@star-insure/sdk 3.2.9 → 3.2.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/dist/components/filter/Action.d.ts +1 -1
- package/dist/sdk.cjs.development.js +34 -2
- 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 +34 -2
- package/dist/sdk.esm.js.map +1 -1
- package/dist/types/misc/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/components/filter/Action.tsx +37 -4
- package/src/types/misc/index.ts +1 -0
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { TPageHeaderAction } from "../../types";
|
|
3
|
-
export default function Action({ title, href, as, target, type, onClick }: TPageHeaderAction): JSX.Element;
|
|
3
|
+
export default function Action({ title, href, as, target, type, onClick, shortcutKey }: TPageHeaderAction): JSX.Element;
|
|
@@ -2414,9 +2414,41 @@ function Action(_ref) {
|
|
|
2414
2414
|
target = _ref$target === void 0 ? '_self' : _ref$target,
|
|
2415
2415
|
type = _ref.type,
|
|
2416
2416
|
_ref$onClick = _ref.onClick,
|
|
2417
|
-
_onClick = _ref$onClick === void 0 ? function () {} : _ref$onClick
|
|
2417
|
+
_onClick = _ref$onClick === void 0 ? function () {} : _ref$onClick,
|
|
2418
|
+
shortcutKey = _ref.shortcutKey;
|
|
2418
2419
|
|
|
2419
|
-
var className = 'bg-white rounded-full font-bold px-4 py-1.5 text-sm whitespace-nowrap hover:bg-gray-100 hover:border-gray-
|
|
2420
|
+
var className = 'bg-white rounded-full font-bold px-4 py-1.5 text-sm whitespace-nowrap hover:bg-gray-100 hover:border-gray-400 transition-colors border border-gray-300';
|
|
2421
|
+
|
|
2422
|
+
function runAction() {
|
|
2423
|
+
if (as === 'Link' && href) {
|
|
2424
|
+
return react.router.get(href);
|
|
2425
|
+
}
|
|
2426
|
+
|
|
2427
|
+
if (as === 'a' && href) {
|
|
2428
|
+
return window.location.href = href;
|
|
2429
|
+
}
|
|
2430
|
+
|
|
2431
|
+
_onClick();
|
|
2432
|
+
}
|
|
2433
|
+
React__default.useEffect(function () {
|
|
2434
|
+
if (typeof window === 'undefined') return;
|
|
2435
|
+
if (!shortcutKey) return;
|
|
2436
|
+
|
|
2437
|
+
var listener = function listener(e) {
|
|
2438
|
+
// Check if Ctrl (Windows) or Cmd (Mac) key is pressed
|
|
2439
|
+
var isCtrlOrCmdPressed = e.ctrlKey || e.metaKey;
|
|
2440
|
+
|
|
2441
|
+
if (e.key === shortcutKey && isCtrlOrCmdPressed) {
|
|
2442
|
+
e.preventDefault();
|
|
2443
|
+
runAction();
|
|
2444
|
+
}
|
|
2445
|
+
};
|
|
2446
|
+
|
|
2447
|
+
window.addEventListener('keydown', listener);
|
|
2448
|
+
return function () {
|
|
2449
|
+
window.removeEventListener('keydown', listener);
|
|
2450
|
+
};
|
|
2451
|
+
}, [shortcutKey]);
|
|
2420
2452
|
|
|
2421
2453
|
if (as === 'Link' && href) {
|
|
2422
2454
|
return React__default.createElement(react.Link, {
|