@star-insure/sdk 4.3.4 → 4.4.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 +62 -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 +62 -8
- package/dist/sdk.esm.js.map +1 -1
- package/dist/types/misc/index.d.ts +9 -0
- package/package.json +1 -1
- package/src/components/filter/Action.tsx +50 -1
- package/src/components/forms/DateOfBirthField.tsx +16 -4
- package/src/types/misc/index.ts +10 -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, shortcutKey }: TPageHeaderAction): JSX.Element;
|
|
3
|
+
export default function Action({ title, href, as, target, type, onClick, shortcutKey, actions }: TPageHeaderAction): JSX.Element;
|
|
@@ -1874,17 +1874,25 @@ function DateOfBirthField(_ref) {
|
|
|
1874
1874
|
day = _ref2[2];
|
|
1875
1875
|
|
|
1876
1876
|
var isValidDate = year && month && day && !isNaN(Date.parse(year + "-" + month + "-" + day));
|
|
1877
|
+
var styleReq = {
|
|
1878
|
+
backgroundPosition: 'top 10px right 3px, center right 10px'
|
|
1879
|
+
};
|
|
1880
|
+
var style = {
|
|
1881
|
+
backgroundPosition: 'right 0.5rem center',
|
|
1882
|
+
paddingRight: '1.5rem'
|
|
1883
|
+
};
|
|
1877
1884
|
return React__default.createElement("span", {
|
|
1878
1885
|
className: "flex flex-col gap-2"
|
|
1879
1886
|
}, React__default.createElement("span", {
|
|
1880
|
-
className: "flex
|
|
1887
|
+
className: "flex w-full border border-gray-300 rounded-lg bg-white"
|
|
1881
1888
|
}, React__default.createElement("select", {
|
|
1882
1889
|
name: name + "_day",
|
|
1883
1890
|
id: id + "_day",
|
|
1884
1891
|
value: day,
|
|
1885
|
-
className: "flex-grow focus:outline-none border-0",
|
|
1892
|
+
className: "flex-grow focus:outline-none border-0 !mr-[3px] lg:pl-4 xl:pl-2",
|
|
1886
1893
|
onChange: handleChange,
|
|
1887
|
-
required: isRequired
|
|
1894
|
+
required: isRequired,
|
|
1895
|
+
style: isRequired ? styleReq : style
|
|
1888
1896
|
}, React__default.createElement("option", {
|
|
1889
1897
|
value: ""
|
|
1890
1898
|
}, "Day"), dayOptions.map(function (option) {
|
|
@@ -1896,9 +1904,10 @@ function DateOfBirthField(_ref) {
|
|
|
1896
1904
|
name: name + "_month",
|
|
1897
1905
|
id: id + "_month",
|
|
1898
1906
|
value: month,
|
|
1899
|
-
className: "flex-grow focus:outline-none border-0",
|
|
1907
|
+
className: "flex-grow focus:outline-none border-0 !mr-[3px] lg:pl-4 xl:pl-2",
|
|
1900
1908
|
onChange: handleChange,
|
|
1901
|
-
required: isRequired
|
|
1909
|
+
required: isRequired,
|
|
1910
|
+
style: isRequired ? styleReq : style
|
|
1902
1911
|
}, React__default.createElement("option", {
|
|
1903
1912
|
value: ""
|
|
1904
1913
|
}, "Month"), monthOptions.map(function (option) {
|
|
@@ -1910,9 +1919,10 @@ function DateOfBirthField(_ref) {
|
|
|
1910
1919
|
name: name + "_year",
|
|
1911
1920
|
id: id + "_year",
|
|
1912
1921
|
value: year,
|
|
1913
|
-
className: "flex-grow focus:outline-none border-0",
|
|
1922
|
+
className: "flex-grow focus:outline-none border-0 !mr-[3px] lg:pl-4 xl:pl-2",
|
|
1914
1923
|
onChange: handleChange,
|
|
1915
|
-
required: isRequired
|
|
1924
|
+
required: isRequired,
|
|
1925
|
+
style: isRequired ? styleReq : style
|
|
1916
1926
|
}, React__default.createElement("option", {
|
|
1917
1927
|
value: ""
|
|
1918
1928
|
}, "Year"), yearOptions.map(function (option) {
|
|
@@ -2592,11 +2602,27 @@ function Action(_ref) {
|
|
|
2592
2602
|
type = _ref.type,
|
|
2593
2603
|
_ref$onClick = _ref.onClick,
|
|
2594
2604
|
_onClick = _ref$onClick === void 0 ? function () {} : _ref$onClick,
|
|
2595
|
-
shortcutKey = _ref.shortcutKey
|
|
2605
|
+
shortcutKey = _ref.shortcutKey,
|
|
2606
|
+
actions = _ref.actions;
|
|
2596
2607
|
|
|
2597
2608
|
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';
|
|
2598
2609
|
var tooltipId = "action-" + title;
|
|
2599
2610
|
var tooltipContent = shortcutKey ? "Ctrl + " + shortcutKey : undefined;
|
|
2611
|
+
var actionButtonRef = React__default.useRef(null);
|
|
2612
|
+
var isActionsButton = actions && actions.length > 0;
|
|
2613
|
+
var actionsButtonClassName = 'relative cursor-pointer ' + className;
|
|
2614
|
+
|
|
2615
|
+
var _React$useState = React__default.useState(false),
|
|
2616
|
+
isInnerActionVisible = _React$useState[0],
|
|
2617
|
+
setIsInnerActionVisible = _React$useState[1];
|
|
2618
|
+
|
|
2619
|
+
var toggleActionsMenu = function toggleActionsMenu() {
|
|
2620
|
+
setIsInnerActionVisible(!isInnerActionVisible);
|
|
2621
|
+
};
|
|
2622
|
+
|
|
2623
|
+
useClickOutside(actionButtonRef, function () {
|
|
2624
|
+
return setIsInnerActionVisible(false);
|
|
2625
|
+
});
|
|
2600
2626
|
|
|
2601
2627
|
function runAction() {
|
|
2602
2628
|
if (as === 'Link' && href) {
|
|
@@ -2632,6 +2658,34 @@ function Action(_ref) {
|
|
|
2632
2658
|
};
|
|
2633
2659
|
}, [shortcutKey]);
|
|
2634
2660
|
|
|
2661
|
+
if (isActionsButton) {
|
|
2662
|
+
return React__default.createElement(React__default.Fragment, null, tooltipContent && React__default.createElement(reactTooltip.Tooltip, {
|
|
2663
|
+
id: tooltipId,
|
|
2664
|
+
className: "z-10"
|
|
2665
|
+
}), React__default.createElement("div", {
|
|
2666
|
+
ref: actionButtonRef,
|
|
2667
|
+
"data-tooltip-id": tooltipId,
|
|
2668
|
+
"data-tooltip-content": tooltipContent,
|
|
2669
|
+
className: actionsButtonClassName,
|
|
2670
|
+
onClick: toggleActionsMenu
|
|
2671
|
+
}, title, isInnerActionVisible && React__default.createElement("div", {
|
|
2672
|
+
className: "absolute top-[120%] right-[-20%] z-10"
|
|
2673
|
+
}, React__default.createElement("div", {
|
|
2674
|
+
className: "flex flex-col gap-2 bg-white rounded-lg shadow-xl p-3"
|
|
2675
|
+
}, actions && actions.map(function (action, index) {
|
|
2676
|
+
if (action.hidden) return null;
|
|
2677
|
+
return React__default.createElement(Action, {
|
|
2678
|
+
key: index,
|
|
2679
|
+
title: action.title,
|
|
2680
|
+
as: action.as,
|
|
2681
|
+
href: action.href,
|
|
2682
|
+
target: action.target,
|
|
2683
|
+
onClick: action.onClick,
|
|
2684
|
+
type: 'button'
|
|
2685
|
+
});
|
|
2686
|
+
})))));
|
|
2687
|
+
}
|
|
2688
|
+
|
|
2635
2689
|
if (as === 'Link' && href) {
|
|
2636
2690
|
return React__default.createElement(React__default.Fragment, null, tooltipContent && React__default.createElement(reactTooltip.Tooltip, {
|
|
2637
2691
|
id: tooltipId,
|