@histoire/controls 0.16.1 → 0.16.5
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/components/HstCopyIcon.vue.d.ts +10 -13
- package/dist/components/HstWrapper.vue.d.ts +22 -30
- package/dist/components/button/HstButton.story.vue.d.ts +1 -1
- package/dist/components/button/HstButton.vue.d.ts +10 -15
- package/dist/components/button/HstButtonGroup.story.vue.d.ts +1 -1
- package/dist/components/button/HstButtonGroup.vue.d.ts +26 -21
- package/dist/components/checkbox/HstCheckbox.story.vue.d.ts +1 -1
- package/dist/components/checkbox/HstCheckbox.vue.d.ts +18 -19
- package/dist/components/checkbox/HstCheckboxList.story.vue.d.ts +1 -1
- package/dist/components/checkbox/HstCheckboxList.vue.d.ts +28 -21
- package/dist/components/checkbox/HstSimpleCheckbox.story.vue.d.ts +1 -1
- package/dist/components/checkbox/HstSimpleCheckbox.vue.d.ts +17 -18
- package/dist/components/colorselect/HstColorSelect.story.vue.d.ts +2 -0
- package/dist/components/colorselect/HstColorSelect.vue.d.ts +27 -0
- package/dist/components/design-tokens/HstColorShades.story.vue.d.ts +1 -1
- package/dist/components/design-tokens/HstColorShades.vue.d.ts +25 -20
- package/dist/components/design-tokens/HstTokenGrid.story.vue.d.ts +1 -1
- package/dist/components/design-tokens/HstTokenGrid.vue.d.ts +30 -32
- package/dist/components/design-tokens/HstTokenList.story.vue.d.ts +1 -1
- package/dist/components/design-tokens/HstTokenList.vue.d.ts +19 -18
- package/dist/components/json/HstJson.story.vue.d.ts +1 -1
- package/dist/components/json/HstJson.vue.d.ts +20 -19
- package/dist/components/number/HstNumber.story.vue.d.ts +1 -1
- package/dist/components/number/HstNumber.vue.d.ts +18 -19
- package/dist/components/radio/HstRadio.story.vue.d.ts +1 -1
- package/dist/components/radio/HstRadio.vue.d.ts +26 -21
- package/dist/components/select/CustomSelect.vue.d.ts +23 -20
- package/dist/components/select/HstSelect.story.vue.d.ts +1 -1
- package/dist/components/select/HstSelect.vue.d.ts +26 -21
- package/dist/components/slider/HstSlider.story.vue.d.ts +1 -1
- package/dist/components/slider/HstSlider.vue.d.ts +33 -22
- package/dist/components/text/HstText.story.vue.d.ts +1 -1
- package/dist/components/text/HstText.vue.d.ts +18 -19
- package/dist/components/textarea/HstTextarea.story.vue.d.ts +1 -1
- package/dist/components/textarea/HstTextarea.vue.d.ts +18 -19
- package/dist/index.d.ts +1708 -498
- package/dist/index.es.js +5288 -4782
- package/dist/style-standalone.css +155 -148
- package/dist/style.css +1 -1
- package/package.json +27 -26
- package/src/components/checkbox/HstCheckbox.vue +3 -3
- package/src/components/checkbox/HstCheckboxList.vue +3 -3
- package/src/components/checkbox/HstSimpleCheckbox.vue +2 -2
- package/src/components/checkbox/__snapshots__/HstCheckbox.spec.ts.snap +3 -69
- package/src/components/colorselect/HstColorSelect.story.vue +28 -0
- package/src/components/colorselect/HstColorSelect.vue +92 -0
- package/src/components/json/HstJson.vue +2 -2
- package/src/components/radio/HstRadio.vue +3 -3
- package/src/components/select/CustomSelect.vue +2 -2
- package/src/components/select/HstSelect.vue +2 -2
- package/src/index.ts +3 -0
- package/tsconfig.json +1 -2
- package/vite.config.ts +18 -10
- package/dist/peeky-preview.d.ts +0 -1
- package/peeky.config.ts +0 -21
- package/src/peeky-preview.ts +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@histoire/controls",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.5",
|
|
4
4
|
"description": "Prebuilt controls components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -31,33 +31,34 @@
|
|
|
31
31
|
"*.vue"
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@codemirror/commands": "^6.
|
|
35
|
-
"@codemirror/lang-json": "^6.0.
|
|
36
|
-
"@codemirror/language": "^6.
|
|
37
|
-
"@codemirror/lint": "^6.
|
|
38
|
-
"@codemirror/state": "^6.1
|
|
39
|
-
"@codemirror/theme-one-dark": "^6.1.
|
|
40
|
-
"@codemirror/view": "^6.
|
|
41
|
-
"@histoire/shared": "^0.16.
|
|
42
|
-
"@histoire/vendors": "^0.16.
|
|
34
|
+
"@codemirror/commands": "^6.2.4",
|
|
35
|
+
"@codemirror/lang-json": "^6.0.1",
|
|
36
|
+
"@codemirror/language": "^6.8.0",
|
|
37
|
+
"@codemirror/lint": "^6.4.0",
|
|
38
|
+
"@codemirror/state": "^6.2.1",
|
|
39
|
+
"@codemirror/theme-one-dark": "^6.1.2",
|
|
40
|
+
"@codemirror/view": "^6.16.0",
|
|
41
|
+
"@histoire/shared": "^0.16.5",
|
|
42
|
+
"@histoire/vendors": "^0.16.5"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@
|
|
46
|
-
"@
|
|
47
|
-
"@
|
|
48
|
-
"@
|
|
49
|
-
"@
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"postcss": "^8.4.
|
|
45
|
+
"@types/node": "^17.0.45",
|
|
46
|
+
"@vitejs/plugin-vue": "^4.2.3",
|
|
47
|
+
"@vue/runtime-dom": "^3.3.4",
|
|
48
|
+
"@vue/test-utils": "^2.4.1",
|
|
49
|
+
"@vueuse/core": "^9.13.0",
|
|
50
|
+
"autoprefixer": "^10.4.15",
|
|
51
|
+
"concurrently": "^7.6.0",
|
|
52
|
+
"floating-vue": "2.0.0-beta.19",
|
|
53
|
+
"jsdom": "^22.1.0",
|
|
54
|
+
"postcss": "^8.4.27",
|
|
55
55
|
"postcss-import": "^14.1.0",
|
|
56
|
-
"tailwindcss": "^3.
|
|
56
|
+
"tailwindcss": "^3.3.3",
|
|
57
57
|
"typescript": "^4.9.5",
|
|
58
|
-
"vite": "^4.
|
|
59
|
-
"
|
|
60
|
-
"vue
|
|
58
|
+
"vite": "^4.4.9",
|
|
59
|
+
"vitest": "^0.34.1",
|
|
60
|
+
"vue": "^3.3.4",
|
|
61
|
+
"vue-tsc": "^1.8.8"
|
|
61
62
|
},
|
|
62
63
|
"scripts": {
|
|
63
64
|
"build": "rimraf dist && pnpm run build:css && vite build && pnpm run build:types",
|
|
@@ -65,7 +66,7 @@
|
|
|
65
66
|
"build:types": "vue-tsc --declaration --emitDeclarationOnly",
|
|
66
67
|
"watch": "concurrently \"vite build --watch\" \"pnpm run build:types --watch\"",
|
|
67
68
|
"watch:full": "concurrently \"vite build --watch\" \"pnpm run build:css --watch\" \"pnpm run build:types --watch\"",
|
|
68
|
-
"test
|
|
69
|
-
"test": "
|
|
69
|
+
"test": "vitest run",
|
|
70
|
+
"test:dev": "vitest"
|
|
70
71
|
}
|
|
71
72
|
}
|
|
@@ -16,17 +16,17 @@ const props = defineProps<{
|
|
|
16
16
|
title?: string
|
|
17
17
|
}>()
|
|
18
18
|
|
|
19
|
-
const
|
|
19
|
+
const emit = defineEmits({
|
|
20
20
|
'update:modelValue': (newValue: Booleanish) => true,
|
|
21
21
|
})
|
|
22
22
|
|
|
23
23
|
function toggle () {
|
|
24
24
|
if (typeof props.modelValue === 'string') {
|
|
25
|
-
|
|
25
|
+
emit('update:modelValue', props.modelValue === 'false' ? 'true' : 'false')
|
|
26
26
|
return
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
emit('update:modelValue', !props.modelValue)
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
const isTrue = computed(() => {
|
|
@@ -29,15 +29,15 @@ const formattedOptions: ComputedRef<Record<string, string>> = computed(() => {
|
|
|
29
29
|
return props.options
|
|
30
30
|
})
|
|
31
31
|
|
|
32
|
-
const
|
|
32
|
+
const emit = defineEmits<{
|
|
33
33
|
(e: 'update:modelValue', value: Array<string>): void
|
|
34
34
|
}>()
|
|
35
35
|
|
|
36
36
|
function toggleOption (value: string) {
|
|
37
37
|
if (props.modelValue.includes(value)) {
|
|
38
|
-
|
|
38
|
+
emit('update:modelValue', props.modelValue.filter(element => element !== value))
|
|
39
39
|
} else {
|
|
40
|
-
|
|
40
|
+
emit('update:modelValue', [...props.modelValue, value])
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
</script>
|
|
@@ -12,7 +12,7 @@ const props = defineProps<{
|
|
|
12
12
|
withToggle?: boolean
|
|
13
13
|
}>()
|
|
14
14
|
|
|
15
|
-
const
|
|
15
|
+
const emit = defineEmits({
|
|
16
16
|
'update:modelValue': (newValue: boolean) => true,
|
|
17
17
|
})
|
|
18
18
|
|
|
@@ -21,7 +21,7 @@ function toggle () {
|
|
|
21
21
|
return
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
emit('update:modelValue', !props.modelValue)
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
watch(() => props.modelValue, () => {
|
|
@@ -1,71 +1,5 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
2
|
|
|
3
|
-
exports[`HstCheckbox toggle to checked 1`] = `
|
|
4
|
-
<label
|
|
5
|
-
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"
|
|
6
|
-
role="checkbox"
|
|
7
|
-
tabindex="0"
|
|
8
|
-
>
|
|
9
|
-
<span class="htw-w-28 htw-whitespace-nowrap htw-text-ellipsis htw-overflow-hidden htw-shrink-0 v-popper--has-tooltip">
|
|
10
|
-
Label
|
|
11
|
-
</span>
|
|
12
|
-
<span class="htw-grow htw-max-w-full htw-flex htw-items-center htw-gap-1">
|
|
13
|
-
<span class="htw-block htw-grow htw-max-w-full">
|
|
14
|
-
<div class="histoire-simple-checkbox htw-group htw-text-white htw-w-[16px] htw-h-[16px] htw-relative">
|
|
15
|
-
<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">
|
|
16
|
-
</div>
|
|
17
|
-
<svg
|
|
18
|
-
width="16"
|
|
19
|
-
height="16"
|
|
20
|
-
viewbox="0 0 24 24"
|
|
21
|
-
class="htw-relative htw-z-10"
|
|
22
|
-
>
|
|
23
|
-
<path
|
|
24
|
-
d="m 4 12 l 5 5 l 10 -10"
|
|
25
|
-
fill="none"
|
|
26
|
-
class="htw-stroke-white htw-stroke-2 htw-duration-200 htw-ease-in-out htw-transition-none"
|
|
27
|
-
stroke-dasharray="21.21"
|
|
28
|
-
stroke-dashoffset="21.21"
|
|
29
|
-
>
|
|
30
|
-
</path>
|
|
31
|
-
</svg>
|
|
32
|
-
</div>
|
|
33
|
-
</span>
|
|
34
|
-
</span>
|
|
35
|
-
</label>
|
|
36
|
-
`;
|
|
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>"`;
|
|
37
4
|
|
|
38
|
-
exports[`HstCheckbox toggle to unchecked 1`] = `
|
|
39
|
-
<label
|
|
40
|
-
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"
|
|
41
|
-
role="checkbox"
|
|
42
|
-
tabindex="0"
|
|
43
|
-
>
|
|
44
|
-
<span class="htw-w-28 htw-whitespace-nowrap htw-text-ellipsis htw-overflow-hidden htw-shrink-0 v-popper--has-tooltip">
|
|
45
|
-
Label
|
|
46
|
-
</span>
|
|
47
|
-
<span class="htw-grow htw-max-w-full htw-flex htw-items-center htw-gap-1">
|
|
48
|
-
<span class="htw-block htw-grow htw-max-w-full">
|
|
49
|
-
<div class="histoire-simple-checkbox htw-group htw-text-white htw-w-[16px] htw-h-[16px] htw-relative">
|
|
50
|
-
<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">
|
|
51
|
-
</div>
|
|
52
|
-
<svg
|
|
53
|
-
width="16"
|
|
54
|
-
height="16"
|
|
55
|
-
viewbox="0 0 24 24"
|
|
56
|
-
class="htw-relative htw-z-10"
|
|
57
|
-
>
|
|
58
|
-
<path
|
|
59
|
-
d="m 4 12 l 5 5 l 10 -10"
|
|
60
|
-
fill="none"
|
|
61
|
-
class="htw-stroke-white htw-stroke-2 htw-duration-200 htw-ease-in-out htw-transition-none htw-delay-150"
|
|
62
|
-
stroke-dasharray="21.21"
|
|
63
|
-
stroke-dashoffset="0"
|
|
64
|
-
>
|
|
65
|
-
</path>
|
|
66
|
-
</svg>
|
|
67
|
-
</div>
|
|
68
|
-
</span>
|
|
69
|
-
</span>
|
|
70
|
-
</label>
|
|
71
|
-
`;
|
|
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,92 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
export default {
|
|
3
|
+
name: 'HstColorSelector',
|
|
4
|
+
inheritAttrs: false,
|
|
5
|
+
}
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<script lang="ts" setup>
|
|
9
|
+
import { computed, ref } from 'vue'
|
|
10
|
+
import HstWrapper from '../HstWrapper.vue'
|
|
11
|
+
|
|
12
|
+
const props = defineProps<{
|
|
13
|
+
title?: string
|
|
14
|
+
modelValue?: string
|
|
15
|
+
}>()
|
|
16
|
+
|
|
17
|
+
const emit = defineEmits({
|
|
18
|
+
'update:modelValue': (newValue: string) => true,
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
const input = ref<HTMLInputElement>(null)
|
|
22
|
+
|
|
23
|
+
const stringModel = computed({
|
|
24
|
+
get: () => props.modelValue,
|
|
25
|
+
set: value => {
|
|
26
|
+
emit('update:modelValue', value)
|
|
27
|
+
},
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
function throttle(cb, delay = 15) {
|
|
31
|
+
let shouldWait = false
|
|
32
|
+
let waitingArgs
|
|
33
|
+
const timeoutFunc = () => {
|
|
34
|
+
if (waitingArgs == null) {
|
|
35
|
+
shouldWait = false
|
|
36
|
+
} else {
|
|
37
|
+
cb(...waitingArgs)
|
|
38
|
+
waitingArgs = null
|
|
39
|
+
setTimeout(timeoutFunc, delay)
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return (...args) => {
|
|
44
|
+
if (shouldWait) {
|
|
45
|
+
waitingArgs = args
|
|
46
|
+
return
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
cb(...args)
|
|
50
|
+
shouldWait = true
|
|
51
|
+
setTimeout(timeoutFunc, delay)
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
const updateValue = throttle((value: string) => {
|
|
55
|
+
emit('update:modelValue', value)
|
|
56
|
+
})
|
|
57
|
+
function processChange(inp) {
|
|
58
|
+
updateValue(inp)
|
|
59
|
+
}
|
|
60
|
+
</script>
|
|
61
|
+
|
|
62
|
+
<script>
|
|
63
|
+
|
|
64
|
+
</script>
|
|
65
|
+
|
|
66
|
+
<template>
|
|
67
|
+
<HstWrapper
|
|
68
|
+
:title="title"
|
|
69
|
+
class="histoire-select htw-cursor-text htw-items-center"
|
|
70
|
+
:class="$attrs.class"
|
|
71
|
+
:style="$attrs.style"
|
|
72
|
+
>
|
|
73
|
+
<div class="htw-flex htw-flex-row htw-gap-1">
|
|
74
|
+
<input
|
|
75
|
+
ref="input"
|
|
76
|
+
v-bind="{ ...$attrs, class: null, style: null }"
|
|
77
|
+
v-model="stringModel"
|
|
78
|
+
type="text"
|
|
79
|
+
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"
|
|
80
|
+
>
|
|
81
|
+
<input
|
|
82
|
+
type="color"
|
|
83
|
+
:value="modelValue"
|
|
84
|
+
@input="((e) => processChange((e.target as HTMLInputElement).value as string))"
|
|
85
|
+
>
|
|
86
|
+
</div>
|
|
87
|
+
|
|
88
|
+
<template #actions>
|
|
89
|
+
<slot name="actions" />
|
|
90
|
+
</template>
|
|
91
|
+
</HstWrapper>
|
|
92
|
+
</template>
|
|
@@ -38,7 +38,7 @@ const props = defineProps<{
|
|
|
38
38
|
modelValue: unknown
|
|
39
39
|
}>()
|
|
40
40
|
|
|
41
|
-
const
|
|
41
|
+
const emit = defineEmits({
|
|
42
42
|
'update:modelValue': (newValue: unknown) => true,
|
|
43
43
|
})
|
|
44
44
|
|
|
@@ -106,7 +106,7 @@ watch(() => props.modelValue, () => {
|
|
|
106
106
|
watch(() => internalValue.value, () => {
|
|
107
107
|
invalidValue.value = false
|
|
108
108
|
try {
|
|
109
|
-
|
|
109
|
+
emit('update:modelValue', JSON.parse(internalValue.value))
|
|
110
110
|
} catch (e) {
|
|
111
111
|
invalidValue.value = true
|
|
112
112
|
}
|
|
@@ -55,9 +55,9 @@ const animationEnabled = ref(false)
|
|
|
55
55
|
:key="value"
|
|
56
56
|
>
|
|
57
57
|
<input
|
|
58
|
-
:id="`${value}-
|
|
58
|
+
:id="`${value}-radio_${title}`"
|
|
59
59
|
type="radio"
|
|
60
|
-
:name="`${value}-
|
|
60
|
+
:name="`${value}-radio_${title}`"
|
|
61
61
|
:value="value"
|
|
62
62
|
:checked="value === modelValue"
|
|
63
63
|
class="htw-hidden"
|
|
@@ -65,7 +65,7 @@ const animationEnabled = ref(false)
|
|
|
65
65
|
>
|
|
66
66
|
<label
|
|
67
67
|
tabindex="0"
|
|
68
|
-
:for="`${value}-
|
|
68
|
+
:for="`${value}-radio_${title}`"
|
|
69
69
|
class="htw-cursor-pointer htw-flex htw-items-center htw-relative htw-py-1 htw-group"
|
|
70
70
|
@keydown.enter.prevent="selectOption(value)"
|
|
71
71
|
@keydown.space.prevent="selectOption(value)"
|
|
@@ -15,7 +15,7 @@ const props = defineProps<{
|
|
|
15
15
|
options: Record<string, any> | string[] | number[] | HstControlOption[]
|
|
16
16
|
}>()
|
|
17
17
|
|
|
18
|
-
const
|
|
18
|
+
const emit = defineEmits<{
|
|
19
19
|
(e: 'update:modelValue', value: string): void
|
|
20
20
|
}>()
|
|
21
21
|
|
|
@@ -36,7 +36,7 @@ const formattedOptions: ComputedRef<[any, string][]> = computed(() => {
|
|
|
36
36
|
const selectedLabel = computed(() => formattedOptions.value.find(([value]) => value === props.modelValue)?.[1])
|
|
37
37
|
|
|
38
38
|
function selectValue (value: any, hide: () => void) {
|
|
39
|
-
|
|
39
|
+
emit('update:modelValue', value)
|
|
40
40
|
hide()
|
|
41
41
|
}
|
|
42
42
|
</script>
|
|
@@ -15,7 +15,7 @@ defineProps<{
|
|
|
15
15
|
options: Record<string, any> | string[] | HstControlOption[]
|
|
16
16
|
}>()
|
|
17
17
|
|
|
18
|
-
const
|
|
18
|
+
const emit = defineEmits<{
|
|
19
19
|
(e: 'update:modelValue', value: any): void
|
|
20
20
|
}>()
|
|
21
21
|
</script>
|
|
@@ -30,7 +30,7 @@ const emits = defineEmits<{
|
|
|
30
30
|
<CustomSelect
|
|
31
31
|
:options="options"
|
|
32
32
|
:model-value="modelValue"
|
|
33
|
-
@update:model-value="
|
|
33
|
+
@update:model-value="emit('update:modelValue', $event)"
|
|
34
34
|
/>
|
|
35
35
|
|
|
36
36
|
<template #actions>
|
package/src/index.ts
CHANGED
|
@@ -13,6 +13,7 @@ import HstTokenGridVue from './components/design-tokens/HstTokenGrid.vue'
|
|
|
13
13
|
import HstCopyIconVue from './components/HstCopyIcon.vue'
|
|
14
14
|
import HstRadioVue from './components/radio/HstRadio.vue'
|
|
15
15
|
import HstJsonVue from './components/json/HstJson.vue'
|
|
16
|
+
import HstColorSelectVue from './components/colorselect/HstColorSelect.vue'
|
|
16
17
|
|
|
17
18
|
export const HstButton = HstButtonVue
|
|
18
19
|
export const HstButtonGroup = HstButtonGroupVue
|
|
@@ -29,6 +30,7 @@ export const HstTokenGrid = HstTokenGridVue
|
|
|
29
30
|
export const HstCopyIcon = HstCopyIconVue
|
|
30
31
|
export const HstRadio = HstRadioVue
|
|
31
32
|
export const HstJson = HstJsonVue
|
|
33
|
+
export const HstColorSelect = HstColorSelectVue
|
|
32
34
|
|
|
33
35
|
export const components = {
|
|
34
36
|
HstButton,
|
|
@@ -46,6 +48,7 @@ export const components = {
|
|
|
46
48
|
HstTokenList,
|
|
47
49
|
HstTokenGrid,
|
|
48
50
|
HstCopyIcon,
|
|
51
|
+
HstColorSelect,
|
|
49
52
|
}
|
|
50
53
|
|
|
51
54
|
export * from './types'
|
package/tsconfig.json
CHANGED
package/vite.config.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/// <reference types="vitest" />
|
|
2
|
+
|
|
1
3
|
import { defineConfig } from 'vite'
|
|
2
4
|
import vue from '@vitejs/plugin-vue'
|
|
3
5
|
|
|
@@ -5,17 +7,18 @@ export default defineConfig({
|
|
|
5
7
|
plugins: [
|
|
6
8
|
vue(),
|
|
7
9
|
],
|
|
8
|
-
|
|
9
10
|
resolve: {
|
|
10
|
-
alias:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
alias: process.env.VITEST
|
|
12
|
+
? {}
|
|
13
|
+
: {
|
|
14
|
+
'floating-vue': '@histoire/vendors/floating-vue',
|
|
15
|
+
'@iconify/vue': '@histoire/vendors/iconify',
|
|
16
|
+
pinia: '@histoire/vendors/pinia',
|
|
17
|
+
'scroll-into-view-if-needed': '@histoire/vendors/scroll',
|
|
18
|
+
'vue-router': '@histoire/vendors/vue-router',
|
|
19
|
+
'@vueuse/core': '@histoire/vendors/vue-use',
|
|
20
|
+
vue: '@histoire/vendors/vue',
|
|
21
|
+
},
|
|
19
22
|
},
|
|
20
23
|
|
|
21
24
|
build: {
|
|
@@ -35,4 +38,9 @@ export default defineConfig({
|
|
|
35
38
|
],
|
|
36
39
|
},
|
|
37
40
|
},
|
|
41
|
+
|
|
42
|
+
test: {
|
|
43
|
+
environment: 'jsdom',
|
|
44
|
+
globals: true,
|
|
45
|
+
},
|
|
38
46
|
})
|
package/dist/peeky-preview.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import './style/main.css';
|
package/peeky.config.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from '@peeky/test'
|
|
2
|
-
|
|
3
|
-
export default defineConfig({
|
|
4
|
-
runtimeEnv: 'dom',
|
|
5
|
-
previewSetupFiles: [
|
|
6
|
-
'src/peeky-preview.ts',
|
|
7
|
-
],
|
|
8
|
-
vite: {
|
|
9
|
-
resolve: {
|
|
10
|
-
alias: {
|
|
11
|
-
'floating-vue': 'floating-vue',
|
|
12
|
-
'@iconify/vue': '@iconify/vue',
|
|
13
|
-
pinia: 'pinia',
|
|
14
|
-
'scroll-into-view-if-needed': 'scroll-into-view-if-needed',
|
|
15
|
-
'vue-router': 'vue-router',
|
|
16
|
-
'@vueuse/core': '@vueuse/core',
|
|
17
|
-
vue: 'vue',
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
})
|
package/src/peeky-preview.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import './style/main.css'
|