@axel669/zephyr 0.2.0-beta.3 → 0.3.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/package.json +33 -33
- package/readme.md +63 -63
- package/src/async/button.md +27 -0
- package/src/async/button.svelte +29 -31
- package/src/async/load-zone.md +42 -0
- package/src/async/load-zone.svelte +22 -20
- package/src/composed/data-table/th.md +21 -0
- package/src/composed/data-table/th.svelte +61 -61
- package/src/composed/data-table.md +86 -85
- package/src/composed/data-table.svelte +199 -149
- package/src/composed/entry-button.md +44 -34
- package/src/composed/entry-button.svelte +31 -31
- package/src/composed/table-functions.js +13 -13
- package/src/composed/toast/message.svelte +56 -56
- package/src/composed/toast.md +45 -36
- package/src/composed/toast.svelte +70 -70
- package/src/control/button.md +41 -41
- package/src/control/button.svelte +27 -27
- package/src/control/input.md +87 -0
- package/src/control/input.svelte +109 -109
- package/src/control/label.md +48 -49
- package/src/control/label.svelte +38 -38
- package/src/control/link.md +50 -50
- package/src/control/link.svelte +32 -30
- package/src/control/radio.md +58 -58
- package/src/control/radio.svelte +28 -28
- package/src/control/select.md +70 -70
- package/src/control/select.svelte +64 -64
- package/src/control/tabs.md +47 -47
- package/src/control/tabs.svelte +43 -41
- package/src/control/toggle.md +61 -61
- package/src/control/toggle.svelte +49 -49
- package/src/data-display/avatar.md +36 -36
- package/src/data-display/avatar.svelte +25 -25
- package/src/data-display/badge.md +30 -30
- package/src/data-display/badge.svelte +14 -14
- package/src/data-display/chip.md +36 -36
- package/src/data-display/chip.svelte +28 -28
- package/src/data-display/details.md +42 -3
- package/src/data-display/details.svelte +25 -25
- package/src/data-display/popover.md +32 -32
- package/src/data-display/popover.svelte +25 -25
- package/src/data-display/progress.md +46 -46
- package/src/data-display/progress.svelte +27 -27
- package/src/data-display/table.md +59 -7
- package/src/data-display/table.svelte +38 -38
- package/src/data-display/tooltip.md +29 -29
- package/src/data-display/tooltip.svelte +17 -17
- package/src/dialogs/alert.md +42 -3
- package/src/dialogs/alert.svelte +34 -34
- package/src/dialogs/confirm.md +56 -3
- package/src/dialogs/confirm.svelte +45 -45
- package/src/functions.md +108 -83
- package/src/handler$.mjs +20 -20
- package/src/hash.js +14 -0
- package/src/index.mjs +53 -52
- package/src/info/icon.md +21 -21
- package/src/info/icon.svelte +9 -9
- package/src/info/notification.md +36 -36
- package/src/info/notification.svelte +16 -16
- package/src/info/titlebar.md +75 -75
- package/src/info/titlebar.svelte +18 -18
- package/src/info/toaster.md +26 -26
- package/src/info/toaster.svelte +14 -14
- package/src/inline-dialog.svelte +23 -23
- package/src/layout/dialog.md +43 -43
- package/src/layout/dialog.svelte +26 -26
- package/src/layout/drawer.md +70 -70
- package/src/layout/drawer.svelte +49 -49
- package/src/layout/flex.md +43 -43
- package/src/layout/flex.svelte +26 -24
- package/src/layout/grid.md +61 -61
- package/src/layout/grid.svelte +30 -28
- package/src/layout/modal.md +50 -50
- package/src/layout/modal.svelte +60 -60
- package/src/layout/paper.md +94 -94
- package/src/layout/paper.svelte +47 -47
- package/src/layout/screen.md +33 -33
- package/src/layout/screen.svelte +34 -34
- package/src/spinner/circle-spinner.svelte +15 -15
- package/src/spinner/hexagon-spinner.svelte +15 -15
- package/src/spinner/spinners.md +22 -3
- package/src/text.md +34 -34
- package/src/text.svelte +22 -22
- package/src/variant.mjs +12 -12
- package/src/wsx.mjs +24 -24
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
<svelte:options immutable />
|
|
2
|
-
|
|
3
|
-
<script>
|
|
4
|
-
import wsx from "../wsx.mjs"
|
|
5
|
-
|
|
6
|
-
export let label = ""
|
|
7
|
-
export let color = "default"
|
|
8
|
-
export let checked = false
|
|
9
|
-
export let flat = false
|
|
10
|
-
export let value
|
|
11
|
-
export let group = []
|
|
12
|
-
export let checkbox = false
|
|
13
|
-
export let reverse = false
|
|
14
|
-
|
|
15
|
-
$: container = {
|
|
16
|
-
"
|
|
17
|
-
"$flat": flat,
|
|
18
|
-
"$color": color,
|
|
19
|
-
"fl.dir": reverse ? "row-reverse" : false,
|
|
20
|
-
...$$restProps,
|
|
21
|
-
}
|
|
22
|
-
$: input = {
|
|
23
|
-
"
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const updateGroup = (checked) => {
|
|
27
|
-
if (checked === true) {
|
|
28
|
-
if (group.includes(value) === true) {
|
|
29
|
-
return
|
|
30
|
-
}
|
|
31
|
-
group = [...group, value]
|
|
32
|
-
return
|
|
33
|
-
}
|
|
34
|
-
if (group.includes(value) === false) {
|
|
35
|
-
return
|
|
36
|
-
}
|
|
37
|
-
group = group.filter(item => item !== value)
|
|
38
|
-
}
|
|
39
|
-
$: updateGroup(checked)
|
|
40
|
-
</script>
|
|
41
|
-
|
|
42
|
-
<label use:wsx={container}>
|
|
43
|
-
<div>
|
|
44
|
-
<slot>
|
|
45
|
-
{label}
|
|
46
|
-
</slot>
|
|
47
|
-
</div>
|
|
48
|
-
<input type="checkbox" bind:checked use:wsx={input} />
|
|
49
|
-
</label>
|
|
1
|
+
<svelte:options immutable />
|
|
2
|
+
|
|
3
|
+
<script>
|
|
4
|
+
import wsx from "../wsx.mjs"
|
|
5
|
+
|
|
6
|
+
export let label = ""
|
|
7
|
+
export let color = "@default"
|
|
8
|
+
export let checked = false
|
|
9
|
+
export let flat = false
|
|
10
|
+
export let value
|
|
11
|
+
export let group = []
|
|
12
|
+
export let checkbox = false
|
|
13
|
+
export let reverse = false
|
|
14
|
+
|
|
15
|
+
$: container = {
|
|
16
|
+
"@toggle": true,
|
|
17
|
+
"$flat": flat,
|
|
18
|
+
"$color": color,
|
|
19
|
+
"fl.dir": reverse ? "row-reverse" : false,
|
|
20
|
+
...$$restProps,
|
|
21
|
+
}
|
|
22
|
+
$: input = {
|
|
23
|
+
"@switch": checkbox === false
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const updateGroup = (checked) => {
|
|
27
|
+
if (checked === true) {
|
|
28
|
+
if (group.includes(value) === true) {
|
|
29
|
+
return
|
|
30
|
+
}
|
|
31
|
+
group = [...group, value]
|
|
32
|
+
return
|
|
33
|
+
}
|
|
34
|
+
if (group.includes(value) === false) {
|
|
35
|
+
return
|
|
36
|
+
}
|
|
37
|
+
group = group.filter(item => item !== value)
|
|
38
|
+
}
|
|
39
|
+
$: updateGroup(checked)
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<label use:wsx={container}>
|
|
43
|
+
<div>
|
|
44
|
+
<slot>
|
|
45
|
+
{label}
|
|
46
|
+
</slot>
|
|
47
|
+
</div>
|
|
48
|
+
<input type="checkbox" bind:checked use:wsx={input} />
|
|
49
|
+
</label>
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
# Avatar
|
|
2
|
-
|
|
3
|
-
Displays an image or text in a circular container.
|
|
4
|
-
|
|
5
|
-
## Props
|
|
6
|
-
|
|
7
|
-
### alt
|
|
8
|
-
`string`
|
|
9
|
-
|
|
10
|
-
Alt text for the image. Has no effect if image prop is not used.
|
|
11
|
-
|
|
12
|
-
### color
|
|
13
|
-
`string`
|
|
14
|
-
|
|
15
|
-
Sets `$color`
|
|
16
|
-
|
|
17
|
-
### image
|
|
18
|
-
`string`
|
|
19
|
-
|
|
20
|
-
An image url. If no url is provided the text property is displayed.
|
|
21
|
-
|
|
22
|
-
### text
|
|
23
|
-
`string`
|
|
24
|
-
|
|
25
|
-
Text to show in the avatar area if image is not used.
|
|
26
|
-
|
|
27
|
-
## Example
|
|
28
|
-
```svelte
|
|
29
|
-
<script>
|
|
30
|
-
import { Avatar } from "@axel669/zephyr"
|
|
31
|
-
</script>
|
|
32
|
-
|
|
33
|
-
<Avatar image="url" />
|
|
34
|
-
<Avatar image="url" alt="text" />
|
|
35
|
-
<Avatar text="Hi" color="primary" />
|
|
36
|
-
```
|
|
1
|
+
# Avatar
|
|
2
|
+
|
|
3
|
+
Displays an image or text in a circular container.
|
|
4
|
+
|
|
5
|
+
## Props
|
|
6
|
+
|
|
7
|
+
### alt
|
|
8
|
+
`string`
|
|
9
|
+
|
|
10
|
+
Alt text for the image. Has no effect if image prop is not used.
|
|
11
|
+
|
|
12
|
+
### color
|
|
13
|
+
`string`
|
|
14
|
+
|
|
15
|
+
Sets `$color`
|
|
16
|
+
|
|
17
|
+
### image
|
|
18
|
+
`string`
|
|
19
|
+
|
|
20
|
+
An image url. If no url is provided the text property is displayed.
|
|
21
|
+
|
|
22
|
+
### text
|
|
23
|
+
`string`
|
|
24
|
+
|
|
25
|
+
Text to show in the avatar area if image is not used.
|
|
26
|
+
|
|
27
|
+
## Example
|
|
28
|
+
```svelte
|
|
29
|
+
<script>
|
|
30
|
+
import { Avatar } from "@axel669/zephyr"
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<Avatar image="url" />
|
|
34
|
+
<Avatar image="url" alt="text" />
|
|
35
|
+
<Avatar text="Hi" color="primary" />
|
|
36
|
+
```
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
<svelte:options immutable />
|
|
2
|
-
|
|
3
|
-
<script>
|
|
4
|
-
import wsx from "../wsx.mjs"
|
|
5
|
-
|
|
6
|
-
export let alt = ""
|
|
7
|
-
export let image = null
|
|
8
|
-
|
|
9
|
-
export let text = ""
|
|
10
|
-
|
|
11
|
-
export let color = false
|
|
12
|
-
|
|
13
|
-
$: wind = {
|
|
14
|
-
"$color": color,
|
|
15
|
-
...$$restProps
|
|
16
|
-
}
|
|
17
|
-
</script>
|
|
18
|
-
|
|
19
|
-
<ws-avatar use:wsx={wind}>
|
|
20
|
-
{#if image !== null}
|
|
21
|
-
<img src={image} {alt} />
|
|
22
|
-
{:else}
|
|
23
|
-
{text}
|
|
24
|
-
{/if}
|
|
25
|
-
</ws-avatar>
|
|
1
|
+
<svelte:options immutable />
|
|
2
|
+
|
|
3
|
+
<script>
|
|
4
|
+
import wsx from "../wsx.mjs"
|
|
5
|
+
|
|
6
|
+
export let alt = ""
|
|
7
|
+
export let image = null
|
|
8
|
+
|
|
9
|
+
export let text = ""
|
|
10
|
+
|
|
11
|
+
export let color = false
|
|
12
|
+
|
|
13
|
+
$: wind = {
|
|
14
|
+
"$color": color,
|
|
15
|
+
...$$restProps
|
|
16
|
+
}
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<ws-avatar use:wsx={wind}>
|
|
20
|
+
{#if image !== null}
|
|
21
|
+
<img src={image} {alt} />
|
|
22
|
+
{:else}
|
|
23
|
+
{text}
|
|
24
|
+
{/if}
|
|
25
|
+
</ws-avatar>
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
# Badge
|
|
2
|
-
Adds a small badge over the upper-right corner of some content.
|
|
3
|
-
|
|
4
|
-
## Props
|
|
5
|
-
|
|
6
|
-
### color
|
|
7
|
-
`string`
|
|
8
|
-
|
|
9
|
-
Sets `$color`
|
|
10
|
-
|
|
11
|
-
### text
|
|
12
|
-
`string`
|
|
13
|
-
|
|
14
|
-
The badge text.
|
|
15
|
-
|
|
16
|
-
## Example
|
|
17
|
-
```svelte
|
|
18
|
-
<script>
|
|
19
|
-
import { Badge } from "@axel669/zephyr"
|
|
20
|
-
|
|
21
|
-
let count = 10
|
|
22
|
-
</script>
|
|
23
|
-
|
|
24
|
-
<Badge text={count}>
|
|
25
|
-
Unread Messages
|
|
26
|
-
</Badge>
|
|
27
|
-
<Badge text="1k+" color="warning">
|
|
28
|
-
<button on:click={() => count += 1}>Clickable Content</button>
|
|
29
|
-
</Badge>
|
|
30
|
-
```
|
|
1
|
+
# Badge
|
|
2
|
+
Adds a small badge over the upper-right corner of some content.
|
|
3
|
+
|
|
4
|
+
## Props
|
|
5
|
+
|
|
6
|
+
### color
|
|
7
|
+
`string`
|
|
8
|
+
|
|
9
|
+
Sets `$color`
|
|
10
|
+
|
|
11
|
+
### text
|
|
12
|
+
`string`
|
|
13
|
+
|
|
14
|
+
The badge text.
|
|
15
|
+
|
|
16
|
+
## Example
|
|
17
|
+
```svelte
|
|
18
|
+
<script>
|
|
19
|
+
import { Badge } from "@axel669/zephyr"
|
|
20
|
+
|
|
21
|
+
let count = 10
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<Badge text={count}>
|
|
25
|
+
Unread Messages
|
|
26
|
+
</Badge>
|
|
27
|
+
<Badge text="1k+" color="warning">
|
|
28
|
+
<button on:click={() => count += 1}>Clickable Content</button>
|
|
29
|
+
</Badge>
|
|
30
|
+
```
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
<svelte:options immutable />
|
|
2
|
-
|
|
3
|
-
<script>
|
|
4
|
-
import wsx from "../wsx.mjs"
|
|
5
|
-
|
|
6
|
-
export let color = "default"
|
|
7
|
-
export let text = ""
|
|
8
|
-
|
|
9
|
-
$: wind = { "$color": color, ...$$restProps }
|
|
10
|
-
</script>
|
|
11
|
-
|
|
12
|
-
<ws-badge ws-text={text} use:wsx={wind}>
|
|
13
|
-
<slot />
|
|
14
|
-
</ws-badge>
|
|
1
|
+
<svelte:options immutable />
|
|
2
|
+
|
|
3
|
+
<script>
|
|
4
|
+
import wsx from "../wsx.mjs"
|
|
5
|
+
|
|
6
|
+
export let color = "@default"
|
|
7
|
+
export let text = ""
|
|
8
|
+
|
|
9
|
+
$: wind = { "$color": color, ...$$restProps }
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<ws-badge ws-text={text} use:wsx={wind}>
|
|
13
|
+
<slot />
|
|
14
|
+
</ws-badge>
|
package/src/data-display/chip.md
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
# Chip
|
|
2
|
-
|
|
3
|
-
Shows a small piece of information that is separate from the surrounding
|
|
4
|
-
info and optionally allows interaction.
|
|
5
|
-
|
|
6
|
-
## Props
|
|
7
|
-
|
|
8
|
-
### color
|
|
9
|
-
`string`
|
|
10
|
-
|
|
11
|
-
Sets `$color`
|
|
12
|
-
|
|
13
|
-
### clickable
|
|
14
|
-
`bool`
|
|
15
|
-
|
|
16
|
-
If true, the chip will have the button ripple effect when clicked.
|
|
17
|
-
|
|
18
|
-
### fill
|
|
19
|
-
`bool`
|
|
20
|
-
|
|
21
|
-
If true, sets $fill on the chip. If false $outline is set instead.
|
|
22
|
-
|
|
23
|
-
## Events
|
|
24
|
-
- click
|
|
25
|
-
|
|
26
|
-
## Example
|
|
27
|
-
```svelte
|
|
28
|
-
<script>
|
|
29
|
-
import { Chip } from "@axel669/zephyr"
|
|
30
|
-
</script>
|
|
31
|
-
|
|
32
|
-
Emails:
|
|
33
|
-
<Chip clickable>admin@site.com</Chip>
|
|
34
|
-
<Chip clickable color="warning">weirdge@site.com</Chip>
|
|
35
|
-
<Chip color="primary" fill>required@site.io</Chip>
|
|
36
|
-
```
|
|
1
|
+
# Chip
|
|
2
|
+
|
|
3
|
+
Shows a small piece of information that is separate from the surrounding
|
|
4
|
+
info and optionally allows interaction.
|
|
5
|
+
|
|
6
|
+
## Props
|
|
7
|
+
|
|
8
|
+
### color
|
|
9
|
+
`string`
|
|
10
|
+
|
|
11
|
+
Sets `$color`
|
|
12
|
+
|
|
13
|
+
### clickable
|
|
14
|
+
`bool`
|
|
15
|
+
|
|
16
|
+
If true, the chip will have the button ripple effect when clicked.
|
|
17
|
+
|
|
18
|
+
### fill
|
|
19
|
+
`bool`
|
|
20
|
+
|
|
21
|
+
If true, sets $fill on the chip. If false $outline is set instead.
|
|
22
|
+
|
|
23
|
+
## Events
|
|
24
|
+
- click
|
|
25
|
+
|
|
26
|
+
## Example
|
|
27
|
+
```svelte
|
|
28
|
+
<script>
|
|
29
|
+
import { Chip } from "@axel669/zephyr"
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
Emails:
|
|
33
|
+
<Chip clickable>admin@site.com</Chip>
|
|
34
|
+
<Chip clickable color="warning">weirdge@site.com</Chip>
|
|
35
|
+
<Chip color="primary" fill>required@site.io</Chip>
|
|
36
|
+
```
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
<svelte:options immutable />
|
|
2
|
-
|
|
3
|
-
<script>
|
|
4
|
-
import wsx from "../wsx.mjs"
|
|
5
|
-
import variant from "../variant.mjs"
|
|
6
|
-
|
|
7
|
-
export let color = "default"
|
|
8
|
-
export let clickable = false
|
|
9
|
-
|
|
10
|
-
export let fill = false
|
|
11
|
-
export let outline = false
|
|
12
|
-
export let flat = false
|
|
13
|
-
|
|
14
|
-
$: type = variant({ fill, flat, outline }, "$outline")
|
|
15
|
-
|
|
16
|
-
$: wind = {
|
|
17
|
-
[type]: true,
|
|
18
|
-
"$color": color,
|
|
19
|
-
$click: clickable,
|
|
20
|
-
...$$restProps
|
|
21
|
-
}
|
|
22
|
-
</script>
|
|
23
|
-
|
|
24
|
-
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
25
|
-
<!-- svelte-ignore a11y-interactive-supports-focus -->
|
|
26
|
-
<ws-chip use:wsx={wind} on:click role="button">
|
|
27
|
-
<slot />
|
|
28
|
-
</ws-chip>
|
|
1
|
+
<svelte:options immutable />
|
|
2
|
+
|
|
3
|
+
<script>
|
|
4
|
+
import wsx from "../wsx.mjs"
|
|
5
|
+
import variant from "../variant.mjs"
|
|
6
|
+
|
|
7
|
+
export let color = "@default"
|
|
8
|
+
export let clickable = false
|
|
9
|
+
|
|
10
|
+
export let fill = false
|
|
11
|
+
export let outline = false
|
|
12
|
+
export let flat = false
|
|
13
|
+
|
|
14
|
+
$: type = variant({ fill, flat, outline }, "$outline")
|
|
15
|
+
|
|
16
|
+
$: wind = {
|
|
17
|
+
[type]: true,
|
|
18
|
+
"$color": color,
|
|
19
|
+
$click: clickable,
|
|
20
|
+
...$$restProps
|
|
21
|
+
}
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
25
|
+
<!-- svelte-ignore a11y-interactive-supports-focus -->
|
|
26
|
+
<ws-chip use:wsx={wind} on:click role="button">
|
|
27
|
+
<slot />
|
|
28
|
+
</ws-chip>
|
|
@@ -1,3 +1,42 @@
|
|
|
1
|
-
# Details
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
# Details
|
|
2
|
+
A component that has some baseline content that is shown, then expands to reveal
|
|
3
|
+
more content (like the html details element).
|
|
4
|
+
|
|
5
|
+
## Props
|
|
6
|
+
|
|
7
|
+
### color
|
|
8
|
+
Sets the $color macro.
|
|
9
|
+
|
|
10
|
+
### label
|
|
11
|
+
The text for the content that is always shown.
|
|
12
|
+
|
|
13
|
+
### open
|
|
14
|
+
Controls whether the Details is showing the extended content. Can be bound to.
|
|
15
|
+
|
|
16
|
+
### outline
|
|
17
|
+
If true, will put an outline around the component, including the extended
|
|
18
|
+
content.
|
|
19
|
+
|
|
20
|
+
## Slots
|
|
21
|
+
|
|
22
|
+
### default
|
|
23
|
+
The content to show when the Details is open.
|
|
24
|
+
|
|
25
|
+
### label
|
|
26
|
+
Can be used for more complex labels (things that need nested elements). If used,
|
|
27
|
+
the label prop will be ignored.
|
|
28
|
+
|
|
29
|
+
## Example
|
|
30
|
+
|
|
31
|
+
```svelte
|
|
32
|
+
<script>
|
|
33
|
+
import { Details } from "@axel669/zephyr"
|
|
34
|
+
|
|
35
|
+
let open = false
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<div>Open: {open}</div>
|
|
39
|
+
<Details label="Info" bind:open>
|
|
40
|
+
Look, more info could go here!
|
|
41
|
+
</Details>
|
|
42
|
+
```
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
<svelte:options immutable />
|
|
2
|
-
|
|
3
|
-
<script>
|
|
4
|
-
import wsx from "../wsx.mjs"
|
|
5
|
-
|
|
6
|
-
export let label
|
|
7
|
-
export let outline
|
|
8
|
-
export let color = "default"
|
|
9
|
-
export let open = false
|
|
10
|
-
|
|
11
|
-
$: wind = {
|
|
12
|
-
"$color": color,
|
|
13
|
-
"$outline": outline,
|
|
14
|
-
...$$restProps,
|
|
15
|
-
}
|
|
16
|
-
</script>
|
|
17
|
-
|
|
18
|
-
<details use:wsx={wind} bind:open>
|
|
19
|
-
<summary>
|
|
20
|
-
<slot name="label">
|
|
21
|
-
{label}
|
|
22
|
-
</slot>
|
|
23
|
-
</summary>
|
|
24
|
-
<slot />
|
|
25
|
-
</details>
|
|
1
|
+
<svelte:options immutable />
|
|
2
|
+
|
|
3
|
+
<script>
|
|
4
|
+
import wsx from "../wsx.mjs"
|
|
5
|
+
|
|
6
|
+
export let label
|
|
7
|
+
export let outline
|
|
8
|
+
export let color = "@default"
|
|
9
|
+
export let open = false
|
|
10
|
+
|
|
11
|
+
$: wind = {
|
|
12
|
+
"$color": color,
|
|
13
|
+
"$outline": outline,
|
|
14
|
+
...$$restProps,
|
|
15
|
+
}
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<details use:wsx={wind} bind:open>
|
|
19
|
+
<summary>
|
|
20
|
+
<slot name="label">
|
|
21
|
+
{label}
|
|
22
|
+
</slot>
|
|
23
|
+
</summary>
|
|
24
|
+
<slot />
|
|
25
|
+
</details>
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
# Popover
|
|
2
|
-
|
|
3
|
-
The Popover component is for displaying content over something without it
|
|
4
|
-
being modal (you can interact with things under it still).
|
|
5
|
-
|
|
6
|
-
## Variables
|
|
7
|
-
- show
|
|
8
|
-
- hide
|
|
9
|
-
The Popover exposes 2 variables for use: `show` and `hide`. These functions
|
|
10
|
-
are given to the content so that it can control when to display the popover
|
|
11
|
-
content without needing to bind to the parent.
|
|
12
|
-
|
|
13
|
-
> Beacuse the hide function is given to a named slot, the `let:hide` declaration
|
|
14
|
-
> needs to be on the slotted element.
|
|
15
|
-
|
|
16
|
-
## Example
|
|
17
|
-
```svelte
|
|
18
|
-
<script>
|
|
19
|
-
import { Popover, Button } from "@axel669/zephyr"
|
|
20
|
-
</script>
|
|
21
|
-
|
|
22
|
-
<Popover let:show>
|
|
23
|
-
<Button on:click={show}>
|
|
24
|
-
Show
|
|
25
|
-
</Button>
|
|
26
|
-
<div ws-x="inset-x[0px] y[0px] h[100px] bg[teal]" slot="content" let:hide>
|
|
27
|
-
<Button on:click={hide}>
|
|
28
|
-
Hide
|
|
29
|
-
</Button>
|
|
30
|
-
</div>
|
|
31
|
-
</Popover>
|
|
32
|
-
```
|
|
1
|
+
# Popover
|
|
2
|
+
|
|
3
|
+
The Popover component is for displaying content over something without it
|
|
4
|
+
being modal (you can interact with things under it still).
|
|
5
|
+
|
|
6
|
+
## Variables
|
|
7
|
+
- show
|
|
8
|
+
- hide
|
|
9
|
+
The Popover exposes 2 variables for use: `show` and `hide`. These functions
|
|
10
|
+
are given to the content so that it can control when to display the popover
|
|
11
|
+
content without needing to bind to the parent.
|
|
12
|
+
|
|
13
|
+
> Beacuse the hide function is given to a named slot, the `let:hide` declaration
|
|
14
|
+
> needs to be on the slotted element.
|
|
15
|
+
|
|
16
|
+
## Example
|
|
17
|
+
```svelte
|
|
18
|
+
<script>
|
|
19
|
+
import { Popover, Button } from "@axel669/zephyr"
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<Popover let:show>
|
|
23
|
+
<Button on:click={show}>
|
|
24
|
+
Show
|
|
25
|
+
</Button>
|
|
26
|
+
<div ws-x="inset-x[0px] y[0px] h[100px] bg[teal]" slot="content" let:hide>
|
|
27
|
+
<Button on:click={hide}>
|
|
28
|
+
Hide
|
|
29
|
+
</Button>
|
|
30
|
+
</div>
|
|
31
|
+
</Popover>
|
|
32
|
+
```
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
<svelte:options immutable />
|
|
2
|
-
|
|
3
|
-
<script>
|
|
4
|
-
import { fade } from "svelte/transition"
|
|
5
|
-
import wsx from "../wsx.mjs"
|
|
6
|
-
|
|
7
|
-
let visible = false
|
|
8
|
-
const show = () => visible = true
|
|
9
|
-
const hide = () => visible = false
|
|
10
|
-
const anim = { duration: 250 }
|
|
11
|
-
|
|
12
|
-
$: wind = {
|
|
13
|
-
$show: true,
|
|
14
|
-
...$$restProps,
|
|
15
|
-
}
|
|
16
|
-
</script>
|
|
17
|
-
|
|
18
|
-
<ws-popover use:wsx={wind}>
|
|
19
|
-
<slot {show} />
|
|
20
|
-
{#if visible}
|
|
21
|
-
<wind-content slot="content" ws-x="inset
|
|
22
|
-
<slot name="content" {hide} />
|
|
23
|
-
</wind-content>
|
|
24
|
-
{/if}
|
|
25
|
-
</ws-popover>
|
|
1
|
+
<svelte:options immutable />
|
|
2
|
+
|
|
3
|
+
<script>
|
|
4
|
+
import { fade } from "svelte/transition"
|
|
5
|
+
import wsx from "../wsx.mjs"
|
|
6
|
+
|
|
7
|
+
let visible = false
|
|
8
|
+
const show = () => visible = true
|
|
9
|
+
const hide = () => visible = false
|
|
10
|
+
const anim = { duration: 250 }
|
|
11
|
+
|
|
12
|
+
$: wind = {
|
|
13
|
+
$show: true,
|
|
14
|
+
...$$restProps,
|
|
15
|
+
}
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<ws-popover use:wsx={wind}>
|
|
19
|
+
<slot {show} />
|
|
20
|
+
{#if visible}
|
|
21
|
+
<wind-content slot="content" ws-x="[inset 0px]" transition:fade={anim}>
|
|
22
|
+
<slot name="content" {hide} />
|
|
23
|
+
</wind-content>
|
|
24
|
+
{/if}
|
|
25
|
+
</ws-popover>
|