@flightlesslabs/dodo-ui 0.3.0 → 0.5.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 +15 -1
- package/dist/index.js +12 -0
- package/dist/stories/components/Form/Button/Button.svelte +4 -1
- package/dist/stories/components/Form/Button/Button.svelte.d.ts +4 -2
- package/dist/stories/components/Form/FormControl/FormControl.stories.svelte +27 -0
- package/dist/stories/components/Form/FormControl/FormControl.stories.svelte.d.ts +19 -0
- package/dist/stories/components/Form/FormControl/FormControl.svelte +34 -0
- package/dist/stories/components/Form/FormControl/FormControl.svelte.d.ts +20 -0
- package/dist/stories/components/Form/Label/Label.stories.svelte +21 -0
- package/dist/stories/components/Form/Label/Label.stories.svelte.d.ts +19 -0
- package/dist/stories/components/Form/Label/Label.svelte +19 -0
- package/dist/stories/components/Form/Label/Label.svelte.d.ts +18 -0
- package/dist/stories/components/Form/Message/Color/Color.stories.svelte +36 -0
- package/dist/stories/components/Form/Message/Color/Color.stories.svelte.d.ts +26 -0
- package/dist/stories/components/Form/Message/Message.stories.svelte +31 -0
- package/dist/stories/components/Form/Message/Message.stories.svelte.d.ts +21 -0
- package/dist/stories/components/Form/Message/Message.svelte +50 -0
- package/dist/stories/components/Form/Message/Message.svelte.d.ts +20 -0
- package/dist/stories/components/Form/Message/Size/Size.stories.svelte +24 -0
- package/dist/stories/components/Form/Message/Size/Size.stories.svelte.d.ts +26 -0
- package/dist/stories/components/Form/PasswordInput/PasswordInput.stories.svelte +17 -1
- package/dist/stories/components/Form/PasswordInput/PasswordInput.svelte +37 -158
- package/dist/stories/components/Form/PasswordInput/PasswordInput.svelte.d.ts +10 -7
- package/dist/stories/components/Form/SimpleSelect/Events/Events.stories.svelte +74 -0
- package/dist/stories/components/Form/SimpleSelect/Events/Events.stories.svelte.d.ts +18 -0
- package/dist/stories/components/Form/SimpleSelect/Roundness/Roundness.stories.svelte +24 -0
- package/dist/stories/components/Form/SimpleSelect/Roundness/Roundness.stories.svelte.d.ts +26 -0
- package/dist/stories/components/Form/SimpleSelect/SimpleSelect.stories.svelte +59 -0
- package/dist/stories/components/Form/SimpleSelect/SimpleSelect.stories.svelte.d.ts +23 -0
- package/dist/stories/components/Form/SimpleSelect/SimpleSelect.svelte +69 -0
- package/dist/stories/components/Form/SimpleSelect/SimpleSelect.svelte.d.ts +50 -0
- package/dist/stories/components/Form/SimpleSelect/Size/Size.stories.svelte +20 -0
- package/dist/stories/components/Form/SimpleSelect/Size/Size.stories.svelte.d.ts +26 -0
- package/dist/stories/components/Form/SimpleSelect/WithIcon/WithIcon.stories.svelte +36 -0
- package/dist/stories/components/Form/SimpleSelect/WithIcon/WithIcon.stories.svelte.d.ts +26 -0
- package/dist/stories/components/Form/TextInput/TextInput.stories.svelte +2 -0
- package/dist/stories/components/Form/TextInput/TextInput.svelte +22 -118
- package/dist/stories/components/Form/TextInput/TextInput.svelte.d.ts +7 -4
- package/dist/stories/developer tools/Intro.mdx +7 -0
- package/dist/stories/developer tools/components/InputEnclosure/InputEnclosure.stories.svelte +34 -0
- package/dist/stories/developer tools/components/InputEnclosure/InputEnclosure.stories.svelte.d.ts +21 -0
- package/dist/stories/developer tools/components/InputEnclosure/InputEnclosure.svelte +120 -0
- package/dist/stories/developer tools/components/InputEnclosure/InputEnclosure.svelte.d.ts +29 -0
- package/dist/stories/developer tools/components/InputEnclosure/Roundness/Roundness.stories.svelte +20 -0
- package/dist/stories/developer tools/components/InputEnclosure/Roundness/Roundness.stories.svelte.d.ts +26 -0
- package/dist/stories/developer tools/components/InputEnclosure/Size/Size.stories.svelte +16 -0
- package/dist/stories/developer tools/components/InputEnclosure/Size/Size.stories.svelte.d.ts +26 -0
- package/dist/stories/developer tools/components/InputEnclosure/WithIcon/WithIcon.stories.svelte +47 -0
- package/dist/stories/developer tools/components/InputEnclosure/WithIcon/WithIcon.stories.svelte.d.ts +26 -0
- package/dist/stories/developer tools/components/UtilityButton/Size/Size.stories.svelte +27 -0
- package/dist/stories/developer tools/components/UtilityButton/Size/Size.stories.svelte.d.ts +26 -0
- package/dist/stories/developer tools/components/UtilityButton/UtilityButton.stories.svelte +29 -0
- package/dist/stories/developer tools/components/UtilityButton/UtilityButton.stories.svelte.d.ts +21 -0
- package/dist/stories/developer tools/components/UtilityButton/UtilityButton.svelte +79 -0
- package/dist/stories/developer tools/components/UtilityButton/UtilityButton.svelte.d.ts +26 -0
- package/package.json +30 -30
- package/src/lib/index.ts +23 -1
- package/src/lib/stories/components/Form/Button/Button.svelte +8 -2
- package/src/lib/stories/components/Form/FormControl/FormControl.stories.svelte +29 -0
- package/src/lib/stories/components/Form/FormControl/FormControl.svelte +67 -0
- package/src/lib/stories/components/Form/Label/Label.stories.svelte +23 -0
- package/src/lib/stories/components/Form/Label/Label.svelte +45 -0
- package/src/lib/stories/components/Form/Message/Color/Color.stories.svelte +36 -0
- package/src/lib/stories/components/Form/Message/Message.stories.svelte +35 -0
- package/src/lib/stories/components/Form/Message/Message.svelte +92 -0
- package/src/lib/stories/components/Form/Message/Size/Size.stories.svelte +24 -0
- package/src/lib/stories/components/Form/PasswordInput/PasswordInput.stories.svelte +17 -1
- package/src/lib/stories/components/Form/PasswordInput/PasswordInput.svelte +51 -196
- package/src/lib/stories/components/Form/SimpleSelect/Events/Events.stories.svelte +79 -0
- package/src/lib/stories/components/Form/SimpleSelect/Roundness/Roundness.stories.svelte +24 -0
- package/src/lib/stories/components/Form/SimpleSelect/SimpleSelect.stories.svelte +64 -0
- package/src/lib/stories/components/Form/SimpleSelect/SimpleSelect.svelte +159 -0
- package/src/lib/stories/components/Form/SimpleSelect/Size/Size.stories.svelte +20 -0
- package/src/lib/stories/components/Form/SimpleSelect/WithIcon/WithIcon.stories.svelte +36 -0
- package/src/lib/stories/components/Form/TextInput/TextInput.stories.svelte +2 -0
- package/src/lib/stories/components/Form/TextInput/TextInput.svelte +29 -142
- package/src/lib/stories/developer tools/Intro.mdx +7 -0
- package/src/lib/stories/developer tools/components/InputEnclosure/InputEnclosure.stories.svelte +38 -0
- package/src/lib/stories/developer tools/components/InputEnclosure/InputEnclosure.svelte +198 -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/UtilityButton/Size/Size.stories.svelte +27 -0
- package/src/lib/stories/developer tools/components/UtilityButton/UtilityButton.stories.svelte +33 -0
- package/src/lib/stories/developer tools/components/UtilityButton/UtilityButton.svelte +128 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,25 @@
|
|
|
1
1
|
import './styles/global.css';
|
|
2
2
|
export type { ComponentSize, ComponentRoundness, ComponentRoundnessFull } from './types.js';
|
|
3
|
+
/** developer tools: components: UtilityButton */
|
|
4
|
+
export { default as UtilityButton } from './stories/developer tools/components/UtilityButton/UtilityButton.svelte';
|
|
5
|
+
/** developer tools: components: InputEnclosure */
|
|
6
|
+
export { default as InputEnclosure } from './stories/developer tools/components/InputEnclosure/InputEnclosure.svelte';
|
|
3
7
|
/** Form: Button */
|
|
4
8
|
export { default as Button } from './stories/components/Form/Button/Button.svelte';
|
|
5
9
|
export type { ButtonColor, ButtonRoundness, ButtonLinkTarget, ButtonLinkReferrerpolicy, } from './stories/components/Form/Button/Button.svelte';
|
|
6
10
|
/** Form: TextInput */
|
|
7
11
|
export { default as TextInput } from './stories/components/Form/TextInput/TextInput.svelte';
|
|
8
|
-
export type {
|
|
12
|
+
export type { TextInputType, TextInputFocusEvent, TextInputClipboardEvent, } from './stories/components/Form/TextInput/TextInput.svelte';
|
|
9
13
|
/** Form: PasswordInput */
|
|
10
14
|
export { default as PasswordInput } from './stories/components/Form/PasswordInput/PasswordInput.svelte';
|
|
11
15
|
export type { PasswordInputToggleEvent } from './stories/components/Form/PasswordInput/PasswordInput.svelte';
|
|
16
|
+
/** Form: Label */
|
|
17
|
+
export { default as Label } from './stories/components/Form/Label/Label.svelte';
|
|
18
|
+
/** Form: FormControl */
|
|
19
|
+
export { default as FormControl } from './stories/components/Form/FormControl/FormControl.svelte';
|
|
20
|
+
/** Form: Message */
|
|
21
|
+
export { default as Message } from './stories/components/Form/Message/Message.svelte';
|
|
22
|
+
export type { MessageColor } from './stories/components/Form/Message/Message.svelte';
|
|
23
|
+
/** Form: SimpleSelect */
|
|
24
|
+
export { default as SimpleSelect } from './stories/components/Form/SimpleSelect/SimpleSelect.svelte';
|
|
25
|
+
export type { SimpleSelectFocusEvent, SimpleSelectOption, } from './stories/components/Form/SimpleSelect/SimpleSelect.svelte';
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
import './styles/global.css';
|
|
2
|
+
/** developer tools: components: UtilityButton */
|
|
3
|
+
export { default as UtilityButton } from './stories/developer tools/components/UtilityButton/UtilityButton.svelte';
|
|
4
|
+
/** developer tools: components: InputEnclosure */
|
|
5
|
+
export { default as InputEnclosure } from './stories/developer tools/components/InputEnclosure/InputEnclosure.svelte';
|
|
2
6
|
/** Form: Button */
|
|
3
7
|
export { default as Button } from './stories/components/Form/Button/Button.svelte';
|
|
4
8
|
/** Form: TextInput */
|
|
5
9
|
export { default as TextInput } from './stories/components/Form/TextInput/TextInput.svelte';
|
|
6
10
|
/** Form: PasswordInput */
|
|
7
11
|
export { default as PasswordInput } from './stories/components/Form/PasswordInput/PasswordInput.svelte';
|
|
12
|
+
/** Form: Label */
|
|
13
|
+
export { default as Label } from './stories/components/Form/Label/Label.svelte';
|
|
14
|
+
/** Form: FormControl */
|
|
15
|
+
export { default as FormControl } from './stories/components/Form/FormControl/FormControl.svelte';
|
|
16
|
+
/** Form: Message */
|
|
17
|
+
export { default as Message } from './stories/components/Form/Message/Message.svelte';
|
|
18
|
+
/** Form: SimpleSelect */
|
|
19
|
+
export { default as SimpleSelect } from './stories/components/Form/SimpleSelect/SimpleSelect.svelte';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts" module>export {};
|
|
2
2
|
</script>
|
|
3
3
|
|
|
4
|
-
<script lang="ts">
|
|
4
|
+
<script lang="ts">let { children, type = 'button', size = 'normal', color = 'default', roundness = '1x', variant = 'text', outline = false, compact = false, fullWidth = false, name, id, title, class: className = '', disabled = false, onclick, before, after, href, download, hreflang, media, ping, rel, target, anchorMediaType, referrerpolicy, _unsafeChildrenStringForTesting, ref = $bindable(), } = $props();
|
|
5
5
|
export {};
|
|
6
6
|
</script>
|
|
7
7
|
|
|
@@ -50,6 +50,7 @@ export {};
|
|
|
50
50
|
`roundness--${roundness}`,
|
|
51
51
|
className,
|
|
52
52
|
].join(' ')}
|
|
53
|
+
bind:this={ref}
|
|
53
54
|
>
|
|
54
55
|
{@render buttonContent()}
|
|
55
56
|
</a>
|
|
@@ -72,6 +73,7 @@ export {};
|
|
|
72
73
|
{title}
|
|
73
74
|
{disabled}
|
|
74
75
|
{onclick}
|
|
76
|
+
bind:this={ref}
|
|
75
77
|
>
|
|
76
78
|
{@render buttonContent()}
|
|
77
79
|
</button>
|
|
@@ -188,6 +190,7 @@ export {};
|
|
|
188
190
|
outline: 0;
|
|
189
191
|
color: inherit;
|
|
190
192
|
letter-spacing: 0.3px;
|
|
193
|
+
font-family: inherit;
|
|
191
194
|
}
|
|
192
195
|
.dodo-ui-Button.size--normal {
|
|
193
196
|
height: var(--dodo-ui-element-height-normal);
|
|
@@ -6,8 +6,10 @@ import type { ComponentRoundness, ComponentRoundnessFull, ComponentSize } from '
|
|
|
6
6
|
import type { Snippet } from 'svelte';
|
|
7
7
|
import type { MouseEventHandler } from 'svelte/elements';
|
|
8
8
|
interface ButtonProps {
|
|
9
|
-
/** Button contents goes here*/
|
|
9
|
+
/** Button contents goes here */
|
|
10
10
|
children?: Snippet;
|
|
11
|
+
/** Button ref */
|
|
12
|
+
ref?: HTMLButtonElement | HTMLAnchorElement;
|
|
11
13
|
/** Regular button or submit button? */
|
|
12
14
|
type?: 'button' | 'submit';
|
|
13
15
|
/** How large should the button be? */
|
|
@@ -61,6 +63,6 @@ interface ButtonProps {
|
|
|
61
63
|
/** Test: ⚠️ Unsafe Children String. Do Not use*/
|
|
62
64
|
_unsafeChildrenStringForTesting?: string;
|
|
63
65
|
}
|
|
64
|
-
declare const Button: import("svelte").Component<ButtonProps, {}, "">;
|
|
66
|
+
declare const Button: import("svelte").Component<ButtonProps, {}, "ref">;
|
|
65
67
|
type Button = ReturnType<typeof Button>;
|
|
66
68
|
export default Button;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<script module lang="ts">import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
2
|
+
import FormControl from './FormControl.svelte';
|
|
3
|
+
import TextInput from '../TextInput/TextInput.svelte';
|
|
4
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
5
|
+
const { Story } = defineMeta({
|
|
6
|
+
component: FormControl,
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
});
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<Story name="Default" args={{ label: 'Hello there' }} />
|
|
12
|
+
|
|
13
|
+
<Story name="Example TextInput" args={{ label: 'Whats your first name?' }}>
|
|
14
|
+
<FormControl label="Whats your first name?" for="first-name-01">
|
|
15
|
+
<TextInput placeholder="First name" id="first-name-01" />
|
|
16
|
+
</FormControl>
|
|
17
|
+
</Story>
|
|
18
|
+
|
|
19
|
+
<Story name="ErrorMessage" args={{ label: 'Whats your first name?' }}>
|
|
20
|
+
<FormControl
|
|
21
|
+
label="Whats your first name?"
|
|
22
|
+
for="first-name-02"
|
|
23
|
+
errorMessage="This is an error message"
|
|
24
|
+
>
|
|
25
|
+
<TextInput value="John Smith" id="first-name-02" error />
|
|
26
|
+
</FormControl>
|
|
27
|
+
</Story>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import FormControl from './FormControl.svelte';
|
|
2
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
+
$$bindings?: Bindings;
|
|
5
|
+
} & Exports;
|
|
6
|
+
(internal: unknown, props: {
|
|
7
|
+
$$events?: Events;
|
|
8
|
+
$$slots?: Slots;
|
|
9
|
+
}): Exports & {
|
|
10
|
+
$set?: any;
|
|
11
|
+
$on?: any;
|
|
12
|
+
};
|
|
13
|
+
z_$$bindings?: Bindings;
|
|
14
|
+
}
|
|
15
|
+
declare const FormControl: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
16
|
+
[evt: string]: CustomEvent<any>;
|
|
17
|
+
}, {}, {}, string>;
|
|
18
|
+
type FormControl = InstanceType<typeof FormControl>;
|
|
19
|
+
export default FormControl;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<script lang="ts">import Label from '../Label/Label.svelte';
|
|
2
|
+
import Message from '../Message/Message.svelte';
|
|
3
|
+
let { children, label, class: className = '', for: htmlFor, form, ref = $bindable(), errorMessage, } = $props();
|
|
4
|
+
</script>
|
|
5
|
+
|
|
6
|
+
<div class={['dodo-ui-FormControl', className].join(' ')} bind:this={ref}>
|
|
7
|
+
{#if label}
|
|
8
|
+
<div class="LabelSection">
|
|
9
|
+
<Label for={htmlFor} {form}>{label}</Label>
|
|
10
|
+
</div>
|
|
11
|
+
{/if}
|
|
12
|
+
<div class="content">
|
|
13
|
+
{#if children}
|
|
14
|
+
{@render children()}
|
|
15
|
+
{/if}
|
|
16
|
+
</div>
|
|
17
|
+
{#if errorMessage}
|
|
18
|
+
<div class="errorMessage">
|
|
19
|
+
<Message color="danger">{errorMessage}</Message>
|
|
20
|
+
</div>
|
|
21
|
+
{/if}
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
<style>:global(:root) {
|
|
25
|
+
--dodo-ui-FormControl-LabelSection-gap: 8px;
|
|
26
|
+
--dodo-ui-FormControl-errorMessage-gap: 10px;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.dodo-ui-FormControl .LabelSection {
|
|
30
|
+
margin-bottom: var(--dodo-ui-FormControl-LabelSection-gap);
|
|
31
|
+
}
|
|
32
|
+
.dodo-ui-FormControl .errorMessage {
|
|
33
|
+
margin-top: var(--dodo-ui-FormControl-errorMessage-gap);
|
|
34
|
+
}</style>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
interface FormControlProps {
|
|
3
|
+
/** FormControl contents goes here */
|
|
4
|
+
children?: Snippet;
|
|
5
|
+
/** Label for FormControl */
|
|
6
|
+
label?: string;
|
|
7
|
+
/** is there any associated Error Message ? */
|
|
8
|
+
errorMessage?: string;
|
|
9
|
+
/** Label ref */
|
|
10
|
+
ref?: HTMLDivElement;
|
|
11
|
+
/** id of the form element the label should be bound to */
|
|
12
|
+
for?: string;
|
|
13
|
+
/** Specifies which form the label belongs to */
|
|
14
|
+
form?: string;
|
|
15
|
+
/** Custom css class*/
|
|
16
|
+
class?: string;
|
|
17
|
+
}
|
|
18
|
+
declare const FormControl: import("svelte").Component<FormControlProps, {}, "ref">;
|
|
19
|
+
type FormControl = ReturnType<typeof FormControl>;
|
|
20
|
+
export default FormControl;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script module lang="ts">import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
2
|
+
import Label from './Label.svelte';
|
|
3
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
4
|
+
const { Story } = defineMeta({
|
|
5
|
+
component: Label,
|
|
6
|
+
tags: ['autodocs'],
|
|
7
|
+
});
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<!-- ⚠️ Test Label: Do not use! -->
|
|
11
|
+
<Story
|
|
12
|
+
name="Test Label"
|
|
13
|
+
args={{
|
|
14
|
+
_unsafeChildrenStringForTesting: 'This is a form label',
|
|
15
|
+
}}
|
|
16
|
+
/>
|
|
17
|
+
|
|
18
|
+
<!-- Label with default style -->
|
|
19
|
+
<Story name="Default">
|
|
20
|
+
<Label>This is a form label</Label>
|
|
21
|
+
</Story>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import Label from './Label.svelte';
|
|
2
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
+
$$bindings?: Bindings;
|
|
5
|
+
} & Exports;
|
|
6
|
+
(internal: unknown, props: {
|
|
7
|
+
$$events?: Events;
|
|
8
|
+
$$slots?: Slots;
|
|
9
|
+
}): Exports & {
|
|
10
|
+
$set?: any;
|
|
11
|
+
$on?: any;
|
|
12
|
+
};
|
|
13
|
+
z_$$bindings?: Bindings;
|
|
14
|
+
}
|
|
15
|
+
declare const Label: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
16
|
+
[evt: string]: CustomEvent<any>;
|
|
17
|
+
}, {}, {}, string>;
|
|
18
|
+
type Label = InstanceType<typeof Label>;
|
|
19
|
+
export default Label;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script lang="ts">let { children, class: className = '', for: htmlFor, form, _unsafeChildrenStringForTesting, ref = $bindable(), } = $props();
|
|
2
|
+
export {};
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<label class={['dodo-ui-Label', className].join(' ')} for={htmlFor} {form} bind:this={ref}>
|
|
6
|
+
{#if children}
|
|
7
|
+
{@render children()}
|
|
8
|
+
{:else if _unsafeChildrenStringForTesting}
|
|
9
|
+
{_unsafeChildrenStringForTesting}
|
|
10
|
+
{/if}
|
|
11
|
+
</label>
|
|
12
|
+
|
|
13
|
+
<style>.dodo-ui-Label {
|
|
14
|
+
font-size: 0.95rem;
|
|
15
|
+
color: var(--dodo-color-default-700);
|
|
16
|
+
display: flex;
|
|
17
|
+
align-items: center;
|
|
18
|
+
font-family: inherit;
|
|
19
|
+
}</style>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
interface LabelProps {
|
|
3
|
+
/** Label contents goes here */
|
|
4
|
+
children?: Snippet;
|
|
5
|
+
/** Label ref */
|
|
6
|
+
ref?: HTMLLabelElement;
|
|
7
|
+
/** id of the form element the label should be bound to */
|
|
8
|
+
for?: string;
|
|
9
|
+
/** Specifies which form the label belongs to */
|
|
10
|
+
form?: string;
|
|
11
|
+
/** Custom css class*/
|
|
12
|
+
class?: string;
|
|
13
|
+
/** Test: ⚠️ Unsafe Children String. Do Not use*/
|
|
14
|
+
_unsafeChildrenStringForTesting?: string;
|
|
15
|
+
}
|
|
16
|
+
declare const Label: import("svelte").Component<LabelProps, {}, "ref">;
|
|
17
|
+
type Label = ReturnType<typeof Label>;
|
|
18
|
+
export default Label;
|
|
@@ -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="Default">
|
|
15
|
+
<Message>Lorem ipsum dolor sit amet, consectetur adipiscing elit</Message>
|
|
16
|
+
</Story>
|
|
17
|
+
|
|
18
|
+
<Story name="Primary" args={{ color: 'primary' }}>
|
|
19
|
+
<Message color="primary">Lorem ipsum dolor sit amet, consectetur adipiscing elit</Message>
|
|
20
|
+
</Story>
|
|
21
|
+
|
|
22
|
+
<Story name="Safe" args={{ color: 'safe' }}>
|
|
23
|
+
<Message color="safe">Lorem ipsum dolor sit amet, consectetur adipiscing elit</Message>
|
|
24
|
+
</Story>
|
|
25
|
+
|
|
26
|
+
<Story name="Warning" args={{ color: 'warning' }}>
|
|
27
|
+
<Message color="warning">Lorem ipsum dolor sit amet, consectetur adipiscing elit</Message>
|
|
28
|
+
</Story>
|
|
29
|
+
|
|
30
|
+
<Story name="Danger" args={{ color: 'danger' }}>
|
|
31
|
+
<Message color="danger">Lorem ipsum dolor sit amet, consectetur adipiscing elit</Message>
|
|
32
|
+
</Story>
|
|
33
|
+
|
|
34
|
+
<Story name="Info" args={{ color: 'info' }}>
|
|
35
|
+
<Message color="info">Lorem ipsum dolor sit amet, consectetur adipiscing elit</Message>
|
|
36
|
+
</Story>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export default Color;
|
|
2
|
+
type Color = SvelteComponent<{
|
|
3
|
+
[x: string]: never;
|
|
4
|
+
}, {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
}, {}> & {
|
|
7
|
+
$$bindings?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare const Color: $$__sveltets_2_IsomorphicComponent<{
|
|
10
|
+
[x: string]: never;
|
|
11
|
+
}, {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
}, {}, {}, string>;
|
|
14
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
15
|
+
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
16
|
+
$$bindings?: Bindings;
|
|
17
|
+
} & Exports;
|
|
18
|
+
(internal: unknown, props: {
|
|
19
|
+
$$events?: Events;
|
|
20
|
+
$$slots?: Slots;
|
|
21
|
+
}): Exports & {
|
|
22
|
+
$set?: any;
|
|
23
|
+
$on?: any;
|
|
24
|
+
};
|
|
25
|
+
z_$$bindings?: Bindings;
|
|
26
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<script module lang="ts">import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
2
|
+
import Message from './Message.svelte';
|
|
3
|
+
export const storyMessageArgTypes = {
|
|
4
|
+
color: {
|
|
5
|
+
control: { type: 'select' },
|
|
6
|
+
options: ['default', 'primary', 'safe', 'warning', 'danger', 'info'],
|
|
7
|
+
},
|
|
8
|
+
size: {
|
|
9
|
+
control: { type: 'select' },
|
|
10
|
+
options: ['normal', 'small', 'large'],
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
14
|
+
const { Story } = defineMeta({
|
|
15
|
+
component: Message,
|
|
16
|
+
tags: ['autodocs'],
|
|
17
|
+
argTypes: storyMessageArgTypes,
|
|
18
|
+
});
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<!-- ⚠️ Test Message: Do not use! -->
|
|
22
|
+
<Story
|
|
23
|
+
name="Test Message"
|
|
24
|
+
args={{
|
|
25
|
+
_unsafeChildrenStringForTesting: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit',
|
|
26
|
+
}}
|
|
27
|
+
/>
|
|
28
|
+
|
|
29
|
+
<Story name="Default">
|
|
30
|
+
<Message>Lorem ipsum dolor sit amet, consectetur adipiscing elit</Message>
|
|
31
|
+
</Story>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import Message from './Message.svelte';
|
|
2
|
+
import type { StoryBookArgTypes } from '../../../../storybook-types.js';
|
|
3
|
+
export declare const storyMessageArgTypes: StoryBookArgTypes;
|
|
4
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
5
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
6
|
+
$$bindings?: Bindings;
|
|
7
|
+
} & Exports;
|
|
8
|
+
(internal: unknown, props: {
|
|
9
|
+
$$events?: Events;
|
|
10
|
+
$$slots?: Slots;
|
|
11
|
+
}): Exports & {
|
|
12
|
+
$set?: any;
|
|
13
|
+
$on?: any;
|
|
14
|
+
};
|
|
15
|
+
z_$$bindings?: Bindings;
|
|
16
|
+
}
|
|
17
|
+
declare const Message: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
18
|
+
[evt: string]: CustomEvent<any>;
|
|
19
|
+
}, {}, {}, string>;
|
|
20
|
+
type Message = InstanceType<typeof Message>;
|
|
21
|
+
export default Message;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<script lang="ts" module>export {};
|
|
2
|
+
</script>
|
|
3
|
+
|
|
4
|
+
<script lang="ts">let { children, class: className = '', color = 'default', ref = $bindable(), _unsafeChildrenStringForTesting, size = 'normal', } = $props();
|
|
5
|
+
export {};
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<div
|
|
9
|
+
class={['dodo-ui-Message', `color--${color}`, `size--${size}`, className].join(' ')}
|
|
10
|
+
bind:this={ref}
|
|
11
|
+
>
|
|
12
|
+
{#if children}
|
|
13
|
+
{@render children()}
|
|
14
|
+
{:else if _unsafeChildrenStringForTesting}
|
|
15
|
+
{_unsafeChildrenStringForTesting}
|
|
16
|
+
{/if}
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
<style>.dodo-ui-Message {
|
|
20
|
+
letter-spacing: 0.3px;
|
|
21
|
+
display: flex;
|
|
22
|
+
font-family: inherit;
|
|
23
|
+
}
|
|
24
|
+
.dodo-ui-Message.size--normal {
|
|
25
|
+
font-size: 1rem;
|
|
26
|
+
}
|
|
27
|
+
.dodo-ui-Message.size--small {
|
|
28
|
+
font-size: 0.9rem;
|
|
29
|
+
}
|
|
30
|
+
.dodo-ui-Message.size--large {
|
|
31
|
+
font-size: 1.1rem;
|
|
32
|
+
}
|
|
33
|
+
.dodo-ui-Message.color--default {
|
|
34
|
+
color: var(--dodo-color-default-800);
|
|
35
|
+
}
|
|
36
|
+
.dodo-ui-Message.color--primary {
|
|
37
|
+
color: var(--dodo-color-primary-600);
|
|
38
|
+
}
|
|
39
|
+
.dodo-ui-Message.color--safe {
|
|
40
|
+
color: var(--dodo-color-safe-600);
|
|
41
|
+
}
|
|
42
|
+
.dodo-ui-Message.color--warning {
|
|
43
|
+
color: var(--dodo-color-warning-600);
|
|
44
|
+
}
|
|
45
|
+
.dodo-ui-Message.color--danger {
|
|
46
|
+
color: var(--dodo-color-danger-600);
|
|
47
|
+
}
|
|
48
|
+
.dodo-ui-Message.color--info {
|
|
49
|
+
color: var(--dodo-color-info-600);
|
|
50
|
+
}</style>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type MessageColor = 'default' | 'primary' | 'safe' | 'warning' | 'danger' | 'info';
|
|
2
|
+
import type { ComponentSize } from '../../../../types.js';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
interface MessageProps {
|
|
5
|
+
/** Message contents goes here */
|
|
6
|
+
children?: Snippet;
|
|
7
|
+
/** Message ref */
|
|
8
|
+
ref?: HTMLDivElement;
|
|
9
|
+
/** What color to use? */
|
|
10
|
+
color?: MessageColor;
|
|
11
|
+
/** Message size */
|
|
12
|
+
size?: ComponentSize;
|
|
13
|
+
/** Custom css class*/
|
|
14
|
+
class?: string;
|
|
15
|
+
/** Test: ⚠️ Unsafe Children String. Do Not use*/
|
|
16
|
+
_unsafeChildrenStringForTesting?: string;
|
|
17
|
+
}
|
|
18
|
+
declare const Message: import("svelte").Component<MessageProps, {}, "ref">;
|
|
19
|
+
type Message = ReturnType<typeof Message>;
|
|
20
|
+
export default Message;
|
|
@@ -0,0 +1,24 @@
|
|
|
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">
|
|
15
|
+
<Message>Lorem ipsum dolor sit amet, consectetur adipiscing elit</Message>
|
|
16
|
+
</Story>
|
|
17
|
+
|
|
18
|
+
<Story name="Small" args={{ size: 'small' }}>
|
|
19
|
+
<Message size="small">Lorem ipsum dolor sit amet, consectetur adipiscing elit</Message>
|
|
20
|
+
</Story>
|
|
21
|
+
|
|
22
|
+
<Story name="Large" args={{ size: 'large' }}>
|
|
23
|
+
<Message size="large">Lorem ipsum dolor sit amet, consectetur adipiscing elit</Message>
|
|
24
|
+
</Story>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export default Size;
|
|
2
|
+
type Size = SvelteComponent<{
|
|
3
|
+
[x: string]: never;
|
|
4
|
+
}, {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
}, {}> & {
|
|
7
|
+
$$bindings?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare const Size: $$__sveltets_2_IsomorphicComponent<{
|
|
10
|
+
[x: string]: never;
|
|
11
|
+
}, {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
}, {}, {}, string>;
|
|
14
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
15
|
+
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
16
|
+
$$bindings?: Bindings;
|
|
17
|
+
} & Exports;
|
|
18
|
+
(internal: unknown, props: {
|
|
19
|
+
$$events?: Events;
|
|
20
|
+
$$slots?: Slots;
|
|
21
|
+
}): Exports & {
|
|
22
|
+
$set?: any;
|
|
23
|
+
$on?: any;
|
|
24
|
+
};
|
|
25
|
+
z_$$bindings?: Bindings;
|
|
26
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script module lang="ts">import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
2
2
|
import PasswordInput from './PasswordInput.svelte';
|
|
3
|
+
import Icon from '@iconify/svelte';
|
|
3
4
|
export const storyPasswordInputArgTypes = {
|
|
4
5
|
roundness: {
|
|
5
6
|
control: { type: 'select' },
|
|
@@ -34,4 +35,19 @@ const { Story } = defineMeta({
|
|
|
34
35
|
<Story name="No toggle" args={{ passwordToggle: false }} />
|
|
35
36
|
|
|
36
37
|
<!-- Show Password by default -->
|
|
37
|
-
<Story name="Show Password" args={{
|
|
38
|
+
<Story name="Show Password" args={{ passwordToggleState: true }} />
|
|
39
|
+
|
|
40
|
+
<Story name="Read only" args={{ readonly: true }} />
|
|
41
|
+
|
|
42
|
+
<!-- Show Password by default -->
|
|
43
|
+
<Story name="Custom toggle icon">
|
|
44
|
+
<PasswordInput value="Hello world!">
|
|
45
|
+
{#snippet customPasswordToggleIcon(toggle)}
|
|
46
|
+
{#if toggle}
|
|
47
|
+
<Icon icon="mingcute:eye-close-line" width="24" height="24" />
|
|
48
|
+
{:else}
|
|
49
|
+
<Icon icon="mingcute:eye-2-line" width="24" height="24" />
|
|
50
|
+
{/if}
|
|
51
|
+
{/snippet}
|
|
52
|
+
</PasswordInput>
|
|
53
|
+
</Story>
|