@elliemae/ds-controlled-form 2.4.3-rc.6 → 2.4.3

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.
@@ -86,7 +86,7 @@ const DSControlledCheckbox = props => {
86
86
  "aria-controls": ariaControls || legacyAriaControls,
87
87
  disabled: disabled,
88
88
  readOnly: readOnly,
89
- onClick: !disabled && onChange,
89
+ onClick: onChange,
90
90
  "aria-checked": checked
91
91
  }, restGlobals), {}, {
92
92
  tabIndex: 0
@@ -101,20 +101,15 @@ const DSControlledCheckbox = props => {
101
101
  disabled: disabled,
102
102
  readOnly: readOnly,
103
103
  onChange: onChange
104
- }, restGlobals))), label && /*#__PURE__*/jsxRuntime.jsx(styles.StyledLabel, _objectSpread(_objectSpread({
104
+ }, restGlobals))), label && /*#__PURE__*/_jsx__default["default"](styles.StyledLabel, {
105
105
  htmlFor: id,
106
106
  disabled: disabled,
107
107
  readOnly: readOnly,
108
108
  checked: checked,
109
- disabled: disabled,
110
109
  "data-testid": "ds-checkbox-label",
111
110
  wrapLabel: wrapLabel
112
- }, !disabled && (ariaControls || legacyAriaControls) ? {
113
- onClick: onChange
114
- } : {}), {}, {
115
- children: wrapLabel ? /*#__PURE__*/_jsx__default["default"](styles.StyledWrapLabel, {}, void 0, label) : /*#__PURE__*/_jsx__default["default"](dsTruncatedTooltipText.SimpleTruncatedTooltipText, {
116
- value: label
117
- })
111
+ }, void 0, wrapLabel ? /*#__PURE__*/_jsx__default["default"](styles.StyledWrapLabel, {}, void 0, label) : /*#__PURE__*/_jsx__default["default"](dsTruncatedTooltipText.SimpleTruncatedTooltipText, {
112
+ value: label
118
113
  }))]
119
114
  }));
120
115
  };
@@ -105,6 +105,9 @@ const checkboxStyles = dsSystem.css`
105
105
  &:hover {
106
106
  cursor: pointer;
107
107
  }
108
+ &:disabled {
109
+ cursor: not-allowed;
110
+ }
108
111
  width: 100%;
109
112
  height: 100%;
110
113
  position: absolute;
@@ -117,58 +120,40 @@ const StyledInput = dsSystem.styled('input', {
117
120
  slot: theming.DSCheckboxSlots.INPUT
118
121
  })`
119
122
  ${checkboxStyles}
120
- &:disabled {
121
- cursor: not-allowed;
122
- }
123
123
  `;
124
124
  const StyledInputMixed = dsSystem.styled('div', {
125
125
  name: theming.DSCheckboxName,
126
126
  slot: theming.DSCheckboxSlots.INPUT
127
127
  })`
128
128
  ${checkboxStyles}
129
- ${_ref11 => {
130
- let {
131
- disabled
132
- } = _ref11;
133
- return disabled ? `&:hover {
134
- cursor: not-allowed;
135
- }` : '';
136
- }}
137
129
  `;
138
130
  const StyledLabel = dsSystem.styled('label', {
139
131
  name: theming.DSCheckboxName,
140
132
  slot: theming.DSCheckboxSlots.LABEL
141
133
  })`
142
- ${_ref12 => {
134
+ &:hover {
135
+ cursor: pointer;
136
+ }
137
+ ${_ref11 => {
143
138
  let {
144
139
  wrapLabel,
145
140
  theme
146
- } = _ref12;
141
+ } = _ref11;
147
142
  return wrapLabel ? 'padding: 8px 0px 8px 8px;' : `padding-left: ${theme.space.xxs}`;
148
143
  }};
149
144
 
150
- color: ${_ref13 => {
145
+ color: ${_ref12 => {
151
146
  let {
152
147
  theme,
153
148
  disabled,
154
- readOnly
155
- } = _ref13;
156
- return disabled || readOnly ? theme.colors.neutral[500] : theme.colors.neutral[800];
149
+ readOnly,
150
+ checked
151
+ } = _ref12;
152
+ return disabled && checked !== true || readOnly ? theme.colors.neutral[500] : theme.colors.neutral[800];
157
153
  }};
158
154
  font-size: 13px;
159
155
  line-height: 13px;
160
156
  display: inherit;
161
-
162
- ${_ref14 => {
163
- let {
164
- disabled
165
- } = _ref14;
166
- return disabled ? `&:hover {
167
- cursor: not-allowed;
168
- }` : `&:hover {
169
- cursor: pointer;
170
- }`;
171
- }}
172
157
  `;
173
158
  const StyledWrapLabel = dsSystem.styled('span')``;
174
159
 
@@ -44,7 +44,7 @@ const ControlsInput = () => {
44
44
  return /*#__PURE__*/_jsx__default["default"](styled.StyledInputWrapper, {}, void 0, /*#__PURE__*/jsxRuntime.jsx(styled.StyledInputWidthReference, {
45
45
  ref: spanReference,
46
46
  children: spanReferenceText
47
- }), showPlaceholder && /*#__PURE__*/_jsx__default["default"](styled.StyledInputPlaceHolder, {}, void 0, /*#__PURE__*/_jsx__default["default"](dsTruncatedTooltipText.SimpleTruncatedTooltipText, {
47
+ }), /*#__PURE__*/_jsx__default["default"](styled.StyledInputPlaceHolder, {}, void 0, /*#__PURE__*/_jsx__default["default"](dsTruncatedTooltipText.SimpleTruncatedTooltipText, {
48
48
  value: showPlaceholder
49
49
  })), /*#__PURE__*/jsxRuntime.jsx(styled.StyledInput, {
50
50
  "data-testid": ComboboxDataTestids.ComboboxDataTestid.INPUT,
@@ -12,9 +12,7 @@ const StyledInput = dsSystem.styled('input', {
12
12
  font-size: 13px;
13
13
  line-height: 13px;
14
14
  border: none;
15
- overflow: hidden;
16
15
  padding: 0;
17
- z-index: 2;
18
16
  outline: none;
19
17
  color: ${props => props.theme.colors.neutral[700]};
20
18
  &:focus {
@@ -43,20 +41,17 @@ const StyledInputPlaceHolder = dsSystem.styled.div`
43
41
  & span::after {
44
42
  content: '';
45
43
  padding: 1px;
46
- // solve italic font style clipping issue with overflow hidden.
47
44
  }
48
45
  `;
49
46
  const StyledInputWidthReference = dsSystem.styled.span`
50
47
  visibility: hidden;
51
48
  position: absolute;
52
49
  top: -9999px;
53
- z-index: 1;
54
50
  `;
55
51
  const StyledInputWrapper = dsSystem.styled('div')`
56
52
  position: relative;
57
53
  align-items: center;
58
54
  display: flex;
59
- padding-right: 1px;
60
55
  `;
61
56
 
62
57
  exports.StyledInput = StyledInput;
@@ -17,6 +17,7 @@ const useControlsInput = () => {
17
17
  },
18
18
  setHasFocus,
19
19
  inputValue,
20
+ setMenuState,
20
21
  setInputValue
21
22
  } = React.useContext(ComboBoxCTX.ComboBoxContext);
22
23
  const [width, setWidth] = React.useState(1); // use span reference to calculate the real width for the input
@@ -25,11 +26,7 @@ const useControlsInput = () => {
25
26
  const showPlaceholder = !inputValue && listHelper.isSelectedValueEmpty(selectedValues) ? placeholder : null;
26
27
  const spanReferenceText = inputValue.replace(/\s/g, '\u00a0');
27
28
  React.useEffect(() => {
28
- if (spanReference.current) {
29
- spanReference.current.style.display = 'block';
30
- setWidth(spanReference.current?.offsetWidth ? spanReference.current.offsetWidth + 2 : 1);
31
- spanReference.current.style.display = 'none';
32
- }
29
+ setWidth(spanReference.current?.offsetWidth ? spanReference.current.offsetWidth + 2 : 1);
33
30
  }, [inputValue]); // if we se an input mask we configure inside here the proper mask
34
31
  // or a stardard combobox onchange event
35
32
 
@@ -158,6 +158,8 @@ const useKeyboardNavigation = () => {
158
158
  if (!e.currentTarget.value && lastValue) {
159
159
  onChange(listHelper.getSuggestedValueOnChange(lastValue, selectedValues), lastValue, e);
160
160
  }
161
+
162
+ if (onFilter) onFilter(allOptions, inputValue);
161
163
  }
162
164
 
163
165
  if (e.key === 'Tab' && !inline && menuState) {
@@ -72,10 +72,7 @@ const getSuggestedValueOnChange = (selectedOption, selectedValues) => {
72
72
 
73
73
  return selectedOption;
74
74
  };
75
- const filterOptions = (inputValue, options) => {
76
- if (inputValue === '') return options;
77
- return options.filter(option => option.type === constants.MENU_OPTION_TYPES.OPTION && option.label.toLowerCase().includes(inputValue.toLowerCase()));
78
- };
75
+ const filterOptions = (inputValue, options) => options.filter(option => option.type === constants.MENU_OPTION_TYPES.OPTION && option.label.toLowerCase().includes(inputValue.toLowerCase()));
79
76
  const selectedValuesWithSections = (optionsToParse, multiSelectedValue) => {
80
77
  const items = [];
81
78
  if (optionsToParse) optionsToParse.forEach(option => {
@@ -76,7 +76,7 @@ const DSControlledCheckbox = props => {
76
76
  "aria-controls": ariaControls || legacyAriaControls,
77
77
  disabled: disabled,
78
78
  readOnly: readOnly,
79
- onClick: !disabled && onChange,
79
+ onClick: onChange,
80
80
  "aria-checked": checked
81
81
  }, restGlobals), {}, {
82
82
  tabIndex: 0
@@ -91,20 +91,15 @@ const DSControlledCheckbox = props => {
91
91
  disabled: disabled,
92
92
  readOnly: readOnly,
93
93
  onChange: onChange
94
- }, restGlobals))), label && /*#__PURE__*/jsx(StyledLabel, _objectSpread(_objectSpread({
94
+ }, restGlobals))), label && /*#__PURE__*/_jsx(StyledLabel, {
95
95
  htmlFor: id,
96
96
  disabled: disabled,
97
97
  readOnly: readOnly,
98
98
  checked: checked,
99
- disabled: disabled,
100
99
  "data-testid": "ds-checkbox-label",
101
100
  wrapLabel: wrapLabel
102
- }, !disabled && (ariaControls || legacyAriaControls) ? {
103
- onClick: onChange
104
- } : {}), {}, {
105
- children: wrapLabel ? /*#__PURE__*/_jsx(StyledWrapLabel, {}, void 0, label) : /*#__PURE__*/_jsx(SimpleTruncatedTooltipText, {
106
- value: label
107
- })
101
+ }, void 0, wrapLabel ? /*#__PURE__*/_jsx(StyledWrapLabel, {}, void 0, label) : /*#__PURE__*/_jsx(SimpleTruncatedTooltipText, {
102
+ value: label
108
103
  }))]
109
104
  }));
110
105
  };
@@ -101,6 +101,9 @@ const checkboxStyles = css`
101
101
  &:hover {
102
102
  cursor: pointer;
103
103
  }
104
+ &:disabled {
105
+ cursor: not-allowed;
106
+ }
104
107
  width: 100%;
105
108
  height: 100%;
106
109
  position: absolute;
@@ -113,58 +116,40 @@ const StyledInput = styled('input', {
113
116
  slot: DSCheckboxSlots.INPUT
114
117
  })`
115
118
  ${checkboxStyles}
116
- &:disabled {
117
- cursor: not-allowed;
118
- }
119
119
  `;
120
120
  const StyledInputMixed = styled('div', {
121
121
  name: DSCheckboxName,
122
122
  slot: DSCheckboxSlots.INPUT
123
123
  })`
124
124
  ${checkboxStyles}
125
- ${_ref11 => {
126
- let {
127
- disabled
128
- } = _ref11;
129
- return disabled ? `&:hover {
130
- cursor: not-allowed;
131
- }` : '';
132
- }}
133
125
  `;
134
126
  const StyledLabel = styled('label', {
135
127
  name: DSCheckboxName,
136
128
  slot: DSCheckboxSlots.LABEL
137
129
  })`
138
- ${_ref12 => {
130
+ &:hover {
131
+ cursor: pointer;
132
+ }
133
+ ${_ref11 => {
139
134
  let {
140
135
  wrapLabel,
141
136
  theme
142
- } = _ref12;
137
+ } = _ref11;
143
138
  return wrapLabel ? 'padding: 8px 0px 8px 8px;' : `padding-left: ${theme.space.xxs}`;
144
139
  }};
145
140
 
146
- color: ${_ref13 => {
141
+ color: ${_ref12 => {
147
142
  let {
148
143
  theme,
149
144
  disabled,
150
- readOnly
151
- } = _ref13;
152
- return disabled || readOnly ? theme.colors.neutral[500] : theme.colors.neutral[800];
145
+ readOnly,
146
+ checked
147
+ } = _ref12;
148
+ return disabled && checked !== true || readOnly ? theme.colors.neutral[500] : theme.colors.neutral[800];
153
149
  }};
154
150
  font-size: 13px;
155
151
  line-height: 13px;
156
152
  display: inherit;
157
-
158
- ${_ref14 => {
159
- let {
160
- disabled
161
- } = _ref14;
162
- return disabled ? `&:hover {
163
- cursor: not-allowed;
164
- }` : `&:hover {
165
- cursor: pointer;
166
- }`;
167
- }}
168
153
  `;
169
154
  const StyledWrapLabel = styled('span')``;
170
155
 
@@ -36,7 +36,7 @@ const ControlsInput = () => {
36
36
  return /*#__PURE__*/_jsx(StyledInputWrapper, {}, void 0, /*#__PURE__*/jsx(StyledInputWidthReference, {
37
37
  ref: spanReference,
38
38
  children: spanReferenceText
39
- }), showPlaceholder && /*#__PURE__*/_jsx(StyledInputPlaceHolder, {}, void 0, /*#__PURE__*/_jsx(SimpleTruncatedTooltipText, {
39
+ }), /*#__PURE__*/_jsx(StyledInputPlaceHolder, {}, void 0, /*#__PURE__*/_jsx(SimpleTruncatedTooltipText, {
40
40
  value: showPlaceholder
41
41
  })), /*#__PURE__*/jsx(StyledInput, {
42
42
  "data-testid": ComboboxDataTestid.INPUT,
@@ -8,9 +8,7 @@ const StyledInput = styled('input', {
8
8
  font-size: 13px;
9
9
  line-height: 13px;
10
10
  border: none;
11
- overflow: hidden;
12
11
  padding: 0;
13
- z-index: 2;
14
12
  outline: none;
15
13
  color: ${props => props.theme.colors.neutral[700]};
16
14
  &:focus {
@@ -39,20 +37,17 @@ const StyledInputPlaceHolder = styled.div`
39
37
  & span::after {
40
38
  content: '';
41
39
  padding: 1px;
42
- // solve italic font style clipping issue with overflow hidden.
43
40
  }
44
41
  `;
45
42
  const StyledInputWidthReference = styled.span`
46
43
  visibility: hidden;
47
44
  position: absolute;
48
45
  top: -9999px;
49
- z-index: 1;
50
46
  `;
51
47
  const StyledInputWrapper = styled('div')`
52
48
  position: relative;
53
49
  align-items: center;
54
50
  display: flex;
55
- padding-right: 1px;
56
51
  `;
57
52
 
58
53
  export { StyledInput, StyledInputPlaceHolder, StyledInputWidthReference, StyledInputWrapper };
@@ -13,6 +13,7 @@ const useControlsInput = () => {
13
13
  },
14
14
  setHasFocus,
15
15
  inputValue,
16
+ setMenuState,
16
17
  setInputValue
17
18
  } = useContext(ComboBoxContext);
18
19
  const [width, setWidth] = useState(1); // use span reference to calculate the real width for the input
@@ -21,11 +22,7 @@ const useControlsInput = () => {
21
22
  const showPlaceholder = !inputValue && isSelectedValueEmpty(selectedValues) ? placeholder : null;
22
23
  const spanReferenceText = inputValue.replace(/\s/g, '\u00a0');
23
24
  useEffect(() => {
24
- if (spanReference.current) {
25
- spanReference.current.style.display = 'block';
26
- setWidth(spanReference.current?.offsetWidth ? spanReference.current.offsetWidth + 2 : 1);
27
- spanReference.current.style.display = 'none';
28
- }
25
+ setWidth(spanReference.current?.offsetWidth ? spanReference.current.offsetWidth + 2 : 1);
29
26
  }, [inputValue]); // if we se an input mask we configure inside here the proper mask
30
27
  // or a stardard combobox onchange event
31
28
 
@@ -154,6 +154,8 @@ const useKeyboardNavigation = () => {
154
154
  if (!e.currentTarget.value && lastValue) {
155
155
  onChange(getSuggestedValueOnChange(lastValue, selectedValues), lastValue, e);
156
156
  }
157
+
158
+ if (onFilter) onFilter(allOptions, inputValue);
157
159
  }
158
160
 
159
161
  if (e.key === 'Tab' && !inline && menuState) {
@@ -68,10 +68,7 @@ const getSuggestedValueOnChange = (selectedOption, selectedValues) => {
68
68
 
69
69
  return selectedOption;
70
70
  };
71
- const filterOptions = (inputValue, options) => {
72
- if (inputValue === '') return options;
73
- return options.filter(option => option.type === MENU_OPTION_TYPES.OPTION && option.label.toLowerCase().includes(inputValue.toLowerCase()));
74
- };
71
+ const filterOptions = (inputValue, options) => options.filter(option => option.type === MENU_OPTION_TYPES.OPTION && option.label.toLowerCase().includes(inputValue.toLowerCase()));
75
72
  const selectedValuesWithSections = (optionsToParse, multiSelectedValue) => {
76
73
  const items = [];
77
74
  if (optionsToParse) optionsToParse.forEach(option => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/ds-controlled-form",
3
- "version": "2.4.3-rc.6",
3
+ "version": "2.4.3",
4
4
  "license": "MIT",
5
5
  "description": "ICE MT - Dimsum - Controlled Form Controllers",
6
6
  "module": "./esm/index.js",
@@ -896,20 +896,20 @@
896
896
  "build": "node ../../scripts/build/build.js"
897
897
  },
898
898
  "dependencies": {
899
- "@elliemae/ds-button": "2.4.3-rc.6",
900
- "@elliemae/ds-circular-progress-indicator": "2.4.3-rc.6",
901
- "@elliemae/ds-controlled-form": "2.4.3-rc.6",
902
- "@elliemae/ds-form": "2.4.3-rc.6",
903
- "@elliemae/ds-form-layout-blocks": "2.4.3-rc.6",
904
- "@elliemae/ds-grid": "2.4.3-rc.6",
905
- "@elliemae/ds-icon": "2.4.3-rc.6",
906
- "@elliemae/ds-icons": "2.4.3-rc.6",
907
- "@elliemae/ds-pills": "2.4.3-rc.6",
908
- "@elliemae/ds-popperjs": "2.4.3-rc.6",
909
- "@elliemae/ds-props-helpers": "2.4.3-rc.6",
910
- "@elliemae/ds-system": "2.4.3-rc.6",
911
- "@elliemae/ds-tooltip": "2.4.3-rc.6",
912
- "@elliemae/ds-truncated-tooltip-text": "2.4.3-rc.6",
899
+ "@elliemae/ds-button": "2.4.3",
900
+ "@elliemae/ds-circular-progress-indicator": "2.4.3",
901
+ "@elliemae/ds-controlled-form": "2.4.3",
902
+ "@elliemae/ds-form": "2.4.3",
903
+ "@elliemae/ds-form-layout-blocks": "2.4.3",
904
+ "@elliemae/ds-grid": "2.4.3",
905
+ "@elliemae/ds-icon": "2.4.3",
906
+ "@elliemae/ds-icons": "2.4.3",
907
+ "@elliemae/ds-pills": "2.4.3",
908
+ "@elliemae/ds-popperjs": "2.4.3",
909
+ "@elliemae/ds-props-helpers": "2.4.3",
910
+ "@elliemae/ds-system": "2.4.3",
911
+ "@elliemae/ds-tooltip": "2.4.3",
912
+ "@elliemae/ds-truncated-tooltip-text": "2.4.3",
913
913
  "prop-types": "~15.7.2",
914
914
  "react-desc": "~4.1.3",
915
915
  "react-popper": "~2.2.5",
@@ -6,7 +6,6 @@ export declare namespace DSControlledCheckboxT {
6
6
  tabIndex?: number;
7
7
  hasError?: boolean;
8
8
  wrapLabel: boolean;
9
- disabled: boolean;
10
9
  }
11
10
  interface OptionalProps {
12
11
  innerRef: React.RefObject<HTMLInputElement> | React.LegacyRef<HTMLInputElement>;
@@ -36,6 +36,7 @@ export declare namespace DSComboboxT {
36
36
  onCreate?: (label: string) => void;
37
37
  onFilter?: (newOptions: OptionTypes[], inputValue?: string) => void;
38
38
  onCancel?: () => void;
39
+ onBlur?: () => void;
39
40
  onSelectAll?: (suggestedValue: OptionTypes[] | [], event: React.MouseEvent | React.KeyboardEvent) => null;
40
41
  onKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>, value: ItemOption) => void;
41
42
  }