spaper 0.2.6 → 0.5.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 +2 -2
- 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 +5 -3
- package/components/Button.svelte.d.ts +1 -0
- package/components/Card.svelte +3 -2
- package/components/Card.svelte.d.ts +1 -0
- package/components/CloseButton.svelte +2 -2
- 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/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/Modal/Modal.svelte +5 -3
- 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/Progress.svelte +3 -2
- package/components/Table.svelte +5 -6
- package/components/Tabs/Tab.svelte +10 -3
- package/components/Tabs/Tab.svelte.d.ts +1 -0
- package/components/Tabs/Tabs.svelte +11 -4
- package/components/Tabs/index.d.ts +1 -0
- package/components/Tabs/index.js +3 -0
- package/components/Toast/Toast.svelte +1 -1
- package/components/Toast/ToastContainer.svelte +4 -4
- package/components/Toast/index.js +1 -1
- package/index.d.ts +3 -1
- package/index.js +3 -1
- package/package.json +8 -10
- 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:
|
|
@@ -51,6 +51,33 @@ npm i spaper
|
|
|
51
51
|
|
|
52
52
|
<hr />
|
|
53
53
|
|
|
54
|
+
### Sponsors
|
|
55
|
+
|
|
56
|
+
Thanks to these generous people! :heart:
|
|
57
|
+
|
|
58
|
+
<table>
|
|
59
|
+
<tr>
|
|
60
|
+
<td align="center">
|
|
61
|
+
<a href="https://github.com/mehdi-dalil">
|
|
62
|
+
<img src="https://avatars.githubusercontent.com/u/65339771?v=4" width="80px;" alt=""/><br />
|
|
63
|
+
<sub><b>mehdi-dalil</b></sub>
|
|
64
|
+
</a>
|
|
65
|
+
</td>
|
|
66
|
+
</tr>
|
|
67
|
+
</table>
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
### Donate
|
|
71
|
+
|
|
72
|
+
Any donation is greatly appreciated :heart:
|
|
73
|
+
|
|
74
|
+
| Source | Link / Address |
|
|
75
|
+
| :-------------- | :------------------------------------------|
|
|
76
|
+
| Github Sponsor | https://github.com/sponsors/Oli8 |
|
|
77
|
+
| PayPal | https://paypal.me/OliCrt |
|
|
78
|
+
| Bitcoin | 1Ez3Ts2WShUcbeGCjhZapdxVDK77DbYjdU |
|
|
79
|
+
| Ethereum | 0x6cd3d316a6ee6d210894981e1fcc83a00a27ede2 |
|
|
80
|
+
|
|
54
81
|
#### Components
|
|
55
82
|
|
|
56
83
|
- Alert
|
|
@@ -59,7 +86,9 @@ npm i spaper
|
|
|
59
86
|
- Breadcrumb
|
|
60
87
|
- Button
|
|
61
88
|
- Card
|
|
89
|
+
- CloseButton
|
|
62
90
|
- Collapsible
|
|
91
|
+
- CopyButton
|
|
63
92
|
- Form
|
|
64
93
|
- Checkbox
|
|
65
94
|
- Input
|
package/components/Alert.svelte
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
{/if}
|
|
9
9
|
</div>
|
|
10
10
|
|
|
11
|
-
<script
|
|
11
|
+
<script >var _a;
|
|
12
12
|
;
|
|
13
13
|
import CloseButton from './CloseButton.svelte';
|
|
14
14
|
import { computeClasses } from '../utils';
|
|
@@ -21,7 +21,7 @@ function close() {
|
|
|
21
21
|
$: classes = `${(_a = $$restProps.class) !== null && _a !== void 0 ? _a : ''} alert ${computeClasses('alert', { type })}`;
|
|
22
22
|
</script>
|
|
23
23
|
|
|
24
|
-
<style
|
|
24
|
+
<style >.alert {
|
|
25
25
|
transition: all 0.25s ease-out;
|
|
26
26
|
}
|
|
27
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,13 +2,14 @@
|
|
|
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 />
|
|
9
9
|
</a>
|
|
10
10
|
{:else}
|
|
11
11
|
<button {...attr}
|
|
12
|
+
type={nativeType}
|
|
12
13
|
class:disabled
|
|
13
14
|
disabled={disabled}
|
|
14
15
|
on:click>
|
|
@@ -16,7 +17,7 @@
|
|
|
16
17
|
</button>
|
|
17
18
|
{/if}
|
|
18
19
|
|
|
19
|
-
<script
|
|
20
|
+
<script >var _a;
|
|
20
21
|
;
|
|
21
22
|
import { computeClasses, getDomAttributes } from '../utils';
|
|
22
23
|
export let type = null;
|
|
@@ -24,8 +25,9 @@ export let size = 'default';
|
|
|
24
25
|
export let block = false;
|
|
25
26
|
export let disabled = false;
|
|
26
27
|
export let outline = null;
|
|
28
|
+
export let nativeType = null;
|
|
27
29
|
export let isLink = false;
|
|
28
|
-
export let href =
|
|
30
|
+
export let href = null;
|
|
29
31
|
export let external = false;
|
|
30
32
|
let attr;
|
|
31
33
|
$: {
|
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,7 @@
|
|
|
57
58
|
{/if}
|
|
58
59
|
</div>
|
|
59
60
|
|
|
60
|
-
<script
|
|
61
|
+
<script >;
|
|
61
62
|
export let title = '';
|
|
62
63
|
export let subTitle = '';
|
|
63
64
|
export let image = '';
|
|
@@ -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>
|
|
@@ -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;
|
|
@@ -1,6 +1,8 @@
|
|
|
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
7
|
<CloseButton on:click={close} />
|
|
6
8
|
{#if title}
|
|
@@ -23,7 +25,7 @@
|
|
|
23
25
|
</div>
|
|
24
26
|
</div>
|
|
25
27
|
|
|
26
|
-
<script
|
|
28
|
+
<script >import Button from '../Button.svelte';
|
|
27
29
|
import CloseButton from '../CloseButton.svelte';
|
|
28
30
|
export let active = false;
|
|
29
31
|
export let title = '';
|
|
@@ -38,7 +40,7 @@ function handleKeydown({ key }) {
|
|
|
38
40
|
}
|
|
39
41
|
</script>
|
|
40
42
|
|
|
41
|
-
<style
|
|
43
|
+
<style >.modal.active {
|
|
42
44
|
opacity: 1;
|
|
43
45
|
visibility: visible;
|
|
44
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,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,6 +1,11 @@
|
|
|
1
|
-
<div
|
|
1
|
+
<div {...$$restProps}
|
|
2
|
+
class="{$$restProps.class ?? ''} content margin"
|
|
2
3
|
class:content--active={active}
|
|
3
|
-
|
|
4
|
+
id={controlLabel}
|
|
5
|
+
aria-hidden={!active}
|
|
6
|
+
aria-labelledby={controlLabel}
|
|
7
|
+
role="tabpanel"
|
|
8
|
+
tabindex={active ? 0 : -1}>
|
|
4
9
|
{#if $$slots.header}
|
|
5
10
|
<div bind:this={header}
|
|
6
11
|
style="display: none">
|
|
@@ -10,8 +15,9 @@
|
|
|
10
15
|
<slot />
|
|
11
16
|
</div>
|
|
12
17
|
|
|
13
|
-
<script
|
|
18
|
+
<script >import { onMount, getContext } from 'svelte';
|
|
14
19
|
;
|
|
20
|
+
import { genControlLabel } from './index';
|
|
15
21
|
export let label;
|
|
16
22
|
const key = {};
|
|
17
23
|
let active = false;
|
|
@@ -32,6 +38,7 @@ onMount(() => {
|
|
|
32
38
|
}
|
|
33
39
|
]);
|
|
34
40
|
});
|
|
41
|
+
$: controlLabel = genControlLabel(label);
|
|
35
42
|
</script>
|
|
36
43
|
|
|
37
44
|
<style>
|
|
@@ -1,8 +1,14 @@
|
|
|
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}
|
|
5
|
+
{@const selected = index == activeTab}
|
|
4
6
|
<div class="tabs-label-header"
|
|
5
|
-
class:tabs-label-header--active={
|
|
7
|
+
class:tabs-label-header--active={selected}
|
|
8
|
+
aria-selected={selected}
|
|
9
|
+
aria-controls={genControlLabel(label)}
|
|
10
|
+
role="tab"
|
|
11
|
+
tabindex={selected ? 0 : -1}
|
|
6
12
|
on:click={showContent.bind(null, index)}>
|
|
7
13
|
{#if header}
|
|
8
14
|
{@html header.innerHTML}
|
|
@@ -15,10 +21,11 @@
|
|
|
15
21
|
<slot />
|
|
16
22
|
</div>
|
|
17
23
|
|
|
18
|
-
<script
|
|
24
|
+
<script >import { onMount, setContext, createEventDispatcher } from 'svelte';
|
|
19
25
|
import { writable } from 'svelte/store';
|
|
20
26
|
;
|
|
21
27
|
;
|
|
28
|
+
import { genControlLabel } from './index';
|
|
22
29
|
export let activeTab = 0;
|
|
23
30
|
export let placement = 'spaces';
|
|
24
31
|
export let contentAlign = 'left';
|
|
@@ -52,7 +59,7 @@ function updateTabsVisility() {
|
|
|
52
59
|
$: activeTab && updateTabsVisility();
|
|
53
60
|
</script>
|
|
54
61
|
|
|
55
|
-
<style
|
|
62
|
+
<style >.tabs-label-header {
|
|
56
63
|
cursor: pointer;
|
|
57
64
|
color: var(--primary-light);
|
|
58
65
|
display: inline-block;
|
package/components/Tabs/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
<div class="{containerClass} {position}">
|
|
2
2
|
</div>
|
|
3
3
|
|
|
4
|
-
<script
|
|
4
|
+
<script context="module">export const containerClass = 'paper-toast-container';
|
|
5
5
|
</script>
|
|
6
6
|
|
|
7
|
-
<script
|
|
7
|
+
<script >;
|
|
8
8
|
export let position = 'top-right';
|
|
9
9
|
</script>
|
|
10
10
|
|
|
11
|
-
<style
|
|
11
|
+
<style >:global(.paper-toast-container:is(.top, .bottom) > div) {
|
|
12
12
|
align-self: center;
|
|
13
13
|
}
|
|
14
14
|
|
|
@@ -17,11 +17,11 @@ export let position = 'top-right';
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
div {
|
|
20
|
+
height: 0;
|
|
20
21
|
position: fixed;
|
|
21
22
|
display: flex;
|
|
22
23
|
width: 100%;
|
|
23
24
|
padding: 2em;
|
|
24
|
-
overflow: hidden;
|
|
25
25
|
z-index: 9999;
|
|
26
26
|
flex-direction: column;
|
|
27
27
|
}
|
package/index.d.ts
CHANGED
|
@@ -14,4 +14,6 @@ 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
|
-
|
|
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
|
@@ -14,4 +14,6 @@ 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
|
-
|
|
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.5.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",
|
|
@@ -35,6 +31,7 @@
|
|
|
35
31
|
"./components/Card.svelte": "./components/Card.svelte",
|
|
36
32
|
"./components/CloseButton.svelte": "./components/CloseButton.svelte",
|
|
37
33
|
"./components/Collapsible.svelte": "./components/Collapsible.svelte",
|
|
34
|
+
"./components/CopyButton.svelte": "./components/CopyButton.svelte",
|
|
38
35
|
"./components/Form/Checkbox.svelte": "./components/Form/Checkbox.svelte",
|
|
39
36
|
"./components/Form/Form.svelte": "./components/Form/Form.svelte",
|
|
40
37
|
"./components/Form/Input.svelte": "./components/Form/Input.svelte",
|
|
@@ -50,7 +47,7 @@
|
|
|
50
47
|
"./components/Pagination/Arrow.svelte": "./components/Pagination/Arrow.svelte",
|
|
51
48
|
"./components/Pagination/NavigationButton.svelte": "./components/Pagination/NavigationButton.svelte",
|
|
52
49
|
"./components/Pagination/Pagination.svelte": "./components/Pagination/Pagination.svelte",
|
|
53
|
-
"./components/Pagination/arrow-dimension
|
|
50
|
+
"./components/Pagination/arrow-dimension": "./components/Pagination/arrow-dimension.js",
|
|
54
51
|
"./components/Pagination": "./components/Pagination/index.js",
|
|
55
52
|
"./components/Popover.svelte": "./components/Popover.svelte",
|
|
56
53
|
"./components/Progress.svelte": "./components/Progress.svelte",
|
|
@@ -63,6 +60,7 @@
|
|
|
63
60
|
"./components/Toast": "./components/Toast/index.js",
|
|
64
61
|
"./components/style.scss": "./components/style.scss",
|
|
65
62
|
".": "./index.js",
|
|
66
|
-
"./utils
|
|
67
|
-
}
|
|
68
|
-
|
|
63
|
+
"./utils": "./utils.js"
|
|
64
|
+
},
|
|
65
|
+
"svelte": "./index.js"
|
|
66
|
+
}
|
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)
|