@axel669/zephyr 0.3.8 → 0.4.4-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 (77) hide show
  1. package/package.json +40 -33
  2. package/src/async/button.svelte +16 -8
  3. package/src/composed/data-table/th.svelte +2 -2
  4. package/src/composed/data-table.svelte +4 -3
  5. package/src/composed/form.svelte +60 -0
  6. package/src/composed/table-functions.js +3 -1
  7. package/src/composed/toast/message.svelte +15 -38
  8. package/src/control/button.svelte +1 -1
  9. package/src/control/input.svelte +89 -109
  10. package/src/control/label.svelte +1 -1
  11. package/src/control/link.svelte +32 -32
  12. package/src/control/radio-group.svelte +21 -0
  13. package/src/control/select.svelte +5 -5
  14. package/src/control/tabs.svelte +9 -21
  15. package/src/control/toggle.svelte +2 -2
  16. package/src/data-display/avatar.svelte +4 -1
  17. package/src/data-display/badge.svelte +1 -1
  18. package/src/data-display/chip.svelte +1 -1
  19. package/src/data-display/popover.svelte +25 -25
  20. package/src/data-display/progress.svelte +27 -27
  21. package/src/data-display/table.svelte +1 -1
  22. package/src/dialogs/confirm.svelte +3 -3
  23. package/src/hash.js +14 -14
  24. package/src/index.mjs +11 -1
  25. package/src/info/notification.svelte +28 -16
  26. package/src/info/titlebar.svelte +22 -5
  27. package/src/layout/dialog.svelte +1 -1
  28. package/src/layout/drawer.svelte +49 -49
  29. package/src/layout/flex.svelte +0 -4
  30. package/src/layout/grid.svelte +4 -4
  31. package/src/layout/paper.svelte +56 -47
  32. package/src/routing/route.svelte +48 -0
  33. package/src/routing/routing.js +62 -0
  34. package/src/routing/title.svelte +26 -0
  35. package/src/spinner/circle-spinner.svelte +2 -1
  36. package/src/spinner/hexagon-spinner.svelte +2 -1
  37. package/src/text.svelte +2 -4
  38. package/src/wsx.mjs +25 -24
  39. package/src/async/button.md +0 -27
  40. package/src/async/load-zone.md +0 -42
  41. package/src/composed/data-table/th.md +0 -21
  42. package/src/composed/data-table.md +0 -86
  43. package/src/composed/entry-button.md +0 -44
  44. package/src/composed/toast.md +0 -45
  45. package/src/control/button.md +0 -41
  46. package/src/control/input.md +0 -87
  47. package/src/control/label.md +0 -48
  48. package/src/control/link.md +0 -50
  49. package/src/control/radio.md +0 -58
  50. package/src/control/radio.svelte +0 -28
  51. package/src/control/select.md +0 -70
  52. package/src/control/tabs.md +0 -47
  53. package/src/control/toggle.md +0 -61
  54. package/src/data-display/avatar.md +0 -36
  55. package/src/data-display/badge.md +0 -30
  56. package/src/data-display/chip.md +0 -36
  57. package/src/data-display/details.md +0 -42
  58. package/src/data-display/popover.md +0 -32
  59. package/src/data-display/progress.md +0 -46
  60. package/src/data-display/table.md +0 -59
  61. package/src/data-display/tooltip.md +0 -29
  62. package/src/dialogs/alert.md +0 -42
  63. package/src/dialogs/confirm.md +0 -56
  64. package/src/functions.md +0 -108
  65. package/src/info/icon.md +0 -21
  66. package/src/info/notification.md +0 -36
  67. package/src/info/titlebar.md +0 -75
  68. package/src/info/toaster.md +0 -26
  69. package/src/layout/dialog.md +0 -43
  70. package/src/layout/drawer.md +0 -70
  71. package/src/layout/flex.md +0 -43
  72. package/src/layout/grid.md +0 -61
  73. package/src/layout/modal.md +0 -50
  74. package/src/layout/paper.md +0 -94
  75. package/src/layout/screen.md +0 -33
  76. package/src/spinner/spinners.md +0 -22
  77. package/src/text.md +0 -34
@@ -1,50 +0,0 @@
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,58 +0,0 @@
1
- # Radio
2
-
3
- The radio component displays a list of radio options and provides an
4
- interface to control which one is selected and react to changes in the
5
- selected value. It also uses a layout component to decide how the options
6
- are presented.
7
-
8
- ## Base
9
- Each radio item rendered is a
10
- [Windstorm Labeled Toggle](https://windstorm.axel669.net/lib/css/component/toggle)
11
- that uses a radio input.
12
-
13
- ## Props
14
-
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.
18
-
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.
35
-
36
- ## Options
37
- Each object in the options array supplied should have a `value` and `label`
38
- prop specified. Additionally, any wind functions that should be applied to
39
- the option can be passed as additional props.
40
-
41
- Labels should be strings, but values can be any type as long as they are
42
- unique in the list.
43
-
44
- ## Example
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
-
56
- <Radio {options} bind:value />
57
- <Radio {options} bind:value={other} layout={Grid} gr.cols="1fr 1fr" />
58
- ```
@@ -1,28 +0,0 @@
1
- <svelte:options immutable />
2
-
3
- <script>
4
- import wsx from "../wsx.mjs"
5
- import { handler$ } from "../handler$.mjs"
6
-
7
- import Flex from "../layout/flex.svelte"
8
-
9
- export let options = []
10
- export let layout = Flex
11
- export let value
12
-
13
- $: valueIndex = options.findIndex(item => item.value === value)
14
- const set = handler$(
15
- (newValue) => value = newValue
16
- )
17
-
18
- const name = `${Math.random().toString(16)}-${Date.now()}`
19
- </script>
20
-
21
- <svelte:component this={layout} {...$$restProps}>
22
- {#each options as {value, label, disabled, ...wind}, index (value)}
23
- <label use:wsx={{"@toggle": true, ...wind}} {disabled}>
24
- <span>{label}</span>
25
- <input type="radio" on:input={set(value)} {name} checked={index === valueIndex} />
26
- </label>
27
- {/each}
28
- </svelte:component>
@@ -1,70 +0,0 @@
1
- # Select
2
-
3
- A wrapper for select elements to make them look nicer.
4
-
5
- ## Base
6
- [Windstorm Labeled Control](https://axel669.github.io/lib.windstorm/#components-labeled control)
7
- using a `<select>`
8
-
9
- ## Props
10
- All [windstorm functions](https://axel669.github.io/lib.windstorm/#css-shorthands)
11
- are supported.
12
-
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.
36
-
37
- ## Options
38
- Each object in the options provided should be in one of 2 forms:
39
- - `{ label, value }`
40
- - `{ group }`
41
-
42
- Items with a label and value are displayed as <option> tags in the select.
43
- Items with a group defined are used to denote <optgroup> tags. Each option
44
- after a `{ group }` item until another group item is seen (or the end of the
45
- array) is put into the optgroup defined by the group item.
46
-
47
- Labels and group names should be strings, but values can be any type.
48
-
49
- ## Example
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
-
68
- <Select {options} bind:value label="Blep" />
69
- <Select {options} bind:value color="warning" label="Why" />
70
- ```
@@ -1,47 +0,0 @@
1
- # Tabs
2
-
3
- It's tabs, everyone knows what tabs are at this point.
4
-
5
- ## Props
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
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
-
45
- <Tab {options} bind:value color="primary" />
46
- <Tab {options} bind:value color="secondary" solid vertical />
47
- ```
@@ -1,61 +0,0 @@
1
- # Toggle
2
-
3
- The Toggle component is used to display checkboxes and switches.
4
-
5
- ## Props
6
-
7
- ### color
8
- `string`
9
-
10
- Sets `$color`
11
-
12
- ### checkbox
13
- `bool`
14
-
15
- If true, the toggle is displayed as a checkbox. Default is false
16
- (shown as a switch)
17
-
18
- ### checked
19
- `bool`
20
-
21
- Controls if the toggle is checked or not. Can be bound.
22
-
23
- ### group
24
- Used for binding, see the
25
- [Svelte bind:group](https://svelte.dev/docs/element-directives#bind-group)
26
- for details.
27
-
28
- ### label
29
- `string`
30
-
31
- The text to use for the label
32
-
33
- ### flat
34
- `bool`
35
-
36
- Sets `$flat`
37
-
38
- ### reverse
39
- `bool`
40
-
41
- If true, the input being toggled will be on the left instead of the
42
- right. Default is false (label is on the left)
43
-
44
- ### value
45
- `any`
46
-
47
- Only used in conjunction with bind:group, see Svelte docs
48
-
49
- ## Example
50
- ```svelte
51
- <script>
52
- import { Toggle } from "@axel669/zephyr"
53
-
54
- let checked = false
55
- </script>
56
-
57
- <Toggle label="Active" bind:checked />
58
- <Toggle label="Active" checkbox bind:checked />
59
- <Toggle label="Active" checkbox reverse bind:checked />
60
- <Toggle label="Active" checkbox flat color="danger" bind:checked />
61
- ```
@@ -1,36 +0,0 @@
1
- # Avatar
2
-
3
- Displays an image or text in a circular container.
4
-
5
- ## Props
6
-
7
- ### alt
8
- `string`
9
-
10
- Alt text for the image. Has no effect if image prop is not used.
11
-
12
- ### color
13
- `string`
14
-
15
- Sets `$color`
16
-
17
- ### image
18
- `string`
19
-
20
- An image url. If no url is provided the text property is displayed.
21
-
22
- ### text
23
- `string`
24
-
25
- Text to show in the avatar area if image is not used.
26
-
27
- ## Example
28
- ```svelte
29
- <script>
30
- import { Avatar } from "@axel669/zephyr"
31
- </script>
32
-
33
- <Avatar image="url" />
34
- <Avatar image="url" alt="text" />
35
- <Avatar text="Hi" color="primary" />
36
- ```
@@ -1,30 +0,0 @@
1
- # Badge
2
- Adds a small badge over the upper-right corner of some content.
3
-
4
- ## Props
5
-
6
- ### color
7
- `string`
8
-
9
- Sets `$color`
10
-
11
- ### text
12
- `string`
13
-
14
- The badge text.
15
-
16
- ## Example
17
- ```svelte
18
- <script>
19
- import { Badge } from "@axel669/zephyr"
20
-
21
- let count = 10
22
- </script>
23
-
24
- <Badge text={count}>
25
- Unread Messages
26
- </Badge>
27
- <Badge text="1k+" color="warning">
28
- <button on:click={() => count += 1}>Clickable Content</button>
29
- </Badge>
30
- ```
@@ -1,36 +0,0 @@
1
- # Chip
2
-
3
- Shows a small piece of information that is separate from the surrounding
4
- info and optionally allows interaction.
5
-
6
- ## Props
7
-
8
- ### color
9
- `string`
10
-
11
- Sets `$color`
12
-
13
- ### clickable
14
- `bool`
15
-
16
- If true, the chip will have the button ripple effect when clicked.
17
-
18
- ### fill
19
- `bool`
20
-
21
- If true, sets $fill on the chip. If false $outline is set instead.
22
-
23
- ## Events
24
- - click
25
-
26
- ## Example
27
- ```svelte
28
- <script>
29
- import { Chip } from "@axel669/zephyr"
30
- </script>
31
-
32
- Emails:
33
- <Chip clickable>admin@site.com</Chip>
34
- <Chip clickable color="warning">weirdge@site.com</Chip>
35
- <Chip color="primary" fill>required@site.io</Chip>
36
- ```
@@ -1,42 +0,0 @@
1
- # Details
2
- A component that has some baseline content that is shown, then expands to reveal
3
- more content (like the html details element).
4
-
5
- ## Props
6
-
7
- ### color
8
- Sets the $color macro.
9
-
10
- ### label
11
- The text for the content that is always shown.
12
-
13
- ### open
14
- Controls whether the Details is showing the extended content. Can be bound to.
15
-
16
- ### outline
17
- If true, will put an outline around the component, including the extended
18
- content.
19
-
20
- ## Slots
21
-
22
- ### default
23
- The content to show when the Details is open.
24
-
25
- ### label
26
- Can be used for more complex labels (things that need nested elements). If used,
27
- the label prop will be ignored.
28
-
29
- ## Example
30
-
31
- ```svelte
32
- <script>
33
- import { Details } from "@axel669/zephyr"
34
-
35
- let open = false
36
- </script>
37
-
38
- <div>Open: {open}</div>
39
- <Details label="Info" bind:open>
40
- Look, more info could go here!
41
- </Details>
42
- ```
@@ -1,32 +0,0 @@
1
- # Popover
2
-
3
- The Popover component is for displaying content over something without it
4
- being modal (you can interact with things under it still).
5
-
6
- ## Variables
7
- - show
8
- - hide
9
- The Popover exposes 2 variables for use: `show` and `hide`. These functions
10
- are given to the content so that it can control when to display the popover
11
- content without needing to bind to the parent.
12
-
13
- > Beacuse the hide function is given to a named slot, the `let:hide` declaration
14
- > needs to be on the slotted element.
15
-
16
- ## Example
17
- ```svelte
18
- <script>
19
- import { Popover, Button } from "@axel669/zephyr"
20
- </script>
21
-
22
- <Popover let:show>
23
- <Button on:click={show}>
24
- Show
25
- </Button>
26
- <div ws-x="inset-x[0px] y[0px] h[100px] bg[teal]" slot="content" let:hide>
27
- <Button on:click={hide}>
28
- Hide
29
- </Button>
30
- </div>
31
- </Popover>
32
- ```
@@ -1,46 +0,0 @@
1
- # Progress
2
-
3
- Displays progress bar with an optional label.
4
-
5
- ## Props
6
-
7
- ### color
8
- `string`
9
-
10
- Sets `$color`
11
-
12
- ### label
13
- `string`
14
-
15
- The label for the bar
16
-
17
- ### max
18
- `number`
19
-
20
- Sets the max value for the progress bar. Default is 1
21
-
22
- ### outline
23
- `bool`
24
-
25
- Sets `$outline`
26
-
27
- ### row
28
- `bool`
29
-
30
- Sets `$row`
31
-
32
- ### value
33
- `number`
34
-
35
- Sets the value of the progress bar. Combined with max to determine how
36
- filled the bar is.
37
-
38
- ## Example
39
- ```svelte
40
- <script>
41
- import { Progress } from "@axel669/zephyr"
42
- </script>
43
-
44
- <Progress color="primary" value={0.1} />
45
- <Progress color="primary" value={5} max={10} />
46
- ```
@@ -1,59 +0,0 @@
1
- # Table
2
- Wrapper for making tables in a way that is easy to maintain.
3
-
4
- ## Props
5
-
6
- ### color
7
- `string`
8
-
9
- Sets the $color macro.
10
-
11
- ### data
12
- `Array`
13
-
14
- The data to display in the table.
15
-
16
- ### fillHeader
17
- `bool`
18
-
19
- If true, the header row will have the background filled instead of just the
20
- colored border.
21
-
22
- ## Slots
23
-
24
- ### header
25
- Used to render the header for the table. Needs to include the `tr`.
26
-
27
- ### row
28
- Used to render an item that is not `undefined`. Needs to include the `tr`. Uses
29
- `let:row` for the row data, and `let:rowNum` for the row number (0-based).
30
-
31
- ### empty-row
32
- If given, will render when the item in the array is `undefined`. Uses
33
- `let:rowNum` for the row number (0-based).
34
-
35
- ## Example
36
- ```svelte
37
- <script>
38
- import { Table } from "@axel669/zephyr"
39
-
40
- const data = Array.from(
41
- { length: 20 },
42
- (_, i) => [i, i ** 2, i ** 3]
43
- )
44
- </script>
45
-
46
- <Table>
47
- <tr slot="header">
48
- <th>N</th>
49
- <th>Squared</th>
50
- <th>Cubed</th>
51
- </tr>
52
-
53
- <tr slot="row" let:row>
54
- <td>{row[0]}</td>
55
- <td>{row[1]}</td>
56
- <td>{row[2]}</td>
57
- </tr>
58
- </Table>
59
- ```
@@ -1,29 +0,0 @@
1
- # Tooltip
2
-
3
- Displays a tooltip above (or below) some content when it's hovered.
4
-
5
- ## Props
6
-
7
- ### text
8
- `string`
9
-
10
- The text to display in the tooltip.
11
-
12
- ### bottom
13
- `bool`
14
-
15
- If true, the tooltip will be shown under the content instead of over.
16
-
17
- ## Example
18
- ```svelte
19
- <script>
20
- import { Tooltip, Button } from "@axel669/zephyr"
21
- </script>
22
-
23
- <Tooltip text="This is a button">
24
- <Button>Do Thing</Button>
25
- </Tooltip>
26
- <Tooltip text="This shows under" bottom>
27
- Just some text content
28
- </Tooltip>
29
- ```
@@ -1,42 +0,0 @@
1
- # Alert Dialog
2
- A nicer alert dialog to use with [Modal](../layout/dialog.md).
3
-
4
- ## Props
5
-
6
- ### color
7
- Sets the $color macro.
8
-
9
- ### icon
10
- The name of an icon to show with the title of the alert.
11
-
12
- ### message
13
- The message to shwo in the alert.
14
-
15
- ### okText
16
- The text for the button that closes the alert.
17
-
18
- ### title
19
- The title for the alert.
20
-
21
- ## Example
22
- ```svelte
23
- <script>
24
- import { Alert, Button, EntryButton, Modal } from "@axel669/zephyr"
25
-
26
- let alertModal = null
27
- const alertProps = {
28
- title: "Alert Example",
29
- message: "This is an alert!"
30
- }
31
- const show = () => alertModal.show(alertProps)
32
- </script>
33
-
34
- <Modal component={Alert} bind:this={alertModal} />
35
- <Button on:click={show}>
36
- Show Alert
37
- </Button>
38
-
39
- <EntryButton props={alertProps}>
40
- Show Alert
41
- </EntryButton>
42
- ```