@axel669/zephyr 0.3.4-beta.0 → 0.3.8

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 (86) hide show
  1. package/package.json +2 -2
  2. package/readme.md +63 -63
  3. package/src/async/button.md +27 -27
  4. package/src/async/button.svelte +29 -29
  5. package/src/async/load-zone.md +42 -42
  6. package/src/async/load-zone.svelte +22 -22
  7. package/src/composed/data-table/th.md +21 -21
  8. package/src/composed/data-table/th.svelte +61 -61
  9. package/src/composed/data-table.md +86 -86
  10. package/src/composed/data-table.svelte +199 -199
  11. package/src/composed/entry-button.md +44 -44
  12. package/src/composed/entry-button.svelte +31 -31
  13. package/src/composed/table-functions.js +13 -13
  14. package/src/composed/toast/message.svelte +56 -56
  15. package/src/composed/toast.md +45 -45
  16. package/src/composed/toast.svelte +70 -70
  17. package/src/control/button.md +41 -41
  18. package/src/control/button.svelte +27 -27
  19. package/src/control/input.md +87 -87
  20. package/src/control/input.svelte +109 -109
  21. package/src/control/label.md +48 -48
  22. package/src/control/label.svelte +38 -38
  23. package/src/control/link.md +50 -50
  24. package/src/control/link.svelte +32 -32
  25. package/src/control/radio.md +58 -58
  26. package/src/control/radio.svelte +28 -28
  27. package/src/control/select.md +70 -70
  28. package/src/control/select.svelte +64 -64
  29. package/src/control/tabs.md +47 -47
  30. package/src/control/tabs.svelte +43 -43
  31. package/src/control/toggle.md +61 -61
  32. package/src/control/toggle.svelte +49 -49
  33. package/src/data-display/avatar.md +36 -36
  34. package/src/data-display/avatar.svelte +25 -25
  35. package/src/data-display/badge.md +30 -30
  36. package/src/data-display/badge.svelte +14 -14
  37. package/src/data-display/chip.md +36 -36
  38. package/src/data-display/chip.svelte +28 -28
  39. package/src/data-display/details.md +42 -42
  40. package/src/data-display/details.svelte +25 -25
  41. package/src/data-display/popover.md +32 -32
  42. package/src/data-display/popover.svelte +25 -25
  43. package/src/data-display/progress.md +46 -46
  44. package/src/data-display/progress.svelte +27 -27
  45. package/src/data-display/table.md +59 -59
  46. package/src/data-display/table.svelte +38 -38
  47. package/src/data-display/tooltip.md +29 -29
  48. package/src/data-display/tooltip.svelte +17 -17
  49. package/src/dialogs/alert.md +42 -42
  50. package/src/dialogs/alert.svelte +34 -34
  51. package/src/dialogs/confirm.md +56 -56
  52. package/src/dialogs/confirm.svelte +45 -45
  53. package/src/functions.md +108 -108
  54. package/src/handler$.mjs +20 -20
  55. package/src/hash.js +14 -14
  56. package/src/index.mjs +53 -53
  57. package/src/info/icon.md +21 -21
  58. package/src/info/icon.svelte +9 -9
  59. package/src/info/notification.md +36 -36
  60. package/src/info/notification.svelte +16 -16
  61. package/src/info/titlebar.md +75 -75
  62. package/src/info/titlebar.svelte +18 -18
  63. package/src/info/toaster.md +26 -26
  64. package/src/info/toaster.svelte +14 -14
  65. package/src/inline-dialog.svelte +23 -23
  66. package/src/layout/dialog.md +43 -43
  67. package/src/layout/dialog.svelte +26 -26
  68. package/src/layout/drawer.md +70 -70
  69. package/src/layout/drawer.svelte +49 -49
  70. package/src/layout/flex.md +43 -43
  71. package/src/layout/flex.svelte +26 -26
  72. package/src/layout/grid.md +61 -61
  73. package/src/layout/grid.svelte +30 -30
  74. package/src/layout/modal.md +50 -50
  75. package/src/layout/modal.svelte +60 -60
  76. package/src/layout/paper.md +94 -94
  77. package/src/layout/paper.svelte +47 -47
  78. package/src/layout/screen.md +33 -33
  79. package/src/layout/screen.svelte +34 -34
  80. package/src/spinner/circle-spinner.svelte +15 -15
  81. package/src/spinner/hexagon-spinner.svelte +15 -15
  82. package/src/spinner/spinners.md +22 -22
  83. package/src/text.md +34 -34
  84. package/src/text.svelte +22 -22
  85. package/src/variant.mjs +12 -12
  86. package/src/wsx.mjs +24 -24
@@ -1,87 +1,87 @@
1
- # Input
2
- A component that wraps the text-based input tags. Includes optional outline,
3
- label, hint text, error showing, input validation, input transformation, and
4
- browser level autocomplete.
5
-
6
- ## Props
7
-
8
- ### autoCompleteOptions
9
- An array of options to show for auto complete. Uses the browser `datalist`
10
- element to create the auto complete.
11
-
12
- ### color
13
- Sets the $color macro.
14
-
15
- ### disabled
16
- Disables the input.
17
-
18
- ### error
19
- If set, shows an error message under the input.
20
-
21
- ### flat
22
- If true, the input will not have a border. Default is false (with a border).
23
-
24
- ### hint
25
- Shows a hint under the label of the input.
26
-
27
- ### type
28
- The type of input. Default to "text".
29
-
30
- ### value
31
- The value of the input. Can be bound the same way a normal text input value is
32
- bound in Svelte.
33
-
34
- ### transform
35
- A function to transform the value of the input automatically. Results are put
36
- into the tvalue prop.
37
-
38
- ### tvalue
39
- The transformed value of the input. Binding should only be used to react to
40
- the value as it will be overriden while a user is typing into the input.
41
-
42
- ### validate
43
- A function to determine if the value of the input is valid. Results are put into
44
- the `valid` prop. If a transform function is provided, the transformed value
45
- is given to the validation function.
46
-
47
- ### valid
48
- The result of the validation function. Binding should only be used to react to
49
- the value.
50
-
51
- ## Instance Functions
52
-
53
- ### focus
54
- Focuses the input.
55
-
56
- ## Slots
57
-
58
- ### end
59
- Puts an element at the end of the input.
60
-
61
- ### start
62
- Puts an element at the start of the input.
63
-
64
- ## Example
65
-
66
- ```svelte
67
- <script>
68
- import { Input } from "@axel669/zephyr"
69
-
70
- let name = ""
71
- let ageText = ""
72
- let age = 0
73
- let ageValid = false
74
-
75
- $: ageError = ageValid ? "Invalid Age" : null
76
- </script>
77
-
78
- <Input bind:value={name} label="Name" />
79
- <Input
80
- bind:value={ageText}
81
- transform={v => parseInt(v)}
82
- bind:tvalue={age}
83
- validate={age => age > 0}
84
- bind:valid={ageValid}
85
- error={ageError}
86
- />
87
- ```
1
+ # Input
2
+ A component that wraps the text-based input tags. Includes optional outline,
3
+ label, hint text, error showing, input validation, input transformation, and
4
+ browser level autocomplete.
5
+
6
+ ## Props
7
+
8
+ ### autoCompleteOptions
9
+ An array of options to show for auto complete. Uses the browser `datalist`
10
+ element to create the auto complete.
11
+
12
+ ### color
13
+ Sets the $color macro.
14
+
15
+ ### disabled
16
+ Disables the input.
17
+
18
+ ### error
19
+ If set, shows an error message under the input.
20
+
21
+ ### flat
22
+ If true, the input will not have a border. Default is false (with a border).
23
+
24
+ ### hint
25
+ Shows a hint under the label of the input.
26
+
27
+ ### type
28
+ The type of input. Default to "text".
29
+
30
+ ### value
31
+ The value of the input. Can be bound the same way a normal text input value is
32
+ bound in Svelte.
33
+
34
+ ### transform
35
+ A function to transform the value of the input automatically. Results are put
36
+ into the tvalue prop.
37
+
38
+ ### tvalue
39
+ The transformed value of the input. Binding should only be used to react to
40
+ the value as it will be overriden while a user is typing into the input.
41
+
42
+ ### validate
43
+ A function to determine if the value of the input is valid. Results are put into
44
+ the `valid` prop. If a transform function is provided, the transformed value
45
+ is given to the validation function.
46
+
47
+ ### valid
48
+ The result of the validation function. Binding should only be used to react to
49
+ the value.
50
+
51
+ ## Instance Functions
52
+
53
+ ### focus
54
+ Focuses the input.
55
+
56
+ ## Slots
57
+
58
+ ### end
59
+ Puts an element at the end of the input.
60
+
61
+ ### start
62
+ Puts an element at the start of the input.
63
+
64
+ ## Example
65
+
66
+ ```svelte
67
+ <script>
68
+ import { Input } from "@axel669/zephyr"
69
+
70
+ let name = ""
71
+ let ageText = ""
72
+ let age = 0
73
+ let ageValid = false
74
+
75
+ $: ageError = ageValid ? "Invalid Age" : null
76
+ </script>
77
+
78
+ <Input bind:value={name} label="Name" />
79
+ <Input
80
+ bind:value={ageText}
81
+ transform={v => parseInt(v)}
82
+ bind:tvalue={age}
83
+ validate={age => age > 0}
84
+ bind:valid={ageValid}
85
+ error={ageError}
86
+ />
87
+ ```
@@ -1,109 +1,109 @@
1
- <svelte:options immutable />
2
-
3
- <script context="module">
4
- const parseNumeric = (value) => {
5
- if (value === "") {
6
- return null
7
- }
8
- return parseFloat(value)
9
- }
10
-
11
- const diff = (type, value, internal) => {
12
- if ((type !== "number" && type !== "range") || typeof value === "string") {
13
- return value !== internal
14
- }
15
- return parseFloat(internal) !== value
16
- }
17
- </script>
18
-
19
- <script>
20
- import wsx from "../wsx.mjs"
21
-
22
- export let type = "text"
23
-
24
- export let flat = false
25
- export let label
26
- export let color = "@default"
27
- export let error = null
28
- export let hint = null
29
- export let disabled
30
-
31
- export let value = ""
32
- export let autocompleteOptions = null
33
-
34
- export let transform = i => i
35
- export let tvalue
36
- export let validate = () => true
37
- export let valid
38
-
39
- let input = null
40
- let internalValue = value
41
- export const focus = () => input.focus()
42
-
43
- const id =
44
- (autocompleteOptions === null)
45
- ? null
46
- : `${Math.random().toString(16)}_${Date.now()}`
47
-
48
- $: isNumeric = (type === "number" || type === "range")
49
- $: if (diff(type, value, internalValue) === true) {
50
- internalValue = value
51
- }
52
-
53
- const update = (evt) => {
54
- internalValue = evt.target.value
55
- value = (isNumeric === true) ? parseNumeric(internalValue) : internalValue
56
- tvalue = transform(value)
57
- valid = validate(tvalue)
58
- }
59
-
60
- $: restKeys = Object.keys($$restProps)
61
- $: props = restKeys.reduce(
62
- (props, key) => {
63
- const [target, name] =
64
- (key.startsWith("i-") === true)
65
- ? [props.input, key.slice(2)]
66
- : [props.wind, key]
67
- target[name] = $$restProps[key]
68
- return props
69
- },
70
- {wind: {}, input: {}}
71
- )
72
-
73
- $: wind = {
74
- "$flat": flat,
75
- "@control": true,
76
- "$color": color,
77
- ...props.wind,
78
- }
79
-
80
- $: tag = (type === "area") ? "textarea" : "input"
81
- </script>
82
-
83
- <label use:wsx={wind} ws-error={error}>
84
- {#if label}
85
- <span use:wsx={{ slot: "label-text" }} ws-hint={hint}>{label}</span>
86
- {/if}
87
- <svelte:element
88
- this={tag}
89
- {...props.input}
90
- {disabled}
91
- {type}
92
- value={internalValue}
93
- list={id}
94
- on:focus
95
- on:blur
96
- on:input={update}
97
- bind:this={input}
98
- />
99
-
100
- <slot name="start" />
101
- <slot name="end" />
102
- {#if autocompleteOptions !== null}
103
- <datalist {id}>
104
- {#each autocompleteOptions as value}
105
- <option {value} />
106
- {/each}
107
- </datalist>
108
- {/if}
109
- </label>
1
+ <svelte:options immutable />
2
+
3
+ <script context="module">
4
+ const parseNumeric = (value) => {
5
+ if (value === "") {
6
+ return null
7
+ }
8
+ return parseFloat(value)
9
+ }
10
+
11
+ const diff = (type, value, internal) => {
12
+ if ((type !== "number" && type !== "range") || typeof value === "string") {
13
+ return value !== internal
14
+ }
15
+ return parseFloat(internal) !== value
16
+ }
17
+ </script>
18
+
19
+ <script>
20
+ import wsx from "../wsx.mjs"
21
+
22
+ export let type = "text"
23
+
24
+ export let flat = false
25
+ export let label
26
+ export let color = "@default"
27
+ export let error = null
28
+ export let hint = null
29
+ export let disabled
30
+
31
+ export let value = ""
32
+ export let autocompleteOptions = null
33
+
34
+ export let transform = i => i
35
+ export let tvalue
36
+ export let validate = () => true
37
+ export let valid
38
+
39
+ let input = null
40
+ let internalValue = value
41
+ export const focus = () => input.focus()
42
+
43
+ const id =
44
+ (autocompleteOptions === null)
45
+ ? null
46
+ : `${Math.random().toString(16)}_${Date.now()}`
47
+
48
+ $: isNumeric = (type === "number" || type === "range")
49
+ $: if (diff(type, value, internalValue) === true) {
50
+ internalValue = value
51
+ }
52
+
53
+ const update = (evt) => {
54
+ internalValue = evt.target.value
55
+ value = (isNumeric === true) ? parseNumeric(internalValue) : internalValue
56
+ tvalue = transform(value)
57
+ valid = validate(tvalue)
58
+ }
59
+
60
+ $: restKeys = Object.keys($$restProps)
61
+ $: props = restKeys.reduce(
62
+ (props, key) => {
63
+ const [target, name] =
64
+ (key.startsWith("i-") === true)
65
+ ? [props.input, key.slice(2)]
66
+ : [props.wind, key]
67
+ target[name] = $$restProps[key]
68
+ return props
69
+ },
70
+ {wind: {}, input: {}}
71
+ )
72
+
73
+ $: wind = {
74
+ "$flat": flat,
75
+ "@control": true,
76
+ "$color": color,
77
+ ...props.wind,
78
+ }
79
+
80
+ $: tag = (type === "area") ? "textarea" : "input"
81
+ </script>
82
+
83
+ <label use:wsx={wind} ws-error={error}>
84
+ {#if label}
85
+ <span use:wsx={{ slot: "label-text" }} ws-hint={hint}>{label}</span>
86
+ {/if}
87
+ <svelte:element
88
+ this={tag}
89
+ {...props.input}
90
+ {disabled}
91
+ {type}
92
+ value={internalValue}
93
+ list={id}
94
+ on:focus
95
+ on:blur
96
+ on:input={update}
97
+ bind:this={input}
98
+ />
99
+
100
+ <slot name="start" />
101
+ <slot name="end" />
102
+ {#if autocompleteOptions !== null}
103
+ <datalist {id}>
104
+ {#each autocompleteOptions as value}
105
+ <option {value} />
106
+ {/each}
107
+ </datalist>
108
+ {/if}
109
+ </label>
@@ -1,48 +1,48 @@
1
- # Label
2
- The label component is a wrapper around a `<label>` element.
3
-
4
- ## Props
5
-
6
- ### button
7
- `bool`
8
-
9
- If true, the label will have the button appearance.
10
-
11
- ### color
12
- `string`
13
-
14
- Sets `$color`
15
-
16
- ### compact
17
- `bool`
18
-
19
- If true, will make the label button be more compact. No effect is `button` is
20
- `false`.
21
-
22
- ### disabled
23
- `bool`
24
-
25
- Disables the label.
26
-
27
- ### fill / outline / flat
28
- `bool`
29
-
30
- Sets the button variant of the label when `button` is `true`.
31
-
32
- ### for
33
- `string`
34
-
35
- [Label for attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label#for)
36
-
37
- ## Example
38
-
39
- ```svelte
40
- <script>
41
- import { Label } from "@axel669/zephyr"
42
- </script>
43
-
44
- <Label for="checkbox">Toggle Checkbox</Label>
45
- <Label for="checkbox" button color="primary" fill>
46
- Open Menu
47
- </Label>
48
- ```
1
+ # Label
2
+ The label component is a wrapper around a `<label>` element.
3
+
4
+ ## Props
5
+
6
+ ### button
7
+ `bool`
8
+
9
+ If true, the label will have the button appearance.
10
+
11
+ ### color
12
+ `string`
13
+
14
+ Sets `$color`
15
+
16
+ ### compact
17
+ `bool`
18
+
19
+ If true, will make the label button be more compact. No effect is `button` is
20
+ `false`.
21
+
22
+ ### disabled
23
+ `bool`
24
+
25
+ Disables the label.
26
+
27
+ ### fill / outline / flat
28
+ `bool`
29
+
30
+ Sets the button variant of the label when `button` is `true`.
31
+
32
+ ### for
33
+ `string`
34
+
35
+ [Label for attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label#for)
36
+
37
+ ## Example
38
+
39
+ ```svelte
40
+ <script>
41
+ import { Label } from "@axel669/zephyr"
42
+ </script>
43
+
44
+ <Label for="checkbox">Toggle Checkbox</Label>
45
+ <Label for="checkbox" button color="primary" fill>
46
+ Open Menu
47
+ </Label>
48
+ ```
@@ -1,38 +1,38 @@
1
- <svelte:options immutable />
2
-
3
- <script>
4
- import wsx from "../wsx.mjs"
5
- import variant from "../variant.mjs"
6
-
7
- export let color = false
8
- export let compact = false
9
- export let disabled
10
-
11
- export let fill = false
12
- export let outline = false
13
- export let flat = false
14
-
15
- let _for = ""
16
- export { _for as for }
17
- export let button = false
18
-
19
- $: type = variant({ fill, outline, flat })
20
- $: baseStyles =
21
- (button === true)
22
- ? {
23
- "@button": true,
24
- [type]: true,
25
- "$color": color,
26
- $compact: compact,
27
- }
28
- : {}
29
-
30
- $: wind = {
31
- ...baseStyles,
32
- ...$$restProps
33
- }
34
- </script>
35
-
36
- <label use:wsx={wind} {disabled} for={_for}>
37
- <slot />
38
- </label>
1
+ <svelte:options immutable />
2
+
3
+ <script>
4
+ import wsx from "../wsx.mjs"
5
+ import variant from "../variant.mjs"
6
+
7
+ export let color = false
8
+ export let compact = false
9
+ export let disabled
10
+
11
+ export let fill = false
12
+ export let outline = false
13
+ export let flat = false
14
+
15
+ let _for = ""
16
+ export { _for as for }
17
+ export let button = false
18
+
19
+ $: type = variant({ fill, outline, flat })
20
+ $: baseStyles =
21
+ (button === true)
22
+ ? {
23
+ "@button": true,
24
+ [type]: true,
25
+ "$color": color,
26
+ $compact: compact,
27
+ }
28
+ : {}
29
+
30
+ $: wind = {
31
+ ...baseStyles,
32
+ ...$$restProps
33
+ }
34
+ </script>
35
+
36
+ <label use:wsx={wind} {disabled} for={_for}>
37
+ <slot />
38
+ </label>
@@ -1,50 +1,50 @@
1
- # Link
2
-
3
- Themed and customizale `<a>` tag component.
4
-
5
- ## Props
6
-
7
- ### button `string`
8
-
9
- If true, the link will be styled like a button
10
-
11
- ### color
12
- `string`
13
-
14
- Sets the color of the button. Applies to both regular links and button
15
- style links.
16
-
17
- ### href
18
- `string`
19
-
20
- Sets the href attribute.
21
-
22
- ### rel
23
- `string`
24
-
25
- Sets the rel attribute.
26
-
27
- ### target
28
- `string`
29
-
30
- Sets the target attribute.
31
-
32
- ### fill / outline / flat
33
- `bool`
34
-
35
- Sets the link-button type to `$fill` if fill is true, `$outline` if outline
36
- is true, or `$flat` if neither is true.
37
-
38
- ## Example
39
- ```svelte
40
- <script>
41
- import { Link } from "@axel669/zephyr"
42
- </script>
43
-
44
- <Link color="primary" href="test" target="_blank">
45
- Test
46
- </Link>
47
- <Link color="primary" href="logout" button outline>
48
- Logout
49
- </Link>
50
- ```
1
+ # Link
2
+
3
+ Themed and customizale `<a>` tag component.
4
+
5
+ ## Props
6
+
7
+ ### button `string`
8
+
9
+ If true, the link will be styled like a button
10
+
11
+ ### color
12
+ `string`
13
+
14
+ Sets the color of the button. Applies to both regular links and button
15
+ style links.
16
+
17
+ ### href
18
+ `string`
19
+
20
+ Sets the href attribute.
21
+
22
+ ### rel
23
+ `string`
24
+
25
+ Sets the rel attribute.
26
+
27
+ ### target
28
+ `string`
29
+
30
+ Sets the target attribute.
31
+
32
+ ### fill / outline / flat
33
+ `bool`
34
+
35
+ Sets the link-button type to `$fill` if fill is true, `$outline` if outline
36
+ is true, or `$flat` if neither is true.
37
+
38
+ ## Example
39
+ ```svelte
40
+ <script>
41
+ import { Link } from "@axel669/zephyr"
42
+ </script>
43
+
44
+ <Link color="primary" href="test" target="_blank">
45
+ Test
46
+ </Link>
47
+ <Link color="primary" href="logout" button outline>
48
+ Logout
49
+ </Link>
50
+ ```