@softwareone/spi-sv5-library 1.3.2 → 1.5.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/Form/FormController/Form.svelte +155 -0
- package/dist/Form/FormController/Form.svelte.d.ts +13 -0
- package/dist/Form/FormController/context.d.ts +3 -0
- package/dist/Form/FormController/context.js +15 -0
- package/dist/Form/FormController/helper.d.ts +3 -0
- package/dist/Form/FormController/helper.js +24 -0
- package/dist/Form/FormController/types.d.ts +7 -0
- package/dist/Form/FormController/types.js +1 -0
- package/dist/Form/FormController/zod-validations.d.ts +19 -0
- package/dist/Form/FormController/zod-validations.js +40 -0
- package/dist/Header/Header.svelte +48 -5
- package/dist/Header/Header.svelte.d.ts +3 -0
- package/dist/Home/Home.svelte +6 -12
- package/dist/Link/Link.svelte +31 -0
- package/dist/Link/Link.svelte.d.ts +9 -0
- package/dist/Menu/Menu.svelte +7 -9
- package/dist/Menu/MenuItem.svelte +2 -14
- package/dist/Menu/MenuItem.svelte.d.ts +0 -1
- package/dist/Modal/Modal.svelte +2 -1
- package/dist/Modal/ModalContent.svelte +0 -1
- package/dist/Modal/ModalHeader.svelte +14 -10
- package/dist/Modal/modalState.svelte.d.ts +1 -0
- package/dist/Processing/Processing.svelte +89 -0
- package/dist/Processing/Processing.svelte.d.ts +4 -0
- package/dist/Processing/processingState.svelte.d.ts +6 -0
- package/dist/Processing/processingState.svelte.js +1 -0
- package/dist/Switcher/Switcher.svelte +78 -0
- package/dist/Switcher/Switcher.svelte.d.ts +8 -0
- package/dist/Switcher/switcherState.svelte.d.ts +4 -0
- package/dist/Switcher/switcherState.svelte.js +1 -0
- package/dist/Waffle/Waffle.svelte +95 -0
- package/dist/Waffle/Waffle.svelte.d.ts +8 -0
- package/dist/Waffle/WaffleItems.svelte +82 -0
- package/dist/Waffle/WaffleItems.svelte.d.ts +9 -0
- package/dist/Waffle/waffleState.svelte.d.ts +6 -0
- package/dist/Waffle/waffleState.svelte.js +1 -0
- package/dist/index.d.ts +32 -17
- package/dist/index.js +28 -12
- package/package.json +27 -16
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { ActionResult } from '@sveltejs/kit';
|
|
3
|
+
import { onDestroy, untrack, type Snippet } from 'svelte';
|
|
4
|
+
|
|
5
|
+
import { zod4Client } from 'sveltekit-superforms/adapters';
|
|
6
|
+
import {
|
|
7
|
+
superForm,
|
|
8
|
+
type TaintedFields,
|
|
9
|
+
type ValidationErrors
|
|
10
|
+
} from 'sveltekit-superforms/client';
|
|
11
|
+
import { z } from 'zod';
|
|
12
|
+
|
|
13
|
+
import { addToast, Spinner } from '../../index.js';
|
|
14
|
+
import { getFormContext } from './context.js';
|
|
15
|
+
import type { FormError } from './types.js';
|
|
16
|
+
import { isEqual } from './helper.js';
|
|
17
|
+
|
|
18
|
+
type Schema = z.infer<typeof schema>;
|
|
19
|
+
|
|
20
|
+
interface Props {
|
|
21
|
+
initialData: Schema;
|
|
22
|
+
action: string;
|
|
23
|
+
schema: z.ZodObject;
|
|
24
|
+
extraData?: Record<string, string | number>;
|
|
25
|
+
onsuccess: (data?: Record<string, unknown>) => void;
|
|
26
|
+
onfailure?: (status: number | undefined, error: unknown) => void;
|
|
27
|
+
children: Snippet;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
let {
|
|
31
|
+
initialData,
|
|
32
|
+
action,
|
|
33
|
+
schema,
|
|
34
|
+
extraData,
|
|
35
|
+
onsuccess,
|
|
36
|
+
onfailure = undefined,
|
|
37
|
+
children
|
|
38
|
+
}: Props = $props();
|
|
39
|
+
|
|
40
|
+
let actionResult: ActionResult;
|
|
41
|
+
let isLoading = $state(false);
|
|
42
|
+
|
|
43
|
+
const { form, errors, isFormValid } = getFormContext<Schema>();
|
|
44
|
+
|
|
45
|
+
$form = structuredClone($state.snapshot(initialData));
|
|
46
|
+
|
|
47
|
+
const onUpdated = () => {
|
|
48
|
+
isLoading = false;
|
|
49
|
+
|
|
50
|
+
const data = actionResult && 'data' in actionResult ? actionResult.data : undefined;
|
|
51
|
+
const success = actionResult?.type === 'success';
|
|
52
|
+
|
|
53
|
+
addToast({ message: data?.message, type: success ? 'success' : 'warning' });
|
|
54
|
+
if (success) {
|
|
55
|
+
onsuccess(data);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const onError = ({ result }: { result: ActionResult }) => {
|
|
60
|
+
if (result.type === 'error') {
|
|
61
|
+
addToast({ message: 'There was an unexpected error.', type: 'danger' });
|
|
62
|
+
onfailure?.(result.status, result.error);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const {
|
|
67
|
+
form: superFormData,
|
|
68
|
+
enhance,
|
|
69
|
+
validateForm,
|
|
70
|
+
errors: superFormErrors,
|
|
71
|
+
tainted: superFormTained
|
|
72
|
+
} = superForm(initialData, {
|
|
73
|
+
applyAction: false,
|
|
74
|
+
autoFocusOnError: true,
|
|
75
|
+
dataType: 'json',
|
|
76
|
+
resetForm: false,
|
|
77
|
+
scrollToError: 'smooth',
|
|
78
|
+
validationMethod: 'oninput',
|
|
79
|
+
validators: zod4Client(schema),
|
|
80
|
+
warnings: { duplicateId: false },
|
|
81
|
+
onSubmit: ({ formData }) => {
|
|
82
|
+
isLoading = true;
|
|
83
|
+
return appendExtraData(formData);
|
|
84
|
+
},
|
|
85
|
+
onResult: ({ result }) => (actionResult = result),
|
|
86
|
+
onUpdated,
|
|
87
|
+
onError
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
const getErrors = (
|
|
91
|
+
errors: ValidationErrors<Record<string, unknown>>,
|
|
92
|
+
tained: TaintedFields<Record<string, unknown>>
|
|
93
|
+
) => {
|
|
94
|
+
const errorEntries = Object.entries(errors)
|
|
95
|
+
.filter(([field]) => Object.hasOwn(tained, field))
|
|
96
|
+
.map(([field, error]) => [field, error && '_errors' in error ? error._errors : error]);
|
|
97
|
+
|
|
98
|
+
return Object.fromEntries(errorEntries) as FormError<Schema>;
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
const appendExtraData = (formData: FormData) => {
|
|
102
|
+
if (extraData) {
|
|
103
|
+
Object.entries(extraData).forEach(([key, value]) => {
|
|
104
|
+
formData.set(key, String(value));
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return formData;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
$effect(() => {
|
|
112
|
+
if (
|
|
113
|
+
!isEqual(
|
|
114
|
+
$form,
|
|
115
|
+
untrack(() => $superFormData)
|
|
116
|
+
)
|
|
117
|
+
) {
|
|
118
|
+
$superFormData = structuredClone($form);
|
|
119
|
+
validateForm().then((result) => ($isFormValid = result.valid));
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
$effect(() => {
|
|
124
|
+
if (
|
|
125
|
+
!isEqual(
|
|
126
|
+
$superFormErrors,
|
|
127
|
+
untrack(() => $errors)
|
|
128
|
+
)
|
|
129
|
+
) {
|
|
130
|
+
$errors = getErrors(
|
|
131
|
+
$superFormErrors,
|
|
132
|
+
untrack(() => $superFormTained!)
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
onDestroy(() => {
|
|
138
|
+
$form = {};
|
|
139
|
+
$errors = {};
|
|
140
|
+
$isFormValid = false;
|
|
141
|
+
});
|
|
142
|
+
</script>
|
|
143
|
+
|
|
144
|
+
<Spinner show={isLoading} />
|
|
145
|
+
|
|
146
|
+
<form
|
|
147
|
+
class="w-full"
|
|
148
|
+
id="form"
|
|
149
|
+
method="POST"
|
|
150
|
+
action="?/{action}"
|
|
151
|
+
use:enhance
|
|
152
|
+
onsubmit={(event) => event.preventDefault()}
|
|
153
|
+
>
|
|
154
|
+
{@render children()}
|
|
155
|
+
</form>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type Snippet } from 'svelte';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
declare const Form: import("svelte").Component<{
|
|
4
|
+
initialData: Record<string, unknown>;
|
|
5
|
+
action: string;
|
|
6
|
+
schema: z.ZodObject;
|
|
7
|
+
extraData?: Record<string, string | number>;
|
|
8
|
+
onsuccess: (data?: Record<string, unknown>) => void;
|
|
9
|
+
onfailure?: (status: number | undefined, error: unknown) => void;
|
|
10
|
+
children: Snippet;
|
|
11
|
+
}, {}, "">;
|
|
12
|
+
type Form = ReturnType<typeof Form>;
|
|
13
|
+
export default Form;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { getContext, setContext } from 'svelte';
|
|
2
|
+
import { writable } from 'svelte/store';
|
|
3
|
+
const formContextKey = Symbol('formContext');
|
|
4
|
+
export const setFormContext = () => {
|
|
5
|
+
const formContext = {
|
|
6
|
+
form: writable({}),
|
|
7
|
+
errors: writable({}),
|
|
8
|
+
isFormValid: writable(false)
|
|
9
|
+
};
|
|
10
|
+
setContext(formContextKey, formContext);
|
|
11
|
+
return formContext;
|
|
12
|
+
};
|
|
13
|
+
export const getFormContext = () => {
|
|
14
|
+
return getContext(formContextKey);
|
|
15
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export const validateSchema = (schema, data) => {
|
|
2
|
+
const result = schema.safeParse(data);
|
|
3
|
+
return result.success;
|
|
4
|
+
};
|
|
5
|
+
export const isEqual = (source, target) => {
|
|
6
|
+
if (arePrimitivesEqual(source, target))
|
|
7
|
+
return true;
|
|
8
|
+
if (Array.isArray(source) && Array.isArray(target))
|
|
9
|
+
return areArraysEqual(source, target);
|
|
10
|
+
if (isObject(source) && isObject(target))
|
|
11
|
+
return areObjectsEqual(source, target);
|
|
12
|
+
return false;
|
|
13
|
+
};
|
|
14
|
+
const arePrimitivesEqual = (source, target) => source === target;
|
|
15
|
+
const isObject = (object) => object !== null && typeof object === 'object' && !Array.isArray(object);
|
|
16
|
+
const areArraysEqual = (sourceArray, targetArray) => sourceArray.length === targetArray.length &&
|
|
17
|
+
sourceArray.every((value, index) => isEqual(value, targetArray[index]));
|
|
18
|
+
const areObjectsEqual = (sourceObject, targetObject) => {
|
|
19
|
+
const keys1 = Object.keys(sourceObject);
|
|
20
|
+
const keys2 = Object.keys(targetObject);
|
|
21
|
+
if (keys1.length !== keys2.length)
|
|
22
|
+
return false;
|
|
23
|
+
return keys1.every((key) => isEqual(sourceObject[key], targetObject[key]));
|
|
24
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type ZodString } from 'zod';
|
|
2
|
+
type Range = {
|
|
3
|
+
from: number;
|
|
4
|
+
to: number;
|
|
5
|
+
};
|
|
6
|
+
declare class ZodValidationBuilder {
|
|
7
|
+
private validator;
|
|
8
|
+
constructor();
|
|
9
|
+
range(regex: RegExp, range: Range): this;
|
|
10
|
+
required(): this;
|
|
11
|
+
noWhitespace(): this;
|
|
12
|
+
uuid(): this;
|
|
13
|
+
min(length: number): this;
|
|
14
|
+
max(length: number): this;
|
|
15
|
+
regex(pattern: RegExp, message: string): this;
|
|
16
|
+
build(): ZodString;
|
|
17
|
+
}
|
|
18
|
+
export declare const createZodString: () => ZodValidationBuilder;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
const REGEX_NO_WHITESPACE = /^\S*$/;
|
|
3
|
+
class ZodValidationBuilder {
|
|
4
|
+
validator;
|
|
5
|
+
constructor() {
|
|
6
|
+
this.validator = z.string().trim();
|
|
7
|
+
}
|
|
8
|
+
range(regex, range) {
|
|
9
|
+
this.validator = this.validator.regex(regex, `Must be between ${range.from} and ${range.to}`);
|
|
10
|
+
return this;
|
|
11
|
+
}
|
|
12
|
+
required() {
|
|
13
|
+
this.validator = this.validator.min(1, 'Required');
|
|
14
|
+
return this;
|
|
15
|
+
}
|
|
16
|
+
noWhitespace() {
|
|
17
|
+
this.validator = this.validator.regex(REGEX_NO_WHITESPACE, 'Whitespace not allowed');
|
|
18
|
+
return this;
|
|
19
|
+
}
|
|
20
|
+
uuid() {
|
|
21
|
+
this.validator = this.validator.uuid('Invalid UUID format');
|
|
22
|
+
return this;
|
|
23
|
+
}
|
|
24
|
+
min(length) {
|
|
25
|
+
this.validator = this.validator.min(length, `Min ${length} characters required`);
|
|
26
|
+
return this;
|
|
27
|
+
}
|
|
28
|
+
max(length) {
|
|
29
|
+
this.validator = this.validator.max(length, `Max ${length} characters allowed`);
|
|
30
|
+
return this;
|
|
31
|
+
}
|
|
32
|
+
regex(pattern, message) {
|
|
33
|
+
this.validator = this.validator.regex(pattern, message);
|
|
34
|
+
return this;
|
|
35
|
+
}
|
|
36
|
+
build() {
|
|
37
|
+
return this.validator;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export const createZodString = () => new ZodValidationBuilder();
|
|
@@ -9,11 +9,14 @@
|
|
|
9
9
|
title?: string;
|
|
10
10
|
homeUrl?: string;
|
|
11
11
|
hideAccount?: boolean;
|
|
12
|
+
hideHelp?: boolean;
|
|
13
|
+
hideNotification?: boolean;
|
|
12
14
|
accountName?: string;
|
|
13
15
|
userName?: string;
|
|
14
16
|
profileUrl?: string;
|
|
15
17
|
hideLoader?: boolean;
|
|
16
18
|
menu?: Snippet<[showMenu: boolean]>;
|
|
19
|
+
waffle?: Snippet<[showWaffle: boolean]>;
|
|
17
20
|
}
|
|
18
21
|
|
|
19
22
|
let {
|
|
@@ -24,25 +27,53 @@
|
|
|
24
27
|
userName = '',
|
|
25
28
|
profileUrl = '/profile',
|
|
26
29
|
hideLoader,
|
|
27
|
-
menu
|
|
30
|
+
menu,
|
|
31
|
+
waffle
|
|
28
32
|
}: HeaderProps = $props();
|
|
29
33
|
|
|
34
|
+
let showWaffle = $state(false);
|
|
30
35
|
let showMenu = $state(false);
|
|
31
36
|
|
|
37
|
+
const toggleWaffle = () => {
|
|
38
|
+
showWaffle = !showWaffle;
|
|
39
|
+
showMenu = false;
|
|
40
|
+
};
|
|
41
|
+
|
|
32
42
|
const toggleMenu = () => {
|
|
33
43
|
showMenu = !showMenu;
|
|
44
|
+
showWaffle = false;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const handleKeydown = (event: KeyboardEvent) => {
|
|
48
|
+
if (event.key === 'Escape' && (showWaffle || showMenu)) {
|
|
49
|
+
showWaffle = false;
|
|
50
|
+
showMenu = false;
|
|
51
|
+
}
|
|
34
52
|
};
|
|
35
53
|
</script>
|
|
36
54
|
|
|
55
|
+
<svelte:window onkeydown={handleKeydown} />
|
|
56
|
+
|
|
37
57
|
<div class="header-container">
|
|
38
58
|
<nav class="header-section">
|
|
39
59
|
{#if !hideLoader}
|
|
40
60
|
<HeaderLoader />
|
|
41
61
|
{/if}
|
|
42
|
-
|
|
62
|
+
{#if waffle}
|
|
63
|
+
<button
|
|
64
|
+
type="button"
|
|
65
|
+
class={[showWaffle && 'active', 'header-button']}
|
|
66
|
+
onclick={toggleWaffle}
|
|
67
|
+
aria-label="Waffle Component"
|
|
68
|
+
aria-expanded={showWaffle}
|
|
69
|
+
>
|
|
70
|
+
<span class="material-icons icon-span">apps</span>
|
|
71
|
+
</button>
|
|
72
|
+
{@render waffle(showWaffle)}
|
|
73
|
+
{/if}
|
|
43
74
|
{#if menu}
|
|
44
75
|
<button type="button" class="header-button" onclick={toggleMenu} aria-label="menu button">
|
|
45
|
-
<span class="material-icons icon-span">menu</span>
|
|
76
|
+
<span class="material-icons icon-span menu-icon">menu</span>
|
|
46
77
|
</button>
|
|
47
78
|
{@render menu(showMenu)}
|
|
48
79
|
{/if}
|
|
@@ -69,20 +100,30 @@
|
|
|
69
100
|
justify-content: center;
|
|
70
101
|
align-items: center;
|
|
71
102
|
border-radius: 50%;
|
|
72
|
-
background:
|
|
103
|
+
background: transparent;
|
|
73
104
|
z-index: 40;
|
|
74
105
|
cursor: pointer;
|
|
75
106
|
border: none;
|
|
76
107
|
width: 40px;
|
|
77
108
|
height: 40px;
|
|
109
|
+
transition: background-color 0.2s ease-in-out;
|
|
78
110
|
}
|
|
79
111
|
|
|
80
112
|
.header-button:hover {
|
|
81
113
|
background: #e0e5e8;
|
|
82
114
|
}
|
|
83
115
|
|
|
116
|
+
.header-button.active {
|
|
117
|
+
background: #fff;
|
|
118
|
+
color: #374151;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.header-button .menu-icon {
|
|
122
|
+
transform: scale(1.26);
|
|
123
|
+
}
|
|
124
|
+
|
|
84
125
|
.icon-span {
|
|
85
|
-
font-size:
|
|
126
|
+
font-size: 24px;
|
|
86
127
|
color: #6b7180;
|
|
87
128
|
}
|
|
88
129
|
|
|
@@ -95,6 +136,8 @@
|
|
|
95
136
|
background: #fff;
|
|
96
137
|
height: 80px;
|
|
97
138
|
border-bottom: 3px solid #aeb1b9;
|
|
139
|
+
position: relative;
|
|
140
|
+
z-index: 50;
|
|
98
141
|
}
|
|
99
142
|
|
|
100
143
|
.header-section {
|
|
@@ -3,11 +3,14 @@ interface HeaderProps {
|
|
|
3
3
|
title?: string;
|
|
4
4
|
homeUrl?: string;
|
|
5
5
|
hideAccount?: boolean;
|
|
6
|
+
hideHelp?: boolean;
|
|
7
|
+
hideNotification?: boolean;
|
|
6
8
|
accountName?: string;
|
|
7
9
|
userName?: string;
|
|
8
10
|
profileUrl?: string;
|
|
9
11
|
hideLoader?: boolean;
|
|
10
12
|
menu?: Snippet<[showMenu: boolean]>;
|
|
13
|
+
waffle?: Snippet<[showWaffle: boolean]>;
|
|
11
14
|
}
|
|
12
15
|
declare const Header: import("svelte").Component<HeaderProps, {}, "">;
|
|
13
16
|
type Header = ReturnType<typeof Header>;
|
package/dist/Home/Home.svelte
CHANGED
|
@@ -19,9 +19,7 @@
|
|
|
19
19
|
<section class={['home-container', hasSingleItem && 'centered', hasManyItems && 'grid']}>
|
|
20
20
|
{#each homeItems as homeItem}
|
|
21
21
|
<a href={homeItem.url} class="home-item">
|
|
22
|
-
<
|
|
23
|
-
<img src={homeItem.icon} alt={homeItem.text} />
|
|
24
|
-
</span>
|
|
22
|
+
<img src={homeItem.icon} alt={homeItem.text} />
|
|
25
23
|
<div>
|
|
26
24
|
<h2>{homeItem.text}</h2>
|
|
27
25
|
<p>{homeItem.detail}</p>
|
|
@@ -82,15 +80,11 @@
|
|
|
82
80
|
background: var(--black-1);
|
|
83
81
|
transition: background 0.2s ease-in-out;
|
|
84
82
|
|
|
85
|
-
>
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
width: 40px;
|
|
91
|
-
height: 40px;
|
|
92
|
-
filter: invert(100%);
|
|
93
|
-
}
|
|
83
|
+
> img {
|
|
84
|
+
width: 36px;
|
|
85
|
+
height: 36px;
|
|
86
|
+
margin: auto 0;
|
|
87
|
+
filter: invert(100%);
|
|
94
88
|
}
|
|
95
89
|
|
|
96
90
|
> div {
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { HTMLAnchorAttributes } from 'svelte/elements';
|
|
4
|
+
|
|
5
|
+
interface Props extends HTMLAnchorAttributes {
|
|
6
|
+
name?: string;
|
|
7
|
+
children?: Snippet;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
let { name, children, ...props }: Props = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<a class="link" {...props}>
|
|
14
|
+
{#if children}
|
|
15
|
+
{@render children()}
|
|
16
|
+
{:else}
|
|
17
|
+
{name}
|
|
18
|
+
{/if}
|
|
19
|
+
</a>
|
|
20
|
+
|
|
21
|
+
<style>
|
|
22
|
+
.link {
|
|
23
|
+
color: var(--primary-color, #472aff);
|
|
24
|
+
text-decoration: none;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.link:hover,
|
|
28
|
+
.link:focus-visible {
|
|
29
|
+
text-decoration: underline;
|
|
30
|
+
}
|
|
31
|
+
</style>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAnchorAttributes } from 'svelte/elements';
|
|
3
|
+
interface Props extends HTMLAnchorAttributes {
|
|
4
|
+
name?: string;
|
|
5
|
+
children?: Snippet;
|
|
6
|
+
}
|
|
7
|
+
declare const Link: import("svelte").Component<Props, {}, "">;
|
|
8
|
+
type Link = ReturnType<typeof Link>;
|
|
9
|
+
export default Link;
|
package/dist/Menu/Menu.svelte
CHANGED
|
@@ -10,16 +10,9 @@
|
|
|
10
10
|
showMenu: boolean;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
let isMainMenu: boolean = $state(true);
|
|
14
|
-
let activeItem: string = $state('');
|
|
15
|
-
|
|
16
13
|
let { menuItems, showMenu }: MenuProps = $props();
|
|
17
14
|
|
|
18
|
-
$
|
|
19
|
-
if (showMenu) {
|
|
20
|
-
setActiveMenuItem();
|
|
21
|
-
}
|
|
22
|
-
});
|
|
15
|
+
let activeItem = $state('');
|
|
23
16
|
|
|
24
17
|
const setActiveMenuItem = () => {
|
|
25
18
|
activeItem = menuItems.find((menuItem: MenuItem) => isActiveMenuItem(menuItem.url))?.text || '';
|
|
@@ -43,6 +36,12 @@
|
|
|
43
36
|
const onHandleMenu = () => {
|
|
44
37
|
showMenu = !showMenu;
|
|
45
38
|
};
|
|
39
|
+
|
|
40
|
+
$effect(() => {
|
|
41
|
+
if (showMenu) {
|
|
42
|
+
setActiveMenuItem();
|
|
43
|
+
}
|
|
44
|
+
});
|
|
46
45
|
</script>
|
|
47
46
|
|
|
48
47
|
{#if showMenu}
|
|
@@ -60,7 +59,6 @@
|
|
|
60
59
|
item={menuItem}
|
|
61
60
|
isCollapsed={false}
|
|
62
61
|
activeItem={activeItem === menuItem.text}
|
|
63
|
-
{isMainMenu}
|
|
64
62
|
onClick={onClickMenuItem}
|
|
65
63
|
/>
|
|
66
64
|
{/each}
|
|
@@ -7,10 +7,9 @@
|
|
|
7
7
|
isCollapsed: boolean;
|
|
8
8
|
onClick?: (item: MenuItem) => void;
|
|
9
9
|
activeItem: boolean;
|
|
10
|
-
isMainMenu?: boolean;
|
|
11
10
|
}
|
|
12
11
|
|
|
13
|
-
let { item, isCollapsed = false, onClick, activeItem
|
|
12
|
+
let { item, isCollapsed = false, onClick, activeItem }: MenuItemProps = $props();
|
|
14
13
|
</script>
|
|
15
14
|
|
|
16
15
|
<li>
|
|
@@ -20,8 +19,7 @@
|
|
|
20
19
|
class={[
|
|
21
20
|
'item',
|
|
22
21
|
isCollapsed ? 'collapsed' : 'expanded',
|
|
23
|
-
activeItem && `active-${isCollapsed ? 'collapsed' : 'expanded'}
|
|
24
|
-
isMainMenu && 'main-menu'
|
|
22
|
+
activeItem && `active-${isCollapsed ? 'collapsed' : 'expanded'}`
|
|
25
23
|
]}
|
|
26
24
|
onclick={() => onClick?.(item)}
|
|
27
25
|
>
|
|
@@ -108,16 +106,6 @@
|
|
|
108
106
|
color: #472aff;
|
|
109
107
|
}
|
|
110
108
|
|
|
111
|
-
.main-menu.expanded:hover:not(.active-expanded),
|
|
112
|
-
.main-menu.collapsed:hover:not(.active-collapsed) {
|
|
113
|
-
background-color: #eaecff;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
.main-menu:hover .item-name-span,
|
|
117
|
-
.main-menu:hover .icon-span {
|
|
118
|
-
color: #472aff;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
109
|
.item.collapsed:focus,
|
|
122
110
|
.item.collapsed:focus-visible {
|
|
123
111
|
outline: none;
|
package/dist/Modal/Modal.svelte
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
title,
|
|
12
12
|
width = 'xs',
|
|
13
13
|
errorIcon,
|
|
14
|
+
hideHeader,
|
|
14
15
|
onclose = () => {},
|
|
15
16
|
children,
|
|
16
17
|
footer,
|
|
@@ -33,7 +34,7 @@
|
|
|
33
34
|
start: 0.95
|
|
34
35
|
}}
|
|
35
36
|
>
|
|
36
|
-
<ModalHeader {title} {errorIcon} onclose={onHandleClose} />
|
|
37
|
+
<ModalHeader {title} {errorIcon} {hideHeader} onclose={onHandleClose} />
|
|
37
38
|
<ModalContent content={children} {disablePadding} />
|
|
38
39
|
<ModalFooter {footer} onclose={onHandleClose} />
|
|
39
40
|
</div>
|
|
@@ -4,20 +4,23 @@
|
|
|
4
4
|
let {
|
|
5
5
|
title = '',
|
|
6
6
|
errorIcon = false,
|
|
7
|
+
hideHeader = false,
|
|
7
8
|
onclose
|
|
8
9
|
}: ModalHeaderProps & { onclose: VoidFunction } = $props();
|
|
9
10
|
</script>
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
<
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
12
|
+
{#if !hideHeader}
|
|
13
|
+
<header class="modal-header">
|
|
14
|
+
<div class="modal-header-title">
|
|
15
|
+
{#if errorIcon}
|
|
16
|
+
<span class="icon error material-icons-outlined">report</span>
|
|
17
|
+
{/if}
|
|
18
|
+
<h2>{title}</h2>
|
|
19
|
+
</div>
|
|
20
|
+
<button type="button" class="close-button material-icons-outlined" onclick={onclose}>close</button
|
|
21
|
+
>
|
|
22
|
+
</header>
|
|
23
|
+
{/if}
|
|
21
24
|
|
|
22
25
|
<style>
|
|
23
26
|
.modal-header,
|
|
@@ -29,6 +32,7 @@
|
|
|
29
32
|
.modal-header {
|
|
30
33
|
padding: 24px;
|
|
31
34
|
align-self: stretch;
|
|
35
|
+
border-bottom: 1px solid #aeb1b9;
|
|
32
36
|
}
|
|
33
37
|
|
|
34
38
|
.modal-header-title > .icon {
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import Modal from '../Modal/Modal.svelte';
|
|
3
|
+
import type { ProcessingProps } from './processingState.svelte.js';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
title = 'Processing your request',
|
|
7
|
+
text = '',
|
|
8
|
+
show = $bindable(true),
|
|
9
|
+
asModal = false
|
|
10
|
+
}: ProcessingProps = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
{#snippet processingContent()}
|
|
14
|
+
<div class="processing-header">
|
|
15
|
+
<span class="material-icons-outlined processing-icon">autorenew</span>
|
|
16
|
+
<div class="processing-content">
|
|
17
|
+
<h2 class="processing-title">{title}</h2>
|
|
18
|
+
{#if text}
|
|
19
|
+
<p class="processing-text">{text}</p>
|
|
20
|
+
{/if}
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
{/snippet}
|
|
24
|
+
|
|
25
|
+
{#if show}
|
|
26
|
+
{#if asModal}
|
|
27
|
+
<Modal bind:showModal={show} width="xs" hideHeader>
|
|
28
|
+
<div class="modal-processing-content">
|
|
29
|
+
{@render processingContent()}
|
|
30
|
+
</div>
|
|
31
|
+
</Modal>
|
|
32
|
+
{:else}
|
|
33
|
+
{@render processingContent()}
|
|
34
|
+
{/if}
|
|
35
|
+
{/if}
|
|
36
|
+
|
|
37
|
+
<style>
|
|
38
|
+
.processing-header {
|
|
39
|
+
display: flex;
|
|
40
|
+
flex-direction: column;
|
|
41
|
+
align-items: center;
|
|
42
|
+
text-align: center;
|
|
43
|
+
gap: 24px;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.processing-content {
|
|
47
|
+
display: flex;
|
|
48
|
+
flex-direction: column;
|
|
49
|
+
gap: 8px;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.processing-title {
|
|
53
|
+
font-size: 18px;
|
|
54
|
+
font-weight: 700;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.processing-text {
|
|
58
|
+
font-size: 16px;
|
|
59
|
+
white-space: pre-line;
|
|
60
|
+
line-height: 1.5;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.processing-icon {
|
|
64
|
+
background: linear-gradient(256deg, #00c9cd -2.41%, #472aff 31.72%, #392d9c 65.86%, #000 100%);
|
|
65
|
+
background-clip: text;
|
|
66
|
+
-webkit-background-clip: text;
|
|
67
|
+
-webkit-text-fill-color: transparent;
|
|
68
|
+
font-size: 32px;
|
|
69
|
+
animation: rotate 2s linear infinite;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
@keyframes rotate {
|
|
73
|
+
from {
|
|
74
|
+
transform: rotate(0deg);
|
|
75
|
+
}
|
|
76
|
+
to {
|
|
77
|
+
transform: rotate(360deg);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.modal-processing-content {
|
|
82
|
+
display: flex;
|
|
83
|
+
flex-direction: column;
|
|
84
|
+
justify-content: center;
|
|
85
|
+
align-items: center;
|
|
86
|
+
min-height: 200px;
|
|
87
|
+
width: 100%;
|
|
88
|
+
}
|
|
89
|
+
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { type SwitcherOption } from '../index.js';
|
|
3
|
+
|
|
4
|
+
interface SwitcherProps {
|
|
5
|
+
options: string[] | SwitcherOption[];
|
|
6
|
+
value?: string | null;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
let { options, value = $bindable() }: SwitcherProps = $props();
|
|
10
|
+
|
|
11
|
+
const isStringArray = (items: string[] | SwitcherOption[]): items is string[] =>
|
|
12
|
+
typeof items[0] === 'string';
|
|
13
|
+
|
|
14
|
+
const originalOptions = $derived<SwitcherOption[]>(
|
|
15
|
+
isStringArray(options) ? options.map((option) => ({ label: option, value: option })) : options
|
|
16
|
+
);
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<div class="switcher-container">
|
|
20
|
+
{#each originalOptions as option}
|
|
21
|
+
<button
|
|
22
|
+
type="button"
|
|
23
|
+
class={['switcher-option', option.value === value && 'active']}
|
|
24
|
+
onclick={() => (value = option.value)}
|
|
25
|
+
>
|
|
26
|
+
{option.label}
|
|
27
|
+
</button>
|
|
28
|
+
{/each}
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
<style>
|
|
32
|
+
.switcher-container {
|
|
33
|
+
--primary-color: #472aff;
|
|
34
|
+
--white: #fff;
|
|
35
|
+
--info-1: #eaecff;
|
|
36
|
+
--gray-1: #f4f6f8;
|
|
37
|
+
--gray-3: #aeb1b9;
|
|
38
|
+
--gray-4: #6b7180;
|
|
39
|
+
|
|
40
|
+
display: flex;
|
|
41
|
+
flex-wrap: wrap;
|
|
42
|
+
width: fit-content;
|
|
43
|
+
padding: 4px;
|
|
44
|
+
gap: 12px;
|
|
45
|
+
border: 1px solid var(--gray-3);
|
|
46
|
+
border-radius: 8px;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.switcher-container > .switcher-option {
|
|
50
|
+
cursor: pointer;
|
|
51
|
+
border: none;
|
|
52
|
+
padding: 4px 20px;
|
|
53
|
+
font-size: 14px;
|
|
54
|
+
color: var(--gray-4);
|
|
55
|
+
font-weight: 500;
|
|
56
|
+
border-radius: 8px;
|
|
57
|
+
background: none;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.switcher-container > .switcher-option:hover {
|
|
61
|
+
background: var(--gray-1);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.switcher-container > .switcher-option:focus-visible {
|
|
65
|
+
box-shadow: 0px 0px 0px 3px #959bff;
|
|
66
|
+
outline: none;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.switcher-container > .switcher-option.active {
|
|
70
|
+
color: var(--white);
|
|
71
|
+
background: var(--primary-color);
|
|
72
|
+
transition: background 0.2s ease-in-out;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.switcher-container > .switcher-option.active:hover {
|
|
76
|
+
background: #3520bf;
|
|
77
|
+
}
|
|
78
|
+
</style>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type SwitcherOption } from '../index.js';
|
|
2
|
+
interface SwitcherProps {
|
|
3
|
+
options: string[] | SwitcherOption[];
|
|
4
|
+
value?: string | null;
|
|
5
|
+
}
|
|
6
|
+
declare const Switcher: import("svelte").Component<SwitcherProps, {}, "value">;
|
|
7
|
+
type Switcher = ReturnType<typeof Switcher>;
|
|
8
|
+
export default Switcher;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { fade } from 'svelte/transition';
|
|
3
|
+
import type { WaffleItem } from './waffleState.svelte.js';
|
|
4
|
+
import WaffleItems from './WaffleItems.svelte';
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
items?: WaffleItem[];
|
|
8
|
+
showWaffle?: boolean;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
let { items = [], showWaffle = false }: Props = $props();
|
|
12
|
+
|
|
13
|
+
const handleTileClick = (item: WaffleItem) => {
|
|
14
|
+
onHandleWaffle();
|
|
15
|
+
window.open(item.url, '_blank', 'noopener,noreferrer');
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const onHandleWaffle = () => {
|
|
19
|
+
showWaffle = !showWaffle;
|
|
20
|
+
};
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
{#if showWaffle}
|
|
24
|
+
<div
|
|
25
|
+
class="waffle-backdrop"
|
|
26
|
+
onclick={onHandleWaffle}
|
|
27
|
+
onkeydown={onHandleWaffle}
|
|
28
|
+
transition:fade={{ duration: 200 }}
|
|
29
|
+
role="button"
|
|
30
|
+
tabindex="0"
|
|
31
|
+
aria-label="Close waffle menu"
|
|
32
|
+
></div>
|
|
33
|
+
|
|
34
|
+
<div
|
|
35
|
+
class="waffle-dropdown"
|
|
36
|
+
transition:fade={{ duration: 250 }}
|
|
37
|
+
role="dialog"
|
|
38
|
+
aria-labelledby="waffle-title"
|
|
39
|
+
aria-modal="true"
|
|
40
|
+
>
|
|
41
|
+
<h2 class="waffle-title">SoftwareOne Cloud</h2>
|
|
42
|
+
|
|
43
|
+
<div class="waffle-content">
|
|
44
|
+
<ul class="waffle-grid" role="list">
|
|
45
|
+
{#each items as item (item.title)}
|
|
46
|
+
<li role="listitem">
|
|
47
|
+
<WaffleItems {...item} onclickwaffleitems={() => handleTileClick(item)} />
|
|
48
|
+
</li>
|
|
49
|
+
{/each}
|
|
50
|
+
</ul>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
{/if}
|
|
54
|
+
|
|
55
|
+
<style>
|
|
56
|
+
.waffle-backdrop {
|
|
57
|
+
position: fixed;
|
|
58
|
+
inset: 0;
|
|
59
|
+
background: rgba(243, 244, 246, 0.5);
|
|
60
|
+
cursor: pointer;
|
|
61
|
+
z-index: 30;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.waffle-dropdown {
|
|
65
|
+
position: absolute;
|
|
66
|
+
display: flex;
|
|
67
|
+
flex-direction: column;
|
|
68
|
+
border-radius: 8px;
|
|
69
|
+
background: #fff;
|
|
70
|
+
box-shadow:
|
|
71
|
+
0 10px 15px -3px rgba(0, 0, 0, 0.1),
|
|
72
|
+
0 4px 6px -2px rgba(0, 0, 0, 0.05);
|
|
73
|
+
top: 80px;
|
|
74
|
+
left: 0;
|
|
75
|
+
z-index: 40;
|
|
76
|
+
width: 600px;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.waffle-content {
|
|
80
|
+
padding: 20px 24px 24px 24px;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.waffle-title {
|
|
84
|
+
padding: 24px 24px 0 24px;
|
|
85
|
+
font-size: 14px;
|
|
86
|
+
font-weight: 600;
|
|
87
|
+
text-align: center;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.waffle-grid {
|
|
91
|
+
display: grid;
|
|
92
|
+
grid-template-columns: repeat(3, 1fr);
|
|
93
|
+
gap: 16px;
|
|
94
|
+
}
|
|
95
|
+
</style>
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
interface Props {
|
|
3
|
+
title: string;
|
|
4
|
+
icon: string;
|
|
5
|
+
isNew?: boolean;
|
|
6
|
+
onclickwaffleitems: VoidFunction;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
let { title, icon, isNew = false, onclickwaffleitems }: Props = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<button onclick={onclickwaffleitems} class="waffle-item-button">
|
|
13
|
+
{#if isNew}
|
|
14
|
+
<span class="waffle-new-badge" aria-label="New application">New</span>
|
|
15
|
+
{/if}
|
|
16
|
+
|
|
17
|
+
<figure class="waffle-icon-container" aria-hidden="true">
|
|
18
|
+
{@html icon}
|
|
19
|
+
</figure>
|
|
20
|
+
|
|
21
|
+
<h3 class="waffle-title">
|
|
22
|
+
{title}
|
|
23
|
+
</h3>
|
|
24
|
+
</button>
|
|
25
|
+
|
|
26
|
+
<style>
|
|
27
|
+
.waffle-item-button {
|
|
28
|
+
position: relative;
|
|
29
|
+
width: 150px;
|
|
30
|
+
height: 110px;
|
|
31
|
+
display: flex;
|
|
32
|
+
flex-direction: column;
|
|
33
|
+
align-items: center;
|
|
34
|
+
justify-content: center;
|
|
35
|
+
border-radius: 8px;
|
|
36
|
+
text-align: center;
|
|
37
|
+
border: none;
|
|
38
|
+
background: transparent;
|
|
39
|
+
cursor: pointer;
|
|
40
|
+
transition: background-color 0.2s ease-in-out;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.waffle-item-button:hover {
|
|
44
|
+
background: #f4f6f8;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.waffle-item-button:focus, .waffle-item-button:focus-visible {
|
|
48
|
+
background: #eaecff;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.waffle-new-badge {
|
|
52
|
+
position: absolute;
|
|
53
|
+
top: 8px;
|
|
54
|
+
right: 8px;
|
|
55
|
+
background: #e6f9f2;
|
|
56
|
+
color: #29764d;
|
|
57
|
+
font-size: 14px;
|
|
58
|
+
font-weight: 500;
|
|
59
|
+
padding: 2px 6px;
|
|
60
|
+
border-radius: 4px;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.waffle-icon-container {
|
|
64
|
+
width: 40px;
|
|
65
|
+
height: 40px;
|
|
66
|
+
margin-bottom: 12px;
|
|
67
|
+
display: flex;
|
|
68
|
+
align-items: center;
|
|
69
|
+
justify-content: center;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.waffle-title {
|
|
73
|
+
color: #000;
|
|
74
|
+
font-weight: 500;
|
|
75
|
+
font-size: inherit;
|
|
76
|
+
word-break: break-words;
|
|
77
|
+
line-height: 1.25;
|
|
78
|
+
text-align: center;
|
|
79
|
+
padding: 0 4px;
|
|
80
|
+
margin: 0;
|
|
81
|
+
}
|
|
82
|
+
</style>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
title: string;
|
|
3
|
+
icon: string;
|
|
4
|
+
isNew?: boolean;
|
|
5
|
+
onclickwaffleitems: VoidFunction;
|
|
6
|
+
}
|
|
7
|
+
declare const WaffleItems: import("svelte").Component<Props, {}, "">;
|
|
8
|
+
type WaffleItems = ReturnType<typeof WaffleItems>;
|
|
9
|
+
export default WaffleItems;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,41 +1,56 @@
|
|
|
1
1
|
import Accordion from './Accordion/Accordion.svelte';
|
|
2
2
|
import Avatar from './Avatar/Avatar.svelte';
|
|
3
3
|
import Breadcrumbs from './Breadcrumbs/Breadcrumbs.svelte';
|
|
4
|
-
import { addBreadcrumbsNameMap, type BreadcrumbsNameMap } from './Breadcrumbs/breadcrumbsState.svelte.js';
|
|
5
4
|
import Button from './Button/Button.svelte';
|
|
6
5
|
import Card from './Card/Card.svelte';
|
|
7
6
|
import Chips from './Chips/Chips.svelte';
|
|
8
|
-
import { ChipType } from './Chips/chipsState.svelte.js';
|
|
9
7
|
import ErrorPage from './ErrorPage/ErrorPage.svelte';
|
|
10
8
|
import Footer from './Footer/Footer.svelte';
|
|
11
|
-
import
|
|
12
|
-
import Select from './Form/Select/Select.svelte';
|
|
13
|
-
import type { SelectOption } from './Form/Select/selectState.svelte.js';
|
|
14
|
-
import TextArea from './Form/TextArea/TextArea.svelte';
|
|
15
|
-
import Toggle from './Form/Toggle/Toggle.svelte';
|
|
9
|
+
import Form from './Form/FormController/Form.svelte';
|
|
16
10
|
import Header from './Header/Header.svelte';
|
|
17
11
|
import HeaderAccount from './Header/HeaderAccount.svelte';
|
|
18
12
|
import HeaderLoader from './Header/HeaderLoader.svelte';
|
|
19
13
|
import HeaderLogo from './Header/HeaderLogo.svelte';
|
|
20
14
|
import HighlightPanel from './HighlightPanel/HighlightPanel.svelte';
|
|
21
|
-
import { ColumnType, ImageType, type HighlightPanelColumn } from './HighlightPanel/highlightPanelState.svelte.js';
|
|
22
15
|
import Home from './Home/Home.svelte';
|
|
23
|
-
import
|
|
16
|
+
import Input from './Form/Input/Input.svelte';
|
|
17
|
+
import Link from './Link/Link.svelte';
|
|
24
18
|
import Menu from './Menu/Menu.svelte';
|
|
25
|
-
import Sidebar from './Menu/Sidebar.svelte';
|
|
26
|
-
import type { MenuItem } from './Menu/SidebarState.svelte';
|
|
27
19
|
import Modal from './Modal/Modal.svelte';
|
|
28
|
-
import type { ModalProps } from './Modal/modalState.svelte.js';
|
|
29
20
|
import Notification from './Notification/Notification.svelte';
|
|
21
|
+
import Processing from './Processing/Processing.svelte';
|
|
30
22
|
import ProgressPage from './ProgressPage/ProgressPage.svelte';
|
|
31
|
-
import { setProgressWizardStepsContext, getProgressWizardContext } from './ProgressWizard/context.js';
|
|
32
23
|
import ProgressWizard from './ProgressWizard/ProgressWizard.svelte';
|
|
33
|
-
import { setStepValidity, type ProgressWizardStep } from './ProgressWizard/progressWizardState.svelte.js';
|
|
34
24
|
import Search from './Search/Search.svelte';
|
|
25
|
+
import Select from './Form/Select/Select.svelte';
|
|
26
|
+
import Sidebar from './Menu/Sidebar.svelte';
|
|
35
27
|
import Spinner from './Spinner/Spinner.svelte';
|
|
28
|
+
import Switcher from './Switcher/Switcher.svelte';
|
|
36
29
|
import Tabs from './Tabs/Tabs.svelte';
|
|
37
|
-
import
|
|
30
|
+
import TextArea from './Form/TextArea/TextArea.svelte';
|
|
38
31
|
import Toaster from './Toast/Toast.svelte';
|
|
39
|
-
import
|
|
32
|
+
import Toggle from './Form/Toggle/Toggle.svelte';
|
|
40
33
|
import Tooltip from './Tooltip/Tooltip.svelte';
|
|
41
|
-
|
|
34
|
+
import Waffle from './Waffle/Waffle.svelte';
|
|
35
|
+
import { addBreadcrumbsNameMap } from './Breadcrumbs/breadcrumbsState.svelte.js';
|
|
36
|
+
import { ChipType } from './Chips/chipsState.svelte.js';
|
|
37
|
+
import { ColumnType, ImageType } from './HighlightPanel/highlightPanelState.svelte.js';
|
|
38
|
+
import { setProgressWizardStepsContext, getProgressWizardContext } from './ProgressWizard/context.js';
|
|
39
|
+
import { setStepValidity } from './ProgressWizard/progressWizardState.svelte.js';
|
|
40
|
+
import { addToast } from './Toast/toastState.svelte';
|
|
41
|
+
import { setFormContext, getFormContext } from './Form/FormController/context.js';
|
|
42
|
+
import { validateSchema } from './Form/FormController/helper.js';
|
|
43
|
+
import { createZodString } from './Form/FormController/zod-validations.js';
|
|
44
|
+
import type { BreadcrumbsNameMap } from './Breadcrumbs/breadcrumbsState.svelte.js';
|
|
45
|
+
import type { FormError, FormContext } from './Form/FormController/types.js';
|
|
46
|
+
import type { HighlightPanelColumn } from './HighlightPanel/highlightPanelState.svelte.js';
|
|
47
|
+
import type { HomeItem } from './Home/homeState.svelte.js';
|
|
48
|
+
import type { MenuItem } from './Menu/SidebarState.svelte';
|
|
49
|
+
import type { ModalProps } from './Modal/modalState.svelte.js';
|
|
50
|
+
import type { ProgressWizardStep } from './ProgressWizard/progressWizardState.svelte.js';
|
|
51
|
+
import type { SwitcherOption } from './Switcher/switcherState.svelte.js';
|
|
52
|
+
import type { SelectOption } from './Form/Select/selectState.svelte.js';
|
|
53
|
+
import type { Tab } from './Tabs/tabsState.svelte.js';
|
|
54
|
+
import type { Toast } from './Toast/toastState.svelte';
|
|
55
|
+
import type { WaffleItem } from './Waffle/waffleState.svelte.js';
|
|
56
|
+
export { Accordion, Avatar, Breadcrumbs, Button, Card, Chips, ErrorPage, Footer, Form, Header, HeaderAccount, HeaderLoader, HeaderLogo, HighlightPanel, Home, Input, Link, Menu, Modal, Notification, Processing, ProgressPage, ProgressWizard, Search, Select, Sidebar, Spinner, Switcher, Tabs, TextArea, Toaster, Toggle, Tooltip, Waffle, addBreadcrumbsNameMap, addToast, getProgressWizardContext, setProgressWizardStepsContext, setStepValidity, setFormContext, getFormContext, validateSchema, createZodString, ChipType, ColumnType, ImageType, type BreadcrumbsNameMap, type HighlightPanelColumn, type HomeItem, type MenuItem, type ModalProps, type ProgressWizardStep, type SelectOption, type SwitcherOption, type Tab, type Toast, type WaffleItem, type FormError, type FormContext };
|
package/dist/index.js
CHANGED
|
@@ -1,36 +1,52 @@
|
|
|
1
|
+
// Components
|
|
1
2
|
import Accordion from './Accordion/Accordion.svelte';
|
|
2
3
|
import Avatar from './Avatar/Avatar.svelte';
|
|
3
4
|
import Breadcrumbs from './Breadcrumbs/Breadcrumbs.svelte';
|
|
4
|
-
import { addBreadcrumbsNameMap } from './Breadcrumbs/breadcrumbsState.svelte.js';
|
|
5
5
|
import Button from './Button/Button.svelte';
|
|
6
6
|
import Card from './Card/Card.svelte';
|
|
7
7
|
import Chips from './Chips/Chips.svelte';
|
|
8
|
-
import { ChipType } from './Chips/chipsState.svelte.js';
|
|
9
8
|
import ErrorPage from './ErrorPage/ErrorPage.svelte';
|
|
10
9
|
import Footer from './Footer/Footer.svelte';
|
|
11
|
-
import
|
|
12
|
-
import Select from './Form/Select/Select.svelte';
|
|
13
|
-
import TextArea from './Form/TextArea/TextArea.svelte';
|
|
14
|
-
import Toggle from './Form/Toggle/Toggle.svelte';
|
|
10
|
+
import Form from './Form/FormController/Form.svelte';
|
|
15
11
|
import Header from './Header/Header.svelte';
|
|
16
12
|
import HeaderAccount from './Header/HeaderAccount.svelte';
|
|
17
13
|
import HeaderLoader from './Header/HeaderLoader.svelte';
|
|
18
14
|
import HeaderLogo from './Header/HeaderLogo.svelte';
|
|
19
15
|
import HighlightPanel from './HighlightPanel/HighlightPanel.svelte';
|
|
20
|
-
import { ColumnType, ImageType } from './HighlightPanel/highlightPanelState.svelte.js';
|
|
21
16
|
import Home from './Home/Home.svelte';
|
|
17
|
+
import Input from './Form/Input/Input.svelte';
|
|
18
|
+
import Link from './Link/Link.svelte';
|
|
22
19
|
import Menu from './Menu/Menu.svelte';
|
|
23
|
-
import Sidebar from './Menu/Sidebar.svelte';
|
|
24
20
|
import Modal from './Modal/Modal.svelte';
|
|
25
21
|
import Notification from './Notification/Notification.svelte';
|
|
22
|
+
import Processing from './Processing/Processing.svelte';
|
|
26
23
|
import ProgressPage from './ProgressPage/ProgressPage.svelte';
|
|
27
|
-
import { setProgressWizardStepsContext, getProgressWizardContext } from './ProgressWizard/context.js';
|
|
28
24
|
import ProgressWizard from './ProgressWizard/ProgressWizard.svelte';
|
|
29
|
-
import { setStepValidity } from './ProgressWizard/progressWizardState.svelte.js';
|
|
30
25
|
import Search from './Search/Search.svelte';
|
|
26
|
+
import Select from './Form/Select/Select.svelte';
|
|
27
|
+
import Sidebar from './Menu/Sidebar.svelte';
|
|
31
28
|
import Spinner from './Spinner/Spinner.svelte';
|
|
29
|
+
import Switcher from './Switcher/Switcher.svelte';
|
|
32
30
|
import Tabs from './Tabs/Tabs.svelte';
|
|
31
|
+
import TextArea from './Form/TextArea/TextArea.svelte';
|
|
33
32
|
import Toaster from './Toast/Toast.svelte';
|
|
34
|
-
import
|
|
33
|
+
import Toggle from './Form/Toggle/Toggle.svelte';
|
|
35
34
|
import Tooltip from './Tooltip/Tooltip.svelte';
|
|
36
|
-
|
|
35
|
+
import Waffle from './Waffle/Waffle.svelte';
|
|
36
|
+
// State, enums, and helpers
|
|
37
|
+
import { addBreadcrumbsNameMap } from './Breadcrumbs/breadcrumbsState.svelte.js';
|
|
38
|
+
import { ChipType } from './Chips/chipsState.svelte.js';
|
|
39
|
+
import { ColumnType, ImageType } from './HighlightPanel/highlightPanelState.svelte.js';
|
|
40
|
+
import { setProgressWizardStepsContext, getProgressWizardContext } from './ProgressWizard/context.js';
|
|
41
|
+
import { setStepValidity } from './ProgressWizard/progressWizardState.svelte.js';
|
|
42
|
+
import { addToast } from './Toast/toastState.svelte';
|
|
43
|
+
import { setFormContext, getFormContext } from './Form/FormController/context.js';
|
|
44
|
+
import { validateSchema } from './Form/FormController/helper.js';
|
|
45
|
+
import { createZodString } from './Form/FormController/zod-validations.js';
|
|
46
|
+
export {
|
|
47
|
+
// Components
|
|
48
|
+
Accordion, Avatar, Breadcrumbs, Button, Card, Chips, ErrorPage, Footer, Form, Header, HeaderAccount, HeaderLoader, HeaderLogo, HighlightPanel, Home, Input, Link, Menu, Modal, Notification, Processing, ProgressPage, ProgressWizard, Search, Select, Sidebar, Spinner, Switcher, Tabs, TextArea, Toaster, Toggle, Tooltip, Waffle,
|
|
49
|
+
// Functions and helpers
|
|
50
|
+
addBreadcrumbsNameMap, addToast, getProgressWizardContext, setProgressWizardStepsContext, setStepValidity, setFormContext, getFormContext, validateSchema, createZodString,
|
|
51
|
+
// Enums
|
|
52
|
+
ChipType, ColumnType, ImageType };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@softwareone/spi-sv5-library",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "Svelte components",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"svelte",
|
|
@@ -41,24 +41,35 @@
|
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"svelte": "^5.0.0"
|
|
44
|
+
"svelte": "^5.0.0",
|
|
45
|
+
"sveltekit-superforms": "^2.0.0",
|
|
46
|
+
"zod": "^4.0.0"
|
|
47
|
+
},
|
|
48
|
+
"peerDependenciesMeta": {
|
|
49
|
+
"sveltekit-superforms": {
|
|
50
|
+
"optional": true
|
|
51
|
+
},
|
|
52
|
+
"zod": {
|
|
53
|
+
"optional": true
|
|
54
|
+
}
|
|
45
55
|
},
|
|
46
56
|
"devDependencies": {
|
|
47
|
-
"@sveltejs/adapter-auto": "^
|
|
48
|
-
"@sveltejs/adapter-node": "^5.
|
|
49
|
-
"@sveltejs/kit": "^2.
|
|
50
|
-
"@sveltejs/package": "^2.
|
|
51
|
-
"@sveltejs/vite-plugin-svelte": "^
|
|
52
|
-
"prettier": "^3.
|
|
53
|
-
"prettier-plugin-svelte": "^3.
|
|
54
|
-
"publint": "^0.3.
|
|
55
|
-
"svelte": "^5.
|
|
56
|
-
"svelte-check": "^4.
|
|
57
|
-
"typescript": "^5.
|
|
58
|
-
"vite": "^6.
|
|
59
|
-
"zod": "^
|
|
57
|
+
"@sveltejs/adapter-auto": "^7.0.0",
|
|
58
|
+
"@sveltejs/adapter-node": "^5.4.0",
|
|
59
|
+
"@sveltejs/kit": "^2.48.4",
|
|
60
|
+
"@sveltejs/package": "^2.5.4",
|
|
61
|
+
"@sveltejs/vite-plugin-svelte": "^6.2.1",
|
|
62
|
+
"prettier": "^3.6.2",
|
|
63
|
+
"prettier-plugin-svelte": "^3.4.0",
|
|
64
|
+
"publint": "^0.3.15",
|
|
65
|
+
"svelte": "^5.43.5",
|
|
66
|
+
"svelte-check": "^4.3.3",
|
|
67
|
+
"typescript": "^5.9.3",
|
|
68
|
+
"vite": "^6.3.0",
|
|
69
|
+
"zod": "^4.1.12",
|
|
70
|
+
"sveltekit-superforms": "^2.28.1"
|
|
60
71
|
},
|
|
61
72
|
"dependencies": {
|
|
62
|
-
"@sveltejs/kit": "^2.
|
|
73
|
+
"@sveltejs/kit": "^2.48.4"
|
|
63
74
|
}
|
|
64
75
|
}
|