@axel669/zephyr 0.1.16 → 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.
Files changed (113) hide show
  1. package/LICENSE +21 -21
  2. package/package.json +34 -30
  3. package/readme.md +55 -44
  4. package/src/composed/data-table/th.svelte +60 -0
  5. package/src/composed/data-table.md +71 -0
  6. package/src/composed/data-table.svelte +136 -150
  7. package/src/composed/entry-button.md +34 -0
  8. package/src/composed/entry-button.svelte +29 -68
  9. package/src/composed/table-functions.js +13 -0
  10. package/src/composed/toast/message.svelte +44 -44
  11. package/src/composed/toast.md +36 -0
  12. package/src/composed/toast.svelte +68 -108
  13. package/src/control/button.md +37 -0
  14. package/src/control/button.svelte +25 -0
  15. package/src/control/input.svelte +107 -0
  16. package/src/control/label.md +0 -0
  17. package/src/control/label.svelte +36 -0
  18. package/src/control/link.md +37 -0
  19. package/src/control/link.svelte +28 -0
  20. package/src/control/radio.md +49 -0
  21. package/src/control/radio.svelte +28 -0
  22. package/src/control/select.md +55 -0
  23. package/src/control/select.svelte +62 -0
  24. package/src/control/tabs.md +35 -0
  25. package/src/control/tabs.svelte +39 -0
  26. package/src/control/toggle.md +38 -0
  27. package/src/control/toggle.svelte +47 -0
  28. package/src/data-display/avatar.md +26 -0
  29. package/src/data-display/avatar.svelte +23 -0
  30. package/src/data-display/badge.md +24 -0
  31. package/src/data-display/badge.svelte +12 -0
  32. package/src/data-display/chip.md +28 -0
  33. package/src/data-display/chip.svelte +26 -0
  34. package/src/data-display/details.md +0 -0
  35. package/src/{details.svelte → data-display/details.svelte} +3 -3
  36. package/src/data-display/popover.md +32 -0
  37. package/src/data-display/popover.svelte +23 -0
  38. package/src/data-display/progress.md +30 -0
  39. package/src/data-display/progress.svelte +25 -0
  40. package/src/data-display/table.md +29 -0
  41. package/src/data-display/table.svelte +36 -0
  42. package/src/data-display/tooltip.md +25 -0
  43. package/src/data-display/tooltip.svelte +15 -0
  44. package/src/dialogs/alert.md +0 -0
  45. package/src/dialogs/alert.svelte +4 -4
  46. package/src/dialogs/confirm.md +0 -0
  47. package/src/dialogs/confirm.svelte +5 -5
  48. package/src/functions.md +77 -0
  49. package/src/handler$.mjs +20 -68
  50. package/src/index.mjs +55 -92
  51. package/src/info/icon.md +20 -0
  52. package/src/info/icon.svelte +9 -0
  53. package/src/info/notification.md +37 -0
  54. package/src/info/notification.svelte +16 -0
  55. package/src/info/titlebar.md +46 -0
  56. package/src/info/titlebar.svelte +18 -0
  57. package/src/info/toaster.md +23 -0
  58. package/src/info/toaster.svelte +14 -0
  59. package/src/inline-dialog.svelte +23 -23
  60. package/src/layout/dialog.md +33 -0
  61. package/src/layout/dialog.svelte +24 -0
  62. package/src/layout/drawer.md +47 -0
  63. package/src/layout/drawer.svelte +47 -0
  64. package/src/layout/flex.md +30 -0
  65. package/src/layout/flex.svelte +22 -0
  66. package/src/layout/grid.md +36 -0
  67. package/src/layout/grid.svelte +26 -0
  68. package/src/layout/modal.md +35 -0
  69. package/src/layout/modal.svelte +58 -0
  70. package/src/layout/paper.md +77 -0
  71. package/src/layout/paper.svelte +45 -0
  72. package/src/layout/screen.md +31 -0
  73. package/src/layout/screen.svelte +32 -0
  74. package/src/{circle-spinner.svelte → spinner/circle-spinner.svelte} +2 -2
  75. package/src/{hexagon-spinner.svelte → spinner/hexagon-spinner.svelte} +2 -2
  76. package/src/spinner/spinners.md +0 -0
  77. package/src/text.md +22 -0
  78. package/src/text.svelte +20 -49
  79. package/src/variant.mjs +12 -12
  80. package/src/wsx.mjs +24 -45
  81. package/src/avatar.svelte +0 -54
  82. package/src/badge.svelte +0 -40
  83. package/src/button.svelte +0 -86
  84. package/src/chip.svelte +0 -56
  85. package/src/dialog.svelte +0 -54
  86. package/src/drawer.svelte +0 -121
  87. package/src/flex.svelte +0 -57
  88. package/src/grid.svelte +0 -66
  89. package/src/icon.svelte +0 -34
  90. package/src/input/area.svelte +0 -98
  91. package/src/input/elems.mjs +0 -7
  92. package/src/input/email.svelte +0 -104
  93. package/src/input/file.svelte +0 -82
  94. package/src/input/number.svelte +0 -104
  95. package/src/input/password.svelte +0 -101
  96. package/src/input/search.svelte +0 -104
  97. package/src/input/text.svelte +0 -104
  98. package/src/link.svelte +0 -67
  99. package/src/modal.svelte +0 -73
  100. package/src/notification.svelte +0 -57
  101. package/src/paper.svelte +0 -127
  102. package/src/popover.svelte +0 -60
  103. package/src/progress.svelte +0 -60
  104. package/src/radio.svelte +0 -82
  105. package/src/screen.svelte +0 -69
  106. package/src/select.svelte +0 -122
  107. package/src/table.svelte +0 -69
  108. package/src/tabs.svelte +0 -78
  109. package/src/titlebar.svelte +0 -69
  110. package/src/toaster.svelte +0 -42
  111. package/src/toggle.svelte +0 -94
  112. package/src/tooltip.svelte +0 -45
  113. package/src/vars.mjs +0 -61
package/src/grid.svelte DELETED
@@ -1,66 +0,0 @@
1
- <script>
2
- /*md
3
- [@] Components/Containers/Grid
4
-
5
- # Grid
6
-
7
- Container that uses grid layout by default with some nice default values.
8
-
9
- ## Base
10
- [Windstorm Grid](https://axel669.github.io/lib.windstorm/#components-grid)
11
-
12
- ## Props
13
- All [windstorm functions](https://axel669.github.io/lib.windstorm/#css-shorthands)
14
- are supported.
15
-
16
- - ### direction `string`
17
- Sets `gr-dir`
18
- - ### pad `string`
19
- Sets `p`
20
- - ### gap `string`
21
- Sets `gap`
22
- - ### cols `string|Array`
23
- Sets `gr-col`. Accepts either an array of values that are joined by " "
24
- or a regular string value.
25
- - ### rows `string|Array`
26
- Sets `gr-row`. Accepts either an array of values that are joined by " "
27
- or a regular string value.
28
- - ### autoCol `string`
29
- Sets `gr-acol`
30
- - ### autoRow `string`
31
- Sets `gr-arow`
32
-
33
- ## Usage
34
- ```svelte
35
- <Grid cross="stretch">
36
- <Text>Content</Text>
37
- <Text>More content</Text>
38
- <Text>Event more content</Text>
39
- <Grid>
40
- ```
41
- */
42
- import wsx from "./wsx.mjs"
43
-
44
- export let direction = false
45
- export let pad = false
46
- export let gap = false
47
- export let cols = null
48
- export let rows = null
49
- export let autoCol = false
50
- export let autoRow = false
51
-
52
- $: wind = {
53
- "gr-dir": direction,
54
- "gr-col": cols?.join?.(" ") ?? cols ?? false,
55
- "gr-row": rows?.join?.(" ") ?? rows ?? false,
56
- "gr-acol": autoCol,
57
- "gr-arow": autoRow,
58
- p: pad,
59
- gap: gap,
60
- ...$$restProps
61
- }
62
- </script>
63
-
64
- <ws-grid use:wsx={wind}>
65
- <slot />
66
- </ws-grid>
package/src/icon.svelte DELETED
@@ -1,34 +0,0 @@
1
- <script>
2
- /*md
3
- [@] Components/Icon
4
-
5
- # Icon
6
-
7
- Displays a [Tabler Icon](https://tabler-icons.io/) and some optional text.
8
- The icon will appear at the beginning of the text.
9
-
10
- ## Base
11
- [Windstorm Icon](https://axel669.github.io/lib.windstorm/#components-icon)
12
-
13
- ## Props
14
- All [windstorm functions](https://axel669.github.io/lib.windstorm/#css-shorthands)
15
- are supported.
16
-
17
- - ### name `string`
18
- The name of the icon. Use the tabler icon class name without the "ti-".
19
-
20
- ## Usage
21
- ```svelte
22
- <Icon name="hexagon" />
23
- <Icon name="hexagons">Are the bestagons</Icon>
24
- ```
25
- */
26
-
27
- import wsx from "./wsx.mjs"
28
-
29
- export let name
30
- </script>
31
-
32
- <ws-icon class="ti-{name}" use:wsx={$$restProps}>
33
- <slot />
34
- </ws-icon>
@@ -1,98 +0,0 @@
1
- <script>
2
- /*md
3
- [@] Components/Input/Area
4
-
5
- # Input.Area
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 a `<textarea>`
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.Area bind:value />
53
- <Input.Area bind:value color="primary" />
54
- <Input.Area bind:value label="Wat" hint="Blep"/>
55
- <Input.Area bind:value bind:tvalue transform={txt => txt.toLowerCase()} />
56
- <Input.Area bind:value bind:valid validate={txt => txt.indexOf("a") > 0} />
57
- ```
58
- */
59
-
60
- import wsx from "../wsx.mjs"
61
-
62
- export let flat = false
63
- export let label
64
- export let color = "default"
65
- export let error = null
66
- export let hint = null
67
- export let disabled
68
-
69
- export let value = ""
70
-
71
- export let transform = i => i
72
- export let tvalue
73
- export let validate = () => true
74
- export let valid
75
-
76
- let area = null
77
- export const focus = () => area.focus()
78
-
79
- $: wind = {
80
- "@flat": flat,
81
- "@control": true,
82
- $color: color,
83
- ...$$restProps,
84
- }
85
-
86
- $: tvalue = transform(value ?? "")
87
- $: valid = validate(tvalue)
88
- </script>
89
-
90
- <label use:wsx={wind} ws-error={error}>
91
- {#if label}
92
- <span ws-x="$text" ws-hint={hint}>{label}</span>
93
- {/if}
94
- <textarea {disabled} {...$$restProps} bind:value on:focus on:blur bind:this={area} />
95
-
96
- <slot name="start" />
97
- <slot name="end" />
98
- </label>
@@ -1,7 +0,0 @@
1
- export { default as Area } from "./area.svelte"
2
- export { default as Email } from "./email.svelte"
3
- export { default as File } from "./file.svelte"
4
- export { default as Number } from "./number.svelte"
5
- export { default as Password } from "./password.svelte"
6
- export { default as Search } from "./search.svelte"
7
- export { default as Text } from "./text.svelte"
@@ -1,104 +0,0 @@
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
- export let disabled
67
-
68
- export let value = ""
69
-
70
- export let transform = i => i
71
- export let tvalue
72
- export let validate = () => true
73
- export let valid
74
-
75
- let input = null
76
- export const focus = () => input.focus()
77
-
78
- $: wind = {
79
- "@flat": flat,
80
- "@control": true,
81
- $color: color,
82
- ...$$restProps,
83
- }
84
-
85
- $: tvalue = transform(value ?? "")
86
- $: valid = validate(tvalue)
87
- </script>
88
-
89
- <label use:wsx={wind} ws-error={error}>
90
- {#if label}
91
- <span ws-x="$text" ws-hint={hint}>{label}</span>
92
- {/if}
93
- <input {...$$restProps}
94
- type="email"
95
- {disabled}
96
- bind:value
97
- on:focus
98
- on:blur
99
- bind:this={input}
100
- />
101
-
102
- <slot name="start" />
103
- <slot name="end" />
104
- </label>
@@ -1,82 +0,0 @@
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
- export let disabled
56
-
57
- export let value
58
-
59
- export let validate = () => true
60
- export let valid
61
-
62
- const handler = (evt) => value = [...evt.target.files]
63
-
64
- $: wind = {
65
- "@flat": flat,
66
- "@control": true,
67
- $color: color,
68
- ...$$restProps,
69
- }
70
-
71
- $: valid = validate(value)
72
- </script>
73
-
74
- <label use:wsx={wind} ws-error={error}>
75
- {#if label}
76
- <span ws-x="$text" ws-hint={hint}>{label}</span>
77
- {/if}
78
- <input {disabled} {...$$restProps} type="file" on:input={handler} />
79
-
80
- <slot name="start" />
81
- <slot name="end" />
82
- </label>
@@ -1,104 +0,0 @@
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
- export let disabled
67
-
68
- export let value = ""
69
-
70
- export let transform = i => i
71
- export let tvalue
72
- export let validate = () => true
73
- export let valid
74
-
75
- let input = null
76
- export const focus = () => input.focus()
77
-
78
- $: wind = {
79
- "@flat": flat,
80
- "@control": true,
81
- $color: color,
82
- ...$$restProps,
83
- }
84
-
85
- $: tvalue = transform(value ?? "")
86
- $: valid = validate(tvalue)
87
- </script>
88
-
89
- <label use:wsx={wind} ws-error={error}>
90
- {#if label}
91
- <span ws-x="$text" ws-hint={hint}>{label}</span>
92
- {/if}
93
- <input {...$$restProps}
94
- type="number"
95
- {disabled}
96
- bind:value
97
- on:focus
98
- on:blur
99
- bind:this={input}
100
- />
101
-
102
- <slot name="start" />
103
- <slot name="end" />
104
- </label>
@@ -1,101 +0,0 @@
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
- export let disabled
67
-
68
- export let value = ""
69
-
70
- export let validate = () => true
71
- export let valid
72
-
73
- let input = null
74
- export const focus = () => input.focus()
75
-
76
- $: wind = {
77
- "@flat": flat,
78
- "@control": true,
79
- $color: color,
80
- ...$$restProps,
81
- }
82
-
83
- $: valid = validate(value)
84
- </script>
85
-
86
- <label use:wsx={wind} ws-error={error}>
87
- {#if label}
88
- <span ws-x="$text" ws-hint={hint}>{label}</span>
89
- {/if}
90
- <input {...$$restProps}
91
- type="password"
92
- {disabled}
93
- bind:value
94
- on:focus
95
- on:blur
96
- bind:this={input}
97
- />
98
-
99
- <slot name="start" />
100
- <slot name="end" />
101
- </label>
@@ -1,104 +0,0 @@
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
- export let disabled
67
-
68
- export let value = ""
69
-
70
- export let transform = i => i
71
- export let tvalue
72
- export let validate = () => true
73
- export let valid
74
-
75
- let input = null
76
- export const focus = () => input.focus()
77
-
78
- $: wind = {
79
- "@flat": flat,
80
- "@control": true,
81
- $color: color,
82
- ...$$restProps,
83
- }
84
-
85
- $: tvalue = transform(value ?? "")
86
- $: valid = validate(tvalue)
87
- </script>
88
-
89
- <label use:wsx={wind} ws-error={error}>
90
- {#if label}
91
- <span ws-x="$text" ws-hint={hint}>{label}</span>
92
- {/if}
93
- <input {...$$restProps}
94
- {disabled}
95
- type="search"
96
- bind:value
97
- on:focus
98
- on:blur
99
- bind:this={input}
100
- />
101
-
102
- <slot name="start" />
103
- <slot name="end" />
104
- </label>