@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.
- package/LICENSE +22 -0
- package/README.md +5 -0
- package/dist/components/HstCopyIcon.story.vue.d.ts +2 -0
- package/dist/components/HstCopyIcon.vue.d.ts +7 -0
- package/dist/components/HstWrapper.vue.d.ts +20 -0
- package/dist/components/button/HstButton.story.vue.d.ts +2 -0
- package/dist/components/button/HstButton.vue.d.ts +13 -0
- package/dist/components/button/HstButtonGroup.story.vue.d.ts +2 -0
- package/dist/components/button/HstButtonGroup.vue.d.ts +22 -0
- package/dist/components/checkbox/HstCheckbox.story.vue.d.ts +2 -0
- package/dist/components/checkbox/HstCheckbox.vue.d.ts +19 -0
- package/dist/components/checkbox/HstCheckboxList.story.vue.d.ts +2 -0
- package/dist/components/checkbox/HstCheckboxList.vue.d.ts +22 -0
- package/dist/components/checkbox/HstSimpleCheckbox.story.vue.d.ts +2 -0
- package/dist/components/checkbox/HstSimpleCheckbox.vue.d.ts +12 -0
- package/dist/components/colorselect/HstColorSelect.story.vue.d.ts +2 -0
- package/dist/components/colorselect/HstColorSelect.vue.d.ts +19 -0
- package/dist/components/design-tokens/HstColorShades.story.vue.d.ts +2 -0
- package/dist/components/design-tokens/HstColorShades.vue.d.ts +19 -0
- package/dist/components/design-tokens/HstTokenGrid.story.vue.d.ts +2 -0
- package/dist/components/design-tokens/HstTokenGrid.vue.d.ts +26 -0
- package/dist/components/design-tokens/HstTokenList.story.vue.d.ts +2 -0
- package/dist/components/design-tokens/HstTokenList.vue.d.ts +21 -0
- package/dist/components/json/HstJson.story.vue.d.ts +2 -0
- package/dist/components/json/HstJson.vue.d.ts +19 -0
- package/dist/components/number/HstNumber.story.vue.d.ts +2 -0
- package/dist/components/number/HstNumber.vue.d.ts +19 -0
- package/dist/components/radio/HstRadio.story.vue.d.ts +2 -0
- package/dist/components/radio/HstRadio.vue.d.ts +22 -0
- package/dist/components/select/CustomSelect.vue.d.ts +22 -0
- package/dist/components/select/HstSelect.story.vue.d.ts +2 -0
- package/dist/components/select/HstSelect.vue.d.ts +22 -0
- package/dist/components/slider/HstSlider.story.vue.d.ts +2 -0
- package/dist/components/slider/HstSlider.vue.d.ts +16 -0
- package/dist/components/text/HstText.story.vue.d.ts +2 -0
- package/dist/components/text/HstText.vue.d.ts +19 -0
- package/dist/components/textarea/HstTextarea.story.vue.d.ts +2 -0
- package/dist/components/textarea/HstTextarea.vue.d.ts +19 -0
- package/dist/index.d.ts +1047 -0
- package/dist/index.es.css +1 -0
- package/dist/index.es.js +16392 -0
- package/dist/style-standalone.css +973 -0
- package/dist/types.d.ts +4 -0
- package/dist/utils.d.ts +1 -0
- package/package.json +72 -0
- package/postcss.config.cjs +8 -0
- package/src/components/HstCopyIcon.story.vue +26 -0
- package/src/components/HstCopyIcon.vue +38 -0
- package/src/components/HstWrapper.vue +41 -0
- package/src/components/button/HstButton.story.vue +30 -0
- package/src/components/button/HstButton.vue +26 -0
- package/src/components/button/HstButtonGroup.story.vue +79 -0
- package/src/components/button/HstButtonGroup.vue +71 -0
- package/src/components/checkbox/HstCheckbox.spec.ts +28 -0
- package/src/components/checkbox/HstCheckbox.story.vue +47 -0
- package/src/components/checkbox/HstCheckbox.vue +56 -0
- package/src/components/checkbox/HstCheckboxList.story.vue +49 -0
- package/src/components/checkbox/HstCheckboxList.vue +82 -0
- package/src/components/checkbox/HstSimpleCheckbox.story.vue +28 -0
- package/src/components/checkbox/HstSimpleCheckbox.vue +82 -0
- package/src/components/checkbox/__snapshots__/HstCheckbox.spec.ts.snap +5 -0
- package/src/components/colorselect/HstColorSelect.story.vue +28 -0
- package/src/components/colorselect/HstColorSelect.vue +89 -0
- package/src/components/design-tokens/HstColorShades.story.vue +392 -0
- package/src/components/design-tokens/HstColorShades.vue +101 -0
- package/src/components/design-tokens/HstTokenGrid.story.vue +36 -0
- package/src/components/design-tokens/HstTokenGrid.vue +88 -0
- package/src/components/design-tokens/HstTokenList.story.vue +81 -0
- package/src/components/design-tokens/HstTokenList.vue +62 -0
- package/src/components/json/HstJson.story.vue +41 -0
- package/src/components/json/HstJson.vue +151 -0
- package/src/components/number/HstNumber.story.vue +42 -0
- package/src/components/number/HstNumber.vue +95 -0
- package/src/components/radio/HstRadio.story.vue +51 -0
- package/src/components/radio/HstRadio.vue +109 -0
- package/src/components/select/CustomSelect.vue +119 -0
- package/src/components/select/HstSelect.story.vue +161 -0
- package/src/components/select/HstSelect.vue +40 -0
- package/src/components/slider/HstSlider.story.vue +37 -0
- package/src/components/slider/HstSlider.vue +103 -0
- package/src/components/text/HstText.story.vue +63 -0
- package/src/components/text/HstText.vue +44 -0
- package/src/components/textarea/HstTextarea.story.vue +35 -0
- package/src/components/textarea/HstTextarea.vue +44 -0
- package/src/end.d.ts +8 -0
- package/src/index.ts +54 -0
- package/src/style/main.css +17 -0
- package/src/types.ts +4 -0
- package/src/utils.ts +12 -0
- package/tailwind.config.cjs +13 -0
- package/tsconfig.json +53 -0
- package/vite.config.ts +46 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
export default {
|
|
3
|
+
name: 'HstText',
|
|
4
|
+
}
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<script lang="ts" setup>
|
|
8
|
+
import { ref } from 'vue'
|
|
9
|
+
import HstWrapper from '../HstWrapper.vue'
|
|
10
|
+
|
|
11
|
+
defineProps<{
|
|
12
|
+
title?: string
|
|
13
|
+
modelValue?: string | null
|
|
14
|
+
}>()
|
|
15
|
+
|
|
16
|
+
const emit = defineEmits({
|
|
17
|
+
'update:modelValue': (newValue: string) => true,
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
const input = ref<HTMLInputElement>()
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<template>
|
|
24
|
+
<HstWrapper
|
|
25
|
+
:title="title"
|
|
26
|
+
class="histoire-text htw-cursor-text htw-items-center"
|
|
27
|
+
:class="$attrs.class"
|
|
28
|
+
:style="$attrs.style"
|
|
29
|
+
@click="input.focus()"
|
|
30
|
+
>
|
|
31
|
+
<input
|
|
32
|
+
ref="input"
|
|
33
|
+
v-bind="{ ...$attrs, class: null, style: null }"
|
|
34
|
+
type="text"
|
|
35
|
+
:value="modelValue"
|
|
36
|
+
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"
|
|
37
|
+
@input="emit('update:modelValue', ($event.target as HTMLInputElement).value)"
|
|
38
|
+
>
|
|
39
|
+
|
|
40
|
+
<template #actions>
|
|
41
|
+
<slot name="actions" />
|
|
42
|
+
</template>
|
|
43
|
+
</HstWrapper>
|
|
44
|
+
</template>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import HstTextarea from './HstTextarea.vue'
|
|
3
|
+
|
|
4
|
+
function initState() {
|
|
5
|
+
return {
|
|
6
|
+
text: '',
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<template>
|
|
12
|
+
<Story
|
|
13
|
+
title="HstTextarea"
|
|
14
|
+
group="controls"
|
|
15
|
+
>
|
|
16
|
+
<Variant
|
|
17
|
+
title="default"
|
|
18
|
+
:init-state="initState"
|
|
19
|
+
>
|
|
20
|
+
<template #default="{ state }">
|
|
21
|
+
<HstTextarea
|
|
22
|
+
v-model="state.text"
|
|
23
|
+
title="Textarea"
|
|
24
|
+
/>
|
|
25
|
+
</template>
|
|
26
|
+
|
|
27
|
+
<template #controls="{ state }">
|
|
28
|
+
<HstTextarea
|
|
29
|
+
v-model="state.text"
|
|
30
|
+
title="Text"
|
|
31
|
+
/>
|
|
32
|
+
</template>
|
|
33
|
+
</Variant>
|
|
34
|
+
</Story>
|
|
35
|
+
</template>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
export default {
|
|
3
|
+
name: 'HstTextarea',
|
|
4
|
+
inheritAttrs: false,
|
|
5
|
+
}
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<script lang="ts" setup>
|
|
9
|
+
import { ref } from 'vue'
|
|
10
|
+
import HstWrapper from '../HstWrapper.vue'
|
|
11
|
+
|
|
12
|
+
defineProps<{
|
|
13
|
+
title?: string
|
|
14
|
+
modelValue?: string | null
|
|
15
|
+
}>()
|
|
16
|
+
|
|
17
|
+
const emit = defineEmits({
|
|
18
|
+
'update:modelValue': (newValue: string) => true,
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
const input = ref<HTMLInputElement>()
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<template>
|
|
25
|
+
<HstWrapper
|
|
26
|
+
:title="title"
|
|
27
|
+
class="histoire-textarea htw-cursor-text"
|
|
28
|
+
:class="$attrs.class"
|
|
29
|
+
:style="$attrs.style"
|
|
30
|
+
@click="input.focus()"
|
|
31
|
+
>
|
|
32
|
+
<textarea
|
|
33
|
+
ref="input"
|
|
34
|
+
v-bind="{ ...$attrs, class: null, style: null }"
|
|
35
|
+
:value="modelValue"
|
|
36
|
+
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 htw-box-border htw-resize-y htw-min-h-[26px]"
|
|
37
|
+
@input="emit('update:modelValue', ($event.target as HTMLInputElement).value)"
|
|
38
|
+
/>
|
|
39
|
+
|
|
40
|
+
<template #actions>
|
|
41
|
+
<slot name="actions" />
|
|
42
|
+
</template>
|
|
43
|
+
</HstWrapper>
|
|
44
|
+
</template>
|
package/src/end.d.ts
ADDED
package/src/index.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import HstButtonVue from './components/button/HstButton.vue'
|
|
2
|
+
import HstButtonGroupVue from './components/button/HstButtonGroup.vue'
|
|
3
|
+
import HstCheckboxVue from './components/checkbox/HstCheckbox.vue'
|
|
4
|
+
import HstCheckboxListVue from './components/checkbox/HstCheckboxList.vue'
|
|
5
|
+
import HstColorSelectVue from './components/colorselect/HstColorSelect.vue'
|
|
6
|
+
import HstColorShadesVue from './components/design-tokens/HstColorShades.vue'
|
|
7
|
+
import HstTokenGridVue from './components/design-tokens/HstTokenGrid.vue'
|
|
8
|
+
import HstTokenListVue from './components/design-tokens/HstTokenList.vue'
|
|
9
|
+
import HstCopyIconVue from './components/HstCopyIcon.vue'
|
|
10
|
+
import HstJsonVue from './components/json/HstJson.vue'
|
|
11
|
+
import HstNumberVue from './components/number/HstNumber.vue'
|
|
12
|
+
import HstRadioVue from './components/radio/HstRadio.vue'
|
|
13
|
+
import HstSelectVue from './components/select/HstSelect.vue'
|
|
14
|
+
import HstSliderVue from './components/slider/HstSlider.vue'
|
|
15
|
+
import HstTextVue from './components/text/HstText.vue'
|
|
16
|
+
import HstTextareaVue from './components/textarea/HstTextarea.vue'
|
|
17
|
+
|
|
18
|
+
export const HstButton = HstButtonVue
|
|
19
|
+
export const HstButtonGroup = HstButtonGroupVue
|
|
20
|
+
export const HstCheckbox = HstCheckboxVue
|
|
21
|
+
export const HstCheckboxList = HstCheckboxListVue
|
|
22
|
+
export const HstText = HstTextVue
|
|
23
|
+
export const HstNumber = HstNumberVue
|
|
24
|
+
export const HstSlider = HstSliderVue
|
|
25
|
+
export const HstTextarea = HstTextareaVue
|
|
26
|
+
export const HstSelect = HstSelectVue
|
|
27
|
+
export const HstColorShades = HstColorShadesVue
|
|
28
|
+
export const HstTokenList = HstTokenListVue
|
|
29
|
+
export const HstTokenGrid = HstTokenGridVue
|
|
30
|
+
export const HstCopyIcon = HstCopyIconVue
|
|
31
|
+
export const HstRadio = HstRadioVue
|
|
32
|
+
export const HstJson = HstJsonVue
|
|
33
|
+
export const HstColorSelect = HstColorSelectVue
|
|
34
|
+
|
|
35
|
+
export const components = {
|
|
36
|
+
HstButton,
|
|
37
|
+
HstButtonGroup,
|
|
38
|
+
HstCheckbox,
|
|
39
|
+
HstCheckboxList,
|
|
40
|
+
HstText,
|
|
41
|
+
HstNumber,
|
|
42
|
+
HstSlider,
|
|
43
|
+
HstTextarea,
|
|
44
|
+
HstSelect,
|
|
45
|
+
HstRadio,
|
|
46
|
+
HstJson,
|
|
47
|
+
HstColorShades,
|
|
48
|
+
HstTokenList,
|
|
49
|
+
HstTokenGrid,
|
|
50
|
+
HstCopyIcon,
|
|
51
|
+
HstColorSelect,
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export * from './types'
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
@import 'floating-vue/dist/style.css';
|
|
2
|
+
|
|
3
|
+
@tailwind base;
|
|
4
|
+
@tailwind components;
|
|
5
|
+
@tailwind utilities;
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
body {
|
|
9
|
+
font-size: 1.125rem;
|
|
10
|
+
@apply dark:htw-text-gray-100;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
@media (min-width: 640px) {
|
|
14
|
+
body {
|
|
15
|
+
font-size: .875rem;
|
|
16
|
+
}
|
|
17
|
+
}
|
package/src/types.ts
ADDED
package/src/utils.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ref } from 'vue'
|
|
2
|
+
|
|
3
|
+
export const isDark = ref(false)
|
|
4
|
+
|
|
5
|
+
if (!window.__hst_controls_dark) {
|
|
6
|
+
window.__hst_controls_dark = []
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
// There could be multiple instances of the controls lib (in the controls book https://controls.poveste.dev)
|
|
10
|
+
window.__hst_controls_dark.push(isDark)
|
|
11
|
+
|
|
12
|
+
window.__hst_controls_dark_ready?.()
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const path = require('node:path')
|
|
2
|
+
const inheritedConfig = require('../../tailwind.config.cjs')
|
|
3
|
+
|
|
4
|
+
module.exports = {
|
|
5
|
+
...inheritedConfig,
|
|
6
|
+
prefix: 'htw-',
|
|
7
|
+
content: [
|
|
8
|
+
path.resolve(__dirname, './src/**/*.{vue,js,ts,jsx,tsx,md}'),
|
|
9
|
+
],
|
|
10
|
+
corePlugins: {
|
|
11
|
+
preflight: false,
|
|
12
|
+
},
|
|
13
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ESNext",
|
|
4
|
+
// Volar
|
|
5
|
+
"jsx": "preserve",
|
|
6
|
+
"lib": [
|
|
7
|
+
"ESNext",
|
|
8
|
+
"DOM"
|
|
9
|
+
],
|
|
10
|
+
"baseUrl": ".",
|
|
11
|
+
"rootDir": "src",
|
|
12
|
+
"module": "ESNext",
|
|
13
|
+
"moduleResolution": "node",
|
|
14
|
+
// Alias
|
|
15
|
+
"paths": {
|
|
16
|
+
"floating-vue": ["./node_modules/@poveste/vendors/floating-vue"],
|
|
17
|
+
"@iconify/vue": ["./node_modules/@poveste/vendors/iconify"],
|
|
18
|
+
"pinia": ["./node_modules/@poveste/vendors/pinia"],
|
|
19
|
+
"scroll-into-view-if-needed": ["./node_modules/@poveste/vendors/scroll"],
|
|
20
|
+
"vue-router": ["./node_modules/@poveste/vendors/vue-router"],
|
|
21
|
+
"@vueuse/core": ["./node_modules/@poveste/vendors/vue-use"],
|
|
22
|
+
"vue": ["./node_modules/@poveste/vendors/vue"]
|
|
23
|
+
},
|
|
24
|
+
"resolveJsonModule": true,
|
|
25
|
+
"types": [
|
|
26
|
+
"node"
|
|
27
|
+
],
|
|
28
|
+
"strictBindCallApply": true,
|
|
29
|
+
"strictFunctionTypes": true,
|
|
30
|
+
"alwaysStrict": true,
|
|
31
|
+
// Strict
|
|
32
|
+
"noImplicitAny": false,
|
|
33
|
+
"noImplicitThis": true,
|
|
34
|
+
// Output
|
|
35
|
+
"outDir": "dist",
|
|
36
|
+
"removeComments": false,
|
|
37
|
+
"sourceMap": false,
|
|
38
|
+
"allowSyntheticDefaultImports": true,
|
|
39
|
+
"esModuleInterop": true,
|
|
40
|
+
"preserveSymlinks": true,
|
|
41
|
+
"skipLibCheck": true,
|
|
42
|
+
"preserveWatchOutput": true
|
|
43
|
+
},
|
|
44
|
+
"include": [
|
|
45
|
+
"src"
|
|
46
|
+
],
|
|
47
|
+
"exclude": [
|
|
48
|
+
"node_modules",
|
|
49
|
+
"generated/**/*",
|
|
50
|
+
"dist/**/*",
|
|
51
|
+
"src/**/*.spec.ts"
|
|
52
|
+
]
|
|
53
|
+
}
|
package/vite.config.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/// <reference types="vitest" />
|
|
2
|
+
|
|
3
|
+
import vue from '@vitejs/plugin-vue'
|
|
4
|
+
import { defineConfig } from 'vite'
|
|
5
|
+
|
|
6
|
+
export default defineConfig({
|
|
7
|
+
plugins: [
|
|
8
|
+
vue(),
|
|
9
|
+
],
|
|
10
|
+
resolve: {
|
|
11
|
+
alias: process.env.VITEST
|
|
12
|
+
? {}
|
|
13
|
+
: {
|
|
14
|
+
'floating-vue': '@poveste/vendors/floating-vue',
|
|
15
|
+
'@iconify/vue': '@poveste/vendors/iconify',
|
|
16
|
+
'pinia': '@poveste/vendors/pinia',
|
|
17
|
+
'scroll-into-view-if-needed': '@poveste/vendors/scroll',
|
|
18
|
+
'vue-router': '@poveste/vendors/vue-router',
|
|
19
|
+
'@vueuse/core': '@poveste/vendors/vue-use',
|
|
20
|
+
'vue': '@poveste/vendors/vue',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
build: {
|
|
25
|
+
emptyOutDir: false,
|
|
26
|
+
|
|
27
|
+
lib: {
|
|
28
|
+
entry: 'src/index.ts',
|
|
29
|
+
formats: [
|
|
30
|
+
'es',
|
|
31
|
+
],
|
|
32
|
+
fileName: 'index.es',
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
rollupOptions: {
|
|
36
|
+
external: [
|
|
37
|
+
/@poveste/,
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
test: {
|
|
43
|
+
environment: 'jsdom',
|
|
44
|
+
globals: true,
|
|
45
|
+
},
|
|
46
|
+
})
|