@tuspe/components 1.7.20 → 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 +6 -0
- package/dist/Breadcrumbs.svelte +4 -3
- package/dist/Breadcrumbs.svelte.d.ts +1 -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 +5 -5
package/README.md
CHANGED
|
@@ -28,6 +28,8 @@ A breadcrumb navigation provide links back to previous pages, and shows the user
|
|
|
28
28
|
interface Props {
|
|
29
29
|
homeName?: string
|
|
30
30
|
homeSlug?: string
|
|
31
|
+
onlyMeta?: boolean
|
|
32
|
+
outerClass?: string
|
|
31
33
|
values: Breadcrumb[]
|
|
32
34
|
}
|
|
33
35
|
```
|
|
@@ -237,6 +239,10 @@ Computes the pre-tax amount by subtracting the tax from the total, using the spe
|
|
|
237
239
|
|
|
238
240
|
Calculates the tax portion of a total amount based on a given VAT percentage (default: 25.5%), ensuring precision.
|
|
239
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
|
+
|
|
240
246
|
### fixNumber
|
|
241
247
|
|
|
242
248
|
Converts a number or string to a rounded number with two decimal places, ensuring precision.
|
package/dist/Breadcrumbs.svelte
CHANGED
|
@@ -6,18 +6,19 @@
|
|
|
6
6
|
interface Props {
|
|
7
7
|
homeName?: string
|
|
8
8
|
homeSlug?: string
|
|
9
|
+
onlyMeta?: boolean
|
|
9
10
|
outerClass?: string
|
|
10
11
|
values: Breadcrumb[]
|
|
11
12
|
}
|
|
12
13
|
|
|
13
|
-
let {homeName = 'Etusivu', homeSlug = '', outerClass, values}: Props = $props(),
|
|
14
|
+
let {homeName = 'Etusivu', homeSlug = '', onlyMeta = false, outerClass, values}: Props = $props(),
|
|
14
15
|
classes = $state('truncate')
|
|
15
16
|
|
|
16
17
|
const origin = page.url.origin + '/'
|
|
17
18
|
|
|
18
19
|
let originWithSlug = $state(origin + homeSlug),
|
|
19
20
|
listItems = $derived<Breadcrumb[]>(
|
|
20
|
-
|
|
21
|
+
validateArray(values)
|
|
21
22
|
? [
|
|
22
23
|
{
|
|
23
24
|
'@type': 'ListItem',
|
|
@@ -51,7 +52,7 @@
|
|
|
51
52
|
{/if}
|
|
52
53
|
</svelte:head>
|
|
53
54
|
|
|
54
|
-
{#if validateArray(listItems)}
|
|
55
|
+
{#if !onlyMeta && validateArray(listItems)}
|
|
55
56
|
<div class={classes}>
|
|
56
57
|
<ol id="breadcrumb" class="max-w-screen-xl mx-auto my-0 px-4 py-2" vocab="https://schema.org/" typeof="BreadcrumbList">
|
|
57
58
|
{#each listItems as page}
|
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,20 +63,20 @@
|
|
|
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"
|
|
81
81
|
}
|
|
82
|
-
}
|
|
82
|
+
}
|