@star-insure/sdk 3.2.9 → 3.2.11
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 +58 -8
- 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 +58 -8
- package/dist/sdk.esm.js.map +1 -1
- package/dist/types/misc/index.d.ts +1 -0
- package/package.json +4 -3
- package/src/components/filter/Action.tsx +59 -13
- package/src/types/misc/index.ts +1 -0
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
|
|
|
@@ -2407,38 +2408,87 @@ function Action(_ref) {
|
|
|
2407
2408
|
target = _ref$target === void 0 ? '_self' : _ref$target,
|
|
2408
2409
|
type = _ref.type,
|
|
2409
2410
|
_ref$onClick = _ref.onClick,
|
|
2410
|
-
_onClick = _ref$onClick === void 0 ? function () {} : _ref$onClick
|
|
2411
|
+
_onClick = _ref$onClick === void 0 ? function () {} : _ref$onClick,
|
|
2412
|
+
shortcutKey = _ref.shortcutKey;
|
|
2411
2413
|
|
|
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-
|
|
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;
|
|
2417
|
+
|
|
2418
|
+
function runAction() {
|
|
2419
|
+
if (as === 'Link' && href) {
|
|
2420
|
+
return router.get(href);
|
|
2421
|
+
}
|
|
2422
|
+
|
|
2423
|
+
if (as === 'a' && href) {
|
|
2424
|
+
return window.location.href = href;
|
|
2425
|
+
}
|
|
2426
|
+
|
|
2427
|
+
_onClick();
|
|
2428
|
+
}
|
|
2429
|
+
React__default.useEffect(function () {
|
|
2430
|
+
if (typeof window === 'undefined') return;
|
|
2431
|
+
if (!shortcutKey) return;
|
|
2432
|
+
|
|
2433
|
+
var listener = function listener(e) {
|
|
2434
|
+
// Check if Ctrl (Windows) or Cmd (Mac) key is pressed
|
|
2435
|
+
var isCtrlOrCmdPressed = e.ctrlKey || e.metaKey;
|
|
2436
|
+
|
|
2437
|
+
if (e.key === shortcutKey && isCtrlOrCmdPressed) {
|
|
2438
|
+
e.preventDefault();
|
|
2439
|
+
runAction();
|
|
2440
|
+
}
|
|
2441
|
+
};
|
|
2442
|
+
|
|
2443
|
+
window.addEventListener('keydown', listener);
|
|
2444
|
+
return function () {
|
|
2445
|
+
window.removeEventListener('keydown', listener);
|
|
2446
|
+
};
|
|
2447
|
+
}, [shortcutKey]);
|
|
2413
2448
|
|
|
2414
2449
|
if (as === 'Link' && href) {
|
|
2415
|
-
return React__default.createElement(
|
|
2450
|
+
return React__default.createElement(React__default.Fragment, null, tooltipContent && React__default.createElement(Tooltip, {
|
|
2451
|
+
id: tooltipId,
|
|
2452
|
+
className: "z-10"
|
|
2453
|
+
}), React__default.createElement(Link, {
|
|
2454
|
+
"data-tooltip-id": tooltipId,
|
|
2455
|
+
"data-tooltip-content": tooltipContent,
|
|
2416
2456
|
className: className,
|
|
2417
2457
|
href: href,
|
|
2418
2458
|
onClick: function onClick() {
|
|
2419
2459
|
return _onClick();
|
|
2420
2460
|
}
|
|
2421
|
-
}, title);
|
|
2461
|
+
}, title));
|
|
2422
2462
|
}
|
|
2423
2463
|
|
|
2424
2464
|
if (as === 'a' && href) {
|
|
2425
|
-
return React__default.createElement(
|
|
2465
|
+
return React__default.createElement(React__default.Fragment, null, tooltipContent && React__default.createElement(Tooltip, {
|
|
2466
|
+
id: tooltipId,
|
|
2467
|
+
className: "z-10"
|
|
2468
|
+
}), React__default.createElement("a", {
|
|
2469
|
+
"data-tooltip-id": tooltipId,
|
|
2470
|
+
"data-tooltip-content": tooltipContent,
|
|
2426
2471
|
className: className,
|
|
2427
2472
|
target: target,
|
|
2428
2473
|
href: href,
|
|
2429
2474
|
onClick: function onClick() {
|
|
2430
2475
|
return _onClick();
|
|
2431
2476
|
}
|
|
2432
|
-
}, title);
|
|
2477
|
+
}, title));
|
|
2433
2478
|
}
|
|
2434
2479
|
|
|
2435
|
-
return React__default.createElement(
|
|
2480
|
+
return React__default.createElement(React__default.Fragment, null, tooltipContent && React__default.createElement(Tooltip, {
|
|
2481
|
+
id: tooltipId,
|
|
2482
|
+
className: "z-10"
|
|
2483
|
+
}), React__default.createElement("button", {
|
|
2484
|
+
"data-tooltip-id": tooltipId,
|
|
2485
|
+
"data-tooltip-content": tooltipContent,
|
|
2436
2486
|
className: className,
|
|
2437
2487
|
type: type,
|
|
2438
2488
|
onClick: function onClick() {
|
|
2439
2489
|
return _onClick();
|
|
2440
2490
|
}
|
|
2441
|
-
}, title);
|
|
2491
|
+
}, title));
|
|
2442
2492
|
}
|
|
2443
2493
|
|
|
2444
2494
|
function Dropdown(_ref) {
|