@elliemae/ds-zipcode-search 3.0.0-next.2 → 3.0.0-next.6
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 +139 -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 +66 -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 +112 -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 +39 -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/package.json +36 -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
- package/types/DSZipCodeSearch.d.ts +0 -126
- package/types/components/blocks.d.ts +0 -2
- package/types/components/helper.d.ts +0 -10
- package/types/index.d.ts +0 -2
- package/types/props.d.ts +0 -102
- package/types/tests/DSZipCodeSearch.test.d.ts +0 -1
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
+
var __spreadValues = (a, b) => {
|
|
11
|
+
for (var prop in b || (b = {}))
|
|
12
|
+
if (__hasOwnProp.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
if (__getOwnPropSymbols)
|
|
15
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
+
if (__propIsEnum.call(b, prop))
|
|
17
|
+
__defNormalProp(a, prop, b[prop]);
|
|
18
|
+
}
|
|
19
|
+
return a;
|
|
20
|
+
};
|
|
21
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
22
|
+
var __export = (target, all) => {
|
|
23
|
+
for (var name in all)
|
|
24
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
25
|
+
};
|
|
26
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
27
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
28
|
+
for (let key of __getOwnPropNames(module2))
|
|
29
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
30
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
31
|
+
}
|
|
32
|
+
return target;
|
|
33
|
+
};
|
|
34
|
+
var __toESM = (module2, isNodeMode) => {
|
|
35
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
36
|
+
};
|
|
37
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
38
|
+
return (module2, temp) => {
|
|
39
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
40
|
+
};
|
|
41
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
42
|
+
var DSZipCodeSearch_exports = {};
|
|
43
|
+
__export(DSZipCodeSearch_exports, {
|
|
44
|
+
DSZipCodeSearch: () => DSZipCodeSearch,
|
|
45
|
+
ZipCodeSearchWithSchema: () => ZipCodeSearchWithSchema,
|
|
46
|
+
default: () => DSZipCodeSearch_default
|
|
47
|
+
});
|
|
48
|
+
var React = __toESM(require("react"));
|
|
49
|
+
var import_react = __toESM(require("react"));
|
|
50
|
+
var import_react_desc = require("react-desc");
|
|
51
|
+
var import_ds_dropdownmenu = __toESM(require("@elliemae/ds-dropdownmenu"));
|
|
52
|
+
var import_ds_form = require("@elliemae/ds-form");
|
|
53
|
+
var import_blocks = require("./components/blocks");
|
|
54
|
+
var import_helper = require("./components/helper");
|
|
55
|
+
var import_props = require("./props");
|
|
56
|
+
const DSZipCodeSearch = ({
|
|
57
|
+
disabled,
|
|
58
|
+
value,
|
|
59
|
+
placeholder,
|
|
60
|
+
mask,
|
|
61
|
+
onBlur,
|
|
62
|
+
onChange,
|
|
63
|
+
onSearch,
|
|
64
|
+
containerProps,
|
|
65
|
+
selectRightOptions,
|
|
66
|
+
activeCount,
|
|
67
|
+
options,
|
|
68
|
+
tabIndex
|
|
69
|
+
}) => {
|
|
70
|
+
const ref = (0, import_react.useRef)(null);
|
|
71
|
+
const [searchValue, setSearchValue] = (0, import_react.useState)(value);
|
|
72
|
+
const [isOpen, setIsOpen] = (0, import_react.useState)(false);
|
|
73
|
+
const [isActive, setIsActive] = (0, import_react.useState)(false);
|
|
74
|
+
const [isInputFocus, setIsInputFocus] = (0, import_react.useState)(false);
|
|
75
|
+
const [isSelected, setIsSelected] = (0, import_react.useState)(false);
|
|
76
|
+
(0, import_react.useEffect)(() => {
|
|
77
|
+
if (isInputFocus && activeCount <= searchValue.length && !isSelected) {
|
|
78
|
+
setIsOpen(true);
|
|
79
|
+
setIsActive(true);
|
|
80
|
+
} else if (!isActive || activeCount > searchValue.length) {
|
|
81
|
+
setIsOpen(false);
|
|
82
|
+
}
|
|
83
|
+
}, [isInputFocus, isActive, activeCount, searchValue, isSelected]);
|
|
84
|
+
(0, import_react.useEffect)(() => {
|
|
85
|
+
setSearchValue(value || "");
|
|
86
|
+
}, [value]);
|
|
87
|
+
const onTypeInInput = (0, import_react.useCallback)((e) => {
|
|
88
|
+
const finalVal = e.target.value;
|
|
89
|
+
onSearch(finalVal);
|
|
90
|
+
setSearchValue(finalVal);
|
|
91
|
+
setIsSelected(false);
|
|
92
|
+
}, [onSearch]);
|
|
93
|
+
const onFocusInput = (0, import_react.useCallback)(() => {
|
|
94
|
+
setIsInputFocus(true);
|
|
95
|
+
}, []);
|
|
96
|
+
const onInnerBlur = (0, import_react.useCallback)((e) => {
|
|
97
|
+
setIsInputFocus(false);
|
|
98
|
+
onBlur(e);
|
|
99
|
+
}, [onBlur]);
|
|
100
|
+
const onClose = (0, import_react.useCallback)(() => {
|
|
101
|
+
setIsActive(false);
|
|
102
|
+
}, []);
|
|
103
|
+
const onSelectItem = (0, import_react.useCallback)((item) => {
|
|
104
|
+
setSearchValue(item.value);
|
|
105
|
+
onChange(item);
|
|
106
|
+
setIsSelected(true);
|
|
107
|
+
ref.current.focus();
|
|
108
|
+
setIsOpen(false);
|
|
109
|
+
onClose();
|
|
110
|
+
}, [onChange, onClose]);
|
|
111
|
+
return /* @__PURE__ */ import_react.default.createElement(import_blocks.InputSearchWrapper, __spreadValues({}, containerProps), /* @__PURE__ */ import_react.default.createElement(import_ds_dropdownmenu.default, {
|
|
112
|
+
isOpen: isOpen && options.length > 0,
|
|
113
|
+
menuProps: { className: "input-search-menu" },
|
|
114
|
+
onClose,
|
|
115
|
+
onSelectMenuItem: onSelectItem,
|
|
116
|
+
contentStyle: {
|
|
117
|
+
maxHeight: 200
|
|
118
|
+
},
|
|
119
|
+
options: options.length > 0 ? [(0, import_helper.createDisabledOption)(selectRightOptions), ...(0, import_helper.noAddonOptions)(options)] : [],
|
|
120
|
+
triggerComponent: /* @__PURE__ */ import_react.default.createElement("div", null, /* @__PURE__ */ import_react.default.createElement(import_ds_form.DSInputMask, {
|
|
121
|
+
disabled,
|
|
122
|
+
innerRef: (_ref) => ref.current = _ref,
|
|
123
|
+
mask,
|
|
124
|
+
onBlur: onInnerBlur,
|
|
125
|
+
onChange: onTypeInInput,
|
|
126
|
+
onFocus: onFocusInput,
|
|
127
|
+
placeholder,
|
|
128
|
+
value: searchValue,
|
|
129
|
+
tabIndex
|
|
130
|
+
}))
|
|
131
|
+
}));
|
|
132
|
+
};
|
|
133
|
+
DSZipCodeSearch.propTypes = import_props.zipcodeSearchProps;
|
|
134
|
+
DSZipCodeSearch.defaultProps = import_props.defaultProps;
|
|
135
|
+
const ZipCodeSearchWithSchema = (0, import_react_desc.describe)(DSZipCodeSearch);
|
|
136
|
+
ZipCodeSearchWithSchema.propTypes = import_props.zipcodeSearchProps;
|
|
137
|
+
var DSZipCodeSearch_default = DSZipCodeSearch;
|
|
138
|
+
module.exports = __toCommonJS(DSZipCodeSearch_exports);
|
|
139
|
+
//# 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,mBAAwB,iBACtB,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,66 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
+
var __spreadValues = (a, b) => {
|
|
13
|
+
for (var prop in b || (b = {}))
|
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
if (__getOwnPropSymbols)
|
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
+
if (__propIsEnum.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
}
|
|
21
|
+
return a;
|
|
22
|
+
};
|
|
23
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
25
|
+
var __export = (target, all) => {
|
|
26
|
+
for (var name in all)
|
|
27
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
28
|
+
};
|
|
29
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
30
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
31
|
+
for (let key of __getOwnPropNames(module2))
|
|
32
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
33
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
34
|
+
}
|
|
35
|
+
return target;
|
|
36
|
+
};
|
|
37
|
+
var __toESM = (module2, isNodeMode) => {
|
|
38
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
39
|
+
};
|
|
40
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
41
|
+
return (module2, temp) => {
|
|
42
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
43
|
+
};
|
|
44
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
45
|
+
var helper_exports = {};
|
|
46
|
+
__export(helper_exports, {
|
|
47
|
+
createDisabledOption: () => createDisabledOption,
|
|
48
|
+
noAddonOptions: () => noAddonOptions
|
|
49
|
+
});
|
|
50
|
+
var React = __toESM(require("react"));
|
|
51
|
+
function createDisabledOption(label) {
|
|
52
|
+
return {
|
|
53
|
+
id: "no-option",
|
|
54
|
+
type: "disabled",
|
|
55
|
+
label,
|
|
56
|
+
noAddon: true,
|
|
57
|
+
"aria-disabled": true,
|
|
58
|
+
className: "no-options",
|
|
59
|
+
tabIndex: -1
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
function noAddonOptions(options) {
|
|
63
|
+
return options.map((op) => __spreadProps(__spreadValues({}, op), { noAddon: true }));
|
|
64
|
+
}
|
|
65
|
+
module.exports = __toCommonJS(helper_exports);
|
|
66
|
+
//# 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,iCAAK,KAAL,EAAS,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,112 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __spreadValues = (a, b) => {
|
|
7
|
+
for (var prop in b || (b = {}))
|
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
|
10
|
+
if (__getOwnPropSymbols)
|
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
+
if (__propIsEnum.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
}
|
|
15
|
+
return a;
|
|
16
|
+
};
|
|
17
|
+
import * as React from "react";
|
|
18
|
+
import React2, { useState, useEffect, useRef, useCallback } from "react";
|
|
19
|
+
import { describe } from "react-desc";
|
|
20
|
+
import DSDropdownMenu from "@elliemae/ds-dropdownmenu";
|
|
21
|
+
import { DSInputMask } from "@elliemae/ds-form";
|
|
22
|
+
import { InputSearchWrapper } from "./components/blocks";
|
|
23
|
+
import { createDisabledOption, noAddonOptions } from "./components/helper";
|
|
24
|
+
import { zipcodeSearchProps, defaultProps } from "./props";
|
|
25
|
+
const DSZipCodeSearch = ({
|
|
26
|
+
disabled,
|
|
27
|
+
value,
|
|
28
|
+
placeholder,
|
|
29
|
+
mask,
|
|
30
|
+
onBlur,
|
|
31
|
+
onChange,
|
|
32
|
+
onSearch,
|
|
33
|
+
containerProps,
|
|
34
|
+
selectRightOptions,
|
|
35
|
+
activeCount,
|
|
36
|
+
options,
|
|
37
|
+
tabIndex
|
|
38
|
+
}) => {
|
|
39
|
+
const ref = useRef(null);
|
|
40
|
+
const [searchValue, setSearchValue] = useState(value);
|
|
41
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
42
|
+
const [isActive, setIsActive] = useState(false);
|
|
43
|
+
const [isInputFocus, setIsInputFocus] = useState(false);
|
|
44
|
+
const [isSelected, setIsSelected] = useState(false);
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
if (isInputFocus && activeCount <= searchValue.length && !isSelected) {
|
|
47
|
+
setIsOpen(true);
|
|
48
|
+
setIsActive(true);
|
|
49
|
+
} else if (!isActive || activeCount > searchValue.length) {
|
|
50
|
+
setIsOpen(false);
|
|
51
|
+
}
|
|
52
|
+
}, [isInputFocus, isActive, activeCount, searchValue, isSelected]);
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
setSearchValue(value || "");
|
|
55
|
+
}, [value]);
|
|
56
|
+
const onTypeInInput = useCallback((e) => {
|
|
57
|
+
const finalVal = e.target.value;
|
|
58
|
+
onSearch(finalVal);
|
|
59
|
+
setSearchValue(finalVal);
|
|
60
|
+
setIsSelected(false);
|
|
61
|
+
}, [onSearch]);
|
|
62
|
+
const onFocusInput = useCallback(() => {
|
|
63
|
+
setIsInputFocus(true);
|
|
64
|
+
}, []);
|
|
65
|
+
const onInnerBlur = useCallback((e) => {
|
|
66
|
+
setIsInputFocus(false);
|
|
67
|
+
onBlur(e);
|
|
68
|
+
}, [onBlur]);
|
|
69
|
+
const onClose = useCallback(() => {
|
|
70
|
+
setIsActive(false);
|
|
71
|
+
}, []);
|
|
72
|
+
const onSelectItem = useCallback((item) => {
|
|
73
|
+
setSearchValue(item.value);
|
|
74
|
+
onChange(item);
|
|
75
|
+
setIsSelected(true);
|
|
76
|
+
ref.current.focus();
|
|
77
|
+
setIsOpen(false);
|
|
78
|
+
onClose();
|
|
79
|
+
}, [onChange, onClose]);
|
|
80
|
+
return /* @__PURE__ */ React2.createElement(InputSearchWrapper, __spreadValues({}, containerProps), /* @__PURE__ */ React2.createElement(DSDropdownMenu, {
|
|
81
|
+
isOpen: isOpen && options.length > 0,
|
|
82
|
+
menuProps: { className: "input-search-menu" },
|
|
83
|
+
onClose,
|
|
84
|
+
onSelectMenuItem: onSelectItem,
|
|
85
|
+
contentStyle: {
|
|
86
|
+
maxHeight: 200
|
|
87
|
+
},
|
|
88
|
+
options: options.length > 0 ? [createDisabledOption(selectRightOptions), ...noAddonOptions(options)] : [],
|
|
89
|
+
triggerComponent: /* @__PURE__ */ React2.createElement("div", null, /* @__PURE__ */ React2.createElement(DSInputMask, {
|
|
90
|
+
disabled,
|
|
91
|
+
innerRef: (_ref) => ref.current = _ref,
|
|
92
|
+
mask,
|
|
93
|
+
onBlur: onInnerBlur,
|
|
94
|
+
onChange: onTypeInInput,
|
|
95
|
+
onFocus: onFocusInput,
|
|
96
|
+
placeholder,
|
|
97
|
+
value: searchValue,
|
|
98
|
+
tabIndex
|
|
99
|
+
}))
|
|
100
|
+
}));
|
|
101
|
+
};
|
|
102
|
+
DSZipCodeSearch.propTypes = zipcodeSearchProps;
|
|
103
|
+
DSZipCodeSearch.defaultProps = defaultProps;
|
|
104
|
+
const ZipCodeSearchWithSchema = describe(DSZipCodeSearch);
|
|
105
|
+
ZipCodeSearchWithSchema.propTypes = zipcodeSearchProps;
|
|
106
|
+
var DSZipCodeSearch_default = DSZipCodeSearch;
|
|
107
|
+
export {
|
|
108
|
+
DSZipCodeSearch,
|
|
109
|
+
ZipCodeSearchWithSchema,
|
|
110
|
+
DSZipCodeSearch_default as default
|
|
111
|
+
};
|
|
112
|
+
//# 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,mBAAwB,iBACtB,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,39 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
import * as React from "react";
|
|
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) => __spreadProps(__spreadValues({}, op), { noAddon: true }));
|
|
34
|
+
}
|
|
35
|
+
export {
|
|
36
|
+
createDisabledOption,
|
|
37
|
+
noAddonOptions
|
|
38
|
+
};
|
|
39
|
+
//# 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,iCAAK,KAAL,EAAS,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
|
+
}
|