@elliemae/ds-controlled-form 2.4.3 → 2.4.4-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.
Files changed (44) hide show
  1. package/cjs/checkbox/ControlledCheckbox.js +9 -4
  2. package/cjs/checkbox/styles.js +28 -13
  3. package/cjs/combobox/ComboBoxCTX.js +2 -1
  4. package/cjs/combobox/parts/controls-input/ControlsInput.js +1 -1
  5. package/cjs/combobox/parts/controls-input/styled.js +5 -0
  6. package/cjs/combobox/parts/controls-input/useControlsInput.js +5 -2
  7. package/cjs/combobox/parts/controls-input/useKeyboardNavigation.js +3 -4
  8. package/cjs/combobox/parts/menu-list/useItemRenderer.js +2 -1
  9. package/cjs/combobox/parts/multi-selected-values-container/RemovableSelectedValuePill.js +2 -1
  10. package/cjs/combobox/parts/multi-selected-values-container/useGroupPills.js +3 -2
  11. package/cjs/combobox/utils/listHelper.js +7 -2
  12. package/cjs/date-time-picker/parts/ClearButton/ClearButton.js +2 -1
  13. package/cjs/date-time-picker/parts/Pickers/Calendar/CalendarHead.js +8 -4
  14. package/cjs/date-time-picker/parts/Pickers/Calendar/CalendarIconTrigger.js +2 -1
  15. package/cjs/date-time-picker/parts/Pickers/Calendar/Day.js +2 -1
  16. package/cjs/date-time-picker/parts/Pickers/TimeWheel/HoursList.js +6 -3
  17. package/cjs/date-time-picker/parts/Pickers/TimeWheel/MeridiemList.js +4 -0
  18. package/cjs/date-time-picker/parts/Pickers/TimeWheel/MinutesList.js +6 -3
  19. package/cjs/date-time-picker/parts/Pickers/TimeWheel/SecondsList.js +6 -3
  20. package/cjs/date-time-picker/parts/Pickers/TimeWheel/TimeWheelIconTrigger.js +2 -1
  21. package/esm/checkbox/ControlledCheckbox.js +9 -4
  22. package/esm/checkbox/styles.js +28 -13
  23. package/esm/combobox/ComboBoxCTX.js +2 -1
  24. package/esm/combobox/parts/controls-input/ControlsInput.js +1 -1
  25. package/esm/combobox/parts/controls-input/styled.js +5 -0
  26. package/esm/combobox/parts/controls-input/useControlsInput.js +5 -2
  27. package/esm/combobox/parts/controls-input/useKeyboardNavigation.js +3 -4
  28. package/esm/combobox/parts/menu-list/useItemRenderer.js +2 -1
  29. package/esm/combobox/parts/multi-selected-values-container/RemovableSelectedValuePill.js +2 -1
  30. package/esm/combobox/parts/multi-selected-values-container/useGroupPills.js +3 -2
  31. package/esm/combobox/utils/listHelper.js +7 -2
  32. package/esm/date-time-picker/parts/ClearButton/ClearButton.js +2 -1
  33. package/esm/date-time-picker/parts/Pickers/Calendar/CalendarHead.js +8 -4
  34. package/esm/date-time-picker/parts/Pickers/Calendar/CalendarIconTrigger.js +2 -1
  35. package/esm/date-time-picker/parts/Pickers/Calendar/Day.js +2 -1
  36. package/esm/date-time-picker/parts/Pickers/TimeWheel/HoursList.js +6 -3
  37. package/esm/date-time-picker/parts/Pickers/TimeWheel/MeridiemList.js +4 -0
  38. package/esm/date-time-picker/parts/Pickers/TimeWheel/MinutesList.js +6 -3
  39. package/esm/date-time-picker/parts/Pickers/TimeWheel/SecondsList.js +6 -3
  40. package/esm/date-time-picker/parts/Pickers/TimeWheel/TimeWheelIconTrigger.js +2 -1
  41. package/package.json +15 -15
  42. package/types/checkbox/react-desc-prop-types.d.ts +1 -0
  43. package/types/combobox/react-desc-prop-types.d.ts +1 -1
  44. package/types/combobox/utils/listHelper.d.ts +1 -1
@@ -86,7 +86,7 @@ const DSControlledCheckbox = props => {
86
86
  "aria-controls": ariaControls || legacyAriaControls,
87
87
  disabled: disabled,
88
88
  readOnly: readOnly,
89
- onClick: onChange,
89
+ onClick: !disabled && onChange,
90
90
  "aria-checked": checked
91
91
  }, restGlobals), {}, {
92
92
  tabIndex: 0
@@ -101,15 +101,20 @@ const DSControlledCheckbox = props => {
101
101
  disabled: disabled,
102
102
  readOnly: readOnly,
103
103
  onChange: onChange
104
- }, restGlobals))), label && /*#__PURE__*/_jsx__default["default"](styles.StyledLabel, {
104
+ }, restGlobals))), label && /*#__PURE__*/jsxRuntime.jsx(styles.StyledLabel, _objectSpread(_objectSpread({
105
105
  htmlFor: id,
106
106
  disabled: disabled,
107
107
  readOnly: readOnly,
108
108
  checked: checked,
109
+ disabled: disabled,
109
110
  "data-testid": "ds-checkbox-label",
110
111
  wrapLabel: wrapLabel
111
- }, void 0, wrapLabel ? /*#__PURE__*/_jsx__default["default"](styles.StyledWrapLabel, {}, void 0, label) : /*#__PURE__*/_jsx__default["default"](dsTruncatedTooltipText.SimpleTruncatedTooltipText, {
112
- value: label
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
+ })
113
118
  }))]
114
119
  }));
115
120
  };
@@ -105,9 +105,6 @@ const checkboxStyles = dsSystem.css`
105
105
  &:hover {
106
106
  cursor: pointer;
107
107
  }
108
- &:disabled {
109
- cursor: not-allowed;
110
- }
111
108
  width: 100%;
112
109
  height: 100%;
113
110
  position: absolute;
@@ -120,40 +117,58 @@ const StyledInput = dsSystem.styled('input', {
120
117
  slot: theming.DSCheckboxSlots.INPUT
121
118
  })`
122
119
  ${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
+ }}
129
137
  `;
130
138
  const StyledLabel = dsSystem.styled('label', {
131
139
  name: theming.DSCheckboxName,
132
140
  slot: theming.DSCheckboxSlots.LABEL
133
141
  })`
134
- &:hover {
135
- cursor: pointer;
136
- }
137
- ${_ref11 => {
142
+ ${_ref12 => {
138
143
  let {
139
144
  wrapLabel,
140
145
  theme
141
- } = _ref11;
146
+ } = _ref12;
142
147
  return wrapLabel ? 'padding: 8px 0px 8px 8px;' : `padding-left: ${theme.space.xxs}`;
143
148
  }};
144
149
 
145
- color: ${_ref12 => {
150
+ color: ${_ref13 => {
146
151
  let {
147
152
  theme,
148
153
  disabled,
149
- readOnly,
150
- checked
151
- } = _ref12;
152
- return disabled && checked !== true || readOnly ? theme.colors.neutral[500] : theme.colors.neutral[800];
154
+ readOnly
155
+ } = _ref13;
156
+ return disabled || readOnly ? theme.colors.neutral[500] : theme.colors.neutral[800];
153
157
  }};
154
158
  font-size: 13px;
155
159
  line-height: 13px;
156
160
  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
+ }}
157
172
  `;
158
173
  const StyledWrapLabel = dsSystem.styled('span')``;
159
174
 
@@ -18,7 +18,8 @@ const defaultProps = {
18
18
  startPlacementPreference: 'bottom-start',
19
19
  placementOrderPreference: ['bottom-start', 'bottom-end'],
20
20
  noOptionsMessage: 'No Matches Found',
21
- filteredOptions: [] // override in useCombobox to avoid ref duplications when more than one cb is used
21
+ filteredOptions: [],
22
+ isNonClearable: false // override in useCombobox to avoid ref duplications when more than one cb is used
22
23
 
23
24
  };
24
25
  const defaultContext = {
@@ -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
- }), /*#__PURE__*/_jsx__default["default"](styled.StyledInputPlaceHolder, {}, void 0, /*#__PURE__*/_jsx__default["default"](dsTruncatedTooltipText.SimpleTruncatedTooltipText, {
47
+ }), showPlaceholder && /*#__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,7 +12,9 @@ const StyledInput = dsSystem.styled('input', {
12
12
  font-size: 13px;
13
13
  line-height: 13px;
14
14
  border: none;
15
+ overflow: hidden;
15
16
  padding: 0;
17
+ z-index: 2;
16
18
  outline: none;
17
19
  color: ${props => props.theme.colors.neutral[700]};
18
20
  &:focus {
@@ -41,17 +43,20 @@ const StyledInputPlaceHolder = dsSystem.styled.div`
41
43
  & span::after {
42
44
  content: '';
43
45
  padding: 1px;
46
+ // solve italic font style clipping issue with overflow hidden.
44
47
  }
45
48
  `;
46
49
  const StyledInputWidthReference = dsSystem.styled.span`
47
50
  visibility: hidden;
48
51
  position: absolute;
49
52
  top: -9999px;
53
+ z-index: 1;
50
54
  `;
51
55
  const StyledInputWrapper = dsSystem.styled('div')`
52
56
  position: relative;
53
57
  align-items: center;
54
58
  display: flex;
59
+ padding-right: 1px;
55
60
  `;
56
61
 
57
62
  exports.StyledInput = StyledInput;
@@ -17,7 +17,6 @@ const useControlsInput = () => {
17
17
  },
18
18
  setHasFocus,
19
19
  inputValue,
20
- setMenuState,
21
20
  setInputValue
22
21
  } = React.useContext(ComboBoxCTX.ComboBoxContext);
23
22
  const [width, setWidth] = React.useState(1); // use span reference to calculate the real width for the input
@@ -26,7 +25,11 @@ const useControlsInput = () => {
26
25
  const showPlaceholder = !inputValue && listHelper.isSelectedValueEmpty(selectedValues) ? placeholder : null;
27
26
  const spanReferenceText = inputValue.replace(/\s/g, '\u00a0');
28
27
  React.useEffect(() => {
29
- setWidth(spanReference.current?.offsetWidth ? spanReference.current.offsetWidth + 2 : 1);
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
+ }
30
33
  }, [inputValue]); // if we se an input mask we configure inside here the proper mask
31
34
  // or a stardard combobox onchange event
32
35
 
@@ -18,6 +18,7 @@ const useKeyboardNavigation = () => {
18
18
  const {
19
19
  props: {
20
20
  allOptions,
21
+ isNonClearable,
21
22
  onCancel,
22
23
  onKeyDown,
23
24
  onChange,
@@ -156,10 +157,8 @@ const useKeyboardNavigation = () => {
156
157
  const lastValue = listHelper.getLastValueSelected(selectedValues);
157
158
 
158
159
  if (!e.currentTarget.value && lastValue) {
159
- onChange(listHelper.getSuggestedValueOnChange(lastValue, selectedValues), lastValue, e);
160
+ onChange(listHelper.getSuggestedValueOnChange(lastValue, selectedValues, isNonClearable), lastValue, e);
160
161
  }
161
-
162
- if (onFilter) onFilter(allOptions, inputValue);
163
162
  }
164
163
 
165
164
  if (e.key === 'Tab' && !inline && menuState) {
@@ -173,7 +172,7 @@ const useKeyboardNavigation = () => {
173
172
  }
174
173
  }
175
174
  }, // eslint-disable-next-line react-hooks/exhaustive-deps
176
- [onKeyDown, currentItem, onCreate, multiple, inputValue, inline, withoutPortal, setMenuState, onCancel, onFilter, setInputValue, listRef, focusOptionIdx, menuState, selectableOptions.length, filteredOptions, currentItemIndex, setFocusOptionIdx, selectedValues, onChange, selectAllCheckboxRef, toggleSelectionButtonRef]);
175
+ [onKeyDown, currentItem, onCreate, multiple, inputValue, inline, withoutPortal, setMenuState, onCancel, onFilter, setInputValue, listRef, focusOptionIdx, menuState, selectableOptions.length, filteredOptions, currentItemIndex, setFocusOptionIdx, selectedValues, onChange, selectAllCheckboxRef, toggleSelectionButtonRef, isNonClearable]);
177
176
  return {
178
177
  onInputKeyDown
179
178
  };
@@ -37,6 +37,7 @@ const useItemRenderer = () => {
37
37
  filteredOptions,
38
38
  onCreate,
39
39
  onChange,
40
+ isNonClearable,
40
41
  selectedValues,
41
42
  onFilter,
42
43
  allOptions
@@ -66,7 +67,7 @@ const useItemRenderer = () => {
66
67
  setMenuState(false, 'selectOption', e);
67
68
  }
68
69
 
69
- onChange(listHelper.getSuggestedValueOnChange(option, selectedValues), option, e);
70
+ onChange(listHelper.getSuggestedValueOnChange(option, selectedValues, isNonClearable), option, e);
70
71
  }
71
72
  } // prevent for loosing focus on input control
72
73
 
@@ -19,6 +19,7 @@ const RemovableSelectedValuePill = props => {
19
19
  const {
20
20
  props: {
21
21
  onChange,
22
+ isNonClearable,
22
23
  disabled,
23
24
  selectedValues,
24
25
  innerRef
@@ -28,7 +29,7 @@ const RemovableSelectedValuePill = props => {
28
29
  size: "s",
29
30
  label: pill.label,
30
31
  disabled: disabled,
31
- type: disabled ? 'value' : 'removable',
32
+ type: disabled || isNonClearable ? 'value' : 'removable',
32
33
  tabIndex: -1,
33
34
  onRemove: e => {
34
35
  // preventing the menu to be opened
@@ -21,6 +21,7 @@ const useGroupPills = () => {
21
21
  const {
22
22
  props: {
23
23
  selectedValues,
24
+ isNonClearable,
24
25
  disabled,
25
26
  innerRef
26
27
  },
@@ -51,7 +52,7 @@ const useGroupPills = () => {
51
52
  let lastPillFit = -1;
52
53
  let currentWidth = 0;
53
54
  const referenceWidth = selectedOptionsRef.current.offsetWidth;
54
- const pills = [...pillGroupRef.current.querySelectorAll(disabled ? '.ds-pill-wrapper-value' : '.ds-pill-wrapper-removable')];
55
+ const pills = [...pillGroupRef.current.querySelectorAll(disabled || isNonClearable ? '.ds-pill-wrapper-value' : '.ds-pill-wrapper-removable')];
55
56
  const pillsWidth = pills.map(pill => pill?.offsetWidth);
56
57
  pillsWidth.forEach((pillWidth, idx) => {
57
58
  currentWidth += pillWidth;
@@ -71,7 +72,7 @@ const useGroupPills = () => {
71
72
 
72
73
  if (pillGroupRef.current) pillGroupRef.current.style.width = 'fit-content';
73
74
  }
74
- }, [selectedOptionsRef, innerRef, multiSelectedValues, pillsToShow, pillGroupRef, width, widthInput, disabled, selectedValuesLength]);
75
+ }, [selectedOptionsRef, innerRef, multiSelectedValues, pillsToShow, pillGroupRef, width, widthInput, disabled, selectedValuesLength, isNonClearable]);
75
76
  return pillsToShow || 1;
76
77
  };
77
78
 
@@ -55,11 +55,12 @@ const getFirstOption = (options, selectedValues, inputValue) => {
55
55
 
56
56
  return '';
57
57
  };
58
- const getSuggestedValueOnChange = (selectedOption, selectedValues) => {
58
+ const getSuggestedValueOnChange = (selectedOption, selectedValues, isNonClearable) => {
59
59
  if (Array.isArray(selectedValues)) {
60
60
  const isFound = selectedValues.find(item => item.type === 'option' && item.value === selectedOption.value);
61
61
 
62
62
  if (isFound) {
63
+ if (isNonClearable) return selectedValues;
63
64
  return selectedValues.filter(item => item.type === 'option' && item.value !== selectedOption.value);
64
65
  }
65
66
 
@@ -67,12 +68,16 @@ const getSuggestedValueOnChange = (selectedOption, selectedValues) => {
67
68
  }
68
69
 
69
70
  if (selectedValues && selectedValues.dsId === selectedOption.dsId) {
71
+ if (isNonClearable) return selectedOption;
70
72
  return null;
71
73
  }
72
74
 
73
75
  return selectedOption;
74
76
  };
75
- const filterOptions = (inputValue, options) => options.filter(option => option.type === constants.MENU_OPTION_TYPES.OPTION && option.label.toLowerCase().includes(inputValue.toLowerCase()));
77
+ const filterOptions = (inputValue, options) => {
78
+ if (inputValue === '') return options;
79
+ return options.filter(option => option.type === constants.MENU_OPTION_TYPES.OPTION && option.label.toLowerCase().includes(inputValue.toLowerCase()));
80
+ };
76
81
  const selectedValuesWithSections = (optionsToParse, multiSelectedValue) => {
77
82
  const items = [];
78
83
  if (optionsToParse) optionsToParse.forEach(option => {
@@ -51,7 +51,8 @@ const ClearButton = () => {
51
51
  if (latestInteractionRegion === 'clear-btn' && currFocusDescriber === 'clear-btn') DomElem?.focus?.();
52
52
  },
53
53
  onClick: onClearClick,
54
- onKeyDown: onClearButtonKeyDown
54
+ onKeyDown: onClearButtonKeyDown,
55
+ type: "button"
55
56
  }, styledsAttrs), {}, {
56
57
  children: /*#__PURE__*/_jsx__default["default"](dsIcons.CloseMedium, {
57
58
  color: dsIcon.DSIconColors.PRIMARY
@@ -78,7 +78,8 @@ const CalendarHead = () => {
78
78
  onKeyDown: handlePrevYearKeyDown,
79
79
  onFocus: onPrevYearFocus,
80
80
  tabIndex: isControllerOnly ? -1 : 1,
81
- "data-testid": ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.CALENDAR.PREV_YEAR
81
+ "data-testid": ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.CALENDAR.PREV_YEAR,
82
+ type: "button"
82
83
  }, void 0, _ChevronDoubleLeft || (_ChevronDoubleLeft = /*#__PURE__*/_jsx__default["default"](dsIcons.ChevronDoubleLeft, {
83
84
  height: 14,
84
85
  width: 14,
@@ -92,7 +93,8 @@ const CalendarHead = () => {
92
93
  innerRef: handlePrevMonthRef,
93
94
  onKeyDown: handlePrevMonthKeyDown,
94
95
  onFocus: onPrevMonthFocus,
95
- "data-testid": ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.CALENDAR.PREV_MONTH // this is a tabstop for when the calendar is open
96
+ "data-testid": ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.CALENDAR.PREV_MONTH,
97
+ type: "button" // this is a tabstop for when the calendar is open
96
98
 
97
99
  }, void 0, _ChevronLeft || (_ChevronLeft = /*#__PURE__*/_jsx__default["default"](dsIcons.ChevronLeft, {
98
100
  fill: "#25292f"
@@ -104,7 +106,8 @@ const CalendarHead = () => {
104
106
  innerRef: handleNextMonthRef,
105
107
  onKeyDown: handleNextMonthKeyDown,
106
108
  onFocus: onNextMonthFocus,
107
- "data-testid": ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.CALENDAR.NEXT_MONTH
109
+ "data-testid": ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.CALENDAR.NEXT_MONTH,
110
+ type: "button"
108
111
  }, void 0, _ChevronRight || (_ChevronRight = /*#__PURE__*/_jsx__default["default"](dsIcons.ChevronRight, {
109
112
  fill: "#25292f"
110
113
  }))), /*#__PURE__*/_jsx__default["default"](Styleds.StyledHeaderButton, {
@@ -115,7 +118,8 @@ const CalendarHead = () => {
115
118
  innerRef: handleNextYearRef,
116
119
  onKeyDown: handleNextYearKeyDown,
117
120
  onFocus: onNextYearFocus,
118
- "data-testid": ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.CALENDAR.NEXT_YEAR
121
+ "data-testid": ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.CALENDAR.NEXT_YEAR,
122
+ type: "button"
119
123
  }, void 0, _ChevronDoubleRight || (_ChevronDoubleRight = /*#__PURE__*/_jsx__default["default"](dsIcons.ChevronDoubleRight, {
120
124
  height: 14,
121
125
  width: 14,
@@ -39,7 +39,8 @@ const CalendarIconTrigger = () => {
39
39
  onClick: handleToggleCalendar,
40
40
  onKeyDown: handlePickerIconKeyDown,
41
41
  "data-testid": ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.PICKER_ICONS.CALENDAR,
42
- disabled: disabled
42
+ disabled: disabled,
43
+ type: "button"
43
44
  }, void 0, _DatePicker || (_DatePicker = /*#__PURE__*/_jsx__default["default"](dsIcons.DatePicker, {}))), [ariaCurrentValueForInputs, handleSetTriggerRef, handleToggleCalendar, handlePickerIconKeyDown, disabled]);
44
45
  };
45
46
 
@@ -140,7 +140,8 @@ const Day = _ref => {
140
140
  innerRef: handleInnerRef,
141
141
  tabIndex: isSelected ? 0 : -1,
142
142
  "data-isfocused": isFocused,
143
- "data-testid": dataTestid
143
+ "data-testid": dataTestid,
144
+ type: "button"
144
145
  }, void 0, `${day.getDate()}`)
145
146
  }));
146
147
  };
@@ -64,7 +64,8 @@ const HoursList = () => {
64
64
  onClick: handlePrevHour,
65
65
  innerRef: prevHourBtnRef,
66
66
  "data-testid": ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.TIMEWHEEL.PREV_HOUR,
67
- tabIndex: -1
67
+ tabIndex: -1,
68
+ type: "button"
68
69
  }, void 0, _ChevronSmallUp || (_ChevronSmallUp = /*#__PURE__*/_jsx__default["default"](dsIcons.ChevronSmallUp, {})))), visibleHours.map(hourString => {
69
70
  const key = `timewheel-hour-${hourString || ''}`;
70
71
  if (!hourString) return /*#__PURE__*/_jsx__default["default"](Styleds.StyledWheelListItem, {}, key);
@@ -97,7 +98,8 @@ const HoursList = () => {
97
98
  "aria-valuemax": 12,
98
99
  "aria-valuemin": 1,
99
100
  "aria-valuenow": currHourNum,
100
- "aria-valuetext": `${hourString} hours`
101
+ "aria-valuetext": `${hourString} hours`,
102
+ type: "button"
101
103
  }, btnProps), {}, {
102
104
  children: hourString
103
105
  })));
@@ -108,7 +110,8 @@ const HoursList = () => {
108
110
  onClick: handleNextHour,
109
111
  innerRef: nextHourBtnRef,
110
112
  tabIndex: -1,
111
- "data-testid": ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.TIMEWHEEL.NEXT_HOUR
113
+ "data-testid": ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.TIMEWHEEL.NEXT_HOUR,
114
+ type: "button"
112
115
  }, void 0, _ChevronSmallDown || (_ChevronSmallDown = /*#__PURE__*/_jsx__default["default"](dsIcons.ChevronSmallDown, {})))));
113
116
  };
114
117
 
@@ -79,6 +79,7 @@ const MeridiemList = () => {
79
79
  onClick: e => handleTimeWheelBtnChangeMeridiem('AM', e),
80
80
  innerRef: prevMeridiemBtnRef,
81
81
  tabIndex: -1,
82
+ type: "button",
82
83
  children: _ChevronSmallUp || (_ChevronSmallUp = /*#__PURE__*/_jsx__default["default"](dsIcons.ChevronSmallUp, {}))
83
84
  }))), currMeridiem === 'AM' || currMeridiem === '' ? _StyledWheelListItem || (_StyledWheelListItem = /*#__PURE__*/_jsx__default["default"](Styleds.StyledWheelListItem, {})) : null, /*#__PURE__*/_jsx__default["default"](Styleds.StyledWheelListItem, {
84
85
  isCurrentListItem: isAmCurrent
@@ -98,6 +99,7 @@ const MeridiemList = () => {
98
99
  "aria-valuemin": 0,
99
100
  "aria-valuenow": isPmCurrent ? 1 : 0,
100
101
  "aria-valuetext": isAmCurrent ? 'ante meridiem' : 'post meridiem',
102
+ type: "button",
101
103
  children: "AM"
102
104
  }))), /*#__PURE__*/_jsx__default["default"](Styleds.StyledWheelListItem, {
103
105
  isCurrentListItem: isPmCurrent
@@ -117,6 +119,7 @@ const MeridiemList = () => {
117
119
  "aria-valuemin": 0,
118
120
  "aria-valuenow": isPmCurrent ? 1 : 0,
119
121
  "aria-valuetext": isAmCurrent ? 'ante meridiem' : 'post meridiem',
122
+ type: "button",
120
123
  children: "PM"
121
124
  }))), currMeridiem === 'PM' ? _StyledWheelListItem2 || (_StyledWheelListItem2 = /*#__PURE__*/_jsx__default["default"](Styleds.StyledWheelListItem, {})) : null, /*#__PURE__*/_jsx__default["default"](Styleds.StyledWheelListItem, {}, void 0, /*#__PURE__*/jsxRuntime.jsx(Styleds.StyledWheelChangeTimeBtn, _objectSpread(_objectSpread({}, styledPropsNextMeridiem), {}, {
122
125
  "aria-label": "set pm meridiem",
@@ -127,6 +130,7 @@ const MeridiemList = () => {
127
130
  onClick: e => handleTimeWheelBtnChangeMeridiem('PM', e),
128
131
  innerRef: nextMeridiemBtnRef,
129
132
  tabIndex: -1,
133
+ type: "button",
130
134
  children: _ChevronSmallDown || (_ChevronSmallDown = /*#__PURE__*/_jsx__default["default"](dsIcons.ChevronSmallDown, {}))
131
135
  }))));
132
136
  };
@@ -63,7 +63,8 @@ const MinutesList = () => {
63
63
  onClick: handlePrevMinute,
64
64
  innerRef: prevMinutesBtnRef,
65
65
  tabIndex: -1,
66
- "data-testid": ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.TIMEWHEEL.PREV_MINUTE
66
+ "data-testid": ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.TIMEWHEEL.PREV_MINUTE,
67
+ type: "button"
67
68
  }, void 0, _ChevronSmallUp || (_ChevronSmallUp = /*#__PURE__*/_jsx__default["default"](dsIcons.ChevronSmallUp, {})))), visibleMinutes.map(minutesString => {
68
69
  const key = `timewheel-minutes-${minutesString || ''}`;
69
70
  if (!minutesString) return /*#__PURE__*/_jsx__default["default"](Styleds.StyledWheelListItem, {}, key);
@@ -96,7 +97,8 @@ const MinutesList = () => {
96
97
  "aria-valuemax": 59,
97
98
  "aria-valuemin": 0,
98
99
  "aria-valuenow": currMinuteNum,
99
- "aria-valuetext": `${minutesString} minutes`
100
+ "aria-valuetext": `${minutesString} minutes`,
101
+ type: "button"
100
102
  }, btnProps), {}, {
101
103
  children: minutesString
102
104
  })));
@@ -107,7 +109,8 @@ const MinutesList = () => {
107
109
  onClick: handleNextMinute,
108
110
  innerRef: nextMinutesBtnRef,
109
111
  "data-testid": ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.TIMEWHEEL.NEXT_MINUTE,
110
- tabIndex: -1
112
+ tabIndex: -1,
113
+ type: "button"
111
114
  }, void 0, _ChevronSmallDown || (_ChevronSmallDown = /*#__PURE__*/_jsx__default["default"](dsIcons.ChevronSmallDown, {})))));
112
115
  };
113
116
 
@@ -53,7 +53,8 @@ const SecondsList = () => {
53
53
  onClick: handlePrevSecond,
54
54
  onKeyDown: handlePrevSecondBtnOnKeyDown,
55
55
  innerRef: prevSecondsBtnRef,
56
- tabIndex: -1
56
+ tabIndex: -1,
57
+ type: "button"
57
58
  }, void 0, _ChevronSmallUp || (_ChevronSmallUp = /*#__PURE__*/_jsx__default["default"](dsIcons.ChevronSmallUp, {})))), visibleSeconds.map(secondsString => {
58
59
  const key = `timewheel-seconds-${secondsString}`;
59
60
  if (!secondsString) return /*#__PURE__*/_jsx__default["default"](Styleds.StyledWheelListItem, {}, key);
@@ -72,7 +73,8 @@ const SecondsList = () => {
72
73
  size: "l",
73
74
  variant: DSButton.BUTTON_VARIANT.DEFAULT,
74
75
  onClick: e => handleTimeWheelBtnChangeSeconds(secondsString, e),
75
- tabIndex: tabIndex
76
+ tabIndex: tabIndex,
77
+ type: "button"
76
78
  }, btnProps), {}, {
77
79
  children: secondsString
78
80
  })));
@@ -84,7 +86,8 @@ const SecondsList = () => {
84
86
  onClick: handleNextSecond,
85
87
  onKeyDown: handleNextSecondBtnOnKeyDown,
86
88
  innerRef: nextSecondsBtnRef,
87
- tabIndex: -1
89
+ tabIndex: -1,
90
+ type: "button"
88
91
  }, void 0, _ChevronSmallDown || (_ChevronSmallDown = /*#__PURE__*/_jsx__default["default"](dsIcons.ChevronSmallDown, {})))));
89
92
  };
90
93
 
@@ -38,7 +38,8 @@ const TimeWheelIconTrigger = () => {
38
38
  onClick: handleToggleTimePicker,
39
39
  onKeyDown: handlePickerIconKeyDown,
40
40
  "data-testid": ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.PICKER_ICONS.TIMEWHEEL,
41
- disabled: disabled
41
+ disabled: disabled,
42
+ type: "button"
42
43
  }, void 0, _RecentDocuments || (_RecentDocuments = /*#__PURE__*/_jsx__default["default"](dsIcons.RecentDocuments, {}))), [ariaCurrentValueForInputs, disabled, handlePickerIconKeyDown, handleSetTriggerRef, handleToggleTimePicker]);
43
44
  };
44
45
 
@@ -76,7 +76,7 @@ const DSControlledCheckbox = props => {
76
76
  "aria-controls": ariaControls || legacyAriaControls,
77
77
  disabled: disabled,
78
78
  readOnly: readOnly,
79
- onClick: onChange,
79
+ onClick: !disabled && onChange,
80
80
  "aria-checked": checked
81
81
  }, restGlobals), {}, {
82
82
  tabIndex: 0
@@ -91,15 +91,20 @@ const DSControlledCheckbox = props => {
91
91
  disabled: disabled,
92
92
  readOnly: readOnly,
93
93
  onChange: onChange
94
- }, restGlobals))), label && /*#__PURE__*/_jsx(StyledLabel, {
94
+ }, restGlobals))), label && /*#__PURE__*/jsx(StyledLabel, _objectSpread(_objectSpread({
95
95
  htmlFor: id,
96
96
  disabled: disabled,
97
97
  readOnly: readOnly,
98
98
  checked: checked,
99
+ disabled: disabled,
99
100
  "data-testid": "ds-checkbox-label",
100
101
  wrapLabel: wrapLabel
101
- }, void 0, wrapLabel ? /*#__PURE__*/_jsx(StyledWrapLabel, {}, void 0, label) : /*#__PURE__*/_jsx(SimpleTruncatedTooltipText, {
102
- value: label
102
+ }, !disabled && (ariaControls || legacyAriaControls) ? {
103
+ onClick: onChange
104
+ } : {}), {}, {
105
+ children: wrapLabel ? /*#__PURE__*/_jsx(StyledWrapLabel, {}, void 0, label) : /*#__PURE__*/_jsx(SimpleTruncatedTooltipText, {
106
+ value: label
107
+ })
103
108
  }))]
104
109
  }));
105
110
  };
@@ -101,9 +101,6 @@ const checkboxStyles = css`
101
101
  &:hover {
102
102
  cursor: pointer;
103
103
  }
104
- &:disabled {
105
- cursor: not-allowed;
106
- }
107
104
  width: 100%;
108
105
  height: 100%;
109
106
  position: absolute;
@@ -116,40 +113,58 @@ const StyledInput = styled('input', {
116
113
  slot: DSCheckboxSlots.INPUT
117
114
  })`
118
115
  ${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
+ }}
125
133
  `;
126
134
  const StyledLabel = styled('label', {
127
135
  name: DSCheckboxName,
128
136
  slot: DSCheckboxSlots.LABEL
129
137
  })`
130
- &:hover {
131
- cursor: pointer;
132
- }
133
- ${_ref11 => {
138
+ ${_ref12 => {
134
139
  let {
135
140
  wrapLabel,
136
141
  theme
137
- } = _ref11;
142
+ } = _ref12;
138
143
  return wrapLabel ? 'padding: 8px 0px 8px 8px;' : `padding-left: ${theme.space.xxs}`;
139
144
  }};
140
145
 
141
- color: ${_ref12 => {
146
+ color: ${_ref13 => {
142
147
  let {
143
148
  theme,
144
149
  disabled,
145
- readOnly,
146
- checked
147
- } = _ref12;
148
- return disabled && checked !== true || readOnly ? theme.colors.neutral[500] : theme.colors.neutral[800];
150
+ readOnly
151
+ } = _ref13;
152
+ return disabled || readOnly ? theme.colors.neutral[500] : theme.colors.neutral[800];
149
153
  }};
150
154
  font-size: 13px;
151
155
  line-height: 13px;
152
156
  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
+ }}
153
168
  `;
154
169
  const StyledWrapLabel = styled('span')``;
155
170
 
@@ -14,7 +14,8 @@ const defaultProps = {
14
14
  startPlacementPreference: 'bottom-start',
15
15
  placementOrderPreference: ['bottom-start', 'bottom-end'],
16
16
  noOptionsMessage: 'No Matches Found',
17
- filteredOptions: [] // override in useCombobox to avoid ref duplications when more than one cb is used
17
+ filteredOptions: [],
18
+ isNonClearable: false // override in useCombobox to avoid ref duplications when more than one cb is used
18
19
 
19
20
  };
20
21
  const defaultContext = {
@@ -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
- }), /*#__PURE__*/_jsx(StyledInputPlaceHolder, {}, void 0, /*#__PURE__*/_jsx(SimpleTruncatedTooltipText, {
39
+ }), showPlaceholder && /*#__PURE__*/_jsx(StyledInputPlaceHolder, {}, void 0, /*#__PURE__*/_jsx(SimpleTruncatedTooltipText, {
40
40
  value: showPlaceholder
41
41
  })), /*#__PURE__*/jsx(StyledInput, {
42
42
  "data-testid": ComboboxDataTestid.INPUT,
@@ -8,7 +8,9 @@ const StyledInput = styled('input', {
8
8
  font-size: 13px;
9
9
  line-height: 13px;
10
10
  border: none;
11
+ overflow: hidden;
11
12
  padding: 0;
13
+ z-index: 2;
12
14
  outline: none;
13
15
  color: ${props => props.theme.colors.neutral[700]};
14
16
  &:focus {
@@ -37,17 +39,20 @@ const StyledInputPlaceHolder = styled.div`
37
39
  & span::after {
38
40
  content: '';
39
41
  padding: 1px;
42
+ // solve italic font style clipping issue with overflow hidden.
40
43
  }
41
44
  `;
42
45
  const StyledInputWidthReference = styled.span`
43
46
  visibility: hidden;
44
47
  position: absolute;
45
48
  top: -9999px;
49
+ z-index: 1;
46
50
  `;
47
51
  const StyledInputWrapper = styled('div')`
48
52
  position: relative;
49
53
  align-items: center;
50
54
  display: flex;
55
+ padding-right: 1px;
51
56
  `;
52
57
 
53
58
  export { StyledInput, StyledInputPlaceHolder, StyledInputWidthReference, StyledInputWrapper };
@@ -13,7 +13,6 @@ const useControlsInput = () => {
13
13
  },
14
14
  setHasFocus,
15
15
  inputValue,
16
- setMenuState,
17
16
  setInputValue
18
17
  } = useContext(ComboBoxContext);
19
18
  const [width, setWidth] = useState(1); // use span reference to calculate the real width for the input
@@ -22,7 +21,11 @@ const useControlsInput = () => {
22
21
  const showPlaceholder = !inputValue && isSelectedValueEmpty(selectedValues) ? placeholder : null;
23
22
  const spanReferenceText = inputValue.replace(/\s/g, '\u00a0');
24
23
  useEffect(() => {
25
- setWidth(spanReference.current?.offsetWidth ? spanReference.current.offsetWidth + 2 : 1);
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
+ }
26
29
  }, [inputValue]); // if we se an input mask we configure inside here the proper mask
27
30
  // or a stardard combobox onchange event
28
31
 
@@ -14,6 +14,7 @@ const useKeyboardNavigation = () => {
14
14
  const {
15
15
  props: {
16
16
  allOptions,
17
+ isNonClearable,
17
18
  onCancel,
18
19
  onKeyDown,
19
20
  onChange,
@@ -152,10 +153,8 @@ const useKeyboardNavigation = () => {
152
153
  const lastValue = getLastValueSelected(selectedValues);
153
154
 
154
155
  if (!e.currentTarget.value && lastValue) {
155
- onChange(getSuggestedValueOnChange(lastValue, selectedValues), lastValue, e);
156
+ onChange(getSuggestedValueOnChange(lastValue, selectedValues, isNonClearable), lastValue, e);
156
157
  }
157
-
158
- if (onFilter) onFilter(allOptions, inputValue);
159
158
  }
160
159
 
161
160
  if (e.key === 'Tab' && !inline && menuState) {
@@ -169,7 +168,7 @@ const useKeyboardNavigation = () => {
169
168
  }
170
169
  }
171
170
  }, // eslint-disable-next-line react-hooks/exhaustive-deps
172
- [onKeyDown, currentItem, onCreate, multiple, inputValue, inline, withoutPortal, setMenuState, onCancel, onFilter, setInputValue, listRef, focusOptionIdx, menuState, selectableOptions.length, filteredOptions, currentItemIndex, setFocusOptionIdx, selectedValues, onChange, selectAllCheckboxRef, toggleSelectionButtonRef]);
171
+ [onKeyDown, currentItem, onCreate, multiple, inputValue, inline, withoutPortal, setMenuState, onCancel, onFilter, setInputValue, listRef, focusOptionIdx, menuState, selectableOptions.length, filteredOptions, currentItemIndex, setFocusOptionIdx, selectedValues, onChange, selectAllCheckboxRef, toggleSelectionButtonRef, isNonClearable]);
173
172
  return {
174
173
  onInputKeyDown
175
174
  };
@@ -28,6 +28,7 @@ const useItemRenderer = () => {
28
28
  filteredOptions,
29
29
  onCreate,
30
30
  onChange,
31
+ isNonClearable,
31
32
  selectedValues,
32
33
  onFilter,
33
34
  allOptions
@@ -57,7 +58,7 @@ const useItemRenderer = () => {
57
58
  setMenuState(false, 'selectOption', e);
58
59
  }
59
60
 
60
- onChange(getSuggestedValueOnChange(option, selectedValues), option, e);
61
+ onChange(getSuggestedValueOnChange(option, selectedValues, isNonClearable), option, e);
61
62
  }
62
63
  } // prevent for loosing focus on input control
63
64
 
@@ -11,6 +11,7 @@ const RemovableSelectedValuePill = props => {
11
11
  const {
12
12
  props: {
13
13
  onChange,
14
+ isNonClearable,
14
15
  disabled,
15
16
  selectedValues,
16
17
  innerRef
@@ -20,7 +21,7 @@ const RemovableSelectedValuePill = props => {
20
21
  size: "s",
21
22
  label: pill.label,
22
23
  disabled: disabled,
23
- type: disabled ? 'value' : 'removable',
24
+ type: disabled || isNonClearable ? 'value' : 'removable',
24
25
  tabIndex: -1,
25
26
  onRemove: e => {
26
27
  // preventing the menu to be opened
@@ -17,6 +17,7 @@ const useGroupPills = () => {
17
17
  const {
18
18
  props: {
19
19
  selectedValues,
20
+ isNonClearable,
20
21
  disabled,
21
22
  innerRef
22
23
  },
@@ -47,7 +48,7 @@ const useGroupPills = () => {
47
48
  let lastPillFit = -1;
48
49
  let currentWidth = 0;
49
50
  const referenceWidth = selectedOptionsRef.current.offsetWidth;
50
- const pills = [...pillGroupRef.current.querySelectorAll(disabled ? '.ds-pill-wrapper-value' : '.ds-pill-wrapper-removable')];
51
+ const pills = [...pillGroupRef.current.querySelectorAll(disabled || isNonClearable ? '.ds-pill-wrapper-value' : '.ds-pill-wrapper-removable')];
51
52
  const pillsWidth = pills.map(pill => pill?.offsetWidth);
52
53
  pillsWidth.forEach((pillWidth, idx) => {
53
54
  currentWidth += pillWidth;
@@ -67,7 +68,7 @@ const useGroupPills = () => {
67
68
 
68
69
  if (pillGroupRef.current) pillGroupRef.current.style.width = 'fit-content';
69
70
  }
70
- }, [selectedOptionsRef, innerRef, multiSelectedValues, pillsToShow, pillGroupRef, width, widthInput, disabled, selectedValuesLength]);
71
+ }, [selectedOptionsRef, innerRef, multiSelectedValues, pillsToShow, pillGroupRef, width, widthInput, disabled, selectedValuesLength, isNonClearable]);
71
72
  return pillsToShow || 1;
72
73
  };
73
74
 
@@ -51,11 +51,12 @@ const getFirstOption = (options, selectedValues, inputValue) => {
51
51
 
52
52
  return '';
53
53
  };
54
- const getSuggestedValueOnChange = (selectedOption, selectedValues) => {
54
+ const getSuggestedValueOnChange = (selectedOption, selectedValues, isNonClearable) => {
55
55
  if (Array.isArray(selectedValues)) {
56
56
  const isFound = selectedValues.find(item => item.type === 'option' && item.value === selectedOption.value);
57
57
 
58
58
  if (isFound) {
59
+ if (isNonClearable) return selectedValues;
59
60
  return selectedValues.filter(item => item.type === 'option' && item.value !== selectedOption.value);
60
61
  }
61
62
 
@@ -63,12 +64,16 @@ const getSuggestedValueOnChange = (selectedOption, selectedValues) => {
63
64
  }
64
65
 
65
66
  if (selectedValues && selectedValues.dsId === selectedOption.dsId) {
67
+ if (isNonClearable) return selectedOption;
66
68
  return null;
67
69
  }
68
70
 
69
71
  return selectedOption;
70
72
  };
71
- const filterOptions = (inputValue, options) => options.filter(option => option.type === MENU_OPTION_TYPES.OPTION && option.label.toLowerCase().includes(inputValue.toLowerCase()));
73
+ const filterOptions = (inputValue, options) => {
74
+ if (inputValue === '') return options;
75
+ return options.filter(option => option.type === MENU_OPTION_TYPES.OPTION && option.label.toLowerCase().includes(inputValue.toLowerCase()));
76
+ };
72
77
  const selectedValuesWithSections = (optionsToParse, multiSelectedValue) => {
73
78
  const items = [];
74
79
  if (optionsToParse) optionsToParse.forEach(option => {
@@ -42,7 +42,8 @@ const ClearButton = () => {
42
42
  if (latestInteractionRegion === 'clear-btn' && currFocusDescriber === 'clear-btn') DomElem?.focus?.();
43
43
  },
44
44
  onClick: onClearClick,
45
- onKeyDown: onClearButtonKeyDown
45
+ onKeyDown: onClearButtonKeyDown,
46
+ type: "button"
46
47
  }, styledsAttrs), {}, {
47
48
  children: /*#__PURE__*/_jsx(CloseMedium, {
48
49
  color: DSIconColors.PRIMARY
@@ -70,7 +70,8 @@ const CalendarHead = () => {
70
70
  onKeyDown: handlePrevYearKeyDown,
71
71
  onFocus: onPrevYearFocus,
72
72
  tabIndex: isControllerOnly ? -1 : 1,
73
- "data-testid": ControlledDateTimePickerDatatestid.CALENDAR.PREV_YEAR
73
+ "data-testid": ControlledDateTimePickerDatatestid.CALENDAR.PREV_YEAR,
74
+ type: "button"
74
75
  }, void 0, _ChevronDoubleLeft || (_ChevronDoubleLeft = /*#__PURE__*/_jsx(ChevronDoubleLeft, {
75
76
  height: 14,
76
77
  width: 14,
@@ -84,7 +85,8 @@ const CalendarHead = () => {
84
85
  innerRef: handlePrevMonthRef,
85
86
  onKeyDown: handlePrevMonthKeyDown,
86
87
  onFocus: onPrevMonthFocus,
87
- "data-testid": ControlledDateTimePickerDatatestid.CALENDAR.PREV_MONTH // this is a tabstop for when the calendar is open
88
+ "data-testid": ControlledDateTimePickerDatatestid.CALENDAR.PREV_MONTH,
89
+ type: "button" // this is a tabstop for when the calendar is open
88
90
 
89
91
  }, void 0, _ChevronLeft || (_ChevronLeft = /*#__PURE__*/_jsx(ChevronLeft, {
90
92
  fill: "#25292f"
@@ -96,7 +98,8 @@ const CalendarHead = () => {
96
98
  innerRef: handleNextMonthRef,
97
99
  onKeyDown: handleNextMonthKeyDown,
98
100
  onFocus: onNextMonthFocus,
99
- "data-testid": ControlledDateTimePickerDatatestid.CALENDAR.NEXT_MONTH
101
+ "data-testid": ControlledDateTimePickerDatatestid.CALENDAR.NEXT_MONTH,
102
+ type: "button"
100
103
  }, void 0, _ChevronRight || (_ChevronRight = /*#__PURE__*/_jsx(ChevronRight, {
101
104
  fill: "#25292f"
102
105
  }))), /*#__PURE__*/_jsx(StyledHeaderButton, {
@@ -107,7 +110,8 @@ const CalendarHead = () => {
107
110
  innerRef: handleNextYearRef,
108
111
  onKeyDown: handleNextYearKeyDown,
109
112
  onFocus: onNextYearFocus,
110
- "data-testid": ControlledDateTimePickerDatatestid.CALENDAR.NEXT_YEAR
113
+ "data-testid": ControlledDateTimePickerDatatestid.CALENDAR.NEXT_YEAR,
114
+ type: "button"
111
115
  }, void 0, _ChevronDoubleRight || (_ChevronDoubleRight = /*#__PURE__*/_jsx(ChevronDoubleRight, {
112
116
  height: 14,
113
117
  width: 14,
@@ -31,7 +31,8 @@ const CalendarIconTrigger = () => {
31
31
  onClick: handleToggleCalendar,
32
32
  onKeyDown: handlePickerIconKeyDown,
33
33
  "data-testid": ControlledDateTimePickerDatatestid.PICKER_ICONS.CALENDAR,
34
- disabled: disabled
34
+ disabled: disabled,
35
+ type: "button"
35
36
  }, void 0, _DatePicker || (_DatePicker = /*#__PURE__*/_jsx(DatePicker, {}))), [ariaCurrentValueForInputs, handleSetTriggerRef, handleToggleCalendar, handlePickerIconKeyDown, disabled]);
36
37
  };
37
38
 
@@ -131,7 +131,8 @@ const Day = _ref => {
131
131
  innerRef: handleInnerRef,
132
132
  tabIndex: isSelected ? 0 : -1,
133
133
  "data-isfocused": isFocused,
134
- "data-testid": dataTestid
134
+ "data-testid": dataTestid,
135
+ type: "button"
135
136
  }, void 0, `${day.getDate()}`)
136
137
  }));
137
138
  };
@@ -55,7 +55,8 @@ const HoursList = () => {
55
55
  onClick: handlePrevHour,
56
56
  innerRef: prevHourBtnRef,
57
57
  "data-testid": ControlledDateTimePickerDatatestid.TIMEWHEEL.PREV_HOUR,
58
- tabIndex: -1
58
+ tabIndex: -1,
59
+ type: "button"
59
60
  }, void 0, _ChevronSmallUp || (_ChevronSmallUp = /*#__PURE__*/_jsx(ChevronSmallUp, {})))), visibleHours.map(hourString => {
60
61
  const key = `timewheel-hour-${hourString || ''}`;
61
62
  if (!hourString) return /*#__PURE__*/_jsx(StyledWheelListItem, {}, key);
@@ -88,7 +89,8 @@ const HoursList = () => {
88
89
  "aria-valuemax": 12,
89
90
  "aria-valuemin": 1,
90
91
  "aria-valuenow": currHourNum,
91
- "aria-valuetext": `${hourString} hours`
92
+ "aria-valuetext": `${hourString} hours`,
93
+ type: "button"
92
94
  }, btnProps), {}, {
93
95
  children: hourString
94
96
  })));
@@ -99,7 +101,8 @@ const HoursList = () => {
99
101
  onClick: handleNextHour,
100
102
  innerRef: nextHourBtnRef,
101
103
  tabIndex: -1,
102
- "data-testid": ControlledDateTimePickerDatatestid.TIMEWHEEL.NEXT_HOUR
104
+ "data-testid": ControlledDateTimePickerDatatestid.TIMEWHEEL.NEXT_HOUR,
105
+ type: "button"
103
106
  }, void 0, _ChevronSmallDown || (_ChevronSmallDown = /*#__PURE__*/_jsx(ChevronSmallDown, {})))));
104
107
  };
105
108
 
@@ -70,6 +70,7 @@ const MeridiemList = () => {
70
70
  onClick: e => handleTimeWheelBtnChangeMeridiem('AM', e),
71
71
  innerRef: prevMeridiemBtnRef,
72
72
  tabIndex: -1,
73
+ type: "button",
73
74
  children: _ChevronSmallUp || (_ChevronSmallUp = /*#__PURE__*/_jsx(ChevronSmallUp, {}))
74
75
  }))), currMeridiem === 'AM' || currMeridiem === '' ? _StyledWheelListItem || (_StyledWheelListItem = /*#__PURE__*/_jsx(StyledWheelListItem, {})) : null, /*#__PURE__*/_jsx(StyledWheelListItem, {
75
76
  isCurrentListItem: isAmCurrent
@@ -89,6 +90,7 @@ const MeridiemList = () => {
89
90
  "aria-valuemin": 0,
90
91
  "aria-valuenow": isPmCurrent ? 1 : 0,
91
92
  "aria-valuetext": isAmCurrent ? 'ante meridiem' : 'post meridiem',
93
+ type: "button",
92
94
  children: "AM"
93
95
  }))), /*#__PURE__*/_jsx(StyledWheelListItem, {
94
96
  isCurrentListItem: isPmCurrent
@@ -108,6 +110,7 @@ const MeridiemList = () => {
108
110
  "aria-valuemin": 0,
109
111
  "aria-valuenow": isPmCurrent ? 1 : 0,
110
112
  "aria-valuetext": isAmCurrent ? 'ante meridiem' : 'post meridiem',
113
+ type: "button",
111
114
  children: "PM"
112
115
  }))), currMeridiem === 'PM' ? _StyledWheelListItem2 || (_StyledWheelListItem2 = /*#__PURE__*/_jsx(StyledWheelListItem, {})) : null, /*#__PURE__*/_jsx(StyledWheelListItem, {}, void 0, /*#__PURE__*/jsx(StyledWheelChangeTimeBtn, _objectSpread(_objectSpread({}, styledPropsNextMeridiem), {}, {
113
116
  "aria-label": "set pm meridiem",
@@ -118,6 +121,7 @@ const MeridiemList = () => {
118
121
  onClick: e => handleTimeWheelBtnChangeMeridiem('PM', e),
119
122
  innerRef: nextMeridiemBtnRef,
120
123
  tabIndex: -1,
124
+ type: "button",
121
125
  children: _ChevronSmallDown || (_ChevronSmallDown = /*#__PURE__*/_jsx(ChevronSmallDown, {}))
122
126
  }))));
123
127
  };
@@ -54,7 +54,8 @@ const MinutesList = () => {
54
54
  onClick: handlePrevMinute,
55
55
  innerRef: prevMinutesBtnRef,
56
56
  tabIndex: -1,
57
- "data-testid": ControlledDateTimePickerDatatestid.TIMEWHEEL.PREV_MINUTE
57
+ "data-testid": ControlledDateTimePickerDatatestid.TIMEWHEEL.PREV_MINUTE,
58
+ type: "button"
58
59
  }, void 0, _ChevronSmallUp || (_ChevronSmallUp = /*#__PURE__*/_jsx(ChevronSmallUp, {})))), visibleMinutes.map(minutesString => {
59
60
  const key = `timewheel-minutes-${minutesString || ''}`;
60
61
  if (!minutesString) return /*#__PURE__*/_jsx(StyledWheelListItem, {}, key);
@@ -87,7 +88,8 @@ const MinutesList = () => {
87
88
  "aria-valuemax": 59,
88
89
  "aria-valuemin": 0,
89
90
  "aria-valuenow": currMinuteNum,
90
- "aria-valuetext": `${minutesString} minutes`
91
+ "aria-valuetext": `${minutesString} minutes`,
92
+ type: "button"
91
93
  }, btnProps), {}, {
92
94
  children: minutesString
93
95
  })));
@@ -98,7 +100,8 @@ const MinutesList = () => {
98
100
  onClick: handleNextMinute,
99
101
  innerRef: nextMinutesBtnRef,
100
102
  "data-testid": ControlledDateTimePickerDatatestid.TIMEWHEEL.NEXT_MINUTE,
101
- tabIndex: -1
103
+ tabIndex: -1,
104
+ type: "button"
102
105
  }, void 0, _ChevronSmallDown || (_ChevronSmallDown = /*#__PURE__*/_jsx(ChevronSmallDown, {})))));
103
106
  };
104
107
 
@@ -43,7 +43,8 @@ const SecondsList = () => {
43
43
  onClick: handlePrevSecond,
44
44
  onKeyDown: handlePrevSecondBtnOnKeyDown,
45
45
  innerRef: prevSecondsBtnRef,
46
- tabIndex: -1
46
+ tabIndex: -1,
47
+ type: "button"
47
48
  }, void 0, _ChevronSmallUp || (_ChevronSmallUp = /*#__PURE__*/_jsx(ChevronSmallUp, {})))), visibleSeconds.map(secondsString => {
48
49
  const key = `timewheel-seconds-${secondsString}`;
49
50
  if (!secondsString) return /*#__PURE__*/_jsx(StyledWheelListItem, {}, key);
@@ -62,7 +63,8 @@ const SecondsList = () => {
62
63
  size: "l",
63
64
  variant: BUTTON_VARIANT.DEFAULT,
64
65
  onClick: e => handleTimeWheelBtnChangeSeconds(secondsString, e),
65
- tabIndex: tabIndex
66
+ tabIndex: tabIndex,
67
+ type: "button"
66
68
  }, btnProps), {}, {
67
69
  children: secondsString
68
70
  })));
@@ -74,7 +76,8 @@ const SecondsList = () => {
74
76
  onClick: handleNextSecond,
75
77
  onKeyDown: handleNextSecondBtnOnKeyDown,
76
78
  innerRef: nextSecondsBtnRef,
77
- tabIndex: -1
79
+ tabIndex: -1,
80
+ type: "button"
78
81
  }, void 0, _ChevronSmallDown || (_ChevronSmallDown = /*#__PURE__*/_jsx(ChevronSmallDown, {})))));
79
82
  };
80
83
 
@@ -30,7 +30,8 @@ const TimeWheelIconTrigger = () => {
30
30
  onClick: handleToggleTimePicker,
31
31
  onKeyDown: handlePickerIconKeyDown,
32
32
  "data-testid": ControlledDateTimePickerDatatestid.PICKER_ICONS.TIMEWHEEL,
33
- disabled: disabled
33
+ disabled: disabled,
34
+ type: "button"
34
35
  }, void 0, _RecentDocuments || (_RecentDocuments = /*#__PURE__*/_jsx(RecentDocuments, {}))), [ariaCurrentValueForInputs, disabled, handlePickerIconKeyDown, handleSetTriggerRef, handleToggleTimePicker]);
35
36
  };
36
37
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/ds-controlled-form",
3
- "version": "2.4.3",
3
+ "version": "2.4.4-rc.0",
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",
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",
899
+ "@elliemae/ds-button": "2.4.4-rc.0",
900
+ "@elliemae/ds-circular-progress-indicator": "2.4.4-rc.0",
901
+ "@elliemae/ds-controlled-form": "2.4.4-rc.0",
902
+ "@elliemae/ds-form": "2.4.4-rc.0",
903
+ "@elliemae/ds-form-layout-blocks": "2.4.4-rc.0",
904
+ "@elliemae/ds-grid": "2.4.4-rc.0",
905
+ "@elliemae/ds-icon": "2.4.4-rc.0",
906
+ "@elliemae/ds-icons": "2.4.4-rc.0",
907
+ "@elliemae/ds-pills": "2.4.4-rc.0",
908
+ "@elliemae/ds-popperjs": "2.4.4-rc.0",
909
+ "@elliemae/ds-props-helpers": "2.4.4-rc.0",
910
+ "@elliemae/ds-system": "2.4.4-rc.0",
911
+ "@elliemae/ds-tooltip": "2.4.4-rc.0",
912
+ "@elliemae/ds-truncated-tooltip-text": "2.4.4-rc.0",
913
913
  "prop-types": "~15.7.2",
914
914
  "react-desc": "~4.1.3",
915
915
  "react-popper": "~2.2.5",
@@ -6,6 +6,7 @@ export declare namespace DSControlledCheckboxT {
6
6
  tabIndex?: number;
7
7
  hasError?: boolean;
8
8
  wrapLabel: boolean;
9
+ disabled: boolean;
9
10
  }
10
11
  interface OptionalProps {
11
12
  innerRef: React.RefObject<HTMLInputElement> | React.LegacyRef<HTMLInputElement>;
@@ -36,7 +36,6 @@ 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;
40
39
  onSelectAll?: (suggestedValue: OptionTypes[] | [], event: React.MouseEvent | React.KeyboardEvent) => null;
41
40
  onKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>, value: ItemOption) => void;
42
41
  }
@@ -53,6 +52,7 @@ export declare namespace DSComboboxT {
53
52
  inline: boolean;
54
53
  withoutPortal: boolean;
55
54
  zIndex: number;
55
+ isNonClearable: boolean;
56
56
  disabled: boolean;
57
57
  noOptionsMessage: string;
58
58
  innerRef: React.RefObject<HTMLInputElement>;
@@ -7,7 +7,7 @@ export declare const isSelected: (value: DSComboboxT.SelectedOptionsT, activeOpt
7
7
  export declare const findInCircularList: (list: DSComboboxT.OptionTypes[], from: number, criteria: (item: DSComboboxT.OptionTypes) => boolean, step?: number) => number;
8
8
  export declare const getLastValueSelected: (selectedValues: DSComboboxT.SelectedOptionsT) => DSComboboxT.ItemOption | null;
9
9
  export declare const getFirstOption: (options: DSComboboxT.OptionTypes[], selectedValues: DSComboboxT.SelectedOptionsT, inputValue: string) => string;
10
- export declare const getSuggestedValueOnChange: (selectedOption: DSComboboxT.ItemOption, selectedValues: DSComboboxT.SelectedOptionsT) => DSComboboxT.ItemOption | DSComboboxT.ItemOption[] | null;
10
+ export declare const getSuggestedValueOnChange: (selectedOption: DSComboboxT.ItemOption, selectedValues: DSComboboxT.SelectedOptionsT, isNonClearable?: boolean | undefined) => DSComboboxT.ItemOption | DSComboboxT.ItemOption[] | null;
11
11
  export declare const filterOptions: (inputValue: string, options: DSComboboxT.OptionTypes[]) => DSComboboxT.OptionTypes[];
12
12
  export declare const selectedValuesWithSections: (optionsToParse: DSComboboxT.OptionTypes[], multiSelectedValue: DSComboboxT.ItemOption[]) => DSComboboxT.OptionTypes[];
13
13
  export declare const getFilteredOptionsSelected: (filteredOption: DSComboboxT.OptionTypes[], selectedValues: DSComboboxT.ItemOption[]) => DSComboboxT.OptionTypes[];