Fix ts lint, remove unused component

This commit is contained in:
Ramon Wenger 2023-04-12 17:47:13 +02:00
parent d4c846a1b9
commit 53fb5c0572
7 changed files with 21 additions and 90 deletions

View File

@ -0,0 +1,8 @@
{
"compilerOptions": {
"lib": ["es5", "dom"],
"target": "es5",
"types": ["cypress", "node"]
},
"include": ["**/*.ts"]
}

View File

@ -28,7 +28,7 @@ export const RadioGroup: Story = {
modelValue: modelValue,
items: items,
label: "Radiogroup",
"onUpdate:modelValue": (newValue) => {
"onUpdate:modelValue": (newValue: any) => {
modelValue = newValue;
},
},

View File

@ -1,21 +0,0 @@
import type { Meta, StoryObj } from "@storybook/vue3";
import ItRadiobutton from "./ItRadiobutton.vue";
const meta: Meta<typeof ItRadiobutton> = {
title: "VBV/Radiobutton",
component: ItRadiobutton,
};
export default meta;
type Story = StoryObj<typeof ItRadiobutton>;
export const Radiobutton: Story = {
args: {
item: {
value: "Hallo",
label: "Velo",
subtitle: "Subtitle",
},
selected: false,
},
};

View File

@ -1,67 +0,0 @@
<script setup lang="ts">
import type { RadioItem } from "@/components/ui/checkbox.types";
import log from "loglevel";
const props = defineProps<{
item: RadioItem<any>;
disabled?: boolean;
}>();
const emit = defineEmits(["toggle"]);
const toggle = () => {
emit("toggle");
};
const keydown = (e: KeyboardEvent) => {
log.debug("keydown", e.type, e.key);
if (e.key === " " && !props.disabled) {
e.preventDefault();
toggle();
}
};
const input = (e: Event) => {
const target = e.target as HTMLInputElement;
log.debug("input", e.type, target.checked, target.value);
emit("toggle");
};
</script>
<template>
<div
:class="{
'opacity-50': disabled,
'cursor-not-allowed': disabled,
}"
class="inline-flex cursor-pointer"
>
<label
class="cy-checkbox cy-checkbox-checked block flex h-8 items-center bg-contain bg-no-repeat pl-8 disabled:opacity-50"
:class="
item.checked
? 'bg-[url(/static/icons/icon-checkbox-checked.svg)] hover:bg-[url(/static/icons/icon-checkbox-checked-hover.svg)]'
: 'bg-[url(/static/icons/icon-checkbox-unchecked.svg)] hover:bg-[url(/static/icons/icon-checkbox-unchecked-hover.svg)]'
"
tabindex="0"
@keydown.stop="keydown"
>
<input
ref="checkbox"
:checked="item.checked"
:value="item.value"
:disabled="disabled"
:data-cy="`it-checkbox-${item.value}`"
class="sr-only"
type="checkbox"
@keydown="keydown"
@input="input"
/>
<div class="ml-4 flex-col">
<div v-if="item.label">
{{ item.label }}
</div>
<div v-if="item.subtitle" class="text-gray-900">
{{ item.subtitle }}
</div>
</div>
</label>
</div>
</template>

View File

@ -10,7 +10,7 @@
},
"strict": true
},
"exclude": ["src/**/__tests__/*"],
"exclude": ["src/**/__tests__/*", "src/**/*.cy.ts"],
"extends": "@vue/tsconfig/tsconfig.web.json",
"include": ["env.d.ts", "src/**/*", "src/**/*.vue"]
}

View File

@ -0,0 +1,8 @@
{
"compilerOptions": {
"lib": ["es5", "dom"],
"target": "es5",
"types": ["cypress", "node"]
},
"include": ["src/**/*.cy.ts"]
}

View File

@ -9,6 +9,9 @@
},
{
"path": "./tsconfig.vitest.json"
},
{
"path": "./tsconfig.cypress.json"
}
]
}