@axel669/zephyr 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -5
- package/src/button.svelte +3 -2
- package/src/circle-spinner.svelte +13 -0
- package/src/composed/entry-button.svelte +4 -2
- package/src/dialogs/alert.svelte +32 -0
- package/src/dialogs/confirm.svelte +43 -0
- package/src/flex.svelte +3 -3
- package/src/hexagon-spinner.svelte +13 -0
- package/src/index.mjs +6 -0
- package/src/input/area.svelte +2 -1
- package/src/input/email.svelte +2 -0
- package/src/input/file.svelte +2 -1
- package/src/input/number.svelte +2 -0
- package/src/input/password.svelte +2 -0
- package/src/input/search.svelte +2 -0
- package/src/input/text.svelte +2 -0
- package/src/modal.svelte +5 -0
- package/src/paper.svelte +22 -9
- package/src/radio.svelte +2 -2
- package/src/select.svelte +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axel669/zephyr",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "src/index.mjs",
|
|
6
6
|
"type": "module",
|
|
@@ -12,10 +12,8 @@
|
|
|
12
12
|
"author": "",
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@axel669/windstorm": "
|
|
16
|
-
"@labyrinthos/asuid": "^0.2.0"
|
|
17
|
-
},
|
|
18
|
-
"peerDependencies": {
|
|
15
|
+
"@axel669/windstorm": "0.1.13",
|
|
16
|
+
"@labyrinthos/asuid": "^0.2.0",
|
|
19
17
|
"svelte": "^3.58.0"
|
|
20
18
|
},
|
|
21
19
|
"devDependencies": {
|
package/src/button.svelte
CHANGED
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
export let color = "default"
|
|
55
55
|
export let compact = false
|
|
56
56
|
export let variant = "flat"
|
|
57
|
+
export let disabled
|
|
57
58
|
|
|
58
59
|
let _for = ""
|
|
59
60
|
export { _for as for }
|
|
@@ -70,11 +71,11 @@
|
|
|
70
71
|
|
|
71
72
|
{#if label === true}
|
|
72
73
|
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
73
|
-
<label use:wsx={wind} for={_for} on:click|stopPropagation>
|
|
74
|
+
<label use:wsx={wind} {disabled} for={_for} on:click|stopPropagation>
|
|
74
75
|
<slot />
|
|
75
76
|
</label>
|
|
76
77
|
{:else}
|
|
77
|
-
<button use:wsx={wind} on:click|stopPropagation>
|
|
78
|
+
<button use:wsx={wind} {disabled} on:click|stopPropagation>
|
|
78
79
|
<slot />
|
|
79
80
|
</button>
|
|
80
81
|
{/if}
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
- ### component
|
|
14
14
|
The component to show when clicked
|
|
15
15
|
- ### props
|
|
16
|
-
The props to pass to the component when it is shown
|
|
16
|
+
The props to pass to the component when it is shown, or a function that
|
|
17
|
+
generates the props when called
|
|
17
18
|
- ### this
|
|
18
19
|
The wrapper for the component. Default is Modal but any component that
|
|
19
20
|
has the same interface as Modal will work
|
|
@@ -53,7 +54,8 @@
|
|
|
53
54
|
let element = null
|
|
54
55
|
const open = handler$(
|
|
55
56
|
async (props) => {
|
|
56
|
-
const
|
|
57
|
+
const elemProps = (typeof props === "function") ? props() : props
|
|
58
|
+
const result = await element.show(elemProps)
|
|
57
59
|
send("entry", result)
|
|
58
60
|
}
|
|
59
61
|
)
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import Button from "../button.svelte"
|
|
3
|
+
import Dialog from "../dialog.svelte"
|
|
4
|
+
import Icon from "../icon.svelte"
|
|
5
|
+
import Text from "../text.svelte"
|
|
6
|
+
import Titlebar from "../titlebar.svelte"
|
|
7
|
+
|
|
8
|
+
export let close
|
|
9
|
+
export let title = "Alert"
|
|
10
|
+
export let icon
|
|
11
|
+
export let message
|
|
12
|
+
export let okText = "OK"
|
|
13
|
+
export let color = "primary"
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<Dialog card {color}>
|
|
17
|
+
<Titlebar slot="header" {color}>
|
|
18
|
+
<Text title slot="title">
|
|
19
|
+
<Icon name={icon}>
|
|
20
|
+
{title}
|
|
21
|
+
</Icon>
|
|
22
|
+
</Text>
|
|
23
|
+
</Titlebar>
|
|
24
|
+
|
|
25
|
+
<Text>
|
|
26
|
+
{message}
|
|
27
|
+
</Text>
|
|
28
|
+
|
|
29
|
+
<Button slot="footer" on:click={close} {color}>
|
|
30
|
+
{okText}
|
|
31
|
+
</Button>
|
|
32
|
+
</Dialog>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import Button from "../button.svelte"
|
|
3
|
+
import Dialog from "../dialog.svelte"
|
|
4
|
+
import Grid from "../grid.svelte"
|
|
5
|
+
import Icon from "../icon.svelte"
|
|
6
|
+
import Text from "../text.svelte"
|
|
7
|
+
import Titlebar from "../titlebar.svelte"
|
|
8
|
+
|
|
9
|
+
import { handler$ } from "../handler$.mjs"
|
|
10
|
+
|
|
11
|
+
export let close
|
|
12
|
+
export let title = "Confirm"
|
|
13
|
+
export let icon
|
|
14
|
+
export let message
|
|
15
|
+
export let okText = "OK"
|
|
16
|
+
export let cancelText = "Cancel"
|
|
17
|
+
export let color = "primary"
|
|
18
|
+
|
|
19
|
+
const cls = handler$(close)
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<Dialog card {color}>
|
|
23
|
+
<Titlebar slot="header" {color}>
|
|
24
|
+
<Text title slot="title">
|
|
25
|
+
<Icon name={icon}>
|
|
26
|
+
{title}
|
|
27
|
+
</Icon>
|
|
28
|
+
</Text>
|
|
29
|
+
</Titlebar>
|
|
30
|
+
|
|
31
|
+
<Text>
|
|
32
|
+
{message}
|
|
33
|
+
</Text>
|
|
34
|
+
|
|
35
|
+
<Grid cols="1fr 1fr" slot="footer" pad="0px">
|
|
36
|
+
<Button on:click={cls(false)} color="danger">
|
|
37
|
+
{cancelText}
|
|
38
|
+
</Button>
|
|
39
|
+
<Button on:click={cls(true)} color="secondary">
|
|
40
|
+
{okText}
|
|
41
|
+
</Button>
|
|
42
|
+
</Grid>
|
|
43
|
+
</Dialog>
|
package/src/flex.svelte
CHANGED
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
- ### gap `string`
|
|
21
21
|
Sets `gap`
|
|
22
22
|
- ### cross `string`
|
|
23
|
-
Sets `fl-cr-a`
|
|
23
|
+
Sets `fl-cr-a`, default is `"stretch"`
|
|
24
24
|
- ### main `string`
|
|
25
|
-
Sets `fl-m-a`
|
|
25
|
+
Sets `fl-m-a`, default is `"start"`
|
|
26
26
|
|
|
27
27
|
## Usage
|
|
28
28
|
```svelte
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
export let direction = false
|
|
40
40
|
export let pad = false
|
|
41
41
|
export let gap = false
|
|
42
|
-
export let cross = "
|
|
42
|
+
export let cross = "stretch"
|
|
43
43
|
export let main = "start"
|
|
44
44
|
|
|
45
45
|
$: wind = {
|
package/src/index.mjs
CHANGED
|
@@ -72,6 +72,12 @@ export { default as Toaster } from "./toaster.svelte"
|
|
|
72
72
|
export { default as Toggle } from "./toggle.svelte"
|
|
73
73
|
export { default as Tooltip } from "./tooltip.svelte"
|
|
74
74
|
|
|
75
|
+
export { default as CircleSpinner } from "./circle-spinner.svelte"
|
|
76
|
+
export { default as HexagonSpinner } from "./hexagon-spinner.svelte"
|
|
77
|
+
|
|
78
|
+
export { default as Alert } from "./dialogs/alert.svelte"
|
|
79
|
+
export { default as Confirm } from "./dialogs/confirm.svelte"
|
|
80
|
+
|
|
75
81
|
export { default as DataTable } from "./composed/data-table.svelte"
|
|
76
82
|
export { default as EntryButton } from "./composed/entry-button.svelte"
|
|
77
83
|
export { default as Toast } from "./composed/toast.svelte"
|
package/src/input/area.svelte
CHANGED
|
@@ -64,6 +64,7 @@
|
|
|
64
64
|
export let color = "default"
|
|
65
65
|
export let error = null
|
|
66
66
|
export let hint = null
|
|
67
|
+
export let disabled
|
|
67
68
|
|
|
68
69
|
export let value = ""
|
|
69
70
|
|
|
@@ -90,7 +91,7 @@
|
|
|
90
91
|
{#if label}
|
|
91
92
|
<span ws-x="$text" ws-hint={hint}>{label}</span>
|
|
92
93
|
{/if}
|
|
93
|
-
<textarea {...$$restProps} bind:value on:focus on:blur bind:this={area} />
|
|
94
|
+
<textarea {disabled} {...$$restProps} bind:value on:focus on:blur bind:this={area} />
|
|
94
95
|
|
|
95
96
|
<slot name="start" />
|
|
96
97
|
<slot name="end" />
|
package/src/input/email.svelte
CHANGED
|
@@ -63,6 +63,7 @@
|
|
|
63
63
|
export let color = "default"
|
|
64
64
|
export let error = null
|
|
65
65
|
export let hint = null
|
|
66
|
+
export let disabled
|
|
66
67
|
|
|
67
68
|
export let value = ""
|
|
68
69
|
|
|
@@ -91,6 +92,7 @@
|
|
|
91
92
|
{/if}
|
|
92
93
|
<input {...$$restProps}
|
|
93
94
|
type="email"
|
|
95
|
+
{disabled}
|
|
94
96
|
bind:value
|
|
95
97
|
on:focus
|
|
96
98
|
on:blur
|
package/src/input/file.svelte
CHANGED
|
@@ -52,6 +52,7 @@
|
|
|
52
52
|
export let color = "default"
|
|
53
53
|
export let error = null
|
|
54
54
|
export let hint = null
|
|
55
|
+
export let disabled
|
|
55
56
|
|
|
56
57
|
export let value
|
|
57
58
|
|
|
@@ -74,7 +75,7 @@
|
|
|
74
75
|
{#if label}
|
|
75
76
|
<span ws-x="$text" ws-hint={hint}>{label}</span>
|
|
76
77
|
{/if}
|
|
77
|
-
<input {...$$restProps} type="file" on:input={handler} />
|
|
78
|
+
<input {disabled} {...$$restProps} type="file" on:input={handler} />
|
|
78
79
|
|
|
79
80
|
<slot name="start" />
|
|
80
81
|
<slot name="end" />
|
package/src/input/number.svelte
CHANGED
|
@@ -63,6 +63,7 @@
|
|
|
63
63
|
export let color = "default"
|
|
64
64
|
export let error = null
|
|
65
65
|
export let hint = null
|
|
66
|
+
export let disabled
|
|
66
67
|
|
|
67
68
|
export let value = ""
|
|
68
69
|
|
|
@@ -91,6 +92,7 @@
|
|
|
91
92
|
{/if}
|
|
92
93
|
<input {...$$restProps}
|
|
93
94
|
type="number"
|
|
95
|
+
{disabled}
|
|
94
96
|
bind:value
|
|
95
97
|
on:focus
|
|
96
98
|
on:blur
|
|
@@ -63,6 +63,7 @@
|
|
|
63
63
|
export let color = "default"
|
|
64
64
|
export let error = null
|
|
65
65
|
export let hint = null
|
|
66
|
+
export let disabled
|
|
66
67
|
|
|
67
68
|
export let value = ""
|
|
68
69
|
|
|
@@ -88,6 +89,7 @@
|
|
|
88
89
|
{/if}
|
|
89
90
|
<input {...$$restProps}
|
|
90
91
|
type="password"
|
|
92
|
+
{disabled}
|
|
91
93
|
bind:value
|
|
92
94
|
on:focus
|
|
93
95
|
on:blur
|
package/src/input/search.svelte
CHANGED
|
@@ -63,6 +63,7 @@
|
|
|
63
63
|
export let color = "default"
|
|
64
64
|
export let error = null
|
|
65
65
|
export let hint = null
|
|
66
|
+
export let disabled
|
|
66
67
|
|
|
67
68
|
export let value = ""
|
|
68
69
|
|
|
@@ -90,6 +91,7 @@
|
|
|
90
91
|
<span ws-x="$text" ws-hint={hint}>{label}</span>
|
|
91
92
|
{/if}
|
|
92
93
|
<input {...$$restProps}
|
|
94
|
+
{disabled}
|
|
93
95
|
type="search"
|
|
94
96
|
bind:value
|
|
95
97
|
on:focus
|
package/src/input/text.svelte
CHANGED
|
@@ -63,6 +63,7 @@
|
|
|
63
63
|
export let color = "default"
|
|
64
64
|
export let error = null
|
|
65
65
|
export let hint = null
|
|
66
|
+
export let disabled
|
|
66
67
|
|
|
67
68
|
export let value = ""
|
|
68
69
|
|
|
@@ -91,6 +92,7 @@
|
|
|
91
92
|
{/if}
|
|
92
93
|
<input {...$$restProps}
|
|
93
94
|
type="text"
|
|
95
|
+
{disabled}
|
|
94
96
|
bind:value
|
|
95
97
|
on:focus
|
|
96
98
|
on:blur
|
package/src/modal.svelte
CHANGED
|
@@ -14,6 +14,11 @@
|
|
|
14
14
|
that can be called to hide the component again. `close` can also be given
|
|
15
15
|
an argument that will be used as the promise value from `show`.
|
|
16
16
|
|
|
17
|
+
If a component that a modal displays exports a `cancel` function, then
|
|
18
|
+
clicking the modal area outside the displayed component will call that
|
|
19
|
+
`cancel` function, allowing any modal component to decide when/if it is
|
|
20
|
+
closes in response to that event.
|
|
21
|
+
|
|
17
22
|
## Props
|
|
18
23
|
Because the Modal does not render content of its own, it does not support
|
|
19
24
|
any wind functions.
|
package/src/paper.svelte
CHANGED
|
@@ -27,8 +27,10 @@
|
|
|
27
27
|
Sets the layout the card will use to display content. Default is Flex.
|
|
28
28
|
- ### scrollable `bool`
|
|
29
29
|
Sets `over[auto]` on the layout component
|
|
30
|
-
- ###
|
|
31
|
-
|
|
30
|
+
- ### l-*
|
|
31
|
+
Any prop that is prefixed with `l-` will be passed to the layout
|
|
32
|
+
component, with the remaining props acting as the normal wind functions
|
|
33
|
+
on the paper itself
|
|
32
34
|
|
|
33
35
|
## Slots
|
|
34
36
|
- ### header
|
|
@@ -57,7 +59,7 @@
|
|
|
57
59
|
<div>Content 2</div>
|
|
58
60
|
<div>Content 3</div>
|
|
59
61
|
</Paper>
|
|
60
|
-
<Paper>
|
|
62
|
+
<Paper l-pad="0px" m="4px">
|
|
61
63
|
<Titlebar slot="header">
|
|
62
64
|
<Text slot="title" title>
|
|
63
65
|
Some Screen
|
|
@@ -86,18 +88,29 @@
|
|
|
86
88
|
export let card = false
|
|
87
89
|
export let square = false
|
|
88
90
|
export let layout = Flex
|
|
89
|
-
export let scrollable =
|
|
90
|
-
|
|
91
|
+
export let scrollable = true
|
|
92
|
+
|
|
93
|
+
$: props = Object.entries($$restProps).reduce(
|
|
94
|
+
(p, [key, value]) => {
|
|
95
|
+
const [target, name] =
|
|
96
|
+
(key.startsWith("l-") === true)
|
|
97
|
+
? [ p.layout, key.slice(2) ]
|
|
98
|
+
: [ p.paper, key ]
|
|
99
|
+
target[name] = value
|
|
100
|
+
return p
|
|
101
|
+
},
|
|
102
|
+
{ layout: {}, paper: {} }
|
|
103
|
+
)
|
|
91
104
|
|
|
92
|
-
$:
|
|
105
|
+
$: layoutProps = {
|
|
93
106
|
over: scrollable ? "auto" : false,
|
|
94
|
-
...
|
|
107
|
+
...props.layout,
|
|
95
108
|
}
|
|
96
109
|
$: wind = {
|
|
97
110
|
$color: color,
|
|
98
111
|
"@outline": card,
|
|
99
112
|
r: square && "0px",
|
|
100
|
-
|
|
113
|
+
...props.paper,
|
|
101
114
|
}
|
|
102
115
|
</script>
|
|
103
116
|
|
|
@@ -106,7 +119,7 @@
|
|
|
106
119
|
{#if $$slots.content}
|
|
107
120
|
<slot name="content" slot="content" />
|
|
108
121
|
{:else}
|
|
109
|
-
<svelte:component this={layout} {...
|
|
122
|
+
<svelte:component this={layout} {...layoutProps} slot="content">
|
|
110
123
|
<slot />
|
|
111
124
|
</svelte:component>
|
|
112
125
|
{/if}
|
package/src/radio.svelte
CHANGED
|
@@ -73,8 +73,8 @@
|
|
|
73
73
|
</script>
|
|
74
74
|
|
|
75
75
|
<svelte:component this={layout} {...$$restProps}>
|
|
76
|
-
{#each options as {value, label, ...wind}, index (value)}
|
|
77
|
-
<label use:wsx={{"@toggle": true, ...wind}}>
|
|
76
|
+
{#each options as {value, label, disabled, ...wind}, index (value)}
|
|
77
|
+
<label use:wsx={{"@toggle": true, ...wind}} {disabled}>
|
|
78
78
|
<span>{label}</span>
|
|
79
79
|
<input type="radio" on:input={set(value)} {name} checked={index === valueIndex} />
|
|
80
80
|
</label>
|
package/src/select.svelte
CHANGED
|
@@ -82,6 +82,7 @@
|
|
|
82
82
|
export let color = "default"
|
|
83
83
|
export let outline = false
|
|
84
84
|
export let label = null
|
|
85
|
+
export let disabled = false
|
|
85
86
|
|
|
86
87
|
const update = (evt) => value = options[evt.target.value].value
|
|
87
88
|
|
|
@@ -101,7 +102,7 @@
|
|
|
101
102
|
{#if label}
|
|
102
103
|
<span ws-x="$text">{label}</span>
|
|
103
104
|
{/if}
|
|
104
|
-
<select value={indexValue} on:input={update}>
|
|
105
|
+
<select value={indexValue} on:input={update} {disabled}>
|
|
105
106
|
{#each grouped as item, index}
|
|
106
107
|
{#if Array.isArray(item) === false}
|
|
107
108
|
<option value={item.pos}>
|