@softwareone/spi-sv5-library 1.10.4 → 1.11.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.
Files changed (39) hide show
  1. package/dist/Button/Button.svelte +2 -1
  2. package/dist/Card/Card.svelte +1 -1
  3. package/dist/{AttachFile → Controls/AttachFile}/AttachFile.svelte +36 -21
  4. package/dist/{AttachFile → Controls/AttachFile}/AttachFile.svelte.d.ts +2 -1
  5. package/dist/{AttachFile → Controls/AttachFile}/Warnings.svelte +1 -1
  6. package/dist/Controls/Input/Input.svelte +2 -4
  7. package/dist/Controls/Input/Input.svelte.d.ts +2 -4
  8. package/dist/Controls/Label/Label.svelte +3 -8
  9. package/dist/Controls/Label/Label.svelte.d.ts +1 -7
  10. package/dist/Controls/Label/labelState.svelte.d.ts +7 -0
  11. package/dist/Controls/Label/labelState.svelte.js +1 -0
  12. package/dist/Controls/Select/Select.svelte +2 -5
  13. package/dist/Controls/Select/Select.svelte.d.ts +2 -5
  14. package/dist/Controls/TextArea/TextArea.svelte +2 -4
  15. package/dist/Controls/TextArea/TextArea.svelte.d.ts +2 -4
  16. package/dist/Controls/Toggle/Toggle.svelte +3 -5
  17. package/dist/Controls/Toggle/Toggle.svelte.d.ts +2 -4
  18. package/dist/Table/AdvancedFilter.svelte +385 -0
  19. package/dist/Table/AdvancedFilter.svelte.d.ts +29 -0
  20. package/dist/Table/Header.svelte +38 -5
  21. package/dist/Table/Table.svelte +78 -35
  22. package/dist/Table/Table.svelte.d.ts +2 -1
  23. package/dist/Table/consts.d.ts +6 -0
  24. package/dist/Table/consts.js +5 -0
  25. package/dist/Table/excel.js +11 -1
  26. package/dist/Table/index.d.ts +2 -1
  27. package/dist/Table/index.js +2 -1
  28. package/dist/Table/types.js +1 -1
  29. package/dist/Table/util.d.ts +2 -0
  30. package/dist/Table/util.js +21 -3
  31. package/dist/Tabs/Tabs.svelte +5 -2
  32. package/dist/Tabs/tabsState.svelte.d.ts +7 -5
  33. package/dist/Tabs/tabsState.svelte.js +3 -1
  34. package/dist/index.d.ts +3 -2
  35. package/dist/index.js +3 -2
  36. package/package.json +1 -1
  37. /package/dist/{AttachFile → Controls/AttachFile}/FileManager.svelte +0 -0
  38. /package/dist/{AttachFile → Controls/AttachFile}/FileManager.svelte.d.ts +0 -0
  39. /package/dist/{AttachFile → Controls/AttachFile}/Warnings.svelte.d.ts +0 -0
@@ -17,6 +17,7 @@
17
17
  variant = 'primary',
18
18
  variantColor = 'primary',
19
19
  loading = false,
20
+ disabled = false,
20
21
  children,
21
22
  ...props
22
23
  }: ButtonProps = $props();
@@ -29,7 +30,7 @@
29
30
  <button
30
31
  {@attach clearButtonFocus}
31
32
  class={['btn', `btn-${variant}-${variantColor}`, loading && 'loading']}
32
- disabled={loading || props.disabled}
33
+ disabled={loading || disabled}
33
34
  {...props}
34
35
  >
35
36
  {#if loading}
@@ -9,7 +9,7 @@
9
9
  let { children, disablePadding = false }: CardProps = $props();
10
10
  </script>
11
11
 
12
- <div class="card" class:padding={!disablePadding}>
12
+ <div class={['card', !disablePadding && 'padding']}>
13
13
  {@render children?.()}
14
14
  </div>
15
15
 
@@ -1,10 +1,12 @@
1
1
  <script lang="ts">
2
- import { Notification } from '../index.js';
3
2
  import type { Attachment } from 'svelte/attachments';
3
+
4
+ import type { LabelProps } from '../Label/labelState.svelte.js';
5
+ import { Label, Notification } from '../../index.js';
4
6
  import FileManager from './FileManager.svelte';
5
7
  import Warnings from './Warnings.svelte';
6
8
 
7
- interface Props {
9
+ interface Props extends LabelProps {
8
10
  accept?: string;
9
11
  multiple?: boolean;
10
12
  externalFileValidationMessages?: string[];
@@ -25,20 +27,29 @@
25
27
  fileSizeLimitMB,
26
28
  error,
27
29
  onvalidatefile,
28
- onchange
30
+ onchange,
31
+ label,
32
+ id,
33
+ required,
34
+ optional,
35
+ infoTooltip
29
36
  }: Props = $props();
30
37
 
31
38
  let validationMessages = $state<string[]>([]);
32
39
 
33
- const extensionFilesMessage = accept
34
- ? `Files of the following type are allowed: ${accept.replaceAll(',', ' & ')}.`
35
- : 'All file types are allowed.';
40
+ const extensionFilesMessage = $derived(
41
+ accept
42
+ ? `Files of the following type are allowed: ${accept.replaceAll(',', ' & ')}.`
43
+ : 'All file types are allowed.'
44
+ );
36
45
 
37
- const reviewMessages = [
38
- extensionFilesMessage,
39
- 'Duplicate file names are not allowed.',
40
- ...externalFileValidationMessages
41
- ];
46
+ const reviewMessages = $derived(
47
+ [
48
+ extensionFilesMessage,
49
+ multiple && 'Duplicate file names are not allowed.',
50
+ ...externalFileValidationMessages
51
+ ].filter(Boolean)
52
+ );
42
53
 
43
54
  const onChangeInputFile = async (selectedFiles: FileList | null) => {
44
55
  if (selectedFiles?.length) {
@@ -138,7 +149,7 @@
138
149
  };
139
150
  </script>
140
151
 
141
- <aside class="container">
152
+ <div class="container">
142
153
  <Notification type="info">
143
154
  {#snippet content()}
144
155
  <ul class="message">
@@ -148,13 +159,20 @@
148
159
  </ul>
149
160
  {/snippet}
150
161
  </Notification>
151
- <h2 class="title">Upload file</h2>
162
+ <Label
163
+ label={label || `Upload ${multiple ? 'files' : 'file'}`}
164
+ {id}
165
+ {required}
166
+ {optional}
167
+ {infoTooltip}
168
+ />
152
169
  <section class="drop-area">
153
170
  <p class="caption">Drag and drop files here</p>
154
171
  <p class="text-small">or</p>
155
172
 
156
173
  <input
157
174
  {@attach loadFiles}
175
+ {id}
158
176
  name="files"
159
177
  type="file"
160
178
  aria-label="Select files to upload"
@@ -177,7 +195,7 @@
177
195
  {#if files?.length}
178
196
  <FileManager {fileSizeLimitMB} {files} {updateFiles} />
179
197
  {/if}
180
- </aside>
198
+ </div>
181
199
 
182
200
  <style>
183
201
  .container {
@@ -192,6 +210,10 @@
192
210
  --spacing-md: 20px;
193
211
  --spacing-sm: 10px;
194
212
  --border-radius-md: 5px;
213
+
214
+ display: flex;
215
+ flex-direction: column;
216
+ gap: 8px;
195
217
  width: 100%;
196
218
  }
197
219
 
@@ -199,12 +221,6 @@
199
221
  font-size: 14px;
200
222
  line-height: 20px;
201
223
  }
202
- .title {
203
- font-size: 16px;
204
- line-height: 24px;
205
- font-weight: 500;
206
- margin-top: 12px;
207
- }
208
224
 
209
225
  .caption {
210
226
  font-size: 16px;
@@ -233,7 +249,6 @@
233
249
  border: 2px dashed var(--color-border);
234
250
  border-radius: var(--border-radius-md);
235
251
  text-align: center;
236
- margin-top: 8px;
237
252
  }
238
253
 
239
254
  .drop-area input[type='file'] {
@@ -1,4 +1,5 @@
1
- interface Props {
1
+ import type { LabelProps } from '../Label/labelState.svelte.js';
2
+ interface Props extends LabelProps {
2
3
  accept?: string;
3
4
  multiple?: boolean;
4
5
  externalFileValidationMessages?: string[];
@@ -24,7 +24,7 @@
24
24
 
25
25
  <style>
26
26
  .container {
27
- margin-top: 16px;
27
+ margin-top: 8px;
28
28
  font-size: 12px;
29
29
  line-height: 16px;
30
30
  }
@@ -1,21 +1,19 @@
1
1
  <script lang="ts">
2
2
  import type { HTMLInputAttributes } from 'svelte/elements';
3
3
 
4
+ import type { LabelProps } from '../Label/labelState.svelte.js';
4
5
  import Label from '../Label/Label.svelte';
5
6
  import InputIcon from './InputIcon.svelte';
6
7
 
7
8
  type InputType = 'text' | 'password' | 'number' | 'date' | 'money';
8
9
 
9
- interface InputProps extends Omit<HTMLInputAttributes, 'type' | 'value'> {
10
- label?: string;
10
+ interface InputProps extends Omit<HTMLInputAttributes, 'type' | 'value'>, LabelProps {
11
11
  type?: InputType;
12
12
  value?: string | number | null;
13
- optional?: boolean;
14
13
  error?: string | string[];
15
14
  description?: string;
16
15
  currency?: string;
17
16
  disableValidationColor?: boolean;
18
- infoTooltip?: string;
19
17
  }
20
18
 
21
19
  let {
@@ -1,15 +1,13 @@
1
1
  import type { HTMLInputAttributes } from 'svelte/elements';
2
+ import type { LabelProps } from '../Label/labelState.svelte.js';
2
3
  type InputType = 'text' | 'password' | 'number' | 'date' | 'money';
3
- interface InputProps extends Omit<HTMLInputAttributes, 'type' | 'value'> {
4
- label?: string;
4
+ interface InputProps extends Omit<HTMLInputAttributes, 'type' | 'value'>, LabelProps {
5
5
  type?: InputType;
6
6
  value?: string | number | null;
7
- optional?: boolean;
8
7
  error?: string | string[];
9
8
  description?: string;
10
9
  currency?: string;
11
10
  disableValidationColor?: boolean;
12
- infoTooltip?: string;
13
11
  }
14
12
  declare const Input: import("svelte").Component<InputProps, {}, "value">;
15
13
  type Input = ReturnType<typeof Input>;
@@ -1,13 +1,6 @@
1
1
  <script lang="ts">
2
2
  import { Tooltip } from '../../index.js';
3
-
4
- interface LabelProps {
5
- label?: string;
6
- id?: string | null;
7
- required?: boolean | null;
8
- optional?: boolean;
9
- infoTooltip?: string;
10
- }
3
+ import type { LabelProps } from './labelState.svelte.js';
11
4
 
12
5
  let { label, id, required, optional, infoTooltip }: LabelProps = $props();
13
6
  </script>
@@ -33,6 +26,8 @@
33
26
  display: flex;
34
27
  gap: 8px;
35
28
  font-weight: 500;
29
+ font-size: 14px;
30
+ line-height: 20px;
36
31
  }
37
32
 
38
33
  .form-label-optional {
@@ -1,10 +1,4 @@
1
- interface LabelProps {
2
- label?: string;
3
- id?: string | null;
4
- required?: boolean | null;
5
- optional?: boolean;
6
- infoTooltip?: string;
7
- }
1
+ import type { LabelProps } from './labelState.svelte.js';
8
2
  declare const Label: import("svelte").Component<LabelProps, {}, "">;
9
3
  type Label = ReturnType<typeof Label>;
10
4
  export default Label;
@@ -0,0 +1,7 @@
1
+ export interface LabelProps {
2
+ label?: string;
3
+ id?: string | null;
4
+ required?: boolean | null;
5
+ optional?: boolean;
6
+ infoTooltip?: string;
7
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -4,15 +4,12 @@
4
4
  import type { Attachment } from 'svelte/attachments';
5
5
 
6
6
  import { Search, type SelectOption } from '../../index.js';
7
+ import type { LabelProps } from '../Label/labelState.svelte.js';
7
8
  import Label from '../Label/Label.svelte';
8
9
 
9
- interface SelectProps {
10
+ interface SelectProps extends LabelProps {
10
11
  options: string[] | SelectOption[];
11
- label?: string;
12
12
  placeholder?: string;
13
- infoTooltip?: string;
14
- required?: boolean;
15
- optional?: boolean;
16
13
  searchable?: boolean;
17
14
  hideClearButton?: boolean;
18
15
  multiple?: boolean;
@@ -1,12 +1,9 @@
1
1
  import { type Snippet } from 'svelte';
2
2
  import { type SelectOption } from '../../index.js';
3
- interface SelectProps {
3
+ import type { LabelProps } from '../Label/labelState.svelte.js';
4
+ interface SelectProps extends LabelProps {
4
5
  options: string[] | SelectOption[];
5
- label?: string;
6
6
  placeholder?: string;
7
- infoTooltip?: string;
8
- required?: boolean;
9
- optional?: boolean;
10
7
  searchable?: boolean;
11
8
  hideClearButton?: boolean;
12
9
  multiple?: boolean;
@@ -1,17 +1,15 @@
1
1
  <script lang="ts">
2
2
  import type { HTMLTextareaAttributes } from 'svelte/elements';
3
3
 
4
+ import type { LabelProps } from '../Label/labelState.svelte.js';
4
5
  import Label from '../Label/Label.svelte';
5
6
 
6
- interface TextAreaProps extends Omit<HTMLTextareaAttributes, 'value'> {
7
- label?: string;
7
+ interface TextAreaProps extends Omit<HTMLTextareaAttributes, 'value'>, LabelProps {
8
8
  value?: string | null;
9
- optional?: boolean;
10
9
  error?: string | string[];
11
10
  description?: string;
12
11
  maximumCharactersAllowed?: number;
13
12
  resize?: boolean;
14
- infoTooltip?: string;
15
13
  disableValidationColor?: boolean;
16
14
  }
17
15
 
@@ -1,13 +1,11 @@
1
1
  import type { HTMLTextareaAttributes } from 'svelte/elements';
2
- interface TextAreaProps extends Omit<HTMLTextareaAttributes, 'value'> {
3
- label?: string;
2
+ import type { LabelProps } from '../Label/labelState.svelte.js';
3
+ interface TextAreaProps extends Omit<HTMLTextareaAttributes, 'value'>, LabelProps {
4
4
  value?: string | null;
5
- optional?: boolean;
6
5
  error?: string | string[];
7
6
  description?: string;
8
7
  maximumCharactersAllowed?: number;
9
8
  resize?: boolean;
10
- infoTooltip?: string;
11
9
  disableValidationColor?: boolean;
12
10
  }
13
11
  declare const TextArea: import("svelte").Component<TextAreaProps, {}, "value">;
@@ -1,12 +1,10 @@
1
1
  <script lang="ts">
2
2
  import Label from '../Label/Label.svelte';
3
+ import type { LabelProps } from '../Label/labelState.svelte.js';
3
4
 
4
- interface ToggleProps {
5
- id?: string;
5
+ interface ToggleProps extends Pick<LabelProps, 'id' | 'label' | 'infoTooltip'> {
6
6
  checked?: boolean;
7
7
  disabled?: boolean;
8
- label?: string;
9
- infoTooltip?: string;
10
8
  vertical?: boolean;
11
9
  onchange?: (event: Event) => void;
12
10
  }
@@ -43,7 +41,7 @@
43
41
  </span>
44
42
  </div>
45
43
  </label>
46
- <Label {label} {infoTooltip} />
44
+ <Label {id} {label} {infoTooltip} />
47
45
  </div>
48
46
 
49
47
  <style>
@@ -1,9 +1,7 @@
1
- interface ToggleProps {
2
- id?: string;
1
+ import type { LabelProps } from '../Label/labelState.svelte.js';
2
+ interface ToggleProps extends Pick<LabelProps, 'id' | 'label' | 'infoTooltip'> {
3
3
  checked?: boolean;
4
4
  disabled?: boolean;
5
- label?: string;
6
- infoTooltip?: string;
7
5
  vertical?: boolean;
8
6
  onchange?: (event: Event) => void;
9
7
  }