@star-insure/sdk 4.0.0 → 4.1.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.
@@ -9,7 +9,7 @@ export interface FilterOption {
9
9
  label: string;
10
10
  name: string;
11
11
  options?: FilterValue[];
12
- type?: 'options' | 'date' | 'greaterThan' | 'scope' | 'select' | 'datalist';
12
+ type?: 'options' | 'date' | 'greaterThan' | 'scope' | 'select' | 'datalist' | 'column';
13
13
  }
14
14
  export interface FilterValue {
15
15
  label: 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": "4.0.0",
5
+ "version": "4.1.1",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
@@ -21,7 +21,7 @@
21
21
  "dev": "tsdx watch",
22
22
  "start": "tsdx watch",
23
23
  "build": "tsdx build",
24
- "test": "tsdx test --passWithNoTests",
24
+ "test": "TZ='Pacific/Auckland' tsdx test --passWithNoTests",
25
25
  "lint": "tsdx lint",
26
26
  "prepare": "tsdx build",
27
27
  "size": "size-limit",
@@ -7,10 +7,11 @@ interface Props {
7
7
  isActive?: boolean;
8
8
  onClose: () => void;
9
9
  title?: string;
10
+ width?: string;
10
11
  className?: string;
11
12
  }
12
13
 
13
- export default function Modal({ children, isActive = false, onClose, title, className = '' }: Props) {
14
+ export default function Modal({ children, isActive = false, onClose, title, width = '', className = '' }: Props) {
14
15
  return (
15
16
  <Transition.Root show={isActive} as={Fragment}>
16
17
  <Dialog as="div" className="fixed z-[110] inset-0 overflow-y-auto" onClose={onClose}>
@@ -36,7 +37,7 @@ export default function Modal({ children, isActive = false, onClose, title, clas
36
37
  leaveFrom="opacity-100 translate-y-0 sm:scale-100"
37
38
  leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
38
39
  >
39
- <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-3xl sm:p-6`}>
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}`}>
40
41
  <div className={`flex gap-4 mb-4 text-asphalt ${title ? 'border-b-2 border-asphalt pb-4' : ''}`}>
41
42
  {title && <h3 className="font-black text-lg">{title}</h3>}
42
43
  <button type="button" onClick={onClose} className="ml-auto transition-all hover:opacity-50">
@@ -303,7 +303,7 @@ export function FilterItem({ filter }: { filter: FilterOption, path?: string })
303
303
  </div>
304
304
  )}
305
305
  </div>
306
- <div className="flex items-center gap-2">
306
+ <div className="flex items-center gap-2 py-4 mt-4 -bottom-4 sticky bg-white">
307
307
  <Button type="button" className="!min-w-[0px] flex-grow !px-2 text-sm !transition-none" onClick={handleClear} small>
308
308
  Clear
309
309
  </Button>
package/src/lib/money.ts CHANGED
@@ -52,7 +52,11 @@ export function gstCalc(input: number|string): {
52
52
  /**
53
53
  * Formats a value nicely
54
54
  */
55
- export function formatMoneyNumerals(value: string|number, decimals: number = 2): string {
55
+ export function formatMoney(value: string|number|null|undefined, decimals: number = 2): string {
56
+ if (value === null || value === undefined) {
57
+ return '';
58
+ }
59
+
56
60
  let toFormat = value;
57
61
  if (typeof value === 'string') {
58
62
  toFormat = value.replace(/[^\d.-]/g, '')
@@ -64,20 +68,6 @@ export function gstCalc(input: number|string): {
64
68
  });
65
69
  }
66
70
 
67
- /**
68
- * Formats a value nicely
69
- */
70
- export function formatMoney(value: string|number|null|undefined, decimals: number = 2): string {
71
- if (value === null || value === undefined) {
72
- return '';
73
- }
74
-
75
- return `$${formatMoneyNumerals(value, decimals)}`
76
-
77
- // If the value is negative, we need to move the negative sign to the front
78
- .replace('$-', '- $');
79
- }
80
-
81
71
  /**
82
72
  * Turns a formatted value in to a float
83
73
  */
@@ -11,7 +11,7 @@ export interface FilterOption {
11
11
  label: string;
12
12
  name: string;
13
13
  options?: FilterValue[];
14
- type?: 'options' | 'date' | 'greaterThan' | 'scope' | 'select' | 'datalist';
14
+ type?: 'options' | 'date' | 'greaterThan' | 'scope' | 'select' | 'datalist' | 'column';
15
15
  }
16
16
 
17
17
  export interface FilterValue {