@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,56 @@
1
+ export type TextInputRoundness = ComponentRoundness | false;
2
+ export type TextInputType = 'text' | 'tel' | 'email' | 'password' | 'url' | 'number';
3
+ export type TextInputFocusEvent = FocusEvent & {
4
+ currentTarget: EventTarget & HTMLInputElement;
5
+ };
6
+ export type TextInputClipboardEvent = ClipboardEvent & {
7
+ currentTarget: EventTarget & HTMLInputElement;
8
+ };
9
+ import type { ComponentRoundness, ComponentSize } from '../../../../types.js';
10
+ import type { Snippet } from 'svelte';
11
+ import type { ChangeEventHandler, ClipboardEventHandler, FocusEventHandler, FormEventHandler } from 'svelte/elements';
12
+ interface TextInputProps {
13
+ /** Input type? */
14
+ type?: TextInputType;
15
+ /** How large should the button be? */
16
+ size?: ComponentSize;
17
+ /** How round should the border radius be? */
18
+ roundness?: TextInputRoundness;
19
+ /** Add a border around the button. Default True */
20
+ outline?: boolean;
21
+ /** Input value */
22
+ value?: string;
23
+ /** How round should the border radius be? */
24
+ placeholder?: string;
25
+ /** Button disabled state */
26
+ disabled?: boolean;
27
+ /** is there any associated Error ? */
28
+ error?: boolean;
29
+ /** Name */
30
+ name?: string;
31
+ /** Id */
32
+ id?: string;
33
+ /** Icon before button content */
34
+ before?: Snippet;
35
+ /** Icon after button content */
36
+ after?: Snippet;
37
+ /** Custom css class*/
38
+ class?: string;
39
+ /** oninput event handler */
40
+ oninput?: FormEventHandler<HTMLInputElement>;
41
+ /** onchange event handler */
42
+ onchange?: ChangeEventHandler<HTMLInputElement>;
43
+ /** onblur event handler */
44
+ onblur?: FocusEventHandler<HTMLInputElement>;
45
+ /** onfocus event handler */
46
+ onfocus?: FocusEventHandler<HTMLInputElement>;
47
+ /** onpaste event handler */
48
+ onpaste?: ClipboardEventHandler<HTMLInputElement>;
49
+ /** oncopy event handler */
50
+ oncopy?: ClipboardEventHandler<HTMLInputElement>;
51
+ /** oncut event handler */
52
+ oncut?: ClipboardEventHandler<HTMLInputElement>;
53
+ }
54
+ declare const TextInput: import("svelte").Component<TextInputProps, {}, "value">;
55
+ type TextInput = ReturnType<typeof TextInput>;
56
+ export default TextInput;
@@ -0,0 +1,47 @@
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
+ 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: TextInput,
10
+ tags: ['autodocs'],
11
+ argTypes: storyTextInputArgTypes,
12
+ });
13
+ </script>
14
+
15
+ <!-- TextInput icon in front. -->
16
+ <Story name="Icon Before">
17
+ <TextInput>
18
+ {#snippet before()}
19
+ <Icon icon="material-symbols:content-copy" />
20
+ {/snippet}
21
+ </TextInput>
22
+ </Story>
23
+
24
+ <!-- TextInput icon in front. -->
25
+ <Story name="Icon After">
26
+ <TextInput>
27
+ {#snippet after()}
28
+ <Icon icon="material-symbols:download-2" />
29
+ {/snippet}
30
+ </TextInput>
31
+ </Story>
32
+
33
+ <Story name="Small" args={{ size: 'small' }}>
34
+ <TextInput size="small">
35
+ {#snippet before()}
36
+ <Icon icon="material-symbols:content-copy" />
37
+ {/snippet}
38
+ </TextInput>
39
+ </Story>
40
+
41
+ <Story name="Large" args={{ size: 'large' }}>
42
+ <TextInput size="large">
43
+ {#snippet before()}
44
+ <Icon icon="material-symbols:content-copy" />
45
+ {/snippet}
46
+ </TextInput>
47
+ </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,43 @@
1
+ import { Meta, Story, Source } from '@storybook/blocks';
2
+ import * as ColorsStories from './Colors.stories.svelte';
3
+ import * as OpacityStories from './Opacity.stories.svelte';
4
+
5
+ <Meta of={ColorsStories} />
6
+
7
+ # Colors
8
+
9
+ We are using an extensive color pallet identical to [Tailwind Css](https://tailwindcss.com/docs/colors) Colors. The colors are adjusted for dark and light themes.
10
+
11
+ ## Main Colors
12
+
13
+ <Story of={ColorsStories.Main} />
14
+
15
+ Neutral pallet
16
+
17
+ <Story of={ColorsStories.ColorsNeutral} />
18
+
19
+ Constant Colors
20
+
21
+ <Story of={ColorsStories.ColorsConstant} />
22
+
23
+ ## Base Color
24
+
25
+ <Story of={ColorsStories.ColorsBase} />
26
+
27
+ Neutral pallet
28
+
29
+ <Story of={ColorsStories.BaseColorsNeutral} />
30
+
31
+ ## Adjusting opacity
32
+
33
+ Opacity can be adjusted using css `color-mix` function.
34
+
35
+ <Source
36
+ dark
37
+ language="css"
38
+ code={`
39
+ color-mix(in oklab, var(--dodo-color-primary-800) 10%, transparent)
40
+ `}
41
+ />
42
+
43
+ <Story of={OpacityStories.Main} meta={OpacityStories} />
@@ -0,0 +1,20 @@
1
+ <script module lang="ts">import { defineMeta } from '@storybook/addon-svelte-csf';
2
+ import Colors from './Colors.svelte';
3
+ // More on how to set up stories at: https://storybook.js.org/docs/writing-stories
4
+ const { Story } = defineMeta({
5
+ component: Colors,
6
+ args: {
7
+ swatchType: 'colors',
8
+ },
9
+ });
10
+ </script>
11
+
12
+ <Story name="Main" />
13
+
14
+ <Story name="ColorsNeutral" args={{ swatchType: 'colors-neutral' }} />
15
+
16
+ <Story name="ColorsConstant" args={{ swatchType: 'colors-constant' }} />
17
+
18
+ <Story name="ColorsBase" args={{ swatchType: 'base-colors' }} />
19
+
20
+ <Story name="BaseColorsNeutral" args={{ swatchType: 'base-colors-neutral' }} />
@@ -0,0 +1,19 @@
1
+ import Colors from './Colors.svelte';
2
+ 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
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
4
+ $$bindings?: Bindings;
5
+ } & Exports;
6
+ (internal: unknown, props: {
7
+ $$events?: Events;
8
+ $$slots?: Slots;
9
+ }): Exports & {
10
+ $set?: any;
11
+ $on?: any;
12
+ };
13
+ z_$$bindings?: Bindings;
14
+ }
15
+ declare const Colors: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
16
+ [evt: string]: CustomEvent<any>;
17
+ }, {}, {}, string>;
18
+ type Colors = InstanceType<typeof Colors>;
19
+ export default Colors;
@@ -0,0 +1,33 @@
1
+ <script lang="ts">import Swatches from './Swatches/Swatches.svelte';
2
+ import { colorPalette, colorPaletteBase, colorPaletteNeutral } from './utils/color.js';
3
+ const { swatchType } = $props();
4
+ </script>
5
+
6
+ <div class="Colors">
7
+ {#if swatchType === 'base-colors'}
8
+ {#each colorPaletteBase as colorPaletteItem (colorPaletteItem)}
9
+ <Swatches colorPalette={colorPaletteItem} prefix="--dodo-color-base-" isColorPaletteValues />
10
+ {/each}
11
+ {:else if swatchType === 'base-colors-neutral'}
12
+ {#each colorPaletteNeutral as colorPaletteItem (colorPaletteItem)}
13
+ <Swatches colorPalette={colorPaletteItem} prefix="--dodo-color-base-" />
14
+ {/each}
15
+ {:else if swatchType === 'colors'}
16
+ {#each colorPalette as colorPaletteItem (colorPaletteItem)}
17
+ <Swatches colorPalette={colorPaletteItem} isColorPaletteValues />
18
+ {/each}
19
+ {:else if swatchType === 'colors-neutral'}
20
+ {#each colorPaletteNeutral as colorPaletteItem (colorPaletteItem)}
21
+ <Swatches colorPalette={colorPaletteItem} />
22
+ {/each}
23
+ {:else if swatchType === 'colors-constant'}
24
+ {#each colorPaletteNeutral as colorPaletteItem (colorPaletteItem)}
25
+ <Swatches colorPalette={colorPaletteItem} prefix="--dodo-color-constant-" />
26
+ {/each}
27
+ {/if}
28
+ </div>
29
+
30
+ <style>.Colors {
31
+ display: flex;
32
+ flex-wrap: wrap;
33
+ }</style>
@@ -0,0 +1,6 @@
1
+ interface ColorsProps {
2
+ swatchType?: 'base-colors' | 'base-colors-neutral' | 'colors' | 'colors-neutral' | 'colors-constant';
3
+ }
4
+ declare const Colors: import("svelte").Component<ColorsProps, {}, "">;
5
+ type Colors = ReturnType<typeof Colors>;
6
+ export default Colors;
@@ -0,0 +1,9 @@
1
+ <script module lang="ts">import { defineMeta } from '@storybook/addon-svelte-csf';
2
+ import Opacity from './Opacity.svelte';
3
+ // More on how to set up stories at: https://storybook.js.org/docs/writing-stories
4
+ const { Story } = defineMeta({
5
+ component: Opacity,
6
+ });
7
+ </script>
8
+
9
+ <Story name="Main" />
@@ -0,0 +1,19 @@
1
+ import Opacity from './Opacity.svelte';
2
+ 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
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
4
+ $$bindings?: Bindings;
5
+ } & Exports;
6
+ (internal: unknown, props: {
7
+ $$events?: Events;
8
+ $$slots?: Slots;
9
+ }): Exports & {
10
+ $set?: any;
11
+ $on?: any;
12
+ };
13
+ z_$$bindings?: Bindings;
14
+ }
15
+ declare const Opacity: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
16
+ [evt: string]: CustomEvent<any>;
17
+ }, {}, {}, string>;
18
+ type Opacity = InstanceType<typeof Opacity>;
19
+ export default Opacity;
@@ -0,0 +1,20 @@
1
+ <script lang="ts">import Palette from './Swatches/Palette.svelte';
2
+ </script>
3
+
4
+ <div class="Opacity">
5
+ <Palette backgroundColor="color-mix(in oklab, var(--dodo-color-primary-800) 10%, transparent)" />
6
+ <Palette backgroundColor="color-mix(in oklab, var(--dodo-color-primary-800) 20%, transparent)" />
7
+ <Palette backgroundColor="color-mix(in oklab, var(--dodo-color-primary-800) 30%, transparent)" />
8
+ <Palette backgroundColor="color-mix(in oklab, var(--dodo-color-primary-800) 40%, transparent)" />
9
+ <Palette backgroundColor="color-mix(in oklab, var(--dodo-color-primary-800) 50%, transparent)" />
10
+ <Palette backgroundColor="color-mix(in oklab, var(--dodo-color-primary-800) 60%, transparent)" />
11
+ <Palette backgroundColor="color-mix(in oklab, var(--dodo-color-primary-800) 70%, transparent)" />
12
+ <Palette backgroundColor="color-mix(in oklab, var(--dodo-color-primary-800) 80%, transparent)" />
13
+ <Palette backgroundColor="color-mix(in oklab, var(--dodo-color-primary-800) 90%, transparent)" />
14
+ <Palette backgroundColor="color-mix(in oklab, var(--dodo-color-primary-800) 100%, transparent)" />
15
+ </div>
16
+
17
+ <style>.Opacity {
18
+ display: flex;
19
+ flex-wrap: wrap;
20
+ }</style>
@@ -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 Opacity: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
15
+ [evt: string]: CustomEvent<any>;
16
+ }, {}, {}, string>;
17
+ type Opacity = InstanceType<typeof Opacity>;
18
+ export default Opacity;
@@ -0,0 +1,15 @@
1
+ <script lang="ts">"use strict";
2
+ const { backgroundColor } = $props();
3
+ </script>
4
+
5
+ <span class="Palette" style={`background-color: ${backgroundColor};`}></span>
6
+
7
+ <style>.Palette {
8
+ display: flex;
9
+ width: 30px;
10
+ height: 30px;
11
+ margin-right: 8px;
12
+ border-radius: 4px;
13
+ border: 1px solid;
14
+ border-color: color-mix(in oklab, var(--dodo-color-default-800) 20%, transparent);
15
+ }</style>
@@ -0,0 +1,6 @@
1
+ interface PaletteProps {
2
+ backgroundColor: string;
3
+ }
4
+ declare const Palette: import("svelte").Component<PaletteProps, {}, "">;
5
+ type Palette = ReturnType<typeof Palette>;
6
+ export default Palette;
@@ -0,0 +1,18 @@
1
+ <script lang="ts">import Palette from './Palette.svelte';
2
+ const { colorPalette, colorPaletteValue, prefix = '--dodo-color-' } = $props();
3
+ </script>
4
+
5
+ <div class="Swatch">
6
+ {#if colorPaletteValue}
7
+ <Palette backgroundColor={`var(${prefix}${colorPalette}-${colorPaletteValue})`} />
8
+ {:else}
9
+ <Palette backgroundColor={`var(${prefix}${colorPalette})`} />
10
+ {/if}
11
+ <div class="colorPaletteValue">{colorPaletteValue}</div>
12
+ </div>
13
+
14
+ <style>.Swatch {
15
+ color: var(--dodo-color-default-900);
16
+ display: flex;
17
+ align-items: center;
18
+ }</style>
@@ -0,0 +1,8 @@
1
+ interface SwatchProps {
2
+ colorPalette: string;
3
+ colorPaletteValue?: string;
4
+ prefix?: string;
5
+ }
6
+ declare const Swatch: import("svelte").Component<SwatchProps, {}, "">;
7
+ type Swatch = ReturnType<typeof Swatch>;
8
+ export default Swatch;
@@ -0,0 +1,39 @@
1
+ <script lang="ts">import { colorPaletteValues } from '../utils/color.js';
2
+ import Swatch from './Swatch.svelte';
3
+ const { colorPalette, prefix, isColorPaletteValues = false } = $props();
4
+ </script>
5
+
6
+ <ul class="Swatches">
7
+ <b>{colorPalette}</b>
8
+
9
+ {#if isColorPaletteValues}
10
+ {#each colorPaletteValues as colorPaletteValue (colorPaletteValue)}
11
+ <li>
12
+ <Swatch {colorPalette} {colorPaletteValue} {prefix} />
13
+ </li>
14
+ {/each}
15
+ {:else}
16
+ <li>
17
+ <Swatch {colorPalette} {prefix} />
18
+ </li>
19
+ {/if}
20
+ </ul>
21
+
22
+ <style>.Swatches {
23
+ color: var(--dodo-color-default-900);
24
+ margin: 0;
25
+ padding: 0;
26
+ width: 100px;
27
+ margin: 16px 0;
28
+ }
29
+ .Swatches b {
30
+ text-transform: capitalize;
31
+ margin-bottom: 16px;
32
+ display: block;
33
+ font-weight: 500;
34
+ }
35
+ .Swatches li {
36
+ display: flex;
37
+ align-items: center;
38
+ margin-bottom: 10px;
39
+ }</style>
@@ -0,0 +1,8 @@
1
+ interface SwatchesProps {
2
+ colorPalette: string;
3
+ prefix?: string;
4
+ isColorPaletteValues?: boolean;
5
+ }
6
+ declare const Swatches: import("svelte").Component<SwatchesProps, {}, "">;
7
+ type Swatches = ReturnType<typeof Swatches>;
8
+ export default Swatches;
@@ -0,0 +1,4 @@
1
+ export declare const colorPaletteBase: string[];
2
+ export declare const colorPaletteNeutral: string[];
3
+ export declare const colorPalette: string[];
4
+ export declare const colorPaletteValues: string[];
@@ -0,0 +1,38 @@
1
+ export const colorPaletteBase = [
2
+ 'red',
3
+ 'orange',
4
+ 'amber',
5
+ 'yellow',
6
+ 'lime',
7
+ 'green',
8
+ 'emerald',
9
+ 'teal',
10
+ 'cyan',
11
+ 'blue',
12
+ 'indigo',
13
+ 'violet',
14
+ 'purple',
15
+ 'fuchsia',
16
+ 'pink',
17
+ 'rose',
18
+ 'slate',
19
+ 'gray',
20
+ 'zinc',
21
+ 'neutral',
22
+ 'stone',
23
+ ];
24
+ export const colorPaletteNeutral = ['black', 'white'];
25
+ export const colorPalette = ['default', 'primary', 'safe', 'warning', 'danger', 'info'];
26
+ export const colorPaletteValues = [
27
+ '50',
28
+ '100',
29
+ '200',
30
+ '300',
31
+ '400',
32
+ '500',
33
+ '600',
34
+ '700',
35
+ '800',
36
+ '900',
37
+ '950',
38
+ ];
@@ -0,0 +1,23 @@
1
+ import { Source } from '@storybook/blocks';
2
+ import darkThemeToggleImage from '../assets/dark-theme-toggle.png';
3
+
4
+ # Themes
5
+
6
+ ## Dark theme
7
+
8
+ dark theme can be activated by adding `.dodo-theme--dark` class on the top container.
9
+
10
+ <Source
11
+ dark
12
+ language="html"
13
+ code={`
14
+ <body class="dodo-theme--dark">
15
+ ...
16
+ `}
17
+ />
18
+
19
+ ## Toggle theme in documentation
20
+
21
+ Use the moon icon to toogle theme in documentation mode
22
+
23
+ <img src={darkThemeToggleImage} />
@@ -1,9 +1,9 @@
1
1
  :root {
2
- /* Base colors */
2
+ /* Neutral colors */
3
3
  --dodo-color-black: var(--dodo-color-base-black);
4
4
  --dodo-color-white: var(--dodo-color-base-white);
5
5
 
6
- /* Base colors constants */
6
+ /* Constants colors */
7
7
  --dodo-color-constant-black: var(--dodo-color-base-black);
8
8
  --dodo-color-constant-white: var(--dodo-color-base-white);
9
9
 
@@ -1,10 +1,11 @@
1
1
  :root {
2
- --dodo-ui-element-height-normal: 40px;
3
2
  --dodo-ui-element-height-small: 34px;
4
- --dodo-ui-element-height-large: 48px;
3
+ --dodo-ui-element-height-normal: 40px;
4
+ --dodo-ui-element-height-large: 50px;
5
+
6
+ --dodo-ui-element-roundness-1x: 7px;
7
+ --dodo-ui-element-roundness-2x: 13px;
8
+ --dodo-ui-element-roundness-3x: 31px;
5
9
 
6
- --dodo-ui-element-roundness-base: 7px;
7
- --dodo-ui-element-roundness-1: var(--dodo-ui-element-roundness-base);
8
- --dodo-ui-element-roundness-2: calc(var(--dodo-ui-element-roundness-base) * 2);
9
- --dodo-ui-element-roundness-3: calc(var(--dodo-ui-element-roundness-base) * 4);
10
+ --dodo-ui-element-border-width: 1px;
10
11
  }
@@ -0,0 +1,3 @@
1
+ * {
2
+ box-sizing: border-box;
3
+ }
@@ -1,3 +1,4 @@
1
+ @import '_minimal-reset.css';
1
2
  @import '_colors-base.css';
2
3
  @import '_colors.css';
3
4
  @import '_breakpoint.css';
package/dist/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  /** Component Size */
2
2
  export type ComponentSize = 'normal' | 'small' | 'large';
3
- export type ComponentRoundness = 1 | 2 | 3;
3
+ export type ComponentRoundness = '1x' | '2x' | '3x';
4
4
  export type ComponentRoundnessFull = 'full';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flightlesslabs/dodo-ui",
3
- "version": "0.1.5",
3
+ "version": "0.3.0",
4
4
  "scripts": {
5
5
  "build": "vite build && pnpm run prepack",
6
6
  "preview": "vite preview",
@@ -29,7 +29,8 @@
29
29
  "!src/lib/**/*.spec.*",
30
30
  "!src/lib/stories/*.stories.*",
31
31
  "!src/lib/stories/*.mdx",
32
- "!src/lib/stories/assets"
32
+ "!src/lib/stories/assets",
33
+ "!src/lib/stories/philosophy"
33
34
  ],
34
35
  "sideEffects": [
35
36
  "**/*.css"
package/src/lib/index.ts CHANGED
@@ -10,3 +10,16 @@ export type {
10
10
  ButtonLinkTarget,
11
11
  ButtonLinkReferrerpolicy,
12
12
  } from '$lib/stories/components/Form/Button/Button.svelte';
13
+
14
+ /** Form: TextInput */
15
+ export { default as TextInput } from '$lib/stories/components/Form/TextInput/TextInput.svelte';
16
+ export type {
17
+ TextInputRoundness,
18
+ TextInputType,
19
+ TextInputFocusEvent,
20
+ TextInputClipboardEvent,
21
+ } from '$lib/stories/components/Form/TextInput/TextInput.svelte';
22
+
23
+ /** Form: PasswordInput */
24
+ export { default as PasswordInput } from '$lib/stories/components/Form/PasswordInput/PasswordInput.svelte';
25
+ export type { PasswordInputToggleEvent } from '$lib/stories/components/Form/PasswordInput/PasswordInput.svelte';
@@ -19,7 +19,7 @@
19
19
  },
20
20
  roundness: {
21
21
  control: { type: 'select' },
22
- options: [false, 1, 2, 3, 'full'],
22
+ options: [false, '1x', '2x', '3x', 'full'],
23
23
  },
24
24
  size: {
25
25
  control: { type: 'select' },
@@ -54,20 +54,25 @@
54
54
  <Button>Click me!</Button>
55
55
  </Story>
56
56
 
57
- <Story name="Disabled" args={{ disabled: true }}>
58
- <Button disabled>Click me!</Button>
59
- </Story>
60
-
61
57
  <!-- Button with border around it -->
62
58
  <Story name="Outline" args={{ outline: true }}>
63
59
  <Button outline>Click me!</Button>
64
60
  </Story>
65
61
 
62
+ <Story name="Disabled" args={{ disabled: true }}>
63
+ <Button disabled>Click me!</Button>
64
+ </Story>
65
+
66
66
  <!-- Form submit button -->
67
67
  <Story name="Sumbit Button" args={{ type: 'submit' }}>
68
68
  <Button type="submit">Submit Form</Button>
69
69
  </Story>
70
70
 
71
+ <!-- Form submit button -->
72
+ <Story name="Full width Button" args={{ fullWidth: true }}>
73
+ <Button fullWidth>Click me!</Button>
74
+ </Story>
75
+
71
76
  <!-- Anchor Link styled like a Button -->
72
77
  <Story
73
78
  name="Link Button"