@flightlesslabs/dodo-ui 0.17.1 → 0.18.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/index.d.ts +5 -1
- package/dist/index.js +2 -0
- package/dist/stories/Home.mdx +2 -1
- package/dist/stories/components/Form/Button/Button.svelte +0 -2
- package/dist/stories/components/Form/Radio/Radio.svelte +0 -1
- package/dist/stories/components/Form/Select/Select.svelte.d.ts +2 -2
- package/dist/stories/components/Layout/Accordian/Accordian.stories.svelte +52 -0
- package/dist/stories/components/Layout/Accordian/Accordian.stories.svelte.d.ts +21 -0
- package/dist/stories/components/Layout/Accordian/Accordian.svelte +121 -0
- package/dist/stories/components/Layout/Accordian/Accordian.svelte.d.ts +34 -0
- package/dist/stories/components/Layout/Accordian/Customize/Customize.stories.svelte +69 -0
- package/dist/stories/components/Layout/Accordian/Customize/Customize.stories.svelte.d.ts +18 -0
- package/dist/stories/components/Layout/Accordian/Events/Events.stories.svelte +30 -0
- package/dist/stories/components/Layout/Accordian/Events/Events.stories.svelte.d.ts +18 -0
- package/dist/stories/components/Layout/Accordian/Size/Size.stories.svelte +48 -0
- package/dist/stories/components/Layout/Accordian/Size/Size.stories.svelte.d.ts +26 -0
- 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/dist/types/special.d.ts +1 -0
- package/dist/types/special.js +1 -0
- package/package.json +8 -6
- package/src/lib/index.ts +10 -5
- package/src/lib/stories/components/Form/Button/Button.svelte +0 -2
- package/src/lib/stories/components/Form/Radio/Radio.svelte +0 -1
- package/src/lib/stories/components/Form/Select/Select.svelte +2 -3
- package/src/lib/stories/components/Layout/Accordian/Accordian.svelte +195 -0
- 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
- package/src/lib/types/special.ts +1 -0
|
@@ -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);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type DropdownArrowPosition = false | 'before' | 'after';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flightlesslabs/dodo-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
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",
|
|
@@ -60,9 +60,10 @@
|
|
|
60
60
|
"@storybook/addon-vitest": "^9.1.1",
|
|
61
61
|
"@storybook/sveltekit": "^9.1.1",
|
|
62
62
|
"@sveltejs/adapter-static": "^3.0.8",
|
|
63
|
-
"@sveltejs/kit": "^2.27.
|
|
63
|
+
"@sveltejs/kit": "^2.27.1",
|
|
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",
|
|
@@ -76,14 +77,14 @@
|
|
|
76
77
|
"prettier": "^3.6.2",
|
|
77
78
|
"prettier-plugin-svelte": "^3.4.0",
|
|
78
79
|
"publint": "^0.3.12",
|
|
79
|
-
"sass": "^1.
|
|
80
|
+
"sass": "^1.90.0",
|
|
80
81
|
"storybook": "^9.1.1",
|
|
81
|
-
"svelte": "^5.
|
|
82
|
+
"svelte": "^5.38.0",
|
|
82
83
|
"svelte-check": "^4.3.1",
|
|
83
84
|
"svelte-preprocess": "^6.0.3",
|
|
84
85
|
"typescript": "^5.9.2",
|
|
85
86
|
"typescript-eslint": "^8.39.0",
|
|
86
|
-
"vite": "^7.0
|
|
87
|
+
"vite": "^7.1.0",
|
|
87
88
|
"vitest": "^3.2.4"
|
|
88
89
|
},
|
|
89
90
|
"keywords": [
|
|
@@ -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
|
}
|
package/src/lib/index.ts
CHANGED
|
@@ -12,6 +12,8 @@ export type { ComponentWeight } from './types/weight.js';
|
|
|
12
12
|
|
|
13
13
|
export type { PositionY, PositionX } from './types/position.js';
|
|
14
14
|
|
|
15
|
+
export type { DropdownArrowPosition } from './types/special.js';
|
|
16
|
+
|
|
15
17
|
/** developer tools: helpers: logger */
|
|
16
18
|
export { default as createLogger } from '$lib/stories/developer tools/helpers/logger/logger.js';
|
|
17
19
|
export type {
|
|
@@ -103,11 +105,7 @@ export type { MessageProps } from '$lib/stories/components/Form/Message/Message.
|
|
|
103
105
|
|
|
104
106
|
/** Form: Select */
|
|
105
107
|
export { default as Select } from '$lib/stories/components/Form/Select/Select.svelte';
|
|
106
|
-
export type {
|
|
107
|
-
SelectOption,
|
|
108
|
-
SelectDropdownArrowPosition,
|
|
109
|
-
SelectProps,
|
|
110
|
-
} from '$lib/stories/components/Form/Select/Select.svelte';
|
|
108
|
+
export type { SelectOption, SelectProps } from '$lib/stories/components/Form/Select/Select.svelte';
|
|
111
109
|
|
|
112
110
|
/** Form: NumericInput */
|
|
113
111
|
export { default as NumericInput } from '$lib/stories/components/Form/NumericInput/NumericInput.svelte';
|
|
@@ -172,6 +170,13 @@ export type {
|
|
|
172
170
|
GridColumnProps,
|
|
173
171
|
} from '$lib/stories/components/Layout/Grid/Column/Column.svelte';
|
|
174
172
|
|
|
173
|
+
/** Layout: Accordian */
|
|
174
|
+
export { default as Accordian } from '$lib/stories/components/Layout/Accordian/Accordian.svelte';
|
|
175
|
+
export type {
|
|
176
|
+
AccordianProps,
|
|
177
|
+
AccordianToggleEvent,
|
|
178
|
+
} from '$lib/stories/components/Layout/Accordian/Accordian.svelte';
|
|
179
|
+
|
|
175
180
|
/** Info: Calendar */
|
|
176
181
|
export { default as Calendar } from '$lib/stories/components/Info/Calendar/Calendar.svelte';
|
|
177
182
|
export type {
|
|
@@ -220,7 +220,6 @@
|
|
|
220
220
|
|
|
221
221
|
.dodo-ui-Button {
|
|
222
222
|
cursor: pointer;
|
|
223
|
-
outline: none;
|
|
224
223
|
transition: all 150ms;
|
|
225
224
|
text-decoration: none;
|
|
226
225
|
margin: 0;
|
|
@@ -232,7 +231,6 @@
|
|
|
232
231
|
border-style: solid;
|
|
233
232
|
border-width: var(--dodo-ui-element-border-width);
|
|
234
233
|
border-color: transparent;
|
|
235
|
-
outline: 0;
|
|
236
234
|
color: inherit;
|
|
237
235
|
letter-spacing: 0.3px;
|
|
238
236
|
|
|
@@ -17,8 +17,6 @@
|
|
|
17
17
|
disabled?: boolean;
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
-
export type SelectDropdownArrowPosition = false | 'before' | 'after';
|
|
21
|
-
|
|
22
20
|
export interface SelectProps {
|
|
23
21
|
/** How large should the button be? */
|
|
24
22
|
size?: ComponentSize;
|
|
@@ -105,7 +103,7 @@
|
|
|
105
103
|
/** Dropdown Arrow Icon */
|
|
106
104
|
customDropdownArrowIcon?: (open: boolean) => Snippet;
|
|
107
105
|
/** Select Dropdown Arrow Position */
|
|
108
|
-
dropdownArrowPosition?:
|
|
106
|
+
dropdownArrowPosition?: DropdownArrowPosition;
|
|
109
107
|
/** Popup stick horizontally */
|
|
110
108
|
popupPositionX?: PositionX;
|
|
111
109
|
/** Popup stick vertically */
|
|
@@ -138,6 +136,7 @@
|
|
|
138
136
|
} from '$lib/index.js';
|
|
139
137
|
import type { TextInputInputEvent } from '../TextInput/TextInput.svelte';
|
|
140
138
|
import type { ButtonClickEvent } from '../Button/Button.svelte';
|
|
139
|
+
import type { DropdownArrowPosition } from '$lib/types/special.js';
|
|
141
140
|
|
|
142
141
|
let {
|
|
143
142
|
size = 'normal',
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { ComponentSize } from '$lib/types/size.js';
|
|
3
|
+
import type { DropdownArrowPosition } from '$lib/types/special.js';
|
|
4
|
+
import Icon from '@iconify/svelte';
|
|
5
|
+
import { onMount, type Snippet } from 'svelte';
|
|
6
|
+
import type { EventHandler } from 'svelte/elements';
|
|
7
|
+
|
|
8
|
+
export type AccordianToggleEvent = Event & {
|
|
9
|
+
currentTarget: EventTarget & HTMLDetailsElement;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export interface AccordianProps {
|
|
13
|
+
/** Contents goes here */
|
|
14
|
+
children?: Snippet;
|
|
15
|
+
/** Accordian summary */
|
|
16
|
+
summary?: Snippet;
|
|
17
|
+
/** summary full width */
|
|
18
|
+
fullWidthSummary?: boolean;
|
|
19
|
+
/** Accordian ref */
|
|
20
|
+
ref?: HTMLDetailsElement;
|
|
21
|
+
/** Custom css class */
|
|
22
|
+
class?: string;
|
|
23
|
+
/** The toggle event handler */
|
|
24
|
+
ontoggle?: EventHandler<Event, HTMLDetailsElement>;
|
|
25
|
+
/** Open state, for dynmaic Accordians */
|
|
26
|
+
open?: boolean;
|
|
27
|
+
/** default Open, for static Accordians */
|
|
28
|
+
defaultOpen?: boolean;
|
|
29
|
+
/** How large should the button be? */
|
|
30
|
+
size?: ComponentSize;
|
|
31
|
+
/** Select Dropdown Arrow Position */
|
|
32
|
+
dropdownArrowPosition?: DropdownArrowPosition;
|
|
33
|
+
/** Dropdown Arrow Icon */
|
|
34
|
+
customDropdownArrowIcon?: (open: boolean) => Snippet;
|
|
35
|
+
}
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<script lang="ts">
|
|
39
|
+
let {
|
|
40
|
+
class: className = '',
|
|
41
|
+
ref = $bindable<HTMLDetailsElement>(),
|
|
42
|
+
ontoggle,
|
|
43
|
+
open = $bindable<boolean>(),
|
|
44
|
+
defaultOpen,
|
|
45
|
+
summary,
|
|
46
|
+
children,
|
|
47
|
+
size = 'normal',
|
|
48
|
+
fullWidthSummary = false,
|
|
49
|
+
customDropdownArrowIcon: customDropdownArrowIconInternal,
|
|
50
|
+
dropdownArrowPosition = 'before',
|
|
51
|
+
}: AccordianProps = $props();
|
|
52
|
+
|
|
53
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
54
|
+
let customDropdownArrowIconTyped = customDropdownArrowIconInternal as any;
|
|
55
|
+
|
|
56
|
+
let isUserInteraction = $state(false);
|
|
57
|
+
|
|
58
|
+
function ontoggleMod(e: AccordianToggleEvent) {
|
|
59
|
+
if (isUserInteraction) {
|
|
60
|
+
if (ontoggle) {
|
|
61
|
+
ontoggle(e);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
isUserInteraction = false;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function onsummaryclick() {
|
|
69
|
+
isUserInteraction = true;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
onMount(() => {
|
|
73
|
+
if (open === true) {
|
|
74
|
+
ref.open = true;
|
|
75
|
+
} else if (open === false) {
|
|
76
|
+
ref.open = false;
|
|
77
|
+
} else if (defaultOpen === true) {
|
|
78
|
+
ref.open = true;
|
|
79
|
+
} else if (defaultOpen === false) {
|
|
80
|
+
ref.open = false;
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
</script>
|
|
84
|
+
|
|
85
|
+
{#snippet dropdownArrowIcon()}
|
|
86
|
+
{#if customDropdownArrowIconTyped}
|
|
87
|
+
{@render customDropdownArrowIconTyped(open)}
|
|
88
|
+
{:else}
|
|
89
|
+
<div class="IconOpen">
|
|
90
|
+
<Icon icon="material-symbols:arrow-drop-up-rounded" width="32" height="32" />
|
|
91
|
+
</div>
|
|
92
|
+
<div class="IconClose">
|
|
93
|
+
<Icon icon="material-symbols:arrow-drop-down-rounded" width="32" height="32" />
|
|
94
|
+
</div>
|
|
95
|
+
{/if}
|
|
96
|
+
{/snippet}
|
|
97
|
+
|
|
98
|
+
<details
|
|
99
|
+
class:fullWidthSummary
|
|
100
|
+
class={['dodo-ui-Accordian', `size--${size}`, className].join(' ')}
|
|
101
|
+
bind:this={ref}
|
|
102
|
+
{open}
|
|
103
|
+
ontoggle={ontoggleMod}
|
|
104
|
+
>
|
|
105
|
+
{#if summary}
|
|
106
|
+
<summary onclick={onsummaryclick}>
|
|
107
|
+
{#if dropdownArrowPosition === 'before'}
|
|
108
|
+
<div class:open class="DropdownArrow before">
|
|
109
|
+
{@render dropdownArrowIcon()}
|
|
110
|
+
</div>
|
|
111
|
+
{/if}
|
|
112
|
+
{@render summary()}
|
|
113
|
+
{#if dropdownArrowPosition === 'after'}
|
|
114
|
+
<div class:open class="DropdownArrow after">
|
|
115
|
+
{@render dropdownArrowIcon()}
|
|
116
|
+
</div>
|
|
117
|
+
{/if}
|
|
118
|
+
</summary>
|
|
119
|
+
{/if}
|
|
120
|
+
|
|
121
|
+
{#if children}
|
|
122
|
+
<div class="AccordianContent">
|
|
123
|
+
{@render children()}
|
|
124
|
+
</div>
|
|
125
|
+
{/if}
|
|
126
|
+
</details>
|
|
127
|
+
|
|
128
|
+
<style lang="scss">
|
|
129
|
+
.dodo-ui-Accordian {
|
|
130
|
+
color: var(--dodo-color-neutral-900);
|
|
131
|
+
width: 100%;
|
|
132
|
+
|
|
133
|
+
summary {
|
|
134
|
+
display: inline-flex;
|
|
135
|
+
align-items: center;
|
|
136
|
+
cursor: pointer;
|
|
137
|
+
user-select: none;
|
|
138
|
+
font-weight: 500;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
&.fullWidthSummary {
|
|
142
|
+
summary {
|
|
143
|
+
display: flex;
|
|
144
|
+
width: 100%;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
&[open] {
|
|
149
|
+
.IconOpen {
|
|
150
|
+
display: flex;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.IconClose {
|
|
154
|
+
display: none;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
&:not([open]) {
|
|
159
|
+
.IconOpen {
|
|
160
|
+
display: none;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.IconClose {
|
|
164
|
+
display: flex;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
&.size {
|
|
169
|
+
&--normal {
|
|
170
|
+
summary {
|
|
171
|
+
font-size: 1rem;
|
|
172
|
+
min-height: var(--dodo-ui-element-height-normal);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
&--small {
|
|
177
|
+
summary {
|
|
178
|
+
font-size: 0.9rem;
|
|
179
|
+
min-height: var(--dodo-ui-element-height-small);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
&--large {
|
|
184
|
+
summary {
|
|
185
|
+
font-size: 1.1rem;
|
|
186
|
+
min-height: var(--dodo-ui-element-height-large);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.AccordianContent {
|
|
192
|
+
margin-top: var(--dodo-ui-space);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
</style>
|
|
@@ -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>
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import Button from '$lib/stories/components/Form/Button/Button.svelte';
|
|
3
|
+
import { useAutoCustomizeConfigStore } from '../stores/config.svelte.js';
|
|
4
|
+
import ColorTool from './ColorTool/ColorTool.svelte';
|
|
5
|
+
import Export from './Export.svelte';
|
|
6
|
+
import ValueSilder from './ValueSilder/ValueSilder.svelte';
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<div class="Config">
|
|
10
|
+
<h3>Auto Customize</h3>
|
|
11
|
+
<ColorTool
|
|
12
|
+
label="Primary Color:"
|
|
13
|
+
onclick={(color) => useAutoCustomizeConfigStore.updateDataColor({ primary: color })}
|
|
14
|
+
selectedColor={useAutoCustomizeConfigStore.data.colors?.primary}
|
|
15
|
+
colors={[
|
|
16
|
+
'violet',
|
|
17
|
+
'red',
|
|
18
|
+
'orange',
|
|
19
|
+
'amber',
|
|
20
|
+
'yellow',
|
|
21
|
+
'lime',
|
|
22
|
+
'green',
|
|
23
|
+
'emerald',
|
|
24
|
+
'teal',
|
|
25
|
+
'cyan',
|
|
26
|
+
'blue',
|
|
27
|
+
'indigo',
|
|
28
|
+
'purple',
|
|
29
|
+
'fuchsia',
|
|
30
|
+
'pink',
|
|
31
|
+
'rose',
|
|
32
|
+
]}
|
|
33
|
+
/>
|
|
34
|
+
|
|
35
|
+
<ColorTool
|
|
36
|
+
label="Secondary Color:"
|
|
37
|
+
onclick={(color) => useAutoCustomizeConfigStore.updateDataColor({ secondary: color })}
|
|
38
|
+
selectedColor={useAutoCustomizeConfigStore.data.colors?.secondary}
|
|
39
|
+
colors={[
|
|
40
|
+
'blue',
|
|
41
|
+
'red',
|
|
42
|
+
'orange',
|
|
43
|
+
'amber',
|
|
44
|
+
'yellow',
|
|
45
|
+
'lime',
|
|
46
|
+
'green',
|
|
47
|
+
'emerald',
|
|
48
|
+
'teal',
|
|
49
|
+
'cyan',
|
|
50
|
+
'indigo',
|
|
51
|
+
'violet',
|
|
52
|
+
'purple',
|
|
53
|
+
'fuchsia',
|
|
54
|
+
'pink',
|
|
55
|
+
'rose',
|
|
56
|
+
]}
|
|
57
|
+
/>
|
|
58
|
+
|
|
59
|
+
<ColorTool
|
|
60
|
+
label="Neutral Color:"
|
|
61
|
+
onclick={(color) => useAutoCustomizeConfigStore.updateDataColor({ neutral: color })}
|
|
62
|
+
selectedColor={useAutoCustomizeConfigStore.data.colors?.neutral}
|
|
63
|
+
colors={['gray', 'slate', 'zinc', 'neutral', 'stone']}
|
|
64
|
+
/>
|
|
65
|
+
|
|
66
|
+
<ColorTool
|
|
67
|
+
label="Safe Color:"
|
|
68
|
+
onclick={(color) => useAutoCustomizeConfigStore.updateDataColor({ safe: color })}
|
|
69
|
+
selectedColor={useAutoCustomizeConfigStore.data.colors?.safe}
|
|
70
|
+
colors={['emerald', 'lime', 'green', 'teal']}
|
|
71
|
+
/>
|
|
72
|
+
|
|
73
|
+
<ColorTool
|
|
74
|
+
label="Warning Color:"
|
|
75
|
+
onclick={(color) => useAutoCustomizeConfigStore.updateDataColor({ warning: color })}
|
|
76
|
+
selectedColor={useAutoCustomizeConfigStore.data.colors?.warning}
|
|
77
|
+
colors={['amber', 'red', 'rose', 'orange', 'yellow']}
|
|
78
|
+
/>
|
|
79
|
+
|
|
80
|
+
<ColorTool
|
|
81
|
+
label="Danger Color:"
|
|
82
|
+
onclick={(color) => useAutoCustomizeConfigStore.updateDataColor({ danger: color })}
|
|
83
|
+
selectedColor={useAutoCustomizeConfigStore.data.colors?.danger}
|
|
84
|
+
colors={['red', 'orange', 'amber', 'yellow', 'pink', 'rose']}
|
|
85
|
+
/>
|
|
86
|
+
|
|
87
|
+
<ValueSilder
|
|
88
|
+
label="Roundness:"
|
|
89
|
+
value={useAutoCustomizeConfigStore.data.components?.roundness || 0}
|
|
90
|
+
min={-5}
|
|
91
|
+
max={7}
|
|
92
|
+
oninput={(value) => useAutoCustomizeConfigStore.updateDataComponents({ roundness: value })}
|
|
93
|
+
/>
|
|
94
|
+
|
|
95
|
+
<ValueSilder
|
|
96
|
+
label="Size:"
|
|
97
|
+
value={useAutoCustomizeConfigStore.data.components?.elementHeight || 0}
|
|
98
|
+
min={-5}
|
|
99
|
+
max={7}
|
|
100
|
+
oninput={(value) => useAutoCustomizeConfigStore.updateDataComponents({ elementHeight: value })}
|
|
101
|
+
/>
|
|
102
|
+
|
|
103
|
+
<ValueSilder
|
|
104
|
+
label="Border:"
|
|
105
|
+
value={useAutoCustomizeConfigStore.data.components?.borderWidth || 0}
|
|
106
|
+
min={0}
|
|
107
|
+
max={7}
|
|
108
|
+
oninput={(value) => useAutoCustomizeConfigStore.updateDataComponents({ borderWidth: value })}
|
|
109
|
+
/>
|
|
110
|
+
|
|
111
|
+
<ValueSilder
|
|
112
|
+
label="Space:"
|
|
113
|
+
value={useAutoCustomizeConfigStore.data.space || 0}
|
|
114
|
+
min={-5}
|
|
115
|
+
max={15}
|
|
116
|
+
oninput={(value) => useAutoCustomizeConfigStore.updateData({ space: value })}
|
|
117
|
+
/>
|
|
118
|
+
|
|
119
|
+
<div class="Export">
|
|
120
|
+
<Export />
|
|
121
|
+
</div>
|
|
122
|
+
|
|
123
|
+
<div class="Reset">
|
|
124
|
+
<Button onclick={() => useAutoCustomizeConfigStore.reset()} variant="text" color="danger">
|
|
125
|
+
Reset
|
|
126
|
+
</Button>
|
|
127
|
+
</div>
|
|
128
|
+
</div>
|
|
129
|
+
|
|
130
|
+
<style lang="scss">
|
|
131
|
+
@use '../../../../../../styles/scss' as *;
|
|
132
|
+
|
|
133
|
+
.Config {
|
|
134
|
+
width: 100%;
|
|
135
|
+
display: flex;
|
|
136
|
+
flex-direction: column;
|
|
137
|
+
padding: calc(var(--dodo-ui-space) * 2);
|
|
138
|
+
|
|
139
|
+
@media (min-width: $breakpoints-lg) {
|
|
140
|
+
max-width: 300px;
|
|
141
|
+
height: calc(100vh - 130px);
|
|
142
|
+
overflow: auto;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.Reset {
|
|
146
|
+
margin-top: calc(var(--dodo-ui-space) * 4);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
</style>
|