@snack-uikit/search 0.11.1 → 0.11.2-preview-ff55e021.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/SearchAutocomplete/SearchAutocomplete.js +5 -3
- package/dist/cjs/components/SearchFieldText/SearchFieldText.js +5 -3
- package/dist/esm/components/SearchAutocomplete/SearchAutocomplete.js +2 -2
- package/dist/esm/components/SearchFieldText/SearchFieldText.js +2 -2
- package/package.json +2 -2
- package/src/components/SearchAutocomplete/SearchAutocomplete.tsx +2 -0
- package/src/components/SearchFieldText/SearchFieldText.tsx +15 -1
|
@@ -37,9 +37,10 @@ exports.SearchAutocomplete = (0, react_1.forwardRef)(function SearchAutocomplete
|
|
|
37
37
|
outline,
|
|
38
38
|
onSubmit,
|
|
39
39
|
onFocus,
|
|
40
|
-
className
|
|
40
|
+
className,
|
|
41
|
+
tabIndex
|
|
41
42
|
} = _a,
|
|
42
|
-
rest = __rest(_a, ["size", "value", "onChange", "placeholder", "options", "loading", "outline", "onSubmit", "onFocus", "className"]);
|
|
43
|
+
rest = __rest(_a, ["size", "value", "onChange", "placeholder", "options", "loading", "outline", "onSubmit", "onFocus", "className", "tabIndex"]);
|
|
43
44
|
const scrollRef = (0, react_1.useRef)(null);
|
|
44
45
|
const localRef = (0, react_1.useRef)(null);
|
|
45
46
|
const [isOpen, setIsOpen] = (0, react_1.useState)(false);
|
|
@@ -130,7 +131,8 @@ exports.SearchAutocomplete = (0, react_1.forwardRef)(function SearchAutocomplete
|
|
|
130
131
|
onKeyDown: handleKeyDown(onKeyDown),
|
|
131
132
|
onFocus: onFocus,
|
|
132
133
|
size: size,
|
|
133
|
-
"data-test-id": constants_1.PRIVATE_SEARCH_TEST_IDS.field
|
|
134
|
+
"data-test-id": constants_1.PRIVATE_SEARCH_TEST_IDS.field,
|
|
135
|
+
tabIndex: tabIndex
|
|
134
136
|
})
|
|
135
137
|
});
|
|
136
138
|
}
|
|
@@ -28,9 +28,10 @@ exports.SearchFieldText = (0, react_1.forwardRef)(function SearchFieldText(_a, r
|
|
|
28
28
|
loading,
|
|
29
29
|
placeholder,
|
|
30
30
|
onSubmit,
|
|
31
|
-
className
|
|
31
|
+
className,
|
|
32
|
+
tabIndex
|
|
32
33
|
} = _a,
|
|
33
|
-
rest = __rest(_a, ["value", "onChange", "onBlur", "onFocus", "size", "outline", "loading", "placeholder", "onSubmit", "className"]);
|
|
34
|
+
rest = __rest(_a, ["value", "onChange", "onBlur", "onFocus", "size", "outline", "loading", "placeholder", "onSubmit", "className", "tabIndex"]);
|
|
34
35
|
return (0, jsx_runtime_1.jsx)(SearchDecorator_1.SearchDecorator, Object.assign({
|
|
35
36
|
outline: outline,
|
|
36
37
|
size: size,
|
|
@@ -46,7 +47,8 @@ exports.SearchFieldText = (0, react_1.forwardRef)(function SearchFieldText(_a, r
|
|
|
46
47
|
onSubmit: onSubmit,
|
|
47
48
|
placeholder: placeholder,
|
|
48
49
|
loading: loading,
|
|
49
|
-
"data-test-id": constants_1.PRIVATE_SEARCH_TEST_IDS.field
|
|
50
|
+
"data-test-id": constants_1.PRIVATE_SEARCH_TEST_IDS.field,
|
|
51
|
+
tabIndex: tabIndex
|
|
50
52
|
})
|
|
51
53
|
}));
|
|
52
54
|
});
|
|
@@ -19,7 +19,7 @@ import { PRIVATE_SEARCH_TEST_IDS, SIZE, TEST_IDS } from '../../constants';
|
|
|
19
19
|
import { SearchDecorator } from '../SearchDecorator';
|
|
20
20
|
import styles from './styles.module.css';
|
|
21
21
|
export const SearchAutocomplete = forwardRef(function SearchAutocomplete(_a, ref) {
|
|
22
|
-
var { size = SIZE.S, value, onChange, placeholder, options = [], loading, outline, onSubmit, onFocus, className } = _a, rest = __rest(_a, ["size", "value", "onChange", "placeholder", "options", "loading", "outline", "onSubmit", "onFocus", "className"]);
|
|
22
|
+
var { size = SIZE.S, value, onChange, placeholder, options = [], loading, outline, onSubmit, onFocus, className, tabIndex } = _a, rest = __rest(_a, ["size", "value", "onChange", "placeholder", "options", "loading", "outline", "onSubmit", "onFocus", "className", "tabIndex"]);
|
|
23
23
|
const scrollRef = useRef(null);
|
|
24
24
|
const localRef = useRef(null);
|
|
25
25
|
const [isOpen, setIsOpen] = useState(false);
|
|
@@ -73,6 +73,6 @@ export const SearchAutocomplete = forwardRef(function SearchAutocomplete(_a, ref
|
|
|
73
73
|
}), [handleOptionKeyDown, onChange, onSubmit, options]);
|
|
74
74
|
return (_jsx("div", Object.assign({ className: cn(styles.wrap, className) }, rest, { children: _jsx(Droplist, { open: isOpen && options.length > 0, scroll: true, size: size, onOpenChange: setIsOpen, "data-test-id": TEST_IDS.droplist, triggerClassName: styles.triggerClassName, scrollRef: scrollRef, triggerElemRef: localRef, items: items, loading: loading, children: ({ onKeyDown }) => {
|
|
75
75
|
var _a;
|
|
76
|
-
return (_jsx(SearchDecorator, { size: size, outline: outline || undefined, focused: (isOpen && Boolean((_a = localRef.current) === null || _a === void 0 ? void 0 : _a.value)) || undefined, "data-test-id": TEST_IDS.decorator, children: _jsx(SearchPrivate, { loading: loading, value: value, onChange: onChange, onSubmit: onSubmit, placeholder: placeholder, ref: mergeRefs(ref, localRef), onKeyDown: handleKeyDown(onKeyDown), onFocus: onFocus, size: size, "data-test-id": PRIVATE_SEARCH_TEST_IDS.field }) }));
|
|
76
|
+
return (_jsx(SearchDecorator, { size: size, outline: outline || undefined, focused: (isOpen && Boolean((_a = localRef.current) === null || _a === void 0 ? void 0 : _a.value)) || undefined, "data-test-id": TEST_IDS.decorator, children: _jsx(SearchPrivate, { loading: loading, value: value, onChange: onChange, onSubmit: onSubmit, placeholder: placeholder, ref: mergeRefs(ref, localRef), onKeyDown: handleKeyDown(onKeyDown), onFocus: onFocus, size: size, "data-test-id": PRIVATE_SEARCH_TEST_IDS.field, tabIndex: tabIndex }) }));
|
|
77
77
|
} }) })));
|
|
78
78
|
});
|
|
@@ -15,6 +15,6 @@ import { SearchPrivate } from '@snack-uikit/search-private';
|
|
|
15
15
|
import { PRIVATE_SEARCH_TEST_IDS, SIZE } from '../../constants';
|
|
16
16
|
import { SearchDecorator } from '../SearchDecorator';
|
|
17
17
|
export const SearchFieldText = forwardRef(function SearchFieldText(_a, ref) {
|
|
18
|
-
var { value, onChange, onBlur, onFocus, size = SIZE.S, outline, loading, placeholder, onSubmit, className } = _a, rest = __rest(_a, ["value", "onChange", "onBlur", "onFocus", "size", "outline", "loading", "placeholder", "onSubmit", "className"]);
|
|
19
|
-
return (_jsx(SearchDecorator, Object.assign({ outline: outline, size: size, className: className }, rest, { children: _jsx(SearchPrivate, { ref: ref, size: size, value: value, onChange: onChange, onBlur: onBlur, onFocus: onFocus, onSubmit: onSubmit, placeholder: placeholder, loading: loading, "data-test-id": PRIVATE_SEARCH_TEST_IDS.field }) })));
|
|
18
|
+
var { value, onChange, onBlur, onFocus, size = SIZE.S, outline, loading, placeholder, onSubmit, className, tabIndex } = _a, rest = __rest(_a, ["value", "onChange", "onBlur", "onFocus", "size", "outline", "loading", "placeholder", "onSubmit", "className", "tabIndex"]);
|
|
19
|
+
return (_jsx(SearchDecorator, Object.assign({ outline: outline, size: size, className: className }, rest, { children: _jsx(SearchPrivate, { ref: ref, size: size, value: value, onChange: onChange, onBlur: onBlur, onFocus: onFocus, onSubmit: onSubmit, placeholder: placeholder, loading: loading, "data-test-id": PRIVATE_SEARCH_TEST_IDS.field, tabIndex: tabIndex }) })));
|
|
20
20
|
});
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"title": "Search",
|
|
7
|
-
"version": "0.11.
|
|
7
|
+
"version": "0.11.2-preview-ff55e021.0",
|
|
8
8
|
"sideEffects": [
|
|
9
9
|
"*.css",
|
|
10
10
|
"*.woff",
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/merge-refs": "1.0.0"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "67587bd2fedcd8accb1cfbc049ebce363fb6bf83"
|
|
49
49
|
}
|
|
@@ -41,6 +41,7 @@ export const SearchAutocomplete = forwardRef<HTMLInputElement, SearchAutocomplet
|
|
|
41
41
|
onSubmit,
|
|
42
42
|
onFocus,
|
|
43
43
|
className,
|
|
44
|
+
tabIndex,
|
|
44
45
|
...rest
|
|
45
46
|
},
|
|
46
47
|
ref,
|
|
@@ -143,6 +144,7 @@ export const SearchAutocomplete = forwardRef<HTMLInputElement, SearchAutocomplet
|
|
|
143
144
|
onFocus={onFocus}
|
|
144
145
|
size={size}
|
|
145
146
|
data-test-id={PRIVATE_SEARCH_TEST_IDS.field}
|
|
147
|
+
tabIndex={tabIndex}
|
|
146
148
|
/>
|
|
147
149
|
</SearchDecorator>
|
|
148
150
|
)}
|
|
@@ -11,7 +11,20 @@ export type SearchTextFieldProps = Omit<SearchPrivateProps, 'onKeyDown'> & {
|
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
export const SearchFieldText = forwardRef<HTMLInputElement, SearchTextFieldProps>(function SearchFieldText(
|
|
14
|
-
{
|
|
14
|
+
{
|
|
15
|
+
value,
|
|
16
|
+
onChange,
|
|
17
|
+
onBlur,
|
|
18
|
+
onFocus,
|
|
19
|
+
size = SIZE.S,
|
|
20
|
+
outline,
|
|
21
|
+
loading,
|
|
22
|
+
placeholder,
|
|
23
|
+
onSubmit,
|
|
24
|
+
className,
|
|
25
|
+
tabIndex,
|
|
26
|
+
...rest
|
|
27
|
+
},
|
|
15
28
|
ref,
|
|
16
29
|
) {
|
|
17
30
|
return (
|
|
@@ -27,6 +40,7 @@ export const SearchFieldText = forwardRef<HTMLInputElement, SearchTextFieldProps
|
|
|
27
40
|
placeholder={placeholder}
|
|
28
41
|
loading={loading}
|
|
29
42
|
data-test-id={PRIVATE_SEARCH_TEST_IDS.field}
|
|
43
|
+
tabIndex={tabIndex}
|
|
30
44
|
/>
|
|
31
45
|
</SearchDecorator>
|
|
32
46
|
);
|