@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
package/dist/sdk.esm.js
CHANGED
|
@@ -1867,17 +1867,25 @@ function DateOfBirthField(_ref) {
|
|
|
1867
1867
|
day = _ref2[2];
|
|
1868
1868
|
|
|
1869
1869
|
var isValidDate = year && month && day && !isNaN(Date.parse(year + "-" + month + "-" + day));
|
|
1870
|
+
var styleReq = {
|
|
1871
|
+
backgroundPosition: 'top 10px right 3px, center right 10px'
|
|
1872
|
+
};
|
|
1873
|
+
var style = {
|
|
1874
|
+
backgroundPosition: 'right 0.5rem center',
|
|
1875
|
+
paddingRight: '1.5rem'
|
|
1876
|
+
};
|
|
1870
1877
|
return React__default.createElement("span", {
|
|
1871
1878
|
className: "flex flex-col gap-2"
|
|
1872
1879
|
}, React__default.createElement("span", {
|
|
1873
|
-
className: "flex
|
|
1880
|
+
className: "flex w-full border border-gray-300 rounded-lg bg-white"
|
|
1874
1881
|
}, React__default.createElement("select", {
|
|
1875
1882
|
name: name + "_day",
|
|
1876
1883
|
id: id + "_day",
|
|
1877
1884
|
value: day,
|
|
1878
|
-
className: "flex-grow focus:outline-none border-0",
|
|
1885
|
+
className: "flex-grow focus:outline-none border-0 !mr-[3px] lg:pl-4 xl:pl-2",
|
|
1879
1886
|
onChange: handleChange,
|
|
1880
|
-
required: isRequired
|
|
1887
|
+
required: isRequired,
|
|
1888
|
+
style: isRequired ? styleReq : style
|
|
1881
1889
|
}, React__default.createElement("option", {
|
|
1882
1890
|
value: ""
|
|
1883
1891
|
}, "Day"), dayOptions.map(function (option) {
|
|
@@ -1889,9 +1897,10 @@ function DateOfBirthField(_ref) {
|
|
|
1889
1897
|
name: name + "_month",
|
|
1890
1898
|
id: id + "_month",
|
|
1891
1899
|
value: month,
|
|
1892
|
-
className: "flex-grow focus:outline-none border-0",
|
|
1900
|
+
className: "flex-grow focus:outline-none border-0 !mr-[3px] lg:pl-4 xl:pl-2",
|
|
1893
1901
|
onChange: handleChange,
|
|
1894
|
-
required: isRequired
|
|
1902
|
+
required: isRequired,
|
|
1903
|
+
style: isRequired ? styleReq : style
|
|
1895
1904
|
}, React__default.createElement("option", {
|
|
1896
1905
|
value: ""
|
|
1897
1906
|
}, "Month"), monthOptions.map(function (option) {
|
|
@@ -1903,9 +1912,10 @@ function DateOfBirthField(_ref) {
|
|
|
1903
1912
|
name: name + "_year",
|
|
1904
1913
|
id: id + "_year",
|
|
1905
1914
|
value: year,
|
|
1906
|
-
className: "flex-grow focus:outline-none border-0",
|
|
1915
|
+
className: "flex-grow focus:outline-none border-0 !mr-[3px] lg:pl-4 xl:pl-2",
|
|
1907
1916
|
onChange: handleChange,
|
|
1908
|
-
required: isRequired
|
|
1917
|
+
required: isRequired,
|
|
1918
|
+
style: isRequired ? styleReq : style
|
|
1909
1919
|
}, React__default.createElement("option", {
|
|
1910
1920
|
value: ""
|
|
1911
1921
|
}, "Year"), yearOptions.map(function (option) {
|
|
@@ -2585,11 +2595,27 @@ function Action(_ref) {
|
|
|
2585
2595
|
type = _ref.type,
|
|
2586
2596
|
_ref$onClick = _ref.onClick,
|
|
2587
2597
|
_onClick = _ref$onClick === void 0 ? function () {} : _ref$onClick,
|
|
2588
|
-
shortcutKey = _ref.shortcutKey
|
|
2598
|
+
shortcutKey = _ref.shortcutKey,
|
|
2599
|
+
actions = _ref.actions;
|
|
2589
2600
|
|
|
2590
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';
|
|
2591
2602
|
var tooltipId = "action-" + title;
|
|
2592
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
|
+
});
|
|
2593
2619
|
|
|
2594
2620
|
function runAction() {
|
|
2595
2621
|
if (as === 'Link' && href) {
|
|
@@ -2625,6 +2651,34 @@ function Action(_ref) {
|
|
|
2625
2651
|
};
|
|
2626
2652
|
}, [shortcutKey]);
|
|
2627
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
|
+
|
|
2628
2682
|
if (as === 'Link' && href) {
|
|
2629
2683
|
return React__default.createElement(React__default.Fragment, null, tooltipContent && React__default.createElement(Tooltip, {
|
|
2630
2684
|
id: tooltipId,
|