@flightlesslabs/dodo-ui 0.17.0-beta-2 → 0.17.2
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 +2 -1
- package/dist/stories/components/Form/Button/Button.svelte +3 -3
- package/dist/stories/components/Form/Button/Button.svelte.d.ts +2 -0
- package/dist/stories/components/Form/Radio/Radio.svelte +0 -1
- package/dist/stories/developer tools/Intro.mdx +1 -0
- package/dist/stories/developer tools/customize/AutoCustomize/AutoCustomize.mdx +4 -0
- package/dist/stories/developer tools/customize/AutoCustomize/Tool/Config/ColorTool/ColorButton.svelte +42 -0
- package/dist/stories/developer tools/customize/AutoCustomize/Tool/Config/ColorTool/ColorButton.svelte.d.ts +8 -0
- package/dist/stories/developer tools/customize/AutoCustomize/Tool/Config/ColorTool/ColorTool.svelte +21 -0
- package/dist/stories/developer tools/customize/AutoCustomize/Tool/Config/ColorTool/ColorTool.svelte.d.ts +9 -0
- package/dist/stories/developer tools/customize/AutoCustomize/Tool/Config/Config.svelte +144 -0
- package/dist/stories/developer tools/customize/AutoCustomize/Tool/Config/Config.svelte.d.ts +18 -0
- package/dist/stories/developer tools/customize/AutoCustomize/Tool/Config/Export.svelte +123 -0
- package/dist/stories/developer tools/customize/AutoCustomize/Tool/Config/Export.svelte.d.ts +18 -0
- package/dist/stories/developer tools/customize/AutoCustomize/Tool/Config/ValueSilder/ValueSilder.svelte +32 -0
- package/dist/stories/developer tools/customize/AutoCustomize/Tool/Config/ValueSilder/ValueSilder.svelte.d.ts +11 -0
- package/dist/stories/developer tools/customize/AutoCustomize/Tool/Preview/Preview.svelte +192 -0
- package/dist/stories/developer tools/customize/AutoCustomize/Tool/Preview/Preview.svelte.d.ts +3 -0
- package/dist/stories/developer tools/customize/AutoCustomize/Tool/Tool.stories.svelte +9 -0
- package/dist/stories/developer tools/customize/AutoCustomize/Tool/Tool.stories.svelte.d.ts +19 -0
- package/dist/stories/developer tools/customize/AutoCustomize/Tool/Tool.svelte +13 -0
- package/dist/stories/developer tools/customize/AutoCustomize/Tool/Tool.svelte.d.ts +18 -0
- package/dist/stories/developer tools/customize/AutoCustomize/Tool/helpers/download-file.d.ts +1 -0
- package/dist/stories/developer tools/customize/AutoCustomize/Tool/helpers/download-file.js +10 -0
- package/dist/stories/developer tools/customize/AutoCustomize/Tool/stores/config.svelte.d.ts +27 -0
- package/dist/stories/developer tools/customize/AutoCustomize/Tool/stores/config.svelte.js +70 -0
- package/dist/stories/developer tools/customize/Intro.mdx +8 -0
- package/dist/styles/_colors.css +1 -1
- package/package.json +16 -14
- package/src/lib/stories/components/Form/Button/Button.svelte +5 -2
- package/src/lib/stories/components/Form/Radio/Radio.svelte +0 -1
- package/src/lib/stories/developer tools/customize/AutoCustomize/Tool/Config/ColorTool/ColorButton.svelte +56 -0
- package/src/lib/stories/developer tools/customize/AutoCustomize/Tool/Config/ColorTool/ColorTool.svelte +32 -0
- package/src/lib/stories/developer tools/customize/AutoCustomize/Tool/Config/Config.svelte +149 -0
- package/src/lib/stories/developer tools/customize/AutoCustomize/Tool/Config/Export.svelte +172 -0
- package/src/lib/stories/developer tools/customize/AutoCustomize/Tool/Config/ValueSilder/ValueSilder.svelte +47 -0
- package/src/lib/stories/developer tools/customize/AutoCustomize/Tool/Preview/Preview.svelte +227 -0
- package/src/lib/stories/developer tools/customize/AutoCustomize/Tool/Tool.svelte +16 -0
- package/src/lib/stories/developer tools/customize/AutoCustomize/Tool/helpers/download-file.ts +11 -0
- package/src/lib/stories/developer tools/customize/AutoCustomize/Tool/stores/config.svelte.ts +107 -0
- package/src/lib/styles/_colors.css +1 -1
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
<script lang="ts">import Button from '../../../../../components/Form/Button/Button.svelte';
|
|
2
|
+
import RangeSlider from '../../../../../components/Form/RangeSlider/RangeSlider.svelte';
|
|
3
|
+
import Column from '../../../../../components/Layout/Grid/Column/Column.svelte';
|
|
4
|
+
import Grid from '../../../../../components/Layout/Grid/Grid.svelte';
|
|
5
|
+
import Paper from '../../../../../components/Layout/Paper/Paper.svelte';
|
|
6
|
+
import { colorPalette, colorPaletteValues, } from '../../../../philosophy/Colors/utils/color.js';
|
|
7
|
+
import { useAutoCustomizeConfigStore, } from '../stores/config.svelte.js';
|
|
8
|
+
let cssVariables = $state([]);
|
|
9
|
+
$effect(() => {
|
|
10
|
+
const newCssvariables = [];
|
|
11
|
+
for (let index = 0; index < colorPalette.length; index++) {
|
|
12
|
+
const colorName = colorPalette[index];
|
|
13
|
+
const fieldName = `${colorName}`;
|
|
14
|
+
const dataPoint = useAutoCustomizeConfigStore.data.colors &&
|
|
15
|
+
useAutoCustomizeConfigStore.data.colors[fieldName]
|
|
16
|
+
? useAutoCustomizeConfigStore.data.colors[fieldName]
|
|
17
|
+
: undefined;
|
|
18
|
+
if (dataPoint) {
|
|
19
|
+
for (let index = 0; index < colorPaletteValues.length; index++) {
|
|
20
|
+
const weight = colorPaletteValues[index];
|
|
21
|
+
newCssvariables.push(`--dodo-color-${colorName}-${weight}: var(--dodo-color-base-${dataPoint}-${weight})`);
|
|
22
|
+
}
|
|
23
|
+
newCssvariables.push(...[
|
|
24
|
+
`--dodo-ui-Button-outline-${colorName}: var(--dodo-color-base-${dataPoint}-400)`,
|
|
25
|
+
`--dodo-ui-Button-text-${colorName}-bg: var(--dodo-color-base-${dataPoint}-100)`,
|
|
26
|
+
`--dodo-ui-Button-text-${colorName}-hover-bg: var(--dodo-color-base-${dataPoint}-200)`,
|
|
27
|
+
`--dodo-ui-Button-text-${colorName}-active-bg: var(--dodo-color-base-${dataPoint}-300)`,
|
|
28
|
+
`--dodo-ui-Button-solid-${colorName}-bg: var(--dodo-color-base-${dataPoint}-500)`,
|
|
29
|
+
`--dodo-ui-Button-solid-${colorName}-hover-bg: var(--dodo-color-base-${dataPoint}-600)`,
|
|
30
|
+
`--dodo-ui-Button-solid-${colorName}-active-bg: var(--dodo-color-base-${dataPoint}-700)`,
|
|
31
|
+
`--dodo-ui-RangeSlider-thumb-${colorName}-bg: var(--dodo-color-base-${dataPoint}-500)`,
|
|
32
|
+
`--dodo-ui-RangeSlider-thumb-${colorName}-hover-bg: var(--dodo-color-base-${dataPoint}-600)`,
|
|
33
|
+
`--dodo-ui-RangeSlider-thumb-${colorName}-active-bg: var(--dodo-color-base-${dataPoint}-700)`,
|
|
34
|
+
`--dodo-ui-RangeSlider-track-filled-${colorName}-bg: var(--dodo-color-base-${dataPoint}-500)`,
|
|
35
|
+
]);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (useAutoCustomizeConfigStore.data.components?.roundness) {
|
|
39
|
+
const roundness = useAutoCustomizeConfigStore.data.components.roundness / 8;
|
|
40
|
+
newCssvariables.push(`--dodo-ui-element-roundness-1: ${0.4375 + roundness}em`);
|
|
41
|
+
newCssvariables.push(`--dodo-ui-element-roundness-2: ${0.8125 + roundness}em`);
|
|
42
|
+
newCssvariables.push(`--dodo-ui-element-roundness-3: ${1.9375 + roundness}em`);
|
|
43
|
+
}
|
|
44
|
+
if (useAutoCustomizeConfigStore.data.components?.elementHeight) {
|
|
45
|
+
const elementHeight = useAutoCustomizeConfigStore.data.components.elementHeight + 2;
|
|
46
|
+
const elementHeightTrack = useAutoCustomizeConfigStore.data.components.elementHeight / 2;
|
|
47
|
+
newCssvariables.push(`--dodo-ui-element-height-small: ${34 + elementHeight}px`);
|
|
48
|
+
newCssvariables.push(`--dodo-ui-element-height-normal: ${40 + elementHeight}px`);
|
|
49
|
+
newCssvariables.push(`--dodo-ui-element-height-large: ${50 + elementHeight}px`);
|
|
50
|
+
newCssvariables.push(`--dodo-ui-track-element-height-small: ${6 + elementHeightTrack}px`);
|
|
51
|
+
newCssvariables.push(`--dodo-ui-track-element-height-normal: ${8 + elementHeightTrack}px`);
|
|
52
|
+
newCssvariables.push(`--dodo-ui-track-element-height-large: ${10 + elementHeightTrack}px`);
|
|
53
|
+
}
|
|
54
|
+
if (useAutoCustomizeConfigStore.data.components?.borderWidth) {
|
|
55
|
+
const borderWidth = useAutoCustomizeConfigStore.data.components.borderWidth;
|
|
56
|
+
newCssvariables.push(`--dodo-ui-element-border-width: ${1 + borderWidth}px`);
|
|
57
|
+
}
|
|
58
|
+
if (useAutoCustomizeConfigStore.data.space) {
|
|
59
|
+
const space = useAutoCustomizeConfigStore.data.space;
|
|
60
|
+
newCssvariables.push(`--dodo-ui-space-small: ${6 + space}px`);
|
|
61
|
+
newCssvariables.push(`--dodo-ui-space: ${8 + space}px`);
|
|
62
|
+
newCssvariables.push(`--dodo-ui-space-large: ${10 + space}px`);
|
|
63
|
+
}
|
|
64
|
+
cssVariables = [...newCssvariables];
|
|
65
|
+
});
|
|
66
|
+
</script>
|
|
67
|
+
|
|
68
|
+
<div class="Preview" style={cssVariables.join(';')}>
|
|
69
|
+
<div class="section">
|
|
70
|
+
<div class="column">
|
|
71
|
+
<Button>Primary</Button>
|
|
72
|
+
</div>
|
|
73
|
+
<div class="column">
|
|
74
|
+
<Button color="secondary">Secondary</Button>
|
|
75
|
+
</div>
|
|
76
|
+
<div class="column">
|
|
77
|
+
<Button color="neutral">Neutral</Button>
|
|
78
|
+
</div>
|
|
79
|
+
<div class="column">
|
|
80
|
+
<Button color="safe">Safe</Button>
|
|
81
|
+
</div>
|
|
82
|
+
<div class="column">
|
|
83
|
+
<Button color="warning">Warning</Button>
|
|
84
|
+
</div>
|
|
85
|
+
<div class="column">
|
|
86
|
+
<Button color="danger">Danger</Button>
|
|
87
|
+
</div>
|
|
88
|
+
</div>
|
|
89
|
+
|
|
90
|
+
<div class="section">
|
|
91
|
+
<div class="column">
|
|
92
|
+
<Button variant="text" outline>Primary</Button>
|
|
93
|
+
</div>
|
|
94
|
+
<div class="column">
|
|
95
|
+
<Button variant="text" outline color="secondary">Secondary</Button>
|
|
96
|
+
</div>
|
|
97
|
+
<div class="column">
|
|
98
|
+
<Button variant="text" outline color="neutral">Neutral</Button>
|
|
99
|
+
</div>
|
|
100
|
+
<div class="column">
|
|
101
|
+
<Button variant="text" outline color="safe">Safe</Button>
|
|
102
|
+
</div>
|
|
103
|
+
<div class="column">
|
|
104
|
+
<Button variant="text" outline color="warning">Warning</Button>
|
|
105
|
+
</div>
|
|
106
|
+
<div class="column">
|
|
107
|
+
<Button variant="text" outline color="danger">Danger</Button>
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
|
|
111
|
+
<div class="section">
|
|
112
|
+
<div class="column">
|
|
113
|
+
<Paper shadow={1} width="150px" height="180px">
|
|
114
|
+
<div style="padding: var(--dodo-ui-space)">Hola!</div>
|
|
115
|
+
</Paper>
|
|
116
|
+
</div>
|
|
117
|
+
<div class="column">
|
|
118
|
+
<RangeSlider value={50} min={20} max={70} />
|
|
119
|
+
</div>
|
|
120
|
+
</div>
|
|
121
|
+
|
|
122
|
+
<div class="section">
|
|
123
|
+
<Grid class="GridSection">
|
|
124
|
+
<Column md={6}>
|
|
125
|
+
<Paper shadow={1}>
|
|
126
|
+
<div style="padding: var(--dodo-ui-space)">Hola!</div>
|
|
127
|
+
</Paper>
|
|
128
|
+
</Column>
|
|
129
|
+
<Column md={6}>
|
|
130
|
+
<Paper shadow={1}>
|
|
131
|
+
<div style="padding: var(--dodo-ui-space)">Hola!</div>
|
|
132
|
+
</Paper>
|
|
133
|
+
</Column>
|
|
134
|
+
<Column md={4}>
|
|
135
|
+
<Paper shadow={1}>
|
|
136
|
+
<div style="padding: var(--dodo-ui-space)">Hola!</div>
|
|
137
|
+
</Paper>
|
|
138
|
+
</Column>
|
|
139
|
+
<Column md={3}>
|
|
140
|
+
<Paper shadow={1}>
|
|
141
|
+
<div style="padding: var(--dodo-ui-space)">Hola!</div>
|
|
142
|
+
</Paper>
|
|
143
|
+
</Column>
|
|
144
|
+
<Column md={2}>
|
|
145
|
+
<Paper shadow={1}>
|
|
146
|
+
<div style="padding: var(--dodo-ui-space)">Hola!</div>
|
|
147
|
+
</Paper>
|
|
148
|
+
</Column>
|
|
149
|
+
<Column md={3}>
|
|
150
|
+
<Paper shadow={1}>
|
|
151
|
+
<div style="padding: var(--dodo-ui-space)">Hola!</div>
|
|
152
|
+
</Paper>
|
|
153
|
+
</Column>
|
|
154
|
+
</Grid>
|
|
155
|
+
</div>
|
|
156
|
+
</div>
|
|
157
|
+
|
|
158
|
+
<style>:global(:root) {
|
|
159
|
+
--AutoCustomize-Preview-bgColor: var(--dodo-color-base-gray-100);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
:global(.dodo-theme--dark) {
|
|
163
|
+
--AutoCustomize-Preview-bgColor: var(--dodo-color-base-gray-800);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.Preview {
|
|
167
|
+
background-color: var(--AutoCustomize-Preview-bgColor);
|
|
168
|
+
padding: calc(var(--dodo-ui-space) * 2);
|
|
169
|
+
border-radius: var(--dodo-ui-element-roundness-2);
|
|
170
|
+
width: 100%;
|
|
171
|
+
}
|
|
172
|
+
@media (min-width: 64rem) {
|
|
173
|
+
.Preview {
|
|
174
|
+
flex: 1;
|
|
175
|
+
width: initial;
|
|
176
|
+
height: calc(100vh - 130px);
|
|
177
|
+
overflow: auto;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
.Preview .section {
|
|
181
|
+
width: 100%;
|
|
182
|
+
margin: var(--dodo-ui-space) 0;
|
|
183
|
+
display: flex;
|
|
184
|
+
flex-wrap: wrap;
|
|
185
|
+
}
|
|
186
|
+
.Preview .column {
|
|
187
|
+
margin: 4px;
|
|
188
|
+
display: inline-flex;
|
|
189
|
+
}
|
|
190
|
+
.Preview :global(.GridSection) {
|
|
191
|
+
width: 100%;
|
|
192
|
+
}</style>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<script module lang="ts">import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
2
|
+
import Tool from './Tool.svelte';
|
|
3
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
4
|
+
const { Story } = defineMeta({
|
|
5
|
+
component: Tool,
|
|
6
|
+
});
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<Story name="Main" />
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import Tool from './Tool.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 Tool: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
16
|
+
[evt: string]: CustomEvent<any>;
|
|
17
|
+
}, {}, {}, string>;
|
|
18
|
+
type Tool = InstanceType<typeof Tool>;
|
|
19
|
+
export default Tool;
|
|
@@ -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 Tool: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
}, {}, {}, string>;
|
|
17
|
+
type Tool = InstanceType<typeof Tool>;
|
|
18
|
+
export default Tool;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function downloadFile(fileName: string, data: Blob): Promise<void>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export type AutoCustomizeConfigDataColors = {
|
|
2
|
+
primary?: string;
|
|
3
|
+
secondary?: string;
|
|
4
|
+
neutral?: string;
|
|
5
|
+
safe?: string;
|
|
6
|
+
warning?: string;
|
|
7
|
+
danger?: string;
|
|
8
|
+
};
|
|
9
|
+
export type AutoCustomizeConfigDataComponents = {
|
|
10
|
+
roundness?: number;
|
|
11
|
+
elementHeight?: number;
|
|
12
|
+
borderWidth?: number;
|
|
13
|
+
};
|
|
14
|
+
export type AutoCustomizeConfigData = {
|
|
15
|
+
colors?: AutoCustomizeConfigDataColors;
|
|
16
|
+
components?: AutoCustomizeConfigDataComponents;
|
|
17
|
+
space?: number;
|
|
18
|
+
};
|
|
19
|
+
export declare const autoCustomizeConfigdefaultData: AutoCustomizeConfigData;
|
|
20
|
+
export declare const useAutoCustomizeConfigStore: {
|
|
21
|
+
readonly data: AutoCustomizeConfigData;
|
|
22
|
+
readonly updatedAt: number;
|
|
23
|
+
updateData(newData: Partial<AutoCustomizeConfigData>): void;
|
|
24
|
+
updateDataColor(newData: Partial<AutoCustomizeConfigDataColors>): void;
|
|
25
|
+
updateDataComponents(newData: Partial<AutoCustomizeConfigDataComponents>): void;
|
|
26
|
+
reset(): void;
|
|
27
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { browser } from '$app/environment';
|
|
2
|
+
const AUTO_CUSTOMIZE_TOOL_CONFIG = 'AUTO_CUSTOMIZE_TOOL_CONFIG';
|
|
3
|
+
export const autoCustomizeConfigdefaultData = {
|
|
4
|
+
colors: {
|
|
5
|
+
primary: 'violet',
|
|
6
|
+
secondary: 'blue',
|
|
7
|
+
neutral: 'gray',
|
|
8
|
+
safe: 'emerald',
|
|
9
|
+
warning: 'amber',
|
|
10
|
+
danger: 'red',
|
|
11
|
+
},
|
|
12
|
+
components: {
|
|
13
|
+
roundness: 0,
|
|
14
|
+
elementHeight: 0,
|
|
15
|
+
borderWidth: 0,
|
|
16
|
+
},
|
|
17
|
+
space: 0,
|
|
18
|
+
};
|
|
19
|
+
function getDefaultData() {
|
|
20
|
+
if (!browser) {
|
|
21
|
+
return autoCustomizeConfigdefaultData;
|
|
22
|
+
}
|
|
23
|
+
let values = JSON.parse(localStorage.getItem(AUTO_CUSTOMIZE_TOOL_CONFIG) || `{}`);
|
|
24
|
+
values = { ...autoCustomizeConfigdefaultData, ...values };
|
|
25
|
+
return values;
|
|
26
|
+
}
|
|
27
|
+
function createAutoCustomizeConfigStore() {
|
|
28
|
+
let updatedAt = $state(Date.now());
|
|
29
|
+
let data = $state(getDefaultData());
|
|
30
|
+
return {
|
|
31
|
+
get data() {
|
|
32
|
+
return data;
|
|
33
|
+
},
|
|
34
|
+
get updatedAt() {
|
|
35
|
+
return updatedAt;
|
|
36
|
+
},
|
|
37
|
+
updateData(newData) {
|
|
38
|
+
data = {
|
|
39
|
+
...data,
|
|
40
|
+
...newData,
|
|
41
|
+
};
|
|
42
|
+
updatedAt = Date.now();
|
|
43
|
+
if (browser) {
|
|
44
|
+
localStorage.setItem(AUTO_CUSTOMIZE_TOOL_CONFIG, JSON.stringify(newData));
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
updateDataColor(newData) {
|
|
48
|
+
const colors = {
|
|
49
|
+
...data.colors,
|
|
50
|
+
...newData,
|
|
51
|
+
};
|
|
52
|
+
this.updateData({ colors });
|
|
53
|
+
},
|
|
54
|
+
updateDataComponents(newData) {
|
|
55
|
+
const components = {
|
|
56
|
+
...data.components,
|
|
57
|
+
...newData,
|
|
58
|
+
};
|
|
59
|
+
this.updateData({ components });
|
|
60
|
+
},
|
|
61
|
+
reset() {
|
|
62
|
+
data = autoCustomizeConfigdefaultData;
|
|
63
|
+
updatedAt = Date.now();
|
|
64
|
+
if (browser) {
|
|
65
|
+
localStorage.setItem(AUTO_CUSTOMIZE_TOOL_CONFIG, JSON.stringify(autoCustomizeConfigdefaultData));
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
export const useAutoCustomizeConfigStore = createAutoCustomizeConfigStore();
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Customize
|
|
2
|
+
|
|
3
|
+
Use our [Auto Customize](?path=/docs/developer-tools-customize-autocustomize--docs) to modify the look and feel of the components.
|
|
4
|
+
|
|
5
|
+
## Explore More
|
|
6
|
+
|
|
7
|
+
- [Tailwind CSS Color Generator](https://uicolors.app/generate/)
|
|
8
|
+
- [Colors](?path=/docs/developer-tools-philosophy-colors--docs)
|
package/dist/styles/_colors.css
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
--dodo-color-constant-black: var(--dodo-color-base-black);
|
|
8
8
|
--dodo-color-constant-white: var(--dodo-color-base-white);
|
|
9
9
|
|
|
10
|
-
/*
|
|
10
|
+
/* Neutral color */
|
|
11
11
|
--dodo-color-neutral-50: var(--dodo-color-base-gray-50);
|
|
12
12
|
--dodo-color-neutral-100: var(--dodo-color-base-gray-100);
|
|
13
13
|
--dodo-color-neutral-200: var(--dodo-color-base-gray-200);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flightlesslabs/dodo-ui",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.2",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"copy-css": "cpy src/lib/styles/global.css dist/styles --parents",
|
|
6
6
|
"build": "vite build && pnpm copy-css && pnpm run prepack",
|
|
@@ -52,37 +52,38 @@
|
|
|
52
52
|
"svelte": "^5.0.0"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@chromatic-com/storybook": "4.0
|
|
55
|
+
"@chromatic-com/storybook": "4.1.0",
|
|
56
56
|
"@eslint/compat": "^1.3.1",
|
|
57
57
|
"@eslint/js": "^9.32.0",
|
|
58
|
-
"@storybook/addon-docs": "^9.
|
|
58
|
+
"@storybook/addon-docs": "^9.1.1",
|
|
59
59
|
"@storybook/addon-svelte-csf": "5.0.7",
|
|
60
|
-
"@storybook/addon-vitest": "^9.
|
|
61
|
-
"@storybook/sveltekit": "^9.
|
|
60
|
+
"@storybook/addon-vitest": "^9.1.1",
|
|
61
|
+
"@storybook/sveltekit": "^9.1.1",
|
|
62
62
|
"@sveltejs/adapter-static": "^3.0.8",
|
|
63
|
-
"@sveltejs/kit": "^2.
|
|
63
|
+
"@sveltejs/kit": "^2.27.0",
|
|
64
64
|
"@sveltejs/package": "^2.4.0",
|
|
65
65
|
"@sveltejs/vite-plugin-svelte": "^6.1.0",
|
|
66
|
+
"@types/file-saver": "^2.0.7",
|
|
66
67
|
"@vitest/browser": "^3.2.4",
|
|
67
68
|
"@vitest/coverage-v8": "^3.2.4",
|
|
68
69
|
"@vueless/storybook-dark-mode": "^9.0.6",
|
|
69
70
|
"cpy-cli": "^5.0.0",
|
|
70
71
|
"eslint": "^9.32.0",
|
|
71
72
|
"eslint-config-prettier": "^10.1.8",
|
|
72
|
-
"eslint-plugin-storybook": "9.
|
|
73
|
+
"eslint-plugin-storybook": "9.1.1",
|
|
73
74
|
"eslint-plugin-svelte": "^3.11.0",
|
|
74
75
|
"globals": "^16.3.0",
|
|
75
|
-
"playwright": "^1.54.
|
|
76
|
+
"playwright": "^1.54.2",
|
|
76
77
|
"prettier": "^3.6.2",
|
|
77
78
|
"prettier-plugin-svelte": "^3.4.0",
|
|
78
79
|
"publint": "^0.3.12",
|
|
79
80
|
"sass": "^1.89.2",
|
|
80
|
-
"storybook": "^9.
|
|
81
|
-
"svelte": "^5.37.
|
|
82
|
-
"svelte-check": "^4.3.
|
|
81
|
+
"storybook": "^9.1.1",
|
|
82
|
+
"svelte": "^5.37.3",
|
|
83
|
+
"svelte-check": "^4.3.1",
|
|
83
84
|
"svelte-preprocess": "^6.0.3",
|
|
84
|
-
"typescript": "^5.
|
|
85
|
-
"typescript-eslint": "^8.
|
|
85
|
+
"typescript": "^5.9.2",
|
|
86
|
+
"typescript-eslint": "^8.39.0",
|
|
86
87
|
"vite": "^7.0.6",
|
|
87
88
|
"vitest": "^3.2.4"
|
|
88
89
|
},
|
|
@@ -95,6 +96,7 @@
|
|
|
95
96
|
},
|
|
96
97
|
"dependencies": {
|
|
97
98
|
"@iconify/svelte": "^5.0.1",
|
|
98
|
-
"dayjs": "^1.11.13"
|
|
99
|
+
"dayjs": "^1.11.13",
|
|
100
|
+
"file-saver": "^2.0.5"
|
|
99
101
|
}
|
|
100
102
|
}
|
|
@@ -60,6 +60,8 @@
|
|
|
60
60
|
class?: string;
|
|
61
61
|
/** The onclick event handler */
|
|
62
62
|
onclick?: MouseEventHandler<HTMLButtonElement>;
|
|
63
|
+
/** Aria label */
|
|
64
|
+
'aria-label'?: string;
|
|
63
65
|
/** Turn Button into link */
|
|
64
66
|
href?: string;
|
|
65
67
|
/** Link button: download */
|
|
@@ -101,6 +103,7 @@
|
|
|
101
103
|
onclick,
|
|
102
104
|
before,
|
|
103
105
|
after,
|
|
106
|
+
'aria-label': ariaLabel,
|
|
104
107
|
href,
|
|
105
108
|
download,
|
|
106
109
|
hreflang,
|
|
@@ -145,6 +148,7 @@
|
|
|
145
148
|
{target}
|
|
146
149
|
type={anchorMediaType}
|
|
147
150
|
{referrerpolicy}
|
|
151
|
+
aria-label={ariaLabel}
|
|
148
152
|
class:outline
|
|
149
153
|
class:compact
|
|
150
154
|
class:disabled
|
|
@@ -166,6 +170,7 @@
|
|
|
166
170
|
class:outline
|
|
167
171
|
class:compact
|
|
168
172
|
class:fullWidth
|
|
173
|
+
aria-label={ariaLabel}
|
|
169
174
|
class={[
|
|
170
175
|
'dodo-ui-Button',
|
|
171
176
|
`size--${size}`,
|
|
@@ -215,7 +220,6 @@
|
|
|
215
220
|
|
|
216
221
|
.dodo-ui-Button {
|
|
217
222
|
cursor: pointer;
|
|
218
|
-
outline: none;
|
|
219
223
|
transition: all 150ms;
|
|
220
224
|
text-decoration: none;
|
|
221
225
|
margin: 0;
|
|
@@ -227,7 +231,6 @@
|
|
|
227
231
|
border-style: solid;
|
|
228
232
|
border-width: var(--dodo-ui-element-border-width);
|
|
229
233
|
border-color: transparent;
|
|
230
|
-
outline: 0;
|
|
231
234
|
color: inherit;
|
|
232
235
|
letter-spacing: 0.3px;
|
|
233
236
|
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import Icon from '@iconify/svelte';
|
|
3
|
+
|
|
4
|
+
interface ColorButtonProps {
|
|
5
|
+
color: string;
|
|
6
|
+
selectedColor?: string;
|
|
7
|
+
onclick?: (color: string) => void;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const { color, selectedColor, onclick }: ColorButtonProps = $props();
|
|
11
|
+
|
|
12
|
+
function onClickMod() {
|
|
13
|
+
if (onclick) {
|
|
14
|
+
onclick(color);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<button
|
|
20
|
+
class="ColorButton"
|
|
21
|
+
class:selectedColor={selectedColor === color}
|
|
22
|
+
onclick={onClickMod}
|
|
23
|
+
aria-label={`color button ${color}`}
|
|
24
|
+
style={`background-color: var(--dodo-color-base-${color}-400);`}
|
|
25
|
+
>
|
|
26
|
+
<Icon icon="material-symbols:check-small" width="24" height="24" />
|
|
27
|
+
</button>
|
|
28
|
+
|
|
29
|
+
<style lang="scss">
|
|
30
|
+
.ColorButton {
|
|
31
|
+
width: 22px;
|
|
32
|
+
height: 22px;
|
|
33
|
+
border-radius: 50%;
|
|
34
|
+
margin: 4px;
|
|
35
|
+
cursor: pointer;
|
|
36
|
+
color: var(--dodo-color-constant-white);
|
|
37
|
+
display: inline-flex;
|
|
38
|
+
align-items: center;
|
|
39
|
+
justify-content: center;
|
|
40
|
+
position: relative;
|
|
41
|
+
border: 3px solid transparent;
|
|
42
|
+
|
|
43
|
+
:global(svg) {
|
|
44
|
+
position: absolute;
|
|
45
|
+
display: none;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&.selectedColor {
|
|
49
|
+
border-color: var(--dodo-color-primary-600);
|
|
50
|
+
|
|
51
|
+
:global(svg) {
|
|
52
|
+
display: block;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
</style>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import FormControl from '$lib/stories/components/Form/FormControl/FormControl.svelte';
|
|
3
|
+
import { colorPaletteBase } from '$lib/stories/developer tools/philosophy/Colors/utils/color.js';
|
|
4
|
+
import ColorButton from './ColorButton.svelte';
|
|
5
|
+
|
|
6
|
+
interface ColorToolProps {
|
|
7
|
+
label?: string;
|
|
8
|
+
colors?: string[];
|
|
9
|
+
selectedColor?: string;
|
|
10
|
+
onclick?: (color: string) => void;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const { colors = colorPaletteBase, selectedColor, onclick, label }: ColorToolProps = $props();
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<div class="ColorTool">
|
|
17
|
+
<FormControl {label}>
|
|
18
|
+
{#each colors as color (color)}
|
|
19
|
+
<ColorButton {color} {onclick} {selectedColor} />
|
|
20
|
+
{/each}
|
|
21
|
+
</FormControl>
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
<style lang="scss">
|
|
25
|
+
.ColorTool {
|
|
26
|
+
display: flex;
|
|
27
|
+
flex-wrap: wrap;
|
|
28
|
+
margin-bottom: calc(var(--dodo-ui-space) * 2.5);
|
|
29
|
+
margin-left: -4px;
|
|
30
|
+
margin-right: -4px;
|
|
31
|
+
}
|
|
32
|
+
</style>
|