@star-insure/sdk 4.3.5 → 4.5.0
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 +45 -1
- 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 +45 -1
- package/dist/sdk.esm.js.map +1 -1
- package/dist/types/misc/index.d.ts +10 -1
- package/package.json +1 -1
- package/src/components/filter/Action.tsx +50 -1
- package/src/types/misc/index.ts +11 -1
package/dist/sdk.esm.js
CHANGED
|
@@ -2595,11 +2595,27 @@ function Action(_ref) {
|
|
|
2595
2595
|
type = _ref.type,
|
|
2596
2596
|
_ref$onClick = _ref.onClick,
|
|
2597
2597
|
_onClick = _ref$onClick === void 0 ? function () {} : _ref$onClick,
|
|
2598
|
-
shortcutKey = _ref.shortcutKey
|
|
2598
|
+
shortcutKey = _ref.shortcutKey,
|
|
2599
|
+
actions = _ref.actions;
|
|
2599
2600
|
|
|
2600
2601
|
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';
|
|
2601
2602
|
var tooltipId = "action-" + title;
|
|
2602
2603
|
var tooltipContent = shortcutKey ? "Ctrl + " + shortcutKey : undefined;
|
|
2604
|
+
var actionButtonRef = React__default.useRef(null);
|
|
2605
|
+
var isActionsButton = actions && actions.length > 0;
|
|
2606
|
+
var actionsButtonClassName = 'relative cursor-pointer ' + className;
|
|
2607
|
+
|
|
2608
|
+
var _React$useState = React__default.useState(false),
|
|
2609
|
+
isInnerActionVisible = _React$useState[0],
|
|
2610
|
+
setIsInnerActionVisible = _React$useState[1];
|
|
2611
|
+
|
|
2612
|
+
var toggleActionsMenu = function toggleActionsMenu() {
|
|
2613
|
+
setIsInnerActionVisible(!isInnerActionVisible);
|
|
2614
|
+
};
|
|
2615
|
+
|
|
2616
|
+
useClickOutside(actionButtonRef, function () {
|
|
2617
|
+
return setIsInnerActionVisible(false);
|
|
2618
|
+
});
|
|
2603
2619
|
|
|
2604
2620
|
function runAction() {
|
|
2605
2621
|
if (as === 'Link' && href) {
|
|
@@ -2635,6 +2651,34 @@ function Action(_ref) {
|
|
|
2635
2651
|
};
|
|
2636
2652
|
}, [shortcutKey]);
|
|
2637
2653
|
|
|
2654
|
+
if (isActionsButton) {
|
|
2655
|
+
return React__default.createElement(React__default.Fragment, null, tooltipContent && React__default.createElement(Tooltip, {
|
|
2656
|
+
id: tooltipId,
|
|
2657
|
+
className: "z-10"
|
|
2658
|
+
}), React__default.createElement("div", {
|
|
2659
|
+
ref: actionButtonRef,
|
|
2660
|
+
"data-tooltip-id": tooltipId,
|
|
2661
|
+
"data-tooltip-content": tooltipContent,
|
|
2662
|
+
className: actionsButtonClassName,
|
|
2663
|
+
onClick: toggleActionsMenu
|
|
2664
|
+
}, title, isInnerActionVisible && React__default.createElement("div", {
|
|
2665
|
+
className: "absolute top-[120%] right-[-20%] z-10"
|
|
2666
|
+
}, React__default.createElement("div", {
|
|
2667
|
+
className: "flex flex-col gap-2 bg-white rounded-lg shadow-xl p-3"
|
|
2668
|
+
}, actions && actions.map(function (action, index) {
|
|
2669
|
+
if (action.hidden) return null;
|
|
2670
|
+
return React__default.createElement(Action, {
|
|
2671
|
+
key: index,
|
|
2672
|
+
title: action.title,
|
|
2673
|
+
as: action.as,
|
|
2674
|
+
href: action.href,
|
|
2675
|
+
target: action.target,
|
|
2676
|
+
onClick: action.onClick,
|
|
2677
|
+
type: 'button'
|
|
2678
|
+
});
|
|
2679
|
+
})))));
|
|
2680
|
+
}
|
|
2681
|
+
|
|
2638
2682
|
if (as === 'Link' && href) {
|
|
2639
2683
|
return React__default.createElement(React__default.Fragment, null, tooltipContent && React__default.createElement(Tooltip, {
|
|
2640
2684
|
id: tooltipId,
|