@softwareone/spi-sv5-library 1.13.0 → 1.14.1

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 (128) hide show
  1. package/README.md +0 -5
  2. package/dist/Accordion/Accordion.svelte +2 -7
  3. package/dist/Accordion/Accordion.svelte.d.ts +2 -2
  4. package/dist/Announcement/Announcement.svelte +1 -1
  5. package/dist/Announcement/Announcement.svelte.d.ts +1 -1
  6. package/dist/Avatar/Avatar.svelte +2 -2
  7. package/dist/Avatar/Avatar.svelte.d.ts +2 -2
  8. package/dist/Button/Button.svelte +2 -2
  9. package/dist/Button/Button.svelte.d.ts +2 -2
  10. package/dist/Card/Card.svelte +2 -2
  11. package/dist/Card/Card.svelte.d.ts +2 -2
  12. package/dist/Chips/Chips.svelte +3 -3
  13. package/dist/Chips/Chips.svelte.d.ts +3 -3
  14. package/dist/Confirmation/Confirmation.svelte +44 -0
  15. package/dist/Confirmation/Confirmation.svelte.d.ts +11 -0
  16. package/dist/Controls/AttachFile/AttachFile.svelte +1 -1
  17. package/dist/Controls/AttachFile/AttachFile.svelte.d.ts +1 -1
  18. package/dist/Controls/AttachFile/Warnings.svelte +2 -2
  19. package/dist/Controls/AttachFile/Warnings.svelte.d.ts +2 -2
  20. package/dist/Controls/Input/Input.svelte +3 -3
  21. package/dist/Controls/Input/Input.svelte.d.ts +3 -3
  22. package/dist/Controls/Label/Label.svelte +1 -1
  23. package/dist/Controls/Label/Label.svelte.d.ts +1 -1
  24. package/dist/Controls/RadioGroup/RadioGroup.svelte +4 -4
  25. package/dist/Controls/RadioGroup/RadioGroup.svelte.d.ts +4 -4
  26. package/dist/Controls/Select/Select.svelte +22 -10
  27. package/dist/Controls/Select/Select.svelte.d.ts +3 -3
  28. package/dist/Controls/TextArea/TextArea.svelte +3 -3
  29. package/dist/Controls/TextArea/TextArea.svelte.d.ts +3 -3
  30. package/dist/Controls/Toggle/Toggle.svelte +3 -3
  31. package/dist/Controls/Toggle/Toggle.svelte.d.ts +3 -3
  32. package/dist/DeleteConfirmation/DeleteConfirmation.svelte +7 -11
  33. package/dist/DeleteConfirmation/DeleteConfirmation.svelte.d.ts +3 -4
  34. package/dist/ErrorPage/ErrorPage.svelte +2 -2
  35. package/dist/ErrorPage/ErrorPage.svelte.d.ts +2 -2
  36. package/dist/Footer/Footer.svelte +3 -2
  37. package/dist/Footer/Footer.svelte.d.ts +2 -2
  38. package/dist/Header/Header.svelte +3 -3
  39. package/dist/Header/Header.svelte.d.ts +3 -3
  40. package/dist/HighlightPanel/HighlightPanel.svelte +2 -2
  41. package/dist/HighlightPanel/HighlightPanel.svelte.d.ts +2 -2
  42. package/dist/HighlightPanel/enums.d.ts +12 -0
  43. package/dist/HighlightPanel/{highlightPanelState.svelte.d.ts → types.d.ts} +1 -12
  44. package/dist/Home/Home.svelte +2 -2
  45. package/dist/Home/Home.svelte.d.ts +2 -2
  46. package/dist/Menu/Menu.svelte +3 -3
  47. package/dist/Menu/Menu.svelte.d.ts +3 -3
  48. package/dist/Menu/MenuItem.svelte +3 -3
  49. package/dist/Menu/MenuItem.svelte.d.ts +3 -3
  50. package/dist/Menu/Sidebar.svelte +1 -1
  51. package/dist/Menu/Sidebar.svelte.d.ts +1 -1
  52. package/dist/Menu/{MenuState.svelte.d.ts → types.d.ts} +0 -1
  53. package/dist/Menu/utils.d.ts +2 -0
  54. package/dist/Modal/Modal.svelte +1 -1
  55. package/dist/Modal/Modal.svelte.d.ts +1 -1
  56. package/dist/Modal/ModalContent.svelte +2 -2
  57. package/dist/Modal/ModalContent.svelte.d.ts +2 -2
  58. package/dist/Modal/ModalFooter.svelte +1 -1
  59. package/dist/Modal/ModalFooter.svelte.d.ts +1 -1
  60. package/dist/Modal/ModalHeader.svelte +1 -1
  61. package/dist/Modal/ModalHeader.svelte.d.ts +1 -1
  62. package/dist/Notification/Notification.svelte +10 -1
  63. package/dist/Notification/Notification.svelte.d.ts +8 -1
  64. package/dist/Processing/Processing.svelte +8 -2
  65. package/dist/Processing/Processing.svelte.d.ts +7 -2
  66. package/dist/ProgressPage/ProgressPage.svelte +3 -3
  67. package/dist/ProgressPage/ProgressPage.svelte.d.ts +3 -3
  68. package/dist/ProgressWizard/ProgressWizard.svelte +2 -2
  69. package/dist/ProgressWizard/ProgressWizard.svelte.d.ts +2 -2
  70. package/dist/ProgressWizard/context.d.ts +1 -1
  71. package/dist/ProgressWizard/{progressWizardState.svelte.d.ts → types.d.ts} +0 -1
  72. package/dist/ProgressWizard/utils.d.ts +2 -0
  73. package/dist/Spinner/Spinner.svelte +2 -2
  74. package/dist/Spinner/Spinner.svelte.d.ts +2 -2
  75. package/dist/Switcher/Switcher.svelte +2 -2
  76. package/dist/Switcher/Switcher.svelte.d.ts +2 -2
  77. package/dist/Table/AdvancedFilter.svelte +1 -1
  78. package/dist/Table/Header.svelte +1 -1
  79. package/dist/Table/Table.svelte +1 -1
  80. package/dist/Table/index.d.ts +1 -1
  81. package/dist/Table/index.js +1 -1
  82. package/dist/Tabs/Tabs.svelte +2 -2
  83. package/dist/Tabs/Tabs.svelte.d.ts +2 -2
  84. package/dist/Toast/Toast.svelte +3 -3
  85. package/dist/Toast/Toast.svelte.d.ts +2 -2
  86. package/dist/Toast/{toastState.svelte.d.ts → state.svelte.d.ts} +1 -6
  87. package/dist/Toast/types.d.ts +7 -0
  88. package/dist/Toast/types.js +1 -0
  89. package/dist/Tooltip/Tooltip.svelte +2 -2
  90. package/dist/Tooltip/Tooltip.svelte.d.ts +2 -2
  91. package/dist/Waffle/Waffle.svelte +1 -1
  92. package/dist/Waffle/Waffle.svelte.d.ts +1 -1
  93. package/dist/Waffle/types.js +1 -0
  94. package/dist/index.d.ts +28 -32
  95. package/dist/index.js +18 -19
  96. package/package.json +1 -1
  97. package/dist/Breadcrumbs/Breadcrumbs.svelte +0 -78
  98. package/dist/Breadcrumbs/Breadcrumbs.svelte.d.ts +0 -18
  99. package/dist/Breadcrumbs/breadcrumbsState.svelte.d.ts +0 -8
  100. package/dist/Breadcrumbs/breadcrumbsState.svelte.js +0 -24
  101. package/dist/Notification/notificationState.svelte.d.ts +0 -9
  102. package/dist/Processing/processingState.svelte.d.ts +0 -6
  103. /package/dist/Announcement/{AnnouncementState.svelte.d.ts → types.d.ts} +0 -0
  104. /package/dist/Announcement/{AnnouncementState.svelte.js → types.js} +0 -0
  105. /package/dist/Chips/{chipsState.svelte.d.ts → enums.d.ts} +0 -0
  106. /package/dist/Chips/{chipsState.svelte.js → enums.js} +0 -0
  107. /package/dist/Controls/Label/{labelState.svelte.d.ts → types.d.ts} +0 -0
  108. /package/dist/Controls/Label/{labelState.svelte.js → types.js} +0 -0
  109. /package/dist/Controls/RadioGroup/{radioGroupState.svelte.d.ts → types.d.ts} +0 -0
  110. /package/dist/Controls/RadioGroup/{radioGroupState.svelte.js → types.js} +0 -0
  111. /package/dist/Controls/Select/{selectState.svelte.d.ts → types.d.ts} +0 -0
  112. /package/dist/Controls/Select/{selectState.svelte.js → types.js} +0 -0
  113. /package/dist/HighlightPanel/{highlightPanelState.svelte.js → enums.js} +0 -0
  114. /package/dist/{Modal/modalState.svelte.js → HighlightPanel/types.js} +0 -0
  115. /package/dist/{Notification/notificationState.svelte.js → Menu/types.js} +0 -0
  116. /package/dist/Menu/{MenuState.svelte.js → utils.js} +0 -0
  117. /package/dist/Modal/{modalState.svelte.d.ts → types.d.ts} +0 -0
  118. /package/dist/{Processing/processingState.svelte.js → Modal/types.js} +0 -0
  119. /package/dist/{Switcher/switcherState.svelte.js → ProgressWizard/types.js} +0 -0
  120. /package/dist/ProgressWizard/{progressWizardState.svelte.js → utils.js} +0 -0
  121. /package/dist/Switcher/{switcherState.svelte.d.ts → types.d.ts} +0 -0
  122. /package/dist/{Waffle/waffleState.svelte.js → Switcher/types.js} +0 -0
  123. /package/dist/Table/{util.d.ts → utils.d.ts} +0 -0
  124. /package/dist/Table/{util.js → utils.js} +0 -0
  125. /package/dist/Tabs/{tabsState.svelte.d.ts → types.d.ts} +0 -0
  126. /package/dist/Tabs/{tabsState.svelte.js → types.js} +0 -0
  127. /package/dist/Toast/{toastState.svelte.js → state.svelte.js} +0 -0
  128. /package/dist/Waffle/{waffleState.svelte.d.ts → types.d.ts} +0 -0
package/README.md CHANGED
@@ -17,7 +17,6 @@ Import the components you need into your Svelte application:
17
17
  ```javascript
18
18
  import {
19
19
  Avatar,
20
- Breadcrumbs,
21
20
  Button,
22
21
  Card,
23
22
  Chips,
@@ -45,7 +44,6 @@ Import the types you need into your Svelte application:
45
44
 
46
45
  ```javascript
47
46
  import {
48
- type BreadcrumbsNameMap,
49
47
  type HighlightPanelColumn,
50
48
  type MenuItem,
51
49
  type ModalProps,
@@ -58,7 +56,6 @@ import {
58
56
  # List of components
59
57
 
60
58
  - Avatar
61
- - Breadcrumbs
62
59
  - Button
63
60
  - Card
64
61
  - Chips
@@ -84,8 +81,6 @@ import {
84
81
 
85
82
  # List of types per component
86
83
 
87
- - Breadcrumbs
88
- - BreadcrumbsNameMap
89
84
  - Chips
90
85
  - ChipType
91
86
  - HighlightPanel
@@ -1,19 +1,14 @@
1
1
  <script lang="ts">
2
2
  import type { Snippet } from 'svelte';
3
3
 
4
- interface AccordionProps {
4
+ interface Props {
5
5
  title: string;
6
6
  disableBorder?: boolean;
7
7
  isOpen?: boolean;
8
8
  children: Snippet;
9
9
  }
10
10
 
11
- let {
12
- title,
13
- disableBorder = false,
14
- isOpen = $bindable(false),
15
- children
16
- }: AccordionProps = $props();
11
+ let { title, disableBorder = false, isOpen = $bindable(false), children }: Props = $props();
17
12
 
18
13
  const toggleAccordion = () => {
19
14
  isOpen = !isOpen;
@@ -1,10 +1,10 @@
1
1
  import type { Snippet } from 'svelte';
2
- interface AccordionProps {
2
+ interface Props {
3
3
  title: string;
4
4
  disableBorder?: boolean;
5
5
  isOpen?: boolean;
6
6
  children: Snippet;
7
7
  }
8
- declare const Accordion: import("svelte").Component<AccordionProps, {}, "isOpen">;
8
+ declare const Accordion: import("svelte").Component<Props, {}, "isOpen">;
9
9
  type Accordion = ReturnType<typeof Accordion>;
10
10
  export default Accordion;
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">
2
2
  import { fade } from 'svelte/transition';
3
3
 
4
- import type { AnnouncementItem } from './AnnouncementState.svelte.js';
4
+ import type { AnnouncementItem } from './types.js';
5
5
 
6
6
  interface Props {
7
7
  announcementItems?: AnnouncementItem[];
@@ -1,4 +1,4 @@
1
- import type { AnnouncementItem } from './AnnouncementState.svelte.js';
1
+ import type { AnnouncementItem } from './types.js';
2
2
  interface Props {
3
3
  announcementItems?: AnnouncementItem[];
4
4
  showAnnouncement: boolean;
@@ -2,7 +2,7 @@
2
2
  type BackgroundColor = '#472AFF' | '#25282D';
3
3
  type TextColor = '#333840' | '#FFFFFF';
4
4
 
5
- interface AvatarProps {
5
+ interface Props {
6
6
  text: string;
7
7
  backgroundColor?: BackgroundColor;
8
8
  textColor?: TextColor;
@@ -14,7 +14,7 @@
14
14
  backgroundColor = '#25282D',
15
15
  textColor = '#FFFFFF',
16
16
  keepOrder = false
17
- }: AvatarProps = $props();
17
+ }: Props = $props();
18
18
 
19
19
  const avatarSrc = (text: string): string => {
20
20
  const defaultValue = 'SO';
@@ -1,11 +1,11 @@
1
1
  type BackgroundColor = '#472AFF' | '#25282D';
2
2
  type TextColor = '#333840' | '#FFFFFF';
3
- interface AvatarProps {
3
+ interface Props {
4
4
  text: string;
5
5
  backgroundColor?: BackgroundColor;
6
6
  textColor?: TextColor;
7
7
  keepOrder?: boolean;
8
8
  }
9
- declare const Avatar: import("svelte").Component<AvatarProps, {}, "">;
9
+ declare const Avatar: import("svelte").Component<Props, {}, "">;
10
10
  type Avatar = ReturnType<typeof Avatar>;
11
11
  export default Avatar;
@@ -6,7 +6,7 @@
6
6
  type Variant = 'primary' | 'secondary' | 'outline' | 'outline-none';
7
7
  type VariantColor = 'primary' | 'danger';
8
8
 
9
- interface ButtonProps extends HTMLButtonAttributes {
9
+ interface Props extends HTMLButtonAttributes {
10
10
  variant?: Variant;
11
11
  variantColor?: VariantColor;
12
12
  loading?: boolean;
@@ -20,7 +20,7 @@
20
20
  disabled = false,
21
21
  children,
22
22
  ...props
23
- }: ButtonProps = $props();
23
+ }: Props = $props();
24
24
 
25
25
  const clearButtonFocus: Attachment<HTMLButtonElement> = (element: HTMLButtonElement) => {
26
26
  if (loading) element.blur();
@@ -2,12 +2,12 @@ import type { Snippet } from 'svelte';
2
2
  import type { HTMLButtonAttributes } from 'svelte/elements';
3
3
  type Variant = 'primary' | 'secondary' | 'outline' | 'outline-none';
4
4
  type VariantColor = 'primary' | 'danger';
5
- interface ButtonProps extends HTMLButtonAttributes {
5
+ interface Props extends HTMLButtonAttributes {
6
6
  variant?: Variant;
7
7
  variantColor?: VariantColor;
8
8
  loading?: boolean;
9
9
  children: Snippet;
10
10
  }
11
- declare const Button: import("svelte").Component<ButtonProps, {}, "">;
11
+ declare const Button: import("svelte").Component<Props, {}, "">;
12
12
  type Button = ReturnType<typeof Button>;
13
13
  export default Button;
@@ -1,12 +1,12 @@
1
1
  <script lang="ts">
2
2
  import type { Snippet } from 'svelte';
3
3
 
4
- interface CardProps {
4
+ interface Props {
5
5
  children?: Snippet;
6
6
  disablePadding?: boolean;
7
7
  }
8
8
 
9
- let { children, disablePadding = false }: CardProps = $props();
9
+ let { children, disablePadding = false }: Props = $props();
10
10
  </script>
11
11
 
12
12
  <div class={['card', !disablePadding && 'padding']}>
@@ -1,8 +1,8 @@
1
1
  import type { Snippet } from 'svelte';
2
- interface CardProps {
2
+ interface Props {
3
3
  children?: Snippet;
4
4
  disablePadding?: boolean;
5
5
  }
6
- declare const Card: import("svelte").Component<CardProps, {}, "">;
6
+ declare const Card: import("svelte").Component<Props, {}, "">;
7
7
  type Card = ReturnType<typeof Card>;
8
8
  export default Card;
@@ -1,12 +1,12 @@
1
1
  <script lang="ts">
2
- import { ChipType } from './chipsState.svelte.js';
2
+ import { ChipType } from './enums.js';
3
3
 
4
- interface ChipsProps {
4
+ interface Props {
5
5
  type?: ChipType;
6
6
  text?: string;
7
7
  }
8
8
 
9
- let { type = ChipType.Info, text = type.charAt(0).toUpperCase() + type.slice(1) }: ChipsProps =
9
+ let { type = ChipType.Info, text = type.charAt(0).toUpperCase() + type.slice(1) }: Props =
10
10
  $props();
11
11
  </script>
12
12
 
@@ -1,8 +1,8 @@
1
- import { ChipType } from './chipsState.svelte.js';
2
- interface ChipsProps {
1
+ import { ChipType } from './enums.js';
2
+ interface Props {
3
3
  type?: ChipType;
4
4
  text?: string;
5
5
  }
6
- declare const Chips: import("svelte").Component<ChipsProps, {}, "">;
6
+ declare const Chips: import("svelte").Component<Props, {}, "">;
7
7
  type Chips = ReturnType<typeof Chips>;
8
8
  export default Chips;
@@ -0,0 +1,44 @@
1
+ <script lang="ts">
2
+ import { Button, Modal, Spinner, addToast } from '../index.js';
3
+
4
+ interface Props {
5
+ title: string;
6
+ confirmationText: string;
7
+ confirmButtonText?: string;
8
+ showModal?: boolean;
9
+ onconfirm: () => Promise<string | void> | string | void;
10
+ onclose?: VoidFunction;
11
+ }
12
+
13
+ let {
14
+ title,
15
+ confirmationText,
16
+ confirmButtonText = 'Proceed',
17
+ showModal = $bindable(false),
18
+ onconfirm,
19
+ onclose
20
+ }: Props = $props();
21
+
22
+ let isLoading = $state(false);
23
+
24
+ const handleConfirm = async () => {
25
+ isLoading = true;
26
+
27
+ const error = await onconfirm();
28
+ if (error === undefined) {
29
+ showModal = false;
30
+ } else {
31
+ addToast({ message: error, type: 'danger' });
32
+ }
33
+
34
+ isLoading = false;
35
+ };
36
+ </script>
37
+
38
+ <Modal {title} bind:showModal {onclose}>
39
+ <Spinner show={isLoading} />
40
+ <p>{confirmationText}</p>
41
+ {#snippet footer()}
42
+ <Button type="button" onclick={handleConfirm}>{confirmButtonText}</Button>
43
+ {/snippet}
44
+ </Modal>
@@ -0,0 +1,11 @@
1
+ interface Props {
2
+ title: string;
3
+ confirmationText: string;
4
+ confirmButtonText?: string;
5
+ showModal?: boolean;
6
+ onconfirm: () => Promise<string | void> | string | void;
7
+ onclose?: VoidFunction;
8
+ }
9
+ declare const Confirmation: import("svelte").Component<Props, {}, "showModal">;
10
+ type Confirmation = ReturnType<typeof Confirmation>;
11
+ export default Confirmation;
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">
2
2
  import type { Attachment } from 'svelte/attachments';
3
3
 
4
- import type { LabelProps } from '../Label/labelState.svelte.js';
4
+ import type { LabelProps } from '../Label/types.js';
5
5
  import { Label, Notification } from '../../index.js';
6
6
  import FileManager from './FileManager.svelte';
7
7
  import Warnings from './Warnings.svelte';
@@ -1,4 +1,4 @@
1
- import type { LabelProps } from '../Label/labelState.svelte.js';
1
+ import type { LabelProps } from '../Label/types.js';
2
2
  interface Props extends LabelProps {
3
3
  accept?: string;
4
4
  multiple?: boolean;
@@ -1,8 +1,8 @@
1
1
  <script lang="ts">
2
- interface WarningProps {
2
+ interface Props {
3
3
  validationMessages: string[];
4
4
  }
5
- let { validationMessages }: WarningProps = $props();
5
+ let { validationMessages }: Props = $props();
6
6
  </script>
7
7
 
8
8
  <details class="container">
@@ -1,6 +1,6 @@
1
- interface WarningProps {
1
+ interface Props {
2
2
  validationMessages: string[];
3
3
  }
4
- declare const Warnings: import("svelte").Component<WarningProps, {}, "">;
4
+ declare const Warnings: import("svelte").Component<Props, {}, "">;
5
5
  type Warnings = ReturnType<typeof Warnings>;
6
6
  export default Warnings;
@@ -2,12 +2,12 @@
2
2
  import type { HTMLInputAttributes } from 'svelte/elements';
3
3
 
4
4
  import Label from '../Label/Label.svelte';
5
- import type { LabelProps } from '../Label/labelState.svelte.js';
5
+ import type { LabelProps } from '../Label/types.js';
6
6
  import InputIcon from './InputIcon.svelte';
7
7
 
8
8
  type InputType = 'text' | 'password' | 'number' | 'date' | 'money';
9
9
 
10
- interface InputProps extends Omit<HTMLInputAttributes, 'type' | 'value'>, LabelProps {
10
+ interface Props extends Omit<HTMLInputAttributes, 'type' | 'value'>, LabelProps {
11
11
  type?: InputType;
12
12
  value?: string | number | null;
13
13
  error?: string | string[];
@@ -31,7 +31,7 @@
31
31
  disableValidationColor = false,
32
32
  infoTooltip,
33
33
  ...props
34
- }: InputProps = $props();
34
+ }: Props = $props();
35
35
 
36
36
  let isPasswordVisible = $state(false);
37
37
 
@@ -1,7 +1,7 @@
1
1
  import type { HTMLInputAttributes } from 'svelte/elements';
2
- import type { LabelProps } from '../Label/labelState.svelte.js';
2
+ import type { LabelProps } from '../Label/types.js';
3
3
  type InputType = 'text' | 'password' | 'number' | 'date' | 'money';
4
- interface InputProps extends Omit<HTMLInputAttributes, 'type' | 'value'>, LabelProps {
4
+ interface Props extends Omit<HTMLInputAttributes, 'type' | 'value'>, LabelProps {
5
5
  type?: InputType;
6
6
  value?: string | number | null;
7
7
  error?: string | string[];
@@ -9,6 +9,6 @@ interface InputProps extends Omit<HTMLInputAttributes, 'type' | 'value'>, LabelP
9
9
  currency?: string;
10
10
  disableValidationColor?: boolean;
11
11
  }
12
- declare const Input: import("svelte").Component<InputProps, {}, "value">;
12
+ declare const Input: import("svelte").Component<Props, {}, "value">;
13
13
  type Input = ReturnType<typeof Input>;
14
14
  export default Input;
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">
2
2
  import { Tooltip } from '../../index.js';
3
- import type { LabelProps } from './labelState.svelte.js';
3
+ import type { LabelProps } from './types.js';
4
4
 
5
5
  let { label, id, required, optional, infoTooltip }: LabelProps = $props();
6
6
  </script>
@@ -1,4 +1,4 @@
1
- import type { LabelProps } from './labelState.svelte.js';
1
+ import type { LabelProps } from './types.js';
2
2
  declare const Label: import("svelte").Component<LabelProps, {}, "">;
3
3
  type Label = ReturnType<typeof Label>;
4
4
  export default Label;
@@ -1,9 +1,9 @@
1
1
  <script lang="ts">
2
2
  import Label from '../Label/Label.svelte';
3
- import type { LabelProps } from '../Label/labelState.svelte.js';
4
- import type { OptionValueType, RadioOption } from './radioGroupState.svelte.js';
3
+ import type { LabelProps } from '../Label/types.js';
4
+ import type { OptionValueType, RadioOption } from './types.js';
5
5
 
6
- interface RadioGroupProps extends LabelProps {
6
+ interface Props extends LabelProps {
7
7
  options: string[] | RadioOption[];
8
8
  name: string;
9
9
  value?: OptionValueType;
@@ -25,7 +25,7 @@
25
25
  row = false,
26
26
  description,
27
27
  onchange
28
- }: RadioGroupProps = $props();
28
+ }: Props = $props();
29
29
 
30
30
  const isStringArray = (items: string[] | RadioOption[]): items is string[] =>
31
31
  typeof items[0] === 'string';
@@ -1,6 +1,6 @@
1
- import type { LabelProps } from '../Label/labelState.svelte.js';
2
- import type { OptionValueType, RadioOption } from './radioGroupState.svelte.js';
3
- interface RadioGroupProps extends LabelProps {
1
+ import type { LabelProps } from '../Label/types.js';
2
+ import type { OptionValueType, RadioOption } from './types.js';
3
+ interface Props extends LabelProps {
4
4
  options: string[] | RadioOption[];
5
5
  name: string;
6
6
  value?: OptionValueType;
@@ -9,6 +9,6 @@ interface RadioGroupProps extends LabelProps {
9
9
  description?: string;
10
10
  onchange?: (value: OptionValueType) => void;
11
11
  }
12
- declare const RadioGroup: import("svelte").Component<RadioGroupProps, {}, "value">;
12
+ declare const RadioGroup: import("svelte").Component<Props, {}, "value">;
13
13
  type RadioGroup = ReturnType<typeof RadioGroup>;
14
14
  export default RadioGroup;
@@ -5,9 +5,9 @@
5
5
 
6
6
  import { Search, type SelectOption } from '../../index.js';
7
7
  import Label from '../Label/Label.svelte';
8
- import type { LabelProps } from '../Label/labelState.svelte.js';
8
+ import type { LabelProps } from '../Label/types.js';
9
9
 
10
- interface SelectProps extends LabelProps {
10
+ interface Props extends LabelProps {
11
11
  options: string[] | SelectOption[];
12
12
  placeholder?: string;
13
13
  searchable?: boolean;
@@ -49,7 +49,7 @@
49
49
  customOption,
50
50
  onclear,
51
51
  onchange
52
- }: SelectProps = $props();
52
+ }: Props = $props();
53
53
 
54
54
  let searchText = $state('');
55
55
  let showListOptions = $state(false);
@@ -107,6 +107,11 @@
107
107
  : originalOptions.filter((option) => option.label.toLowerCase().includes(text));
108
108
  });
109
109
 
110
+ const focusInput: Attachment<HTMLElement> = () => {
111
+ const searchElement = document.getElementById('search-options') as HTMLInputElement;
112
+ searchElement.focus();
113
+ };
114
+
110
115
  const activeOptionScroll: Action<HTMLElement, boolean> = (node, isActive) => {
111
116
  $effect(() => {
112
117
  if (isActive) {
@@ -196,7 +201,11 @@
196
201
 
197
202
  const onClearSearch = () => (searchText = '');
198
203
 
199
- const onFocusDropdownContainer = () => dropdownContainer && dropdownContainer.focus();
204
+ const onFocusDropdownContainer = (event: Event) => {
205
+ event.stopPropagation();
206
+ showListOptions = true;
207
+ dropdownContainer.focus();
208
+ };
200
209
 
201
210
  const onToggleListOptions = () => (showListOptions = !showListOptions);
202
211
 
@@ -275,12 +284,15 @@
275
284
  {@attach autoDirection}
276
285
  >
277
286
  {#if searchable && !noOptionsAvailable}
278
- <Search
279
- placeholder="Search"
280
- bind:value={searchText}
281
- onclear={onClearSearch}
282
- autocomplete="off"
283
- />
287
+ <div {@attach focusInput}>
288
+ <Search
289
+ id="search-options"
290
+ placeholder="Search"
291
+ bind:value={searchText}
292
+ onclear={onClearSearch}
293
+ autocomplete="off"
294
+ />
295
+ </div>
284
296
  {/if}
285
297
 
286
298
  {#if noOptionsAvailable || !filteredOptions.length}
@@ -1,7 +1,7 @@
1
1
  import { type Snippet } from 'svelte';
2
2
  import { type SelectOption } from '../../index.js';
3
- import type { LabelProps } from '../Label/labelState.svelte.js';
4
- interface SelectProps extends LabelProps {
3
+ import type { LabelProps } from '../Label/types.js';
4
+ interface Props extends LabelProps {
5
5
  options: string[] | SelectOption[];
6
6
  placeholder?: string;
7
7
  searchable?: boolean;
@@ -20,6 +20,6 @@ interface SelectProps extends LabelProps {
20
20
  onclear?: () => void;
21
21
  onchange?: (option: SelectOption) => void;
22
22
  }
23
- declare const Select: import("svelte").Component<SelectProps, {}, "value">;
23
+ declare const Select: import("svelte").Component<Props, {}, "value">;
24
24
  type Select = ReturnType<typeof Select>;
25
25
  export default Select;
@@ -1,10 +1,10 @@
1
1
  <script lang="ts">
2
2
  import type { HTMLTextareaAttributes } from 'svelte/elements';
3
3
 
4
- import type { LabelProps } from '../Label/labelState.svelte.js';
5
4
  import Label from '../Label/Label.svelte';
5
+ import type { LabelProps } from '../Label/types.js';
6
6
 
7
- interface TextAreaProps extends Omit<HTMLTextareaAttributes, 'value'>, LabelProps {
7
+ interface Props extends Omit<HTMLTextareaAttributes, 'value'>, LabelProps {
8
8
  value?: string | null;
9
9
  error?: string | string[];
10
10
  description?: string;
@@ -26,7 +26,7 @@
26
26
  infoTooltip,
27
27
  disableValidationColor = false,
28
28
  ...props
29
- }: TextAreaProps = $props();
29
+ }: Props = $props();
30
30
 
31
31
  const componentId = $props.id();
32
32
  const textareaId = id || componentId;
@@ -1,6 +1,6 @@
1
1
  import type { HTMLTextareaAttributes } from 'svelte/elements';
2
- import type { LabelProps } from '../Label/labelState.svelte.js';
3
- interface TextAreaProps extends Omit<HTMLTextareaAttributes, 'value'>, LabelProps {
2
+ import type { LabelProps } from '../Label/types.js';
3
+ interface Props extends Omit<HTMLTextareaAttributes, 'value'>, LabelProps {
4
4
  value?: string | null;
5
5
  error?: string | string[];
6
6
  description?: string;
@@ -8,6 +8,6 @@ interface TextAreaProps extends Omit<HTMLTextareaAttributes, 'value'>, LabelProp
8
8
  resize?: boolean;
9
9
  disableValidationColor?: boolean;
10
10
  }
11
- declare const TextArea: import("svelte").Component<TextAreaProps, {}, "value">;
11
+ declare const TextArea: import("svelte").Component<Props, {}, "value">;
12
12
  type TextArea = ReturnType<typeof TextArea>;
13
13
  export default TextArea;
@@ -1,8 +1,8 @@
1
1
  <script lang="ts">
2
2
  import Label from '../Label/Label.svelte';
3
- import type { LabelProps } from '../Label/labelState.svelte.js';
3
+ import type { LabelProps } from '../Label/types.js';
4
4
 
5
- interface ToggleProps extends Pick<LabelProps, 'id' | 'label' | 'infoTooltip'> {
5
+ interface Props extends Pick<LabelProps, 'id' | 'label' | 'infoTooltip'> {
6
6
  checked?: boolean;
7
7
  disabled?: boolean;
8
8
  vertical?: boolean;
@@ -17,7 +17,7 @@
17
17
  infoTooltip,
18
18
  vertical,
19
19
  onchange
20
- }: ToggleProps = $props();
20
+ }: Props = $props();
21
21
  </script>
22
22
 
23
23
  <div class="container" class:vertical>
@@ -1,10 +1,10 @@
1
- import type { LabelProps } from '../Label/labelState.svelte.js';
2
- interface ToggleProps extends Pick<LabelProps, 'id' | 'label' | 'infoTooltip'> {
1
+ import type { LabelProps } from '../Label/types.js';
2
+ interface Props extends Pick<LabelProps, 'id' | 'label' | 'infoTooltip'> {
3
3
  checked?: boolean;
4
4
  disabled?: boolean;
5
5
  vertical?: boolean;
6
6
  onchange?: (event: Event) => void;
7
7
  }
8
- declare const Toggle: import("svelte").Component<ToggleProps, {}, "checked">;
8
+ declare const Toggle: import("svelte").Component<Props, {}, "checked">;
9
9
  type Toggle = ReturnType<typeof Toggle>;
10
10
  export default Toggle;
@@ -1,13 +1,12 @@
1
1
  <script lang="ts">
2
2
  import { Button, Input, Modal, Spinner, addToast } from '../index.js';
3
3
 
4
- interface DeleteConfirmationProps {
4
+ interface Props {
5
5
  confirmationName?: string;
6
6
  enableDoubleConfirmation?: boolean;
7
7
  showModal?: boolean;
8
- ondelete: () => Promise<boolean> | boolean;
8
+ ondelete: () => Promise<string | void> | string | void;
9
9
  onclose?: VoidFunction;
10
- ondeleteSuccess?: () => Promise<void> | void;
11
10
  }
12
11
 
13
12
  let {
@@ -15,9 +14,8 @@
15
14
  enableDoubleConfirmation = false,
16
15
  showModal = $bindable(false),
17
16
  ondelete,
18
- onclose,
19
- ondeleteSuccess
20
- }: DeleteConfirmationProps = $props();
17
+ onclose
18
+ }: Props = $props();
21
19
 
22
20
  let confirmationText = $derived(
23
21
  `Are you sure you want to delete ${confirmationName || 'this item'}?`
@@ -29,13 +27,11 @@
29
27
  const handleDelete = async () => {
30
28
  isLoading = true;
31
29
 
32
- const isSuccessful = await ondelete();
33
-
34
- if (isSuccessful) {
35
- await ondeleteSuccess?.();
30
+ const error = await ondelete();
31
+ if (error === undefined) {
36
32
  showModal = false;
37
33
  } else {
38
- addToast({ message: 'There was an unexpected error.', type: 'danger' });
34
+ addToast({ message: error, type: 'danger' });
39
35
  }
40
36
 
41
37
  isLoading = false;
@@ -1,11 +1,10 @@
1
- interface DeleteConfirmationProps {
1
+ interface Props {
2
2
  confirmationName?: string;
3
3
  enableDoubleConfirmation?: boolean;
4
4
  showModal?: boolean;
5
- ondelete: () => Promise<boolean> | boolean;
5
+ ondelete: () => Promise<string | void> | string | void;
6
6
  onclose?: VoidFunction;
7
- ondeleteSuccess?: () => Promise<void> | void;
8
7
  }
9
- declare const DeleteConfirmation: import("svelte").Component<DeleteConfirmationProps, {}, "showModal">;
8
+ declare const DeleteConfirmation: import("svelte").Component<Props, {}, "showModal">;
10
9
  type DeleteConfirmation = ReturnType<typeof DeleteConfirmation>;
11
10
  export default DeleteConfirmation;
@@ -5,12 +5,12 @@
5
5
  import FeedbackIcon from '../assets/icons/feedback.svg';
6
6
  import { Button } from '../index.js';
7
7
 
8
- interface ErrorPageProps {
8
+ interface Props {
9
9
  status: number;
10
10
  title?: string;
11
11
  }
12
12
 
13
- let { status, title }: ErrorPageProps = $props();
13
+ let { status, title }: Props = $props();
14
14
 
15
15
  const errorTitle: Record<number, string> = {
16
16
  [404]: 'Page not found',