@softwareone/spi-sv5-library 0.0.1 → 0.0.3

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.
package/README.md CHANGED
@@ -1,58 +1,23 @@
1
- # create-svelte
1
+ # SoftwareOne SPI Component Library for Svelte
2
+ This library provides a set of reusable components to help you build modern web applications with Svelte 5 (Runes) and SvelteKit 2. Each component is designed to be easily customizable and integrate seamlessly with your Svelte projects.
2
3
 
3
- Everything you need to build a Svelte library, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/main/packages/create-svelte).
4
+ ## Installation
4
5
 
5
- Read more about creating a library [in the docs](https://svelte.dev/docs/kit/packaging).
6
-
7
- ## Creating a project
8
-
9
- If you're seeing this, you've probably already done this step. Congrats!
6
+ To install the library, use the following command:
10
7
 
11
8
  ```bash
12
- # create a new project in the current directory
13
- npx sv create
14
-
15
- # create a new project in my-app
16
- npx sv create my-app
9
+ npm install @softwareone/swo-spi-svelte5-library
17
10
  ```
18
11
 
19
- ## Developing
20
-
21
- Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
22
-
23
- ```bash
24
- npm run dev
25
-
26
- # or start the server and open the app in a new browser tab
27
- npm run dev -- --open
28
- ```
29
-
30
- Everything inside `src/lib` is part of your library, everything inside `src/routes` can be used as a showcase or preview app.
31
-
32
- ## Building
33
-
34
- To build your library:
12
+ ## Usage
35
13
 
36
- ```bash
37
- npm run package
38
- ```
39
-
40
- To create a production version of your showcase app:
14
+ Import the components you need into your Svelte application:
41
15
 
42
- ```bash
43
- npm run build
16
+ ```javascript
17
+ import { Button, Modal, Spinner } from '@softwareone/swo-spi-svelte5-library';
44
18
  ```
45
19
 
46
- You can preview the production build with `npm run preview`.
47
-
48
- > To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.
49
-
50
- ## Publishing
51
-
52
- Go into the `package.json` and give your package the desired name through the `"name"` option. Also consider adding a `"license"` field and point it to a `LICENSE` file which you can create from a template (one popular option is the [MIT license](https://opensource.org/license/mit/)).
53
-
54
- To publish your library to [npm](https://www.npmjs.com):
55
-
56
- ```bash
57
- npm publish
58
- ```
20
+ # List of components
21
+ - Button
22
+ - Modal
23
+ - Spinner
@@ -165,5 +165,6 @@
165
165
  background: var(--brand-primary, #e0e5e8);
166
166
  color: var(--brand-white, #6b7180);
167
167
  cursor: not-allowed;
168
+ border: none;
168
169
  }
169
170
  </style>
@@ -3,33 +3,30 @@
3
3
  import ModalFooter from './ModalFooter.svelte';
4
4
  import ModalHeader from './ModalHeader.svelte';
5
5
 
6
- let { headerTitle, contentTitle, contentMessage, contentCodeMessage, cancelButton, okButton } =
7
- $props();
6
+ interface ModalProps {
7
+ headerTitle?: string;
8
+ contentTitle?: string;
9
+ contentMessage?: string;
10
+ contentCodeMessage?: string;
11
+ cancelButton?: () => void;
12
+ okButton?: () => void;
13
+ }
14
+
15
+ let {
16
+ headerTitle,
17
+ contentTitle,
18
+ contentMessage,
19
+ contentCodeMessage,
20
+ cancelButton,
21
+ okButton
22
+ }: ModalProps = $props();
8
23
 
9
- headerTitle = headerTitle || 'Modal title';
10
- contentTitle = contentTitle || 'Error title';
11
- contentMessage =
12
- contentMessage ||
13
- 'The text displayed here serves as a placeholder for the error modal content.';
14
- contentCodeMessage =
15
- contentCodeMessage ||
16
- `Placeholder error code:# Handle specific error: invalid value error_message = f"Error: Invalid value - {ve}" return {'error': error_message, 'error_code': 400}`;
17
- cancelButton =
18
- cancelButton ||
19
- function () {
20
- console.log('cancelButton');
21
- };
22
- okButton =
23
- okButton ||
24
- function () {
25
- console.log('okButton');
26
- };
27
24
  </script>
28
25
 
29
26
  <div class="modal">
30
- <ModalHeader {headerTitle} />
27
+ <ModalHeader {headerTitle}/>
31
28
  <ModalContent {contentTitle} {contentMessage} {contentCodeMessage} />
32
- <ModalFooter {cancelButton} {okButton} />
29
+ <ModalFooter {cancelButton} {okButton}/>
33
30
  </div>
34
31
 
35
32
  <style>
@@ -1,10 +1,11 @@
1
- declare const Modal: import("svelte").Component<{
2
- headerTitle: any;
3
- contentTitle: any;
4
- contentMessage: any;
5
- contentCodeMessage: any;
6
- cancelButton: any;
7
- okButton: any;
8
- }, {}, "">;
1
+ interface ModalProps {
2
+ headerTitle?: string;
3
+ contentTitle?: string;
4
+ contentMessage?: string;
5
+ contentCodeMessage?: string;
6
+ cancelButton?: () => void;
7
+ okButton?: () => void;
8
+ }
9
+ declare const Modal: import("svelte").Component<ModalProps, {}, "">;
9
10
  type Modal = ReturnType<typeof Modal>;
10
11
  export default Modal;
@@ -1,7 +1,13 @@
1
1
  <script lang="ts">
2
2
  import { Copy, Check } from 'lucide-svelte'
3
3
 
4
- let { contentTitle, contentMessage, contentCodeMessage } = $props();
4
+ interface ModalContentProps {
5
+ contentTitle?: string;
6
+ contentMessage?: string;
7
+ contentCodeMessage?: string;
8
+ }
9
+
10
+ let { contentTitle, contentMessage, contentCodeMessage }: ModalContentProps = $props();
5
11
 
6
12
  let copyCodeContent = $state(contentCodeMessage);
7
13
  let copyCodeState = $state(false);
@@ -10,6 +16,14 @@
10
16
  navigator.clipboard.writeText(copyCodeContent);
11
17
  copyCodeState = true;
12
18
  }
19
+
20
+ contentTitle = contentTitle || 'Error title';
21
+ contentMessage =
22
+ contentMessage ||
23
+ 'The text displayed here serves as a placeholder for the error modal content.';
24
+ contentCodeMessage =
25
+ contentCodeMessage ||
26
+ `Placeholder error code:# Handle specific error: invalid value error_message = f"Error: Invalid value - {ve}" return {'error': error_message, 'error_code': 400}`;
13
27
  </script>
14
28
 
15
29
  <div class="modal-content">
@@ -1,7 +1,8 @@
1
- declare const ModalContent: import("svelte").Component<{
2
- contentTitle: any;
3
- contentMessage: any;
4
- contentCodeMessage: any;
5
- }, {}, "">;
1
+ interface ModalContentProps {
2
+ contentTitle?: string;
3
+ contentMessage?: string;
4
+ contentCodeMessage?: string;
5
+ }
6
+ declare const ModalContent: import("svelte").Component<ModalContentProps, {}, "">;
6
7
  type ModalContent = ReturnType<typeof ModalContent>;
7
8
  export default ModalContent;
@@ -1,6 +1,11 @@
1
1
  <script lang="ts">
2
+
3
+ interface ModalFooterProps {
4
+ cancelButton?: () => void;
5
+ okButton?: () => void;
6
+ }
2
7
 
3
- let { cancelButton, okButton } = $props();
8
+ let { cancelButton, okButton }: ModalFooterProps = $props();
4
9
 
5
10
  cancelButton =
6
11
  cancelButton ||
@@ -1,6 +1,7 @@
1
- declare const ModalFooter: import("svelte").Component<{
2
- cancelButton: any;
3
- okButton: any;
4
- }, {}, "">;
1
+ interface ModalFooterProps {
2
+ cancelButton?: () => void;
3
+ okButton?: () => void;
4
+ }
5
+ declare const ModalFooter: import("svelte").Component<ModalFooterProps, {}, "">;
5
6
  type ModalFooter = ReturnType<typeof ModalFooter>;
6
7
  export default ModalFooter;
@@ -1,7 +1,13 @@
1
1
  <script lang="ts">
2
- import { OctagonAlert } from "lucide-svelte";
2
+ import { OctagonAlert } from 'lucide-svelte';
3
3
 
4
- let { headerTitle } = $props();
4
+ interface ModalHeaderProps {
5
+ headerTitle?: string;
6
+ }
7
+
8
+ let { headerTitle }: ModalHeaderProps = $props();
9
+
10
+ headerTitle = headerTitle || 'Modal title';
5
11
 
6
12
  </script>
7
13
 
@@ -1,5 +1,6 @@
1
- declare const ModalHeader: import("svelte").Component<{
2
- headerTitle: any;
3
- }, {}, "">;
1
+ interface ModalHeaderProps {
2
+ headerTitle?: string;
3
+ }
4
+ declare const ModalHeader: import("svelte").Component<ModalHeaderProps, {}, "">;
4
5
  type ModalHeader = ReturnType<typeof ModalHeader>;
5
6
  export default ModalHeader;
@@ -0,0 +1,69 @@
1
+ <script lang="ts">
2
+ interface SpinnerProps {
3
+ size?: 'small' | 'medium' | 'large';
4
+ }
5
+
6
+ let { size }: SpinnerProps = $props();
7
+
8
+ size = size || 'large';
9
+
10
+ const sizes = {
11
+ small: {
12
+ pxsize: '16px',
13
+ svg: `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none">
14
+ <path d="M16 8C16 12.4183 12.4183 16 8 16C3.58172 16 0 12.4183 0 8C0 3.58172 3.58172 0 8 0C12.4183 0 16 3.58172 16 8ZM4.2005 8C4.2005 10.0984 5.90159 11.7995 8 11.7995C10.0984 11.7995 11.7995 10.0984 11.7995 8C11.7995 5.90159 10.0984 4.2005 8 4.2005C5.90159 4.2005 4.2005 5.90159 4.2005 8Z" fill="#E0E5E8"/>
15
+ <path d="M8 13.8998C8 15.0597 8.95609 16.027 10.0763 15.7259C11.4189 15.365 12.6567 14.657 13.6569 13.6569C15.1571 12.1566 16 10.1217 16 8C16 5.87827 15.1571 3.84344 13.6569 2.34315C12.6567 1.34297 11.4189 0.634982 10.0763 0.274108C8.95609 -0.0269669 8 0.940313 8 2.10025C8 3.26019 9.00775 4.15735 9.99495 4.76635C10.244 4.91998 10.4764 5.10307 10.6867 5.31335C11.3992 6.02589 11.7995 6.99231 11.7995 8C11.7995 9.00769 11.3992 9.97411 10.6867 10.6867C10.4764 10.8969 10.244 11.08 9.99495 11.2336C9.00775 11.8427 8 12.7398 8 13.8998Z" fill="#472AFF"/>
16
+ </svg>`
17
+ },
18
+ medium: {
19
+ pxsize: '33px',
20
+ svg: `<svg xmlns="http://www.w3.org/2000/svg" width="33" height="33" viewBox="0 0 33 33" fill="none">
21
+ <path d="M33 16.5C33 25.6127 25.6127 33 16.5 33C7.3873 33 0 25.6127 0 16.5C0 7.3873 7.3873 0 16.5 0C25.6127 0 33 7.3873 33 16.5ZM3.4924 16.5C3.4924 23.6839 9.3161 29.5076 16.5 29.5076C23.6839 29.5076 29.5076 23.6839 29.5076 16.5C29.5076 9.3161 23.6839 3.4924 16.5 3.4924C9.3161 3.4924 3.4924 9.3161 3.4924 16.5Z" fill="#E0E5E8"/>
22
+ <path d="M16.5 31.2538C16.5 32.2182 17.2841 33.0096 18.2431 32.9077C21.9784 32.511 25.4865 30.848 28.1673 28.1673C31.2616 25.0729 33 20.8761 33 16.5C33 12.1239 31.2616 7.92709 28.1673 4.83274C25.4865 2.15202 21.9784 0.488977 18.2431 0.0922724C17.2841 -0.00957781 16.5 0.781801 16.5 1.7462C16.5 2.7106 17.2853 3.48033 18.2411 3.6094C21.048 3.98847 23.6725 5.27693 25.6978 7.30224C28.1372 9.74164 29.5076 13.0502 29.5076 16.5C29.5076 19.9498 28.1372 23.2584 25.6978 25.6978C23.6725 27.7231 21.048 29.0115 18.2411 29.3906C17.2853 29.5197 16.5 30.2894 16.5 31.2538Z" fill="#472AFF"/>
23
+ </svg>`
24
+ },
25
+ large: {
26
+ pxsize: '40px',
27
+ svg: `<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40" fill="none">
28
+ <path d="M40 20C40 31.0457 31.0457 40 20 40C8.9543 40 0 31.0457 0 20C0 8.9543 8.9543 0 20 0C31.0457 0 40 8.9543 40 20ZM6.27298 20C6.27298 27.5812 12.4188 33.727 20 33.727C27.5812 33.727 33.727 27.5812 33.727 20C33.727 12.4188 27.5812 6.27298 20 6.27298C12.4188 6.27298 6.27298 12.4188 6.27298 20Z" fill="#E0E5E8"/>
29
+ <path d="M20 3.13649C20 1.40425 21.4128 -0.0251732 23.1238 0.245376C27.2709 0.901143 31.1358 2.85154 34.1421 5.85786C37.8929 9.60859 40 14.6957 40 20C40 25.3043 37.8929 30.3914 34.1421 34.1421C31.1358 37.1485 27.2709 39.0989 23.1238 39.7546C21.4128 40.0252 20 38.5957 20 36.8635C20 35.1313 21.4222 33.7627 23.1094 33.3703C25.5876 32.7939 27.8783 31.5346 29.7065 29.7065C32.2808 27.1322 33.727 23.6406 33.727 20C33.727 16.3594 32.2808 12.8678 29.7065 10.2935C27.8783 8.46537 25.5876 7.20612 23.1094 6.62973C21.4222 6.23731 20 4.86873 20 3.13649Z" fill="#472AFF"/>
30
+ </svg>`
31
+ }
32
+ };
33
+
34
+ let pxsize = $state(sizes[size].pxsize);
35
+ let svg = $state(sizes[size].svg);
36
+ </script>
37
+
38
+ <div class="spinner-container">
39
+ <div class="spinner" style="width: {pxsize}; height: {pxsize};">
40
+ {@html svg}
41
+ </div>
42
+ </div>
43
+
44
+ <style>
45
+ .spinner-container {
46
+ display: flex;
47
+ justify-content: center;
48
+ align-items: center;
49
+ width: 100vw;
50
+ height: 100vh;
51
+ position: fixed;
52
+ top: 0;
53
+ left: 0;
54
+ background-color: rgba(255, 255, 255, 0.8);
55
+ }
56
+
57
+ .spinner {
58
+ animation: spin 0.8s linear infinite;
59
+ }
60
+
61
+ @keyframes spin {
62
+ from {
63
+ transform: rotate(0deg);
64
+ }
65
+ to {
66
+ transform: rotate(360deg);
67
+ }
68
+ }
69
+ </style>
@@ -0,0 +1,6 @@
1
+ interface SpinnerProps {
2
+ size?: 'small' | 'medium' | 'large';
3
+ }
4
+ declare const Spinner: import("svelte").Component<SpinnerProps, {}, "">;
5
+ type Spinner = ReturnType<typeof Spinner>;
6
+ export default Spinner;
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  import Button from "./Button/Button.svelte";
2
2
  import Modal from "./Modal/Modal.svelte";
3
- export { Button, Modal };
3
+ import Spinner from "./Spinner/Spinner.svelte";
4
+ export { Button, Modal, Spinner };
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  // Reexport your entry components here
2
2
  import Button from "./Button/Button.svelte";
3
3
  import Modal from "./Modal/Modal.svelte";
4
- export { Button, Modal };
4
+ import Spinner from "./Spinner/Spinner.svelte";
5
+ export { Button, Modal, Spinner };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@softwareone/spi-sv5-library",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "Svelte components",
5
5
  "keywords": [
6
6
  "svelte",
@@ -45,6 +45,7 @@
45
45
  },
46
46
  "devDependencies": {
47
47
  "@sveltejs/adapter-auto": "^4.0.0",
48
+ "@sveltejs/adapter-node": "^5.2.12",
48
49
  "@sveltejs/kit": "^2.16.0",
49
50
  "@sveltejs/package": "^2.0.0",
50
51
  "@sveltejs/vite-plugin-svelte": "^5.0.0",