mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 10:21:05 +00:00
feat(text-input): add fluid text input story
This commit is contained in:
parent
dae3cf6dd0
commit
303f410413
2 changed files with 42 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
|||
<script>
|
||||
export let story = undefined;
|
||||
|
||||
import { FluidForm } from "../FluidForm";
|
||||
import PasswordInput from "./PasswordInput.svelte";
|
||||
import TextInput from "./TextInput.svelte";
|
||||
import TextInputSkeleton from "./TextInput.Skeleton.svelte";
|
||||
|
@ -54,6 +55,20 @@
|
|||
Hide password
|
||||
</button>
|
||||
</div>
|
||||
{:else if story === 'fluid'}
|
||||
<FluidForm>
|
||||
<TextInput
|
||||
bind:ref
|
||||
{...$$props}
|
||||
bind:value
|
||||
on:keydown="{(e) => {
|
||||
console.log('on:keydown', e);
|
||||
}}"
|
||||
on:change="{() => {
|
||||
console.log('change');
|
||||
}}"
|
||||
/>
|
||||
</FluidForm>
|
||||
{:else}
|
||||
<TextInput
|
||||
bind:ref
|
||||
|
|
|
@ -35,6 +35,33 @@ export const Default = () => ({
|
|||
},
|
||||
});
|
||||
|
||||
export const Fluid = () => ({
|
||||
Component,
|
||||
props: {
|
||||
story: 'fluid',
|
||||
size: select("Field size (size)", sizes, undefined) || undefined,
|
||||
disabled: boolean("Disabled (disabled)", false),
|
||||
light: boolean("Light variant (light)", false),
|
||||
hideLabel: boolean("No label (hideLabel)", false),
|
||||
labelText: text("Label text (labelText)", "Text Input label"),
|
||||
helperText: text("Helper text (helperText)", "Optional helper text here"),
|
||||
invalid: boolean("Show form validation UI (invalid)", false),
|
||||
invalidText: text(
|
||||
"Content of form validation UI (invalidText)",
|
||||
"A valid value is required"
|
||||
),
|
||||
warn: boolean("Show warning state (warn)", false),
|
||||
warnText: text(
|
||||
"Warning state text (warnText)",
|
||||
"This will overwrite your current settings"
|
||||
),
|
||||
placeholder: text("Placeholder text (placeholder)", "Placeholder text."),
|
||||
inline: boolean("Inline variant (inline)", false),
|
||||
id: text("TextInput id", "text-input-id"),
|
||||
name: text("TextInput name", "text-input-name"),
|
||||
},
|
||||
});
|
||||
|
||||
export const TogglePasswordVisibility = () => ({
|
||||
Component,
|
||||
props: {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue