@axel669/zephyr 0.1.1

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.
Files changed (45) hide show
  1. package/LICENSE +21 -0
  2. package/package.json +32 -0
  3. package/readme.md +44 -0
  4. package/src/avatar.svelte +54 -0
  5. package/src/badge.svelte +40 -0
  6. package/src/button.svelte +80 -0
  7. package/src/chip.svelte +53 -0
  8. package/src/composed/data-table.svelte +150 -0
  9. package/src/composed/entry-button.svelte +66 -0
  10. package/src/composed/toast/message.svelte +44 -0
  11. package/src/composed/toast.svelte +108 -0
  12. package/src/dialog.svelte +53 -0
  13. package/src/drawer.svelte +121 -0
  14. package/src/flex.svelte +57 -0
  15. package/src/grid.svelte +66 -0
  16. package/src/handler$.mjs +68 -0
  17. package/src/icon.svelte +34 -0
  18. package/src/index.mjs +85 -0
  19. package/src/inline-dialog.svelte +23 -0
  20. package/src/input/area.svelte +97 -0
  21. package/src/input/elems.mjs +7 -0
  22. package/src/input/email.svelte +102 -0
  23. package/src/input/file.svelte +81 -0
  24. package/src/input/number.svelte +102 -0
  25. package/src/input/password.svelte +99 -0
  26. package/src/input/search.svelte +102 -0
  27. package/src/input/text.svelte +102 -0
  28. package/src/link.svelte +62 -0
  29. package/src/modal.svelte +68 -0
  30. package/src/notification.svelte +57 -0
  31. package/src/paper.svelte +114 -0
  32. package/src/popover.svelte +60 -0
  33. package/src/progress.svelte +60 -0
  34. package/src/radio.svelte +82 -0
  35. package/src/screen.svelte +69 -0
  36. package/src/select.svelte +121 -0
  37. package/src/table.svelte +69 -0
  38. package/src/tabs.svelte +77 -0
  39. package/src/text.svelte +49 -0
  40. package/src/titlebar.svelte +69 -0
  41. package/src/toaster.svelte +42 -0
  42. package/src/toggle.svelte +90 -0
  43. package/src/tooltip.svelte +45 -0
  44. package/src/vars.mjs +61 -0
  45. package/src/wsx.mjs +45 -0
@@ -0,0 +1,102 @@
1
+ <script>
2
+ /*md
3
+ [@] Components/Input/Email
4
+
5
+ # Input.Email
6
+
7
+ A multiline text input component.
8
+
9
+ ## Base
10
+ [Windstorm Labled Control](https://axel669.github.io/lib.windstorm/#components-labeled-control)
11
+ using an input with type="email"
12
+
13
+ ## Props
14
+ All [windstorm functions](https://axel669.github.io/lib.windstorm/#css-shorthands)
15
+ are supported.
16
+
17
+ - ### color `string`
18
+ Sets `$color`
19
+ - ### error `string`
20
+ Shows an error message under the input
21
+ - ### flat `bool`
22
+ Sets `@flat`
23
+ - ### hint `string`
24
+ Shows a hint under the label. If no label is provided, the hint will not
25
+ be shown either
26
+ - ### label `string`
27
+ The label for the input
28
+ - ### transform `function`
29
+ If given, it will transform the text value from the input and set the
30
+ `tvalue` to the result
31
+ - ### tvalue
32
+ Value that can be bound to as the output of the transform function.
33
+ Setting has no effect
34
+ - ### validate `function`
35
+ If given, will check the transformed output against a validation
36
+ criteria and store the result in `valid`
37
+ - ### valid `bool`
38
+ Value that can be bound to as the output of the validation function.
39
+ Setting has no effect
40
+ - ### value `string`
41
+ The value of the textarea, can be bound to
42
+
43
+ ## Functions
44
+ - focus()\\
45
+ Focuses the input
46
+
47
+ ## Usage
48
+ ```js
49
+ import { Input } from "@axel669/svelte-wind"
50
+ ```svelte
51
+ <Input.Email bind:value />
52
+ <Input.Email bind:value color="primary" />
53
+ <Input.Email bind:value label="Wat" hint="Blep"/>
54
+ <Input.Email bind:value bind:tvalue transform={txt => txt.toLowerCase()} />
55
+ <Input.Email bind:value bind:valid validate={txt => txt.indexOf("a") > 0} />
56
+ ```
57
+ */
58
+
59
+ import wsx from "../wsx.mjs"
60
+
61
+ export let flat = false
62
+ export let label
63
+ export let color = "default"
64
+ export let error = null
65
+ export let hint = null
66
+
67
+ export let value = ""
68
+
69
+ export let transform = i => i
70
+ export let tvalue
71
+ export let validate = () => true
72
+ export let valid
73
+
74
+ let input = null
75
+ export const focus = () => input.focus()
76
+
77
+ $: wind = {
78
+ "@flat": flat,
79
+ "@control": true,
80
+ $color: color,
81
+ ...$$restProps,
82
+ }
83
+
84
+ $: tvalue = transform(value ?? "")
85
+ $: valid = validate(tvalue)
86
+ </script>
87
+
88
+ <label use:wsx={wind} ws-error={error}>
89
+ {#if label}
90
+ <span ws-x="$text" ws-hint={hint}>{label}</span>
91
+ {/if}
92
+ <input {...$$restProps}
93
+ type="email"
94
+ bind:value
95
+ on:focus
96
+ on:blur
97
+ bind:this={input}
98
+ />
99
+
100
+ <slot name="start" />
101
+ <slot name="end" />
102
+ </label>
@@ -0,0 +1,81 @@
1
+ <script>
2
+ /*md
3
+ [@] Components/Input/File
4
+
5
+ # Input.File
6
+
7
+ A multiline text input component.
8
+
9
+ ## Base
10
+ [Windstorm Labled Control](https://axel669.github.io/lib.windstorm/#components-labeled-control)
11
+ using an input with type="file"
12
+
13
+ ## Props
14
+ All [windstorm functions](https://axel669.github.io/lib.windstorm/#css-shorthands)
15
+ are supported.
16
+
17
+ - ### color `string`
18
+ Sets `$color`
19
+ - ### error `string`
20
+ Shows an error message under the input
21
+ - ### flat `bool`
22
+ Sets `@flat`
23
+ - ### hint `string`
24
+ Shows a hint under the label. If no label is provided, the hint will not
25
+ be shown either
26
+ - ### label `string`
27
+ The label for the input
28
+ - ### validate `function`
29
+ If given, will check the transformed output against a validation
30
+ criteria and store the result in `valid`
31
+ - ### valid `bool`
32
+ Value that can be bound to as the output of the validation function.
33
+ Setting has no effect
34
+ - ### value `string`
35
+ The value of the textarea, can be bound to
36
+
37
+ ## Usage
38
+ ```js
39
+ import { Input } from "@axel669/svelte-wind"
40
+ ```svelte
41
+ <Input.File bind:value />
42
+ <Input.File bind:value color="primary" />
43
+ <Input.File bind:value label="Wat" hint="Blep"/>
44
+ <Input.File bind:value bind:valid validate={file => file[0].type !== "text"} />
45
+ ```
46
+ */
47
+
48
+ import wsx from "../wsx.mjs"
49
+
50
+ export let flat = false
51
+ export let label
52
+ export let color = "default"
53
+ export let error = null
54
+ export let hint = null
55
+
56
+ export let value
57
+
58
+ export let validate = () => true
59
+ export let valid
60
+
61
+ const handler = (evt) => value = [...evt.target.files]
62
+
63
+ $: wind = {
64
+ "@flat": flat,
65
+ "@control": true,
66
+ $color: color,
67
+ ...$$restProps,
68
+ }
69
+
70
+ $: valid = validate(value)
71
+ </script>
72
+
73
+ <label use:wsx={wind} ws-error={error}>
74
+ {#if label}
75
+ <span ws-x="$text" ws-hint={hint}>{label}</span>
76
+ {/if}
77
+ <input {...$$restProps} type="file" on:input={handler} />
78
+
79
+ <slot name="start" />
80
+ <slot name="end" />
81
+ </label>
@@ -0,0 +1,102 @@
1
+ <script>
2
+ /*md
3
+ [@] Components/Input/Number
4
+
5
+ # Input.Number
6
+
7
+ A multiline text input component.
8
+
9
+ ## Base
10
+ [Windstorm Labled Control](https://axel669.github.io/lib.windstorm/#components-labeled-control)
11
+ using an input with type="number"
12
+
13
+ ## Props
14
+ All [windstorm functions](https://axel669.github.io/lib.windstorm/#css-shorthands)
15
+ are supported.
16
+
17
+ - ### color `string`
18
+ Sets `$color`
19
+ - ### error `string`
20
+ Shows an error message under the input
21
+ - ### flat `bool`
22
+ Sets `@flat`
23
+ - ### hint `string`
24
+ Shows a hint under the label. If no label is provided, the hint will not
25
+ be shown either
26
+ - ### label `string`
27
+ The label for the input
28
+ - ### transform `function`
29
+ If given, it will transform the text value from the input and set the
30
+ `tvalue` to the result
31
+ - ### tvalue
32
+ Value that can be bound to as the output of the transform function.
33
+ Setting has no effect
34
+ - ### validate `function`
35
+ If given, will check the transformed output against a validation
36
+ criteria and store the result in `valid`
37
+ - ### valid `bool`
38
+ Value that can be bound to as the output of the validation function.
39
+ Setting has no effect
40
+ - ### value `string`
41
+ The value of the textarea, can be bound to
42
+
43
+ ## Functions
44
+ - focus()\\
45
+ Focuses the input
46
+
47
+ ## Usage
48
+ ```js
49
+ import { Input } from "@axel669/svelte-wind"
50
+ ```svelte
51
+ <Input.Number bind:value />
52
+ <Input.Number bind:value color="primary" />
53
+ <Input.Number bind:value label="Wat" hint="Blep"/>
54
+ <Input.Number bind:value bind:tvalue transform={parseInt} />
55
+ <Input.Number bind:value transform={parseInt} bind:valid validate={value => value > 0} />
56
+ ```
57
+ */
58
+
59
+ import wsx from "../wsx.mjs"
60
+
61
+ export let flat = false
62
+ export let label
63
+ export let color = "default"
64
+ export let error = null
65
+ export let hint = null
66
+
67
+ export let value = ""
68
+
69
+ export let transform = i => i
70
+ export let tvalue
71
+ export let validate = () => true
72
+ export let valid
73
+
74
+ let input = null
75
+ export const focus = () => input.focus()
76
+
77
+ $: wind = {
78
+ "@flat": flat,
79
+ "@control": true,
80
+ $color: color,
81
+ ...$$restProps,
82
+ }
83
+
84
+ $: tvalue = transform(value ?? "")
85
+ $: valid = validate(tvalue)
86
+ </script>
87
+
88
+ <label use:wsx={wind} ws-error={error}>
89
+ {#if label}
90
+ <span ws-x="$text" ws-hint={hint}>{label}</span>
91
+ {/if}
92
+ <input {...$$restProps}
93
+ type="number"
94
+ bind:value
95
+ on:focus
96
+ on:blur
97
+ bind:this={input}
98
+ />
99
+
100
+ <slot name="start" />
101
+ <slot name="end" />
102
+ </label>
@@ -0,0 +1,99 @@
1
+ <script>
2
+ /*md
3
+ [@] Components/Input/Password
4
+
5
+ # Input.Password
6
+
7
+ A multiline text input component.
8
+
9
+ ## Base
10
+ [Windstorm Labled Control](https://axel669.github.io/lib.windstorm/#components-labeled-control)
11
+ using an input with type="password"
12
+
13
+ ## Props
14
+ All [windstorm functions](https://axel669.github.io/lib.windstorm/#css-shorthands)
15
+ are supported.
16
+
17
+ - ### color `string`
18
+ Sets `$color`
19
+ - ### error `string`
20
+ Shows an error message under the input
21
+ - ### flat `bool`
22
+ Sets `@flat`
23
+ - ### hint `string`
24
+ Shows a hint under the label. If no label is provided, the hint will not
25
+ be shown either
26
+ - ### label `string`
27
+ The label for the input
28
+ - ### transform `function`
29
+ If given, it will transform the text value from the input and set the
30
+ `tvalue` to the result
31
+ - ### tvalue
32
+ Value that can be bound to as the output of the transform function.
33
+ Setting has no effect
34
+ - ### validate `function`
35
+ If given, will check the transformed output against a validation
36
+ criteria and store the result in `valid`
37
+ - ### valid `bool`
38
+ Value that can be bound to as the output of the validation function.
39
+ Setting has no effect
40
+ - ### value `string`
41
+ The value of the textarea, can be bound to
42
+
43
+ ## Functions
44
+ - focus()\\
45
+ Focuses the textarea
46
+
47
+ ## Usage
48
+ ```js
49
+ import { Input } from "@axel669/svelte-wind"
50
+ ```
51
+ ```svelte
52
+ <Input.Password bind:value />
53
+ <Input.Password bind:value color="primary" />
54
+ <Input.Password bind:value label="Wat" hint="Blep"/>
55
+ <Input.Password bind:value bind:valid validate={txt => txt.indexOf("a") > 0} />
56
+ ```
57
+ */
58
+
59
+ import wsx from "../wsx.mjs"
60
+
61
+ export let flat = false
62
+ export let label
63
+ export let color = "default"
64
+ export let error = null
65
+ export let hint = null
66
+
67
+ export let value = ""
68
+
69
+ export let validate = () => true
70
+ export let valid
71
+
72
+ let input = null
73
+ export const focus = () => input.focus()
74
+
75
+ $: wind = {
76
+ "@flat": flat,
77
+ "@control": true,
78
+ $color: color,
79
+ ...$$restProps,
80
+ }
81
+
82
+ $: valid = validate(value)
83
+ </script>
84
+
85
+ <label use:wsx={wind} ws-error={error}>
86
+ {#if label}
87
+ <span ws-x="$text" ws-hint={hint}>{label}</span>
88
+ {/if}
89
+ <input {...$$restProps}
90
+ type="password"
91
+ bind:value
92
+ on:focus
93
+ on:blur
94
+ bind:this={input}
95
+ />
96
+
97
+ <slot name="start" />
98
+ <slot name="end" />
99
+ </label>
@@ -0,0 +1,102 @@
1
+ <script>
2
+ /*md
3
+ [@] Components/Input/Search
4
+
5
+ # Input.Search
6
+
7
+ A multiline text input component.
8
+
9
+ ## Base
10
+ [Windstorm Labled Control](https://axel669.github.io/lib.windstorm/#components-labeled-control)
11
+ using an input with type="search"
12
+
13
+ ## Props
14
+ All [windstorm functions](https://axel669.github.io/lib.windstorm/#css-shorthands)
15
+ are supported.
16
+
17
+ - ### color `string`
18
+ Sets `$color`
19
+ - ### error `string`
20
+ Shows an error message under the input
21
+ - ### flat `bool`
22
+ Sets `@flat`
23
+ - ### hint `string`
24
+ Shows a hint under the label. If no label is provided, the hint will not
25
+ be shown either
26
+ - ### label `string`
27
+ The label for the input
28
+ - ### transform `function`
29
+ If given, it will transform the text value from the input and set the
30
+ `tvalue` to the result
31
+ - ### tvalue
32
+ Value that can be bound to as the output of the transform function.
33
+ Setting has no effect
34
+ - ### validate `function`
35
+ If given, will check the transformed output against a validation
36
+ criteria and store the result in `valid`
37
+ - ### valid `bool`
38
+ Value that can be bound to as the output of the validation function.
39
+ Setting has no effect
40
+ - ### value `string`
41
+ The value of the textarea, can be bound to
42
+
43
+ ## Functions
44
+ - focus()\\
45
+ Focuses the input
46
+
47
+ ## Usage
48
+ ```js
49
+ import { Input } from "@axel669/svelte-wind"
50
+ ```svelte
51
+ <Input.Search bind:value />
52
+ <Input.Search bind:value color="primary" />
53
+ <Input.Search bind:value label="Wat" hint="Blep"/>
54
+ <Input.Search bind:value bind:tvalue transform={txt => txt.toLowerCase()} />
55
+ <Input.Search bind:value bind:valid validate={txt => txt.indexOf("a") > 0} />
56
+ ```
57
+ */
58
+
59
+ import wsx from "../wsx.mjs"
60
+
61
+ export let flat = false
62
+ export let label
63
+ export let color = "default"
64
+ export let error = null
65
+ export let hint = null
66
+
67
+ export let value = ""
68
+
69
+ export let transform = i => i
70
+ export let tvalue
71
+ export let validate = () => true
72
+ export let valid
73
+
74
+ let input = null
75
+ export const focus = () => input.focus()
76
+
77
+ $: wind = {
78
+ "@flat": flat,
79
+ "@control": true,
80
+ $color: color,
81
+ ...$$restProps,
82
+ }
83
+
84
+ $: tvalue = transform(value ?? "")
85
+ $: valid = validate(tvalue)
86
+ </script>
87
+
88
+ <label use:wsx={wind} ws-error={error}>
89
+ {#if label}
90
+ <span ws-x="$text" ws-hint={hint}>{label}</span>
91
+ {/if}
92
+ <input {...$$restProps}
93
+ type="search"
94
+ bind:value
95
+ on:focus
96
+ on:blur
97
+ bind:this={input}
98
+ />
99
+
100
+ <slot name="start" />
101
+ <slot name="end" />
102
+ </label>
@@ -0,0 +1,102 @@
1
+ <script>
2
+ /*md
3
+ [@] Components/Input/Text
4
+
5
+ # Input.Text
6
+
7
+ A multiline text input component.
8
+
9
+ ## Base
10
+ [Windstorm Labled Control](https://axel669.github.io/lib.windstorm/#components-labeled-control)
11
+ using an input with type="text"
12
+
13
+ ## Props
14
+ All [windstorm functions](https://axel669.github.io/lib.windstorm/#css-shorthands)
15
+ are supported.
16
+
17
+ - ### color `string`
18
+ Sets `$color`
19
+ - ### error `string`
20
+ Shows an error message under the input
21
+ - ### flat `bool`
22
+ Sets `@flat`
23
+ - ### hint `string`
24
+ Shows a hint under the label. If no label is provided, the hint will not
25
+ be shown either
26
+ - ### label `string`
27
+ The label for the input
28
+ - ### transform `function`
29
+ If given, it will transform the text value from the input and set the
30
+ `tvalue` to the result
31
+ - ### tvalue
32
+ Value that can be bound to as the output of the transform function.
33
+ Setting has no effect
34
+ - ### validate `function`
35
+ If given, will check the transformed output against a validation
36
+ criteria and store the result in `valid`
37
+ - ### valid `bool`
38
+ Value that can be bound to as the output of the validation function.
39
+ Setting has no effect
40
+ - ### value `string`
41
+ The value of the textarea, can be bound to
42
+
43
+ ## Functions
44
+ - focus()\\
45
+ Focuses the input
46
+
47
+ ## Usage
48
+ ```js
49
+ import { Input } from "@axel669/svelte-wind"
50
+ ```svelte
51
+ <Input.Text bind:value />
52
+ <Input.Text bind:value color="primary" />
53
+ <Input.Text bind:value label="Wat" hint="Blep"/>
54
+ <Input.Text bind:value bind:tvalue transform={txt => txt.toLowerCase()} />
55
+ <Input.Text bind:value bind:valid validate={txt => txt.indexOf("a") > 0} />
56
+ ```
57
+ */
58
+
59
+ import wsx from "../wsx.mjs"
60
+
61
+ export let flat = false
62
+ export let label
63
+ export let color = "default"
64
+ export let error = null
65
+ export let hint = null
66
+
67
+ export let value = ""
68
+
69
+ export let transform = i => i
70
+ export let tvalue
71
+ export let validate = () => true
72
+ export let valid
73
+
74
+ let input = null
75
+ export const focus = () => input.focus()
76
+
77
+ $: wind = {
78
+ "@flat": flat,
79
+ "@control": true,
80
+ $color: color,
81
+ ...$$restProps,
82
+ }
83
+
84
+ $: tvalue = transform(value ?? "")
85
+ $: valid = validate(tvalue)
86
+ </script>
87
+
88
+ <label use:wsx={wind} ws-error={error}>
89
+ {#if label}
90
+ <span ws-x="$text" ws-hint={hint}>{label}</span>
91
+ {/if}
92
+ <input {...$$restProps}
93
+ type="text"
94
+ bind:value
95
+ on:focus
96
+ on:blur
97
+ bind:this={input}
98
+ />
99
+
100
+ <slot name="start" />
101
+ <slot name="end" />
102
+ </label>
@@ -0,0 +1,62 @@
1
+ <script>
2
+ /*md
3
+ [@] Components/Link
4
+
5
+ # Link
6
+
7
+ Themed and customizale `<a>` tag component.
8
+
9
+ ## Base
10
+ [Windstorm Link](https://axel669.github.io/lib.windstorm/#components-link)
11
+
12
+ ## Props
13
+ All [windstorm functions](https://axel669.github.io/lib.windstorm/#css-shorthands)
14
+ are supported.
15
+
16
+ - ### button `string`
17
+ If true, the link will be styled like a button
18
+ - ### color `string`
19
+ Sets the color of the button. Applies to both regular links and button
20
+ style links.
21
+ - ### href `string`
22
+ Sets the href attribute.
23
+ - ### rel `string`
24
+ Sets the rel attribute.
25
+ - ### target `string`
26
+ Sets the target attribute
27
+ - ### variant `string`
28
+ Sets the link-button type to `@<variant>` (ex: "flat" -> `@flat`).
29
+ Default variant is "flat". Currently supports "flat", "fill", "outline".
30
+
31
+ ## Usage
32
+ ```svelte
33
+ <Link color="primary" href="test" target="_blank">
34
+ Test
35
+ </Link>
36
+ <Link color="primary" href="logout" button variant="outline">
37
+ Logout
38
+ </Link>
39
+ ```
40
+ */
41
+
42
+ import wsx from "./wsx.mjs"
43
+
44
+ export let button = false
45
+ export let variant = "flat"
46
+ export let color = "default"
47
+
48
+ export let href = ""
49
+ export let rel = "noreferrer"
50
+ export let target = null
51
+
52
+ $: wind = {
53
+ "@button": button,
54
+ [`@${variant}`]: true,
55
+ $color: color,
56
+ ...$$restProps
57
+ }
58
+ </script>
59
+
60
+ <a {href} {target} {rel} use:wsx={wind}>
61
+ <slot />
62
+ </a>