@flightlesslabs/dodo-ui 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/index.d.ts +6 -1
  2. package/dist/index.js +4 -0
  3. package/dist/stories/components/Form/FormControl/FormControl.svelte +1 -1
  4. package/dist/stories/components/Form/Message/Color/Color.stories.svelte +36 -0
  5. package/dist/stories/components/Form/Message/Color/Color.stories.svelte.d.ts +26 -0
  6. package/dist/stories/components/Form/Message/Message.stories.svelte +11 -26
  7. package/dist/stories/components/Form/Message/Message.stories.svelte.d.ts +2 -0
  8. package/dist/stories/components/Form/Message/Message.svelte +14 -3
  9. package/dist/stories/components/Form/Message/Message.svelte.d.ts +3 -0
  10. package/dist/stories/components/Form/Message/Size/Size.stories.svelte +24 -0
  11. package/dist/stories/components/Form/Message/Size/Size.stories.svelte.d.ts +26 -0
  12. package/dist/stories/components/Form/PasswordInput/PasswordInput.svelte +32 -130
  13. package/dist/stories/components/Form/PasswordInput/PasswordInput.svelte.d.ts +2 -3
  14. package/dist/stories/components/Form/SimpleSelect/Events/Events.stories.svelte +74 -0
  15. package/dist/stories/components/Form/SimpleSelect/Events/Events.stories.svelte.d.ts +18 -0
  16. package/dist/stories/components/Form/SimpleSelect/Roundness/Roundness.stories.svelte +24 -0
  17. package/dist/stories/components/Form/SimpleSelect/Roundness/Roundness.stories.svelte.d.ts +26 -0
  18. package/dist/stories/components/Form/SimpleSelect/SimpleSelect.stories.svelte +59 -0
  19. package/dist/stories/components/Form/SimpleSelect/SimpleSelect.stories.svelte.d.ts +23 -0
  20. package/dist/stories/components/Form/SimpleSelect/SimpleSelect.svelte +69 -0
  21. package/dist/stories/components/Form/SimpleSelect/SimpleSelect.svelte.d.ts +50 -0
  22. package/dist/stories/components/Form/SimpleSelect/Size/Size.stories.svelte +20 -0
  23. package/dist/stories/components/Form/SimpleSelect/Size/Size.stories.svelte.d.ts +26 -0
  24. package/dist/stories/components/Form/SimpleSelect/WithIcon/WithIcon.stories.svelte +36 -0
  25. package/dist/stories/components/Form/SimpleSelect/WithIcon/WithIcon.stories.svelte.d.ts +26 -0
  26. package/dist/stories/components/Form/TextInput/TextInput.svelte +22 -120
  27. package/dist/stories/components/Form/TextInput/TextInput.svelte.d.ts +1 -2
  28. package/dist/stories/developer tools/components/InputEnclosure/InputEnclosure.stories.svelte +34 -0
  29. package/dist/stories/developer tools/components/InputEnclosure/InputEnclosure.stories.svelte.d.ts +21 -0
  30. package/dist/stories/developer tools/components/InputEnclosure/InputEnclosure.svelte +120 -0
  31. package/dist/stories/developer tools/components/InputEnclosure/InputEnclosure.svelte.d.ts +29 -0
  32. package/dist/stories/developer tools/components/InputEnclosure/Roundness/Roundness.stories.svelte +20 -0
  33. package/dist/stories/developer tools/components/InputEnclosure/Roundness/Roundness.stories.svelte.d.ts +26 -0
  34. package/dist/stories/developer tools/components/InputEnclosure/Size/Size.stories.svelte +16 -0
  35. package/dist/stories/developer tools/components/InputEnclosure/Size/Size.stories.svelte.d.ts +26 -0
  36. package/dist/stories/developer tools/components/InputEnclosure/WithIcon/WithIcon.stories.svelte +47 -0
  37. package/dist/stories/developer tools/components/InputEnclosure/WithIcon/WithIcon.stories.svelte.d.ts +26 -0
  38. package/package.json +1 -1
  39. package/src/lib/index.ts +10 -1
  40. package/src/lib/stories/components/Form/FormControl/FormControl.svelte +1 -1
  41. package/src/lib/stories/components/Form/Message/Color/Color.stories.svelte +36 -0
  42. package/src/lib/stories/components/Form/Message/Message.stories.svelte +13 -26
  43. package/src/lib/stories/components/Form/Message/Message.svelte +23 -2
  44. package/src/lib/stories/components/Form/Message/Size/Size.stories.svelte +24 -0
  45. package/src/lib/stories/components/Form/PasswordInput/PasswordInput.svelte +35 -157
  46. package/src/lib/stories/components/Form/SimpleSelect/Events/Events.stories.svelte +79 -0
  47. package/src/lib/stories/components/Form/SimpleSelect/Roundness/Roundness.stories.svelte +24 -0
  48. package/src/lib/stories/components/Form/SimpleSelect/SimpleSelect.stories.svelte +64 -0
  49. package/src/lib/stories/components/Form/SimpleSelect/SimpleSelect.svelte +159 -0
  50. package/src/lib/stories/components/Form/SimpleSelect/Size/Size.stories.svelte +20 -0
  51. package/src/lib/stories/components/Form/SimpleSelect/WithIcon/WithIcon.stories.svelte +36 -0
  52. package/src/lib/stories/components/Form/TextInput/TextInput.svelte +22 -143
  53. package/src/lib/stories/developer tools/components/InputEnclosure/InputEnclosure.stories.svelte +38 -0
  54. package/src/lib/stories/developer tools/components/InputEnclosure/InputEnclosure.svelte +198 -0
  55. package/src/lib/stories/developer tools/components/InputEnclosure/Roundness/Roundness.stories.svelte +20 -0
  56. package/src/lib/stories/developer tools/components/InputEnclosure/Size/Size.stories.svelte +16 -0
  57. package/src/lib/stories/developer tools/components/InputEnclosure/WithIcon/WithIcon.stories.svelte +47 -0
package/dist/index.d.ts CHANGED
@@ -2,12 +2,14 @@ import './styles/global.css';
2
2
  export type { ComponentSize, ComponentRoundness, ComponentRoundnessFull } from './types.js';
3
3
  /** developer tools: components: UtilityButton */
4
4
  export { default as UtilityButton } from './stories/developer tools/components/UtilityButton/UtilityButton.svelte';
5
+ /** developer tools: components: InputEnclosure */
6
+ export { default as InputEnclosure } from './stories/developer tools/components/InputEnclosure/InputEnclosure.svelte';
5
7
  /** Form: Button */
6
8
  export { default as Button } from './stories/components/Form/Button/Button.svelte';
7
9
  export type { ButtonColor, ButtonRoundness, ButtonLinkTarget, ButtonLinkReferrerpolicy, } from './stories/components/Form/Button/Button.svelte';
8
10
  /** Form: TextInput */
9
11
  export { default as TextInput } from './stories/components/Form/TextInput/TextInput.svelte';
10
- export type { TextInputRoundness, TextInputType, TextInputFocusEvent, TextInputClipboardEvent, } from './stories/components/Form/TextInput/TextInput.svelte';
12
+ export type { TextInputType, TextInputFocusEvent, TextInputClipboardEvent, } from './stories/components/Form/TextInput/TextInput.svelte';
11
13
  /** Form: PasswordInput */
12
14
  export { default as PasswordInput } from './stories/components/Form/PasswordInput/PasswordInput.svelte';
13
15
  export type { PasswordInputToggleEvent } from './stories/components/Form/PasswordInput/PasswordInput.svelte';
@@ -18,3 +20,6 @@ export { default as FormControl } from './stories/components/Form/FormControl/Fo
18
20
  /** Form: Message */
19
21
  export { default as Message } from './stories/components/Form/Message/Message.svelte';
20
22
  export type { MessageColor } from './stories/components/Form/Message/Message.svelte';
23
+ /** Form: SimpleSelect */
24
+ export { default as SimpleSelect } from './stories/components/Form/SimpleSelect/SimpleSelect.svelte';
25
+ export type { SimpleSelectFocusEvent, SimpleSelectOption, } from './stories/components/Form/SimpleSelect/SimpleSelect.svelte';
package/dist/index.js CHANGED
@@ -1,6 +1,8 @@
1
1
  import './styles/global.css';
2
2
  /** developer tools: components: UtilityButton */
3
3
  export { default as UtilityButton } from './stories/developer tools/components/UtilityButton/UtilityButton.svelte';
4
+ /** developer tools: components: InputEnclosure */
5
+ export { default as InputEnclosure } from './stories/developer tools/components/InputEnclosure/InputEnclosure.svelte';
4
6
  /** Form: Button */
5
7
  export { default as Button } from './stories/components/Form/Button/Button.svelte';
6
8
  /** Form: TextInput */
@@ -13,3 +15,5 @@ export { default as Label } from './stories/components/Form/Label/Label.svelte';
13
15
  export { default as FormControl } from './stories/components/Form/FormControl/FormControl.svelte';
14
16
  /** Form: Message */
15
17
  export { default as Message } from './stories/components/Form/Message/Message.svelte';
18
+ /** Form: SimpleSelect */
19
+ export { default as SimpleSelect } from './stories/components/Form/SimpleSelect/SimpleSelect.svelte';
@@ -23,7 +23,7 @@ let { children, label, class: className = '', for: htmlFor, form, ref = $bindabl
23
23
 
24
24
  <style>:global(:root) {
25
25
  --dodo-ui-FormControl-LabelSection-gap: 8px;
26
- --dodo-ui-FormControl-errorMessage-gap: 16px;
26
+ --dodo-ui-FormControl-errorMessage-gap: 10px;
27
27
  }
28
28
 
29
29
  .dodo-ui-FormControl .LabelSection {
@@ -0,0 +1,36 @@
1
+ <script module>
2
+ import { defineMeta } from '@storybook/addon-svelte-csf';
3
+ import Message from '../Message.svelte';
4
+ import { storyMessageArgTypes } from '../Message.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: Message,
9
+ tags: ['autodocs'],
10
+ argTypes: storyMessageArgTypes,
11
+ });
12
+ </script>
13
+
14
+ <Story name="Default">
15
+ <Message>Lorem ipsum dolor sit amet, consectetur adipiscing elit</Message>
16
+ </Story>
17
+
18
+ <Story name="Primary" args={{ color: 'primary' }}>
19
+ <Message color="primary">Lorem ipsum dolor sit amet, consectetur adipiscing elit</Message>
20
+ </Story>
21
+
22
+ <Story name="Safe" args={{ color: 'safe' }}>
23
+ <Message color="safe">Lorem ipsum dolor sit amet, consectetur adipiscing elit</Message>
24
+ </Story>
25
+
26
+ <Story name="Warning" args={{ color: 'warning' }}>
27
+ <Message color="warning">Lorem ipsum dolor sit amet, consectetur adipiscing elit</Message>
28
+ </Story>
29
+
30
+ <Story name="Danger" args={{ color: 'danger' }}>
31
+ <Message color="danger">Lorem ipsum dolor sit amet, consectetur adipiscing elit</Message>
32
+ </Story>
33
+
34
+ <Story name="Info" args={{ color: 'info' }}>
35
+ <Message color="info">Lorem ipsum dolor sit amet, consectetur adipiscing elit</Message>
36
+ </Story>
@@ -0,0 +1,26 @@
1
+ export default Color;
2
+ type Color = SvelteComponent<{
3
+ [x: string]: never;
4
+ }, {
5
+ [evt: string]: CustomEvent<any>;
6
+ }, {}> & {
7
+ $$bindings?: string | undefined;
8
+ };
9
+ declare const Color: $$__sveltets_2_IsomorphicComponent<{
10
+ [x: string]: never;
11
+ }, {
12
+ [evt: string]: CustomEvent<any>;
13
+ }, {}, {}, string>;
14
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
15
+ new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
16
+ $$bindings?: Bindings;
17
+ } & Exports;
18
+ (internal: unknown, props: {
19
+ $$events?: Events;
20
+ $$slots?: Slots;
21
+ }): Exports & {
22
+ $set?: any;
23
+ $on?: any;
24
+ };
25
+ z_$$bindings?: Bindings;
26
+ }
@@ -1,15 +1,20 @@
1
1
  <script module lang="ts">import { defineMeta } from '@storybook/addon-svelte-csf';
2
2
  import Message from './Message.svelte';
3
+ export const storyMessageArgTypes = {
4
+ color: {
5
+ control: { type: 'select' },
6
+ options: ['default', 'primary', 'safe', 'warning', 'danger', 'info'],
7
+ },
8
+ size: {
9
+ control: { type: 'select' },
10
+ options: ['normal', 'small', 'large'],
11
+ },
12
+ };
3
13
  // More on how to set up stories at: https://storybook.js.org/docs/writing-stories
4
14
  const { Story } = defineMeta({
5
15
  component: Message,
6
16
  tags: ['autodocs'],
7
- argTypes: {
8
- color: {
9
- control: { type: 'select' },
10
- options: ['default', 'primary', 'safe', 'warning', 'danger', 'info'],
11
- },
12
- },
17
+ argTypes: storyMessageArgTypes,
13
18
  });
14
19
  </script>
15
20
 
@@ -24,23 +29,3 @@ const { Story } = defineMeta({
24
29
  <Story name="Default">
25
30
  <Message>Lorem ipsum dolor sit amet, consectetur adipiscing elit</Message>
26
31
  </Story>
27
-
28
- <Story name="Primary" args={{ color: 'primary' }}>
29
- <Message color="primary">Lorem ipsum dolor sit amet, consectetur adipiscing elit</Message>
30
- </Story>
31
-
32
- <Story name="Safe" args={{ color: 'safe' }}>
33
- <Message color="safe">Lorem ipsum dolor sit amet, consectetur adipiscing elit</Message>
34
- </Story>
35
-
36
- <Story name="Warning" args={{ color: 'warning' }}>
37
- <Message color="warning">Lorem ipsum dolor sit amet, consectetur adipiscing elit</Message>
38
- </Story>
39
-
40
- <Story name="Danger" args={{ color: 'danger' }}>
41
- <Message color="danger">Lorem ipsum dolor sit amet, consectetur adipiscing elit</Message>
42
- </Story>
43
-
44
- <Story name="Info" args={{ color: 'info' }}>
45
- <Message color="info">Lorem ipsum dolor sit amet, consectetur adipiscing elit</Message>
46
- </Story>
@@ -1,4 +1,6 @@
1
1
  import Message from './Message.svelte';
2
+ import type { StoryBookArgTypes } from '../../../../storybook-types.js';
3
+ export declare const storyMessageArgTypes: StoryBookArgTypes;
2
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> {
3
5
  new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
4
6
  $$bindings?: Bindings;
@@ -1,11 +1,14 @@
1
1
  <script lang="ts" module>export {};
2
2
  </script>
3
3
 
4
- <script lang="ts">let { children, class: className = '', color = 'default', ref = $bindable(), _unsafeChildrenStringForTesting, } = $props();
4
+ <script lang="ts">let { children, class: className = '', color = 'default', ref = $bindable(), _unsafeChildrenStringForTesting, size = 'normal', } = $props();
5
5
  export {};
6
6
  </script>
7
7
 
8
- <div class={['dodo-ui-Message', `color--${color}`, className].join(' ')} bind:this={ref}>
8
+ <div
9
+ class={['dodo-ui-Message', `color--${color}`, `size--${size}`, className].join(' ')}
10
+ bind:this={ref}
11
+ >
9
12
  {#if children}
10
13
  {@render children()}
11
14
  {:else if _unsafeChildrenStringForTesting}
@@ -14,11 +17,19 @@ export {};
14
17
  </div>
15
18
 
16
19
  <style>.dodo-ui-Message {
17
- font-size: 1rem;
18
20
  letter-spacing: 0.3px;
19
21
  display: flex;
20
22
  font-family: inherit;
21
23
  }
24
+ .dodo-ui-Message.size--normal {
25
+ font-size: 1rem;
26
+ }
27
+ .dodo-ui-Message.size--small {
28
+ font-size: 0.9rem;
29
+ }
30
+ .dodo-ui-Message.size--large {
31
+ font-size: 1.1rem;
32
+ }
22
33
  .dodo-ui-Message.color--default {
23
34
  color: var(--dodo-color-default-800);
24
35
  }
@@ -1,4 +1,5 @@
1
1
  export type MessageColor = 'default' | 'primary' | 'safe' | 'warning' | 'danger' | 'info';
2
+ import type { ComponentSize } from '../../../../types.js';
2
3
  import type { Snippet } from 'svelte';
3
4
  interface MessageProps {
4
5
  /** Message contents goes here */
@@ -7,6 +8,8 @@ interface MessageProps {
7
8
  ref?: HTMLDivElement;
8
9
  /** What color to use? */
9
10
  color?: MessageColor;
11
+ /** Message size */
12
+ size?: ComponentSize;
10
13
  /** Custom css class*/
11
14
  class?: string;
12
15
  /** Test: ⚠️ Unsafe Children String. Do Not use*/
@@ -0,0 +1,24 @@
1
+ <script module>
2
+ import { defineMeta } from '@storybook/addon-svelte-csf';
3
+ import Message from '../Message.svelte';
4
+ import { storyMessageArgTypes } from '../Message.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: Message,
9
+ tags: ['autodocs'],
10
+ argTypes: storyMessageArgTypes,
11
+ });
12
+ </script>
13
+
14
+ <Story name="Normal">
15
+ <Message>Lorem ipsum dolor sit amet, consectetur adipiscing elit</Message>
16
+ </Story>
17
+
18
+ <Story name="Small" args={{ size: 'small' }}>
19
+ <Message size="small">Lorem ipsum dolor sit amet, consectetur adipiscing elit</Message>
20
+ </Story>
21
+
22
+ <Story name="Large" args={{ size: 'large' }}>
23
+ <Message size="large">Lorem ipsum dolor sit amet, consectetur adipiscing elit</Message>
24
+ </Story>
@@ -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
+ }
@@ -3,6 +3,7 @@
3
3
 
4
4
  <script lang="ts">import Icon from '@iconify/svelte';
5
5
  import UtilityButton from '../../../developer tools/components/UtilityButton/UtilityButton.svelte';
6
+ import InputEnclosure from '../../../developer tools/components/InputEnclosure/InputEnclosure.svelte';
6
7
  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
8
  let focused = $state(false);
8
9
  let toggle = $state(passwordToggleState);
@@ -40,72 +41,40 @@ function ontoggleMod(e) {
40
41
  class:toggle
41
42
  class={['dodo-ui-PasswordInput', `size--${size}`, `roundness--${roundness}`, className].join(' ')}
42
43
  >
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
- />
44
+ <InputEnclosure {outline} {disabled} {error} {focused} {size} {roundness} {before} {after}>
45
+ <input
46
+ type={passwordToggle && toggle ? 'text' : 'password'}
47
+ {name}
48
+ {id}
49
+ {disabled}
50
+ {oninput}
51
+ {onchange}
52
+ onfocus={onfocusMod}
53
+ onblur={onblurMod}
54
+ {onpaste}
55
+ {oncopy}
56
+ {oncut}
57
+ {placeholder}
58
+ bind:value
59
+ bind:this={ref}
60
+ {readonly}
61
+ />
65
62
 
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}
63
+ {#if passwordToggle && !disabled}
64
+ <UtilityButton {size} title="Toggle password" class="passwordToggle" onclick={ontoggleMod}>
65
+ {#if customPasswordToggleIcon}
66
+ {@render customPasswordToggleIconTyped(toggle)}
67
+ {:else if toggle}
68
+ <Icon icon="mdi:eye-off" width="24" height="24" />
69
+ {:else}
70
+ <Icon icon="mdi:eye" width="24" height="24" />
71
+ {/if}
72
+ </UtilityButton>
73
+ {/if}
74
+ </InputEnclosure>
83
75
  </div>
84
76
 
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 {
77
+ <style>.dodo-ui-PasswordInput input {
109
78
  flex: 1;
110
79
  border: 0;
111
80
  outline: 0;
@@ -115,82 +84,15 @@ function ontoggleMod(e) {
115
84
  color: inherit;
116
85
  letter-spacing: 0.3px;
117
86
  }
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
87
  .dodo-ui-PasswordInput.size--normal input {
147
88
  font-size: 1rem;
148
89
  padding: 0 12px;
149
90
  }
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
91
  .dodo-ui-PasswordInput.size--small input {
162
92
  padding: 0 8px;
163
93
  font-size: 0.9rem;
164
94
  }
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
95
  .dodo-ui-PasswordInput.size--large input {
177
96
  font-size: 1.1rem;
178
97
  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
98
  }</style>
@@ -2,10 +2,9 @@ export type PasswordInputToggleEvent = {
2
2
  event: Event;
3
3
  toggle: boolean;
4
4
  };
5
- import type { ComponentSize } from '../../../../types.js';
5
+ import type { ComponentRoundness, ComponentSize } from '../../../../types.js';
6
6
  import type { Snippet } from 'svelte';
7
7
  import type { ChangeEventHandler, ClipboardEventHandler, FocusEventHandler, FormEventHandler } from 'svelte/elements';
8
- import type { TextInputRoundness } from '../TextInput/TextInput.svelte';
9
8
  interface PasswordInputProps {
10
9
  /** How large should the button be? */
11
10
  size?: ComponentSize;
@@ -18,7 +17,7 @@ interface PasswordInputProps {
18
17
  /** Toggle Password Icon */
19
18
  customPasswordToggleIcon?: (toggle: boolean) => Snippet;
20
19
  /** How round should the border radius be? */
21
- roundness?: TextInputRoundness;
20
+ roundness?: ComponentRoundness | false;
22
21
  /** Add a border around the button. Default True */
23
22
  outline?: boolean;
24
23
  /** Input value */
@@ -0,0 +1,74 @@
1
+ <script module lang="ts">import { defineMeta } from '@storybook/addon-svelte-csf';
2
+ import {} from '../SimpleSelect.svelte';
3
+ import SimpleSelect from '../SimpleSelect.svelte';
4
+ import { storySimpleSelectArgTypes, storySimpleSelectOptions, } from '../SimpleSelect.stories.svelte';
5
+ // More on how to set up stories at: https://storybook.js.org/docs/writing-stories
6
+ const { Story } = defineMeta({
7
+ component: SimpleSelect,
8
+ tags: ['autodocs'],
9
+ argTypes: storySimpleSelectArgTypes,
10
+ args: { options: storySimpleSelectOptions },
11
+ });
12
+ </script>
13
+
14
+ <Story
15
+ name="Change"
16
+ args={{
17
+ onchange: (e: Event) => {
18
+ const target = e.target as HTMLSelectElement;
19
+
20
+ console.log('onChange Event', target.value);
21
+ },
22
+ }}
23
+ >
24
+ <SimpleSelect
25
+ onchange={(e: Event) => {
26
+ const target = e.target as HTMLSelectElement;
27
+
28
+ console.log('onchange Event', target.value);
29
+ }}
30
+ options={storySimpleSelectOptions}
31
+ />
32
+ </Story>
33
+
34
+ <!-- `e: SimpleSelectFocusEvent` -->
35
+ <Story
36
+ name="Focus"
37
+ args={{
38
+ onfocus: (e: SimpleSelectFocusEvent) => {
39
+ const target = e.target as HTMLSelectElement;
40
+
41
+ console.log('onfocus Event', target);
42
+ },
43
+ }}
44
+ >
45
+ <SimpleSelect
46
+ onfocus={(e: SimpleSelectFocusEvent) => {
47
+ const target = e.target as HTMLSelectElement;
48
+
49
+ console.log('onfocus Event', target);
50
+ }}
51
+ options={storySimpleSelectOptions}
52
+ />
53
+ </Story>
54
+
55
+ <!-- `e: SimpleSelectFocusEvent` -->
56
+ <Story
57
+ name="Blur"
58
+ args={{
59
+ onblur: (e: SimpleSelectFocusEvent) => {
60
+ const target = e.target as HTMLSelectElement;
61
+
62
+ console.log('onblur Event', target);
63
+ },
64
+ }}
65
+ >
66
+ <SimpleSelect
67
+ onblur={(e: SimpleSelectFocusEvent) => {
68
+ const target = e.target as HTMLSelectElement;
69
+
70
+ console.log('onblur Event', target);
71
+ }}
72
+ options={storySimpleSelectOptions}
73
+ />
74
+ </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,24 @@
1
+ <script module>
2
+ import { defineMeta } from '@storybook/addon-svelte-csf';
3
+ import SimpleSelect from '../SimpleSelect.svelte';
4
+ import {
5
+ storySimpleSelectArgTypes,
6
+ storySimpleSelectOptions,
7
+ } from '../SimpleSelect.stories.svelte';
8
+
9
+ // More on how to set up stories at: https://storybook.js.org/docs/writing-stories
10
+ const { Story } = defineMeta({
11
+ component: SimpleSelect,
12
+ tags: ['autodocs'],
13
+ argTypes: storySimpleSelectArgTypes,
14
+ args: { options: storySimpleSelectOptions },
15
+ });
16
+ </script>
17
+
18
+ <Story name="Roundness 1x" />
19
+
20
+ <Story name="Roundness 2x" args={{ roundness: '2x' }} />
21
+
22
+ <Story name="Roundness 3x" args={{ roundness: '3x' }} />
23
+
24
+ <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
+ }