@elliemae/ds-zipcode-search 2.3.0-next.0 → 3.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/DSZipCodeSearch.js +127 -0
- package/dist/cjs/DSZipCodeSearch.js.map +7 -0
- package/dist/cjs/components/blocks.js +37 -0
- package/dist/cjs/components/blocks.js.map +7 -0
- package/dist/cjs/components/helper.js +49 -0
- package/dist/cjs/components/helper.js.map +7 -0
- package/dist/cjs/index.js +36 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/props.js +68 -0
- package/dist/cjs/props.js.map +7 -0
- package/dist/esm/DSZipCodeSearch.js +98 -0
- package/dist/esm/DSZipCodeSearch.js.map +7 -0
- package/dist/esm/components/blocks.js +8 -0
- package/dist/esm/components/blocks.js.map +7 -0
- package/dist/esm/components/helper.js +20 -0
- package/dist/esm/components/helper.js.map +7 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/props.js +39 -0
- package/dist/esm/props.js.map +7 -0
- package/{types → dist/types}/DSZipCodeSearch.d.ts +0 -0
- package/{types → dist/types}/components/blocks.d.ts +0 -0
- package/{types → dist/types}/components/helper.d.ts +0 -0
- package/{types → dist/types}/index.d.ts +0 -0
- package/{types → dist/types}/props.d.ts +0 -0
- package/{types → dist/types}/tests/DSZipCodeSearch.test.d.ts +0 -0
- package/package.json +35 -27
- package/cjs/DSZipCodeSearch.js +0 -121
- package/cjs/components/blocks.js +0 -10
- package/cjs/components/helper.js +0 -39
- package/cjs/index.js +0 -11
- package/cjs/props.js +0 -66
- package/esm/DSZipCodeSearch.js +0 -109
- package/esm/components/blocks.js +0 -6
- package/esm/components/helper.js +0 -30
- package/esm/index.js +0 -1
- package/esm/props.js +0 -61
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var DSZipCodeSearch_exports = {};
|
|
29
|
+
__export(DSZipCodeSearch_exports, {
|
|
30
|
+
DSZipCodeSearch: () => DSZipCodeSearch,
|
|
31
|
+
ZipCodeSearchWithSchema: () => ZipCodeSearchWithSchema,
|
|
32
|
+
default: () => DSZipCodeSearch_default
|
|
33
|
+
});
|
|
34
|
+
var React = __toESM(require("react"));
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_react_desc = require("react-desc");
|
|
37
|
+
var import_ds_dropdownmenu = __toESM(require("@elliemae/ds-dropdownmenu"));
|
|
38
|
+
var import_ds_form = require("@elliemae/ds-form");
|
|
39
|
+
var import_blocks = require("./components/blocks");
|
|
40
|
+
var import_helper = require("./components/helper");
|
|
41
|
+
var import_props = require("./props");
|
|
42
|
+
const DSZipCodeSearch = ({
|
|
43
|
+
disabled,
|
|
44
|
+
value,
|
|
45
|
+
placeholder,
|
|
46
|
+
mask,
|
|
47
|
+
onBlur,
|
|
48
|
+
onChange,
|
|
49
|
+
onSearch,
|
|
50
|
+
containerProps,
|
|
51
|
+
selectRightOptions,
|
|
52
|
+
activeCount,
|
|
53
|
+
options,
|
|
54
|
+
tabIndex
|
|
55
|
+
}) => {
|
|
56
|
+
const ref = (0, import_react.useRef)(null);
|
|
57
|
+
const [searchValue, setSearchValue] = (0, import_react.useState)(value);
|
|
58
|
+
const [isOpen, setIsOpen] = (0, import_react.useState)(false);
|
|
59
|
+
const [isActive, setIsActive] = (0, import_react.useState)(false);
|
|
60
|
+
const [isInputFocus, setIsInputFocus] = (0, import_react.useState)(false);
|
|
61
|
+
const [isSelected, setIsSelected] = (0, import_react.useState)(false);
|
|
62
|
+
(0, import_react.useEffect)(() => {
|
|
63
|
+
if (isInputFocus && activeCount <= searchValue.length && !isSelected) {
|
|
64
|
+
setIsOpen(true);
|
|
65
|
+
setIsActive(true);
|
|
66
|
+
} else if (!isActive || activeCount > searchValue.length) {
|
|
67
|
+
setIsOpen(false);
|
|
68
|
+
}
|
|
69
|
+
}, [isInputFocus, isActive, activeCount, searchValue, isSelected]);
|
|
70
|
+
(0, import_react.useEffect)(() => {
|
|
71
|
+
setSearchValue(value || "");
|
|
72
|
+
}, [value]);
|
|
73
|
+
const onTypeInInput = (0, import_react.useCallback)((e) => {
|
|
74
|
+
const finalVal = e.target.value;
|
|
75
|
+
onSearch(finalVal);
|
|
76
|
+
setSearchValue(finalVal);
|
|
77
|
+
setIsSelected(false);
|
|
78
|
+
}, [onSearch]);
|
|
79
|
+
const onFocusInput = (0, import_react.useCallback)(() => {
|
|
80
|
+
setIsInputFocus(true);
|
|
81
|
+
}, []);
|
|
82
|
+
const onInnerBlur = (0, import_react.useCallback)((e) => {
|
|
83
|
+
setIsInputFocus(false);
|
|
84
|
+
onBlur(e);
|
|
85
|
+
}, [onBlur]);
|
|
86
|
+
const onClose = (0, import_react.useCallback)(() => {
|
|
87
|
+
setIsActive(false);
|
|
88
|
+
}, []);
|
|
89
|
+
const onSelectItem = (0, import_react.useCallback)((item) => {
|
|
90
|
+
setSearchValue(item.value);
|
|
91
|
+
onChange(item);
|
|
92
|
+
setIsSelected(true);
|
|
93
|
+
ref.current.focus();
|
|
94
|
+
setIsOpen(false);
|
|
95
|
+
onClose();
|
|
96
|
+
}, [onChange, onClose]);
|
|
97
|
+
return /* @__PURE__ */ import_react.default.createElement(import_blocks.InputSearchWrapper, {
|
|
98
|
+
...containerProps
|
|
99
|
+
}, /* @__PURE__ */ import_react.default.createElement(import_ds_dropdownmenu.default, {
|
|
100
|
+
isOpen: isOpen && options.length > 0,
|
|
101
|
+
menuProps: { className: "input-search-menu" },
|
|
102
|
+
onClose,
|
|
103
|
+
onSelectMenuItem: onSelectItem,
|
|
104
|
+
contentStyle: {
|
|
105
|
+
maxHeight: 200
|
|
106
|
+
},
|
|
107
|
+
options: options.length > 0 ? [(0, import_helper.createDisabledOption)(selectRightOptions), ...(0, import_helper.noAddonOptions)(options)] : [],
|
|
108
|
+
triggerComponent: /* @__PURE__ */ import_react.default.createElement("div", null, /* @__PURE__ */ import_react.default.createElement(import_ds_form.DSInputMask, {
|
|
109
|
+
disabled,
|
|
110
|
+
innerRef: (_ref) => ref.current = _ref,
|
|
111
|
+
mask,
|
|
112
|
+
onBlur: onInnerBlur,
|
|
113
|
+
onChange: onTypeInInput,
|
|
114
|
+
onFocus: onFocusInput,
|
|
115
|
+
placeholder,
|
|
116
|
+
value: searchValue,
|
|
117
|
+
tabIndex
|
|
118
|
+
}))
|
|
119
|
+
}));
|
|
120
|
+
};
|
|
121
|
+
DSZipCodeSearch.propTypes = import_props.zipcodeSearchProps;
|
|
122
|
+
DSZipCodeSearch.defaultProps = import_props.defaultProps;
|
|
123
|
+
const ZipCodeSearchWithSchema = (0, import_react_desc.describe)(DSZipCodeSearch);
|
|
124
|
+
ZipCodeSearchWithSchema.propTypes = import_props.zipcodeSearchProps;
|
|
125
|
+
var DSZipCodeSearch_default = DSZipCodeSearch;
|
|
126
|
+
module.exports = __toCommonJS(DSZipCodeSearch_exports);
|
|
127
|
+
//# sourceMappingURL=DSZipCodeSearch.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/DSZipCodeSearch.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"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", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADGvB,mBAAgE;AAChE,wBAAyB;AACzB,6BAA2B;AAC3B,qBAA4B;AAC5B,oBAAmC;AACnC,oBAAqD;AACrD,mBAAiD;AAEjD,MAAM,kBAAkB,CAAC;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,MACI;AACJ,QAAM,MAAM,yBAAO;AACnB,QAAM,CAAC,aAAa,kBAAkB,2BAAS;AAC/C,QAAM,CAAC,QAAQ,aAAa,2BAAS;AACrC,QAAM,CAAC,UAAU,eAAe,2BAAS;AACzC,QAAM,CAAC,cAAc,mBAAmB,2BAAS;AACjD,QAAM,CAAC,YAAY,iBAAiB,2BAAS;AAE7C,8BAAU,MAAM;AACd,QAAI,gBAAgB,eAAe,YAAY,UAAU,CAAC,YAAY;AACpE,gBAAU;AACV,kBAAY;AAAA,eACH,CAAC,YAAY,cAAc,YAAY,QAAQ;AACxD,gBAAU;AAAA;AAAA,KAEX,CAAC,cAAc,UAAU,aAAa,aAAa;AACtD,8BAAU,MAAM;AACd,mBAAe,SAAS;AAAA,KACvB,CAAC;AAEJ,QAAM,gBAAgB,8BACpB,CAAC,MAAM;AACL,UAAM,WAAW,EAAE,OAAO;AAC1B,aAAS;AACT,mBAAe;AACf,kBAAc;AAAA,KAEhB,CAAC;AAGH,QAAM,eAAe,8BAAY,MAAM;AACrC,oBAAgB;AAAA,KACf;AAEH,QAAM,cAAc,8BAClB,CAAC,MAAM;AACL,oBAAgB;AAChB,WAAO;AAAA,KAET,CAAC;AAEH,QAAM,UAAU,8BAAY,MAAM;AAChC,gBAAY;AAAA,KACX;AACH,QAAM,eAAe,8BACnB,CAAC,SAAS;AACR,mBAAe,KAAK;AACpB,aAAS;AACT,kBAAc;AACd,QAAI,QAAQ;AACZ,cAAU;AACV;AAAA,KAEF,CAAC,UAAU;AAGb,SACE,mDAAC,kCAAD;AAAA,OAAwB;AAAA,KACtB,mDAAC,gCAAD;AAAA,IACE,QAAQ,UAAU,QAAQ,SAAS;AAAA,IACnC,WAAW,EAAE,WAAW;AAAA,IACxB;AAAA,IACA,kBAAkB;AAAA,IAClB,cAAc;AAAA,MACZ,WAAW;AAAA;AAAA,IAEb,SAAS,QAAQ,SAAS,IAAI,CAAC,wCAAqB,qBAAqB,GAAG,kCAAe,YAAY;AAAA,IACvG,kBACE,mDAAC,OAAD,MACE,mDAAC,4BAAD;AAAA,MACE;AAAA,MACA,UAAU,CAAC,SAAU,IAAI,UAAU;AAAA,MACnC;AAAA,MACA,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,SAAS;AAAA,MACT;AAAA,MACA,OAAO;AAAA,MACP;AAAA;AAAA;AAAA;AASd,gBAAgB,YAAY;AAE5B,gBAAgB,eAAe;AAE/B,MAAM,0BAA0B,gCAAS;AACzC,wBAAwB,YAAY;AAGpC,IAAO,0BAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var blocks_exports = {};
|
|
29
|
+
__export(blocks_exports, {
|
|
30
|
+
InputSearchWrapper: () => InputSearchWrapper
|
|
31
|
+
});
|
|
32
|
+
var React = __toESM(require("react"));
|
|
33
|
+
var import_ds_classnames = require("@elliemae/ds-classnames");
|
|
34
|
+
const blockName = "input-search";
|
|
35
|
+
const InputSearchWrapper = (0, import_ds_classnames.aggregatedClasses)("div")(blockName);
|
|
36
|
+
module.exports = __toCommonJS(blocks_exports);
|
|
37
|
+
//# sourceMappingURL=blocks.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/blocks.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import { aggregatedClasses } from '@elliemae/ds-classnames';\n\nconst blockName = 'input-search';\n\nexport const InputSearchWrapper = aggregatedClasses('div')(blockName);\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,2BAAkC;AAElC,MAAM,YAAY;AAEX,MAAM,qBAAqB,4CAAkB,OAAO;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var helper_exports = {};
|
|
29
|
+
__export(helper_exports, {
|
|
30
|
+
createDisabledOption: () => createDisabledOption,
|
|
31
|
+
noAddonOptions: () => noAddonOptions
|
|
32
|
+
});
|
|
33
|
+
var React = __toESM(require("react"));
|
|
34
|
+
function createDisabledOption(label) {
|
|
35
|
+
return {
|
|
36
|
+
id: "no-option",
|
|
37
|
+
type: "disabled",
|
|
38
|
+
label,
|
|
39
|
+
noAddon: true,
|
|
40
|
+
"aria-disabled": true,
|
|
41
|
+
className: "no-options",
|
|
42
|
+
tabIndex: -1
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function noAddonOptions(options) {
|
|
46
|
+
return options.map((op) => ({ ...op, noAddon: true }));
|
|
47
|
+
}
|
|
48
|
+
module.exports = __toCommonJS(helper_exports);
|
|
49
|
+
//# sourceMappingURL=helper.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/helper.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"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", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,8BAA8B,OAAO;AAC1C,SAAO;AAAA,IACL,IAAI;AAAA,IACJ,MAAM;AAAA,IACN;AAAA,IACA,SAAS;AAAA,IACT,iBAAiB;AAAA,IACjB,WAAW;AAAA,IACX,UAAU;AAAA;AAAA;AAIP,wBAAwB,SAAS;AACtC,SAAO,QAAQ,IAAI,QAAO,MAAK,IAAI,SAAS;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var src_exports = {};
|
|
29
|
+
__export(src_exports, {
|
|
30
|
+
default: () => import_DSZipCodeSearch.default
|
|
31
|
+
});
|
|
32
|
+
var React = __toESM(require("react"));
|
|
33
|
+
__reExport(src_exports, require("./DSZipCodeSearch"));
|
|
34
|
+
var import_DSZipCodeSearch = __toESM(require("./DSZipCodeSearch"));
|
|
35
|
+
module.exports = __toCommonJS(src_exports);
|
|
36
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/index.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["export * from './DSZipCodeSearch';\n\nexport { default } from './DSZipCodeSearch';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,wBAAc;AAEd,6BAAwB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var props_exports = {};
|
|
29
|
+
__export(props_exports, {
|
|
30
|
+
defaultProps: () => defaultProps,
|
|
31
|
+
zipcodeSearchProps: () => zipcodeSearchProps
|
|
32
|
+
});
|
|
33
|
+
var React = __toESM(require("react"));
|
|
34
|
+
var import_react_desc = require("react-desc");
|
|
35
|
+
var import_ds_form = require("@elliemae/ds-form");
|
|
36
|
+
const zipcodeSearchProps = {
|
|
37
|
+
className: import_react_desc.PropTypes.string.description("html class attribute"),
|
|
38
|
+
containerProps: import_react_desc.PropTypes.object.description("Set of Properties attached to the main container"),
|
|
39
|
+
tabIndex: import_react_desc.PropTypes.number.description("native tabindex property to handle focus order"),
|
|
40
|
+
disabled: import_react_desc.PropTypes.bool.description("disable component"),
|
|
41
|
+
value: import_react_desc.PropTypes.oneOfType([import_react_desc.PropTypes.string, import_react_desc.PropTypes.number, import_react_desc.PropTypes.object]).description("input value").isRequired,
|
|
42
|
+
onBlur: import_react_desc.PropTypes.func.description("function called on blur"),
|
|
43
|
+
onChange: import_react_desc.PropTypes.func.description("function called on change"),
|
|
44
|
+
options: import_react_desc.PropTypes.arrayOf(import_react_desc.PropTypes.shape({
|
|
45
|
+
label: import_react_desc.PropTypes.oneOfType([import_react_desc.PropTypes.string, import_react_desc.PropTypes.number]),
|
|
46
|
+
value: import_react_desc.PropTypes.oneOfType([import_react_desc.PropTypes.string, import_react_desc.PropTypes.number])
|
|
47
|
+
})).description("options to display"),
|
|
48
|
+
placeholder: import_react_desc.PropTypes.string.description("placeholder value"),
|
|
49
|
+
mask: import_react_desc.PropTypes.arrayOf(import_react_desc.PropTypes.any).description("format mask to apply"),
|
|
50
|
+
onSearch: import_react_desc.PropTypes.func.description("function called onsearch"),
|
|
51
|
+
selectRightOptions: import_react_desc.PropTypes.string.description("Correction messange"),
|
|
52
|
+
activeCount: import_react_desc.PropTypes.number.description("current amount")
|
|
53
|
+
};
|
|
54
|
+
const defaultProps = {
|
|
55
|
+
disabled: false,
|
|
56
|
+
value: "",
|
|
57
|
+
placeholder: "_____-____",
|
|
58
|
+
mask: import_ds_form.MASK_TYPES.ZIP_CODE_SEARCH,
|
|
59
|
+
onBlur: () => null,
|
|
60
|
+
onChange: () => null,
|
|
61
|
+
onSearch: () => null,
|
|
62
|
+
containerProps: {},
|
|
63
|
+
selectRightOptions: "Please select the appropriate city",
|
|
64
|
+
activeCount: 5,
|
|
65
|
+
options: []
|
|
66
|
+
};
|
|
67
|
+
module.exports = __toCommonJS(props_exports);
|
|
68
|
+
//# sourceMappingURL=props.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/props.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"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", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,wBAA0B;AAC1B,qBAA2B;AAEpB,MAAM,qBAAqB;AAAA,EAEhC,WAAW,4BAAU,OAAO,YAAY;AAAA,EAExC,gBAAgB,4BAAU,OAAO,YAAY;AAAA,EAE7C,UAAU,4BAAU,OAAO,YAAY;AAAA,EAEvC,UAAU,4BAAU,KAAK,YAAY;AAAA,EAErC,OAAO,4BAAU,UAAU,CAAC,4BAAU,QAAQ,4BAAU,QAAQ,4BAAU,SAAS,YAAY,eAC5F;AAAA,EAEH,QAAQ,4BAAU,KAAK,YAAY;AAAA,EAEnC,UAAU,4BAAU,KAAK,YAAY;AAAA,EAErC,SAAS,4BAAU,QACjB,4BAAU,MAAM;AAAA,IACd,OAAO,4BAAU,UAAU,CAAC,4BAAU,QAAQ,4BAAU;AAAA,IACxD,OAAO,4BAAU,UAAU,CAAC,4BAAU,QAAQ,4BAAU;AAAA,MAE1D,YAAY;AAAA,EAEd,aAAa,4BAAU,OAAO,YAAY;AAAA,EAE1C,MAAM,4BAAU,QAAQ,4BAAU,KAAK,YAAY;AAAA,EAEnD,UAAU,4BAAU,KAAK,YAAY;AAAA,EAErC,oBAAoB,4BAAU,OAAO,YAAY;AAAA,EAEjD,aAAa,4BAAU,OAAO,YAAY;AAAA;AAGrC,MAAM,eAAe;AAAA,EAC1B,UAAU;AAAA,EACV,OAAO;AAAA,EACP,aAAa;AAAA,EACb,MAAM,0BAAW;AAAA,EACjB,QAAQ,MAAM;AAAA,EACd,UAAU,MAAM;AAAA,EAChB,UAAU,MAAM;AAAA,EAChB,gBAAgB;AAAA,EAChB,oBAAoB;AAAA,EACpB,aAAa;AAAA,EACb,SAAS;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import React2, { useState, useEffect, useRef, useCallback } from "react";
|
|
3
|
+
import { describe } from "react-desc";
|
|
4
|
+
import DSDropdownMenu from "@elliemae/ds-dropdownmenu";
|
|
5
|
+
import { DSInputMask } from "@elliemae/ds-form";
|
|
6
|
+
import { InputSearchWrapper } from "./components/blocks";
|
|
7
|
+
import { createDisabledOption, noAddonOptions } from "./components/helper";
|
|
8
|
+
import { zipcodeSearchProps, defaultProps } from "./props";
|
|
9
|
+
const DSZipCodeSearch = ({
|
|
10
|
+
disabled,
|
|
11
|
+
value,
|
|
12
|
+
placeholder,
|
|
13
|
+
mask,
|
|
14
|
+
onBlur,
|
|
15
|
+
onChange,
|
|
16
|
+
onSearch,
|
|
17
|
+
containerProps,
|
|
18
|
+
selectRightOptions,
|
|
19
|
+
activeCount,
|
|
20
|
+
options,
|
|
21
|
+
tabIndex
|
|
22
|
+
}) => {
|
|
23
|
+
const ref = useRef(null);
|
|
24
|
+
const [searchValue, setSearchValue] = useState(value);
|
|
25
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
26
|
+
const [isActive, setIsActive] = useState(false);
|
|
27
|
+
const [isInputFocus, setIsInputFocus] = useState(false);
|
|
28
|
+
const [isSelected, setIsSelected] = useState(false);
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
if (isInputFocus && activeCount <= searchValue.length && !isSelected) {
|
|
31
|
+
setIsOpen(true);
|
|
32
|
+
setIsActive(true);
|
|
33
|
+
} else if (!isActive || activeCount > searchValue.length) {
|
|
34
|
+
setIsOpen(false);
|
|
35
|
+
}
|
|
36
|
+
}, [isInputFocus, isActive, activeCount, searchValue, isSelected]);
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
setSearchValue(value || "");
|
|
39
|
+
}, [value]);
|
|
40
|
+
const onTypeInInput = useCallback((e) => {
|
|
41
|
+
const finalVal = e.target.value;
|
|
42
|
+
onSearch(finalVal);
|
|
43
|
+
setSearchValue(finalVal);
|
|
44
|
+
setIsSelected(false);
|
|
45
|
+
}, [onSearch]);
|
|
46
|
+
const onFocusInput = useCallback(() => {
|
|
47
|
+
setIsInputFocus(true);
|
|
48
|
+
}, []);
|
|
49
|
+
const onInnerBlur = useCallback((e) => {
|
|
50
|
+
setIsInputFocus(false);
|
|
51
|
+
onBlur(e);
|
|
52
|
+
}, [onBlur]);
|
|
53
|
+
const onClose = useCallback(() => {
|
|
54
|
+
setIsActive(false);
|
|
55
|
+
}, []);
|
|
56
|
+
const onSelectItem = useCallback((item) => {
|
|
57
|
+
setSearchValue(item.value);
|
|
58
|
+
onChange(item);
|
|
59
|
+
setIsSelected(true);
|
|
60
|
+
ref.current.focus();
|
|
61
|
+
setIsOpen(false);
|
|
62
|
+
onClose();
|
|
63
|
+
}, [onChange, onClose]);
|
|
64
|
+
return /* @__PURE__ */ React2.createElement(InputSearchWrapper, {
|
|
65
|
+
...containerProps
|
|
66
|
+
}, /* @__PURE__ */ React2.createElement(DSDropdownMenu, {
|
|
67
|
+
isOpen: isOpen && options.length > 0,
|
|
68
|
+
menuProps: { className: "input-search-menu" },
|
|
69
|
+
onClose,
|
|
70
|
+
onSelectMenuItem: onSelectItem,
|
|
71
|
+
contentStyle: {
|
|
72
|
+
maxHeight: 200
|
|
73
|
+
},
|
|
74
|
+
options: options.length > 0 ? [createDisabledOption(selectRightOptions), ...noAddonOptions(options)] : [],
|
|
75
|
+
triggerComponent: /* @__PURE__ */ React2.createElement("div", null, /* @__PURE__ */ React2.createElement(DSInputMask, {
|
|
76
|
+
disabled,
|
|
77
|
+
innerRef: (_ref) => ref.current = _ref,
|
|
78
|
+
mask,
|
|
79
|
+
onBlur: onInnerBlur,
|
|
80
|
+
onChange: onTypeInInput,
|
|
81
|
+
onFocus: onFocusInput,
|
|
82
|
+
placeholder,
|
|
83
|
+
value: searchValue,
|
|
84
|
+
tabIndex
|
|
85
|
+
}))
|
|
86
|
+
}));
|
|
87
|
+
};
|
|
88
|
+
DSZipCodeSearch.propTypes = zipcodeSearchProps;
|
|
89
|
+
DSZipCodeSearch.defaultProps = defaultProps;
|
|
90
|
+
const ZipCodeSearchWithSchema = describe(DSZipCodeSearch);
|
|
91
|
+
ZipCodeSearchWithSchema.propTypes = zipcodeSearchProps;
|
|
92
|
+
var DSZipCodeSearch_default = DSZipCodeSearch;
|
|
93
|
+
export {
|
|
94
|
+
DSZipCodeSearch,
|
|
95
|
+
ZipCodeSearchWithSchema,
|
|
96
|
+
DSZipCodeSearch_default as default
|
|
97
|
+
};
|
|
98
|
+
//# sourceMappingURL=DSZipCodeSearch.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/DSZipCodeSearch.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* 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"],
|
|
5
|
+
"mappings": "AAAA;ACGA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,MAAM,kBAAkB,CAAC;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,MACI;AACJ,QAAM,MAAM,OAAO;AACnB,QAAM,CAAC,aAAa,kBAAkB,SAAS;AAC/C,QAAM,CAAC,QAAQ,aAAa,SAAS;AACrC,QAAM,CAAC,UAAU,eAAe,SAAS;AACzC,QAAM,CAAC,cAAc,mBAAmB,SAAS;AACjD,QAAM,CAAC,YAAY,iBAAiB,SAAS;AAE7C,YAAU,MAAM;AACd,QAAI,gBAAgB,eAAe,YAAY,UAAU,CAAC,YAAY;AACpE,gBAAU;AACV,kBAAY;AAAA,eACH,CAAC,YAAY,cAAc,YAAY,QAAQ;AACxD,gBAAU;AAAA;AAAA,KAEX,CAAC,cAAc,UAAU,aAAa,aAAa;AACtD,YAAU,MAAM;AACd,mBAAe,SAAS;AAAA,KACvB,CAAC;AAEJ,QAAM,gBAAgB,YACpB,CAAC,MAAM;AACL,UAAM,WAAW,EAAE,OAAO;AAC1B,aAAS;AACT,mBAAe;AACf,kBAAc;AAAA,KAEhB,CAAC;AAGH,QAAM,eAAe,YAAY,MAAM;AACrC,oBAAgB;AAAA,KACf;AAEH,QAAM,cAAc,YAClB,CAAC,MAAM;AACL,oBAAgB;AAChB,WAAO;AAAA,KAET,CAAC;AAEH,QAAM,UAAU,YAAY,MAAM;AAChC,gBAAY;AAAA,KACX;AACH,QAAM,eAAe,YACnB,CAAC,SAAS;AACR,mBAAe,KAAK;AACpB,aAAS;AACT,kBAAc;AACd,QAAI,QAAQ;AACZ,cAAU;AACV;AAAA,KAEF,CAAC,UAAU;AAGb,SACE,qCAAC,oBAAD;AAAA,OAAwB;AAAA,KACtB,qCAAC,gBAAD;AAAA,IACE,QAAQ,UAAU,QAAQ,SAAS;AAAA,IACnC,WAAW,EAAE,WAAW;AAAA,IACxB;AAAA,IACA,kBAAkB;AAAA,IAClB,cAAc;AAAA,MACZ,WAAW;AAAA;AAAA,IAEb,SAAS,QAAQ,SAAS,IAAI,CAAC,qBAAqB,qBAAqB,GAAG,eAAe,YAAY;AAAA,IACvG,kBACE,qCAAC,OAAD,MACE,qCAAC,aAAD;AAAA,MACE;AAAA,MACA,UAAU,CAAC,SAAU,IAAI,UAAU;AAAA,MACnC;AAAA,MACA,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,SAAS;AAAA,MACT;AAAA,MACA,OAAO;AAAA,MACP;AAAA;AAAA;AAAA;AASd,gBAAgB,YAAY;AAE5B,gBAAgB,eAAe;AAE/B,MAAM,0BAA0B,SAAS;AACzC,wBAAwB,YAAY;AAGpC,IAAO,0BAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { aggregatedClasses } from "@elliemae/ds-classnames";
|
|
3
|
+
const blockName = "input-search";
|
|
4
|
+
const InputSearchWrapper = aggregatedClasses("div")(blockName);
|
|
5
|
+
export {
|
|
6
|
+
InputSearchWrapper
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=blocks.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/components/blocks.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { aggregatedClasses } from '@elliemae/ds-classnames';\n\nconst blockName = 'input-search';\n\nexport const InputSearchWrapper = aggregatedClasses('div')(blockName);\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AAEA,MAAM,YAAY;AAEX,MAAM,qBAAqB,kBAAkB,OAAO;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
function createDisabledOption(label) {
|
|
3
|
+
return {
|
|
4
|
+
id: "no-option",
|
|
5
|
+
type: "disabled",
|
|
6
|
+
label,
|
|
7
|
+
noAddon: true,
|
|
8
|
+
"aria-disabled": true,
|
|
9
|
+
className: "no-options",
|
|
10
|
+
tabIndex: -1
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
function noAddonOptions(options) {
|
|
14
|
+
return options.map((op) => ({ ...op, noAddon: true }));
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
createDisabledOption,
|
|
18
|
+
noAddonOptions
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=helper.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/components/helper.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "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"],
|
|
5
|
+
"mappings": "AAAA;ACAO,8BAA8B,OAAO;AAC1C,SAAO;AAAA,IACL,IAAI;AAAA,IACJ,MAAM;AAAA,IACN;AAAA,IACA,SAAS;AAAA,IACT,iBAAiB;AAAA,IACjB,WAAW;AAAA,IACX,UAAU;AAAA;AAAA;AAIP,wBAAwB,SAAS;AACtC,SAAO,QAAQ,IAAI,QAAO,MAAK,IAAI,SAAS;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/index.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export * from './DSZipCodeSearch';\n\nexport { default } from './DSZipCodeSearch';\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AAEA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { PropTypes } from "react-desc";
|
|
3
|
+
import { MASK_TYPES } from "@elliemae/ds-form";
|
|
4
|
+
const zipcodeSearchProps = {
|
|
5
|
+
className: PropTypes.string.description("html class attribute"),
|
|
6
|
+
containerProps: PropTypes.object.description("Set of Properties attached to the main container"),
|
|
7
|
+
tabIndex: PropTypes.number.description("native tabindex property to handle focus order"),
|
|
8
|
+
disabled: PropTypes.bool.description("disable component"),
|
|
9
|
+
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.object]).description("input value").isRequired,
|
|
10
|
+
onBlur: PropTypes.func.description("function called on blur"),
|
|
11
|
+
onChange: PropTypes.func.description("function called on change"),
|
|
12
|
+
options: PropTypes.arrayOf(PropTypes.shape({
|
|
13
|
+
label: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
14
|
+
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
|
15
|
+
})).description("options to display"),
|
|
16
|
+
placeholder: PropTypes.string.description("placeholder value"),
|
|
17
|
+
mask: PropTypes.arrayOf(PropTypes.any).description("format mask to apply"),
|
|
18
|
+
onSearch: PropTypes.func.description("function called onsearch"),
|
|
19
|
+
selectRightOptions: PropTypes.string.description("Correction messange"),
|
|
20
|
+
activeCount: PropTypes.number.description("current amount")
|
|
21
|
+
};
|
|
22
|
+
const defaultProps = {
|
|
23
|
+
disabled: false,
|
|
24
|
+
value: "",
|
|
25
|
+
placeholder: "_____-____",
|
|
26
|
+
mask: MASK_TYPES.ZIP_CODE_SEARCH,
|
|
27
|
+
onBlur: () => null,
|
|
28
|
+
onChange: () => null,
|
|
29
|
+
onSearch: () => null,
|
|
30
|
+
containerProps: {},
|
|
31
|
+
selectRightOptions: "Please select the appropriate city",
|
|
32
|
+
activeCount: 5,
|
|
33
|
+
options: []
|
|
34
|
+
};
|
|
35
|
+
export {
|
|
36
|
+
defaultProps,
|
|
37
|
+
zipcodeSearchProps
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=props.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/props.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "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"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AACA;AAEO,MAAM,qBAAqB;AAAA,EAEhC,WAAW,UAAU,OAAO,YAAY;AAAA,EAExC,gBAAgB,UAAU,OAAO,YAAY;AAAA,EAE7C,UAAU,UAAU,OAAO,YAAY;AAAA,EAEvC,UAAU,UAAU,KAAK,YAAY;AAAA,EAErC,OAAO,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,QAAQ,UAAU,SAAS,YAAY,eAC5F;AAAA,EAEH,QAAQ,UAAU,KAAK,YAAY;AAAA,EAEnC,UAAU,UAAU,KAAK,YAAY;AAAA,EAErC,SAAS,UAAU,QACjB,UAAU,MAAM;AAAA,IACd,OAAO,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU;AAAA,IACxD,OAAO,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU;AAAA,MAE1D,YAAY;AAAA,EAEd,aAAa,UAAU,OAAO,YAAY;AAAA,EAE1C,MAAM,UAAU,QAAQ,UAAU,KAAK,YAAY;AAAA,EAEnD,UAAU,UAAU,KAAK,YAAY;AAAA,EAErC,oBAAoB,UAAU,OAAO,YAAY;AAAA,EAEjD,aAAa,UAAU,OAAO,YAAY;AAAA;AAGrC,MAAM,eAAe;AAAA,EAC1B,UAAU;AAAA,EACV,OAAO;AAAA,EACP,aAAa;AAAA,EACb,MAAM,WAAW;AAAA,EACjB,QAAQ,MAAM;AAAA,EACd,UAAU,MAAM;AAAA,EAChB,UAAU,MAAM;AAAA,EAChB,gBAAgB;AAAA,EAChB,oBAAoB;AAAA,EACpB,aAAa;AAAA,EACb,SAAS;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,31 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-zipcode-search",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-alpha.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Zipcode Search",
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
"files": [
|
|
7
|
+
"dist"
|
|
8
|
+
],
|
|
9
|
+
"module": "./dist/esm/index.js",
|
|
10
|
+
"main": "./dist/cjs/index.js",
|
|
11
|
+
"types": "./dist/types/index.d.ts",
|
|
9
12
|
"exports": {
|
|
10
13
|
".": {
|
|
11
|
-
"import": "./esm/index.js",
|
|
12
|
-
"require": "./cjs/index.js"
|
|
14
|
+
"import": "./dist/esm/index.js",
|
|
15
|
+
"require": "./dist/cjs/index.js"
|
|
13
16
|
},
|
|
14
17
|
"./props": {
|
|
15
|
-
"import": "./esm/props.js",
|
|
16
|
-
"require": "./cjs/props.js"
|
|
18
|
+
"import": "./dist/esm/props.js",
|
|
19
|
+
"require": "./dist/cjs/props.js"
|
|
17
20
|
},
|
|
18
21
|
"./DSZipCodeSearch": {
|
|
19
|
-
"import": "./esm/DSZipCodeSearch.js",
|
|
20
|
-
"require": "./cjs/DSZipCodeSearch.js"
|
|
22
|
+
"import": "./dist/esm/DSZipCodeSearch.js",
|
|
23
|
+
"require": "./dist/cjs/DSZipCodeSearch.js"
|
|
21
24
|
},
|
|
22
25
|
"./components/helper": {
|
|
23
|
-
"import": "./esm/components/helper.js",
|
|
24
|
-
"require": "./cjs/components/helper.js"
|
|
26
|
+
"import": "./dist/esm/components/helper.js",
|
|
27
|
+
"require": "./dist/cjs/components/helper.js"
|
|
25
28
|
},
|
|
26
29
|
"./components/blocks": {
|
|
27
|
-
"import": "./esm/components/blocks.js",
|
|
28
|
-
"require": "./cjs/components/blocks.js"
|
|
30
|
+
"import": "./dist/esm/components/blocks.js",
|
|
31
|
+
"require": "./dist/cjs/components/blocks.js"
|
|
29
32
|
}
|
|
30
33
|
},
|
|
31
34
|
"sideEffects": [
|
|
@@ -37,24 +40,24 @@
|
|
|
37
40
|
"url": "https://git.elliemae.io/platform-ui/dimsum.git"
|
|
38
41
|
},
|
|
39
42
|
"engines": {
|
|
40
|
-
"
|
|
41
|
-
"node": ">=
|
|
43
|
+
"pnpm": ">=6",
|
|
44
|
+
"node": ">=16"
|
|
42
45
|
},
|
|
43
46
|
"author": "ICE MT",
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
47
|
+
"jestSonar": {
|
|
48
|
+
"sonar56x": true,
|
|
49
|
+
"reportPath": "reports",
|
|
50
|
+
"reportFile": "tests.xml",
|
|
51
|
+
"indent": 4
|
|
49
52
|
},
|
|
50
53
|
"dependencies": {
|
|
51
|
-
"@elliemae/ds-classnames": "
|
|
52
|
-
"@elliemae/ds-dropdownmenu": "
|
|
53
|
-
"@elliemae/ds-form": "
|
|
54
|
+
"@elliemae/ds-classnames": "3.0.0-alpha.0",
|
|
55
|
+
"@elliemae/ds-dropdownmenu": "3.0.0-alpha.0",
|
|
56
|
+
"@elliemae/ds-form": "3.0.0-alpha.0",
|
|
54
57
|
"react-desc": "~4.1.3"
|
|
55
58
|
},
|
|
56
59
|
"devDependencies": {
|
|
57
|
-
"@testing-library/jest-dom": "~5.15.
|
|
60
|
+
"@testing-library/jest-dom": "~5.15.1",
|
|
58
61
|
"@testing-library/react": "~12.1.2",
|
|
59
62
|
"@testing-library/user-event": "~13.5.0"
|
|
60
63
|
},
|
|
@@ -64,7 +67,12 @@
|
|
|
64
67
|
},
|
|
65
68
|
"publishConfig": {
|
|
66
69
|
"access": "public",
|
|
67
|
-
"
|
|
68
|
-
|
|
70
|
+
"typeSafety": false
|
|
71
|
+
},
|
|
72
|
+
"scripts": {
|
|
73
|
+
"dev": "cross-env NODE_ENV=development node ../../scripts/build/build.mjs --watch",
|
|
74
|
+
"test": "node ../../scripts/testing/test.mjs",
|
|
75
|
+
"lint": "node ../../scripts/lint.mjs",
|
|
76
|
+
"build": "cross-env NODE_ENV=production node ../../scripts/build/build.mjs"
|
|
69
77
|
}
|
|
70
78
|
}
|
package/cjs/DSZipCodeSearch.js
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
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');
|
|
14
|
-
var reactDesc = require('react-desc');
|
|
15
|
-
var DSDropdownMenu = require('@elliemae/ds-dropdownmenu');
|
|
16
|
-
var dsForm = require('@elliemae/ds-form');
|
|
17
|
-
var blocks = require('./components/blocks.js');
|
|
18
|
-
var helper = require('./components/helper.js');
|
|
19
|
-
var props = require('./props.js');
|
|
20
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
21
|
-
|
|
22
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
23
|
-
|
|
24
|
-
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
25
|
-
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
26
|
-
var DSDropdownMenu__default = /*#__PURE__*/_interopDefaultLegacy(DSDropdownMenu);
|
|
27
|
-
|
|
28
|
-
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; }
|
|
29
|
-
|
|
30
|
-
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; }
|
|
31
|
-
|
|
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(() => {
|
|
54
|
-
if (isInputFocus && activeCount <= searchValue.length && !isSelected) {
|
|
55
|
-
setIsOpen(true);
|
|
56
|
-
setIsActive(true);
|
|
57
|
-
} else if (!isActive || activeCount > searchValue.length) {
|
|
58
|
-
setIsOpen(false);
|
|
59
|
-
}
|
|
60
|
-
}, [isInputFocus, isActive, activeCount, searchValue, isSelected]);
|
|
61
|
-
react.useEffect(() => {
|
|
62
|
-
setSearchValue(value || '');
|
|
63
|
-
}, [value]);
|
|
64
|
-
const onTypeInInput = react.useCallback(e => {
|
|
65
|
-
const finalVal = e.target.value;
|
|
66
|
-
onSearch(finalVal);
|
|
67
|
-
setSearchValue(finalVal);
|
|
68
|
-
setIsSelected(false);
|
|
69
|
-
}, [onSearch]);
|
|
70
|
-
const onFocusInput = react.useCallback(() => {
|
|
71
|
-
setIsInputFocus(true);
|
|
72
|
-
}, []);
|
|
73
|
-
const onInnerBlur = react.useCallback(e => {
|
|
74
|
-
setIsInputFocus(false);
|
|
75
|
-
onBlur(e);
|
|
76
|
-
}, [onBlur]);
|
|
77
|
-
const onClose = react.useCallback(() => {
|
|
78
|
-
setIsActive(false);
|
|
79
|
-
}, []);
|
|
80
|
-
const onSelectItem = react.useCallback(item => {
|
|
81
|
-
setSearchValue(item.value);
|
|
82
|
-
onChange(item);
|
|
83
|
-
setIsSelected(true);
|
|
84
|
-
ref.current.focus();
|
|
85
|
-
setIsOpen(false);
|
|
86
|
-
onClose();
|
|
87
|
-
}, [onChange, onClose]);
|
|
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
|
|
98
|
-
},
|
|
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
|
-
})
|
|
112
|
-
}));
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
DSZipCodeSearch.defaultProps = props.defaultProps;
|
|
116
|
-
const ZipCodeSearchWithSchema = reactDesc.describe(DSZipCodeSearch);
|
|
117
|
-
ZipCodeSearchWithSchema.propTypes = props.zipcodeSearchProps;
|
|
118
|
-
|
|
119
|
-
exports.DSZipCodeSearch = DSZipCodeSearch;
|
|
120
|
-
exports.ZipCodeSearchWithSchema = ZipCodeSearchWithSchema;
|
|
121
|
-
exports["default"] = DSZipCodeSearch;
|
package/cjs/components/blocks.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var dsClassnames = require('@elliemae/ds-classnames');
|
|
6
|
-
|
|
7
|
-
const blockName = 'input-search';
|
|
8
|
-
const InputSearchWrapper = dsClassnames.aggregatedClasses('div')(blockName);
|
|
9
|
-
|
|
10
|
-
exports.InputSearchWrapper = InputSearchWrapper;
|
package/cjs/components/helper.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
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');
|
|
13
|
-
|
|
14
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
15
|
-
|
|
16
|
-
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
17
|
-
|
|
18
|
-
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; }
|
|
19
|
-
|
|
20
|
-
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; }
|
|
21
|
-
function createDisabledOption(label) {
|
|
22
|
-
return {
|
|
23
|
-
id: 'no-option',
|
|
24
|
-
type: 'disabled',
|
|
25
|
-
label,
|
|
26
|
-
noAddon: true,
|
|
27
|
-
'aria-disabled': true,
|
|
28
|
-
className: 'no-options',
|
|
29
|
-
tabIndex: -1
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
function noAddonOptions(options) {
|
|
33
|
-
return options.map(op => _objectSpread(_objectSpread({}, op), {}, {
|
|
34
|
-
noAddon: true
|
|
35
|
-
}));
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
exports.createDisabledOption = createDisabledOption;
|
|
39
|
-
exports.noAddonOptions = noAddonOptions;
|
package/cjs/index.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var DSZipCodeSearch = require('./DSZipCodeSearch.js');
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
exports.DSZipCodeSearch = DSZipCodeSearch.DSZipCodeSearch;
|
|
10
|
-
exports.ZipCodeSearchWithSchema = DSZipCodeSearch.ZipCodeSearchWithSchema;
|
|
11
|
-
exports["default"] = DSZipCodeSearch.DSZipCodeSearch;
|
package/cjs/props.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var reactDesc = require('react-desc');
|
|
6
|
-
var dsForm = require('@elliemae/ds-form');
|
|
7
|
-
|
|
8
|
-
const zipcodeSearchProps = {
|
|
9
|
-
/** html class attribute */
|
|
10
|
-
className: reactDesc.PropTypes.string.description('html class attribute'),
|
|
11
|
-
|
|
12
|
-
/** Set of Properties attached to the main container */
|
|
13
|
-
containerProps: reactDesc.PropTypes.object.description('Set of Properties attached to the main container'),
|
|
14
|
-
|
|
15
|
-
/** native tabindex property to handle focus order */
|
|
16
|
-
tabIndex: reactDesc.PropTypes.number.description('native tabindex property to handle focus order'),
|
|
17
|
-
|
|
18
|
-
/** disable component */
|
|
19
|
-
disabled: reactDesc.PropTypes.bool.description('disable component'),
|
|
20
|
-
|
|
21
|
-
/** input value */
|
|
22
|
-
value: reactDesc.PropTypes.oneOfType([reactDesc.PropTypes.string, reactDesc.PropTypes.number, reactDesc.PropTypes.object]).description('input value').isRequired,
|
|
23
|
-
|
|
24
|
-
/** function called on blur */
|
|
25
|
-
onBlur: reactDesc.PropTypes.func.description('function called on blur'),
|
|
26
|
-
|
|
27
|
-
/** function called on change */
|
|
28
|
-
onChange: reactDesc.PropTypes.func.description('function called on change'),
|
|
29
|
-
|
|
30
|
-
/** options to display */
|
|
31
|
-
options: reactDesc.PropTypes.arrayOf(reactDesc.PropTypes.shape({
|
|
32
|
-
label: reactDesc.PropTypes.oneOfType([reactDesc.PropTypes.string, reactDesc.PropTypes.number]),
|
|
33
|
-
value: reactDesc.PropTypes.oneOfType([reactDesc.PropTypes.string, reactDesc.PropTypes.number])
|
|
34
|
-
})).description('options to display'),
|
|
35
|
-
|
|
36
|
-
/** placeholder value */
|
|
37
|
-
placeholder: reactDesc.PropTypes.string.description('placeholder value'),
|
|
38
|
-
|
|
39
|
-
/** format mask to apply */
|
|
40
|
-
mask: reactDesc.PropTypes.arrayOf(reactDesc.PropTypes.any).description('format mask to apply'),
|
|
41
|
-
|
|
42
|
-
/** function called onsearch */
|
|
43
|
-
onSearch: reactDesc.PropTypes.func.description('function called onsearch'),
|
|
44
|
-
|
|
45
|
-
/** Correction messange */
|
|
46
|
-
selectRightOptions: reactDesc.PropTypes.string.description('Correction messange'),
|
|
47
|
-
|
|
48
|
-
/** current amount */
|
|
49
|
-
activeCount: reactDesc.PropTypes.number.description('current amount')
|
|
50
|
-
};
|
|
51
|
-
const defaultProps = {
|
|
52
|
-
disabled: false,
|
|
53
|
-
value: '',
|
|
54
|
-
placeholder: '_____-____',
|
|
55
|
-
mask: dsForm.MASK_TYPES.ZIP_CODE_SEARCH,
|
|
56
|
-
onBlur: () => null,
|
|
57
|
-
onChange: () => null,
|
|
58
|
-
onSearch: () => null,
|
|
59
|
-
containerProps: {},
|
|
60
|
-
selectRightOptions: 'Please select the appropriate city',
|
|
61
|
-
activeCount: 5,
|
|
62
|
-
options: []
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
exports.defaultProps = defaultProps;
|
|
66
|
-
exports.zipcodeSearchProps = zipcodeSearchProps;
|
package/esm/DSZipCodeSearch.js
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
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';
|
|
10
|
-
import { describe } from 'react-desc';
|
|
11
|
-
import DSDropdownMenu from '@elliemae/ds-dropdownmenu';
|
|
12
|
-
import { DSInputMask } from '@elliemae/ds-form';
|
|
13
|
-
import { InputSearchWrapper } from './components/blocks.js';
|
|
14
|
-
import { createDisabledOption, noAddonOptions } from './components/helper.js';
|
|
15
|
-
import { zipcodeSearchProps, defaultProps } from './props.js';
|
|
16
|
-
import { jsx } from 'react/jsx-runtime';
|
|
17
|
-
|
|
18
|
-
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; }
|
|
19
|
-
|
|
20
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
21
|
-
|
|
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(() => {
|
|
44
|
-
if (isInputFocus && activeCount <= searchValue.length && !isSelected) {
|
|
45
|
-
setIsOpen(true);
|
|
46
|
-
setIsActive(true);
|
|
47
|
-
} else if (!isActive || activeCount > searchValue.length) {
|
|
48
|
-
setIsOpen(false);
|
|
49
|
-
}
|
|
50
|
-
}, [isInputFocus, isActive, activeCount, searchValue, isSelected]);
|
|
51
|
-
useEffect(() => {
|
|
52
|
-
setSearchValue(value || '');
|
|
53
|
-
}, [value]);
|
|
54
|
-
const onTypeInInput = useCallback(e => {
|
|
55
|
-
const finalVal = e.target.value;
|
|
56
|
-
onSearch(finalVal);
|
|
57
|
-
setSearchValue(finalVal);
|
|
58
|
-
setIsSelected(false);
|
|
59
|
-
}, [onSearch]);
|
|
60
|
-
const onFocusInput = useCallback(() => {
|
|
61
|
-
setIsInputFocus(true);
|
|
62
|
-
}, []);
|
|
63
|
-
const onInnerBlur = useCallback(e => {
|
|
64
|
-
setIsInputFocus(false);
|
|
65
|
-
onBlur(e);
|
|
66
|
-
}, [onBlur]);
|
|
67
|
-
const onClose = useCallback(() => {
|
|
68
|
-
setIsActive(false);
|
|
69
|
-
}, []);
|
|
70
|
-
const onSelectItem = useCallback(item => {
|
|
71
|
-
setSearchValue(item.value);
|
|
72
|
-
onChange(item);
|
|
73
|
-
setIsSelected(true);
|
|
74
|
-
ref.current.focus();
|
|
75
|
-
setIsOpen(false);
|
|
76
|
-
onClose();
|
|
77
|
-
}, [onChange, onClose]);
|
|
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
|
|
88
|
-
},
|
|
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
|
-
})
|
|
102
|
-
}));
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
DSZipCodeSearch.defaultProps = defaultProps;
|
|
106
|
-
const ZipCodeSearchWithSchema = describe(DSZipCodeSearch);
|
|
107
|
-
ZipCodeSearchWithSchema.propTypes = zipcodeSearchProps;
|
|
108
|
-
|
|
109
|
-
export { DSZipCodeSearch, ZipCodeSearchWithSchema, DSZipCodeSearch as default };
|
package/esm/components/blocks.js
DELETED
package/esm/components/helper.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
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';
|
|
9
|
-
|
|
10
|
-
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; }
|
|
11
|
-
|
|
12
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
13
|
-
function createDisabledOption(label) {
|
|
14
|
-
return {
|
|
15
|
-
id: 'no-option',
|
|
16
|
-
type: 'disabled',
|
|
17
|
-
label,
|
|
18
|
-
noAddon: true,
|
|
19
|
-
'aria-disabled': true,
|
|
20
|
-
className: 'no-options',
|
|
21
|
-
tabIndex: -1
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
function noAddonOptions(options) {
|
|
25
|
-
return options.map(op => _objectSpread(_objectSpread({}, op), {}, {
|
|
26
|
-
noAddon: true
|
|
27
|
-
}));
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export { createDisabledOption, noAddonOptions };
|
package/esm/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { DSZipCodeSearch, ZipCodeSearchWithSchema, DSZipCodeSearch as default } from './DSZipCodeSearch.js';
|
package/esm/props.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { PropTypes } from 'react-desc';
|
|
2
|
-
import { MASK_TYPES } from '@elliemae/ds-form';
|
|
3
|
-
|
|
4
|
-
const zipcodeSearchProps = {
|
|
5
|
-
/** html class attribute */
|
|
6
|
-
className: PropTypes.string.description('html class attribute'),
|
|
7
|
-
|
|
8
|
-
/** Set of Properties attached to the main container */
|
|
9
|
-
containerProps: PropTypes.object.description('Set of Properties attached to the main container'),
|
|
10
|
-
|
|
11
|
-
/** native tabindex property to handle focus order */
|
|
12
|
-
tabIndex: PropTypes.number.description('native tabindex property to handle focus order'),
|
|
13
|
-
|
|
14
|
-
/** disable component */
|
|
15
|
-
disabled: PropTypes.bool.description('disable component'),
|
|
16
|
-
|
|
17
|
-
/** input value */
|
|
18
|
-
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.object]).description('input value').isRequired,
|
|
19
|
-
|
|
20
|
-
/** function called on blur */
|
|
21
|
-
onBlur: PropTypes.func.description('function called on blur'),
|
|
22
|
-
|
|
23
|
-
/** function called on change */
|
|
24
|
-
onChange: PropTypes.func.description('function called on change'),
|
|
25
|
-
|
|
26
|
-
/** options to display */
|
|
27
|
-
options: PropTypes.arrayOf(PropTypes.shape({
|
|
28
|
-
label: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
29
|
-
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
|
30
|
-
})).description('options to display'),
|
|
31
|
-
|
|
32
|
-
/** placeholder value */
|
|
33
|
-
placeholder: PropTypes.string.description('placeholder value'),
|
|
34
|
-
|
|
35
|
-
/** format mask to apply */
|
|
36
|
-
mask: PropTypes.arrayOf(PropTypes.any).description('format mask to apply'),
|
|
37
|
-
|
|
38
|
-
/** function called onsearch */
|
|
39
|
-
onSearch: PropTypes.func.description('function called onsearch'),
|
|
40
|
-
|
|
41
|
-
/** Correction messange */
|
|
42
|
-
selectRightOptions: PropTypes.string.description('Correction messange'),
|
|
43
|
-
|
|
44
|
-
/** current amount */
|
|
45
|
-
activeCount: PropTypes.number.description('current amount')
|
|
46
|
-
};
|
|
47
|
-
const defaultProps = {
|
|
48
|
-
disabled: false,
|
|
49
|
-
value: '',
|
|
50
|
-
placeholder: '_____-____',
|
|
51
|
-
mask: MASK_TYPES.ZIP_CODE_SEARCH,
|
|
52
|
-
onBlur: () => null,
|
|
53
|
-
onChange: () => null,
|
|
54
|
-
onSearch: () => null,
|
|
55
|
-
containerProps: {},
|
|
56
|
-
selectRightOptions: 'Please select the appropriate city',
|
|
57
|
-
activeCount: 5,
|
|
58
|
-
options: []
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export { defaultProps, zipcodeSearchProps };
|