@flightlesslabs/dodo-ui 0.4.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 +6 -1
- package/dist/index.js +4 -0
- package/dist/stories/components/Form/FormControl/FormControl.svelte +1 -1
- 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 +11 -26
- package/dist/stories/components/Form/Message/Message.stories.svelte.d.ts +2 -0
- package/dist/stories/components/Form/Message/Message.svelte +14 -3
- package/dist/stories/components/Form/Message/Message.svelte.d.ts +3 -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.svelte +32 -130
- package/dist/stories/components/Form/PasswordInput/PasswordInput.svelte.d.ts +2 -3
- 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.svelte +22 -120
- package/dist/stories/components/Form/TextInput/TextInput.svelte.d.ts +1 -2
- 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/package.json +1 -1
- package/src/lib/index.ts +10 -1
- package/src/lib/stories/components/Form/FormControl/FormControl.svelte +1 -1
- package/src/lib/stories/components/Form/Message/Color/Color.stories.svelte +36 -0
- package/src/lib/stories/components/Form/Message/Message.stories.svelte +13 -26
- package/src/lib/stories/components/Form/Message/Message.svelte +23 -2
- package/src/lib/stories/components/Form/Message/Size/Size.stories.svelte +24 -0
- package/src/lib/stories/components/Form/PasswordInput/PasswordInput.svelte +35 -157
- 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.svelte +22 -143
- 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
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ComponentRoundness, ComponentSize } from '../../../../types.js';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
interface InputEnclosureProps {
|
|
4
|
+
/** InputEnclosure contents goes here */
|
|
5
|
+
children?: Snippet;
|
|
6
|
+
/** InputEnclosure ref */
|
|
7
|
+
ref?: HTMLDivElement;
|
|
8
|
+
/** How large should the button be? */
|
|
9
|
+
size?: ComponentSize;
|
|
10
|
+
/** How round should the border radius be? */
|
|
11
|
+
roundness?: ComponentRoundness | false;
|
|
12
|
+
/** Add a border around the button. Default True */
|
|
13
|
+
outline?: boolean;
|
|
14
|
+
/** disabled state */
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
/** is there any associated Error ? */
|
|
17
|
+
error?: boolean;
|
|
18
|
+
/** is focused */
|
|
19
|
+
focused?: boolean;
|
|
20
|
+
/** Icon before button content */
|
|
21
|
+
before?: Snippet;
|
|
22
|
+
/** Icon after button content */
|
|
23
|
+
after?: Snippet;
|
|
24
|
+
/** Custom css class*/
|
|
25
|
+
class?: string;
|
|
26
|
+
}
|
|
27
|
+
declare const InputEnclosure: import("svelte").Component<InputEnclosureProps, {}, "ref">;
|
|
28
|
+
type InputEnclosure = ReturnType<typeof InputEnclosure>;
|
|
29
|
+
export default InputEnclosure;
|
package/dist/stories/developer tools/components/InputEnclosure/Roundness/Roundness.stories.svelte
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import InputEnclosure from '../InputEnclosure.svelte';
|
|
4
|
+
import { storyInputEnclosureArgTypes } from '../InputEnclosure.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: InputEnclosure,
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
argTypes: storyInputEnclosureArgTypes,
|
|
11
|
+
});
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<Story name="Roundness 1x" />
|
|
15
|
+
|
|
16
|
+
<Story name="Roundness 2x" args={{ roundness: '2x' }} />
|
|
17
|
+
|
|
18
|
+
<Story name="Roundness 3x" args={{ roundness: '3x' }} />
|
|
19
|
+
|
|
20
|
+
<Story name="Roundness False" args={{ roundness: false }} />
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export default Roundness;
|
|
2
|
+
type Roundness = SvelteComponent<{
|
|
3
|
+
[x: string]: never;
|
|
4
|
+
}, {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
}, {}> & {
|
|
7
|
+
$$bindings?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare const Roundness: $$__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,16 @@
|
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import InputEnclosure from '../InputEnclosure.svelte';
|
|
4
|
+
import { storyInputEnclosureArgTypes } from '../InputEnclosure.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: InputEnclosure,
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
argTypes: storyInputEnclosureArgTypes,
|
|
11
|
+
});
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<Story name="Normal" />
|
|
15
|
+
<Story name="Small" args={{ size: 'small' }} />
|
|
16
|
+
<Story name="Large" args={{ size: 'large' }} />
|
|
@@ -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
|
+
}
|
package/dist/stories/developer tools/components/InputEnclosure/WithIcon/WithIcon.stories.svelte
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import InputEnclosure from '../InputEnclosure.svelte';
|
|
4
|
+
import { storyInputEnclosureArgTypes } from '../InputEnclosure.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: InputEnclosure,
|
|
10
|
+
tags: ['autodocs'],
|
|
11
|
+
argTypes: storyInputEnclosureArgTypes,
|
|
12
|
+
});
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<!-- InputEnclosure icon in front. -->
|
|
16
|
+
<Story name="Icon Before">
|
|
17
|
+
<InputEnclosure>
|
|
18
|
+
{#snippet before()}
|
|
19
|
+
<Icon icon="material-symbols:content-copy" />
|
|
20
|
+
{/snippet}
|
|
21
|
+
</InputEnclosure>
|
|
22
|
+
</Story>
|
|
23
|
+
|
|
24
|
+
<!-- InputEnclosure icon in front. -->
|
|
25
|
+
<Story name="Icon After">
|
|
26
|
+
<InputEnclosure>
|
|
27
|
+
{#snippet after()}
|
|
28
|
+
<Icon icon="material-symbols:download-2" />
|
|
29
|
+
{/snippet}
|
|
30
|
+
</InputEnclosure>
|
|
31
|
+
</Story>
|
|
32
|
+
|
|
33
|
+
<Story name="Small" args={{ size: 'small' }}>
|
|
34
|
+
<InputEnclosure size="small">
|
|
35
|
+
{#snippet before()}
|
|
36
|
+
<Icon icon="material-symbols:content-copy" />
|
|
37
|
+
{/snippet}
|
|
38
|
+
</InputEnclosure>
|
|
39
|
+
</Story>
|
|
40
|
+
|
|
41
|
+
<Story name="Large" args={{ size: 'large' }}>
|
|
42
|
+
<InputEnclosure size="large">
|
|
43
|
+
{#snippet before()}
|
|
44
|
+
<Icon icon="material-symbols:content-copy" />
|
|
45
|
+
{/snippet}
|
|
46
|
+
</InputEnclosure>
|
|
47
|
+
</Story>
|
package/dist/stories/developer tools/components/InputEnclosure/WithIcon/WithIcon.stories.svelte.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export default WithIcon;
|
|
2
|
+
type WithIcon = SvelteComponent<{
|
|
3
|
+
[x: string]: never;
|
|
4
|
+
}, {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
}, {}> & {
|
|
7
|
+
$$bindings?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare const WithIcon: $$__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
|
+
}
|
package/package.json
CHANGED
package/src/lib/index.ts
CHANGED
|
@@ -5,6 +5,9 @@ export type { ComponentSize, ComponentRoundness, ComponentRoundnessFull } from '
|
|
|
5
5
|
/** developer tools: components: UtilityButton */
|
|
6
6
|
export { default as UtilityButton } from '$lib/stories/developer tools/components/UtilityButton/UtilityButton.svelte';
|
|
7
7
|
|
|
8
|
+
/** developer tools: components: InputEnclosure */
|
|
9
|
+
export { default as InputEnclosure } from '$lib/stories/developer tools/components/InputEnclosure/InputEnclosure.svelte';
|
|
10
|
+
|
|
8
11
|
/** Form: Button */
|
|
9
12
|
export { default as Button } from '$lib/stories/components/Form/Button/Button.svelte';
|
|
10
13
|
export type {
|
|
@@ -17,7 +20,6 @@ export type {
|
|
|
17
20
|
/** Form: TextInput */
|
|
18
21
|
export { default as TextInput } from '$lib/stories/components/Form/TextInput/TextInput.svelte';
|
|
19
22
|
export type {
|
|
20
|
-
TextInputRoundness,
|
|
21
23
|
TextInputType,
|
|
22
24
|
TextInputFocusEvent,
|
|
23
25
|
TextInputClipboardEvent,
|
|
@@ -36,3 +38,10 @@ export { default as FormControl } from '$lib/stories/components/Form/FormControl
|
|
|
36
38
|
/** Form: Message */
|
|
37
39
|
export { default as Message } from '$lib/stories/components/Form/Message/Message.svelte';
|
|
38
40
|
export type { MessageColor } from '$lib/stories/components/Form/Message/Message.svelte';
|
|
41
|
+
|
|
42
|
+
/** Form: SimpleSelect */
|
|
43
|
+
export { default as SimpleSelect } from '$lib/stories/components/Form/SimpleSelect/SimpleSelect.svelte';
|
|
44
|
+
export type {
|
|
45
|
+
SimpleSelectFocusEvent,
|
|
46
|
+
SimpleSelectOption,
|
|
47
|
+
} from '$lib/stories/components/Form/SimpleSelect/SimpleSelect.svelte';
|
|
@@ -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>
|
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
2
|
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
3
|
import Message from './Message.svelte';
|
|
4
|
+
import type { StoryBookArgTypes } from '$lib/storybook-types.js';
|
|
5
|
+
|
|
6
|
+
export const storyMessageArgTypes: StoryBookArgTypes = {
|
|
7
|
+
color: {
|
|
8
|
+
control: { type: 'select' },
|
|
9
|
+
options: ['default', 'primary', 'safe', 'warning', 'danger', 'info'],
|
|
10
|
+
},
|
|
11
|
+
size: {
|
|
12
|
+
control: { type: 'select' },
|
|
13
|
+
options: ['normal', 'small', 'large'],
|
|
14
|
+
},
|
|
15
|
+
};
|
|
4
16
|
|
|
5
17
|
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
6
18
|
const { Story } = defineMeta({
|
|
7
19
|
component: Message,
|
|
8
20
|
tags: ['autodocs'],
|
|
9
|
-
argTypes:
|
|
10
|
-
color: {
|
|
11
|
-
control: { type: 'select' },
|
|
12
|
-
options: ['default', 'primary', 'safe', 'warning', 'danger', 'info'],
|
|
13
|
-
},
|
|
14
|
-
},
|
|
21
|
+
argTypes: storyMessageArgTypes,
|
|
15
22
|
});
|
|
16
23
|
</script>
|
|
17
24
|
|
|
@@ -26,23 +33,3 @@
|
|
|
26
33
|
<Story name="Default">
|
|
27
34
|
<Message>Lorem ipsum dolor sit amet, consectetur adipiscing elit</Message>
|
|
28
35
|
</Story>
|
|
29
|
-
|
|
30
|
-
<Story name="Primary" args={{ color: 'primary' }}>
|
|
31
|
-
<Message color="primary">Lorem ipsum dolor sit amet, consectetur adipiscing elit</Message>
|
|
32
|
-
</Story>
|
|
33
|
-
|
|
34
|
-
<Story name="Safe" args={{ color: 'safe' }}>
|
|
35
|
-
<Message color="safe">Lorem ipsum dolor sit amet, consectetur adipiscing elit</Message>
|
|
36
|
-
</Story>
|
|
37
|
-
|
|
38
|
-
<Story name="Warning" args={{ color: 'warning' }}>
|
|
39
|
-
<Message color="warning">Lorem ipsum dolor sit amet, consectetur adipiscing elit</Message>
|
|
40
|
-
</Story>
|
|
41
|
-
|
|
42
|
-
<Story name="Danger" args={{ color: 'danger' }}>
|
|
43
|
-
<Message color="danger">Lorem ipsum dolor sit amet, consectetur adipiscing elit</Message>
|
|
44
|
-
</Story>
|
|
45
|
-
|
|
46
|
-
<Story name="Info" args={{ color: 'info' }}>
|
|
47
|
-
<Message color="info">Lorem ipsum dolor sit amet, consectetur adipiscing elit</Message>
|
|
48
|
-
</Story>
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
</script>
|
|
4
4
|
|
|
5
5
|
<script lang="ts">
|
|
6
|
+
import type { ComponentSize } from '$lib/types.js';
|
|
7
|
+
|
|
6
8
|
import type { Snippet } from 'svelte';
|
|
7
9
|
|
|
8
10
|
interface MessageProps {
|
|
@@ -12,6 +14,8 @@
|
|
|
12
14
|
ref?: HTMLDivElement;
|
|
13
15
|
/** What color to use? */
|
|
14
16
|
color?: MessageColor;
|
|
17
|
+
/** Message size */
|
|
18
|
+
size?: ComponentSize;
|
|
15
19
|
/** Custom css class*/
|
|
16
20
|
class?: string;
|
|
17
21
|
/** Test: ⚠️ Unsafe Children String. Do Not use*/
|
|
@@ -24,10 +28,14 @@
|
|
|
24
28
|
color = 'default',
|
|
25
29
|
ref = $bindable<HTMLDivElement>(),
|
|
26
30
|
_unsafeChildrenStringForTesting,
|
|
31
|
+
size = 'normal',
|
|
27
32
|
}: MessageProps = $props();
|
|
28
33
|
</script>
|
|
29
34
|
|
|
30
|
-
<div
|
|
35
|
+
<div
|
|
36
|
+
class={['dodo-ui-Message', `color--${color}`, `size--${size}`, className].join(' ')}
|
|
37
|
+
bind:this={ref}
|
|
38
|
+
>
|
|
31
39
|
{#if children}
|
|
32
40
|
{@render children()}
|
|
33
41
|
{:else if _unsafeChildrenStringForTesting}
|
|
@@ -37,11 +45,24 @@
|
|
|
37
45
|
|
|
38
46
|
<style lang="scss">
|
|
39
47
|
.dodo-ui-Message {
|
|
40
|
-
font-size: 1rem;
|
|
41
48
|
letter-spacing: 0.3px;
|
|
42
49
|
display: flex;
|
|
43
50
|
font-family: inherit;
|
|
44
51
|
|
|
52
|
+
&.size {
|
|
53
|
+
&--normal {
|
|
54
|
+
font-size: 1rem;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
&--small {
|
|
58
|
+
font-size: 0.9rem;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&--large {
|
|
62
|
+
font-size: 1.1rem;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
45
66
|
&.color {
|
|
46
67
|
&--default {
|
|
47
68
|
color: var(--dodo-color-default-800);
|
|
@@ -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>
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
</script>
|
|
7
7
|
|
|
8
8
|
<script lang="ts">
|
|
9
|
-
import type { ComponentSize } from '$lib/types.js';
|
|
9
|
+
import type { ComponentRoundness, ComponentSize } from '$lib/types.js';
|
|
10
10
|
import type { Snippet } from 'svelte';
|
|
11
11
|
import type {
|
|
12
12
|
ChangeEventHandler,
|
|
@@ -14,9 +14,10 @@
|
|
|
14
14
|
FocusEventHandler,
|
|
15
15
|
FormEventHandler,
|
|
16
16
|
} from 'svelte/elements';
|
|
17
|
-
import type { TextInputFocusEvent
|
|
17
|
+
import type { TextInputFocusEvent } from '../TextInput/TextInput.svelte';
|
|
18
18
|
import Icon from '@iconify/svelte';
|
|
19
19
|
import UtilityButton from '$lib/stories/developer tools/components/UtilityButton/UtilityButton.svelte';
|
|
20
|
+
import InputEnclosure from '$lib/stories/developer tools/components/InputEnclosure/InputEnclosure.svelte';
|
|
20
21
|
|
|
21
22
|
interface PasswordInputProps {
|
|
22
23
|
/** How large should the button be? */
|
|
@@ -30,7 +31,7 @@
|
|
|
30
31
|
/** Toggle Password Icon */
|
|
31
32
|
customPasswordToggleIcon?: (toggle: boolean) => Snippet;
|
|
32
33
|
/** How round should the border radius be? */
|
|
33
|
-
roundness?:
|
|
34
|
+
roundness?: ComponentRoundness | false;
|
|
34
35
|
/** Add a border around the button. Default True */
|
|
35
36
|
outline?: boolean;
|
|
36
37
|
/** Input value */
|
|
@@ -143,74 +144,41 @@
|
|
|
143
144
|
class:toggle
|
|
144
145
|
class={['dodo-ui-PasswordInput', `size--${size}`, `roundness--${roundness}`, className].join(' ')}
|
|
145
146
|
>
|
|
146
|
-
{
|
|
147
|
-
<
|
|
148
|
-
{
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
{/if}
|
|
178
|
-
</UtilityButton>
|
|
179
|
-
{/if}
|
|
180
|
-
|
|
181
|
-
{#if after}
|
|
182
|
-
<span class="content--after">
|
|
183
|
-
{@render after()}
|
|
184
|
-
</span>
|
|
185
|
-
{/if}
|
|
147
|
+
<InputEnclosure {outline} {disabled} {error} {focused} {size} {roundness} {before} {after}>
|
|
148
|
+
<input
|
|
149
|
+
type={passwordToggle && toggle ? 'text' : 'password'}
|
|
150
|
+
{name}
|
|
151
|
+
{id}
|
|
152
|
+
{disabled}
|
|
153
|
+
{oninput}
|
|
154
|
+
{onchange}
|
|
155
|
+
onfocus={onfocusMod}
|
|
156
|
+
onblur={onblurMod}
|
|
157
|
+
{onpaste}
|
|
158
|
+
{oncopy}
|
|
159
|
+
{oncut}
|
|
160
|
+
{placeholder}
|
|
161
|
+
bind:value
|
|
162
|
+
bind:this={ref}
|
|
163
|
+
{readonly}
|
|
164
|
+
/>
|
|
165
|
+
|
|
166
|
+
{#if passwordToggle && !disabled}
|
|
167
|
+
<UtilityButton {size} title="Toggle password" class="passwordToggle" onclick={ontoggleMod}>
|
|
168
|
+
{#if customPasswordToggleIcon}
|
|
169
|
+
{@render customPasswordToggleIconTyped(toggle)}
|
|
170
|
+
{:else if toggle}
|
|
171
|
+
<Icon icon="mdi:eye-off" width="24" height="24" />
|
|
172
|
+
{:else}
|
|
173
|
+
<Icon icon="mdi:eye" width="24" height="24" />
|
|
174
|
+
{/if}
|
|
175
|
+
</UtilityButton>
|
|
176
|
+
{/if}
|
|
177
|
+
</InputEnclosure>
|
|
186
178
|
</div>
|
|
187
179
|
|
|
188
180
|
<style lang="scss">
|
|
189
|
-
:global(:root) {
|
|
190
|
-
--dodo-ui-PasswordInput-border-color: var(--dodo-color-default-500);
|
|
191
|
-
--dodo-ui-PasswordInput-focus-border-color: var(--dodo-color-primary-500);
|
|
192
|
-
--dodo-ui-PasswordInput-error-border-color: var(--dodo-color-danger-500);
|
|
193
|
-
|
|
194
|
-
--dodo-ui-PasswordInput-disabled-color: var(--dodo-color-default-400);
|
|
195
|
-
--dodo-ui-PasswordInput-disabled-bg: var(--dodo-color-default-200);
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
:global(.dodo-theme--dark) {
|
|
199
|
-
--dodo-ui-PasswordInput-border-color: var(--dodo-color-default-600);
|
|
200
|
-
--dodo-ui-PasswordInput-focus-border-color: var(--dodo-color-primary-600);
|
|
201
|
-
--dodo-ui-PasswordInput-error-border-color: var(--dodo-color-danger-600);
|
|
202
|
-
|
|
203
|
-
--dodo-ui-PasswordInput-disabled-bg: var(--dodo-color-default-100);
|
|
204
|
-
--dodo-ui-PasswordInput-disabled-color: var(--dodo-color-default-500);
|
|
205
|
-
}
|
|
206
|
-
|
|
207
181
|
.dodo-ui-PasswordInput {
|
|
208
|
-
display: flex;
|
|
209
|
-
overflow: hidden;
|
|
210
|
-
color: var(--dodo-color-default-800);
|
|
211
|
-
transition: all 150ms;
|
|
212
|
-
border: 0;
|
|
213
|
-
|
|
214
182
|
input {
|
|
215
183
|
flex: 1;
|
|
216
184
|
border: 0;
|
|
@@ -222,116 +190,26 @@
|
|
|
222
190
|
letter-spacing: 0.3px;
|
|
223
191
|
}
|
|
224
192
|
|
|
225
|
-
&.outline {
|
|
226
|
-
border-style: solid;
|
|
227
|
-
border-width: var(--dodo-ui-element-border-width);
|
|
228
|
-
border-color: var(--dodo-ui-PasswordInput-border-color);
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
&.focused {
|
|
232
|
-
border-color: var(--dodo-ui-PasswordInput-focus-border-color);
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
&.error {
|
|
236
|
-
border-color: var(--dodo-ui-PasswordInput-error-border-color);
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
&.disabled {
|
|
240
|
-
cursor: initial;
|
|
241
|
-
background-color: var(--dodo-ui-PasswordInput-disabled-bg);
|
|
242
|
-
color: var(--dodo-ui-PasswordInput-disabled-color);
|
|
243
|
-
border-color: var(--dodo-ui-PasswordInput-disabled-bg);
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
.content {
|
|
247
|
-
&--after,
|
|
248
|
-
&--before {
|
|
249
|
-
&:empty {
|
|
250
|
-
display: none;
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
&--after,
|
|
255
|
-
&--before {
|
|
256
|
-
display: inline-flex;
|
|
257
|
-
height: 100%;
|
|
258
|
-
align-items: center;
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
|
|
262
193
|
&.size {
|
|
263
194
|
&--normal {
|
|
264
|
-
height: var(--dodo-ui-element-height-normal);
|
|
265
195
|
input {
|
|
266
196
|
font-size: 1rem;
|
|
267
197
|
padding: 0 12px;
|
|
268
198
|
}
|
|
269
|
-
|
|
270
|
-
.content {
|
|
271
|
-
&--before {
|
|
272
|
-
margin-left: 12px;
|
|
273
|
-
margin-right: -4px;
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
&--after {
|
|
277
|
-
margin-right: 12px;
|
|
278
|
-
margin-left: -4px;
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
199
|
}
|
|
282
200
|
|
|
283
201
|
&--small {
|
|
284
|
-
height: var(--dodo-ui-element-height-small);
|
|
285
202
|
input {
|
|
286
203
|
padding: 0 8px;
|
|
287
204
|
font-size: 0.9rem;
|
|
288
205
|
}
|
|
289
|
-
|
|
290
|
-
.content {
|
|
291
|
-
&--before {
|
|
292
|
-
margin-left: 8px;
|
|
293
|
-
margin-right: -2px;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
&--after {
|
|
297
|
-
margin-right: 8px;
|
|
298
|
-
margin-left: -2px;
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
206
|
}
|
|
302
207
|
|
|
303
208
|
&--large {
|
|
304
|
-
height: var(--dodo-ui-element-height-large);
|
|
305
209
|
input {
|
|
306
210
|
font-size: 1.1rem;
|
|
307
211
|
padding: 0 14px;
|
|
308
212
|
}
|
|
309
|
-
|
|
310
|
-
.content {
|
|
311
|
-
&--before {
|
|
312
|
-
margin-left: 14px;
|
|
313
|
-
margin-right: -4px;
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
&--after {
|
|
317
|
-
margin-right: 14px;
|
|
318
|
-
margin-left: -4px;
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
&.roundness {
|
|
325
|
-
&--1x {
|
|
326
|
-
border-radius: var(--dodo-ui-element-roundness-1x);
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
&--2x {
|
|
330
|
-
border-radius: var(--dodo-ui-element-roundness-2x);
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
&--3x {
|
|
334
|
-
border-radius: var(--dodo-ui-element-roundness-3x);
|
|
335
213
|
}
|
|
336
214
|
}
|
|
337
215
|
}
|