@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/sdk.esm.js CHANGED
@@ -2407,9 +2407,41 @@ function Action(_ref) {
2407
2407
  target = _ref$target === void 0 ? '_self' : _ref$target,
2408
2408
  type = _ref.type,
2409
2409
  _ref$onClick = _ref.onClick,
2410
- _onClick = _ref$onClick === void 0 ? function () {} : _ref$onClick;
2410
+ _onClick = _ref$onClick === void 0 ? function () {} : _ref$onClick,
2411
+ shortcutKey = _ref.shortcutKey;
2411
2412
 
2412
- var className = 'bg-white rounded-full font-bold px-4 py-1.5 text-sm whitespace-nowrap hover:bg-gray-100 hover:border-gray-300 transition-colors border border-gray-200';
2413
+ 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';
2414
+
2415
+ function runAction() {
2416
+ if (as === 'Link' && href) {
2417
+ return router.get(href);
2418
+ }
2419
+
2420
+ if (as === 'a' && href) {
2421
+ return window.location.href = href;
2422
+ }
2423
+
2424
+ _onClick();
2425
+ }
2426
+ React__default.useEffect(function () {
2427
+ if (typeof window === 'undefined') return;
2428
+ if (!shortcutKey) return;
2429
+
2430
+ var listener = function listener(e) {
2431
+ // Check if Ctrl (Windows) or Cmd (Mac) key is pressed
2432
+ var isCtrlOrCmdPressed = e.ctrlKey || e.metaKey;
2433
+
2434
+ if (e.key === shortcutKey && isCtrlOrCmdPressed) {
2435
+ e.preventDefault();
2436
+ runAction();
2437
+ }
2438
+ };
2439
+
2440
+ window.addEventListener('keydown', listener);
2441
+ return function () {
2442
+ window.removeEventListener('keydown', listener);
2443
+ };
2444
+ }, [shortcutKey]);
2413
2445
 
2414
2446
  if (as === 'Link' && href) {
2415
2447
  return React__default.createElement(Link, {