@cloudtower/eagle 481.0.2 → 481.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/core/Cascader/cascader.widget.js +12 -12
- package/dist/cjs/core/SearchInput/SearchInput.hook.js +124 -0
- package/dist/cjs/core/SearchInput/SearchInput.js +253 -0
- package/dist/cjs/core/SearchInput/SearchInput.style.js +13 -0
- package/dist/cjs/core/index.js +6 -6
- package/dist/cjs/index.js +172 -172
- package/dist/cjs/legacy-antd.js +89 -89
- package/dist/cjs/stats1.html +1 -1
- package/dist/components.css +2240 -2217
- package/dist/esm/core/Cascader/cascader.widget.js +1 -1
- package/dist/esm/core/SearchInput/SearchInput.hook.js +117 -0
- package/dist/esm/core/SearchInput/SearchInput.js +247 -0
- package/dist/esm/core/SearchInput/SearchInput.style.js +7 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/legacy-antd.js +1 -1
- package/dist/esm/stats1.html +1 -1
- package/dist/linaria.merged.scss +2372 -2343
- package/dist/src/core/Cascader/cascader.type.d.ts +1 -1
- package/dist/src/core/SearchInput/SearchInput.d.ts +2 -0
- package/dist/src/core/SearchInput/SearchInput.hook.d.ts +9 -0
- package/dist/src/core/SearchInput/SearchInput.style.d.ts +5 -0
- package/dist/src/core/SearchInput/{searchInput.type.d.ts → SearchInput.type.d.ts} +18 -2
- package/dist/src/core/SearchInput/__test__/SearchInput.hook.test.d.ts +1 -0
- package/dist/src/core/SearchInput/index.d.ts +2 -4
- package/dist/src/core/index.d.ts +0 -1
- package/dist/stories/docs/core/SearchInput.stories.d.ts +6 -1
- package/dist/style.css +2240 -2217
- package/package.json +4 -4
- package/dist/cjs/core/SearchInput/index.js +0 -164
- package/dist/esm/core/SearchInput/index.js +0 -157
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var core = require('@linaria/core');
|
|
4
|
-
var index
|
|
5
|
-
var index$
|
|
6
|
-
var index$
|
|
4
|
+
var index = require('../Link/index.js');
|
|
5
|
+
var index$2 = require('../Token/index.js');
|
|
6
|
+
var index$3 = require('../../coreX/OverflowTooltip/index.js');
|
|
7
7
|
var useParrotTranslation = require('../../hooks/useParrotTranslation.js');
|
|
8
8
|
var antd5 = require('antd5');
|
|
9
9
|
var cs = require('classnames');
|
|
10
10
|
var React = require('react');
|
|
11
|
-
var index = require('../
|
|
12
|
-
var index$2 = require('../Typo/index.js');
|
|
11
|
+
var index$1 = require('../Typo/index.js');
|
|
13
12
|
var cascader_style = require('./cascader.style.js');
|
|
13
|
+
var SearchInput = require('../SearchInput/SearchInput.js');
|
|
14
14
|
|
|
15
15
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
16
|
|
|
@@ -48,14 +48,14 @@ const PresetCascaderHeader = ({ defaultContent, searchProps }) => {
|
|
|
48
48
|
(_a = defaultContent == null ? void 0 : defaultContent.onClickAll) == null ? void 0 : _a.call(defaultContent, selectedAll);
|
|
49
49
|
};
|
|
50
50
|
return /* @__PURE__ */ React__default.default.createElement(antd5.Flex, { vertical: true, className: cascader_style.CascaderDefaultHeaderContainer }, searchProps ? /* @__PURE__ */ React__default.default.createElement(
|
|
51
|
-
|
|
51
|
+
SearchInput.SearchInput,
|
|
52
52
|
__spreadProps(__spreadValues({}, searchProps), {
|
|
53
53
|
className: cs__default.default(searchProps.className, cascader_style.CascaderDefaultHeaderSearch),
|
|
54
54
|
style: {
|
|
55
55
|
width: "unset"
|
|
56
56
|
}
|
|
57
57
|
})
|
|
58
|
-
) : /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null), (defaultContent == null ? void 0 : defaultContent.hide) ? /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null) : /* @__PURE__ */ React__default.default.createElement("div", { className: cs__default.default(cascader_style.CascaderDefaultHeader) }, defaultContent == null ? void 0 : defaultContent.label, /* @__PURE__ */ React__default.default.createElement(index
|
|
58
|
+
) : /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null), (defaultContent == null ? void 0 : defaultContent.hide) ? /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null) : /* @__PURE__ */ React__default.default.createElement("div", { className: cs__default.default(cascader_style.CascaderDefaultHeader) }, defaultContent == null ? void 0 : defaultContent.label, /* @__PURE__ */ React__default.default.createElement(index, { size: "small", onClick }, selectedAll ? t("components.unselect_all") : t("components.select_all"))));
|
|
59
59
|
};
|
|
60
60
|
const PresetCascaderRender = ({
|
|
61
61
|
menus,
|
|
@@ -80,20 +80,20 @@ const CascaderDoubleRowOption = ({ leftTop, leftBottom, rightTop, rightBottom, r
|
|
|
80
80
|
className: !leftTop && !rightTop ? cascader_style.Hide : "",
|
|
81
81
|
gap: 8
|
|
82
82
|
},
|
|
83
|
-
/* @__PURE__ */ React__default.default.createElement("div", { className: cs__default.default(index$
|
|
83
|
+
/* @__PURE__ */ React__default.default.createElement("div", { className: cs__default.default(index$1.Typo.Label.l2_medium, "top", "left") }, leftTop),
|
|
84
84
|
/* @__PURE__ */ React__default.default.createElement("div", null, rightTop)
|
|
85
85
|
),
|
|
86
86
|
/* @__PURE__ */ React__default.default.createElement(
|
|
87
87
|
antd5.Flex,
|
|
88
88
|
{
|
|
89
89
|
justify: "space-between",
|
|
90
|
-
className: cs__default.default(index$
|
|
90
|
+
className: cs__default.default(index$1.Typo.Label.l4_regular, {
|
|
91
91
|
[cascader_style.Hide]: !leftBottom && !rightBottom
|
|
92
92
|
}),
|
|
93
93
|
gap: 8
|
|
94
94
|
},
|
|
95
|
-
/* @__PURE__ */ React__default.default.createElement("div", { className: cs__default.default(index$
|
|
96
|
-
/* @__PURE__ */ React__default.default.createElement("div", { className: cs__default.default(index$
|
|
95
|
+
/* @__PURE__ */ React__default.default.createElement("div", { className: cs__default.default(index$1.Typo.Label.l4_regular, "bottom", "left") }, leftBottom),
|
|
96
|
+
/* @__PURE__ */ React__default.default.createElement("div", { className: cs__default.default(index$1.Typo.Label.l4_regular, "bottom") }, rightBottom)
|
|
97
97
|
)
|
|
98
98
|
);
|
|
99
99
|
};
|
|
@@ -101,7 +101,7 @@ const CascaderOptionWithCount = ({ label, count }) => {
|
|
|
101
101
|
return /* @__PURE__ */ React__default.default.createElement("div", { className: cascader_style.CascaderDefaultOptionLabel }, label, count ? /* @__PURE__ */ React__default.default.createElement("span", { className: "label" }, count.selected, "/", count.total) : /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null));
|
|
102
102
|
};
|
|
103
103
|
const defaultTagRender = (props) => {
|
|
104
|
-
return /* @__PURE__ */ React__default.default.createElement(index$
|
|
104
|
+
return /* @__PURE__ */ React__default.default.createElement(index$2.default, __spreadValues({ size: "medium", color: "blue", key: props.value }, props), /* @__PURE__ */ React__default.default.createElement(index$3, { content: props.label, tooltip: props.label }));
|
|
105
105
|
};
|
|
106
106
|
|
|
107
107
|
exports.CascaderDoubleRowOption = CascaderDoubleRowOption;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var iconsReact = require('@cloudtower/icons-react');
|
|
4
|
+
var core = require('@linaria/core');
|
|
5
|
+
var index$1 = require('../Icon/index.js');
|
|
6
|
+
var index = require('../Typo/index.js');
|
|
7
|
+
var useParrotTranslation = require('../../hooks/useParrotTranslation.js');
|
|
8
|
+
var _ = require('lodash');
|
|
9
|
+
var React = require('react');
|
|
10
|
+
var index$2 = require('../../coreX/OverflowTooltip/index.js');
|
|
11
|
+
|
|
12
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
|
|
14
|
+
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
15
|
+
|
|
16
|
+
var __defProp = Object.defineProperty;
|
|
17
|
+
var __defProps = Object.defineProperties;
|
|
18
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
19
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
20
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
21
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
22
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
23
|
+
var __spreadValues = (a, b) => {
|
|
24
|
+
for (var prop in b || (b = {}))
|
|
25
|
+
if (__hasOwnProp.call(b, prop))
|
|
26
|
+
__defNormalProp(a, prop, b[prop]);
|
|
27
|
+
if (__getOwnPropSymbols)
|
|
28
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
29
|
+
if (__propIsEnum.call(b, prop))
|
|
30
|
+
__defNormalProp(a, prop, b[prop]);
|
|
31
|
+
}
|
|
32
|
+
return a;
|
|
33
|
+
};
|
|
34
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
35
|
+
const searchInputRecentSearchLocalStorageKey = "search-input-recent-search";
|
|
36
|
+
const useRecentSearch = (recentSearchLocalStorageKey, maxRecentCount, setValue, onChange) => {
|
|
37
|
+
const { t } = useParrotTranslation();
|
|
38
|
+
const [recentSearchKeys, setRecentSearchKeys] = React.useState([]);
|
|
39
|
+
React.useEffect(() => {
|
|
40
|
+
if (!recentSearchLocalStorageKey)
|
|
41
|
+
return;
|
|
42
|
+
try {
|
|
43
|
+
const currRecentSearchKeys = JSON.parse(
|
|
44
|
+
localStorage.getItem(searchInputRecentSearchLocalStorageKey) || "{}"
|
|
45
|
+
)[recentSearchLocalStorageKey];
|
|
46
|
+
setRecentSearchKeys(currRecentSearchKeys || []);
|
|
47
|
+
} catch (error) {
|
|
48
|
+
setRecentSearchKeys([]);
|
|
49
|
+
}
|
|
50
|
+
}, [recentSearchLocalStorageKey]);
|
|
51
|
+
const setRecentSearchKeysDebounceRef = React.useRef();
|
|
52
|
+
React.useEffect(() => {
|
|
53
|
+
if (!recentSearchLocalStorageKey)
|
|
54
|
+
return;
|
|
55
|
+
const fn = _.debounce((val) => {
|
|
56
|
+
if (!val || !recentSearchLocalStorageKey)
|
|
57
|
+
return;
|
|
58
|
+
setRecentSearchKeys((preState) => {
|
|
59
|
+
const newState = [...preState].filter((item) => item !== val);
|
|
60
|
+
if (newState.length >= maxRecentCount)
|
|
61
|
+
newState.pop();
|
|
62
|
+
newState.unshift(val);
|
|
63
|
+
try {
|
|
64
|
+
const recentSearchMap = JSON.parse(
|
|
65
|
+
localStorage.getItem(searchInputRecentSearchLocalStorageKey) || "{}"
|
|
66
|
+
);
|
|
67
|
+
localStorage.setItem(
|
|
68
|
+
searchInputRecentSearchLocalStorageKey,
|
|
69
|
+
JSON.stringify(__spreadProps(__spreadValues({}, recentSearchMap), {
|
|
70
|
+
[recentSearchLocalStorageKey]: newState
|
|
71
|
+
}))
|
|
72
|
+
);
|
|
73
|
+
} catch (err) {
|
|
74
|
+
console.error(err);
|
|
75
|
+
}
|
|
76
|
+
return newState;
|
|
77
|
+
});
|
|
78
|
+
}, 400);
|
|
79
|
+
setRecentSearchKeysDebounceRef.current = fn;
|
|
80
|
+
return () => fn.cancel();
|
|
81
|
+
}, [maxRecentCount, recentSearchLocalStorageKey]);
|
|
82
|
+
const antd5DropdownMenu = React.useMemo(
|
|
83
|
+
() => ({
|
|
84
|
+
onClick: ({ key: val }) => {
|
|
85
|
+
var _a;
|
|
86
|
+
setValue(val);
|
|
87
|
+
onChange == null ? void 0 : onChange(val);
|
|
88
|
+
(_a = setRecentSearchKeysDebounceRef.current) == null ? void 0 : _a.call(setRecentSearchKeysDebounceRef, val);
|
|
89
|
+
},
|
|
90
|
+
items: [
|
|
91
|
+
{
|
|
92
|
+
key: "recent-search",
|
|
93
|
+
className: core.cx("recent-search-menu-item", index.Typo.Label.l4_regular),
|
|
94
|
+
disabled: true,
|
|
95
|
+
label: /* @__PURE__ */ React__default.default.createElement("span", null, t("components.recent_search"))
|
|
96
|
+
},
|
|
97
|
+
...recentSearchKeys.map((k) => ({
|
|
98
|
+
key: k,
|
|
99
|
+
label: /* @__PURE__ */ React__default.default.createElement(
|
|
100
|
+
index$1,
|
|
101
|
+
{
|
|
102
|
+
src: iconsReact.Search24Icon,
|
|
103
|
+
hoverSrc: iconsReact.Search24BlueIcon,
|
|
104
|
+
iconHeight: 24,
|
|
105
|
+
iconWidth: 24
|
|
106
|
+
},
|
|
107
|
+
/* @__PURE__ */ React__default.default.createElement(index$2, { content: k })
|
|
108
|
+
)
|
|
109
|
+
}))
|
|
110
|
+
],
|
|
111
|
+
// 避免 Dropdown 点击时被 Input blur 关闭
|
|
112
|
+
onMouseDown: (e) => e.preventDefault()
|
|
113
|
+
}),
|
|
114
|
+
[onChange, recentSearchKeys, setRecentSearchKeysDebounceRef, setValue, t]
|
|
115
|
+
);
|
|
116
|
+
return {
|
|
117
|
+
recentSearchKeys,
|
|
118
|
+
setRecentSearchKeysDebounceRef,
|
|
119
|
+
antd5DropdownMenu
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
exports.searchInputRecentSearchLocalStorageKey = searchInputRecentSearchLocalStorageKey;
|
|
124
|
+
exports.useRecentSearch = useRecentSearch;
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var icons = require('@ant-design/icons');
|
|
4
|
+
var iconsReact = require('@cloudtower/icons-react');
|
|
5
|
+
var core = require('@linaria/core');
|
|
6
|
+
var index$1 = require('../Icon/index.js');
|
|
7
|
+
var index$3 = require('../Input/index.js');
|
|
8
|
+
var index$2 = require('../Tooltip/index.js');
|
|
9
|
+
var index = require('../Typo/index.js');
|
|
10
|
+
var useParrotTranslation = require('../../hooks/useParrotTranslation.js');
|
|
11
|
+
var _ = require('lodash');
|
|
12
|
+
var React = require('react');
|
|
13
|
+
var SearchInput_hook = require('./SearchInput.hook.js');
|
|
14
|
+
var SearchInput_style = require('./SearchInput.style.js');
|
|
15
|
+
var Antd5Dropdown = require('../Antd5Dropdown/Antd5Dropdown.js');
|
|
16
|
+
|
|
17
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
|
+
|
|
19
|
+
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
20
|
+
|
|
21
|
+
var __defProp = Object.defineProperty;
|
|
22
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
23
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
24
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
25
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
26
|
+
var __spreadValues = (a, b) => {
|
|
27
|
+
for (var prop in b || (b = {}))
|
|
28
|
+
if (__hasOwnProp.call(b, prop))
|
|
29
|
+
__defNormalProp(a, prop, b[prop]);
|
|
30
|
+
if (__getOwnPropSymbols)
|
|
31
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
32
|
+
if (__propIsEnum.call(b, prop))
|
|
33
|
+
__defNormalProp(a, prop, b[prop]);
|
|
34
|
+
}
|
|
35
|
+
return a;
|
|
36
|
+
};
|
|
37
|
+
var __objRest = (source, exclude) => {
|
|
38
|
+
var target = {};
|
|
39
|
+
for (var prop in source)
|
|
40
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
41
|
+
target[prop] = source[prop];
|
|
42
|
+
if (source != null && __getOwnPropSymbols)
|
|
43
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
44
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
45
|
+
target[prop] = source[prop];
|
|
46
|
+
}
|
|
47
|
+
return target;
|
|
48
|
+
};
|
|
49
|
+
const SearchInput = (props) => {
|
|
50
|
+
const _a = props, {
|
|
51
|
+
className,
|
|
52
|
+
debounceWait = 300,
|
|
53
|
+
total = 0,
|
|
54
|
+
onSearchNext,
|
|
55
|
+
onSearchPrev,
|
|
56
|
+
prefixHoverIcon,
|
|
57
|
+
nextHoverIcon,
|
|
58
|
+
clearHoverIcon,
|
|
59
|
+
prefixIcon,
|
|
60
|
+
nextIcon,
|
|
61
|
+
clearIcon,
|
|
62
|
+
width = 276,
|
|
63
|
+
searchIcon,
|
|
64
|
+
enableRecentSearch,
|
|
65
|
+
recentSearchLocalStorageKey,
|
|
66
|
+
maxRecentCount = 5,
|
|
67
|
+
current: externalCurrent,
|
|
68
|
+
onChange,
|
|
69
|
+
onFocus,
|
|
70
|
+
onBlur
|
|
71
|
+
} = _a, restProps = __objRest(_a, [
|
|
72
|
+
"className",
|
|
73
|
+
"debounceWait",
|
|
74
|
+
"total",
|
|
75
|
+
"onSearchNext",
|
|
76
|
+
"onSearchPrev",
|
|
77
|
+
"prefixHoverIcon",
|
|
78
|
+
"nextHoverIcon",
|
|
79
|
+
"clearHoverIcon",
|
|
80
|
+
"prefixIcon",
|
|
81
|
+
"nextIcon",
|
|
82
|
+
"clearIcon",
|
|
83
|
+
"width",
|
|
84
|
+
"searchIcon",
|
|
85
|
+
"enableRecentSearch",
|
|
86
|
+
"recentSearchLocalStorageKey",
|
|
87
|
+
"maxRecentCount",
|
|
88
|
+
"current",
|
|
89
|
+
"onChange",
|
|
90
|
+
"onFocus",
|
|
91
|
+
"onBlur"
|
|
92
|
+
]);
|
|
93
|
+
const [internalCurrent, setInternalCurrent] = React.useState(0);
|
|
94
|
+
const [value, setValue] = React.useState(props.value || "");
|
|
95
|
+
const { t } = useParrotTranslation();
|
|
96
|
+
const isNoMatch = total === 0;
|
|
97
|
+
const [inputFocused, setInputFocused] = React.useState(false);
|
|
98
|
+
const {
|
|
99
|
+
recentSearchKeys,
|
|
100
|
+
setRecentSearchKeysDebounceRef,
|
|
101
|
+
antd5DropdownMenu
|
|
102
|
+
} = SearchInput_hook.useRecentSearch(
|
|
103
|
+
recentSearchLocalStorageKey,
|
|
104
|
+
maxRecentCount,
|
|
105
|
+
setValue,
|
|
106
|
+
onChange
|
|
107
|
+
);
|
|
108
|
+
const debounceOnChangeRef = React.useRef();
|
|
109
|
+
React.useEffect(() => {
|
|
110
|
+
const fn = _.debounce((val) => {
|
|
111
|
+
var _a2;
|
|
112
|
+
onChange == null ? void 0 : onChange(val);
|
|
113
|
+
if (enableRecentSearch && val) {
|
|
114
|
+
(_a2 = setRecentSearchKeysDebounceRef.current) == null ? void 0 : _a2.call(setRecentSearchKeysDebounceRef, val);
|
|
115
|
+
}
|
|
116
|
+
}, debounceWait);
|
|
117
|
+
debounceOnChangeRef.current = fn;
|
|
118
|
+
return () => fn.cancel();
|
|
119
|
+
}, [
|
|
120
|
+
onChange,
|
|
121
|
+
enableRecentSearch,
|
|
122
|
+
debounceWait,
|
|
123
|
+
setRecentSearchKeysDebounceRef
|
|
124
|
+
]);
|
|
125
|
+
const current = externalCurrent !== void 0 ? externalCurrent : internalCurrent;
|
|
126
|
+
const setCurrent = React.useCallback(
|
|
127
|
+
(newCurrent) => {
|
|
128
|
+
if (externalCurrent === void 0) {
|
|
129
|
+
setInternalCurrent(newCurrent);
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
[externalCurrent]
|
|
133
|
+
);
|
|
134
|
+
const next = React.useCallback(() => {
|
|
135
|
+
if (total) {
|
|
136
|
+
const nextCurrent = current + 1 > total ? 1 : current + 1;
|
|
137
|
+
onSearchNext == null ? void 0 : onSearchNext(value, nextCurrent);
|
|
138
|
+
setCurrent(nextCurrent);
|
|
139
|
+
}
|
|
140
|
+
}, [onSearchNext, current, total, value, setCurrent]);
|
|
141
|
+
const prev = React.useCallback(() => {
|
|
142
|
+
if (total) {
|
|
143
|
+
const prevCurrent = current - 1 < 1 ? total : current - 1;
|
|
144
|
+
onSearchPrev == null ? void 0 : onSearchPrev(value, prevCurrent);
|
|
145
|
+
setCurrent(prevCurrent);
|
|
146
|
+
}
|
|
147
|
+
}, [onSearchPrev, current, total, value, setCurrent]);
|
|
148
|
+
const suffix = onSearchNext && onSearchPrev && value ? /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null, typeof total === "number" ? /* @__PURE__ */ React__default.default.createElement(
|
|
149
|
+
"span",
|
|
150
|
+
{
|
|
151
|
+
className: core.cx(
|
|
152
|
+
index.Typo.Label.l4_regular,
|
|
153
|
+
"counter-text",
|
|
154
|
+
SearchInput_style.CountTextStyles
|
|
155
|
+
)
|
|
156
|
+
},
|
|
157
|
+
current,
|
|
158
|
+
"/",
|
|
159
|
+
total
|
|
160
|
+
) : null, /* @__PURE__ */ React__default.default.createElement("span", { className: SearchInput_style.IconContainerStyles }, isNoMatch ? /* @__PURE__ */ React__default.default.createElement(
|
|
161
|
+
index$1,
|
|
162
|
+
{
|
|
163
|
+
className: SearchInput_style.DisabledIconStyles,
|
|
164
|
+
src: iconsReact.ArrowChevronUp16SecondaryIcon,
|
|
165
|
+
style: { opacity: 0.5 }
|
|
166
|
+
}
|
|
167
|
+
) : /* @__PURE__ */ React__default.default.createElement(index$2, { title: t("components.prev") }, /* @__PURE__ */ React__default.default.createElement(
|
|
168
|
+
index$1,
|
|
169
|
+
{
|
|
170
|
+
src: prefixIcon != null ? prefixIcon : iconsReact.ArrowChevronUp16SecondaryIcon,
|
|
171
|
+
hoverSrc: prefixHoverIcon != null ? prefixHoverIcon : iconsReact.ArrowChevronUp16BlueIcon,
|
|
172
|
+
onClick: prev
|
|
173
|
+
}
|
|
174
|
+
)), isNoMatch ? /* @__PURE__ */ React__default.default.createElement(
|
|
175
|
+
index$1,
|
|
176
|
+
{
|
|
177
|
+
className: SearchInput_style.DisabledIconStyles,
|
|
178
|
+
src: iconsReact.ArrowChevronDown16SecondaryIcon,
|
|
179
|
+
style: { opacity: 0.5 }
|
|
180
|
+
}
|
|
181
|
+
) : /* @__PURE__ */ React__default.default.createElement(index$2, { title: t("components.next") }, /* @__PURE__ */ React__default.default.createElement(
|
|
182
|
+
index$1,
|
|
183
|
+
{
|
|
184
|
+
src: nextIcon != null ? nextIcon : iconsReact.ArrowChevronDown16SecondaryIcon,
|
|
185
|
+
hoverSrc: nextHoverIcon != null ? nextHoverIcon : iconsReact.ArrowChevronDown16BlueIcon,
|
|
186
|
+
onClick: next
|
|
187
|
+
}
|
|
188
|
+
)), /* @__PURE__ */ React__default.default.createElement(index$2, { title: t("components.clear") }, /* @__PURE__ */ React__default.default.createElement(
|
|
189
|
+
index$1,
|
|
190
|
+
{
|
|
191
|
+
src: clearIcon != null ? clearIcon : iconsReact.XmarkCloseCircleFill16TertiaryIcon,
|
|
192
|
+
hoverSrc: clearHoverIcon != null ? clearHoverIcon : iconsReact.XmarkCloseCircleFill16SecondaryIcon,
|
|
193
|
+
onClick: () => {
|
|
194
|
+
var _a2;
|
|
195
|
+
setValue("");
|
|
196
|
+
(_a2 = debounceOnChangeRef.current) == null ? void 0 : _a2.call(debounceOnChangeRef, "");
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
)))) : null;
|
|
200
|
+
React.useEffect(() => {
|
|
201
|
+
setValue(props.value || "");
|
|
202
|
+
}, [props.value]);
|
|
203
|
+
React.useEffect(() => {
|
|
204
|
+
if (externalCurrent === void 0) {
|
|
205
|
+
setCurrent(total ? 1 : 0);
|
|
206
|
+
}
|
|
207
|
+
}, [value, total, externalCurrent, setCurrent]);
|
|
208
|
+
const InputComponent = /* @__PURE__ */ React__default.default.createElement(
|
|
209
|
+
index$3,
|
|
210
|
+
__spreadValues({
|
|
211
|
+
className: core.cx(SearchInput_style.SearchInputStyles, className),
|
|
212
|
+
style: { width },
|
|
213
|
+
prefix: searchIcon ? /* @__PURE__ */ React__default.default.createElement(index$1, { src: searchIcon }) : /* @__PURE__ */ React__default.default.createElement(icons.SearchOutlined, null),
|
|
214
|
+
suffix,
|
|
215
|
+
onPressEnter: next,
|
|
216
|
+
value,
|
|
217
|
+
onChange: (e) => {
|
|
218
|
+
var _a2;
|
|
219
|
+
const newValue = e.target.value || "";
|
|
220
|
+
setValue(newValue);
|
|
221
|
+
(_a2 = debounceOnChangeRef.current) == null ? void 0 : _a2.call(debounceOnChangeRef, newValue);
|
|
222
|
+
},
|
|
223
|
+
onFocus: (e) => {
|
|
224
|
+
setInputFocused(true);
|
|
225
|
+
onFocus == null ? void 0 : onFocus(e);
|
|
226
|
+
},
|
|
227
|
+
onBlur: (e) => {
|
|
228
|
+
setInputFocused(false);
|
|
229
|
+
onBlur == null ? void 0 : onBlur(e);
|
|
230
|
+
}
|
|
231
|
+
}, restProps)
|
|
232
|
+
);
|
|
233
|
+
if (enableRecentSearch)
|
|
234
|
+
return /* @__PURE__ */ React__default.default.createElement(
|
|
235
|
+
Antd5Dropdown.Antd5Dropdown,
|
|
236
|
+
{
|
|
237
|
+
overlayClassName: core.cx(
|
|
238
|
+
"recent-search-dropdown",
|
|
239
|
+
SearchInput_style.SearchInputDropdownStyles
|
|
240
|
+
),
|
|
241
|
+
overlayStyle: { width },
|
|
242
|
+
transitionName: "",
|
|
243
|
+
placement: "bottomLeft",
|
|
244
|
+
trigger: ["click"],
|
|
245
|
+
open: inputFocused && !value && !!recentSearchKeys.length,
|
|
246
|
+
menu: antd5DropdownMenu
|
|
247
|
+
},
|
|
248
|
+
InputComponent
|
|
249
|
+
);
|
|
250
|
+
return InputComponent;
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
exports.SearchInput = SearchInput;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const SearchInputStyles = "E_s1n7hav7";
|
|
4
|
+
const CountTextStyles = "E_c1tgpyn0";
|
|
5
|
+
const IconContainerStyles = "E_i1cmbu8m";
|
|
6
|
+
const DisabledIconStyles = "E_dxmfsc9";
|
|
7
|
+
const SearchInputDropdownStyles = "E_slbf45q";
|
|
8
|
+
|
|
9
|
+
exports.CountTextStyles = CountTextStyles;
|
|
10
|
+
exports.DisabledIconStyles = DisabledIconStyles;
|
|
11
|
+
exports.IconContainerStyles = IconContainerStyles;
|
|
12
|
+
exports.SearchInputDropdownStyles = SearchInputDropdownStyles;
|
|
13
|
+
exports.SearchInputStyles = SearchInputStyles;
|
package/dist/cjs/core/index.js
CHANGED
|
@@ -7,19 +7,19 @@ var index$e = require('./Byte/index.js');
|
|
|
7
7
|
var index$f = require('./BytePerSecond/index.js');
|
|
8
8
|
var index$u = require('./Frequency/index.js');
|
|
9
9
|
var index$O = require('./Percent/index.js');
|
|
10
|
-
var index$
|
|
11
|
-
var index$
|
|
10
|
+
var index$Q = require('./Second/index.js');
|
|
11
|
+
var index$U = require('./Speed/index.js');
|
|
12
12
|
|
|
13
13
|
const units = {
|
|
14
14
|
Percent: index$O,
|
|
15
15
|
Byte: index$e,
|
|
16
16
|
BytePerSecond: index$f,
|
|
17
17
|
Frequency: index$u,
|
|
18
|
-
Speed: index$
|
|
18
|
+
Speed: index$U,
|
|
19
19
|
Bps: index$a,
|
|
20
20
|
BitPerSecond: index$8,
|
|
21
21
|
Bit: index$7,
|
|
22
|
-
Second: index$
|
|
22
|
+
Second: index$Q
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
exports.Bit = index$7;
|
|
@@ -29,7 +29,7 @@ exports.Byte = index$e;
|
|
|
29
29
|
exports.BytePerSecond = index$f;
|
|
30
30
|
exports.Frequency = index$u;
|
|
31
31
|
exports.Percent = index$O;
|
|
32
|
-
exports.Second = index$
|
|
33
|
-
exports.Speed = index$
|
|
32
|
+
exports.Second = index$Q;
|
|
33
|
+
exports.Speed = index$U;
|
|
34
34
|
exports.Units = units;
|
|
35
35
|
exports.units = units;
|