@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.
Files changed (90) hide show
  1. package/dist/index.d.ts +6 -0
  2. package/dist/index.js +4 -0
  3. package/dist/stories/Home.mdx +57 -7
  4. package/dist/stories/assets/dark-theme-toggle.png +0 -0
  5. package/dist/stories/components/Form/Button/Button.stories.svelte +10 -5
  6. package/dist/stories/components/Form/Button/Button.svelte +213 -211
  7. package/dist/stories/components/Form/Button/Button.svelte.d.ts +4 -1
  8. package/dist/stories/components/Form/Button/Events/Events.stories.svelte +40 -0
  9. package/dist/stories/components/Form/Button/Events/Events.stories.svelte.d.ts +18 -0
  10. package/dist/stories/components/Form/Button/Roundness/Roundness.stories.svelte +14 -11
  11. package/dist/stories/components/Form/Button/utils/scss/mixins.scss +21 -21
  12. package/dist/stories/components/Form/PasswordInput/Events/Events.stories.svelte +168 -0
  13. package/dist/stories/components/Form/PasswordInput/Events/Events.stories.svelte.d.ts +18 -0
  14. package/dist/stories/components/Form/PasswordInput/PasswordInput.stories.svelte +37 -0
  15. package/dist/stories/components/Form/PasswordInput/PasswordInput.stories.svelte.d.ts +21 -0
  16. package/dist/stories/components/Form/PasswordInput/PasswordInput.svelte +219 -0
  17. package/dist/stories/components/Form/PasswordInput/PasswordInput.svelte.d.ts +59 -0
  18. package/dist/stories/components/Form/PasswordInput/Roundness/Roundness.stories.svelte +20 -0
  19. package/dist/stories/components/Form/{ExampleButton/ExampleButton.stories.svelte.d.ts → PasswordInput/Roundness/Roundness.stories.svelte.d.ts} +3 -4
  20. package/dist/stories/components/Form/PasswordInput/Size/Size.stories.svelte +16 -0
  21. package/dist/stories/components/Form/PasswordInput/Size/Size.stories.svelte.d.ts +26 -0
  22. package/dist/stories/components/Form/PasswordInput/WithIcon/WithIcon.stories.svelte +31 -0
  23. package/dist/stories/components/Form/PasswordInput/WithIcon/WithIcon.stories.svelte.d.ts +26 -0
  24. package/dist/stories/components/Form/TextInput/Events/Events.stories.svelte +148 -0
  25. package/dist/stories/components/Form/TextInput/Events/Events.stories.svelte.d.ts +18 -0
  26. package/dist/stories/components/Form/TextInput/Roundness/Roundness.stories.svelte +21 -0
  27. package/dist/stories/components/Form/TextInput/Roundness/Roundness.stories.svelte.d.ts +26 -0
  28. package/dist/stories/components/Form/TextInput/Size/Size.stories.svelte +17 -0
  29. package/dist/stories/components/Form/TextInput/Size/Size.stories.svelte.d.ts +26 -0
  30. package/dist/stories/components/Form/TextInput/TextInput.stories.svelte +35 -0
  31. package/dist/stories/components/Form/TextInput/TextInput.stories.svelte.d.ts +21 -0
  32. package/dist/stories/components/Form/TextInput/TextInput.svelte +166 -0
  33. package/dist/stories/components/Form/TextInput/TextInput.svelte.d.ts +56 -0
  34. package/dist/stories/components/Form/TextInput/WithIcon/WithIcon.stories.svelte +47 -0
  35. package/dist/stories/components/Form/TextInput/WithIcon/WithIcon.stories.svelte.d.ts +26 -0
  36. package/dist/stories/philosophy/Colors/Colors.mdx +43 -0
  37. package/dist/stories/philosophy/Colors/Colors.stories.svelte +20 -0
  38. package/dist/stories/philosophy/Colors/Colors.stories.svelte.d.ts +19 -0
  39. package/dist/stories/philosophy/Colors/Colors.svelte +33 -0
  40. package/dist/stories/philosophy/Colors/Colors.svelte.d.ts +6 -0
  41. package/dist/stories/philosophy/Colors/Opacity.stories.svelte +9 -0
  42. package/dist/stories/philosophy/Colors/Opacity.stories.svelte.d.ts +19 -0
  43. package/dist/stories/philosophy/Colors/Opacity.svelte +20 -0
  44. package/dist/stories/philosophy/Colors/Opacity.svelte.d.ts +18 -0
  45. package/dist/stories/philosophy/Colors/Swatches/Palette.svelte +15 -0
  46. package/dist/stories/philosophy/Colors/Swatches/Palette.svelte.d.ts +6 -0
  47. package/dist/stories/philosophy/Colors/Swatches/Swatch.svelte +18 -0
  48. package/dist/stories/philosophy/Colors/Swatches/Swatch.svelte.d.ts +8 -0
  49. package/dist/stories/philosophy/Colors/Swatches/Swatches.svelte +39 -0
  50. package/dist/stories/philosophy/Colors/Swatches/Swatches.svelte.d.ts +8 -0
  51. package/dist/stories/philosophy/Colors/utils/color.d.ts +4 -0
  52. package/dist/stories/philosophy/Colors/utils/color.js +38 -0
  53. package/dist/stories/philosophy/Themes.mdx +23 -0
  54. package/dist/styles/_colors.css +2 -2
  55. package/dist/styles/_components.css +7 -6
  56. package/dist/styles/_minimal-reset.css +3 -0
  57. package/dist/styles/global.css +1 -0
  58. package/dist/types.d.ts +1 -1
  59. package/package.json +3 -2
  60. package/src/lib/index.ts +13 -0
  61. package/src/lib/stories/components/Form/Button/Button.stories.svelte +10 -5
  62. package/src/lib/stories/components/Form/Button/Button.svelte +36 -30
  63. package/src/lib/stories/components/Form/Button/Events/Events.stories.svelte +42 -0
  64. package/src/lib/stories/components/Form/Button/Roundness/Roundness.stories.svelte +14 -11
  65. package/src/lib/stories/components/Form/Button/utils/scss/mixins.scss +21 -21
  66. package/src/lib/stories/components/Form/PasswordInput/Events/Events.stories.svelte +174 -0
  67. package/src/lib/stories/components/Form/PasswordInput/PasswordInput.stories.svelte +41 -0
  68. package/src/lib/stories/components/Form/PasswordInput/PasswordInput.svelte +361 -0
  69. package/src/lib/stories/components/Form/PasswordInput/Roundness/Roundness.stories.svelte +20 -0
  70. package/src/lib/stories/components/Form/PasswordInput/Size/Size.stories.svelte +16 -0
  71. package/src/lib/stories/components/Form/PasswordInput/WithIcon/WithIcon.stories.svelte +31 -0
  72. package/src/lib/stories/components/Form/TextInput/Events/Events.stories.svelte +153 -0
  73. package/src/lib/stories/components/Form/TextInput/Roundness/Roundness.stories.svelte +21 -0
  74. package/src/lib/stories/components/Form/TextInput/Size/Size.stories.svelte +17 -0
  75. package/src/lib/stories/components/Form/TextInput/TextInput.stories.svelte +39 -0
  76. package/src/lib/stories/components/Form/TextInput/TextInput.svelte +293 -0
  77. package/src/lib/stories/components/Form/TextInput/WithIcon/WithIcon.stories.svelte +47 -0
  78. package/src/lib/styles/_colors.css +2 -2
  79. package/src/lib/styles/_components.css +7 -6
  80. package/src/lib/styles/_minimal-reset.css +3 -0
  81. package/src/lib/styles/global.css +1 -0
  82. package/src/lib/types.ts +1 -1
  83. package/dist/stories/Getting Started.mdx +0 -13
  84. package/dist/stories/components/Form/ExampleButton/ExampleButton.stories.svelte +0 -30
  85. package/dist/stories/components/Form/ExampleButton/ExampleButton.svelte +0 -14
  86. package/dist/stories/components/Form/ExampleButton/ExampleButton.svelte.d.ts +0 -16
  87. package/dist/stories/components/Form/ExampleButton/button.css +0 -30
  88. package/src/lib/stories/components/Form/ExampleButton/ExampleButton.stories.svelte +0 -30
  89. package/src/lib/stories/components/Form/ExampleButton/ExampleButton.svelte +0 -29
  90. package/src/lib/stories/components/Form/ExampleButton/button.css +0 -30
@@ -0,0 +1,20 @@
1
+ <script module>
2
+ import { defineMeta } from '@storybook/addon-svelte-csf';
3
+ import PasswordInput from '../PasswordInput.svelte';
4
+ import { storyPasswordInputArgTypes } from '../PasswordInput.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: PasswordInput,
9
+ tags: ['autodocs'],
10
+ argTypes: storyPasswordInputArgTypes,
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 }} />
@@ -1,17 +1,16 @@
1
- export default ExampleButton;
2
- type ExampleButton = SvelteComponent<{
1
+ export default Roundness;
2
+ type Roundness = SvelteComponent<{
3
3
  [x: string]: never;
4
4
  }, {
5
5
  [evt: string]: CustomEvent<any>;
6
6
  }, {}> & {
7
7
  $$bindings?: string | undefined;
8
8
  };
9
- declare const ExampleButton: $$__sveltets_2_IsomorphicComponent<{
9
+ declare const Roundness: $$__sveltets_2_IsomorphicComponent<{
10
10
  [x: string]: never;
11
11
  }, {
12
12
  [evt: string]: CustomEvent<any>;
13
13
  }, {}, {}, string>;
14
- import ExampleButton from './ExampleButton.svelte';
15
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> {
16
15
  new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
17
16
  $$bindings?: Bindings;
@@ -0,0 +1,16 @@
1
+ <script module>
2
+ import { defineMeta } from '@storybook/addon-svelte-csf';
3
+ import PasswordInput from '../PasswordInput.svelte';
4
+ import { storyPasswordInputArgTypes } from '../PasswordInput.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: PasswordInput,
9
+ tags: ['autodocs'],
10
+ argTypes: storyPasswordInputArgTypes,
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
+ }
@@ -0,0 +1,31 @@
1
+ <script module>
2
+ import { defineMeta } from '@storybook/addon-svelte-csf';
3
+ import PasswordInput from '../PasswordInput.svelte';
4
+ import { storyPasswordInputArgTypes } from '../PasswordInput.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: PasswordInput,
10
+ tags: ['autodocs'],
11
+ argTypes: storyPasswordInputArgTypes,
12
+ });
13
+ </script>
14
+
15
+ <!-- PasswordInput icon in front. -->
16
+ <Story name="Icon Before">
17
+ <PasswordInput>
18
+ {#snippet before()}
19
+ <Icon icon="material-symbols:content-copy" />
20
+ {/snippet}
21
+ </PasswordInput>
22
+ </Story>
23
+
24
+ <!-- PasswordInput icon in front. -->
25
+ <Story name="Icon After">
26
+ <PasswordInput>
27
+ {#snippet after()}
28
+ <Icon icon="material-symbols:download-2" />
29
+ {/snippet}
30
+ </PasswordInput>
31
+ </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
+ }
@@ -0,0 +1,148 @@
1
+ <script module lang="ts">import { defineMeta } from '@storybook/addon-svelte-csf';
2
+ import TextInput, {} from '../TextInput.svelte';
3
+ import { storyTextInputArgTypes } from '../TextInput.stories.svelte';
4
+ // More on how to set up stories at: https://storybook.js.org/docs/writing-stories
5
+ const { Story } = defineMeta({
6
+ component: TextInput,
7
+ tags: ['autodocs'],
8
+ argTypes: storyTextInputArgTypes,
9
+ });
10
+ </script>
11
+
12
+ <Story
13
+ name="Input"
14
+ args={{
15
+ oninput: (e: Event) => {
16
+ const target = e.target as HTMLInputElement;
17
+
18
+ console.log('Input Event', target.value);
19
+ },
20
+ }}
21
+ >
22
+ <TextInput
23
+ oninput={(e: Event) => {
24
+ const target = e.target as HTMLInputElement;
25
+
26
+ console.log('Input Event', target.value);
27
+ }}
28
+ />
29
+ </Story>
30
+
31
+ <Story
32
+ name="Change"
33
+ args={{
34
+ onchange: (e: Event) => {
35
+ const target = e.target as HTMLInputElement;
36
+
37
+ console.log('onChange Event', target.value);
38
+ },
39
+ }}
40
+ >
41
+ <TextInput
42
+ onchange={(e: Event) => {
43
+ const target = e.target as HTMLInputElement;
44
+
45
+ console.log('onchange Event', target.value);
46
+ }}
47
+ />
48
+ </Story>
49
+
50
+ <!-- `e: TextInputFocusEvent` -->
51
+ <Story
52
+ name="Focus"
53
+ args={{
54
+ onfocus: (e: TextInputFocusEvent) => {
55
+ const target = e.target as HTMLInputElement;
56
+
57
+ console.log('onfocus Event', target);
58
+ },
59
+ }}
60
+ >
61
+ <TextInput
62
+ onfocus={(e: TextInputFocusEvent) => {
63
+ const target = e.target as HTMLInputElement;
64
+
65
+ console.log('onfocus Event', target);
66
+ }}
67
+ />
68
+ </Story>
69
+
70
+ <!-- `e: TextInputFocusEvent` -->
71
+ <Story
72
+ name="Blur"
73
+ args={{
74
+ onblur: (e: TextInputFocusEvent) => {
75
+ const target = e.target as HTMLInputElement;
76
+
77
+ console.log('onblur Event', target);
78
+ },
79
+ }}
80
+ >
81
+ <TextInput
82
+ onblur={(e: TextInputFocusEvent) => {
83
+ const target = e.target as HTMLInputElement;
84
+
85
+ console.log('onblur Event', target);
86
+ }}
87
+ />
88
+ </Story>
89
+
90
+ <!-- `e: TextInputClipboardEvent` -->
91
+ <Story
92
+ name="Copy"
93
+ args={{
94
+ oncopy: (e: TextInputClipboardEvent) => {
95
+ const target = e.target as HTMLInputElement;
96
+
97
+ console.log('oncopy Event', target);
98
+ },
99
+ }}
100
+ >
101
+ <TextInput
102
+ oncopy={(e: TextInputClipboardEvent) => {
103
+ const target = e.target as HTMLInputElement;
104
+
105
+ console.log('oncopy Event', target);
106
+ }}
107
+ />
108
+ </Story>
109
+
110
+ <!-- `e: TextInputClipboardEvent` -->
111
+ <Story
112
+ name="Cut"
113
+ args={{
114
+ oncut: (e: TextInputClipboardEvent) => {
115
+ const target = e.target as HTMLInputElement;
116
+
117
+ console.log('oncut Event', target);
118
+ },
119
+ }}
120
+ >
121
+ <TextInput
122
+ oncut={(e: TextInputClipboardEvent) => {
123
+ const target = e.target as HTMLInputElement;
124
+
125
+ console.log('oncut Event', target);
126
+ }}
127
+ />
128
+ </Story>
129
+
130
+ <!-- `e: TextInputClipboardEvent` -->
131
+ <Story
132
+ name="Paste"
133
+ args={{
134
+ onpaste: (e: TextInputClipboardEvent) => {
135
+ const target = e.target as HTMLInputElement;
136
+
137
+ console.log('onpaste Event', target);
138
+ },
139
+ }}
140
+ >
141
+ <TextInput
142
+ onpaste={(e: TextInputClipboardEvent) => {
143
+ const target = e.target as HTMLInputElement;
144
+
145
+ console.log('onpaste Event', target);
146
+ }}
147
+ />
148
+ </Story>
@@ -0,0 +1,18 @@
1
+ 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> {
2
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
+ $$bindings?: Bindings;
4
+ } & Exports;
5
+ (internal: unknown, props: {
6
+ $$events?: Events;
7
+ $$slots?: Slots;
8
+ }): Exports & {
9
+ $set?: any;
10
+ $on?: any;
11
+ };
12
+ z_$$bindings?: Bindings;
13
+ }
14
+ declare const Events: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
15
+ [evt: string]: CustomEvent<any>;
16
+ }, {}, {}, string>;
17
+ type Events = InstanceType<typeof Events>;
18
+ export default Events;
@@ -0,0 +1,21 @@
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
+
6
+ // More on how to set up stories at: https://storybook.js.org/docs/writing-stories
7
+ const { Story } = defineMeta({
8
+ component: TextInput,
9
+ tags: ['autodocs'],
10
+ argTypes: storyTextInputArgTypes,
11
+ args: { value: 'Hello world!' },
12
+ });
13
+ </script>
14
+
15
+ <Story name="Roundness 1x" />
16
+
17
+ <Story name="Roundness 2x" args={{ roundness: '2x' }} />
18
+
19
+ <Story name="Roundness 3x" args={{ roundness: '3x' }} />
20
+
21
+ <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,17 @@
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
+
6
+ // More on how to set up stories at: https://storybook.js.org/docs/writing-stories
7
+ const { Story } = defineMeta({
8
+ component: TextInput,
9
+ tags: ['autodocs'],
10
+ argTypes: storyTextInputArgTypes,
11
+ args: { value: 'Hello world!' },
12
+ });
13
+ </script>
14
+
15
+ <Story name="Normal" />
16
+ <Story name="Small" args={{ size: 'small' }} />
17
+ <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
+ }
@@ -0,0 +1,35 @@
1
+ <script module lang="ts">import { defineMeta } from '@storybook/addon-svelte-csf';
2
+ import TextInput from './TextInput.svelte';
3
+ export const storyTextInputArgTypes = {
4
+ type: {
5
+ control: { type: 'select' },
6
+ options: ['text', 'tel', 'email', 'password', 'url', 'number'],
7
+ },
8
+ roundness: {
9
+ control: { type: 'select' },
10
+ options: [false, '1x', '2x', '3x'],
11
+ },
12
+ size: {
13
+ control: { type: 'select' },
14
+ options: ['normal', 'small', 'large'],
15
+ },
16
+ };
17
+ // More on how to set up stories at: https://storybook.js.org/docs/writing-stories
18
+ const { Story } = defineMeta({
19
+ component: TextInput,
20
+ tags: ['autodocs'],
21
+ argTypes: storyTextInputArgTypes,
22
+ args: { value: 'Hello world!' },
23
+ });
24
+ </script>
25
+
26
+ <!-- TextInput with default style -->
27
+ <Story name="Default" />
28
+
29
+ <Story name="Placeholder" args={{ value: '', placeholder: 'Type something...' }} />
30
+
31
+ <Story name="No Outline" args={{ outline: false }} />
32
+
33
+ <Story name="Error" args={{ error: true }} />
34
+
35
+ <Story name="Disabled" args={{ disabled: true }} />
@@ -0,0 +1,21 @@
1
+ import TextInput from './TextInput.svelte';
2
+ import type { StoryBookArgTypes } from '../../../../storybook-types.js';
3
+ export declare const storyTextInputArgTypes: 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 TextInput: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
18
+ [evt: string]: CustomEvent<any>;
19
+ }, {}, {}, string>;
20
+ type TextInput = InstanceType<typeof TextInput>;
21
+ export default TextInput;
@@ -0,0 +1,166 @@
1
+ <script lang="ts" module>export {};
2
+ </script>
3
+
4
+ <script lang="ts">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, } = $props();
5
+ let focused = $state(false);
6
+ function onfocusMod(e) {
7
+ focused = true;
8
+ if (onfocus) {
9
+ onfocus(e);
10
+ }
11
+ }
12
+ function onblurMod(e) {
13
+ focused = false;
14
+ if (onblur) {
15
+ onblur(e);
16
+ }
17
+ }
18
+ export {};
19
+ </script>
20
+
21
+ <div
22
+ class:outline
23
+ class:disabled
24
+ class:error
25
+ class:focused
26
+ class={['dodo-ui-TextInput', `size--${size}`, `roundness--${roundness}`, className].join(' ')}
27
+ >
28
+ {#if before}
29
+ <span class="content--before">
30
+ {@render before()}
31
+ </span>
32
+ {/if}
33
+ <input
34
+ {type}
35
+ {name}
36
+ {id}
37
+ {disabled}
38
+ {oninput}
39
+ {onchange}
40
+ onfocus={onfocusMod}
41
+ onblur={onblurMod}
42
+ {onpaste}
43
+ {oncopy}
44
+ {oncut}
45
+ {placeholder}
46
+ bind:value
47
+ />
48
+ {#if after}
49
+ <span class="content--after">
50
+ {@render after()}
51
+ </span>
52
+ {/if}
53
+ </div>
54
+
55
+ <style>:global(:root) {
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 {
79
+ flex: 1;
80
+ border: 0;
81
+ outline: 0;
82
+ height: 100%;
83
+ background-color: transparent;
84
+ font-family: inherit;
85
+ color: inherit;
86
+ letter-spacing: 0.3px;
87
+ }
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
+ .dodo-ui-TextInput.size--normal input {
117
+ font-size: 1rem;
118
+ padding: 0 12px;
119
+ }
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
+ .dodo-ui-TextInput.size--small input {
132
+ padding: 0 8px;
133
+ font-size: 0.9rem;
134
+ }
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
+ .dodo-ui-TextInput.size--large input {
147
+ font-size: 1.1rem;
148
+ 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
+ }</style>