@poveste/controls 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +5 -0
  3. package/dist/components/HstCopyIcon.story.vue.d.ts +2 -0
  4. package/dist/components/HstCopyIcon.vue.d.ts +7 -0
  5. package/dist/components/HstWrapper.vue.d.ts +20 -0
  6. package/dist/components/button/HstButton.story.vue.d.ts +2 -0
  7. package/dist/components/button/HstButton.vue.d.ts +13 -0
  8. package/dist/components/button/HstButtonGroup.story.vue.d.ts +2 -0
  9. package/dist/components/button/HstButtonGroup.vue.d.ts +22 -0
  10. package/dist/components/checkbox/HstCheckbox.story.vue.d.ts +2 -0
  11. package/dist/components/checkbox/HstCheckbox.vue.d.ts +19 -0
  12. package/dist/components/checkbox/HstCheckboxList.story.vue.d.ts +2 -0
  13. package/dist/components/checkbox/HstCheckboxList.vue.d.ts +22 -0
  14. package/dist/components/checkbox/HstSimpleCheckbox.story.vue.d.ts +2 -0
  15. package/dist/components/checkbox/HstSimpleCheckbox.vue.d.ts +12 -0
  16. package/dist/components/colorselect/HstColorSelect.story.vue.d.ts +2 -0
  17. package/dist/components/colorselect/HstColorSelect.vue.d.ts +19 -0
  18. package/dist/components/design-tokens/HstColorShades.story.vue.d.ts +2 -0
  19. package/dist/components/design-tokens/HstColorShades.vue.d.ts +19 -0
  20. package/dist/components/design-tokens/HstTokenGrid.story.vue.d.ts +2 -0
  21. package/dist/components/design-tokens/HstTokenGrid.vue.d.ts +26 -0
  22. package/dist/components/design-tokens/HstTokenList.story.vue.d.ts +2 -0
  23. package/dist/components/design-tokens/HstTokenList.vue.d.ts +21 -0
  24. package/dist/components/json/HstJson.story.vue.d.ts +2 -0
  25. package/dist/components/json/HstJson.vue.d.ts +19 -0
  26. package/dist/components/number/HstNumber.story.vue.d.ts +2 -0
  27. package/dist/components/number/HstNumber.vue.d.ts +19 -0
  28. package/dist/components/radio/HstRadio.story.vue.d.ts +2 -0
  29. package/dist/components/radio/HstRadio.vue.d.ts +22 -0
  30. package/dist/components/select/CustomSelect.vue.d.ts +22 -0
  31. package/dist/components/select/HstSelect.story.vue.d.ts +2 -0
  32. package/dist/components/select/HstSelect.vue.d.ts +22 -0
  33. package/dist/components/slider/HstSlider.story.vue.d.ts +2 -0
  34. package/dist/components/slider/HstSlider.vue.d.ts +16 -0
  35. package/dist/components/text/HstText.story.vue.d.ts +2 -0
  36. package/dist/components/text/HstText.vue.d.ts +19 -0
  37. package/dist/components/textarea/HstTextarea.story.vue.d.ts +2 -0
  38. package/dist/components/textarea/HstTextarea.vue.d.ts +19 -0
  39. package/dist/index.d.ts +1047 -0
  40. package/dist/index.es.css +1 -0
  41. package/dist/index.es.js +16392 -0
  42. package/dist/style-standalone.css +973 -0
  43. package/dist/types.d.ts +4 -0
  44. package/dist/utils.d.ts +1 -0
  45. package/package.json +72 -0
  46. package/postcss.config.cjs +8 -0
  47. package/src/components/HstCopyIcon.story.vue +26 -0
  48. package/src/components/HstCopyIcon.vue +38 -0
  49. package/src/components/HstWrapper.vue +41 -0
  50. package/src/components/button/HstButton.story.vue +30 -0
  51. package/src/components/button/HstButton.vue +26 -0
  52. package/src/components/button/HstButtonGroup.story.vue +79 -0
  53. package/src/components/button/HstButtonGroup.vue +71 -0
  54. package/src/components/checkbox/HstCheckbox.spec.ts +28 -0
  55. package/src/components/checkbox/HstCheckbox.story.vue +47 -0
  56. package/src/components/checkbox/HstCheckbox.vue +56 -0
  57. package/src/components/checkbox/HstCheckboxList.story.vue +49 -0
  58. package/src/components/checkbox/HstCheckboxList.vue +82 -0
  59. package/src/components/checkbox/HstSimpleCheckbox.story.vue +28 -0
  60. package/src/components/checkbox/HstSimpleCheckbox.vue +82 -0
  61. package/src/components/checkbox/__snapshots__/HstCheckbox.spec.ts.snap +5 -0
  62. package/src/components/colorselect/HstColorSelect.story.vue +28 -0
  63. package/src/components/colorselect/HstColorSelect.vue +89 -0
  64. package/src/components/design-tokens/HstColorShades.story.vue +392 -0
  65. package/src/components/design-tokens/HstColorShades.vue +101 -0
  66. package/src/components/design-tokens/HstTokenGrid.story.vue +36 -0
  67. package/src/components/design-tokens/HstTokenGrid.vue +88 -0
  68. package/src/components/design-tokens/HstTokenList.story.vue +81 -0
  69. package/src/components/design-tokens/HstTokenList.vue +62 -0
  70. package/src/components/json/HstJson.story.vue +41 -0
  71. package/src/components/json/HstJson.vue +151 -0
  72. package/src/components/number/HstNumber.story.vue +42 -0
  73. package/src/components/number/HstNumber.vue +95 -0
  74. package/src/components/radio/HstRadio.story.vue +51 -0
  75. package/src/components/radio/HstRadio.vue +109 -0
  76. package/src/components/select/CustomSelect.vue +119 -0
  77. package/src/components/select/HstSelect.story.vue +161 -0
  78. package/src/components/select/HstSelect.vue +40 -0
  79. package/src/components/slider/HstSlider.story.vue +37 -0
  80. package/src/components/slider/HstSlider.vue +103 -0
  81. package/src/components/text/HstText.story.vue +63 -0
  82. package/src/components/text/HstText.vue +44 -0
  83. package/src/components/textarea/HstTextarea.story.vue +35 -0
  84. package/src/components/textarea/HstTextarea.vue +44 -0
  85. package/src/end.d.ts +8 -0
  86. package/src/index.ts +54 -0
  87. package/src/style/main.css +17 -0
  88. package/src/types.ts +4 -0
  89. package/src/utils.ts +12 -0
  90. package/tailwind.config.cjs +13 -0
  91. package/tsconfig.json +53 -0
  92. package/vite.config.ts +46 -0
@@ -0,0 +1,28 @@
1
+ <script lang="ts" setup>
2
+ import HstSimpleCheckbox from './HstSimpleCheckbox.vue'
3
+
4
+ function initState() {
5
+ return {
6
+ checked: true,
7
+ }
8
+ }
9
+ </script>
10
+
11
+ <template>
12
+ <Story
13
+ title="internals/HstSimpleCheckbox"
14
+ :layout="{ type: 'single', iframe: false }"
15
+ >
16
+ <Variant
17
+ title="playground"
18
+ :init-state="initState"
19
+ >
20
+ <template #default="{ state }">
21
+ <HstSimpleCheckbox
22
+ v-model="state.checked"
23
+ with-toggle
24
+ />
25
+ </template>
26
+ </Variant>
27
+ </Story>
28
+ </template>
@@ -0,0 +1,82 @@
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="histoire-simple-checkbox htw-group htw-text-white htw-w-[16px] htw-h-[16px] htw-relative"
49
+ :class="{ 'htw-cursor-pointer': withToggle }"
50
+ @click="toggle"
51
+ >
52
+ <div
53
+ class="htw-border htw-border-solid group-active:htw-bg-gray-500/20 htw-rounded-sm htw-box-border htw-absolute htw-inset-0 htw-transition-border htw-duration-150 htw-ease-out group-hover:htw-border-primary-500 group-hover:dark:htw-border-primary-500"
54
+ :class="[
55
+ modelValue
56
+ ? 'htw-border-primary-500 htw-border-8'
57
+ : 'htw-border-black/25 dark:htw-border-white/25 htw-delay-150',
58
+ ]"
59
+ />
60
+ <svg
61
+ width="16"
62
+ height="16"
63
+ viewBox="0 0 24 24"
64
+ class="htw-relative htw-z-10"
65
+ >
66
+ <path
67
+ ref="path"
68
+ d="m 4 12 l 5 5 l 10 -10"
69
+ fill="none"
70
+ class="htw-stroke-white htw-stroke-2 htw-duration-200 htw-ease-in-out"
71
+ :class="[
72
+ animationEnabled ? 'htw-transition-all' : 'htw-transition-none',
73
+ {
74
+ 'htw-delay-150': modelValue,
75
+ },
76
+ ]"
77
+ :stroke-dasharray="dasharray"
78
+ :stroke-dashoffset="dashoffset"
79
+ />
80
+ </svg>
81
+ </div>
82
+ </template>
@@ -0,0 +1,5 @@
1
+ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
+
3
+ exports[`hstCheckbox > toggle to checked 1`] = `"<label class="histoire-wrapper htw-p-2 hover:htw-bg-primary-100 dark:hover:htw-bg-primary-800 htw-flex htw-gap-2 htw-flex-wrap histoire-checkbox htw-cursor-pointer htw-items-center" role="checkbox" tabindex="0"><span class="htw-w-28 htw-whitespace-nowrap htw-text-ellipsis htw-overflow-hidden htw-shrink-0 v-popper--has-tooltip">Label</span><span class="htw-grow htw-max-w-full htw-flex htw-items-center htw-gap-1"><span class="htw-block htw-grow htw-max-w-full"><div class="histoire-simple-checkbox htw-group htw-text-white htw-w-[16px] htw-h-[16px] htw-relative"><div class="htw-border htw-border-solid group-active:htw-bg-gray-500/20 htw-rounded-sm htw-box-border htw-absolute htw-inset-0 htw-transition-border htw-duration-150 htw-ease-out group-hover:htw-border-primary-500 group-hover:dark:htw-border-primary-500 htw-border-black/25 dark:htw-border-white/25 htw-delay-150"></div><svg width="16" height="16" viewBox="0 0 24 24" class="htw-relative htw-z-10"><path d="m 4 12 l 5 5 l 10 -10" fill="none" class="htw-stroke-white htw-stroke-2 htw-duration-200 htw-ease-in-out htw-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="histoire-wrapper htw-p-2 hover:htw-bg-primary-100 dark:hover:htw-bg-primary-800 htw-flex htw-gap-2 htw-flex-wrap histoire-checkbox htw-cursor-pointer htw-items-center" role="checkbox" tabindex="0"><span class="htw-w-28 htw-whitespace-nowrap htw-text-ellipsis htw-overflow-hidden htw-shrink-0 v-popper--has-tooltip">Label</span><span class="htw-grow htw-max-w-full htw-flex htw-items-center htw-gap-1"><span class="htw-block htw-grow htw-max-w-full"><div class="histoire-simple-checkbox htw-group htw-text-white htw-w-[16px] htw-h-[16px] htw-relative"><div class="htw-border htw-border-solid group-active:htw-bg-gray-500/20 htw-rounded-sm htw-box-border htw-absolute htw-inset-0 htw-transition-border htw-duration-150 htw-ease-out group-hover:htw-border-primary-500 group-hover:dark:htw-border-primary-500 htw-border-primary-500 htw-border-8"></div><svg width="16" height="16" viewBox="0 0 24 24" class="htw-relative htw-z-10"><path d="m 4 12 l 5 5 l 10 -10" fill="none" class="htw-stroke-white htw-stroke-2 htw-duration-200 htw-ease-in-out htw-transition-none htw-delay-150" stroke-dasharray="21.21" stroke-dashoffset="0"></path></svg></div></span></span></label>"`;
@@ -0,0 +1,28 @@
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>
@@ -0,0 +1,89 @@
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="histoire-select htw-cursor-text htw-items-center"
68
+ :class="$attrs.class"
69
+ :style="$attrs.style"
70
+ >
71
+ <div class="htw-flex htw-flex-row htw-gap-1">
72
+ <input
73
+ v-bind="{ ...$attrs, class: null, style: null }"
74
+ v-model="stringModel"
75
+ type="text"
76
+ class="htw-text-inherit htw-bg-transparent htw-w-full htw-outline-none htw-px-2 htw-py-1 -htw-my-1 htw-border htw-border-solid htw-border-black/25 dark:htw-border-white/25 focus:htw-border-primary-500 dark:focus:htw-border-primary-500 htw-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>
@@ -0,0 +1,392 @@
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="htw-rounded htw-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="htw-rounded htw-h-[100px] htw-text-5xl htw-flex htw-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="htw-rounded htw-h-[100px] htw-border-solid htw-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>