@synerise/ds-search 1.5.8 → 1.5.10
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/CHANGELOG.md +8 -0
- package/README.md +47 -42
- package/dist/Elements/SearchButton/SearchButton.d.ts +2 -2
- package/dist/Elements/SearchButton/SearchButton.js +16 -28
- package/dist/Elements/SearchButton/SearchButton.types.js +1 -1
- package/dist/Elements/SearchHeader/SearchHeader.d.ts +2 -2
- package/dist/Elements/SearchHeader/SearchHeader.js +15 -15
- package/dist/Elements/SearchHeader/SearchHeader.types.js +1 -1
- package/dist/Elements/SearchInput/SearchInput.d.ts +2 -2
- package/dist/Elements/SearchInput/SearchInput.js +74 -117
- package/dist/Elements/SearchInput/SearchInput.types.d.ts +3 -3
- package/dist/Elements/SearchInput/SearchInput.types.js +1 -1
- package/dist/Elements/SearchItems/SearchItems.d.ts +2 -2
- package/dist/Elements/SearchItems/SearchItems.js +54 -58
- package/dist/Elements/SearchItems/SearchItems.types.d.ts +1 -1
- package/dist/Elements/SearchItems/SearchItems.types.js +1 -1
- package/dist/Elements/SearchRenderer/SearchRenderer.d.ts +1 -1
- package/dist/Elements/SearchRenderer/SearchRenderer.js +22 -33
- package/dist/Elements/SearchRenderer/SearchRenderer.types.d.ts +2 -2
- package/dist/Elements/SearchRenderer/SearchRenderer.types.js +1 -1
- package/dist/Elements/index.js +12 -4
- package/dist/Elements/utils/searchUtils.d.ts +1 -1
- package/dist/Elements/utils/searchUtils.js +16 -17
- package/dist/Search.d.ts +2 -3
- package/dist/Search.js +145 -230
- package/dist/Search.styles.d.ts +15 -15
- package/dist/Search.styles.js +59 -62
- package/dist/Search.types.d.ts +4 -4
- package/dist/Search.types.js +8 -7
- package/dist/assets/style/index-tn0RQdqM.css +0 -0
- package/dist/const.js +16 -7
- package/dist/index.js +14 -2
- package/dist/modules.d.js +1 -1
- package/dist/modules.d.ts +0 -0
- package/package.json +11 -11
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.5.10](https://github.com/Synerise/synerise-design/compare/@synerise/ds-search@1.5.9...@synerise/ds-search@1.5.10) (2026-03-24)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @synerise/ds-search
|
|
9
|
+
|
|
10
|
+
## [1.5.9](https://github.com/Synerise/synerise-design/compare/@synerise/ds-search@1.5.8...@synerise/ds-search@1.5.9) (2026-03-20)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @synerise/ds-search
|
|
13
|
+
|
|
6
14
|
## [1.5.8](https://github.com/Synerise/synerise-design/compare/@synerise/ds-search@1.5.7...@synerise/ds-search@1.5.8) (2026-03-09)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @synerise/ds-search
|
package/README.md
CHANGED
|
@@ -8,14 +8,12 @@ Search UI Component
|
|
|
8
8
|
## Installation
|
|
9
9
|
|
|
10
10
|
```
|
|
11
|
-
|
|
12
|
-
or
|
|
13
|
-
yarn add @synerise/ds-search
|
|
11
|
+
pnpm add @synerise/ds-search
|
|
14
12
|
```
|
|
15
13
|
|
|
16
14
|
## Usage
|
|
17
15
|
|
|
18
|
-
```
|
|
16
|
+
```tsx
|
|
19
17
|
import Search from '@synerise/ds-search';
|
|
20
18
|
|
|
21
19
|
const parameters = [
|
|
@@ -116,6 +114,7 @@ return (
|
|
|
116
114
|
| searchWidth | Width of the search input when expanded | number | - |
|
|
117
115
|
| dropdownWidth | Width of the suggestions dropdown. Will match search input if undefined | number | - |
|
|
118
116
|
| alwaysExpanded | Enable expanded input on Search component with dropdown | boolean / undefined | - |
|
|
117
|
+
| searchTooltipProps | Props forwarded to the Tooltip wrapping the search input | TooltipProps | - |
|
|
119
118
|
|
|
120
119
|
### DataSetProps
|
|
121
120
|
|
|
@@ -126,27 +125,29 @@ return (
|
|
|
126
125
|
| rowHeight | Height of item in the list | number | - |
|
|
127
126
|
| title | Title of the item list | string | - |
|
|
128
127
|
| tooltip | Tooltip of the item list, displayed when hovering on the icon next to the title | string | - |
|
|
129
|
-
| visibleRows | Number of rows visible in the list |
|
|
128
|
+
| visibleRows | Number of rows visible in the list | number | - |
|
|
130
129
|
|
|
131
130
|
## Search usage
|
|
132
131
|
|
|
133
|
-
```
|
|
134
|
-
import { SearchInput } from '@synerise/ds-search
|
|
132
|
+
```tsx
|
|
133
|
+
import { SearchInput } from '@synerise/ds-search';
|
|
135
134
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
135
|
+
const [value, setValue] = React.useState<string>('');
|
|
136
|
+
return (
|
|
137
|
+
<SearchInput
|
|
138
|
+
clearTooltip="Clear"
|
|
139
|
+
placeholder="Search"
|
|
140
|
+
onChange={value => {
|
|
141
|
+
console.log(value);
|
|
142
|
+
setValue(value);
|
|
143
|
+
}}
|
|
144
|
+
value={value}
|
|
145
|
+
onClear={() => {
|
|
146
|
+
console.log('Cleared!');
|
|
147
|
+
}}
|
|
148
|
+
closeOnClickOutside={true}
|
|
149
|
+
/>
|
|
150
|
+
);
|
|
150
151
|
```
|
|
151
152
|
|
|
152
153
|
### SearchInput
|
|
@@ -155,40 +156,44 @@ import { SearchInput } from '@synerise/ds-search/dist/Elements';
|
|
|
155
156
|
| ------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------ | ------- |
|
|
156
157
|
| alwaysHighlight | When set, the input always has blue border when expanded | boolean | `false` |
|
|
157
158
|
| alwaysExpanded | Boolean value to force expanded state of the input | boolean | `false` |
|
|
158
|
-
| clearTooltip | Clear button tooltip text |
|
|
159
|
+
| clearTooltip | Clear button tooltip text | ReactNode | - |
|
|
159
160
|
| closeOnClickOutside | Boolean value to prevent / force toggling the input when clicking outside | boolean | `false` |
|
|
160
|
-
|
|
|
161
|
-
|
|
|
161
|
+
| disabled | Disables the entire component including the search button | boolean | - |
|
|
162
|
+
| disableInput | Disables only the text input; search button remains active | boolean | - |
|
|
163
|
+
| filterLabel | Label displayed on the left-hand side of the input caret | `{ icon?: ReactNode; [key: string]: any }` or null | - |
|
|
164
|
+
| focusTrigger | Toggle this boolean to imperatively focus the input | boolean | - |
|
|
162
165
|
| inputProps | Props object passed to the input element of the component | [InputProps](https://design.synerise.com/docs/components/input/#input-1) | - |
|
|
163
|
-
|
|
|
166
|
+
| moveCursorToEnd | Moves caret to end of value when toggled | boolean | - |
|
|
167
|
+
| onChange | Callback when input changes | `(value: string) => void` | - |
|
|
164
168
|
| onButtonClick | Callback executed when clicking search button | function | - |
|
|
165
169
|
| onClear | Callback after clicking clear button | function | - |
|
|
166
170
|
| onClick | Callback executed when clicking inside an input | function | - |
|
|
167
171
|
| onKeyDown | Callback executed when pressing a keyboard key. | function | - |
|
|
168
172
|
| onToggle | Callback executed when expanding / narrowing the input wrapper | function | - |
|
|
169
173
|
| placeholder | Input placeholder | string | - |
|
|
170
|
-
|
|
|
174
|
+
| searchTooltipProps | Props forwarded to the Tooltip wrapping the input | Partial<TooltipProps> | `{}` |
|
|
175
|
+
| toggleTrigger | Toggle this boolean to imperatively expand / collapse the input | boolean | - |
|
|
171
176
|
| value | The input content value | string | - |
|
|
172
177
|
|
|
173
178
|
### SearchInput usage
|
|
174
179
|
|
|
175
|
-
```
|
|
176
|
-
import { SearchInput } from '@synerise/ds-search
|
|
180
|
+
```tsx
|
|
181
|
+
import { SearchInput } from '@synerise/ds-search';
|
|
177
182
|
|
|
178
183
|
const [value, setValue] = React.useState<string>('');
|
|
179
184
|
return (
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
)
|
|
185
|
+
<SearchInput
|
|
186
|
+
clearTooltip="Clear"
|
|
187
|
+
placeholder="Search"
|
|
188
|
+
onChange={value => {
|
|
189
|
+
console.log(value);
|
|
190
|
+
setValue(value);
|
|
191
|
+
}}
|
|
192
|
+
value={value}
|
|
193
|
+
onClear={() => {
|
|
194
|
+
console.log('Cleared!');
|
|
195
|
+
}}
|
|
196
|
+
closeOnClickOutside={true}
|
|
197
|
+
/>
|
|
198
|
+
);
|
|
194
199
|
```
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { SearchButtonProps } from './SearchButton.types';
|
|
3
3
|
declare const SearchButton: React.FC<SearchButtonProps>;
|
|
4
4
|
export default SearchButton;
|
|
@@ -1,29 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import Button from
|
|
3
|
-
import Icon, { SearchM } from
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
clickable: !disabled && clickable,
|
|
18
|
-
onClick: onClick
|
|
19
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
20
|
-
mode: "single-icon",
|
|
21
|
-
type: "ghost",
|
|
22
|
-
disabled: disabled,
|
|
23
|
-
className: inputOpen ? 'btn-search-open' : 'btn-search',
|
|
24
|
-
"data-testid": "btn"
|
|
25
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
26
|
-
component: /*#__PURE__*/React.createElement(SearchM, null)
|
|
27
|
-
})));
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import Button from "@synerise/ds-button";
|
|
3
|
+
import Icon, { SearchM } from "@synerise/ds-icon";
|
|
4
|
+
import { SearchButton as SearchButton$1 } from "../../Search.styles.js";
|
|
5
|
+
const SearchButton = ({
|
|
6
|
+
inputOpen,
|
|
7
|
+
hidden,
|
|
8
|
+
onClick,
|
|
9
|
+
inputFocused,
|
|
10
|
+
clickable,
|
|
11
|
+
disabled
|
|
12
|
+
}) => {
|
|
13
|
+
return /* @__PURE__ */ jsx(SearchButton$1, { isOpen: inputOpen, hidden, className: "SearchButton", inputFocused, clickable: !disabled && clickable, onClick, children: /* @__PURE__ */ jsx(Button, { mode: "single-icon", type: "ghost", disabled, className: inputOpen ? "btn-search-open" : "btn-search", "data-testid": "btn", children: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(SearchM, {}) }) }) });
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
SearchButton as default
|
|
28
17
|
};
|
|
29
|
-
export default SearchButton;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { SearchHeaderProps } from './SearchHeader.types';
|
|
3
3
|
declare const SearchHeader: React.FC<SearchHeaderProps>;
|
|
4
4
|
export default SearchHeader;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import Icon, { InfoFillS } from
|
|
3
|
-
import Tooltip from
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
title: tooltip || headerText
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import Icon, { InfoFillS } from "@synerise/ds-icon";
|
|
3
|
+
import Tooltip from "@synerise/ds-tooltip/dist/Tooltip";
|
|
4
|
+
import { MenuHeader, HeaderIconWrapper } from "../../Search.styles.js";
|
|
5
|
+
const SearchHeader = ({
|
|
6
|
+
headerText,
|
|
7
|
+
tooltip
|
|
8
|
+
}) => {
|
|
9
|
+
return /* @__PURE__ */ jsxs(MenuHeader, { children: [
|
|
10
|
+
headerText,
|
|
11
|
+
tooltip && /* @__PURE__ */ jsx(Tooltip, { type: "default", trigger: "hover", title: tooltip || headerText, children: /* @__PURE__ */ jsx(HeaderIconWrapper, { children: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(InfoFillS, {}) }) }) })
|
|
12
|
+
] });
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
SearchHeader as default
|
|
15
16
|
};
|
|
16
|
-
export default SearchHeader;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { SearchInputProps } from './SearchInput.types';
|
|
3
3
|
declare const SearchInput: ({ alwaysExpanded, alwaysHighlight, clearTooltip, filterLabel, filterLookupKey, onKeyDown, onClick, onChange, onClear, onToggle, onButtonClick, moveCursorToEnd, placeholder, textLookupKey, value, closeOnClickOutside, disableInput, disabled, focusTrigger, toggleTrigger, inputProps, searchTooltipProps, }: SearchInputProps) => React.JSX.Element;
|
|
4
4
|
export default SearchInput;
|
|
@@ -1,158 +1,115 @@
|
|
|
1
|
-
|
|
2
|
-
import Input from
|
|
3
|
-
import
|
|
4
|
-
import { theme } from
|
|
5
|
-
import Icon, { Close3M } from
|
|
6
|
-
import Tooltip from
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import SearchButton from
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
setIsResultChosen = _useState3[1];
|
|
46
|
-
var _useState4 = useState(true),
|
|
47
|
-
isInputFocused = _useState4[0],
|
|
48
|
-
setIsInputFocused = _useState4[1];
|
|
49
|
-
var renderInputOpened = isInputOpen || !!value || !!filterLabel;
|
|
50
|
-
var prevFocusTrigger = usePrevious(focusTrigger);
|
|
51
|
-
var prevToggleTrigger = usePrevious(toggleTrigger);
|
|
52
|
-
useLayoutEffect(function () {
|
|
53
|
-
if (prevFocusTrigger !== undefined && prevFocusTrigger !== focusTrigger) {
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import Input from "antd/lib/input";
|
|
3
|
+
import { useRef, useState, useLayoutEffect, useEffect } from "react";
|
|
4
|
+
import { theme } from "@synerise/ds-core";
|
|
5
|
+
import Icon, { Close3M } from "@synerise/ds-icon";
|
|
6
|
+
import Tooltip from "@synerise/ds-tooltip";
|
|
7
|
+
import { usePrevious, useOnClickOutside } from "@synerise/ds-utils";
|
|
8
|
+
import { SearchInputWrapper, SearchInputContent, LeftSide, Filter, SearchInner, ClearButton } from "../../Search.styles.js";
|
|
9
|
+
import SearchButton from "../SearchButton/SearchButton.js";
|
|
10
|
+
const SearchInput = ({
|
|
11
|
+
alwaysExpanded,
|
|
12
|
+
alwaysHighlight,
|
|
13
|
+
clearTooltip,
|
|
14
|
+
filterLabel,
|
|
15
|
+
filterLookupKey,
|
|
16
|
+
onKeyDown,
|
|
17
|
+
onClick,
|
|
18
|
+
onChange,
|
|
19
|
+
onClear,
|
|
20
|
+
onToggle,
|
|
21
|
+
onButtonClick,
|
|
22
|
+
moveCursorToEnd,
|
|
23
|
+
placeholder,
|
|
24
|
+
textLookupKey,
|
|
25
|
+
value,
|
|
26
|
+
closeOnClickOutside,
|
|
27
|
+
disableInput,
|
|
28
|
+
disabled,
|
|
29
|
+
focusTrigger,
|
|
30
|
+
toggleTrigger,
|
|
31
|
+
inputProps = {},
|
|
32
|
+
searchTooltipProps = {}
|
|
33
|
+
}) => {
|
|
34
|
+
const inputRef = useRef(null);
|
|
35
|
+
const wrapperRef = useRef(null);
|
|
36
|
+
const [isInputOpen, setIsInputOpen] = useState(alwaysExpanded || !!value || !!filterLabel);
|
|
37
|
+
const [inputOffset, setInputOffset] = useState(0);
|
|
38
|
+
const [isResultChosen, setIsResultChosen] = useState(false);
|
|
39
|
+
const [isInputFocused, setIsInputFocused] = useState(true);
|
|
40
|
+
const renderInputOpened = isInputOpen || !!value || !!filterLabel;
|
|
41
|
+
const prevFocusTrigger = usePrevious(focusTrigger);
|
|
42
|
+
const prevToggleTrigger = usePrevious(toggleTrigger);
|
|
43
|
+
useLayoutEffect(() => {
|
|
44
|
+
if (prevFocusTrigger !== void 0 && prevFocusTrigger !== focusTrigger) {
|
|
54
45
|
focusInput();
|
|
55
46
|
}
|
|
56
|
-
if (prevToggleTrigger !==
|
|
47
|
+
if (prevToggleTrigger !== void 0 && prevToggleTrigger !== toggleTrigger) {
|
|
57
48
|
toggleOpen();
|
|
58
49
|
}
|
|
59
50
|
});
|
|
60
|
-
useOnClickOutside(wrapperRef,
|
|
51
|
+
useOnClickOutside(wrapperRef, () => {
|
|
61
52
|
if (closeOnClickOutside && !alwaysExpanded) {
|
|
62
53
|
setIsInputOpen(false);
|
|
63
54
|
onToggle && onToggle(false);
|
|
64
55
|
}
|
|
65
56
|
});
|
|
66
|
-
|
|
57
|
+
const focusInput = () => {
|
|
67
58
|
inputRef.current && inputRef.current.focus();
|
|
68
59
|
};
|
|
69
|
-
|
|
60
|
+
const handleSearchInputContentClick = () => {
|
|
70
61
|
onClick && onClick();
|
|
71
62
|
focusInput();
|
|
72
63
|
};
|
|
73
|
-
|
|
64
|
+
const handleOffsetWithFilter = (ref) => {
|
|
74
65
|
ref && setInputOffset(ref.getBoundingClientRect().width);
|
|
75
66
|
};
|
|
76
|
-
|
|
77
|
-
|
|
67
|
+
const handleChangeValue = ({
|
|
68
|
+
target: {
|
|
69
|
+
value: changedValue
|
|
70
|
+
}
|
|
71
|
+
}) => {
|
|
78
72
|
onChange(changedValue);
|
|
79
73
|
setIsResultChosen(false);
|
|
80
74
|
};
|
|
81
|
-
|
|
82
|
-
setIsInputOpen(
|
|
75
|
+
const toggleOpen = () => {
|
|
76
|
+
setIsInputOpen((open) => {
|
|
83
77
|
onToggle && onToggle(!open);
|
|
84
78
|
return !open;
|
|
85
79
|
});
|
|
86
80
|
};
|
|
87
|
-
|
|
81
|
+
const handleSearchButtonClick = () => {
|
|
88
82
|
if (!alwaysExpanded) {
|
|
89
83
|
toggleOpen();
|
|
90
84
|
focusInput();
|
|
91
85
|
onButtonClick && onButtonClick();
|
|
92
86
|
}
|
|
93
87
|
};
|
|
94
|
-
|
|
88
|
+
const handleClearValue = () => {
|
|
95
89
|
setInputOffset(0);
|
|
96
90
|
setIsResultChosen(false);
|
|
97
91
|
onClear();
|
|
98
92
|
setIsInputOpen(true);
|
|
99
93
|
focusInput();
|
|
100
94
|
};
|
|
101
|
-
useEffect(
|
|
102
|
-
|
|
103
|
-
if (moveCursorToEnd && (_inputRef$current = inputRef.current) != null && _inputRef$current.input) {
|
|
95
|
+
useEffect(() => {
|
|
96
|
+
if (moveCursorToEnd && inputRef.current?.input) {
|
|
104
97
|
inputRef.current.input.selectionStart = value.length || 0;
|
|
105
98
|
inputRef.current.input.selectionEnd = value.length || 0;
|
|
106
99
|
}
|
|
107
100
|
}, [moveCursorToEnd, value.length]);
|
|
108
|
-
return
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
hasValue: !!value,
|
|
123
|
-
alwaysHighlight: alwaysHighlight
|
|
124
|
-
}, /*#__PURE__*/React.createElement(Input, _extends({
|
|
125
|
-
placeholder: placeholder,
|
|
126
|
-
ref: inputRef,
|
|
127
|
-
value: value,
|
|
128
|
-
onChange: handleChangeValue,
|
|
129
|
-
onKeyDown: onKeyDown,
|
|
130
|
-
onFocus: function onFocus() {
|
|
131
|
-
return setIsInputFocused(true);
|
|
132
|
-
},
|
|
133
|
-
onBlur: function onBlur() {
|
|
134
|
-
return setIsInputFocused(false);
|
|
135
|
-
},
|
|
136
|
-
autoComplete: "off",
|
|
137
|
-
autoFocus: true,
|
|
138
|
-
disabled: disableInput
|
|
139
|
-
}, inputProps))))), /*#__PURE__*/React.createElement(SearchButton, {
|
|
140
|
-
disabled: disabled,
|
|
141
|
-
inputOpen: isInputOpen,
|
|
142
|
-
hidden: !!value || !!filterLabel,
|
|
143
|
-
inputFocused: isInputFocused,
|
|
144
|
-
clickable: !disabled && !alwaysExpanded,
|
|
145
|
-
onClick: handleSearchButtonClick
|
|
146
|
-
}), !disabled && /*#__PURE__*/React.createElement(S.ClearButton, {
|
|
147
|
-
hidden: !value && !filterLabel
|
|
148
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
149
|
-
"data-testid": "clear",
|
|
150
|
-
onClick: handleClearValue,
|
|
151
|
-
component: /*#__PURE__*/React.createElement(Tooltip, {
|
|
152
|
-
title: clearTooltip
|
|
153
|
-
}, /*#__PURE__*/React.createElement(Close3M, null)),
|
|
154
|
-
color: theme.palette['red-600'],
|
|
155
|
-
size: 18
|
|
156
|
-
})));
|
|
101
|
+
return /* @__PURE__ */ jsxs(SearchInputWrapper, { ref: wrapperRef, children: [
|
|
102
|
+
!disabled && /* @__PURE__ */ jsxs(SearchInputContent, { className: renderInputOpened ? "is-open search-input-wrapper" : "search-input-wrapper", offset: inputOffset, filterLabel, onClick: handleSearchInputContentClick, children: [
|
|
103
|
+
/* @__PURE__ */ jsx(LeftSide, { isOpen: isInputOpen, children: filterLabel && /* @__PURE__ */ jsxs(Filter, { ref: handleOffsetWithFilter, children: [
|
|
104
|
+
filterLabel.icon && !isResultChosen && /* @__PURE__ */ jsx(Icon, { component: filterLabel.icon }),
|
|
105
|
+
/* @__PURE__ */ jsx("span", { children: filterLabel[filterLookupKey || ""] || filterLabel[textLookupKey || ""] })
|
|
106
|
+
] }) }),
|
|
107
|
+
/* @__PURE__ */ jsx(Tooltip, { ...searchTooltipProps, children: /* @__PURE__ */ jsx(SearchInner, { hasValue: !!value, alwaysHighlight, children: /* @__PURE__ */ jsx(Input, { placeholder, ref: inputRef, value, onChange: handleChangeValue, onKeyDown, onFocus: () => setIsInputFocused(true), onBlur: () => setIsInputFocused(false), autoComplete: "off", autoFocus: true, disabled: disableInput, ...inputProps }) }) })
|
|
108
|
+
] }),
|
|
109
|
+
/* @__PURE__ */ jsx(SearchButton, { disabled, inputOpen: isInputOpen, hidden: !!value || !!filterLabel, inputFocused: isInputFocused, clickable: !disabled && !alwaysExpanded, onClick: handleSearchButtonClick }),
|
|
110
|
+
!disabled && /* @__PURE__ */ jsx(ClearButton, { hidden: !value && !filterLabel, children: /* @__PURE__ */ jsx(Icon, { "data-testid": "clear", onClick: handleClearValue, component: /* @__PURE__ */ jsx(Tooltip, { title: clearTooltip, children: /* @__PURE__ */ jsx(Close3M, {}) }), color: theme.palette["red-600"], size: 18 }) })
|
|
111
|
+
] });
|
|
112
|
+
};
|
|
113
|
+
export {
|
|
114
|
+
SearchInput as default
|
|
157
115
|
};
|
|
158
|
-
export default SearchInput;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { InputProps } from 'antd/lib/input';
|
|
2
|
+
import { KeyboardEvent, ReactNode } from 'react';
|
|
3
|
+
import { TooltipProps } from '@synerise/ds-tooltip';
|
|
4
4
|
export type SearchInputProps = {
|
|
5
5
|
alwaysExpanded?: boolean;
|
|
6
6
|
alwaysHighlight?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React,
|
|
2
|
-
import {
|
|
1
|
+
import { default as React, ReactElement, ReactNode } from 'react';
|
|
2
|
+
import { SearchItemListProps } from './SearchItems.types';
|
|
3
3
|
export declare function renderSearchList<V>(props: SearchItemListProps<V>, children?: ReactNode): ReactElement<SearchItemListProps<V>>;
|
|
4
4
|
declare const SearchItems: ({ data, height, highlight, itemRender, listProps, onItemClick, rowHeight, visibleRows, width, renderInMenu, }: SearchItemListProps<any>) => React.JSX.Element;
|
|
5
5
|
export default SearchItems;
|