@star-insure/sdk 3.1.1 → 3.1.3
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/lib/page.d.ts +1 -1
- package/dist/sdk.cjs.development.js +9 -3
- 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 +9 -3
- package/dist/sdk.esm.js.map +1 -1
- package/dist/types/misc/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/components/filter/Back.tsx +1 -0
- package/src/components/filter/PageHeader.tsx +6 -2
- package/src/lib/page.tsx +1 -1
- package/src/types/misc/index.ts +1 -0
|
@@ -25,6 +25,7 @@ export declare type TPageHeaderAction = {
|
|
|
25
25
|
target?: '_self' | '_blank';
|
|
26
26
|
onClick?: Function;
|
|
27
27
|
type?: 'button' | 'submit';
|
|
28
|
+
hidden?: boolean;
|
|
28
29
|
};
|
|
29
30
|
export declare type Environment = 'production' | 'staging' | 'testing' | 'local';
|
|
30
31
|
export declare type Breadcrumb = {
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@star-insure/sdk",
|
|
3
3
|
"description": "The SDK for Star Insure client apps with shared helper functions and TypeScript definitions.",
|
|
4
4
|
"author": "alexclark_nz",
|
|
5
|
-
"version": "3.1.
|
|
5
|
+
"version": "3.1.3",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
@@ -12,6 +12,7 @@ export function BackButton({ back }: { back?: string | boolean }) {
|
|
|
12
12
|
*/
|
|
13
13
|
React.useEffect(() => {
|
|
14
14
|
if (typeof window !== 'undefined') {
|
|
15
|
+
if (!breadcrumbs) return;
|
|
15
16
|
// Set back button URL
|
|
16
17
|
if (back && typeof back === 'boolean') {
|
|
17
18
|
// If we haven't provided a path as a prop, use the last breadcrumb that's not the current one
|
|
@@ -133,6 +133,10 @@ export default function PageHeader({
|
|
|
133
133
|
checkScroll();
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
+
const filteredActions = React.useMemo(() => {
|
|
137
|
+
return actions.filter(action => !action.hidden);
|
|
138
|
+
}, [actions]);
|
|
139
|
+
|
|
136
140
|
return (
|
|
137
141
|
<section className={cn('col-span-full max-w-full rounded-lg bg-white p-2 shadow', className)}>
|
|
138
142
|
<div className={cn('grid grid-cols-[auto_1fr_auto] min-h-[60px] rounded gap-4 bg-gray-100 p-3', innerClassName)}>
|
|
@@ -160,11 +164,11 @@ export default function PageHeader({
|
|
|
160
164
|
)}
|
|
161
165
|
</div>
|
|
162
166
|
|
|
163
|
-
{
|
|
167
|
+
{filteredActions.length > 0 && (
|
|
164
168
|
<div className="flex items-center gap-3">
|
|
165
169
|
{filterOptions.length > 0 && <div className="w-[1px] h-full bg-gray-300" />}
|
|
166
170
|
<nav className="flex items-center gap-2">
|
|
167
|
-
{
|
|
171
|
+
{filteredActions.map((action) => (
|
|
168
172
|
<Action key={`${action.title}-${action.as}-${action.href}`} {...action} />
|
|
169
173
|
))}
|
|
170
174
|
</nav>
|
package/src/lib/page.tsx
CHANGED
|
@@ -7,7 +7,7 @@ import { AuthContext, Breadcrumb, Environment } from '../types';
|
|
|
7
7
|
*/
|
|
8
8
|
type CustomPageProps = {
|
|
9
9
|
env: Environment;
|
|
10
|
-
breadcrumbs
|
|
10
|
+
breadcrumbs?: Breadcrumb[];
|
|
11
11
|
links: Record<string, string>;
|
|
12
12
|
access_token?: string;
|
|
13
13
|
impersonate_id?: number;
|
package/src/types/misc/index.ts
CHANGED