@axel669/zephyr 0.1.17 → 0.2.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/package.json +11 -7
- package/readme.md +55 -44
- package/src/composed/data-table/th.svelte +60 -0
- package/src/composed/data-table.md +71 -0
- package/src/composed/data-table.svelte +136 -150
- package/src/composed/entry-button.md +34 -0
- package/src/composed/entry-button.svelte +29 -68
- package/src/composed/table-functions.js +13 -0
- package/src/composed/toast/message.svelte +44 -44
- package/src/composed/toast.md +36 -0
- package/src/composed/toast.svelte +68 -108
- package/src/control/button.md +37 -0
- package/src/control/button.svelte +25 -0
- package/src/control/input.svelte +107 -0
- package/src/control/label.md +0 -0
- package/src/control/label.svelte +36 -0
- package/src/control/link.md +37 -0
- package/src/control/link.svelte +28 -0
- package/src/control/radio.md +49 -0
- package/src/control/radio.svelte +28 -0
- package/src/control/select.md +55 -0
- package/src/control/select.svelte +62 -0
- package/src/control/tabs.md +35 -0
- package/src/control/tabs.svelte +39 -0
- package/src/control/toggle.md +38 -0
- package/src/control/toggle.svelte +47 -0
- package/src/data-display/avatar.md +26 -0
- package/src/data-display/avatar.svelte +23 -0
- package/src/data-display/badge.md +24 -0
- package/src/data-display/badge.svelte +12 -0
- package/src/data-display/chip.md +28 -0
- package/src/data-display/chip.svelte +26 -0
- package/src/data-display/details.md +0 -0
- package/src/{details.svelte → data-display/details.svelte} +3 -3
- package/src/data-display/popover.md +32 -0
- package/src/data-display/popover.svelte +23 -0
- package/src/data-display/progress.md +30 -0
- package/src/data-display/progress.svelte +25 -0
- package/src/data-display/table.md +29 -0
- package/src/data-display/table.svelte +36 -0
- package/src/data-display/tooltip.md +25 -0
- package/src/data-display/tooltip.svelte +15 -0
- package/src/dialogs/alert.md +0 -0
- package/src/dialogs/alert.svelte +4 -4
- package/src/dialogs/confirm.md +0 -0
- package/src/dialogs/confirm.svelte +5 -5
- package/src/functions.md +77 -0
- package/src/handler$.mjs +20 -68
- package/src/index.mjs +55 -92
- package/src/info/icon.md +20 -0
- package/src/info/icon.svelte +9 -0
- package/src/info/notification.md +37 -0
- package/src/info/notification.svelte +16 -0
- package/src/info/titlebar.md +46 -0
- package/src/info/titlebar.svelte +18 -0
- package/src/info/toaster.md +23 -0
- package/src/info/toaster.svelte +14 -0
- package/src/inline-dialog.svelte +23 -23
- package/src/layout/dialog.md +33 -0
- package/src/layout/dialog.svelte +24 -0
- package/src/layout/drawer.md +47 -0
- package/src/layout/drawer.svelte +47 -0
- package/src/layout/flex.md +30 -0
- package/src/layout/flex.svelte +22 -0
- package/src/layout/grid.md +36 -0
- package/src/layout/grid.svelte +26 -0
- package/src/layout/modal.md +35 -0
- package/src/layout/modal.svelte +58 -0
- package/src/layout/paper.md +77 -0
- package/src/layout/paper.svelte +45 -0
- package/src/layout/screen.md +31 -0
- package/src/layout/screen.svelte +32 -0
- package/src/{circle-spinner.svelte → spinner/circle-spinner.svelte} +2 -2
- package/src/{hexagon-spinner.svelte → spinner/hexagon-spinner.svelte} +2 -2
- package/src/spinner/spinners.md +0 -0
- package/src/text.md +22 -0
- package/src/text.svelte +20 -49
- package/src/variant.mjs +12 -12
- package/src/wsx.mjs +24 -45
- package/src/avatar.svelte +0 -54
- package/src/badge.svelte +0 -40
- package/src/button.svelte +0 -86
- package/src/chip.svelte +0 -56
- package/src/dialog.svelte +0 -54
- package/src/drawer.svelte +0 -121
- package/src/flex.svelte +0 -57
- package/src/grid.svelte +0 -66
- package/src/icon.svelte +0 -34
- package/src/input/area.svelte +0 -98
- package/src/input/elems.mjs +0 -7
- package/src/input/email.svelte +0 -104
- package/src/input/file.svelte +0 -82
- package/src/input/number.svelte +0 -104
- package/src/input/password.svelte +0 -101
- package/src/input/search.svelte +0 -104
- package/src/input/text.svelte +0 -104
- package/src/link.svelte +0 -67
- package/src/modal.svelte +0 -73
- package/src/notification.svelte +0 -57
- package/src/paper.svelte +0 -127
- package/src/popover.svelte +0 -60
- package/src/progress.svelte +0 -60
- package/src/radio.svelte +0 -82
- package/src/screen.svelte +0 -69
- package/src/select.svelte +0 -122
- package/src/table.svelte +0 -69
- package/src/tabs.svelte +0 -78
- package/src/titlebar.svelte +0 -69
- package/src/toaster.svelte +0 -42
- package/src/toggle.svelte +0 -94
- package/src/tooltip.svelte +0 -45
- package/src/vars.mjs +0 -61
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import wsx from "../wsx.mjs"
|
|
3
|
+
import variant from "../variant.mjs"
|
|
4
|
+
|
|
5
|
+
export let button = false
|
|
6
|
+
export let color = false
|
|
7
|
+
|
|
8
|
+
export let href = ""
|
|
9
|
+
export let rel = "noreferrer"
|
|
10
|
+
export let target = null
|
|
11
|
+
|
|
12
|
+
export let fill = false
|
|
13
|
+
export let outline = false
|
|
14
|
+
export let flat = false
|
|
15
|
+
|
|
16
|
+
$: type = variant({ fill, outline, flat })
|
|
17
|
+
|
|
18
|
+
$: wind = {
|
|
19
|
+
"@button": button,
|
|
20
|
+
[type]: true,
|
|
21
|
+
"$color": color,
|
|
22
|
+
...$$restProps
|
|
23
|
+
}
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<a {href} {target} {rel} use:wsx={wind}>
|
|
27
|
+
<slot />
|
|
28
|
+
</a>
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Radio
|
|
2
|
+
|
|
3
|
+
The radio component displays a list of radio options and provides an
|
|
4
|
+
interface to control which one is selected and react to changes in the
|
|
5
|
+
selected value. It also uses a layout component to decide how the options
|
|
6
|
+
are presented.
|
|
7
|
+
|
|
8
|
+
## Base
|
|
9
|
+
Each radio item rendered is a
|
|
10
|
+
[Windstorm Labeled Toggle](https://axel669.github.io/lib.windstorm/#components-labeled toggle)
|
|
11
|
+
that uses a radio input.
|
|
12
|
+
|
|
13
|
+
## Props
|
|
14
|
+
All [windstorm functions](https://axel669.github.io/lib.windstorm/#css-shorthands)
|
|
15
|
+
are supported.
|
|
16
|
+
|
|
17
|
+
Unlike the Paper, the wind functions passed as props to the Radio component
|
|
18
|
+
are passed directly to the layout specified because the Radio does not have
|
|
19
|
+
a container element of its own.
|
|
20
|
+
|
|
21
|
+
- ### layout `Component`
|
|
22
|
+
The component to use for layout out the options. Default is Flex.
|
|
23
|
+
- ### options `Array[Object]`
|
|
24
|
+
An array of objects that defines the options to show. Details below.
|
|
25
|
+
- ### value `any`
|
|
26
|
+
The value currently selected. Can be bound to react to selections or
|
|
27
|
+
change the current selection.
|
|
28
|
+
|
|
29
|
+
## Options
|
|
30
|
+
Each object in the options array supplied should have a `value` and `label`
|
|
31
|
+
prop specified. Additionally, any wind functions that should be applied to
|
|
32
|
+
the option can be passed as additional props.
|
|
33
|
+
|
|
34
|
+
Labels should be strings, but values can be any type as long as they are
|
|
35
|
+
unique in the list.
|
|
36
|
+
|
|
37
|
+
```js
|
|
38
|
+
const options = [
|
|
39
|
+
{ label: "first", value: 1 },
|
|
40
|
+
{ label: "second", value: [] },
|
|
41
|
+
{ label: "third", value: "3", "$color": "warning" }
|
|
42
|
+
]
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Usage
|
|
46
|
+
```svelte
|
|
47
|
+
<Radio {options} bind:value />
|
|
48
|
+
<Radio {options} bind:value={other} layout={Grid} gr-col="1fr 1fr" />
|
|
49
|
+
```
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import asuid from "@labyrinthos/asuid"
|
|
3
|
+
|
|
4
|
+
import wsx from "../wsx.mjs"
|
|
5
|
+
import { handler$ } from "../handler$.mjs"
|
|
6
|
+
|
|
7
|
+
import Flex from "../layout/flex.svelte"
|
|
8
|
+
|
|
9
|
+
export let options = []
|
|
10
|
+
export let layout = Flex
|
|
11
|
+
export let value
|
|
12
|
+
|
|
13
|
+
$: valueIndex = options.findIndex(item => item.value === value)
|
|
14
|
+
const set = handler$(
|
|
15
|
+
(newValue) => value = newValue
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
const name = asuid()
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<svelte:component this={layout} {...$$restProps}>
|
|
22
|
+
{#each options as {value, label, disabled, ...wind}, index (value)}
|
|
23
|
+
<label use:wsx={{"$toggle": true, ...wind}} {disabled}>
|
|
24
|
+
<span>{label}</span>
|
|
25
|
+
<input type="radio" on:input={set(value)} {name} checked={index === valueIndex} />
|
|
26
|
+
</label>
|
|
27
|
+
{/each}
|
|
28
|
+
</svelte:component>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Select
|
|
2
|
+
|
|
3
|
+
A wrapper for select elements to make them look nicer.
|
|
4
|
+
|
|
5
|
+
## Base
|
|
6
|
+
[Windstorm Labeled Control](https://axel669.github.io/lib.windstorm/#components-labeled control)
|
|
7
|
+
using a `<select>`
|
|
8
|
+
|
|
9
|
+
## Props
|
|
10
|
+
All [windstorm functions](https://axel669.github.io/lib.windstorm/#css-shorthands)
|
|
11
|
+
are supported.
|
|
12
|
+
|
|
13
|
+
- ### color `string`
|
|
14
|
+
Sets `$color`
|
|
15
|
+
- ### label `string`
|
|
16
|
+
The text to display as the label
|
|
17
|
+
- ### options `Array[Object]`
|
|
18
|
+
An array of options and groups to show in the select. Details below
|
|
19
|
+
- ### outline `bool`
|
|
20
|
+
Sets `$outline`
|
|
21
|
+
- ### value `any`
|
|
22
|
+
The value currently selected. Can be bound to react to selections or
|
|
23
|
+
change the current selection.
|
|
24
|
+
|
|
25
|
+
## Options
|
|
26
|
+
Each object in the options provided should be in one of 2 forms:
|
|
27
|
+
- `{ label, value }`
|
|
28
|
+
- `{ group }`
|
|
29
|
+
|
|
30
|
+
Items with a label and value are displayed as <option> tags in the select.
|
|
31
|
+
Items with a group defined are used to denote <optgroup> tags. Each option
|
|
32
|
+
after a `{ group }` item until another group item is seen (or the end of the
|
|
33
|
+
array) is put into the optgroup defined by the group item.
|
|
34
|
+
|
|
35
|
+
Labels and group names should be strings, but values can be any type.
|
|
36
|
+
|
|
37
|
+
## Usage
|
|
38
|
+
```js
|
|
39
|
+
// Results in:
|
|
40
|
+
// <option>first</option>
|
|
41
|
+
// <optgroup label="Not Numbers">
|
|
42
|
+
// <option>second</option>
|
|
43
|
+
// <option>third</option>
|
|
44
|
+
// </optgroup>
|
|
45
|
+
const options = [
|
|
46
|
+
{ label: "first", value: 1 },
|
|
47
|
+
{ group: "Not numbers" },
|
|
48
|
+
{ label: "second", value: "two" },
|
|
49
|
+
{ label: "third", value: [3] },
|
|
50
|
+
]
|
|
51
|
+
```
|
|
52
|
+
```svelte
|
|
53
|
+
<Select {options} bind:value label="Blep" />
|
|
54
|
+
<Select {options} bind:value color="warning" label="Why" />
|
|
55
|
+
```
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<script context="module">
|
|
2
|
+
const groupOptions = (options) => options.reduce(
|
|
3
|
+
({grouped, target = grouped}, item, pos) => {
|
|
4
|
+
const opt = { ... item, pos }
|
|
5
|
+
if (item.group === undefined) {
|
|
6
|
+
target.push(opt)
|
|
7
|
+
return { grouped, target }
|
|
8
|
+
}
|
|
9
|
+
const next = [opt]
|
|
10
|
+
grouped.push(next)
|
|
11
|
+
return { grouped, target: next }
|
|
12
|
+
},
|
|
13
|
+
{ grouped: [] }
|
|
14
|
+
).grouped
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<script>
|
|
18
|
+
import wsx from "../wsx.mjs"
|
|
19
|
+
|
|
20
|
+
export let options = []
|
|
21
|
+
export let value
|
|
22
|
+
export let color = "default"
|
|
23
|
+
export let outline = false
|
|
24
|
+
export let label = null
|
|
25
|
+
export let disabled = false
|
|
26
|
+
|
|
27
|
+
const update = (evt) => value = options[evt.target.value].value
|
|
28
|
+
|
|
29
|
+
$: indexValue = options.findIndex(item => item.value === value)
|
|
30
|
+
|
|
31
|
+
$: grouped = groupOptions(options)
|
|
32
|
+
|
|
33
|
+
$: wind = {
|
|
34
|
+
"$control": true,
|
|
35
|
+
"$outline": outline,
|
|
36
|
+
"$color": color,
|
|
37
|
+
...$$restProps,
|
|
38
|
+
}
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
<label use:wsx={wind}>
|
|
42
|
+
{#if label}
|
|
43
|
+
<span ws-x="$text">{label}</span>
|
|
44
|
+
{/if}
|
|
45
|
+
<select value={indexValue} on:input={update} {disabled}>
|
|
46
|
+
{#each grouped as item, index}
|
|
47
|
+
{#if Array.isArray(item) === false}
|
|
48
|
+
<option value={item.pos}>
|
|
49
|
+
{item.label}
|
|
50
|
+
</option>
|
|
51
|
+
{:else}
|
|
52
|
+
<optgroup label={item[0].group}>
|
|
53
|
+
{#each item.slice(1) as subitem, subindex}
|
|
54
|
+
<option value={subitem.pos}>
|
|
55
|
+
{subitem.label}
|
|
56
|
+
</option>
|
|
57
|
+
{/each}
|
|
58
|
+
</optgroup>
|
|
59
|
+
{/if}
|
|
60
|
+
{/each}
|
|
61
|
+
</select>
|
|
62
|
+
</label>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Tabs
|
|
2
|
+
|
|
3
|
+
It's tabs, everyone knows what tabs are at this point.
|
|
4
|
+
|
|
5
|
+
## Base
|
|
6
|
+
[Windstorm Tabs](https://axel669.github.io/lib.windstorm/#components-tabs)
|
|
7
|
+
|
|
8
|
+
## Props
|
|
9
|
+
All [windstorm functions](https://axel669.github.io/lib.windstorm/#css-shorthands)
|
|
10
|
+
are supported.
|
|
11
|
+
|
|
12
|
+
- ### color `string`
|
|
13
|
+
Sets `$color`
|
|
14
|
+
- ### options `Array[Object]`
|
|
15
|
+
An array of options where each item is `{ label, value }`. `label`
|
|
16
|
+
should be a string, `value` can be of any type.
|
|
17
|
+
- ### vertical `bool`
|
|
18
|
+
Sets `$vert`
|
|
19
|
+
- ### solid `bool`
|
|
20
|
+
Sets `$solid`
|
|
21
|
+
- ### value `any`
|
|
22
|
+
The value of the currently selected tab. Can be bound to react to
|
|
23
|
+
changes and set to control which tab is selected.
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
```js
|
|
27
|
+
const options = [
|
|
28
|
+
{ label: "Left", value: "left" },
|
|
29
|
+
{ label: "Right", value: 2 },
|
|
30
|
+
]
|
|
31
|
+
```
|
|
32
|
+
```svelte
|
|
33
|
+
<Tab {options} bind:value color="primary" />
|
|
34
|
+
<Tab {options} bind:value color="secondary" solid vertical />
|
|
35
|
+
```
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import wsx from "../wsx.mjs"
|
|
3
|
+
import { handler$ } from "../handler$.mjs"
|
|
4
|
+
|
|
5
|
+
export let color = "primary"
|
|
6
|
+
export let options = []
|
|
7
|
+
export let vertical = false
|
|
8
|
+
export let solid = false
|
|
9
|
+
export let value
|
|
10
|
+
|
|
11
|
+
$: index = options.findIndex(item => item.value === value)
|
|
12
|
+
|
|
13
|
+
const set = handler$(
|
|
14
|
+
(next) => {
|
|
15
|
+
if (value === next) {
|
|
16
|
+
return
|
|
17
|
+
}
|
|
18
|
+
value = next
|
|
19
|
+
}
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
$: wind = {
|
|
23
|
+
"@solid": solid,
|
|
24
|
+
"$color": color,
|
|
25
|
+
$vert: vertical,
|
|
26
|
+
...$$restProps,
|
|
27
|
+
}
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
31
|
+
<ws-tabs use:wsx={wind} role="tablist">
|
|
32
|
+
{#each options as tab, i}
|
|
33
|
+
<!-- svelte-ignore a11y-interactive-supports-focus -->
|
|
34
|
+
<ws-tab use:wsx={{"$tab-selected": index === i}}
|
|
35
|
+
on:click={set(tab.value)} role="tab">
|
|
36
|
+
{tab.label}
|
|
37
|
+
</ws-tab>
|
|
38
|
+
{/each}
|
|
39
|
+
</ws-tabs>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Toggle
|
|
2
|
+
|
|
3
|
+
The Toggle component is used to display checkboxes and switches.
|
|
4
|
+
|
|
5
|
+
## Base
|
|
6
|
+
[Windstorm Labeled Toggle](https://axel669.github.io/lib.windstorm/#components-labeled-toggle)
|
|
7
|
+
using a checkbox input
|
|
8
|
+
|
|
9
|
+
## Props
|
|
10
|
+
All [windstorm functions](https://axel669.github.io/lib.windstorm/#css-shorthands)
|
|
11
|
+
are supported.
|
|
12
|
+
|
|
13
|
+
- ### color `string`
|
|
14
|
+
Sets `$color`
|
|
15
|
+
- ### checkbox `bool`
|
|
16
|
+
If true, the toggle is displayed as a checkbox. Default is false
|
|
17
|
+
(shown as a switch)
|
|
18
|
+
- ### checked `bool`
|
|
19
|
+
Controls if the toggle is checked or not. Can be bound
|
|
20
|
+
- ### group
|
|
21
|
+
Used for binding, see the Svelte bind:group for details
|
|
22
|
+
- ### label `string`
|
|
23
|
+
The text to use for the label
|
|
24
|
+
- ### flat `bool`
|
|
25
|
+
Sets `$flat`
|
|
26
|
+
- ### reverse `bool`
|
|
27
|
+
If true, the input being toggled will be on the left instead of the
|
|
28
|
+
right. Default is false (label is on the left)
|
|
29
|
+
- ### value
|
|
30
|
+
Only used in conjunction with bind:group, see Svelte docs
|
|
31
|
+
|
|
32
|
+
## Usage
|
|
33
|
+
```svelte
|
|
34
|
+
<Toggle label="Active" bind:checked />
|
|
35
|
+
<Toggle label="Active" checkbox bind:checked />
|
|
36
|
+
<Toggle label="Active" checkbox reverse bind:checked />
|
|
37
|
+
<Toggle label="Active" checkbox flat color="danger" bind:checked />
|
|
38
|
+
```
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import wsx from "../wsx.mjs"
|
|
3
|
+
|
|
4
|
+
export let label = ""
|
|
5
|
+
export let color = "default"
|
|
6
|
+
export let checked = false
|
|
7
|
+
export let flat = false
|
|
8
|
+
export let value
|
|
9
|
+
export let group = []
|
|
10
|
+
export let checkbox = false
|
|
11
|
+
export let reverse = false
|
|
12
|
+
|
|
13
|
+
$: container = {
|
|
14
|
+
"$toggle": true,
|
|
15
|
+
"$flat": flat,
|
|
16
|
+
"$color": color,
|
|
17
|
+
"fl.dir": reverse ? "row-reverse" : false,
|
|
18
|
+
...$$restProps,
|
|
19
|
+
}
|
|
20
|
+
$: input = {
|
|
21
|
+
"$switch": checkbox === false
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const updateGroup = (checked) => {
|
|
25
|
+
if (checked === true) {
|
|
26
|
+
if (group.includes(value) === true) {
|
|
27
|
+
return
|
|
28
|
+
}
|
|
29
|
+
group = [...group, value]
|
|
30
|
+
return
|
|
31
|
+
}
|
|
32
|
+
if (group.includes(value) === false) {
|
|
33
|
+
return
|
|
34
|
+
}
|
|
35
|
+
group = group.filter(item => item !== value)
|
|
36
|
+
}
|
|
37
|
+
$: updateGroup(checked)
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<label use:wsx={container}>
|
|
41
|
+
<div>
|
|
42
|
+
<slot>
|
|
43
|
+
{label}
|
|
44
|
+
</slot>
|
|
45
|
+
</div>
|
|
46
|
+
<input type="checkbox" bind:checked use:wsx={input} />
|
|
47
|
+
</label>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Avatar
|
|
2
|
+
|
|
3
|
+
Displays an image or text in a circular container.
|
|
4
|
+
|
|
5
|
+
## Base
|
|
6
|
+
[Windstorm Avatar](https://axel669.github.io/lib.windstorm/#components-avatar)
|
|
7
|
+
|
|
8
|
+
## Props
|
|
9
|
+
All [windstorm functions](https://axel669.github.io/lib.windstorm/#css-shorthands)
|
|
10
|
+
are supported.
|
|
11
|
+
|
|
12
|
+
- ### alt `string`
|
|
13
|
+
Alt text for the image. Has no effect if image prop is not used.
|
|
14
|
+
- ### color `string`
|
|
15
|
+
Sets `$color`
|
|
16
|
+
- ### image `string`
|
|
17
|
+
An image url. If no url is provided the text property is displayed.
|
|
18
|
+
- ### text `string`
|
|
19
|
+
Text to show in the avatar area if image is not used.
|
|
20
|
+
|
|
21
|
+
## Example
|
|
22
|
+
```svelte
|
|
23
|
+
<Avatar image="url" />
|
|
24
|
+
<Avatar image="url" alt="text" />
|
|
25
|
+
<Avatar text="Hi" color="primary" />
|
|
26
|
+
```
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import wsx from "../wsx.mjs"
|
|
3
|
+
|
|
4
|
+
export let alt = ""
|
|
5
|
+
export let image = null
|
|
6
|
+
|
|
7
|
+
export let text = ""
|
|
8
|
+
|
|
9
|
+
export let color = false
|
|
10
|
+
|
|
11
|
+
$: wind = {
|
|
12
|
+
"$color": color,
|
|
13
|
+
...$$restProps
|
|
14
|
+
}
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<ws-avatar use:wsx={wind}>
|
|
18
|
+
{#if image !== null}
|
|
19
|
+
<img src={image} {alt} />
|
|
20
|
+
{:else}
|
|
21
|
+
{text}
|
|
22
|
+
{/if}
|
|
23
|
+
</ws-avatar>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Badge
|
|
2
|
+
Adds a small badge over the upper-right corner of some content.
|
|
3
|
+
|
|
4
|
+
## Base
|
|
5
|
+
[Windstorm Badge](https://axel669.github.io/lib.windstorm/#components-badge)
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
All [windstorm functions](https://axel669.github.io/lib.windstorm/#css-shorthands)
|
|
9
|
+
are supported.
|
|
10
|
+
|
|
11
|
+
- ### color `string`
|
|
12
|
+
Sets `$color`
|
|
13
|
+
- ### text `string`
|
|
14
|
+
The badge text.
|
|
15
|
+
|
|
16
|
+
## Example
|
|
17
|
+
```svelte
|
|
18
|
+
<Badge text="100">
|
|
19
|
+
Unread Messages
|
|
20
|
+
</Badge>
|
|
21
|
+
<Badge text="1k+" color="warning">
|
|
22
|
+
<button>Clickable Content</button>
|
|
23
|
+
</Badge>
|
|
24
|
+
```
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Chip
|
|
2
|
+
Shows a small piece of information that is separate from the surrounding
|
|
3
|
+
info and optionally allows interaction.
|
|
4
|
+
|
|
5
|
+
## Base
|
|
6
|
+
[Windstorm Chip](https://axel669.github.io/lib.windstorm/#components-chip)
|
|
7
|
+
|
|
8
|
+
## Props
|
|
9
|
+
All [windstorm functions](https://axel669.github.io/lib.windstorm/#css-shorthands)
|
|
10
|
+
are supported.
|
|
11
|
+
|
|
12
|
+
- ### color `string`
|
|
13
|
+
Sets `$color`
|
|
14
|
+
- ### clickable `bool`
|
|
15
|
+
If true, the chip will have the button ripple effect when clicked.
|
|
16
|
+
- ### fill `bool`
|
|
17
|
+
If true, sets $fill on the chip. If false $outline is set instead.
|
|
18
|
+
|
|
19
|
+
## Events
|
|
20
|
+
- click
|
|
21
|
+
|
|
22
|
+
## Example
|
|
23
|
+
```svelte
|
|
24
|
+
Emails:
|
|
25
|
+
<Chip clickable>admin@site.com</Chip>
|
|
26
|
+
<Chip clickable color="warning">weirdge@site.com</Chip>
|
|
27
|
+
<Chip color="primary" fill>required@site.io</Chip>
|
|
28
|
+
```
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import wsx from "../wsx.mjs"
|
|
3
|
+
import variant from "../variant.mjs"
|
|
4
|
+
|
|
5
|
+
export let color = "default"
|
|
6
|
+
export let clickable = false
|
|
7
|
+
|
|
8
|
+
export let fill = false
|
|
9
|
+
export let outline = false
|
|
10
|
+
export let flat = false
|
|
11
|
+
|
|
12
|
+
$: type = variant({ fill, flat, outline }, "$outline")
|
|
13
|
+
|
|
14
|
+
$: wind = {
|
|
15
|
+
[type]: true,
|
|
16
|
+
"$color": color,
|
|
17
|
+
$click: clickable,
|
|
18
|
+
...$$restProps
|
|
19
|
+
}
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
23
|
+
<!-- svelte-ignore a11y-interactive-supports-focus -->
|
|
24
|
+
<ws-chip use:wsx={wind} on:click role="button">
|
|
25
|
+
<slot />
|
|
26
|
+
</ws-chip>
|
|
File without changes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import wsx from "
|
|
2
|
+
import wsx from "../wsx.mjs"
|
|
3
3
|
|
|
4
4
|
export let label
|
|
5
5
|
export let outline
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
export let open = false
|
|
8
8
|
|
|
9
9
|
$: wind = {
|
|
10
|
-
$color: color,
|
|
11
|
-
"
|
|
10
|
+
"$color": color,
|
|
11
|
+
"$outline": outline,
|
|
12
12
|
...$$restProps,
|
|
13
13
|
}
|
|
14
14
|
</script>
|
|
@@ -0,0 +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
|
+
## Base
|
|
7
|
+
[Windstorm Popover](https://axel669.github.io/lib.windstorm/#components-popover)
|
|
8
|
+
|
|
9
|
+
## Props
|
|
10
|
+
All [windstorm functions](https://axel669.github.io/lib.windstorm/#css-shorthands)
|
|
11
|
+
are supported.
|
|
12
|
+
|
|
13
|
+
## Variables
|
|
14
|
+
- show
|
|
15
|
+
- hide
|
|
16
|
+
The Popover exposes 2 variables for use: `show` and `hide`. These functions
|
|
17
|
+
are given to the content so that it can control when to display the popover
|
|
18
|
+
content without needing to bind to the parent.
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
```svelte
|
|
22
|
+
<Popover let:show let:hide>
|
|
23
|
+
<Button on:click={show}>
|
|
24
|
+
Show
|
|
25
|
+
</Button>
|
|
26
|
+
<div ws-x="inset-x[0px] y[0px] h[100px] bg[teal]" slot="content">
|
|
27
|
+
<Button on:click={hide}>
|
|
28
|
+
Hide
|
|
29
|
+
</Button>
|
|
30
|
+
</div>
|
|
31
|
+
</Popover>
|
|
32
|
+
```
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { fade } from "svelte/transition"
|
|
3
|
+
import wsx from "../wsx.mjs"
|
|
4
|
+
|
|
5
|
+
let visible = false
|
|
6
|
+
const show = () => visible = true
|
|
7
|
+
const hide = () => visible = false
|
|
8
|
+
const anim = { duration: 250 }
|
|
9
|
+
|
|
10
|
+
$: wind = {
|
|
11
|
+
$show: true,
|
|
12
|
+
...$$restProps,
|
|
13
|
+
}
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<ws-popover use:wsx={wind}>
|
|
17
|
+
<slot {show} />
|
|
18
|
+
{#if visible}
|
|
19
|
+
<wind-content slot="content" ws-x="inset[0px]" transition:fade={anim}>
|
|
20
|
+
<slot name="content" {hide} />
|
|
21
|
+
</wind-content>
|
|
22
|
+
{/if}
|
|
23
|
+
</ws-popover>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Progress
|
|
2
|
+
|
|
3
|
+
Displays progress bar with an optional label.
|
|
4
|
+
|
|
5
|
+
## Base
|
|
6
|
+
[Windstorm Progress Bar](https://axel669.github.io/lib.windstorm/#components-progress-bar)
|
|
7
|
+
|
|
8
|
+
## Props
|
|
9
|
+
All [windstorm functions](https://axel669.github.io/lib.windstorm/#css-shorthands)
|
|
10
|
+
are supported.
|
|
11
|
+
|
|
12
|
+
- ### color `string`
|
|
13
|
+
Sets `$color`
|
|
14
|
+
- ### label `string`
|
|
15
|
+
The label for the bar
|
|
16
|
+
- ### max `number`
|
|
17
|
+
Sets the max value for the progress bar. Default is 1
|
|
18
|
+
- ### outline `bool`
|
|
19
|
+
Sets `$outline`
|
|
20
|
+
- ### row `bool`
|
|
21
|
+
Sets `$row`
|
|
22
|
+
- ### value `number`
|
|
23
|
+
Sets the value of the progress bar. Combined with max to determine how
|
|
24
|
+
filled the bar is.
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
```svelte
|
|
28
|
+
<Progress color="primary" value={0.1} />
|
|
29
|
+
<Progress color="primary" value={5} max={10} />
|
|
30
|
+
```
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import wsx from "../wsx.mjs"
|
|
3
|
+
|
|
4
|
+
export let value = 0
|
|
5
|
+
export let max = 1
|
|
6
|
+
export let color = "default"
|
|
7
|
+
export let outline = false
|
|
8
|
+
export let row = false
|
|
9
|
+
export let label = null
|
|
10
|
+
|
|
11
|
+
$: wind = {
|
|
12
|
+
"@progress": true,
|
|
13
|
+
"$outline": outline,
|
|
14
|
+
"$color": color,
|
|
15
|
+
$row: row,
|
|
16
|
+
...$$restProps,
|
|
17
|
+
}
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<label use:wsx={wind}>
|
|
21
|
+
{#if label}
|
|
22
|
+
<span ws-x="$text t-ws[nowrap]">{label}</span>
|
|
23
|
+
{/if}
|
|
24
|
+
<progress {value} {max} />
|
|
25
|
+
</label>
|