mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 02:11:05 +00:00
feat(components): add TextInput
This commit is contained in:
parent
bf502f904f
commit
e786e0e78f
8 changed files with 362 additions and 11 deletions
42
src/components/TextInput/TextInput.Story.svelte
Normal file
42
src/components/TextInput/TextInput.Story.svelte
Normal file
|
@ -0,0 +1,42 @@
|
|||
<script>
|
||||
export let story = undefined;
|
||||
|
||||
import Layout from '../../internal/ui/Layout.svelte';
|
||||
import TextInput from './TextInput.svelte';
|
||||
import PasswordInput from './PasswordInput.svelte';
|
||||
import TextInputSkeleton from './TextInput.Skeleton.svelte';
|
||||
|
||||
let value = '';
|
||||
let type = 'password';
|
||||
</script>
|
||||
|
||||
<Layout>
|
||||
{value}
|
||||
{#if story === 'skeleton'}
|
||||
<div aria-label="loading text input" aria-live="assertive" role="status" tabindex="0">
|
||||
<TextInputSkeleton />
|
||||
<br />
|
||||
<TextInputSkeleton hideLabel />
|
||||
</div>
|
||||
{:else if story === 'password-visibility'}
|
||||
<PasswordInput {...$$props} aria-level="" />
|
||||
{:else if story === 'controlled'}
|
||||
<PasswordInput {...$$props} {type} />
|
||||
<div>
|
||||
<button
|
||||
on:click={() => {
|
||||
type = 'text';
|
||||
}}>
|
||||
Show password
|
||||
</button>
|
||||
<button
|
||||
on:click={() => {
|
||||
type = 'password';
|
||||
}}>
|
||||
Hide password
|
||||
</button>
|
||||
</div>
|
||||
{:else}
|
||||
<TextInput {...$$props} bind:value />
|
||||
{/if}
|
||||
</Layout>
|
Loading…
Add table
Add a link
Reference in a new issue