@softwareone/spi-sv5-library 1.5.5 → 1.5.7

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.
@@ -18,6 +18,7 @@
18
18
  type Schema = z.infer<typeof schema>;
19
19
 
20
20
  interface Props {
21
+ id?: string;
21
22
  initialData: Schema;
22
23
  action: string;
23
24
  schema: z.ZodObject;
@@ -28,6 +29,7 @@
28
29
  }
29
30
 
30
31
  let {
32
+ id,
31
33
  initialData,
32
34
  action,
33
35
  schema,
@@ -145,17 +147,17 @@
145
147
  <Spinner show={isLoading} />
146
148
 
147
149
  <form
148
- id="form"
150
+ id={id ? `form-${id}` : 'form'}
149
151
  method="POST"
150
152
  action="?/{action}"
151
153
  use:enhance
152
154
  onsubmit={(event) => event.preventDefault()}
153
155
  >
154
- {@render children()}
156
+ {@render children?.()}
155
157
  </form>
156
158
 
157
159
  <style>
158
160
  form {
159
161
  width: 100%;
160
162
  }
161
- </style>
163
+ </style>
@@ -1,6 +1,7 @@
1
1
  import { type Snippet } from 'svelte';
2
2
  import { z } from 'zod';
3
3
  declare const Form: import("svelte").Component<{
4
+ id?: string;
4
5
  initialData: Record<string, unknown>;
5
6
  action: string;
6
7
  schema: z.ZodObject;
@@ -19,7 +19,9 @@
19
19
  {#if column.type === ColumnType.Text}
20
20
  <h2>{column.label}</h2>
21
21
  <p>{column.value}</p>
22
- <p class="text-description">{column.description ?? ''}</p>
22
+ {#if column.description}
23
+ <p class="text-description">{column.description}</p>
24
+ {/if}
23
25
  {/if}
24
26
 
25
27
  {#if column.type === ColumnType.Status}
@@ -37,14 +39,27 @@
37
39
  {#if column.type === ColumnType.Image}
38
40
  {@const { content, iconType } = column}
39
41
  <h2>{column.label}</h2>
40
- {#if iconType === ImageType.Default}
41
- <img src={content} alt="icon" />
42
- {:else if iconType === ImageType.Avatar}
43
- <Avatar text={content} />
44
- {:else if iconType === ImageType.Material}
45
- <span class="material-icons">{content}</span>
46
- {/if}
47
- <p class="text-description">{column.description ?? ''}</p>
42
+
43
+ <figure class:text-right={column.alignTextRight}>
44
+ {#if iconType === ImageType.Default}
45
+ <img src={content} alt="icon" />
46
+ {:else if iconType === ImageType.Avatar}
47
+ <Avatar text={content} />
48
+ {:else if iconType === ImageType.Material}
49
+ <span class="material-icons">{content}</span>
50
+ {/if}
51
+
52
+ {#if column.value || column.description}
53
+ <div>
54
+ {#if column.value}
55
+ <p>{column.value}</p>
56
+ {/if}
57
+ {#if column.description}
58
+ <p class="text-description">{column.description}</p>
59
+ {/if}
60
+ </div>
61
+ {/if}
62
+ </figure>
48
63
  {/if}
49
64
  </div>
50
65
  {/each}
@@ -70,6 +85,7 @@
70
85
  }
71
86
 
72
87
  .text-description {
88
+ font-size: 12px;
73
89
  color: #6b7180;
74
90
  }
75
91
 
@@ -121,6 +137,16 @@
121
137
  border-radius: 9999px;
122
138
  }
123
139
 
140
+ .panel-element > figure {
141
+ display: flex;
142
+ flex-direction: column;
143
+ gap: 8px;
144
+ }
145
+
146
+ .panel-element > figure.text-right {
147
+ flex-direction: row;
148
+ }
149
+
124
150
  @media screen and (max-width: 700px) {
125
151
  .buttons-section {
126
152
  flex-direction: column;
@@ -26,6 +26,7 @@ type Icon = BaseColumn & {
26
26
  type: ColumnType.Image;
27
27
  iconType: ImageType;
28
28
  content: string;
29
+ alignTextRight?: boolean;
29
30
  };
30
31
  type Status = BaseColumn & {
31
32
  type: ColumnType.Status;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@softwareone/spi-sv5-library",
3
- "version": "1.5.5",
3
+ "version": "1.5.7",
4
4
  "description": "Svelte components",
5
5
  "keywords": [
6
6
  "svelte",