mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-18 03:26:36 +00:00
feat: forward restProps to input element
This commit is contained in:
parent
6a609240cd
commit
576dedb9c3
14 changed files with 42 additions and 37 deletions
|
@ -1397,7 +1397,7 @@
|
||||||
"ts": "interface ComboBoxItem { id: string; text: string; }"
|
"ts": "interface ComboBoxItem { id: string; text: string; }"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"rest_props": { "type": "Element", "name": "div" }
|
"rest_props": { "type": "Element", "name": "input" }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"moduleName": "ComposedModal",
|
"moduleName": "ComposedModal",
|
||||||
|
@ -2249,7 +2249,7 @@
|
||||||
{ "type": "forwarded", "name": "blur", "element": "input" }
|
{ "type": "forwarded", "name": "blur", "element": "input" }
|
||||||
],
|
],
|
||||||
"typedefs": [],
|
"typedefs": [],
|
||||||
"rest_props": { "type": "Element", "name": "div" }
|
"rest_props": { "type": "Element", "name": "input" }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"moduleName": "DatePickerSkeleton",
|
"moduleName": "DatePickerSkeleton",
|
||||||
|
@ -5430,7 +5430,7 @@
|
||||||
"ts": "interface MultiSelectItem { id: MultiSelectItemId; text: MultiSelectItemText; }"
|
"ts": "interface MultiSelectItem { id: MultiSelectItemId; text: MultiSelectItemText; }"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"rest_props": { "type": "Element", "name": "div" }
|
"rest_props": { "type": "Element", "name": "input" }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"moduleName": "NotificationActionButton",
|
"moduleName": "NotificationActionButton",
|
||||||
|
@ -5841,7 +5841,7 @@
|
||||||
"ts": "type NumberInputTranslationId = \"increment\" | \"decrement\""
|
"ts": "type NumberInputTranslationId = \"increment\" | \"decrement\""
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"rest_props": { "type": "Element", "name": "div" }
|
"rest_props": { "type": "Element", "name": "input" }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"moduleName": "NumberInputSkeleton",
|
"moduleName": "NumberInputSkeleton",
|
||||||
|
@ -9797,7 +9797,7 @@
|
||||||
{ "type": "forwarded", "name": "blur", "element": "input" }
|
{ "type": "forwarded", "name": "blur", "element": "input" }
|
||||||
],
|
],
|
||||||
"typedefs": [],
|
"typedefs": [],
|
||||||
"rest_props": { "type": "Element", "name": "div" }
|
"rest_props": { "type": "Element", "name": "input" }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"moduleName": "TimePickerSelect",
|
"moduleName": "TimePickerSelect",
|
||||||
|
|
|
@ -24,6 +24,16 @@ To prevent alphabetical item ordering, pass an empty function to the `sortItem`
|
||||||
sortItem="{() => {}}"
|
sortItem="{() => {}}"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
### Filterable
|
||||||
|
|
||||||
|
`$$restProps` are spread to the underlying input element.
|
||||||
|
|
||||||
|
<MultiSelect spellcheck="false" filterable titleText="Contact" placeholder="Filter contact methods..."
|
||||||
|
items="{[{id: "0", text: "Slack"},
|
||||||
|
{id: "1", text: "Email"},
|
||||||
|
{id: "2", text: "Fax"}]}"
|
||||||
|
/>
|
||||||
|
|
||||||
### Initial selected items
|
### Initial selected items
|
||||||
|
|
||||||
To select (or bind) items, pass an array of item ids to `selectedIds`.
|
To select (or bind) items, pass an array of item ids to `selectedIds`.
|
||||||
|
@ -93,13 +103,7 @@ Set `direction` to `"top"` for the dropdown menu to appear above the input.
|
||||||
{id: "2", text: "Fax"}]}"
|
{id: "2", text: "Fax"}]}"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
### Filterable
|
|
||||||
|
|
||||||
<MultiSelect filterable titleText="Contact" placeholder="Filter contact methods..."
|
|
||||||
items="{[{id: "0", text: "Slack"},
|
|
||||||
{id: "1", text: "Email"},
|
|
||||||
{id: "2", text: "Fax"}]}"
|
|
||||||
/>
|
|
||||||
|
|
||||||
### Invalid state
|
### Invalid state
|
||||||
|
|
||||||
|
|
|
@ -160,7 +160,7 @@
|
||||||
}
|
}
|
||||||
}}" />
|
}}" />
|
||||||
|
|
||||||
<div class:bx--list-box__wrapper="{true}" {...$$restProps}>
|
<div class:bx--list-box__wrapper="{true}">
|
||||||
{#if titleText}
|
{#if titleText}
|
||||||
<label
|
<label
|
||||||
for="{id}"
|
for="{id}"
|
||||||
|
@ -209,6 +209,11 @@
|
||||||
aria-disabled="{disabled}"
|
aria-disabled="{disabled}"
|
||||||
aria-controls="{open ? menuId : undefined}"
|
aria-controls="{open ? menuId : undefined}"
|
||||||
aria-owns="{open ? menuId : undefined}"
|
aria-owns="{open ? menuId : undefined}"
|
||||||
|
disabled="{disabled}"
|
||||||
|
placeholder="{placeholder}"
|
||||||
|
id="{id}"
|
||||||
|
value="{inputValue}"
|
||||||
|
{...$$restProps}
|
||||||
class:bx--text-input="{true}"
|
class:bx--text-input="{true}"
|
||||||
class:bx--text-input--light="{light}"
|
class:bx--text-input--light="{light}"
|
||||||
class:bx--text-input--empty="{inputValue === ''}"
|
class:bx--text-input--empty="{inputValue === ''}"
|
||||||
|
@ -246,10 +251,6 @@
|
||||||
ref.focus();
|
ref.focus();
|
||||||
}
|
}
|
||||||
}}"
|
}}"
|
||||||
disabled="{disabled}"
|
|
||||||
placeholder="{placeholder}"
|
|
||||||
id="{id}"
|
|
||||||
value="{inputValue}"
|
|
||||||
/>
|
/>
|
||||||
{#if invalid}
|
{#if invalid}
|
||||||
<WarningFilled16 class="bx--list-box__invalid-icon" />
|
<WarningFilled16 class="bx--list-box__invalid-icon" />
|
||||||
|
|
|
@ -77,7 +77,6 @@
|
||||||
<div
|
<div
|
||||||
class:bx--date-picker-container="{true}"
|
class:bx--date-picker-container="{true}"
|
||||||
class:bx--date-picker--nolabel="{!labelText}"
|
class:bx--date-picker--nolabel="{!labelText}"
|
||||||
{...$$restProps}
|
|
||||||
>
|
>
|
||||||
{#if labelText}
|
{#if labelText}
|
||||||
<label
|
<label
|
||||||
|
@ -97,13 +96,14 @@
|
||||||
<input
|
<input
|
||||||
bind:this="{ref}"
|
bind:this="{ref}"
|
||||||
data-invalid="{invalid || undefined}"
|
data-invalid="{invalid || undefined}"
|
||||||
value="{!$range ? $inputValue : undefined}"
|
|
||||||
id="{id}"
|
id="{id}"
|
||||||
name="{name}"
|
name="{name}"
|
||||||
placeholder="{placeholder}"
|
placeholder="{placeholder}"
|
||||||
type="{type}"
|
type="{type}"
|
||||||
pattern="{pattern}"
|
pattern="{pattern}"
|
||||||
disabled="{disabled}"
|
disabled="{disabled}"
|
||||||
|
{...$$restProps}
|
||||||
|
value="{!$range ? $inputValue : undefined}"
|
||||||
class:bx--date-picker__input="{true}"
|
class:bx--date-picker__input="{true}"
|
||||||
class:bx--date-picker__input--invalid="{invalid}"
|
class:bx--date-picker__input--invalid="{invalid}"
|
||||||
class="{size && `bx--date-picker__input--${size}`}"
|
class="{size && `bx--date-picker__input--${size}`}"
|
||||||
|
|
|
@ -237,7 +237,6 @@
|
||||||
class:bx--multi-select__wrapper--inline="{inline}"
|
class:bx--multi-select__wrapper--inline="{inline}"
|
||||||
class:bx--list-box__wrapper--inline="{inline}"
|
class:bx--list-box__wrapper--inline="{inline}"
|
||||||
class:bx--multi-select__wrapper--inline--invalid="{inline && invalid}"
|
class:bx--multi-select__wrapper--inline--invalid="{inline && invalid}"
|
||||||
{...$$restProps}
|
|
||||||
>
|
>
|
||||||
{#if titleText}
|
{#if titleText}
|
||||||
<label
|
<label
|
||||||
|
@ -348,6 +347,7 @@
|
||||||
{#if filterable}
|
{#if filterable}
|
||||||
<input
|
<input
|
||||||
bind:this="{inputRef}"
|
bind:this="{inputRef}"
|
||||||
|
{...$$restProps}
|
||||||
role="combobox"
|
role="combobox"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
|
|
|
@ -144,7 +144,6 @@
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class:bx--form-item="{true}"
|
class:bx--form-item="{true}"
|
||||||
{...$$restProps}
|
|
||||||
on:click
|
on:click
|
||||||
on:mouseover
|
on:mouseover
|
||||||
on:mouseenter
|
on:mouseenter
|
||||||
|
@ -195,10 +194,6 @@
|
||||||
type="number"
|
type="number"
|
||||||
pattern="[0-9]*"
|
pattern="[0-9]*"
|
||||||
aria-label="{label ? undefined : ariaLabel}"
|
aria-label="{label ? undefined : ariaLabel}"
|
||||||
on:input
|
|
||||||
on:input="{({ target }) => {
|
|
||||||
inputValue = target.value;
|
|
||||||
}}"
|
|
||||||
disabled="{disabled}"
|
disabled="{disabled}"
|
||||||
id="{id}"
|
id="{id}"
|
||||||
name="{name}"
|
name="{name}"
|
||||||
|
@ -207,6 +202,11 @@
|
||||||
step="{step}"
|
step="{step}"
|
||||||
value="{value}"
|
value="{value}"
|
||||||
readonly="{readonly}"
|
readonly="{readonly}"
|
||||||
|
{...$$restProps}
|
||||||
|
on:input
|
||||||
|
on:input="{({ target }) => {
|
||||||
|
inputValue = target.value;
|
||||||
|
}}"
|
||||||
/>
|
/>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
|
@ -247,10 +247,6 @@
|
||||||
data-invalid="{invalid || undefined}"
|
data-invalid="{invalid || undefined}"
|
||||||
aria-invalid="{invalid || undefined}"
|
aria-invalid="{invalid || undefined}"
|
||||||
aria-label="{label ? undefined : ariaLabel}"
|
aria-label="{label ? undefined : ariaLabel}"
|
||||||
on:input
|
|
||||||
on:input="{({ target }) => {
|
|
||||||
inputValue = target.value;
|
|
||||||
}}"
|
|
||||||
disabled="{disabled}"
|
disabled="{disabled}"
|
||||||
id="{id}"
|
id="{id}"
|
||||||
max="{max}"
|
max="{max}"
|
||||||
|
@ -258,6 +254,11 @@
|
||||||
step="{step}"
|
step="{step}"
|
||||||
value="{value}"
|
value="{value}"
|
||||||
readonly="{readonly}"
|
readonly="{readonly}"
|
||||||
|
{...$$restProps}
|
||||||
|
on:input
|
||||||
|
on:input="{({ target }) => {
|
||||||
|
inputValue = target.value;
|
||||||
|
}}"
|
||||||
/>
|
/>
|
||||||
{#if invalid}
|
{#if invalid}
|
||||||
<WarningFilled16 class="bx--number__invalid" />
|
<WarningFilled16 class="bx--number__invalid" />
|
||||||
|
|
|
@ -98,7 +98,6 @@
|
||||||
class:bx--search--sm="{size === 'sm' || small}"
|
class:bx--search--sm="{size === 'sm' || small}"
|
||||||
class:bx--search--lg="{size === 'lg'}"
|
class:bx--search--lg="{size === 'lg'}"
|
||||||
class:bx--search--xl="{size === 'xl'}"
|
class:bx--search--xl="{size === 'xl'}"
|
||||||
{...$$restProps}
|
|
||||||
>
|
>
|
||||||
<Search16 class="bx--search-magnifier" />
|
<Search16 class="bx--search-magnifier" />
|
||||||
<label id="{id}-search" for="{id}" class:bx--label="{true}"
|
<label id="{id}-search" for="{id}" class:bx--label="{true}"
|
||||||
|
@ -116,7 +115,7 @@
|
||||||
placeholder="{placeholder}"
|
placeholder="{placeholder}"
|
||||||
type="{type}"
|
type="{type}"
|
||||||
value="{value}"
|
value="{value}"
|
||||||
aria-hidden="{$$props['aria-hidden']}"
|
{...$$restProps}
|
||||||
on:change
|
on:change
|
||||||
on:input
|
on:input
|
||||||
on:input="{({ target }) => {
|
on:input="{({ target }) => {
|
||||||
|
|
|
@ -59,7 +59,6 @@
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class:bx--form-item="{true}"
|
class:bx--form-item="{true}"
|
||||||
{...$$restProps}
|
|
||||||
on:click
|
on:click
|
||||||
on:mouseover
|
on:mouseover
|
||||||
on:mouseenter
|
on:mouseenter
|
||||||
|
@ -94,6 +93,7 @@
|
||||||
type="{type}"
|
type="{type}"
|
||||||
value="{value}"
|
value="{value}"
|
||||||
disabled="{disabled}"
|
disabled="{disabled}"
|
||||||
|
{...$$restProps}
|
||||||
class:bx--time-picker__input-field="{true}"
|
class:bx--time-picker__input-field="{true}"
|
||||||
class:bx--text-input="{true}"
|
class:bx--text-input="{true}"
|
||||||
class:bx--text-input--light="{light}"
|
class:bx--text-input--light="{light}"
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
import { TimePicker, TimePickerSelect, SelectItem } from "../types";
|
import { TimePicker, TimePickerSelect, SelectItem } from "../types";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<TimePicker labelText="Cron job" placeholder="hh:mm">
|
<TimePicker spellcheck="false" labelText="Cron job" placeholder="hh:mm">
|
||||||
<TimePickerSelect value="PM">
|
<TimePickerSelect value="PM">
|
||||||
<SelectItem value="am" text="AM" />
|
<SelectItem value="am" text="AM" />
|
||||||
<SelectItem value="pm" text="PM" />
|
<SelectItem value="pm" text="PM" />
|
||||||
|
|
2
types/ComboBox/ComboBox.d.ts
vendored
2
types/ComboBox/ComboBox.d.ts
vendored
|
@ -7,7 +7,7 @@ export interface ComboBoxItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ComboBoxProps
|
export interface ComboBoxProps
|
||||||
extends svelte.JSX.HTMLAttributes<HTMLElementTagNameMap["div"]> {
|
extends svelte.JSX.HTMLAttributes<HTMLElementTagNameMap["input"]> {
|
||||||
/**
|
/**
|
||||||
* Set the combobox items
|
* Set the combobox items
|
||||||
* @default []
|
* @default []
|
||||||
|
|
2
types/DatePicker/DatePickerInput.d.ts
vendored
2
types/DatePicker/DatePickerInput.d.ts
vendored
|
@ -2,7 +2,7 @@
|
||||||
import { SvelteComponentTyped } from "svelte";
|
import { SvelteComponentTyped } from "svelte";
|
||||||
|
|
||||||
export interface DatePickerInputProps
|
export interface DatePickerInputProps
|
||||||
extends svelte.JSX.HTMLAttributes<HTMLElementTagNameMap["div"]> {
|
extends svelte.JSX.HTMLAttributes<HTMLElementTagNameMap["input"]> {
|
||||||
/**
|
/**
|
||||||
* Set the size of the input
|
* Set the size of the input
|
||||||
*/
|
*/
|
||||||
|
|
2
types/MultiSelect/MultiSelect.d.ts
vendored
2
types/MultiSelect/MultiSelect.d.ts
vendored
|
@ -11,7 +11,7 @@ export interface MultiSelectItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface MultiSelectProps
|
export interface MultiSelectProps
|
||||||
extends svelte.JSX.HTMLAttributes<HTMLElementTagNameMap["div"]> {
|
extends svelte.JSX.HTMLAttributes<HTMLElementTagNameMap["input"]> {
|
||||||
/**
|
/**
|
||||||
* Set the multiselect items
|
* Set the multiselect items
|
||||||
* @default []
|
* @default []
|
||||||
|
|
2
types/NumberInput/NumberInput.d.ts
vendored
2
types/NumberInput/NumberInput.d.ts
vendored
|
@ -4,7 +4,7 @@ import { SvelteComponentTyped } from "svelte";
|
||||||
export type NumberInputTranslationId = "increment" | "decrement";
|
export type NumberInputTranslationId = "increment" | "decrement";
|
||||||
|
|
||||||
export interface NumberInputProps
|
export interface NumberInputProps
|
||||||
extends svelte.JSX.HTMLAttributes<HTMLElementTagNameMap["div"]> {
|
extends svelte.JSX.HTMLAttributes<HTMLElementTagNameMap["input"]> {
|
||||||
/**
|
/**
|
||||||
* Set the size of the input
|
* Set the size of the input
|
||||||
*/
|
*/
|
||||||
|
|
2
types/TimePicker/TimePicker.d.ts
vendored
2
types/TimePicker/TimePicker.d.ts
vendored
|
@ -2,7 +2,7 @@
|
||||||
import { SvelteComponentTyped } from "svelte";
|
import { SvelteComponentTyped } from "svelte";
|
||||||
|
|
||||||
export interface TimePickerProps
|
export interface TimePickerProps
|
||||||
extends svelte.JSX.HTMLAttributes<HTMLElementTagNameMap["div"]> {
|
extends svelte.JSX.HTMLAttributes<HTMLElementTagNameMap["input"]> {
|
||||||
/**
|
/**
|
||||||
* Specify the size of the input
|
* Specify the size of the input
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue