@elliemae/ds-form 2.0.0-rc.3 → 2.0.0-rc.7
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/v3/ComboBox.js +1 -1
- package/cjs/ComboBox/v3/ComboBoxCTX.js +0 -1
- package/cjs/ComboBox/v3/parts/controls/styled.js +18 -18
- 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 +39 -36
- package/cjs/ComboBox/v3/parts/header-list/styled.js +10 -3
- package/cjs/ComboBox/v3/parts/header-list/useHeaderListHandlers.js +3 -4
- package/cjs/ComboBox/v3/parts/menu-list/MenuList.js +11 -6
- package/cjs/ComboBox/v3/parts/menu-list/styled.js +6 -5
- package/cjs/ComboBox/v3/parts/menu-list/useMenuList.js +3 -2
- package/cjs/ComboBox/v3/parts/multi-selected-values-container/MultiSelectedValuesContainer.js +13 -7
- package/cjs/ComboBox/v3/propTypes.js +12 -13
- package/cjs/ComboBox/v3/utils/hooks/useKeyboardNavigation.js +11 -11
- package/cjs/MenuItem/components/MenuItem/index.js +1 -1
- package/cjs/MenuItem/components/Section/index.js +1 -1
- package/cjs/MenuItem/components/SingleMenuItem/SingleMenuItem.js +6 -6
- package/cjs/MenuItem/components/SubmenuItem/index.js +1 -1
- package/cjs/MenuItem/components/styled.js +7 -2
- package/esm/ComboBox/v3/ComboBox.js +1 -1
- package/esm/ComboBox/v3/ComboBoxCTX.js +0 -1
- package/esm/ComboBox/v3/parts/controls/styled.js +18 -19
- 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 +40 -37
- package/esm/ComboBox/v3/parts/header-list/styled.js +10 -5
- package/esm/ComboBox/v3/parts/header-list/useHeaderListHandlers.js +3 -4
- package/esm/ComboBox/v3/parts/menu-list/MenuList.js +11 -6
- package/esm/ComboBox/v3/parts/menu-list/styled.js +6 -5
- package/esm/ComboBox/v3/parts/menu-list/useMenuList.js +3 -2
- package/esm/ComboBox/v3/parts/multi-selected-values-container/MultiSelectedValuesContainer.js +13 -7
- package/esm/ComboBox/v3/propTypes.js +12 -13
- package/esm/ComboBox/v3/utils/hooks/useKeyboardNavigation.js +11 -11
- package/esm/MenuItem/components/MenuItem/index.js +1 -1
- package/esm/MenuItem/components/Section/index.js +1 -1
- package/esm/MenuItem/components/SingleMenuItem/SingleMenuItem.js +6 -6
- package/esm/MenuItem/components/SubmenuItem/index.js +1 -1
- package/esm/MenuItem/components/styled.js +7 -3
- package/package.json +18 -21
- package/types/Checkbox/elements/CheckMark.d.ts +1 -1
- package/types/ComboBox/v3/ComboBox.d.ts +0 -1
- 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/dropdown-indicator/styled.d.ts +1 -1
- package/types/ComboBox/v3/parts/empty-state/styled.d.ts +2 -2
- package/types/ComboBox/v3/parts/header-list/styled.d.ts +7 -6
- package/types/ComboBox/v3/parts/menu-list/styled.d.ts +5 -3
- package/types/ComboBox/v3/parts/multi-selected-values-container/styled.d.ts +3 -3
- package/types/ComboBox/v3/parts/single-selected-value-container/styled.d.ts +1 -1
- package/types/ComboBox/v3/propTypes.d.ts +0 -1
- package/types/DateInputV2/components/styled.d.ts +4 -4
- package/types/FormItem/Suffix/Suffix.d.ts +3 -3
- package/types/MenuItem/components/MenuItem/styled.d.ts +1 -1
- package/types/MenuItem/components/MultiMenuItem/styled.d.ts +1 -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/SubmenuItem/styled.d.ts +2 -2
- package/types/MenuItem/components/styled.d.ts +3 -3
- package/types/Radio/Circle.d.ts +1 -1
- package/types/SearchBox/styled.d.ts +1 -1
- package/cjs/MenuItem/components/SingleMenuItem/styled.js +0 -19
- package/esm/MenuItem/components/SingleMenuItem/styled.js +0 -10
- package/types/MenuItem/components/SingleMenuItem/styled.d.ts +0 -2
|
@@ -11,7 +11,7 @@ var _Container;
|
|
|
11
11
|
|
|
12
12
|
const DSComboBox = props => {
|
|
13
13
|
const propsWithDefault = useMemoMergePropsWithDefault(props, defaultProps);
|
|
14
|
-
useValidateTypescriptPropTypes(propsWithDefault,
|
|
14
|
+
useValidateTypescriptPropTypes(propsWithDefault, propTypes);
|
|
15
15
|
const ctx = useComboBox(props);
|
|
16
16
|
return /*#__PURE__*/_jsx(ComboBoxContext.Provider, {
|
|
17
17
|
value: ctx
|
|
@@ -1,31 +1,30 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _taggedTemplateLiteral from '@babel/runtime/helpers/esm/taggedTemplateLiteral';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { css } from '@elliemae/ds-system';
|
|
2
4
|
import { Grid } from '@elliemae/ds-grid';
|
|
3
5
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} = _ref;
|
|
9
|
-
|
|
10
|
-
if (hasError) {
|
|
11
|
-
return theme.colors.danger[900];
|
|
6
|
+
var _templateObject, _templateObject2;
|
|
7
|
+
const normalBorder = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n border: 1px solid\n ", ";\n"])), props => {
|
|
8
|
+
if (props.hasError) {
|
|
9
|
+
return props.theme.colors.danger[900];
|
|
12
10
|
}
|
|
13
11
|
|
|
12
|
+
return props.theme.colors.neutral[400];
|
|
13
|
+
});
|
|
14
|
+
const focusBorder = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n border: 2px solid ", ";\n"])), _ref => {
|
|
15
|
+
let {
|
|
16
|
+
theme
|
|
17
|
+
} = _ref;
|
|
14
18
|
return theme.colors.brand[700];
|
|
15
19
|
});
|
|
16
20
|
const StyledControlsWrapper = /*#__PURE__*/styled(Grid).withConfig({
|
|
17
21
|
componentId: "sc-64uci7-0"
|
|
18
|
-
})(["background:transparent;position:relative;border
|
|
19
|
-
if (props.hasError) {
|
|
20
|
-
return props.theme.colors.danger[900];
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return props.theme.colors.neutral[400];
|
|
24
|
-
}, _ref2 => {
|
|
22
|
+
})(["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 => {
|
|
25
23
|
let {
|
|
26
|
-
minWidth
|
|
24
|
+
minWidth,
|
|
25
|
+
inline
|
|
27
26
|
} = _ref2;
|
|
28
|
-
return minWidth;
|
|
27
|
+
return inline ? '' : "".concat(minWidth, "px");
|
|
29
28
|
}, _ref3 => {
|
|
30
29
|
let {
|
|
31
30
|
inline
|
|
@@ -35,7 +34,7 @@ const StyledControlsWrapper = /*#__PURE__*/styled(Grid).withConfig({
|
|
|
35
34
|
let {
|
|
36
35
|
hasFocus
|
|
37
36
|
} = _ref4;
|
|
38
|
-
return hasFocus
|
|
37
|
+
return hasFocus ? focusBorder : normalBorder;
|
|
39
38
|
});
|
|
40
39
|
const StyledSelection = /*#__PURE__*/styled.div.withConfig({
|
|
41
40
|
componentId: "sc-64uci7-1"
|
|
@@ -18,9 +18,6 @@ const DropdownIndicator = () => {
|
|
|
18
18
|
"aria-expanded": showPopover,
|
|
19
19
|
"aria-haspopup": "listbox",
|
|
20
20
|
buttonType: "text",
|
|
21
|
-
style: {
|
|
22
|
-
height: '100%'
|
|
23
|
-
},
|
|
24
21
|
icon: _ChevronSmallDown || (_ChevronSmallDown = /*#__PURE__*/_jsx(ChevronSmallDown, {})),
|
|
25
22
|
tabIndex: -1
|
|
26
23
|
});
|
|
@@ -3,6 +3,6 @@ import DSButton from '@elliemae/ds-button';
|
|
|
3
3
|
|
|
4
4
|
const StyledDropDownButton = /*#__PURE__*/styled(DSButton).withConfig({
|
|
5
5
|
componentId: "sc-1ijoe1w-0"
|
|
6
|
-
})(["
|
|
6
|
+
})(["box-sizing:border-box;width:100;& svg{fill:", ";}"], props => props.theme.colors.brand['700']);
|
|
7
7
|
|
|
8
8
|
export { StyledDropDownButton };
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
2
|
import { useContext } from 'react';
|
|
3
|
-
import { DSControlledToggle } from '@elliemae/ds-controlled-form';
|
|
4
3
|
import { noop } from 'lodash';
|
|
5
4
|
import { ComboBoxContext } from '../../ComboBoxCTX.js';
|
|
6
|
-
import { StyledHeaderListWrapper, StyledSelectedItems,
|
|
5
|
+
import { StyledHeaderListWrapper, StyledSelectedItems, StyledButton, StyledSeparator, StyledButtonSelection, StyledNoOptionsSelected, StyledShowAllButton } from './styled.js';
|
|
7
6
|
import { getSelectableOptions } from '../../utils/listHelper.js';
|
|
8
7
|
import { ComboboxDataTestid } from '../../ComboboxDataTestids.js';
|
|
9
8
|
import { useHeaderListHandlers } from './useHeaderListHandlers.js';
|
|
10
9
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
11
10
|
|
|
12
|
-
var
|
|
11
|
+
var _StyledSeparator, _StyledNoOptionsSelec, _StyledSeparator2;
|
|
13
12
|
|
|
14
13
|
const HeaderList = () => {
|
|
14
|
+
var _inputRef$current;
|
|
15
|
+
|
|
15
16
|
const {
|
|
16
17
|
props: {
|
|
17
18
|
onSelectAll,
|
|
@@ -20,7 +21,8 @@ const HeaderList = () => {
|
|
|
20
21
|
selectedValues,
|
|
21
22
|
options
|
|
22
23
|
},
|
|
23
|
-
showSelectedOptions
|
|
24
|
+
showSelectedOptions,
|
|
25
|
+
inputRef
|
|
24
26
|
} = useContext(ComboBoxContext);
|
|
25
27
|
const multiSelectedValues = selectedValues;
|
|
26
28
|
const selectableOptions = getSelectableOptions(options);
|
|
@@ -36,13 +38,38 @@ const HeaderList = () => {
|
|
|
36
38
|
return /*#__PURE__*/_jsx(StyledHeaderListWrapper, {
|
|
37
39
|
onKeyDown: handleKeyDown,
|
|
38
40
|
onMouseDown: handleOnMouseDown
|
|
39
|
-
}, void 0, /*#__PURE__*/_jsx(StyledSelectedItems, {}, void 0,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
}, void 0, /*#__PURE__*/_jsx(StyledSelectedItems, {}, void 0, onSelectAll && /*#__PURE__*/_jsx(StyledButton, {
|
|
42
|
+
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,
|
|
43
|
+
"data-testid": ComboboxDataTestid.SELECT_ALL_BUTTON,
|
|
44
|
+
buttonType: "text",
|
|
45
|
+
labelText: "All",
|
|
46
|
+
size: "s",
|
|
47
|
+
onMouseDown: handleOnMouseDown,
|
|
48
|
+
onBlur: handleOnBlurSelectAll,
|
|
49
|
+
onClick: handleClickOnSelectAll
|
|
50
|
+
}), onSelectAll && onClearAll && (_StyledSeparator || (_StyledSeparator = /*#__PURE__*/_jsx(StyledSeparator, {
|
|
51
|
+
orientation: "vertical",
|
|
52
|
+
position: "center",
|
|
53
|
+
type: "group-level",
|
|
54
|
+
margin: "none"
|
|
55
|
+
}))), onClearAll && /*#__PURE__*/_jsx(StyledButton, {
|
|
56
|
+
disabled: multiSelectedValues.length === 0,
|
|
57
|
+
tabIndex: 0,
|
|
58
|
+
"data-testid": ComboboxDataTestid.CLEAR_ALL_BUTTON,
|
|
59
|
+
buttonType: "text",
|
|
60
|
+
size: "s",
|
|
61
|
+
labelText: "Clear",
|
|
62
|
+
onMouseDown: handleOnMouseDown,
|
|
63
|
+
onBlur: handleOnBlurClearAll,
|
|
64
|
+
onClick: handleClickOnClearAll
|
|
65
|
+
})), /*#__PURE__*/_jsx(StyledSelectedItems, {}, void 0, withToggle ? /*#__PURE__*/jsx(Fragment, {
|
|
66
|
+
children: multiSelectedValues.length > 0 ? /*#__PURE__*/_jsx(StyledButtonSelection, {
|
|
67
|
+
buttonType: "text",
|
|
68
|
+
disabled: !showSelectedOptions && selectableOptions.length === multiSelectedValues.length,
|
|
69
|
+
onClick: handleToggle,
|
|
70
|
+
labelText: !showSelectedOptions ? "".concat(multiSelectedValues.length, " SELECTED") : 'SHOW ALL',
|
|
71
|
+
size: "s"
|
|
72
|
+
}) : _StyledNoOptionsSelec || (_StyledNoOptionsSelec = /*#__PURE__*/_jsx(StyledNoOptionsSelected, {}, void 0, "0 SELECTED"))
|
|
46
73
|
}) : /*#__PURE__*/jsxs(Fragment, {
|
|
47
74
|
children: [/*#__PURE__*/_jsx(StyledShowAllButton, {
|
|
48
75
|
buttonType: "text",
|
|
@@ -55,7 +82,7 @@ const HeaderList = () => {
|
|
|
55
82
|
style: {
|
|
56
83
|
fontWeight: showSelectedOptions ? '300' : '600'
|
|
57
84
|
}
|
|
58
|
-
}),
|
|
85
|
+
}), _StyledSeparator2 || (_StyledSeparator2 = /*#__PURE__*/_jsx(StyledSeparator, {
|
|
59
86
|
orientation: "vertical",
|
|
60
87
|
position: "center",
|
|
61
88
|
type: "group-level",
|
|
@@ -63,37 +90,13 @@ const HeaderList = () => {
|
|
|
63
90
|
})), /*#__PURE__*/_jsx(StyledButtonSelection, {
|
|
64
91
|
tabIndex: showSelectedOptions ? -1 : 0,
|
|
65
92
|
"data-testid": ComboboxDataTestid.SHOW_SELECTED_OPTIONS_BUTTON,
|
|
66
|
-
disabled: multiSelectedValues.length === 0,
|
|
93
|
+
disabled: multiSelectedValues.length === 0 || !showSelectedOptions && selectableOptions.length === multiSelectedValues.length,
|
|
67
94
|
buttonType: "text",
|
|
68
95
|
isSelected: showSelectedOptions,
|
|
69
96
|
onClick: !showSelectedOptions ? handleToggle : noop,
|
|
70
97
|
labelText: "".concat(multiSelectedValues.length, " SELECTED"),
|
|
71
98
|
size: "s"
|
|
72
99
|
})]
|
|
73
|
-
})), /*#__PURE__*/_jsx(StyledSelectedItems, {}, void 0, onSelectAll && /*#__PURE__*/_jsx(StyledButton, {
|
|
74
|
-
disabled: selectableOptions.length === multiSelectedValues.length,
|
|
75
|
-
"data-testid": ComboboxDataTestid.SELECT_ALL_BUTTON,
|
|
76
|
-
buttonType: "text",
|
|
77
|
-
labelText: "All",
|
|
78
|
-
size: "s",
|
|
79
|
-
onMouseDown: handleOnMouseDown,
|
|
80
|
-
onBlur: handleOnBlurSelectAll,
|
|
81
|
-
onClick: handleClickOnSelectAll
|
|
82
|
-
}), onSelectAll && onClearAll && (_StyledSeparator2 || (_StyledSeparator2 = /*#__PURE__*/_jsx(StyledSeparator, {
|
|
83
|
-
orientation: "vertical",
|
|
84
|
-
position: "center",
|
|
85
|
-
type: "group-level",
|
|
86
|
-
margin: "none"
|
|
87
|
-
}))), onClearAll && /*#__PURE__*/_jsx(StyledButton, {
|
|
88
|
-
disabled: multiSelectedValues.length === 0,
|
|
89
|
-
tabIndex: 0,
|
|
90
|
-
"data-testid": ComboboxDataTestid.CLEAR_ALL_BUTTON,
|
|
91
|
-
buttonType: "text",
|
|
92
|
-
size: "s",
|
|
93
|
-
labelText: "Clear",
|
|
94
|
-
onMouseDown: handleOnMouseDown,
|
|
95
|
-
onBlur: handleOnBlurClearAll,
|
|
96
|
-
onClick: handleClickOnClearAll
|
|
97
100
|
})));
|
|
98
101
|
};
|
|
99
102
|
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _taggedTemplateLiteral from '@babel/runtime/helpers/esm/taggedTemplateLiteral';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { css } from '@elliemae/ds-system';
|
|
2
4
|
import DSButton from '@elliemae/ds-button';
|
|
3
5
|
import DSSeparator from '@elliemae/ds-separator';
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
var _templateObject;
|
|
6
8
|
|
|
7
|
-
const selectedStyle = isSelected => css(["border-bottom:2px solid ", "
|
|
9
|
+
const selectedStyle = isSelected => css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n & span {\n border-bottom: 2px solid ", ";\n }\n cursor: ", ";\n"])), props => isSelected ? props.theme.colors.brand[700] : '#FFF', isSelected && 'default');
|
|
8
10
|
|
|
9
11
|
const StyledHeaderListWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
10
12
|
componentId: "sc-dazbzt-0"
|
|
@@ -17,7 +19,7 @@ const StyledButton = /*#__PURE__*/styled(DSButton).withConfig({
|
|
|
17
19
|
})(["padding:0 ", ";align-items:center;"], props => props.theme.space.xxs);
|
|
18
20
|
const StyledGeneralSelectionButton = /*#__PURE__*/styled(DSButton).withConfig({
|
|
19
21
|
componentId: "sc-dazbzt-3"
|
|
20
|
-
})(["border-radius:0px;padding:", ";margin:0;align-items:center;", " transition:unset;"], props => props.theme.space.xxs, _ref => {
|
|
22
|
+
})(["border-radius:0px;padding:0 ", ";margin:0;align-items:center;", " transition:unset;"], props => props.theme.space.xxs, _ref => {
|
|
21
23
|
let {
|
|
22
24
|
isSelected
|
|
23
25
|
} = _ref;
|
|
@@ -32,5 +34,8 @@ const StyledShowAllButton = /*#__PURE__*/styled(StyledGeneralSelectionButton).wi
|
|
|
32
34
|
const StyledSelectedItems = /*#__PURE__*/styled.div.withConfig({
|
|
33
35
|
componentId: "sc-dazbzt-6"
|
|
34
36
|
})(["display:flex;align-items:center;"]);
|
|
37
|
+
const StyledNoOptionsSelected = /*#__PURE__*/styled.div.withConfig({
|
|
38
|
+
componentId: "sc-dazbzt-7"
|
|
39
|
+
})(["padding:0 ", ";"], props => props.theme.space.xxs);
|
|
35
40
|
|
|
36
|
-
export { StyledButton, StyledButtonSelection, StyledHeaderListWrapper, StyledSelectedItems, StyledSeparator, StyledShowAllButton };
|
|
41
|
+
export { StyledButton, StyledButtonSelection, StyledHeaderListWrapper, StyledNoOptionsSelected, StyledSelectedItems, StyledSeparator, StyledShowAllButton };
|
|
@@ -21,14 +21,13 @@ const useHeaderListHandlers = () => {
|
|
|
21
21
|
inputRef.current.focus();
|
|
22
22
|
}
|
|
23
23
|
}, [inputRef, onClearAll, multiSelectedValues]);
|
|
24
|
-
const handleOnBlurClearAll = useCallback(e => {
|
|
25
|
-
e.preventDefault();
|
|
26
|
-
inputRef.current.focus();
|
|
24
|
+
const handleOnBlurClearAll = useCallback(e => {// since ux change order from the action buttons this is unneccesary. will comment until review finish
|
|
25
|
+
// e.preventDefault();
|
|
26
|
+
// inputRef.current.focus();
|
|
27
27
|
}, [inputRef]);
|
|
28
28
|
const handleClickOnSelectAll = useCallback(() => {
|
|
29
29
|
onSelectAll();
|
|
30
30
|
inputRef.current.focus();
|
|
31
|
-
setShowPopover(false);
|
|
32
31
|
}, [onSelectAll, inputRef, setShowPopover]);
|
|
33
32
|
const handleClickOnClearAll = useCallback(e => {
|
|
34
33
|
setShowSelectedOptions(false);
|
|
@@ -32,34 +32,39 @@ const MenuList = () => {
|
|
|
32
32
|
}
|
|
33
33
|
} = useContext(ComboBoxContext);
|
|
34
34
|
const multiple = Array.isArray(selectedValues);
|
|
35
|
+
const withHeader = !inline && multiple && options.length > 0;
|
|
35
36
|
const {
|
|
36
37
|
ItemRenderer
|
|
37
38
|
} = useItemRenderer();
|
|
38
39
|
useMenuList();
|
|
39
40
|
useOnElementResize(controlsWrapperRef);
|
|
40
|
-
const listWidth =
|
|
41
|
-
const
|
|
41
|
+
const listWidth = menuMinWidth || "".concat(referenceElement === null || referenceElement === void 0 ? void 0 : referenceElement.offsetWidth);
|
|
42
|
+
const handleOnFocus = useCallback(() => {
|
|
42
43
|
inputRef === null || inputRef === void 0 ? void 0 : inputRef.current.focus();
|
|
43
44
|
}, [inputRef]);
|
|
44
45
|
return /*#__PURE__*/jsxs(StyledListWrapper, {
|
|
46
|
+
tabIndex: -1,
|
|
45
47
|
ref: wrapperListRef,
|
|
48
|
+
inline: inline,
|
|
46
49
|
onMouseDown: e => e.preventDefault(),
|
|
47
50
|
minWidth: listWidth,
|
|
48
51
|
id: "combo-listbox",
|
|
49
52
|
role: "listbox",
|
|
50
|
-
children: [
|
|
53
|
+
children: [withHeader && (_HeaderList || (_HeaderList = /*#__PURE__*/_jsx(HeaderList, {}))), options.length > 0 ? /*#__PURE__*/jsx(StyledVirtualListWrapper, {
|
|
54
|
+
tabIndex: -1,
|
|
51
55
|
maxHeight: menuMaxHeight,
|
|
52
56
|
ref: listRef,
|
|
53
57
|
style: {
|
|
54
|
-
marginTop:
|
|
58
|
+
marginTop: withHeader && '28px'
|
|
55
59
|
},
|
|
56
60
|
children: /*#__PURE__*/_jsx(StyledList, {
|
|
57
61
|
tabIndex: -1,
|
|
58
62
|
"aria-expanded": showPopover,
|
|
59
|
-
onFocus:
|
|
63
|
+
onFocus: handleOnFocus,
|
|
60
64
|
"data-testid": ComboboxDataTestid.LIST,
|
|
61
65
|
style: {
|
|
62
|
-
height: totalSize
|
|
66
|
+
height: totalSize,
|
|
67
|
+
margin: inline ? '0px' : '8px 0px'
|
|
63
68
|
}
|
|
64
69
|
}, void 0, ItemRenderer)
|
|
65
70
|
}) : _EmptyState || (_EmptyState = /*#__PURE__*/_jsx(EmptyState, {}))]
|
|
@@ -2,17 +2,18 @@ import styled from 'styled-components';
|
|
|
2
2
|
|
|
3
3
|
const StyledListWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
4
4
|
componentId: "sc-1uedyf-0"
|
|
5
|
-
})(["min-width:", "
|
|
5
|
+
})(["min-width:", ";"], props => props.inline ? '100%' : "".concat(props.minWidth, "px"));
|
|
6
6
|
const StyledList = /*#__PURE__*/styled.ul.withConfig({
|
|
7
7
|
componentId: "sc-1uedyf-1"
|
|
8
|
-
})(["position:relative;padding:0;
|
|
8
|
+
})(["position:relative;padding:0;"]);
|
|
9
9
|
const StyledVirtualListWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
10
10
|
componentId: "sc-1uedyf-2"
|
|
11
|
-
})(["overflow-y:auto;max-height:", "
|
|
11
|
+
})(["overflow-y:auto;max-height:", ";"], _ref => {
|
|
12
12
|
let {
|
|
13
|
-
maxHeight
|
|
13
|
+
maxHeight,
|
|
14
|
+
inline
|
|
14
15
|
} = _ref;
|
|
15
|
-
return maxHeight
|
|
16
|
+
return inline ? '' : "".concat(!maxHeight ? '400' : maxHeight, "px");
|
|
16
17
|
});
|
|
17
18
|
|
|
18
19
|
export { StyledList, StyledListWrapper, StyledVirtualListWrapper };
|
|
@@ -6,6 +6,7 @@ const useMenuList = () => {
|
|
|
6
6
|
|
|
7
7
|
const {
|
|
8
8
|
props: {
|
|
9
|
+
inline,
|
|
9
10
|
selectedValues,
|
|
10
11
|
onMenuOpen,
|
|
11
12
|
options
|
|
@@ -24,7 +25,7 @@ const useMenuList = () => {
|
|
|
24
25
|
}
|
|
25
26
|
};
|
|
26
27
|
|
|
27
|
-
if (showPopover) {
|
|
28
|
+
if (showPopover || inline) {
|
|
28
29
|
onMenuOpen();
|
|
29
30
|
|
|
30
31
|
if (inputRef.current.value !== '') {
|
|
@@ -50,7 +51,7 @@ const useMenuList = () => {
|
|
|
50
51
|
}
|
|
51
52
|
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
52
53
|
|
|
53
|
-
}, [showPopover, hasFocus, (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.value]);
|
|
54
|
+
}, [showPopover, inline, hasFocus, (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.value]);
|
|
54
55
|
};
|
|
55
56
|
|
|
56
57
|
export { useMenuList };
|
package/esm/ComboBox/v3/parts/multi-selected-values-container/MultiSelectedValuesContainer.js
CHANGED
|
@@ -13,6 +13,8 @@ import { jsxs, Fragment } from 'react/jsx-runtime';
|
|
|
13
13
|
var _MultiAllyMessages;
|
|
14
14
|
|
|
15
15
|
const MultiSelectedValuesContainer = () => {
|
|
16
|
+
var _inputRef$current2;
|
|
17
|
+
|
|
16
18
|
const {
|
|
17
19
|
props: {
|
|
18
20
|
selectedValues
|
|
@@ -29,19 +31,23 @@ const MultiSelectedValuesContainer = () => {
|
|
|
29
31
|
}
|
|
30
32
|
}, void 0, /*#__PURE__*/_jsx(DSPillGroupV2, {
|
|
31
33
|
innerRef: pillGroupRef
|
|
32
|
-
}, void 0, multiSelectedValue.length > 0 && multiSelectedValue.slice(0, correctPillsToShow).map(option =>
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
}, void 0, multiSelectedValue.length > 0 && multiSelectedValue.slice(0, correctPillsToShow).map(option => {
|
|
35
|
+
var _inputRef$current;
|
|
36
|
+
|
|
37
|
+
return /*#__PURE__*/_jsx(DSPillV2, {
|
|
38
|
+
size: "s",
|
|
39
|
+
labelTruncated: ((_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.value) === '' || correctPillsToShow !== pillsToShow,
|
|
40
|
+
label: option.label,
|
|
41
|
+
type: "value"
|
|
42
|
+
}, option.value);
|
|
43
|
+
}), multiSelectedValue.length > 0 && correctPillsToShow !== multiSelectedValue.length && /*#__PURE__*/_jsx(DSPillV2, {
|
|
38
44
|
size: "s",
|
|
39
45
|
labelTruncated: false,
|
|
40
46
|
label: "+".concat(multiSelectedValue.length - correctPillsToShow),
|
|
41
47
|
type: "value"
|
|
42
48
|
}, "grouped"))), [pillsToShow, pillGroupRef, inputRef, multiSelectedValue, correctPillsToShow]);
|
|
43
49
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
44
|
-
children: [multiSelectedValue.length > 0 && !inputRef.current.value && (_MultiAllyMessages || (_MultiAllyMessages = /*#__PURE__*/_jsx(MultiAllyMessages, {}))), pills]
|
|
50
|
+
children: [multiSelectedValue.length > 0 && !((_inputRef$current2 = inputRef.current) !== null && _inputRef$current2 !== void 0 && _inputRef$current2.value) && (_MultiAllyMessages || (_MultiAllyMessages = /*#__PURE__*/_jsx(MultiAllyMessages, {}))), pills]
|
|
45
51
|
});
|
|
46
52
|
};
|
|
47
53
|
|
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
import { PropTypes } from 'react-desc';
|
|
2
2
|
|
|
3
3
|
const propTypes = {
|
|
4
|
-
placeholder: PropTypes.string.description('').defaultValue(''),
|
|
5
|
-
options: PropTypes.oneOfType([PropTypes.array, PropTypes.object]).description('').defaultValue([]),
|
|
6
|
-
selectedValues: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.object), PropTypes.object]).description(''),
|
|
7
|
-
autoFocus: PropTypes.bool.description('').defaultValue('false'),
|
|
8
|
-
hasError: PropTypes.bool.description('').defaultValue('false'),
|
|
9
|
-
onChange: PropTypes.func.description('').defaultValue(''),
|
|
10
|
-
onSelectAll: PropTypes.func.description('').defaultValue(''),
|
|
11
|
-
onFilter: PropTypes.func.description('').defaultValue(''),
|
|
12
|
-
onCreate: PropTypes.func.description('').defaultValue(''),
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
onMenuOpen: PropTypes.func.description('').defaultValue(''),
|
|
4
|
+
placeholder: PropTypes.string.description('input s placeholder value').defaultValue(''),
|
|
5
|
+
options: PropTypes.oneOfType([PropTypes.array, PropTypes.object]).description('List of options').defaultValue([]),
|
|
6
|
+
selectedValues: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.object), PropTypes.object]).description('Array of option or single option selected'),
|
|
7
|
+
autoFocus: PropTypes.bool.description('Whether the combo box uses auto focus or not').defaultValue('false'),
|
|
8
|
+
hasError: PropTypes.bool.description('Whether the combo box has error or not').defaultValue('false'),
|
|
9
|
+
onChange: PropTypes.func.description('function triggered when an option is selected it will send the options selected').defaultValue(''),
|
|
10
|
+
onSelectAll: PropTypes.func.description('function triggered when ALL button is selected from the header menu list').defaultValue(''),
|
|
11
|
+
onFilter: PropTypes.func.description('function triggered when user type in the combobox input').defaultValue(''),
|
|
12
|
+
onCreate: PropTypes.func.description('function triggered when user select "create" a new item whenever is not a match in the all option list').defaultValue(''),
|
|
13
|
+
onClearAll: PropTypes.func.description('function triggered when user select CLEAR button from the header menu list').defaultValue(''),
|
|
14
|
+
onMenuOpen: PropTypes.func.description('function triggered when user open the menu list').defaultValue(''),
|
|
16
15
|
inputMinWidth: PropTypes.any.description('Minimum width for the combo box input controller').defaultValue(undefined),
|
|
17
16
|
menuMinWidth: PropTypes.any.description('Minimum width for the dropdown menu').defaultValue(undefined),
|
|
18
17
|
menuMaxHeight: PropTypes.any.description('Maximum height for the dropdown menu').defaultValue(undefined),
|
|
19
|
-
withToggle: PropTypes.bool.description('').defaultValue('false')
|
|
18
|
+
withToggle: PropTypes.bool.description('POC purpose this prop will not remain').defaultValue('false')
|
|
20
19
|
};
|
|
21
20
|
|
|
22
21
|
export { propTypes };
|
|
@@ -50,7 +50,7 @@ const useKeyboardNavigation = () => {
|
|
|
50
50
|
|
|
51
51
|
onKeyDown(e, currentItem); // =============================================================================
|
|
52
52
|
// ENTER KEY TO CREATE ELEMENTS
|
|
53
|
-
//
|
|
53
|
+
// ====================================================== =================
|
|
54
54
|
|
|
55
55
|
if (e.key === 'Enter' && onCreate && !selectableOptions.length) {
|
|
56
56
|
onCreate(targetElement.value);
|
|
@@ -65,7 +65,7 @@ const useKeyboardNavigation = () => {
|
|
|
65
65
|
if (e.keyCode === 32 && targetElement.value === '' || e.key === 'Enter') {
|
|
66
66
|
e.preventDefault();
|
|
67
67
|
|
|
68
|
-
if (!showPopover) {
|
|
68
|
+
if (!showPopover && !inline) {
|
|
69
69
|
setShowPopover(true);
|
|
70
70
|
} else {
|
|
71
71
|
selectOption();
|
|
@@ -88,8 +88,9 @@ const useKeyboardNavigation = () => {
|
|
|
88
88
|
|
|
89
89
|
|
|
90
90
|
if (e.key === 'ArrowDown') {
|
|
91
|
+
e.preventDefault();
|
|
92
|
+
|
|
91
93
|
if (showPopover || inline) {
|
|
92
|
-
e.preventDefault();
|
|
93
94
|
const nextItemIndex = findInCircularList(options, currentItemIndex, isOptionFocuseable);
|
|
94
95
|
setCurrentOption(options[nextItemIndex].dsId);
|
|
95
96
|
scrollOptionIntoView(options[nextItemIndex].dsId);
|
|
@@ -99,8 +100,9 @@ const useKeyboardNavigation = () => {
|
|
|
99
100
|
}
|
|
100
101
|
|
|
101
102
|
if (e.key === 'ArrowUp') {
|
|
103
|
+
e.preventDefault();
|
|
104
|
+
|
|
102
105
|
if (showPopover || inline) {
|
|
103
|
-
e.preventDefault();
|
|
104
106
|
const nextItemIndex = findInCircularList(options, currentItemIndex, isOptionFocuseable, -1);
|
|
105
107
|
setCurrentOption(options[nextItemIndex].dsId);
|
|
106
108
|
scrollOptionIntoView(options[nextItemIndex].dsId);
|
|
@@ -110,7 +112,7 @@ const useKeyboardNavigation = () => {
|
|
|
110
112
|
const nextItemIndex = findInCircularList(options, 0, isOptionFocuseable, -1);
|
|
111
113
|
setCurrentOption(options[nextItemIndex].dsId);
|
|
112
114
|
scrollOptionIntoView(options[nextItemIndex].dsId);
|
|
113
|
-
}
|
|
115
|
+
});
|
|
114
116
|
}
|
|
115
117
|
} // =============================================================================
|
|
116
118
|
// ESCAPE
|
|
@@ -118,9 +120,9 @@ const useKeyboardNavigation = () => {
|
|
|
118
120
|
|
|
119
121
|
|
|
120
122
|
if (e.key === 'Escape' && !inline) {
|
|
121
|
-
setShowPopover(false);
|
|
122
|
-
onFilter('');
|
|
123
|
-
inputRef.current.value = '';
|
|
123
|
+
setShowPopover(false); // TODO confirm funcionality
|
|
124
|
+
// onFilter('');
|
|
125
|
+
// inputRef.current.value = '';
|
|
124
126
|
} // =============================================================================
|
|
125
127
|
// BACKSPACE
|
|
126
128
|
// =============================================================================
|
|
@@ -138,9 +140,7 @@ const useKeyboardNavigation = () => {
|
|
|
138
140
|
setShowSelectedValue(true);
|
|
139
141
|
}
|
|
140
142
|
|
|
141
|
-
if (e.key === 'Tab' && inline)
|
|
142
|
-
e.preventDefault();
|
|
143
|
-
}
|
|
143
|
+
if (e.key === 'Tab' && inline) ;
|
|
144
144
|
}, [scrollOptionIntoView, currentItemIndex, options, currentItem, selectableOptions, inputRef, multiple, showPopover, selectedValues, inline, onKeyDown, onSelectAll, onChange, onCreate, onFilter, setCurrentOption, setShowPopover, setShowSelectedValue, selectOption]);
|
|
145
145
|
return onInputKeyDown;
|
|
146
146
|
};
|
|
@@ -10,7 +10,7 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
10
10
|
|
|
11
11
|
const MenuItem = props => {
|
|
12
12
|
const propsWithDefault = useMemoMergePropsWithDefault(props, defaultProps);
|
|
13
|
-
useValidateTypescriptPropTypes(propsWithDefault,
|
|
13
|
+
useValidateTypescriptPropTypes(propsWithDefault, itemProps);
|
|
14
14
|
const {
|
|
15
15
|
dsId,
|
|
16
16
|
label,
|
|
@@ -9,7 +9,7 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
9
9
|
|
|
10
10
|
const Section = props => {
|
|
11
11
|
const propsWithDefault = useMemoMergePropsWithDefault(props, defaultProps);
|
|
12
|
-
useValidateTypescriptPropTypes(propsWithDefault,
|
|
12
|
+
useValidateTypescriptPropTypes(propsWithDefault, itemProps);
|
|
13
13
|
const {
|
|
14
14
|
label,
|
|
15
15
|
wrapperStyles,
|
|
@@ -5,7 +5,6 @@ import { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text'
|
|
|
5
5
|
import { Checkmark } from '@elliemae/ds-icons';
|
|
6
6
|
import Grid from '@elliemae/ds-grid';
|
|
7
7
|
import { itemProps, defaultProps } from '../../props.js';
|
|
8
|
-
import { StyledItemChecked, StyledItemLabel } from './styled.js';
|
|
9
8
|
import { StyledGlobalMenuItemWrapper } from '../styled.js';
|
|
10
9
|
import { jsx } from 'react/jsx-runtime';
|
|
11
10
|
|
|
@@ -42,15 +41,16 @@ const SingleMenuItem = props => {
|
|
|
42
41
|
pr: render ? 0 : 40,
|
|
43
42
|
"data-testid": dataTestid,
|
|
44
43
|
children: render ? render(props) : /*#__PURE__*/_jsx(Grid, {
|
|
45
|
-
cols: ['
|
|
44
|
+
cols: ['16px', 'auto'],
|
|
46
45
|
height: "16px",
|
|
47
|
-
gutter: "xxs"
|
|
48
|
-
|
|
46
|
+
gutter: "xxs",
|
|
47
|
+
alignItems: "center"
|
|
48
|
+
}, void 0, /*#__PURE__*/_jsx("div", {}, void 0, isSelected && /*#__PURE__*/_jsx(Checkmark, {
|
|
49
49
|
size: "s",
|
|
50
50
|
color: ['brand-primary', '600']
|
|
51
|
-
})), /*#__PURE__*/_jsx(
|
|
51
|
+
})), /*#__PURE__*/_jsx(SimpleTruncatedTooltipText, {
|
|
52
52
|
value: label
|
|
53
|
-
}))
|
|
53
|
+
}))
|
|
54
54
|
});
|
|
55
55
|
};
|
|
56
56
|
|
|
@@ -27,7 +27,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
27
27
|
|
|
28
28
|
const SubmenuItem = props => {
|
|
29
29
|
const propsWithDefault = useMemoMergePropsWithDefault(props, defaultProps);
|
|
30
|
-
useValidateTypescriptPropTypes(propsWithDefault,
|
|
30
|
+
useValidateTypescriptPropTypes(propsWithDefault, itemProps);
|
|
31
31
|
const {
|
|
32
32
|
dsId,
|
|
33
33
|
label,
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _taggedTemplateLiteral from '@babel/runtime/helpers/esm/taggedTemplateLiteral';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { css } from '@elliemae/ds-system';
|
|
2
4
|
import { position, layout } from 'styled-system';
|
|
3
5
|
|
|
6
|
+
var _templateObject, _templateObject2;
|
|
7
|
+
|
|
4
8
|
const borderOutside = function (color) {
|
|
5
9
|
let width = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
6
|
-
return css([":after{display:block
|
|
10
|
+
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n :after {\n display: block;\n content: ' ';\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n border: ", "px solid ", ";\n pointer-events: none;\n z-index: 7;\n }\n"])), width, color);
|
|
7
11
|
};
|
|
8
12
|
|
|
9
|
-
const disabledOption = () => css(["cursor:not-allowed
|
|
13
|
+
const disabledOption = () => css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n cursor: not-allowed;\n * {\n cursor: not-allowed;\n }\n"])));
|
|
10
14
|
|
|
11
15
|
const activeBorderCss = props => borderOutside(props.theme.colors.brand[500]);
|
|
12
16
|
|