@histoire/controls 0.16.1 → 0.16.4
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/colorselect/HstColorSelect.story.vue.d.ts +2 -0
- package/dist/components/colorselect/HstColorSelect.vue.d.ts +28 -0
- package/dist/index.d.ts +174 -0
- package/dist/index.es.js +1646 -1577
- package/dist/style-standalone.css +12 -8
- package/dist/style.css +1 -1
- package/package.json +4 -3
- package/src/components/colorselect/HstColorSelect.story.vue +28 -0
- package/src/components/colorselect/HstColorSelect.vue +92 -0
- package/src/components/radio/HstRadio.vue +3 -3
- package/src/index.ts +3 -0
- package/vite.config.ts +0 -1
|
@@ -440,6 +440,10 @@
|
|
|
440
440
|
width:16px
|
|
441
441
|
}
|
|
442
442
|
|
|
443
|
+
.htw-w-full{
|
|
444
|
+
width:100%
|
|
445
|
+
}
|
|
446
|
+
|
|
443
447
|
.htw-w-16{
|
|
444
448
|
width:4rem
|
|
445
449
|
}
|
|
@@ -448,10 +452,6 @@
|
|
|
448
452
|
width:8rem
|
|
449
453
|
}
|
|
450
454
|
|
|
451
|
-
.htw-w-full{
|
|
452
|
-
width:100%
|
|
453
|
-
}
|
|
454
|
-
|
|
455
455
|
.htw-w-3{
|
|
456
456
|
width:0.75rem
|
|
457
457
|
}
|
|
@@ -518,6 +518,10 @@
|
|
|
518
518
|
grid-template-columns:repeat(auto-fill,minmax(200px,1fr))
|
|
519
519
|
}
|
|
520
520
|
|
|
521
|
+
.htw-flex-row{
|
|
522
|
+
flex-direction:row
|
|
523
|
+
}
|
|
524
|
+
|
|
521
525
|
.htw-flex-col{
|
|
522
526
|
flex-direction:column
|
|
523
527
|
}
|
|
@@ -749,15 +753,15 @@
|
|
|
749
753
|
color:rgb(255 255 255 / var(--tw-text-opacity))
|
|
750
754
|
}
|
|
751
755
|
|
|
756
|
+
.htw-text-inherit{
|
|
757
|
+
color:inherit
|
|
758
|
+
}
|
|
759
|
+
|
|
752
760
|
.htw-text-orange-500{
|
|
753
761
|
--tw-text-opacity:1;
|
|
754
762
|
color:rgb(249 115 22 / var(--tw-text-opacity))
|
|
755
763
|
}
|
|
756
764
|
|
|
757
|
-
.htw-text-inherit{
|
|
758
|
-
color:inherit
|
|
759
|
-
}
|
|
760
|
-
|
|
761
765
|
.htw-text-gray-700{
|
|
762
766
|
--tw-text-opacity:1;
|
|
763
767
|
color:rgb(63 63 70 / var(--tw-text-opacity))
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.htw-range-input::-webkit-slider-thumb{height:.75rem;width:.75rem;-webkit-appearance:none;appearance:none;border-radius:9999px;border-width:1px;border-style:solid;border-color:#00000040;--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.htw-dark .htw-range-input::-webkit-slider-thumb{border-color:#ffffff40;--tw-bg-opacity: 1;background-color:rgb(63 63 70 / var(--tw-bg-opacity))}.htw-range-input:hover::-webkit-slider-thumb{--tw-border-opacity: 1 !important;border-color:rgb(16 185 129 / var(--tw-border-opacity))!important;--tw-bg-opacity: 1 !important;background-color:rgb(16 185 129 / var(--tw-bg-opacity))!important}.htw-range-input::-moz-range-thumb{height:.75rem;width:.75rem;-moz-appearance:none;appearance:none;border-radius:9999px;border-width:1px;border-style:solid;border-color:#00000040;--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.htw-dark .htw-range-input::-moz-range-thumb{border-color:#ffffff40;--tw-bg-opacity: 1;background-color:rgb(63 63 70 / var(--tw-bg-opacity))}.htw-range-input:hover::-moz-range-thumb{--tw-border-opacity: 1 !important;border-color:rgb(16 185 129 / var(--tw-border-opacity))!important;--tw-bg-opacity: 1 !important;background-color:rgb(16 185 129 / var(--tw-bg-opacity))!important}.v-popper{line-height:0}.htw-dark .v-popper--theme-dropdown .v-popper__inner{--tw-border-opacity: 1;border-color:rgb(31 31 33 / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:rgb(63 63 70 / var(--tw-bg-opacity));--tw-text-opacity: 1;color:rgb(244 244 245 / var(--tw-text-opacity))}.htw-dark .v-popper--theme-dropdown .v-popper__arrow-inner{--tw-border-opacity: 1;border-color:rgb(63 63 70 / var(--tw-border-opacity))}.htw-dark .v-popper--theme-dropdown .v-popper__arrow-outer{--tw-border-opacity: 1;border-color:rgb(31 31 33 / var(--tw-border-opacity))}.v-popper--theme-dropdown.v-popper__popper--show-from .v-popper__wrapper{transform:scale(.75)}.v-popper--theme-dropdown.v-popper__popper--show-to .v-popper__wrapper{transform:none;transition:transform .15s cubic-bezier(0,1,.5,1)}.v-popper__popper:focus-visible{outline:none}.htw-bind-col-size{grid-template-columns:repeat(auto-fill,minmax(var(--histoire-col-size),1fr))}.__histoire-json-code[data-v-e5fbff29] .cm-editor{height:100%;min-width:280px}
|
|
1
|
+
.htw-range-input::-webkit-slider-thumb{height:.75rem;width:.75rem;-webkit-appearance:none;-moz-appearance:none;appearance:none;border-radius:9999px;border-width:1px;border-style:solid;border-color:#00000040;--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.htw-dark .htw-range-input::-webkit-slider-thumb{border-color:#ffffff40;--tw-bg-opacity: 1;background-color:rgb(63 63 70 / var(--tw-bg-opacity))}.htw-range-input:hover::-webkit-slider-thumb{--tw-border-opacity: 1 !important;border-color:rgb(16 185 129 / var(--tw-border-opacity))!important;--tw-bg-opacity: 1 !important;background-color:rgb(16 185 129 / var(--tw-bg-opacity))!important}.htw-range-input::-moz-range-thumb{height:.75rem;width:.75rem;-moz-appearance:none;-webkit-appearance:none;appearance:none;border-radius:9999px;border-width:1px;border-style:solid;border-color:#00000040;--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.htw-dark .htw-range-input::-moz-range-thumb{border-color:#ffffff40;--tw-bg-opacity: 1;background-color:rgb(63 63 70 / var(--tw-bg-opacity))}.htw-range-input:hover::-moz-range-thumb{--tw-border-opacity: 1 !important;border-color:rgb(16 185 129 / var(--tw-border-opacity))!important;--tw-bg-opacity: 1 !important;background-color:rgb(16 185 129 / var(--tw-bg-opacity))!important}.v-popper{line-height:0}.htw-dark .v-popper--theme-dropdown .v-popper__inner{--tw-border-opacity: 1;border-color:rgb(31 31 33 / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:rgb(63 63 70 / var(--tw-bg-opacity));--tw-text-opacity: 1;color:rgb(244 244 245 / var(--tw-text-opacity))}.htw-dark .v-popper--theme-dropdown .v-popper__arrow-inner{--tw-border-opacity: 1;border-color:rgb(63 63 70 / var(--tw-border-opacity))}.htw-dark .v-popper--theme-dropdown .v-popper__arrow-outer{--tw-border-opacity: 1;border-color:rgb(31 31 33 / var(--tw-border-opacity))}.v-popper--theme-dropdown.v-popper__popper--show-from .v-popper__wrapper{transform:scale(.75)}.v-popper--theme-dropdown.v-popper__popper--show-to .v-popper__wrapper{transform:none;transition:transform .15s cubic-bezier(0,1,.5,1)}.v-popper__popper:focus-visible{outline:none}.htw-bind-col-size{grid-template-columns:repeat(auto-fill,minmax(var(--histoire-col-size),1fr))}.__histoire-json-code[data-v-e5fbff29] .cm-editor{height:100%;min-width:280px}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@histoire/controls",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.4",
|
|
4
4
|
"description": "Prebuilt controls components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@codemirror/state": "^6.1.2",
|
|
39
39
|
"@codemirror/theme-one-dark": "^6.1.0",
|
|
40
40
|
"@codemirror/view": "^6.3.0",
|
|
41
|
-
"@histoire/shared": "^0.16.
|
|
41
|
+
"@histoire/shared": "^0.16.4",
|
|
42
42
|
"@histoire/vendors": "^0.16.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
"@peeky/test": "^0.14.1",
|
|
47
47
|
"@types/node": "^17.0.32",
|
|
48
48
|
"@vitejs/plugin-vue": "^4.0.0",
|
|
49
|
+
"@vue/runtime-dom": "^3.3.4",
|
|
49
50
|
"@vue/test-utils": "^2.2.10",
|
|
50
51
|
"@vueuse/core": "^9.12.0",
|
|
51
52
|
"autoprefixer": "^10.4.4",
|
|
@@ -55,7 +56,7 @@
|
|
|
55
56
|
"postcss-import": "^14.1.0",
|
|
56
57
|
"tailwindcss": "^3.0.23",
|
|
57
58
|
"typescript": "^4.9.5",
|
|
58
|
-
"vite": "^4.
|
|
59
|
+
"vite": "^4.4.8",
|
|
59
60
|
"vue": "^3.2.47",
|
|
60
61
|
"vue-tsc": "^1.0.24"
|
|
61
62
|
},
|
|
@@ -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>
|
|
@@ -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)"
|
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'
|