@star-insure/sdk 3.2.10 → 3.2.12

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
@@ -6,6 +6,7 @@ import { Transition, Dialog } from '@headlessui/react';
6
6
  import cn from 'classnames';
7
7
  import { padStart } from 'lodash-es';
8
8
  import { HiArrowLeft, HiMagnifyingGlass, HiXMark, HiChevronDown, HiChevronLeft, HiChevronRight } from 'react-icons/hi2';
9
+ import { Tooltip } from 'react-tooltip';
9
10
  import Select from 'react-select';
10
11
  import { router as router$1 } from '@inertiajs/core';
11
12
 
@@ -2411,6 +2412,8 @@ function Action(_ref) {
2411
2412
  shortcutKey = _ref.shortcutKey;
2412
2413
 
2413
2414
  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';
2415
+ var tooltipId = "action-" + title;
2416
+ var tooltipContent = shortcutKey ? "Ctrl + " + shortcutKey : undefined;
2414
2417
 
2415
2418
  function runAction() {
2416
2419
  if (as === 'Link' && href) {
@@ -2429,9 +2432,12 @@ function Action(_ref) {
2429
2432
 
2430
2433
  var listener = function listener(e) {
2431
2434
  // Check if Ctrl (Windows) or Cmd (Mac) key is pressed
2432
- var isCtrlOrCmdPressed = e.ctrlKey || e.metaKey;
2435
+ var isCtrlOrCmdPressed = e.ctrlKey || e.metaKey; // Check if the focus is on an input element or inside a form
2433
2436
 
2434
- if (e.key === shortcutKey && isCtrlOrCmdPressed) {
2437
+ var isInInput = e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement || e.target instanceof HTMLSelectElement;
2438
+ var isInForm = e.target instanceof Element && e.target.closest('form');
2439
+
2440
+ if (isCtrlOrCmdPressed && !isInInput && !isInForm && e.key === shortcutKey) {
2435
2441
  e.preventDefault();
2436
2442
  runAction();
2437
2443
  }
@@ -2444,33 +2450,48 @@ function Action(_ref) {
2444
2450
  }, [shortcutKey]);
2445
2451
 
2446
2452
  if (as === 'Link' && href) {
2447
- return React__default.createElement(Link, {
2453
+ return React__default.createElement(React__default.Fragment, null, tooltipContent && React__default.createElement(Tooltip, {
2454
+ id: tooltipId,
2455
+ className: "z-10"
2456
+ }), React__default.createElement(Link, {
2457
+ "data-tooltip-id": tooltipId,
2458
+ "data-tooltip-content": tooltipContent,
2448
2459
  className: className,
2449
2460
  href: href,
2450
2461
  onClick: function onClick() {
2451
2462
  return _onClick();
2452
2463
  }
2453
- }, title);
2464
+ }, title));
2454
2465
  }
2455
2466
 
2456
2467
  if (as === 'a' && href) {
2457
- return React__default.createElement("a", {
2468
+ return React__default.createElement(React__default.Fragment, null, tooltipContent && React__default.createElement(Tooltip, {
2469
+ id: tooltipId,
2470
+ className: "z-10"
2471
+ }), React__default.createElement("a", {
2472
+ "data-tooltip-id": tooltipId,
2473
+ "data-tooltip-content": tooltipContent,
2458
2474
  className: className,
2459
2475
  target: target,
2460
2476
  href: href,
2461
2477
  onClick: function onClick() {
2462
2478
  return _onClick();
2463
2479
  }
2464
- }, title);
2480
+ }, title));
2465
2481
  }
2466
2482
 
2467
- return React__default.createElement("button", {
2483
+ return React__default.createElement(React__default.Fragment, null, tooltipContent && React__default.createElement(Tooltip, {
2484
+ id: tooltipId,
2485
+ className: "z-10"
2486
+ }), React__default.createElement("button", {
2487
+ "data-tooltip-id": tooltipId,
2488
+ "data-tooltip-content": tooltipContent,
2468
2489
  className: className,
2469
2490
  type: type,
2470
2491
  onClick: function onClick() {
2471
2492
  return _onClick();
2472
2493
  }
2473
- }, title);
2494
+ }, title));
2474
2495
  }
2475
2496
 
2476
2497
  function Dropdown(_ref) {