@softwareone/spi-sv5-library 1.11.3 → 1.11.5

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.
@@ -24,6 +24,7 @@
24
24
  <div class="accordion-content">
25
25
  <section class="header" class:is-open={isOpen}>
26
26
  <button
27
+ type="button"
27
28
  class="button"
28
29
  onclick={toggleAccordion}
29
30
  aria-label={isOpen ? 'Collapse accordion' : 'Expand accordion'}
@@ -59,7 +59,13 @@
59
59
  </div>
60
60
 
61
61
  {#snippet footer()}
62
- <Button variant="primary" variantColor="danger" disabled={!enableButton} onclick={handleDelete}>
62
+ <Button
63
+ type="button"
64
+ variant="primary"
65
+ variantColor="danger"
66
+ disabled={!enableButton}
67
+ onclick={handleDelete}
68
+ >
63
69
  Delete
64
70
  </Button>
65
71
  {/snippet}
@@ -72,7 +78,7 @@
72
78
  gap: 16px;
73
79
  width: 100%;
74
80
  }
75
-
81
+
76
82
  p {
77
83
  margin: 0;
78
84
  user-select: none;
@@ -39,8 +39,8 @@
39
39
  </p>
40
40
 
41
41
  <div class="feedback-footer">
42
- <Button variant="outline" onclick={() => window.history.back()}>Back</Button>
43
- <Button variant="primary" onclick={() => goto(page.url.origin)}>Go home</Button>
42
+ <Button type="button" variant="outline" onclick={() => window.history.back()}>Back</Button>
43
+ <Button type="button" variant="primary" onclick={() => goto(page.url.origin)}>Go home</Button>
44
44
  </div>
45
45
  </section>
46
46
 
@@ -27,6 +27,7 @@
27
27
  enctype?: FormEncodingType;
28
28
  invalidateAll?: boolean;
29
29
  spinnerFixed?: boolean;
30
+ contextName?: string;
30
31
  onsuccess: (data?: Record<string, unknown>) => void;
31
32
  onfailure?: (status: number | undefined, error: unknown) => void;
32
33
  children?: Snippet;
@@ -41,6 +42,7 @@
41
42
  enctype = 'application/x-www-form-urlencoded',
42
43
  invalidateAll = true,
43
44
  spinnerFixed = false,
45
+ contextName,
44
46
  onsuccess,
45
47
  onfailure = undefined,
46
48
  children
@@ -49,8 +51,7 @@
49
51
  let actionResult: ActionResult;
50
52
  let isLoading = $state(false);
51
53
 
52
- const { form, errors, isFormValid } = getFormContext<Schema>();
53
-
54
+ const { form, errors, isFormValid } = getFormContext<Schema>(contextName);
54
55
  $form = structuredClone($state.snapshot(initialData));
55
56
 
56
57
  const onUpdated = () => {
@@ -9,6 +9,7 @@ declare const Form: import("svelte").Component<{
9
9
  enctype?: "application/x-www-form-urlencoded" | "multipart/form-data";
10
10
  invalidateAll?: boolean;
11
11
  spinnerFixed?: boolean;
12
+ contextName?: string;
12
13
  onsuccess: (data?: Record<string, unknown>) => void;
13
14
  onfailure?: (status: number | undefined, error: unknown) => void;
14
15
  children?: Snippet;
@@ -1,3 +1,3 @@
1
1
  import type { FormContext } from './types.js';
2
- export declare const setFormContext: <T>() => FormContext<T>;
3
- export declare const getFormContext: <T>() => FormContext<T>;
2
+ export declare const setFormContext: <T>(name?: string) => FormContext<T>;
3
+ export declare const getFormContext: <T>(name?: string) => FormContext<T>;
@@ -1,15 +1,23 @@
1
1
  import { getContext, setContext } from 'svelte';
2
2
  import { writable } from 'svelte/store';
3
- const formContextKey = Symbol('formContext');
4
- export const setFormContext = () => {
3
+ const symbolCache = new Map();
4
+ const getFormContextKey = (name) => {
5
+ const DEFAULT_KEY = 'formContext';
6
+ const key = name ? `${DEFAULT_KEY}-${name}` : DEFAULT_KEY;
7
+ if (!symbolCache.has(key)) {
8
+ symbolCache.set(key, Symbol(key));
9
+ }
10
+ return symbolCache.get(key);
11
+ };
12
+ export const setFormContext = (name) => {
5
13
  const formContext = {
6
14
  form: writable({}),
7
15
  errors: writable({}),
8
16
  isFormValid: writable(false)
9
17
  };
10
- setContext(formContextKey, formContext);
18
+ setContext(getFormContextKey(name), formContext);
11
19
  return formContext;
12
20
  };
13
- export const getFormContext = () => {
14
- return getContext(formContextKey);
21
+ export const getFormContext = (name) => {
22
+ return getContext(getFormContextKey(name));
15
23
  };
@@ -41,7 +41,7 @@
41
41
  </div>
42
42
  </div>
43
43
  <div class="category-items">
44
- <button class="button" onclick={toggleSidebar}>
44
+ <button type="button" class="button" onclick={toggleSidebar}>
45
45
  <span class="material-icons-outlined icon-span">
46
46
  {isCollapsed ? 'menu' : 'menu_open'}
47
47
  </span>
@@ -7,7 +7,7 @@
7
7
 
8
8
  {#if footer}
9
9
  <footer class="modal-footer">
10
- <Button variant="outline-none" onclick={onclose}>Cancel</Button>
10
+ <Button type="button" variant="outline-none" onclick={onclose}>Cancel</Button>
11
11
  <div class="button-section">
12
12
  {@render footer()}
13
13
  </div>
@@ -12,7 +12,23 @@
12
12
 
13
13
  {#snippet processingContent()}
14
14
  <div class="processing-header">
15
- <span class="material-icons-outlined processing-icon">autorenew</span>
15
+ <svg
16
+ class="processing-icon"
17
+ xmlns="http://www.w3.org/2000/svg"
18
+ viewBox="0 0 24 24"
19
+ fill="none"
20
+ stroke="url(#processingGradient)"
21
+ stroke-width="2"
22
+ >
23
+ <defs>
24
+ <linearGradient id="processingGradient" x1="1.5%" y1="38%" x2="98.5%" y2="62%">
25
+ <stop offset="0%" stop-color="#472aff" />
26
+ <stop offset="65.86%" stop-color="#392d9c" />
27
+ <stop offset="100%" stop-color="#000000" />
28
+ </linearGradient>
29
+ </defs>
30
+ <path d="M21.5 2v6h-6M2.5 22v-6h6M2 11.5a10 10 0 0 1 18.8-4.3M22 12.5a10 10 0 0 1-18.8 4.2" />
31
+ </svg>
16
32
  <div class="processing-content">
17
33
  <h2 class="processing-title">{title}</h2>
18
34
  {#if text}
@@ -61,11 +77,8 @@
61
77
  }
62
78
 
63
79
  .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;
80
+ width: 32px;
81
+ height: 32px;
69
82
  animation: rotate 2s linear infinite;
70
83
  }
71
84
 
@@ -38,7 +38,7 @@
38
38
  </div>
39
39
 
40
40
  {#if onclick}
41
- <Button {onclick}>{buttonText}</Button>
41
+ <Button type="button" {onclick}>{buttonText}</Button>
42
42
  {/if}
43
43
  </article>
44
44
 
@@ -114,19 +114,20 @@
114
114
  </article>
115
115
  </section>
116
116
  <section class="progress-wizard-footer">
117
- <Button variant="outline-none" onclick={oncancel}>Cancel</Button>
117
+ <Button type="button" variant="outline-none" onclick={oncancel}>Cancel</Button>
118
118
 
119
119
  <div class="actions">
120
120
  {#if !allStepsDisabled}
121
121
  {#if !readonly}
122
122
  <Button
123
+ type="button"
123
124
  variant="secondary"
124
125
  disabled={currentStep === firstActiveStep}
125
126
  onclick={onclickBack}>Back</Button
126
127
  >
127
128
 
128
129
  {#if currentStep < lastActiveStep}
129
- <Button variant="primary" onclick={onclickNext}>Next</Button>
130
+ <Button type="button" variant="primary" onclick={onclickNext}>Next</Button>
130
131
  {/if}
131
132
  {/if}
132
133
 
@@ -34,7 +34,17 @@
34
34
 
35
35
  <div class="search-container" class:disabled>
36
36
  <div class="search-wrapper">
37
- <span class="material-icons-outlined search-icon" aria-hidden="true">search</span>
37
+ <svg
38
+ class="search-icon"
39
+ xmlns="http://www.w3.org/2000/svg"
40
+ viewBox="0 -960 960 960"
41
+ fill="currentColor"
42
+ aria-hidden="true"
43
+ >
44
+ <path
45
+ d="M784-120 532-372q-30 24-69 38t-83 14q-109 0-184.5-75.5T120-580q0-109 75.5-184.5T380-840q109 0 184.5 75.5T640-580q0 44-14 83t-38 69l252 252-56 56ZM380-400q75 0 127.5-52.5T560-580q0-75-52.5-127.5T380-760q-75 0-127.5 52.5T200-580q0 75 52.5 127.5T380-400Z"
46
+ />
47
+ </svg>
38
48
  <input
39
49
  type="search"
40
50
  class="search-input"
@@ -110,12 +120,13 @@
110
120
  top: 50%;
111
121
  transform: translateY(-50%);
112
122
  color: #6b7180;
113
- font-size: 18px;
114
123
  }
115
124
 
116
125
  .search-icon {
117
126
  left: 12px;
118
127
  pointer-events: none;
128
+ width: 18px;
129
+ height: 18px;
119
130
  }
120
131
 
121
132
  .clear-button {
@@ -142,7 +153,6 @@
142
153
  .clear-button span {
143
154
  font-size: 16px;
144
155
  }
145
-
146
156
  .disabled .search-wrapper {
147
157
  border-color: #d1d5db;
148
158
  background-color: #f3f4f6;
@@ -177,6 +177,7 @@
177
177
  {#if editingFilters.length}
178
178
  <div class="filter-footer">
179
179
  <Button
180
+ type="button"
180
181
  onclick={applyFilters}
181
182
  disabled={editingFilters.every((filter) => !filter.column || !filter.value.trim())}
182
183
  >
@@ -266,8 +266,10 @@
266
266
  />
267
267
  {/if}
268
268
  {#if enableExportExcel}
269
- <Button variant="secondary" onclick={() => exportExcel(table, excelSetting)}
270
- >Export</Button
269
+ <Button
270
+ type="button"
271
+ variant="secondary"
272
+ onclick={() => exportExcel(table, excelSetting)}>Export</Button
271
273
  >
272
274
  {/if}
273
275
  {@render header?.()}
@@ -8,7 +8,7 @@
8
8
  let { title, icon, onclickwaffleitems }: Props = $props();
9
9
  </script>
10
10
 
11
- <button onclick={onclickwaffleitems} class="waffle-item-button">
11
+ <button type="button" onclick={onclickwaffleitems} class="waffle-item-button">
12
12
  <figure class="waffle-icon-container" aria-hidden="true">
13
13
  {@html icon}
14
14
  </figure>
@@ -39,7 +39,8 @@
39
39
  background: #f4f6f8;
40
40
  }
41
41
 
42
- .waffle-item-button:focus, .waffle-item-button:focus-visible {
42
+ .waffle-item-button:focus,
43
+ .waffle-item-button:focus-visible {
43
44
  background: #eaecff;
44
45
  }
45
46
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@softwareone/spi-sv5-library",
3
- "version": "1.11.3",
3
+ "version": "1.11.5",
4
4
  "description": "Svelte components",
5
5
  "keywords": [
6
6
  "svelte",