@star-insure/sdk 4.2.0 → 4.3.1
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/PageHeader.d.ts +9 -3
- package/dist/sdk.cjs.development.js +41 -5
- 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 +41 -5
- package/dist/sdk.esm.js.map +1 -1
- package/dist/types/misc/index.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/filter/FilterItem.tsx +22 -0
- package/src/components/filter/PageHeader.tsx +22 -1
- package/src/types/misc/index.ts +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { FilterOption, TPageHeaderAction } from '../../types';
|
|
3
3
|
interface Props {
|
|
4
4
|
title: string;
|
|
@@ -10,6 +10,12 @@ interface Props {
|
|
|
10
10
|
backText?: string;
|
|
11
11
|
filterOptions?: FilterOption[];
|
|
12
12
|
focusSearchShortcut?: boolean;
|
|
13
|
+
children?: React.ReactNode;
|
|
13
14
|
}
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
declare function PageHeader({ title, search, className, innerClassName, back, actions, filterOptions, focusSearchShortcut, children }: Props): JSX.Element;
|
|
16
|
+
declare namespace PageHeader {
|
|
17
|
+
var Action: ({ children }: {
|
|
18
|
+
children: React.ReactNode;
|
|
19
|
+
}) => JSX.Element;
|
|
20
|
+
}
|
|
21
|
+
export default PageHeader;
|
|
@@ -2622,7 +2622,7 @@ function Dropdown(_ref) {
|
|
|
2622
2622
|
}
|
|
2623
2623
|
|
|
2624
2624
|
function FilterItem(_ref) {
|
|
2625
|
-
var _filter$options, _filter$options2, _filter$options3, _selected$, _selected$2;
|
|
2625
|
+
var _filter$options, _filter$options2, _filter$options3, _selected$, _selected$2, _selected$3;
|
|
2626
2626
|
|
|
2627
2627
|
var filter = _ref.filter;
|
|
2628
2628
|
|
|
@@ -2760,6 +2760,16 @@ function FilterItem(_ref) {
|
|
|
2760
2760
|
}
|
|
2761
2761
|
}
|
|
2762
2762
|
|
|
2763
|
+
function handleText(e) {
|
|
2764
|
+
var value = e.currentTarget.value;
|
|
2765
|
+
|
|
2766
|
+
if (value) {
|
|
2767
|
+
setSelected([value]);
|
|
2768
|
+
} else {
|
|
2769
|
+
setSelected([]);
|
|
2770
|
+
}
|
|
2771
|
+
}
|
|
2772
|
+
|
|
2763
2773
|
function handleApply(e) {
|
|
2764
2774
|
e.preventDefault();
|
|
2765
2775
|
var search = new URLSearchParams(window.location.search); // Reset the page in the query
|
|
@@ -2932,6 +2942,15 @@ function FilterItem(_ref) {
|
|
|
2932
2942
|
})
|
|
2933
2943
|
});
|
|
2934
2944
|
}
|
|
2945
|
+
})), filter.type === 'text' && React__default.createElement("div", {
|
|
2946
|
+
className: 'w-full'
|
|
2947
|
+
}, React__default.createElement("input", {
|
|
2948
|
+
type: "text",
|
|
2949
|
+
name: filter.name,
|
|
2950
|
+
placeholder: filter.label,
|
|
2951
|
+
value: (_selected$3 = selected[0]) != null ? _selected$3 : '',
|
|
2952
|
+
onChange: handleText,
|
|
2953
|
+
className: "!p-2 text-sm w-full"
|
|
2935
2954
|
}))), React__default.createElement("div", {
|
|
2936
2955
|
className: "bg-gray-100 border-t border-gray-200 flex items-center gap-2 p-4 bottom-0 sticky"
|
|
2937
2956
|
}, React__default.createElement(Button, {
|
|
@@ -2961,7 +2980,8 @@ function PageHeader(_ref) {
|
|
|
2961
2980
|
_ref$filterOptions = _ref.filterOptions,
|
|
2962
2981
|
filterOptions = _ref$filterOptions === void 0 ? [] : _ref$filterOptions,
|
|
2963
2982
|
_ref$focusSearchShort = _ref.focusSearchShortcut,
|
|
2964
|
-
focusSearchShortcut = _ref$focusSearchShort === void 0 ? false : _ref$focusSearchShort
|
|
2983
|
+
focusSearchShortcut = _ref$focusSearchShort === void 0 ? false : _ref$focusSearchShort,
|
|
2984
|
+
children = _ref.children;
|
|
2965
2985
|
|
|
2966
2986
|
var _React$useState = React__default.useState(false),
|
|
2967
2987
|
isSearchActive = _React$useState[0],
|
|
@@ -2973,6 +2993,15 @@ function PageHeader(_ref) {
|
|
|
2973
2993
|
overScroll = _React$useState2[0],
|
|
2974
2994
|
setOverScroll = _React$useState2[1];
|
|
2975
2995
|
|
|
2996
|
+
var actionChildren = []; // Categorize children based on their type
|
|
2997
|
+
|
|
2998
|
+
React__default.Children.forEach(children, function (child) {
|
|
2999
|
+
if (React__default.isValidElement(child)) {
|
|
3000
|
+
if (child.type === PageHeader.Action) {
|
|
3001
|
+
actionChildren.push(child);
|
|
3002
|
+
}
|
|
3003
|
+
}
|
|
3004
|
+
});
|
|
2976
3005
|
React__default.useEffect(function () {
|
|
2977
3006
|
var current = scrollContainerRef.current;
|
|
2978
3007
|
if (!current) return;
|
|
@@ -3092,7 +3121,7 @@ function PageHeader(_ref) {
|
|
|
3092
3121
|
back: back,
|
|
3093
3122
|
className: "bg-gray-100 h-[60px] w-[60px] rounded"
|
|
3094
3123
|
}), React__default.createElement("div", {
|
|
3095
|
-
className: cn('w-full grid grid-cols-[
|
|
3124
|
+
className: cn('w-full grid grid-cols-[auto_1fr_auto_auto] h-[60px] rounded bg-gray-100 p-3 gap-4', innerClassName)
|
|
3096
3125
|
}, React__default.createElement("button", {
|
|
3097
3126
|
type: "button",
|
|
3098
3127
|
disabled: !search,
|
|
@@ -3141,8 +3170,15 @@ function PageHeader(_ref) {
|
|
|
3141
3170
|
return React__default.createElement(Action, Object.assign({
|
|
3142
3171
|
key: action.title + "-" + action.as + "-" + action.href
|
|
3143
3172
|
}, action));
|
|
3144
|
-
})))
|
|
3145
|
-
|
|
3173
|
+
}))), actionChildren && React__default.createElement("div", {
|
|
3174
|
+
className: "flex items-center gap-3 bg-gray-100"
|
|
3175
|
+
}, actionChildren)));
|
|
3176
|
+
} // Subcomponents
|
|
3177
|
+
|
|
3178
|
+
PageHeader.Action = function (_ref2) {
|
|
3179
|
+
var children = _ref2.children;
|
|
3180
|
+
return React__default.createElement("div", null, children);
|
|
3181
|
+
};
|
|
3146
3182
|
|
|
3147
3183
|
exports.Button = Button;
|
|
3148
3184
|
exports.Card = Card;
|