@elliemae/ds-controlled-form 2.3.0-next.8 → 2.3.0-rc.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.
- package/cjs/controlled-autocomplete/parts/controls/styled.js +2 -2
- package/cjs/controlled-autocomplete/parts/menu-list/MenuList.js +2 -2
- package/cjs/controlled-checkbox/ControlledCheckbox.js +54 -40
- package/cjs/controlled-checkbox/config/useValidateProps.js +2 -2
- package/cjs/controlled-checkbox/react-desc-prop-types.js +32 -0
- package/cjs/controlled-checkbox/utils/styleHelpers.js +4 -4
- package/cjs/controlled-combobox/ComboBoxCTX.js +1 -4
- package/cjs/controlled-combobox/config/useComboBox.js +6 -5
- package/cjs/controlled-combobox/parts/a11y-messages/SelectedValuesAllyMsg.js +7 -2
- package/cjs/controlled-combobox/parts/container/Container.js +2 -16
- package/cjs/controlled-combobox/parts/controls/Controls.js +1 -0
- package/cjs/controlled-combobox/parts/controls/styled.js +3 -3
- package/cjs/controlled-combobox/parts/controls-input/ControlsInput.js +5 -3
- package/cjs/controlled-combobox/parts/controls-input/useControlsInput.js +3 -1
- package/cjs/controlled-combobox/parts/header-list/HeaderList.js +4 -9
- package/cjs/controlled-combobox/parts/header-list/useHeaderListHandlers.js +8 -1
- package/cjs/controlled-combobox/parts/menu-list/MenuList.js +10 -13
- package/cjs/controlled-combobox/parts/menu-list/styled.js +4 -0
- package/cjs/controlled-combobox/parts/menu-list/useItemRenderer.js +4 -7
- package/cjs/controlled-combobox/parts/multi-selected-values-container/MultiSelectedValuesContainer.js +18 -8
- package/cjs/controlled-combobox/react-desc-prop-types.js +1 -1
- package/cjs/controlled-combobox/utils/hooks/useKeyboardNavigation.js +2 -5
- package/cjs/controlled-date-time-picker/parts/ControlledDateTimePickerContent.js +2 -2
- package/cjs/controlled-date-time-picker/parts/DateInputs/DateInputs.js +2 -2
- package/cjs/controlled-date-time-picker/parts/Pickers/Calendar/Styleds.js +2 -2
- package/cjs/controlled-date-time-picker/parts/Pickers/TimeWheel/Styleds.js +2 -2
- package/cjs/controlled-date-time-picker/parts/Styleds.js +6 -6
- package/cjs/controlled-date-time-picker/parts/TimeInputs/TimeInputs.js +2 -2
- package/esm/controlled-checkbox/ControlledCheckbox.js +49 -37
- package/esm/controlled-checkbox/config/useValidateProps.js +2 -2
- package/esm/controlled-checkbox/react-desc-prop-types.js +23 -0
- package/esm/controlled-checkbox/utils/styleHelpers.js +4 -4
- package/esm/controlled-combobox/ComboBoxCTX.js +2 -5
- package/esm/controlled-combobox/config/useComboBox.js +7 -6
- package/esm/controlled-combobox/parts/a11y-messages/SelectedValuesAllyMsg.js +7 -2
- package/esm/controlled-combobox/parts/container/Container.js +2 -16
- package/esm/controlled-combobox/parts/controls/Controls.js +1 -0
- package/esm/controlled-combobox/parts/controls-input/ControlsInput.js +5 -3
- package/esm/controlled-combobox/parts/controls-input/useControlsInput.js +3 -1
- package/esm/controlled-combobox/parts/header-list/HeaderList.js +4 -9
- package/esm/controlled-combobox/parts/header-list/useHeaderListHandlers.js +8 -1
- package/esm/controlled-combobox/parts/menu-list/MenuList.js +12 -15
- package/esm/controlled-combobox/parts/menu-list/styled.js +4 -1
- package/esm/controlled-combobox/parts/menu-list/useItemRenderer.js +2 -5
- package/esm/controlled-combobox/parts/multi-selected-values-container/MultiSelectedValuesContainer.js +19 -8
- package/esm/controlled-combobox/react-desc-prop-types.js +1 -1
- package/esm/controlled-combobox/utils/hooks/useKeyboardNavigation.js +2 -5
- package/package.json +13 -29
- package/types/controlled-checkbox/ControlledCheckbox.d.ts +4 -70
- package/types/controlled-checkbox/config/useValidateProps.d.ts +2 -2
- package/types/controlled-checkbox/react-desc-prop-types.d.ts +32 -0
- package/types/controlled-checkbox/styles.d.ts +3 -3
- package/types/controlled-checkbox/utils/setMultipleRefs.d.ts +1 -1
- package/types/controlled-checkbox/utils/styleHelpers.d.ts +3 -3
- package/types/controlled-combobox/config/useComboBox.d.ts +1 -1
- package/types/controlled-combobox/parts/controls/useOnPillsNavigation.d.ts +2 -2
- package/types/controlled-combobox/parts/header-list/useHeaderListHandlers.d.ts +2 -1
- package/types/controlled-combobox/parts/menu-list/styled.d.ts +1 -0
- package/types/controlled-combobox/parts/menu-list/useItemRenderer.d.ts +2 -2
- package/types/controlled-combobox/react-desc-prop-types.d.ts +9 -5
- package/types/controlled-combobox/sharedTypes.d.ts +0 -2
- package/cjs/controlled-checkbox/index.d.js +0 -2
- package/cjs/controlled-checkbox/propTypes.js +0 -22
- package/cjs/controlled-combobox/parts/dropdown-indicator/index.js +0 -2
- package/cjs/controlled-combobox/parts/empty-state/index.js +0 -23
- package/cjs/controlled-combobox/parts/empty-state/styled.js +0 -19
- package/cjs/controlled-combobox/parts/multi-selected-values-container/styled.js +0 -23
- package/esm/controlled-checkbox/index.d.js +0 -1
- package/esm/controlled-checkbox/propTypes.js +0 -18
- package/esm/controlled-combobox/parts/dropdown-indicator/index.js +0 -1
- package/esm/controlled-combobox/parts/empty-state/index.js +0 -15
- package/esm/controlled-combobox/parts/empty-state/styled.js +0 -10
- package/esm/controlled-combobox/parts/multi-selected-values-container/styled.js +0 -13
- package/types/controlled-checkbox/index.d.d.ts +0 -29
- package/types/controlled-checkbox/propTypes.d.ts +0 -60
- package/types/controlled-combobox/parts/dropdown-indicator/index.d.ts +0 -0
- package/types/controlled-combobox/parts/empty-state/index.d.ts +0 -3
- package/types/controlled-combobox/parts/empty-state/styled.d.ts +0 -2
- package/types/controlled-combobox/parts/multi-selected-values-container/styled.d.ts +0 -3
|
@@ -12,7 +12,7 @@ require('core-js/modules/esnext.iterator.filter.js');
|
|
|
12
12
|
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
13
13
|
require('core-js/modules/esnext.iterator.for-each.js');
|
|
14
14
|
var React = require('react');
|
|
15
|
-
var
|
|
15
|
+
var dsGrid = require('@elliemae/ds-grid');
|
|
16
16
|
var dsForm = require('@elliemae/ds-form');
|
|
17
17
|
var ComboBoxCTX = require('../../ComboBoxCTX.js');
|
|
18
18
|
var styled = require('./styled.js');
|
|
@@ -45,9 +45,6 @@ const useItemRenderer = () => {
|
|
|
45
45
|
focusOptionIdx,
|
|
46
46
|
virtualListHelpers
|
|
47
47
|
} = React.useContext(ComboBoxCTX.ComboBoxContext);
|
|
48
|
-
const {
|
|
49
|
-
virtualItems
|
|
50
|
-
} = virtualListHelpers;
|
|
51
48
|
const multiple = Array.isArray(selectedValues);
|
|
52
49
|
const CBItem = multiple ? dsForm.MultiMenuItem : dsForm.SingleMenuItem;
|
|
53
50
|
const handleClick = React.useCallback((option, e) => {
|
|
@@ -75,7 +72,7 @@ const useItemRenderer = () => {
|
|
|
75
72
|
const handleOnMouseDown = React.useCallback(e => {
|
|
76
73
|
e.preventDefault();
|
|
77
74
|
}, []);
|
|
78
|
-
const ItemRenderer = React.useMemo(() => virtualItems.map(vItem => {
|
|
75
|
+
const ItemRenderer = React.useMemo(() => virtualListHelpers === null || virtualListHelpers === void 0 ? void 0 : virtualListHelpers.virtualItems.map(vItem => {
|
|
79
76
|
const option = options[vItem.index];
|
|
80
77
|
const generalProps = {
|
|
81
78
|
wrapperStyles: {
|
|
@@ -121,7 +118,7 @@ const useItemRenderer = () => {
|
|
|
121
118
|
let {
|
|
122
119
|
label
|
|
123
120
|
} = _ref;
|
|
124
|
-
return /*#__PURE__*/_jsx__default["default"](
|
|
121
|
+
return /*#__PURE__*/_jsx__default["default"](dsGrid.Grid, {
|
|
125
122
|
cols: ['min-content', 'auto'],
|
|
126
123
|
height: "16px",
|
|
127
124
|
gutter: "xxs",
|
|
@@ -134,7 +131,7 @@ const useItemRenderer = () => {
|
|
|
134
131
|
}
|
|
135
132
|
|
|
136
133
|
return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
137
|
-
}), [options, focusOptionIdx, selectedValues, innerRef, virtualItems]);
|
|
134
|
+
}), [options, focusOptionIdx, selectedValues, innerRef, virtualListHelpers === null || virtualListHelpers === void 0 ? void 0 : virtualListHelpers.virtualItems]);
|
|
138
135
|
return ItemRenderer;
|
|
139
136
|
};
|
|
140
137
|
|
|
@@ -6,7 +6,6 @@ var _jsx = require('@babel/runtime/helpers/jsx');
|
|
|
6
6
|
require('core-js/modules/esnext.async-iterator.map.js');
|
|
7
7
|
require('core-js/modules/esnext.iterator.map.js');
|
|
8
8
|
var React = require('react');
|
|
9
|
-
var Grid = require('@elliemae/ds-grid');
|
|
10
9
|
var dsPills = require('@elliemae/ds-pills');
|
|
11
10
|
var ComboBoxCTX = require('../../ComboBoxCTX.js');
|
|
12
11
|
var useGroupPills = require('./useGroupPills.js');
|
|
@@ -16,7 +15,6 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
16
15
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
17
16
|
|
|
18
17
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
19
|
-
var Grid__default = /*#__PURE__*/_interopDefaultLegacy(Grid);
|
|
20
18
|
|
|
21
19
|
const MultiSelectedValuesContainer = () => {
|
|
22
20
|
const {
|
|
@@ -25,17 +23,29 @@ const MultiSelectedValuesContainer = () => {
|
|
|
25
23
|
onChange,
|
|
26
24
|
innerRef
|
|
27
25
|
},
|
|
28
|
-
pillGroupRef
|
|
26
|
+
pillGroupRef,
|
|
27
|
+
showPopover,
|
|
28
|
+
setShowPopover
|
|
29
29
|
} = React.useContext(ComboBoxCTX.ComboBoxContext);
|
|
30
30
|
const multiSelectedValue = selectedValues;
|
|
31
31
|
const correctPillsToShow = useGroupPills.useGroupPills() || 1;
|
|
32
|
-
const
|
|
32
|
+
const handleClickOnPills = React.useCallback(e => {
|
|
33
|
+
if (!showPopover) {
|
|
34
|
+
var _innerRef$current;
|
|
35
|
+
|
|
36
|
+
setShowPopover(true);
|
|
37
|
+
(_innerRef$current = innerRef.current) === null || _innerRef$current === void 0 ? void 0 : _innerRef$current.focus();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
e.stopPropagation();
|
|
41
|
+
}, [setShowPopover, innerRef, showPopover]);
|
|
42
|
+
const pills = React.useMemo(() => /*#__PURE__*/_jsx__default["default"]("div", {
|
|
33
43
|
style: {
|
|
34
44
|
width: 'max-content'
|
|
35
45
|
},
|
|
36
|
-
onClick: e => e.stopPropagation(),
|
|
37
46
|
"data-testid": ComboboxDataTestids.ComboboxDataTestid.SELECTED_VALUES
|
|
38
47
|
}, void 0, /*#__PURE__*/_jsx__default["default"](dsPills.DSPillGroupV2, {
|
|
48
|
+
onClick: handleClickOnPills,
|
|
39
49
|
innerRef: pillGroupRef
|
|
40
50
|
}, void 0, multiSelectedValue.length > 0 && multiSelectedValue.slice(0, correctPillsToShow).map(option => /*#__PURE__*/_jsx__default["default"](dsPills.DSPillV2, {
|
|
41
51
|
size: "s",
|
|
@@ -43,17 +53,17 @@ const MultiSelectedValuesContainer = () => {
|
|
|
43
53
|
type: "removable",
|
|
44
54
|
tabIndex: -1,
|
|
45
55
|
onRemove: () => {
|
|
46
|
-
var _innerRef$
|
|
56
|
+
var _innerRef$current2;
|
|
47
57
|
|
|
48
58
|
onChange(option);
|
|
49
|
-
(_innerRef$
|
|
59
|
+
(_innerRef$current2 = innerRef.current) === null || _innerRef$current2 === void 0 ? void 0 : _innerRef$current2.focus();
|
|
50
60
|
}
|
|
51
61
|
}, option.value)), multiSelectedValue.length > 0 && correctPillsToShow !== multiSelectedValue.length && /*#__PURE__*/_jsx__default["default"](dsPills.DSPillV2, {
|
|
52
62
|
size: "s",
|
|
53
63
|
labelTruncated: false,
|
|
54
64
|
label: "+".concat(multiSelectedValue.length - correctPillsToShow),
|
|
55
65
|
type: "value"
|
|
56
|
-
}, "grouped"))), [pillGroupRef, innerRef, onChange, multiSelectedValue, correctPillsToShow]);
|
|
66
|
+
}, "grouped"))), [pillGroupRef, innerRef, onChange, handleClickOnPills, multiSelectedValue, correctPillsToShow]);
|
|
57
67
|
return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
58
68
|
children: pills
|
|
59
69
|
});
|
|
@@ -19,7 +19,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
19
19
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
20
20
|
const ComboboxPropTypes = _objectSpread(_objectSpread({}, dsPropsHelpers.globalAttributesPropTypes), {}, {
|
|
21
21
|
placeholder: dsPropsHelpers.PropTypes.string.description('input s placeholder value').defaultValue(''),
|
|
22
|
-
options: dsPropsHelpers.PropTypes.oneOfType([dsPropsHelpers.PropTypes.array, dsPropsHelpers.PropTypes.object]).description('List of options').defaultValue([]),
|
|
22
|
+
options: dsPropsHelpers.PropTypes.oneOfType([dsPropsHelpers.PropTypes.array, dsPropsHelpers.PropTypes.object]).isRequired.description('List of options').defaultValue([]),
|
|
23
23
|
selectedValues: dsPropsHelpers.PropTypes.oneOfType([dsPropsHelpers.PropTypes.arrayOf(dsPropsHelpers.PropTypes.object), dsPropsHelpers.PropTypes.object]).description('Array of option or single option selected'),
|
|
24
24
|
disabled: dsPropsHelpers.PropTypes.bool.description('wheter or not the input is disabled').defaultValue('false'),
|
|
25
25
|
autoFocus: dsPropsHelpers.PropTypes.bool.description('Whether the combo box uses auto focus or not').defaultValue('false'),
|
|
@@ -28,7 +28,6 @@ const useKeyboardNavigation = () => {
|
|
|
28
28
|
},
|
|
29
29
|
setShowPopover,
|
|
30
30
|
showPopover,
|
|
31
|
-
setShowSelectedValue,
|
|
32
31
|
focusOptionIdx,
|
|
33
32
|
setCurrentOption,
|
|
34
33
|
scrollOptionIntoView,
|
|
@@ -44,13 +43,12 @@ const useKeyboardNavigation = () => {
|
|
|
44
43
|
} else {
|
|
45
44
|
onFilter('');
|
|
46
45
|
if (innerRef.current) innerRef.current.value = '';
|
|
47
|
-
setShowSelectedValue(true);
|
|
48
46
|
}
|
|
49
47
|
|
|
50
48
|
const selectedOption = options.find(item => item.dsId === focusOptionIdx);
|
|
51
49
|
onChange(selectedOption);
|
|
52
50
|
if (!selectedOption.disabled && !multiple) setShowPopover(false);
|
|
53
|
-
}, [multiple, options, focusOptionIdx, setShowPopover, onFilter, innerRef,
|
|
51
|
+
}, [multiple, options, focusOptionIdx, setShowPopover, onFilter, innerRef, onChange]);
|
|
54
52
|
const onInputKeyDown = React.useCallback(e => {
|
|
55
53
|
const targetElement = e.target; // =============================================================================
|
|
56
54
|
// CUSTOM KEYS
|
|
@@ -150,7 +148,6 @@ const useKeyboardNavigation = () => {
|
|
|
150
148
|
}
|
|
151
149
|
|
|
152
150
|
onFilter('');
|
|
153
|
-
setShowSelectedValue(true);
|
|
154
151
|
}
|
|
155
152
|
|
|
156
153
|
if (e.key === 'Tab' && !inline && !withoutPortal) {
|
|
@@ -165,7 +162,7 @@ const useKeyboardNavigation = () => {
|
|
|
165
162
|
} // if (e.key === 'Tab' && multiple) {
|
|
166
163
|
// }
|
|
167
164
|
|
|
168
|
-
}, [currentItemIndex, options, currentItem, innerRef, multiple, showPopover, selectedValues, inline, scrollOptionIntoView, onKeyDown, onSelectAll, onChange, onCreate, onFilter, setCurrentOption, setShowPopover,
|
|
165
|
+
}, [currentItemIndex, options, currentItem, innerRef, multiple, showPopover, selectedValues, inline, scrollOptionIntoView, onKeyDown, onSelectAll, onChange, onCreate, onFilter, setCurrentOption, setShowPopover, selectOption, onCancel, selectAllCheckboxRef, toggleSelectionButtonRef, withoutPortal]);
|
|
169
166
|
return {
|
|
170
167
|
onInputKeyDown
|
|
171
168
|
};
|
|
@@ -10,7 +10,7 @@ require('core-js/modules/esnext.iterator.for-each.js');
|
|
|
10
10
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
11
11
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
12
12
|
var React = require('react');
|
|
13
|
-
var
|
|
13
|
+
var dsGrid = require('@elliemae/ds-grid');
|
|
14
14
|
var ControlledDateTimePickerCTX = require('../ControlledDateTimePickerCTX.js');
|
|
15
15
|
var Styleds = require('./Styleds.js');
|
|
16
16
|
var DateInputs = require('./DateInputs/DateInputs.js');
|
|
@@ -72,7 +72,7 @@ const ControlledDateTimePickerContent = () => {
|
|
|
72
72
|
isControllerOnly: isControllerOnly,
|
|
73
73
|
disabled: disabled
|
|
74
74
|
}, dataAttrs), {}, {
|
|
75
|
-
children: [hideDate ? null : _DateInputs || (_DateInputs = /*#__PURE__*/_jsx__default["default"](DateInputs.DateInputs, {})), hideTime ? null : _TimeInputs || (_TimeInputs = /*#__PURE__*/_jsx__default["default"](TimeInputs.TimeInputs, {})), withAnyRightController ? /*#__PURE__*/_jsx__default["default"](
|
|
75
|
+
children: [hideDate ? null : _DateInputs || (_DateInputs = /*#__PURE__*/_jsx__default["default"](DateInputs.DateInputs, {})), hideTime ? null : _TimeInputs || (_TimeInputs = /*#__PURE__*/_jsx__default["default"](TimeInputs.TimeInputs, {})), withAnyRightController ? /*#__PURE__*/_jsx__default["default"](dsGrid.Grid, {
|
|
76
76
|
cols: rightControlCols
|
|
77
77
|
}, void 0, shouldPreserveClearableSpace ? _ClearButton || (_ClearButton = /*#__PURE__*/_jsx__default["default"](ClearButton.ClearButton, {})) : null, withAnyPicker ? _PickersIcons || (_PickersIcons = /*#__PURE__*/_jsx__default["default"](PickersIcons.PickersIcons, {})) : null) : null]
|
|
78
78
|
}))
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
6
|
var React = require('react');
|
|
7
|
-
var
|
|
7
|
+
var dsGrid = require('@elliemae/ds-grid');
|
|
8
8
|
var ControlledDateTimePickerCTX = require('../../ControlledDateTimePickerCTX.js');
|
|
9
9
|
var MMInput = require('./MMInput.js');
|
|
10
10
|
var DDInput = require('./DDInput.js');
|
|
@@ -45,7 +45,7 @@ const DateInputs = () => {
|
|
|
45
45
|
yearInputRef,
|
|
46
46
|
ariaCurrentValueForInputs
|
|
47
47
|
} = React.useContext(ControlledDateTimePickerCTX.ControlledDateTimePickerContext);
|
|
48
|
-
return /*#__PURE__*/_jsx__default["default"](
|
|
48
|
+
return /*#__PURE__*/_jsx__default["default"](dsGrid.Grid, {
|
|
49
49
|
cols: [config.fixedValues.smallInputWidth, config.fixedValues.separatorWidth, config.fixedValues.smallInputWidth, config.fixedValues.separatorWidth, config.fixedValues.largeInputWidth]
|
|
50
50
|
}, void 0, /*#__PURE__*/_jsx__default["default"](Styleds.StyledFocusWithIn, {}, void 0, /*#__PURE__*/_jsx__default["default"](MMInput.MMInput, {
|
|
51
51
|
onChange: onMonthChange,
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var _taggedTemplateLiteral = require('@babel/runtime/helpers/taggedTemplateLiteral');
|
|
6
6
|
var styled = require('styled-components');
|
|
7
7
|
var dsSystem = require('@elliemae/ds-system');
|
|
8
|
-
var
|
|
8
|
+
var dsGrid = require('@elliemae/ds-grid');
|
|
9
9
|
var DSButton = require('@elliemae/ds-button');
|
|
10
10
|
|
|
11
11
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -127,7 +127,7 @@ const StyledDayBtn = /*#__PURE__*/styled__default["default"](DSButton.DSButtonV2
|
|
|
127
127
|
} = _ref17;
|
|
128
128
|
return theme.colors.brand[200];
|
|
129
129
|
}, focusBorder);
|
|
130
|
-
const StyledWeekDaysListWrapper = /*#__PURE__*/styled__default["default"](
|
|
130
|
+
const StyledWeekDaysListWrapper = /*#__PURE__*/styled__default["default"](dsGrid.Grid).withConfig({
|
|
131
131
|
componentId: "sc-18gg4kd-7"
|
|
132
132
|
})(["font-size:", ";text-align:center;", ";", ";.dayWrapper.selectedDay,.dayWrapper.startRangeDay,.dayWrapper.endRangeDay{", "{color:", ";font-weight:", ";}&:not(.disabledDay),&:not(.outOfRangeDay){", "{background-color:", ";}}&.disabledDay,&.outOfRangeDay{", "{color:", ";background-color:", ";&:before{background-color:", ";}}}&.focusedDay{", "{color:", ";border-color:", ";}}&.outOfRangeDay.focusedDay{", "{color:", ";&:before{background-color:", ";}}}}.dayWrapper.disabledDay,.dayWrapper.outOfRangeDay{", "{color:", ";", " &:before{background-color:", ";}}&.focusedDay{", "{&:after{border:2px solid ", ";}}}}.dayWrapper.focusedDay{", "{", " color:", ";&:after{border:2px solid ", ";}}&.disabledDay,&.outOfRangeDay{", "{color:", ";&:before{background-color:", ";}}}}.dayWrapper.notCurrentMonth{", "{color:", ";}&.focusedDay{", "{color:", ";}&.disabledDay,&.outOfRangeDay{", "{color:", ";}&.inRangeDay,&.startRangeDay,&.endRangeDay{", "{color:", ";}}}}&.selectedDay,&.startRangeDay,&.endRangeDay{", "{color:", ";}}}.dayWrapper.inRangeDay{", " &.disabledDay,&.outOfRangeDay{", "{color:", ";background-color:", ";&:before{background-color:", ";}}&.focusedDay{", "{border-color:", ";}}}}.dayWrapper.startRangeDay{", " &.focusedDay{", "{color:", ";}}&.disabledDay,&.outOfRangeDay{", "{color:", ";&:before{background-color:", ";}}}}.dayWrapper.endRangeDay{", " &.focusedDay{", "{color:", ";}}&.disabledDay,&.outOfRangeDay{", "{color:", ";&:before{background-color:", ";}}}}.dayWrapper.endRangeDay.startRangeDay{background-color:transparent;box-shadow:none;}"], _ref18 => {
|
|
133
133
|
let {
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var _taggedTemplateLiteral = require('@babel/runtime/helpers/taggedTemplateLiteral');
|
|
6
6
|
var styled = require('styled-components');
|
|
7
7
|
var dsSystem = require('@elliemae/ds-system');
|
|
8
|
-
var
|
|
8
|
+
var dsGrid = require('@elliemae/ds-grid');
|
|
9
9
|
var DSButton = require('@elliemae/ds-button');
|
|
10
10
|
|
|
11
11
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -84,7 +84,7 @@ const StyledTimePickerContainer = /*#__PURE__*/styled__default["default"].div.wi
|
|
|
84
84
|
} = _ref8;
|
|
85
85
|
return showShadow && !isControllerOnly ? "\n box-shadow: 0 6px 20px 0 rgb(0 0 0 / 24%), 0 8px 17px 0 rgb(0 0 0 / 19%);\n " : '';
|
|
86
86
|
});
|
|
87
|
-
const StyledTimePickerHead = /*#__PURE__*/styled__default["default"](
|
|
87
|
+
const StyledTimePickerHead = /*#__PURE__*/styled__default["default"](dsGrid.Grid).withConfig({
|
|
88
88
|
componentId: "sc-1nsw31l-3"
|
|
89
89
|
})(["width:100%;grid-area:TimePickerHead;justify-content:center;align-items:center;background:", ";"], _ref9 => {
|
|
90
90
|
let {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var styled = require('styled-components');
|
|
6
|
-
var
|
|
6
|
+
var dsGrid = require('@elliemae/ds-grid');
|
|
7
7
|
var DSButton = require('@elliemae/ds-button');
|
|
8
8
|
|
|
9
9
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -14,10 +14,10 @@ var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
|
14
14
|
const ResettedInput = /*#__PURE__*/styled__default["default"].input.withConfig({
|
|
15
15
|
componentId: "sc-1t4k08s-0"
|
|
16
16
|
})(["border:none;box-shadow:none;background:none;text-align:center;height:100%;display:flex;align-items:center;:focus{outline:none;}padding-top:2px;"]);
|
|
17
|
-
const StyledSeparator = /*#__PURE__*/styled__default["default"](
|
|
17
|
+
const StyledSeparator = /*#__PURE__*/styled__default["default"](dsGrid.Grid).withConfig({
|
|
18
18
|
componentId: "sc-1t4k08s-1"
|
|
19
19
|
})(["padding-top:2px;margin:auto;"]);
|
|
20
|
-
const StyledColonSeparator = /*#__PURE__*/styled__default["default"](
|
|
20
|
+
const StyledColonSeparator = /*#__PURE__*/styled__default["default"](dsGrid.Grid).withConfig({
|
|
21
21
|
componentId: "sc-1t4k08s-2"
|
|
22
22
|
})(["padding-bottom:1px;margin:auto;"]);
|
|
23
23
|
const Styled2DigitsInput = /*#__PURE__*/styled__default["default"](ResettedInput).withConfig({
|
|
@@ -36,7 +36,7 @@ const StyledMin4DigitsInput = /*#__PURE__*/styled__default["default"](ResettedIn
|
|
|
36
36
|
} = _ref2;
|
|
37
37
|
return disabled ? "color: #616b7f;" : "";
|
|
38
38
|
});
|
|
39
|
-
const StyledInputsWrapperGrid = /*#__PURE__*/styled__default["default"](
|
|
39
|
+
const StyledInputsWrapperGrid = /*#__PURE__*/styled__default["default"](dsGrid.Grid).withConfig({
|
|
40
40
|
componentId: "sc-1t4k08s-5"
|
|
41
41
|
})(["width:max-content;align-items:center;", " border-color:", ";border-radius:2px;padding-left:", ";padding-right:", ";position:relative;", ""], _ref3 => {
|
|
42
42
|
let {
|
|
@@ -75,7 +75,7 @@ const StyledDateInputsWrapperGrid = /*#__PURE__*/styled__default["default"].div.
|
|
|
75
75
|
const StyledTimeInputsWrapperGrid = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
76
76
|
componentId: "sc-1t4k08s-7"
|
|
77
77
|
})(["display:grid;grid-template-columns:24px min-content 24px min-content 24px min-content 24px;grid-template-rows:min-content;padding:6px 0;gap:0px 0px;align-items:center;input,p{margin:0;}"]);
|
|
78
|
-
const StyledPickersIconsWrapperGrid = /*#__PURE__*/styled__default["default"](
|
|
78
|
+
const StyledPickersIconsWrapperGrid = /*#__PURE__*/styled__default["default"](dsGrid.Grid).withConfig({
|
|
79
79
|
componentId: "sc-1t4k08s-8"
|
|
80
80
|
})(["position:relative;", ":before{content:'';position:absolute;top:0px;left:-1px;width:100%;height:100%;border-radius:2px;z-index:-1;", "}"], _ref8 => {
|
|
81
81
|
let {
|
|
@@ -90,7 +90,7 @@ const StyledPickersIconsWrapperGrid = /*#__PURE__*/styled__default["default"](Gr
|
|
|
90
90
|
} = _ref9;
|
|
91
91
|
return isControllerOnly ? "" : "\n border-left: 1px solid ".concat(hasError ? theme.colors.danger[900] : theme.colors.neutral[200], "\n ");
|
|
92
92
|
});
|
|
93
|
-
const StyledFocusWithIn = /*#__PURE__*/styled__default["default"](
|
|
93
|
+
const StyledFocusWithIn = /*#__PURE__*/styled__default["default"](dsGrid.Grid).withConfig({
|
|
94
94
|
componentId: "sc-1t4k08s-9"
|
|
95
95
|
})(["position:relative;&:focus-within{&:after{display:block;content:' ';position:absolute;top:-5px;left:-2px;width:calc(100% + 4px);height:calc(100% + 10px);border:2px solid ", ";border-radius:2px;pointer-events:none;}}"], _ref10 => {
|
|
96
96
|
let {
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
6
|
var React = require('react');
|
|
7
|
-
var
|
|
7
|
+
var dsGrid = require('@elliemae/ds-grid');
|
|
8
8
|
var ControlledDateTimePickerCTX = require('../../ControlledDateTimePickerCTX.js');
|
|
9
9
|
var HHInput = require('./HHInput.js');
|
|
10
10
|
var MinutesInput = require('./MinutesInput.js');
|
|
@@ -49,7 +49,7 @@ const TimeInputs = () => {
|
|
|
49
49
|
meridiemInputRef,
|
|
50
50
|
ariaCurrentValueForInputs
|
|
51
51
|
} = React.useContext(ControlledDateTimePickerCTX.ControlledDateTimePickerContext);
|
|
52
|
-
return /*#__PURE__*/_jsx__default["default"](
|
|
52
|
+
return /*#__PURE__*/_jsx__default["default"](dsGrid.Grid, {
|
|
53
53
|
cols: [config.fixedValues.smallInputWidth, config.fixedValues.separatorWidth, config.fixedValues.smallInputWidth, config.fixedValues.separatorWidth, config.fixedValues.smallInputWidth]
|
|
54
54
|
}, void 0, /*#__PURE__*/_jsx__default["default"](Styleds.StyledFocusWithIn, {}, void 0, /*#__PURE__*/_jsx__default["default"](HHInput.HHInput, {
|
|
55
55
|
value: hours,
|
|
@@ -1,68 +1,80 @@
|
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
1
6
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
7
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
8
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
2
9
|
import { useRef, useCallback } from 'react';
|
|
3
|
-
import { describe } from '
|
|
10
|
+
import { describe, useMemoMergePropsWithDefault, useGetGlobalAttributes } from '@elliemae/ds-props-helpers';
|
|
4
11
|
import { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';
|
|
5
|
-
import { propTypes } from './propTypes.js';
|
|
6
12
|
import { StyledContainer, StyledCheckBox, StyledInput, StyledLabel } from './styles.js';
|
|
7
|
-
import {
|
|
13
|
+
import { propTypes, defaultProps } from './react-desc-prop-types.js';
|
|
8
14
|
import { setMultipleRefs } from './utils/setMultipleRefs.js';
|
|
15
|
+
import { useValidateProps } from './config/useValidateProps.js';
|
|
9
16
|
import { jsx } from 'react/jsx-runtime';
|
|
10
17
|
|
|
18
|
+
const _excluded = ["id", "disabled", "readOnly", "label", "aria-label", "aria-controls", "onKeyDown", "className"];
|
|
19
|
+
|
|
20
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
21
|
+
|
|
22
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
23
|
+
|
|
11
24
|
const DSControlledCheckbox = props => {
|
|
25
|
+
const propsWithDefault = useMemoMergePropsWithDefault(props, defaultProps);
|
|
12
26
|
useValidateProps(props, propTypes);
|
|
13
|
-
const checkboxRef = useRef();
|
|
27
|
+
const checkboxRef = useRef(null);
|
|
14
28
|
const {
|
|
15
|
-
autoFocus,
|
|
16
29
|
checked,
|
|
17
|
-
ariaControls,
|
|
18
|
-
ariaLabel,
|
|
19
|
-
disabled,
|
|
20
|
-
id,
|
|
21
30
|
label,
|
|
22
31
|
hasError,
|
|
23
|
-
onChange,
|
|
24
|
-
onFocus,
|
|
25
|
-
onBlur,
|
|
26
|
-
value,
|
|
27
|
-
readOnly,
|
|
28
|
-
name,
|
|
29
32
|
innerRef,
|
|
30
|
-
tabIndex
|
|
31
|
-
|
|
33
|
+
tabIndex,
|
|
34
|
+
ariaLabel: legacyAriaLabel,
|
|
35
|
+
ariaControls: legacyAriaControls,
|
|
36
|
+
'data-testid': dataTestid = 'ds-checkbox-container'
|
|
37
|
+
} = propsWithDefault;
|
|
32
38
|
const handleOnKeyDown = useCallback(e => {
|
|
33
39
|
if (checkboxRef.current && e.key === 'Enter') {
|
|
34
40
|
checkboxRef.current.click();
|
|
35
41
|
}
|
|
36
42
|
}, []);
|
|
43
|
+
|
|
44
|
+
const _useGetGlobalAttribut = useGetGlobalAttributes(propsWithDefault, {
|
|
45
|
+
onKeyDown: handleOnKeyDown
|
|
46
|
+
}),
|
|
47
|
+
{
|
|
48
|
+
id,
|
|
49
|
+
disabled,
|
|
50
|
+
readOnly,
|
|
51
|
+
label: globalLabel,
|
|
52
|
+
'aria-label': ariaLabel,
|
|
53
|
+
'aria-controls': ariaControls,
|
|
54
|
+
onKeyDown,
|
|
55
|
+
className
|
|
56
|
+
} = _useGetGlobalAttribut,
|
|
57
|
+
restGlobals = _objectWithoutProperties(_useGetGlobalAttribut, _excluded);
|
|
58
|
+
|
|
37
59
|
return /*#__PURE__*/_jsx(StyledContainer, {
|
|
38
|
-
"data-testid":
|
|
60
|
+
"data-testid": dataTestid,
|
|
61
|
+
className: className
|
|
39
62
|
}, void 0, /*#__PURE__*/_jsx(StyledCheckBox, {
|
|
40
|
-
checked:
|
|
63
|
+
checked: checked,
|
|
41
64
|
hasError: hasError,
|
|
42
65
|
disabled: disabled,
|
|
43
66
|
readOnly: readOnly
|
|
44
|
-
}, void 0, /*#__PURE__*/jsx(StyledInput, {
|
|
45
|
-
|
|
67
|
+
}, void 0, /*#__PURE__*/jsx(StyledInput, _objectSpread(_objectSpread({}, restGlobals), {}, {
|
|
68
|
+
"data-testid": "ds-checkbox",
|
|
69
|
+
id: id,
|
|
46
70
|
ref: ref => setMultipleRefs([checkboxRef, innerRef])(ref),
|
|
47
71
|
onKeyDown: handleOnKeyDown,
|
|
48
72
|
type: "checkbox",
|
|
49
73
|
checked: checked !== 'mixed' ? checked : undefined,
|
|
50
|
-
"aria-
|
|
51
|
-
"aria-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
"aria-readonly": readOnly,
|
|
55
|
-
"aria-label": ariaLabel || label,
|
|
56
|
-
onFocus: onFocus,
|
|
57
|
-
onBlur: onBlur,
|
|
58
|
-
name: name,
|
|
59
|
-
value: value,
|
|
60
|
-
onChange: onChange,
|
|
61
|
-
id: id,
|
|
62
|
-
"data-testid": "ds-checkbox",
|
|
63
|
-
autoFocus: autoFocus,
|
|
64
|
-
tabIndex: tabIndex || 0
|
|
65
|
-
})), label && /*#__PURE__*/_jsx(StyledLabel, {
|
|
74
|
+
"aria-label": ariaLabel || legacyAriaLabel || label,
|
|
75
|
+
"aria-controls": ariaControls || legacyAriaControls,
|
|
76
|
+
tabIndex: tabIndex
|
|
77
|
+
}))), label && /*#__PURE__*/_jsx(StyledLabel, {
|
|
66
78
|
htmlFor: id,
|
|
67
79
|
disabled: disabled,
|
|
68
80
|
readOnly: readOnly,
|
|
@@ -7,11 +7,11 @@ const throwError = message => {
|
|
|
7
7
|
const useValidateProps = (props, propTypes) => {
|
|
8
8
|
useValidateTypescriptPropTypes(props, propTypes);
|
|
9
9
|
|
|
10
|
-
if (typeof props.label === 'undefined' && typeof props
|
|
10
|
+
if (typeof props.label === 'undefined' && typeof props['aria-label'] === 'undefined') {
|
|
11
11
|
throwError("Please provide a label or ariaLabel property to use this component.");
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
if (props.checked === 'mixed' && typeof props
|
|
14
|
+
if (props.checked === 'mixed' && typeof props['aria-controls'] === 'undefined') {
|
|
15
15
|
throwError("Please provide an ariaControls property to use a checkbox mixed state. \n This property must be a string containing all the ids that this mixed checkbox is controlling.");
|
|
16
16
|
}
|
|
17
17
|
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
6
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
7
|
+
import { PropTypes, globalAttributesPropTypes } from '@elliemae/ds-props-helpers';
|
|
8
|
+
|
|
9
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
10
|
+
|
|
11
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
12
|
+
const defaultProps = {
|
|
13
|
+
hasError: false,
|
|
14
|
+
tabIndex: undefined,
|
|
15
|
+
checked: false
|
|
16
|
+
};
|
|
17
|
+
const propTypes = _objectSpread(_objectSpread({}, globalAttributesPropTypes), {}, {
|
|
18
|
+
label: PropTypes.string.description('Checkbox Label property. This label is also going to be used as an aria-label for screen readers.'),
|
|
19
|
+
hasError: PropTypes.bool.description('Whether the checkbox has error or not.'),
|
|
20
|
+
innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]).description('Checkbox input ref.')
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export { defaultProps, propTypes };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable max-params */
|
|
2
|
-
const handleCheckMarkColor = (_ref,
|
|
2
|
+
const handleCheckMarkColor = (_ref, checked, isHovering, disabled, readOnly, hasError) => {
|
|
3
3
|
let {
|
|
4
4
|
colors
|
|
5
5
|
} = _ref;
|
|
@@ -22,14 +22,14 @@ const handleCheckmark = function (theme, checked, disabled, readOnly, hasError)
|
|
|
22
22
|
let isHovering = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
23
23
|
|
|
24
24
|
if (checked === 'mixed') {
|
|
25
|
-
return "&:before {\n position: absolute;\n content: '';\n top: 6px;\n left: 3px;\n background: ".concat(handleCheckMarkColor(theme,
|
|
25
|
+
return "&:before {\n position: absolute;\n content: '';\n top: 6px;\n left: 3px;\n background: ".concat(handleCheckMarkColor(theme, checked, isHovering, disabled, readOnly, hasError), ";\n width: ").concat(theme.space.xxs, ";\n height: 2px;\n }");
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
if (checked) {
|
|
29
|
-
return "&:before {\n position: absolute;\n content: '';\n top: 3px;\n left: 2px;\n border-left: 2px solid ".concat(handleCheckMarkColor(theme,
|
|
29
|
+
return "&:before {\n position: absolute;\n content: '';\n top: 3px;\n left: 2px;\n border-left: 2px solid ".concat(handleCheckMarkColor(theme, checked, isHovering, disabled, readOnly, hasError), ";\n border-bottom: 2px solid ").concat(handleCheckMarkColor(theme, checked, isHovering, disabled, readOnly, hasError), ";\n height: 5px;\n width: 10px;\n transform: rotate(-45deg);\n }");
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
return
|
|
32
|
+
return '';
|
|
33
33
|
};
|
|
34
34
|
const handleBackgroundColor = (_ref2, disabled) => {
|
|
35
35
|
let {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createContext, createRef } from 'react';
|
|
2
2
|
import { noop } from 'lodash';
|
|
3
3
|
|
|
4
4
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
@@ -20,8 +20,7 @@ const defaultProps = {
|
|
|
20
20
|
onChange: noop,
|
|
21
21
|
onKeyDown: noop,
|
|
22
22
|
onFilter: noop,
|
|
23
|
-
onMenuOpen: noop
|
|
24
|
-
innerRef: /*#__PURE__*/createRef()
|
|
23
|
+
onMenuOpen: noop
|
|
25
24
|
};
|
|
26
25
|
const defaultContext = {
|
|
27
26
|
props: defaultProps,
|
|
@@ -39,8 +38,6 @@ const defaultContext = {
|
|
|
39
38
|
selectedOptionsRef: /*#__PURE__*/createRef(),
|
|
40
39
|
selectAllCheckboxRef: /*#__PURE__*/createRef(),
|
|
41
40
|
toggleSelectionButtonRef: /*#__PURE__*/createRef(),
|
|
42
|
-
showSelectedValue: false,
|
|
43
|
-
setShowSelectedValue: noop,
|
|
44
41
|
focusOptionIdx: '',
|
|
45
42
|
setCurrentOption: noop,
|
|
46
43
|
showSelectedOptions: false,
|
|
@@ -5,7 +5,7 @@ import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
|
5
5
|
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
6
6
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
7
7
|
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
8
|
-
import {
|
|
8
|
+
import { useRef, useState, useCallback, useMemo } from 'react';
|
|
9
9
|
import { useVirtual } from 'react-virtual';
|
|
10
10
|
import { useMemoMergePropsWithDefault, useValidateTypescriptPropTypes } from '@elliemae/ds-props-helpers';
|
|
11
11
|
import { defaultProps } from '../ComboBoxCTX.js';
|
|
@@ -16,11 +16,14 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
16
16
|
|
|
17
17
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
18
18
|
const useComboBox = props => {
|
|
19
|
-
const
|
|
19
|
+
const defaultPropsWithInnerRef = _objectSpread(_objectSpread({}, defaultProps), {}, {
|
|
20
|
+
innerRef: useRef(null)
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const propsWithDefaults = useMemoMergePropsWithDefault(props, defaultPropsWithInnerRef);
|
|
20
24
|
useValidateTypescriptPropTypes(propsWithDefaults, ComboboxPropTypes);
|
|
21
25
|
const [showPopover, setShowPopover] = useState(false);
|
|
22
26
|
const [referenceElement, setReferenceElement] = useState(null);
|
|
23
|
-
const [showSelectedValue, setShowSelectedValue] = useState(false);
|
|
24
27
|
const [showSelectedOptions, setShowSelectedOptions] = useState(false);
|
|
25
28
|
const [hasFocus, setHasFocus] = useState(false);
|
|
26
29
|
const [focusOptionIdx, setCurrentOption] = useState('');
|
|
@@ -59,7 +62,6 @@ const useComboBox = props => {
|
|
|
59
62
|
virtualListHelpers,
|
|
60
63
|
showPopover,
|
|
61
64
|
referenceElement,
|
|
62
|
-
showSelectedValue,
|
|
63
65
|
listRef,
|
|
64
66
|
focusOptionIdx,
|
|
65
67
|
selectedOptionsRef,
|
|
@@ -74,10 +76,9 @@ const useComboBox = props => {
|
|
|
74
76
|
setHasFocus,
|
|
75
77
|
setCurrentOption,
|
|
76
78
|
scrollOptionIntoView,
|
|
77
|
-
setShowSelectedValue,
|
|
78
79
|
setReferenceElement,
|
|
79
80
|
setShowPopover
|
|
80
|
-
}), [scrollOptionIntoView, correctOptions, propsWithDefaults, virtualListHelpers, focusOptionIdx,
|
|
81
|
+
}), [scrollOptionIntoView, correctOptions, propsWithDefaults, virtualListHelpers, focusOptionIdx, wrapperListRef, showSelectedOptions, showPopover, pillGroupRef, referenceElement, selectedOptionsRef, controlsWrapperRef, selectAllCheckboxRef, toggleSelectionButtonRef, hasFocus, listRef]);
|
|
81
82
|
return ctx;
|
|
82
83
|
};
|
|
83
84
|
|
|
@@ -14,16 +14,21 @@ const SelectedValuesAllyMsg = () => {
|
|
|
14
14
|
} = useContext(ComboBoxContext);
|
|
15
15
|
const msg = useMemo(() => {
|
|
16
16
|
if (Array.isArray(selectedValues)) {
|
|
17
|
-
|
|
17
|
+
if (selectedValues.length > 0) {
|
|
18
|
+
return "Options selected: ".concat(selectedValues.map(item => item.label).join(', '));
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return 'No Options Selected';
|
|
18
22
|
}
|
|
19
23
|
|
|
20
24
|
if (selectedValues) {
|
|
21
25
|
return "Option selected: ".concat(selectedValues === null || selectedValues === void 0 ? void 0 : selectedValues.label);
|
|
22
26
|
}
|
|
23
27
|
|
|
24
|
-
return '';
|
|
28
|
+
return 'No Option Selected';
|
|
25
29
|
}, [selectedValues]);
|
|
26
30
|
return /*#__PURE__*/_jsx(StyledA11ySelectedValues, {
|
|
31
|
+
id: "combobox-selected-items",
|
|
27
32
|
"data-testid": ComboboxDataTestid.ALLY_SELECTED_VALUES,
|
|
28
33
|
"aria-live": "polite",
|
|
29
34
|
"aria-atomic": "false",
|