@axel669/zephyr 0.2.0-beta.0 → 0.2.0-beta.2
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 -4
- package/readme.md +23 -15
- package/src/async/button.svelte +31 -0
- package/src/async/load-zone.svelte +17 -0
- package/src/composed/data-table.md +19 -5
- package/src/composed/entry-button.md +1 -1
- package/src/composed/toast/message.svelte +16 -4
- package/src/composed/toast.md +1 -1
- package/src/control/button.md +6 -2
- package/src/control/label.md +49 -0
- package/src/control/link.md +24 -11
- package/src/control/link.svelte +1 -1
- package/src/control/radio.md +32 -23
- package/src/control/radio.svelte +1 -3
- package/src/control/select.md +41 -26
- package/src/control/tabs.md +38 -26
- package/src/control/toggle.md +50 -27
- package/src/data-display/avatar.md +24 -14
- package/src/data-display/badge.md +17 -11
- package/src/data-display/chip.md +19 -11
- package/src/data-display/details.md +3 -0
- package/src/data-display/popover.md +10 -10
- package/src/data-display/progress.md +37 -21
- package/src/data-display/table.md +4 -26
- package/src/data-display/tooltip.md +14 -10
- package/src/dialogs/alert.md +3 -0
- package/src/dialogs/confirm.md +3 -0
- package/src/functions.md +9 -3
- package/src/index.mjs +4 -7
- package/src/info/icon.md +9 -8
- package/src/info/notification.md +7 -8
- package/src/info/titlebar.md +47 -18
- package/src/info/toaster.md +11 -8
- package/src/layout/dialog.md +12 -2
- package/src/layout/drawer.md +40 -17
- package/src/layout/flex.md +31 -18
- package/src/layout/grid.md +44 -19
- package/src/layout/modal.md +21 -6
- package/src/layout/paper.md +51 -34
- package/src/layout/screen.md +11 -9
- package/src/spinner/spinners.md +3 -0
- package/src/text.md +22 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axel669/zephyr",
|
|
3
|
-
"version": "0.2.0-beta.
|
|
3
|
+
"version": "0.2.0-beta.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "src/index.mjs",
|
|
6
6
|
"type": "module",
|
|
@@ -12,11 +12,10 @@
|
|
|
12
12
|
"author": "",
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@axel669/windstorm": "0.2.3"
|
|
16
|
-
"@labyrinthos/asuid": "^0.2.0"
|
|
15
|
+
"@axel669/windstorm": "0.2.3"
|
|
17
16
|
},
|
|
18
17
|
"devDependencies": {
|
|
19
|
-
"@axel669/ipsen": "0.4.0-beta.
|
|
18
|
+
"@axel669/ipsen": "0.4.0-beta.7",
|
|
20
19
|
"@axel669/rollup-html-input": "^0.1.2",
|
|
21
20
|
"@rollup/plugin-node-resolve": "^15.0.2",
|
|
22
21
|
"@rollup/plugin-terser": "^0.4.0",
|
package/readme.md
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
NOTE: add docs for dumbass svelte browser resolve bullshit
|
|
2
|
-
https://svelte.dev/docs/v4-migration-guide#browser-conditions-for-bundlers
|
|
3
|
-
- form controls?
|
|
4
|
-
|
|
5
1
|
# Zephyr
|
|
6
2
|
Zephyr is a svelte binding for the [Windstorm](https://windstorm.axel669.net)
|
|
7
3
|
library, with some additional parts to make it look nice in the markup.
|
|
@@ -12,44 +8,56 @@ library, with some additional parts to make it look nice in the markup.
|
|
|
12
8
|
Zephyr can be installed through npm (or the variants like yarn, pnpm, etc).
|
|
13
9
|
|
|
14
10
|
```bash
|
|
15
|
-
npm install @axel669/zephyr
|
|
11
|
+
npm install @axel669/zephyr@0.2.0-beta.1
|
|
16
12
|
```
|
|
17
13
|
|
|
18
|
-
##
|
|
14
|
+
## Components
|
|
19
15
|
Components can be imported individually from the library for tree-shaking, or
|
|
20
16
|
the entire lib can imported at once, but I dunno how big that bundle will be.
|
|
21
17
|
Components can also take any windstorm function as a prop, using the same rules
|
|
22
18
|
as the `wsx` action.
|
|
23
19
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
### Theming
|
|
21
|
+
Windstorm expects a theme to be defined on an ancestor of the html elements
|
|
22
|
+
that use it, and Zephyr does not automatically set the theme because it can
|
|
23
|
+
used anywhere in the page. This means the wsx action (or setting the ws-x
|
|
24
|
+
attribute directly) will be needed for components to look right. Any valid
|
|
25
|
+
Windstorm theme is usable, including custom ones.
|
|
28
26
|
|
|
27
|
+
### Example
|
|
29
28
|
```svelte
|
|
30
29
|
<script>
|
|
31
30
|
// individual import for tree shaking
|
|
32
|
-
import {
|
|
31
|
+
import {
|
|
32
|
+
Button,
|
|
33
|
+
wsx
|
|
34
|
+
} from "@axel669/zephyr"
|
|
33
35
|
|
|
34
36
|
// bring the whole thing to keep it simple
|
|
35
37
|
import * as Wind from "@axel669/zephyr"
|
|
38
|
+
|
|
39
|
+
const theme = "dark"
|
|
40
|
+
const handler = () => {
|
|
41
|
+
console.log("button clicked!")
|
|
42
|
+
}
|
|
36
43
|
</script>
|
|
37
44
|
|
|
38
45
|
<!-- the wsx action can be used to setup the ws-x needed for the body -->
|
|
39
46
|
<svelte:body use:wsx={{"$theme": theme, "$app": true}} />
|
|
40
47
|
|
|
41
|
-
<Button on:click={
|
|
48
|
+
<Button on:click={handler}>
|
|
42
49
|
I'm a button!
|
|
43
50
|
</Button>
|
|
44
51
|
|
|
45
|
-
<Wind.Button on:click={
|
|
52
|
+
<Wind.Button on:click={handler}>
|
|
46
53
|
I'm also button!
|
|
47
54
|
</Wind.Button>
|
|
48
55
|
```
|
|
49
56
|
|
|
50
|
-
|
|
57
|
+
## Svelte Config
|
|
51
58
|
Zephyr does not output any css of its own, so no configuration is required to
|
|
52
59
|
make it styled as expected. For people using Svelte 4+ you will need to make
|
|
53
60
|
sure your bundler has the browser conditions set as some components do use
|
|
54
61
|
lifecycle functions that will not be bundled without the setting.
|
|
55
|
-
[
|
|
62
|
+
[Svelte Docs](https://svelte.dev/docs/v4-migration-guide#browser-conditions-for-bundlers)
|
|
63
|
+
about the setting.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import Button from "../control/button.svelte"
|
|
3
|
+
import Spinner from "../spinner/circle-spinner.svelte"
|
|
4
|
+
|
|
5
|
+
export let handler = null
|
|
6
|
+
export let disabled
|
|
7
|
+
export let inactiveProps = null
|
|
8
|
+
|
|
9
|
+
let running = false
|
|
10
|
+
const asyncHandler = async (evt) => {
|
|
11
|
+
running = true
|
|
12
|
+
await handler(evt)
|
|
13
|
+
running = false
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
$: inactive = (typeof disabled === "boolean") ? disabled : running
|
|
17
|
+
$: props = {
|
|
18
|
+
...$$restProps,
|
|
19
|
+
...(running === false ? null : inactiveProps),
|
|
20
|
+
disabled: inactive,
|
|
21
|
+
}
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<Button {...props} on:click={asyncHandler}>
|
|
25
|
+
<div ws-x="h[20px] m.r:not(:empty)[4px]">
|
|
26
|
+
{#if running === true}
|
|
27
|
+
<Spinner size="20px" />
|
|
28
|
+
{/if}
|
|
29
|
+
</div>
|
|
30
|
+
<slot />
|
|
31
|
+
</Button>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import Spinner from "../spinner/hexagon-spinner.svelte"
|
|
3
|
+
export let source = null
|
|
4
|
+
</script>
|
|
5
|
+
|
|
6
|
+
{#if source !== null}
|
|
7
|
+
{#await source}
|
|
8
|
+
<slot name="loading">
|
|
9
|
+
<ws-flex ws-x="fl.cross[center] fl.main[center]">
|
|
10
|
+
<span>Loading</span>
|
|
11
|
+
<Spinner size="100px" />
|
|
12
|
+
</ws-flex>
|
|
13
|
+
</slot>
|
|
14
|
+
{:then result}
|
|
15
|
+
<slot {result} />
|
|
16
|
+
{/await}
|
|
17
|
+
{/if}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
NOTE: include Th as its own component
|
|
2
|
+
|
|
1
3
|
# DataTable
|
|
2
4
|
|
|
3
5
|
The DataTable is a more advanced way to show data on screen. Underneath is
|
|
@@ -14,21 +16,33 @@ are supported.
|
|
|
14
16
|
|
|
15
17
|
- ### color
|
|
16
18
|
Sets `$color`
|
|
17
|
-
|
|
19
|
+
|
|
20
|
+
### cols
|
|
21
|
+
`Array`
|
|
22
|
+
|
|
18
23
|
The columns that should be displayed. Should be in the format of
|
|
19
24
|
`{ label, width?, format?, prop? }`. If a format function is provided,
|
|
20
25
|
it is called on each cell to determine a cells value as
|
|
21
26
|
`format(rowItem)`, otherwise the property defined in prop will be used
|
|
22
27
|
as the cell value.
|
|
23
|
-
|
|
28
|
+
|
|
29
|
+
### data
|
|
30
|
+
`Array`
|
|
31
|
+
|
|
24
32
|
The data to display. Each item in the array can be in either the same
|
|
25
33
|
format as the Table, or any kind of object if column format functions
|
|
26
34
|
are used.
|
|
27
|
-
|
|
35
|
+
|
|
36
|
+
### cellWSX
|
|
37
|
+
`function`
|
|
38
|
+
|
|
28
39
|
If given, this function will be called for each cell, and should return
|
|
29
40
|
an object that will be passed to the `wsx` action for each <td>
|
|
30
41
|
generated. The function is passed `(rowvalue, rowNum, col)`.
|
|
31
|
-
|
|
42
|
+
|
|
43
|
+
### rowWSX
|
|
44
|
+
`function`
|
|
45
|
+
|
|
32
46
|
If given, this function will be called for each row, and should return
|
|
33
47
|
an object that will be passed to the `wsx` action for each <tr>
|
|
34
48
|
generated. The function is passed `(rowValue, rowNum)`.
|
|
@@ -42,7 +56,7 @@ are supported.
|
|
|
42
56
|
that may lead to a degraded user experience if the rows change size
|
|
43
57
|
while paging through the data
|
|
44
58
|
|
|
45
|
-
##
|
|
59
|
+
## Example
|
|
46
60
|
```js
|
|
47
61
|
let page
|
|
48
62
|
const cols = [
|
|
@@ -20,7 +20,7 @@ addition to the buttons that show them.
|
|
|
20
20
|
When the component is close the entry event is fired. The detail
|
|
21
21
|
property of the event will have the value from closing it
|
|
22
22
|
|
|
23
|
-
##
|
|
23
|
+
## Example
|
|
24
24
|
```svelte
|
|
25
25
|
<EntryButton component={Subscreen} on:entry={console.log}>
|
|
26
26
|
Open Subscreen
|
|
@@ -7,14 +7,26 @@
|
|
|
7
7
|
The default component for Toast to show messages with
|
|
8
8
|
|
|
9
9
|
## Props
|
|
10
|
-
|
|
10
|
+
|
|
11
|
+
### actionText
|
|
12
|
+
`string`
|
|
13
|
+
|
|
11
14
|
If given, the message will have a button that can be clicked and will
|
|
12
15
|
use this text for the button text
|
|
13
|
-
|
|
16
|
+
|
|
17
|
+
### color
|
|
18
|
+
`string`
|
|
19
|
+
|
|
14
20
|
Sets `$color`
|
|
15
|
-
|
|
21
|
+
|
|
22
|
+
### icon
|
|
23
|
+
`string`
|
|
24
|
+
|
|
16
25
|
An icon to show with the message
|
|
17
|
-
|
|
26
|
+
|
|
27
|
+
### message
|
|
28
|
+
`string`
|
|
29
|
+
|
|
18
30
|
The message to show
|
|
19
31
|
*/
|
|
20
32
|
|
package/src/composed/toast.md
CHANGED
|
@@ -26,7 +26,7 @@ also controls the children being shown for convenience.
|
|
|
26
26
|
actions to be taken against interactions in the message without having
|
|
27
27
|
to bind all kinds of events or callbacks.
|
|
28
28
|
|
|
29
|
-
##
|
|
29
|
+
## Example
|
|
30
30
|
```js
|
|
31
31
|
let toast = null
|
|
32
32
|
const notify = () => toast.show(5000, { message: "hi" })
|
package/src/control/button.md
CHANGED
|
@@ -17,14 +17,18 @@ Sets `$compact`
|
|
|
17
17
|
### fill / outline
|
|
18
18
|
`bool`
|
|
19
19
|
|
|
20
|
-
Sets the button type to
|
|
21
|
-
is true, or
|
|
20
|
+
Sets the button type to `$fill` if fill is true, `$outline` if outline
|
|
21
|
+
is true, or `$flat` if neither is true.
|
|
22
22
|
|
|
23
23
|
## Events
|
|
24
24
|
- click
|
|
25
25
|
|
|
26
26
|
## Example
|
|
27
27
|
```svelte
|
|
28
|
+
<script>
|
|
29
|
+
import { Button } from "@axel669/zephyr"
|
|
30
|
+
</script>
|
|
31
|
+
|
|
28
32
|
<Button on:click={action}>
|
|
29
33
|
Flat Button
|
|
30
34
|
</Button>
|
package/src/control/label.md
CHANGED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Label
|
|
2
|
+
|
|
3
|
+
The label component is a wrapper around a `<label>` element.
|
|
4
|
+
|
|
5
|
+
## Props
|
|
6
|
+
|
|
7
|
+
### button
|
|
8
|
+
`bool`
|
|
9
|
+
|
|
10
|
+
If true, the label will have the button appearance.
|
|
11
|
+
|
|
12
|
+
### color
|
|
13
|
+
`string`
|
|
14
|
+
|
|
15
|
+
Sets `$color`
|
|
16
|
+
|
|
17
|
+
### compact
|
|
18
|
+
`bool`
|
|
19
|
+
|
|
20
|
+
If true, will make the label button be more compact. No effect is `button` is
|
|
21
|
+
`false`.
|
|
22
|
+
|
|
23
|
+
### disabled
|
|
24
|
+
`bool`
|
|
25
|
+
|
|
26
|
+
Disables the label.
|
|
27
|
+
|
|
28
|
+
### fill / outline / flat
|
|
29
|
+
`bool`
|
|
30
|
+
|
|
31
|
+
Sets the button variant of the label when `button` is `true`.
|
|
32
|
+
|
|
33
|
+
### for
|
|
34
|
+
`string`
|
|
35
|
+
|
|
36
|
+
[Label for attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label#for)
|
|
37
|
+
|
|
38
|
+
## Example
|
|
39
|
+
|
|
40
|
+
```svelte
|
|
41
|
+
<script>
|
|
42
|
+
import { Label } from "@axel669/zephyr"
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<Label for="checkbox">Toggle Checkbox</Label>
|
|
46
|
+
<Label for="checkbox" button color="primary" fill>
|
|
47
|
+
Open Menu
|
|
48
|
+
</Label>
|
|
49
|
+
```
|
package/src/control/link.md
CHANGED
|
@@ -8,26 +8,39 @@ Themed and customizale `<a>` tag component.
|
|
|
8
8
|
|
|
9
9
|
If true, the link will be styled like a button
|
|
10
10
|
|
|
11
|
-
### color
|
|
11
|
+
### color
|
|
12
|
+
`string`
|
|
12
13
|
|
|
13
14
|
Sets the color of the button. Applies to both regular links and button
|
|
14
15
|
style links.
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
### href
|
|
18
|
+
`string`
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
Sets the rel attribute.
|
|
20
|
+
Sets the href attribute.
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
### rel
|
|
23
|
+
`string`
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
Sets the link-button type to $fill if fill is true, $outline if outline
|
|
27
|
-
is true, or $flat if neither is true.
|
|
25
|
+
Sets the rel attribute.
|
|
28
26
|
|
|
29
|
-
|
|
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
|
|
30
39
|
```svelte
|
|
40
|
+
<script>
|
|
41
|
+
import { Link } from "@axel669/zephyr"
|
|
42
|
+
</script>
|
|
43
|
+
|
|
31
44
|
<Link color="primary" href="test" target="_blank">
|
|
32
45
|
Test
|
|
33
46
|
</Link>
|
package/src/control/link.svelte
CHANGED
package/src/control/radio.md
CHANGED
|
@@ -7,24 +7,31 @@ are presented.
|
|
|
7
7
|
|
|
8
8
|
## Base
|
|
9
9
|
Each radio item rendered is a
|
|
10
|
-
[Windstorm Labeled Toggle](https://axel669.
|
|
10
|
+
[Windstorm Labeled Toggle](https://windstorm.axel669.net/lib/css/component/toggle)
|
|
11
11
|
that uses a radio input.
|
|
12
12
|
|
|
13
13
|
## Props
|
|
14
|
-
All [windstorm functions](https://axel669.github.io/lib.windstorm/#css-shorthands)
|
|
15
|
-
are supported.
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
The wind functions passed as props to the Radio component are passed directly to
|
|
16
|
+
the layout specified because the Radio does not have a container element of its
|
|
17
|
+
own.
|
|
20
18
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
19
|
+
### layout
|
|
20
|
+
`Component`
|
|
21
|
+
|
|
22
|
+
The component to use for layout out the options. Default is
|
|
23
|
+
[Flex](../layout/flex.md).
|
|
24
|
+
|
|
25
|
+
### options
|
|
26
|
+
`Array[Object]`
|
|
27
|
+
|
|
28
|
+
An array of objects that defines the options to show. Details below.
|
|
29
|
+
|
|
30
|
+
### value
|
|
31
|
+
`any`
|
|
32
|
+
|
|
33
|
+
The value currently selected. Can be bound to react to selections or change the
|
|
34
|
+
current selection.
|
|
28
35
|
|
|
29
36
|
## Options
|
|
30
37
|
Each object in the options array supplied should have a `value` and `label`
|
|
@@ -34,16 +41,18 @@ the option can be passed as additional props.
|
|
|
34
41
|
Labels should be strings, but values can be any type as long as they are
|
|
35
42
|
unique in the list.
|
|
36
43
|
|
|
37
|
-
|
|
38
|
-
const options = [
|
|
39
|
-
{ label: "first", value: 1 },
|
|
40
|
-
{ label: "second", value: [] },
|
|
41
|
-
{ label: "third", value: "3", "$color": "warning" }
|
|
42
|
-
]
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
## Usage
|
|
44
|
+
## Example
|
|
46
45
|
```svelte
|
|
46
|
+
<script>
|
|
47
|
+
import { Radio, Grid } from "@axel669/zephyr"
|
|
48
|
+
|
|
49
|
+
const options = [
|
|
50
|
+
{ label: "first", value: 1 },
|
|
51
|
+
{ label: "second", value: [] },
|
|
52
|
+
{ label: "third", value: "3", "$color": "warning" }
|
|
53
|
+
]
|
|
54
|
+
</script>
|
|
55
|
+
|
|
47
56
|
<Radio {options} bind:value />
|
|
48
|
-
<Radio {options} bind:value={other} layout={Grid} gr
|
|
57
|
+
<Radio {options} bind:value={other} layout={Grid} gr.cols="1fr 1fr" />
|
|
49
58
|
```
|
package/src/control/radio.svelte
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import asuid from "@labyrinthos/asuid"
|
|
3
|
-
|
|
4
2
|
import wsx from "../wsx.mjs"
|
|
5
3
|
import { handler$ } from "../handler$.mjs"
|
|
6
4
|
|
|
@@ -15,7 +13,7 @@
|
|
|
15
13
|
(newValue) => value = newValue
|
|
16
14
|
)
|
|
17
15
|
|
|
18
|
-
const name =
|
|
16
|
+
const name = `${Math.random().toString(16)}-${Date.now()}`
|
|
19
17
|
</script>
|
|
20
18
|
|
|
21
19
|
<svelte:component this={layout} {...$$restProps}>
|
package/src/control/select.md
CHANGED
|
@@ -10,17 +10,29 @@ using a `<select>`
|
|
|
10
10
|
All [windstorm functions](https://axel669.github.io/lib.windstorm/#css-shorthands)
|
|
11
11
|
are supported.
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
13
|
+
### color
|
|
14
|
+
`string`
|
|
15
|
+
|
|
16
|
+
Sets `$color`
|
|
17
|
+
|
|
18
|
+
### label
|
|
19
|
+
`string`
|
|
20
|
+
|
|
21
|
+
The text to display as the label
|
|
22
|
+
|
|
23
|
+
### options
|
|
24
|
+
`Array[Object]`
|
|
25
|
+
|
|
26
|
+
An array of options and groups to show in the select. Details below
|
|
27
|
+
|
|
28
|
+
### outline `bool`
|
|
29
|
+
|
|
30
|
+
Sets `$outline`
|
|
31
|
+
### value
|
|
32
|
+
`any`
|
|
33
|
+
|
|
34
|
+
The value currently selected. Can be bound to react to selections or
|
|
35
|
+
change the current selection.
|
|
24
36
|
|
|
25
37
|
## Options
|
|
26
38
|
Each object in the options provided should be in one of 2 forms:
|
|
@@ -34,22 +46,25 @@ array) is put into the optgroup defined by the group item.
|
|
|
34
46
|
|
|
35
47
|
Labels and group names should be strings, but values can be any type.
|
|
36
48
|
|
|
37
|
-
##
|
|
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
|
-
```
|
|
49
|
+
## Example
|
|
52
50
|
```svelte
|
|
51
|
+
<script>
|
|
52
|
+
import { Select } from "@axel669/zephyr"
|
|
53
|
+
|
|
54
|
+
// Results in:
|
|
55
|
+
// <option>first</option>
|
|
56
|
+
// <optgroup label="Not Numbers">
|
|
57
|
+
// <option>second</option>
|
|
58
|
+
// <option>third</option>
|
|
59
|
+
// </optgroup>
|
|
60
|
+
const options = [
|
|
61
|
+
{ label: "first", value: 1 },
|
|
62
|
+
{ group: "Not numbers" },
|
|
63
|
+
{ label: "second", value: "two" },
|
|
64
|
+
{ label: "third", value: [3] },
|
|
65
|
+
]
|
|
66
|
+
</script>
|
|
67
|
+
|
|
53
68
|
<Select {options} bind:value label="Blep" />
|
|
54
69
|
<Select {options} bind:value color="warning" label="Why" />
|
|
55
70
|
```
|
package/src/control/tabs.md
CHANGED
|
@@ -2,34 +2,46 @@
|
|
|
2
2
|
|
|
3
3
|
It's tabs, everyone knows what tabs are at this point.
|
|
4
4
|
|
|
5
|
-
## Base
|
|
6
|
-
[Windstorm Tabs](https://axel669.github.io/lib.windstorm/#components-tabs)
|
|
7
|
-
|
|
8
5
|
## Props
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
6
|
+
|
|
7
|
+
### color
|
|
8
|
+
`string`
|
|
9
|
+
|
|
10
|
+
Sets `$color`
|
|
11
|
+
|
|
12
|
+
### options
|
|
13
|
+
`Array[Object]`
|
|
14
|
+
|
|
15
|
+
An array of options where each item is `{ label, value }`. `label`
|
|
16
|
+
should be a string, `value` can be of any type.
|
|
17
|
+
|
|
18
|
+
### vertical
|
|
19
|
+
`bool`
|
|
20
|
+
|
|
21
|
+
Sets `$vert`
|
|
22
|
+
|
|
23
|
+
### solid
|
|
24
|
+
`bool`
|
|
25
|
+
|
|
26
|
+
Sets `$solid`
|
|
27
|
+
|
|
28
|
+
### value
|
|
29
|
+
`any`
|
|
30
|
+
|
|
31
|
+
The value of the currently selected tab. Can be bound to react to
|
|
32
|
+
changes and set to control which tab is selected.
|
|
33
|
+
|
|
34
|
+
## Example
|
|
32
35
|
```svelte
|
|
36
|
+
<script>
|
|
37
|
+
import { Tabs } from "@axel669/zephyr"
|
|
38
|
+
|
|
39
|
+
const options = [
|
|
40
|
+
{ label: "Left", value: "left" },
|
|
41
|
+
{ label: "Right", value: 2 },
|
|
42
|
+
]
|
|
43
|
+
</script>
|
|
44
|
+
|
|
33
45
|
<Tab {options} bind:value color="primary" />
|
|
34
46
|
<Tab {options} bind:value color="secondary" solid vertical />
|
|
35
47
|
```
|