@elliemae/ds-controlled-form 2.3.0-next.7 → 2.3.0-rc.2
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 +49 -39
- 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/ComboBox.js +3 -6
- package/cjs/controlled-combobox/ComboBoxCTX.js +1 -4
- package/cjs/controlled-combobox/ComboboxDataTestids.js +2 -1
- package/cjs/controlled-combobox/config/useComboBox.js +19 -73
- package/cjs/controlled-combobox/config/useCorrectOptions.js +77 -0
- package/cjs/controlled-combobox/parts/a11y-messages/FocusMenuItem.js +46 -0
- package/cjs/controlled-combobox/parts/a11y-messages/{MultiAllyMessages.js → SelectedValuesAllyMsg.js} +21 -7
- package/cjs/controlled-combobox/parts/a11y-messages/index.js +4 -4
- package/cjs/controlled-combobox/parts/container/Container.js +32 -21
- package/cjs/controlled-combobox/parts/container/styled.js +9 -6
- package/cjs/controlled-combobox/parts/controls/Controls.js +31 -19
- package/cjs/controlled-combobox/parts/controls/styled.js +24 -12
- package/cjs/controlled-combobox/parts/controls/useOnPillsNavigation.js +51 -0
- package/cjs/controlled-combobox/parts/controls-input/ControlsInput.js +9 -7
- package/cjs/controlled-combobox/parts/controls-input/useControlsInput.js +16 -8
- package/cjs/controlled-combobox/parts/dropdown-indicator/DropdownIndicator.js +6 -3
- package/cjs/controlled-combobox/parts/dropdown-indicator/styled.js +2 -3
- package/cjs/controlled-combobox/parts/header-list/HeaderList.js +8 -13
- package/cjs/controlled-combobox/parts/header-list/useHeaderListHandlers.js +12 -5
- package/cjs/controlled-combobox/parts/menu-list/MenuList.js +13 -18
- package/cjs/controlled-combobox/parts/menu-list/styled.js +5 -1
- package/cjs/controlled-combobox/parts/menu-list/useItemRenderer.js +14 -17
- package/cjs/controlled-combobox/parts/menu-list/useMenuList.js +11 -13
- package/cjs/controlled-combobox/parts/multi-selected-values-container/MultiSelectedValuesContainer.js +33 -19
- package/cjs/controlled-combobox/parts/multi-selected-values-container/useGroupPills.js +5 -5
- package/cjs/controlled-combobox/react-desc-prop-types.js +42 -0
- package/cjs/{controlled-checkbox/index.d.js → controlled-combobox/sharedTypes.js} +0 -0
- package/cjs/controlled-combobox/utils/hooks/useKeyboardNavigation.js +19 -18
- package/cjs/controlled-combobox/utils/listHelper.js +2 -2
- 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 +44 -36
- 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/ComboBox.js +4 -7
- package/esm/controlled-combobox/ComboBoxCTX.js +1 -4
- package/esm/controlled-combobox/ComboboxDataTestids.js +2 -1
- package/esm/controlled-combobox/config/useComboBox.js +22 -76
- package/esm/controlled-combobox/config/useCorrectOptions.js +73 -0
- package/esm/controlled-combobox/parts/a11y-messages/FocusMenuItem.js +38 -0
- package/esm/controlled-combobox/parts/a11y-messages/SelectedValuesAllyMsg.js +39 -0
- package/esm/controlled-combobox/parts/a11y-messages/index.js +2 -2
- package/esm/controlled-combobox/parts/container/Container.js +30 -21
- package/esm/controlled-combobox/parts/container/styled.js +9 -6
- package/esm/controlled-combobox/parts/controls/Controls.js +32 -20
- package/esm/controlled-combobox/parts/controls/styled.js +22 -10
- package/esm/controlled-combobox/parts/controls/useOnPillsNavigation.js +47 -0
- package/esm/controlled-combobox/parts/controls-input/ControlsInput.js +9 -7
- package/esm/controlled-combobox/parts/controls-input/useControlsInput.js +16 -8
- package/esm/controlled-combobox/parts/dropdown-indicator/DropdownIndicator.js +6 -3
- package/esm/controlled-combobox/parts/dropdown-indicator/styled.js +3 -3
- package/esm/controlled-combobox/parts/header-list/HeaderList.js +8 -13
- package/esm/controlled-combobox/parts/header-list/useHeaderListHandlers.js +12 -5
- package/esm/controlled-combobox/parts/menu-list/MenuList.js +16 -21
- package/esm/controlled-combobox/parts/menu-list/styled.js +5 -2
- package/esm/controlled-combobox/parts/menu-list/useItemRenderer.js +12 -15
- package/esm/controlled-combobox/parts/menu-list/useMenuList.js +11 -13
- package/esm/controlled-combobox/parts/multi-selected-values-container/MultiSelectedValuesContainer.js +35 -20
- package/esm/controlled-combobox/parts/multi-selected-values-container/useGroupPills.js +5 -5
- package/esm/controlled-combobox/{propTypes.js → react-desc-prop-types.js} +17 -7
- package/esm/{controlled-checkbox/index.d.js → controlled-combobox/sharedTypes.js} +0 -0
- package/esm/controlled-combobox/utils/hooks/useKeyboardNavigation.js +19 -18
- package/esm/controlled-combobox/utils/listHelper.js +2 -2
- package/package.json +33 -57
- 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 +31 -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/ComboBox.d.ts +4 -70
- package/types/controlled-combobox/ComboBoxCTX.d.ts +4 -3
- package/types/controlled-combobox/ComboboxDataTestids.d.ts +1 -0
- package/types/controlled-combobox/config/useComboBox.d.ts +3 -2
- package/types/controlled-combobox/config/useCorrectOptions.d.ts +3 -0
- package/types/controlled-combobox/parts/a11y-messages/FocusMenuItem.d.ts +3 -0
- package/types/controlled-combobox/parts/a11y-messages/SelectedValuesAllyMsg.d.ts +3 -0
- package/types/controlled-combobox/parts/a11y-messages/index.d.ts +2 -2
- package/types/controlled-combobox/parts/controls/styled.d.ts +10 -7
- package/types/controlled-combobox/parts/controls/useOnPillsNavigation.d.ts +4 -0
- package/types/controlled-combobox/parts/dropdown-indicator/styled.d.ts +2 -1
- 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 +57 -0
- package/types/controlled-combobox/sharedTypes.d.ts +27 -0
- package/types/controlled-combobox/utils/hooks/useKeyboardNavigation.d.ts +1 -1
- package/types/controlled-combobox/utils/listHelper.d.ts +7 -7
- package/types/controlled-date-time-picker/parts/Pickers/Calendar/Styleds.d.ts +3 -12
- package/types/controlled-date-time-picker/parts/Pickers/CalendarWithTimeWheel/Styleds.d.ts +1 -4
- package/types/controlled-date-time-picker/parts/Pickers/TimeWheel/Styleds.d.ts +3 -12
- package/types/controlled-date-time-picker/parts/Styleds.d.ts +1 -4
- package/cjs/controlled-checkbox/propTypes.js +0 -22
- package/cjs/controlled-combobox/config/constants.js +0 -14
- package/cjs/controlled-combobox/config/useGetPropsWithDefault.js +0 -11
- package/cjs/controlled-combobox/index.d.js +0 -2
- package/cjs/controlled-combobox/parts/a11y-messages/SingleAllyMessages.js +0 -28
- 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/cjs/controlled-combobox/parts/single-selected-value-container/SingleSelectedValueContainer.js +0 -28
- package/cjs/controlled-combobox/parts/single-selected-value-container/index.js +0 -9
- package/cjs/controlled-combobox/parts/single-selected-value-container/styled.js +0 -15
- package/cjs/controlled-combobox/propTypes.js +0 -28
- package/esm/controlled-checkbox/propTypes.js +0 -18
- package/esm/controlled-combobox/config/constants.js +0 -10
- package/esm/controlled-combobox/config/useGetPropsWithDefault.js +0 -7
- package/esm/controlled-combobox/index.d.js +0 -1
- package/esm/controlled-combobox/parts/a11y-messages/MultiAllyMessages.js +0 -25
- package/esm/controlled-combobox/parts/a11y-messages/SingleAllyMessages.js +0 -20
- 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/esm/controlled-combobox/parts/single-selected-value-container/SingleSelectedValueContainer.js +0 -20
- package/esm/controlled-combobox/parts/single-selected-value-container/index.js +0 -1
- package/esm/controlled-combobox/parts/single-selected-value-container/styled.js +0 -7
- package/types/controlled-checkbox/index.d.d.ts +0 -29
- package/types/controlled-checkbox/propTypes.d.ts +0 -60
- package/types/controlled-combobox/config/constants.d.ts +0 -8
- package/types/controlled-combobox/config/useGetPropsWithDefault.d.ts +0 -2
- package/types/controlled-combobox/parts/a11y-messages/MultiAllyMessages.d.ts +0 -3
- package/types/controlled-combobox/parts/a11y-messages/SingleAllyMessages.d.ts +0 -3
- 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
- package/types/controlled-combobox/parts/single-selected-value-container/SingleSelectedValueContainer.d.ts +0 -3
- package/types/controlled-combobox/parts/single-selected-value-container/index.d.ts +0 -1
- package/types/controlled-combobox/parts/single-selected-value-container/styled.d.ts +0 -1
- package/types/controlled-combobox/propTypes.d.ts +0 -60
- package/types/controlled-combobox/tests/combobox-special-keys.test.d.ts +0 -1
|
@@ -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
|
|
|
10
10
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
11
11
|
|
|
@@ -20,7 +20,7 @@ const focusBorder = dsSystem.css(_templateObject2 || (_templateObject2 = _tagged
|
|
|
20
20
|
} = _ref;
|
|
21
21
|
return theme.colors.brand[700];
|
|
22
22
|
});
|
|
23
|
-
const StyledControlsWrapper = /*#__PURE__*/styled__default["default"](
|
|
23
|
+
const StyledControlsWrapper = /*#__PURE__*/styled__default["default"](dsGrid.Grid).withConfig({
|
|
24
24
|
componentId: "sc-xlhlqm-0"
|
|
25
25
|
})(["background:transparent;position:relative;border-radius:2px;min-width:", ";align-items:center;align-content:center;height:28px;padding-left:8px;::after{display:block;content:' ';position:absolute;top:0;left:0;right:0;bottom:0;border-radius:2px;", " pointer-events:none;z-index:7;}:focus-within{::after{", "}}"], _ref2 => {
|
|
26
26
|
let {
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var dsCircularProgressIndicator = require('@elliemae/ds-circular-progress-indicator');
|
|
8
|
-
var
|
|
8
|
+
var dsGrid = require('@elliemae/ds-grid');
|
|
9
9
|
var styled = require('./styled.js');
|
|
10
10
|
var AutocompleteDataTestids = require('../../AutocompleteDataTestids.js');
|
|
11
11
|
var AutocompleteCTX = require('../../AutocompleteCTX.js');
|
|
@@ -57,7 +57,7 @@ const MenuList = () => {
|
|
|
57
57
|
minWidth: listWidth,
|
|
58
58
|
id: "combo-listbox",
|
|
59
59
|
role: "listbox",
|
|
60
|
-
children: isLoading && ((_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.value) !== '' ? /*#__PURE__*/_jsx__default["default"](
|
|
60
|
+
children: isLoading && ((_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.value) !== '' ? /*#__PURE__*/_jsx__default["default"](dsGrid.Grid, {
|
|
61
61
|
justifyContent: "center",
|
|
62
62
|
alignItems: "center",
|
|
63
63
|
style: {
|
|
@@ -2,75 +2,85 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
6
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
8
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
5
10
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
11
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
12
|
+
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
6
13
|
var React = require('react');
|
|
7
|
-
var
|
|
14
|
+
var dsPropsHelpers = require('@elliemae/ds-props-helpers');
|
|
8
15
|
var dsTruncatedTooltipText = require('@elliemae/ds-truncated-tooltip-text');
|
|
9
|
-
var propTypes = require('./propTypes.js');
|
|
10
16
|
var styles = require('./styles.js');
|
|
11
|
-
var
|
|
17
|
+
var reactDescPropTypes = require('./react-desc-prop-types.js');
|
|
12
18
|
var setMultipleRefs = require('./utils/setMultipleRefs.js');
|
|
19
|
+
var useValidateProps = require('./config/useValidateProps.js');
|
|
13
20
|
var jsxRuntime = require('react/jsx-runtime');
|
|
14
21
|
|
|
15
22
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
16
23
|
|
|
17
24
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
25
|
+
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
26
|
+
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
|
|
27
|
+
|
|
28
|
+
const _excluded = ["id", "disabled", "readOnly", "label", "aria-label", "aria-controls", "onKeyDown"];
|
|
29
|
+
|
|
30
|
+
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; }
|
|
31
|
+
|
|
32
|
+
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; }
|
|
18
33
|
|
|
19
34
|
const DSControlledCheckbox = props => {
|
|
20
|
-
|
|
21
|
-
|
|
35
|
+
const propsWithDefault = dsPropsHelpers.useMemoMergePropsWithDefault(props, reactDescPropTypes.defaultProps);
|
|
36
|
+
useValidateProps.useValidateProps(props, reactDescPropTypes.propTypes);
|
|
37
|
+
const checkboxRef = React.useRef(null);
|
|
22
38
|
const {
|
|
23
|
-
autoFocus,
|
|
24
39
|
checked,
|
|
25
|
-
ariaControls,
|
|
26
|
-
ariaLabel,
|
|
27
|
-
disabled,
|
|
28
|
-
id,
|
|
29
40
|
label,
|
|
30
41
|
hasError,
|
|
31
|
-
onChange,
|
|
32
|
-
onFocus,
|
|
33
|
-
onBlur,
|
|
34
|
-
value,
|
|
35
|
-
readOnly,
|
|
36
|
-
name,
|
|
37
42
|
innerRef,
|
|
38
|
-
tabIndex
|
|
39
|
-
|
|
43
|
+
tabIndex,
|
|
44
|
+
ariaLabel: legacyAriaLabel,
|
|
45
|
+
ariaControls: legacyAriaControls
|
|
46
|
+
} = propsWithDefault;
|
|
40
47
|
const handleOnKeyDown = React.useCallback(e => {
|
|
41
48
|
if (checkboxRef.current && e.key === 'Enter') {
|
|
42
49
|
checkboxRef.current.click();
|
|
43
50
|
}
|
|
44
51
|
}, []);
|
|
52
|
+
|
|
53
|
+
const _useGetGlobalAttribut = dsPropsHelpers.useGetGlobalAttributes(propsWithDefault, {
|
|
54
|
+
onKeyDown: handleOnKeyDown
|
|
55
|
+
}),
|
|
56
|
+
{
|
|
57
|
+
id,
|
|
58
|
+
disabled,
|
|
59
|
+
readOnly,
|
|
60
|
+
label: globalLabel,
|
|
61
|
+
'aria-label': ariaLabel,
|
|
62
|
+
'aria-controls': ariaControls,
|
|
63
|
+
onKeyDown
|
|
64
|
+
} = _useGetGlobalAttribut,
|
|
65
|
+
restGlobals = _objectWithoutProperties__default["default"](_useGetGlobalAttribut, _excluded);
|
|
66
|
+
|
|
45
67
|
return /*#__PURE__*/_jsx__default["default"](styles.StyledContainer, {
|
|
46
68
|
"data-testid": "ds-checkbox-container"
|
|
47
69
|
}, void 0, /*#__PURE__*/_jsx__default["default"](styles.StyledCheckBox, {
|
|
48
|
-
checked:
|
|
70
|
+
checked: checked,
|
|
49
71
|
hasError: hasError,
|
|
50
72
|
disabled: disabled,
|
|
51
73
|
readOnly: readOnly
|
|
52
|
-
}, void 0, /*#__PURE__*/jsxRuntime.jsx(styles.StyledInput, {
|
|
53
|
-
|
|
74
|
+
}, void 0, /*#__PURE__*/jsxRuntime.jsx(styles.StyledInput, _objectSpread(_objectSpread({}, restGlobals), {}, {
|
|
75
|
+
id: id,
|
|
54
76
|
ref: ref => setMultipleRefs.setMultipleRefs([checkboxRef, innerRef])(ref),
|
|
55
77
|
onKeyDown: handleOnKeyDown,
|
|
56
78
|
type: "checkbox",
|
|
57
79
|
checked: checked !== 'mixed' ? checked : undefined,
|
|
58
|
-
"aria-
|
|
59
|
-
"aria-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
"aria-readonly": readOnly,
|
|
63
|
-
"aria-label": ariaLabel || label,
|
|
64
|
-
onFocus: onFocus,
|
|
65
|
-
onBlur: onBlur,
|
|
66
|
-
name: name,
|
|
67
|
-
value: value,
|
|
68
|
-
onChange: onChange,
|
|
69
|
-
id: id,
|
|
70
|
-
"data-testid": "ds-checkbox",
|
|
71
|
-
autoFocus: autoFocus,
|
|
72
|
-
tabIndex: tabIndex || 0
|
|
73
|
-
})), label && /*#__PURE__*/_jsx__default["default"](styles.StyledLabel, {
|
|
80
|
+
"aria-label": ariaLabel || legacyAriaLabel || label,
|
|
81
|
+
"aria-controls": ariaControls || legacyAriaControls,
|
|
82
|
+
tabIndex: tabIndex
|
|
83
|
+
}))), label && /*#__PURE__*/_jsx__default["default"](styles.StyledLabel, {
|
|
74
84
|
htmlFor: id,
|
|
75
85
|
disabled: disabled,
|
|
76
86
|
readOnly: readOnly,
|
|
@@ -81,8 +91,8 @@ const DSControlledCheckbox = props => {
|
|
|
81
91
|
})));
|
|
82
92
|
};
|
|
83
93
|
|
|
84
|
-
const DSControlledCheckboxWithSchema =
|
|
85
|
-
DSControlledCheckboxWithSchema.propTypes =
|
|
94
|
+
const DSControlledCheckboxWithSchema = dsPropsHelpers.describe(DSControlledCheckbox);
|
|
95
|
+
DSControlledCheckboxWithSchema.propTypes = reactDescPropTypes.propTypes;
|
|
86
96
|
|
|
87
97
|
exports.DSControlledCheckbox = DSControlledCheckbox;
|
|
88
98
|
exports.DSControlledCheckboxWithSchema = DSControlledCheckboxWithSchema;
|
|
@@ -11,11 +11,11 @@ const throwError = message => {
|
|
|
11
11
|
const useValidateProps = (props, propTypes) => {
|
|
12
12
|
dsPropsHelpers.useValidateTypescriptPropTypes(props, propTypes);
|
|
13
13
|
|
|
14
|
-
if (typeof props.label === 'undefined' && typeof props
|
|
14
|
+
if (typeof props.label === 'undefined' && typeof props['aria-label'] === 'undefined') {
|
|
15
15
|
throwError("Please provide a label or ariaLabel property to use this component.");
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
if (props.checked === 'mixed' && typeof props
|
|
18
|
+
if (props.checked === 'mixed' && typeof props['aria-controls'] === 'undefined') {
|
|
19
19
|
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.");
|
|
20
20
|
}
|
|
21
21
|
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
6
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
8
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
10
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
11
|
+
var dsPropsHelpers = require('@elliemae/ds-props-helpers');
|
|
12
|
+
|
|
13
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
14
|
+
|
|
15
|
+
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
16
|
+
|
|
17
|
+
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; }
|
|
18
|
+
|
|
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
|
+
const defaultProps = {
|
|
21
|
+
hasError: false,
|
|
22
|
+
tabIndex: undefined,
|
|
23
|
+
checked: false
|
|
24
|
+
};
|
|
25
|
+
const propTypes = _objectSpread(_objectSpread({}, dsPropsHelpers.globalAttributesPropTypes), {}, {
|
|
26
|
+
label: dsPropsHelpers.PropTypes.string.description('Checkbox Label property. This label is also going to be used as an aria-label for screen readers.'),
|
|
27
|
+
hasError: dsPropsHelpers.PropTypes.bool.description('Whether the checkbox has error or not.'),
|
|
28
|
+
innerRef: dsPropsHelpers.PropTypes.oneOfType([dsPropsHelpers.PropTypes.func, dsPropsHelpers.PropTypes.object]).description('Checkbox input ref.')
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
exports.defaultProps = defaultProps;
|
|
32
|
+
exports.propTypes = propTypes;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
/* eslint-disable max-params */
|
|
6
|
-
const handleCheckMarkColor = (_ref,
|
|
6
|
+
const handleCheckMarkColor = (_ref, checked, isHovering, disabled, readOnly, hasError) => {
|
|
7
7
|
let {
|
|
8
8
|
colors
|
|
9
9
|
} = _ref;
|
|
@@ -26,14 +26,14 @@ const handleCheckmark = function (theme, checked, disabled, readOnly, hasError)
|
|
|
26
26
|
let isHovering = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
27
27
|
|
|
28
28
|
if (checked === 'mixed') {
|
|
29
|
-
return "&:before {\n position: absolute;\n content: '';\n top: 6px;\n left: 3px;\n background: ".concat(handleCheckMarkColor(theme,
|
|
29
|
+
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 }");
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
if (checked) {
|
|
33
|
-
return "&:before {\n position: absolute;\n content: '';\n top: 3px;\n left: 2px;\n border-left: 2px solid ".concat(handleCheckMarkColor(theme,
|
|
33
|
+
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 }");
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
return
|
|
36
|
+
return '';
|
|
37
37
|
};
|
|
38
38
|
const handleBackgroundColor = (_ref2, disabled) => {
|
|
39
39
|
let {
|
|
@@ -4,12 +4,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
6
|
require('react');
|
|
7
|
-
var reactDesc = require('react-desc');
|
|
8
7
|
var dsPropsHelpers = require('@elliemae/ds-props-helpers');
|
|
9
8
|
var useComboBox = require('./config/useComboBox.js');
|
|
10
9
|
var Container = require('./parts/container/Container.js');
|
|
11
|
-
var propTypes = require('./propTypes.js');
|
|
12
10
|
var ComboBoxCTX = require('./ComboBoxCTX.js');
|
|
11
|
+
var reactDescPropTypes = require('./react-desc-prop-types.js');
|
|
13
12
|
|
|
14
13
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
15
14
|
|
|
@@ -18,16 +17,14 @@ var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
|
18
17
|
var _Container;
|
|
19
18
|
|
|
20
19
|
const DSComboBox = props => {
|
|
21
|
-
const propsWithDefault = dsPropsHelpers.useMemoMergePropsWithDefault(props, ComboBoxCTX.defaultProps);
|
|
22
|
-
dsPropsHelpers.useValidateTypescriptPropTypes(propsWithDefault, propTypes.propTypes);
|
|
23
20
|
const ctx = useComboBox.useComboBox(props);
|
|
24
21
|
return /*#__PURE__*/_jsx__default["default"](ComboBoxCTX.ComboBoxContext.Provider, {
|
|
25
22
|
value: ctx
|
|
26
23
|
}, void 0, _Container || (_Container = /*#__PURE__*/_jsx__default["default"](Container.Container, {})));
|
|
27
24
|
};
|
|
28
25
|
|
|
29
|
-
const DSComboBoxWithSchema =
|
|
30
|
-
DSComboBoxWithSchema.propTypes =
|
|
26
|
+
const DSComboBoxWithSchema = dsPropsHelpers.describe(DSComboBox);
|
|
27
|
+
DSComboBoxWithSchema.propTypes = reactDescPropTypes.ComboboxPropTypes;
|
|
31
28
|
|
|
32
29
|
exports.DSComboBox = DSComboBox;
|
|
33
30
|
exports.DSComboBoxWithSchema = DSComboBoxWithSchema;
|
|
@@ -18,7 +18,7 @@ const defaultProps = {
|
|
|
18
18
|
onClearAll: lodash.noop,
|
|
19
19
|
onSelectAll: lodash.noop,
|
|
20
20
|
onCreate: lodash.noop,
|
|
21
|
-
|
|
21
|
+
onBlur: lodash.noop,
|
|
22
22
|
withoutPortal: true,
|
|
23
23
|
zIndex: 10,
|
|
24
24
|
onChange: lodash.noop,
|
|
@@ -36,15 +36,12 @@ const defaultContext = {
|
|
|
36
36
|
setHasFocus: lodash.noop,
|
|
37
37
|
pillGroupRef: /*#__PURE__*/React.createRef(),
|
|
38
38
|
setReferenceElement: lodash.noop,
|
|
39
|
-
inputRef: /*#__PURE__*/React.createRef(),
|
|
40
39
|
listRef: /*#__PURE__*/React.createRef(),
|
|
41
40
|
wrapperListRef: /*#__PURE__*/React.createRef(),
|
|
42
41
|
controlsWrapperRef: /*#__PURE__*/React.createRef(),
|
|
43
42
|
selectedOptionsRef: /*#__PURE__*/React.createRef(),
|
|
44
43
|
selectAllCheckboxRef: /*#__PURE__*/React.createRef(),
|
|
45
44
|
toggleSelectionButtonRef: /*#__PURE__*/React.createRef(),
|
|
46
|
-
showSelectedValue: false,
|
|
47
|
-
setShowSelectedValue: lodash.noop,
|
|
48
45
|
focusOptionIdx: '',
|
|
49
46
|
setCurrentOption: lodash.noop,
|
|
50
47
|
showSelectedOptions: false,
|
|
@@ -11,7 +11,8 @@ const ComboboxDataTestid = {
|
|
|
11
11
|
DROPDOWN: 'combobox-dropdown-btn',
|
|
12
12
|
OPTION: 'combobox-option',
|
|
13
13
|
SELECT_ALL_CHECKBOX: 'combobox-select-all-checkbox',
|
|
14
|
-
SHOW_SELECTED_OPTIONS_TOGGLE: 'combobox-selected-options-toggle'
|
|
14
|
+
SHOW_SELECTED_OPTIONS_TOGGLE: 'combobox-selected-options-toggle',
|
|
15
|
+
ALLY_SELECTED_VALUES: 'combobox-ally-selected-values'
|
|
15
16
|
};
|
|
16
17
|
|
|
17
18
|
exports.ComboboxDataTestid = ComboboxDataTestid;
|
|
@@ -4,18 +4,17 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
6
6
|
require('core-js/modules/web.dom-collections.iterator.js');
|
|
7
|
-
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
8
|
-
require('core-js/modules/esnext.iterator.constructor.js');
|
|
9
|
-
require('core-js/modules/esnext.iterator.for-each.js');
|
|
10
|
-
require('core-js/modules/esnext.async-iterator.find.js');
|
|
11
|
-
require('core-js/modules/esnext.iterator.find.js');
|
|
12
7
|
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
8
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
13
9
|
require('core-js/modules/esnext.iterator.filter.js');
|
|
10
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
11
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
14
12
|
var React = require('react');
|
|
15
|
-
var lodash = require('lodash');
|
|
16
|
-
var uuid = require('uuid');
|
|
17
13
|
var reactVirtual = require('react-virtual');
|
|
18
|
-
var
|
|
14
|
+
var dsPropsHelpers = require('@elliemae/ds-props-helpers');
|
|
15
|
+
var ComboBoxCTX = require('../ComboBoxCTX.js');
|
|
16
|
+
var reactDescPropTypes = require('../react-desc-prop-types.js');
|
|
17
|
+
var useCorrectOptions = require('./useCorrectOptions.js');
|
|
19
18
|
|
|
20
19
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
21
20
|
|
|
@@ -25,77 +24,28 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
25
24
|
|
|
26
25
|
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; }
|
|
27
26
|
const useComboBox = props => {
|
|
27
|
+
const defaultPropsWithInnerRef = _objectSpread(_objectSpread({}, ComboBoxCTX.defaultProps), {}, {
|
|
28
|
+
innerRef: React.useRef(null)
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const propsWithDefaults = dsPropsHelpers.useMemoMergePropsWithDefault(props, defaultPropsWithInnerRef);
|
|
32
|
+
dsPropsHelpers.useValidateTypescriptPropTypes(propsWithDefaults, reactDescPropTypes.ComboboxPropTypes);
|
|
28
33
|
const [showPopover, setShowPopover] = React.useState(false);
|
|
29
34
|
const [referenceElement, setReferenceElement] = React.useState(null);
|
|
30
|
-
const [showSelectedValue, setShowSelectedValue] = React.useState(false);
|
|
31
35
|
const [showSelectedOptions, setShowSelectedOptions] = React.useState(false);
|
|
32
36
|
const [hasFocus, setHasFocus] = React.useState(false);
|
|
33
37
|
const [focusOptionIdx, setCurrentOption] = React.useState('');
|
|
34
|
-
const inputRef = React.useRef(null);
|
|
35
38
|
const listRef = React.useRef(null);
|
|
36
39
|
const wrapperListRef = React.useRef(null);
|
|
37
40
|
const selectedOptionsRef = React.useRef(null);
|
|
38
41
|
const controlsWrapperRef = React.useRef(null);
|
|
39
42
|
const selectAllCheckboxRef = React.useRef(null);
|
|
40
43
|
const toggleSelectionButtonRef = React.useRef(null);
|
|
41
|
-
const pillGroupRef = React.useRef(null);
|
|
42
|
-
const propsWithDefaults = useGetPropsWithDefault.useGetComboBoxWithDefaultsProps(props);
|
|
43
|
-
const {
|
|
44
|
-
options,
|
|
45
|
-
selectedValues,
|
|
46
|
-
onCreate
|
|
47
|
-
} = propsWithDefaults; // ---------------------------------------------------------------------------
|
|
44
|
+
const pillGroupRef = React.useRef(null); // ---------------------------------------------------------------------------
|
|
48
45
|
// Menu Options with/out selected filter
|
|
49
46
|
// ---------------------------------------------------------------------------
|
|
50
47
|
|
|
51
|
-
const
|
|
52
|
-
var _items2;
|
|
53
|
-
|
|
54
|
-
const multiSelectedValue = selectedValues;
|
|
55
|
-
const items = [];
|
|
56
|
-
options.forEach(option => {
|
|
57
|
-
const isSelectedValue = multiSelectedValue.find(item => item.dsId === option.dsId);
|
|
58
|
-
|
|
59
|
-
if (isSelectedValue) {
|
|
60
|
-
items.push(option);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
if (option.type === 'section') {
|
|
64
|
-
var _items;
|
|
65
|
-
|
|
66
|
-
if (((_items = items[items.length - 1]) === null || _items === void 0 ? void 0 : _items.type) === 'section') {
|
|
67
|
-
items[items.length - 1] = option;
|
|
68
|
-
} else {
|
|
69
|
-
items.push(option);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
if (((_items2 = items[items.length - 1]) === null || _items2 === void 0 ? void 0 : _items2.type) === 'section') {
|
|
75
|
-
items.pop();
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
return items;
|
|
79
|
-
}, [options, selectedValues]);
|
|
80
|
-
const correctOptions = React.useMemo(() => {
|
|
81
|
-
if (showSelectedOptions && Array.isArray(selectedValues) && selectedValues.length > 0) {
|
|
82
|
-
return selectedValuesWithSections();
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
if (onCreate !== lodash.noop && inputRef.current && inputRef.current.value !== '') {
|
|
86
|
-
var _inputRef$current;
|
|
87
|
-
|
|
88
|
-
const creatableUuid = uuid.v4();
|
|
89
|
-
const creatableItem = {
|
|
90
|
-
dsId: "creatable-".concat(creatableUuid),
|
|
91
|
-
label: (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.value,
|
|
92
|
-
type: 'creatable'
|
|
93
|
-
};
|
|
94
|
-
return [creatableItem, ...options];
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
return options;
|
|
98
|
-
}, [options, onCreate, selectedValuesWithSections, selectedValues, showSelectedOptions]); // ===========================================================================
|
|
48
|
+
const correctOptions = useCorrectOptions.useCorrectOptions(propsWithDefaults, showSelectedOptions); // ===========================================================================
|
|
99
49
|
// Virtualization setup
|
|
100
50
|
// ===========================================================================
|
|
101
51
|
|
|
@@ -108,11 +58,10 @@ const useComboBox = props => {
|
|
|
108
58
|
// Scroll into view function
|
|
109
59
|
// ===========================================================================
|
|
110
60
|
|
|
111
|
-
const scrollOptionIntoView = React.useCallback(
|
|
112
|
-
|
|
61
|
+
const scrollOptionIntoView = React.useCallback(dsId => {
|
|
62
|
+
virtualListHelpers.scrollToIndex(correctOptions.findIndex(opt => opt.dsId === dsId), {
|
|
113
63
|
align: 'center'
|
|
114
|
-
};
|
|
115
|
-
virtualListHelpers.scrollToIndex(correctOptions.findIndex(opt => opt.dsId === dsId), opts);
|
|
64
|
+
});
|
|
116
65
|
}, [correctOptions, virtualListHelpers]);
|
|
117
66
|
const ctx = React.useMemo(() => ({
|
|
118
67
|
props: _objectSpread(_objectSpread({}, propsWithDefaults), {}, {
|
|
@@ -121,8 +70,6 @@ const useComboBox = props => {
|
|
|
121
70
|
virtualListHelpers,
|
|
122
71
|
showPopover,
|
|
123
72
|
referenceElement,
|
|
124
|
-
inputRef,
|
|
125
|
-
showSelectedValue,
|
|
126
73
|
listRef,
|
|
127
74
|
focusOptionIdx,
|
|
128
75
|
selectedOptionsRef,
|
|
@@ -137,10 +84,9 @@ const useComboBox = props => {
|
|
|
137
84
|
setHasFocus,
|
|
138
85
|
setCurrentOption,
|
|
139
86
|
scrollOptionIntoView,
|
|
140
|
-
setShowSelectedValue,
|
|
141
87
|
setReferenceElement,
|
|
142
88
|
setShowPopover
|
|
143
|
-
}), [scrollOptionIntoView, correctOptions, propsWithDefaults, virtualListHelpers, focusOptionIdx,
|
|
89
|
+
}), [scrollOptionIntoView, correctOptions, propsWithDefaults, virtualListHelpers, focusOptionIdx, wrapperListRef, showSelectedOptions, showPopover, pillGroupRef, referenceElement, selectedOptionsRef, controlsWrapperRef, selectAllCheckboxRef, toggleSelectionButtonRef, hasFocus, listRef]);
|
|
144
90
|
return ctx;
|
|
145
91
|
};
|
|
146
92
|
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
6
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
8
|
+
require('core-js/modules/esnext.async-iterator.find.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.find.js');
|
|
10
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
11
|
+
var React = require('react');
|
|
12
|
+
var uuid = require('uuid');
|
|
13
|
+
var lodash = require('lodash');
|
|
14
|
+
|
|
15
|
+
const useCorrectOptions = (propsWithDefaults, showSelectedOptions) => {
|
|
16
|
+
const {
|
|
17
|
+
options,
|
|
18
|
+
selectedValues,
|
|
19
|
+
onCreate,
|
|
20
|
+
innerRef
|
|
21
|
+
} = propsWithDefaults;
|
|
22
|
+
const selectedValuesWithSections = React.useCallback(() => {
|
|
23
|
+
var _items2;
|
|
24
|
+
|
|
25
|
+
const multiSelectedValue = selectedValues;
|
|
26
|
+
const items = [];
|
|
27
|
+
options.forEach(option => {
|
|
28
|
+
const isSelectedValue = multiSelectedValue.find(item => item.dsId === option.dsId);
|
|
29
|
+
|
|
30
|
+
if (isSelectedValue) {
|
|
31
|
+
items.push(option);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (option.type === 'section') {
|
|
35
|
+
var _items;
|
|
36
|
+
|
|
37
|
+
if (((_items = items[items.length - 1]) === null || _items === void 0 ? void 0 : _items.type) === 'section') {
|
|
38
|
+
items[items.length - 1] = option;
|
|
39
|
+
} else {
|
|
40
|
+
items.push(option);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
if (((_items2 = items[items.length - 1]) === null || _items2 === void 0 ? void 0 : _items2.type) === 'section') {
|
|
46
|
+
items.pop();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return items;
|
|
50
|
+
}, [options, selectedValues]);
|
|
51
|
+
const correctOptions = React.useMemo(() => {
|
|
52
|
+
if (showSelectedOptions && Array.isArray(selectedValues) && selectedValues.length > 0) {
|
|
53
|
+
return selectedValuesWithSections();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (onCreate !== lodash.noop && innerRef.current && innerRef.current.value !== '' && options.findIndex(option => {
|
|
57
|
+
var _innerRef$current;
|
|
58
|
+
|
|
59
|
+
return option.type === 'option' && option.label === (innerRef === null || innerRef === void 0 ? void 0 : (_innerRef$current = innerRef.current) === null || _innerRef$current === void 0 ? void 0 : _innerRef$current.value);
|
|
60
|
+
}) === -1) {
|
|
61
|
+
var _innerRef$current2;
|
|
62
|
+
|
|
63
|
+
const creatableUuid = uuid.v4();
|
|
64
|
+
const creatableItem = {
|
|
65
|
+
dsId: "creatable-".concat(creatableUuid),
|
|
66
|
+
label: (_innerRef$current2 = innerRef.current) === null || _innerRef$current2 === void 0 ? void 0 : _innerRef$current2.value,
|
|
67
|
+
type: 'creatable'
|
|
68
|
+
};
|
|
69
|
+
return [creatableItem, ...options];
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return options;
|
|
73
|
+
}, [options, onCreate, innerRef, selectedValuesWithSections, selectedValues, showSelectedOptions]);
|
|
74
|
+
return correctOptions;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
exports.useCorrectOptions = useCorrectOptions;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
|
+
require('core-js/modules/esnext.async-iterator.find.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
8
|
+
require('core-js/modules/esnext.iterator.find.js');
|
|
9
|
+
var React = require('react');
|
|
10
|
+
var ComboBoxCTX = require('../../ComboBoxCTX.js');
|
|
11
|
+
var styled = require('./styled.js');
|
|
12
|
+
var listHelper = require('../../utils/listHelper.js');
|
|
13
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
14
|
+
|
|
15
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
16
|
+
|
|
17
|
+
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
18
|
+
|
|
19
|
+
const FocusMenuItem = () => {
|
|
20
|
+
const {
|
|
21
|
+
props: {
|
|
22
|
+
options
|
|
23
|
+
},
|
|
24
|
+
focusOptionIdx,
|
|
25
|
+
showPopover
|
|
26
|
+
} = React.useContext(ComboBoxCTX.ComboBoxContext);
|
|
27
|
+
const selectabledOptions = listHelper.getSelectableOptions(options);
|
|
28
|
+
const focusOption = options.find(option => option.dsId === focusOptionIdx);
|
|
29
|
+
const focusSelectableOptionIdx = selectabledOptions.findIndex(option => option.dsId === focusOptionIdx);
|
|
30
|
+
const msg = React.useMemo(() => {
|
|
31
|
+
if (showPopover) {
|
|
32
|
+
return /*#__PURE__*/_jsx__default["default"](styled.StyledA11ySelectedValues, {
|
|
33
|
+
"aria-live": "polite",
|
|
34
|
+
"aria-atomic": "false",
|
|
35
|
+
"aria-relevant": "additions text"
|
|
36
|
+
}, void 0, "option ".concat(focusOption === null || focusOption === void 0 ? void 0 : focusOption.label, " focused.").concat(focusSelectableOptionIdx + 1, " of ").concat(selectabledOptions.length, " "));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
40
|
+
}, [showPopover, focusOption, focusSelectableOptionIdx, selectabledOptions]);
|
|
41
|
+
return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
42
|
+
children: msg
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
exports.FocusMenuItem = FocusMenuItem;
|
|
@@ -7,27 +7,41 @@ 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
9
|
var ComboBoxCTX = require('../../ComboBoxCTX.js');
|
|
10
|
-
var listHelper = require('../../utils/listHelper.js');
|
|
11
10
|
var styled = require('./styled.js');
|
|
11
|
+
var ComboboxDataTestids = require('../../ComboboxDataTestids.js');
|
|
12
12
|
|
|
13
13
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
14
14
|
|
|
15
15
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
16
16
|
|
|
17
|
-
const
|
|
17
|
+
const SelectedValuesAllyMsg = () => {
|
|
18
18
|
const {
|
|
19
19
|
props: {
|
|
20
|
-
options,
|
|
21
20
|
selectedValues
|
|
22
21
|
}
|
|
23
22
|
} = React.useContext(ComboBoxCTX.ComboBoxContext);
|
|
24
|
-
const
|
|
25
|
-
|
|
23
|
+
const msg = React.useMemo(() => {
|
|
24
|
+
if (Array.isArray(selectedValues)) {
|
|
25
|
+
if (selectedValues.length > 0) {
|
|
26
|
+
return "Options selected: ".concat(selectedValues.map(item => item.label).join(', '));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return 'No Options Selected';
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (selectedValues) {
|
|
33
|
+
return "Option selected: ".concat(selectedValues === null || selectedValues === void 0 ? void 0 : selectedValues.label);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return 'No Option Selected';
|
|
37
|
+
}, [selectedValues]);
|
|
26
38
|
return /*#__PURE__*/_jsx__default["default"](styled.StyledA11ySelectedValues, {
|
|
39
|
+
id: "combobox-selected-items",
|
|
40
|
+
"data-testid": ComboboxDataTestids.ComboboxDataTestid.ALLY_SELECTED_VALUES,
|
|
27
41
|
"aria-live": "polite",
|
|
28
42
|
"aria-atomic": "false",
|
|
29
43
|
"aria-relevant": "additions text"
|
|
30
|
-
}, void 0,
|
|
44
|
+
}, void 0, msg);
|
|
31
45
|
};
|
|
32
46
|
|
|
33
|
-
exports.
|
|
47
|
+
exports.SelectedValuesAllyMsg = SelectedValuesAllyMsg;
|