@softwareone/spi-sv5-library 1.8.8 → 1.8.10
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/Select/Select.svelte +26 -18
- package/dist/Form/TextArea/TextArea.svelte +8 -1
- package/dist/Form/TextArea/TextArea.svelte.d.ts +1 -0
- package/dist/Modal/ModalContent.svelte +1 -0
- package/dist/ProgressWizard/context.d.ts +6 -1
- package/dist/ProgressWizard/context.js +1 -1
- package/package.json +1 -1
|
@@ -53,7 +53,6 @@
|
|
|
53
53
|
}: SelectProps = $props();
|
|
54
54
|
|
|
55
55
|
let searchText = $state('');
|
|
56
|
-
let showInTopPosition = $state(false);
|
|
57
56
|
let showListOptions = $state(false);
|
|
58
57
|
|
|
59
58
|
let dropdown: HTMLElement;
|
|
@@ -117,42 +116,51 @@
|
|
|
117
116
|
|
|
118
117
|
const autoDirection: Attachment<HTMLElement> = (element: HTMLElement) => {
|
|
119
118
|
const BOTTOM_SPACING_OFFSET = 300;
|
|
120
|
-
const DROPDOWN_GAP =
|
|
119
|
+
const DROPDOWN_GAP = 16;
|
|
121
120
|
|
|
122
121
|
const updatePosition = () => {
|
|
123
122
|
const rect = dropdown.getBoundingClientRect();
|
|
124
123
|
const viewportHeight = window.innerHeight;
|
|
125
124
|
|
|
126
|
-
showInTopPosition = rect.bottom + BOTTOM_SPACING_OFFSET > viewportHeight;
|
|
125
|
+
const showInTopPosition = rect.bottom + BOTTOM_SPACING_OFFSET > viewportHeight;
|
|
127
126
|
|
|
128
|
-
if (positionStrategy === '
|
|
129
|
-
|
|
127
|
+
if (positionStrategy === 'absolute') {
|
|
128
|
+
element.classList.toggle('upwards', showInTopPosition);
|
|
129
|
+
} else {
|
|
130
|
+
setDropdownStyles(element, rect, showInTopPosition);
|
|
130
131
|
}
|
|
131
132
|
};
|
|
132
133
|
|
|
133
|
-
const setDropdownStyles = (element: HTMLElement, rect: DOMRect) => {
|
|
134
|
+
const setDropdownStyles = (element: HTMLElement, rect: DOMRect, showInTopPosition: boolean) => {
|
|
134
135
|
element.style.setProperty('--dropdown-width', `${rect.width}px`);
|
|
135
136
|
element.style.setProperty('--dropdown-left', `${rect.left}px`);
|
|
136
137
|
|
|
137
138
|
const topPosition = showInTopPosition
|
|
138
139
|
? rect.top - element.offsetHeight - DROPDOWN_GAP
|
|
139
|
-
: rect.bottom
|
|
140
|
+
: rect.bottom;
|
|
140
141
|
|
|
141
142
|
element.style.setProperty('--dropdown-top', `${topPosition}px`);
|
|
142
143
|
};
|
|
143
144
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
145
|
+
const resizeObserver = new ResizeObserver(updatePosition);
|
|
146
|
+
|
|
147
|
+
if (showListOptions) {
|
|
148
|
+
updatePosition();
|
|
149
|
+
window.addEventListener('scroll', updatePosition, true);
|
|
150
|
+
window.addEventListener('resize', updatePosition);
|
|
151
|
+
if (positionStrategy === 'fixed') {
|
|
152
|
+
resizeObserver.observe(element);
|
|
153
|
+
resizeObserver.observe(dropdown);
|
|
149
154
|
}
|
|
155
|
+
}
|
|
150
156
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
157
|
+
return () => {
|
|
158
|
+
window.removeEventListener('scroll', updatePosition, true);
|
|
159
|
+
window.removeEventListener('resize', updatePosition);
|
|
160
|
+
if (positionStrategy === 'fixed') {
|
|
161
|
+
resizeObserver.disconnect();
|
|
162
|
+
}
|
|
163
|
+
};
|
|
156
164
|
};
|
|
157
165
|
|
|
158
166
|
const canBeVisible = (option: SelectOption): boolean =>
|
|
@@ -256,7 +264,7 @@
|
|
|
256
264
|
<section
|
|
257
265
|
class={[
|
|
258
266
|
'dropdown-list',
|
|
259
|
-
positionStrategy === 'absolute' &&
|
|
267
|
+
positionStrategy === 'absolute' && 'upwards',
|
|
260
268
|
positionStrategy === 'fixed' && 'position-fixed'
|
|
261
269
|
]}
|
|
262
270
|
{@attach autoDirection}
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
maximumCharactersAllowed?: number;
|
|
12
12
|
resize?: boolean;
|
|
13
13
|
infoTooltip?: string;
|
|
14
|
+
disableValidationColor?: boolean;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
let {
|
|
@@ -24,6 +25,7 @@
|
|
|
24
25
|
resize = false,
|
|
25
26
|
id,
|
|
26
27
|
infoTooltip,
|
|
28
|
+
disableValidationColor = false,
|
|
27
29
|
...props
|
|
28
30
|
}: TextAreaProps = $props();
|
|
29
31
|
|
|
@@ -42,7 +44,12 @@
|
|
|
42
44
|
<div class="form-container">
|
|
43
45
|
<Label {label} {id} {optional} {required} {infoTooltip} />
|
|
44
46
|
|
|
45
|
-
<div
|
|
47
|
+
<div
|
|
48
|
+
class={[
|
|
49
|
+
'form-textarea-wrapper',
|
|
50
|
+
!disableValidationColor && [isInvalid && 'error', isValid && 'success']
|
|
51
|
+
]}
|
|
52
|
+
>
|
|
46
53
|
<textarea
|
|
47
54
|
{...props}
|
|
48
55
|
id={textareaId}
|
|
@@ -8,6 +8,7 @@ interface TextAreaProps extends Omit<HTMLTextareaAttributes, 'value'> {
|
|
|
8
8
|
maximumCharactersAllowed?: number;
|
|
9
9
|
resize?: boolean;
|
|
10
10
|
infoTooltip?: string;
|
|
11
|
+
disableValidationColor?: boolean;
|
|
11
12
|
}
|
|
12
13
|
declare const TextArea: import("svelte").Component<TextAreaProps, {}, "value">;
|
|
13
14
|
type TextArea = ReturnType<typeof TextArea>;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { type Writable } from 'svelte/store';
|
|
2
2
|
import type { ProgressWizardStep } from './progressWizardState.svelte.js';
|
|
3
|
-
export declare const setProgressWizardStepsContext: (steps: ProgressWizardStep[]) => Writable<
|
|
3
|
+
export declare const setProgressWizardStepsContext: (steps: ProgressWizardStep[]) => Writable<{
|
|
4
|
+
title: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
isValid: boolean;
|
|
7
|
+
disabled: boolean;
|
|
8
|
+
}[]>;
|
|
4
9
|
export declare const getProgressWizardContext: () => Writable<ProgressWizardStep[]>;
|
|
@@ -2,7 +2,7 @@ import { getContext, setContext } from 'svelte';
|
|
|
2
2
|
import { writable } from 'svelte/store';
|
|
3
3
|
const stepsKey = Symbol('steps');
|
|
4
4
|
export const setProgressWizardStepsContext = (steps) => {
|
|
5
|
-
const stepsContext = writable(steps);
|
|
5
|
+
const stepsContext = writable(steps.map(step => ({ ...step })));
|
|
6
6
|
setContext(stepsKey, stepsContext);
|
|
7
7
|
return stepsContext;
|
|
8
8
|
};
|