@axel669/zephyr 0.3.8 → 0.4.5

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 (76) 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/input.svelte +21 -41
  9. package/src/control/label.svelte +1 -1
  10. package/src/control/link.svelte +1 -1
  11. package/src/control/radio-group.svelte +21 -0
  12. package/src/control/select.svelte +5 -5
  13. package/src/control/tabs.svelte +9 -21
  14. package/src/control/toggle.svelte +2 -2
  15. package/src/data-display/avatar.svelte +4 -1
  16. package/src/data-display/badge.svelte +1 -1
  17. package/src/data-display/chip.svelte +1 -1
  18. package/src/data-display/popover.svelte +1 -1
  19. package/src/data-display/progress.svelte +2 -2
  20. package/src/data-display/table.svelte +1 -1
  21. package/src/dialogs/confirm.svelte +3 -3
  22. package/src/hash.js +3 -3
  23. package/src/index.mjs +11 -1
  24. package/src/info/notification.svelte +13 -1
  25. package/src/info/titlebar.svelte +21 -5
  26. package/src/layout/dialog.svelte +1 -1
  27. package/src/layout/drawer.svelte +4 -4
  28. package/src/layout/flex.svelte +0 -4
  29. package/src/layout/grid.svelte +4 -4
  30. package/src/layout/paper.svelte +13 -4
  31. package/src/routing/route.svelte +48 -0
  32. package/src/routing/routing.js +62 -0
  33. package/src/routing/title.svelte +26 -0
  34. package/src/spinner/circle-spinner.svelte +2 -1
  35. package/src/spinner/hexagon-spinner.svelte +2 -1
  36. package/src/text.svelte +2 -4
  37. package/src/wsx.mjs +9 -8
  38. package/src/async/button.md +0 -27
  39. package/src/async/load-zone.md +0 -42
  40. package/src/composed/data-table/th.md +0 -21
  41. package/src/composed/data-table.md +0 -86
  42. package/src/composed/entry-button.md +0 -44
  43. package/src/composed/toast.md +0 -45
  44. package/src/control/button.md +0 -41
  45. package/src/control/input.md +0 -87
  46. package/src/control/label.md +0 -48
  47. package/src/control/link.md +0 -50
  48. package/src/control/radio.md +0 -58
  49. package/src/control/radio.svelte +0 -28
  50. package/src/control/select.md +0 -70
  51. package/src/control/tabs.md +0 -47
  52. package/src/control/toggle.md +0 -61
  53. package/src/data-display/avatar.md +0 -36
  54. package/src/data-display/badge.md +0 -30
  55. package/src/data-display/chip.md +0 -36
  56. package/src/data-display/details.md +0 -42
  57. package/src/data-display/popover.md +0 -32
  58. package/src/data-display/progress.md +0 -46
  59. package/src/data-display/table.md +0 -59
  60. package/src/data-display/tooltip.md +0 -29
  61. package/src/dialogs/alert.md +0 -42
  62. package/src/dialogs/confirm.md +0 -56
  63. package/src/functions.md +0 -108
  64. package/src/info/icon.md +0 -21
  65. package/src/info/notification.md +0 -36
  66. package/src/info/titlebar.md +0 -75
  67. package/src/info/toaster.md +0 -26
  68. package/src/layout/dialog.md +0 -43
  69. package/src/layout/drawer.md +0 -70
  70. package/src/layout/flex.md +0 -43
  71. package/src/layout/grid.md +0 -61
  72. package/src/layout/modal.md +0 -50
  73. package/src/layout/paper.md +0 -94
  74. package/src/layout/screen.md +0 -33
  75. package/src/spinner/spinners.md +0 -22
  76. package/src/text.md +0 -34
@@ -1,45 +0,0 @@
1
- # Toast
2
- Displays toast notifications along the edge of the screen. Unlike the Toaster
3
- component, this has functions for interacting with and generating toast
4
- messages, where the Toaster component has the programmer manage the content.
5
-
6
- ## Props
7
- See the Toaster component. The Toast component is wrapper around it that
8
- also controls the children being shown for convenience.
9
-
10
- ### component
11
- The component to use as a wrapper for the messages. Defaults to the
12
- ToastMessage component.
13
-
14
- ### position
15
- The position to show modals in. Uses the same positions as the Windstorm
16
- toaster.
17
-
18
- ## Functions
19
-
20
- ### show(duration, props)
21
- Shows a toast notification that will disappear after the specified
22
- duration (time in milliseconds). The props provided are passed to an
23
- instance of the component specified in the props.
24
-
25
- ## Events
26
-
27
- ### action
28
- Fired when a toast message is clicked. The info argument contains a
29
- value property that is provided by the message component, and a copy
30
- of the props passed to that instace.
31
-
32
- For the default messages, the value will be `null` if no button was
33
- clicked, and `true` if the action button was clicked. This allows
34
- actions to be taken against interactions in the message without having
35
- to bind all kinds of events or callbacks.
36
-
37
- ## Example
38
- ```svelte
39
- <script>
40
- let toast = null
41
- const notify = () => toast.show(5000, { message: "hi" })
42
- </script>
43
-
44
- <Toast bind:this={toast} position="bc" />
45
- ```
@@ -1,41 +0,0 @@
1
- # Button
2
-
3
- Basic clickable component for handling user interaction.
4
-
5
- ## Props
6
-
7
- ### color
8
- `string`
9
-
10
- Sets `$color`
11
-
12
- ### compact
13
- `bool`
14
-
15
- Sets `$compact`
16
-
17
- ### fill / outline
18
- `bool`
19
-
20
- Sets the button type to `$fill` if fill is true, `$outline` if outline
21
- is true, or `$flat` if neither is true.
22
-
23
- ## Events
24
- - click
25
-
26
- ## Example
27
- ```svelte
28
- <script>
29
- import { Button } from "@axel669/zephyr"
30
- </script>
31
-
32
- <Button on:click={action}>
33
- Flat Button
34
- </Button>
35
- <Button on:click={action} outline>
36
- Outlined Button
37
- </Button>
38
- <Button on:click={action} fill color="danger">
39
- Filled Button
40
- </Button>
41
- ```
@@ -1,87 +0,0 @@
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,48 +0,0 @@
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,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
- ```