@elliemae/ds-zipcode-search 1.60.0 → 2.0.0-alpha.12
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/DSZipCodeSearch.js +70 -83
- package/cjs/components/blocks.js +2 -3
- package/cjs/components/helper.js +12 -9
- package/cjs/index.js +1 -13
- package/cjs/props.js +5 -12
- package/esm/DSZipCodeSearch.js +65 -77
- package/esm/components/blocks.js +2 -3
- package/esm/components/helper.js +11 -8
- package/esm/index.js +0 -12
- package/esm/props.js +5 -12
- package/package.json +49 -11
- package/types/DSZipCodeSearch.d.ts +126 -0
- package/types/components/blocks.d.ts +2 -0
- package/types/components/helper.d.ts +10 -0
- package/types/index.d.ts +2 -0
- package/types/props.d.ts +102 -0
- package/types/tests/DSZipCodeSearch.test.d.ts +1 -0
- package/DSZipCodeSearch/package.json +0 -10
- package/cjs/DSZipCodeSearch.js.map +0 -1
- package/cjs/components/blocks.js.map +0 -1
- package/cjs/components/helper.js.map +0 -1
- package/cjs/index.js.map +0 -1
- package/cjs/props.js.map +0 -1
- package/components/blocks/package.json +0 -10
- package/components/helper/package.json +0 -10
- package/esm/DSZipCodeSearch.js.map +0 -1
- package/esm/components/blocks.js.map +0 -1
- package/esm/components/helper.js.map +0 -1
- package/esm/index.js.map +0 -1
- package/esm/props.js.map +0 -1
- package/props/package.json +0 -10
package/cjs/DSZipCodeSearch.js
CHANGED
|
@@ -2,66 +2,55 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
|
|
5
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
6
|
+
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
7
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
8
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
10
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
11
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
12
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
13
|
+
var react = require('react');
|
|
8
14
|
var reactDesc = require('react-desc');
|
|
9
15
|
var DSDropdownMenu = require('@elliemae/ds-dropdownmenu');
|
|
10
16
|
var dsForm = require('@elliemae/ds-form');
|
|
11
|
-
var
|
|
12
|
-
var
|
|
17
|
+
var blocks = require('./components/blocks.js');
|
|
18
|
+
var helper = require('./components/helper.js');
|
|
13
19
|
var props = require('./props.js');
|
|
14
|
-
require('
|
|
15
|
-
require('@babel/runtime/helpers/defineProperty');
|
|
20
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
16
21
|
|
|
17
22
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
18
23
|
|
|
19
|
-
var
|
|
20
|
-
var
|
|
21
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
24
|
+
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
25
|
+
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
22
26
|
var DSDropdownMenu__default = /*#__PURE__*/_interopDefaultLegacy(DSDropdownMenu);
|
|
23
27
|
|
|
24
|
-
var
|
|
25
|
-
var disabled = _ref2.disabled,
|
|
26
|
-
value = _ref2.value,
|
|
27
|
-
placeholder = _ref2.placeholder,
|
|
28
|
-
mask = _ref2.mask,
|
|
29
|
-
onBlur = _ref2.onBlur,
|
|
30
|
-
onChange = _ref2.onChange,
|
|
31
|
-
onSearch = _ref2.onSearch,
|
|
32
|
-
containerProps = _ref2.containerProps,
|
|
33
|
-
selectRightOptions = _ref2.selectRightOptions,
|
|
34
|
-
activeCount = _ref2.activeCount,
|
|
35
|
-
options = _ref2.options,
|
|
36
|
-
tabIndex = _ref2.tabIndex;
|
|
37
|
-
var ref = React.useRef(null);
|
|
28
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
38
29
|
|
|
39
|
-
|
|
40
|
-
_useState2 = _slicedToArray__default['default'](_useState, 2),
|
|
41
|
-
searchValue = _useState2[0],
|
|
42
|
-
setSearchValue = _useState2[1];
|
|
30
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
43
31
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
32
|
+
const DSZipCodeSearch = _ref2 => {
|
|
33
|
+
let {
|
|
34
|
+
disabled,
|
|
35
|
+
value,
|
|
36
|
+
placeholder,
|
|
37
|
+
mask,
|
|
38
|
+
onBlur,
|
|
39
|
+
onChange,
|
|
40
|
+
onSearch,
|
|
41
|
+
containerProps,
|
|
42
|
+
selectRightOptions,
|
|
43
|
+
activeCount,
|
|
44
|
+
options,
|
|
45
|
+
tabIndex
|
|
46
|
+
} = _ref2;
|
|
47
|
+
const ref = react.useRef(null);
|
|
48
|
+
const [searchValue, setSearchValue] = react.useState(value);
|
|
49
|
+
const [isOpen, setIsOpen] = react.useState(false);
|
|
50
|
+
const [isActive, setIsActive] = react.useState(false);
|
|
51
|
+
const [isInputFocus, setIsInputFocus] = react.useState(false);
|
|
52
|
+
const [isSelected, setIsSelected] = react.useState(false);
|
|
53
|
+
react.useEffect(() => {
|
|
65
54
|
if (isInputFocus && activeCount <= searchValue.length && !isSelected) {
|
|
66
55
|
setIsOpen(true);
|
|
67
56
|
setIsActive(true);
|
|
@@ -69,26 +58,26 @@ var DSZipCodeSearch = function DSZipCodeSearch(_ref2) {
|
|
|
69
58
|
setIsOpen(false);
|
|
70
59
|
}
|
|
71
60
|
}, [isInputFocus, isActive, activeCount, searchValue, isSelected]);
|
|
72
|
-
|
|
61
|
+
react.useEffect(() => {
|
|
73
62
|
setSearchValue(value || '');
|
|
74
63
|
}, [value]);
|
|
75
|
-
|
|
76
|
-
|
|
64
|
+
const onTypeInInput = react.useCallback(e => {
|
|
65
|
+
const finalVal = e.target.value;
|
|
77
66
|
onSearch(finalVal);
|
|
78
67
|
setSearchValue(finalVal);
|
|
79
68
|
setIsSelected(false);
|
|
80
69
|
}, [onSearch]);
|
|
81
|
-
|
|
70
|
+
const onFocusInput = react.useCallback(() => {
|
|
82
71
|
setIsInputFocus(true);
|
|
83
72
|
}, []);
|
|
84
|
-
|
|
73
|
+
const onInnerBlur = react.useCallback(e => {
|
|
85
74
|
setIsInputFocus(false);
|
|
86
75
|
onBlur(e);
|
|
87
76
|
}, [onBlur]);
|
|
88
|
-
|
|
77
|
+
const onClose = react.useCallback(() => {
|
|
89
78
|
setIsActive(false);
|
|
90
79
|
}, []);
|
|
91
|
-
|
|
80
|
+
const onSelectItem = react.useCallback(item => {
|
|
92
81
|
setSearchValue(item.value);
|
|
93
82
|
onChange(item);
|
|
94
83
|
setIsSelected(true);
|
|
@@ -96,39 +85,37 @@ var DSZipCodeSearch = function DSZipCodeSearch(_ref2) {
|
|
|
96
85
|
setIsOpen(false);
|
|
97
86
|
onClose();
|
|
98
87
|
}, [onChange, onClose]);
|
|
99
|
-
return /*#__PURE__*/
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
options: options.length > 0 ? [components_helper.createDisabledOption(selectRightOptions)].concat(_toConsumableArray__default['default'](components_helper.noAddonOptions(options))) : [],
|
|
110
|
-
triggerComponent: /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement(dsForm.DSInputMask, {
|
|
111
|
-
disabled: disabled,
|
|
112
|
-
innerRef: function innerRef(_ref) {
|
|
113
|
-
return ref.current = _ref;
|
|
88
|
+
return /*#__PURE__*/jsxRuntime.jsx(blocks.InputSearchWrapper, _objectSpread(_objectSpread({}, containerProps), {}, {
|
|
89
|
+
children: /*#__PURE__*/_jsx__default["default"](DSDropdownMenu__default["default"], {
|
|
90
|
+
isOpen: isOpen && options.length > 0,
|
|
91
|
+
menuProps: {
|
|
92
|
+
className: 'input-search-menu'
|
|
93
|
+
},
|
|
94
|
+
onClose: onClose,
|
|
95
|
+
onSelectMenuItem: onSelectItem,
|
|
96
|
+
contentStyle: {
|
|
97
|
+
maxHeight: 200
|
|
114
98
|
},
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
99
|
+
options: options.length > 0 ? [helper.createDisabledOption(selectRightOptions), ...helper.noAddonOptions(options)] : [],
|
|
100
|
+
triggerComponent: /*#__PURE__*/_jsx__default["default"]("div", {}, void 0, /*#__PURE__*/_jsx__default["default"](dsForm.DSInputMask, {
|
|
101
|
+
disabled: disabled,
|
|
102
|
+
innerRef: _ref => ref.current = _ref,
|
|
103
|
+
mask: mask,
|
|
104
|
+
onBlur: onInnerBlur,
|
|
105
|
+
onChange: onTypeInInput,
|
|
106
|
+
onFocus: onFocusInput,
|
|
107
|
+
placeholder: placeholder,
|
|
108
|
+
value: searchValue,
|
|
109
|
+
tabIndex: tabIndex
|
|
110
|
+
}))
|
|
111
|
+
})
|
|
123
112
|
}));
|
|
124
113
|
};
|
|
125
114
|
|
|
126
|
-
DSZipCodeSearch.propTypes = props.zipcodeSearchProps;
|
|
127
115
|
DSZipCodeSearch.defaultProps = props.defaultProps;
|
|
128
|
-
|
|
116
|
+
const ZipCodeSearchWithSchema = reactDesc.describe(DSZipCodeSearch);
|
|
129
117
|
ZipCodeSearchWithSchema.propTypes = props.zipcodeSearchProps;
|
|
130
118
|
|
|
131
119
|
exports.DSZipCodeSearch = DSZipCodeSearch;
|
|
132
120
|
exports.ZipCodeSearchWithSchema = ZipCodeSearchWithSchema;
|
|
133
|
-
exports[
|
|
134
|
-
//# sourceMappingURL=DSZipCodeSearch.js.map
|
|
121
|
+
exports["default"] = DSZipCodeSearch;
|
package/cjs/components/blocks.js
CHANGED
|
@@ -4,8 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var dsClassnames = require('@elliemae/ds-classnames');
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
const blockName = 'input-search';
|
|
8
|
+
const InputSearchWrapper = dsClassnames.aggregatedClasses('div')(blockName);
|
|
9
9
|
|
|
10
10
|
exports.InputSearchWrapper = InputSearchWrapper;
|
|
11
|
-
//# sourceMappingURL=blocks.js.map
|
package/cjs/components/helper.js
CHANGED
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
6
|
+
require('core-js/modules/esnext.async-iterator.map.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.map.js');
|
|
8
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
10
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
11
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
12
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
6
13
|
|
|
7
14
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
15
|
|
|
@@ -10,13 +17,12 @@ var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_definePropert
|
|
|
10
17
|
|
|
11
18
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
12
19
|
|
|
13
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default[
|
|
14
|
-
|
|
20
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
15
21
|
function createDisabledOption(label) {
|
|
16
22
|
return {
|
|
17
23
|
id: 'no-option',
|
|
18
24
|
type: 'disabled',
|
|
19
|
-
label
|
|
25
|
+
label,
|
|
20
26
|
noAddon: true,
|
|
21
27
|
'aria-disabled': true,
|
|
22
28
|
className: 'no-options',
|
|
@@ -24,13 +30,10 @@ function createDisabledOption(label) {
|
|
|
24
30
|
};
|
|
25
31
|
}
|
|
26
32
|
function noAddonOptions(options) {
|
|
27
|
-
return options.map(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
});
|
|
31
|
-
});
|
|
33
|
+
return options.map(op => _objectSpread(_objectSpread({}, op), {}, {
|
|
34
|
+
noAddon: true
|
|
35
|
+
}));
|
|
32
36
|
}
|
|
33
37
|
|
|
34
38
|
exports.createDisabledOption = createDisabledOption;
|
|
35
39
|
exports.noAddonOptions = noAddonOptions;
|
|
36
|
-
//# sourceMappingURL=helper.js.map
|
package/cjs/index.js
CHANGED
|
@@ -3,21 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var DSZipCodeSearch = require('./DSZipCodeSearch.js');
|
|
6
|
-
require('@babel/runtime/helpers/toConsumableArray');
|
|
7
|
-
require('@babel/runtime/helpers/slicedToArray');
|
|
8
|
-
require('react');
|
|
9
|
-
require('react-desc');
|
|
10
|
-
require('@elliemae/ds-dropdownmenu');
|
|
11
|
-
require('@elliemae/ds-form');
|
|
12
|
-
require('./components/blocks.js');
|
|
13
|
-
require('@elliemae/ds-classnames');
|
|
14
|
-
require('./components/helper.js');
|
|
15
|
-
require('@babel/runtime/helpers/defineProperty');
|
|
16
|
-
require('./props.js');
|
|
17
6
|
|
|
18
7
|
|
|
19
8
|
|
|
20
9
|
exports.DSZipCodeSearch = DSZipCodeSearch.DSZipCodeSearch;
|
|
21
10
|
exports.ZipCodeSearchWithSchema = DSZipCodeSearch.ZipCodeSearchWithSchema;
|
|
22
|
-
exports
|
|
23
|
-
//# sourceMappingURL=index.js.map
|
|
11
|
+
exports["default"] = DSZipCodeSearch.DSZipCodeSearch;
|
package/cjs/props.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var reactDesc = require('react-desc');
|
|
6
6
|
var dsForm = require('@elliemae/ds-form');
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
const zipcodeSearchProps = {
|
|
9
9
|
/** html class attribute */
|
|
10
10
|
className: reactDesc.PropTypes.string.description('html class attribute'),
|
|
11
11
|
|
|
@@ -48,20 +48,14 @@ var zipcodeSearchProps = {
|
|
|
48
48
|
/** current amount */
|
|
49
49
|
activeCount: reactDesc.PropTypes.number.description('current amount')
|
|
50
50
|
};
|
|
51
|
-
|
|
51
|
+
const defaultProps = {
|
|
52
52
|
disabled: false,
|
|
53
53
|
value: '',
|
|
54
54
|
placeholder: '_____-____',
|
|
55
55
|
mask: dsForm.MASK_TYPES.ZIP_CODE_SEARCH,
|
|
56
|
-
onBlur:
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
onChange: function onChange() {
|
|
60
|
-
return null;
|
|
61
|
-
},
|
|
62
|
-
onSearch: function onSearch() {
|
|
63
|
-
return null;
|
|
64
|
-
},
|
|
56
|
+
onBlur: () => null,
|
|
57
|
+
onChange: () => null,
|
|
58
|
+
onSearch: () => null,
|
|
65
59
|
containerProps: {},
|
|
66
60
|
selectRightOptions: 'Please select the appropriate city',
|
|
67
61
|
activeCount: 5,
|
|
@@ -70,4 +64,3 @@ var defaultProps = {
|
|
|
70
64
|
|
|
71
65
|
exports.defaultProps = defaultProps;
|
|
72
66
|
exports.zipcodeSearchProps = zipcodeSearchProps;
|
|
73
|
-
//# sourceMappingURL=props.js.map
|
package/esm/DSZipCodeSearch.js
CHANGED
|
@@ -1,56 +1,46 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
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 _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
8
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
9
|
+
import { useRef, useState, useEffect, useCallback } from 'react';
|
|
4
10
|
import { describe } from 'react-desc';
|
|
5
11
|
import DSDropdownMenu from '@elliemae/ds-dropdownmenu';
|
|
6
12
|
import { DSInputMask } from '@elliemae/ds-form';
|
|
7
13
|
import { InputSearchWrapper } from './components/blocks.js';
|
|
8
14
|
import { createDisabledOption, noAddonOptions } from './components/helper.js';
|
|
9
15
|
import { zipcodeSearchProps, defaultProps } from './props.js';
|
|
10
|
-
import '
|
|
11
|
-
import '@babel/runtime/helpers/esm/defineProperty';
|
|
16
|
+
import { jsx } from 'react/jsx-runtime';
|
|
12
17
|
|
|
13
|
-
var
|
|
14
|
-
var disabled = _ref2.disabled,
|
|
15
|
-
value = _ref2.value,
|
|
16
|
-
placeholder = _ref2.placeholder,
|
|
17
|
-
mask = _ref2.mask,
|
|
18
|
-
onBlur = _ref2.onBlur,
|
|
19
|
-
onChange = _ref2.onChange,
|
|
20
|
-
onSearch = _ref2.onSearch,
|
|
21
|
-
containerProps = _ref2.containerProps,
|
|
22
|
-
selectRightOptions = _ref2.selectRightOptions,
|
|
23
|
-
activeCount = _ref2.activeCount,
|
|
24
|
-
options = _ref2.options,
|
|
25
|
-
tabIndex = _ref2.tabIndex;
|
|
26
|
-
var ref = useRef(null);
|
|
18
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
27
19
|
|
|
28
|
-
|
|
29
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
30
|
-
searchValue = _useState2[0],
|
|
31
|
-
setSearchValue = _useState2[1];
|
|
20
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
32
21
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
22
|
+
const DSZipCodeSearch = _ref2 => {
|
|
23
|
+
let {
|
|
24
|
+
disabled,
|
|
25
|
+
value,
|
|
26
|
+
placeholder,
|
|
27
|
+
mask,
|
|
28
|
+
onBlur,
|
|
29
|
+
onChange,
|
|
30
|
+
onSearch,
|
|
31
|
+
containerProps,
|
|
32
|
+
selectRightOptions,
|
|
33
|
+
activeCount,
|
|
34
|
+
options,
|
|
35
|
+
tabIndex
|
|
36
|
+
} = _ref2;
|
|
37
|
+
const ref = useRef(null);
|
|
38
|
+
const [searchValue, setSearchValue] = useState(value);
|
|
39
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
40
|
+
const [isActive, setIsActive] = useState(false);
|
|
41
|
+
const [isInputFocus, setIsInputFocus] = useState(false);
|
|
42
|
+
const [isSelected, setIsSelected] = useState(false);
|
|
43
|
+
useEffect(() => {
|
|
54
44
|
if (isInputFocus && activeCount <= searchValue.length && !isSelected) {
|
|
55
45
|
setIsOpen(true);
|
|
56
46
|
setIsActive(true);
|
|
@@ -58,26 +48,26 @@ var DSZipCodeSearch = function DSZipCodeSearch(_ref2) {
|
|
|
58
48
|
setIsOpen(false);
|
|
59
49
|
}
|
|
60
50
|
}, [isInputFocus, isActive, activeCount, searchValue, isSelected]);
|
|
61
|
-
useEffect(
|
|
51
|
+
useEffect(() => {
|
|
62
52
|
setSearchValue(value || '');
|
|
63
53
|
}, [value]);
|
|
64
|
-
|
|
65
|
-
|
|
54
|
+
const onTypeInInput = useCallback(e => {
|
|
55
|
+
const finalVal = e.target.value;
|
|
66
56
|
onSearch(finalVal);
|
|
67
57
|
setSearchValue(finalVal);
|
|
68
58
|
setIsSelected(false);
|
|
69
59
|
}, [onSearch]);
|
|
70
|
-
|
|
60
|
+
const onFocusInput = useCallback(() => {
|
|
71
61
|
setIsInputFocus(true);
|
|
72
62
|
}, []);
|
|
73
|
-
|
|
63
|
+
const onInnerBlur = useCallback(e => {
|
|
74
64
|
setIsInputFocus(false);
|
|
75
65
|
onBlur(e);
|
|
76
66
|
}, [onBlur]);
|
|
77
|
-
|
|
67
|
+
const onClose = useCallback(() => {
|
|
78
68
|
setIsActive(false);
|
|
79
69
|
}, []);
|
|
80
|
-
|
|
70
|
+
const onSelectItem = useCallback(item => {
|
|
81
71
|
setSearchValue(item.value);
|
|
82
72
|
onChange(item);
|
|
83
73
|
setIsSelected(true);
|
|
@@ -85,37 +75,35 @@ var DSZipCodeSearch = function DSZipCodeSearch(_ref2) {
|
|
|
85
75
|
setIsOpen(false);
|
|
86
76
|
onClose();
|
|
87
77
|
}, [onChange, onClose]);
|
|
88
|
-
return /*#__PURE__*/
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
options: options.length > 0 ? [createDisabledOption(selectRightOptions)].concat(_toConsumableArray(noAddonOptions(options))) : [],
|
|
99
|
-
triggerComponent: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(DSInputMask, {
|
|
100
|
-
disabled: disabled,
|
|
101
|
-
innerRef: function innerRef(_ref) {
|
|
102
|
-
return ref.current = _ref;
|
|
78
|
+
return /*#__PURE__*/jsx(InputSearchWrapper, _objectSpread(_objectSpread({}, containerProps), {}, {
|
|
79
|
+
children: /*#__PURE__*/_jsx(DSDropdownMenu, {
|
|
80
|
+
isOpen: isOpen && options.length > 0,
|
|
81
|
+
menuProps: {
|
|
82
|
+
className: 'input-search-menu'
|
|
83
|
+
},
|
|
84
|
+
onClose: onClose,
|
|
85
|
+
onSelectMenuItem: onSelectItem,
|
|
86
|
+
contentStyle: {
|
|
87
|
+
maxHeight: 200
|
|
103
88
|
},
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
89
|
+
options: options.length > 0 ? [createDisabledOption(selectRightOptions), ...noAddonOptions(options)] : [],
|
|
90
|
+
triggerComponent: /*#__PURE__*/_jsx("div", {}, void 0, /*#__PURE__*/_jsx(DSInputMask, {
|
|
91
|
+
disabled: disabled,
|
|
92
|
+
innerRef: _ref => ref.current = _ref,
|
|
93
|
+
mask: mask,
|
|
94
|
+
onBlur: onInnerBlur,
|
|
95
|
+
onChange: onTypeInInput,
|
|
96
|
+
onFocus: onFocusInput,
|
|
97
|
+
placeholder: placeholder,
|
|
98
|
+
value: searchValue,
|
|
99
|
+
tabIndex: tabIndex
|
|
100
|
+
}))
|
|
101
|
+
})
|
|
112
102
|
}));
|
|
113
103
|
};
|
|
114
104
|
|
|
115
|
-
DSZipCodeSearch.propTypes = zipcodeSearchProps;
|
|
116
105
|
DSZipCodeSearch.defaultProps = defaultProps;
|
|
117
|
-
|
|
106
|
+
const ZipCodeSearchWithSchema = describe(DSZipCodeSearch);
|
|
118
107
|
ZipCodeSearchWithSchema.propTypes = zipcodeSearchProps;
|
|
119
108
|
|
|
120
109
|
export { DSZipCodeSearch, ZipCodeSearchWithSchema, DSZipCodeSearch as default };
|
|
121
|
-
//# sourceMappingURL=DSZipCodeSearch.js.map
|
package/esm/components/blocks.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { aggregatedClasses } from '@elliemae/ds-classnames';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
const blockName = 'input-search';
|
|
4
|
+
const InputSearchWrapper = aggregatedClasses('div')(blockName);
|
|
5
5
|
|
|
6
6
|
export { InputSearchWrapper };
|
|
7
|
-
//# sourceMappingURL=blocks.js.map
|
package/esm/components/helper.js
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
|
+
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.map.js';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
6
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
7
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
8
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
2
9
|
|
|
3
10
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
4
11
|
|
|
5
12
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
6
|
-
|
|
7
13
|
function createDisabledOption(label) {
|
|
8
14
|
return {
|
|
9
15
|
id: 'no-option',
|
|
10
16
|
type: 'disabled',
|
|
11
|
-
label
|
|
17
|
+
label,
|
|
12
18
|
noAddon: true,
|
|
13
19
|
'aria-disabled': true,
|
|
14
20
|
className: 'no-options',
|
|
@@ -16,12 +22,9 @@ function createDisabledOption(label) {
|
|
|
16
22
|
};
|
|
17
23
|
}
|
|
18
24
|
function noAddonOptions(options) {
|
|
19
|
-
return options.map(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
});
|
|
23
|
-
});
|
|
25
|
+
return options.map(op => _objectSpread(_objectSpread({}, op), {}, {
|
|
26
|
+
noAddon: true
|
|
27
|
+
}));
|
|
24
28
|
}
|
|
25
29
|
|
|
26
30
|
export { createDisabledOption, noAddonOptions };
|
|
27
|
-
//# sourceMappingURL=helper.js.map
|
package/esm/index.js
CHANGED
|
@@ -1,13 +1 @@
|
|
|
1
1
|
export { DSZipCodeSearch, ZipCodeSearchWithSchema, DSZipCodeSearch as default } from './DSZipCodeSearch.js';
|
|
2
|
-
import '@babel/runtime/helpers/esm/toConsumableArray';
|
|
3
|
-
import '@babel/runtime/helpers/esm/slicedToArray';
|
|
4
|
-
import 'react';
|
|
5
|
-
import 'react-desc';
|
|
6
|
-
import '@elliemae/ds-dropdownmenu';
|
|
7
|
-
import '@elliemae/ds-form';
|
|
8
|
-
import './components/blocks.js';
|
|
9
|
-
import '@elliemae/ds-classnames';
|
|
10
|
-
import './components/helper.js';
|
|
11
|
-
import '@babel/runtime/helpers/esm/defineProperty';
|
|
12
|
-
import './props.js';
|
|
13
|
-
//# sourceMappingURL=index.js.map
|
package/esm/props.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PropTypes } from 'react-desc';
|
|
2
2
|
import { MASK_TYPES } from '@elliemae/ds-form';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
const zipcodeSearchProps = {
|
|
5
5
|
/** html class attribute */
|
|
6
6
|
className: PropTypes.string.description('html class attribute'),
|
|
7
7
|
|
|
@@ -44,20 +44,14 @@ var zipcodeSearchProps = {
|
|
|
44
44
|
/** current amount */
|
|
45
45
|
activeCount: PropTypes.number.description('current amount')
|
|
46
46
|
};
|
|
47
|
-
|
|
47
|
+
const defaultProps = {
|
|
48
48
|
disabled: false,
|
|
49
49
|
value: '',
|
|
50
50
|
placeholder: '_____-____',
|
|
51
51
|
mask: MASK_TYPES.ZIP_CODE_SEARCH,
|
|
52
|
-
onBlur:
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
onChange: function onChange() {
|
|
56
|
-
return null;
|
|
57
|
-
},
|
|
58
|
-
onSearch: function onSearch() {
|
|
59
|
-
return null;
|
|
60
|
-
},
|
|
52
|
+
onBlur: () => null,
|
|
53
|
+
onChange: () => null,
|
|
54
|
+
onSearch: () => null,
|
|
61
55
|
containerProps: {},
|
|
62
56
|
selectRightOptions: 'Please select the appropriate city',
|
|
63
57
|
activeCount: 5,
|
|
@@ -65,4 +59,3 @@ var defaultProps = {
|
|
|
65
59
|
};
|
|
66
60
|
|
|
67
61
|
export { defaultProps, zipcodeSearchProps };
|
|
68
|
-
//# sourceMappingURL=props.js.map
|
package/package.json
CHANGED
|
@@ -1,14 +1,46 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-zipcode-search",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-alpha.12",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"description": "
|
|
6
|
-
"module": "esm/index.js",
|
|
7
|
-
"main": "cjs/index.js",
|
|
5
|
+
"description": "ICE MT - Dimsum - Zipcode Search",
|
|
6
|
+
"module": "./esm/index.js",
|
|
7
|
+
"main": "./cjs/index.js",
|
|
8
|
+
"types": "./types/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./esm/index.js",
|
|
12
|
+
"require": "./cjs/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./props": {
|
|
15
|
+
"import": "./esm/props.js",
|
|
16
|
+
"require": "./cjs/props.js"
|
|
17
|
+
},
|
|
18
|
+
"./DSZipCodeSearch": {
|
|
19
|
+
"import": "./esm/DSZipCodeSearch.js",
|
|
20
|
+
"require": "./cjs/DSZipCodeSearch.js"
|
|
21
|
+
},
|
|
22
|
+
"./components/helper": {
|
|
23
|
+
"import": "./esm/components/helper.js",
|
|
24
|
+
"require": "./cjs/components/helper.js"
|
|
25
|
+
},
|
|
26
|
+
"./components/blocks": {
|
|
27
|
+
"import": "./esm/components/blocks.js",
|
|
28
|
+
"require": "./cjs/components/blocks.js"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
8
31
|
"sideEffects": [
|
|
9
32
|
"*.css",
|
|
10
33
|
"*.scss"
|
|
11
34
|
],
|
|
35
|
+
"repository": {
|
|
36
|
+
"type": "git",
|
|
37
|
+
"url": "https://git.elliemae.io/platform-ui/dimsum.git"
|
|
38
|
+
},
|
|
39
|
+
"engines": {
|
|
40
|
+
"npm": ">=7",
|
|
41
|
+
"node": ">=14"
|
|
42
|
+
},
|
|
43
|
+
"author": "ICE MT",
|
|
12
44
|
"scripts": {
|
|
13
45
|
"dev": "cross-env NODE_ENV=development && node ../../scripts/build/build.js -w",
|
|
14
46
|
"prebuild": "exit 0",
|
|
@@ -16,17 +48,23 @@
|
|
|
16
48
|
"build": "node ../../scripts/build/build.js"
|
|
17
49
|
},
|
|
18
50
|
"dependencies": {
|
|
19
|
-
"@elliemae/ds-classnames": "
|
|
20
|
-
"@elliemae/ds-dropdownmenu": "
|
|
21
|
-
"@elliemae/ds-form": "
|
|
22
|
-
"react-desc": "
|
|
51
|
+
"@elliemae/ds-classnames": "2.0.0-alpha.12",
|
|
52
|
+
"@elliemae/ds-dropdownmenu": "2.0.0-alpha.12",
|
|
53
|
+
"@elliemae/ds-form": "2.0.0-alpha.12",
|
|
54
|
+
"react-desc": "~4.1.3"
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"@testing-library/jest-dom": "~5.15.0",
|
|
58
|
+
"@testing-library/react": "~12.1.2",
|
|
59
|
+
"@testing-library/user-event": "~13.5.0"
|
|
23
60
|
},
|
|
24
61
|
"peerDependencies": {
|
|
25
|
-
"react": "^17.0.
|
|
26
|
-
"react-dom": "^17.0.
|
|
62
|
+
"react": "^17.0.2",
|
|
63
|
+
"react-dom": "^17.0.2"
|
|
27
64
|
},
|
|
28
65
|
"publishConfig": {
|
|
29
66
|
"access": "public",
|
|
30
|
-
"directory": "dist"
|
|
67
|
+
"directory": "dist",
|
|
68
|
+
"generateSubmodules": true
|
|
31
69
|
}
|
|
32
70
|
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/// <reference path="../../../../shared/typings/react-desc.d.ts" />
|
|
2
|
+
/// <reference types="react" />
|
|
3
|
+
declare const DSZipCodeSearch: {
|
|
4
|
+
({ disabled, value, placeholder, mask, onBlur, onChange, onSearch, containerProps, selectRightOptions, activeCount, options, tabIndex, }: {
|
|
5
|
+
disabled: any;
|
|
6
|
+
value: any;
|
|
7
|
+
placeholder: any;
|
|
8
|
+
mask: any;
|
|
9
|
+
onBlur: any;
|
|
10
|
+
onChange: any;
|
|
11
|
+
onSearch: any;
|
|
12
|
+
containerProps: any;
|
|
13
|
+
selectRightOptions: any;
|
|
14
|
+
activeCount: any;
|
|
15
|
+
options: any;
|
|
16
|
+
tabIndex: any;
|
|
17
|
+
}): JSX.Element;
|
|
18
|
+
propTypes: {
|
|
19
|
+
className: {
|
|
20
|
+
defaultValue<T = unknown>(arg: T): {
|
|
21
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
22
|
+
};
|
|
23
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
24
|
+
};
|
|
25
|
+
containerProps: {
|
|
26
|
+
defaultValue<T = unknown>(arg: T): {
|
|
27
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
28
|
+
};
|
|
29
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
30
|
+
};
|
|
31
|
+
tabIndex: {
|
|
32
|
+
defaultValue<T = unknown>(arg: T): {
|
|
33
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
34
|
+
};
|
|
35
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
36
|
+
};
|
|
37
|
+
disabled: {
|
|
38
|
+
defaultValue<T = unknown>(arg: T): {
|
|
39
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
40
|
+
};
|
|
41
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
42
|
+
};
|
|
43
|
+
value: import("react-desc").PropTypesDescValidator;
|
|
44
|
+
onBlur: {
|
|
45
|
+
defaultValue<T = unknown>(arg: T): {
|
|
46
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
47
|
+
};
|
|
48
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
49
|
+
};
|
|
50
|
+
onChange: {
|
|
51
|
+
defaultValue<T = unknown>(arg: T): {
|
|
52
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
53
|
+
};
|
|
54
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
55
|
+
};
|
|
56
|
+
options: {
|
|
57
|
+
defaultValue<T = unknown>(arg: T): {
|
|
58
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
59
|
+
};
|
|
60
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
61
|
+
};
|
|
62
|
+
placeholder: {
|
|
63
|
+
defaultValue<T = unknown>(arg: T): {
|
|
64
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
65
|
+
};
|
|
66
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
67
|
+
};
|
|
68
|
+
mask: {
|
|
69
|
+
defaultValue<T = unknown>(arg: T): {
|
|
70
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
71
|
+
};
|
|
72
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
73
|
+
};
|
|
74
|
+
onSearch: {
|
|
75
|
+
defaultValue<T = unknown>(arg: T): {
|
|
76
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
77
|
+
};
|
|
78
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
79
|
+
};
|
|
80
|
+
selectRightOptions: {
|
|
81
|
+
defaultValue<T = unknown>(arg: T): {
|
|
82
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
83
|
+
};
|
|
84
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
85
|
+
};
|
|
86
|
+
activeCount: {
|
|
87
|
+
defaultValue<T = unknown>(arg: T): {
|
|
88
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
89
|
+
};
|
|
90
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
defaultProps: {
|
|
94
|
+
disabled: boolean;
|
|
95
|
+
value: string;
|
|
96
|
+
placeholder: string;
|
|
97
|
+
mask: string;
|
|
98
|
+
onBlur: () => null;
|
|
99
|
+
onChange: () => null;
|
|
100
|
+
onSearch: () => null;
|
|
101
|
+
containerProps: {};
|
|
102
|
+
selectRightOptions: string;
|
|
103
|
+
activeCount: number;
|
|
104
|
+
options: never[];
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
declare const ZipCodeSearchWithSchema: {
|
|
108
|
+
(props?: {
|
|
109
|
+
disabled: any;
|
|
110
|
+
value: any;
|
|
111
|
+
placeholder: any;
|
|
112
|
+
mask: any;
|
|
113
|
+
onBlur: any;
|
|
114
|
+
onChange: any;
|
|
115
|
+
onSearch: any;
|
|
116
|
+
containerProps: any;
|
|
117
|
+
selectRightOptions: any;
|
|
118
|
+
activeCount: any;
|
|
119
|
+
options: any;
|
|
120
|
+
tabIndex: any;
|
|
121
|
+
} | undefined): JSX.Element;
|
|
122
|
+
propTypes: unknown;
|
|
123
|
+
toTypescript: () => import("react-desc").TypescriptSchema;
|
|
124
|
+
};
|
|
125
|
+
export { DSZipCodeSearch, ZipCodeSearchWithSchema };
|
|
126
|
+
export default DSZipCodeSearch;
|
package/types/index.d.ts
ADDED
package/types/props.d.ts
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/// <reference path="../../../../shared/typings/react-desc.d.ts" />
|
|
2
|
+
export declare const zipcodeSearchProps: {
|
|
3
|
+
/** html class attribute */
|
|
4
|
+
className: {
|
|
5
|
+
defaultValue<T = unknown>(arg: T): {
|
|
6
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
7
|
+
};
|
|
8
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
9
|
+
};
|
|
10
|
+
/** Set of Properties attached to the main container */
|
|
11
|
+
containerProps: {
|
|
12
|
+
defaultValue<T = unknown>(arg: T): {
|
|
13
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
14
|
+
};
|
|
15
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
16
|
+
};
|
|
17
|
+
/** native tabindex property to handle focus order */
|
|
18
|
+
tabIndex: {
|
|
19
|
+
defaultValue<T = unknown>(arg: T): {
|
|
20
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
21
|
+
};
|
|
22
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
23
|
+
};
|
|
24
|
+
/** disable component */
|
|
25
|
+
disabled: {
|
|
26
|
+
defaultValue<T = unknown>(arg: T): {
|
|
27
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
28
|
+
};
|
|
29
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
30
|
+
};
|
|
31
|
+
/** input value */
|
|
32
|
+
value: import("react-desc").PropTypesDescValidator;
|
|
33
|
+
/** function called on blur */
|
|
34
|
+
onBlur: {
|
|
35
|
+
defaultValue<T = unknown>(arg: T): {
|
|
36
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
37
|
+
};
|
|
38
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
39
|
+
};
|
|
40
|
+
/** function called on change */
|
|
41
|
+
onChange: {
|
|
42
|
+
defaultValue<T = unknown>(arg: T): {
|
|
43
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
44
|
+
};
|
|
45
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
46
|
+
};
|
|
47
|
+
/** options to display */
|
|
48
|
+
options: {
|
|
49
|
+
defaultValue<T = unknown>(arg: T): {
|
|
50
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
51
|
+
};
|
|
52
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
53
|
+
};
|
|
54
|
+
/** placeholder value */
|
|
55
|
+
placeholder: {
|
|
56
|
+
defaultValue<T = unknown>(arg: T): {
|
|
57
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
58
|
+
};
|
|
59
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
60
|
+
};
|
|
61
|
+
/** format mask to apply */
|
|
62
|
+
mask: {
|
|
63
|
+
defaultValue<T = unknown>(arg: T): {
|
|
64
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
65
|
+
};
|
|
66
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
67
|
+
};
|
|
68
|
+
/** function called onsearch */
|
|
69
|
+
onSearch: {
|
|
70
|
+
defaultValue<T = unknown>(arg: T): {
|
|
71
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
72
|
+
};
|
|
73
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
74
|
+
};
|
|
75
|
+
/** Correction messange */
|
|
76
|
+
selectRightOptions: {
|
|
77
|
+
defaultValue<T = unknown>(arg: T): {
|
|
78
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
79
|
+
};
|
|
80
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
81
|
+
};
|
|
82
|
+
/** current amount */
|
|
83
|
+
activeCount: {
|
|
84
|
+
defaultValue<T = unknown>(arg: T): {
|
|
85
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
86
|
+
};
|
|
87
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
export declare const defaultProps: {
|
|
91
|
+
disabled: boolean;
|
|
92
|
+
value: string;
|
|
93
|
+
placeholder: string;
|
|
94
|
+
mask: string;
|
|
95
|
+
onBlur: () => null;
|
|
96
|
+
onChange: () => null;
|
|
97
|
+
onSearch: () => null;
|
|
98
|
+
containerProps: {};
|
|
99
|
+
selectRightOptions: string;
|
|
100
|
+
activeCount: number;
|
|
101
|
+
options: never[];
|
|
102
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DSZipCodeSearch.js","sources":["../../src/DSZipCodeSearch.tsx"],"sourcesContent":["/* eslint-disable no-useless-escape */\n/* eslint-disable max-lines */\n/* eslint-disable indent */\nimport React, { useState, useEffect, useRef, useCallback } from 'react';\nimport { describe } from 'react-desc';\nimport DSDropdownMenu from '@elliemae/ds-dropdownmenu';\nimport { DSInputMask } from '@elliemae/ds-form';\nimport { InputSearchWrapper } from './components/blocks';\nimport { createDisabledOption, noAddonOptions } from './components/helper';\nimport { zipcodeSearchProps, defaultProps } from './props';\n\nconst DSZipCodeSearch = ({\n disabled,\n value,\n placeholder,\n mask,\n onBlur,\n onChange,\n onSearch,\n containerProps,\n selectRightOptions,\n activeCount,\n options,\n tabIndex,\n}) => {\n const ref = useRef(null);\n const [searchValue, setSearchValue] = useState(value);\n const [isOpen, setIsOpen] = useState(false);\n const [isActive, setIsActive] = useState(false);\n const [isInputFocus, setIsInputFocus] = useState(false);\n const [isSelected, setIsSelected] = useState(false);\n\n useEffect(() => {\n if (isInputFocus && activeCount <= searchValue.length && !isSelected) {\n setIsOpen(true);\n setIsActive(true);\n } else if (!isActive || activeCount > searchValue.length) {\n setIsOpen(false);\n }\n }, [isInputFocus, isActive, activeCount, searchValue, isSelected]);\n useEffect(() => {\n setSearchValue(value || '');\n }, [value]);\n\n const onTypeInInput = useCallback(\n (e) => {\n const finalVal = e.target.value;\n onSearch(finalVal);\n setSearchValue(finalVal);\n setIsSelected(false);\n },\n [onSearch],\n );\n\n const onFocusInput = useCallback(() => {\n setIsInputFocus(true);\n }, []);\n\n const onInnerBlur = useCallback(\n (e) => {\n setIsInputFocus(false);\n onBlur(e);\n },\n [onBlur],\n );\n const onClose = useCallback(() => {\n setIsActive(false);\n }, []);\n const onSelectItem = useCallback(\n (item) => {\n setSearchValue(item.value);\n onChange(item);\n setIsSelected(true);\n ref.current.focus();\n setIsOpen(false);\n onClose();\n },\n [onChange, onClose],\n );\n\n return (\n <InputSearchWrapper {...containerProps}>\n <DSDropdownMenu\n isOpen={isOpen && options.length > 0}\n menuProps={{ className: 'input-search-menu' }}\n onClose={onClose}\n onSelectMenuItem={onSelectItem}\n contentStyle={{\n maxHeight: 200,\n }}\n options={options.length > 0 ? [createDisabledOption(selectRightOptions), ...noAddonOptions(options)] : []}\n triggerComponent={\n <div>\n <DSInputMask\n disabled={disabled}\n innerRef={(_ref) => (ref.current = _ref)}\n mask={mask}\n onBlur={onInnerBlur}\n onChange={onTypeInInput}\n onFocus={onFocusInput}\n placeholder={placeholder}\n value={searchValue}\n tabIndex={tabIndex}\n />\n </div>\n }\n />\n </InputSearchWrapper>\n );\n};\n\nDSZipCodeSearch.propTypes = zipcodeSearchProps;\n\nDSZipCodeSearch.defaultProps = defaultProps;\n\nconst ZipCodeSearchWithSchema = describe(DSZipCodeSearch);\nZipCodeSearchWithSchema.propTypes = zipcodeSearchProps;\n\nexport { DSZipCodeSearch, ZipCodeSearchWithSchema };\nexport default DSZipCodeSearch;\n"],"names":["DSZipCodeSearch","disabled","value","placeholder","mask","onBlur","onChange","onSearch","containerProps","selectRightOptions","activeCount","options","tabIndex","ref","useRef","useState","searchValue","setSearchValue","isOpen","setIsOpen","isActive","setIsActive","isInputFocus","setIsInputFocus","isSelected","setIsSelected","useEffect","length","onTypeInInput","useCallback","e","finalVal","target","onFocusInput","onInnerBlur","onClose","onSelectItem","item","current","focus","React","InputSearchWrapper","DSDropdownMenu","className","maxHeight","createDisabledOption","noAddonOptions","DSInputMask","_ref","propTypes","zipcodeSearchProps","defaultProps","ZipCodeSearchWithSchema","describe"],"mappings":";;;;;;;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js","sources":["../../../src/components/blocks.tsx"],"sourcesContent":["import { aggregatedClasses } from '@elliemae/ds-classnames';\n\nconst blockName = 'input-search';\n\nexport const InputSearchWrapper = aggregatedClasses('div')(blockName);\n"],"names":["blockName","InputSearchWrapper","aggregatedClasses"],"mappings":";;;;;;AAEA,IAAMA,SAAS,GAAG,cAAlB;IAEaC,kBAAkB,GAAGC,8BAAiB,CAAC,KAAD,CAAjB,CAAyBF,SAAzB;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helper.js","sources":["../../../src/components/helper.tsx"],"sourcesContent":["export function createDisabledOption(label) {\n return {\n id: 'no-option',\n type: 'disabled',\n label,\n noAddon: true,\n 'aria-disabled': true,\n className: 'no-options',\n tabIndex: -1,\n };\n}\n\nexport function noAddonOptions(options) {\n return options.map(op => ({ ...op, noAddon: true }));\n}\n"],"names":["createDisabledOption","label","id","type","noAddon","className","tabIndex","noAddonOptions","options","map","op"],"mappings":";;;;;;;;;;;;;;AAAO,SAASA,oBAAT,CAA8BC,KAA9B,EAAqC;AAC1C,SAAO;AACLC,IAAAA,EAAE,EAAE,WADC;AAELC,IAAAA,IAAI,EAAE,UAFD;AAGLF,IAAAA,KAAK,EAALA,KAHK;AAILG,IAAAA,OAAO,EAAE,IAJJ;AAKL,qBAAiB,IALZ;AAMLC,IAAAA,SAAS,EAAE,YANN;AAOLC,IAAAA,QAAQ,EAAE,CAAC;AAPN,GAAP;AASD;AAEM,SAASC,cAAT,CAAwBC,OAAxB,EAAiC;AACtC,SAAOA,OAAO,CAACC,GAAR,CAAY,UAAAC,EAAE;AAAA,2CAAUA,EAAV;AAAcN,MAAAA,OAAO,EAAE;AAAvB;AAAA,GAAd,CAAP;AACD;;;;;"}
|
package/cjs/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;"}
|
package/cjs/props.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"props.js","sources":["../../src/props.tsx"],"sourcesContent":["import { PropTypes } from 'react-desc';\nimport { MASK_TYPES } from '@elliemae/ds-form';\n\nexport const zipcodeSearchProps = {\n /** html class attribute */\n className: PropTypes.string.description('html class attribute'),\n /** Set of Properties attached to the main container */\n containerProps: PropTypes.object.description('Set of Properties attached to the main container'),\n /** native tabindex property to handle focus order */\n tabIndex: PropTypes.number.description('native tabindex property to handle focus order'),\n /** disable component */\n disabled: PropTypes.bool.description('disable component'),\n /** input value */\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.object]).description('input value')\n .isRequired,\n /** function called on blur */\n onBlur: PropTypes.func.description('function called on blur'),\n /** function called on change */\n onChange: PropTypes.func.description('function called on change'),\n /** options to display */\n options: PropTypes.arrayOf(\n PropTypes.shape({\n label: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n }),\n ).description('options to display'),\n /** placeholder value */\n placeholder: PropTypes.string.description('placeholder value'),\n /** format mask to apply */\n mask: PropTypes.arrayOf(PropTypes.any).description('format mask to apply'),\n /** function called onsearch */\n onSearch: PropTypes.func.description('function called onsearch'),\n /** Correction messange */\n selectRightOptions: PropTypes.string.description('Correction messange'),\n /** current amount */\n activeCount: PropTypes.number.description('current amount'),\n};\n\nexport const defaultProps = {\n disabled: false,\n value: '',\n placeholder: '_____-____',\n mask: MASK_TYPES.ZIP_CODE_SEARCH,\n onBlur: () => null,\n onChange: () => null,\n onSearch: () => null,\n containerProps: {},\n selectRightOptions: 'Please select the appropriate city',\n activeCount: 5,\n options: [],\n};\n"],"names":["zipcodeSearchProps","className","PropTypes","string","description","containerProps","object","tabIndex","number","disabled","bool","value","oneOfType","isRequired","onBlur","func","onChange","options","arrayOf","shape","label","placeholder","mask","any","onSearch","selectRightOptions","activeCount","defaultProps","MASK_TYPES","ZIP_CODE_SEARCH"],"mappings":";;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CAxBmB;;AAyBhC;AACAkB,EAAAA,IAAI,EAAEpB,mBAAS,CAACgB,OAAV,CAAkBhB,mBAAS,CAACqB,GAA5B,EAAiCnB,WAAjC,CAA6C,sBAA7C,CA1B0B;;AA2BhC;AACAoB,EAAAA,QAAQ,EAAEtB,mBAAS,CAACa,IAAV,CAAeX,WAAf,CAA2B,0BAA3B,CA5BsB;;AA6BhC;AACAqB,EAAAA,kBAAkB,EAAEvB,mBAAS,CAACC,MAAV,CAAiBC,WAAjB,CAA6B,qBAA7B,CA9BY;;AA+BhC;AACAsB,EAAAA,WAAW,EAAExB,mBAAS,CAACM,MAAV,CAAiBJ,WAAjB,CAA6B,gBAA7B;AAhCmB;IAmCrBuB,YAAY,GAAG;AAC1BlB,EAAAA,QAAQ,EAAE,KADgB;AAE1BE,EAAAA,KAAK,EAAE,EAFmB;AAG1BU,EAAAA,WAAW,EAAE,YAHa;AAI1BC,EAAAA,IAAI,EAAEM,iBAAU,CAACC,eAJS;AAK1Bf,EAAAA,MAAM,EAAE;AAAA,WAAM,IAAN;AAAA,GALkB;AAM1BE,EAAAA,QAAQ,EAAE;AAAA,WAAM,IAAN;AAAA,GANgB;AAO1BQ,EAAAA,QAAQ,EAAE;AAAA,WAAM,IAAN;AAAA,GAPgB;AAQ1BnB,EAAAA,cAAc,EAAE,EARU;AAS1BoB,EAAAA,kBAAkB,EAAE,oCATM;AAU1BC,EAAAA,WAAW,EAAE,CAVa;AAW1BT,EAAAA,OAAO,EAAE;AAXiB;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DSZipCodeSearch.js","sources":["../../src/DSZipCodeSearch.tsx"],"sourcesContent":["/* eslint-disable no-useless-escape */\n/* eslint-disable max-lines */\n/* eslint-disable indent */\nimport React, { useState, useEffect, useRef, useCallback } from 'react';\nimport { describe } from 'react-desc';\nimport DSDropdownMenu from '@elliemae/ds-dropdownmenu';\nimport { DSInputMask } from '@elliemae/ds-form';\nimport { InputSearchWrapper } from './components/blocks';\nimport { createDisabledOption, noAddonOptions } from './components/helper';\nimport { zipcodeSearchProps, defaultProps } from './props';\n\nconst DSZipCodeSearch = ({\n disabled,\n value,\n placeholder,\n mask,\n onBlur,\n onChange,\n onSearch,\n containerProps,\n selectRightOptions,\n activeCount,\n options,\n tabIndex,\n}) => {\n const ref = useRef(null);\n const [searchValue, setSearchValue] = useState(value);\n const [isOpen, setIsOpen] = useState(false);\n const [isActive, setIsActive] = useState(false);\n const [isInputFocus, setIsInputFocus] = useState(false);\n const [isSelected, setIsSelected] = useState(false);\n\n useEffect(() => {\n if (isInputFocus && activeCount <= searchValue.length && !isSelected) {\n setIsOpen(true);\n setIsActive(true);\n } else if (!isActive || activeCount > searchValue.length) {\n setIsOpen(false);\n }\n }, [isInputFocus, isActive, activeCount, searchValue, isSelected]);\n useEffect(() => {\n setSearchValue(value || '');\n }, [value]);\n\n const onTypeInInput = useCallback(\n (e) => {\n const finalVal = e.target.value;\n onSearch(finalVal);\n setSearchValue(finalVal);\n setIsSelected(false);\n },\n [onSearch],\n );\n\n const onFocusInput = useCallback(() => {\n setIsInputFocus(true);\n }, []);\n\n const onInnerBlur = useCallback(\n (e) => {\n setIsInputFocus(false);\n onBlur(e);\n },\n [onBlur],\n );\n const onClose = useCallback(() => {\n setIsActive(false);\n }, []);\n const onSelectItem = useCallback(\n (item) => {\n setSearchValue(item.value);\n onChange(item);\n setIsSelected(true);\n ref.current.focus();\n setIsOpen(false);\n onClose();\n },\n [onChange, onClose],\n );\n\n return (\n <InputSearchWrapper {...containerProps}>\n <DSDropdownMenu\n isOpen={isOpen && options.length > 0}\n menuProps={{ className: 'input-search-menu' }}\n onClose={onClose}\n onSelectMenuItem={onSelectItem}\n contentStyle={{\n maxHeight: 200,\n }}\n options={options.length > 0 ? [createDisabledOption(selectRightOptions), ...noAddonOptions(options)] : []}\n triggerComponent={\n <div>\n <DSInputMask\n disabled={disabled}\n innerRef={(_ref) => (ref.current = _ref)}\n mask={mask}\n onBlur={onInnerBlur}\n onChange={onTypeInInput}\n onFocus={onFocusInput}\n placeholder={placeholder}\n value={searchValue}\n tabIndex={tabIndex}\n />\n </div>\n }\n />\n </InputSearchWrapper>\n );\n};\n\nDSZipCodeSearch.propTypes = zipcodeSearchProps;\n\nDSZipCodeSearch.defaultProps = defaultProps;\n\nconst ZipCodeSearchWithSchema = describe(DSZipCodeSearch);\nZipCodeSearchWithSchema.propTypes = zipcodeSearchProps;\n\nexport { DSZipCodeSearch, ZipCodeSearchWithSchema };\nexport default DSZipCodeSearch;\n"],"names":["DSZipCodeSearch","disabled","value","placeholder","mask","onBlur","onChange","onSearch","containerProps","selectRightOptions","activeCount","options","tabIndex","ref","useRef","useState","searchValue","setSearchValue","isOpen","setIsOpen","isActive","setIsActive","isInputFocus","setIsInputFocus","isSelected","setIsSelected","useEffect","length","onTypeInInput","useCallback","e","finalVal","target","onFocusInput","onInnerBlur","onClose","onSelectItem","item","current","focus","className","maxHeight","createDisabledOption","noAddonOptions","_ref","propTypes","zipcodeSearchProps","defaultProps","ZipCodeSearchWithSchema","describe"],"mappings":";;;;;;;;;;;;IAWMA,eAAe,GAAG,SAAlBA,eAAkB,QAalB;AAAA,MAZJC,QAYI,SAZJA,QAYI;AAAA,MAXJC,KAWI,SAXJA,KAWI;AAAA,MAVJC,WAUI,SAVJA,WAUI;AAAA,MATJC,IASI,SATJA,IASI;AAAA,MARJC,MAQI,SARJA,MAQI;AAAA,MAPJC,QAOI,SAPJA,QAOI;AAAA,MANJC,QAMI,SANJA,QAMI;AAAA,MALJC,cAKI,SALJA,cAKI;AAAA,MAJJC,kBAII,SAJJA,kBAII;AAAA,MAHJC,WAGI,SAHJA,WAGI;AAAA,MAFJC,OAEI,SAFJA,OAEI;AAAA,MADJC,QACI,SADJA,QACI;AACJ,MAAMC,GAAG,GAAGC,MAAM,CAAC,IAAD,CAAlB;;AACA,kBAAsCC,QAAQ,CAACb,KAAD,CAA9C;AAAA;AAAA,MAAOc,WAAP;AAAA,MAAoB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CACE,oBAAC,WAAD;AACE,MAAA,QAAQ,EAAEV,QADZ;AAEE,MAAA,QAAQ,EAAE,kBAAC2C,IAAD;AAAA,eAAW/B,GAAG,CAACyB,OAAJ,GAAcM,IAAzB;AAAA,OAFZ;AAGE,MAAA,IAAI,EAAExC,IAHR;AAIE,MAAA,MAAM,EAAE8B,WAJV;AAKE,MAAA,QAAQ,EAAEN,aALZ;AAME,MAAA,OAAO,EAAEK,YANX;AAOE,MAAA,WAAW,EAAE9B,WAPf;AAQE,MAAA,KAAK,EAAEa,WART;AASE,MAAA,QAAQ,EAAEJ;AATZ,MADF;AAVJ,IADF,CADF;AA6BD;;AAEDZ,eAAe,CAAC6C,SAAhB,GAA4BC,kBAA5B;AAEA9C,eAAe,CAAC+C,YAAhB,GAA+BA,YAA/B;IAEMC,uBAAuB,GAAGC,QAAQ,CAACjD,eAAD;AACxCgD,uBAAuB,CAACH,SAAxB,GAAoCC,kBAApC;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"blocks.js","sources":["../../../src/components/blocks.tsx"],"sourcesContent":["import { aggregatedClasses } from '@elliemae/ds-classnames';\n\nconst blockName = 'input-search';\n\nexport const InputSearchWrapper = aggregatedClasses('div')(blockName);\n"],"names":["blockName","InputSearchWrapper","aggregatedClasses"],"mappings":";;AAEA,IAAMA,SAAS,GAAG,cAAlB;IAEaC,kBAAkB,GAAGC,iBAAiB,CAAC,KAAD,CAAjB,CAAyBF,SAAzB;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helper.js","sources":["../../../src/components/helper.tsx"],"sourcesContent":["export function createDisabledOption(label) {\n return {\n id: 'no-option',\n type: 'disabled',\n label,\n noAddon: true,\n 'aria-disabled': true,\n className: 'no-options',\n tabIndex: -1,\n };\n}\n\nexport function noAddonOptions(options) {\n return options.map(op => ({ ...op, noAddon: true }));\n}\n"],"names":["createDisabledOption","label","id","type","noAddon","className","tabIndex","noAddonOptions","options","map","op"],"mappings":";;;;;;AAAO,SAASA,oBAAT,CAA8BC,KAA9B,EAAqC;AAC1C,SAAO;AACLC,IAAAA,EAAE,EAAE,WADC;AAELC,IAAAA,IAAI,EAAE,UAFD;AAGLF,IAAAA,KAAK,EAALA,KAHK;AAILG,IAAAA,OAAO,EAAE,IAJJ;AAKL,qBAAiB,IALZ;AAMLC,IAAAA,SAAS,EAAE,YANN;AAOLC,IAAAA,QAAQ,EAAE,CAAC;AAPN,GAAP;AASD;AAEM,SAASC,cAAT,CAAwBC,OAAxB,EAAiC;AACtC,SAAOA,OAAO,CAACC,GAAR,CAAY,UAAAC,EAAE;AAAA,2CAAUA,EAAV;AAAcN,MAAAA,OAAO,EAAE;AAAvB;AAAA,GAAd,CAAP;AACD;;;;"}
|
package/esm/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
|
package/esm/props.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"props.js","sources":["../../src/props.tsx"],"sourcesContent":["import { PropTypes } from 'react-desc';\nimport { MASK_TYPES } from '@elliemae/ds-form';\n\nexport const zipcodeSearchProps = {\n /** html class attribute */\n className: PropTypes.string.description('html class attribute'),\n /** Set of Properties attached to the main container */\n containerProps: PropTypes.object.description('Set of Properties attached to the main container'),\n /** native tabindex property to handle focus order */\n tabIndex: PropTypes.number.description('native tabindex property to handle focus order'),\n /** disable component */\n disabled: PropTypes.bool.description('disable component'),\n /** input value */\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.object]).description('input value')\n .isRequired,\n /** function called on blur */\n onBlur: PropTypes.func.description('function called on blur'),\n /** function called on change */\n onChange: PropTypes.func.description('function called on change'),\n /** options to display */\n options: PropTypes.arrayOf(\n PropTypes.shape({\n label: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n }),\n ).description('options to display'),\n /** placeholder value */\n placeholder: PropTypes.string.description('placeholder value'),\n /** format mask to apply */\n mask: PropTypes.arrayOf(PropTypes.any).description('format mask to apply'),\n /** function called onsearch */\n onSearch: PropTypes.func.description('function called onsearch'),\n /** Correction messange */\n selectRightOptions: PropTypes.string.description('Correction messange'),\n /** current amount */\n activeCount: PropTypes.number.description('current amount'),\n};\n\nexport const defaultProps = {\n disabled: false,\n value: '',\n placeholder: '_____-____',\n mask: MASK_TYPES.ZIP_CODE_SEARCH,\n onBlur: () => null,\n onChange: () => null,\n onSearch: () => null,\n containerProps: {},\n selectRightOptions: 'Please select the appropriate city',\n activeCount: 5,\n options: [],\n};\n"],"names":["zipcodeSearchProps","className","PropTypes","string","description","containerProps","object","tabIndex","number","disabled","bool","value","oneOfType","isRequired","onBlur","func","onChange","options","arrayOf","shape","label","placeholder","mask","any","onSearch","selectRightOptions","activeCount","defaultProps","MASK_TYPES","ZIP_CODE_SEARCH"],"mappings":";;;IAGaA,kBAAkB,GAAG;AAChC;AACAC,EAAAA,SAAS,EAAEC,SAAS,CAACC,MAAV,CAAiBC,WAAjB,CAA6B,sBAA7B,CAFqB;;AAGhC;AACAC,EAAAA,cAAc,EAAEH,SAAS,CAACI,MAAV,CAAiBF,WAAjB,CAA6B,kDAA7B,CAJgB;;AAKhC;AACAG,EAAAA,QAAQ,EAAEL,SAAS,CAACM,MAAV,CAAiBJ,WAAjB,CAA6B,gDAA7B,CANsB;;AAOhC;AACAK,EAAAA,QAAQ,EAAEP,SAAS,CAACQ,IAAV,CAAeN,WAAf,CAA2B,mBAA3B,CARsB;;AAShC;AACAO,EAAAA,KAAK,EAAET,SAAS,CAACU,SAAV,CAAoB,CAACV,SAAS,CAACC,MAAX,EAAmBD,SAAS,CAACM,MAA7B,EAAqCN,SAAS,CAACI,MAA/C,CAApB,EAA4EF,WAA5E,CAAwF,aAAxF,EACJS,UAX6B;;AAYhC;AACAC,EAAAA,MAAM,EAAEZ,SAAS,CAAC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