@star-insure/sdk 4.5.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/lib/dates.d.ts +4 -0
- package/dist/sdk.cjs.development.js +39 -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 +39 -19
- 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/lib/dates.ts +20 -0
- package/src/tailwind-preset.js +51 -0
- package/src/theme.css +30 -0
- package/src/types/api/auth.ts +1 -0
package/dist/sdk.esm.js
CHANGED
|
@@ -118,6 +118,26 @@ function formatDateTime(dateTime, overrideFormatString) {
|
|
|
118
118
|
|
|
119
119
|
return '';
|
|
120
120
|
}
|
|
121
|
+
/**
|
|
122
|
+
* Attempts to create a date object from a date string
|
|
123
|
+
*/
|
|
124
|
+
|
|
125
|
+
function createDate(dateString) {
|
|
126
|
+
// Re-use our logic from formatDateTime
|
|
127
|
+
var formattedDateTime = formatDateTime(dateString);
|
|
128
|
+
|
|
129
|
+
if (!formattedDateTime) {
|
|
130
|
+
return null;
|
|
131
|
+
} // Attempt to parse the formatted date to a date object
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
try {
|
|
135
|
+
return parse(formattedDateTime, 'dd/MM/yyyy HH:mm', new Date());
|
|
136
|
+
} catch (error) {
|
|
137
|
+
console.error("Error parsing date: " + (dateString == null ? void 0 : dateString.toString()));
|
|
138
|
+
return null;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
121
141
|
|
|
122
142
|
/**
|
|
123
143
|
* Safely rounds a number
|
|
@@ -1321,7 +1341,7 @@ function Button(_ref) {
|
|
|
1321
1341
|
_ref$small = _ref.small,
|
|
1322
1342
|
small = _ref$small === void 0 ? false : _ref$small;
|
|
1323
1343
|
var baseClasses = small ? 'font-bold text-sm inline-flex items-center gap-3 justify-center text-white text-center px-3 py-1 rounded min-w-[80px] transition-all hover:brightness-110' : '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';
|
|
1324
|
-
var statusClass = status === 'primary' && 'bg-
|
|
1344
|
+
var statusClass = status === 'primary' && 'bg-primary' || status === 'danger' && 'bg-red-500' || status === 'warning' && 'bg-yellow-400' || status === 'info' && 'bg-blue-400' || 'bg-gray-600';
|
|
1325
1345
|
var classes = (className != null ? className : '') + " " + baseClasses + " " + statusClass;
|
|
1326
1346
|
|
|
1327
1347
|
if (_onClick) {
|
|
@@ -1580,7 +1600,7 @@ function ToastItem(_ref) {
|
|
|
1580
1600
|
removeToast = _useToast.removeToast;
|
|
1581
1601
|
|
|
1582
1602
|
var defaultClasses = 'w-full min-w-[250px] p-4 shadow flex justify-between items-center font-black rounded-md not:';
|
|
1583
|
-
var statusClasses = status === 'success' && 'bg-
|
|
1603
|
+
var statusClasses = status === 'success' && 'bg-primary text-white' || status === 'error' && 'bg-red-500 text-white' || status === 'warning' && 'bg-yellow-400 text-white' || 'bg-white text-secondary';
|
|
1584
1604
|
var classes = defaultClasses + " " + statusClasses;
|
|
1585
1605
|
|
|
1586
1606
|
function handleClick() {
|
|
@@ -1669,7 +1689,7 @@ function Modal(_ref) {
|
|
|
1669
1689
|
}, React__default.createElement("div", {
|
|
1670
1690
|
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
|
|
1671
1691
|
}, React__default.createElement("div", {
|
|
1672
|
-
className: "flex gap-4 mb-4 text-
|
|
1692
|
+
className: "flex gap-4 mb-4 text-secondary " + (title ? 'border-b-2 border-secondary pb-4' : '')
|
|
1673
1693
|
}, title && React__default.createElement("h3", {
|
|
1674
1694
|
className: "font-black text-lg"
|
|
1675
1695
|
}, title), React__default.createElement("button", {
|
|
@@ -1747,7 +1767,7 @@ function TableHead(_ref) {
|
|
|
1747
1767
|
props = _objectWithoutPropertiesLoose(_ref, _excluded$3);
|
|
1748
1768
|
|
|
1749
1769
|
return React__default.createElement("thead", Object.assign({}, props, {
|
|
1750
|
-
className: cn(className, 'px-3 py-4 text-sm text-white bg-
|
|
1770
|
+
className: cn(className, 'px-3 py-4 text-sm text-white bg-table-header-background')
|
|
1751
1771
|
}), children);
|
|
1752
1772
|
}
|
|
1753
1773
|
|
|
@@ -1814,7 +1834,7 @@ function TableRow(_ref) {
|
|
|
1814
1834
|
_onClick = _ref$onClick === void 0 ? function () {} : _ref$onClick,
|
|
1815
1835
|
props = _objectWithoutPropertiesLoose(_ref, _excluded$5);
|
|
1816
1836
|
|
|
1817
|
-
var bgClass = className.includes('bg') ? '' : 'bg-white even:bg-
|
|
1837
|
+
var bgClass = className.includes('bg') ? '' : 'bg-white even:bg-table-row-alternative-background';
|
|
1818
1838
|
return React__default.createElement("tr", Object.assign({}, props, {
|
|
1819
1839
|
className: cn(className, bgClass, 'hover:bg-gray-100'),
|
|
1820
1840
|
onClick: function onClick(e) {
|
|
@@ -1957,7 +1977,7 @@ function MoneyField(_ref) {
|
|
|
1957
1977
|
|
|
1958
1978
|
var displayValue = formatMoney(value, 0);
|
|
1959
1979
|
return React__default.createElement("div", {
|
|
1960
|
-
className: className + " flex items-center gap-2 pl-4 rounded-md border border-gray-300 transition-all focus-within:border-
|
|
1980
|
+
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"
|
|
1961
1981
|
}, React__default.createElement("span", {
|
|
1962
1982
|
className: "font-bold pr-2"
|
|
1963
1983
|
}, "$"), React__default.createElement("input", {
|
|
@@ -2187,7 +2207,7 @@ function RegistrationSearchField(_ref) {
|
|
|
2187
2207
|
type: "button",
|
|
2188
2208
|
onClick: handleSearch,
|
|
2189
2209
|
disabled: status === 'processing',
|
|
2190
|
-
className: cn(searchBtnClassName, "bg-
|
|
2210
|
+
className: cn(searchBtnClassName, "bg-primary px-4 py-3 rounded-md transition-all")
|
|
2191
2211
|
}, React__default.createElement("span", {
|
|
2192
2212
|
className: "sr-only"
|
|
2193
2213
|
}, "Search"), React__default.createElement("svg", {
|
|
@@ -2461,7 +2481,7 @@ function BackButton(_ref) {
|
|
|
2461
2481
|
}, [breadcrumbs]);
|
|
2462
2482
|
return React__default.createElement(Link, {
|
|
2463
2483
|
href: backUrl || '/',
|
|
2464
|
-
className: cn(className, 'flex items-center justify-center hover:text-
|
|
2484
|
+
className: cn(className, 'flex items-center justify-center text-back-button-text hover:text-primary transition-all')
|
|
2465
2485
|
}, React__default.createElement(HiArrowLeft, {
|
|
2466
2486
|
className: "h-5 w-5 stroke-[1.25]"
|
|
2467
2487
|
}));
|
|
@@ -2552,12 +2572,12 @@ function SearchBar(_ref) {
|
|
|
2552
2572
|
onClick: function onClick() {
|
|
2553
2573
|
return onActive(true);
|
|
2554
2574
|
},
|
|
2555
|
-
className: "flex items-center justify-center rounded-full hover:text-
|
|
2575
|
+
className: "flex items-center justify-center rounded-full hover:text-primary p-1 hover:bg-gray-100"
|
|
2556
2576
|
}, React__default.createElement(HiMagnifyingGlass, {
|
|
2557
2577
|
className: "h-5 w-5 stroke-[1.25]"
|
|
2558
2578
|
})), active && React__default.createElement("form", {
|
|
2559
2579
|
onSubmit: handleSearch,
|
|
2560
|
-
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-
|
|
2580
|
+
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"
|
|
2561
2581
|
}, React__default.createElement("input", {
|
|
2562
2582
|
type: "text",
|
|
2563
2583
|
name: "search",
|
|
@@ -2974,8 +2994,8 @@ function FilterItem(_ref) {
|
|
|
2974
2994
|
onClick: function onClick() {
|
|
2975
2995
|
return handleClick();
|
|
2976
2996
|
},
|
|
2977
|
-
className: cn('flex rounded-2xl border hover:cursor-pointer hover:border-
|
|
2978
|
-
'!bg-
|
|
2997
|
+
className: cn('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', {
|
|
2998
|
+
'!bg-primary border-primary': hasFilters
|
|
2979
2999
|
})
|
|
2980
3000
|
}, React__default.createElement("p", {
|
|
2981
3001
|
className: "whitespace-nowrap"
|
|
@@ -3249,17 +3269,17 @@ function PageHeader(_ref) {
|
|
|
3249
3269
|
className: cn('col-span-full flex items-center gap-2 max-w-full rounded-lg bg-white p-2 shadow', className)
|
|
3250
3270
|
}, back && React__default.createElement(BackButton, {
|
|
3251
3271
|
back: back,
|
|
3252
|
-
className: "bg-
|
|
3272
|
+
className: "bg-back-button-background h-[60px] w-[60px] rounded"
|
|
3253
3273
|
}), React__default.createElement("div", {
|
|
3254
|
-
className: cn('w-full grid grid-cols-[auto_1fr_auto_auto] h-[60px] rounded bg-
|
|
3274
|
+
className: cn('w-full grid grid-cols-[auto_1fr_auto_auto] h-[60px] rounded bg-page-header-background p-3 gap-4', innerClassName)
|
|
3255
3275
|
}, React__default.createElement("button", {
|
|
3256
3276
|
type: "button",
|
|
3257
3277
|
disabled: !search,
|
|
3258
3278
|
onClick: function onClick() {
|
|
3259
3279
|
return setSearchActive(true);
|
|
3260
3280
|
},
|
|
3261
|
-
className: cn('mr-auto flex items-center gap-4 transition-colors pr-6 pl-1 disabled:opacity-100', {
|
|
3262
|
-
'hover:text-
|
|
3281
|
+
className: cn('mr-auto flex items-center gap-4 transition-colors pr-6 pl-1 disabled:opacity-100 text-page-header-text', {
|
|
3282
|
+
'hover:text-primary': search && !isSearchActive
|
|
3263
3283
|
})
|
|
3264
3284
|
}, search && React__default.createElement(SearchBar, {
|
|
3265
3285
|
search: search,
|
|
@@ -3268,7 +3288,7 @@ function PageHeader(_ref) {
|
|
|
3268
3288
|
placeholder: "Search " + title + "...",
|
|
3269
3289
|
focusSearchShortcut: focusSearchShortcut
|
|
3270
3290
|
}), !isSearchActive && React__default.createElement("h1", {
|
|
3271
|
-
className: "text-base font-black"
|
|
3291
|
+
className: "text-base text-page-header-text font-black"
|
|
3272
3292
|
}, title)), React__default.createElement("div", {
|
|
3273
3293
|
className: "flex items-center ml-auto gap-2 h-full min-w-0 max-w-full"
|
|
3274
3294
|
}, filterOptions.length > 0 && React__default.createElement(React__default.Fragment, null, React__default.createElement("button", {
|
|
@@ -3291,7 +3311,7 @@ function PageHeader(_ref) {
|
|
|
3291
3311
|
onClick: clickRight,
|
|
3292
3312
|
className: "w-5 h-5 text-gray-400 stroke-[1.25]"
|
|
3293
3313
|
}))), filteredActions.length > 0 && React__default.createElement("div", {
|
|
3294
|
-
className: "flex items-center gap-3 bg-
|
|
3314
|
+
className: "flex items-center gap-3 bg-page-header-background"
|
|
3295
3315
|
}, filterOptions.length > 0 && React__default.createElement("div", {
|
|
3296
3316
|
className: "w-[1px] h-full bg-gray-300"
|
|
3297
3317
|
}), React__default.createElement("nav", {
|
|
@@ -3310,5 +3330,5 @@ PageHeader.Action = function (_ref2) {
|
|
|
3310
3330
|
return React__default.createElement("div", null, children);
|
|
3311
3331
|
};
|
|
3312
3332
|
|
|
3313
|
-
export { Button, Card, DateOfBirthField, ErrorList, FormTester, Modal, MoneyField, PageHeader, Pagination, QuoteRequestFormContext, QuoteRequestFormProvider, QuoteRequestOptionsProvider, RegistrationSearchField, SimplePagination, Table, TableActions, TableBody, TableCell, TableHead, TableHeader, TableRow, ToastItem, ToastProvider, Toasts, addGst, autocomplete, calcMonthlyEnhancementPrice, calcPurchaseOptionPricing, calculateAge, fixRoundingError, formatDate, formatDateForTable, formatDateNice, formatDateTime, formatMoney, formatNumber, getAddressData, getGst, gstCalc, initialData, round, sanitiseQuoteRequestFormData, sanitiseVehicleType, subtractGst, useAuth, useClickOutside, useFetch, useInertiaOptions, useLocalStorage, useQuoteRequestForm, useQuoteRequestOptions, useToast };
|
|
3333
|
+
export { Button, Card, DateOfBirthField, ErrorList, FormTester, Modal, MoneyField, PageHeader, Pagination, QuoteRequestFormContext, QuoteRequestFormProvider, QuoteRequestOptionsProvider, RegistrationSearchField, SimplePagination, Table, TableActions, TableBody, TableCell, TableHead, TableHeader, TableRow, ToastItem, ToastProvider, Toasts, addGst, autocomplete, calcMonthlyEnhancementPrice, calcPurchaseOptionPricing, calculateAge, createDate, fixRoundingError, formatDate, formatDateForTable, formatDateNice, formatDateTime, formatMoney, formatNumber, getAddressData, getGst, gstCalc, initialData, round, sanitiseQuoteRequestFormData, sanitiseVehicleType, subtractGst, useAuth, useClickOutside, useFetch, useInertiaOptions, useLocalStorage, useQuoteRequestForm, useQuoteRequestOptions, useToast };
|
|
3314
3334
|
//# sourceMappingURL=sdk.esm.js.map
|