@star-insure/sdk 3.2.7 → 3.2.8
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/components/filter/PageHeader.d.ts +2 -1
- package/dist/components/filter/SearchBar.d.ts +5 -2
- package/dist/sdk.cjs.development.js +10 -5
- package/dist/sdk.cjs.development.js.map +1 -1
- package/dist/sdk.cjs.production.min.js +1 -1
- package/dist/sdk.cjs.production.min.js.map +1 -1
- package/dist/sdk.esm.js +10 -5
- package/dist/sdk.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/filter/PageHeader.tsx +6 -4
- package/src/components/filter/SearchBar.tsx +10 -4
|
@@ -9,6 +9,7 @@ interface Props {
|
|
|
9
9
|
actions?: TPageHeaderAction[];
|
|
10
10
|
backText?: string;
|
|
11
11
|
filterOptions?: FilterOption[];
|
|
12
|
+
focusSearchShortcut?: boolean;
|
|
12
13
|
}
|
|
13
|
-
export default function PageHeader({ title, search, className, innerClassName, back, actions, filterOptions, }: Props): JSX.Element;
|
|
14
|
+
export default function PageHeader({ title, search, className, innerClassName, back, actions, filterOptions, focusSearchShortcut, }: Props): JSX.Element;
|
|
14
15
|
export {};
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
2
|
+
interface Props {
|
|
3
3
|
search?: string;
|
|
4
4
|
active: boolean;
|
|
5
5
|
onActive: Function;
|
|
6
6
|
placeholder?: string;
|
|
7
|
-
|
|
7
|
+
focusSearchShortcut?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export default function SearchBar({ search, active, onActive, placeholder, focusSearchShortcut }: Props): JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -2291,7 +2291,9 @@ function SearchBar(_ref) {
|
|
|
2291
2291
|
var search = _ref.search,
|
|
2292
2292
|
active = _ref.active,
|
|
2293
2293
|
onActive = _ref.onActive,
|
|
2294
|
-
placeholder = _ref.placeholder
|
|
2294
|
+
placeholder = _ref.placeholder,
|
|
2295
|
+
_ref$focusSearchShort = _ref.focusSearchShortcut,
|
|
2296
|
+
focusSearchShortcut = _ref$focusSearchShort === void 0 ? false : _ref$focusSearchShort;
|
|
2295
2297
|
|
|
2296
2298
|
var _React$useState = React__default.useState(''),
|
|
2297
2299
|
query = _React$useState[0],
|
|
@@ -2316,7 +2318,7 @@ function SearchBar(_ref) {
|
|
|
2316
2318
|
}
|
|
2317
2319
|
|
|
2318
2320
|
var listener = function listener(e) {
|
|
2319
|
-
if (e.key === '/') {
|
|
2321
|
+
if (focusSearchShortcut && e.key === '/') {
|
|
2320
2322
|
e.preventDefault();
|
|
2321
2323
|
onActive(true);
|
|
2322
2324
|
}
|
|
@@ -2330,7 +2332,7 @@ function SearchBar(_ref) {
|
|
|
2330
2332
|
return function () {
|
|
2331
2333
|
window.removeEventListener('keydown', listener);
|
|
2332
2334
|
};
|
|
2333
|
-
}, []);
|
|
2335
|
+
}, [focusSearchShortcut]);
|
|
2334
2336
|
/**
|
|
2335
2337
|
* Minimise the search bar on click outside if there's no search query
|
|
2336
2338
|
*/
|
|
@@ -2809,7 +2811,9 @@ function PageHeader(_ref) {
|
|
|
2809
2811
|
_ref$actions = _ref.actions,
|
|
2810
2812
|
actions = _ref$actions === void 0 ? [] : _ref$actions,
|
|
2811
2813
|
_ref$filterOptions = _ref.filterOptions,
|
|
2812
|
-
filterOptions = _ref$filterOptions === void 0 ? [] : _ref$filterOptions
|
|
2814
|
+
filterOptions = _ref$filterOptions === void 0 ? [] : _ref$filterOptions,
|
|
2815
|
+
_ref$focusSearchShort = _ref.focusSearchShortcut,
|
|
2816
|
+
focusSearchShortcut = _ref$focusSearchShort === void 0 ? false : _ref$focusSearchShort;
|
|
2813
2817
|
|
|
2814
2818
|
var _React$useState = React__default.useState(false),
|
|
2815
2819
|
isSearchActive = _React$useState[0],
|
|
@@ -2954,7 +2958,8 @@ function PageHeader(_ref) {
|
|
|
2954
2958
|
search: search,
|
|
2955
2959
|
active: isSearchActive,
|
|
2956
2960
|
onActive: setSearchActive,
|
|
2957
|
-
placeholder: "Search " + title + "..."
|
|
2961
|
+
placeholder: "Search " + title + "...",
|
|
2962
|
+
focusSearchShortcut: focusSearchShortcut
|
|
2958
2963
|
}), !isSearchActive && React__default.createElement("h1", {
|
|
2959
2964
|
className: "text-base font-bold"
|
|
2960
2965
|
}, title)), React__default.createElement("div", {
|