@poveste/controls 0.6.0 → 0.7.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/package.json +16 -3
- package/postcss.config.cjs +0 -7
- package/src/components/HstCopyIcon.story.vue +0 -26
- package/src/components/HstCopyIcon.vue +0 -38
- package/src/components/HstWrapper.vue +0 -41
- package/src/components/button/HstButton.story.vue +0 -30
- package/src/components/button/HstButton.vue +0 -26
- package/src/components/button/HstButtonGroup.story.vue +0 -79
- package/src/components/button/HstButtonGroup.vue +0 -71
- package/src/components/checkbox/HstCheckbox.spec.ts +0 -28
- package/src/components/checkbox/HstCheckbox.story.vue +0 -47
- package/src/components/checkbox/HstCheckbox.vue +0 -56
- package/src/components/checkbox/HstCheckboxList.story.vue +0 -49
- package/src/components/checkbox/HstCheckboxList.vue +0 -82
- package/src/components/checkbox/HstSimpleCheckbox.story.vue +0 -28
- package/src/components/checkbox/HstSimpleCheckbox.vue +0 -82
- package/src/components/checkbox/__snapshots__/HstCheckbox.spec.ts.snap +0 -5
- package/src/components/colorselect/HstColorSelect.story.vue +0 -28
- package/src/components/colorselect/HstColorSelect.vue +0 -89
- package/src/components/design-tokens/HstColorShades.story.vue +0 -392
- package/src/components/design-tokens/HstColorShades.vue +0 -101
- package/src/components/design-tokens/HstTokenGrid.story.vue +0 -36
- package/src/components/design-tokens/HstTokenGrid.vue +0 -88
- package/src/components/design-tokens/HstTokenList.story.vue +0 -81
- package/src/components/design-tokens/HstTokenList.vue +0 -62
- package/src/components/json/HstJson.story.vue +0 -41
- package/src/components/json/HstJson.vue +0 -167
- package/src/components/json/serialize.spec.ts +0 -85
- package/src/components/json/serialize.ts +0 -54
- package/src/components/number/HstNumber.story.vue +0 -42
- package/src/components/number/HstNumber.vue +0 -95
- package/src/components/radio/HstRadio.story.vue +0 -51
- package/src/components/radio/HstRadio.vue +0 -109
- package/src/components/select/CustomSelect.vue +0 -126
- package/src/components/select/HstSelect.story.vue +0 -161
- package/src/components/select/HstSelect.vue +0 -40
- package/src/components/slider/HstSlider.story.vue +0 -37
- package/src/components/slider/HstSlider.vue +0 -106
- package/src/components/text/HstText.story.vue +0 -63
- package/src/components/text/HstText.vue +0 -44
- package/src/components/textarea/HstTextarea.story.vue +0 -35
- package/src/components/textarea/HstTextarea.vue +0 -44
- package/src/end.d.ts +0 -8
- package/src/index.ts +0 -54
- package/src/style/main.css +0 -65
- package/src/types.ts +0 -4
- package/src/utils.ts +0 -12
- package/tsconfig.json +0 -53
- package/vite.config.ts +0 -46
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
export default {
|
|
3
|
-
name: 'HstSimpleCheckbox',
|
|
4
|
-
}
|
|
5
|
-
</script>
|
|
6
|
-
|
|
7
|
-
<script setup lang="ts">
|
|
8
|
-
import { computed, ref, watch } from 'vue'
|
|
9
|
-
|
|
10
|
-
const props = defineProps<{
|
|
11
|
-
modelValue?: boolean
|
|
12
|
-
withToggle?: boolean
|
|
13
|
-
}>()
|
|
14
|
-
|
|
15
|
-
const emit = defineEmits({
|
|
16
|
-
'update:modelValue': (newValue: boolean) => true,
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
function toggle() {
|
|
20
|
-
if (!props.withToggle) {
|
|
21
|
-
return
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
emit('update:modelValue', !props.modelValue)
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
watch(() => props.modelValue, () => {
|
|
28
|
-
animationEnabled.value = true
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
// SVG check
|
|
32
|
-
|
|
33
|
-
const path = ref<SVGPathElement>()
|
|
34
|
-
const dasharray = ref(0)
|
|
35
|
-
const progress = computed(() => props.modelValue ? 1 : 0)
|
|
36
|
-
const dashoffset = computed(() => (1 - progress.value) * dasharray.value)
|
|
37
|
-
|
|
38
|
-
// animationEnabled prevents the animation from triggering on mounted
|
|
39
|
-
const animationEnabled = ref(false)
|
|
40
|
-
|
|
41
|
-
watch(path, () => {
|
|
42
|
-
dasharray.value = path.value.getTotalLength?.() ?? 21.21
|
|
43
|
-
})
|
|
44
|
-
</script>
|
|
45
|
-
|
|
46
|
-
<template>
|
|
47
|
-
<div
|
|
48
|
-
class="poveste-simple-checkbox group text-white w-[16px] h-[16px] relative"
|
|
49
|
-
:class="{ 'cursor-pointer': withToggle }"
|
|
50
|
-
@click="toggle"
|
|
51
|
-
>
|
|
52
|
-
<div
|
|
53
|
-
class="border border-solid group-active:bg-gray-500/20 rounded-sm box-border absolute inset-0 transition-border duration-150 ease-out group-hover:border-primary-500 group-hover:dark:border-primary-500"
|
|
54
|
-
:class="[
|
|
55
|
-
modelValue
|
|
56
|
-
? 'border-primary-500 border-8'
|
|
57
|
-
: 'border-black/25 dark:border-white/25 delay-150',
|
|
58
|
-
]"
|
|
59
|
-
/>
|
|
60
|
-
<svg
|
|
61
|
-
width="16"
|
|
62
|
-
height="16"
|
|
63
|
-
viewBox="0 0 24 24"
|
|
64
|
-
class="relative z-10"
|
|
65
|
-
>
|
|
66
|
-
<path
|
|
67
|
-
ref="path"
|
|
68
|
-
d="m 4 12 l 5 5 l 10 -10"
|
|
69
|
-
fill="none"
|
|
70
|
-
class="stroke-white stroke-2 duration-200 ease-in-out"
|
|
71
|
-
:class="[
|
|
72
|
-
animationEnabled ? 'transition-all' : 'transition-none',
|
|
73
|
-
{
|
|
74
|
-
'delay-150': modelValue,
|
|
75
|
-
},
|
|
76
|
-
]"
|
|
77
|
-
:stroke-dasharray="dasharray"
|
|
78
|
-
:stroke-dashoffset="dashoffset"
|
|
79
|
-
/>
|
|
80
|
-
</svg>
|
|
81
|
-
</div>
|
|
82
|
-
</template>
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
-
|
|
3
|
-
exports[`hstCheckbox > toggle to checked 1`] = `"<label class="poveste-wrapper histoire-wrapper p-2 hover:bg-primary-100 dark:hover:bg-primary-800 flex gap-2 flex-wrap poveste-checkbox cursor-pointer items-center" role="checkbox" tabindex="0"><span class="w-28 whitespace-nowrap text-ellipsis overflow-hidden shrink-0 v-popper--has-tooltip">Label</span><span class="grow max-w-full flex items-center gap-1"><span class="block grow max-w-full"><div class="poveste-simple-checkbox group text-white w-[16px] h-[16px] relative"><div class="border border-solid group-active:bg-gray-500/20 rounded-sm box-border absolute inset-0 transition-border duration-150 ease-out group-hover:border-primary-500 group-hover:dark:border-primary-500 border-black/25 dark:border-white/25 delay-150"></div><svg width="16" height="16" viewBox="0 0 24 24" class="relative z-10"><path d="m 4 12 l 5 5 l 10 -10" fill="none" class="stroke-white stroke-2 duration-200 ease-in-out transition-none" stroke-dasharray="21.21" stroke-dashoffset="21.21"></path></svg></div></span></span></label>"`;
|
|
4
|
-
|
|
5
|
-
exports[`hstCheckbox > toggle to unchecked 1`] = `"<label class="poveste-wrapper histoire-wrapper p-2 hover:bg-primary-100 dark:hover:bg-primary-800 flex gap-2 flex-wrap poveste-checkbox cursor-pointer items-center" role="checkbox" tabindex="0"><span class="w-28 whitespace-nowrap text-ellipsis overflow-hidden shrink-0 v-popper--has-tooltip">Label</span><span class="grow max-w-full flex items-center gap-1"><span class="block grow max-w-full"><div class="poveste-simple-checkbox group text-white w-[16px] h-[16px] relative"><div class="border border-solid group-active:bg-gray-500/20 rounded-sm box-border absolute inset-0 transition-border duration-150 ease-out group-hover:border-primary-500 group-hover:dark:border-primary-500 border-primary-500 border-8"></div><svg width="16" height="16" viewBox="0 0 24 24" class="relative z-10"><path d="m 4 12 l 5 5 l 10 -10" fill="none" class="stroke-white stroke-2 duration-200 ease-in-out transition-none delay-150" stroke-dasharray="21.21" stroke-dashoffset="0"></path></svg></div></span></span></label>"`;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { reactive } from 'vue'
|
|
3
|
-
import HstColorSelect from './HstColorSelect.vue'
|
|
4
|
-
|
|
5
|
-
const state = reactive({
|
|
6
|
-
value: '#000000',
|
|
7
|
-
})
|
|
8
|
-
</script>
|
|
9
|
-
|
|
10
|
-
<template>
|
|
11
|
-
<Story
|
|
12
|
-
title="HstColorSelect"
|
|
13
|
-
group="controls"
|
|
14
|
-
:layout="{ type: 'single', iframe: false }"
|
|
15
|
-
>
|
|
16
|
-
<HstColorSelect
|
|
17
|
-
v-model="state.value"
|
|
18
|
-
title="Color Select"
|
|
19
|
-
/>
|
|
20
|
-
<pre>{{ state }}</pre>
|
|
21
|
-
<template #controls>
|
|
22
|
-
<HstColorSelect
|
|
23
|
-
v-model="state.value"
|
|
24
|
-
title="Value"
|
|
25
|
-
/>
|
|
26
|
-
</template>
|
|
27
|
-
</Story>
|
|
28
|
-
</template>
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
export default {
|
|
3
|
-
name: 'HstColorSelect',
|
|
4
|
-
inheritAttrs: false,
|
|
5
|
-
}
|
|
6
|
-
</script>
|
|
7
|
-
|
|
8
|
-
<script lang="ts" setup>
|
|
9
|
-
import { computed } from 'vue'
|
|
10
|
-
import HstWrapper from '../HstWrapper.vue'
|
|
11
|
-
|
|
12
|
-
const props = defineProps<{
|
|
13
|
-
title?: string
|
|
14
|
-
modelValue?: string | null
|
|
15
|
-
}>()
|
|
16
|
-
|
|
17
|
-
const emit = defineEmits({
|
|
18
|
-
'update:modelValue': (newValue: string) => true,
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
const stringModel = computed({
|
|
22
|
-
get: () => props.modelValue,
|
|
23
|
-
set: value => {
|
|
24
|
-
emit('update:modelValue', value)
|
|
25
|
-
},
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
function throttle(cb, delay = 15) {
|
|
29
|
-
let shouldWait = false
|
|
30
|
-
let waitingArgs
|
|
31
|
-
const timeoutFunc = () => {
|
|
32
|
-
if (waitingArgs == null) {
|
|
33
|
-
shouldWait = false
|
|
34
|
-
} else {
|
|
35
|
-
cb(...waitingArgs)
|
|
36
|
-
waitingArgs = null
|
|
37
|
-
setTimeout(timeoutFunc, delay)
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return (...args) => {
|
|
42
|
-
if (shouldWait) {
|
|
43
|
-
waitingArgs = args
|
|
44
|
-
return
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
cb(...args)
|
|
48
|
-
shouldWait = true
|
|
49
|
-
setTimeout(timeoutFunc, delay)
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
const updateValue = throttle((value: string) => {
|
|
53
|
-
emit('update:modelValue', value)
|
|
54
|
-
})
|
|
55
|
-
function processChange(inp) {
|
|
56
|
-
updateValue(inp)
|
|
57
|
-
}
|
|
58
|
-
</script>
|
|
59
|
-
|
|
60
|
-
<script>
|
|
61
|
-
|
|
62
|
-
</script>
|
|
63
|
-
|
|
64
|
-
<template>
|
|
65
|
-
<HstWrapper
|
|
66
|
-
:title="title"
|
|
67
|
-
class="poveste-select cursor-text items-center"
|
|
68
|
-
:class="$attrs.class"
|
|
69
|
-
:style="$attrs.style"
|
|
70
|
-
>
|
|
71
|
-
<div class="flex flex-row gap-1">
|
|
72
|
-
<input
|
|
73
|
-
v-bind="{ ...$attrs, class: null, style: null }"
|
|
74
|
-
v-model="stringModel"
|
|
75
|
-
type="text"
|
|
76
|
-
class="text-inherit bg-transparent w-full outline-none px-2 py-1 -my-1 border border-solid border-black/25 dark:border-white/25 focus:border-primary-500 dark:focus:border-primary-500 rounded-sm"
|
|
77
|
-
>
|
|
78
|
-
<input
|
|
79
|
-
type="color"
|
|
80
|
-
:value="modelValue"
|
|
81
|
-
@input="((e) => processChange((e.target as HTMLInputElement).value as string))"
|
|
82
|
-
>
|
|
83
|
-
</div>
|
|
84
|
-
|
|
85
|
-
<template #actions>
|
|
86
|
-
<slot name="actions" />
|
|
87
|
-
</template>
|
|
88
|
-
</HstWrapper>
|
|
89
|
-
</template>
|
|
@@ -1,392 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import type { CSSProperties } from 'vue'
|
|
3
|
-
import HstColorShades from './HstColorShades.vue'
|
|
4
|
-
|
|
5
|
-
const colors = {
|
|
6
|
-
slate: {
|
|
7
|
-
50: '#f8fafc',
|
|
8
|
-
100: '#f1f5f9',
|
|
9
|
-
200: '#e2e8f0',
|
|
10
|
-
300: '#cbd5e1',
|
|
11
|
-
400: '#94a3b8',
|
|
12
|
-
500: '#64748b',
|
|
13
|
-
600: '#475569',
|
|
14
|
-
700: '#334155',
|
|
15
|
-
750: '#283548',
|
|
16
|
-
800: '#1e293b',
|
|
17
|
-
850: '#151f32',
|
|
18
|
-
900: '#0f172a',
|
|
19
|
-
950: '#09101f',
|
|
20
|
-
},
|
|
21
|
-
gray: {
|
|
22
|
-
50: '#f9fafb',
|
|
23
|
-
100: '#f3f4f6',
|
|
24
|
-
200: '#e5e7eb',
|
|
25
|
-
300: '#d1d5db',
|
|
26
|
-
400: '#9ca3af',
|
|
27
|
-
500: '#6b7280',
|
|
28
|
-
600: '#4b5563',
|
|
29
|
-
700: '#374151',
|
|
30
|
-
750: '#2b3546',
|
|
31
|
-
800: '#1f2937',
|
|
32
|
-
850: '#18212f',
|
|
33
|
-
900: '#111827',
|
|
34
|
-
950: '#0c101d',
|
|
35
|
-
},
|
|
36
|
-
zinc: {
|
|
37
|
-
50: '#fafafa',
|
|
38
|
-
100: '#f4f4f5',
|
|
39
|
-
200: '#e4e4e7',
|
|
40
|
-
300: '#d4d4d8',
|
|
41
|
-
400: '#a1a1aa',
|
|
42
|
-
500: '#71717a',
|
|
43
|
-
600: '#52525b',
|
|
44
|
-
700: '#3f3f46',
|
|
45
|
-
750: '#323238',
|
|
46
|
-
800: '#27272a',
|
|
47
|
-
850: '#1f1f21',
|
|
48
|
-
900: '#18181b',
|
|
49
|
-
950: '#101012',
|
|
50
|
-
},
|
|
51
|
-
neutral: {
|
|
52
|
-
50: '#fafafa',
|
|
53
|
-
100: '#f5f5f5',
|
|
54
|
-
200: '#e5e5e5',
|
|
55
|
-
300: '#d4d4d4',
|
|
56
|
-
400: '#a3a3a3',
|
|
57
|
-
500: '#737373',
|
|
58
|
-
600: '#525252',
|
|
59
|
-
700: '#404040',
|
|
60
|
-
750: '#333333',
|
|
61
|
-
800: '#262626',
|
|
62
|
-
850: '#1f1f1f',
|
|
63
|
-
900: '#171717',
|
|
64
|
-
950: '#0f0f0f',
|
|
65
|
-
},
|
|
66
|
-
stone: {
|
|
67
|
-
50: '#fafaf9',
|
|
68
|
-
100: '#f5f5f4',
|
|
69
|
-
200: '#e7e5e4',
|
|
70
|
-
300: '#d6d3d1',
|
|
71
|
-
400: '#a8a29e',
|
|
72
|
-
500: '#78716c',
|
|
73
|
-
600: '#57534e',
|
|
74
|
-
700: '#44403c',
|
|
75
|
-
750: '#363230',
|
|
76
|
-
800: '#292524',
|
|
77
|
-
850: '#211e1c',
|
|
78
|
-
900: '#1c1917',
|
|
79
|
-
950: '#171412',
|
|
80
|
-
},
|
|
81
|
-
red: {
|
|
82
|
-
50: '#fef2f2',
|
|
83
|
-
100: '#fee2e2',
|
|
84
|
-
200: '#fecaca',
|
|
85
|
-
300: '#fca5a5',
|
|
86
|
-
400: '#f87171',
|
|
87
|
-
500: '#ef4444',
|
|
88
|
-
600: '#dc2626',
|
|
89
|
-
700: '#b91c1c',
|
|
90
|
-
800: '#991b1b',
|
|
91
|
-
900: '#7f1d1d',
|
|
92
|
-
},
|
|
93
|
-
orange: {
|
|
94
|
-
50: '#fff7ed',
|
|
95
|
-
100: '#ffedd5',
|
|
96
|
-
200: '#fed7aa',
|
|
97
|
-
300: '#fdba74',
|
|
98
|
-
400: '#fb923c',
|
|
99
|
-
500: '#f97316',
|
|
100
|
-
600: '#ea580c',
|
|
101
|
-
700: '#c2410c',
|
|
102
|
-
800: '#9a3412',
|
|
103
|
-
900: '#7c2d12',
|
|
104
|
-
},
|
|
105
|
-
amber: {
|
|
106
|
-
50: '#fffbeb',
|
|
107
|
-
100: '#fef3c7',
|
|
108
|
-
200: '#fde68a',
|
|
109
|
-
300: '#fcd34d',
|
|
110
|
-
400: '#fbbf24',
|
|
111
|
-
500: '#f59e0b',
|
|
112
|
-
600: '#d97706',
|
|
113
|
-
700: '#b45309',
|
|
114
|
-
800: '#92400e',
|
|
115
|
-
900: '#78350f',
|
|
116
|
-
},
|
|
117
|
-
yellow: {
|
|
118
|
-
50: '#fefce8',
|
|
119
|
-
100: '#fef9c3',
|
|
120
|
-
200: '#fef08a',
|
|
121
|
-
300: '#fde047',
|
|
122
|
-
400: '#facc15',
|
|
123
|
-
500: '#eab308',
|
|
124
|
-
600: '#ca8a04',
|
|
125
|
-
700: '#a16207',
|
|
126
|
-
800: '#854d0e',
|
|
127
|
-
900: '#713f12',
|
|
128
|
-
},
|
|
129
|
-
lime: {
|
|
130
|
-
50: '#f7fee7',
|
|
131
|
-
100: '#ecfccb',
|
|
132
|
-
200: '#d9f99d',
|
|
133
|
-
300: '#bef264',
|
|
134
|
-
400: '#a3e635',
|
|
135
|
-
500: '#84cc16',
|
|
136
|
-
600: '#65a30d',
|
|
137
|
-
700: '#4d7c0f',
|
|
138
|
-
800: '#3f6212',
|
|
139
|
-
900: '#365314',
|
|
140
|
-
},
|
|
141
|
-
green: {
|
|
142
|
-
50: '#f0fdf4',
|
|
143
|
-
100: '#dcfce7',
|
|
144
|
-
200: '#bbf7d0',
|
|
145
|
-
300: '#86efac',
|
|
146
|
-
400: '#4ade80',
|
|
147
|
-
500: '#22c55e',
|
|
148
|
-
600: '#16a34a',
|
|
149
|
-
700: '#15803d',
|
|
150
|
-
800: '#166534',
|
|
151
|
-
900: '#14532d',
|
|
152
|
-
},
|
|
153
|
-
emerald: {
|
|
154
|
-
50: '#ecfdf5',
|
|
155
|
-
100: '#d1fae5',
|
|
156
|
-
200: '#a7f3d0',
|
|
157
|
-
300: '#6ee7b7',
|
|
158
|
-
400: '#34d399',
|
|
159
|
-
500: '#10b981',
|
|
160
|
-
600: '#059669',
|
|
161
|
-
700: '#047857',
|
|
162
|
-
800: '#065f46',
|
|
163
|
-
900: '#064e3b',
|
|
164
|
-
},
|
|
165
|
-
teal: {
|
|
166
|
-
50: '#f0fdfa',
|
|
167
|
-
100: '#ccfbf1',
|
|
168
|
-
200: '#99f6e4',
|
|
169
|
-
300: '#5eead4',
|
|
170
|
-
400: '#2dd4bf',
|
|
171
|
-
500: '#14b8a6',
|
|
172
|
-
600: '#0d9488',
|
|
173
|
-
700: '#0f766e',
|
|
174
|
-
800: '#115e59',
|
|
175
|
-
900: '#134e4a',
|
|
176
|
-
},
|
|
177
|
-
cyan: {
|
|
178
|
-
50: '#ecfeff',
|
|
179
|
-
100: '#cffafe',
|
|
180
|
-
200: '#a5f3fc',
|
|
181
|
-
300: '#67e8f9',
|
|
182
|
-
400: '#22d3ee',
|
|
183
|
-
500: '#06b6d4',
|
|
184
|
-
600: '#0891b2',
|
|
185
|
-
700: '#0e7490',
|
|
186
|
-
800: '#155e75',
|
|
187
|
-
900: '#164e63',
|
|
188
|
-
},
|
|
189
|
-
sky: {
|
|
190
|
-
50: '#f0f9ff',
|
|
191
|
-
100: '#e0f2fe',
|
|
192
|
-
200: '#bae6fd',
|
|
193
|
-
300: '#7dd3fc',
|
|
194
|
-
400: '#38bdf8',
|
|
195
|
-
500: '#0ea5e9',
|
|
196
|
-
600: '#0284c7',
|
|
197
|
-
700: '#0369a1',
|
|
198
|
-
800: '#075985',
|
|
199
|
-
900: '#0c4a6e',
|
|
200
|
-
},
|
|
201
|
-
blue: {
|
|
202
|
-
50: '#eff6ff',
|
|
203
|
-
100: '#dbeafe',
|
|
204
|
-
200: '#bfdbfe',
|
|
205
|
-
300: '#93c5fd',
|
|
206
|
-
400: '#60a5fa',
|
|
207
|
-
500: '#3b82f6',
|
|
208
|
-
600: '#2563eb',
|
|
209
|
-
700: '#1d4ed8',
|
|
210
|
-
800: '#1e40af',
|
|
211
|
-
900: '#1e3a8a',
|
|
212
|
-
},
|
|
213
|
-
indigo: {
|
|
214
|
-
50: '#eef2ff',
|
|
215
|
-
100: '#e0e7ff',
|
|
216
|
-
200: '#c7d2fe',
|
|
217
|
-
300: '#a5b4fc',
|
|
218
|
-
400: '#818cf8',
|
|
219
|
-
500: '#6366f1',
|
|
220
|
-
600: '#4f46e5',
|
|
221
|
-
700: '#4338ca',
|
|
222
|
-
800: '#3730a3',
|
|
223
|
-
900: '#312e81',
|
|
224
|
-
},
|
|
225
|
-
violet: {
|
|
226
|
-
50: '#f5f3ff',
|
|
227
|
-
100: '#ede9fe',
|
|
228
|
-
200: '#ddd6fe',
|
|
229
|
-
300: '#c4b5fd',
|
|
230
|
-
400: '#a78bfa',
|
|
231
|
-
500: '#8b5cf6',
|
|
232
|
-
600: '#7c3aed',
|
|
233
|
-
700: '#6d28d9',
|
|
234
|
-
800: '#5b21b6',
|
|
235
|
-
900: '#4c1d95',
|
|
236
|
-
},
|
|
237
|
-
purple: {
|
|
238
|
-
50: '#faf5ff',
|
|
239
|
-
100: '#f3e8ff',
|
|
240
|
-
200: '#e9d5ff',
|
|
241
|
-
300: '#d8b4fe',
|
|
242
|
-
400: '#c084fc',
|
|
243
|
-
500: '#a855f7',
|
|
244
|
-
600: '#9333ea',
|
|
245
|
-
700: '#7e22ce',
|
|
246
|
-
800: '#6b21a8',
|
|
247
|
-
900: '#581c87',
|
|
248
|
-
},
|
|
249
|
-
fuchsia: {
|
|
250
|
-
50: '#fdf4ff',
|
|
251
|
-
100: '#fae8ff',
|
|
252
|
-
200: '#f5d0fe',
|
|
253
|
-
300: '#f0abfc',
|
|
254
|
-
400: '#e879f9',
|
|
255
|
-
500: '#d946ef',
|
|
256
|
-
600: '#c026d3',
|
|
257
|
-
700: '#a21caf',
|
|
258
|
-
800: '#86198f',
|
|
259
|
-
900: '#701a75',
|
|
260
|
-
},
|
|
261
|
-
pink: {
|
|
262
|
-
50: '#fdf2f8',
|
|
263
|
-
100: '#fce7f3',
|
|
264
|
-
200: '#fbcfe8',
|
|
265
|
-
300: '#f9a8d4',
|
|
266
|
-
400: '#f472b6',
|
|
267
|
-
500: '#ec4899',
|
|
268
|
-
600: '#db2777',
|
|
269
|
-
700: '#be185d',
|
|
270
|
-
800: '#9d174d',
|
|
271
|
-
900: '#831843',
|
|
272
|
-
},
|
|
273
|
-
rose: {
|
|
274
|
-
50: '#fff1f2',
|
|
275
|
-
100: '#ffe4e6',
|
|
276
|
-
200: '#fecdd3',
|
|
277
|
-
300: '#fda4af',
|
|
278
|
-
400: '#fb7185',
|
|
279
|
-
500: '#f43f5e',
|
|
280
|
-
600: '#e11d48',
|
|
281
|
-
700: '#be123c',
|
|
282
|
-
800: '#9f1239',
|
|
283
|
-
900: '#881337',
|
|
284
|
-
},
|
|
285
|
-
}
|
|
286
|
-
</script>
|
|
287
|
-
|
|
288
|
-
<template>
|
|
289
|
-
<Story
|
|
290
|
-
title="HstColorShades"
|
|
291
|
-
group="design-system"
|
|
292
|
-
responsive-disabled
|
|
293
|
-
>
|
|
294
|
-
<Variant title="default">
|
|
295
|
-
<HstColorShades
|
|
296
|
-
v-for="(shades, key) of colors"
|
|
297
|
-
:key="key"
|
|
298
|
-
:shades="shades"
|
|
299
|
-
:get-name="shade => `${key}-${shade}`"
|
|
300
|
-
/>
|
|
301
|
-
</Variant>
|
|
302
|
-
|
|
303
|
-
<Variant title="background">
|
|
304
|
-
<HstColorShades
|
|
305
|
-
v-for="(shades, key) of colors"
|
|
306
|
-
:key="key"
|
|
307
|
-
:shades="shades"
|
|
308
|
-
:get-name="shade => `${key}-${shade}`"
|
|
309
|
-
>
|
|
310
|
-
<template #default="{ color }">
|
|
311
|
-
<div
|
|
312
|
-
class="rounded h-[100px]"
|
|
313
|
-
:style="{
|
|
314
|
-
backgroundColor: color,
|
|
315
|
-
} as CSSProperties"
|
|
316
|
-
/>
|
|
317
|
-
</template>
|
|
318
|
-
</HstColorShades>
|
|
319
|
-
</Variant>
|
|
320
|
-
|
|
321
|
-
<Variant title="text">
|
|
322
|
-
<HstColorShades
|
|
323
|
-
v-for="(shades, key) of colors"
|
|
324
|
-
:key="key"
|
|
325
|
-
:shades="shades"
|
|
326
|
-
:get-name="shade => `${key}-${shade}`"
|
|
327
|
-
>
|
|
328
|
-
<template #default="{ color }">
|
|
329
|
-
<div
|
|
330
|
-
class="rounded h-[100px] text-5xl flex items-end"
|
|
331
|
-
:style="{
|
|
332
|
-
color,
|
|
333
|
-
} as CSSProperties"
|
|
334
|
-
>
|
|
335
|
-
Aa
|
|
336
|
-
</div>
|
|
337
|
-
</template>
|
|
338
|
-
</HstColorShades>
|
|
339
|
-
</Variant>
|
|
340
|
-
|
|
341
|
-
<Variant title="border">
|
|
342
|
-
<HstColorShades
|
|
343
|
-
v-for="(shades, key) of colors"
|
|
344
|
-
:key="key"
|
|
345
|
-
:shades="shades"
|
|
346
|
-
:get-name="shade => `${key}-${shade}`"
|
|
347
|
-
>
|
|
348
|
-
<template #default="{ color }">
|
|
349
|
-
<div
|
|
350
|
-
class="rounded h-[100px] border-solid border-2"
|
|
351
|
-
:style="{
|
|
352
|
-
borderColor: color,
|
|
353
|
-
} as CSSProperties"
|
|
354
|
-
/>
|
|
355
|
-
</template>
|
|
356
|
-
</HstColorShades>
|
|
357
|
-
</Variant>
|
|
358
|
-
|
|
359
|
-
<Variant
|
|
360
|
-
title="with search"
|
|
361
|
-
:init-state="() => ({
|
|
362
|
-
search: '',
|
|
363
|
-
})"
|
|
364
|
-
>
|
|
365
|
-
<template #default="{ state }">
|
|
366
|
-
<HstColorShades
|
|
367
|
-
v-for="(shades, key) of colors"
|
|
368
|
-
:key="key"
|
|
369
|
-
:shades="shades"
|
|
370
|
-
:get-name="shade => `${key}-${shade}`"
|
|
371
|
-
:search="state.search"
|
|
372
|
-
/>
|
|
373
|
-
</template>
|
|
374
|
-
|
|
375
|
-
<template #controls="{ state }">
|
|
376
|
-
<HstText
|
|
377
|
-
v-model="state.search"
|
|
378
|
-
title="Filter colors..."
|
|
379
|
-
/>
|
|
380
|
-
</template>
|
|
381
|
-
</Variant>
|
|
382
|
-
|
|
383
|
-
<Variant title="long names">
|
|
384
|
-
<HstColorShades
|
|
385
|
-
v-for="(shades, key) of colors"
|
|
386
|
-
:key="key"
|
|
387
|
-
:shades="shades"
|
|
388
|
-
:get-name="shade => `${'\'very-'.repeat(5)}long-${key}-${shade}`"
|
|
389
|
-
/>
|
|
390
|
-
</Variant>
|
|
391
|
-
</Story>
|
|
392
|
-
</template>
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
export default {
|
|
3
|
-
name: 'HstColorShades',
|
|
4
|
-
}
|
|
5
|
-
</script>
|
|
6
|
-
|
|
7
|
-
<script lang="ts" setup>
|
|
8
|
-
import type { CSSProperties } from 'vue'
|
|
9
|
-
import { VTooltip as vTooltip } from 'floating-vue'
|
|
10
|
-
import { computed, ref } from 'vue'
|
|
11
|
-
import HstCopyIcon from '../HstCopyIcon.vue'
|
|
12
|
-
|
|
13
|
-
const props = defineProps<{
|
|
14
|
-
shades: Record<string, any>
|
|
15
|
-
getName?: (key: string, color: string) => string
|
|
16
|
-
search?: string
|
|
17
|
-
}>()
|
|
18
|
-
|
|
19
|
-
function flattenShades(shades: Record<string, any>, path = ''): Record<string, string> {
|
|
20
|
-
return Object.entries(shades).reduce((acc, [key, color]) => {
|
|
21
|
-
const nextPath = path ? key === 'DEFAULT' ? path : `${path}-${key}` : key
|
|
22
|
-
const obj = typeof color === 'object' ? flattenShades(color, nextPath) : { [nextPath]: color }
|
|
23
|
-
return { ...acc, ...obj }
|
|
24
|
-
}, {})
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const shadesWithName = computed(() => {
|
|
28
|
-
const shades = props.shades
|
|
29
|
-
const getName = props.getName
|
|
30
|
-
const flatShades = flattenShades(shades)
|
|
31
|
-
return Object.entries(flatShades).map(([key, color]) => {
|
|
32
|
-
const name = getName ? getName(key, color) : key
|
|
33
|
-
return {
|
|
34
|
-
key,
|
|
35
|
-
color,
|
|
36
|
-
name,
|
|
37
|
-
}
|
|
38
|
-
})
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
const displayedShades = computed(() => {
|
|
42
|
-
let list = shadesWithName.value
|
|
43
|
-
if (props.search) {
|
|
44
|
-
const reg = new RegExp(props.search, 'i')
|
|
45
|
-
list = list.filter(({ name }) => reg.test(name))
|
|
46
|
-
}
|
|
47
|
-
return list
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
const hover = ref<string>(null)
|
|
51
|
-
</script>
|
|
52
|
-
|
|
53
|
-
<template>
|
|
54
|
-
<div
|
|
55
|
-
v-if="displayedShades.length"
|
|
56
|
-
class="poveste-color-shades grid gap-4 grid-cols-[repeat(auto-fill,minmax(200px,1fr))] m-4"
|
|
57
|
-
>
|
|
58
|
-
<div
|
|
59
|
-
v-for="shade of displayedShades"
|
|
60
|
-
:key="shade.key"
|
|
61
|
-
class="flex flex-col gap-2"
|
|
62
|
-
@mouseenter="hover = shade.key"
|
|
63
|
-
@mouseleave="hover = null"
|
|
64
|
-
>
|
|
65
|
-
<slot
|
|
66
|
-
:color="shade.color"
|
|
67
|
-
>
|
|
68
|
-
<div
|
|
69
|
-
class="rounded-full w-16 h-16"
|
|
70
|
-
:style="{
|
|
71
|
-
backgroundColor: shade.color,
|
|
72
|
-
} as CSSProperties"
|
|
73
|
-
/>
|
|
74
|
-
</slot>
|
|
75
|
-
<div>
|
|
76
|
-
<div class="flex gap-1">
|
|
77
|
-
<pre
|
|
78
|
-
v-tooltip="shade.name.length > 23 ? shade.name : ''"
|
|
79
|
-
class="my-0 truncate shrink"
|
|
80
|
-
>{{ shade.name }}</pre>
|
|
81
|
-
<HstCopyIcon
|
|
82
|
-
v-if="hover === shade.key"
|
|
83
|
-
:content="shade.name"
|
|
84
|
-
class="flex-none"
|
|
85
|
-
/>
|
|
86
|
-
</div>
|
|
87
|
-
<div class="flex gap-1">
|
|
88
|
-
<pre
|
|
89
|
-
v-tooltip="shade.color.length > 23 ? shade.color : ''"
|
|
90
|
-
class="my-0 opacity-50 truncate shrink"
|
|
91
|
-
>{{ shade.color }}</pre>
|
|
92
|
-
<HstCopyIcon
|
|
93
|
-
v-if="hover === shade.key"
|
|
94
|
-
:content="shade.color"
|
|
95
|
-
class="flex-none"
|
|
96
|
-
/>
|
|
97
|
-
</div>
|
|
98
|
-
</div>
|
|
99
|
-
</div>
|
|
100
|
-
</div>
|
|
101
|
-
</template>
|