@histoire/controls 0.7.9 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/select/CustomSelect.vue.d.ts +2 -2
- package/dist/components/select/HstSelect.vue.d.ts +4 -4
- package/dist/index.d.ts +369 -76
- package/dist/index.es.js +345 -5072
- package/dist/types.d.ts +1 -1
- package/package.json +4 -6
- package/peeky.config.ts +21 -0
- package/src/components/HstWrapper.vue +1 -1
- package/src/components/radio/HstRadio.vue +0 -2
- package/src/components/select/CustomSelect.vue +12 -11
- package/src/components/select/HstSelect.vue +2 -2
- package/src/components/slider/HstSlider.vue +1 -1
- package/src/components/text/HstText.vue +1 -1
- package/src/components/textarea/HstTextarea.vue +1 -1
- package/src/index.ts +13 -12
- package/src/types.ts +1 -1
- package/tsconfig.json +10 -0
- package/vite.config.ts +12 -9
package/dist/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@histoire/controls",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.2",
|
|
4
4
|
"description": "Prebuilt controls components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -31,9 +31,7 @@
|
|
|
31
31
|
"*.vue"
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@
|
|
35
|
-
"@vueuse/core": "^8.2.5",
|
|
36
|
-
"floating-vue": "^2.0.0-beta.16"
|
|
34
|
+
"@histoire/vendors": "^0.8.2"
|
|
37
35
|
},
|
|
38
36
|
"devDependencies": {
|
|
39
37
|
"@peeky/test": "^0.13.5",
|
|
@@ -44,11 +42,11 @@
|
|
|
44
42
|
"autoprefixer": "^10.4.4",
|
|
45
43
|
"concurrently": "^7.1.0",
|
|
46
44
|
"floating-vue": "^2.0.0-beta.16",
|
|
47
|
-
"histoire": "0.
|
|
45
|
+
"histoire": "0.8.2",
|
|
48
46
|
"postcss": "^8.4.12",
|
|
49
47
|
"postcss-import": "^14.1.0",
|
|
50
48
|
"tailwindcss": "^3.0.23",
|
|
51
|
-
"typescript": "^4.
|
|
49
|
+
"typescript": "^4.7.4",
|
|
52
50
|
"vite": "^2.9.1",
|
|
53
51
|
"vue": "^3.2.31",
|
|
54
52
|
"vue-tsc": "^0.35.2"
|
package/peeky.config.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
})
|
|
@@ -12,29 +12,30 @@ import { HstControlOption } from '../../types'
|
|
|
12
12
|
|
|
13
13
|
const props = defineProps<{
|
|
14
14
|
modelValue: string
|
|
15
|
-
options: Record<string,
|
|
15
|
+
options: Record<string, any> | string[] | HstControlOption[]
|
|
16
16
|
}>()
|
|
17
17
|
|
|
18
18
|
const emits = defineEmits<{
|
|
19
19
|
(e: 'update:modelValue', value: string): void
|
|
20
20
|
}>()
|
|
21
21
|
|
|
22
|
-
const formattedOptions: ComputedRef<
|
|
22
|
+
const formattedOptions: ComputedRef<[any, string][]> = computed(() => {
|
|
23
23
|
if (Array.isArray(props.options)) {
|
|
24
|
-
return
|
|
25
|
-
if (typeof
|
|
26
|
-
return [
|
|
24
|
+
return props.options.map(option => {
|
|
25
|
+
if (typeof option === 'string') {
|
|
26
|
+
return [option, option] as [string, string]
|
|
27
27
|
} else {
|
|
28
|
-
return [
|
|
28
|
+
return [option.value, option.label] as [any, string]
|
|
29
29
|
}
|
|
30
|
-
})
|
|
30
|
+
})
|
|
31
|
+
} else {
|
|
32
|
+
return Object.entries(props.options)
|
|
31
33
|
}
|
|
32
|
-
return props.options
|
|
33
34
|
})
|
|
34
35
|
|
|
35
|
-
const selectedLabel = computed(() => formattedOptions.value[props.modelValue])
|
|
36
|
+
const selectedLabel = computed(() => formattedOptions.value.find(([value]) => value === props.modelValue)?.[1])
|
|
36
37
|
|
|
37
|
-
function selectValue (value:
|
|
38
|
+
function selectValue (value: any, hide: () => void) {
|
|
38
39
|
emits('update:modelValue', value)
|
|
39
40
|
hide()
|
|
40
41
|
}
|
|
@@ -60,7 +61,7 @@ function selectValue (value: string, hide: () => void) {
|
|
|
60
61
|
<template #popper="{ hide }">
|
|
61
62
|
<div class="htw-flex htw-flex-col htw-bg-gray-50 dark:htw-bg-gray-700">
|
|
62
63
|
<div
|
|
63
|
-
v-for="
|
|
64
|
+
v-for="[value, label] of formattedOptions"
|
|
64
65
|
v-bind="{ ...$attrs, class: null, style: null }"
|
|
65
66
|
:key="label"
|
|
66
67
|
class="htw-px-2 htw-py-1 htw-cursor-pointer hover:htw-bg-primary-100 dark:hover:htw-bg-primary-700"
|
|
@@ -12,11 +12,11 @@ import { HstControlOption } from '../../types'
|
|
|
12
12
|
defineProps<{
|
|
13
13
|
title?: string
|
|
14
14
|
modelValue: string
|
|
15
|
-
options: Record<string,
|
|
15
|
+
options: Record<string, any> | string[] | HstControlOption[]
|
|
16
16
|
}>()
|
|
17
17
|
|
|
18
18
|
const emits = defineEmits<{
|
|
19
|
-
(e: 'update:modelValue', value:
|
|
19
|
+
(e: 'update:modelValue', value: any): void
|
|
20
20
|
}>()
|
|
21
21
|
</script>
|
|
22
22
|
|
|
@@ -64,7 +64,7 @@ const tooltipStyle = computed<CSSProperties>(() => {
|
|
|
64
64
|
v-model.number="numberModel"
|
|
65
65
|
class="htw-range-input htw-appearance-none htw-border-0 htw-bg-transparent htw-cursor-pointer htw-relative htw-w-full htw-m-0 htw-text-gray-700"
|
|
66
66
|
type="range"
|
|
67
|
-
v-bind="{ ...$attrs, class: null, style: null }"
|
|
67
|
+
v-bind="{ ...$attrs, class: null, style: null, min, max }"
|
|
68
68
|
@mouseover="showTooltip = true"
|
|
69
69
|
@mouseleave="showTooltip = false"
|
|
70
70
|
>
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { App } from 'vue'
|
|
2
1
|
import HstCheckboxVue from './components/checkbox/HstCheckbox.vue'
|
|
3
2
|
import HstTextVue from './components/text/HstText.vue'
|
|
4
3
|
import HstNumberVue from './components/number/HstNumber.vue'
|
|
@@ -16,21 +15,23 @@ export const HstText = HstTextVue
|
|
|
16
15
|
export const HstNumber = HstNumberVue
|
|
17
16
|
export const HstSlider = HstSliderVue
|
|
18
17
|
export const HstTextarea = HstTextareaVue
|
|
18
|
+
export const HstSelect = HstSelectVue
|
|
19
19
|
export const HstColorShades = HstColorShadesVue
|
|
20
20
|
export const HstTokenList = HstTokenListVue
|
|
21
21
|
export const HstTokenGrid = HstTokenGridVue
|
|
22
22
|
export const HstCopyIcon = HstCopyIconVue
|
|
23
23
|
export const HstRadio = HstRadioVue
|
|
24
24
|
|
|
25
|
-
export
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
25
|
+
export const components = {
|
|
26
|
+
HstCheckbox,
|
|
27
|
+
HstText,
|
|
28
|
+
HstNumber,
|
|
29
|
+
HstSlider,
|
|
30
|
+
HstTextarea,
|
|
31
|
+
HstSelect,
|
|
32
|
+
HstColorShades,
|
|
33
|
+
HstTokenList,
|
|
34
|
+
HstTokenGrid,
|
|
35
|
+
HstCopyIcon,
|
|
36
|
+
HstRadio,
|
|
36
37
|
}
|
package/src/types.ts
CHANGED
package/tsconfig.json
CHANGED
|
@@ -29,6 +29,16 @@
|
|
|
29
29
|
"strictFunctionTypes": true,
|
|
30
30
|
// Volar
|
|
31
31
|
"jsx": "preserve",
|
|
32
|
+
// Alias
|
|
33
|
+
"paths": {
|
|
34
|
+
"floating-vue": ["./node_modules/@histoire/vendors/dist/client/floating-vue"],
|
|
35
|
+
"@iconify/vue": ["./node_modules/@histoire/vendors/dist/client/iconify"],
|
|
36
|
+
"pinia": ["./node_modules/@histoire/vendors/dist/client/pinia"],
|
|
37
|
+
"scroll-into-view-if-needed": ["./node_modules/@histoire/vendors/dist/client/scroll"],
|
|
38
|
+
"vue-router": ["./node_modules/@histoire/vendors/dist/client/vue-router"],
|
|
39
|
+
"@vueuse/core": ["./node_modules/@histoire/vendors/dist/client/vue-use"],
|
|
40
|
+
"vue": ["./node_modules/@histoire/vendors/dist/client/vue"]
|
|
41
|
+
}
|
|
32
42
|
},
|
|
33
43
|
"include": [
|
|
34
44
|
"src"
|
package/vite.config.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="@peeky/test"/>
|
|
2
1
|
/// <reference types="histoire"/>
|
|
3
2
|
|
|
4
3
|
import { defineConfig } from 'vite'
|
|
@@ -9,6 +8,18 @@ export default defineConfig({
|
|
|
9
8
|
vue(),
|
|
10
9
|
],
|
|
11
10
|
|
|
11
|
+
resolve: {
|
|
12
|
+
alias: {
|
|
13
|
+
'floating-vue': '@histoire/vendors/dist/client/floating-vue.js',
|
|
14
|
+
'@iconify/vue': '@histoire/vendors/dist/client/iconify.js',
|
|
15
|
+
pinia: '@histoire/vendors/dist/client/pinia.js',
|
|
16
|
+
'scroll-into-view-if-needed': '@histoire/vendors/dist/client/scroll.js',
|
|
17
|
+
'vue-router': '@histoire/vendors/dist/client/vue-router.js',
|
|
18
|
+
'@vueuse/core': '@histoire/vendors/dist/client/vue-use.js',
|
|
19
|
+
vue: '@histoire/vendors/dist/client/vue.js',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
|
|
12
23
|
build: {
|
|
13
24
|
emptyOutDir: false,
|
|
14
25
|
|
|
@@ -23,7 +34,6 @@ export default defineConfig({
|
|
|
23
34
|
rollupOptions: {
|
|
24
35
|
external: [
|
|
25
36
|
/@histoire/,
|
|
26
|
-
'vue',
|
|
27
37
|
],
|
|
28
38
|
},
|
|
29
39
|
},
|
|
@@ -45,11 +55,4 @@ export default defineConfig({
|
|
|
45
55
|
favicon: '/histoire.svg',
|
|
46
56
|
},
|
|
47
57
|
},
|
|
48
|
-
|
|
49
|
-
test: {
|
|
50
|
-
runtimeEnv: 'dom',
|
|
51
|
-
previewSetupFiles: [
|
|
52
|
-
'src/peeky-preview.ts',
|
|
53
|
-
],
|
|
54
|
-
},
|
|
55
58
|
})
|