@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.
Files changed (173) hide show
  1. package/cjs/ComboBox/v1/DSComboBox.js +18 -22
  2. package/cjs/ComboBox/v1/withSelectStringValueConverter.js +3 -4
  3. package/cjs/ComboBox/v3/ComboBox.js +1 -2
  4. package/cjs/ComboBox/v3/ComboBoxCTX.js +22 -15
  5. package/cjs/ComboBox/v3/ComboboxDataTestids.js +3 -1
  6. package/cjs/ComboBox/v3/config/useComboBox.js +65 -21
  7. package/cjs/ComboBox/v3/parts/container/Container.js +28 -18
  8. package/cjs/ComboBox/v3/parts/controls/Controls.js +3 -1
  9. package/cjs/ComboBox/v3/parts/controls/styled.js +30 -8
  10. package/cjs/ComboBox/v3/parts/controls-input/ControlsInput.js +5 -3
  11. package/cjs/ComboBox/v3/parts/controls-input/styled.js +1 -1
  12. package/cjs/ComboBox/v3/parts/controls-input/useControlsInput.js +19 -21
  13. package/cjs/ComboBox/v3/parts/dropdown-indicator/DropdownIndicator.js +0 -3
  14. package/cjs/ComboBox/v3/parts/dropdown-indicator/styled.js +1 -1
  15. package/cjs/ComboBox/v3/parts/header-list/HeaderList.js +61 -37
  16. package/cjs/ComboBox/v3/parts/header-list/styled.js +31 -8
  17. package/cjs/ComboBox/v3/parts/header-list/useHeaderListHandlers.js +73 -0
  18. package/cjs/ComboBox/v3/parts/menu-list/MenuList.js +32 -18
  19. package/cjs/ComboBox/v3/parts/menu-list/styled.js +17 -2
  20. package/cjs/ComboBox/v3/parts/menu-list/useItemRenderer.js +105 -0
  21. package/cjs/ComboBox/v3/parts/menu-list/useMenuList.js +42 -85
  22. package/cjs/ComboBox/v3/parts/multi-selected-values-container/MultiSelectedValuesContainer.js +26 -35
  23. package/cjs/ComboBox/v3/parts/multi-selected-values-container/useGroupPills.js +10 -6
  24. package/cjs/ComboBox/v3/propTypes.js +15 -11
  25. package/cjs/ComboBox/v3/utils/hooks/useKeyboardNavigation.js +28 -30
  26. package/cjs/ComboBox/v3/utils/hooks/useOnElementResize.js +4 -4
  27. package/cjs/FloatingLabelInput/FloatingLabelInputImpl.js +4 -7
  28. package/cjs/FormItem/ValidationFieldWrapper.js +2 -3
  29. package/cjs/Input/InputAddonWrapper.js +2 -3
  30. package/cjs/Input/InputImpl.js +16 -18
  31. package/cjs/InputGroup/AddonWrapper.js +4 -6
  32. package/cjs/InputMask/DSInputMaskDeprecated.js +10 -12
  33. package/cjs/MenuItem/components/MenuItem/index.js +1 -1
  34. package/cjs/MenuItem/components/MultiMenuItem/MultiMenuItem.js +1 -0
  35. package/cjs/MenuItem/components/Section/index.js +1 -1
  36. package/cjs/MenuItem/components/Section/styled.js +1 -1
  37. package/cjs/MenuItem/components/Separator/styled.js +2 -2
  38. package/cjs/MenuItem/components/SingleMenuItem/SingleMenuItem.js +6 -6
  39. package/cjs/MenuItem/components/SubmenuItem/index.js +1 -1
  40. package/cjs/MenuItem/components/styled.js +12 -4
  41. package/cjs/SearchBox/withSearchable.js +3 -5
  42. package/cjs/Toggle/DSToggleImpl.js +28 -28
  43. package/esm/ComboBox/v1/DSComboBox.js +17 -21
  44. package/esm/ComboBox/v1/withSelectStringValueConverter.js +3 -4
  45. package/esm/ComboBox/v3/ComboBox.js +1 -2
  46. package/esm/ComboBox/v3/ComboBoxCTX.js +17 -10
  47. package/esm/ComboBox/v3/ComboboxDataTestids.js +3 -1
  48. package/esm/ComboBox/v3/config/useComboBox.js +62 -22
  49. package/esm/ComboBox/v3/parts/container/Container.js +29 -19
  50. package/esm/ComboBox/v3/parts/controls/Controls.js +3 -1
  51. package/esm/ComboBox/v3/parts/controls/styled.js +30 -9
  52. package/esm/ComboBox/v3/parts/controls-input/ControlsInput.js +5 -3
  53. package/esm/ComboBox/v3/parts/controls-input/styled.js +1 -1
  54. package/esm/ComboBox/v3/parts/controls-input/useControlsInput.js +20 -22
  55. package/esm/ComboBox/v3/parts/dropdown-indicator/DropdownIndicator.js +0 -3
  56. package/esm/ComboBox/v3/parts/dropdown-indicator/styled.js +1 -1
  57. package/esm/ComboBox/v3/parts/header-list/HeaderList.js +63 -39
  58. package/esm/ComboBox/v3/parts/header-list/styled.js +28 -8
  59. package/esm/ComboBox/v3/parts/header-list/useHeaderListHandlers.js +69 -0
  60. package/esm/ComboBox/v3/parts/menu-list/MenuList.js +35 -21
  61. package/esm/ComboBox/v3/parts/menu-list/styled.js +17 -3
  62. package/esm/ComboBox/v3/parts/menu-list/useItemRenderer.js +97 -0
  63. package/esm/ComboBox/v3/parts/menu-list/useMenuList.js +43 -82
  64. package/esm/ComboBox/v3/parts/multi-selected-values-container/MultiSelectedValuesContainer.js +26 -35
  65. package/esm/ComboBox/v3/parts/multi-selected-values-container/useGroupPills.js +10 -6
  66. package/esm/ComboBox/v3/propTypes.js +15 -11
  67. package/esm/ComboBox/v3/utils/hooks/useKeyboardNavigation.js +28 -30
  68. package/esm/ComboBox/v3/utils/hooks/useOnElementResize.js +4 -4
  69. package/esm/FloatingLabelInput/FloatingLabelInputImpl.js +4 -7
  70. package/esm/FormItem/ValidationFieldWrapper.js +2 -3
  71. package/esm/Input/InputAddonWrapper.js +2 -3
  72. package/esm/Input/InputImpl.js +15 -17
  73. package/esm/InputGroup/AddonWrapper.js +5 -7
  74. package/esm/InputMask/DSInputMaskDeprecated.js +10 -12
  75. package/esm/MenuItem/components/MenuItem/index.js +1 -1
  76. package/esm/MenuItem/components/MultiMenuItem/MultiMenuItem.js +1 -0
  77. package/esm/MenuItem/components/Section/index.js +1 -1
  78. package/esm/MenuItem/components/Section/styled.js +1 -1
  79. package/esm/MenuItem/components/Separator/styled.js +2 -2
  80. package/esm/MenuItem/components/SingleMenuItem/SingleMenuItem.js +6 -6
  81. package/esm/MenuItem/components/SubmenuItem/index.js +1 -1
  82. package/esm/MenuItem/components/styled.js +13 -6
  83. package/esm/SearchBox/withSearchable.js +2 -4
  84. package/esm/Toggle/DSToggleImpl.js +28 -28
  85. package/package.json +40 -27
  86. package/types/Checkbox/DSCheckbox.d.ts +78 -13
  87. package/types/Checkbox/elements/CheckMark.d.ts +1 -1
  88. package/types/Checkbox/props.d.ts +58 -12
  89. package/types/CheckboxGroup/DSCheckboxGroup.d.ts +51 -7
  90. package/types/CheckboxGroup/props.d.ts +37 -6
  91. package/types/ComboBox/v2/Combobox.d.ts +56 -1
  92. package/types/ComboBox/v3/ComboBox.d.ts +54 -12
  93. package/types/ComboBox/v3/ComboboxDataTestids.d.ts +2 -0
  94. package/types/ComboBox/v3/parts/a11y-messages/styled.d.ts +1 -1
  95. package/types/ComboBox/v3/parts/container/styled.d.ts +3 -3
  96. package/types/ComboBox/v3/parts/controls/styled.d.ts +5 -5
  97. package/types/ComboBox/v3/parts/controls-input/styled.d.ts +4 -4
  98. package/types/ComboBox/v3/parts/controls-input/useControlsInput.d.ts +3 -3
  99. package/types/ComboBox/v3/parts/dropdown-indicator/styled.d.ts +1 -60
  100. package/types/ComboBox/v3/parts/empty-state/styled.d.ts +2 -2
  101. package/types/ComboBox/v3/parts/header-list/styled.d.ts +7 -93
  102. package/types/ComboBox/v3/parts/header-list/useHeaderListHandlers.d.ts +12 -0
  103. package/types/ComboBox/v3/parts/menu-list/styled.d.ts +9 -3
  104. package/types/ComboBox/v3/parts/menu-list/useItemRenderer.d.ts +2 -0
  105. package/types/ComboBox/v3/parts/menu-list/useMenuList.d.ts +1 -1
  106. package/types/ComboBox/v3/parts/multi-selected-values-container/styled.d.ts +3 -3
  107. package/types/ComboBox/v3/parts/multi-selected-values-container/useGroupPills.d.ts +1 -2
  108. package/types/ComboBox/v3/parts/single-selected-value-container/styled.d.ts +1 -1
  109. package/types/ComboBox/v3/propTypes.d.ts +49 -11
  110. package/types/ComboBox/v3/tests/combobox-special-keys.test.d.ts +1 -0
  111. package/types/ComboBox/v3/tests/utils.d.ts +5 -0
  112. package/types/ComboBox/v3/utils/hooks/useKeyboardNavigation.d.ts +4 -1
  113. package/types/ComboBox/v3/utils/listHelper.d.ts +1 -1
  114. package/types/DateInput/DSDateInput.d.ts +97 -16
  115. package/types/DateInput/props.d.ts +97 -16
  116. package/types/DateInputV2/components/DSDateInput.d.ts +72 -5
  117. package/types/DateInputV2/components/props.d.ts +61 -10
  118. package/types/DateInputV2/components/styled.d.ts +4 -4
  119. package/types/FloatingLabelInput/DSFloatingLabelInput.d.ts +118 -20
  120. package/types/FormItem/DSFormItemLayout.d.ts +390 -60
  121. package/types/FormItem/Error/DSError.d.ts +21 -3
  122. package/types/FormItem/Suffix/Suffix.d.ts +3 -3
  123. package/types/FormItem/defaultProps.d.ts +118 -20
  124. package/types/FormItem/props.d.ts +229 -39
  125. package/types/InputGroup/DSInputGroup.d.ts +56 -8
  126. package/types/InputGroup/props.d.ts +43 -7
  127. package/types/InputMask/DSInputMask.d.ts +172 -30
  128. package/types/InputMask/mask_types/DateInputMask.d.ts +34 -33
  129. package/types/InputMask/mask_types/DateTimeInputMask.d.ts +34 -33
  130. package/types/InputMask/mask_types/DictionaryInputMask.d.ts +37 -36
  131. package/types/InputMask/mask_types/NumberInputMask.d.ts +46 -45
  132. package/types/InputMask/mask_types/PhoneInputMask.d.ts +34 -33
  133. package/types/InputMask/mask_types/PhoneInternationalInputMask.d.ts +34 -33
  134. package/types/InputMask/mask_types/SsnInputMask.d.ts +34 -33
  135. package/types/InputMask/mask_types/UsZipCodeInputMask.d.ts +34 -33
  136. package/types/InputMask/mask_types/ZipCodeSearchInputMask.d.ts +34 -33
  137. package/types/InputMask/props.d.ts +172 -30
  138. package/types/InputProtected/DSInputProtected.d.ts +56 -7
  139. package/types/InputProtected/props.d.ts +43 -8
  140. package/types/LargeInputText/DSLargeInputText.d.ts +163 -27
  141. package/types/LargeInputText/props.d.ts +163 -27
  142. package/types/MenuItem/components/MenuItem/index.d.ts +12 -3
  143. package/types/MenuItem/components/MenuItem/styled.d.ts +1 -1
  144. package/types/MenuItem/components/MultiMenuItem/MultiMenuItem.d.ts +12 -3
  145. package/types/MenuItem/components/MultiMenuItem/styled.d.ts +1 -1
  146. package/types/MenuItem/components/Section/index.d.ts +4 -1
  147. package/types/MenuItem/components/Section/props.d.ts +4 -1
  148. package/types/MenuItem/components/Section/styled.d.ts +2 -2
  149. package/types/MenuItem/components/Separator/styled.d.ts +2 -2
  150. package/types/MenuItem/components/SingleMenuItem/SingleMenuItem.d.ts +7 -2
  151. package/types/MenuItem/components/SubmenuItem/index.d.ts +12 -3
  152. package/types/MenuItem/components/SubmenuItem/styled.d.ts +2 -2
  153. package/types/MenuItem/components/styled.d.ts +3 -3
  154. package/types/MenuItem/props.d.ts +7 -2
  155. package/types/Radio/Circle.d.ts +1 -1
  156. package/types/Radio/DSRadio.d.ts +79 -13
  157. package/types/RadioGroup/DSRadioGroup.d.ts +51 -7
  158. package/types/RadioGroup/props.d.ts +37 -6
  159. package/types/SearchBox/DSSearchBox.d.ts +146 -21
  160. package/types/SearchBox/NavSearchBox.d.ts +18 -3
  161. package/types/SearchBox/SButton.d.ts +13 -2
  162. package/types/SearchBox/props.d.ts +133 -22
  163. package/types/SearchBox/styled.d.ts +1 -49
  164. package/types/TextBox/DSTextBox.d.ts +146 -21
  165. package/types/TimeInput/DSTimeInput.d.ts +83 -12
  166. package/types/TimeInput/utils.d.ts +1 -1
  167. package/types/Toggle/DSToggle.d.ts +84 -12
  168. package/cjs/ComboBox/v3/utils/hooks/useOnWindowResize.js +0 -31
  169. package/cjs/MenuItem/components/SingleMenuItem/styled.js +0 -19
  170. package/esm/ComboBox/v3/utils/hooks/useOnWindowResize.js +0 -27
  171. package/esm/MenuItem/components/SingleMenuItem/styled.js +0 -10
  172. package/types/ComboBox/v3/utils/hooks/useOnWindowResize.d.ts +0 -5
  173. package/types/MenuItem/components/SingleMenuItem/styled.d.ts +0 -2
@@ -1,26 +1,47 @@
1
- import styled, { css } from 'styled-components';
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
 
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];
10
+ }
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;
18
+ return theme.colors.brand[700];
19
+ });
4
20
  const StyledControlsWrapper = /*#__PURE__*/styled(Grid).withConfig({
5
21
  componentId: "sc-64uci7-0"
6
- })(["background:transparent;position:relative;border:1px solid ", ";border-radius:2px;align-items:center;align-content:center;height:28px;padding-left:8px;margin:", ";", " &:hover{border:1px solid ", ";}"], props => props.hasError ? props.theme.colors.danger[900] : props.theme.colors.neutral[400], _ref => {
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 => {
7
23
  let {
24
+ minWidth,
8
25
  inline
9
- } = _ref;
26
+ } = _ref2;
27
+ return inline ? '' : "".concat(minWidth, "px");
28
+ }, _ref3 => {
29
+ let {
30
+ inline
31
+ } = _ref3;
10
32
  return inline ? '10px 16px' : 'none';
11
- }, props => props.hasFocus && focusMixin, props => props.theme.colors.brand[600]);
12
- const focusMixin = /*#__PURE__*/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 => {
33
+ }, _ref4 => {
13
34
  let {
14
- theme
15
- } = _ref2;
16
- return theme.colors.brand[700];
35
+ hasFocus
36
+ } = _ref4;
37
+ return hasFocus ? focusBorder : normalBorder;
17
38
  });
18
39
  const StyledSelection = /*#__PURE__*/styled.div.withConfig({
19
40
  componentId: "sc-64uci7-1"
20
41
  })(["font-size:13px;margin-right:3px;line-height:13px;display:flex;"]);
21
42
  const StyledHeaderActionsWrapper = /*#__PURE__*/styled.div.withConfig({
22
43
  componentId: "sc-64uci7-2"
23
- })(["align-items:center;align-self:stretch;display:flex;box-sizing:border-box;height:26px;.em-ds-button--text:focus::after{border:none;}"]);
44
+ })(["align-items:center;align-self:stretch;display:flex;box-sizing:border-box;height:28px;.em-ds-button--text:focus::after{border:none;}"]);
24
45
  const StyleDropdownIndicator = /*#__PURE__*/styled.div.withConfig({
25
46
  componentId: "sc-64uci7-3"
26
47
  })([""]);
@@ -17,9 +17,11 @@ const ControlsInput = () => {
17
17
  focusOptionIdx,
18
18
  inputRef
19
19
  } = useContext(ComboBoxContext);
20
- const onInputKeyDown = useKeyboardNavigation();
21
20
  const {
22
- span,
21
+ onInputKeyDown
22
+ } = useKeyboardNavigation();
23
+ const {
24
+ spanReference,
23
25
  width,
24
26
  spanReferenceText,
25
27
  showPlaceholder,
@@ -28,7 +30,7 @@ const ControlsInput = () => {
28
30
  handleOnFocus
29
31
  } = useControlsInput();
30
32
  return /*#__PURE__*/_jsx(StyledInputWrapper, {}, void 0, /*#__PURE__*/jsx(StyledInputWidthReference, {
31
- ref: span,
33
+ ref: spanReference,
32
34
  children: spanReferenceText
33
35
  }), /*#__PURE__*/_jsx(StyledInputPlaceHolder, {}, void 0, /*#__PURE__*/_jsx(SimpleTruncatedTooltipText, {
34
36
  value: showPlaceholder
@@ -2,7 +2,7 @@ import styled from 'styled-components';
2
2
 
3
3
  const StyledInput = /*#__PURE__*/styled.input.withConfig({
4
4
  componentId: "sc-1ue5xik-0"
5
- })(["font-size:13px;line-height:13px;border:none;padding:0;outline:none;&:focus{outline:none;}"]);
5
+ })(["font-size:13px;line-height:13px;border:none;padding:0;outline:none;color:", ";&:focus{outline:none;}"], props => props.theme.colors.neutral[700]);
6
6
  const StyledInputPlaceHolder = /*#__PURE__*/styled.div.withConfig({
7
7
  componentId: "sc-1ue5xik-1"
8
8
  })(["font-style:italic;color:", ";position:absolute;display:flex;align-items:center;width:100%;user-select:none;height:28px;"], props => props.theme.colors.neutral[500]);
@@ -2,7 +2,7 @@ import 'core-js/modules/web.dom-collections.iterator.js';
2
2
  import 'core-js/modules/es.string.replace.js';
3
3
  import { useContext, useState, useRef, useEffect, useCallback, useMemo } from 'react';
4
4
  import { ComboBoxContext } from '../../ComboBoxCTX.js';
5
- import { findInCircularList, isSelectedValueEmpty } from '../../utils/listHelper.js';
5
+ import { isSelectedValueEmpty } from '../../utils/listHelper.js';
6
6
 
7
7
  const useControlsInput = () => {
8
8
  var _inputRef$current, _inputRef$current2, _inputRef$current3;
@@ -10,23 +10,23 @@ const useControlsInput = () => {
10
10
  const {
11
11
  props: {
12
12
  selectedValues,
13
- options,
14
13
  placeholder,
15
14
  onFilter
16
15
  },
17
16
  setShowPopover,
18
17
  setCurrentOption,
19
18
  inputRef,
20
- listRef,
19
+ wrapperListRef,
21
20
  setHasFocus,
22
- setShowSelectedValue
21
+ setShowSelectedValue,
22
+ setShowSelectedOptions
23
23
  } = useContext(ComboBoxContext);
24
- const [width, setWidth] = useState();
25
- const span = useRef(null);
24
+ const [width, setWidth] = useState(1);
25
+ const spanReference = useRef(null);
26
26
  useEffect(() => {
27
- var _span$current;
27
+ var _spanReference$curren;
28
28
 
29
- setWidth(((_span$current = span.current) === null || _span$current === void 0 ? void 0 : _span$current.offsetWidth) || 1);
29
+ setWidth(((_spanReference$curren = spanReference.current) === null || _spanReference$curren === void 0 ? void 0 : _spanReference$curren.offsetWidth) || 1);
30
30
  }, [(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.value]);
31
31
  useEffect(() => {
32
32
  setShowSelectedValue(true);
@@ -34,31 +34,29 @@ const useControlsInput = () => {
34
34
  // and refresh selected values and update filter outside value.
35
35
 
36
36
  const handleOnChange = useCallback(e => {
37
- if (e.target.value) setShowSelectedValue(false);
37
+ setShowSelectedOptions(false);
38
+ if (e.currentTarget.value) setShowSelectedValue(false);
38
39
  setShowPopover(true);
39
- onFilter(e.target.value);
40
- }, [onFilter, setShowPopover, setShowSelectedValue]);
40
+ onFilter(e.currentTarget.value);
41
+ }, [onFilter, setShowPopover, setShowSelectedOptions, setShowSelectedValue]);
41
42
  const handleOnBlur = useCallback(() => {
43
+ setHasFocus(false);
42
44
  setTimeout(() => {
43
- var _listRef$current;
45
+ var _wrapperListRef$curre;
44
46
 
45
- if (!(listRef !== null && listRef !== void 0 && (_listRef$current = listRef.current) !== null && _listRef$current !== void 0 && _listRef$current.contains(document.activeElement))) {
47
+ if (!(wrapperListRef !== null && wrapperListRef !== void 0 && (_wrapperListRef$curre = wrapperListRef.current) !== null && _wrapperListRef$curre !== void 0 && _wrapperListRef$curre.contains(document.activeElement))) {
46
48
  setShowPopover(false);
47
49
  }
48
50
 
49
51
  setCurrentOption('');
50
- setHasFocus(false);
51
52
  setShowSelectedValue(true);
52
53
  onFilter('');
53
54
  if (inputRef.current) inputRef.current.value = '';
54
- }, 100);
55
- }, [setHasFocus, setCurrentOption, listRef, onFilter, inputRef, setShowPopover, setShowSelectedValue]);
55
+ });
56
+ }, [setHasFocus, setCurrentOption, wrapperListRef, onFilter, inputRef, setShowPopover, setShowSelectedValue]);
56
57
  const handleOnFocus = useCallback(() => {
57
58
  setHasFocus(true);
58
- setShowPopover(true);
59
- const firstItem = findInCircularList(options, -1, opt => !['section', 'separator'].includes(opt.type));
60
- setCurrentOption(options[firstItem] ? options[firstItem].dsId : '');
61
- }, [setHasFocus, options, setCurrentOption, setShowPopover]);
59
+ }, [setHasFocus]);
62
60
  const showPlaceholder = !((_inputRef$current2 = inputRef.current) !== null && _inputRef$current2 !== void 0 && _inputRef$current2.value) && isSelectedValueEmpty(selectedValues) ? placeholder : null;
63
61
  const spanReferenceText = (_inputRef$current3 = inputRef.current) === null || _inputRef$current3 === void 0 ? void 0 : _inputRef$current3.value.replace(/\s/g, '\u00a0');
64
62
  return useMemo(() => ({
@@ -68,8 +66,8 @@ const useControlsInput = () => {
68
66
  showPlaceholder,
69
67
  spanReferenceText,
70
68
  width,
71
- span
72
- }), [handleOnFocus, handleOnBlur, handleOnChange, spanReferenceText, showPlaceholder, width, span]);
69
+ spanReference
70
+ }), [handleOnFocus, handleOnBlur, handleOnChange, spanReferenceText, showPlaceholder, width, spanReference]);
73
71
  };
74
72
 
75
73
  export { useControlsInput };
@@ -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,58 +1,47 @@
1
1
  import _jsx from '@babel/runtime/helpers/esm/jsx';
2
- import { useContext, useCallback } from 'react';
2
+ import { useContext } from 'react';
3
+ import { noop } from 'lodash';
3
4
  import { ComboBoxContext } from '../../ComboBoxCTX.js';
4
- import { StyledHeaderListWrapper, StyledSelectedItems, ActionButtons, StyledButton, StyledSeparator } from './styled.js';
5
+ import { StyledHeaderListWrapper, StyledSelectedItems, StyledButton, StyledSeparator, StyledButtonSelection, StyledNoOptionsSelected, StyledShowAllButton } from './styled.js';
5
6
  import { getSelectableOptions } from '../../utils/listHelper.js';
6
7
  import { ComboboxDataTestid } from '../../ComboboxDataTestids.js';
8
+ import { useHeaderListHandlers } from './useHeaderListHandlers.js';
9
+ import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
7
10
 
8
- var _StyledSeparator;
11
+ var _StyledSeparator, _StyledNoOptionsSelec, _StyledSeparator2;
9
12
 
10
13
  const HeaderList = () => {
14
+ var _inputRef$current;
15
+
11
16
  const {
12
17
  props: {
13
18
  onSelectAll,
14
19
  onClearAll,
20
+ withToggle,
15
21
  selectedValues,
16
22
  options
17
23
  },
18
- inputRef,
19
- setShowPopover
24
+ showSelectedOptions,
25
+ inputRef
20
26
  } = useContext(ComboBoxContext);
27
+ const isSelectAllSupplied = onSelectAll !== noop;
28
+ const isClearAllSupplied = onClearAll !== noop;
21
29
  const multiSelectedValues = selectedValues;
22
30
  const selectableOptions = getSelectableOptions(options);
23
-
24
- const handleOnBlurSelectAll = e => {
25
- if (!onClearAll || multiSelectedValues.length === 0) {
26
- e.preventDefault();
27
- inputRef.current.focus();
28
- }
29
- };
30
-
31
- const handleOnBlurClearAll = e => {
32
- e.preventDefault();
33
- inputRef.current.focus();
34
- };
35
-
36
- const handleClickOnSelectAll = () => {
37
- onSelectAll();
38
- inputRef.current.focus();
39
- setShowPopover(false);
40
- };
41
-
42
- const handleClickOnClearAll = useCallback(e => {
43
- e.preventDefault();
44
- e.stopPropagation();
45
- onClearAll();
46
- inputRef.current.focus();
47
- }, [inputRef, onClearAll]);
48
- const handleOnMouseDown = useCallback(e => {
49
- e.preventDefault();
50
- }, []);
31
+ const {
32
+ handleKeyDown,
33
+ handleClickOnClearAll,
34
+ handleClickOnSelectAll,
35
+ handleOnBlurClearAll,
36
+ handleOnBlurSelectAll,
37
+ handleOnMouseDown,
38
+ handleToggle
39
+ } = useHeaderListHandlers();
51
40
  return /*#__PURE__*/_jsx(StyledHeaderListWrapper, {
41
+ onKeyDown: handleKeyDown,
52
42
  onMouseDown: handleOnMouseDown
53
- }, void 0, /*#__PURE__*/_jsx(StyledSelectedItems, {}, void 0, "".concat(multiSelectedValues.length, " Selected")), /*#__PURE__*/_jsx(ActionButtons, {}, void 0, onSelectAll && /*#__PURE__*/_jsx(StyledButton, {
54
- disabled: selectableOptions.length === multiSelectedValues.length,
55
- tabIndex: 0,
43
+ }, void 0, /*#__PURE__*/_jsx(StyledSelectedItems, {}, void 0, isSelectAllSupplied && /*#__PURE__*/_jsx(StyledButton, {
44
+ 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,
56
45
  "data-testid": ComboboxDataTestid.SELECT_ALL_BUTTON,
57
46
  buttonType: "text",
58
47
  labelText: "All",
@@ -60,21 +49,56 @@ const HeaderList = () => {
60
49
  onMouseDown: handleOnMouseDown,
61
50
  onBlur: handleOnBlurSelectAll,
62
51
  onClick: handleClickOnSelectAll
63
- }), onSelectAll && onClearAll && (_StyledSeparator || (_StyledSeparator = /*#__PURE__*/_jsx(StyledSeparator, {
52
+ }), isSelectAllSupplied && isClearAllSupplied && (_StyledSeparator || (_StyledSeparator = /*#__PURE__*/_jsx(StyledSeparator, {
64
53
  orientation: "vertical",
65
54
  position: "center",
66
55
  type: "group-level",
67
56
  margin: "none"
68
- }))), onClearAll && /*#__PURE__*/_jsx(StyledButton, {
57
+ }))), isClearAllSupplied && /*#__PURE__*/_jsx(StyledButton, {
69
58
  disabled: multiSelectedValues.length === 0,
70
59
  tabIndex: 0,
71
60
  "data-testid": ComboboxDataTestid.CLEAR_ALL_BUTTON,
72
61
  buttonType: "text",
73
- labelText: "Clear",
74
62
  size: "s",
63
+ labelText: "Clear",
75
64
  onMouseDown: handleOnMouseDown,
76
65
  onBlur: handleOnBlurClearAll,
77
66
  onClick: handleClickOnClearAll
67
+ })), /*#__PURE__*/_jsx(StyledSelectedItems, {}, void 0, withToggle ? /*#__PURE__*/jsx(Fragment, {
68
+ children: multiSelectedValues.length > 0 ? /*#__PURE__*/_jsx(StyledButtonSelection, {
69
+ buttonType: "text",
70
+ disabled: !showSelectedOptions && selectableOptions.length === multiSelectedValues.length,
71
+ onClick: handleToggle,
72
+ labelText: !showSelectedOptions ? "".concat(multiSelectedValues.length, " SELECTED") : 'SHOW ALL',
73
+ size: "s"
74
+ }) : _StyledNoOptionsSelec || (_StyledNoOptionsSelec = /*#__PURE__*/_jsx(StyledNoOptionsSelected, {}, void 0, "0 SELECTED"))
75
+ }) : /*#__PURE__*/jsxs(Fragment, {
76
+ children: [/*#__PURE__*/_jsx(StyledShowAllButton, {
77
+ buttonType: "text",
78
+ "data-testid": ComboboxDataTestid.SHOW_ALL_BUTTON,
79
+ tabIndex: !showSelectedOptions ? -1 : 0,
80
+ onClick: showSelectedOptions ? handleToggle : noop,
81
+ labelText: "SHOW ALL",
82
+ isSelected: !showSelectedOptions,
83
+ size: "s",
84
+ style: {
85
+ fontWeight: showSelectedOptions ? '300' : '600'
86
+ }
87
+ }), _StyledSeparator2 || (_StyledSeparator2 = /*#__PURE__*/_jsx(StyledSeparator, {
88
+ orientation: "vertical",
89
+ position: "center",
90
+ type: "group-level",
91
+ margin: "none"
92
+ })), /*#__PURE__*/_jsx(StyledButtonSelection, {
93
+ tabIndex: showSelectedOptions ? -1 : 0,
94
+ "data-testid": ComboboxDataTestid.SHOW_SELECTED_OPTIONS_BUTTON,
95
+ disabled: multiSelectedValues.length === 0 || !showSelectedOptions && selectableOptions.length === multiSelectedValues.length,
96
+ buttonType: "text",
97
+ isSelected: showSelectedOptions,
98
+ onClick: !showSelectedOptions ? handleToggle : noop,
99
+ labelText: "".concat(multiSelectedValues.length, " SELECTED"),
100
+ size: "s"
101
+ })]
78
102
  })));
79
103
  };
80
104
 
@@ -1,21 +1,41 @@
1
+ import _taggedTemplateLiteral from '@babel/runtime/helpers/esm/taggedTemplateLiteral';
1
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
 
7
+ var _templateObject;
8
+
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');
10
+
5
11
  const StyledHeaderListWrapper = /*#__PURE__*/styled.div.withConfig({
6
12
  componentId: "sc-dazbzt-0"
7
- })(["display:flex;justify-content:space-between;padding:0px 16px;height:28px;"]);
8
- const ActionButtons = /*#__PURE__*/styled.div.withConfig({
9
- componentId: "sc-dazbzt-1"
10
- })(["display:inline-flex;align-items:center;color:", ";"], props => props.theme.colors.neutral[500]);
13
+ })(["display:flex;position:fixed;top:0;z-index:10;justify-content:space-between;padding:0px 12px 0px 12px;width:100%;height:28px;background-color:#fff;box-shadow:0 4px 2px -4px ", ";overflow-x:hidden;& button{font-size:13px;}"], props => props.theme.colors.neutral[700]);
11
14
  const StyledSeparator = /*#__PURE__*/styled(DSSeparator).withConfig({
12
- componentId: "sc-dazbzt-2"
15
+ componentId: "sc-dazbzt-1"
13
16
  })(["height:50%;width:auto;"]);
14
17
  const StyledButton = /*#__PURE__*/styled(DSButton).withConfig({
15
- componentId: "sc-dazbzt-3"
18
+ componentId: "sc-dazbzt-2"
16
19
  })(["padding:0 ", ";align-items:center;"], props => props.theme.space.xxs);
17
- const StyledSelectedItems = /*#__PURE__*/styled.div.withConfig({
20
+ const StyledGeneralSelectionButton = /*#__PURE__*/styled(DSButton).withConfig({
21
+ componentId: "sc-dazbzt-3"
22
+ })(["border-radius:0px;padding:0 ", ";margin:0;align-items:center;", " transition:unset;"], props => props.theme.space.xxs, _ref => {
23
+ let {
24
+ isSelected
25
+ } = _ref;
26
+ return selectedStyle(isSelected);
27
+ });
28
+ const StyledButtonSelection = /*#__PURE__*/styled(StyledGeneralSelectionButton).withConfig({
18
29
  componentId: "sc-dazbzt-4"
30
+ })(["&:hover:not([disabled]){background-color:transparent;color:", ";}"], props => props.theme.colors.brand['700']);
31
+ const StyledShowAllButton = /*#__PURE__*/styled(StyledGeneralSelectionButton).withConfig({
32
+ componentId: "sc-dazbzt-5"
33
+ })(["color:", ";&:hover:not([disabled]){background-color:transparent;color:", ";}"], props => props.theme.colors.neutral['700'], props => props.theme.colors.neutral['700']);
34
+ const StyledSelectedItems = /*#__PURE__*/styled.div.withConfig({
35
+ componentId: "sc-dazbzt-6"
19
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);
20
40
 
21
- export { ActionButtons, StyledButton, StyledHeaderListWrapper, StyledSelectedItems, StyledSeparator };
41
+ export { StyledButton, StyledButtonSelection, StyledHeaderListWrapper, StyledNoOptionsSelected, StyledSelectedItems, StyledSeparator, StyledShowAllButton };
@@ -0,0 +1,69 @@
1
+ import { useContext, useCallback, useEffect, useMemo } from 'react';
2
+ import { ComboBoxContext } from '../../ComboBoxCTX.js';
3
+
4
+ const useHeaderListHandlers = () => {
5
+ const {
6
+ props: {
7
+ onSelectAll,
8
+ onFilter,
9
+ onClearAll,
10
+ selectedValues
11
+ },
12
+ inputRef,
13
+ showSelectedOptions,
14
+ setShowSelectedOptions,
15
+ setShowPopover
16
+ } = useContext(ComboBoxContext);
17
+ const multiSelectedValues = selectedValues;
18
+ const handleOnBlurSelectAll = useCallback(e => {
19
+ if (!onClearAll || multiSelectedValues.length === 0) {
20
+ e.preventDefault();
21
+ inputRef.current.focus();
22
+ }
23
+ }, [inputRef, onClearAll, multiSelectedValues]);
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
+ }, [inputRef]);
28
+ const handleClickOnSelectAll = useCallback(() => {
29
+ onSelectAll();
30
+ inputRef.current.focus();
31
+ }, [onSelectAll, inputRef, setShowPopover]);
32
+ const handleClickOnClearAll = useCallback(e => {
33
+ setShowSelectedOptions(false);
34
+ e.preventDefault();
35
+ e.stopPropagation();
36
+ onClearAll();
37
+ inputRef.current.focus();
38
+ }, [inputRef, setShowSelectedOptions, onClearAll]);
39
+ const handleOnMouseDown = useCallback(e => {
40
+ e.preventDefault();
41
+ }, []);
42
+ const handleToggle = useCallback(() => {
43
+ inputRef.current.value = '';
44
+ onFilter('');
45
+ setShowSelectedOptions(!showSelectedOptions);
46
+ inputRef.current.focus();
47
+ }, [setShowSelectedOptions, inputRef, onFilter, showSelectedOptions]);
48
+ const handleKeyDown = useCallback(e => {
49
+ if (e.key === 'Escape') {
50
+ setShowPopover(false);
51
+ }
52
+ }, [setShowPopover]);
53
+ useEffect(() => {
54
+ if (multiSelectedValues.length === 0) {
55
+ setShowSelectedOptions(false);
56
+ }
57
+ }, [multiSelectedValues, setShowSelectedOptions]);
58
+ return useMemo(() => ({
59
+ handleKeyDown,
60
+ handleToggle,
61
+ handleOnMouseDown,
62
+ handleClickOnClearAll,
63
+ handleClickOnSelectAll,
64
+ handleOnBlurClearAll,
65
+ handleOnBlurSelectAll
66
+ }), [handleKeyDown, handleToggle, handleOnMouseDown, handleClickOnClearAll, handleClickOnSelectAll, handleOnBlurClearAll, handleOnBlurSelectAll]);
67
+ };
68
+
69
+ export { useHeaderListHandlers };
@@ -1,20 +1,22 @@
1
1
  import _jsx from '@babel/runtime/helpers/esm/jsx';
2
- import { useContext, useCallback } from 'react';
3
- import { getOptions } from '../../utils/listHelper.js';
4
- import { StyledListWrapper, StyledList } from './styled.js';
2
+ import { useContext, useMemo, useCallback } from 'react';
3
+ import { StyledListWrapper, StyledVirtualListWrapper, StyledList } from './styled.js';
5
4
  import { ComboboxDataTestid } from '../../ComboboxDataTestids.js';
6
5
  import { ComboBoxContext } from '../../ComboBoxCTX.js';
7
6
  import { HeaderList } from '../header-list/HeaderList.js';
8
7
  import { useOnElementResize } from '../../utils/hooks/useOnElementResize.js';
9
8
  import { EmptyState } from '../empty-state/index.js';
9
+ import { useItemRenderer } from './useItemRenderer.js';
10
10
  import { useMenuList } from './useMenuList.js';
11
- import { jsxs } from 'react/jsx-runtime';
11
+ import { jsxs, jsx } from 'react/jsx-runtime';
12
12
 
13
13
  var _HeaderList, _EmptyState;
14
14
 
15
15
  const MenuList = () => {
16
16
  const {
17
17
  props: {
18
+ menuMinWidth,
19
+ menuMaxHeight,
18
20
  inline,
19
21
  options,
20
22
  selectedValues
@@ -23,36 +25,48 @@ const MenuList = () => {
23
25
  inputRef,
24
26
  listRef,
25
27
  showPopover,
28
+ wrapperListRef,
26
29
  controlsWrapperRef,
27
30
  virtualListHelpers: {
28
31
  totalSize
29
32
  }
30
33
  } = useContext(ComboBoxContext);
31
34
  const multiple = Array.isArray(selectedValues);
32
- const {
33
- ItemRenderer
34
- } = useMenuList();
35
+ const withHeader = !inline && multiple && options.length > 0;
36
+ const ItemRenderer = useItemRenderer();
37
+ useMenuList();
35
38
  useOnElementResize(controlsWrapperRef);
36
- const listWidth = inline ? '100%' : "".concat(referenceElement === null || referenceElement === void 0 ? void 0 : referenceElement.offsetWidth, "px");
37
- const selectableOptions = getOptions(options);
38
- const handleOnClick = useCallback(() => {
39
- inputRef === null || inputRef === void 0 ? void 0 : inputRef.current.focus();
39
+ const listWidth = useMemo(() => menuMinWidth || "".concat(referenceElement === null || referenceElement === void 0 ? void 0 : referenceElement.offsetWidth), [menuMinWidth, referenceElement]);
40
+ const handleOnFocus = useCallback(() => {
41
+ var _inputRef$current;
42
+
43
+ (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus();
40
44
  }, [inputRef]);
41
45
  return /*#__PURE__*/jsxs(StyledListWrapper, {
46
+ tabIndex: -1,
47
+ ref: wrapperListRef,
48
+ inline: inline,
42
49
  onMouseDown: e => e.preventDefault(),
43
- ref: listRef,
44
- width: listWidth,
50
+ minWidth: listWidth,
45
51
  id: "combo-listbox",
46
52
  role: "listbox",
47
- children: [!inline && multiple && options.length > 0 && (_HeaderList || (_HeaderList = /*#__PURE__*/_jsx(HeaderList, {}))), selectableOptions.length > 0 ? /*#__PURE__*/_jsx(StyledList, {
53
+ children: [withHeader && (_HeaderList || (_HeaderList = /*#__PURE__*/_jsx(HeaderList, {}))), options.length > 0 ? /*#__PURE__*/jsx(StyledVirtualListWrapper, {
48
54
  tabIndex: -1,
49
- "aria-expanded": showPopover,
50
- onFocus: handleOnClick,
51
- "data-testid": ComboboxDataTestid.LIST,
52
- style: {
53
- height: totalSize
54
- }
55
- }, void 0, ItemRenderer) : _EmptyState || (_EmptyState = /*#__PURE__*/_jsx(EmptyState, {}))]
55
+ inline: inline,
56
+ maxHeight: menuMaxHeight,
57
+ ref: listRef,
58
+ withHeader: withHeader,
59
+ children: /*#__PURE__*/_jsx(StyledList, {
60
+ tabIndex: -1,
61
+ "aria-expanded": showPopover,
62
+ onFocus: handleOnFocus,
63
+ "data-testid": ComboboxDataTestid.LIST,
64
+ style: {
65
+ height: totalSize,
66
+ margin: inline ? '0px' : '8px 0px'
67
+ }
68
+ }, void 0, ItemRenderer)
69
+ }) : _EmptyState || (_EmptyState = /*#__PURE__*/_jsx(EmptyState, {}))]
56
70
  });
57
71
  };
58
72
 
@@ -2,9 +2,23 @@ import styled from 'styled-components';
2
2
 
3
3
  const StyledListWrapper = /*#__PURE__*/styled.div.withConfig({
4
4
  componentId: "sc-1uedyf-0"
5
- })(["width:", ";overflow-y:auto;max-height:300px;"], props => props.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;margin:0;"]);
8
+ })(["position:relative;padding:0;"]);
9
+ const StyledVirtualListWrapper = /*#__PURE__*/styled.div.withConfig({
10
+ componentId: "sc-1uedyf-2"
11
+ })(["overflow-y:auto;margin-top:", ";max-height:", ";"], _ref => {
12
+ let {
13
+ withHeader
14
+ } = _ref;
15
+ return withHeader ? '28px' : '';
16
+ }, _ref2 => {
17
+ let {
18
+ maxHeight,
19
+ inline
20
+ } = _ref2;
21
+ return inline ? '' : "".concat(!maxHeight ? '400' : maxHeight, "px");
22
+ });
9
23
 
10
- export { StyledList, StyledListWrapper };
24
+ export { StyledList, StyledListWrapper, StyledVirtualListWrapper };