@star-insure/sdk 4.6.0 → 5.0.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/sdk.cjs.development.js +18 -18
- 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 +18 -18
- package/dist/sdk.esm.js.map +1 -1
- package/dist/types/api/auth.d.ts +1 -1
- package/package.json +3 -1
- package/src/components/common/Button.tsx +1 -1
- package/src/components/common/Modal.tsx +1 -1
- package/src/components/common/ToastItem.tsx +2 -2
- package/src/components/filter/Back.tsx +1 -1
- package/src/components/filter/FilterItem.tsx +2 -2
- package/src/components/filter/PageHeader.tsx +6 -6
- package/src/components/filter/SearchBar.tsx +2 -2
- package/src/components/forms/MoneyField.tsx +1 -1
- package/src/components/forms/RegistrationSearchField.tsx +1 -1
- package/src/components/tables/TableHead.tsx +1 -1
- package/src/components/tables/TableRow.tsx +1 -1
- package/src/tailwind-preset.js +51 -0
- package/src/theme.css +30 -0
- package/src/types/api/auth.ts +1 -0
package/dist/types/api/auth.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare type UserContext = 'administrator' | 'staff' | 'broker' | 'agent' | 'security' | 'customer';
|
|
1
|
+
export declare type UserContext = 'administrator' | 'staff' | 'broker' | 'dealer' | 'agent' | 'security' | 'customer';
|
|
2
2
|
declare type AuthUser = {
|
|
3
3
|
id: number;
|
|
4
4
|
name: string;
|
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": "
|
|
5
|
+
"version": "5.0.0",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
@@ -67,6 +67,8 @@
|
|
|
67
67
|
"dependencies": {
|
|
68
68
|
"@headlessui/react": "^1.6.3",
|
|
69
69
|
"@inertiajs/react": "^1.0.0",
|
|
70
|
+
"@tailwindcss/forms": "^0.5.9",
|
|
71
|
+
"@tailwindcss/typography": "^0.5.15",
|
|
70
72
|
"classnames": "^2.3.2",
|
|
71
73
|
"date-fns": "^2.28.0",
|
|
72
74
|
"lodash-es": "^4.17.21",
|
|
@@ -31,7 +31,7 @@ export default function Button({
|
|
|
31
31
|
: 'font-black inline-flex items-center gap-3 justify-center text-white text-center px-5 py-2 rounded-md min-w-[120px] transition-all hover:brightness-110';
|
|
32
32
|
|
|
33
33
|
const statusClass =
|
|
34
|
-
(status === 'primary' && 'bg-
|
|
34
|
+
(status === 'primary' && 'bg-primary') ||
|
|
35
35
|
(status === 'danger' && 'bg-red-500') ||
|
|
36
36
|
(status === 'warning' && 'bg-yellow-400') ||
|
|
37
37
|
(status === 'info' && 'bg-blue-400') ||
|
|
@@ -38,7 +38,7 @@ export default function Modal({ children, isActive = false, onClose, title, widt
|
|
|
38
38
|
leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
|
|
39
39
|
>
|
|
40
40
|
<div className={`${className} w-full align-start inline-block bg-white rounded-lg px-4 pt-5 pb-4 text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-7xl sm:p-6 ${width}`}>
|
|
41
|
-
<div className={`flex gap-4 mb-4 text-
|
|
41
|
+
<div className={`flex gap-4 mb-4 text-secondary ${title ? 'border-b-2 border-secondary pb-4' : ''}`}>
|
|
42
42
|
{title && <h3 className="font-black text-lg">{title}</h3>}
|
|
43
43
|
<button type="button" onClick={onClose} className="ml-auto transition-all hover:opacity-50">
|
|
44
44
|
<svg xmlns="http://www.w3.org/2000/svg" className="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2}>
|
|
@@ -8,10 +8,10 @@ export default function ToastItem({ _id = '', message, status = 'default' }: Toa
|
|
|
8
8
|
|
|
9
9
|
const defaultClasses = 'w-full min-w-[250px] p-4 shadow flex justify-between items-center font-black rounded-md not:';
|
|
10
10
|
|
|
11
|
-
const statusClasses = status === 'success' && 'bg-
|
|
11
|
+
const statusClasses = status === 'success' && 'bg-primary text-white'
|
|
12
12
|
|| status === 'error' && 'bg-red-500 text-white'
|
|
13
13
|
|| status === 'warning' && 'bg-yellow-400 text-white'
|
|
14
|
-
|| 'bg-white text-
|
|
14
|
+
|| 'bg-white text-secondary';
|
|
15
15
|
|
|
16
16
|
const classes = `${defaultClasses} ${statusClasses}`;
|
|
17
17
|
|
|
@@ -30,7 +30,7 @@ export function BackButton({ back, className }: { back?: string | boolean; class
|
|
|
30
30
|
}, [breadcrumbs]);
|
|
31
31
|
|
|
32
32
|
return (
|
|
33
|
-
<Link href={backUrl || '/'} className={cn(className, 'flex items-center justify-center hover:text-
|
|
33
|
+
<Link href={backUrl || '/'} className={cn(className, 'flex items-center justify-center text-back-button-text hover:text-primary transition-all')}>
|
|
34
34
|
<HiArrowLeft className="h-5 w-5 stroke-[1.25]" />
|
|
35
35
|
</Link>
|
|
36
36
|
);
|
|
@@ -198,9 +198,9 @@ export function FilterItem({ filter }: { filter: FilterOption, path?: string })
|
|
|
198
198
|
<div
|
|
199
199
|
onClick={() => handleClick()}
|
|
200
200
|
className={cn(
|
|
201
|
-
'flex rounded-2xl border hover:cursor-pointer hover:border-
|
|
201
|
+
'flex rounded-2xl border hover:cursor-pointer hover:border-primary bg-gray-600 px-2 py-1 items-center justify-between shrink-0 gap-2 text-xs text-white hover:bg-primary transition-colors',
|
|
202
202
|
{
|
|
203
|
-
'!bg-
|
|
203
|
+
'!bg-primary border-primary': hasFilters,
|
|
204
204
|
}
|
|
205
205
|
)}>
|
|
206
206
|
<p className="whitespace-nowrap">{filter.label}</p>
|
|
@@ -155,21 +155,21 @@ export default function PageHeader({
|
|
|
155
155
|
return (
|
|
156
156
|
<section className={cn('col-span-full flex items-center gap-2 max-w-full rounded-lg bg-white p-2 shadow', className)}>
|
|
157
157
|
{back && (
|
|
158
|
-
<BackButton back={back} className="bg-
|
|
158
|
+
<BackButton back={back} className="bg-back-button-background h-[60px] w-[60px] rounded" />
|
|
159
159
|
)}
|
|
160
160
|
|
|
161
|
-
<div className={cn('w-full grid grid-cols-[auto_1fr_auto_auto] h-[60px] rounded bg-
|
|
161
|
+
<div className={cn('w-full grid grid-cols-[auto_1fr_auto_auto] h-[60px] rounded bg-page-header-background p-3 gap-4', innerClassName)}>
|
|
162
162
|
<button
|
|
163
163
|
type="button"
|
|
164
164
|
disabled={!search}
|
|
165
165
|
onClick={() => setSearchActive(true)}
|
|
166
|
-
className={cn('mr-auto flex items-center gap-4 transition-colors pr-6 pl-1 disabled:opacity-100', {
|
|
167
|
-
'hover:text-
|
|
166
|
+
className={cn('mr-auto flex items-center gap-4 transition-colors pr-6 pl-1 disabled:opacity-100 text-page-header-text', {
|
|
167
|
+
'hover:text-primary': search && !isSearchActive,
|
|
168
168
|
}
|
|
169
169
|
)}>
|
|
170
170
|
{search && <SearchBar search={search} active={isSearchActive} onActive={setSearchActive} placeholder={`Search ${title}...`} focusSearchShortcut={focusSearchShortcut} />}
|
|
171
171
|
|
|
172
|
-
{!isSearchActive && <h1 className="text-base font-black">{title}</h1>}
|
|
172
|
+
{!isSearchActive && <h1 className="text-base text-page-header-text font-black">{title}</h1>}
|
|
173
173
|
</button>
|
|
174
174
|
|
|
175
175
|
<div className="flex items-center ml-auto gap-2 h-full min-w-0 max-w-full">
|
|
@@ -189,7 +189,7 @@ export default function PageHeader({
|
|
|
189
189
|
</div>
|
|
190
190
|
|
|
191
191
|
{filteredActions.length > 0 && (
|
|
192
|
-
<div className="flex items-center gap-3 bg-
|
|
192
|
+
<div className="flex items-center gap-3 bg-page-header-background">
|
|
193
193
|
{filterOptions.length > 0 && <div className="w-[1px] h-full bg-gray-300" />}
|
|
194
194
|
<nav className="flex items-center gap-2">
|
|
195
195
|
{filteredActions.map((action) => (
|
|
@@ -86,7 +86,7 @@ export default function SearchBar({ search, active, onActive, placeholder, focus
|
|
|
86
86
|
title="Open Search Bar"
|
|
87
87
|
type="button"
|
|
88
88
|
onClick={() => onActive(true)}
|
|
89
|
-
className="flex items-center justify-center rounded-full hover:text-
|
|
89
|
+
className="flex items-center justify-center rounded-full hover:text-primary p-1 hover:bg-gray-100"
|
|
90
90
|
>
|
|
91
91
|
<HiMagnifyingGlass className="h-5 w-5 stroke-[1.25]" />
|
|
92
92
|
</button>
|
|
@@ -94,7 +94,7 @@ export default function SearchBar({ search, active, onActive, placeholder, focus
|
|
|
94
94
|
{active && (
|
|
95
95
|
<form
|
|
96
96
|
onSubmit={handleSearch}
|
|
97
|
-
className="group flex items-center gap-2 rounded-full bg-white pr-4 pl-1 shadow transition-all focus-within:outline-none focus-within:ring-1 focus-within:ring-
|
|
97
|
+
className="group flex items-center gap-2 rounded-full bg-white pr-4 pl-1 shadow transition-all focus-within:outline-none focus-within:ring-1 focus-within:ring-primary"
|
|
98
98
|
>
|
|
99
99
|
<input
|
|
100
100
|
type="text"
|
|
@@ -28,7 +28,7 @@ export default function MoneyField({ value = 0, onChange, name = 'value', id = '
|
|
|
28
28
|
const displayValue = formatMoney(value, 0);
|
|
29
29
|
|
|
30
30
|
return (
|
|
31
|
-
<div className={`${className} flex items-center gap-2 pl-4 rounded-md border border-gray-300 transition-all focus-within:border-
|
|
31
|
+
<div className={`${className} flex items-center gap-2 pl-4 rounded-md border border-gray-300 transition-all focus-within:border-primary focus-within:outline-none focus-within:ring focus-within:ring-primary focus-within:ring-opacity-50`}>
|
|
32
32
|
<span className="font-bold pr-2">$</span>
|
|
33
33
|
<input
|
|
34
34
|
type="text"
|
|
@@ -228,7 +228,7 @@ export default function RegistrationSearchField({
|
|
|
228
228
|
type="button"
|
|
229
229
|
onClick={handleSearch}
|
|
230
230
|
disabled={status === 'processing'}
|
|
231
|
-
className={cn(searchBtnClassName, "bg-
|
|
231
|
+
className={cn(searchBtnClassName, "bg-primary px-4 py-3 rounded-md transition-all")}
|
|
232
232
|
>
|
|
233
233
|
<span className="sr-only">Search</span>
|
|
234
234
|
<svg
|
|
@@ -8,7 +8,7 @@ interface Props extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableSe
|
|
|
8
8
|
|
|
9
9
|
export default function TableHead({ children, className, ...props }: Props) {
|
|
10
10
|
return (
|
|
11
|
-
<thead {...props} className={cn(className, 'px-3 py-4 text-sm text-white bg-
|
|
11
|
+
<thead {...props} className={cn(className, 'px-3 py-4 text-sm text-white bg-table-header-background')}>
|
|
12
12
|
{children}
|
|
13
13
|
</thead>
|
|
14
14
|
)
|
|
@@ -8,7 +8,7 @@ interface Props extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableRo
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export default function TableRow({ children, className = '', onClick = () => {}, ...props }: Props) {
|
|
11
|
-
const bgClass = className.includes('bg') ? '' : 'bg-white even:bg-
|
|
11
|
+
const bgClass = className.includes('bg') ? '' : 'bg-white even:bg-table-row-alternative-background'
|
|
12
12
|
|
|
13
13
|
return (
|
|
14
14
|
<tr {...props} className={cn(className, bgClass, 'hover:bg-gray-100')} onClick={(e) => onClick(e)}>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
content: [
|
|
3
|
+
'./resources/**/*.blade.php',
|
|
4
|
+
'./resources/**/*.{js,ts,jsx,tsx}',
|
|
5
|
+
'./node_modules/@star-insure/sdk/src/**/*.{js,ts,jsx,tsx}',
|
|
6
|
+
],
|
|
7
|
+
theme: {
|
|
8
|
+
fontFamily: {
|
|
9
|
+
sans: ['MuseoSansRounded', 'Helvetica', 'arial', 'sans-serif'],
|
|
10
|
+
serif: ['Gabriela', 'Georgia', 'serif'],
|
|
11
|
+
},
|
|
12
|
+
container: {
|
|
13
|
+
center: true,
|
|
14
|
+
padding: '1.25rem',
|
|
15
|
+
},
|
|
16
|
+
extend: {
|
|
17
|
+
colors: {
|
|
18
|
+
primary: 'var(--primary-color)',
|
|
19
|
+
'primary-300': 'var(--primary-300-color)',
|
|
20
|
+
'primary-100': 'var(--primary-100-color)',
|
|
21
|
+
'primary-700': 'var(--primary-700-color)',
|
|
22
|
+
secondary: 'var(--secondary-color)',
|
|
23
|
+
'page-background': 'var(--page-background-color)',
|
|
24
|
+
'footer-background': 'var(--footer-background-color)',
|
|
25
|
+
'page-header-background': 'var(--page-header-background-color)',
|
|
26
|
+
'page-header-text': 'var(--page-header-text-color)',
|
|
27
|
+
'back-button-background': 'var(--back-button-background-color)',
|
|
28
|
+
'back-button-text': 'var(--back-button-text-color)',
|
|
29
|
+
'section-title': 'var(--section-title-color)',
|
|
30
|
+
'sub-section-title': 'var(--sub-section-title-color)',
|
|
31
|
+
'section-separator': 'var(--section-separator-color)',
|
|
32
|
+
'section-header-background': 'var(--section-header-background-color)',
|
|
33
|
+
'section-header-text': 'var(--section-header-text-color)',
|
|
34
|
+
'card-subtitle': 'var(--card-subtitle-color)',
|
|
35
|
+
'card-alternative-background': 'var(--card-alternative-background-color)',
|
|
36
|
+
'table-header-background': 'var(--table-header-background-color)',
|
|
37
|
+
'table-header-text': 'var(--table-header-text-color)',
|
|
38
|
+
'table-row-alternative-background': 'var(--table-row-alternative-background-color)',
|
|
39
|
+
'gray-600': '#8a8c8e',
|
|
40
|
+
'gray-700': '#666',
|
|
41
|
+
},
|
|
42
|
+
transitionDuration: {
|
|
43
|
+
DEFAULT: '300ms',
|
|
44
|
+
},
|
|
45
|
+
transitionTimingFunction: {
|
|
46
|
+
DEFAULT: 'cubic-bezier(0.4, 0, 0.2, 1)',
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
plugins: [require('@tailwindcss/forms'), require('@tailwindcss/typography')],
|
|
51
|
+
};
|
package/src/theme.css
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--primary-color: #6fc7b6;
|
|
3
|
+
--primary-300-color: #b8e1d9;
|
|
4
|
+
--primary-100-color: #f2f9f8;
|
|
5
|
+
--primary-700-color: #48aa97;
|
|
6
|
+
|
|
7
|
+
--secondary-color: #2b3844;
|
|
8
|
+
|
|
9
|
+
--page-background-color: #f9fafb;
|
|
10
|
+
--footer-background-color: #e5e7eb;
|
|
11
|
+
|
|
12
|
+
--page-header-background-color: #f3f4f6;
|
|
13
|
+
--page-header-text-color: rgb(102, 102, 102);
|
|
14
|
+
--back-button-background-color: #f3f4f6;
|
|
15
|
+
--back-button-text-color: rgb(102, 102, 102);
|
|
16
|
+
|
|
17
|
+
--section-title-color: #6b7280;
|
|
18
|
+
--sub-section-title-color: rgb(102, 102, 102);
|
|
19
|
+
--section-separator-color: rgb(107, 114, 128);
|
|
20
|
+
|
|
21
|
+
--section-header-background-color: #f3f4f6;
|
|
22
|
+
--section-header-text-color: rgb(102, 102, 102);
|
|
23
|
+
|
|
24
|
+
--card-subtitle-color: #2B3844;
|
|
25
|
+
--card-alternative-background-color: rgba(102, 102, 102, 0.07);
|
|
26
|
+
|
|
27
|
+
--table-header-background-color: #8a8c8e;
|
|
28
|
+
--table-header-text-color: #FFFFFF;
|
|
29
|
+
--table-row-alternative-background-color: #f9fafb;
|
|
30
|
+
}
|