@elliemae/ds-form 2.0.0-rc.7 → 2.0.1-rc.0
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/ComboBoxCTX.js +16 -17
- package/cjs/ComboBox/v3/config/useComboBox.js +6 -6
- package/cjs/ComboBox/v3/parts/container/Container.js +1 -1
- package/cjs/ComboBox/v3/parts/controls-input/ControlsInput.js +5 -3
- package/cjs/ComboBox/v3/parts/controls-input/useControlsInput.js +8 -8
- package/cjs/ComboBox/v3/parts/header-list/HeaderList.js +5 -3
- package/cjs/ComboBox/v3/parts/menu-list/MenuList.js +7 -8
- package/cjs/ComboBox/v3/parts/menu-list/styled.js +8 -4
- package/cjs/ComboBox/v3/parts/menu-list/useItemRenderer.js +10 -9
- package/cjs/ComboBox/v3/utils/hooks/useKeyboardNavigation.js +5 -5
- 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/SearchBox/NavSearchBox.js +5 -1
- 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/ComboBoxCTX.js +5 -6
- package/esm/ComboBox/v3/config/useComboBox.js +6 -6
- package/esm/ComboBox/v3/parts/container/Container.js +1 -1
- package/esm/ComboBox/v3/parts/controls-input/ControlsInput.js +5 -3
- package/esm/ComboBox/v3/parts/controls-input/useControlsInput.js +8 -8
- package/esm/ComboBox/v3/parts/header-list/HeaderList.js +5 -3
- package/esm/ComboBox/v3/parts/menu-list/MenuList.js +8 -9
- package/esm/ComboBox/v3/parts/menu-list/styled.js +8 -4
- package/esm/ComboBox/v3/parts/menu-list/useItemRenderer.js +10 -9
- package/esm/ComboBox/v3/utils/hooks/useKeyboardNavigation.js +5 -5
- 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/SearchBox/NavSearchBox.js +5 -1
- package/esm/SearchBox/withSearchable.js +2 -4
- package/esm/Toggle/DSToggleImpl.js +28 -28
- package/package.json +31 -23
- package/types/Checkbox/DSCheckbox.d.ts +78 -13
- 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 -16
- 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/header-list/styled.d.ts +4 -208
- package/types/ComboBox/v3/parts/menu-list/styled.d.ts +4 -3
- package/types/ComboBox/v3/parts/menu-list/useItemRenderer.d.ts +1 -1
- package/types/ComboBox/v3/propTypes.d.ts +49 -15
- 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/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/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/MultiMenuItem/MultiMenuItem.d.ts +12 -3
- package/types/MenuItem/components/Section/index.d.ts +4 -1
- package/types/MenuItem/components/Section/props.d.ts +4 -1
- package/types/MenuItem/components/SingleMenuItem/SingleMenuItem.d.ts +7 -2
- package/types/MenuItem/components/SubmenuItem/index.d.ts +12 -3
- package/types/MenuItem/props.d.ts +7 -2
- 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/index.d.ts +1 -1
- 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/esm/ComboBox/v3/utils/hooks/useOnWindowResize.js +0 -27
- package/types/ComboBox/v3/utils/hooks/useOnWindowResize.d.ts +0 -5
|
@@ -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;
|
|
@@ -3,10 +3,9 @@
|
|
|
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: [],
|
|
@@ -16,36 +15,36 @@ const defaultProps = {
|
|
|
16
15
|
autoFocus: false,
|
|
17
16
|
startPlacementPreference: 'bottom-start',
|
|
18
17
|
placementOrderPreference: ['bottom-start', 'bottom-end'],
|
|
19
|
-
onClearAll:
|
|
20
|
-
onSelectAll:
|
|
21
|
-
onCreate:
|
|
18
|
+
onClearAll: lodash.noop,
|
|
19
|
+
onSelectAll: lodash.noop,
|
|
20
|
+
onCreate: lodash.noop,
|
|
22
21
|
withToggle: false,
|
|
23
|
-
onChange: noop,
|
|
24
|
-
onKeyDown: noop,
|
|
25
|
-
onFilter: noop,
|
|
26
|
-
onMenuOpen: noop
|
|
22
|
+
onChange: lodash.noop,
|
|
23
|
+
onKeyDown: lodash.noop,
|
|
24
|
+
onFilter: lodash.noop,
|
|
25
|
+
onMenuOpen: lodash.noop
|
|
27
26
|
};
|
|
28
27
|
const defaultContext = {
|
|
29
28
|
props: defaultProps,
|
|
30
29
|
showPopover: false,
|
|
31
|
-
setShowPopover: noop,
|
|
32
|
-
scrollOptionIntoView: noop,
|
|
33
|
-
referenceElement:
|
|
30
|
+
setShowPopover: lodash.noop,
|
|
31
|
+
scrollOptionIntoView: lodash.noop,
|
|
32
|
+
referenceElement: null,
|
|
34
33
|
hasFocus: false,
|
|
35
|
-
setHasFocus: noop,
|
|
34
|
+
setHasFocus: lodash.noop,
|
|
36
35
|
pillGroupRef: /*#__PURE__*/React.createRef(),
|
|
37
|
-
setReferenceElement: noop,
|
|
36
|
+
setReferenceElement: lodash.noop,
|
|
38
37
|
inputRef: /*#__PURE__*/React.createRef(),
|
|
39
38
|
listRef: /*#__PURE__*/React.createRef(),
|
|
40
39
|
wrapperListRef: /*#__PURE__*/React.createRef(),
|
|
41
40
|
controlsWrapperRef: /*#__PURE__*/React.createRef(),
|
|
42
41
|
selectedOptionsRef: /*#__PURE__*/React.createRef(),
|
|
43
42
|
showSelectedValue: false,
|
|
44
|
-
setShowSelectedValue: noop,
|
|
43
|
+
setShowSelectedValue: lodash.noop,
|
|
45
44
|
focusOptionIdx: '',
|
|
46
|
-
setCurrentOption: noop,
|
|
45
|
+
setCurrentOption: lodash.noop,
|
|
47
46
|
showSelectedOptions: false,
|
|
48
|
-
setShowSelectedOptions: noop
|
|
47
|
+
setShowSelectedOptions: lodash.noop
|
|
49
48
|
};
|
|
50
49
|
/** Context for cross component communication */
|
|
51
50
|
|
|
@@ -24,16 +24,16 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
24
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
25
|
const useComboBox = props => {
|
|
26
26
|
const [showPopover, setShowPopover] = React.useState(false);
|
|
27
|
-
const [referenceElement, setReferenceElement] = React.useState();
|
|
27
|
+
const [referenceElement, setReferenceElement] = React.useState(null);
|
|
28
28
|
const [showSelectedValue, setShowSelectedValue] = React.useState(false);
|
|
29
29
|
const [showSelectedOptions, setShowSelectedOptions] = React.useState(false);
|
|
30
30
|
const [hasFocus, setHasFocus] = React.useState(false);
|
|
31
31
|
const [focusOptionIdx, setCurrentOption] = React.useState('');
|
|
32
|
-
const inputRef = React.useRef();
|
|
33
|
-
const listRef = React.useRef();
|
|
34
|
-
const wrapperListRef = React.useRef();
|
|
35
|
-
const selectedOptionsRef = React.useRef();
|
|
36
|
-
const controlsWrapperRef = React.useRef();
|
|
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
37
|
const pillGroupRef = React.useRef(null);
|
|
38
38
|
const propsWithDefaults = useGetPropsWithDefault.useGetComboBoxWithDefaultsProps(props);
|
|
39
39
|
const {
|
|
@@ -32,7 +32,7 @@ const Container = () => {
|
|
|
32
32
|
} = React.useContext(ComboBoxCTX.ComboBoxContext);
|
|
33
33
|
const handleCloseMenu = React.useCallback(() => {
|
|
34
34
|
setShowPopover(false);
|
|
35
|
-
inputRef.current.blur();
|
|
35
|
+
if (inputRef.current) inputRef.current.blur();
|
|
36
36
|
}, [inputRef, setShowPopover]);
|
|
37
37
|
const handleMouseDown = React.useCallback(e => {
|
|
38
38
|
e.preventDefault();
|
|
@@ -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
|
|
@@ -25,12 +25,12 @@ const useControlsInput = () => {
|
|
|
25
25
|
setShowSelectedValue,
|
|
26
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);
|
|
@@ -39,9 +39,9 @@ const useControlsInput = () => {
|
|
|
39
39
|
|
|
40
40
|
const handleOnChange = React.useCallback(e => {
|
|
41
41
|
setShowSelectedOptions(false);
|
|
42
|
-
if (e.
|
|
42
|
+
if (e.currentTarget.value) setShowSelectedValue(false);
|
|
43
43
|
setShowPopover(true);
|
|
44
|
-
onFilter(e.
|
|
44
|
+
onFilter(e.currentTarget.value);
|
|
45
45
|
}, [onFilter, setShowPopover, setShowSelectedOptions, setShowSelectedValue]);
|
|
46
46
|
const handleOnBlur = React.useCallback(() => {
|
|
47
47
|
setHasFocus(false);
|
|
@@ -70,8 +70,8 @@ const useControlsInput = () => {
|
|
|
70
70
|
showPlaceholder,
|
|
71
71
|
spanReferenceText,
|
|
72
72
|
width,
|
|
73
|
-
|
|
74
|
-
}), [handleOnFocus, handleOnBlur, handleOnChange, spanReferenceText, showPlaceholder, width,
|
|
73
|
+
spanReference
|
|
74
|
+
}), [handleOnFocus, handleOnBlur, handleOnChange, spanReferenceText, showPlaceholder, width, spanReference]);
|
|
75
75
|
};
|
|
76
76
|
|
|
77
77
|
exports.useControlsInput = useControlsInput;
|
|
@@ -32,6 +32,8 @@ const HeaderList = () => {
|
|
|
32
32
|
showSelectedOptions,
|
|
33
33
|
inputRef
|
|
34
34
|
} = React.useContext(ComboBoxCTX.ComboBoxContext);
|
|
35
|
+
const isSelectAllSupplied = onSelectAll !== lodash.noop;
|
|
36
|
+
const isClearAllSupplied = onClearAll !== lodash.noop;
|
|
35
37
|
const multiSelectedValues = selectedValues;
|
|
36
38
|
const selectableOptions = listHelper.getSelectableOptions(options);
|
|
37
39
|
const {
|
|
@@ -46,7 +48,7 @@ const HeaderList = () => {
|
|
|
46
48
|
return /*#__PURE__*/_jsx__default["default"](styled.StyledHeaderListWrapper, {
|
|
47
49
|
onKeyDown: handleKeyDown,
|
|
48
50
|
onMouseDown: handleOnMouseDown
|
|
49
|
-
}, void 0, /*#__PURE__*/_jsx__default["default"](styled.StyledSelectedItems, {}, void 0,
|
|
51
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"](styled.StyledSelectedItems, {}, void 0, isSelectAllSupplied && /*#__PURE__*/_jsx__default["default"](styled.StyledButton, {
|
|
50
52
|
disabled: (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.value) !== '' || selectableOptions.length === multiSelectedValues.length,
|
|
51
53
|
"data-testid": ComboboxDataTestids.ComboboxDataTestid.SELECT_ALL_BUTTON,
|
|
52
54
|
buttonType: "text",
|
|
@@ -55,12 +57,12 @@ const HeaderList = () => {
|
|
|
55
57
|
onMouseDown: handleOnMouseDown,
|
|
56
58
|
onBlur: handleOnBlurSelectAll,
|
|
57
59
|
onClick: handleClickOnSelectAll
|
|
58
|
-
}),
|
|
60
|
+
}), isSelectAllSupplied && isClearAllSupplied && (_StyledSeparator || (_StyledSeparator = /*#__PURE__*/_jsx__default["default"](styled.StyledSeparator, {
|
|
59
61
|
orientation: "vertical",
|
|
60
62
|
position: "center",
|
|
61
63
|
type: "group-level",
|
|
62
64
|
margin: "none"
|
|
63
|
-
}))),
|
|
65
|
+
}))), isClearAllSupplied && /*#__PURE__*/_jsx__default["default"](styled.StyledButton, {
|
|
64
66
|
disabled: multiSelectedValues.length === 0,
|
|
65
67
|
tabIndex: 0,
|
|
66
68
|
"data-testid": ComboboxDataTestids.ComboboxDataTestid.CLEAR_ALL_BUTTON,
|
|
@@ -41,14 +41,14 @@ const MenuList = () => {
|
|
|
41
41
|
} = React.useContext(ComboBoxCTX.ComboBoxContext);
|
|
42
42
|
const multiple = Array.isArray(selectedValues);
|
|
43
43
|
const withHeader = !inline && multiple && options.length > 0;
|
|
44
|
-
const
|
|
45
|
-
ItemRenderer
|
|
46
|
-
} = useItemRenderer.useItemRenderer();
|
|
44
|
+
const ItemRenderer = useItemRenderer.useItemRenderer();
|
|
47
45
|
useMenuList.useMenuList();
|
|
48
46
|
useOnElementResize.useOnElementResize(controlsWrapperRef);
|
|
49
|
-
const listWidth = menuMinWidth || "".concat(referenceElement === null || referenceElement === void 0 ? void 0 : referenceElement.offsetWidth);
|
|
47
|
+
const listWidth = React.useMemo(() => menuMinWidth || "".concat(referenceElement === null || referenceElement === void 0 ? void 0 : referenceElement.offsetWidth), [menuMinWidth, referenceElement]);
|
|
50
48
|
const handleOnFocus = React.useCallback(() => {
|
|
51
|
-
|
|
49
|
+
var _inputRef$current;
|
|
50
|
+
|
|
51
|
+
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus();
|
|
52
52
|
}, [inputRef]);
|
|
53
53
|
return /*#__PURE__*/jsxRuntime.jsxs(styled.StyledListWrapper, {
|
|
54
54
|
tabIndex: -1,
|
|
@@ -60,11 +60,10 @@ const MenuList = () => {
|
|
|
60
60
|
role: "listbox",
|
|
61
61
|
children: [withHeader && (_HeaderList || (_HeaderList = /*#__PURE__*/_jsx__default["default"](HeaderList.HeaderList, {}))), options.length > 0 ? /*#__PURE__*/jsxRuntime.jsx(styled.StyledVirtualListWrapper, {
|
|
62
62
|
tabIndex: -1,
|
|
63
|
+
inline: inline,
|
|
63
64
|
maxHeight: menuMaxHeight,
|
|
64
65
|
ref: listRef,
|
|
65
|
-
|
|
66
|
-
marginTop: withHeader && '28px'
|
|
67
|
-
},
|
|
66
|
+
withHeader: withHeader,
|
|
68
67
|
children: /*#__PURE__*/_jsx__default["default"](styled.StyledList, {
|
|
69
68
|
tabIndex: -1,
|
|
70
69
|
"aria-expanded": showPopover,
|
|
@@ -16,12 +16,16 @@ const StyledList = /*#__PURE__*/styled__default["default"].ul.withConfig({
|
|
|
16
16
|
})(["position:relative;padding:0;"]);
|
|
17
17
|
const StyledVirtualListWrapper = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
18
18
|
componentId: "sc-1uedyf-2"
|
|
19
|
-
})(["overflow-y:auto;max-height:", ";"], _ref => {
|
|
19
|
+
})(["overflow-y:auto;margin-top:", ";max-height:", ";"], _ref => {
|
|
20
20
|
let {
|
|
21
|
-
|
|
22
|
-
inline
|
|
21
|
+
withHeader
|
|
23
22
|
} = _ref;
|
|
24
|
-
return
|
|
23
|
+
return withHeader ? '28px' : '';
|
|
24
|
+
}, _ref2 => {
|
|
25
|
+
let {
|
|
26
|
+
maxHeight
|
|
27
|
+
} = _ref2;
|
|
28
|
+
return !maxHeight ? '400px' : "".concat(maxHeight, "px");
|
|
25
29
|
});
|
|
26
30
|
|
|
27
31
|
exports.StyledList = StyledList;
|
|
@@ -36,22 +36,25 @@ const useItemRenderer = () => {
|
|
|
36
36
|
inputRef,
|
|
37
37
|
setShowPopover,
|
|
38
38
|
focusOptionIdx,
|
|
39
|
-
virtualListHelpers
|
|
40
|
-
virtualItems
|
|
41
|
-
}
|
|
39
|
+
virtualListHelpers
|
|
42
40
|
} = React.useContext(ComboBoxCTX.ComboBoxContext);
|
|
41
|
+
const {
|
|
42
|
+
virtualItems
|
|
43
|
+
} = virtualListHelpers;
|
|
43
44
|
const multiple = Array.isArray(selectedValues);
|
|
44
45
|
const CBItem = multiple ? dsForm.MultiMenuItem : dsForm.SingleMenuItem;
|
|
45
46
|
const handleClick = React.useCallback((option, e) => {
|
|
47
|
+
var _inputRef$current;
|
|
48
|
+
|
|
46
49
|
if (!multiple) {
|
|
47
50
|
setShowPopover(false);
|
|
48
|
-
inputRef.current.value = '';
|
|
49
|
-
} else {
|
|
51
|
+
if (inputRef.current) inputRef.current.value = '';
|
|
52
|
+
} else if (inputRef.current) {
|
|
50
53
|
onFilter(inputRef.current.value);
|
|
51
54
|
}
|
|
52
55
|
|
|
53
56
|
onChange(option);
|
|
54
|
-
inputRef.current.focus();
|
|
57
|
+
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus();
|
|
55
58
|
e.stopPropagation();
|
|
56
59
|
e.preventDefault();
|
|
57
60
|
}, [onFilter, onChange, setShowPopover, multiple, inputRef]);
|
|
@@ -96,9 +99,7 @@ const useItemRenderer = () => {
|
|
|
96
99
|
|
|
97
100
|
return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
98
101
|
}), [options, focusOptionIdx, selectedValues, inputRef, virtualItems]);
|
|
99
|
-
return
|
|
100
|
-
ItemRenderer
|
|
101
|
-
}), [ItemRenderer]);
|
|
102
|
+
return ItemRenderer;
|
|
102
103
|
};
|
|
103
104
|
|
|
104
105
|
exports.useItemRenderer = useItemRenderer;
|
|
@@ -37,7 +37,7 @@ const useKeyboardNavigation = () => {
|
|
|
37
37
|
const currentItem = options.find(item => item.dsId === focusOptionIdx);
|
|
38
38
|
const selectOption = React.useCallback(() => {
|
|
39
39
|
if (multiple) {
|
|
40
|
-
onFilter(inputRef.current.value);
|
|
40
|
+
if (inputRef.current) onFilter(inputRef.current.value);
|
|
41
41
|
} else {
|
|
42
42
|
onFilter('');
|
|
43
43
|
if (inputRef.current) inputRef.current.value = '';
|
|
@@ -85,7 +85,6 @@ const useKeyboardNavigation = () => {
|
|
|
85
85
|
|
|
86
86
|
if (e.key === 'a' && e.ctrlKey && multiple) {
|
|
87
87
|
onSelectAll();
|
|
88
|
-
setShowPopover(false);
|
|
89
88
|
} // =============================================================================
|
|
90
89
|
// ARROWS UP AND DOWN
|
|
91
90
|
// =============================================================================
|
|
@@ -134,8 +133,7 @@ const useKeyboardNavigation = () => {
|
|
|
134
133
|
|
|
135
134
|
if (e.key === 'Backspace' && targetElement.value.length <= 0 && !inline) {
|
|
136
135
|
if (multiple && !targetElement.value) {
|
|
137
|
-
|
|
138
|
-
if (multiSelectedValues.length > 0) onChange(multiSelectedValues[multiSelectedValues.length - 1]);
|
|
136
|
+
if (selectedValues.length > 0) onChange(selectedValues[selectedValues.length - 1]);
|
|
139
137
|
} else {
|
|
140
138
|
onChange(null);
|
|
141
139
|
}
|
|
@@ -146,7 +144,9 @@ const useKeyboardNavigation = () => {
|
|
|
146
144
|
|
|
147
145
|
if (e.key === 'Tab' && inline) ;
|
|
148
146
|
}, [scrollOptionIntoView, currentItemIndex, options, currentItem, selectableOptions, inputRef, multiple, showPopover, selectedValues, inline, onKeyDown, onSelectAll, onChange, onCreate, onFilter, setCurrentOption, setShowPopover, setShowSelectedValue, selectOption]);
|
|
149
|
-
return
|
|
147
|
+
return {
|
|
148
|
+
onInputKeyDown
|
|
149
|
+
};
|
|
150
150
|
};
|
|
151
151
|
|
|
152
152
|
exports.useKeyboardNavigation = useKeyboardNavigation;
|
|
@@ -15,10 +15,10 @@ const useOnElementResize = targetRef => {
|
|
|
15
15
|
const observer = React.useRef(null);
|
|
16
16
|
React.useEffect(() => {
|
|
17
17
|
function outputsize() {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
if (targetRef.current) {
|
|
19
|
+
setWidth(targetRef.current.offsetWidth);
|
|
20
|
+
setHeight(targetRef.current.offsetHeight);
|
|
21
|
+
}
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
observer.current = new ResizeObserver(outputsize).observe(targetRef.current);
|
|
@@ -53,11 +53,8 @@ const shouldUpdateSvgPath = (_ref2, prevSizes) => {
|
|
|
53
53
|
class FloatingLabelInputImpl extends React.Component {
|
|
54
54
|
constructor(props) {
|
|
55
55
|
super(props);
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
_defineProperty__default["default"](this, "prevSizes", {});
|
|
60
|
-
|
|
56
|
+
this.resizeObserver = new resizeObserver.ResizeObserver(() => this.updatePath());
|
|
57
|
+
this.prevSizes = {};
|
|
61
58
|
this.wrapperRef = /*#__PURE__*/React__default["default"].createRef();
|
|
62
59
|
this.outlinePathRef = /*#__PURE__*/React__default["default"].createRef();
|
|
63
60
|
this.outlineIdleRef = /*#__PURE__*/React__default["default"].createRef();
|
|
@@ -197,8 +194,8 @@ class FloatingLabelInputImpl extends React.Component {
|
|
|
197
194
|
|
|
198
195
|
}
|
|
199
196
|
|
|
200
|
-
|
|
197
|
+
FloatingLabelInputImpl.defaultProps = {
|
|
201
198
|
onChange: () => null
|
|
202
|
-
}
|
|
199
|
+
};
|
|
203
200
|
|
|
204
201
|
module.exports = FloatingLabelInputImpl;
|
|
@@ -111,8 +111,7 @@ class ValidationFieldWrapper extends React.Component {
|
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
}
|
|
114
|
-
|
|
115
|
-
_defineProperty__default["default"](ValidationFieldWrapper, "defaultProps", {
|
|
114
|
+
ValidationFieldWrapper.defaultProps = {
|
|
116
115
|
validateOnBlur: false,
|
|
117
116
|
validateOnChange: false,
|
|
118
117
|
name: '',
|
|
@@ -121,6 +120,6 @@ _defineProperty__default["default"](ValidationFieldWrapper, "defaultProps", {
|
|
|
121
120
|
validate: () => null,
|
|
122
121
|
onChange: () => null,
|
|
123
122
|
onBlur: () => null
|
|
124
|
-
}
|
|
123
|
+
};
|
|
125
124
|
|
|
126
125
|
module.exports = ValidationFieldWrapper;
|
|
@@ -112,11 +112,10 @@ class InputAddonWrapper extends React.Component {
|
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
}
|
|
115
|
-
|
|
116
|
-
_defineProperty__default["default"](InputAddonWrapper, "defaultProps", {
|
|
115
|
+
InputAddonWrapper.defaultProps = {
|
|
117
116
|
rightComponents: [],
|
|
118
117
|
leftComponents: [],
|
|
119
118
|
containerProps: {}
|
|
120
|
-
}
|
|
119
|
+
};
|
|
121
120
|
|
|
122
121
|
module.exports = InputAddonWrapper;
|
package/cjs/Input/InputImpl.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
3
4
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
4
5
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
5
|
-
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
6
6
|
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
7
7
|
require('core-js/modules/esnext.iterator.constructor.js');
|
|
8
8
|
require('core-js/modules/esnext.iterator.filter.js');
|
|
@@ -20,9 +20,9 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
20
20
|
|
|
21
21
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
22
22
|
|
|
23
|
+
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
23
24
|
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
|
|
24
25
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
25
|
-
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
26
26
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
27
27
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
28
28
|
var DSButton__default = /*#__PURE__*/_interopDefaultLegacy(DSButton);
|
|
@@ -66,12 +66,10 @@ const noop = () => null;
|
|
|
66
66
|
class InputImpl extends React.Component {
|
|
67
67
|
constructor(props) {
|
|
68
68
|
super(props);
|
|
69
|
+
this.ref = void 0;
|
|
70
|
+
this.refTooltip = void 0;
|
|
69
71
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
_defineProperty__default["default"](this, "refTooltip", void 0);
|
|
73
|
-
|
|
74
|
-
_defineProperty__default["default"](this, "handleOnChange", e => {
|
|
72
|
+
this.handleOnChange = e => {
|
|
75
73
|
const {
|
|
76
74
|
onChange,
|
|
77
75
|
max
|
|
@@ -87,9 +85,9 @@ class InputImpl extends React.Component {
|
|
|
87
85
|
isEllipsisOn: this.ref.current.offsetWidth < this.ref.current.scrollWidth
|
|
88
86
|
});
|
|
89
87
|
}
|
|
90
|
-
}
|
|
88
|
+
};
|
|
91
89
|
|
|
92
|
-
|
|
90
|
+
this.handleBlur = e => {
|
|
93
91
|
const {
|
|
94
92
|
onBlur,
|
|
95
93
|
onChange,
|
|
@@ -111,9 +109,9 @@ class InputImpl extends React.Component {
|
|
|
111
109
|
this.setState({
|
|
112
110
|
active: false
|
|
113
111
|
});
|
|
114
|
-
}
|
|
112
|
+
};
|
|
115
113
|
|
|
116
|
-
|
|
114
|
+
this.handleFocus = e => {
|
|
117
115
|
const {
|
|
118
116
|
onFocus
|
|
119
117
|
} = this.props;
|
|
@@ -121,30 +119,30 @@ class InputImpl extends React.Component {
|
|
|
121
119
|
this.setState({
|
|
122
120
|
active: true
|
|
123
121
|
});
|
|
124
|
-
}
|
|
122
|
+
};
|
|
125
123
|
|
|
126
|
-
|
|
124
|
+
this.handleMouseEnter = () => {
|
|
127
125
|
if (!this.state.showTooltip) {
|
|
128
126
|
this.setState({
|
|
129
127
|
showTooltip: true
|
|
130
128
|
});
|
|
131
129
|
}
|
|
132
|
-
}
|
|
130
|
+
};
|
|
133
131
|
|
|
134
|
-
|
|
132
|
+
this.handleMouseLeave = () => {
|
|
135
133
|
if (this.state.showTooltip) {
|
|
136
134
|
this.setState({
|
|
137
135
|
showTooltip: false
|
|
138
136
|
});
|
|
139
137
|
}
|
|
140
|
-
}
|
|
138
|
+
};
|
|
141
139
|
|
|
142
|
-
|
|
140
|
+
this.setWidth = () => {
|
|
143
141
|
const client = this.refTooltip.current.getBoundingClientRect();
|
|
144
142
|
this.setState({
|
|
145
143
|
width: client.width
|
|
146
144
|
});
|
|
147
|
-
}
|
|
145
|
+
};
|
|
148
146
|
|
|
149
147
|
this.state = {
|
|
150
148
|
width: -1,
|