feat(stage-ui): more component

This commit is contained in:
Neko Ayaka
2025-03-16 21:56:08 +08:00
parent 04bd410643
commit e466a7afe8
3 changed files with 227 additions and 0 deletions
@@ -0,0 +1,72 @@
<script setup lang="ts">
import { ref } from 'vue'
import Checkbox from './Checkbox.vue'
const checkedValue = ref(true)
const uncheckedValue = ref(false)
const interactiveValue = ref(false)
</script>
<template>
<Story
title="Checkbox"
group="form"
:layout="{ type: 'grid', width: 600 }"
>
<template #controls>
<ThemeColorsHueControl />
</template>
<Variant
id="checked"
title="Checked"
>
<div class="bg-white p-4 dark:bg-neutral-900">
<Checkbox v-model="checkedValue" />
</div>
</Variant>
<Variant
id="unchecked"
title="Unchecked"
>
<div class="bg-white p-4 dark:bg-neutral-900">
<Checkbox v-model="uncheckedValue" />
</div>
</Variant>
<Variant
id="interactive"
title="Interactive"
>
<div class="bg-white p-4 dark:bg-neutral-900">
<div class="flex items-center gap-4">
<Checkbox v-model="interactiveValue" />
<div class="text-sm">
Current value: {{ interactiveValue ? 'On' : 'Off' }}
</div>
</div>
</div>
</Variant>
<Variant
id="sizes"
title="Different Contexts"
>
<div class="bg-white p-4 dark:bg-neutral-900">
<div class="flex flex-col gap-4">
<div class="flex items-center gap-2">
<Checkbox v-model="checkedValue" />
<span class="text-sm">Default checkbox in a row</span>
</div>
<div class="flex items-center gap-2 bg-neutral-100 p-3 dark:bg-neutral-800">
<Checkbox v-model="checkedValue" />
<span class="text-sm">Checkbox in a different background</span>
</div>
</div>
</div>
</Variant>
</Story>
</template>
@@ -0,0 +1,152 @@
<script setup lang="ts">
import { ref } from 'vue'
import Input from './Input.vue'
const textValue = ref('')
const filledTextValue = ref('Sample text')
const passwordValue = ref('secret-password')
const emailValue = ref('user@example.com')
const numberValue = ref('42')
const urlValue = ref('https://example.com')
</script>
<template>
<Story
title="Input"
group="form"
:layout="{ type: 'grid', width: 600 }"
>
<template #controls>
<ThemeColorsHueControl />
</template>
<Variant
id="text-empty"
title="Text Input (Empty)"
>
<div class="bg-white p-4 dark:bg-neutral-900">
<Input
v-model="textValue"
placeholder="Enter text..."
/>
</div>
</Variant>
<Variant
id="text-filled"
title="Text Input (Filled)"
>
<div class="bg-white p-4 dark:bg-neutral-900">
<Input
v-model="filledTextValue"
placeholder="Enter text..."
/>
</div>
</Variant>
<Variant
id="password"
title="Password Input"
>
<div class="bg-white p-4 dark:bg-neutral-900">
<Input
v-model="passwordValue"
type="password"
placeholder="Enter password..."
/>
</div>
</Variant>
<Variant
id="email"
title="Email Input"
>
<div class="bg-white p-4 dark:bg-neutral-900">
<Input
v-model="emailValue"
type="email"
placeholder="Enter email..."
/>
</div>
</Variant>
<Variant
id="number"
title="Number Input"
>
<div class="bg-white p-4 dark:bg-neutral-900">
<Input
v-model="numberValue"
type="number"
placeholder="Enter number..."
/>
</div>
</Variant>
<Variant
id="url"
title="URL Input"
>
<div class="bg-white p-4 dark:bg-neutral-900">
<Input
v-model="urlValue"
type="url"
placeholder="Enter URL..."
/>
</div>
</Variant>
<Variant
id="disabled"
title="Disabled Input"
>
<div class="bg-white p-4 dark:bg-neutral-900">
<Input
v-model="filledTextValue"
placeholder="This input is disabled"
disabled
/>
</div>
</Variant>
<Variant
id="readonly"
title="Readonly Input"
>
<div class="bg-white p-4 dark:bg-neutral-900">
<Input
v-model="filledTextValue"
placeholder="This input is readonly"
readonly
/>
</div>
</Variant>
<Variant
id="with-classes"
title="With Custom Classes"
>
<div class="bg-white p-4 dark:bg-neutral-900">
<Input
v-model="textValue"
placeholder="Custom styled input"
class="border-primary-500 dark:border-primary-400"
/>
</div>
</Variant>
<Variant
id="with-autofocus"
title="With Autofocus"
>
<div class="bg-white p-4 dark:bg-neutral-900">
<Input
v-model="textValue"
placeholder="This input has autofocus"
autofocus
/>
</div>
</Variant>
</Story>
</template>
@@ -12,7 +12,10 @@ const modelValue = defineModel<string>({ required: true })
:type="props.type || 'text'"
border="neutral-100 dark:neutral-800 solid 2 focus:neutral-200 dark:focus:neutral-700"
transition="all duration-250 ease-in-out"
text="disabled:neutral-400 dark:disabled:neutral-600"
cursor="disabled:not-allowed"
w-full rounded-lg px-2 py-1 text-nowrap text-sm outline-none
shadow="sm"
bg="neutral-100 dark:neutral-800 focus:neutral-50 dark:focus:neutral-900"
>
</template>