@itwin/itwinui-react 1.37.2 → 1.38.1
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/CHANGELOG.md +28 -0
- package/cjs/core/Breadcrumbs/Breadcrumbs.js +3 -5
- package/cjs/core/ColorPicker/ColorSwatch.d.ts +1 -1
- package/cjs/core/ComboBox/ComboBox.d.ts +11 -2
- package/cjs/core/ComboBox/ComboBox.js +135 -245
- package/cjs/core/ComboBox/ComboBoxDropdown.d.ts +8 -0
- package/cjs/core/ComboBox/ComboBoxDropdown.js +55 -0
- package/cjs/core/ComboBox/ComboBoxEndIcon.d.ts +5 -0
- package/cjs/core/ComboBox/ComboBoxEndIcon.js +54 -0
- package/cjs/core/ComboBox/ComboBoxInput.d.ts +5 -0
- package/cjs/core/ComboBox/ComboBoxInput.js +134 -0
- package/cjs/core/ComboBox/ComboBoxInputContainer.d.ts +8 -0
- package/cjs/core/ComboBox/ComboBoxInputContainer.js +45 -0
- package/cjs/core/ComboBox/ComboBoxMenu.d.ts +3 -0
- package/cjs/core/ComboBox/ComboBoxMenu.js +81 -0
- package/cjs/core/ComboBox/ComboBoxMenuItem.d.ts +21 -0
- package/cjs/core/ComboBox/ComboBoxMenuItem.js +64 -0
- package/cjs/core/ComboBox/helpers.d.ts +32 -0
- package/cjs/core/ComboBox/helpers.js +50 -0
- package/cjs/core/Modal/Modal.d.ts +1 -1
- package/cjs/core/Modal/Modal.js +6 -6
- package/cjs/core/Modal/ModalButtonBar.d.ts +1 -1
- package/cjs/core/Modal/ModalButtonBar.js +2 -2
- package/cjs/core/Modal/ModalContent.d.ts +1 -1
- package/cjs/core/Modal/ModalContent.js +2 -2
- package/cjs/core/RadioTiles/RadioTile.d.ts +1 -1
- package/cjs/core/RadioTiles/RadioTile.js +7 -9
- package/cjs/core/Select/Select.js +1 -1
- package/cjs/core/Slider/Thumb.js +15 -1
- package/cjs/core/Slider/Track.js +23 -12
- package/cjs/core/Table/Table.js +2 -2
- package/cjs/core/Table/filters/FilterToggle.js +3 -2
- package/cjs/core/Toast/ToastWrapper.d.ts +7 -5
- package/cjs/core/Toast/ToastWrapper.js +8 -4
- package/cjs/core/Toast/Toaster.d.ts +3 -0
- package/cjs/core/Toast/Toaster.js +30 -5
- package/cjs/core/utils/components/Popover.d.ts +1 -1
- package/cjs/core/utils/components/VirtualScroll.d.ts +35 -1
- package/cjs/core/utils/components/VirtualScroll.js +159 -26
- package/cjs/core/utils/hooks/index.d.ts +1 -0
- package/cjs/core/utils/hooks/index.js +1 -0
- package/cjs/core/utils/hooks/useSafeContext.d.ts +6 -0
- package/cjs/core/utils/hooks/useSafeContext.js +23 -0
- package/esm/core/Breadcrumbs/Breadcrumbs.js +3 -5
- package/esm/core/ColorPicker/ColorSwatch.d.ts +1 -1
- package/esm/core/ComboBox/ComboBox.d.ts +11 -2
- package/esm/core/ComboBox/ComboBox.js +137 -247
- package/esm/core/ComboBox/ComboBoxDropdown.d.ts +8 -0
- package/esm/core/ComboBox/ComboBoxDropdown.js +49 -0
- package/esm/core/ComboBox/ComboBoxEndIcon.d.ts +5 -0
- package/esm/core/ComboBox/ComboBoxEndIcon.js +48 -0
- package/esm/core/ComboBox/ComboBoxInput.d.ts +5 -0
- package/esm/core/ComboBox/ComboBoxInput.js +128 -0
- package/esm/core/ComboBox/ComboBoxInputContainer.d.ts +8 -0
- package/esm/core/ComboBox/ComboBoxInputContainer.js +38 -0
- package/esm/core/ComboBox/ComboBoxMenu.d.ts +3 -0
- package/esm/core/ComboBox/ComboBoxMenu.js +75 -0
- package/esm/core/ComboBox/ComboBoxMenuItem.d.ts +21 -0
- package/esm/core/ComboBox/ComboBoxMenuItem.js +58 -0
- package/esm/core/ComboBox/helpers.d.ts +32 -0
- package/esm/core/ComboBox/helpers.js +43 -0
- package/esm/core/Modal/Modal.d.ts +1 -1
- package/esm/core/Modal/Modal.js +6 -6
- package/esm/core/Modal/ModalButtonBar.d.ts +1 -1
- package/esm/core/Modal/ModalButtonBar.js +2 -2
- package/esm/core/Modal/ModalContent.d.ts +1 -1
- package/esm/core/Modal/ModalContent.js +2 -2
- package/esm/core/RadioTiles/RadioTile.d.ts +1 -1
- package/esm/core/RadioTiles/RadioTile.js +7 -9
- package/esm/core/Select/Select.js +1 -1
- package/esm/core/Slider/Thumb.js +15 -1
- package/esm/core/Slider/Track.js +23 -12
- package/esm/core/Table/Table.js +2 -2
- package/esm/core/Table/filters/FilterToggle.js +3 -2
- package/esm/core/Toast/ToastWrapper.d.ts +7 -5
- package/esm/core/Toast/ToastWrapper.js +8 -3
- package/esm/core/Toast/Toaster.d.ts +3 -0
- package/esm/core/Toast/Toaster.js +30 -5
- package/esm/core/utils/components/Popover.d.ts +1 -1
- package/esm/core/utils/components/VirtualScroll.d.ts +35 -1
- package/esm/core/utils/components/VirtualScroll.js +157 -25
- package/esm/core/utils/hooks/index.d.ts +1 -0
- package/esm/core/utils/hooks/index.js +1 -0
- package/esm/core/utils/hooks/useSafeContext.d.ts +6 -0
- package/esm/core/utils/hooks/useSafeContext.js +16 -0
- package/package.json +5 -33
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.useSafeContext = void 0;
|
|
7
|
+
/*---------------------------------------------------------------------------------------------
|
|
8
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
9
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
10
|
+
*--------------------------------------------------------------------------------------------*/
|
|
11
|
+
var react_1 = __importDefault(require("react"));
|
|
12
|
+
/**
|
|
13
|
+
* Wrapper hook around `useContext` that throws an error if the context is not provided.
|
|
14
|
+
* @param context Context to use. Must have a `displayName` for useful errors.
|
|
15
|
+
*/
|
|
16
|
+
var useSafeContext = function (context) {
|
|
17
|
+
var value = react_1.default.useContext(context);
|
|
18
|
+
if (!value) {
|
|
19
|
+
throw new Error("".concat(context.displayName, " is undefined"));
|
|
20
|
+
}
|
|
21
|
+
return value; // eslint-disable-line @typescript-eslint/no-non-null-assertion -- we already checked for undefined
|
|
22
|
+
};
|
|
23
|
+
exports.useSafeContext = useSafeContext;
|
|
@@ -61,9 +61,7 @@ export var Breadcrumbs = React.forwardRef(function (props, ref) {
|
|
|
61
61
|
var _b;
|
|
62
62
|
var index = _a.index;
|
|
63
63
|
var item = items[index];
|
|
64
|
-
return (React.createElement("li", { className:
|
|
65
|
-
'iui-current': currentIndex === index,
|
|
66
|
-
}) }, React.isValidElement(item)
|
|
64
|
+
return (React.createElement("li", { className: 'iui-breadcrumbs-item iui-breadcrumbs-item-overrides' }, React.isValidElement(item)
|
|
67
65
|
? React.cloneElement(item, {
|
|
68
66
|
'aria-current': ((_b = item.props['aria-current']) !== null && _b !== void 0 ? _b : currentIndex === index)
|
|
69
67
|
? 'location'
|
|
@@ -77,8 +75,8 @@ export var Breadcrumbs = React.forwardRef(function (props, ref) {
|
|
|
77
75
|
React.createElement(ListItem, { index: 0 }),
|
|
78
76
|
React.createElement(Separator, null))),
|
|
79
77
|
items.length - visibleCount > 0 && (React.createElement(React.Fragment, null,
|
|
80
|
-
React.createElement("li", { className: 'iui-breadcrumbs-item' },
|
|
81
|
-
React.createElement("span",
|
|
78
|
+
React.createElement("li", { className: 'iui-breadcrumbs-item iui-breadcrumbs-item-overrides' },
|
|
79
|
+
React.createElement("span", { className: 'iui-breadcrumbs-text' }, "\u2026")),
|
|
82
80
|
React.createElement(Separator, null))),
|
|
83
81
|
items
|
|
84
82
|
.slice(visibleCount > 1
|
|
@@ -17,5 +17,5 @@ export declare type ColorSwatchProps = {
|
|
|
17
17
|
* <ColorSwatch color='#23450b' onClick={onClick}/>
|
|
18
18
|
* <ColorSwatch color={{ r: 255, g: 255, b: 0 }} onClick={onClick}/>
|
|
19
19
|
*/
|
|
20
|
-
export declare const ColorSwatch: React.ForwardRefExoticComponent<Pick<ColorSwatchProps, "dir" | "slot" | "style" | "title" | "id" | "aria-disabled" | "
|
|
20
|
+
export declare const ColorSwatch: React.ForwardRefExoticComponent<Pick<ColorSwatchProps, "dir" | "slot" | "style" | "title" | "id" | "aria-disabled" | "children" | "role" | "className" | "onClick" | "accessKey" | "draggable" | "hidden" | "lang" | "translate" | "prefix" | "contentEditable" | "inputMode" | "tabIndex" | "onFocus" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "color" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "contextMenu" | "placeholder" | "spellCheck" | "radioGroup" | "about" | "datatype" | "inlist" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "is" | "isActive"> & React.RefAttributes<HTMLDivElement>>;
|
|
21
21
|
export default ColorSwatch;
|
|
@@ -40,8 +40,10 @@ export declare type ComboBoxProps<T> = {
|
|
|
40
40
|
emptyStateMessage?: string;
|
|
41
41
|
/**
|
|
42
42
|
* A custom item renderer can be specified to control the rendering.
|
|
43
|
-
*
|
|
44
|
-
*
|
|
43
|
+
*
|
|
44
|
+
* For keyboard navigation to work, the returned element should use the `id` provided by this function.
|
|
45
|
+
* The `isFocused` state is calculated using this `id` and can be used for specifying the focus styling.
|
|
46
|
+
* If a `MenuItem` is returned, then focus styling is automatically handled.
|
|
45
47
|
*/
|
|
46
48
|
itemRenderer?: (option: SelectOption<T>, states: {
|
|
47
49
|
isSelected: boolean;
|
|
@@ -49,6 +51,13 @@ export declare type ComboBoxProps<T> = {
|
|
|
49
51
|
id: string;
|
|
50
52
|
index: number;
|
|
51
53
|
}) => JSX.Element;
|
|
54
|
+
/**
|
|
55
|
+
* If enabled, virtualization is used for the scrollable dropdown list.
|
|
56
|
+
* Use it if you expect a very long list of items.
|
|
57
|
+
* @default false
|
|
58
|
+
* @beta
|
|
59
|
+
*/
|
|
60
|
+
enableVirtualization?: boolean;
|
|
52
61
|
} & Pick<InputContainerProps, 'status'> & Omit<CommonProps, 'title'>;
|
|
53
62
|
/**
|
|
54
63
|
* ComboBox component that allows typing a value to filter the options in dropdown list.
|
|
@@ -26,13 +26,22 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
26
26
|
*--------------------------------------------------------------------------------------------*/
|
|
27
27
|
import React from 'react';
|
|
28
28
|
import cx from 'classnames';
|
|
29
|
-
import {
|
|
30
|
-
import { Menu, MenuExtraContent, MenuItem } from '../Menu';
|
|
29
|
+
import { MenuExtraContent } from '../Menu';
|
|
31
30
|
import { Text } from '../Typography';
|
|
32
|
-
import {
|
|
33
|
-
import SvgCaretDownSmall from '@itwin/itwinui-icons-react/cjs/icons/CaretDownSmall';
|
|
31
|
+
import { useTheme, getRandomValue, mergeRefs, } from '../utils';
|
|
34
32
|
import 'tippy.js/animations/shift-away.css';
|
|
35
|
-
import {
|
|
33
|
+
import { ComboBoxActionContext, comboBoxReducer, ComboBoxRefsContext, ComboBoxStateContext, } from './helpers';
|
|
34
|
+
import { ComboBoxDropdown } from './ComboBoxDropdown';
|
|
35
|
+
import { ComboBoxEndIcon } from './ComboBoxEndIcon';
|
|
36
|
+
import { ComboBoxInput } from './ComboBoxInput';
|
|
37
|
+
import { ComboBoxInputContainer } from './ComboBoxInputContainer';
|
|
38
|
+
import { ComboBoxMenu } from './ComboBoxMenu';
|
|
39
|
+
import { ComboBoxMenuItem } from './ComboBoxMenuItem';
|
|
40
|
+
/** Returns either `option.id` or derives a stable id using `idPrefix` and `option.label` (without whitespace) */
|
|
41
|
+
var getOptionId = function (option, idPrefix) {
|
|
42
|
+
var _a;
|
|
43
|
+
return (_a = option.id) !== null && _a !== void 0 ? _a : "".concat(idPrefix, "-option-").concat(option.label.replace(/\s/g, '-'));
|
|
44
|
+
};
|
|
36
45
|
/**
|
|
37
46
|
* ComboBox component that allows typing a value to filter the options in dropdown list.
|
|
38
47
|
* Values can be selected either using mouse clicks or using the Enter key.
|
|
@@ -47,272 +56,153 @@ import { StatusMessage } from '../StatusMessage';
|
|
|
47
56
|
* />
|
|
48
57
|
*/
|
|
49
58
|
export var ComboBox = function (props) {
|
|
50
|
-
var
|
|
59
|
+
var _a;
|
|
60
|
+
var options = props.options, valueProp = props.value, onChange = props.onChange, filterFunction = props.filterFunction, inputProps = props.inputProps, dropdownMenuProps = props.dropdownMenuProps, _b = props.emptyStateMessage, emptyStateMessage = _b === void 0 ? 'No options found' : _b, itemRenderer = props.itemRenderer, _c = props.enableVirtualization, enableVirtualization = _c === void 0 ? false : _c, rest = __rest(props, ["options", "value", "onChange", "filterFunction", "inputProps", "dropdownMenuProps", "emptyStateMessage", "itemRenderer", "enableVirtualization"]);
|
|
51
61
|
// Generate a stateful random id if not specified
|
|
52
62
|
var id = React.useState(function () {
|
|
53
63
|
var _a, _b;
|
|
54
64
|
return (_b = (_a = props.id) !== null && _a !== void 0 ? _a : ((inputProps === null || inputProps === void 0 ? void 0 : inputProps.id) && "".concat(inputProps.id, "-cb"))) !== null && _b !== void 0 ? _b : "iui-cb-".concat(getRandomValue(10));
|
|
55
65
|
})[0];
|
|
56
66
|
useTheme();
|
|
57
|
-
|
|
58
|
-
var
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}));
|
|
64
|
-
}, [options, id]);
|
|
65
|
-
var userOnChange = React.useRef(onChange);
|
|
67
|
+
// Refs get set in subcomponents
|
|
68
|
+
var inputRef = React.useRef(null);
|
|
69
|
+
var menuRef = React.useRef(null);
|
|
70
|
+
var toggleButtonRef = React.useRef(null);
|
|
71
|
+
// Latest value of the onChange prop
|
|
72
|
+
var onChangeProp = React.useRef(onChange);
|
|
66
73
|
React.useEffect(function () {
|
|
67
|
-
|
|
74
|
+
onChangeProp.current = onChange;
|
|
68
75
|
}, [onChange]);
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
76
|
+
// Record to store all extra information (e.g. original indexes), where the key is the id of the option
|
|
77
|
+
var optionsExtraInfoRef = React.useRef({});
|
|
78
|
+
// Clear the extra info when the options change so that it can be reinitialized below
|
|
79
|
+
React.useEffect(function () {
|
|
80
|
+
optionsExtraInfoRef.current = {};
|
|
81
|
+
}, [options]);
|
|
82
|
+
// Initialize the extra info only if it is not already initialized
|
|
83
|
+
if (options.length > 0 &&
|
|
84
|
+
Object.keys(optionsExtraInfoRef.current).length === 0) {
|
|
85
|
+
options.forEach(function (option, index) {
|
|
86
|
+
optionsExtraInfoRef.current[getOptionId(option, id)] = {
|
|
87
|
+
__originalIndex: index,
|
|
81
88
|
};
|
|
82
|
-
if (itemRenderer) {
|
|
83
|
-
return React.cloneElement(itemRenderer(option, {
|
|
84
|
-
id: getOptionId(index),
|
|
85
|
-
index: index,
|
|
86
|
-
isSelected: false,
|
|
87
|
-
isFocused: false,
|
|
88
|
-
}), additionalProps);
|
|
89
|
-
}
|
|
90
|
-
return (React.createElement(MenuItem, __assign({ id: getOptionId(index), key: getOptionId(index) }, additionalProps, rest), label));
|
|
91
89
|
});
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
var
|
|
95
|
-
|
|
96
|
-
|
|
90
|
+
}
|
|
91
|
+
// Reducer where all the component-wide state is stored
|
|
92
|
+
var _d = React.useReducer(comboBoxReducer, {
|
|
93
|
+
isOpen: false,
|
|
94
|
+
selectedIndex: -1,
|
|
95
|
+
focusedIndex: -1,
|
|
96
|
+
}), _e = _d[0], isOpen = _e.isOpen, selectedIndex = _e.selectedIndex, focusedIndex = _e.focusedIndex, dispatch = _d[1];
|
|
97
|
+
React.useEffect(function () {
|
|
98
|
+
var _a, _b;
|
|
99
|
+
// When the dropdown opens
|
|
100
|
+
if (isOpen) {
|
|
101
|
+
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus(); // Focus the input
|
|
102
|
+
setFilteredOptions(options); // Reset the filtered list
|
|
103
|
+
}
|
|
104
|
+
// When the dropdown closes
|
|
105
|
+
else {
|
|
106
|
+
// Reset the focused index
|
|
107
|
+
dispatch(['focus']);
|
|
108
|
+
// Reset the input value
|
|
109
|
+
setInputValue(selectedIndex != undefined && selectedIndex >= 0
|
|
110
|
+
? (_b = options[selectedIndex]) === null || _b === void 0 ? void 0 : _b.label
|
|
111
|
+
: '');
|
|
112
|
+
}
|
|
113
|
+
}, [isOpen, options, selectedIndex]);
|
|
97
114
|
// Set min-width of menu to be same as input
|
|
98
|
-
var
|
|
115
|
+
var _f = React.useState(0), minWidth = _f[0], setMinWidth = _f[1];
|
|
99
116
|
React.useEffect(function () {
|
|
100
117
|
if (inputRef.current) {
|
|
101
118
|
setMinWidth(inputRef.current.offsetWidth);
|
|
102
119
|
}
|
|
103
120
|
}, [isOpen]);
|
|
104
|
-
|
|
121
|
+
// Initialize filtered options to the latest value options
|
|
122
|
+
var _g = React.useState(options), filteredOptions = _g[0], setFilteredOptions = _g[1];
|
|
105
123
|
React.useEffect(function () {
|
|
106
124
|
setFilteredOptions(options);
|
|
107
125
|
}, [options]);
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
126
|
+
// Filter options based on input value
|
|
127
|
+
var _h = React.useState((_a = inputProps === null || inputProps === void 0 ? void 0 : inputProps.value) !== null && _a !== void 0 ? _a : ''), inputValue = _h[0], setInputValue = _h[1];
|
|
128
|
+
var handleOnInput = React.useCallback(function (event) {
|
|
129
|
+
var _a, _b;
|
|
130
|
+
var value = event.currentTarget.value;
|
|
131
|
+
setInputValue(value);
|
|
132
|
+
dispatch(['open']); // reopen when typing
|
|
133
|
+
setFilteredOptions((_a = filterFunction === null || filterFunction === void 0 ? void 0 : filterFunction(options, value)) !== null && _a !== void 0 ? _a : options.filter(function (option) {
|
|
134
|
+
return option.label.toLowerCase().includes(value.toLowerCase());
|
|
135
|
+
}));
|
|
136
|
+
(_b = inputProps === null || inputProps === void 0 ? void 0 : inputProps.onChange) === null || _b === void 0 ? void 0 : _b.call(inputProps, event);
|
|
137
|
+
}, [filterFunction, inputProps, options]);
|
|
138
|
+
// Reset focused item when filteredOptions change
|
|
113
139
|
React.useEffect(function () {
|
|
114
|
-
|
|
115
|
-
}, [
|
|
116
|
-
//
|
|
117
|
-
var _g = React.useState(''), inputValue = _g[0], setInputValue = _g[1];
|
|
118
|
-
var onInput = React.useCallback(function (event) {
|
|
119
|
-
var _a;
|
|
120
|
-
setInputValue(event.target.value);
|
|
121
|
-
(_a = inputProps === null || inputProps === void 0 ? void 0 : inputProps.onChange) === null || _a === void 0 ? void 0 : _a.call(inputProps, event);
|
|
122
|
-
}, [inputProps]);
|
|
123
|
-
// update inputValue and focusedIndex every time selected value changes
|
|
140
|
+
dispatch(['focus']);
|
|
141
|
+
}, [filteredOptions]);
|
|
142
|
+
// When the value prop changes, update the selectedIndex
|
|
124
143
|
React.useEffect(function () {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
setFocusedIndex(selectedOption ? options.indexOf(selectedOption) : -1);
|
|
132
|
-
}, [selectedValue, options]);
|
|
133
|
-
// Filter options and update focus when input value changes
|
|
144
|
+
dispatch([
|
|
145
|
+
'select',
|
|
146
|
+
options.findIndex(function (option) { return option.value === valueProp; }),
|
|
147
|
+
]);
|
|
148
|
+
}, [options, valueProp]);
|
|
149
|
+
// Call user-defined onChange when the value actually changes
|
|
134
150
|
React.useEffect(function () {
|
|
135
|
-
var _a;
|
|
136
|
-
if (
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
var selectedOption = options.find(function (_a) {
|
|
141
|
-
var value = _a.value;
|
|
142
|
-
return value === selectedValue;
|
|
143
|
-
});
|
|
144
|
-
if (!inputValue || (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.label) === inputValue) {
|
|
145
|
-
setFilteredOptions(options);
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
var _filteredOptions = (_a = filterFunction === null || filterFunction === void 0 ? void 0 : filterFunction(options, inputValue)) !== null && _a !== void 0 ? _a : options.filter(function (option) {
|
|
149
|
-
return option.label.toLowerCase().includes(inputValue === null || inputValue === void 0 ? void 0 : inputValue.trim().toLowerCase());
|
|
150
|
-
});
|
|
151
|
-
setFilteredOptions(_filteredOptions);
|
|
152
|
-
setFocusedIndex(function (previouslyFocusedIndex) {
|
|
153
|
-
if (_filteredOptions.includes(options[previouslyFocusedIndex])) {
|
|
154
|
-
return previouslyFocusedIndex;
|
|
155
|
-
}
|
|
156
|
-
else if (_filteredOptions.find(function (_a) {
|
|
157
|
-
var value = _a.value;
|
|
158
|
-
return value === selectedValue;
|
|
159
|
-
})) {
|
|
160
|
-
return options.findIndex(function (_a) {
|
|
161
|
-
var value = _a.value;
|
|
162
|
-
return value === selectedValue;
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
else {
|
|
166
|
-
return -1; // reset focus if previously focused or selected value is not in filtered list
|
|
151
|
+
var _a, _b;
|
|
152
|
+
if (selectedIndex != undefined && selectedIndex >= 0) {
|
|
153
|
+
var value = (_a = options[selectedIndex]) === null || _a === void 0 ? void 0 : _a.value;
|
|
154
|
+
if (value === valueProp) {
|
|
155
|
+
return;
|
|
167
156
|
}
|
|
168
|
-
|
|
169
|
-
}, [inputValue, options, selectedValue, isOpen, filterFunction]);
|
|
170
|
-
var onKeyDown = React.useCallback(function (event) {
|
|
171
|
-
var _a;
|
|
172
|
-
var focusableOptions = getFocusableElements(menuRef.current);
|
|
173
|
-
var focusedIndexInFilteredList = focusableOptions.findIndex(function (_a) {
|
|
174
|
-
var _b;
|
|
175
|
-
var id = _a.id;
|
|
176
|
-
return id === ((_b = inputRef.current) === null || _b === void 0 ? void 0 : _b.getAttribute('aria-activedescendant'));
|
|
177
|
-
});
|
|
178
|
-
switch (event.key) {
|
|
179
|
-
case 'ArrowDown':
|
|
180
|
-
if (isOpen) {
|
|
181
|
-
var nextIndex_1 = Math.min(focusedIndexInFilteredList + 1, focusableOptions.length - 1);
|
|
182
|
-
setFocusedIndex(options.findIndex(function (_, index) {
|
|
183
|
-
return getOptionId(index) === focusableOptions[nextIndex_1].id;
|
|
184
|
-
}));
|
|
185
|
-
}
|
|
186
|
-
else {
|
|
187
|
-
setIsOpen(true); // reopen menu if closed when typing
|
|
188
|
-
}
|
|
189
|
-
event.preventDefault();
|
|
190
|
-
event.stopPropagation();
|
|
191
|
-
break;
|
|
192
|
-
case 'ArrowUp':
|
|
193
|
-
if (isOpen) {
|
|
194
|
-
var previousIndex_1 = Math.max(focusedIndexInFilteredList - 1, 0);
|
|
195
|
-
setFocusedIndex(options.findIndex(function (_, index) {
|
|
196
|
-
return getOptionId(index) === focusableOptions[previousIndex_1].id;
|
|
197
|
-
}));
|
|
198
|
-
}
|
|
199
|
-
event.preventDefault();
|
|
200
|
-
event.stopPropagation();
|
|
201
|
-
break;
|
|
202
|
-
case 'Enter':
|
|
203
|
-
if (isOpen) {
|
|
204
|
-
setSelectedValue(options[focusedIndex].value);
|
|
205
|
-
(_a = userOnChange.current) === null || _a === void 0 ? void 0 : _a.call(userOnChange, options[focusedIndex].value);
|
|
206
|
-
}
|
|
207
|
-
setIsOpen(function (open) { return !open; });
|
|
208
|
-
event.preventDefault();
|
|
209
|
-
event.stopPropagation();
|
|
210
|
-
break;
|
|
211
|
-
case 'Escape':
|
|
212
|
-
setIsOpen(false);
|
|
213
|
-
event.preventDefault();
|
|
214
|
-
event.stopPropagation();
|
|
215
|
-
break;
|
|
216
|
-
case 'Tab':
|
|
217
|
-
setIsOpen(false);
|
|
218
|
-
break;
|
|
219
|
-
default:
|
|
220
|
-
if (!isOpen) {
|
|
221
|
-
setIsOpen(true); // reopen menu if closed when typing
|
|
222
|
-
}
|
|
223
|
-
break;
|
|
157
|
+
(_b = onChangeProp.current) === null || _b === void 0 ? void 0 : _b.call(onChangeProp, value);
|
|
224
158
|
}
|
|
225
|
-
}, [
|
|
226
|
-
var
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
filteredOptions,
|
|
267
|
-
emptyStateMessage,
|
|
268
|
-
options,
|
|
269
|
-
getOptionId,
|
|
270
|
-
selectedValue,
|
|
271
|
-
focusedIndex,
|
|
272
|
-
itemRenderer,
|
|
273
|
-
memoizedItems,
|
|
274
|
-
]);
|
|
275
|
-
return (React.createElement(InputContainer, __assign({ className: className, status: status, statusMessage: typeof message === 'string' ? (React.createElement(StatusMessage, { status: status }, message)) : (React.isValidElement(message) &&
|
|
276
|
-
React.cloneElement(message, { status: status })) }, rest, { id: id }),
|
|
277
|
-
React.createElement("div", { className: 'iui-input-with-icon' },
|
|
278
|
-
React.createElement(Popover, __assign({ placement: 'bottom-start', visible: isOpen, onClickOutside: function (_, _a) {
|
|
279
|
-
var _b;
|
|
280
|
-
var target = _a.target;
|
|
281
|
-
if (!((_b = toggleButtonRef.current) === null || _b === void 0 ? void 0 : _b.contains(target))) {
|
|
282
|
-
setIsOpen(false);
|
|
283
|
-
}
|
|
284
|
-
}, animation: 'shift-away', duration: 200 }, dropdownMenuProps, { content: React.createElement(Menu, { id: "".concat(id, "-list"), className: 'iui-scroll', style: {
|
|
285
|
-
minWidth: minWidth,
|
|
286
|
-
maxWidth: "min(".concat(minWidth * 2, "px, 90vw)"),
|
|
287
|
-
maxHeight: 300,
|
|
288
|
-
}, setFocus: false, role: 'listbox', ref: menuRef }, menuItems), onHide: function (instance) {
|
|
289
|
-
var _a;
|
|
290
|
-
var selectedIndex = options.findIndex(function (_a) {
|
|
291
|
-
var value = _a.value;
|
|
292
|
-
return value === selectedValue;
|
|
293
|
-
});
|
|
294
|
-
setFocusedIndex(selectedIndex);
|
|
295
|
-
if (selectedIndex > -1) {
|
|
296
|
-
setInputValue(options[selectedIndex].label); // update input value to be same as selected value
|
|
297
|
-
}
|
|
298
|
-
(_a = dropdownMenuProps === null || dropdownMenuProps === void 0 ? void 0 : dropdownMenuProps.onHide) === null || _a === void 0 ? void 0 : _a.call(dropdownMenuProps, instance);
|
|
299
|
-
} }),
|
|
300
|
-
React.createElement(Input, __assign({ ref: inputRef, onKeyDown: onKeyDown, onFocus: function () { return setIsOpen(true); }, value: inputValue, "aria-activedescendant": isOpen && focusedIndex > -1
|
|
301
|
-
? getOptionId(focusedIndex)
|
|
302
|
-
: undefined, role: 'combobox', "aria-controls": isOpen ? "".concat(id, "-list") : undefined, "aria-autocomplete": 'list', spellCheck: false, autoCapitalize: 'none', autoCorrect: 'off' }, inputProps, { onChange: onInput }))),
|
|
303
|
-
React.createElement("span", { ref: toggleButtonRef, className: cx('iui-end-icon', {
|
|
304
|
-
'iui-actionable': !(inputProps === null || inputProps === void 0 ? void 0 : inputProps.disabled),
|
|
305
|
-
'iui-disabled': inputProps === null || inputProps === void 0 ? void 0 : inputProps.disabled,
|
|
306
|
-
'iui-open': isOpen,
|
|
307
|
-
}), onClick: function () {
|
|
308
|
-
var _a;
|
|
309
|
-
if (isOpen) {
|
|
310
|
-
setIsOpen(false);
|
|
311
|
-
}
|
|
312
|
-
else {
|
|
313
|
-
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
314
|
-
}
|
|
159
|
+
}, [options, selectedIndex, valueProp]);
|
|
160
|
+
var getMenuItem = React.useCallback(function (option) {
|
|
161
|
+
var optionId = getOptionId(option, id);
|
|
162
|
+
var __originalIndex = optionsExtraInfoRef.current[optionId].__originalIndex;
|
|
163
|
+
var customItem = itemRenderer
|
|
164
|
+
? itemRenderer(option, {
|
|
165
|
+
isFocused: focusedIndex === __originalIndex,
|
|
166
|
+
isSelected: selectedIndex === __originalIndex,
|
|
167
|
+
index: __originalIndex,
|
|
168
|
+
id: optionId,
|
|
169
|
+
})
|
|
170
|
+
: null;
|
|
171
|
+
return customItem ? (React.cloneElement(customItem, {
|
|
172
|
+
onClick: function (e) {
|
|
173
|
+
var _a, _b;
|
|
174
|
+
dispatch(['select', __originalIndex]);
|
|
175
|
+
(_b = (_a = customItem.props).onClick) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
|
176
|
+
},
|
|
177
|
+
// ComboBox.MenuItem handles scrollIntoView, data-iui-index and iui-focused through context
|
|
178
|
+
// but we still need to pass them here for backwards compatibility with MenuItem
|
|
179
|
+
className: cx(customItem.props.className, {
|
|
180
|
+
'iui-focused': focusedIndex === __originalIndex,
|
|
181
|
+
}),
|
|
182
|
+
'data-iui-index': __originalIndex,
|
|
183
|
+
ref: mergeRefs(customItem.props.ref, function (el) {
|
|
184
|
+
if (!enableVirtualization && focusedIndex === __originalIndex) {
|
|
185
|
+
el === null || el === void 0 ? void 0 : el.scrollIntoView({ block: 'nearest' });
|
|
186
|
+
}
|
|
187
|
+
}),
|
|
188
|
+
})) : (React.createElement(ComboBoxMenuItem, __assign({ key: optionId, id: optionId }, option, { isSelected: selectedIndex === __originalIndex, onClick: function () { return dispatch(['select', __originalIndex]); }, index: __originalIndex }), option.label));
|
|
189
|
+
}, [enableVirtualization, focusedIndex, id, itemRenderer, selectedIndex]);
|
|
190
|
+
return (React.createElement(ComboBoxRefsContext.Provider, { value: { inputRef: inputRef, menuRef: menuRef, toggleButtonRef: toggleButtonRef, optionsExtraInfoRef: optionsExtraInfoRef } },
|
|
191
|
+
React.createElement(ComboBoxActionContext.Provider, { value: dispatch },
|
|
192
|
+
React.createElement(ComboBoxStateContext.Provider, { value: {
|
|
193
|
+
id: id,
|
|
194
|
+
minWidth: minWidth,
|
|
195
|
+
isOpen: isOpen,
|
|
196
|
+
focusedIndex: focusedIndex,
|
|
197
|
+
enableVirtualization: enableVirtualization,
|
|
198
|
+
filteredOptions: filteredOptions,
|
|
199
|
+
getMenuItem: getMenuItem,
|
|
315
200
|
} },
|
|
316
|
-
React.createElement(
|
|
201
|
+
React.createElement(ComboBoxInputContainer, __assign({ disabled: inputProps === null || inputProps === void 0 ? void 0 : inputProps.disabled }, rest),
|
|
202
|
+
React.createElement(ComboBoxInput, __assign({ value: inputValue }, inputProps, { onChange: handleOnInput })),
|
|
203
|
+
React.createElement(ComboBoxEndIcon, { disabled: inputProps === null || inputProps === void 0 ? void 0 : inputProps.disabled, isOpen: isOpen })),
|
|
204
|
+
React.createElement(ComboBoxDropdown, __assign({}, dropdownMenuProps),
|
|
205
|
+
React.createElement(ComboBoxMenu, null, filteredOptions.length > 0 && !enableVirtualization ? (filteredOptions.map(getMenuItem)) : (React.createElement(MenuExtraContent, null,
|
|
206
|
+
React.createElement(Text, { isMuted: true }, emptyStateMessage)))))))));
|
|
317
207
|
};
|
|
318
208
|
export default ComboBox;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const ComboBoxDropdown: React.ForwardRefExoticComponent<Pick<{
|
|
3
|
+
visible?: boolean | undefined;
|
|
4
|
+
trigger?: string | undefined;
|
|
5
|
+
placement?: import("@popperjs/core").Placement | undefined;
|
|
6
|
+
} & Omit<import("@tippyjs/react").TippyProps, "placement" | "trigger" | "visible"> & {
|
|
7
|
+
children: JSX.Element;
|
|
8
|
+
}, "disabled" | "children" | "placement" | "trigger" | "visible" | "content" | "render" | "animateFill" | "appendTo" | "aria" | "delay" | "duration" | "followCursor" | "getReferenceClientRect" | "hideOnClick" | "ignoreAttributes" | "inlinePositioning" | "interactive" | "interactiveBorder" | "interactiveDebounce" | "moveTransition" | "offset" | "plugins" | "popperOptions" | "showOnCreate" | "sticky" | "touch" | "triggerTarget" | "onAfterUpdate" | "onBeforeUpdate" | "onCreate" | "onDestroy" | "onHidden" | "onHide" | "onMount" | "onShow" | "onShown" | "onTrigger" | "onUntrigger" | "onClickOutside" | "allowHTML" | "animation" | "arrow" | "inertia" | "maxWidth" | "role" | "theme" | "zIndex" | "className" | "singleton" | "reference"> & React.RefAttributes<Element>>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
/*---------------------------------------------------------------------------------------------
|
|
24
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
25
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
26
|
+
*--------------------------------------------------------------------------------------------*/
|
|
27
|
+
import React from 'react';
|
|
28
|
+
import { Popover, useSafeContext } from '../utils';
|
|
29
|
+
import { ComboBoxStateContext, ComboBoxActionContext, ComboBoxRefsContext, } from './helpers';
|
|
30
|
+
export var ComboBoxDropdown = React.forwardRef(function (props, forwardedRef) {
|
|
31
|
+
var children = props.children, rest = __rest(props, ["children"]);
|
|
32
|
+
var isOpen = useSafeContext(ComboBoxStateContext).isOpen;
|
|
33
|
+
var dispatch = useSafeContext(ComboBoxActionContext);
|
|
34
|
+
var _a = useSafeContext(ComboBoxRefsContext), inputRef = _a.inputRef, toggleButtonRef = _a.toggleButtonRef;
|
|
35
|
+
// sync internal isOpen state with user's visible prop
|
|
36
|
+
React.useEffect(function () {
|
|
37
|
+
if (props.visible != undefined) {
|
|
38
|
+
dispatch([props.visible ? 'open' : 'close']);
|
|
39
|
+
}
|
|
40
|
+
}, [dispatch, props.visible]);
|
|
41
|
+
return (React.createElement(Popover, __assign({ placement: 'bottom-start', visible: isOpen, onClickOutside: React.useCallback(function (_, _a) {
|
|
42
|
+
var _b;
|
|
43
|
+
var target = _a.target;
|
|
44
|
+
if (!((_b = toggleButtonRef.current) === null || _b === void 0 ? void 0 : _b.contains(target))) {
|
|
45
|
+
dispatch(['close']);
|
|
46
|
+
}
|
|
47
|
+
}, [dispatch, toggleButtonRef]), animation: 'shift-away', duration: 200, reference: inputRef, ref: forwardedRef, content: children }, rest)));
|
|
48
|
+
});
|
|
49
|
+
ComboBoxDropdown.displayName = 'ComboBoxDropdown';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const ComboBoxEndIcon: React.ForwardRefExoticComponent<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "key" | keyof React.HTMLAttributes<HTMLSpanElement>> & {
|
|
3
|
+
disabled?: boolean | undefined;
|
|
4
|
+
isOpen?: boolean | undefined;
|
|
5
|
+
} & React.RefAttributes<HTMLSpanElement>>;
|