@flightlesslabs/dodo-ui 0.4.0 → 0.6.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 +9 -1
- package/dist/index.js +6 -0
- package/dist/stories/components/Form/Button/Button.stories.svelte +1 -1
- package/dist/stories/components/Form/Button/Button.svelte +37 -37
- package/dist/stories/components/Form/Button/Button.svelte.d.ts +1 -1
- package/dist/stories/components/Form/Button/Color/Color.stories.svelte +9 -7
- 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 +17 -6
- package/dist/stories/components/Form/Message/Message.svelte.d.ts +4 -1
- 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/components/Layout/Paper/Paper.stories.svelte +32 -0
- package/dist/stories/components/Layout/Paper/Paper.stories.svelte.d.ts +21 -0
- package/dist/stories/components/Layout/Paper/Paper.svelte +52 -0
- package/dist/stories/components/Layout/Paper/Paper.svelte.d.ts +23 -0
- package/dist/stories/components/Layout/Paper/Roundness/Roundness.stories.svelte +30 -0
- package/dist/stories/components/Layout/Paper/Roundness/Roundness.stories.svelte.d.ts +26 -0
- package/dist/stories/components/Layout/Paper/Shadow/Shadow.stories.svelte +42 -0
- package/dist/stories/components/Layout/Paper/Shadow/Shadow.stories.svelte.d.ts +26 -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/philosophy/Colors/utils/color.js +1 -1
- package/dist/styles/_colors.css +26 -26
- package/dist/styles/_shadow.css +39 -0
- package/dist/styles/global.css +1 -0
- package/dist/types.d.ts +1 -0
- package/package.json +1 -1
- package/src/lib/index.ts +17 -1
- package/src/lib/stories/components/Form/Button/Button.stories.svelte +1 -1
- package/src/lib/stories/components/Form/Button/Button.svelte +4 -4
- package/src/lib/stories/components/Form/Button/Color/Color.stories.svelte +9 -7
- 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 +28 -7
- 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/components/Layout/Paper/Paper.stories.svelte +36 -0
- package/src/lib/stories/components/Layout/Paper/Paper.svelte +91 -0
- package/src/lib/stories/components/Layout/Paper/Roundness/Roundness.stories.svelte +30 -0
- package/src/lib/stories/components/Layout/Paper/Shadow/Shadow.stories.svelte +42 -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/styles/_colors.css +26 -26
- package/src/lib/styles/_shadow.css +39 -0
- package/src/lib/styles/global.css +1 -0
- package/src/lib/types.ts +1 -0
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
|
-
export type TextInputRoundness = ComponentRoundness | false;
|
|
3
2
|
export type TextInputType = 'text' | 'tel' | 'email' | 'password' | 'url' | 'number';
|
|
4
3
|
|
|
5
4
|
export type TextInputFocusEvent = FocusEvent & {
|
|
@@ -12,6 +11,8 @@
|
|
|
12
11
|
</script>
|
|
13
12
|
|
|
14
13
|
<script lang="ts">
|
|
14
|
+
import InputEnclosure from '$lib/stories/developer tools/components/InputEnclosure/InputEnclosure.svelte';
|
|
15
|
+
|
|
15
16
|
import type { ComponentRoundness, ComponentSize } from '$lib/types.js';
|
|
16
17
|
import type { Snippet } from 'svelte';
|
|
17
18
|
import type {
|
|
@@ -29,7 +30,7 @@
|
|
|
29
30
|
/** How large should the button be? */
|
|
30
31
|
size?: ComponentSize;
|
|
31
32
|
/** How round should the border radius be? */
|
|
32
|
-
roundness?:
|
|
33
|
+
roundness?: ComponentRoundness | false;
|
|
33
34
|
/** Add a border around the button. Default True */
|
|
34
35
|
outline?: boolean;
|
|
35
36
|
/** Input value */
|
|
@@ -119,61 +120,29 @@
|
|
|
119
120
|
class:focused
|
|
120
121
|
class={['dodo-ui-TextInput', `size--${size}`, `roundness--${roundness}`, className].join(' ')}
|
|
121
122
|
>
|
|
122
|
-
{
|
|
123
|
-
<
|
|
124
|
-
{
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
bind:value
|
|
142
|
-
bind:this={ref}
|
|
143
|
-
/>
|
|
144
|
-
{#if after}
|
|
145
|
-
<span class="content--after">
|
|
146
|
-
{@render after()}
|
|
147
|
-
</span>
|
|
148
|
-
{/if}
|
|
123
|
+
<InputEnclosure {outline} {disabled} {error} {focused} {size} {roundness} {before} {after}>
|
|
124
|
+
<input
|
|
125
|
+
{type}
|
|
126
|
+
{name}
|
|
127
|
+
{id}
|
|
128
|
+
{disabled}
|
|
129
|
+
{oninput}
|
|
130
|
+
{onchange}
|
|
131
|
+
onfocus={onfocusMod}
|
|
132
|
+
onblur={onblurMod}
|
|
133
|
+
{onpaste}
|
|
134
|
+
{oncopy}
|
|
135
|
+
{oncut}
|
|
136
|
+
{placeholder}
|
|
137
|
+
{readonly}
|
|
138
|
+
bind:value
|
|
139
|
+
bind:this={ref}
|
|
140
|
+
/>
|
|
141
|
+
</InputEnclosure>
|
|
149
142
|
</div>
|
|
150
143
|
|
|
151
144
|
<style lang="scss">
|
|
152
|
-
:global(:root) {
|
|
153
|
-
--dodo-ui-TextInput-border-color: var(--dodo-color-default-500);
|
|
154
|
-
--dodo-ui-TextInput-focus-border-color: var(--dodo-color-primary-500);
|
|
155
|
-
--dodo-ui-TextInput-error-border-color: var(--dodo-color-danger-500);
|
|
156
|
-
|
|
157
|
-
--dodo-ui-TextInput-disabled-color: var(--dodo-color-default-400);
|
|
158
|
-
--dodo-ui-TextInput-disabled-bg: var(--dodo-color-default-200);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
:global(.dodo-theme--dark) {
|
|
162
|
-
--dodo-ui-TextInput-border-color: var(--dodo-color-default-600);
|
|
163
|
-
--dodo-ui-TextInput-focus-border-color: var(--dodo-color-primary-600);
|
|
164
|
-
--dodo-ui-TextInput-error-border-color: var(--dodo-color-danger-600);
|
|
165
|
-
|
|
166
|
-
--dodo-ui-TextInput-disabled-bg: var(--dodo-color-default-100);
|
|
167
|
-
--dodo-ui-TextInput-disabled-color: var(--dodo-color-default-500);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
145
|
.dodo-ui-TextInput {
|
|
171
|
-
display: flex;
|
|
172
|
-
overflow: hidden;
|
|
173
|
-
color: var(--dodo-color-default-800);
|
|
174
|
-
transition: all 150ms;
|
|
175
|
-
border: 0;
|
|
176
|
-
|
|
177
146
|
input {
|
|
178
147
|
flex: 1;
|
|
179
148
|
border: 0;
|
|
@@ -185,116 +154,26 @@
|
|
|
185
154
|
letter-spacing: 0.3px;
|
|
186
155
|
}
|
|
187
156
|
|
|
188
|
-
&.outline {
|
|
189
|
-
border-style: solid;
|
|
190
|
-
border-width: var(--dodo-ui-element-border-width);
|
|
191
|
-
border-color: var(--dodo-ui-TextInput-border-color);
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
&.focused {
|
|
195
|
-
border-color: var(--dodo-ui-TextInput-focus-border-color);
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
&.error {
|
|
199
|
-
border-color: var(--dodo-ui-TextInput-error-border-color);
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
&.disabled {
|
|
203
|
-
cursor: initial;
|
|
204
|
-
background-color: var(--dodo-ui-TextInput-disabled-bg);
|
|
205
|
-
color: var(--dodo-ui-TextInput-disabled-color);
|
|
206
|
-
border-color: var(--dodo-ui-TextInput-disabled-bg);
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
.content {
|
|
210
|
-
&--after,
|
|
211
|
-
&--before {
|
|
212
|
-
&:empty {
|
|
213
|
-
display: none;
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
&--after,
|
|
218
|
-
&--before {
|
|
219
|
-
display: inline-flex;
|
|
220
|
-
height: 100%;
|
|
221
|
-
align-items: center;
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
|
|
225
157
|
&.size {
|
|
226
158
|
&--normal {
|
|
227
|
-
height: var(--dodo-ui-element-height-normal);
|
|
228
159
|
input {
|
|
229
160
|
font-size: 1rem;
|
|
230
161
|
padding: 0 12px;
|
|
231
162
|
}
|
|
232
|
-
|
|
233
|
-
.content {
|
|
234
|
-
&--before {
|
|
235
|
-
margin-left: 12px;
|
|
236
|
-
margin-right: -4px;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
&--after {
|
|
240
|
-
margin-right: 12px;
|
|
241
|
-
margin-left: -4px;
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
163
|
}
|
|
245
164
|
|
|
246
165
|
&--small {
|
|
247
|
-
height: var(--dodo-ui-element-height-small);
|
|
248
166
|
input {
|
|
249
167
|
padding: 0 8px;
|
|
250
168
|
font-size: 0.9rem;
|
|
251
169
|
}
|
|
252
|
-
|
|
253
|
-
.content {
|
|
254
|
-
&--before {
|
|
255
|
-
margin-left: 8px;
|
|
256
|
-
margin-right: -2px;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
&--after {
|
|
260
|
-
margin-right: 8px;
|
|
261
|
-
margin-left: -2px;
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
170
|
}
|
|
265
171
|
|
|
266
172
|
&--large {
|
|
267
|
-
height: var(--dodo-ui-element-height-large);
|
|
268
173
|
input {
|
|
269
174
|
font-size: 1.1rem;
|
|
270
175
|
padding: 0 14px;
|
|
271
176
|
}
|
|
272
|
-
|
|
273
|
-
.content {
|
|
274
|
-
&--before {
|
|
275
|
-
margin-left: 14px;
|
|
276
|
-
margin-right: -4px;
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
&--after {
|
|
280
|
-
margin-right: 14px;
|
|
281
|
-
margin-left: -4px;
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
&.roundness {
|
|
288
|
-
&--1x {
|
|
289
|
-
border-radius: var(--dodo-ui-element-roundness-1x);
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
&--2x {
|
|
293
|
-
border-radius: var(--dodo-ui-element-roundness-2x);
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
&--3x {
|
|
297
|
-
border-radius: var(--dodo-ui-element-roundness-3x);
|
|
298
177
|
}
|
|
299
178
|
}
|
|
300
179
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import Paper from './Paper.svelte';
|
|
4
|
+
import type { StoryBookArgTypes } from '$lib/storybook-types.js';
|
|
5
|
+
|
|
6
|
+
export const storyPaperArgTypes: StoryBookArgTypes = {
|
|
7
|
+
roundness: {
|
|
8
|
+
control: { type: 'select' },
|
|
9
|
+
options: [false, '1x', '2x', '3x', 'full'],
|
|
10
|
+
},
|
|
11
|
+
shadow: {
|
|
12
|
+
control: { type: 'select' },
|
|
13
|
+
options: [false, '1x', '2x', '3x', '4x', '5x', '6x', '7x'],
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
18
|
+
const { Story } = defineMeta({
|
|
19
|
+
component: Paper,
|
|
20
|
+
tags: ['autodocs'],
|
|
21
|
+
argTypes: storyPaperArgTypes,
|
|
22
|
+
});
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<!-- ⚠️ Test Paper: Do not use! -->
|
|
26
|
+
<Story
|
|
27
|
+
name="Test Paper"
|
|
28
|
+
args={{
|
|
29
|
+
_unsafeChildrenStringForTesting: 'Hola!',
|
|
30
|
+
}}
|
|
31
|
+
/>
|
|
32
|
+
|
|
33
|
+
<!-- Paper with default style -->
|
|
34
|
+
<Story name="Default">
|
|
35
|
+
<Paper>Hola!</Paper>
|
|
36
|
+
</Story>
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
export type PaperRoundness = ComponentRoundness | false | ComponentRoundnessFull;
|
|
3
|
+
export type PaperShadow = false | '1x' | '2x' | '3x' | '4x' | '5x' | '6x' | '7x';
|
|
4
|
+
</script>
|
|
5
|
+
|
|
6
|
+
<script lang="ts">
|
|
7
|
+
import type { ComponentRoundness, ComponentRoundnessFull } from '$lib/types.js';
|
|
8
|
+
import type { Snippet } from 'svelte';
|
|
9
|
+
|
|
10
|
+
interface PaperProps {
|
|
11
|
+
/** Paper contents goes here */
|
|
12
|
+
children?: Snippet;
|
|
13
|
+
/** Paper ref */
|
|
14
|
+
ref?: HTMLDivElement;
|
|
15
|
+
/** How round should the border radius be? */
|
|
16
|
+
roundness?: PaperRoundness;
|
|
17
|
+
/** Shadow elevation */
|
|
18
|
+
shadow?: PaperShadow;
|
|
19
|
+
/** Custom css class*/
|
|
20
|
+
class?: string;
|
|
21
|
+
/** Id */
|
|
22
|
+
id?: string;
|
|
23
|
+
/** Test: ⚠️ Unsafe Children String. Do Not use*/
|
|
24
|
+
_unsafeChildrenStringForTesting?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
let {
|
|
28
|
+
children,
|
|
29
|
+
roundness = '1x',
|
|
30
|
+
shadow = '1x',
|
|
31
|
+
id,
|
|
32
|
+
class: className = '',
|
|
33
|
+
_unsafeChildrenStringForTesting,
|
|
34
|
+
ref = $bindable<HTMLDivElement>(),
|
|
35
|
+
}: PaperProps = $props();
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<div
|
|
39
|
+
class={[
|
|
40
|
+
'dodo-ui-Paper',
|
|
41
|
+
`roundness--${roundness}`,
|
|
42
|
+
`${shadow ? `shadow--${shadow} dodo-shadow-${shadow}` : `shadow--${shadow}`}`,
|
|
43
|
+
className,
|
|
44
|
+
].join(' ')}
|
|
45
|
+
{id}
|
|
46
|
+
bind:this={ref}
|
|
47
|
+
>
|
|
48
|
+
{#if children}
|
|
49
|
+
{@render children()}
|
|
50
|
+
{:else if _unsafeChildrenStringForTesting}
|
|
51
|
+
{_unsafeChildrenStringForTesting}
|
|
52
|
+
{/if}
|
|
53
|
+
</div>
|
|
54
|
+
|
|
55
|
+
<style lang="scss">
|
|
56
|
+
:global(:root) {
|
|
57
|
+
--dodo-ui-Paper-bg: var(--dodo-color-white);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
:global(.dodo-theme--dark) {
|
|
61
|
+
--dodo-ui-Paper-bg: var(--dodo-color-default-100);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.dodo-ui-Paper {
|
|
65
|
+
outline: none;
|
|
66
|
+
transition: all 150ms;
|
|
67
|
+
font-family: inherit;
|
|
68
|
+
color: inherit;
|
|
69
|
+
|
|
70
|
+
background-color: var(--dodo-ui-Paper-bg);
|
|
71
|
+
overflow: hidden;
|
|
72
|
+
|
|
73
|
+
&.roundness {
|
|
74
|
+
&--1x {
|
|
75
|
+
border-radius: var(--dodo-ui-element-roundness-1x);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
&--2x {
|
|
79
|
+
border-radius: var(--dodo-ui-element-roundness-2x);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
&--3x {
|
|
83
|
+
border-radius: var(--dodo-ui-element-roundness-3x);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
&--full {
|
|
87
|
+
border-radius: 50%;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
</style>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import Paper from '../Paper.svelte';
|
|
4
|
+
import { storyPaperArgTypes } from '../Paper.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: Paper,
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
argTypes: storyPaperArgTypes,
|
|
11
|
+
});
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<Story name="Roundness 1x">
|
|
15
|
+
<Paper>Hola!</Paper>
|
|
16
|
+
</Story>
|
|
17
|
+
|
|
18
|
+
<Story name="Roundness 2x" args={{ roundness: '2x' }}><Paper roundness="2x">Hola!</Paper></Story>
|
|
19
|
+
|
|
20
|
+
<Story name="Roundness 3x" args={{ roundness: '3x' }}>
|
|
21
|
+
<Paper roundness="3x">Hola!</Paper>
|
|
22
|
+
</Story>
|
|
23
|
+
|
|
24
|
+
<Story name="Roundness False" args={{ roundness: false }}>
|
|
25
|
+
<Paper roundness={false}>Hola!</Paper>
|
|
26
|
+
</Story>
|
|
27
|
+
|
|
28
|
+
<Story name="Roundness Full" args={{ roundness: 'full' }}>
|
|
29
|
+
<Paper roundness="full">Hola!</Paper>
|
|
30
|
+
</Story>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import Paper from '../Paper.svelte';
|
|
4
|
+
import { storyPaperArgTypes } from '../Paper.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: Paper,
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
argTypes: storyPaperArgTypes,
|
|
11
|
+
});
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<Story name="Shadow 1x">
|
|
15
|
+
<Paper>Hola!</Paper>
|
|
16
|
+
</Story>
|
|
17
|
+
|
|
18
|
+
<Story name="Shadow 2x" args={{ shadow: '2x' }}><Paper shadow="2x">Hola!</Paper></Story>
|
|
19
|
+
|
|
20
|
+
<Story name="Shadow 3x" args={{ shadow: '3x' }}>
|
|
21
|
+
<Paper shadow="3x">Hola!</Paper>
|
|
22
|
+
</Story>
|
|
23
|
+
|
|
24
|
+
<Story name="Shadow 4x" args={{ shadow: '4x' }}>
|
|
25
|
+
<Paper shadow="4x">Hola!</Paper>
|
|
26
|
+
</Story>
|
|
27
|
+
|
|
28
|
+
<Story name="Shadow 5x" args={{ shadow: '5x' }}>
|
|
29
|
+
<Paper shadow="5x">Hola!</Paper>
|
|
30
|
+
</Story>
|
|
31
|
+
|
|
32
|
+
<Story name="Shadow 6x" args={{ shadow: '6x' }}>
|
|
33
|
+
<Paper shadow="6x">Hola!</Paper>
|
|
34
|
+
</Story>
|
|
35
|
+
|
|
36
|
+
<Story name="Shadow 7x" args={{ shadow: '7x' }}>
|
|
37
|
+
<Paper shadow="7x">Hola!</Paper>
|
|
38
|
+
</Story>
|
|
39
|
+
|
|
40
|
+
<Story name="Shadow False" args={{ shadow: false }}>
|
|
41
|
+
<Paper shadow={false}>Hola!</Paper>
|
|
42
|
+
</Story>
|
package/src/lib/stories/developer tools/components/InputEnclosure/InputEnclosure.stories.svelte
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import InputEnclosure from './InputEnclosure.svelte';
|
|
4
|
+
import type { StoryBookArgTypes } from '$lib/storybook-types.js';
|
|
5
|
+
|
|
6
|
+
export const storyInputEnclosureArgTypes: StoryBookArgTypes = {
|
|
7
|
+
roundness: {
|
|
8
|
+
control: { type: 'select' },
|
|
9
|
+
options: [false, '1x', '2x', '3x'],
|
|
10
|
+
},
|
|
11
|
+
size: {
|
|
12
|
+
control: { type: 'select' },
|
|
13
|
+
options: ['normal', 'small', 'large'],
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
18
|
+
const { Story } = defineMeta({
|
|
19
|
+
component: InputEnclosure,
|
|
20
|
+
tags: ['autodocs'],
|
|
21
|
+
argTypes: storyInputEnclosureArgTypes,
|
|
22
|
+
});
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<!-- An ensloure for Form Inputs [TextInput](?path=/docs/components-form-textinput--docs) -->
|
|
26
|
+
<Story name="Default" />
|
|
27
|
+
|
|
28
|
+
<Story name="Focused" args={{ focused: true }} />
|
|
29
|
+
|
|
30
|
+
<Story name="Error" args={{ error: true }} />
|
|
31
|
+
|
|
32
|
+
<Story name="Disabled" args={{ disabled: true }} />
|
|
33
|
+
|
|
34
|
+
<Story name="Input example">
|
|
35
|
+
<InputEnclosure>
|
|
36
|
+
<input type="text" style="flex: 1; border: 0;" placeholder="Enter name" />
|
|
37
|
+
</InputEnclosure>
|
|
38
|
+
</Story>
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { ComponentRoundness, ComponentSize } from '$lib/types.js';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
|
|
5
|
+
interface InputEnclosureProps {
|
|
6
|
+
/** InputEnclosure contents goes here */
|
|
7
|
+
children?: Snippet;
|
|
8
|
+
/** InputEnclosure ref */
|
|
9
|
+
ref?: HTMLDivElement;
|
|
10
|
+
/** How large should the button be? */
|
|
11
|
+
size?: ComponentSize;
|
|
12
|
+
/** How round should the border radius be? */
|
|
13
|
+
roundness?: ComponentRoundness | false;
|
|
14
|
+
/** Add a border around the button. Default True */
|
|
15
|
+
outline?: boolean;
|
|
16
|
+
/** disabled state */
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
/** is there any associated Error ? */
|
|
19
|
+
error?: boolean;
|
|
20
|
+
/** is focused */
|
|
21
|
+
focused?: boolean;
|
|
22
|
+
/** Icon before button content */
|
|
23
|
+
before?: Snippet;
|
|
24
|
+
/** Icon after button content */
|
|
25
|
+
after?: Snippet;
|
|
26
|
+
/** Custom css class*/
|
|
27
|
+
class?: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
let {
|
|
31
|
+
size = 'normal',
|
|
32
|
+
roundness = '1x',
|
|
33
|
+
outline = true,
|
|
34
|
+
class: className = '',
|
|
35
|
+
disabled = false,
|
|
36
|
+
before,
|
|
37
|
+
after,
|
|
38
|
+
error = false,
|
|
39
|
+
focused = false,
|
|
40
|
+
children,
|
|
41
|
+
ref = $bindable<HTMLDivElement>(),
|
|
42
|
+
}: InputEnclosureProps = $props();
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<div
|
|
46
|
+
class:outline
|
|
47
|
+
class:disabled
|
|
48
|
+
class:error
|
|
49
|
+
class:focused
|
|
50
|
+
class={['dodo-ui-InputEnclosure', `size--${size}`, `roundness--${roundness}`, className].join(
|
|
51
|
+
' ',
|
|
52
|
+
)}
|
|
53
|
+
bind:this={ref}
|
|
54
|
+
>
|
|
55
|
+
{#if before}
|
|
56
|
+
<span class="content--before">
|
|
57
|
+
{@render before()}
|
|
58
|
+
</span>
|
|
59
|
+
{/if}
|
|
60
|
+
|
|
61
|
+
{#if children}
|
|
62
|
+
{@render children()}
|
|
63
|
+
{/if}
|
|
64
|
+
{#if after}
|
|
65
|
+
<span class="content--after">
|
|
66
|
+
{@render after()}
|
|
67
|
+
</span>
|
|
68
|
+
{/if}
|
|
69
|
+
</div>
|
|
70
|
+
|
|
71
|
+
<style lang="scss">
|
|
72
|
+
:global(:root) {
|
|
73
|
+
--dodo-ui-InputEnclosure-border-color: var(--dodo-color-default-500);
|
|
74
|
+
--dodo-ui-InputEnclosure-focus-border-color: var(--dodo-color-primary-500);
|
|
75
|
+
--dodo-ui-InputEnclosure-error-border-color: var(--dodo-color-danger-500);
|
|
76
|
+
|
|
77
|
+
--dodo-ui-InputEnclosure-disabled-color: var(--dodo-color-default-400);
|
|
78
|
+
--dodo-ui-InputEnclosure-disabled-bg: var(--dodo-color-default-200);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
:global(.dodo-theme--dark) {
|
|
82
|
+
--dodo-ui-InputEnclosure-border-color: var(--dodo-color-default-600);
|
|
83
|
+
--dodo-ui-InputEnclosure-focus-border-color: var(--dodo-color-primary-600);
|
|
84
|
+
--dodo-ui-InputEnclosure-error-border-color: var(--dodo-color-danger-600);
|
|
85
|
+
|
|
86
|
+
--dodo-ui-InputEnclosure-disabled-bg: var(--dodo-color-default-100);
|
|
87
|
+
--dodo-ui-InputEnclosure-disabled-color: var(--dodo-color-default-500);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.dodo-ui-InputEnclosure {
|
|
91
|
+
display: flex;
|
|
92
|
+
overflow: hidden;
|
|
93
|
+
color: var(--dodo-color-default-800);
|
|
94
|
+
transition: all 150ms;
|
|
95
|
+
border: 0;
|
|
96
|
+
|
|
97
|
+
&.outline {
|
|
98
|
+
border-style: solid;
|
|
99
|
+
border-width: var(--dodo-ui-element-border-width);
|
|
100
|
+
border-color: var(--dodo-ui-InputEnclosure-border-color);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
&.focused {
|
|
104
|
+
border-color: var(--dodo-ui-InputEnclosure-focus-border-color);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
&.error {
|
|
108
|
+
border-color: var(--dodo-ui-InputEnclosure-error-border-color);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
&.disabled {
|
|
112
|
+
cursor: initial;
|
|
113
|
+
background-color: var(--dodo-ui-InputEnclosure-disabled-bg);
|
|
114
|
+
color: var(--dodo-ui-InputEnclosure-disabled-color);
|
|
115
|
+
border-color: var(--dodo-ui-InputEnclosure-disabled-bg);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.content {
|
|
119
|
+
&--after,
|
|
120
|
+
&--before {
|
|
121
|
+
&:empty {
|
|
122
|
+
display: none;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
&--after,
|
|
127
|
+
&--before {
|
|
128
|
+
display: inline-flex;
|
|
129
|
+
height: 100%;
|
|
130
|
+
align-items: center;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
&.size {
|
|
135
|
+
&--normal {
|
|
136
|
+
height: var(--dodo-ui-element-height-normal);
|
|
137
|
+
|
|
138
|
+
.content {
|
|
139
|
+
&--before {
|
|
140
|
+
margin-left: 12px;
|
|
141
|
+
margin-right: -4px;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
&--after {
|
|
145
|
+
margin-right: 12px;
|
|
146
|
+
margin-left: -4px;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
&--small {
|
|
152
|
+
height: var(--dodo-ui-element-height-small);
|
|
153
|
+
|
|
154
|
+
.content {
|
|
155
|
+
&--before {
|
|
156
|
+
margin-left: 8px;
|
|
157
|
+
margin-right: -2px;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
&--after {
|
|
161
|
+
margin-right: 8px;
|
|
162
|
+
margin-left: -2px;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
&--large {
|
|
168
|
+
height: var(--dodo-ui-element-height-large);
|
|
169
|
+
|
|
170
|
+
.content {
|
|
171
|
+
&--before {
|
|
172
|
+
margin-left: 14px;
|
|
173
|
+
margin-right: -4px;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
&--after {
|
|
177
|
+
margin-right: 14px;
|
|
178
|
+
margin-left: -4px;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
&.roundness {
|
|
185
|
+
&--1x {
|
|
186
|
+
border-radius: var(--dodo-ui-element-roundness-1x);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
&--2x {
|
|
190
|
+
border-radius: var(--dodo-ui-element-roundness-2x);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
&--3x {
|
|
194
|
+
border-radius: var(--dodo-ui-element-roundness-3x);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
</style>
|
package/src/lib/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,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' }} />
|