@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.
Files changed (85) hide show
  1. package/dist/index.d.ts +9 -1
  2. package/dist/index.js +6 -0
  3. package/dist/stories/components/Form/Button/Button.stories.svelte +1 -1
  4. package/dist/stories/components/Form/Button/Button.svelte +37 -37
  5. package/dist/stories/components/Form/Button/Button.svelte.d.ts +1 -1
  6. package/dist/stories/components/Form/Button/Color/Color.stories.svelte +9 -7
  7. package/dist/stories/components/Form/FormControl/FormControl.svelte +1 -1
  8. package/dist/stories/components/Form/Message/Color/Color.stories.svelte +36 -0
  9. package/dist/stories/components/Form/Message/Color/Color.stories.svelte.d.ts +26 -0
  10. package/dist/stories/components/Form/Message/Message.stories.svelte +11 -26
  11. package/dist/stories/components/Form/Message/Message.stories.svelte.d.ts +2 -0
  12. package/dist/stories/components/Form/Message/Message.svelte +17 -6
  13. package/dist/stories/components/Form/Message/Message.svelte.d.ts +4 -1
  14. package/dist/stories/components/Form/Message/Size/Size.stories.svelte +24 -0
  15. package/dist/stories/components/Form/Message/Size/Size.stories.svelte.d.ts +26 -0
  16. package/dist/stories/components/Form/PasswordInput/PasswordInput.svelte +32 -130
  17. package/dist/stories/components/Form/PasswordInput/PasswordInput.svelte.d.ts +2 -3
  18. package/dist/stories/components/Form/SimpleSelect/Events/Events.stories.svelte +74 -0
  19. package/dist/stories/components/Form/SimpleSelect/Events/Events.stories.svelte.d.ts +18 -0
  20. package/dist/stories/components/Form/SimpleSelect/Roundness/Roundness.stories.svelte +24 -0
  21. package/dist/stories/components/Form/SimpleSelect/Roundness/Roundness.stories.svelte.d.ts +26 -0
  22. package/dist/stories/components/Form/SimpleSelect/SimpleSelect.stories.svelte +59 -0
  23. package/dist/stories/components/Form/SimpleSelect/SimpleSelect.stories.svelte.d.ts +23 -0
  24. package/dist/stories/components/Form/SimpleSelect/SimpleSelect.svelte +69 -0
  25. package/dist/stories/components/Form/SimpleSelect/SimpleSelect.svelte.d.ts +50 -0
  26. package/dist/stories/components/Form/SimpleSelect/Size/Size.stories.svelte +20 -0
  27. package/dist/stories/components/Form/SimpleSelect/Size/Size.stories.svelte.d.ts +26 -0
  28. package/dist/stories/components/Form/SimpleSelect/WithIcon/WithIcon.stories.svelte +36 -0
  29. package/dist/stories/components/Form/SimpleSelect/WithIcon/WithIcon.stories.svelte.d.ts +26 -0
  30. package/dist/stories/components/Form/TextInput/TextInput.svelte +22 -120
  31. package/dist/stories/components/Form/TextInput/TextInput.svelte.d.ts +1 -2
  32. package/dist/stories/components/Layout/Paper/Paper.stories.svelte +32 -0
  33. package/dist/stories/components/Layout/Paper/Paper.stories.svelte.d.ts +21 -0
  34. package/dist/stories/components/Layout/Paper/Paper.svelte +52 -0
  35. package/dist/stories/components/Layout/Paper/Paper.svelte.d.ts +23 -0
  36. package/dist/stories/components/Layout/Paper/Roundness/Roundness.stories.svelte +30 -0
  37. package/dist/stories/components/Layout/Paper/Roundness/Roundness.stories.svelte.d.ts +26 -0
  38. package/dist/stories/components/Layout/Paper/Shadow/Shadow.stories.svelte +42 -0
  39. package/dist/stories/components/Layout/Paper/Shadow/Shadow.stories.svelte.d.ts +26 -0
  40. package/dist/stories/developer tools/components/InputEnclosure/InputEnclosure.stories.svelte +34 -0
  41. package/dist/stories/developer tools/components/InputEnclosure/InputEnclosure.stories.svelte.d.ts +21 -0
  42. package/dist/stories/developer tools/components/InputEnclosure/InputEnclosure.svelte +120 -0
  43. package/dist/stories/developer tools/components/InputEnclosure/InputEnclosure.svelte.d.ts +29 -0
  44. package/dist/stories/developer tools/components/InputEnclosure/Roundness/Roundness.stories.svelte +20 -0
  45. package/dist/stories/developer tools/components/InputEnclosure/Roundness/Roundness.stories.svelte.d.ts +26 -0
  46. package/dist/stories/developer tools/components/InputEnclosure/Size/Size.stories.svelte +16 -0
  47. package/dist/stories/developer tools/components/InputEnclosure/Size/Size.stories.svelte.d.ts +26 -0
  48. package/dist/stories/developer tools/components/InputEnclosure/WithIcon/WithIcon.stories.svelte +47 -0
  49. package/dist/stories/developer tools/components/InputEnclosure/WithIcon/WithIcon.stories.svelte.d.ts +26 -0
  50. package/dist/stories/philosophy/Colors/utils/color.js +1 -1
  51. package/dist/styles/_colors.css +26 -26
  52. package/dist/styles/_shadow.css +39 -0
  53. package/dist/styles/global.css +1 -0
  54. package/dist/types.d.ts +1 -0
  55. package/package.json +1 -1
  56. package/src/lib/index.ts +17 -1
  57. package/src/lib/stories/components/Form/Button/Button.stories.svelte +1 -1
  58. package/src/lib/stories/components/Form/Button/Button.svelte +4 -4
  59. package/src/lib/stories/components/Form/Button/Color/Color.stories.svelte +9 -7
  60. package/src/lib/stories/components/Form/FormControl/FormControl.svelte +1 -1
  61. package/src/lib/stories/components/Form/Message/Color/Color.stories.svelte +36 -0
  62. package/src/lib/stories/components/Form/Message/Message.stories.svelte +13 -26
  63. package/src/lib/stories/components/Form/Message/Message.svelte +28 -7
  64. package/src/lib/stories/components/Form/Message/Size/Size.stories.svelte +24 -0
  65. package/src/lib/stories/components/Form/PasswordInput/PasswordInput.svelte +35 -157
  66. package/src/lib/stories/components/Form/SimpleSelect/Events/Events.stories.svelte +79 -0
  67. package/src/lib/stories/components/Form/SimpleSelect/Roundness/Roundness.stories.svelte +24 -0
  68. package/src/lib/stories/components/Form/SimpleSelect/SimpleSelect.stories.svelte +64 -0
  69. package/src/lib/stories/components/Form/SimpleSelect/SimpleSelect.svelte +159 -0
  70. package/src/lib/stories/components/Form/SimpleSelect/Size/Size.stories.svelte +20 -0
  71. package/src/lib/stories/components/Form/SimpleSelect/WithIcon/WithIcon.stories.svelte +36 -0
  72. package/src/lib/stories/components/Form/TextInput/TextInput.svelte +22 -143
  73. package/src/lib/stories/components/Layout/Paper/Paper.stories.svelte +36 -0
  74. package/src/lib/stories/components/Layout/Paper/Paper.svelte +91 -0
  75. package/src/lib/stories/components/Layout/Paper/Roundness/Roundness.stories.svelte +30 -0
  76. package/src/lib/stories/components/Layout/Paper/Shadow/Shadow.stories.svelte +42 -0
  77. package/src/lib/stories/developer tools/components/InputEnclosure/InputEnclosure.stories.svelte +38 -0
  78. package/src/lib/stories/developer tools/components/InputEnclosure/InputEnclosure.svelte +198 -0
  79. package/src/lib/stories/developer tools/components/InputEnclosure/Roundness/Roundness.stories.svelte +20 -0
  80. package/src/lib/stories/developer tools/components/InputEnclosure/Size/Size.stories.svelte +16 -0
  81. package/src/lib/stories/developer tools/components/InputEnclosure/WithIcon/WithIcon.stories.svelte +47 -0
  82. package/src/lib/styles/_colors.css +26 -26
  83. package/src/lib/styles/_shadow.css +39 -0
  84. package/src/lib/styles/global.css +1 -0
  85. package/src/lib/types.ts +1 -0
@@ -1,7 +1,8 @@
1
1
  <script lang="ts" module>export {};
2
2
  </script>
3
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, ref = $bindable(), readonly = false, } = $props();
4
+ <script lang="ts">import InputEnclosure from '../../../developer tools/components/InputEnclosure/InputEnclosure.svelte';
5
+ 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, ref = $bindable(), readonly = false, } = $props();
5
6
  let focused = $state(false);
6
7
  function onfocusMod(e) {
7
8
  focused = true;
@@ -15,7 +16,6 @@ function onblurMod(e) {
15
16
  onblur(e);
16
17
  }
17
18
  }
18
- export {};
19
19
  </script>
20
20
 
21
21
  <div
@@ -25,59 +25,28 @@ export {};
25
25
  class:focused
26
26
  class={['dodo-ui-TextInput', `size--${size}`, `roundness--${roundness}`, className].join(' ')}
27
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
- {readonly}
47
- bind:value
48
- bind:this={ref}
49
- />
50
- {#if after}
51
- <span class="content--after">
52
- {@render after()}
53
- </span>
54
- {/if}
28
+ <InputEnclosure {outline} {disabled} {error} {focused} {size} {roundness} {before} {after}>
29
+ <input
30
+ {type}
31
+ {name}
32
+ {id}
33
+ {disabled}
34
+ {oninput}
35
+ {onchange}
36
+ onfocus={onfocusMod}
37
+ onblur={onblurMod}
38
+ {onpaste}
39
+ {oncopy}
40
+ {oncut}
41
+ {placeholder}
42
+ {readonly}
43
+ bind:value
44
+ bind:this={ref}
45
+ />
46
+ </InputEnclosure>
55
47
  </div>
56
48
 
57
- <style>:global(:root) {
58
- --dodo-ui-TextInput-border-color: var(--dodo-color-default-500);
59
- --dodo-ui-TextInput-focus-border-color: var(--dodo-color-primary-500);
60
- --dodo-ui-TextInput-error-border-color: var(--dodo-color-danger-500);
61
- --dodo-ui-TextInput-disabled-color: var(--dodo-color-default-400);
62
- --dodo-ui-TextInput-disabled-bg: var(--dodo-color-default-200);
63
- }
64
-
65
- :global(.dodo-theme--dark) {
66
- --dodo-ui-TextInput-border-color: var(--dodo-color-default-600);
67
- --dodo-ui-TextInput-focus-border-color: var(--dodo-color-primary-600);
68
- --dodo-ui-TextInput-error-border-color: var(--dodo-color-danger-600);
69
- --dodo-ui-TextInput-disabled-bg: var(--dodo-color-default-100);
70
- --dodo-ui-TextInput-disabled-color: var(--dodo-color-default-500);
71
- }
72
-
73
- .dodo-ui-TextInput {
74
- display: flex;
75
- overflow: hidden;
76
- color: var(--dodo-color-default-800);
77
- transition: all 150ms;
78
- border: 0;
79
- }
80
- .dodo-ui-TextInput input {
49
+ <style>.dodo-ui-TextInput input {
81
50
  flex: 1;
82
51
  border: 0;
83
52
  outline: 0;
@@ -87,82 +56,15 @@ export {};
87
56
  color: inherit;
88
57
  letter-spacing: 0.3px;
89
58
  }
90
- .dodo-ui-TextInput.outline {
91
- border-style: solid;
92
- border-width: var(--dodo-ui-element-border-width);
93
- border-color: var(--dodo-ui-TextInput-border-color);
94
- }
95
- .dodo-ui-TextInput.focused {
96
- border-color: var(--dodo-ui-TextInput-focus-border-color);
97
- }
98
- .dodo-ui-TextInput.error {
99
- border-color: var(--dodo-ui-TextInput-error-border-color);
100
- }
101
- .dodo-ui-TextInput.disabled {
102
- cursor: initial;
103
- background-color: var(--dodo-ui-TextInput-disabled-bg);
104
- color: var(--dodo-ui-TextInput-disabled-color);
105
- border-color: var(--dodo-ui-TextInput-disabled-bg);
106
- }
107
- .dodo-ui-TextInput .content--after:empty, .dodo-ui-TextInput .content--before:empty {
108
- display: none;
109
- }
110
- .dodo-ui-TextInput .content--after, .dodo-ui-TextInput .content--before {
111
- display: inline-flex;
112
- height: 100%;
113
- align-items: center;
114
- }
115
- .dodo-ui-TextInput.size--normal {
116
- height: var(--dodo-ui-element-height-normal);
117
- }
118
59
  .dodo-ui-TextInput.size--normal input {
119
60
  font-size: 1rem;
120
61
  padding: 0 12px;
121
62
  }
122
- .dodo-ui-TextInput.size--normal .content--before {
123
- margin-left: 12px;
124
- margin-right: -4px;
125
- }
126
- .dodo-ui-TextInput.size--normal .content--after {
127
- margin-right: 12px;
128
- margin-left: -4px;
129
- }
130
- .dodo-ui-TextInput.size--small {
131
- height: var(--dodo-ui-element-height-small);
132
- }
133
63
  .dodo-ui-TextInput.size--small input {
134
64
  padding: 0 8px;
135
65
  font-size: 0.9rem;
136
66
  }
137
- .dodo-ui-TextInput.size--small .content--before {
138
- margin-left: 8px;
139
- margin-right: -2px;
140
- }
141
- .dodo-ui-TextInput.size--small .content--after {
142
- margin-right: 8px;
143
- margin-left: -2px;
144
- }
145
- .dodo-ui-TextInput.size--large {
146
- height: var(--dodo-ui-element-height-large);
147
- }
148
67
  .dodo-ui-TextInput.size--large input {
149
68
  font-size: 1.1rem;
150
69
  padding: 0 14px;
151
- }
152
- .dodo-ui-TextInput.size--large .content--before {
153
- margin-left: 14px;
154
- margin-right: -4px;
155
- }
156
- .dodo-ui-TextInput.size--large .content--after {
157
- margin-right: 14px;
158
- margin-left: -4px;
159
- }
160
- .dodo-ui-TextInput.roundness--1x {
161
- border-radius: var(--dodo-ui-element-roundness-1x);
162
- }
163
- .dodo-ui-TextInput.roundness--2x {
164
- border-radius: var(--dodo-ui-element-roundness-2x);
165
- }
166
- .dodo-ui-TextInput.roundness--3x {
167
- border-radius: var(--dodo-ui-element-roundness-3x);
168
70
  }</style>
@@ -1,4 +1,3 @@
1
- export type TextInputRoundness = ComponentRoundness | false;
2
1
  export type TextInputType = 'text' | 'tel' | 'email' | 'password' | 'url' | 'number';
3
2
  export type TextInputFocusEvent = FocusEvent & {
4
3
  currentTarget: EventTarget & HTMLInputElement;
@@ -17,7 +16,7 @@ interface TextInputProps {
17
16
  /** How large should the button be? */
18
17
  size?: ComponentSize;
19
18
  /** How round should the border radius be? */
20
- roundness?: TextInputRoundness;
19
+ roundness?: ComponentRoundness | false;
21
20
  /** Add a border around the button. Default True */
22
21
  outline?: boolean;
23
22
  /** Input value */
@@ -0,0 +1,32 @@
1
+ <script module lang="ts">import { defineMeta } from '@storybook/addon-svelte-csf';
2
+ import Paper from './Paper.svelte';
3
+ export const storyPaperArgTypes = {
4
+ roundness: {
5
+ control: { type: 'select' },
6
+ options: [false, '1x', '2x', '3x', 'full'],
7
+ },
8
+ shadow: {
9
+ control: { type: 'select' },
10
+ options: [false, '1x', '2x', '3x', '4x', '5x', '6x', '7x'],
11
+ },
12
+ };
13
+ // More on how to set up stories at: https://storybook.js.org/docs/writing-stories
14
+ const { Story } = defineMeta({
15
+ component: Paper,
16
+ tags: ['autodocs'],
17
+ argTypes: storyPaperArgTypes,
18
+ });
19
+ </script>
20
+
21
+ <!-- ⚠️ Test Paper: Do not use! -->
22
+ <Story
23
+ name="Test Paper"
24
+ args={{
25
+ _unsafeChildrenStringForTesting: 'Hola!',
26
+ }}
27
+ />
28
+
29
+ <!-- Paper with default style -->
30
+ <Story name="Default">
31
+ <Paper>Hola!</Paper>
32
+ </Story>
@@ -0,0 +1,21 @@
1
+ import Paper from './Paper.svelte';
2
+ import type { StoryBookArgTypes } from '../../../../storybook-types.js';
3
+ export declare const storyPaperArgTypes: 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 Paper: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
18
+ [evt: string]: CustomEvent<any>;
19
+ }, {}, {}, string>;
20
+ type Paper = InstanceType<typeof Paper>;
21
+ export default Paper;
@@ -0,0 +1,52 @@
1
+ <script lang="ts" module>export {};
2
+ </script>
3
+
4
+ <script lang="ts">let { children, roundness = '1x', shadow = '1x', id, class: className = '', _unsafeChildrenStringForTesting, ref = $bindable(), } = $props();
5
+ export {};
6
+ </script>
7
+
8
+ <div
9
+ class={[
10
+ 'dodo-ui-Paper',
11
+ `roundness--${roundness}`,
12
+ `${shadow ? `shadow--${shadow} dodo-shadow-${shadow}` : `shadow--${shadow}`}`,
13
+ className,
14
+ ].join(' ')}
15
+ {id}
16
+ bind:this={ref}
17
+ >
18
+ {#if children}
19
+ {@render children()}
20
+ {:else if _unsafeChildrenStringForTesting}
21
+ {_unsafeChildrenStringForTesting}
22
+ {/if}
23
+ </div>
24
+
25
+ <style>:global(:root) {
26
+ --dodo-ui-Paper-bg: var(--dodo-color-white);
27
+ }
28
+
29
+ :global(.dodo-theme--dark) {
30
+ --dodo-ui-Paper-bg: var(--dodo-color-default-100);
31
+ }
32
+
33
+ .dodo-ui-Paper {
34
+ outline: none;
35
+ transition: all 150ms;
36
+ font-family: inherit;
37
+ color: inherit;
38
+ background-color: var(--dodo-ui-Paper-bg);
39
+ overflow: hidden;
40
+ }
41
+ .dodo-ui-Paper.roundness--1x {
42
+ border-radius: var(--dodo-ui-element-roundness-1x);
43
+ }
44
+ .dodo-ui-Paper.roundness--2x {
45
+ border-radius: var(--dodo-ui-element-roundness-2x);
46
+ }
47
+ .dodo-ui-Paper.roundness--3x {
48
+ border-radius: var(--dodo-ui-element-roundness-3x);
49
+ }
50
+ .dodo-ui-Paper.roundness--full {
51
+ border-radius: 50%;
52
+ }</style>
@@ -0,0 +1,23 @@
1
+ export type PaperRoundness = ComponentRoundness | false | ComponentRoundnessFull;
2
+ export type PaperShadow = false | '1x' | '2x' | '3x' | '4x' | '5x' | '6x' | '7x';
3
+ import type { ComponentRoundness, ComponentRoundnessFull } from '../../../../types.js';
4
+ import type { Snippet } from 'svelte';
5
+ interface PaperProps {
6
+ /** Paper contents goes here */
7
+ children?: Snippet;
8
+ /** Paper ref */
9
+ ref?: HTMLDivElement;
10
+ /** How round should the border radius be? */
11
+ roundness?: PaperRoundness;
12
+ /** Shadow elevation */
13
+ shadow?: PaperShadow;
14
+ /** Custom css class*/
15
+ class?: string;
16
+ /** Id */
17
+ id?: string;
18
+ /** Test: ⚠️ Unsafe Children String. Do Not use*/
19
+ _unsafeChildrenStringForTesting?: string;
20
+ }
21
+ declare const Paper: import("svelte").Component<PaperProps, {}, "ref">;
22
+ type Paper = ReturnType<typeof Paper>;
23
+ export default Paper;
@@ -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,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,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>
@@ -0,0 +1,26 @@
1
+ export default Shadow;
2
+ type Shadow = SvelteComponent<{
3
+ [x: string]: never;
4
+ }, {
5
+ [evt: string]: CustomEvent<any>;
6
+ }, {}> & {
7
+ $$bindings?: string | undefined;
8
+ };
9
+ declare const Shadow: $$__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,34 @@
1
+ <script module lang="ts">import { defineMeta } from '@storybook/addon-svelte-csf';
2
+ import InputEnclosure from './InputEnclosure.svelte';
3
+ export const storyInputEnclosureArgTypes = {
4
+ roundness: {
5
+ control: { type: 'select' },
6
+ options: [false, '1x', '2x', '3x'],
7
+ },
8
+ size: {
9
+ control: { type: 'select' },
10
+ options: ['normal', 'small', 'large'],
11
+ },
12
+ };
13
+ // More on how to set up stories at: https://storybook.js.org/docs/writing-stories
14
+ const { Story } = defineMeta({
15
+ component: InputEnclosure,
16
+ tags: ['autodocs'],
17
+ argTypes: storyInputEnclosureArgTypes,
18
+ });
19
+ </script>
20
+
21
+ <!-- An ensloure for Form Inputs [TextInput](?path=/docs/components-form-textinput--docs) -->
22
+ <Story name="Default" />
23
+
24
+ <Story name="Focused" args={{ focused: true }} />
25
+
26
+ <Story name="Error" args={{ error: true }} />
27
+
28
+ <Story name="Disabled" args={{ disabled: true }} />
29
+
30
+ <Story name="Input example">
31
+ <InputEnclosure>
32
+ <input type="text" style="flex: 1; border: 0;" placeholder="Enter name" />
33
+ </InputEnclosure>
34
+ </Story>
@@ -0,0 +1,21 @@
1
+ import InputEnclosure from './InputEnclosure.svelte';
2
+ import type { StoryBookArgTypes } from '../../../../storybook-types.js';
3
+ export declare const storyInputEnclosureArgTypes: 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 InputEnclosure: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
18
+ [evt: string]: CustomEvent<any>;
19
+ }, {}, {}, string>;
20
+ type InputEnclosure = InstanceType<typeof InputEnclosure>;
21
+ export default InputEnclosure;
@@ -0,0 +1,120 @@
1
+ <script lang="ts">let { size = 'normal', roundness = '1x', outline = true, class: className = '', disabled = false, before, after, error = false, focused = false, children, ref = $bindable(), } = $props();
2
+ export {};
3
+ </script>
4
+
5
+ <div
6
+ class:outline
7
+ class:disabled
8
+ class:error
9
+ class:focused
10
+ class={['dodo-ui-InputEnclosure', `size--${size}`, `roundness--${roundness}`, className].join(
11
+ ' ',
12
+ )}
13
+ bind:this={ref}
14
+ >
15
+ {#if before}
16
+ <span class="content--before">
17
+ {@render before()}
18
+ </span>
19
+ {/if}
20
+
21
+ {#if children}
22
+ {@render children()}
23
+ {/if}
24
+ {#if after}
25
+ <span class="content--after">
26
+ {@render after()}
27
+ </span>
28
+ {/if}
29
+ </div>
30
+
31
+ <style>:global(:root) {
32
+ --dodo-ui-InputEnclosure-border-color: var(--dodo-color-default-500);
33
+ --dodo-ui-InputEnclosure-focus-border-color: var(--dodo-color-primary-500);
34
+ --dodo-ui-InputEnclosure-error-border-color: var(--dodo-color-danger-500);
35
+ --dodo-ui-InputEnclosure-disabled-color: var(--dodo-color-default-400);
36
+ --dodo-ui-InputEnclosure-disabled-bg: var(--dodo-color-default-200);
37
+ }
38
+
39
+ :global(.dodo-theme--dark) {
40
+ --dodo-ui-InputEnclosure-border-color: var(--dodo-color-default-600);
41
+ --dodo-ui-InputEnclosure-focus-border-color: var(--dodo-color-primary-600);
42
+ --dodo-ui-InputEnclosure-error-border-color: var(--dodo-color-danger-600);
43
+ --dodo-ui-InputEnclosure-disabled-bg: var(--dodo-color-default-100);
44
+ --dodo-ui-InputEnclosure-disabled-color: var(--dodo-color-default-500);
45
+ }
46
+
47
+ .dodo-ui-InputEnclosure {
48
+ display: flex;
49
+ overflow: hidden;
50
+ color: var(--dodo-color-default-800);
51
+ transition: all 150ms;
52
+ border: 0;
53
+ }
54
+ .dodo-ui-InputEnclosure.outline {
55
+ border-style: solid;
56
+ border-width: var(--dodo-ui-element-border-width);
57
+ border-color: var(--dodo-ui-InputEnclosure-border-color);
58
+ }
59
+ .dodo-ui-InputEnclosure.focused {
60
+ border-color: var(--dodo-ui-InputEnclosure-focus-border-color);
61
+ }
62
+ .dodo-ui-InputEnclosure.error {
63
+ border-color: var(--dodo-ui-InputEnclosure-error-border-color);
64
+ }
65
+ .dodo-ui-InputEnclosure.disabled {
66
+ cursor: initial;
67
+ background-color: var(--dodo-ui-InputEnclosure-disabled-bg);
68
+ color: var(--dodo-ui-InputEnclosure-disabled-color);
69
+ border-color: var(--dodo-ui-InputEnclosure-disabled-bg);
70
+ }
71
+ .dodo-ui-InputEnclosure .content--after:empty, .dodo-ui-InputEnclosure .content--before:empty {
72
+ display: none;
73
+ }
74
+ .dodo-ui-InputEnclosure .content--after, .dodo-ui-InputEnclosure .content--before {
75
+ display: inline-flex;
76
+ height: 100%;
77
+ align-items: center;
78
+ }
79
+ .dodo-ui-InputEnclosure.size--normal {
80
+ height: var(--dodo-ui-element-height-normal);
81
+ }
82
+ .dodo-ui-InputEnclosure.size--normal .content--before {
83
+ margin-left: 12px;
84
+ margin-right: -4px;
85
+ }
86
+ .dodo-ui-InputEnclosure.size--normal .content--after {
87
+ margin-right: 12px;
88
+ margin-left: -4px;
89
+ }
90
+ .dodo-ui-InputEnclosure.size--small {
91
+ height: var(--dodo-ui-element-height-small);
92
+ }
93
+ .dodo-ui-InputEnclosure.size--small .content--before {
94
+ margin-left: 8px;
95
+ margin-right: -2px;
96
+ }
97
+ .dodo-ui-InputEnclosure.size--small .content--after {
98
+ margin-right: 8px;
99
+ margin-left: -2px;
100
+ }
101
+ .dodo-ui-InputEnclosure.size--large {
102
+ height: var(--dodo-ui-element-height-large);
103
+ }
104
+ .dodo-ui-InputEnclosure.size--large .content--before {
105
+ margin-left: 14px;
106
+ margin-right: -4px;
107
+ }
108
+ .dodo-ui-InputEnclosure.size--large .content--after {
109
+ margin-right: 14px;
110
+ margin-left: -4px;
111
+ }
112
+ .dodo-ui-InputEnclosure.roundness--1x {
113
+ border-radius: var(--dodo-ui-element-roundness-1x);
114
+ }
115
+ .dodo-ui-InputEnclosure.roundness--2x {
116
+ border-radius: var(--dodo-ui-element-roundness-2x);
117
+ }
118
+ .dodo-ui-InputEnclosure.roundness--3x {
119
+ border-radius: var(--dodo-ui-element-roundness-3x);
120
+ }</style>
@@ -0,0 +1,29 @@
1
+ import type { ComponentRoundness, ComponentSize } from '../../../../types.js';
2
+ import type { Snippet } from 'svelte';
3
+ interface InputEnclosureProps {
4
+ /** InputEnclosure contents goes here */
5
+ children?: Snippet;
6
+ /** InputEnclosure ref */
7
+ ref?: HTMLDivElement;
8
+ /** How large should the button be? */
9
+ size?: ComponentSize;
10
+ /** How round should the border radius be? */
11
+ roundness?: ComponentRoundness | false;
12
+ /** Add a border around the button. Default True */
13
+ outline?: boolean;
14
+ /** disabled state */
15
+ disabled?: boolean;
16
+ /** is there any associated Error ? */
17
+ error?: boolean;
18
+ /** is focused */
19
+ focused?: boolean;
20
+ /** Icon before button content */
21
+ before?: Snippet;
22
+ /** Icon after button content */
23
+ after?: Snippet;
24
+ /** Custom css class*/
25
+ class?: string;
26
+ }
27
+ declare const InputEnclosure: import("svelte").Component<InputEnclosureProps, {}, "ref">;
28
+ type InputEnclosure = ReturnType<typeof InputEnclosure>;
29
+ export default InputEnclosure;
@@ -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 }} />