@flightlesslabs/dodo-ui 0.1.5 → 0.3.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 -0
- package/dist/index.js +4 -0
- package/dist/stories/Home.mdx +57 -7
- package/dist/stories/assets/dark-theme-toggle.png +0 -0
- package/dist/stories/components/Form/Button/Button.stories.svelte +10 -5
- package/dist/stories/components/Form/Button/Button.svelte +213 -211
- package/dist/stories/components/Form/Button/Button.svelte.d.ts +4 -1
- package/dist/stories/components/Form/Button/Events/Events.stories.svelte +40 -0
- package/dist/stories/components/Form/Button/Events/Events.stories.svelte.d.ts +18 -0
- package/dist/stories/components/Form/Button/Roundness/Roundness.stories.svelte +14 -11
- package/dist/stories/components/Form/Button/utils/scss/mixins.scss +21 -21
- package/dist/stories/components/Form/PasswordInput/Events/Events.stories.svelte +168 -0
- package/dist/stories/components/Form/PasswordInput/Events/Events.stories.svelte.d.ts +18 -0
- package/dist/stories/components/Form/PasswordInput/PasswordInput.stories.svelte +37 -0
- package/dist/stories/components/Form/PasswordInput/PasswordInput.stories.svelte.d.ts +21 -0
- package/dist/stories/components/Form/PasswordInput/PasswordInput.svelte +219 -0
- package/dist/stories/components/Form/PasswordInput/PasswordInput.svelte.d.ts +59 -0
- package/dist/stories/components/Form/PasswordInput/Roundness/Roundness.stories.svelte +20 -0
- package/dist/stories/components/Form/{ExampleButton/ExampleButton.stories.svelte.d.ts → PasswordInput/Roundness/Roundness.stories.svelte.d.ts} +3 -4
- package/dist/stories/components/Form/PasswordInput/Size/Size.stories.svelte +16 -0
- package/dist/stories/components/Form/PasswordInput/Size/Size.stories.svelte.d.ts +26 -0
- package/dist/stories/components/Form/PasswordInput/WithIcon/WithIcon.stories.svelte +31 -0
- package/dist/stories/components/Form/PasswordInput/WithIcon/WithIcon.stories.svelte.d.ts +26 -0
- package/dist/stories/components/Form/TextInput/Events/Events.stories.svelte +148 -0
- package/dist/stories/components/Form/TextInput/Events/Events.stories.svelte.d.ts +18 -0
- package/dist/stories/components/Form/TextInput/Roundness/Roundness.stories.svelte +21 -0
- package/dist/stories/components/Form/TextInput/Roundness/Roundness.stories.svelte.d.ts +26 -0
- package/dist/stories/components/Form/TextInput/Size/Size.stories.svelte +17 -0
- package/dist/stories/components/Form/TextInput/Size/Size.stories.svelte.d.ts +26 -0
- package/dist/stories/components/Form/TextInput/TextInput.stories.svelte +35 -0
- package/dist/stories/components/Form/TextInput/TextInput.stories.svelte.d.ts +21 -0
- package/dist/stories/components/Form/TextInput/TextInput.svelte +166 -0
- package/dist/stories/components/Form/TextInput/TextInput.svelte.d.ts +56 -0
- package/dist/stories/components/Form/TextInput/WithIcon/WithIcon.stories.svelte +47 -0
- package/dist/stories/components/Form/TextInput/WithIcon/WithIcon.stories.svelte.d.ts +26 -0
- package/dist/stories/philosophy/Colors/Colors.mdx +43 -0
- package/dist/stories/philosophy/Colors/Colors.stories.svelte +20 -0
- package/dist/stories/philosophy/Colors/Colors.stories.svelte.d.ts +19 -0
- package/dist/stories/philosophy/Colors/Colors.svelte +33 -0
- package/dist/stories/philosophy/Colors/Colors.svelte.d.ts +6 -0
- package/dist/stories/philosophy/Colors/Opacity.stories.svelte +9 -0
- package/dist/stories/philosophy/Colors/Opacity.stories.svelte.d.ts +19 -0
- package/dist/stories/philosophy/Colors/Opacity.svelte +20 -0
- package/dist/stories/philosophy/Colors/Opacity.svelte.d.ts +18 -0
- package/dist/stories/philosophy/Colors/Swatches/Palette.svelte +15 -0
- package/dist/stories/philosophy/Colors/Swatches/Palette.svelte.d.ts +6 -0
- package/dist/stories/philosophy/Colors/Swatches/Swatch.svelte +18 -0
- package/dist/stories/philosophy/Colors/Swatches/Swatch.svelte.d.ts +8 -0
- package/dist/stories/philosophy/Colors/Swatches/Swatches.svelte +39 -0
- package/dist/stories/philosophy/Colors/Swatches/Swatches.svelte.d.ts +8 -0
- package/dist/stories/philosophy/Colors/utils/color.d.ts +4 -0
- package/dist/stories/philosophy/Colors/utils/color.js +38 -0
- package/dist/stories/philosophy/Themes.mdx +23 -0
- package/dist/styles/_colors.css +2 -2
- package/dist/styles/_components.css +7 -6
- package/dist/styles/_minimal-reset.css +3 -0
- package/dist/styles/global.css +1 -0
- package/dist/types.d.ts +1 -1
- package/package.json +3 -2
- package/src/lib/index.ts +13 -0
- package/src/lib/stories/components/Form/Button/Button.stories.svelte +10 -5
- package/src/lib/stories/components/Form/Button/Button.svelte +36 -30
- package/src/lib/stories/components/Form/Button/Events/Events.stories.svelte +42 -0
- package/src/lib/stories/components/Form/Button/Roundness/Roundness.stories.svelte +14 -11
- package/src/lib/stories/components/Form/Button/utils/scss/mixins.scss +21 -21
- package/src/lib/stories/components/Form/PasswordInput/Events/Events.stories.svelte +174 -0
- package/src/lib/stories/components/Form/PasswordInput/PasswordInput.stories.svelte +41 -0
- package/src/lib/stories/components/Form/PasswordInput/PasswordInput.svelte +361 -0
- package/src/lib/stories/components/Form/PasswordInput/Roundness/Roundness.stories.svelte +20 -0
- package/src/lib/stories/components/Form/PasswordInput/Size/Size.stories.svelte +16 -0
- package/src/lib/stories/components/Form/PasswordInput/WithIcon/WithIcon.stories.svelte +31 -0
- package/src/lib/stories/components/Form/TextInput/Events/Events.stories.svelte +153 -0
- package/src/lib/stories/components/Form/TextInput/Roundness/Roundness.stories.svelte +21 -0
- package/src/lib/stories/components/Form/TextInput/Size/Size.stories.svelte +17 -0
- package/src/lib/stories/components/Form/TextInput/TextInput.stories.svelte +39 -0
- package/src/lib/stories/components/Form/TextInput/TextInput.svelte +293 -0
- package/src/lib/stories/components/Form/TextInput/WithIcon/WithIcon.stories.svelte +47 -0
- package/src/lib/styles/_colors.css +2 -2
- package/src/lib/styles/_components.css +7 -6
- package/src/lib/styles/_minimal-reset.css +3 -0
- package/src/lib/styles/global.css +1 -0
- package/src/lib/types.ts +1 -1
- package/dist/stories/Getting Started.mdx +0 -13
- package/dist/stories/components/Form/ExampleButton/ExampleButton.stories.svelte +0 -30
- package/dist/stories/components/Form/ExampleButton/ExampleButton.svelte +0 -14
- package/dist/stories/components/Form/ExampleButton/ExampleButton.svelte.d.ts +0 -16
- package/dist/stories/components/Form/ExampleButton/button.css +0 -30
- package/src/lib/stories/components/Form/ExampleButton/ExampleButton.stories.svelte +0 -30
- package/src/lib/stories/components/Form/ExampleButton/ExampleButton.svelte +0 -29
- package/src/lib/stories/components/Form/ExampleButton/button.css +0 -30
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
export type TextInputRoundness = ComponentRoundness | false;
|
|
3
|
+
export type TextInputType = 'text' | 'tel' | 'email' | 'password' | 'url' | 'number';
|
|
4
|
+
|
|
5
|
+
export type TextInputFocusEvent = FocusEvent & {
|
|
6
|
+
currentTarget: EventTarget & HTMLInputElement;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export type TextInputClipboardEvent = ClipboardEvent & {
|
|
10
|
+
currentTarget: EventTarget & HTMLInputElement;
|
|
11
|
+
};
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<script lang="ts">
|
|
15
|
+
import type { ComponentRoundness, ComponentSize } from '$lib/types.js';
|
|
16
|
+
import type { Snippet } from 'svelte';
|
|
17
|
+
import type {
|
|
18
|
+
ChangeEventHandler,
|
|
19
|
+
ClipboardEventHandler,
|
|
20
|
+
FocusEventHandler,
|
|
21
|
+
FormEventHandler,
|
|
22
|
+
} from 'svelte/elements';
|
|
23
|
+
|
|
24
|
+
interface TextInputProps {
|
|
25
|
+
/** Input type? */
|
|
26
|
+
type?: TextInputType;
|
|
27
|
+
/** How large should the button be? */
|
|
28
|
+
size?: ComponentSize;
|
|
29
|
+
/** How round should the border radius be? */
|
|
30
|
+
roundness?: TextInputRoundness;
|
|
31
|
+
/** Add a border around the button. Default True */
|
|
32
|
+
outline?: boolean;
|
|
33
|
+
/** Input value */
|
|
34
|
+
value?: string;
|
|
35
|
+
/** How round should the border radius be? */
|
|
36
|
+
placeholder?: string;
|
|
37
|
+
/** Button disabled state */
|
|
38
|
+
disabled?: boolean;
|
|
39
|
+
/** is there any associated Error ? */
|
|
40
|
+
error?: boolean;
|
|
41
|
+
/** Name */
|
|
42
|
+
name?: string;
|
|
43
|
+
/** Id */
|
|
44
|
+
id?: string;
|
|
45
|
+
/** Icon before button content */
|
|
46
|
+
before?: Snippet;
|
|
47
|
+
/** Icon after button content */
|
|
48
|
+
after?: Snippet;
|
|
49
|
+
/** Custom css class*/
|
|
50
|
+
class?: string;
|
|
51
|
+
/** oninput event handler */
|
|
52
|
+
oninput?: FormEventHandler<HTMLInputElement>;
|
|
53
|
+
/** onchange event handler */
|
|
54
|
+
onchange?: ChangeEventHandler<HTMLInputElement>;
|
|
55
|
+
/** onblur event handler */
|
|
56
|
+
onblur?: FocusEventHandler<HTMLInputElement>;
|
|
57
|
+
/** onfocus event handler */
|
|
58
|
+
onfocus?: FocusEventHandler<HTMLInputElement>;
|
|
59
|
+
/** onpaste event handler */
|
|
60
|
+
onpaste?: ClipboardEventHandler<HTMLInputElement>;
|
|
61
|
+
/** oncopy event handler */
|
|
62
|
+
oncopy?: ClipboardEventHandler<HTMLInputElement>;
|
|
63
|
+
/** oncut event handler */
|
|
64
|
+
oncut?: ClipboardEventHandler<HTMLInputElement>;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
let {
|
|
68
|
+
type = 'text',
|
|
69
|
+
size = 'normal',
|
|
70
|
+
roundness = '1x',
|
|
71
|
+
outline = true,
|
|
72
|
+
name,
|
|
73
|
+
id,
|
|
74
|
+
class: className = '',
|
|
75
|
+
disabled = false,
|
|
76
|
+
oninput,
|
|
77
|
+
onchange,
|
|
78
|
+
onblur,
|
|
79
|
+
onfocus,
|
|
80
|
+
onpaste,
|
|
81
|
+
oncopy,
|
|
82
|
+
oncut,
|
|
83
|
+
before,
|
|
84
|
+
after,
|
|
85
|
+
error = false,
|
|
86
|
+
value = $bindable<string>(),
|
|
87
|
+
placeholder,
|
|
88
|
+
}: TextInputProps = $props();
|
|
89
|
+
|
|
90
|
+
let focused: boolean = $state(false);
|
|
91
|
+
|
|
92
|
+
function onfocusMod(e: TextInputFocusEvent) {
|
|
93
|
+
focused = true;
|
|
94
|
+
|
|
95
|
+
if (onfocus) {
|
|
96
|
+
onfocus(e);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function onblurMod(e: TextInputFocusEvent) {
|
|
101
|
+
focused = false;
|
|
102
|
+
|
|
103
|
+
if (onblur) {
|
|
104
|
+
onblur(e);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
</script>
|
|
108
|
+
|
|
109
|
+
<div
|
|
110
|
+
class:outline
|
|
111
|
+
class:disabled
|
|
112
|
+
class:error
|
|
113
|
+
class:focused
|
|
114
|
+
class={['dodo-ui-TextInput', `size--${size}`, `roundness--${roundness}`, className].join(' ')}
|
|
115
|
+
>
|
|
116
|
+
{#if before}
|
|
117
|
+
<span class="content--before">
|
|
118
|
+
{@render before()}
|
|
119
|
+
</span>
|
|
120
|
+
{/if}
|
|
121
|
+
<input
|
|
122
|
+
{type}
|
|
123
|
+
{name}
|
|
124
|
+
{id}
|
|
125
|
+
{disabled}
|
|
126
|
+
{oninput}
|
|
127
|
+
{onchange}
|
|
128
|
+
onfocus={onfocusMod}
|
|
129
|
+
onblur={onblurMod}
|
|
130
|
+
{onpaste}
|
|
131
|
+
{oncopy}
|
|
132
|
+
{oncut}
|
|
133
|
+
{placeholder}
|
|
134
|
+
bind:value
|
|
135
|
+
/>
|
|
136
|
+
{#if after}
|
|
137
|
+
<span class="content--after">
|
|
138
|
+
{@render after()}
|
|
139
|
+
</span>
|
|
140
|
+
{/if}
|
|
141
|
+
</div>
|
|
142
|
+
|
|
143
|
+
<style lang="scss">
|
|
144
|
+
:global(:root) {
|
|
145
|
+
--dodo-ui-TextInput-border-color: var(--dodo-color-default-500);
|
|
146
|
+
--dodo-ui-TextInput-focus-border-color: var(--dodo-color-primary-500);
|
|
147
|
+
--dodo-ui-TextInput-error-border-color: var(--dodo-color-danger-500);
|
|
148
|
+
|
|
149
|
+
--dodo-ui-TextInput-disabled-color: var(--dodo-color-default-400);
|
|
150
|
+
--dodo-ui-TextInput-disabled-bg: var(--dodo-color-default-200);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
:global(.dodo-theme--dark) {
|
|
154
|
+
--dodo-ui-TextInput-border-color: var(--dodo-color-default-600);
|
|
155
|
+
--dodo-ui-TextInput-focus-border-color: var(--dodo-color-primary-600);
|
|
156
|
+
--dodo-ui-TextInput-error-border-color: var(--dodo-color-danger-600);
|
|
157
|
+
|
|
158
|
+
--dodo-ui-TextInput-disabled-bg: var(--dodo-color-default-100);
|
|
159
|
+
--dodo-ui-TextInput-disabled-color: var(--dodo-color-default-500);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.dodo-ui-TextInput {
|
|
163
|
+
display: flex;
|
|
164
|
+
overflow: hidden;
|
|
165
|
+
color: var(--dodo-color-default-800);
|
|
166
|
+
transition: all 150ms;
|
|
167
|
+
border: 0;
|
|
168
|
+
|
|
169
|
+
input {
|
|
170
|
+
flex: 1;
|
|
171
|
+
border: 0;
|
|
172
|
+
outline: 0;
|
|
173
|
+
height: 100%;
|
|
174
|
+
background-color: transparent;
|
|
175
|
+
font-family: inherit;
|
|
176
|
+
color: inherit;
|
|
177
|
+
letter-spacing: 0.3px;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
&.outline {
|
|
181
|
+
border-style: solid;
|
|
182
|
+
border-width: var(--dodo-ui-element-border-width);
|
|
183
|
+
border-color: var(--dodo-ui-TextInput-border-color);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
&.focused {
|
|
187
|
+
border-color: var(--dodo-ui-TextInput-focus-border-color);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
&.error {
|
|
191
|
+
border-color: var(--dodo-ui-TextInput-error-border-color);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
&.disabled {
|
|
195
|
+
cursor: initial;
|
|
196
|
+
background-color: var(--dodo-ui-TextInput-disabled-bg);
|
|
197
|
+
color: var(--dodo-ui-TextInput-disabled-color);
|
|
198
|
+
border-color: var(--dodo-ui-TextInput-disabled-bg);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.content {
|
|
202
|
+
&--after,
|
|
203
|
+
&--before {
|
|
204
|
+
&:empty {
|
|
205
|
+
display: none;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
&--after,
|
|
210
|
+
&--before {
|
|
211
|
+
display: inline-flex;
|
|
212
|
+
height: 100%;
|
|
213
|
+
align-items: center;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
&.size {
|
|
218
|
+
&--normal {
|
|
219
|
+
height: var(--dodo-ui-element-height-normal);
|
|
220
|
+
input {
|
|
221
|
+
font-size: 1rem;
|
|
222
|
+
padding: 0 12px;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.content {
|
|
226
|
+
&--before {
|
|
227
|
+
margin-left: 12px;
|
|
228
|
+
margin-right: -4px;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
&--after {
|
|
232
|
+
margin-right: 12px;
|
|
233
|
+
margin-left: -4px;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
&--small {
|
|
239
|
+
height: var(--dodo-ui-element-height-small);
|
|
240
|
+
input {
|
|
241
|
+
padding: 0 8px;
|
|
242
|
+
font-size: 0.9rem;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.content {
|
|
246
|
+
&--before {
|
|
247
|
+
margin-left: 8px;
|
|
248
|
+
margin-right: -2px;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
&--after {
|
|
252
|
+
margin-right: 8px;
|
|
253
|
+
margin-left: -2px;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
&--large {
|
|
259
|
+
height: var(--dodo-ui-element-height-large);
|
|
260
|
+
input {
|
|
261
|
+
font-size: 1.1rem;
|
|
262
|
+
padding: 0 14px;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
.content {
|
|
266
|
+
&--before {
|
|
267
|
+
margin-left: 14px;
|
|
268
|
+
margin-right: -4px;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
&--after {
|
|
272
|
+
margin-right: 14px;
|
|
273
|
+
margin-left: -4px;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
&.roundness {
|
|
280
|
+
&--1x {
|
|
281
|
+
border-radius: var(--dodo-ui-element-roundness-1x);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
&--2x {
|
|
285
|
+
border-radius: var(--dodo-ui-element-roundness-2x);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
&--3x {
|
|
289
|
+
border-radius: var(--dodo-ui-element-roundness-3x);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
</style>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import TextInput from '../TextInput.svelte';
|
|
4
|
+
import { storyTextInputArgTypes } from '../TextInput.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: TextInput,
|
|
10
|
+
tags: ['autodocs'],
|
|
11
|
+
argTypes: storyTextInputArgTypes,
|
|
12
|
+
});
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<!-- TextInput icon in front. -->
|
|
16
|
+
<Story name="Icon Before">
|
|
17
|
+
<TextInput>
|
|
18
|
+
{#snippet before()}
|
|
19
|
+
<Icon icon="material-symbols:content-copy" />
|
|
20
|
+
{/snippet}
|
|
21
|
+
</TextInput>
|
|
22
|
+
</Story>
|
|
23
|
+
|
|
24
|
+
<!-- TextInput icon in front. -->
|
|
25
|
+
<Story name="Icon After">
|
|
26
|
+
<TextInput>
|
|
27
|
+
{#snippet after()}
|
|
28
|
+
<Icon icon="material-symbols:download-2" />
|
|
29
|
+
{/snippet}
|
|
30
|
+
</TextInput>
|
|
31
|
+
</Story>
|
|
32
|
+
|
|
33
|
+
<Story name="Small" args={{ size: 'small' }}>
|
|
34
|
+
<TextInput size="small">
|
|
35
|
+
{#snippet before()}
|
|
36
|
+
<Icon icon="material-symbols:content-copy" />
|
|
37
|
+
{/snippet}
|
|
38
|
+
</TextInput>
|
|
39
|
+
</Story>
|
|
40
|
+
|
|
41
|
+
<Story name="Large" args={{ size: 'large' }}>
|
|
42
|
+
<TextInput size="large">
|
|
43
|
+
{#snippet before()}
|
|
44
|
+
<Icon icon="material-symbols:content-copy" />
|
|
45
|
+
{/snippet}
|
|
46
|
+
</TextInput>
|
|
47
|
+
</Story>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
:root {
|
|
2
|
-
/*
|
|
2
|
+
/* Neutral colors */
|
|
3
3
|
--dodo-color-black: var(--dodo-color-base-black);
|
|
4
4
|
--dodo-color-white: var(--dodo-color-base-white);
|
|
5
5
|
|
|
6
|
-
/*
|
|
6
|
+
/* Constants colors */
|
|
7
7
|
--dodo-color-constant-black: var(--dodo-color-base-black);
|
|
8
8
|
--dodo-color-constant-white: var(--dodo-color-base-white);
|
|
9
9
|
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
:root {
|
|
2
|
-
--dodo-ui-element-height-normal: 40px;
|
|
3
2
|
--dodo-ui-element-height-small: 34px;
|
|
4
|
-
--dodo-ui-element-height-
|
|
3
|
+
--dodo-ui-element-height-normal: 40px;
|
|
4
|
+
--dodo-ui-element-height-large: 50px;
|
|
5
|
+
|
|
6
|
+
--dodo-ui-element-roundness-1x: 7px;
|
|
7
|
+
--dodo-ui-element-roundness-2x: 13px;
|
|
8
|
+
--dodo-ui-element-roundness-3x: 31px;
|
|
5
9
|
|
|
6
|
-
--dodo-ui-element-
|
|
7
|
-
--dodo-ui-element-roundness-1: var(--dodo-ui-element-roundness-base);
|
|
8
|
-
--dodo-ui-element-roundness-2: calc(var(--dodo-ui-element-roundness-base) * 2);
|
|
9
|
-
--dodo-ui-element-roundness-3: calc(var(--dodo-ui-element-roundness-base) * 4);
|
|
10
|
+
--dodo-ui-element-border-width: 1px;
|
|
10
11
|
}
|
package/src/lib/types.ts
CHANGED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
<script module>
|
|
2
|
-
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
-
import ExampleButton from './ExampleButton.svelte';
|
|
4
|
-
import { fn } from '@storybook/test';
|
|
5
|
-
|
|
6
|
-
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
7
|
-
const { Story } = defineMeta({
|
|
8
|
-
component: ExampleButton,
|
|
9
|
-
tags: ['autodocs'],
|
|
10
|
-
argTypes: {
|
|
11
|
-
backgroundColor: { control: 'color' },
|
|
12
|
-
size: {
|
|
13
|
-
control: { type: 'select' },
|
|
14
|
-
options: ['small', 'medium', 'large'],
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
args: {
|
|
18
|
-
onClick: fn(),
|
|
19
|
-
},
|
|
20
|
-
});
|
|
21
|
-
</script>
|
|
22
|
-
|
|
23
|
-
<!-- More on writing stories with args: https://storybook.js.org/docs/writing-stories/args -->
|
|
24
|
-
<Story name="Primary" args={{ primary: true, label: 'Button' }} />
|
|
25
|
-
|
|
26
|
-
<Story name="Secondary" args={{ label: 'Button' }} />
|
|
27
|
-
|
|
28
|
-
<Story name="Large" args={{ size: 'large', label: 'Button' }} />
|
|
29
|
-
|
|
30
|
-
<Story name="Small" args={{ size: 'small', label: 'Button' }} />
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
<script lang="ts">import './button.css';
|
|
2
|
-
const { primary = false, backgroundColor, size = 'medium', label, onClick } = $props();
|
|
3
|
-
</script>
|
|
4
|
-
|
|
5
|
-
<button
|
|
6
|
-
type="button"
|
|
7
|
-
class={['storybook-button', `storybook-button--${size}`].join(' ')}
|
|
8
|
-
class:storybook-button--primary={primary}
|
|
9
|
-
class:storybook-button--secondary={!primary}
|
|
10
|
-
style:background-color={backgroundColor}
|
|
11
|
-
onclick={onClick}
|
|
12
|
-
>
|
|
13
|
-
{label}
|
|
14
|
-
</button>
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import './button.css';
|
|
2
|
-
interface Props {
|
|
3
|
-
/** Is this the principal call to action on the page? */
|
|
4
|
-
primary?: boolean;
|
|
5
|
-
/** What background color to use */
|
|
6
|
-
backgroundColor?: string;
|
|
7
|
-
/** How large should the button be? */
|
|
8
|
-
size?: 'small' | 'medium' | 'large';
|
|
9
|
-
/** Button contents */
|
|
10
|
-
label: string;
|
|
11
|
-
/** The onclick event handler */
|
|
12
|
-
onClick?: () => void;
|
|
13
|
-
}
|
|
14
|
-
declare const ExampleButton: import("svelte").Component<Props, {}, "">;
|
|
15
|
-
type ExampleButton = ReturnType<typeof ExampleButton>;
|
|
16
|
-
export default ExampleButton;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
.storybook-button {
|
|
2
|
-
display: inline-block;
|
|
3
|
-
cursor: pointer;
|
|
4
|
-
border: 0;
|
|
5
|
-
border-radius: 3em;
|
|
6
|
-
font-weight: 700;
|
|
7
|
-
line-height: 1;
|
|
8
|
-
font-family: 'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
|
9
|
-
}
|
|
10
|
-
.storybook-button--primary {
|
|
11
|
-
background-color: #555ab9;
|
|
12
|
-
color: white;
|
|
13
|
-
}
|
|
14
|
-
.storybook-button--secondary {
|
|
15
|
-
box-shadow: rgba(0, 0, 0, 0.15) 0px 0px 0px 1px inset;
|
|
16
|
-
background-color: transparent;
|
|
17
|
-
color: #333;
|
|
18
|
-
}
|
|
19
|
-
.storybook-button--small {
|
|
20
|
-
padding: 10px 16px;
|
|
21
|
-
font-size: 12px;
|
|
22
|
-
}
|
|
23
|
-
.storybook-button--medium {
|
|
24
|
-
padding: 11px 20px;
|
|
25
|
-
font-size: 14px;
|
|
26
|
-
}
|
|
27
|
-
.storybook-button--large {
|
|
28
|
-
padding: 12px 24px;
|
|
29
|
-
font-size: 16px;
|
|
30
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
<script module>
|
|
2
|
-
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
-
import ExampleButton from './ExampleButton.svelte';
|
|
4
|
-
import { fn } from '@storybook/test';
|
|
5
|
-
|
|
6
|
-
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
7
|
-
const { Story } = defineMeta({
|
|
8
|
-
component: ExampleButton,
|
|
9
|
-
tags: ['autodocs'],
|
|
10
|
-
argTypes: {
|
|
11
|
-
backgroundColor: { control: 'color' },
|
|
12
|
-
size: {
|
|
13
|
-
control: { type: 'select' },
|
|
14
|
-
options: ['small', 'medium', 'large'],
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
args: {
|
|
18
|
-
onClick: fn(),
|
|
19
|
-
},
|
|
20
|
-
});
|
|
21
|
-
</script>
|
|
22
|
-
|
|
23
|
-
<!-- More on writing stories with args: https://storybook.js.org/docs/writing-stories/args -->
|
|
24
|
-
<Story name="Primary" args={{ primary: true, label: 'Button' }} />
|
|
25
|
-
|
|
26
|
-
<Story name="Secondary" args={{ label: 'Button' }} />
|
|
27
|
-
|
|
28
|
-
<Story name="Large" args={{ size: 'large', label: 'Button' }} />
|
|
29
|
-
|
|
30
|
-
<Story name="Small" args={{ size: 'small', label: 'Button' }} />
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import './button.css';
|
|
3
|
-
|
|
4
|
-
interface Props {
|
|
5
|
-
/** Is this the principal call to action on the page? */
|
|
6
|
-
primary?: boolean;
|
|
7
|
-
/** What background color to use */
|
|
8
|
-
backgroundColor?: string;
|
|
9
|
-
/** How large should the button be? */
|
|
10
|
-
size?: 'small' | 'medium' | 'large';
|
|
11
|
-
/** Button contents */
|
|
12
|
-
label: string;
|
|
13
|
-
/** The onclick event handler */
|
|
14
|
-
onClick?: () => void;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const { primary = false, backgroundColor, size = 'medium', label, onClick }: Props = $props();
|
|
18
|
-
</script>
|
|
19
|
-
|
|
20
|
-
<button
|
|
21
|
-
type="button"
|
|
22
|
-
class={['storybook-button', `storybook-button--${size}`].join(' ')}
|
|
23
|
-
class:storybook-button--primary={primary}
|
|
24
|
-
class:storybook-button--secondary={!primary}
|
|
25
|
-
style:background-color={backgroundColor}
|
|
26
|
-
onclick={onClick}
|
|
27
|
-
>
|
|
28
|
-
{label}
|
|
29
|
-
</button>
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
.storybook-button {
|
|
2
|
-
display: inline-block;
|
|
3
|
-
cursor: pointer;
|
|
4
|
-
border: 0;
|
|
5
|
-
border-radius: 3em;
|
|
6
|
-
font-weight: 700;
|
|
7
|
-
line-height: 1;
|
|
8
|
-
font-family: 'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
|
9
|
-
}
|
|
10
|
-
.storybook-button--primary {
|
|
11
|
-
background-color: #555ab9;
|
|
12
|
-
color: white;
|
|
13
|
-
}
|
|
14
|
-
.storybook-button--secondary {
|
|
15
|
-
box-shadow: rgba(0, 0, 0, 0.15) 0px 0px 0px 1px inset;
|
|
16
|
-
background-color: transparent;
|
|
17
|
-
color: #333;
|
|
18
|
-
}
|
|
19
|
-
.storybook-button--small {
|
|
20
|
-
padding: 10px 16px;
|
|
21
|
-
font-size: 12px;
|
|
22
|
-
}
|
|
23
|
-
.storybook-button--medium {
|
|
24
|
-
padding: 11px 20px;
|
|
25
|
-
font-size: 14px;
|
|
26
|
-
}
|
|
27
|
-
.storybook-button--large {
|
|
28
|
-
padding: 12px 24px;
|
|
29
|
-
font-size: 16px;
|
|
30
|
-
}
|