@star-insure/sdk 3.1.0 → 3.1.2

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.
@@ -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.0",
5
+ "version": "3.1.2",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
@@ -143,7 +143,7 @@ export function FilterItem({ filter }: { filter: FilterOption, path?: string })
143
143
  search.delete(`${filter.name}[]`);
144
144
 
145
145
  // Apply the filters to the query string
146
- selected.forEach((selectedValue, i) => {
146
+ selected.forEach((selectedValue) => {
147
147
  // Fall back to option equality filters
148
148
  search.append(`${filter.name}[]`, selectedValue);
149
149
  });
@@ -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
- {actions.length > 0 && (
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
- {actions.map((action) => (
171
+ {filteredActions.map((action) => (
168
172
  <Action key={`${action.title}-${action.as}-${action.href}`} {...action} />
169
173
  ))}
170
174
  </nav>
@@ -1,3 +1,4 @@
1
1
  export * from './common';
2
2
  export * from './tables';
3
3
  export * from './forms';
4
+ export * from './filter';
@@ -30,6 +30,7 @@ export type TPageHeaderAction = {
30
30
  target?: '_self' | '_blank';
31
31
  onClick?: Function;
32
32
  type?: 'button' | 'submit';
33
+ hidden?: boolean;
33
34
  };
34
35
 
35
36
  export type Environment = 'production' | 'staging' | 'testing' | 'local';