@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
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import Icon from '@iconify/svelte';
|
|
4
|
+
|
|
5
|
+
import SimpleSelect from '../SimpleSelect.svelte';
|
|
6
|
+
import {
|
|
7
|
+
storySimpleSelectArgTypes,
|
|
8
|
+
storySimpleSelectOptions,
|
|
9
|
+
} from '../SimpleSelect.stories.svelte';
|
|
10
|
+
|
|
11
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
12
|
+
const { Story } = defineMeta({
|
|
13
|
+
component: SimpleSelect,
|
|
14
|
+
tags: ['autodocs'],
|
|
15
|
+
argTypes: storySimpleSelectArgTypes,
|
|
16
|
+
args: { options: storySimpleSelectOptions },
|
|
17
|
+
});
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<!-- SimpleSelect icon in front. -->
|
|
21
|
+
<Story name="Icon Before">
|
|
22
|
+
<SimpleSelect options={storySimpleSelectOptions}>
|
|
23
|
+
{#snippet before()}
|
|
24
|
+
<Icon icon="material-symbols:content-copy" />
|
|
25
|
+
{/snippet}
|
|
26
|
+
</SimpleSelect>
|
|
27
|
+
</Story>
|
|
28
|
+
|
|
29
|
+
<!-- SimpleSelect icon in front. -->
|
|
30
|
+
<Story name="Icon After">
|
|
31
|
+
<SimpleSelect options={storySimpleSelectOptions}>
|
|
32
|
+
{#snippet after()}
|
|
33
|
+
<Icon icon="material-symbols:download-2" />
|
|
34
|
+
{/snippet}
|
|
35
|
+
</SimpleSelect>
|
|
36
|
+
</Story>
|
|
@@ -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
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<script lang="ts" module>export {};
|
|
2
2
|
</script>
|
|
3
3
|
|
|
4
|
-
<script lang="ts">
|
|
4
|
+
<script lang="ts">import InputEnclosure from '../../../developer tools/components/InputEnclosure/InputEnclosure.svelte';
|
|
5
|
+
let { type = 'text', size = 'normal', roundness = '1x', outline = true, name, id, class: className = '', disabled = false, oninput, onchange, onblur, onfocus, onpaste, oncopy, oncut, before, after, error = false, value = $bindable(), placeholder, ref = $bindable(), readonly = false, } = $props();
|
|
5
6
|
let focused = $state(false);
|
|
6
7
|
function onfocusMod(e) {
|
|
7
8
|
focused = true;
|
|
@@ -15,7 +16,6 @@ function onblurMod(e) {
|
|
|
15
16
|
onblur(e);
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
|
-
export {};
|
|
19
19
|
</script>
|
|
20
20
|
|
|
21
21
|
<div
|
|
@@ -25,57 +25,28 @@ export {};
|
|
|
25
25
|
class:focused
|
|
26
26
|
class={['dodo-ui-TextInput', `size--${size}`, `roundness--${roundness}`, className].join(' ')}
|
|
27
27
|
>
|
|
28
|
-
{
|
|
29
|
-
<
|
|
30
|
-
{
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
/>
|
|
48
|
-
{#if after}
|
|
49
|
-
<span class="content--after">
|
|
50
|
-
{@render after()}
|
|
51
|
-
</span>
|
|
52
|
-
{/if}
|
|
28
|
+
<InputEnclosure {outline} {disabled} {error} {focused} {size} {roundness} {before} {after}>
|
|
29
|
+
<input
|
|
30
|
+
{type}
|
|
31
|
+
{name}
|
|
32
|
+
{id}
|
|
33
|
+
{disabled}
|
|
34
|
+
{oninput}
|
|
35
|
+
{onchange}
|
|
36
|
+
onfocus={onfocusMod}
|
|
37
|
+
onblur={onblurMod}
|
|
38
|
+
{onpaste}
|
|
39
|
+
{oncopy}
|
|
40
|
+
{oncut}
|
|
41
|
+
{placeholder}
|
|
42
|
+
{readonly}
|
|
43
|
+
bind:value
|
|
44
|
+
bind:this={ref}
|
|
45
|
+
/>
|
|
46
|
+
</InputEnclosure>
|
|
53
47
|
</div>
|
|
54
48
|
|
|
55
|
-
<style
|
|
56
|
-
--dodo-ui-TextInput-border-color: var(--dodo-color-default-500);
|
|
57
|
-
--dodo-ui-TextInput-focus-border-color: var(--dodo-color-primary-500);
|
|
58
|
-
--dodo-ui-TextInput-error-border-color: var(--dodo-color-danger-500);
|
|
59
|
-
--dodo-ui-TextInput-disabled-color: var(--dodo-color-default-400);
|
|
60
|
-
--dodo-ui-TextInput-disabled-bg: var(--dodo-color-default-200);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
:global(.dodo-theme--dark) {
|
|
64
|
-
--dodo-ui-TextInput-border-color: var(--dodo-color-default-600);
|
|
65
|
-
--dodo-ui-TextInput-focus-border-color: var(--dodo-color-primary-600);
|
|
66
|
-
--dodo-ui-TextInput-error-border-color: var(--dodo-color-danger-600);
|
|
67
|
-
--dodo-ui-TextInput-disabled-bg: var(--dodo-color-default-100);
|
|
68
|
-
--dodo-ui-TextInput-disabled-color: var(--dodo-color-default-500);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.dodo-ui-TextInput {
|
|
72
|
-
display: flex;
|
|
73
|
-
overflow: hidden;
|
|
74
|
-
color: var(--dodo-color-default-800);
|
|
75
|
-
transition: all 150ms;
|
|
76
|
-
border: 0;
|
|
77
|
-
}
|
|
78
|
-
.dodo-ui-TextInput input {
|
|
49
|
+
<style>.dodo-ui-TextInput input {
|
|
79
50
|
flex: 1;
|
|
80
51
|
border: 0;
|
|
81
52
|
outline: 0;
|
|
@@ -85,82 +56,15 @@ export {};
|
|
|
85
56
|
color: inherit;
|
|
86
57
|
letter-spacing: 0.3px;
|
|
87
58
|
}
|
|
88
|
-
.dodo-ui-TextInput.outline {
|
|
89
|
-
border-style: solid;
|
|
90
|
-
border-width: var(--dodo-ui-element-border-width);
|
|
91
|
-
border-color: var(--dodo-ui-TextInput-border-color);
|
|
92
|
-
}
|
|
93
|
-
.dodo-ui-TextInput.focused {
|
|
94
|
-
border-color: var(--dodo-ui-TextInput-focus-border-color);
|
|
95
|
-
}
|
|
96
|
-
.dodo-ui-TextInput.error {
|
|
97
|
-
border-color: var(--dodo-ui-TextInput-error-border-color);
|
|
98
|
-
}
|
|
99
|
-
.dodo-ui-TextInput.disabled {
|
|
100
|
-
cursor: initial;
|
|
101
|
-
background-color: var(--dodo-ui-TextInput-disabled-bg);
|
|
102
|
-
color: var(--dodo-ui-TextInput-disabled-color);
|
|
103
|
-
border-color: var(--dodo-ui-TextInput-disabled-bg);
|
|
104
|
-
}
|
|
105
|
-
.dodo-ui-TextInput .content--after:empty, .dodo-ui-TextInput .content--before:empty {
|
|
106
|
-
display: none;
|
|
107
|
-
}
|
|
108
|
-
.dodo-ui-TextInput .content--after, .dodo-ui-TextInput .content--before {
|
|
109
|
-
display: inline-flex;
|
|
110
|
-
height: 100%;
|
|
111
|
-
align-items: center;
|
|
112
|
-
}
|
|
113
|
-
.dodo-ui-TextInput.size--normal {
|
|
114
|
-
height: var(--dodo-ui-element-height-normal);
|
|
115
|
-
}
|
|
116
59
|
.dodo-ui-TextInput.size--normal input {
|
|
117
60
|
font-size: 1rem;
|
|
118
61
|
padding: 0 12px;
|
|
119
62
|
}
|
|
120
|
-
.dodo-ui-TextInput.size--normal .content--before {
|
|
121
|
-
margin-left: 12px;
|
|
122
|
-
margin-right: -4px;
|
|
123
|
-
}
|
|
124
|
-
.dodo-ui-TextInput.size--normal .content--after {
|
|
125
|
-
margin-right: 12px;
|
|
126
|
-
margin-left: -4px;
|
|
127
|
-
}
|
|
128
|
-
.dodo-ui-TextInput.size--small {
|
|
129
|
-
height: var(--dodo-ui-element-height-small);
|
|
130
|
-
}
|
|
131
63
|
.dodo-ui-TextInput.size--small input {
|
|
132
64
|
padding: 0 8px;
|
|
133
65
|
font-size: 0.9rem;
|
|
134
66
|
}
|
|
135
|
-
.dodo-ui-TextInput.size--small .content--before {
|
|
136
|
-
margin-left: 8px;
|
|
137
|
-
margin-right: -2px;
|
|
138
|
-
}
|
|
139
|
-
.dodo-ui-TextInput.size--small .content--after {
|
|
140
|
-
margin-right: 8px;
|
|
141
|
-
margin-left: -2px;
|
|
142
|
-
}
|
|
143
|
-
.dodo-ui-TextInput.size--large {
|
|
144
|
-
height: var(--dodo-ui-element-height-large);
|
|
145
|
-
}
|
|
146
67
|
.dodo-ui-TextInput.size--large input {
|
|
147
68
|
font-size: 1.1rem;
|
|
148
69
|
padding: 0 14px;
|
|
149
|
-
}
|
|
150
|
-
.dodo-ui-TextInput.size--large .content--before {
|
|
151
|
-
margin-left: 14px;
|
|
152
|
-
margin-right: -4px;
|
|
153
|
-
}
|
|
154
|
-
.dodo-ui-TextInput.size--large .content--after {
|
|
155
|
-
margin-right: 14px;
|
|
156
|
-
margin-left: -4px;
|
|
157
|
-
}
|
|
158
|
-
.dodo-ui-TextInput.roundness--1x {
|
|
159
|
-
border-radius: var(--dodo-ui-element-roundness-1x);
|
|
160
|
-
}
|
|
161
|
-
.dodo-ui-TextInput.roundness--2x {
|
|
162
|
-
border-radius: var(--dodo-ui-element-roundness-2x);
|
|
163
|
-
}
|
|
164
|
-
.dodo-ui-TextInput.roundness--3x {
|
|
165
|
-
border-radius: var(--dodo-ui-element-roundness-3x);
|
|
166
70
|
}</style>
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export type TextInputRoundness = ComponentRoundness | false;
|
|
2
1
|
export type TextInputType = 'text' | 'tel' | 'email' | 'password' | 'url' | 'number';
|
|
3
2
|
export type TextInputFocusEvent = FocusEvent & {
|
|
4
3
|
currentTarget: EventTarget & HTMLInputElement;
|
|
@@ -12,18 +11,22 @@ import type { ChangeEventHandler, ClipboardEventHandler, FocusEventHandler, Form
|
|
|
12
11
|
interface TextInputProps {
|
|
13
12
|
/** Input type? */
|
|
14
13
|
type?: TextInputType;
|
|
14
|
+
/** Input ref */
|
|
15
|
+
ref?: HTMLInputElement;
|
|
15
16
|
/** How large should the button be? */
|
|
16
17
|
size?: ComponentSize;
|
|
17
18
|
/** How round should the border radius be? */
|
|
18
|
-
roundness?:
|
|
19
|
+
roundness?: ComponentRoundness | false;
|
|
19
20
|
/** Add a border around the button. Default True */
|
|
20
21
|
outline?: boolean;
|
|
21
22
|
/** Input value */
|
|
22
23
|
value?: string;
|
|
23
24
|
/** How round should the border radius be? */
|
|
24
25
|
placeholder?: string;
|
|
25
|
-
/**
|
|
26
|
+
/** disabled state */
|
|
26
27
|
disabled?: boolean;
|
|
28
|
+
/** Read only ? */
|
|
29
|
+
readonly?: boolean;
|
|
27
30
|
/** is there any associated Error ? */
|
|
28
31
|
error?: boolean;
|
|
29
32
|
/** Name */
|
|
@@ -51,6 +54,6 @@ interface TextInputProps {
|
|
|
51
54
|
/** oncut event handler */
|
|
52
55
|
oncut?: ClipboardEventHandler<HTMLInputElement>;
|
|
53
56
|
}
|
|
54
|
-
declare const TextInput: import("svelte").Component<TextInputProps, {}, "value">;
|
|
57
|
+
declare const TextInput: import("svelte").Component<TextInputProps, {}, "ref" | "value">;
|
|
55
58
|
type TextInput = ReturnType<typeof TextInput>;
|
|
56
59
|
export default TextInput;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<script module lang="ts">import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
2
|
+
import InputEnclosure from './InputEnclosure.svelte';
|
|
3
|
+
export const storyInputEnclosureArgTypes = {
|
|
4
|
+
roundness: {
|
|
5
|
+
control: { type: 'select' },
|
|
6
|
+
options: [false, '1x', '2x', '3x'],
|
|
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: InputEnclosure,
|
|
16
|
+
tags: ['autodocs'],
|
|
17
|
+
argTypes: storyInputEnclosureArgTypes,
|
|
18
|
+
});
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<!-- An ensloure for Form Inputs [TextInput](?path=/docs/components-form-textinput--docs) -->
|
|
22
|
+
<Story name="Default" />
|
|
23
|
+
|
|
24
|
+
<Story name="Focused" args={{ focused: true }} />
|
|
25
|
+
|
|
26
|
+
<Story name="Error" args={{ error: true }} />
|
|
27
|
+
|
|
28
|
+
<Story name="Disabled" args={{ disabled: true }} />
|
|
29
|
+
|
|
30
|
+
<Story name="Input example">
|
|
31
|
+
<InputEnclosure>
|
|
32
|
+
<input type="text" style="flex: 1; border: 0;" placeholder="Enter name" />
|
|
33
|
+
</InputEnclosure>
|
|
34
|
+
</Story>
|
package/dist/stories/developer tools/components/InputEnclosure/InputEnclosure.stories.svelte.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import InputEnclosure from './InputEnclosure.svelte';
|
|
2
|
+
import type { StoryBookArgTypes } from '../../../../storybook-types.js';
|
|
3
|
+
export declare const storyInputEnclosureArgTypes: 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 InputEnclosure: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
18
|
+
[evt: string]: CustomEvent<any>;
|
|
19
|
+
}, {}, {}, string>;
|
|
20
|
+
type InputEnclosure = InstanceType<typeof InputEnclosure>;
|
|
21
|
+
export default InputEnclosure;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
<script lang="ts">let { size = 'normal', roundness = '1x', outline = true, class: className = '', disabled = false, before, after, error = false, focused = false, children, ref = $bindable(), } = $props();
|
|
2
|
+
export {};
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<div
|
|
6
|
+
class:outline
|
|
7
|
+
class:disabled
|
|
8
|
+
class:error
|
|
9
|
+
class:focused
|
|
10
|
+
class={['dodo-ui-InputEnclosure', `size--${size}`, `roundness--${roundness}`, className].join(
|
|
11
|
+
' ',
|
|
12
|
+
)}
|
|
13
|
+
bind:this={ref}
|
|
14
|
+
>
|
|
15
|
+
{#if before}
|
|
16
|
+
<span class="content--before">
|
|
17
|
+
{@render before()}
|
|
18
|
+
</span>
|
|
19
|
+
{/if}
|
|
20
|
+
|
|
21
|
+
{#if children}
|
|
22
|
+
{@render children()}
|
|
23
|
+
{/if}
|
|
24
|
+
{#if after}
|
|
25
|
+
<span class="content--after">
|
|
26
|
+
{@render after()}
|
|
27
|
+
</span>
|
|
28
|
+
{/if}
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
<style>:global(:root) {
|
|
32
|
+
--dodo-ui-InputEnclosure-border-color: var(--dodo-color-default-500);
|
|
33
|
+
--dodo-ui-InputEnclosure-focus-border-color: var(--dodo-color-primary-500);
|
|
34
|
+
--dodo-ui-InputEnclosure-error-border-color: var(--dodo-color-danger-500);
|
|
35
|
+
--dodo-ui-InputEnclosure-disabled-color: var(--dodo-color-default-400);
|
|
36
|
+
--dodo-ui-InputEnclosure-disabled-bg: var(--dodo-color-default-200);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
:global(.dodo-theme--dark) {
|
|
40
|
+
--dodo-ui-InputEnclosure-border-color: var(--dodo-color-default-600);
|
|
41
|
+
--dodo-ui-InputEnclosure-focus-border-color: var(--dodo-color-primary-600);
|
|
42
|
+
--dodo-ui-InputEnclosure-error-border-color: var(--dodo-color-danger-600);
|
|
43
|
+
--dodo-ui-InputEnclosure-disabled-bg: var(--dodo-color-default-100);
|
|
44
|
+
--dodo-ui-InputEnclosure-disabled-color: var(--dodo-color-default-500);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.dodo-ui-InputEnclosure {
|
|
48
|
+
display: flex;
|
|
49
|
+
overflow: hidden;
|
|
50
|
+
color: var(--dodo-color-default-800);
|
|
51
|
+
transition: all 150ms;
|
|
52
|
+
border: 0;
|
|
53
|
+
}
|
|
54
|
+
.dodo-ui-InputEnclosure.outline {
|
|
55
|
+
border-style: solid;
|
|
56
|
+
border-width: var(--dodo-ui-element-border-width);
|
|
57
|
+
border-color: var(--dodo-ui-InputEnclosure-border-color);
|
|
58
|
+
}
|
|
59
|
+
.dodo-ui-InputEnclosure.focused {
|
|
60
|
+
border-color: var(--dodo-ui-InputEnclosure-focus-border-color);
|
|
61
|
+
}
|
|
62
|
+
.dodo-ui-InputEnclosure.error {
|
|
63
|
+
border-color: var(--dodo-ui-InputEnclosure-error-border-color);
|
|
64
|
+
}
|
|
65
|
+
.dodo-ui-InputEnclosure.disabled {
|
|
66
|
+
cursor: initial;
|
|
67
|
+
background-color: var(--dodo-ui-InputEnclosure-disabled-bg);
|
|
68
|
+
color: var(--dodo-ui-InputEnclosure-disabled-color);
|
|
69
|
+
border-color: var(--dodo-ui-InputEnclosure-disabled-bg);
|
|
70
|
+
}
|
|
71
|
+
.dodo-ui-InputEnclosure .content--after:empty, .dodo-ui-InputEnclosure .content--before:empty {
|
|
72
|
+
display: none;
|
|
73
|
+
}
|
|
74
|
+
.dodo-ui-InputEnclosure .content--after, .dodo-ui-InputEnclosure .content--before {
|
|
75
|
+
display: inline-flex;
|
|
76
|
+
height: 100%;
|
|
77
|
+
align-items: center;
|
|
78
|
+
}
|
|
79
|
+
.dodo-ui-InputEnclosure.size--normal {
|
|
80
|
+
height: var(--dodo-ui-element-height-normal);
|
|
81
|
+
}
|
|
82
|
+
.dodo-ui-InputEnclosure.size--normal .content--before {
|
|
83
|
+
margin-left: 12px;
|
|
84
|
+
margin-right: -4px;
|
|
85
|
+
}
|
|
86
|
+
.dodo-ui-InputEnclosure.size--normal .content--after {
|
|
87
|
+
margin-right: 12px;
|
|
88
|
+
margin-left: -4px;
|
|
89
|
+
}
|
|
90
|
+
.dodo-ui-InputEnclosure.size--small {
|
|
91
|
+
height: var(--dodo-ui-element-height-small);
|
|
92
|
+
}
|
|
93
|
+
.dodo-ui-InputEnclosure.size--small .content--before {
|
|
94
|
+
margin-left: 8px;
|
|
95
|
+
margin-right: -2px;
|
|
96
|
+
}
|
|
97
|
+
.dodo-ui-InputEnclosure.size--small .content--after {
|
|
98
|
+
margin-right: 8px;
|
|
99
|
+
margin-left: -2px;
|
|
100
|
+
}
|
|
101
|
+
.dodo-ui-InputEnclosure.size--large {
|
|
102
|
+
height: var(--dodo-ui-element-height-large);
|
|
103
|
+
}
|
|
104
|
+
.dodo-ui-InputEnclosure.size--large .content--before {
|
|
105
|
+
margin-left: 14px;
|
|
106
|
+
margin-right: -4px;
|
|
107
|
+
}
|
|
108
|
+
.dodo-ui-InputEnclosure.size--large .content--after {
|
|
109
|
+
margin-right: 14px;
|
|
110
|
+
margin-left: -4px;
|
|
111
|
+
}
|
|
112
|
+
.dodo-ui-InputEnclosure.roundness--1x {
|
|
113
|
+
border-radius: var(--dodo-ui-element-roundness-1x);
|
|
114
|
+
}
|
|
115
|
+
.dodo-ui-InputEnclosure.roundness--2x {
|
|
116
|
+
border-radius: var(--dodo-ui-element-roundness-2x);
|
|
117
|
+
}
|
|
118
|
+
.dodo-ui-InputEnclosure.roundness--3x {
|
|
119
|
+
border-radius: var(--dodo-ui-element-roundness-3x);
|
|
120
|
+
}</style>
|
|
@@ -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
|
+
}
|