@softwareone/spi-sv5-library 1.2.0 → 1.3.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.
@@ -2,31 +2,29 @@
2
2
  import type { Snippet } from 'svelte';
3
3
 
4
4
  interface CardProps {
5
- type?: 'layout' | 'highlight';
6
5
  children?: Snippet;
6
+ disablePadding?: boolean;
7
7
  }
8
8
 
9
- let { type = 'layout', children }: CardProps = $props();
9
+ let { children, disablePadding = false }: CardProps = $props();
10
10
  </script>
11
11
 
12
- <div class="card card-{type}">
12
+ <div class="card" class:padding={!disablePadding}>
13
13
  {@render children?.()}
14
14
  </div>
15
15
 
16
16
  <style>
17
17
  .card {
18
18
  width: 100%;
19
- min-height: var(--card-min-height, auto);
20
19
  background: #fff;
21
20
  margin-bottom: 24px;
22
- padding: 24px;
23
21
  border-radius: 16px;
24
22
  box-shadow:
25
23
  0px 1px 16px rgba(107, 113, 128, 0.1),
26
24
  0px 1px 3px rgba(107, 113, 128, 0.2);
27
25
  }
28
26
 
29
- .card-layout {
30
- --card-min-height: 100vh;
27
+ .padding {
28
+ padding: 24px;
31
29
  }
32
30
  </style>
@@ -1,7 +1,7 @@
1
1
  import type { Snippet } from 'svelte';
2
2
  interface CardProps {
3
- type?: 'layout' | 'highlight';
4
3
  children?: Snippet;
4
+ disablePadding?: boolean;
5
5
  }
6
6
  declare const Card: import("svelte").Component<CardProps, {}, "">;
7
7
  type Card = ReturnType<typeof Card>;
@@ -14,6 +14,7 @@
14
14
  description?: string;
15
15
  currency?: string;
16
16
  disableValidationColor?: boolean;
17
+ infoTooltip?: string;
17
18
  }
18
19
 
19
20
  let {
@@ -30,6 +31,7 @@
30
31
  readonly,
31
32
  oninput,
32
33
  disableValidationColor = false,
34
+ infoTooltip,
33
35
  ...props
34
36
  }: InputProps = $props();
35
37
 
@@ -51,7 +53,7 @@
51
53
  </script>
52
54
 
53
55
  <div class="form-container">
54
- <Label {label} {id} {optional} {required} />
56
+ <Label {label} {id} {optional} {required} {infoTooltip} />
55
57
  <div
56
58
  class={[
57
59
  'form-input-wrapper',
@@ -9,6 +9,7 @@ interface InputProps extends Omit<HTMLInputAttributes, 'type' | 'value'> {
9
9
  description?: string;
10
10
  currency?: string;
11
11
  disableValidationColor?: boolean;
12
+ infoTooltip?: string;
12
13
  }
13
14
  declare const Input: import("svelte").Component<InputProps, {}, "value">;
14
15
  type Input = ReturnType<typeof Input>;
@@ -1,12 +1,15 @@
1
1
  <script lang="ts">
2
+ import { Tooltip } from '../index.js';
3
+
2
4
  interface LabelProps {
3
5
  label?: string;
4
6
  id?: string | null;
5
7
  required?: boolean | null;
6
8
  optional?: boolean;
9
+ infoTooltip?: string;
7
10
  }
8
11
 
9
- let { label, id, required, optional }: LabelProps = $props();
12
+ let { label, id, required, optional, infoTooltip }: LabelProps = $props();
10
13
  </script>
11
14
 
12
15
  {#if label}
@@ -17,6 +20,13 @@
17
20
  {:else if optional}
18
21
  <span class="form-label-optional">Optional</span>
19
22
  {/if}
23
+ {#if infoTooltip}
24
+ <Tooltip content={infoTooltip} width="sm">
25
+ {#snippet children()}
26
+ <span class="material-icons-outlined">info</span>
27
+ {/snippet}
28
+ </Tooltip>
29
+ {/if}
20
30
  </div>
21
31
  {/if}
22
32
 
@@ -34,4 +44,9 @@
34
44
  .form-label-required {
35
45
  color: #dc2626;
36
46
  }
47
+
48
+ .material-icons-outlined {
49
+ font-size: 14px;
50
+ vertical-align: middle;
51
+ }
37
52
  </style>
@@ -3,6 +3,7 @@ interface LabelProps {
3
3
  id?: string | null;
4
4
  required?: boolean | null;
5
5
  optional?: boolean;
6
+ infoTooltip?: string;
6
7
  }
7
8
  declare const Label: import("svelte").Component<LabelProps, {}, "">;
8
9
  type Label = ReturnType<typeof Label>;
@@ -21,6 +21,7 @@
21
21
  error?: string | string[];
22
22
  customSelection?: Snippet<[option: SelectOption]>;
23
23
  customOption?: Snippet<[option: SelectOption]>;
24
+ infoTooltip?: string;
24
25
  }
25
26
 
26
27
  let {
@@ -38,7 +39,8 @@
38
39
  value = $bindable(),
39
40
  error,
40
41
  customSelection,
41
- customOption
42
+ customOption,
43
+ infoTooltip
42
44
  }: SelectProps = $props();
43
45
 
44
46
  let dropdownElement: HTMLElement;
@@ -156,7 +158,7 @@
156
158
 
157
159
  <div class="form-container">
158
160
  {#if label}
159
- <Label {label} {required} {optional} />
161
+ <Label {label} {required} {optional} {infoTooltip} />
160
162
  {/if}
161
163
 
162
164
  <div
@@ -16,6 +16,7 @@ interface SelectProps {
16
16
  error?: string | string[];
17
17
  customSelection?: Snippet<[option: SelectOption]>;
18
18
  customOption?: Snippet<[option: SelectOption]>;
19
+ infoTooltip?: string;
19
20
  }
20
21
  declare const Select: import("svelte").Component<SelectProps, {}, "value">;
21
22
  type Select = ReturnType<typeof Select>;
@@ -10,6 +10,7 @@
10
10
  description?: string;
11
11
  maximumCharactersAllowed?: number;
12
12
  resize?: boolean;
13
+ infoTooltip?: string;
13
14
  }
14
15
 
15
16
  let {
@@ -22,6 +23,7 @@
22
23
  maximumCharactersAllowed,
23
24
  resize = false,
24
25
  id,
26
+ infoTooltip,
25
27
  ...props
26
28
  }: TextAreaProps = $props();
27
29
 
@@ -38,7 +40,7 @@
38
40
  </script>
39
41
 
40
42
  <div class="form-container">
41
- <Label {label} {id} {optional} {required} />
43
+ <Label {label} {id} {optional} {required} {infoTooltip} />
42
44
 
43
45
  <div class={['form-textarea-wrapper', isInvalid && 'error', isValid && 'success']}>
44
46
  <textarea
@@ -87,7 +89,6 @@
87
89
  line-height: 20px;
88
90
  }
89
91
 
90
-
91
92
  .form-message {
92
93
  font-size: 12px;
93
94
  }
@@ -7,6 +7,7 @@ interface TextAreaProps extends Omit<HTMLTextareaAttributes, 'value'> {
7
7
  description?: string;
8
8
  maximumCharactersAllowed?: number;
9
9
  resize?: boolean;
10
+ infoTooltip?: string;
10
11
  }
11
12
  declare const TextArea: import("svelte").Component<TextAreaProps, {}, "value">;
12
13
  type TextArea = ReturnType<typeof TextArea>;
@@ -65,6 +65,10 @@
65
65
  line-height: 20px;
66
66
  }
67
67
 
68
+ h2 {
69
+ font-weight: bold;
70
+ }
71
+
68
72
  .text-description {
69
73
  color: #6b7180;
70
74
  }
@@ -0,0 +1,116 @@
1
+ <script lang="ts">
2
+ import type { HomeItem } from '../index.js';
3
+
4
+ interface HomeProps {
5
+ title: string;
6
+ homeItems: HomeItem[];
7
+ }
8
+
9
+ let { title, homeItems }: HomeProps = $props();
10
+
11
+ const hasSingleItem: boolean = homeItems.length === 1;
12
+ const hasManyItems: boolean = homeItems.length > 1;
13
+ </script>
14
+
15
+ <h1 class={['home-title', hasSingleItem && 'centered']}>
16
+ {title}
17
+ </h1>
18
+
19
+ <section class={['home-container', hasSingleItem && 'centered', hasManyItems && 'grid']}>
20
+ {#each homeItems as homeItem}
21
+ <a href={homeItem.url} class="home-item">
22
+ <span>
23
+ <img src={homeItem.icon} alt={homeItem.text} />
24
+ </span>
25
+ <div>
26
+ <h2>{homeItem.text}</h2>
27
+ <p>{homeItem.detail}</p>
28
+ </div>
29
+ </a>
30
+ {/each}
31
+ </section>
32
+
33
+ <style>
34
+ .home-title {
35
+ padding-bottom: 16px;
36
+ font-size: 18px;
37
+ line-height: 1.55;
38
+ font-weight: 600;
39
+ }
40
+
41
+ .home-title.centered {
42
+ display: flex;
43
+ justify-content: center;
44
+ }
45
+
46
+ .home-container {
47
+ --black-1: #434952;
48
+ --black-2: #273444;
49
+ --white: #fff;
50
+ }
51
+
52
+ .home-container.centered {
53
+ display: flex;
54
+ flex-direction: column;
55
+ align-items: center;
56
+ }
57
+
58
+ .home-container.grid {
59
+ display: grid;
60
+ gap: 24px;
61
+
62
+ @media (width >= 640px) {
63
+ grid-template-columns: repeat(1, minmax(0, 1fr));
64
+ }
65
+
66
+ @media (width >= 1024px) {
67
+ grid-template-columns: repeat(2, minmax(0, 1fr));
68
+ }
69
+
70
+ @media (width >= 1536px) {
71
+ grid-template-columns: repeat(3, minmax(0, 1fr));
72
+ }
73
+ }
74
+
75
+ .home-container > .home-item {
76
+ display: flex;
77
+ max-height: 150px;
78
+ max-width: 770px;
79
+ gap: 16px;
80
+ padding: 12px;
81
+ border-radius: 16px;
82
+ background: var(--black-1);
83
+ transition: background 0.2s ease-in-out;
84
+
85
+ > span {
86
+ display: flex;
87
+ align-items: center;
88
+
89
+ > img {
90
+ width: 40px;
91
+ height: 40px;
92
+ filter: invert(100%);
93
+ }
94
+ }
95
+
96
+ > div {
97
+ color: var(--white);
98
+
99
+ > h2 {
100
+ padding-bottom: 8px;
101
+ font-size: 16px;
102
+ line-height: 1.5;
103
+ font-weight: 600;
104
+ }
105
+
106
+ > p {
107
+ font-size: 14px;
108
+ line-height: 1.42;
109
+ }
110
+ }
111
+ }
112
+
113
+ .home-container > .home-item:hover {
114
+ background: var(--black-2);
115
+ }
116
+ </style>
@@ -0,0 +1,8 @@
1
+ import type { HomeItem } from '../index.js';
2
+ interface HomeProps {
3
+ title: string;
4
+ homeItems: HomeItem[];
5
+ }
6
+ declare const Home: import("svelte").Component<HomeProps, {}, "">;
7
+ type Home = ReturnType<typeof Home>;
8
+ export default Home;
@@ -0,0 +1,4 @@
1
+ import { type MenuItem } from '../index.js';
2
+ export type HomeItem = Omit<MenuItem, 'children'> & {
3
+ detail?: string;
4
+ };
@@ -0,0 +1 @@
1
+ import {} from '../index.js';
@@ -16,70 +16,52 @@
16
16
  footer
17
17
  }: ModalProps = $props();
18
18
 
19
- let dialog = $state<HTMLDialogElement>();
20
-
21
- $effect(() => {
22
- showModal ? dialog?.showModal() : dialog?.close();
23
- });
24
-
25
19
  const onHandleClose = () => {
26
20
  showModal = false;
27
21
  onclose();
28
22
  };
29
23
  </script>
30
24
 
31
- <dialog
32
- bind:this={dialog}
33
- onclose={onHandleClose}
34
- class="modal {width}"
35
- transition:scale={{
36
- duration: 150,
37
- start: 0.95
38
- }}
39
- >
40
- <ModalHeader {title} {errorIcon} onclose={onHandleClose} />
41
- <ModalContent content={children} />
42
- <ModalFooter {footer} onclose={onHandleClose} />
43
- </dialog>
25
+ <div class="modal-container">
26
+ <div
27
+ onclose={onHandleClose}
28
+ class="modal {width}"
29
+ transition:scale={{
30
+ duration: 150,
31
+ start: 0.95
32
+ }}
33
+ >
34
+ <ModalHeader {title} {errorIcon} onclose={onHandleClose} />
35
+ <ModalContent content={children} />
36
+ <ModalFooter {footer} onclose={onHandleClose} />
37
+ </div>
38
+ </div>
44
39
 
45
40
  <style>
46
- dialog {
47
- align-self: center;
41
+ .modal-container {
42
+ display: flex;
43
+ position: fixed;
44
+ top: 0;
45
+ left: 0;
46
+ z-index: 1000;
47
+ width: 100%;
48
+ height: 100%;
49
+ background-color: #e0e5e880;
50
+ }
51
+
52
+ .modal {
53
+ width: var(--modal-width);
54
+ max-height: 90%;
48
55
  border-radius: 16px;
49
56
  background-color: #ffffff;
50
- border: none;
51
57
  margin: auto;
58
+ overflow-y: auto;
52
59
  box-shadow:
53
60
  0px 1px 10px 0px rgba(51, 56, 64, 0.12),
54
61
  0px 2px 4px -1px rgba(51, 56, 64, 0.2),
55
62
  0px 4px 5px 0px rgba(51, 56, 64, 0.14);
56
63
  }
57
64
 
58
- dialog:focus-visible {
59
- outline: none;
60
- }
61
-
62
- dialog::backdrop {
63
- background: #e0e5e880;
64
- }
65
-
66
- dialog::-webkit-scrollbar {
67
- width: 10px;
68
- }
69
-
70
- dialog::-webkit-scrollbar-thumb {
71
- background: #888;
72
- border-radius: 10px;
73
- }
74
-
75
- dialog::-webkit-scrollbar-thumb:hover {
76
- background: #555;
77
- }
78
-
79
- .modal {
80
- width: var(--modal-width);
81
- }
82
-
83
65
  .modal.xs {
84
66
  --modal-width: 500px;
85
67
  }
@@ -96,7 +78,20 @@
96
78
  --modal-width: 1000px;
97
79
  }
98
80
 
99
- :global(html:has(dialog.modal[open])) {
81
+ .modal::-webkit-scrollbar {
82
+ width: 10px;
83
+ }
84
+
85
+ .modal::-webkit-scrollbar-thumb {
86
+ background: #888;
87
+ border-radius: 10px;
88
+ }
89
+
90
+ .modal::-webkit-scrollbar-thumb:hover {
91
+ background: #555;
92
+ }
93
+
94
+ :global(html:has(.modal-container)) {
100
95
  overflow: hidden;
101
96
  }
102
97
  </style>
@@ -59,6 +59,7 @@
59
59
  display: flex;
60
60
  gap: 16px;
61
61
  border-bottom: 1px solid #e0e5e8;
62
+ padding: 0 24px;
62
63
  }
63
64
 
64
65
  .tabs-list button {
@@ -68,6 +69,7 @@
68
69
  position: relative;
69
70
  border: none;
70
71
  font-size: 16px;
72
+ font-weight: 500;
71
73
  }
72
74
 
73
75
  .tabs-list button:hover {
@@ -77,6 +79,7 @@
77
79
 
78
80
  .tabs-list button.active {
79
81
  color: #472aff;
82
+ font-weight: 600;
80
83
  }
81
84
 
82
85
  .tabs-list button::after {
package/dist/index.d.ts CHANGED
@@ -19,6 +19,8 @@ import HeaderLoader from './Header/HeaderLoader.svelte';
19
19
  import HeaderLogo from './Header/HeaderLogo.svelte';
20
20
  import HighlightPanel from './HighlightPanel/HighlightPanel.svelte';
21
21
  import { ColumnType, ImageType, type HighlightPanelColumn } from './HighlightPanel/highlightPanelState.svelte.js';
22
+ import Home from './Home/Home.svelte';
23
+ import type { HomeItem } from './Home/homeState.svelte.js';
22
24
  import Menu from './Menu/Menu.svelte';
23
25
  import Sidebar from './Menu/Sidebar.svelte';
24
26
  import type { MenuItem } from './Menu/SidebarState.svelte';
@@ -35,4 +37,4 @@ import type { Tab } from './Tabs/tabsState.svelte.js';
35
37
  import Toaster from './Toast/Toast.svelte';
36
38
  import { addToast, type Toast } from './Toast/toastState.svelte';
37
39
  import Tooltip from './Tooltip/Tooltip.svelte';
38
- export { Accordion, addBreadcrumbsNameMap, addToast, Avatar, Breadcrumbs, Button, Card, Chips, ChipType, ColumnType, ErrorPage, Footer, Header, HeaderAccount, HeaderLoader, HeaderLogo, HighlightPanel, ImageType, Input, Menu, Modal, Notification, ProgressPage, ProgressWizard, Search, Select, Sidebar, Spinner, Tabs, TextArea, Toaster, Toggle, Tooltip, type BreadcrumbsNameMap, type HighlightPanelColumn, type MenuItem, type ModalProps, type ProgressWizardStep, type SelectOption, type Tab, type Toast };
40
+ export { Accordion, addBreadcrumbsNameMap, addToast, Avatar, Breadcrumbs, Button, Card, Chips, ChipType, ColumnType, ErrorPage, Footer, Header, HeaderAccount, HeaderLoader, HeaderLogo, HighlightPanel, Home, ImageType, Input, Menu, Modal, Notification, ProgressPage, ProgressWizard, Search, Select, Sidebar, Spinner, Tabs, TextArea, Toaster, Toggle, Tooltip, type BreadcrumbsNameMap, type HighlightPanelColumn, type HomeItem, type MenuItem, type ModalProps, type ProgressWizardStep, type SelectOption, type Tab, type Toast };
package/dist/index.js CHANGED
@@ -18,6 +18,7 @@ import HeaderLoader from './Header/HeaderLoader.svelte';
18
18
  import HeaderLogo from './Header/HeaderLogo.svelte';
19
19
  import HighlightPanel from './HighlightPanel/HighlightPanel.svelte';
20
20
  import { ColumnType, ImageType } from './HighlightPanel/highlightPanelState.svelte.js';
21
+ import Home from './Home/Home.svelte';
21
22
  import Menu from './Menu/Menu.svelte';
22
23
  import Sidebar from './Menu/Sidebar.svelte';
23
24
  import Modal from './Modal/Modal.svelte';
@@ -30,4 +31,4 @@ import Tabs from './Tabs/Tabs.svelte';
30
31
  import Toaster from './Toast/Toast.svelte';
31
32
  import { addToast } from './Toast/toastState.svelte';
32
33
  import Tooltip from './Tooltip/Tooltip.svelte';
33
- export { Accordion, addBreadcrumbsNameMap, addToast, Avatar, Breadcrumbs, Button, Card, Chips, ChipType, ColumnType, ErrorPage, Footer, Header, HeaderAccount, HeaderLoader, HeaderLogo, HighlightPanel, ImageType, Input, Menu, Modal, Notification, ProgressPage, ProgressWizard, Search, Select, Sidebar, Spinner, Tabs, TextArea, Toaster, Toggle, Tooltip };
34
+ export { Accordion, addBreadcrumbsNameMap, addToast, Avatar, Breadcrumbs, Button, Card, Chips, ChipType, ColumnType, ErrorPage, Footer, Header, HeaderAccount, HeaderLoader, HeaderLogo, HighlightPanel, Home, ImageType, Input, Menu, Modal, Notification, ProgressPage, ProgressWizard, Search, Select, Sidebar, Spinner, Tabs, TextArea, Toaster, Toggle, Tooltip };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@softwareone/spi-sv5-library",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "Svelte components",
5
5
  "keywords": [
6
6
  "svelte",