@flightlesslabs/dodo-ui 0.2.0 → 0.4.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 (93) hide show
  1. package/dist/index.d.ts +15 -0
  2. package/dist/index.js +12 -0
  3. package/dist/stories/Home.mdx +1 -1
  4. package/dist/stories/components/Form/Button/Button.stories.svelte +10 -5
  5. package/dist/stories/components/Form/Button/Button.svelte +216 -208
  6. package/dist/stories/components/Form/Button/Button.svelte.d.ts +8 -3
  7. package/dist/stories/components/Form/Button/Events/Events.stories.svelte +40 -0
  8. package/dist/stories/components/Form/Button/Events/Events.stories.svelte.d.ts +18 -0
  9. package/dist/stories/components/Form/Button/utils/scss/mixins.scss +21 -21
  10. package/dist/stories/components/Form/FormControl/FormControl.stories.svelte +27 -0
  11. package/dist/stories/components/Form/FormControl/FormControl.stories.svelte.d.ts +19 -0
  12. package/dist/stories/components/Form/FormControl/FormControl.svelte +34 -0
  13. package/dist/stories/components/Form/FormControl/FormControl.svelte.d.ts +20 -0
  14. package/dist/stories/components/Form/Label/Label.stories.svelte +21 -0
  15. package/dist/stories/components/Form/Label/Label.stories.svelte.d.ts +19 -0
  16. package/dist/stories/components/Form/Label/Label.svelte +19 -0
  17. package/dist/stories/components/Form/Label/Label.svelte.d.ts +18 -0
  18. package/dist/stories/components/Form/Message/Message.stories.svelte +46 -0
  19. package/dist/stories/components/Form/Message/Message.stories.svelte.d.ts +19 -0
  20. package/dist/stories/components/Form/Message/Message.svelte +39 -0
  21. package/dist/stories/components/Form/Message/Message.svelte.d.ts +17 -0
  22. package/dist/stories/components/Form/PasswordInput/Events/Events.stories.svelte +168 -0
  23. package/dist/stories/components/Form/PasswordInput/Events/Events.stories.svelte.d.ts +18 -0
  24. package/dist/stories/components/Form/PasswordInput/PasswordInput.stories.svelte +53 -0
  25. package/dist/stories/components/Form/PasswordInput/PasswordInput.stories.svelte.d.ts +21 -0
  26. package/dist/stories/components/Form/PasswordInput/PasswordInput.svelte +196 -0
  27. package/dist/stories/components/Form/PasswordInput/PasswordInput.svelte.d.ts +63 -0
  28. package/dist/stories/components/Form/PasswordInput/Roundness/Roundness.stories.svelte +20 -0
  29. package/dist/stories/components/Form/{ExampleButton/ExampleButton.stories.svelte.d.ts → PasswordInput/Roundness/Roundness.stories.svelte.d.ts} +3 -4
  30. package/dist/stories/components/Form/PasswordInput/Size/Size.stories.svelte +16 -0
  31. package/dist/stories/components/Form/PasswordInput/Size/Size.stories.svelte.d.ts +26 -0
  32. package/dist/stories/components/Form/PasswordInput/WithIcon/WithIcon.stories.svelte +31 -0
  33. package/dist/stories/components/Form/PasswordInput/WithIcon/WithIcon.stories.svelte.d.ts +26 -0
  34. package/dist/stories/components/Form/TextInput/Events/Events.stories.svelte +148 -0
  35. package/dist/stories/components/Form/TextInput/Events/Events.stories.svelte.d.ts +18 -0
  36. package/dist/stories/components/Form/TextInput/Roundness/Roundness.stories.svelte +21 -0
  37. package/dist/stories/components/Form/TextInput/Roundness/Roundness.stories.svelte.d.ts +26 -0
  38. package/dist/stories/components/Form/TextInput/Size/Size.stories.svelte +17 -0
  39. package/dist/stories/components/Form/TextInput/Size/Size.stories.svelte.d.ts +26 -0
  40. package/dist/stories/components/Form/TextInput/TextInput.stories.svelte +37 -0
  41. package/dist/stories/components/Form/TextInput/TextInput.stories.svelte.d.ts +21 -0
  42. package/dist/stories/components/Form/TextInput/TextInput.svelte +168 -0
  43. package/dist/stories/components/Form/TextInput/TextInput.svelte.d.ts +60 -0
  44. package/dist/stories/components/Form/TextInput/WithIcon/WithIcon.stories.svelte +47 -0
  45. package/dist/stories/components/Form/TextInput/WithIcon/WithIcon.stories.svelte.d.ts +26 -0
  46. package/dist/stories/developer tools/Intro.mdx +7 -0
  47. package/dist/stories/developer tools/components/UtilityButton/Size/Size.stories.svelte +27 -0
  48. package/dist/stories/developer tools/components/UtilityButton/Size/Size.stories.svelte.d.ts +26 -0
  49. package/dist/stories/developer tools/components/UtilityButton/UtilityButton.stories.svelte +29 -0
  50. package/dist/stories/developer tools/components/UtilityButton/UtilityButton.stories.svelte.d.ts +21 -0
  51. package/dist/stories/developer tools/components/UtilityButton/UtilityButton.svelte +79 -0
  52. package/dist/stories/developer tools/components/UtilityButton/UtilityButton.svelte.d.ts +26 -0
  53. package/dist/styles/_components.css +8 -7
  54. package/dist/styles/_minimal-reset.css +3 -0
  55. package/dist/styles/global.css +1 -0
  56. package/package.json +30 -30
  57. package/src/lib/index.ts +26 -0
  58. package/src/lib/stories/components/Form/Button/Button.stories.svelte +10 -5
  59. package/src/lib/stories/components/Form/Button/Button.svelte +40 -24
  60. package/src/lib/stories/components/Form/Button/Events/Events.stories.svelte +42 -0
  61. package/src/lib/stories/components/Form/Button/utils/scss/mixins.scss +21 -21
  62. package/src/lib/stories/components/Form/FormControl/FormControl.stories.svelte +29 -0
  63. package/src/lib/stories/components/Form/FormControl/FormControl.svelte +67 -0
  64. package/src/lib/stories/components/Form/Label/Label.stories.svelte +23 -0
  65. package/src/lib/stories/components/Form/Label/Label.svelte +45 -0
  66. package/src/lib/stories/components/Form/Message/Message.stories.svelte +48 -0
  67. package/src/lib/stories/components/Form/Message/Message.svelte +71 -0
  68. package/src/lib/stories/components/Form/PasswordInput/Events/Events.stories.svelte +174 -0
  69. package/src/lib/stories/components/Form/PasswordInput/PasswordInput.stories.svelte +57 -0
  70. package/src/lib/stories/components/Form/PasswordInput/PasswordInput.svelte +338 -0
  71. package/src/lib/stories/components/Form/PasswordInput/Roundness/Roundness.stories.svelte +20 -0
  72. package/src/lib/stories/components/Form/PasswordInput/Size/Size.stories.svelte +16 -0
  73. package/src/lib/stories/components/Form/PasswordInput/WithIcon/WithIcon.stories.svelte +31 -0
  74. package/src/lib/stories/components/Form/TextInput/Events/Events.stories.svelte +153 -0
  75. package/src/lib/stories/components/Form/TextInput/Roundness/Roundness.stories.svelte +21 -0
  76. package/src/lib/stories/components/Form/TextInput/Size/Size.stories.svelte +17 -0
  77. package/src/lib/stories/components/Form/TextInput/TextInput.stories.svelte +41 -0
  78. package/src/lib/stories/components/Form/TextInput/TextInput.svelte +301 -0
  79. package/src/lib/stories/components/Form/TextInput/WithIcon/WithIcon.stories.svelte +47 -0
  80. package/src/lib/stories/developer tools/Intro.mdx +7 -0
  81. package/src/lib/stories/developer tools/components/UtilityButton/Size/Size.stories.svelte +27 -0
  82. package/src/lib/stories/developer tools/components/UtilityButton/UtilityButton.stories.svelte +33 -0
  83. package/src/lib/stories/developer tools/components/UtilityButton/UtilityButton.svelte +128 -0
  84. package/src/lib/styles/_components.css +8 -7
  85. package/src/lib/styles/_minimal-reset.css +3 -0
  86. package/src/lib/styles/global.css +1 -0
  87. package/dist/stories/components/Form/ExampleButton/ExampleButton.stories.svelte +0 -30
  88. package/dist/stories/components/Form/ExampleButton/ExampleButton.svelte +0 -14
  89. package/dist/stories/components/Form/ExampleButton/ExampleButton.svelte.d.ts +0 -16
  90. package/dist/stories/components/Form/ExampleButton/button.css +0 -30
  91. package/src/lib/stories/components/Form/ExampleButton/ExampleButton.stories.svelte +0 -30
  92. package/src/lib/stories/components/Form/ExampleButton/ExampleButton.svelte +0 -29
  93. package/src/lib/stories/components/Form/ExampleButton/button.css +0 -30
@@ -0,0 +1,53 @@
1
+ <script module lang="ts">import { defineMeta } from '@storybook/addon-svelte-csf';
2
+ import PasswordInput from './PasswordInput.svelte';
3
+ import Icon from '@iconify/svelte';
4
+ export const storyPasswordInputArgTypes = {
5
+ roundness: {
6
+ control: { type: 'select' },
7
+ options: [false, '1x', '2x', '3x'],
8
+ },
9
+ size: {
10
+ control: { type: 'select' },
11
+ options: ['normal', 'small', 'large'],
12
+ },
13
+ };
14
+ // More on how to set up stories at: https://storybook.js.org/docs/writing-stories
15
+ const { Story } = defineMeta({
16
+ component: PasswordInput,
17
+ tags: ['autodocs'],
18
+ argTypes: storyPasswordInputArgTypes,
19
+ args: { value: 'Hello world!' },
20
+ });
21
+ </script>
22
+
23
+ <!-- PasswordInput with default style -->
24
+ <Story name="Default" />
25
+
26
+ <Story name="Placeholder" args={{ value: '', placeholder: 'Type something...' }} />
27
+
28
+ <Story name="No Outline" args={{ outline: false }} />
29
+
30
+ <Story name="Error" args={{ error: true }} />
31
+
32
+ <Story name="Disabled" args={{ disabled: true }} />
33
+
34
+ <!-- Disable password toggle -->
35
+ <Story name="No toggle" args={{ passwordToggle: false }} />
36
+
37
+ <!-- Show Password by default -->
38
+ <Story name="Show Password" args={{ passwordToggleState: true }} />
39
+
40
+ <Story name="Read only" args={{ readonly: true }} />
41
+
42
+ <!-- Show Password by default -->
43
+ <Story name="Custom toggle icon">
44
+ <PasswordInput value="Hello world!">
45
+ {#snippet customPasswordToggleIcon(toggle)}
46
+ {#if toggle}
47
+ <Icon icon="mingcute:eye-close-line" width="24" height="24" />
48
+ {:else}
49
+ <Icon icon="mingcute:eye-2-line" width="24" height="24" />
50
+ {/if}
51
+ {/snippet}
52
+ </PasswordInput>
53
+ </Story>
@@ -0,0 +1,21 @@
1
+ import PasswordInput from './PasswordInput.svelte';
2
+ import type { StoryBookArgTypes } from '../../../../storybook-types.js';
3
+ export declare const storyPasswordInputArgTypes: 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 PasswordInput: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
18
+ [evt: string]: CustomEvent<any>;
19
+ }, {}, {}, string>;
20
+ type PasswordInput = InstanceType<typeof PasswordInput>;
21
+ export default PasswordInput;
@@ -0,0 +1,196 @@
1
+ <script lang="ts" module>export {};
2
+ </script>
3
+
4
+ <script lang="ts">import Icon from '@iconify/svelte';
5
+ import UtilityButton from '../../../developer tools/components/UtilityButton/UtilityButton.svelte';
6
+ let { size = 'normal', roundness = '1x', outline = true, name, id, class: className = '', disabled = false, oninput, onchange, onblur, onfocus, onpaste, oncopy, oncut, before, after, customPasswordToggleIcon, error = false, passwordToggle = true, passwordToggleState = $bindable(), value = $bindable(), placeholder, ontoggle, ref = $bindable(), readonly = false, } = $props();
7
+ let focused = $state(false);
8
+ let toggle = $state(passwordToggleState);
9
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
10
+ let customPasswordToggleIconTyped = customPasswordToggleIcon;
11
+ function onfocusMod(e) {
12
+ focused = true;
13
+ if (onfocus) {
14
+ onfocus(e);
15
+ }
16
+ }
17
+ function onblurMod(e) {
18
+ focused = false;
19
+ if (onblur) {
20
+ onblur(e);
21
+ }
22
+ }
23
+ function ontoggleMod(e) {
24
+ toggle = !toggle;
25
+ const customEvent = {
26
+ event: e,
27
+ toggle,
28
+ };
29
+ if (ontoggle) {
30
+ ontoggle(customEvent);
31
+ }
32
+ }
33
+ </script>
34
+
35
+ <div
36
+ class:outline
37
+ class:disabled
38
+ class:error
39
+ class:focused
40
+ class:toggle
41
+ class={['dodo-ui-PasswordInput', `size--${size}`, `roundness--${roundness}`, className].join(' ')}
42
+ >
43
+ {#if before}
44
+ <span class="content--before">
45
+ {@render before()}
46
+ </span>
47
+ {/if}
48
+ <input
49
+ type={passwordToggle && toggle ? 'text' : 'password'}
50
+ {name}
51
+ {id}
52
+ {disabled}
53
+ {oninput}
54
+ {onchange}
55
+ onfocus={onfocusMod}
56
+ onblur={onblurMod}
57
+ {onpaste}
58
+ {oncopy}
59
+ {oncut}
60
+ {placeholder}
61
+ bind:value
62
+ bind:this={ref}
63
+ {readonly}
64
+ />
65
+
66
+ {#if passwordToggle && !disabled}
67
+ <UtilityButton {size} title="Toggle password" class="passwordToggle" onclick={ontoggleMod}>
68
+ {#if customPasswordToggleIcon}
69
+ {@render customPasswordToggleIconTyped(toggle)}
70
+ {:else if toggle}
71
+ <Icon icon="mdi:eye-off" width="24" height="24" />
72
+ {:else}
73
+ <Icon icon="mdi:eye" width="24" height="24" />
74
+ {/if}
75
+ </UtilityButton>
76
+ {/if}
77
+
78
+ {#if after}
79
+ <span class="content--after">
80
+ {@render after()}
81
+ </span>
82
+ {/if}
83
+ </div>
84
+
85
+ <style>:global(:root) {
86
+ --dodo-ui-PasswordInput-border-color: var(--dodo-color-default-500);
87
+ --dodo-ui-PasswordInput-focus-border-color: var(--dodo-color-primary-500);
88
+ --dodo-ui-PasswordInput-error-border-color: var(--dodo-color-danger-500);
89
+ --dodo-ui-PasswordInput-disabled-color: var(--dodo-color-default-400);
90
+ --dodo-ui-PasswordInput-disabled-bg: var(--dodo-color-default-200);
91
+ }
92
+
93
+ :global(.dodo-theme--dark) {
94
+ --dodo-ui-PasswordInput-border-color: var(--dodo-color-default-600);
95
+ --dodo-ui-PasswordInput-focus-border-color: var(--dodo-color-primary-600);
96
+ --dodo-ui-PasswordInput-error-border-color: var(--dodo-color-danger-600);
97
+ --dodo-ui-PasswordInput-disabled-bg: var(--dodo-color-default-100);
98
+ --dodo-ui-PasswordInput-disabled-color: var(--dodo-color-default-500);
99
+ }
100
+
101
+ .dodo-ui-PasswordInput {
102
+ display: flex;
103
+ overflow: hidden;
104
+ color: var(--dodo-color-default-800);
105
+ transition: all 150ms;
106
+ border: 0;
107
+ }
108
+ .dodo-ui-PasswordInput input {
109
+ flex: 1;
110
+ border: 0;
111
+ outline: 0;
112
+ height: 100%;
113
+ background-color: transparent;
114
+ font-family: inherit;
115
+ color: inherit;
116
+ letter-spacing: 0.3px;
117
+ }
118
+ .dodo-ui-PasswordInput.outline {
119
+ border-style: solid;
120
+ border-width: var(--dodo-ui-element-border-width);
121
+ border-color: var(--dodo-ui-PasswordInput-border-color);
122
+ }
123
+ .dodo-ui-PasswordInput.focused {
124
+ border-color: var(--dodo-ui-PasswordInput-focus-border-color);
125
+ }
126
+ .dodo-ui-PasswordInput.error {
127
+ border-color: var(--dodo-ui-PasswordInput-error-border-color);
128
+ }
129
+ .dodo-ui-PasswordInput.disabled {
130
+ cursor: initial;
131
+ background-color: var(--dodo-ui-PasswordInput-disabled-bg);
132
+ color: var(--dodo-ui-PasswordInput-disabled-color);
133
+ border-color: var(--dodo-ui-PasswordInput-disabled-bg);
134
+ }
135
+ .dodo-ui-PasswordInput .content--after:empty, .dodo-ui-PasswordInput .content--before:empty {
136
+ display: none;
137
+ }
138
+ .dodo-ui-PasswordInput .content--after, .dodo-ui-PasswordInput .content--before {
139
+ display: inline-flex;
140
+ height: 100%;
141
+ align-items: center;
142
+ }
143
+ .dodo-ui-PasswordInput.size--normal {
144
+ height: var(--dodo-ui-element-height-normal);
145
+ }
146
+ .dodo-ui-PasswordInput.size--normal input {
147
+ font-size: 1rem;
148
+ padding: 0 12px;
149
+ }
150
+ .dodo-ui-PasswordInput.size--normal .content--before {
151
+ margin-left: 12px;
152
+ margin-right: -4px;
153
+ }
154
+ .dodo-ui-PasswordInput.size--normal .content--after {
155
+ margin-right: 12px;
156
+ margin-left: -4px;
157
+ }
158
+ .dodo-ui-PasswordInput.size--small {
159
+ height: var(--dodo-ui-element-height-small);
160
+ }
161
+ .dodo-ui-PasswordInput.size--small input {
162
+ padding: 0 8px;
163
+ font-size: 0.9rem;
164
+ }
165
+ .dodo-ui-PasswordInput.size--small .content--before {
166
+ margin-left: 8px;
167
+ margin-right: -2px;
168
+ }
169
+ .dodo-ui-PasswordInput.size--small .content--after {
170
+ margin-right: 8px;
171
+ margin-left: -2px;
172
+ }
173
+ .dodo-ui-PasswordInput.size--large {
174
+ height: var(--dodo-ui-element-height-large);
175
+ }
176
+ .dodo-ui-PasswordInput.size--large input {
177
+ font-size: 1.1rem;
178
+ padding: 0 14px;
179
+ }
180
+ .dodo-ui-PasswordInput.size--large .content--before {
181
+ margin-left: 14px;
182
+ margin-right: -4px;
183
+ }
184
+ .dodo-ui-PasswordInput.size--large .content--after {
185
+ margin-right: 14px;
186
+ margin-left: -4px;
187
+ }
188
+ .dodo-ui-PasswordInput.roundness--1x {
189
+ border-radius: var(--dodo-ui-element-roundness-1x);
190
+ }
191
+ .dodo-ui-PasswordInput.roundness--2x {
192
+ border-radius: var(--dodo-ui-element-roundness-2x);
193
+ }
194
+ .dodo-ui-PasswordInput.roundness--3x {
195
+ border-radius: var(--dodo-ui-element-roundness-3x);
196
+ }</style>
@@ -0,0 +1,63 @@
1
+ export type PasswordInputToggleEvent = {
2
+ event: Event;
3
+ toggle: boolean;
4
+ };
5
+ import type { ComponentSize } from '../../../../types.js';
6
+ import type { Snippet } from 'svelte';
7
+ import type { ChangeEventHandler, ClipboardEventHandler, FocusEventHandler, FormEventHandler } from 'svelte/elements';
8
+ import type { TextInputRoundness } from '../TextInput/TextInput.svelte';
9
+ interface PasswordInputProps {
10
+ /** How large should the button be? */
11
+ size?: ComponentSize;
12
+ /** Input ref */
13
+ ref?: HTMLInputElement;
14
+ /** Toggle Password */
15
+ passwordToggle?: boolean;
16
+ /** Default Password Toggle State */
17
+ passwordToggleState?: boolean;
18
+ /** Toggle Password Icon */
19
+ customPasswordToggleIcon?: (toggle: boolean) => Snippet;
20
+ /** How round should the border radius be? */
21
+ roundness?: TextInputRoundness;
22
+ /** Add a border around the button. Default True */
23
+ outline?: boolean;
24
+ /** Input value */
25
+ value?: string;
26
+ /** How round should the border radius be? */
27
+ placeholder?: string;
28
+ /** disabled state */
29
+ disabled?: boolean;
30
+ /** Read only ? */
31
+ readonly?: boolean;
32
+ /** is there any associated Error ? */
33
+ error?: boolean;
34
+ /** Name */
35
+ name?: string;
36
+ /** Id */
37
+ id?: string;
38
+ /** Icon before button content */
39
+ before?: Snippet;
40
+ /** Icon after button content */
41
+ after?: Snippet;
42
+ /** Custom css class*/
43
+ class?: string;
44
+ /** oninput event handler */
45
+ oninput?: FormEventHandler<HTMLInputElement>;
46
+ /** onchange event handler */
47
+ onchange?: ChangeEventHandler<HTMLInputElement>;
48
+ /** onblur event handler */
49
+ onblur?: FocusEventHandler<HTMLInputElement>;
50
+ /** onfocus event handler */
51
+ onfocus?: FocusEventHandler<HTMLInputElement>;
52
+ /** onpaste event handler */
53
+ onpaste?: ClipboardEventHandler<HTMLInputElement>;
54
+ /** oncopy event handler */
55
+ oncopy?: ClipboardEventHandler<HTMLInputElement>;
56
+ /** oncut event handler */
57
+ oncut?: ClipboardEventHandler<HTMLInputElement>;
58
+ /** ontoggle event handler */
59
+ ontoggle?: (e: PasswordInputToggleEvent) => void;
60
+ }
61
+ declare const PasswordInput: import("svelte").Component<PasswordInputProps, {}, "ref" | "value" | "passwordToggleState">;
62
+ type PasswordInput = ReturnType<typeof PasswordInput>;
63
+ export default PasswordInput;
@@ -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 }} />