@flightlesslabs/dodo-ui 0.1.5 → 0.2.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.
- package/dist/stories/Home.mdx +57 -7
- package/dist/stories/assets/dark-theme-toggle.png +0 -0
- package/dist/stories/components/Form/Button/Button.svelte +4 -7
- package/dist/stories/components/Form/Button/Roundness/Roundness.stories.svelte +14 -11
- package/dist/stories/philosophy/Colors/Colors.mdx +43 -0
- package/dist/stories/philosophy/Colors/Colors.stories.svelte +20 -0
- package/dist/stories/philosophy/Colors/Colors.stories.svelte.d.ts +19 -0
- package/dist/stories/philosophy/Colors/Colors.svelte +33 -0
- package/dist/stories/philosophy/Colors/Colors.svelte.d.ts +6 -0
- package/dist/stories/philosophy/Colors/Opacity.stories.svelte +9 -0
- package/dist/stories/philosophy/Colors/Opacity.stories.svelte.d.ts +19 -0
- package/dist/stories/philosophy/Colors/Opacity.svelte +20 -0
- package/dist/stories/philosophy/Colors/Opacity.svelte.d.ts +18 -0
- package/dist/stories/philosophy/Colors/Swatches/Palette.svelte +15 -0
- package/dist/stories/philosophy/Colors/Swatches/Palette.svelte.d.ts +6 -0
- package/dist/stories/philosophy/Colors/Swatches/Swatch.svelte +18 -0
- package/dist/stories/philosophy/Colors/Swatches/Swatch.svelte.d.ts +8 -0
- package/dist/stories/philosophy/Colors/Swatches/Swatches.svelte +39 -0
- package/dist/stories/philosophy/Colors/Swatches/Swatches.svelte.d.ts +8 -0
- package/dist/stories/philosophy/Colors/utils/color.d.ts +4 -0
- package/dist/stories/philosophy/Colors/utils/color.js +38 -0
- package/dist/stories/philosophy/Themes.mdx +23 -0
- package/dist/styles/_colors.css +2 -2
- package/dist/styles/_components.css +4 -4
- package/dist/types.d.ts +1 -1
- package/package.json +3 -2
- package/src/lib/stories/components/Form/Button/Button.svelte +4 -8
- package/src/lib/stories/components/Form/Button/Roundness/Roundness.stories.svelte +14 -11
- package/src/lib/styles/_colors.css +2 -2
- package/src/lib/styles/_components.css +4 -4
- package/src/lib/types.ts +1 -1
- package/dist/stories/Getting Started.mdx +0 -13
package/dist/stories/Home.mdx
CHANGED
|
@@ -1,10 +1,60 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { Source } from '@storybook/blocks';
|
|
2
|
+
import item from '../../../package.json?raw';
|
|
3
|
+
|
|
4
|
+
<main style={{ textAlign: 'center' }}>
|
|
5
|
+
|
|
6
|
+
<img src="dodo-circle-6.png" style={{ width: 200, height: 'auto' }} />
|
|
7
|
+
|
|
8
|
+
# Dodo UI
|
|
9
|
+
|
|
10
|
+
<h3 style={{ fontWeight: 500 }}>v{JSON.parse(item)?.version}</h3>
|
|
11
|
+
|
|
12
|
+
<h3 style={{ fontWeight: 400 }}>An open-source, opinionated UI framework for Svelte.</h3>
|
|
13
|
+
</main>
|
|
14
|
+
|
|
15
|
+
<br />
|
|
16
|
+
<br />
|
|
17
|
+
|
|
18
|
+
## Install
|
|
19
|
+
|
|
20
|
+
pnpm
|
|
21
|
+
|
|
22
|
+
<Source
|
|
23
|
+
dark
|
|
24
|
+
language="bash"
|
|
25
|
+
code={`
|
|
26
|
+
pnpm add @flightlesslabs/dodo-ui
|
|
27
|
+
`}
|
|
4
28
|
/>
|
|
5
29
|
|
|
6
|
-
|
|
30
|
+
npm
|
|
31
|
+
|
|
32
|
+
<Source
|
|
33
|
+
dark
|
|
34
|
+
language="bash"
|
|
35
|
+
code={`
|
|
36
|
+
npm i @flightlesslabs/dodo-ui
|
|
37
|
+
`}
|
|
38
|
+
/>
|
|
39
|
+
|
|
40
|
+
## Use one of the components
|
|
41
|
+
|
|
42
|
+
Lets import [Button](?path=/docs/components-form-button--docs) component
|
|
43
|
+
|
|
44
|
+
<Source
|
|
45
|
+
dark
|
|
46
|
+
language="js"
|
|
47
|
+
code={`
|
|
48
|
+
import { Button } '@flightlesslabs/dodo-ui';
|
|
49
|
+
`}
|
|
50
|
+
/>
|
|
51
|
+
|
|
52
|
+
Checkout documentation for [Button](?path=/docs/components-form-button--docs)
|
|
53
|
+
|
|
54
|
+
## Explore more
|
|
7
55
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
56
|
+
- [Themes](?path=/docs/philosophy-themes--docs)
|
|
57
|
+
- [Colors](?path=/docs/philosophy-colors--docs)
|
|
58
|
+
- [Adjust Color Opacity](?path=/docs/philosophy-colors--docs#adjusting-opacity)
|
|
59
|
+
- [Github](https://github.com/flightlesslabs/dodo-ui)
|
|
60
|
+
- [NPM](https://www.npmjs.com/package/@flightlesslabs/dodo-ui)
|
|
Binary file
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts" module>export {};
|
|
2
2
|
</script>
|
|
3
3
|
|
|
4
|
-
<script lang="ts">const { children, type = 'button', size = 'normal', color = 'default', roundness =
|
|
4
|
+
<script lang="ts">const { children, type = 'button', size = 'normal', color = 'default', roundness = '1x', variant = 'text', outline = false, compact = false, name, id, title, class: className = '', disabled = false, onclick, before, after, href, download, hreflang, media, ping, rel, target, anchorMediaType, referrerpolicy, _unsafeChildrenStringForTesting, } = $props();
|
|
5
5
|
export {};
|
|
6
6
|
</script>
|
|
7
7
|
|
|
@@ -205,18 +205,15 @@ export {};
|
|
|
205
205
|
padding: 0 16px;
|
|
206
206
|
min-width: 85px;
|
|
207
207
|
}
|
|
208
|
-
.dodo-ui-button.roundness--
|
|
208
|
+
.dodo-ui-button.roundness--1x {
|
|
209
209
|
border-radius: var(--dodo-ui-element-roundness-1);
|
|
210
210
|
}
|
|
211
|
-
.dodo-ui-button.roundness--
|
|
211
|
+
.dodo-ui-button.roundness--2x {
|
|
212
212
|
border-radius: var(--dodo-ui-element-roundness-2);
|
|
213
213
|
}
|
|
214
|
-
.dodo-ui-button.roundness--
|
|
214
|
+
.dodo-ui-button.roundness--3x {
|
|
215
215
|
border-radius: var(--dodo-ui-element-roundness-3);
|
|
216
216
|
}
|
|
217
|
-
.dodo-ui-button.roundness--4 {
|
|
218
|
-
border-radius: var(--dodo-ui-element-roundness-4);
|
|
219
|
-
}
|
|
220
217
|
.dodo-ui-button.roundness--full {
|
|
221
218
|
border-radius: 50%;
|
|
222
219
|
}
|
|
@@ -15,23 +15,26 @@
|
|
|
15
15
|
});
|
|
16
16
|
</script>
|
|
17
17
|
|
|
18
|
-
<Story
|
|
19
|
-
|
|
20
|
-
args={{ outline: false, disabled: false, compact: false, roundness: 'full' }}
|
|
21
|
-
>
|
|
22
|
-
<Button roundness="full">Click me!</Button>
|
|
18
|
+
<Story name="Roundness 1x" args={{ outline: false, disabled: false, compact: false }}>
|
|
19
|
+
<Button>Click me!</Button>
|
|
23
20
|
</Story>
|
|
24
21
|
|
|
25
|
-
<Story
|
|
26
|
-
|
|
22
|
+
<Story
|
|
23
|
+
name="Roundness 2x"
|
|
24
|
+
args={{ outline: false, disabled: false, compact: false, roundness: '2x' }}
|
|
25
|
+
>
|
|
26
|
+
<Button roundness="2x">Click me!</Button>
|
|
27
27
|
</Story>
|
|
28
28
|
|
|
29
|
-
<Story
|
|
30
|
-
|
|
29
|
+
<Story
|
|
30
|
+
name="Roundness 3x"
|
|
31
|
+
args={{ outline: false, disabled: false, compact: false, roundness: '3x' }}
|
|
32
|
+
>
|
|
33
|
+
<Button roundness="3x">Click me!</Button>
|
|
31
34
|
</Story>
|
|
32
35
|
|
|
33
36
|
<Story
|
|
34
|
-
name="
|
|
37
|
+
name="Roundness False"
|
|
35
38
|
args={{ outline: false, disabled: false, compact: false, roundness: false }}
|
|
36
39
|
>
|
|
37
40
|
<Button roundness={false}>Click me!</Button>
|
|
@@ -39,7 +42,7 @@
|
|
|
39
42
|
|
|
40
43
|
<!-- Button with 50% roundness usefull for icon (Compact) buttons -->
|
|
41
44
|
<Story
|
|
42
|
-
name="
|
|
45
|
+
name="Roundness Full"
|
|
43
46
|
args={{ outline: false, disabled: false, compact: false, roundness: 'full' }}
|
|
44
47
|
>
|
|
45
48
|
<Button roundness="full">C</Button>
|
|
@@ -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,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,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,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} />
|
package/dist/styles/_colors.css
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
:root {
|
|
2
|
-
/*
|
|
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
|
-
/*
|
|
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,9 +1,9 @@
|
|
|
1
1
|
:root {
|
|
2
|
-
--dodo-ui-element-height-normal:
|
|
3
|
-
--dodo-ui-element-height-small:
|
|
4
|
-
--dodo-ui-element-height-large:
|
|
2
|
+
--dodo-ui-element-height-normal: 2.5rem;
|
|
3
|
+
--dodo-ui-element-height-small: 2.125rem;
|
|
4
|
+
--dodo-ui-element-height-large: 3rem;
|
|
5
5
|
|
|
6
|
-
--dodo-ui-element-roundness-base:
|
|
6
|
+
--dodo-ui-element-roundness-base: 0.438rem;
|
|
7
7
|
--dodo-ui-element-roundness-1: var(--dodo-ui-element-roundness-base);
|
|
8
8
|
--dodo-ui-element-roundness-2: calc(var(--dodo-ui-element-roundness-base) * 2);
|
|
9
9
|
--dodo-ui-element-roundness-3: calc(var(--dodo-ui-element-roundness-base) * 4);
|
package/dist/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flightlesslabs/dodo-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.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"
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
type = 'button',
|
|
78
78
|
size = 'normal',
|
|
79
79
|
color = 'default',
|
|
80
|
-
roundness =
|
|
80
|
+
roundness = '1x',
|
|
81
81
|
variant = 'text',
|
|
82
82
|
outline = false,
|
|
83
83
|
compact = false,
|
|
@@ -241,22 +241,18 @@
|
|
|
241
241
|
}
|
|
242
242
|
|
|
243
243
|
&.roundness {
|
|
244
|
-
&--
|
|
244
|
+
&--1x {
|
|
245
245
|
border-radius: var(--dodo-ui-element-roundness-1);
|
|
246
246
|
}
|
|
247
247
|
|
|
248
|
-
&--
|
|
248
|
+
&--2x {
|
|
249
249
|
border-radius: var(--dodo-ui-element-roundness-2);
|
|
250
250
|
}
|
|
251
251
|
|
|
252
|
-
&--
|
|
252
|
+
&--3x {
|
|
253
253
|
border-radius: var(--dodo-ui-element-roundness-3);
|
|
254
254
|
}
|
|
255
255
|
|
|
256
|
-
&--4 {
|
|
257
|
-
border-radius: var(--dodo-ui-element-roundness-4);
|
|
258
|
-
}
|
|
259
|
-
|
|
260
256
|
&--full {
|
|
261
257
|
border-radius: 50%;
|
|
262
258
|
}
|
|
@@ -15,23 +15,26 @@
|
|
|
15
15
|
});
|
|
16
16
|
</script>
|
|
17
17
|
|
|
18
|
-
<Story
|
|
19
|
-
|
|
20
|
-
args={{ outline: false, disabled: false, compact: false, roundness: 'full' }}
|
|
21
|
-
>
|
|
22
|
-
<Button roundness="full">Click me!</Button>
|
|
18
|
+
<Story name="Roundness 1x" args={{ outline: false, disabled: false, compact: false }}>
|
|
19
|
+
<Button>Click me!</Button>
|
|
23
20
|
</Story>
|
|
24
21
|
|
|
25
|
-
<Story
|
|
26
|
-
|
|
22
|
+
<Story
|
|
23
|
+
name="Roundness 2x"
|
|
24
|
+
args={{ outline: false, disabled: false, compact: false, roundness: '2x' }}
|
|
25
|
+
>
|
|
26
|
+
<Button roundness="2x">Click me!</Button>
|
|
27
27
|
</Story>
|
|
28
28
|
|
|
29
|
-
<Story
|
|
30
|
-
|
|
29
|
+
<Story
|
|
30
|
+
name="Roundness 3x"
|
|
31
|
+
args={{ outline: false, disabled: false, compact: false, roundness: '3x' }}
|
|
32
|
+
>
|
|
33
|
+
<Button roundness="3x">Click me!</Button>
|
|
31
34
|
</Story>
|
|
32
35
|
|
|
33
36
|
<Story
|
|
34
|
-
name="
|
|
37
|
+
name="Roundness False"
|
|
35
38
|
args={{ outline: false, disabled: false, compact: false, roundness: false }}
|
|
36
39
|
>
|
|
37
40
|
<Button roundness={false}>Click me!</Button>
|
|
@@ -39,7 +42,7 @@
|
|
|
39
42
|
|
|
40
43
|
<!-- Button with 50% roundness usefull for icon (Compact) buttons -->
|
|
41
44
|
<Story
|
|
42
|
-
name="
|
|
45
|
+
name="Roundness Full"
|
|
43
46
|
args={{ outline: false, disabled: false, compact: false, roundness: 'full' }}
|
|
44
47
|
>
|
|
45
48
|
<Button roundness="full">C</Button>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
:root {
|
|
2
|
-
/*
|
|
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
|
-
/*
|
|
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,9 +1,9 @@
|
|
|
1
1
|
:root {
|
|
2
|
-
--dodo-ui-element-height-normal:
|
|
3
|
-
--dodo-ui-element-height-small:
|
|
4
|
-
--dodo-ui-element-height-large:
|
|
2
|
+
--dodo-ui-element-height-normal: 2.5rem;
|
|
3
|
+
--dodo-ui-element-height-small: 2.125rem;
|
|
4
|
+
--dodo-ui-element-height-large: 3rem;
|
|
5
5
|
|
|
6
|
-
--dodo-ui-element-roundness-base:
|
|
6
|
+
--dodo-ui-element-roundness-base: 0.438rem;
|
|
7
7
|
--dodo-ui-element-roundness-1: var(--dodo-ui-element-roundness-base);
|
|
8
8
|
--dodo-ui-element-roundness-2: calc(var(--dodo-ui-element-roundness-base) * 2);
|
|
9
9
|
--dodo-ui-element-roundness-3: calc(var(--dodo-ui-element-roundness-base) * 4);
|
package/src/lib/types.ts
CHANGED