spaper 0.2.4 → 0.4.6
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 +30 -1
- package/components/Alert.svelte +8 -6
- package/components/Alert.svelte.d.ts +3 -1
- package/components/Article.svelte +3 -2
- package/components/Article.svelte.d.ts +1 -0
- package/components/Badge.svelte +4 -2
- package/components/Badge.svelte.d.ts +1 -0
- package/components/Breadcrumb.svelte +4 -2
- package/components/Breadcrumb.svelte.d.ts +1 -0
- package/components/Button.svelte +3 -3
- package/components/Card.svelte +4 -2
- package/components/Card.svelte.d.ts +3 -1
- package/components/CloseButton.svelte +23 -0
- package/components/CloseButton.svelte.d.ts +19 -0
- package/components/Collapsible.svelte +2 -2
- package/components/CopyButton.svelte +43 -0
- package/components/CopyButton.svelte.d.ts +24 -0
- package/components/Form/Checkbox.svelte +4 -3
- package/components/Form/Checkbox.svelte.d.ts +1 -0
- package/components/Form/Form.svelte +4 -0
- package/components/Form/Form.svelte.d.ts +20 -0
- package/components/Form/Input.svelte +1 -1
- package/components/Form/Radio.svelte +1 -1
- package/components/Form/Select.svelte +1 -1
- package/components/Form/Slider.svelte +2 -2
- package/components/Form/Switch.svelte +13 -6
- package/components/Form/index.d.ts +2 -1
- package/components/Form/index.js +2 -1
- package/components/Modal/Modal.svelte +7 -15
- package/components/Modal/Modal.svelte.d.ts +1 -0
- package/components/Navbar.svelte +4 -3
- package/components/Pagination/Arrow.svelte +1 -1
- package/components/Pagination/NavigationButton.svelte +1 -1
- package/components/Pagination/Pagination.svelte +2 -2
- package/components/Popover.svelte +4 -3
- package/components/Popover.svelte.d.ts +2 -2
- package/components/Progress.svelte +3 -2
- package/components/Table.svelte +5 -6
- package/components/Tabs/Tab.svelte +3 -2
- package/components/Tabs/Tab.svelte.d.ts +1 -0
- package/components/Tabs/Tabs.svelte +15 -3
- package/components/Toast/Toast.svelte +91 -0
- package/components/Toast/Toast.svelte.d.ts +26 -0
- package/components/Toast/ToastContainer.svelte +37 -0
- package/components/Toast/ToastContainer.svelte.d.ts +18 -0
- package/components/Toast/index.d.ts +32 -0
- package/components/Toast/index.js +37 -0
- package/index.d.ts +5 -2
- package/index.js +5 -2
- package/package.json +13 -10
- package/types.d.ts +4 -0
- package/utils.js +4 -1
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ Browse [documentation and demo here](https://oli8.github.io/spaper/).
|
|
|
14
14
|
Add a link to the CDN into your HTML file:
|
|
15
15
|
|
|
16
16
|
```html
|
|
17
|
-
<link rel="stylesheet" href="https://unpkg.com/papercss@1.8.
|
|
17
|
+
<link rel="stylesheet" href="https://unpkg.com/papercss@1.8.3/dist/paper.min.css">
|
|
18
18
|
```
|
|
19
19
|
|
|
20
20
|
Or use NPM:
|
|
@@ -48,3 +48,32 @@ npm i spaper
|
|
|
48
48
|
<Alert>...</Alert>
|
|
49
49
|
<Button>Click me</Button>
|
|
50
50
|
```
|
|
51
|
+
|
|
52
|
+
<hr />
|
|
53
|
+
|
|
54
|
+
#### Components
|
|
55
|
+
|
|
56
|
+
- Alert
|
|
57
|
+
- Article
|
|
58
|
+
- Badge
|
|
59
|
+
- Breadcrumb
|
|
60
|
+
- Button
|
|
61
|
+
- Card
|
|
62
|
+
- CloseButton
|
|
63
|
+
- Collapsible
|
|
64
|
+
- CopyButton
|
|
65
|
+
- Form
|
|
66
|
+
- Checkbox
|
|
67
|
+
- Input
|
|
68
|
+
- Radio
|
|
69
|
+
- Select
|
|
70
|
+
- Slider
|
|
71
|
+
- Switch
|
|
72
|
+
- Modal
|
|
73
|
+
- Navbar
|
|
74
|
+
- Pagination
|
|
75
|
+
- Popover
|
|
76
|
+
- Progress
|
|
77
|
+
- Table
|
|
78
|
+
- Tabs
|
|
79
|
+
- Toast
|
package/components/Alert.svelte
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
<div
|
|
1
|
+
<div {...$$restProps}
|
|
2
|
+
class={classes}
|
|
2
3
|
class:closed class:dismissible
|
|
3
4
|
role="alert">
|
|
4
5
|
<slot />
|
|
5
6
|
{#if dismissible}
|
|
6
|
-
<
|
|
7
|
+
<CloseButton on:click={close} />
|
|
7
8
|
{/if}
|
|
8
9
|
</div>
|
|
9
10
|
|
|
10
|
-
<script
|
|
11
|
+
<script >var _a;
|
|
12
|
+
;
|
|
13
|
+
import CloseButton from './CloseButton.svelte';
|
|
11
14
|
import { computeClasses } from '../utils';
|
|
12
15
|
export let type = 'primary';
|
|
13
16
|
export let dismissible = false;
|
|
@@ -15,11 +18,10 @@ let closed = false;
|
|
|
15
18
|
function close() {
|
|
16
19
|
closed = true;
|
|
17
20
|
}
|
|
18
|
-
|
|
19
|
-
$: classes = `alert ${computeClasses('alert', { type })}`;
|
|
21
|
+
$: classes = `${(_a = $$restProps.class) !== null && _a !== void 0 ? _a : ''} alert ${computeClasses('alert', { type })}`;
|
|
20
22
|
</script>
|
|
21
23
|
|
|
22
|
-
<style
|
|
24
|
+
<style >.alert {
|
|
23
25
|
transition: all 0.25s ease-out;
|
|
24
26
|
}
|
|
25
27
|
.alert.closed {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
<article
|
|
1
|
+
<article {...$$restProps}
|
|
2
|
+
class="{$$restProps.class ?? ''} article padding-small"
|
|
2
3
|
class:border>
|
|
3
4
|
<h1 class="article-title">
|
|
4
5
|
{#if $$slots.title}
|
|
@@ -31,7 +32,7 @@
|
|
|
31
32
|
{/if}
|
|
32
33
|
</article>
|
|
33
34
|
|
|
34
|
-
<script
|
|
35
|
+
<script >export let title = '';
|
|
35
36
|
export let meta = '';
|
|
36
37
|
export let textLead = '';
|
|
37
38
|
export let border = false;
|
package/components/Badge.svelte
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
<span
|
|
1
|
+
<span {...$$restProps}
|
|
2
|
+
class="{$$restProps.class ?? ''} badge {type}"
|
|
3
|
+
class:rounded>
|
|
2
4
|
<slot />
|
|
3
5
|
</span>
|
|
4
6
|
|
|
5
|
-
<script
|
|
7
|
+
<script >;
|
|
6
8
|
export let type = 'primary';
|
|
7
9
|
export let rounded = false;
|
|
8
10
|
</script>
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
<ul
|
|
1
|
+
<ul {...$$restProps}
|
|
2
|
+
class="{$$restProps.class ?? ''} breadcrumb"
|
|
3
|
+
class:border>
|
|
2
4
|
{#each items as { text, href }}
|
|
3
5
|
<li>
|
|
4
6
|
{#if href}
|
|
@@ -10,6 +12,6 @@
|
|
|
10
12
|
{/each}
|
|
11
13
|
</ul>
|
|
12
14
|
|
|
13
|
-
<script
|
|
15
|
+
<script >export let border = false;
|
|
14
16
|
export let items = [];
|
|
15
17
|
</script>
|
package/components/Button.svelte
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<a {...attr}
|
|
3
3
|
class:disabled
|
|
4
4
|
role="button"
|
|
5
|
-
{href}
|
|
5
|
+
href={href ?? 'javascript:void(0);'}
|
|
6
6
|
target={external ? '_blank' : '_self'}
|
|
7
7
|
on:click>
|
|
8
8
|
<slot />
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
</button>
|
|
17
17
|
{/if}
|
|
18
18
|
|
|
19
|
-
<script
|
|
19
|
+
<script >var _a;
|
|
20
20
|
;
|
|
21
21
|
import { computeClasses, getDomAttributes } from '../utils';
|
|
22
22
|
export let type = null;
|
|
@@ -25,7 +25,7 @@ export let block = false;
|
|
|
25
25
|
export let disabled = false;
|
|
26
26
|
export let outline = null;
|
|
27
27
|
export let isLink = false;
|
|
28
|
-
export let href =
|
|
28
|
+
export let href = null;
|
|
29
29
|
export let external = false;
|
|
30
30
|
let attr;
|
|
31
31
|
$: {
|
package/components/Card.svelte
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
<div
|
|
1
|
+
<div {...$$restProps}
|
|
2
|
+
class="{$$restProps.class ?? ''} card"
|
|
2
3
|
style={`width: ${width}`}>
|
|
3
4
|
{#if header || $$slots.header}
|
|
4
5
|
<header class="card-header">
|
|
@@ -57,7 +58,8 @@
|
|
|
57
58
|
{/if}
|
|
58
59
|
</div>
|
|
59
60
|
|
|
60
|
-
<script
|
|
61
|
+
<script >;
|
|
62
|
+
export let title = '';
|
|
61
63
|
export let subTitle = '';
|
|
62
64
|
export let image = '';
|
|
63
65
|
export let imageAlt = '';
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { PositionY } from "../types";
|
|
2
3
|
declare const __propDef: {
|
|
3
4
|
props: {
|
|
5
|
+
[x: string]: any;
|
|
4
6
|
title?: string;
|
|
5
7
|
subTitle?: string;
|
|
6
8
|
image?: string;
|
|
7
9
|
imageAlt?: string;
|
|
8
|
-
imagePlacement?:
|
|
10
|
+
imagePlacement?: PositionY;
|
|
9
11
|
header?: string;
|
|
10
12
|
footer?: string;
|
|
11
13
|
width?: string;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<button {...$$restProps}
|
|
2
|
+
class="{$$restProps.class ?? ''} btn-close"
|
|
3
|
+
aria-label={ariaLabel}
|
|
4
|
+
on:click>
|
|
5
|
+
X
|
|
6
|
+
</button>
|
|
7
|
+
|
|
8
|
+
<script >export let ariaLabel = 'close';
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<style >button {
|
|
12
|
+
float: right;
|
|
13
|
+
border: 0;
|
|
14
|
+
padding: 0;
|
|
15
|
+
background: none;
|
|
16
|
+
box-shadow: none;
|
|
17
|
+
transform: none;
|
|
18
|
+
}
|
|
19
|
+
button:hover, button:focus {
|
|
20
|
+
transform: none;
|
|
21
|
+
box-shadow: none;
|
|
22
|
+
border: 0;
|
|
23
|
+
}</style>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
ariaLabel?: string;
|
|
6
|
+
};
|
|
7
|
+
events: {
|
|
8
|
+
click: MouseEvent;
|
|
9
|
+
} & {
|
|
10
|
+
[evt: string]: CustomEvent<any>;
|
|
11
|
+
};
|
|
12
|
+
slots: {};
|
|
13
|
+
};
|
|
14
|
+
export declare type CloseButtonProps = typeof __propDef.props;
|
|
15
|
+
export declare type CloseButtonEvents = typeof __propDef.events;
|
|
16
|
+
export declare type CloseButtonSlots = typeof __propDef.slots;
|
|
17
|
+
export default class CloseButton extends SvelteComponentTyped<CloseButtonProps, CloseButtonEvents, CloseButtonSlots> {
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
</div>
|
|
15
15
|
</section>
|
|
16
16
|
|
|
17
|
-
<script
|
|
17
|
+
<script context="module">let count = 0;
|
|
18
18
|
</script>
|
|
19
19
|
|
|
20
|
-
<script
|
|
20
|
+
<script >var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
21
21
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
22
22
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
23
23
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<Button {...$$restProps}
|
|
2
|
+
aria-label={ariaLabel}
|
|
3
|
+
on:click
|
|
4
|
+
on:click={copy}>
|
|
5
|
+
<slot />
|
|
6
|
+
</Button>
|
|
7
|
+
|
|
8
|
+
<script >var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
9
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
10
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
11
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
12
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
13
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
14
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
import { createEventDispatcher } from 'svelte';
|
|
18
|
+
import Button from './Button.svelte';
|
|
19
|
+
import { success } from './Toast';
|
|
20
|
+
export let text;
|
|
21
|
+
export let successMessage = 'Copied!';
|
|
22
|
+
export let ariaLabel = 'Copy to clipboard';
|
|
23
|
+
const dispatch = createEventDispatcher();
|
|
24
|
+
function copy() {
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
if (!text)
|
|
27
|
+
return;
|
|
28
|
+
try {
|
|
29
|
+
yield navigator.clipboard.writeText(text);
|
|
30
|
+
dispatch('copy', text);
|
|
31
|
+
if (successMessage)
|
|
32
|
+
success({
|
|
33
|
+
message: successMessage,
|
|
34
|
+
position: 'top',
|
|
35
|
+
duration: 1000,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
catch (e) {
|
|
39
|
+
console.error(e);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
</script>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
text: string;
|
|
6
|
+
successMessage?: string;
|
|
7
|
+
ariaLabel?: string;
|
|
8
|
+
};
|
|
9
|
+
events: {
|
|
10
|
+
click: MouseEvent;
|
|
11
|
+
copy: CustomEvent<any>;
|
|
12
|
+
} & {
|
|
13
|
+
[evt: string]: CustomEvent<any>;
|
|
14
|
+
};
|
|
15
|
+
slots: {
|
|
16
|
+
default: {};
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export declare type CopyButtonProps = typeof __propDef.props;
|
|
20
|
+
export declare type CopyButtonEvents = typeof __propDef.events;
|
|
21
|
+
export declare type CopyButtonSlots = typeof __propDef.slots;
|
|
22
|
+
export default class CopyButton extends SvelteComponentTyped<CopyButtonProps, CopyButtonEvents, CopyButtonSlots> {
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
<label
|
|
1
|
+
<label {...$$restProps}
|
|
2
|
+
class="{$$restProps.class ?? ''} paper-check">
|
|
2
3
|
<input type="checkbox"
|
|
3
4
|
{value} {name}
|
|
4
5
|
{disabled}
|
|
@@ -9,7 +10,7 @@
|
|
|
9
10
|
<span>{label}</span>
|
|
10
11
|
</label>
|
|
11
12
|
|
|
12
|
-
<script
|
|
13
|
+
<script >import { createEventDispatcher } from 'svelte';
|
|
13
14
|
export let label = '';
|
|
14
15
|
export let value = '';
|
|
15
16
|
export let name = '';
|
|
@@ -30,7 +31,7 @@ function onChange({ target }) {
|
|
|
30
31
|
}
|
|
31
32
|
</script>
|
|
32
33
|
|
|
33
|
-
<style
|
|
34
|
+
<style >input[disabled] + span::before, input[disabled] ~ span {
|
|
34
35
|
opacity: 0.5;
|
|
35
36
|
cursor: not-allowed;
|
|
36
37
|
}</style>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} FormProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} FormEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} FormSlots */
|
|
4
|
+
export default class Form {
|
|
5
|
+
}
|
|
6
|
+
export type FormProps = typeof __propDef.props;
|
|
7
|
+
export type FormEvents = typeof __propDef.events;
|
|
8
|
+
export type FormSlots = typeof __propDef.slots;
|
|
9
|
+
declare const __propDef: {
|
|
10
|
+
props: {
|
|
11
|
+
[x: string]: any;
|
|
12
|
+
};
|
|
13
|
+
events: {
|
|
14
|
+
[evt: string]: CustomEvent<any>;
|
|
15
|
+
};
|
|
16
|
+
slots: {
|
|
17
|
+
default: {};
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export {};
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
{/if}
|
|
25
25
|
</label>
|
|
26
26
|
|
|
27
|
-
<script
|
|
27
|
+
<script >import { onMount } from 'svelte';
|
|
28
28
|
;
|
|
29
29
|
import { computeClasses } from '../../utils';
|
|
30
30
|
export let label = '';
|
|
@@ -52,7 +52,7 @@ $: if (percentage) {
|
|
|
52
52
|
}
|
|
53
53
|
</script>
|
|
54
54
|
|
|
55
|
-
<style
|
|
55
|
+
<style >label.block {
|
|
56
56
|
width: 100%;
|
|
57
57
|
}
|
|
58
58
|
label.disabled {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
{#if tile}
|
|
2
|
-
<label
|
|
2
|
+
<label {...$$restProps}
|
|
3
|
+
class="{$$restProps.class ?? ''} paper-switch-tile"
|
|
3
4
|
class:disabled>
|
|
4
5
|
<input bind:checked
|
|
5
6
|
type="checkbox"
|
|
6
|
-
{disabled}
|
|
7
|
+
{disabled}
|
|
8
|
+
on:change={onChange} />
|
|
7
9
|
<div class="paper-switch-tile-card border">
|
|
8
10
|
<div class={`paper-switch-tile-card-front border
|
|
9
11
|
${bgClass(tile.off.background)}`}>
|
|
@@ -20,7 +22,8 @@
|
|
|
20
22
|
<input id={domId}
|
|
21
23
|
bind:checked
|
|
22
24
|
type="checkbox"
|
|
23
|
-
{disabled}
|
|
25
|
+
{disabled}
|
|
26
|
+
on:change={onChange} />
|
|
24
27
|
<span class="paper-switch-slider"
|
|
25
28
|
class:round></span>
|
|
26
29
|
</label>
|
|
@@ -32,16 +35,17 @@
|
|
|
32
35
|
{/if}
|
|
33
36
|
{/if}
|
|
34
37
|
|
|
35
|
-
<script
|
|
38
|
+
<script context="module">let count = 0;
|
|
36
39
|
</script>
|
|
37
40
|
|
|
38
|
-
<script
|
|
41
|
+
<script >import { onMount, createEventDispatcher } from "svelte";
|
|
39
42
|
;
|
|
40
43
|
export let checked = false;
|
|
41
44
|
export let disabled = false;
|
|
42
45
|
export let round = false;
|
|
43
46
|
export let inline = false;
|
|
44
47
|
export let tile = null;
|
|
48
|
+
const dispatch = createEventDispatcher();
|
|
45
49
|
let id;
|
|
46
50
|
onMount(() => {
|
|
47
51
|
id = count++;
|
|
@@ -50,6 +54,9 @@ let domId;
|
|
|
50
54
|
$: domId = `paper-switch-input-${id}`;
|
|
51
55
|
let prefix;
|
|
52
56
|
$: prefix = 'paper-switch' + (inline ? '-2' : '');
|
|
57
|
+
function onChange() {
|
|
58
|
+
dispatch('change', checked);
|
|
59
|
+
}
|
|
53
60
|
function bgClass(color) {
|
|
54
61
|
if (!color)
|
|
55
62
|
return;
|
|
@@ -57,7 +64,7 @@ function bgClass(color) {
|
|
|
57
64
|
}
|
|
58
65
|
</script>
|
|
59
66
|
|
|
60
|
-
<style
|
|
67
|
+
<style >input[disabled] + span,
|
|
61
68
|
.paper-switch-tile.disabled {
|
|
62
69
|
opacity: 0.5;
|
|
63
70
|
cursor: not-allowed;
|
|
@@ -4,5 +4,6 @@ import Radio from './Radio.svelte';
|
|
|
4
4
|
import Checkbox from './Checkbox.svelte';
|
|
5
5
|
import Switch from './Switch.svelte';
|
|
6
6
|
import Slider from './Slider.svelte';
|
|
7
|
+
import Form from './Form.svelte';
|
|
7
8
|
export declare type InputType = 'text' | 'email' | 'number' | 'password' | 'search' | 'tel' | 'url' | 'time' | 'date' | 'month' | 'week' | 'datetime-local' | 'color' | 'textarea';
|
|
8
|
-
export { Input, Select, Radio, Checkbox, Switch, Slider, };
|
|
9
|
+
export { Input, Select, Radio, Checkbox, Switch, Slider, Form, };
|
package/components/Form/index.js
CHANGED
|
@@ -4,4 +4,5 @@ import Radio from './Radio.svelte';
|
|
|
4
4
|
import Checkbox from './Checkbox.svelte';
|
|
5
5
|
import Switch from './Switch.svelte';
|
|
6
6
|
import Slider from './Slider.svelte';
|
|
7
|
-
|
|
7
|
+
import Form from './Form.svelte';
|
|
8
|
+
export { Input, Select, Radio, Checkbox, Switch, Slider, Form, };
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
<svelte:window on:keydown={handleKeydown} />
|
|
2
2
|
|
|
3
|
-
<div
|
|
3
|
+
<div {...$$restProps}
|
|
4
|
+
class="{$$restProps.class ?? ''} modal"
|
|
5
|
+
class:active>
|
|
4
6
|
<div class="modal-body">
|
|
5
|
-
<
|
|
6
|
-
on:click={close}>
|
|
7
|
-
X
|
|
8
|
-
</button>
|
|
7
|
+
<CloseButton on:click={close} />
|
|
9
8
|
{#if title}
|
|
10
9
|
<h4 class="modal-title">{title}</h4>
|
|
11
10
|
{/if}
|
|
@@ -26,7 +25,8 @@
|
|
|
26
25
|
</div>
|
|
27
26
|
</div>
|
|
28
27
|
|
|
29
|
-
<script
|
|
28
|
+
<script >import Button from '../Button.svelte';
|
|
29
|
+
import CloseButton from '../CloseButton.svelte';
|
|
30
30
|
export let active = false;
|
|
31
31
|
export let title = '';
|
|
32
32
|
export let subTitle = '';
|
|
@@ -40,15 +40,7 @@ function handleKeydown({ key }) {
|
|
|
40
40
|
}
|
|
41
41
|
</script>
|
|
42
42
|
|
|
43
|
-
<style
|
|
44
|
-
border: 0;
|
|
45
|
-
}
|
|
46
|
-
.btn-close:hover {
|
|
47
|
-
box-shadow: none;
|
|
48
|
-
transform: none;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
.modal.active {
|
|
43
|
+
<style >.modal.active {
|
|
52
44
|
opacity: 1;
|
|
53
45
|
visibility: visible;
|
|
54
46
|
}
|
package/components/Navbar.svelte
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
<nav
|
|
1
|
+
<nav {...$$restProps}
|
|
2
|
+
class={`${$$restProps.class ?? ''} paper-navbar`}
|
|
2
3
|
class:border class:fixed
|
|
3
4
|
class:split-nav={split}>
|
|
4
5
|
{#if $$slots.brand}
|
|
@@ -14,7 +15,7 @@
|
|
|
14
15
|
</div>
|
|
15
16
|
</nav>
|
|
16
17
|
|
|
17
|
-
<script
|
|
18
|
+
<script >export let border = true;
|
|
18
19
|
export let fixed = false;
|
|
19
20
|
export let split = true;
|
|
20
21
|
let open = false;
|
|
@@ -23,7 +24,7 @@ function collapse() {
|
|
|
23
24
|
}
|
|
24
25
|
</script>
|
|
25
26
|
|
|
26
|
-
<style
|
|
27
|
+
<style >/* Papercss removes border of buttons in .collapsible */
|
|
27
28
|
.collapsible > button {
|
|
28
29
|
border: 2px solid var(--primary);
|
|
29
30
|
}
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
{/if}
|
|
52
52
|
</section>
|
|
53
53
|
|
|
54
|
-
<script
|
|
54
|
+
<script >import { createEventDispatcher } from 'svelte';
|
|
55
55
|
import Button from '../Button.svelte';
|
|
56
56
|
import Input from '../Form/Input.svelte';
|
|
57
57
|
;
|
|
@@ -105,7 +105,7 @@ function changePage(val) {
|
|
|
105
105
|
}
|
|
106
106
|
</script>
|
|
107
107
|
|
|
108
|
-
<style
|
|
108
|
+
<style >ul, li {
|
|
109
109
|
display: inline;
|
|
110
110
|
}
|
|
111
111
|
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
<div {
|
|
1
|
+
<div {...$$restProps}
|
|
2
|
+
{ ...{[`popover-${position}`]: label} }
|
|
2
3
|
class={`${$$restProps.class} ${bgClass(background)}`}
|
|
3
4
|
class:inline
|
|
4
5
|
class:active={always || active}>
|
|
5
6
|
<slot />
|
|
6
7
|
</div>
|
|
7
8
|
|
|
8
|
-
<script
|
|
9
|
+
<script >;
|
|
9
10
|
export let label = '';
|
|
10
11
|
export let position = 'top';
|
|
11
12
|
export let inline = true;
|
|
@@ -17,7 +18,7 @@ function bgClass(color) {
|
|
|
17
18
|
}
|
|
18
19
|
</script>
|
|
19
20
|
|
|
20
|
-
<style
|
|
21
|
+
<style >.inline {
|
|
21
22
|
display: inline;
|
|
22
23
|
}
|
|
23
24
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import type { PaperType } from "../types";
|
|
2
|
+
import type { PaperType, Position } from "../types";
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
5
|
[x: string]: any;
|
|
6
6
|
label?: string;
|
|
7
|
-
position?:
|
|
7
|
+
position?: Position;
|
|
8
8
|
inline?: boolean;
|
|
9
9
|
background?: PaperType;
|
|
10
10
|
active?: boolean;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
<div
|
|
1
|
+
<div {...$$restProps}
|
|
2
|
+
class={`progress ${$$restProps.class ?? ''}`}
|
|
2
3
|
class:margin-bottom={marginBottom}>
|
|
3
4
|
<div class={`bar ${type} w-${cappedValue}`}
|
|
4
5
|
class:striped class:infinite>
|
|
@@ -10,7 +11,7 @@
|
|
|
10
11
|
</div>
|
|
11
12
|
</div>
|
|
12
13
|
|
|
13
|
-
<script
|
|
14
|
+
<script >;
|
|
14
15
|
export let value = 50;
|
|
15
16
|
export let type = 'primary';
|
|
16
17
|
export let showValue = false;
|
package/components/Table.svelte
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
<table
|
|
2
|
-
class:table-
|
|
3
|
-
{
|
|
1
|
+
<table {...$$restProps}
|
|
2
|
+
class:table-alternating={striped}
|
|
3
|
+
class:table-hover={hoverable}>
|
|
4
4
|
{#if showHeader}
|
|
5
5
|
<thead>
|
|
6
6
|
<tr>
|
|
@@ -41,8 +41,7 @@
|
|
|
41
41
|
</tbody>
|
|
42
42
|
</table>
|
|
43
43
|
|
|
44
|
-
<script
|
|
45
|
-
let tmpCol;
|
|
44
|
+
<script >let tmpCol;
|
|
46
45
|
export let columns = [];
|
|
47
46
|
export let data = [];
|
|
48
47
|
export let striped = false;
|
|
@@ -63,7 +62,7 @@ function isColumnObj(arg) {
|
|
|
63
62
|
return arg.field;
|
|
64
63
|
}
|
|
65
64
|
function getRowFiltered(row) {
|
|
66
|
-
return Object.entries(
|
|
65
|
+
return Object.entries(row).filter(([key, _val]) => displayedFields.includes(key));
|
|
67
66
|
}
|
|
68
67
|
$: if (!columns.length) {
|
|
69
68
|
columns = Object.keys(data[0] || {});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
<div
|
|
1
|
+
<div {...$$restProps}
|
|
2
|
+
class="{$$restProps.class ?? ''} content margin"
|
|
2
3
|
class:content--active={active}
|
|
3
4
|
aria-hidden={!active}>
|
|
4
5
|
{#if $$slots.header}
|
|
@@ -10,7 +11,7 @@
|
|
|
10
11
|
<slot />
|
|
11
12
|
</div>
|
|
12
13
|
|
|
13
|
-
<script
|
|
14
|
+
<script >import { onMount, getContext } from 'svelte';
|
|
14
15
|
;
|
|
15
16
|
export let label;
|
|
16
17
|
const key = {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
<div
|
|
1
|
+
<div {...$$restProps}
|
|
2
|
+
class={`row flex-${placement} tabs ${$$restProps.class ?? ''}`}
|
|
2
3
|
style={`text-align: ${contentAlign}`}>
|
|
3
4
|
{#each $tabs as { label, header }, index}
|
|
4
5
|
<div class="tabs-label-header"
|
|
@@ -15,7 +16,7 @@
|
|
|
15
16
|
<slot />
|
|
16
17
|
</div>
|
|
17
18
|
|
|
18
|
-
<script
|
|
19
|
+
<script >import { onMount, setContext, createEventDispatcher } from 'svelte';
|
|
19
20
|
import { writable } from 'svelte/store';
|
|
20
21
|
;
|
|
21
22
|
;
|
|
@@ -52,7 +53,7 @@ function updateTabsVisility() {
|
|
|
52
53
|
$: activeTab && updateTabsVisility();
|
|
53
54
|
</script>
|
|
54
55
|
|
|
55
|
-
<style
|
|
56
|
+
<style >.tabs-label-header {
|
|
56
57
|
cursor: pointer;
|
|
57
58
|
color: var(--primary-light);
|
|
58
59
|
display: inline-block;
|
|
@@ -67,4 +68,15 @@ $: activeTab && updateTabsVisility();
|
|
|
67
68
|
.tabs-label-header--active {
|
|
68
69
|
color: var(--primary);
|
|
69
70
|
border-bottom: 3px solid var(--secondary);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
:global(.tabs input) {
|
|
74
|
+
display: block;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
:global(.tabs label) {
|
|
78
|
+
all: inherit;
|
|
79
|
+
}
|
|
80
|
+
:global(.tabs label):hover {
|
|
81
|
+
all: inherit;
|
|
70
82
|
}</style>
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
{#if active}
|
|
2
|
+
<div class={classes}
|
|
3
|
+
bind:this={toastElement}
|
|
4
|
+
on:mouseenter={pause}
|
|
5
|
+
on:mouseleave={dismiss}
|
|
6
|
+
in:fly={{ y: position.includes('top') ? -100 : 100 }}
|
|
7
|
+
out:fade={{ duration: TRANSITION_OUT_DURATION }}
|
|
8
|
+
role="alert">
|
|
9
|
+
{@html message}
|
|
10
|
+
{#if dismissible||indefinite}
|
|
11
|
+
<CloseButton ariaLabel={closeAriaLabel}
|
|
12
|
+
on:click={close} />
|
|
13
|
+
{/if}
|
|
14
|
+
</div>
|
|
15
|
+
{/if}
|
|
16
|
+
|
|
17
|
+
<script >import { onMount } from 'svelte';
|
|
18
|
+
import { fly, fade } from 'svelte/transition';
|
|
19
|
+
;
|
|
20
|
+
;
|
|
21
|
+
import { computeClasses } from '../../utils';
|
|
22
|
+
import ToastContainer, { containerClass } from './ToastContainer.svelte';
|
|
23
|
+
import CloseButton from '../CloseButton.svelte';
|
|
24
|
+
export let message;
|
|
25
|
+
export let type = 'primary';
|
|
26
|
+
export let duration = 2000;
|
|
27
|
+
export let position = 'top-right';
|
|
28
|
+
export let pauseOnHover = false;
|
|
29
|
+
export let dismissible = false;
|
|
30
|
+
export let indefinite = false;
|
|
31
|
+
export let closeAriaLabel = 'close';
|
|
32
|
+
export let onClose = null;
|
|
33
|
+
const TRANSITION_OUT_DURATION = 300;
|
|
34
|
+
let active = true;
|
|
35
|
+
let toastElement;
|
|
36
|
+
let timeoutId;
|
|
37
|
+
$: containerSelector = `.${containerClass}.${position}`;
|
|
38
|
+
$: classes = `alert margin-small shadow ${computeClasses('alert', { type })}`;
|
|
39
|
+
onMount(() => {
|
|
40
|
+
insert();
|
|
41
|
+
if (!indefinite) {
|
|
42
|
+
timeoutId = window.setTimeout(close, duration);
|
|
43
|
+
}
|
|
44
|
+
if (timeoutId) {
|
|
45
|
+
return () => clearTimeout(timeoutId);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
function pause() {
|
|
49
|
+
if (!pauseOnHover || indefinite)
|
|
50
|
+
return;
|
|
51
|
+
clearTimeout(timeoutId);
|
|
52
|
+
}
|
|
53
|
+
function dismiss() {
|
|
54
|
+
if (!pauseOnHover || indefinite)
|
|
55
|
+
return;
|
|
56
|
+
close();
|
|
57
|
+
}
|
|
58
|
+
function close() {
|
|
59
|
+
active = false;
|
|
60
|
+
removeContainer();
|
|
61
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
62
|
+
}
|
|
63
|
+
function getContainer() {
|
|
64
|
+
return document.querySelector(containerSelector);
|
|
65
|
+
}
|
|
66
|
+
function setupContainer() {
|
|
67
|
+
new ToastContainer({
|
|
68
|
+
target: document.body,
|
|
69
|
+
props: { position },
|
|
70
|
+
});
|
|
71
|
+
return getContainer();
|
|
72
|
+
}
|
|
73
|
+
function insert() {
|
|
74
|
+
const container = getContainer() || setupContainer();
|
|
75
|
+
container.insertAdjacentElement('afterbegin', toastElement);
|
|
76
|
+
}
|
|
77
|
+
function removeContainer() {
|
|
78
|
+
const container = getContainer();
|
|
79
|
+
setTimeout(() => {
|
|
80
|
+
if (container.children.length === 1) {
|
|
81
|
+
container.remove();
|
|
82
|
+
}
|
|
83
|
+
}, TRANSITION_OUT_DURATION);
|
|
84
|
+
}
|
|
85
|
+
</script>
|
|
86
|
+
|
|
87
|
+
<style>
|
|
88
|
+
div {
|
|
89
|
+
width: 250px;
|
|
90
|
+
}
|
|
91
|
+
</style>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { PaperType } from '../../types';
|
|
3
|
+
import type { ToastPosition } from './';
|
|
4
|
+
declare const __propDef: {
|
|
5
|
+
props: {
|
|
6
|
+
message: string;
|
|
7
|
+
type?: PaperType;
|
|
8
|
+
duration?: number;
|
|
9
|
+
position?: ToastPosition;
|
|
10
|
+
pauseOnHover?: boolean;
|
|
11
|
+
dismissible?: boolean;
|
|
12
|
+
indefinite?: boolean;
|
|
13
|
+
closeAriaLabel?: string;
|
|
14
|
+
onClose?: Function;
|
|
15
|
+
};
|
|
16
|
+
events: {
|
|
17
|
+
[evt: string]: CustomEvent<any>;
|
|
18
|
+
};
|
|
19
|
+
slots: {};
|
|
20
|
+
};
|
|
21
|
+
export declare type ToastProps = typeof __propDef.props;
|
|
22
|
+
export declare type ToastEvents = typeof __propDef.events;
|
|
23
|
+
export declare type ToastSlots = typeof __propDef.slots;
|
|
24
|
+
export default class Toast extends SvelteComponentTyped<ToastProps, ToastEvents, ToastSlots> {
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<div class="{containerClass} {position}">
|
|
2
|
+
</div>
|
|
3
|
+
|
|
4
|
+
<script context="module">export const containerClass = 'paper-toast-container';
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<script >;
|
|
8
|
+
export let position = 'top-right';
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<style >:global(.paper-toast-container:is(.top, .bottom) > div) {
|
|
12
|
+
align-self: center;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
:global(.paper-toast-container:is([class*=right]) > div) {
|
|
16
|
+
align-self: end;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
div {
|
|
20
|
+
height: 0;
|
|
21
|
+
position: fixed;
|
|
22
|
+
display: flex;
|
|
23
|
+
width: 100%;
|
|
24
|
+
padding: 2em;
|
|
25
|
+
z-index: 9999;
|
|
26
|
+
flex-direction: column;
|
|
27
|
+
}
|
|
28
|
+
div[class*=top] {
|
|
29
|
+
top: 0;
|
|
30
|
+
}
|
|
31
|
+
div[class*=bottom] {
|
|
32
|
+
bottom: 0;
|
|
33
|
+
flex-direction: column-reverse;
|
|
34
|
+
}
|
|
35
|
+
div[class*=left] {
|
|
36
|
+
left: 0;
|
|
37
|
+
}</style>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
export declare const containerClass = "paper-toast-container";
|
|
3
|
+
import type { ToastPosition } from './';
|
|
4
|
+
declare const __propDef: {
|
|
5
|
+
props: {
|
|
6
|
+
position?: ToastPosition;
|
|
7
|
+
};
|
|
8
|
+
events: {
|
|
9
|
+
[evt: string]: CustomEvent<any>;
|
|
10
|
+
};
|
|
11
|
+
slots: {};
|
|
12
|
+
};
|
|
13
|
+
export declare type ToastContainerProps = typeof __propDef.props;
|
|
14
|
+
export declare type ToastContainerEvents = typeof __propDef.events;
|
|
15
|
+
export declare type ToastContainerSlots = typeof __propDef.slots;
|
|
16
|
+
export default class ToastContainer extends SvelteComponentTyped<ToastContainerProps, ToastContainerEvents, ToastContainerSlots> {
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { PaperType, PositionY } from '../../types';
|
|
2
|
+
export declare type ToastPosition = PositionY | 'top-right' | 'bottom-right' | 'bottom-left' | 'top-left';
|
|
3
|
+
interface ToastProps {
|
|
4
|
+
message: string;
|
|
5
|
+
type?: PaperType;
|
|
6
|
+
duration?: number;
|
|
7
|
+
position?: ToastPosition;
|
|
8
|
+
pauseOnHover?: boolean;
|
|
9
|
+
dismissible?: boolean;
|
|
10
|
+
indefinite?: boolean;
|
|
11
|
+
closeAriaLabel?: string;
|
|
12
|
+
onClose?: Function;
|
|
13
|
+
}
|
|
14
|
+
interface ToastMethods {
|
|
15
|
+
open: (props: ToastProps | string) => void;
|
|
16
|
+
info: (options: OpenWithTypeParams | string) => void;
|
|
17
|
+
success: (options: OpenWithTypeParams | string) => void;
|
|
18
|
+
warning: (options: OpenWithTypeParams | string) => void;
|
|
19
|
+
warn: (options: OpenWithTypeParams | string) => void;
|
|
20
|
+
danger: (options: OpenWithTypeParams | string) => void;
|
|
21
|
+
error: (options: OpenWithTypeParams | string) => void;
|
|
22
|
+
}
|
|
23
|
+
declare type OpenWithTypeParams = Omit<ToastProps, 'type'>;
|
|
24
|
+
export declare function open(props: ToastProps | string): void;
|
|
25
|
+
export declare const info: (options: OpenWithTypeParams | string) => void;
|
|
26
|
+
export declare const success: (options: OpenWithTypeParams | string) => void;
|
|
27
|
+
export declare const warning: (options: OpenWithTypeParams | string) => void;
|
|
28
|
+
export declare const warn: (options: OpenWithTypeParams | string) => void;
|
|
29
|
+
export declare const danger: (options: OpenWithTypeParams | string) => void;
|
|
30
|
+
export declare const error: (options: OpenWithTypeParams | string) => void;
|
|
31
|
+
declare const _default: ToastMethods;
|
|
32
|
+
export default _default;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import Toast from './Toast.svelte';
|
|
2
|
+
export function open(props) {
|
|
3
|
+
if (typeof props === 'string')
|
|
4
|
+
props = { message: props };
|
|
5
|
+
new Toast({
|
|
6
|
+
target: document.body,
|
|
7
|
+
props,
|
|
8
|
+
intro: true,
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
function openType(type) {
|
|
12
|
+
return (options) => {
|
|
13
|
+
const props = {
|
|
14
|
+
type,
|
|
15
|
+
message: '',
|
|
16
|
+
};
|
|
17
|
+
if (typeof options === 'string')
|
|
18
|
+
props.message = options;
|
|
19
|
+
else
|
|
20
|
+
Object.assign(props, options);
|
|
21
|
+
new Toast({
|
|
22
|
+
target: document.body,
|
|
23
|
+
props,
|
|
24
|
+
intro: true,
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export const info = openType('secondary');
|
|
29
|
+
export const success = openType('success');
|
|
30
|
+
export const warning = openType('warning');
|
|
31
|
+
export const warn = warning;
|
|
32
|
+
export const danger = openType('danger');
|
|
33
|
+
export const error = danger;
|
|
34
|
+
Object.assign(Toast, {
|
|
35
|
+
open, info, success, warning, warn, error, danger
|
|
36
|
+
});
|
|
37
|
+
export default Toast;
|
package/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import Breadcrumb from './components/Breadcrumb.svelte';
|
|
|
5
5
|
import Navbar from './components/Navbar.svelte';
|
|
6
6
|
import Modal from './components/Modal';
|
|
7
7
|
import { Tabs, Tab } from './components/Tabs';
|
|
8
|
-
import { Input, Select, Radio, Checkbox, Switch, Slider } from './components/Form';
|
|
8
|
+
import { Input, Select, Radio, Checkbox, Switch, Slider, Form } from './components/Form';
|
|
9
9
|
import Article from './components/Article.svelte';
|
|
10
10
|
import Card from './components/Card.svelte';
|
|
11
11
|
import Collapsible from './components/Collapsible.svelte';
|
|
@@ -13,4 +13,7 @@ import Popover from './components/Popover.svelte';
|
|
|
13
13
|
import Progress from './components/Progress.svelte';
|
|
14
14
|
import Table from './components/Table.svelte';
|
|
15
15
|
import Pagination from './components/Pagination';
|
|
16
|
-
|
|
16
|
+
import Toast from './components/Toast';
|
|
17
|
+
import CloseButton from './components/CloseButton.svelte';
|
|
18
|
+
import CopyButton from './components/CopyButton.svelte';
|
|
19
|
+
export { Button, Alert, Badge, Breadcrumb, Navbar, Modal, Tabs, Tab, Form, Input, Select, Radio, Checkbox, Switch, Slider, Article, Card, Collapsible, Popover, Progress, Table, Pagination, Toast, CloseButton, CopyButton, };
|
package/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import Breadcrumb from './components/Breadcrumb.svelte';
|
|
|
5
5
|
import Navbar from './components/Navbar.svelte';
|
|
6
6
|
import Modal from './components/Modal';
|
|
7
7
|
import { Tabs, Tab } from './components/Tabs';
|
|
8
|
-
import { Input, Select, Radio, Checkbox, Switch, Slider } from './components/Form';
|
|
8
|
+
import { Input, Select, Radio, Checkbox, Switch, Slider, Form } from './components/Form';
|
|
9
9
|
import Article from './components/Article.svelte';
|
|
10
10
|
import Card from './components/Card.svelte';
|
|
11
11
|
import Collapsible from './components/Collapsible.svelte';
|
|
@@ -13,4 +13,7 @@ import Popover from './components/Popover.svelte';
|
|
|
13
13
|
import Progress from './components/Progress.svelte';
|
|
14
14
|
import Table from './components/Table.svelte';
|
|
15
15
|
import Pagination from './components/Pagination';
|
|
16
|
-
|
|
16
|
+
import Toast from './components/Toast';
|
|
17
|
+
import CloseButton from './components/CloseButton.svelte';
|
|
18
|
+
import CopyButton from './components/CopyButton.svelte';
|
|
19
|
+
export { Button, Alert, Badge, Breadcrumb, Navbar, Modal, Tabs, Tab, Form, Input, Select, Radio, Checkbox, Switch, Slider, Article, Card, Collapsible, Popover, Progress, Table, Pagination, Toast, CloseButton, CopyButton, };
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"papercss",
|
|
9
9
|
"components"
|
|
10
10
|
],
|
|
11
|
-
"version": "0.
|
|
11
|
+
"version": "0.4.6",
|
|
12
12
|
"repository": {
|
|
13
13
|
"type": "git",
|
|
14
14
|
"url": "git+https://github.com/Oli8/spaper.git"
|
|
@@ -18,13 +18,9 @@
|
|
|
18
18
|
},
|
|
19
19
|
"homepage": "https://github.com/Oli8/spaper#readme",
|
|
20
20
|
"peerDependencies": {
|
|
21
|
-
"papercss": "^1.8.
|
|
21
|
+
"papercss": "^1.8.3"
|
|
22
22
|
},
|
|
23
23
|
"type": "module",
|
|
24
|
-
"dependencies": {
|
|
25
|
-
"lodash.omit": "^4.5.0",
|
|
26
|
-
"lodash.pick": "^4.4.0"
|
|
27
|
-
},
|
|
28
24
|
"exports": {
|
|
29
25
|
"./package.json": "./package.json",
|
|
30
26
|
"./components/Alert.svelte": "./components/Alert.svelte",
|
|
@@ -33,8 +29,11 @@
|
|
|
33
29
|
"./components/Breadcrumb.svelte": "./components/Breadcrumb.svelte",
|
|
34
30
|
"./components/Button.svelte": "./components/Button.svelte",
|
|
35
31
|
"./components/Card.svelte": "./components/Card.svelte",
|
|
32
|
+
"./components/CloseButton.svelte": "./components/CloseButton.svelte",
|
|
36
33
|
"./components/Collapsible.svelte": "./components/Collapsible.svelte",
|
|
34
|
+
"./components/CopyButton.svelte": "./components/CopyButton.svelte",
|
|
37
35
|
"./components/Form/Checkbox.svelte": "./components/Form/Checkbox.svelte",
|
|
36
|
+
"./components/Form/Form.svelte": "./components/Form/Form.svelte",
|
|
38
37
|
"./components/Form/Input.svelte": "./components/Form/Input.svelte",
|
|
39
38
|
"./components/Form/Radio.svelte": "./components/Form/Radio.svelte",
|
|
40
39
|
"./components/Form/Select.svelte": "./components/Form/Select.svelte",
|
|
@@ -48,7 +47,7 @@
|
|
|
48
47
|
"./components/Pagination/Arrow.svelte": "./components/Pagination/Arrow.svelte",
|
|
49
48
|
"./components/Pagination/NavigationButton.svelte": "./components/Pagination/NavigationButton.svelte",
|
|
50
49
|
"./components/Pagination/Pagination.svelte": "./components/Pagination/Pagination.svelte",
|
|
51
|
-
"./components/Pagination/arrow-dimension
|
|
50
|
+
"./components/Pagination/arrow-dimension": "./components/Pagination/arrow-dimension.js",
|
|
52
51
|
"./components/Pagination": "./components/Pagination/index.js",
|
|
53
52
|
"./components/Popover.svelte": "./components/Popover.svelte",
|
|
54
53
|
"./components/Progress.svelte": "./components/Progress.svelte",
|
|
@@ -56,8 +55,12 @@
|
|
|
56
55
|
"./components/Tabs/Tab.svelte": "./components/Tabs/Tab.svelte",
|
|
57
56
|
"./components/Tabs/Tabs.svelte": "./components/Tabs/Tabs.svelte",
|
|
58
57
|
"./components/Tabs": "./components/Tabs/index.js",
|
|
58
|
+
"./components/Toast/Toast.svelte": "./components/Toast/Toast.svelte",
|
|
59
|
+
"./components/Toast/ToastContainer.svelte": "./components/Toast/ToastContainer.svelte",
|
|
60
|
+
"./components/Toast": "./components/Toast/index.js",
|
|
59
61
|
"./components/style.scss": "./components/style.scss",
|
|
60
62
|
".": "./index.js",
|
|
61
|
-
"./utils
|
|
62
|
-
}
|
|
63
|
-
|
|
63
|
+
"./utils": "./utils.js"
|
|
64
|
+
},
|
|
65
|
+
"svelte": "./index.js"
|
|
66
|
+
}
|
package/types.d.ts
CHANGED
|
@@ -7,3 +7,7 @@ export type PaperFlexPlacement = 'spaces' | 'edges' | 'right' | 'center' | 'left
|
|
|
7
7
|
export type PaperAlign = 'left' | 'center' | 'right';
|
|
8
8
|
|
|
9
9
|
export type Attributes = Record<string, string|boolean>;
|
|
10
|
+
|
|
11
|
+
export type PositionY = 'top' | 'bottom';
|
|
12
|
+
export type PositionX = 'left' | 'right';
|
|
13
|
+
export type Position = PositionX | PositionY;
|
package/utils.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import omit from 'lodash.omit';
|
|
2
1
|
const propToClass = {
|
|
3
2
|
size: (pf, val) => `${pf}-${val}`,
|
|
4
3
|
block: (pf, _val) => `${pf}-block`,
|
|
5
4
|
type: (pf, val) => `${pf}-${val}`,
|
|
6
5
|
outline: (pf, val) => `${pf}-${val}-outline`,
|
|
7
6
|
};
|
|
7
|
+
function omit(obj, properties) {
|
|
8
|
+
return Object.fromEntries(Object.entries(obj)
|
|
9
|
+
.filter(([key, _val]) => !properties.includes(key)));
|
|
10
|
+
}
|
|
8
11
|
export function computeClasses(elPrefix, props) {
|
|
9
12
|
return Object.entries(props)
|
|
10
13
|
.filter(([_prop, val]) => val)
|