@elliemae/ds-form 2.0.0-rc.1 → 2.0.0-rc.13
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/cjs/ComboBox/v1/DSComboBox.js +18 -22
- package/cjs/ComboBox/v1/withSelectStringValueConverter.js +3 -4
- package/cjs/ComboBox/v3/ComboBox.js +1 -2
- package/cjs/ComboBox/v3/ComboBoxCTX.js +22 -15
- package/cjs/ComboBox/v3/ComboboxDataTestids.js +3 -1
- package/cjs/ComboBox/v3/config/useComboBox.js +65 -21
- package/cjs/ComboBox/v3/parts/container/Container.js +28 -18
- package/cjs/ComboBox/v3/parts/controls/Controls.js +3 -1
- package/cjs/ComboBox/v3/parts/controls/styled.js +30 -8
- package/cjs/ComboBox/v3/parts/controls-input/ControlsInput.js +5 -3
- package/cjs/ComboBox/v3/parts/controls-input/styled.js +1 -1
- package/cjs/ComboBox/v3/parts/controls-input/useControlsInput.js +19 -21
- package/cjs/ComboBox/v3/parts/dropdown-indicator/DropdownIndicator.js +0 -3
- package/cjs/ComboBox/v3/parts/dropdown-indicator/styled.js +1 -1
- package/cjs/ComboBox/v3/parts/header-list/HeaderList.js +61 -37
- package/cjs/ComboBox/v3/parts/header-list/styled.js +31 -8
- package/cjs/ComboBox/v3/parts/header-list/useHeaderListHandlers.js +73 -0
- package/cjs/ComboBox/v3/parts/menu-list/MenuList.js +32 -18
- package/cjs/ComboBox/v3/parts/menu-list/styled.js +17 -2
- package/cjs/ComboBox/v3/parts/menu-list/useItemRenderer.js +105 -0
- package/cjs/ComboBox/v3/parts/menu-list/useMenuList.js +42 -85
- package/cjs/ComboBox/v3/parts/multi-selected-values-container/MultiSelectedValuesContainer.js +26 -35
- package/cjs/ComboBox/v3/parts/multi-selected-values-container/useGroupPills.js +10 -6
- package/cjs/ComboBox/v3/propTypes.js +15 -11
- package/cjs/ComboBox/v3/utils/hooks/useKeyboardNavigation.js +28 -30
- package/cjs/ComboBox/v3/utils/hooks/useOnElementResize.js +4 -4
- package/cjs/FloatingLabelInput/FloatingLabelInputImpl.js +4 -7
- package/cjs/FormItem/ValidationFieldWrapper.js +2 -3
- package/cjs/Input/InputAddonWrapper.js +2 -3
- package/cjs/Input/InputImpl.js +16 -18
- package/cjs/InputGroup/AddonWrapper.js +4 -6
- package/cjs/InputMask/DSInputMaskDeprecated.js +10 -12
- package/cjs/MenuItem/components/MenuItem/index.js +1 -1
- package/cjs/MenuItem/components/MultiMenuItem/MultiMenuItem.js +1 -0
- package/cjs/MenuItem/components/Section/index.js +1 -1
- package/cjs/MenuItem/components/Section/styled.js +1 -1
- package/cjs/MenuItem/components/Separator/styled.js +2 -2
- package/cjs/MenuItem/components/SingleMenuItem/SingleMenuItem.js +6 -6
- package/cjs/MenuItem/components/SubmenuItem/index.js +1 -1
- package/cjs/MenuItem/components/styled.js +12 -4
- package/cjs/SearchBox/withSearchable.js +3 -5
- package/cjs/Toggle/DSToggleImpl.js +28 -28
- package/esm/ComboBox/v1/DSComboBox.js +17 -21
- package/esm/ComboBox/v1/withSelectStringValueConverter.js +3 -4
- package/esm/ComboBox/v3/ComboBox.js +1 -2
- package/esm/ComboBox/v3/ComboBoxCTX.js +17 -10
- package/esm/ComboBox/v3/ComboboxDataTestids.js +3 -1
- package/esm/ComboBox/v3/config/useComboBox.js +62 -22
- package/esm/ComboBox/v3/parts/container/Container.js +29 -19
- package/esm/ComboBox/v3/parts/controls/Controls.js +3 -1
- package/esm/ComboBox/v3/parts/controls/styled.js +30 -9
- package/esm/ComboBox/v3/parts/controls-input/ControlsInput.js +5 -3
- package/esm/ComboBox/v3/parts/controls-input/styled.js +1 -1
- package/esm/ComboBox/v3/parts/controls-input/useControlsInput.js +20 -22
- package/esm/ComboBox/v3/parts/dropdown-indicator/DropdownIndicator.js +0 -3
- package/esm/ComboBox/v3/parts/dropdown-indicator/styled.js +1 -1
- package/esm/ComboBox/v3/parts/header-list/HeaderList.js +63 -39
- package/esm/ComboBox/v3/parts/header-list/styled.js +28 -8
- package/esm/ComboBox/v3/parts/header-list/useHeaderListHandlers.js +69 -0
- package/esm/ComboBox/v3/parts/menu-list/MenuList.js +35 -21
- package/esm/ComboBox/v3/parts/menu-list/styled.js +17 -3
- package/esm/ComboBox/v3/parts/menu-list/useItemRenderer.js +97 -0
- package/esm/ComboBox/v3/parts/menu-list/useMenuList.js +43 -82
- package/esm/ComboBox/v3/parts/multi-selected-values-container/MultiSelectedValuesContainer.js +26 -35
- package/esm/ComboBox/v3/parts/multi-selected-values-container/useGroupPills.js +10 -6
- package/esm/ComboBox/v3/propTypes.js +15 -11
- package/esm/ComboBox/v3/utils/hooks/useKeyboardNavigation.js +28 -30
- package/esm/ComboBox/v3/utils/hooks/useOnElementResize.js +4 -4
- package/esm/FloatingLabelInput/FloatingLabelInputImpl.js +4 -7
- package/esm/FormItem/ValidationFieldWrapper.js +2 -3
- package/esm/Input/InputAddonWrapper.js +2 -3
- package/esm/Input/InputImpl.js +15 -17
- package/esm/InputGroup/AddonWrapper.js +5 -7
- package/esm/InputMask/DSInputMaskDeprecated.js +10 -12
- package/esm/MenuItem/components/MenuItem/index.js +1 -1
- package/esm/MenuItem/components/MultiMenuItem/MultiMenuItem.js +1 -0
- package/esm/MenuItem/components/Section/index.js +1 -1
- package/esm/MenuItem/components/Section/styled.js +1 -1
- package/esm/MenuItem/components/Separator/styled.js +2 -2
- package/esm/MenuItem/components/SingleMenuItem/SingleMenuItem.js +6 -6
- package/esm/MenuItem/components/SubmenuItem/index.js +1 -1
- package/esm/MenuItem/components/styled.js +13 -6
- package/esm/SearchBox/withSearchable.js +2 -4
- package/esm/Toggle/DSToggleImpl.js +28 -28
- package/package.json +40 -27
- package/types/Checkbox/DSCheckbox.d.ts +78 -13
- package/types/Checkbox/elements/CheckMark.d.ts +1 -1
- package/types/Checkbox/props.d.ts +58 -12
- package/types/CheckboxGroup/DSCheckboxGroup.d.ts +51 -7
- package/types/CheckboxGroup/props.d.ts +37 -6
- package/types/ComboBox/v2/Combobox.d.ts +56 -1
- package/types/ComboBox/v3/ComboBox.d.ts +54 -12
- package/types/ComboBox/v3/ComboboxDataTestids.d.ts +2 -0
- package/types/ComboBox/v3/parts/a11y-messages/styled.d.ts +1 -1
- package/types/ComboBox/v3/parts/container/styled.d.ts +3 -3
- package/types/ComboBox/v3/parts/controls/styled.d.ts +5 -5
- package/types/ComboBox/v3/parts/controls-input/styled.d.ts +4 -4
- package/types/ComboBox/v3/parts/controls-input/useControlsInput.d.ts +3 -3
- package/types/ComboBox/v3/parts/dropdown-indicator/styled.d.ts +1 -60
- package/types/ComboBox/v3/parts/empty-state/styled.d.ts +2 -2
- package/types/ComboBox/v3/parts/header-list/styled.d.ts +7 -93
- package/types/ComboBox/v3/parts/header-list/useHeaderListHandlers.d.ts +12 -0
- package/types/ComboBox/v3/parts/menu-list/styled.d.ts +9 -3
- package/types/ComboBox/v3/parts/menu-list/useItemRenderer.d.ts +2 -0
- package/types/ComboBox/v3/parts/menu-list/useMenuList.d.ts +1 -1
- package/types/ComboBox/v3/parts/multi-selected-values-container/styled.d.ts +3 -3
- package/types/ComboBox/v3/parts/multi-selected-values-container/useGroupPills.d.ts +1 -2
- package/types/ComboBox/v3/parts/single-selected-value-container/styled.d.ts +1 -1
- package/types/ComboBox/v3/propTypes.d.ts +49 -11
- package/types/ComboBox/v3/tests/combobox-special-keys.test.d.ts +1 -0
- package/types/ComboBox/v3/tests/utils.d.ts +5 -0
- package/types/ComboBox/v3/utils/hooks/useKeyboardNavigation.d.ts +4 -1
- package/types/ComboBox/v3/utils/listHelper.d.ts +1 -1
- package/types/DateInput/DSDateInput.d.ts +97 -16
- package/types/DateInput/props.d.ts +97 -16
- package/types/DateInputV2/components/DSDateInput.d.ts +72 -5
- package/types/DateInputV2/components/props.d.ts +61 -10
- package/types/DateInputV2/components/styled.d.ts +4 -4
- package/types/FloatingLabelInput/DSFloatingLabelInput.d.ts +118 -20
- package/types/FormItem/DSFormItemLayout.d.ts +390 -60
- package/types/FormItem/Error/DSError.d.ts +21 -3
- package/types/FormItem/Suffix/Suffix.d.ts +3 -3
- package/types/FormItem/defaultProps.d.ts +118 -20
- package/types/FormItem/props.d.ts +229 -39
- package/types/InputGroup/DSInputGroup.d.ts +56 -8
- package/types/InputGroup/props.d.ts +43 -7
- package/types/InputMask/DSInputMask.d.ts +172 -30
- package/types/InputMask/mask_types/DateInputMask.d.ts +34 -33
- package/types/InputMask/mask_types/DateTimeInputMask.d.ts +34 -33
- package/types/InputMask/mask_types/DictionaryInputMask.d.ts +37 -36
- package/types/InputMask/mask_types/NumberInputMask.d.ts +46 -45
- package/types/InputMask/mask_types/PhoneInputMask.d.ts +34 -33
- package/types/InputMask/mask_types/PhoneInternationalInputMask.d.ts +34 -33
- package/types/InputMask/mask_types/SsnInputMask.d.ts +34 -33
- package/types/InputMask/mask_types/UsZipCodeInputMask.d.ts +34 -33
- package/types/InputMask/mask_types/ZipCodeSearchInputMask.d.ts +34 -33
- package/types/InputMask/props.d.ts +172 -30
- package/types/InputProtected/DSInputProtected.d.ts +56 -7
- package/types/InputProtected/props.d.ts +43 -8
- package/types/LargeInputText/DSLargeInputText.d.ts +163 -27
- package/types/LargeInputText/props.d.ts +163 -27
- package/types/MenuItem/components/MenuItem/index.d.ts +12 -3
- package/types/MenuItem/components/MenuItem/styled.d.ts +1 -1
- package/types/MenuItem/components/MultiMenuItem/MultiMenuItem.d.ts +12 -3
- package/types/MenuItem/components/MultiMenuItem/styled.d.ts +1 -1
- package/types/MenuItem/components/Section/index.d.ts +4 -1
- package/types/MenuItem/components/Section/props.d.ts +4 -1
- package/types/MenuItem/components/Section/styled.d.ts +2 -2
- package/types/MenuItem/components/Separator/styled.d.ts +2 -2
- package/types/MenuItem/components/SingleMenuItem/SingleMenuItem.d.ts +7 -2
- package/types/MenuItem/components/SubmenuItem/index.d.ts +12 -3
- package/types/MenuItem/components/SubmenuItem/styled.d.ts +2 -2
- package/types/MenuItem/components/styled.d.ts +3 -3
- package/types/MenuItem/props.d.ts +7 -2
- package/types/Radio/Circle.d.ts +1 -1
- package/types/Radio/DSRadio.d.ts +79 -13
- package/types/RadioGroup/DSRadioGroup.d.ts +51 -7
- package/types/RadioGroup/props.d.ts +37 -6
- package/types/SearchBox/DSSearchBox.d.ts +146 -21
- package/types/SearchBox/NavSearchBox.d.ts +18 -3
- package/types/SearchBox/SButton.d.ts +13 -2
- package/types/SearchBox/props.d.ts +133 -22
- package/types/SearchBox/styled.d.ts +1 -49
- package/types/TextBox/DSTextBox.d.ts +146 -21
- package/types/TimeInput/DSTimeInput.d.ts +83 -12
- package/types/TimeInput/utils.d.ts +1 -1
- package/types/Toggle/DSToggle.d.ts +84 -12
- package/cjs/ComboBox/v3/utils/hooks/useOnWindowResize.js +0 -31
- package/cjs/MenuItem/components/SingleMenuItem/styled.js +0 -19
- package/esm/ComboBox/v3/utils/hooks/useOnWindowResize.js +0 -27
- package/esm/MenuItem/components/SingleMenuItem/styled.js +0 -10
- package/types/ComboBox/v3/utils/hooks/useOnWindowResize.d.ts +0 -5
- package/types/MenuItem/components/SingleMenuItem/styled.d.ts +0 -2
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
5
6
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
7
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
7
|
-
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
8
8
|
require('core-js/modules/esnext.async-iterator.map.js');
|
|
9
9
|
require('core-js/modules/esnext.iterator.map.js');
|
|
10
10
|
require('core-js/modules/web.dom-collections.iterator.js');
|
|
@@ -37,9 +37,9 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
37
37
|
|
|
38
38
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
39
39
|
|
|
40
|
+
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
40
41
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
41
42
|
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
|
|
42
|
-
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
43
43
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
44
44
|
var Select__default = /*#__PURE__*/_interopDefaultLegacy(Select);
|
|
45
45
|
|
|
@@ -67,36 +67,32 @@ const getValues = (option, isMulti, valueProperty) => {
|
|
|
67
67
|
class DSComboBox extends React__default["default"].Component {
|
|
68
68
|
constructor(props) {
|
|
69
69
|
super(props);
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
_defineProperty__default["default"](this, "isHover", undefined);
|
|
74
|
-
|
|
75
|
-
_defineProperty__default["default"](this, "handleHover", lodash.debounce(value => {
|
|
70
|
+
this.forceFocus = false;
|
|
71
|
+
this.isHover = undefined;
|
|
72
|
+
this.handleHover = lodash.debounce(value => {
|
|
76
73
|
if (this.state.isHover === this.isHover) return;
|
|
77
74
|
if (!this.unmount) this.setState({
|
|
78
75
|
isHover: value
|
|
79
76
|
});
|
|
80
|
-
}, 0)
|
|
81
|
-
|
|
82
|
-
_defineProperty__default["default"](this, "state", {
|
|
77
|
+
}, 0);
|
|
78
|
+
this.state = {
|
|
83
79
|
focus: null,
|
|
84
80
|
isHover: undefined
|
|
85
|
-
}
|
|
81
|
+
};
|
|
86
82
|
|
|
87
|
-
|
|
83
|
+
this.handleOutsideScroll = () => {
|
|
88
84
|
if (this.isHover !== true && !this.unmount) {
|
|
89
85
|
this.isHover = false;
|
|
90
86
|
this.handleHover(false);
|
|
91
87
|
}
|
|
92
|
-
}
|
|
88
|
+
};
|
|
93
89
|
|
|
94
|
-
|
|
90
|
+
this.handleHoverRef = value => {
|
|
95
91
|
this.isHover = value;
|
|
96
92
|
this.handleHover(value);
|
|
97
|
-
}
|
|
93
|
+
};
|
|
98
94
|
|
|
99
|
-
|
|
95
|
+
this.onKeyDownClear = e => {
|
|
100
96
|
// if (e.key === 'ArrowRight') {
|
|
101
97
|
// this.arrow.focus()
|
|
102
98
|
// } else if (e.key === 'ArrowLeft') {
|
|
@@ -105,9 +101,9 @@ class DSComboBox extends React__default["default"].Component {
|
|
|
105
101
|
if (e.keyCode === 32 || e.keyCode === 13) {
|
|
106
102
|
this.select.focus();
|
|
107
103
|
}
|
|
108
|
-
}
|
|
104
|
+
};
|
|
109
105
|
|
|
110
|
-
|
|
106
|
+
this.handleKeyDown = e => {
|
|
111
107
|
// if (e.key === 'ArrowRight') e.preventDefault()
|
|
112
108
|
// if (e.target.type === 'text' && e.key === 'ArrowRight') {
|
|
113
109
|
// if (this.clear && this.clear.focus) {
|
|
@@ -127,7 +123,7 @@ class DSComboBox extends React__default["default"].Component {
|
|
|
127
123
|
if (!value && e.key === ' ') e.preventDefault();
|
|
128
124
|
this.props.onKeyDown(e);
|
|
129
125
|
};
|
|
130
|
-
}
|
|
126
|
+
};
|
|
131
127
|
|
|
132
128
|
this.clear = /*#__PURE__*/React__default["default"].createRef();
|
|
133
129
|
this.arrow = /*#__PURE__*/React__default["default"].createRef();
|
|
@@ -338,9 +334,9 @@ class DSComboBox extends React__default["default"].Component {
|
|
|
338
334
|
|
|
339
335
|
}
|
|
340
336
|
|
|
341
|
-
|
|
337
|
+
DSComboBox.defaultProps = {
|
|
342
338
|
showAllOption: false
|
|
343
|
-
}
|
|
339
|
+
};
|
|
344
340
|
var DSComboBox$1 = withSelectStringValueConverter(reactMeasure.withContentRect('bounds')(DSComboBox));
|
|
345
341
|
|
|
346
342
|
Object.defineProperty(exports, 'components', {
|
|
@@ -50,8 +50,7 @@ const withSelectStringValueConverter = WrappedComponent => {
|
|
|
50
50
|
return _temp = _class = class extends React.Component {
|
|
51
51
|
constructor() {
|
|
52
52
|
super(...arguments);
|
|
53
|
-
|
|
54
|
-
_defineProperty__default["default"](this, "state", {});
|
|
53
|
+
this.state = {};
|
|
55
54
|
}
|
|
56
55
|
|
|
57
56
|
static getDerivedStateFromProps(nextProps, prevState) {
|
|
@@ -74,10 +73,10 @@ const withSelectStringValueConverter = WrappedComponent => {
|
|
|
74
73
|
}));
|
|
75
74
|
}
|
|
76
75
|
|
|
77
|
-
},
|
|
76
|
+
}, _class.defaultProps = {
|
|
78
77
|
valueProperty: 'value',
|
|
79
78
|
labelProperty: 'label'
|
|
80
|
-
}
|
|
79
|
+
}, _temp;
|
|
81
80
|
};
|
|
82
81
|
|
|
83
82
|
module.exports = withSelectStringValueConverter;
|
|
@@ -18,9 +18,8 @@ var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
|
18
18
|
var _Container;
|
|
19
19
|
|
|
20
20
|
const DSComboBox = props => {
|
|
21
|
-
// if we detect wrong props configuration we throw meaningful errors
|
|
22
21
|
const propsWithDefault = dsPropsHelpers.useMemoMergePropsWithDefault(props, ComboBoxCTX.defaultProps);
|
|
23
|
-
dsPropsHelpers.useValidateTypescriptPropTypes(propsWithDefault,
|
|
22
|
+
dsPropsHelpers.useValidateTypescriptPropTypes(propsWithDefault, propTypes.propTypes);
|
|
24
23
|
const ctx = useComboBox.useComboBox(props);
|
|
25
24
|
return /*#__PURE__*/_jsx__default["default"](ComboBoxCTX.ComboBoxContext.Provider, {
|
|
26
25
|
value: ctx
|
|
@@ -3,41 +3,48 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var React = require('react');
|
|
6
|
+
var lodash = require('lodash');
|
|
6
7
|
|
|
7
8
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
8
|
-
const noop = () => {};
|
|
9
|
-
|
|
10
9
|
const defaultProps = {
|
|
11
10
|
placeholder: '',
|
|
12
11
|
options: [],
|
|
13
12
|
selectedValues: null,
|
|
14
|
-
onChange: noop,
|
|
15
|
-
onClear: noop,
|
|
16
13
|
hasError: false,
|
|
17
14
|
inline: false,
|
|
18
15
|
autoFocus: false,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
startPlacementPreference: 'bottom-start',
|
|
17
|
+
placementOrderPreference: ['bottom-start', 'bottom-end'],
|
|
18
|
+
onClearAll: lodash.noop,
|
|
19
|
+
onSelectAll: lodash.noop,
|
|
20
|
+
onCreate: lodash.noop,
|
|
21
|
+
withToggle: false,
|
|
22
|
+
onChange: lodash.noop,
|
|
23
|
+
onKeyDown: lodash.noop,
|
|
24
|
+
onFilter: lodash.noop,
|
|
25
|
+
onMenuOpen: lodash.noop
|
|
23
26
|
};
|
|
24
27
|
const defaultContext = {
|
|
25
28
|
props: defaultProps,
|
|
26
29
|
showPopover: false,
|
|
27
|
-
setShowPopover: noop,
|
|
28
|
-
scrollOptionIntoView: noop,
|
|
29
|
-
referenceElement:
|
|
30
|
+
setShowPopover: lodash.noop,
|
|
31
|
+
scrollOptionIntoView: lodash.noop,
|
|
32
|
+
referenceElement: null,
|
|
30
33
|
hasFocus: false,
|
|
31
|
-
setHasFocus: noop,
|
|
32
|
-
|
|
34
|
+
setHasFocus: lodash.noop,
|
|
35
|
+
pillGroupRef: /*#__PURE__*/React.createRef(),
|
|
36
|
+
setReferenceElement: lodash.noop,
|
|
33
37
|
inputRef: /*#__PURE__*/React.createRef(),
|
|
34
38
|
listRef: /*#__PURE__*/React.createRef(),
|
|
39
|
+
wrapperListRef: /*#__PURE__*/React.createRef(),
|
|
35
40
|
controlsWrapperRef: /*#__PURE__*/React.createRef(),
|
|
36
41
|
selectedOptionsRef: /*#__PURE__*/React.createRef(),
|
|
37
42
|
showSelectedValue: false,
|
|
38
|
-
setShowSelectedValue: noop,
|
|
43
|
+
setShowSelectedValue: lodash.noop,
|
|
39
44
|
focusOptionIdx: '',
|
|
40
|
-
setCurrentOption: noop
|
|
45
|
+
setCurrentOption: lodash.noop,
|
|
46
|
+
showSelectedOptions: false,
|
|
47
|
+
setShowSelectedOptions: lodash.noop
|
|
41
48
|
};
|
|
42
49
|
/** Context for cross component communication */
|
|
43
50
|
|
|
@@ -9,7 +9,9 @@ const ComboboxDataTestid = {
|
|
|
9
9
|
SELECT_ALL_BUTTON: 'combobox-all-btn',
|
|
10
10
|
CLEAR_ALL_BUTTON: 'combobox-clear-btn',
|
|
11
11
|
DROPDOWN: 'combobox-dropdown-btn',
|
|
12
|
-
OPTION: 'combobox-option'
|
|
12
|
+
OPTION: 'combobox-option',
|
|
13
|
+
SHOW_ALL_BUTTON: 'combobox-show-all-btn',
|
|
14
|
+
SHOW_SELECTED_OPTIONS_BUTTON: 'combobox-selected-options-btn'
|
|
13
15
|
};
|
|
14
16
|
|
|
15
17
|
exports.ComboboxDataTestid = ComboboxDataTestid;
|
|
@@ -2,44 +2,82 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
5
6
|
require('core-js/modules/web.dom-collections.iterator.js');
|
|
7
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
8
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
10
|
+
require('core-js/modules/esnext.async-iterator.find.js');
|
|
11
|
+
require('core-js/modules/esnext.iterator.find.js');
|
|
12
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
13
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
6
14
|
var React = require('react');
|
|
7
15
|
var reactVirtual = require('react-virtual');
|
|
8
16
|
var useGetPropsWithDefault = require('./useGetPropsWithDefault.js');
|
|
9
17
|
|
|
10
|
-
|
|
11
|
-
|
|
18
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
19
|
+
|
|
20
|
+
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
21
|
+
|
|
22
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
12
23
|
|
|
24
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
25
|
+
const useComboBox = props => {
|
|
13
26
|
const [showPopover, setShowPopover] = React.useState(false);
|
|
14
|
-
const [referenceElement, setReferenceElement] = React.useState();
|
|
27
|
+
const [referenceElement, setReferenceElement] = React.useState(null);
|
|
15
28
|
const [showSelectedValue, setShowSelectedValue] = React.useState(false);
|
|
29
|
+
const [showSelectedOptions, setShowSelectedOptions] = React.useState(false);
|
|
16
30
|
const [hasFocus, setHasFocus] = React.useState(false);
|
|
17
31
|
const [focusOptionIdx, setCurrentOption] = React.useState('');
|
|
18
|
-
const inputRef = React.useRef();
|
|
19
|
-
const listRef = React.useRef();
|
|
20
|
-
const
|
|
21
|
-
const
|
|
32
|
+
const inputRef = React.useRef(null);
|
|
33
|
+
const listRef = React.useRef(null);
|
|
34
|
+
const wrapperListRef = React.useRef(null);
|
|
35
|
+
const selectedOptionsRef = React.useRef(null);
|
|
36
|
+
const controlsWrapperRef = React.useRef(null);
|
|
37
|
+
const pillGroupRef = React.useRef(null);
|
|
22
38
|
const propsWithDefaults = useGetPropsWithDefault.useGetComboBoxWithDefaultsProps(props);
|
|
23
39
|
const {
|
|
24
|
-
options
|
|
40
|
+
options,
|
|
41
|
+
selectedValues
|
|
25
42
|
} = propsWithDefaults; // ---------------------------------------------------------------------------
|
|
26
|
-
//
|
|
43
|
+
// Menu Options with/out selected filter
|
|
27
44
|
// ---------------------------------------------------------------------------
|
|
28
45
|
|
|
29
|
-
React.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
46
|
+
const selectedValuesWithSections = React.useCallback(() => {
|
|
47
|
+
var _items2;
|
|
48
|
+
|
|
49
|
+
const multiSelectedValue = selectedValues;
|
|
50
|
+
const items = [];
|
|
51
|
+
options.forEach(option => {
|
|
52
|
+
const isSelectedValue = multiSelectedValue.find(item => item.dsId === option.dsId);
|
|
53
|
+
|
|
54
|
+
if (isSelectedValue) {
|
|
55
|
+
items.push(option);
|
|
34
56
|
}
|
|
35
|
-
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
36
57
|
|
|
37
|
-
|
|
58
|
+
if (option.type === 'section') {
|
|
59
|
+
var _items;
|
|
60
|
+
|
|
61
|
+
if (((_items = items[items.length - 1]) === null || _items === void 0 ? void 0 : _items.type) === 'section') {
|
|
62
|
+
items[items.length - 1] = option;
|
|
63
|
+
} else {
|
|
64
|
+
items.push(option);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
if (((_items2 = items[items.length - 1]) === null || _items2 === void 0 ? void 0 : _items2.type) === 'section') {
|
|
70
|
+
items.pop();
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return items;
|
|
74
|
+
}, [options, selectedValues]);
|
|
75
|
+
const correctOptions = React.useMemo(() => showSelectedOptions && Array.isArray(selectedValues) && selectedValues.length > 0 ? selectedValuesWithSections() : options, [options, selectedValuesWithSections, selectedValues, showSelectedOptions]); // ===========================================================================
|
|
38
76
|
// Virtualization setup
|
|
39
77
|
// ===========================================================================
|
|
40
78
|
|
|
41
79
|
const virtualListHelpers = reactVirtual.useVirtual({
|
|
42
|
-
size:
|
|
80
|
+
size: correctOptions.length,
|
|
43
81
|
parentRef: listRef,
|
|
44
82
|
overscan: 15,
|
|
45
83
|
paddingStart: 0
|
|
@@ -51,10 +89,12 @@ const useComboBox = props => {
|
|
|
51
89
|
let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
52
90
|
align: 'center'
|
|
53
91
|
};
|
|
54
|
-
virtualListHelpers.scrollToIndex(
|
|
55
|
-
}, [
|
|
92
|
+
virtualListHelpers.scrollToIndex(correctOptions.findIndex(opt => opt.dsId === dsId), opts);
|
|
93
|
+
}, [correctOptions, virtualListHelpers]);
|
|
56
94
|
const ctx = React.useMemo(() => ({
|
|
57
|
-
props: propsWithDefaults,
|
|
95
|
+
props: _objectSpread(_objectSpread({}, propsWithDefaults), {}, {
|
|
96
|
+
options: correctOptions
|
|
97
|
+
}),
|
|
58
98
|
virtualListHelpers,
|
|
59
99
|
showPopover,
|
|
60
100
|
referenceElement,
|
|
@@ -65,13 +105,17 @@ const useComboBox = props => {
|
|
|
65
105
|
selectedOptionsRef,
|
|
66
106
|
controlsWrapperRef,
|
|
67
107
|
hasFocus,
|
|
108
|
+
pillGroupRef,
|
|
109
|
+
showSelectedOptions,
|
|
110
|
+
wrapperListRef,
|
|
111
|
+
setShowSelectedOptions,
|
|
68
112
|
setHasFocus,
|
|
69
113
|
setCurrentOption,
|
|
70
114
|
scrollOptionIntoView,
|
|
71
115
|
setShowSelectedValue,
|
|
72
116
|
setReferenceElement,
|
|
73
117
|
setShowPopover
|
|
74
|
-
}), [scrollOptionIntoView, propsWithDefaults, virtualListHelpers, focusOptionIdx, showSelectedValue, showPopover, referenceElement, inputRef, selectedOptionsRef, controlsWrapperRef, hasFocus, listRef]);
|
|
118
|
+
}), [scrollOptionIntoView, correctOptions, propsWithDefaults, virtualListHelpers, focusOptionIdx, showSelectedValue, wrapperListRef, showSelectedOptions, showPopover, pillGroupRef, referenceElement, inputRef, selectedOptionsRef, controlsWrapperRef, hasFocus, listRef]);
|
|
75
119
|
return ctx;
|
|
76
120
|
};
|
|
77
121
|
|
|
@@ -20,7 +20,9 @@ var _Controls, _MenuList, _MenuList2;
|
|
|
20
20
|
const Container = () => {
|
|
21
21
|
const {
|
|
22
22
|
props: {
|
|
23
|
-
inline
|
|
23
|
+
inline,
|
|
24
|
+
startPlacementPreference,
|
|
25
|
+
placementOrderPreference
|
|
24
26
|
},
|
|
25
27
|
showPopover,
|
|
26
28
|
inputRef,
|
|
@@ -30,28 +32,36 @@ const Container = () => {
|
|
|
30
32
|
} = React.useContext(ComboBoxCTX.ComboBoxContext);
|
|
31
33
|
const handleCloseMenu = React.useCallback(() => {
|
|
32
34
|
setShowPopover(false);
|
|
33
|
-
inputRef.current.blur();
|
|
35
|
+
if (inputRef.current) inputRef.current.blur();
|
|
34
36
|
}, [inputRef, setShowPopover]);
|
|
35
37
|
const handleMouseDown = React.useCallback(e => {
|
|
36
38
|
e.preventDefault();
|
|
37
39
|
}, []);
|
|
40
|
+
const handleOnClickContainer = React.useCallback(() => {
|
|
41
|
+
setShowPopover(!showPopover);
|
|
42
|
+
}, [setShowPopover, showPopover]);
|
|
38
43
|
const StyledContainer = inline ? styled.StyledContainerInline : styled.StyledContainerWithPopper;
|
|
39
|
-
return /*#__PURE__*/
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
44
|
+
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
45
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs(StyledContainer, {
|
|
46
|
+
ref: setReferenceElement,
|
|
47
|
+
onClick: handleOnClickContainer,
|
|
48
|
+
children: [_Controls || (_Controls = /*#__PURE__*/_jsx__default["default"](Controls.Controls, {})), inline ? _MenuList || (_MenuList = /*#__PURE__*/_jsx__default["default"](MenuList.MenuList, {})) : null]
|
|
49
|
+
}), !inline ? /*#__PURE__*/_jsx__default["default"](dsPopperjs.DSPopperJS, {
|
|
50
|
+
customOffset: [0, 5],
|
|
51
|
+
closeContextMenu: handleCloseMenu,
|
|
52
|
+
referenceElement: referenceElement,
|
|
53
|
+
showPopover: showPopover,
|
|
54
|
+
startPlacementPreference: startPlacementPreference,
|
|
55
|
+
placementOrderPreference: placementOrderPreference,
|
|
56
|
+
withoutPortal: true,
|
|
57
|
+
withoutArrow: true,
|
|
58
|
+
withoutAnimation: true,
|
|
59
|
+
zIndex: 10
|
|
60
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"](styled.StyledPopperWrapper, {
|
|
61
|
+
tabIndex: -1,
|
|
62
|
+
onMouseDown: handleMouseDown
|
|
63
|
+
}, void 0, _MenuList2 || (_MenuList2 = /*#__PURE__*/_jsx__default["default"](MenuList.MenuList, {})))) : null]
|
|
64
|
+
});
|
|
55
65
|
};
|
|
56
66
|
|
|
57
67
|
exports.Container = Container;
|
|
@@ -23,6 +23,7 @@ const Controls = () => {
|
|
|
23
23
|
const {
|
|
24
24
|
props: {
|
|
25
25
|
inline,
|
|
26
|
+
inputMinWidth,
|
|
26
27
|
hasError,
|
|
27
28
|
selectedValues
|
|
28
29
|
},
|
|
@@ -49,10 +50,11 @@ const Controls = () => {
|
|
|
49
50
|
}
|
|
50
51
|
};
|
|
51
52
|
|
|
52
|
-
const cols = !inline ? ['minmax(0px,max-content)', 'minmax(
|
|
53
|
+
const cols = !inline ? ['minmax(0px,max-content)', 'minmax(20px, auto)', '29px'] : ['minmax(0px, auto)'];
|
|
53
54
|
return /*#__PURE__*/jsxRuntime.jsxs(styled.StyledControlsWrapper, {
|
|
54
55
|
ref: controlsWrapperRef,
|
|
55
56
|
cols: cols,
|
|
57
|
+
minWidth: inputMinWidth,
|
|
56
58
|
hasError: hasError,
|
|
57
59
|
hasFocus: hasFocus,
|
|
58
60
|
inline: inline,
|
|
@@ -2,33 +2,55 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var _taggedTemplateLiteral = require('@babel/runtime/helpers/taggedTemplateLiteral');
|
|
5
6
|
var styled = require('styled-components');
|
|
7
|
+
var dsSystem = require('@elliemae/ds-system');
|
|
6
8
|
var Grid = require('@elliemae/ds-grid');
|
|
7
9
|
|
|
8
10
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
9
11
|
|
|
12
|
+
var _taggedTemplateLiteral__default = /*#__PURE__*/_interopDefaultLegacy(_taggedTemplateLiteral);
|
|
10
13
|
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
11
14
|
|
|
15
|
+
var _templateObject, _templateObject2;
|
|
16
|
+
const normalBorder = dsSystem.css(_templateObject || (_templateObject = _taggedTemplateLiteral__default["default"](["\n border: 1px solid\n ", ";\n"])), props => {
|
|
17
|
+
if (props.hasError) {
|
|
18
|
+
return props.theme.colors.danger[900];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return props.theme.colors.neutral[400];
|
|
22
|
+
});
|
|
23
|
+
const focusBorder = dsSystem.css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral__default["default"](["\n border: 2px solid ", ";\n"])), _ref => {
|
|
24
|
+
let {
|
|
25
|
+
theme
|
|
26
|
+
} = _ref;
|
|
27
|
+
return theme.colors.brand[700];
|
|
28
|
+
});
|
|
12
29
|
const StyledControlsWrapper = /*#__PURE__*/styled__default["default"](Grid.Grid).withConfig({
|
|
13
30
|
componentId: "sc-64uci7-0"
|
|
14
|
-
})(["background:transparent;position:relative;border:
|
|
31
|
+
})(["background:transparent;position:relative;border-radius:2px;min-width:", ";align-items:center;align-content:center;height:28px;padding-left:8px;margin:", ";&::after{display:block;content:' ';position:absolute;top:0;left:0;right:0;bottom:0;border-radius:2px;", " pointer-events:none;z-index:7;}"], _ref2 => {
|
|
15
32
|
let {
|
|
33
|
+
minWidth,
|
|
16
34
|
inline
|
|
17
|
-
} =
|
|
35
|
+
} = _ref2;
|
|
36
|
+
return inline ? '' : "".concat(minWidth, "px");
|
|
37
|
+
}, _ref3 => {
|
|
38
|
+
let {
|
|
39
|
+
inline
|
|
40
|
+
} = _ref3;
|
|
18
41
|
return inline ? '10px 16px' : 'none';
|
|
19
|
-
},
|
|
20
|
-
const focusMixin = /*#__PURE__*/styled.css(["&::after{display:block;content:' ';position:absolute;top:0;left:0;right:0;bottom:0;border:2px solid ", ";pointer-events:none;z-index:7;}"], _ref2 => {
|
|
42
|
+
}, _ref4 => {
|
|
21
43
|
let {
|
|
22
|
-
|
|
23
|
-
} =
|
|
24
|
-
return
|
|
44
|
+
hasFocus
|
|
45
|
+
} = _ref4;
|
|
46
|
+
return hasFocus ? focusBorder : normalBorder;
|
|
25
47
|
});
|
|
26
48
|
const StyledSelection = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
27
49
|
componentId: "sc-64uci7-1"
|
|
28
50
|
})(["font-size:13px;margin-right:3px;line-height:13px;display:flex;"]);
|
|
29
51
|
const StyledHeaderActionsWrapper = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
30
52
|
componentId: "sc-64uci7-2"
|
|
31
|
-
})(["align-items:center;align-self:stretch;display:flex;box-sizing:border-box;height:
|
|
53
|
+
})(["align-items:center;align-self:stretch;display:flex;box-sizing:border-box;height:28px;.em-ds-button--text:focus::after{border:none;}"]);
|
|
32
54
|
const StyleDropdownIndicator = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
33
55
|
componentId: "sc-64uci7-3"
|
|
34
56
|
})([""]);
|
|
@@ -25,9 +25,11 @@ const ControlsInput = () => {
|
|
|
25
25
|
focusOptionIdx,
|
|
26
26
|
inputRef
|
|
27
27
|
} = React.useContext(ComboBoxCTX.ComboBoxContext);
|
|
28
|
-
const onInputKeyDown = useKeyboardNavigation.useKeyboardNavigation();
|
|
29
28
|
const {
|
|
30
|
-
|
|
29
|
+
onInputKeyDown
|
|
30
|
+
} = useKeyboardNavigation.useKeyboardNavigation();
|
|
31
|
+
const {
|
|
32
|
+
spanReference,
|
|
31
33
|
width,
|
|
32
34
|
spanReferenceText,
|
|
33
35
|
showPlaceholder,
|
|
@@ -36,7 +38,7 @@ const ControlsInput = () => {
|
|
|
36
38
|
handleOnFocus
|
|
37
39
|
} = useControlsInput.useControlsInput();
|
|
38
40
|
return /*#__PURE__*/_jsx__default["default"](styled.StyledInputWrapper, {}, void 0, /*#__PURE__*/jsxRuntime.jsx(styled.StyledInputWidthReference, {
|
|
39
|
-
ref:
|
|
41
|
+
ref: spanReference,
|
|
40
42
|
children: spanReferenceText
|
|
41
43
|
}), /*#__PURE__*/_jsx__default["default"](styled.StyledInputPlaceHolder, {}, void 0, /*#__PURE__*/_jsx__default["default"](DSTruncatedTooltipText.SimpleTruncatedTooltipText, {
|
|
42
44
|
value: showPlaceholder
|
|
@@ -10,7 +10,7 @@ var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
|
10
10
|
|
|
11
11
|
const StyledInput = /*#__PURE__*/styled__default["default"].input.withConfig({
|
|
12
12
|
componentId: "sc-1ue5xik-0"
|
|
13
|
-
})(["font-size:13px;line-height:13px;border:none;padding:0;outline:none;&:focus{outline:none;}"]);
|
|
13
|
+
})(["font-size:13px;line-height:13px;border:none;padding:0;outline:none;color:", ";&:focus{outline:none;}"], props => props.theme.colors.neutral[700]);
|
|
14
14
|
const StyledInputPlaceHolder = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
15
15
|
componentId: "sc-1ue5xik-1"
|
|
16
16
|
})(["font-style:italic;color:", ";position:absolute;display:flex;align-items:center;width:100%;user-select:none;height:28px;"], props => props.theme.colors.neutral[500]);
|
|
@@ -14,23 +14,23 @@ const useControlsInput = () => {
|
|
|
14
14
|
const {
|
|
15
15
|
props: {
|
|
16
16
|
selectedValues,
|
|
17
|
-
options,
|
|
18
17
|
placeholder,
|
|
19
18
|
onFilter
|
|
20
19
|
},
|
|
21
20
|
setShowPopover,
|
|
22
21
|
setCurrentOption,
|
|
23
22
|
inputRef,
|
|
24
|
-
|
|
23
|
+
wrapperListRef,
|
|
25
24
|
setHasFocus,
|
|
26
|
-
setShowSelectedValue
|
|
25
|
+
setShowSelectedValue,
|
|
26
|
+
setShowSelectedOptions
|
|
27
27
|
} = React.useContext(ComboBoxCTX.ComboBoxContext);
|
|
28
|
-
const [width, setWidth] = React.useState();
|
|
29
|
-
const
|
|
28
|
+
const [width, setWidth] = React.useState(1);
|
|
29
|
+
const spanReference = React.useRef(null);
|
|
30
30
|
React.useEffect(() => {
|
|
31
|
-
var
|
|
31
|
+
var _spanReference$curren;
|
|
32
32
|
|
|
33
|
-
setWidth(((
|
|
33
|
+
setWidth(((_spanReference$curren = spanReference.current) === null || _spanReference$curren === void 0 ? void 0 : _spanReference$curren.offsetWidth) || 1);
|
|
34
34
|
}, [(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.value]);
|
|
35
35
|
React.useEffect(() => {
|
|
36
36
|
setShowSelectedValue(true);
|
|
@@ -38,31 +38,29 @@ const useControlsInput = () => {
|
|
|
38
38
|
// and refresh selected values and update filter outside value.
|
|
39
39
|
|
|
40
40
|
const handleOnChange = React.useCallback(e => {
|
|
41
|
-
|
|
41
|
+
setShowSelectedOptions(false);
|
|
42
|
+
if (e.currentTarget.value) setShowSelectedValue(false);
|
|
42
43
|
setShowPopover(true);
|
|
43
|
-
onFilter(e.
|
|
44
|
-
}, [onFilter, setShowPopover, setShowSelectedValue]);
|
|
44
|
+
onFilter(e.currentTarget.value);
|
|
45
|
+
}, [onFilter, setShowPopover, setShowSelectedOptions, setShowSelectedValue]);
|
|
45
46
|
const handleOnBlur = React.useCallback(() => {
|
|
47
|
+
setHasFocus(false);
|
|
46
48
|
setTimeout(() => {
|
|
47
|
-
var
|
|
49
|
+
var _wrapperListRef$curre;
|
|
48
50
|
|
|
49
|
-
if (!(
|
|
51
|
+
if (!(wrapperListRef !== null && wrapperListRef !== void 0 && (_wrapperListRef$curre = wrapperListRef.current) !== null && _wrapperListRef$curre !== void 0 && _wrapperListRef$curre.contains(document.activeElement))) {
|
|
50
52
|
setShowPopover(false);
|
|
51
53
|
}
|
|
52
54
|
|
|
53
55
|
setCurrentOption('');
|
|
54
|
-
setHasFocus(false);
|
|
55
56
|
setShowSelectedValue(true);
|
|
56
57
|
onFilter('');
|
|
57
58
|
if (inputRef.current) inputRef.current.value = '';
|
|
58
|
-
}
|
|
59
|
-
}, [setHasFocus, setCurrentOption,
|
|
59
|
+
});
|
|
60
|
+
}, [setHasFocus, setCurrentOption, wrapperListRef, onFilter, inputRef, setShowPopover, setShowSelectedValue]);
|
|
60
61
|
const handleOnFocus = React.useCallback(() => {
|
|
61
62
|
setHasFocus(true);
|
|
62
|
-
|
|
63
|
-
const firstItem = listHelper.findInCircularList(options, -1, opt => !['section', 'separator'].includes(opt.type));
|
|
64
|
-
setCurrentOption(options[firstItem] ? options[firstItem].dsId : '');
|
|
65
|
-
}, [setHasFocus, options, setCurrentOption, setShowPopover]);
|
|
63
|
+
}, [setHasFocus]);
|
|
66
64
|
const showPlaceholder = !((_inputRef$current2 = inputRef.current) !== null && _inputRef$current2 !== void 0 && _inputRef$current2.value) && listHelper.isSelectedValueEmpty(selectedValues) ? placeholder : null;
|
|
67
65
|
const spanReferenceText = (_inputRef$current3 = inputRef.current) === null || _inputRef$current3 === void 0 ? void 0 : _inputRef$current3.value.replace(/\s/g, '\u00a0');
|
|
68
66
|
return React.useMemo(() => ({
|
|
@@ -72,8 +70,8 @@ const useControlsInput = () => {
|
|
|
72
70
|
showPlaceholder,
|
|
73
71
|
spanReferenceText,
|
|
74
72
|
width,
|
|
75
|
-
|
|
76
|
-
}), [handleOnFocus, handleOnBlur, handleOnChange, spanReferenceText, showPlaceholder, width,
|
|
73
|
+
spanReference
|
|
74
|
+
}), [handleOnFocus, handleOnBlur, handleOnChange, spanReferenceText, showPlaceholder, width, spanReference]);
|
|
77
75
|
};
|
|
78
76
|
|
|
79
77
|
exports.useControlsInput = useControlsInput;
|
|
@@ -25,9 +25,6 @@ const DropdownIndicator = () => {
|
|
|
25
25
|
"aria-expanded": showPopover,
|
|
26
26
|
"aria-haspopup": "listbox",
|
|
27
27
|
buttonType: "text",
|
|
28
|
-
style: {
|
|
29
|
-
height: '100%'
|
|
30
|
-
},
|
|
31
28
|
icon: _ChevronSmallDown || (_ChevronSmallDown = /*#__PURE__*/_jsx__default["default"](ChevronSmallDown__default["default"], {})),
|
|
32
29
|
tabIndex: -1
|
|
33
30
|
});
|
|
@@ -12,6 +12,6 @@ var DSButton__default = /*#__PURE__*/_interopDefaultLegacy(DSButton);
|
|
|
12
12
|
|
|
13
13
|
const StyledDropDownButton = /*#__PURE__*/styled__default["default"](DSButton__default["default"]).withConfig({
|
|
14
14
|
componentId: "sc-1ijoe1w-0"
|
|
15
|
-
})([""]);
|
|
15
|
+
})(["box-sizing:border-box;width:100;& svg{fill:", ";}"], props => props.theme.colors.brand['700']);
|
|
16
16
|
|
|
17
17
|
exports.StyledDropDownButton = StyledDropDownButton;
|