Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add missing fields to $$Props in FloatingLableInput #1461

Merged
merged 1 commit into from
Oct 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/lib/forms/FloatingLabelInput.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
size?: 'small' | 'default';
color?: 'base' | 'green' | 'red';
value?: any;
classDiv?: string;
classInput?: string;
classLabel?: string;
}

export let id: $$Props['id'] = generateId();
Expand All @@ -19,6 +22,9 @@
export let size: NonNullable<$$Props['size']> = 'default';
export let color: NonNullable<$$Props['color']> = 'base';
export let value: $$Props['value'] = undefined;
export let classDiv: $$Props['classDiv'] = '';
export let classInput: $$Props['classInput'] = '';
export let classLabel: $$Props['classLabel'] = '';

const divClasses = {
filled: 'relative',
Expand Down Expand Up @@ -81,10 +87,10 @@
};
</script>

<div class={twMerge(divClasses[style], $$props.classDiv)}>
<input {id} {...$$restProps} bind:value on:blur on:change on:click on:focus on:input on:keydown on:keypress on:keyup on:mouseenter on:mouseleave on:mouseover on:paste {...{ type }} placeholder=" " class={twMerge(inputClasses[style], inputColorClasses[color], inputSizes[style][size], $$props.classInput)} />
<div class={twMerge(divClasses[style], classDiv)}>
<input {id} {...$$restProps} bind:value on:blur on:change on:click on:focus on:input on:keydown on:keypress on:keyup on:mouseenter on:mouseleave on:mouseover on:paste {...{ type }} placeholder=" " class={twMerge(inputClasses[style], inputColorClasses[color], inputSizes[style][size], classInput)} />

<label for={id} class={twMerge(labelClasses[style], labelColorClasses[color], labelSizes[style][size], $$props.classLabel)}>
<label for={id} class={twMerge(labelClasses[style], labelColorClasses[color], labelSizes[style][size], classLabel)}>
<slot />
</label>
</div>
Expand All @@ -99,4 +105,7 @@
@prop export let size: NonNullable<$$Props['size']> = 'default';
@prop export let color: NonNullable<$$Props['color']> = 'base';
@prop export let value: $$Props['value'] = undefined;
@prop export let classDiv: $$Props['classDiv'] = '';
@prop export let classInput: $$Props['classInput'] = '';
@prop export let classLabel: $$Props['classLabel'] = '';
-->
68 changes: 60 additions & 8 deletions src/routes/component-data/FloatingLabelInput.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,65 @@
{
"name": "FloatingLabelInput",
"slots": [],
"events": ["blur", "change", "click", "focus", "input", "keydown", "keypress", "keyup", "mouseenter", "mouseleave", "mouseover", "paste"],
"events": [
"blur",
"change",
"click",
"focus",
"input",
"keydown",
"keypress",
"keyup",
"mouseenter",
"mouseleave",
"mouseover",
"paste"
],
"props": [
["id?", "string", "generateId()"],
["style?", "'filled' | 'outlined' | 'standard'", ""],
["type?", "InputType", ""],
["size?", "'small' | 'default'", ""],
["color?", "'base' | 'green' | 'red'", ""],
["value?", "any", "undefined"]
[
"id?",
"string",
"generateId()"
],
[
"style?",
"'filled' | 'outlined' | 'standard'",
""
],
[
"type?",
"InputType",
""
],
[
"size?",
"'small' | 'default'",
""
],
[
"color?",
"'base' | 'green' | 'red'",
""
],
[
"value?",
"any",
"undefined"
],
[
"classDiv?",
"string",
"''"
],
[
"classInput?",
"string",
"''"
],
[
"classLabel?",
"string",
"''"
]
]
}
}