@tuspe/components 1.7.21 → 1.8.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/README.md +4 -0
- package/dist/Button.svelte +1 -1
- package/dist/Button.svelte.d.ts +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +3 -2
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -239,6 +239,10 @@ Computes the pre-tax amount by subtracting the tax from the total, using the spe
|
|
|
239
239
|
|
|
240
240
|
Calculates the tax portion of a total amount based on a given VAT percentage (default: 25.5%), ensuring precision.
|
|
241
241
|
|
|
242
|
+
### calculateWithTax
|
|
243
|
+
|
|
244
|
+
Calculates the total price by adding VAT to a pre-tax amount, using the specified VAT percentage (default: 25.5%).
|
|
245
|
+
|
|
242
246
|
### fixNumber
|
|
243
247
|
|
|
244
248
|
Converts a number or string to a rounded number with two decimal places, ensuring precision.
|
package/dist/Button.svelte
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
ariaControls?: string | undefined
|
|
7
7
|
ariaExpanded?: boolean | undefined
|
|
8
8
|
ariaLabel?: string
|
|
9
|
-
ariaPopup?: 'dialog' | '
|
|
9
|
+
ariaPopup?: 'dialog' | 'listbox' | 'menu' | undefined
|
|
10
10
|
borderColor?: 'content' | 'default' | 'primary'
|
|
11
11
|
borderSize?: 0 | 1 | 2
|
|
12
12
|
children: Snippet
|
package/dist/Button.svelte.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ interface Props {
|
|
|
3
3
|
ariaControls?: string | undefined;
|
|
4
4
|
ariaExpanded?: boolean | undefined;
|
|
5
5
|
ariaLabel?: string;
|
|
6
|
-
ariaPopup?: 'dialog' | '
|
|
6
|
+
ariaPopup?: 'dialog' | 'listbox' | 'menu' | undefined;
|
|
7
7
|
borderColor?: 'content' | 'default' | 'primary';
|
|
8
8
|
borderSize?: 0 | 1 | 2;
|
|
9
9
|
children: Snippet;
|
package/dist/index.d.ts
CHANGED
|
@@ -31,8 +31,9 @@ export declare const loading: import("svelte/store").Writable<number>;
|
|
|
31
31
|
*/
|
|
32
32
|
export declare const formatPrice: (value: number | string, comma?: boolean, currency?: string) => string;
|
|
33
33
|
export declare const fixNumber: (value: number | string) => number;
|
|
34
|
-
export declare const calculateTax: (
|
|
35
|
-
export declare const calculatePreTax: (
|
|
34
|
+
export declare const calculateTax: (value: number, vatPercentage?: number) => number;
|
|
35
|
+
export declare const calculatePreTax: (value: number, vatPercentage?: number) => number;
|
|
36
|
+
export declare const calculateWithTax: (value: number, vatPercentage?: number) => number;
|
|
36
37
|
/**
|
|
37
38
|
* STRING VALIDATIONS
|
|
38
39
|
*/
|
package/dist/index.js
CHANGED
|
@@ -42,8 +42,9 @@ export const fixNumber = (value) => {
|
|
|
42
42
|
* VAT CALCULATION
|
|
43
43
|
*/
|
|
44
44
|
const defaultVatPercentage = 25.5;
|
|
45
|
-
export const calculateTax = (
|
|
46
|
-
export const calculatePreTax = (
|
|
45
|
+
export const calculateTax = (value, vatPercentage = defaultVatPercentage) => fixNumber((vatPercentage * value) / (100 + vatPercentage));
|
|
46
|
+
export const calculatePreTax = (value, vatPercentage = defaultVatPercentage) => fixNumber(value - calculateTax(value, vatPercentage));
|
|
47
|
+
export const calculateWithTax = (value, vatPercentage = defaultVatPercentage) => fixNumber(value * (1 + vatPercentage / 100));
|
|
47
48
|
/**
|
|
48
49
|
* STRING VALIDATIONS
|
|
49
50
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tuspe/components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"description": "A reusable SvelteKit component library for form elements, breadcrumbs, prices and images.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"svelteKit",
|
|
@@ -63,18 +63,18 @@
|
|
|
63
63
|
"@eslint/compat": "^1.2.7",
|
|
64
64
|
"@eslint/js": "^9.22.0",
|
|
65
65
|
"@sveltejs/adapter-static": "^3.0.8",
|
|
66
|
-
"@sveltejs/kit": "^2.19.
|
|
66
|
+
"@sveltejs/kit": "^2.19.2",
|
|
67
67
|
"@sveltejs/package": "^2.3.10",
|
|
68
68
|
"@sveltejs/vite-plugin-svelte": "^5.0.3",
|
|
69
69
|
"eslint-config-prettier": "^10.1.1",
|
|
70
|
-
"eslint-plugin-svelte": "^3.1
|
|
70
|
+
"eslint-plugin-svelte": "^3.2.1",
|
|
71
71
|
"eslint": "^9.22.0",
|
|
72
72
|
"globals": "^16.0.0",
|
|
73
73
|
"prettier-plugin-svelte": "^3.3.3",
|
|
74
74
|
"prettier": "^3.5.3",
|
|
75
75
|
"publint": "^0.3.9",
|
|
76
76
|
"svelte-check": "^4.1.5",
|
|
77
|
-
"svelte": "^5.23.
|
|
77
|
+
"svelte": "^5.23.1",
|
|
78
78
|
"typescript-eslint": "^8.26.1",
|
|
79
79
|
"typescript": "^5.8.2",
|
|
80
80
|
"vite": "^6.2.2"
|