@star-insure/sdk 3.1.3 → 3.2.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/Back.d.ts +2 -1
- package/dist/components/filter/Dropdown.d.ts +3 -6
- package/dist/sdk.cjs.development.js +36 -40
- 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 +36 -40
- package/dist/sdk.esm.js.map +1 -1
- package/dist/types/api/auth.d.ts +1 -0
- package/dist/types/models/auth/User.d.ts +1 -0
- package/package.json +6 -4
- package/src/components/filter/Back.tsx +3 -2
- package/src/components/filter/Dropdown.tsx +14 -22
- package/src/components/filter/FilterItem.tsx +8 -9
- package/src/components/filter/PageHeader.tsx +9 -7
- package/src/types/api/auth.ts +1 -0
- package/src/types/models/auth/User.ts +1 -0
package/dist/types/api/auth.d.ts
CHANGED
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.2.1",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
@@ -60,19 +60,21 @@
|
|
|
60
60
|
"size-limit": "^7.0.8",
|
|
61
61
|
"tsdx": "^0.14.1",
|
|
62
62
|
"tslib": "^2.4.0",
|
|
63
|
-
"typescript": "^3.9.10"
|
|
63
|
+
"typescript": "^3.9.10",
|
|
64
|
+
"react": "^18.2.0"
|
|
64
65
|
},
|
|
65
66
|
"dependencies": {
|
|
66
67
|
"@headlessui/react": "^1.6.3",
|
|
67
68
|
"@inertiajs/react": "^1.0.0",
|
|
68
69
|
"classnames": "^2.3.2",
|
|
69
|
-
"create-slots": "^0.6.1",
|
|
70
70
|
"date-fns": "^2.28.0",
|
|
71
71
|
"lodash-es": "^4.17.21",
|
|
72
|
-
"react": "^18.2.0",
|
|
73
72
|
"react-dom": "^18.2.0",
|
|
74
73
|
"react-icons": "^4.11.0",
|
|
75
74
|
"react-select": "^5.8.0",
|
|
76
75
|
"uuid": "^9.0.0"
|
|
76
|
+
},
|
|
77
|
+
"peerDependencies": {
|
|
78
|
+
"react": "^18.2.0"
|
|
77
79
|
}
|
|
78
80
|
}
|
|
@@ -2,8 +2,9 @@ import { Link } from "@inertiajs/react";
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { HiArrowLeft } from "react-icons/hi2";
|
|
4
4
|
import { usePage } from "../../lib/page";
|
|
5
|
+
import cn from 'classnames';
|
|
5
6
|
|
|
6
|
-
export function BackButton({ back }: { back?: string | boolean }) {
|
|
7
|
+
export function BackButton({ back, className }: { back?: string | boolean; className?: string; }) {
|
|
7
8
|
const [backUrl, setBackUrl] = React.useState<string | undefined>(typeof back === 'string' ? back : undefined);
|
|
8
9
|
const { breadcrumbs } = usePage().props;
|
|
9
10
|
|
|
@@ -29,7 +30,7 @@ export function BackButton({ back }: { back?: string | boolean }) {
|
|
|
29
30
|
}, [breadcrumbs]);
|
|
30
31
|
|
|
31
32
|
return (
|
|
32
|
-
<Link href={backUrl || '/'} className=
|
|
33
|
+
<Link href={backUrl || '/'} className={cn(className, 'flex items-center justify-center hover:text-teal transition-all')}>
|
|
33
34
|
<HiArrowLeft className="h-5 w-5 stroke-[1.25]" />
|
|
34
35
|
</Link>
|
|
35
36
|
);
|
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
|
-
import { createHost, createSlot } from 'create-slots';
|
|
4
3
|
import { useClickOutside } from "../../lib";
|
|
5
4
|
|
|
6
|
-
const DropdownTitle = createSlot('button');
|
|
7
|
-
const DropdownContent = createSlot('form');
|
|
8
|
-
|
|
9
5
|
type Props = {
|
|
10
|
-
children: React.ReactNode;
|
|
11
6
|
onClose: Function;
|
|
12
7
|
active: boolean;
|
|
8
|
+
title: React.ReactNode;
|
|
9
|
+
children: React.ReactNode;
|
|
13
10
|
}
|
|
14
11
|
|
|
15
|
-
function Dropdown({
|
|
12
|
+
function Dropdown({ onClose, active, title, children }: Props) {
|
|
16
13
|
const ref = React.useRef<HTMLDivElement | null>(null);
|
|
17
14
|
const innerRef = React.useRef<HTMLDivElement | null>(null);
|
|
18
15
|
|
|
@@ -30,22 +27,17 @@ function Dropdown({ children, onClose, active }: Props) {
|
|
|
30
27
|
innerCurrent.style.setProperty('left', `${pos?.left}px`)
|
|
31
28
|
}, [active, ref.current, innerRef.current]);
|
|
32
29
|
|
|
33
|
-
return
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
{
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
)
|
|
45
|
-
});
|
|
30
|
+
return (
|
|
31
|
+
<div ref={ref} className="static inline-block">
|
|
32
|
+
{title}
|
|
33
|
+
|
|
34
|
+
{active && (
|
|
35
|
+
<div ref={innerRef} className="absolute children z-10 flex flex-col">
|
|
36
|
+
{children}
|
|
37
|
+
</div>
|
|
38
|
+
)}
|
|
39
|
+
</div>
|
|
40
|
+
);
|
|
46
41
|
};
|
|
47
42
|
|
|
48
|
-
Dropdown.Title = DropdownTitle;
|
|
49
|
-
Dropdown.Content = DropdownContent;
|
|
50
|
-
|
|
51
43
|
export default Dropdown;
|
|
@@ -184,21 +184,20 @@ export function FilterItem({ filter }: { filter: FilterOption, path?: string })
|
|
|
184
184
|
}
|
|
185
185
|
|
|
186
186
|
return (
|
|
187
|
-
<Dropdown onClose={() => setOpen(!open)} active={isOpen}
|
|
188
|
-
<
|
|
187
|
+
<Dropdown onClose={() => setOpen(!open)} active={isOpen} title={
|
|
188
|
+
<div
|
|
189
189
|
onClick={() => handleClick()}
|
|
190
190
|
className={cn(
|
|
191
|
-
'flex rounded-2xl border hover:border-teal bg-gray-600
|
|
191
|
+
'flex rounded-2xl border hover:border-teal bg-gray-600 px-2 py-1 items-center justify-between shrink-0 gap-2 text-xs text-white hover:bg-teal transition-colors',
|
|
192
192
|
{
|
|
193
193
|
'!bg-teal border-teal': hasFilters,
|
|
194
194
|
}
|
|
195
|
-
|
|
196
|
-
>
|
|
195
|
+
)}>
|
|
197
196
|
<p className="whitespace-nowrap">{filter.label}</p>
|
|
198
197
|
<HiChevronDown />
|
|
199
|
-
</
|
|
200
|
-
|
|
201
|
-
<
|
|
198
|
+
</div>
|
|
199
|
+
}>
|
|
200
|
+
<form
|
|
202
201
|
className={`mt-2 flex max-h-[350px] min-w-[200px] flex-col gap-2 rounded-md border border-gray-300 bg-white p-4 shadow-lg ${ filter.type && filter.type === 'select' ? '' : 'overflow-y-scroll'}`}
|
|
203
202
|
onSubmit={handleApply}
|
|
204
203
|
>
|
|
@@ -312,7 +311,7 @@ export function FilterItem({ filter }: { filter: FilterOption, path?: string })
|
|
|
312
311
|
Apply
|
|
313
312
|
</Button>
|
|
314
313
|
</div>
|
|
315
|
-
</
|
|
314
|
+
</form>
|
|
316
315
|
</Dropdown>
|
|
317
316
|
);
|
|
318
317
|
}
|
|
@@ -138,17 +138,19 @@ export default function PageHeader({
|
|
|
138
138
|
}, [actions]);
|
|
139
139
|
|
|
140
140
|
return (
|
|
141
|
-
<section className={cn('col-span-full max-w-full rounded-lg bg-white p-2 shadow', className)}>
|
|
142
|
-
|
|
143
|
-
<
|
|
144
|
-
|
|
145
|
-
|
|
141
|
+
<section className={cn('col-span-full flex items-center gap-2 max-w-full rounded-lg bg-white p-2 shadow', className)}>
|
|
142
|
+
{back && (
|
|
143
|
+
<BackButton back={back} className="bg-gray-100 h-[60px] w-[60px] rounded" />
|
|
144
|
+
)}
|
|
145
|
+
|
|
146
|
+
<div className={cn('w-full grid grid-cols-[auto_1fr_auto] h-[60px] rounded bg-gray-100 p-3 gap-4', innerClassName)}>
|
|
147
|
+
<div className="mr-auto flex items-center gap-4 ml-1">
|
|
146
148
|
{search && <SearchBar search={search} active={isSearchActive} onActive={setSearchActive} placeholder={`Search ${title}...`} />}
|
|
147
149
|
|
|
148
150
|
{!isSearchActive && <h1 className="text-base font-bold">{title}</h1>}
|
|
149
151
|
</div>
|
|
150
152
|
|
|
151
|
-
<div className="flex
|
|
153
|
+
<div className="flex items-center ml-auto gap-2 h-full min-w-0 max-w-full">
|
|
152
154
|
{filterOptions.length > 0 && (
|
|
153
155
|
<>
|
|
154
156
|
<button onClick={handleClear} className="p-1.5 hover:text-red-500"><HiXMark className="w-5 h-5 stroke-[1.25]" /></button>
|
|
@@ -165,7 +167,7 @@ export default function PageHeader({
|
|
|
165
167
|
</div>
|
|
166
168
|
|
|
167
169
|
{filteredActions.length > 0 && (
|
|
168
|
-
<div className="flex items-center gap-3">
|
|
170
|
+
<div className="flex items-center gap-3 bg-gray-100">
|
|
169
171
|
{filterOptions.length > 0 && <div className="w-[1px] h-full bg-gray-300" />}
|
|
170
172
|
<nav className="flex items-center gap-2">
|
|
171
173
|
{filteredActions.map((action) => (
|
package/src/types/api/auth.ts
CHANGED