@flightlesslabs/dodo-ui 0.7.2 → 0.8.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.
- package/dist/index.d.ts +5 -0
- package/dist/index.js +3 -0
- package/dist/stories/components/Form/Select/Customize/Customize.stories.svelte +16 -1
- package/dist/stories/components/Form/Select/DropDownArrow/DropDownArrow.stories.svelte +59 -0
- package/dist/stories/components/Form/Select/DropDownArrow/DropDownArrow.stories.svelte.d.ts +18 -0
- package/dist/stories/components/Form/Select/Positions/AutoPosition/AutoPosition.stories.svelte +54 -0
- package/dist/stories/components/Form/Select/Positions/AutoPosition/AutoPosition.stories.svelte.d.ts +18 -0
- package/dist/stories/components/Form/Select/Positions/Positions.stories.svelte +83 -0
- package/dist/stories/components/Form/Select/Positions/Positions.stories.svelte.d.ts +18 -0
- package/dist/stories/components/Form/Select/Select.svelte +107 -123
- package/dist/stories/components/Form/Select/Select.svelte.d.ts +15 -2
- package/dist/stories/components/Layout/Menu/DynamicMenu/Customize/Customize.stories.svelte +28 -0
- package/dist/stories/components/Layout/Menu/DynamicMenu/Customize/Customize.stories.svelte.d.ts +18 -0
- package/dist/stories/components/Layout/Menu/DynamicMenu/DynamicMenu.stories.svelte +51 -0
- package/dist/stories/components/Layout/Menu/DynamicMenu/DynamicMenu.stories.svelte.d.ts +22 -0
- package/dist/stories/components/Layout/Menu/DynamicMenu/DynamicMenu.svelte +129 -0
- package/dist/stories/components/Layout/Menu/DynamicMenu/DynamicMenu.svelte.d.ts +81 -0
- package/dist/stories/components/Layout/Menu/DynamicMenu/Events/Events.stories.svelte +46 -0
- package/dist/stories/components/Layout/Menu/DynamicMenu/Events/Events.stories.svelte.d.ts +18 -0
- package/dist/stories/components/Layout/Menu/DynamicMenu/KeybaordNavigation/KeybaordNavigation.stories.svelte +27 -0
- package/dist/stories/components/Layout/Menu/DynamicMenu/KeybaordNavigation/KeybaordNavigation.stories.svelte.d.ts +18 -0
- package/dist/stories/components/Layout/Menu/DynamicMenu/Options/OptionFormat.mdx +72 -0
- package/dist/stories/components/Layout/Menu/MenuItem/MenuItem.svelte.d.ts +1 -1
- package/dist/stories/developer tools/components/DynamicInput/DynamicInput.svelte +1 -0
- package/package.json +15 -17
- package/src/lib/index.ts +13 -0
- package/src/lib/stories/Home.mdx +59 -0
- package/src/lib/stories/assets/dark-theme-toggle.png +0 -0
- package/src/lib/stories/components/Form/Button/Button.stories.svelte +61 -0
- package/src/lib/stories/components/Form/Button/Color/Color.stories.svelte +43 -0
- package/src/lib/stories/components/Form/Button/Events/Events.stories.svelte +36 -0
- package/src/lib/stories/components/Form/Button/IconButton/IconButton.stories.svelte +43 -0
- package/src/lib/stories/components/Form/Button/Roundness/Roundness.stories.svelte +23 -0
- package/src/lib/stories/components/Form/Button/Size/Size.stories.svelte +16 -0
- package/src/lib/stories/components/Form/Button/Variant/Variant.stories.svelte +18 -0
- package/src/lib/stories/components/Form/FormControl/FormControl.stories.svelte +28 -0
- package/src/lib/stories/components/Form/Label/Label.stories.svelte +13 -0
- package/src/lib/stories/components/Form/Message/Color/Color.stories.svelte +36 -0
- package/src/lib/stories/components/Form/Message/Message.stories.svelte +27 -0
- package/src/lib/stories/components/Form/Message/Size/Size.stories.svelte +22 -0
- package/src/lib/stories/components/Form/PasswordInput/Events/Events.stories.svelte +110 -0
- package/src/lib/stories/components/Form/PasswordInput/PasswordInput.stories.svelte +59 -0
- package/src/lib/stories/components/Form/PasswordInput/Roundness/Roundness.stories.svelte +20 -0
- package/src/lib/stories/components/Form/PasswordInput/Size/Size.stories.svelte +16 -0
- package/src/lib/stories/components/Form/PasswordInput/WithIcon/WithIcon.stories.svelte +31 -0
- package/src/lib/stories/components/Form/Select/Customize/Customize.stories.svelte +139 -0
- package/src/lib/stories/components/Form/Select/DropDownArrow/DropDownArrow.stories.svelte +63 -0
- package/src/lib/stories/components/Form/Select/Events/Events.stories.svelte +144 -0
- package/src/lib/stories/components/Form/Select/Options/OptionFormat.mdx +40 -0
- package/src/lib/stories/components/Form/Select/Positions/AutoPosition/AutoPosition.stories.svelte +58 -0
- package/src/lib/stories/components/Form/Select/Positions/Positions.stories.svelte +87 -0
- package/src/lib/stories/components/Form/Select/Roundness/Roundness.stories.svelte +32 -0
- package/src/lib/stories/components/Form/Select/Select.stories.svelte +121 -0
- package/src/lib/stories/components/Form/Select/Select.svelte +153 -146
- package/src/lib/stories/components/Form/Select/Size/Size.stories.svelte +28 -0
- package/src/lib/stories/components/Form/Select/WithIcon/WithIcon.stories.svelte +43 -0
- package/src/lib/stories/components/Form/TextInput/Events/Events.stories.svelte +97 -0
- package/src/lib/stories/components/Form/TextInput/Roundness/Roundness.stories.svelte +21 -0
- package/src/lib/stories/components/Form/TextInput/Size/Size.stories.svelte +17 -0
- package/src/lib/stories/components/Form/TextInput/TextInput.stories.svelte +43 -0
- package/src/lib/stories/components/Form/TextInput/WithIcon/WithIcon.stories.svelte +47 -0
- package/src/lib/stories/components/Layout/Menu/DynamicMenu/Customize/Customize.stories.svelte +30 -0
- package/src/lib/stories/components/Layout/Menu/DynamicMenu/DynamicMenu.stories.svelte +56 -0
- package/src/lib/stories/components/Layout/Menu/DynamicMenu/DynamicMenu.svelte +262 -0
- package/src/lib/stories/components/Layout/Menu/DynamicMenu/Events/Events.stories.svelte +48 -0
- package/src/lib/stories/components/Layout/Menu/DynamicMenu/KeybaordNavigation/KeybaordNavigation.stories.svelte +29 -0
- package/src/lib/stories/components/Layout/Menu/DynamicMenu/Options/OptionFormat.mdx +72 -0
- package/src/lib/stories/components/Layout/Menu/Menu.stories.svelte +69 -0
- package/src/lib/stories/components/Layout/Menu/MenuItem/MenuItem.stories.svelte +34 -0
- package/src/lib/stories/components/Layout/Menu/MenuItem/MenuItem.svelte +1 -1
- package/src/lib/stories/components/Layout/Menu/MenuItem/Size/Size.stories.svelte +16 -0
- package/src/lib/stories/components/Layout/Menu/MenuItem/Type/Type.stories.svelte +21 -0
- package/src/lib/stories/components/Layout/Menu/Size/Size.stories.svelte +37 -0
- package/src/lib/stories/components/Layout/Paper/Color/Color.stories.svelte +63 -0
- package/src/lib/stories/components/Layout/Paper/Paper.stories.svelte +50 -0
- package/src/lib/stories/components/Layout/Paper/Roundness/Roundness.stories.svelte +25 -0
- package/src/lib/stories/components/Layout/Paper/Shadow/Shadow.stories.svelte +24 -0
- package/src/lib/stories/components/Layout/Separator/Color/Color.stories.svelte +19 -0
- package/src/lib/stories/components/Layout/Separator/Separator.stories.svelte +30 -0
- package/src/lib/stories/developer tools/Intro.mdx +9 -0
- package/src/lib/stories/developer tools/components/DynamicInput/DynamicInput.stories.svelte +53 -0
- package/src/lib/stories/developer tools/components/DynamicInput/DynamicInput.svelte +1 -0
- package/src/lib/stories/developer tools/components/DynamicInput/Size/Size.stories.svelte +17 -0
- package/src/lib/stories/developer tools/components/InputEnclosure/InputEnclosure.stories.svelte +38 -0
- package/src/lib/stories/developer tools/components/InputEnclosure/Roundness/Roundness.stories.svelte +20 -0
- package/src/lib/stories/developer tools/components/InputEnclosure/Size/Size.stories.svelte +16 -0
- package/src/lib/stories/developer tools/components/InputEnclosure/WithIcon/WithIcon.stories.svelte +47 -0
- package/src/lib/stories/developer tools/components/Popper/Popper.stories.svelte +124 -0
- package/src/lib/stories/developer tools/components/Popper/PopperPopup/PopperPopup.stories.svelte +64 -0
- package/src/lib/stories/developer tools/components/Popper/Positions/AutoPosition/AutoPosition.stories.svelte +92 -0
- package/src/lib/stories/developer tools/components/Popper/Positions/Positions.stories.svelte +114 -0
- package/src/lib/stories/developer tools/components/UtilityButton/Size/Size.stories.svelte +25 -0
- package/src/lib/stories/developer tools/components/UtilityButton/UtilityButton.stories.svelte +30 -0
- package/src/lib/stories/developer tools/directives/clickOutside/index.mdx +25 -0
- package/src/lib/stories/developer tools/philosophy/Colors/Colors.mdx +43 -0
- package/src/lib/stories/developer tools/philosophy/Colors/Colors.stories.svelte +22 -0
- package/src/lib/stories/developer tools/philosophy/Colors/Opacity.stories.svelte +11 -0
- package/src/lib/stories/developer tools/philosophy/Themes.mdx +23 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Source } from '@storybook/blocks';
|
|
2
|
+
import item from '../../../package.json?raw';
|
|
3
|
+
|
|
4
|
+
<main style={{ textAlign: 'center' }}>
|
|
5
|
+
|
|
6
|
+
<img src="dodo-circle-6.png" style={{ width: 200, height: 'auto' }} />
|
|
7
|
+
|
|
8
|
+
# Dodo UI
|
|
9
|
+
|
|
10
|
+
<h3 style={{ fontWeight: 500 }}>v{JSON.parse(item)?.version}</h3>
|
|
11
|
+
|
|
12
|
+
<h3 style={{ fontWeight: 400 }}>An open-source, opinionated UI framework for Svelte.</h3>
|
|
13
|
+
|
|
14
|
+
### [Github](https://github.com/flightlesslabs/dodo-ui) - [npm](https://www.npmjs.com/package/@flightlesslabs/dodo-ui)
|
|
15
|
+
|
|
16
|
+
</main>
|
|
17
|
+
|
|
18
|
+
<br />
|
|
19
|
+
<br />
|
|
20
|
+
|
|
21
|
+
## Install
|
|
22
|
+
|
|
23
|
+
pnpm
|
|
24
|
+
|
|
25
|
+
<Source
|
|
26
|
+
dark
|
|
27
|
+
language="bash"
|
|
28
|
+
code={`
|
|
29
|
+
pnpm add @flightlesslabs/dodo-ui
|
|
30
|
+
`}
|
|
31
|
+
/>
|
|
32
|
+
|
|
33
|
+
npm
|
|
34
|
+
|
|
35
|
+
<Source
|
|
36
|
+
dark
|
|
37
|
+
language="bash"
|
|
38
|
+
code={`
|
|
39
|
+
npm i @flightlesslabs/dodo-ui
|
|
40
|
+
`}
|
|
41
|
+
/>
|
|
42
|
+
|
|
43
|
+
## Use it!
|
|
44
|
+
|
|
45
|
+
Lets import [Button](?path=/docs/components-form-button--docs) component. Checkout documentation for [Button](?path=/docs/components-form-button--docs)
|
|
46
|
+
|
|
47
|
+
<Source
|
|
48
|
+
dark
|
|
49
|
+
language="js"
|
|
50
|
+
code={`
|
|
51
|
+
import { Button } '@flightlesslabs/dodo-ui';
|
|
52
|
+
`}
|
|
53
|
+
/>
|
|
54
|
+
|
|
55
|
+
## Explore more
|
|
56
|
+
|
|
57
|
+
- [Dark Theme](?path=/docs/developer-tools-philosophy-themes--docs#dark-theme)
|
|
58
|
+
- [Colors](?path=/docs/developer-tools-philosophy-colors--docs)
|
|
59
|
+
- [Adjust Color Opacity](?path=/docs/developer-tools-philosophy-colors--docs#adjusting-opacity)
|
|
Binary file
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import Button, { buttonTypeArray } from './Button.svelte';
|
|
4
|
+
import type { StoryBookArgTypes } from '$lib/storybook-types.js';
|
|
5
|
+
import { componentRoundnessArray } from '$lib/types/roundness.js';
|
|
6
|
+
import { componentColorArray } from '$lib/types/colors.js';
|
|
7
|
+
import { componentWeightArray } from '$lib/types/weight.js';
|
|
8
|
+
import { componentSizeArray } from '$lib/types/size.js';
|
|
9
|
+
|
|
10
|
+
export const storyButtonArgTypes: StoryBookArgTypes = {
|
|
11
|
+
type: {
|
|
12
|
+
control: { type: 'select' },
|
|
13
|
+
options: buttonTypeArray,
|
|
14
|
+
},
|
|
15
|
+
color: {
|
|
16
|
+
control: { type: 'select' },
|
|
17
|
+
options: componentColorArray,
|
|
18
|
+
},
|
|
19
|
+
variant: {
|
|
20
|
+
control: { type: 'select' },
|
|
21
|
+
options: componentWeightArray,
|
|
22
|
+
},
|
|
23
|
+
roundness: {
|
|
24
|
+
control: { type: 'select' },
|
|
25
|
+
options: componentRoundnessArray,
|
|
26
|
+
},
|
|
27
|
+
size: {
|
|
28
|
+
control: { type: 'select' },
|
|
29
|
+
options: componentSizeArray,
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
34
|
+
const { Story } = defineMeta({
|
|
35
|
+
component: Button,
|
|
36
|
+
tags: ['autodocs'],
|
|
37
|
+
argTypes: storyButtonArgTypes,
|
|
38
|
+
});
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
<!-- Button with default style -->
|
|
42
|
+
<Story name="Primary">Click me!</Story>
|
|
43
|
+
|
|
44
|
+
<!-- Button with border around it -->
|
|
45
|
+
<Story name="Outline" args={{ outline: true, variant: 'text' }}>Click me!</Story>
|
|
46
|
+
|
|
47
|
+
<Story name="Disabled" args={{ disabled: true }}>Click me!</Story>
|
|
48
|
+
|
|
49
|
+
<!-- Form submit button -->
|
|
50
|
+
<Story name="Sumbit Button" args={{ type: 'submit' }}>Submit Form</Story>
|
|
51
|
+
|
|
52
|
+
<!-- Form submit button -->
|
|
53
|
+
<Story name="Full width Button" args={{ fullWidth: true }}>Click me!</Story>
|
|
54
|
+
|
|
55
|
+
<!-- Anchor Link styled like a Button -->
|
|
56
|
+
<Story
|
|
57
|
+
name="Link Button"
|
|
58
|
+
args={{ href: 'https://www.w3schools.com/tags/tag_a.asp', target: '_blank' }}
|
|
59
|
+
>
|
|
60
|
+
Link
|
|
61
|
+
</Story>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import Button from '../Button.svelte';
|
|
4
|
+
import { storyButtonArgTypes } from '../Button.stories.svelte';
|
|
5
|
+
|
|
6
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
7
|
+
const { Story } = defineMeta({
|
|
8
|
+
component: Button,
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
argTypes: storyButtonArgTypes,
|
|
11
|
+
});
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<Story name="Primary">Click me!</Story>
|
|
15
|
+
<Story name="Secondary" args={{ color: 'secondary' }}>Click me!</Story>
|
|
16
|
+
<Story name="Neutral" args={{ color: 'neutral' }}>Click me!</Story>
|
|
17
|
+
<Story name="Safe" args={{ color: 'safe' }}>Click me!</Story>
|
|
18
|
+
<Story name="Warning" args={{ color: 'warning' }}>Click me!</Story>
|
|
19
|
+
<Story name="Danger" args={{ color: 'danger' }}>Click me!</Story>
|
|
20
|
+
|
|
21
|
+
<Story name="Primary Text" args={{ color: 'primary', variant: 'text' }}>Click me!</Story>
|
|
22
|
+
<Story name="Secondary Text" args={{ color: 'secondary', variant: 'text' }}>Click me!</Story>
|
|
23
|
+
<Story name="Neutral Text" args={{ color: 'neutral', variant: 'text' }}>Click me!</Story>
|
|
24
|
+
<Story name="Safe Text" args={{ color: 'safe', variant: 'text' }}>Click me!</Story>
|
|
25
|
+
<Story name="Warning Text" args={{ color: 'warning', variant: 'text' }}>Click me!</Story>
|
|
26
|
+
<Story name="Danger Text" args={{ color: 'danger', variant: 'text' }}>Click me!</Story>
|
|
27
|
+
|
|
28
|
+
<Story name="Primary Outline" args={{ variant: 'text', outline: true }}>Click me!</Story>
|
|
29
|
+
<Story name="Secondary Outline" args={{ color: 'secondary', variant: 'text', outline: true }}>
|
|
30
|
+
Click me!
|
|
31
|
+
</Story>
|
|
32
|
+
<Story name="Neutral Outline" args={{ color: 'neutral', variant: 'text', outline: true }}>
|
|
33
|
+
Click me!
|
|
34
|
+
</Story>
|
|
35
|
+
<Story name="Safe Outline" args={{ color: 'safe', variant: 'text', outline: true }}>
|
|
36
|
+
Click me!
|
|
37
|
+
</Story>
|
|
38
|
+
<Story name="Warning Outline" args={{ color: 'warning', variant: 'text', outline: true }}>
|
|
39
|
+
Click me!
|
|
40
|
+
</Story>
|
|
41
|
+
<Story name="Danger Outline" args={{ color: 'danger', variant: 'text', outline: true }}>
|
|
42
|
+
Click me!
|
|
43
|
+
</Story>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import Button from '../Button.svelte';
|
|
4
|
+
import { storyButtonArgTypes } from '../Button.stories.svelte';
|
|
5
|
+
|
|
6
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
7
|
+
const { Story } = defineMeta({
|
|
8
|
+
component: Button,
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
argTypes: storyButtonArgTypes,
|
|
11
|
+
});
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<Story
|
|
15
|
+
name="Click"
|
|
16
|
+
args={{
|
|
17
|
+
onclick: (e: Event) => {
|
|
18
|
+
const target = e.target as HTMLButtonElement;
|
|
19
|
+
|
|
20
|
+
alert('Button Clicked');
|
|
21
|
+
console.log('Button Clicked', target);
|
|
22
|
+
},
|
|
23
|
+
}}
|
|
24
|
+
asChild
|
|
25
|
+
>
|
|
26
|
+
<Button
|
|
27
|
+
onclick={(e: Event) => {
|
|
28
|
+
const target = e.target as HTMLButtonElement;
|
|
29
|
+
|
|
30
|
+
alert('Button Clicked');
|
|
31
|
+
console.log('Button Clicked', target);
|
|
32
|
+
}}
|
|
33
|
+
>
|
|
34
|
+
Click me!
|
|
35
|
+
</Button>
|
|
36
|
+
</Story>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import Button from '../Button.svelte';
|
|
4
|
+
import { storyButtonArgTypes } from '../Button.stories.svelte';
|
|
5
|
+
import Icon from '@iconify/svelte';
|
|
6
|
+
|
|
7
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
8
|
+
const { Story } = defineMeta({
|
|
9
|
+
component: Button,
|
|
10
|
+
tags: ['autodocs'],
|
|
11
|
+
argTypes: storyButtonArgTypes,
|
|
12
|
+
});
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<!-- Compact button with paddings stripped out and fixed size. We are using this icon library https://iconify.design/docs/icon-components/svelte/ -->
|
|
16
|
+
<Story name="Icon Button" args={{ compact: true }}>
|
|
17
|
+
<Icon icon="material-symbols:app-badging" width="18" height="18" />
|
|
18
|
+
</Story>
|
|
19
|
+
|
|
20
|
+
<!-- Circualr Icon button. -->
|
|
21
|
+
<Story name="Icon Button Circular" args={{ compact: true, roundness: 'full' }}>
|
|
22
|
+
<Icon icon="material-symbols:app-badging" width="18" height="18" />
|
|
23
|
+
</Story>
|
|
24
|
+
|
|
25
|
+
<!-- Button with an icon in front. -->
|
|
26
|
+
<Story name="Icon Before" asChild>
|
|
27
|
+
<Button>
|
|
28
|
+
{#snippet before()}
|
|
29
|
+
<Icon icon="material-symbols:content-copy" />
|
|
30
|
+
{/snippet}
|
|
31
|
+
Copy
|
|
32
|
+
</Button>
|
|
33
|
+
</Story>
|
|
34
|
+
|
|
35
|
+
<!-- Button with an icon in front. -->
|
|
36
|
+
<Story name="Icon After" asChild>
|
|
37
|
+
<Button>
|
|
38
|
+
{#snippet after()}
|
|
39
|
+
<Icon icon="material-symbols:download-2" />
|
|
40
|
+
{/snippet}
|
|
41
|
+
Download
|
|
42
|
+
</Button>
|
|
43
|
+
</Story>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import Button from '../Button.svelte';
|
|
4
|
+
import { storyButtonArgTypes } from '../Button.stories.svelte';
|
|
5
|
+
|
|
6
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
7
|
+
const { Story } = defineMeta({
|
|
8
|
+
component: Button,
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
argTypes: storyButtonArgTypes,
|
|
11
|
+
});
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<Story name="Roundness 1">Click me!</Story>
|
|
15
|
+
|
|
16
|
+
<Story name="Roundness 2" args={{ roundness: 2 }}>Click me!</Story>
|
|
17
|
+
|
|
18
|
+
<Story name="Roundness 3" args={{ roundness: 3 }}>Click me!</Story>
|
|
19
|
+
|
|
20
|
+
<Story name="Roundness 0" args={{ roundness: 0 }}>Click me!</Story>
|
|
21
|
+
|
|
22
|
+
<!-- Button with 50% roundness usefull for icon (Compact) buttons -->
|
|
23
|
+
<Story name="Roundness Full" args={{ roundness: 'full', compact: true }}>C</Story>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import Button from '../Button.svelte';
|
|
4
|
+
import { storyButtonArgTypes } from '../Button.stories.svelte';
|
|
5
|
+
|
|
6
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
7
|
+
const { Story } = defineMeta({
|
|
8
|
+
component: Button,
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
argTypes: storyButtonArgTypes,
|
|
11
|
+
});
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<Story name="Normal">Click me!</Story>
|
|
15
|
+
<Story name="Small" args={{ size: 'small' }}>Click me!</Story>
|
|
16
|
+
<Story name="Large" args={{ size: 'large' }}>Click me!</Story>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import Button from '../Button.svelte';
|
|
4
|
+
import { storyButtonArgTypes } from '../Button.stories.svelte';
|
|
5
|
+
|
|
6
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
7
|
+
const { Story } = defineMeta({
|
|
8
|
+
component: Button,
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
argTypes: storyButtonArgTypes,
|
|
11
|
+
});
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<Story name="Solid">Click me!</Story>
|
|
15
|
+
|
|
16
|
+
<Story name="Text" args={{ variant: 'text' }}>Click me!</Story>
|
|
17
|
+
|
|
18
|
+
<Story name="Text Outline" args={{ variant: 'text', outline: true }}>Click me!</Story>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import FormControl from './FormControl.svelte';
|
|
4
|
+
import TextInput from '../TextInput/TextInput.svelte';
|
|
5
|
+
|
|
6
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
7
|
+
const { Story } = defineMeta({
|
|
8
|
+
component: FormControl,
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
});
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<Story name="Default" args={{ label: 'Hello there' }} />
|
|
14
|
+
|
|
15
|
+
<Story name="Example TextInput" args={{ label: 'Whats your first name?', for: 'first-name-01' }}>
|
|
16
|
+
<TextInput placeholder="First name" id="first-name-01" />
|
|
17
|
+
</Story>
|
|
18
|
+
|
|
19
|
+
<Story
|
|
20
|
+
name="ErrorMessage"
|
|
21
|
+
args={{
|
|
22
|
+
label: 'Whats your first name?',
|
|
23
|
+
for: 'first-name-02',
|
|
24
|
+
errorMessage: 'This is an error message',
|
|
25
|
+
}}
|
|
26
|
+
>
|
|
27
|
+
<TextInput value="John Smith" id="first-name-02" error />
|
|
28
|
+
</Story>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import Label from './Label.svelte';
|
|
4
|
+
|
|
5
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
6
|
+
const { Story } = defineMeta({
|
|
7
|
+
component: Label,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
});
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<!-- Label with default style -->
|
|
13
|
+
<Story name="Default">This is a form label</Story>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import Message from '../Message.svelte';
|
|
4
|
+
import { storyMessageArgTypes } from '../Message.stories.svelte';
|
|
5
|
+
|
|
6
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
7
|
+
const { Story } = defineMeta({
|
|
8
|
+
component: Message,
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
argTypes: storyMessageArgTypes,
|
|
11
|
+
});
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<Story name="Primary" args={{ color: 'primary' }}>
|
|
15
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit
|
|
16
|
+
</Story>
|
|
17
|
+
|
|
18
|
+
<Story name="Secondary" args={{ color: 'secondary' }}>
|
|
19
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit
|
|
20
|
+
</Story>
|
|
21
|
+
|
|
22
|
+
<Story name="Neutral" args={{ color: 'neutral' }}>
|
|
23
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit
|
|
24
|
+
</Story>
|
|
25
|
+
|
|
26
|
+
<Story name="Safe" args={{ color: 'safe' }}>
|
|
27
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit
|
|
28
|
+
</Story>
|
|
29
|
+
|
|
30
|
+
<Story name="Warning" args={{ color: 'warning' }}>
|
|
31
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit
|
|
32
|
+
</Story>
|
|
33
|
+
|
|
34
|
+
<Story name="Danger" args={{ color: 'danger' }}>
|
|
35
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit
|
|
36
|
+
</Story>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import Message from './Message.svelte';
|
|
4
|
+
import type { StoryBookArgTypes } from '$lib/storybook-types.js';
|
|
5
|
+
import { componentColorArray } from '$lib/types/colors.js';
|
|
6
|
+
import { componentSizeArray } from '$lib/types/size.js';
|
|
7
|
+
|
|
8
|
+
export const storyMessageArgTypes: StoryBookArgTypes = {
|
|
9
|
+
color: {
|
|
10
|
+
control: { type: 'select' },
|
|
11
|
+
options: componentColorArray,
|
|
12
|
+
},
|
|
13
|
+
size: {
|
|
14
|
+
control: { type: 'select' },
|
|
15
|
+
options: componentSizeArray,
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
20
|
+
const { Story } = defineMeta({
|
|
21
|
+
component: Message,
|
|
22
|
+
tags: ['autodocs'],
|
|
23
|
+
argTypes: storyMessageArgTypes,
|
|
24
|
+
});
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<Story name="Primary">Lorem ipsum dolor sit amet, consectetur adipiscing elit</Story>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import Message from '../Message.svelte';
|
|
4
|
+
import { storyMessageArgTypes } from '../Message.stories.svelte';
|
|
5
|
+
|
|
6
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
7
|
+
const { Story } = defineMeta({
|
|
8
|
+
component: Message,
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
argTypes: storyMessageArgTypes,
|
|
11
|
+
});
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<Story name="Normal">Lorem ipsum dolor sit amet, consectetur adipiscing elit</Story>
|
|
15
|
+
|
|
16
|
+
<Story name="Small" args={{ size: 'small' }}>
|
|
17
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit
|
|
18
|
+
</Story>
|
|
19
|
+
|
|
20
|
+
<Story name="Large" args={{ size: 'large' }}>
|
|
21
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit
|
|
22
|
+
</Story>
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import { storyPasswordInputArgTypes } from '../PasswordInput.stories.svelte';
|
|
4
|
+
import PasswordInput, { type PasswordInputToggleEvent } from '../PasswordInput.svelte';
|
|
5
|
+
import type {
|
|
6
|
+
TextInputFocusEvent,
|
|
7
|
+
TextInputClipboardEvent,
|
|
8
|
+
} from '../../TextInput/TextInput.svelte';
|
|
9
|
+
|
|
10
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
11
|
+
const { Story } = defineMeta({
|
|
12
|
+
component: PasswordInput,
|
|
13
|
+
tags: ['autodocs'],
|
|
14
|
+
argTypes: storyPasswordInputArgTypes,
|
|
15
|
+
});
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<Story
|
|
19
|
+
name="Input"
|
|
20
|
+
args={{
|
|
21
|
+
oninput: (e: Event) => {
|
|
22
|
+
const target = e.target as HTMLInputElement;
|
|
23
|
+
|
|
24
|
+
console.log('Input Event', target.value);
|
|
25
|
+
},
|
|
26
|
+
}}
|
|
27
|
+
/>
|
|
28
|
+
|
|
29
|
+
<Story
|
|
30
|
+
name="Change"
|
|
31
|
+
args={{
|
|
32
|
+
onchange: (e: Event) => {
|
|
33
|
+
const target = e.target as HTMLInputElement;
|
|
34
|
+
|
|
35
|
+
console.log('onChange Event', target.value);
|
|
36
|
+
},
|
|
37
|
+
}}
|
|
38
|
+
/>
|
|
39
|
+
|
|
40
|
+
<!-- `e: PasswordInputToggleEvent` -->
|
|
41
|
+
<Story
|
|
42
|
+
name="Toggle"
|
|
43
|
+
args={{
|
|
44
|
+
ontoggle: (e: PasswordInputToggleEvent) => {
|
|
45
|
+
const target = e.event.target as HTMLButtonElement;
|
|
46
|
+
|
|
47
|
+
console.log('ontoggle Event', e, target);
|
|
48
|
+
},
|
|
49
|
+
}}
|
|
50
|
+
/>
|
|
51
|
+
|
|
52
|
+
<!-- `e: TextInputFocusEvent` -->
|
|
53
|
+
<Story
|
|
54
|
+
name="Focus"
|
|
55
|
+
args={{
|
|
56
|
+
onfocus: (e: TextInputFocusEvent) => {
|
|
57
|
+
const target = e.target as HTMLInputElement;
|
|
58
|
+
|
|
59
|
+
console.log('onfocus Event', target);
|
|
60
|
+
},
|
|
61
|
+
}}
|
|
62
|
+
/>
|
|
63
|
+
|
|
64
|
+
<!-- `e: TextInputFocusEvent` -->
|
|
65
|
+
<Story
|
|
66
|
+
name="Blur"
|
|
67
|
+
args={{
|
|
68
|
+
onblur: (e: TextInputFocusEvent) => {
|
|
69
|
+
const target = e.target as HTMLInputElement;
|
|
70
|
+
|
|
71
|
+
console.log('onblur Event', target);
|
|
72
|
+
},
|
|
73
|
+
}}
|
|
74
|
+
/>
|
|
75
|
+
|
|
76
|
+
<!-- `e: TextInputClipboardEvent` -->
|
|
77
|
+
<Story
|
|
78
|
+
name="Copy"
|
|
79
|
+
args={{
|
|
80
|
+
oncopy: (e: TextInputClipboardEvent) => {
|
|
81
|
+
const target = e.target as HTMLInputElement;
|
|
82
|
+
|
|
83
|
+
console.log('oncopy Event', target);
|
|
84
|
+
},
|
|
85
|
+
}}
|
|
86
|
+
/>
|
|
87
|
+
|
|
88
|
+
<!-- `e: TextInputClipboardEvent` -->
|
|
89
|
+
<Story
|
|
90
|
+
name="Cut"
|
|
91
|
+
args={{
|
|
92
|
+
oncut: (e: TextInputClipboardEvent) => {
|
|
93
|
+
const target = e.target as HTMLInputElement;
|
|
94
|
+
|
|
95
|
+
console.log('oncut Event', target);
|
|
96
|
+
},
|
|
97
|
+
}}
|
|
98
|
+
/>
|
|
99
|
+
|
|
100
|
+
<!-- `e: TextInputClipboardEvent` -->
|
|
101
|
+
<Story
|
|
102
|
+
name="Paste"
|
|
103
|
+
args={{
|
|
104
|
+
onpaste: (e: TextInputClipboardEvent) => {
|
|
105
|
+
const target = e.target as HTMLInputElement;
|
|
106
|
+
|
|
107
|
+
console.log('onpaste Event', target);
|
|
108
|
+
},
|
|
109
|
+
}}
|
|
110
|
+
/>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import PasswordInput from './PasswordInput.svelte';
|
|
4
|
+
import type { StoryBookArgTypes } from '$lib/storybook-types.js';
|
|
5
|
+
import Icon from '@iconify/svelte';
|
|
6
|
+
import { componentRoundnessArray } from '$lib/types/roundness.js';
|
|
7
|
+
import { componentSizeArray } from '$lib/types/size.js';
|
|
8
|
+
|
|
9
|
+
export const storyPasswordInputArgTypes: StoryBookArgTypes = {
|
|
10
|
+
roundness: {
|
|
11
|
+
control: { type: 'select' },
|
|
12
|
+
options: componentRoundnessArray,
|
|
13
|
+
},
|
|
14
|
+
size: {
|
|
15
|
+
control: { type: 'select' },
|
|
16
|
+
options: componentSizeArray,
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
21
|
+
const { Story } = defineMeta({
|
|
22
|
+
component: PasswordInput,
|
|
23
|
+
tags: ['autodocs'],
|
|
24
|
+
argTypes: storyPasswordInputArgTypes,
|
|
25
|
+
args: { value: 'Hello world!' },
|
|
26
|
+
});
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<!-- PasswordInput with default style -->
|
|
30
|
+
<Story name="Default" />
|
|
31
|
+
|
|
32
|
+
<Story name="Placeholder" args={{ value: '', placeholder: 'Type something...' }} />
|
|
33
|
+
|
|
34
|
+
<Story name="No Outline" args={{ outline: false }} />
|
|
35
|
+
|
|
36
|
+
<Story name="Error" args={{ error: true }} />
|
|
37
|
+
|
|
38
|
+
<Story name="Disabled" args={{ disabled: true }} />
|
|
39
|
+
|
|
40
|
+
<!-- Disable password toggle -->
|
|
41
|
+
<Story name="No toggle" args={{ passwordToggle: false }} />
|
|
42
|
+
|
|
43
|
+
<!-- Show Password by default -->
|
|
44
|
+
<Story name="Show Password" args={{ passwordToggleState: true }} />
|
|
45
|
+
|
|
46
|
+
<Story name="Read only" args={{ readonly: true }} />
|
|
47
|
+
|
|
48
|
+
<!-- Show Password by default -->
|
|
49
|
+
<Story name="Custom toggle icon" asChild>
|
|
50
|
+
<PasswordInput value="Hello world!">
|
|
51
|
+
{#snippet customPasswordToggleIcon(toggle)}
|
|
52
|
+
{#if toggle}
|
|
53
|
+
<Icon icon="mingcute:eye-close-line" width="24" height="24" />
|
|
54
|
+
{:else}
|
|
55
|
+
<Icon icon="mingcute:eye-2-line" width="24" height="24" />
|
|
56
|
+
{/if}
|
|
57
|
+
{/snippet}
|
|
58
|
+
</PasswordInput>
|
|
59
|
+
</Story>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import PasswordInput from '../PasswordInput.svelte';
|
|
4
|
+
import { storyPasswordInputArgTypes } from '../PasswordInput.stories.svelte';
|
|
5
|
+
|
|
6
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
7
|
+
const { Story } = defineMeta({
|
|
8
|
+
component: PasswordInput,
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
argTypes: storyPasswordInputArgTypes,
|
|
11
|
+
});
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<Story name="Roundness 1" />
|
|
15
|
+
|
|
16
|
+
<Story name="Roundness 2" args={{ roundness: 2 }} />
|
|
17
|
+
|
|
18
|
+
<Story name="Roundness 3" args={{ roundness: 3 }} />
|
|
19
|
+
|
|
20
|
+
<Story name="Roundness 0" args={{ roundness: 0 }} />
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import PasswordInput from '../PasswordInput.svelte';
|
|
4
|
+
import { storyPasswordInputArgTypes } from '../PasswordInput.stories.svelte';
|
|
5
|
+
|
|
6
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
7
|
+
const { Story } = defineMeta({
|
|
8
|
+
component: PasswordInput,
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
argTypes: storyPasswordInputArgTypes,
|
|
11
|
+
});
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<Story name="Normal" />
|
|
15
|
+
<Story name="Small" args={{ size: 'small' }} />
|
|
16
|
+
<Story name="Large" args={{ size: 'large' }} />
|