Merge pull request #222 from IBM/types

add TypeScript definitions
This commit is contained in:
Eric Liu 2020-07-27 06:42:35 -07:00 committed by GitHub
commit be9b6fcc98
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 1620 additions and 154 deletions

253
README.md
View file

@ -537,26 +537,26 @@ import { ComboBox } from "carbon-components-svelte";
**API** **API**
| Prop name | Type | Default | | Prop name | Type | Default |
| :--------------- | :---------------------------------------------------------- | :------------------------------ | | :--------------- | :---------------------------------------------------------- | :----------------------------- |
| items | <code>ComboBoxItem[]</code> | [] | | items | <code>ComboBoxItem[]</code> | [] |
| itemToString | <code>(item: ComboBoxItem) => string;</code> | (item: ComboBoxItem) => string; | | itemToString | <code>(item: ComboBoxItem) => string</code> | (item: ComboBoxItem) => string |
| selectedIndex | <code>number</code> | -1 | | selectedIndex | <code>number</code> | -1 |
| value | <code>string</code> | "" | | value | <code>string</code> | "" |
| size | <code>"sm" &#124; "xl"</code> | - | | size | <code>"sm" &#124; "xl"</code> | - |
| disabled | <code>boolean</code> | false | | disabled | <code>boolean</code> | false |
| titleText | <code>string</code> | "" | | titleText | <code>string</code> | "" |
| placeholder | <code>string</code> | "" | | placeholder | <code>string</code> | "" |
| helperText | <code>string</code> | "" | | helperText | <code>string</code> | "" |
| invalidText | <code>string</code> | "" | | invalidText | <code>string</code> | "" |
| invalid | <code>boolean</code> | false | | invalid | <code>boolean</code> | false |
| light | <code>boolean</code> | false | | light | <code>boolean</code> | false |
| open | <code>boolean</code> | false | | open | <code>boolean</code> | false |
| shouldFilterItem | <code>(item: ComboBoxItem, value: string) => boolean</code> | () => true | | shouldFilterItem | <code>(item: ComboBoxItem, value: string) => boolean</code> | () => true |
| translateWithId | <code>(id: any) => string;</code> | - | | translateWithId | <code>(id: any) => string</code> | - |
| id | <code>string</code> | - | | id | <code>string</code> | - |
| name | <code>string</code> | - | | name | <code>string</code> | - |
| ref | <code>null &#124; HTMLInputElement</code> | null | | ref | <code>null &#124; HTMLInputElement</code> | null |
</details> </details>
@ -916,11 +916,11 @@ import { TableHeader } from "carbon-components-svelte";
**API** **API**
| Prop name | Type | Default | | Prop name | Type | Default |
| :-------------- | :------------------------- | :-------- | | :-------------- | :------------------------ | :------- |
| scope | <code>string</code> | "col" | | scope | <code>string</code> | "col" |
| translateWithId | <code>() => string;</code> | () => ""; | | translateWithId | <code>() => string</code> | () => "" |
| id | <code>string</code> | - | | id | <code>string</code> | - |
</details> </details>
@ -1093,26 +1093,26 @@ import { Dropdown } from "carbon-components-svelte";
**API** **API**
| Prop name | Type | Default | | Prop name | Type | Default |
| :-------------- | :------------------------------------------- | :--------------------------------------- | | :-------------- | :------------------------------------------ | :--------------------------------------- |
| items | <code>DropdownItem[]</code> | [] | | items | <code>DropdownItem[]</code> | [] |
| itemToString | <code>(item: DropdownItem) => string;</code> | (item: DropdownItem) => DropdownItemText | DropdownItemId; | | itemToString | <code>(item: DropdownItem) => string</code> | (item: DropdownItem) => DropdownItemText | DropdownItemId |
| selectedIndex | <code>number</code> | -1 | | selectedIndex | <code>number</code> | -1 |
| type | <code>"default" &#124; "inline"</code> | "default" | | type | <code>"default" &#124; "inline"</code> | "default" |
| size | <code>"sm" &#124; "lg" &#124; "xl"</code> | - | | size | <code>"sm" &#124; "lg" &#124; "xl"</code> | - |
| open | <code>boolean</code> | false | | open | <code>boolean</code> | false |
| inline | <code>boolean</code> | false | | inline | <code>boolean</code> | false |
| light | <code>boolean</code> | false | | light | <code>boolean</code> | false |
| disabled | <code>boolean</code> | false | | disabled | <code>boolean</code> | false |
| titleText | <code>string</code> | "" | | titleText | <code>string</code> | "" |
| invalid | <code>boolean</code> | false | | invalid | <code>boolean</code> | false |
| invalidText | <code>string</code> | "" | | invalidText | <code>string</code> | "" |
| helperText | <code>string</code> | "" | | helperText | <code>string</code> | "" |
| label | <code>string</code> | - | | label | <code>string</code> | - |
| translateWithId | <code>(id: any) => string;</code> | - | | translateWithId | <code>(id: any) => string</code> | - |
| id | <code>string</code> | - | | id | <code>string</code> | - |
| name | <code>string</code> | - | | name | <code>string</code> | - |
| ref | <code>null &#124; HTMLButtonElement</code> | null | | ref | <code>null &#124; HTMLButtonElement</code> | null |
</details> </details>
@ -1158,7 +1158,7 @@ import { FileUploader } from "carbon-components-svelte";
| accept | <code>string[]</code> | [] | | accept | <code>string[]</code> | [] |
| files | <code>string[]</code> | [] | | files | <code>string[]</code> | [] |
| multiple | <code>boolean</code> | false | | multiple | <code>boolean</code> | false |
| clearFiles | <code>() => any;</code> | () => void; | | clearFiles | <code>() => any</code> | () => void |
| labelDescription | <code>string</code> | "" | | labelDescription | <code>string</code> | "" |
| labelTitle | <code>string</code> | "" | | labelTitle | <code>string</code> | "" |
| kind | <code>"primary" &#124; "secondary" &#124; "tertiary" &#124; "ghost" &#124; "danger"</code> | "primary" | | kind | <code>"primary" &#124; "secondary" &#124; "tertiary" &#124; "ghost" &#124; "danger"</code> | "primary" |
@ -1216,18 +1216,18 @@ import { FileUploaderDropContainer } from "carbon-components-svelte";
**API** **API**
| Prop name | Type | Default | | Prop name | Type | Default |
| :------------ | :---------------------------------------- | :----------------------- | | :------------ | :---------------------------------------- | :---------------------- |
| accept | <code>string[]</code> | [] | | accept | <code>string[]</code> | [] |
| multiple | <code>boolean</code> | false | | multiple | <code>boolean</code> | false |
| validateFiles | <code>(files: Files) => Files</code> | (files: Files) => Files; | | validateFiles | <code>(files: Files) => Files</code> | (files: Files) => Files |
| labelText | <code>string</code> | "Add file" | | labelText | <code>string</code> | "Add file" |
| role | <code>string</code> | "button" | | role | <code>string</code> | "button" |
| disabled | <code>boolean</code> | false | | disabled | <code>boolean</code> | false |
| tabindex | <code>string</code> | "0" | | tabindex | <code>string</code> | "0" |
| id | <code>string</code> | - | | id | <code>string</code> | - |
| name | <code>string</code> | "" | | name | <code>string</code> | "" |
| ref | <code>null &#124; HTMLInputElement</code> | null | | ref | <code>null &#124; HTMLInputElement</code> | null |
</details> </details>
@ -1395,7 +1395,6 @@ import { Column } from "carbon-components-svelte";
| lg | <code>ColumnBreakpoint</code> | - | | lg | <code>ColumnBreakpoint</code> | - |
| xlg | <code>ColumnBreakpoint</code> | - | | xlg | <code>ColumnBreakpoint</code> | - |
| max | <code>ColumnBreakpoint</code> | - | | max | <code>ColumnBreakpoint</code> | - |
| | <code>string[]</code> | - |
</details> </details>
@ -1592,15 +1591,14 @@ import { ListBoxField } from "carbon-components-svelte";
**API** **API**
| Prop name | Type | Default | | Prop name | Type | Default |
| :-------------- | :------------------------------------------------------ | :-------------- | | :-------------- | :------------------------------------------------------ | :------------- |
| disabled | <code>boolean</code> | false | | disabled | <code>boolean</code> | false |
| role | <code>string</code> | "combobox" | | role | <code>string</code> | "combobox" |
| tabindex | <code>string</code> | "-1" | | tabindex | <code>string</code> | "-1" |
| | <code>{ close: "close"; open: "open"; }</code> | - | | translateWithId | <code>(id: ListBoxFieldTranslationId) => string;</code> | (id) => string |
| translateWithId | <code>(id: ListBoxFieldTranslationId) => string;</code> | (id) => string; | | id | <code>string</code> | - |
| id | <code>string</code> | - | | ref | <code>null &#124; HTMLElement</code> | null |
| ref | <code>null &#124; HTMLElement</code> | null |
</details> </details>
@ -1642,11 +1640,10 @@ import { ListBoxMenuIcon } from "carbon-components-svelte";
**API** **API**
| Prop name | Type | Default | | Prop name | Type | Default |
| :-------------- | :--------------------------------------------------------- | :-------------- | | :-------------- | :-------------------------------------------------------- | :------------- |
| open | <code>boolean</code> | false | | open | <code>boolean</code> | false |
| | <code>{ close: "close"; open: "open" }</code> | - | | translateWithId | <code>(id: ListBoxMenuIconTranslationId) => string</code> | (id) => string |
| translateWithId | <code>(id: ListBoxMenuIconTranslationId) => string;</code> | (id) => string; |
</details> </details>
@ -1689,13 +1686,12 @@ import { ListBoxSelection } from "carbon-components-svelte";
**API** **API**
| Prop name | Type | Default | | Prop name | Type | Default |
| :-------------- | :---------------------------------------------------------------------- | :-------------- | | :-------------- | :--------------------------------------------------------- | :------------- |
| selectionCount | <code>\*</code> | - | | selectionCount | <code>\*</code> | - |
| disabled | <code>boolean</code> | false | | disabled | <code>boolean</code> | false |
| | <code>{ clearAll: "clearAll"; clearSelection: "clearSelection" }</code> | - | | translateWithId | <code>(id: ListBoxSelectionTranslationId) => string</code> | (id) => string |
| translateWithId | <code>(id: ListBoxSelectionTranslationId) => string;</code> | (id) => string; | | ref | <code>null &#124; HTMLElement</code> | null |
| ref | <code>null &#124; HTMLElement</code> | null |
</details> </details>
@ -1802,7 +1798,7 @@ import { MultiSelect } from "carbon-components-svelte";
| Prop name | Type | Default | | Prop name | Type | Default |
| :---------------- | :------------------------------------------------------------------------ | :---------------------------------------------------------- | | :---------------- | :------------------------------------------------------------------------ | :---------------------------------------------------------- |
| items | <code>MultiSelectItem[]</code> | [] | | items | <code>MultiSelectItem[]</code> | [] |
| itemToString | <code>(item: MultiSelectItem) => string;</code> | (item: MultiSelectItem) => MultiSelectItemText | MultiSelectItemId; | | itemToString | <code>(item: MultiSelectItem) => string</code> | (item: MultiSelectItem) => MultiSelectItemText | MultiSelectItemId |
| selectedIds | <code>MultiSelectItemId[]</code> | [] | | selectedIds | <code>MultiSelectItemId[]</code> | [] |
| value | <code>string</code> | "" | | value | <code>string</code> | "" |
| size | <code>"sm" &#124; "lg" &#124; "xl"</code> | - | | size | <code>"sm" &#124; "lg" &#124; "xl"</code> | - |
@ -1816,7 +1812,7 @@ import { MultiSelect } from "carbon-components-svelte";
| locale | <code>string</code> | "en" | | locale | <code>string</code> | "en" |
| placeholder | <code>string</code> | "" | | placeholder | <code>string</code> | "" |
| sortItem | <code>(a: MultiSelectItem, b: MultiSelectItem) => MultiSelectItem;</code> | (a: MultiSelectItem, b: MultiSelectItem) => MultiSelectItem | | sortItem | <code>(a: MultiSelectItem, b: MultiSelectItem) => MultiSelectItem;</code> | (a: MultiSelectItem, b: MultiSelectItem) => MultiSelectItem |
| translateWithId | <code>(id: any) => string;</code> | - | | translateWithId | <code>(id: any) => string</code> | - |
| titleText | <code>string</code> | "" | | titleText | <code>string</code> | "" |
| useTitleInItem | <code>boolean</code> | false | | useTitleInItem | <code>boolean</code> | false |
| invalid | <code>boolean</code> | false | | invalid | <code>boolean</code> | false |
@ -2019,29 +2015,28 @@ import { NumberInput } from "carbon-components-svelte";
**API** **API**
| Prop name | Type | Default | | Prop name | Type | Default |
| :-------------- | :-------------------------------------------------------------- | :---------------------------------------- | | :-------------- | :---------------------------------------------------- | :--------------------------------------- |
| size | <code>"sm" &#124; "xl"</code> | - | | size | <code>"sm" &#124; "xl"</code> | - |
| value | <code>string</code> | "" | | value | <code>string</code> | "" |
| step | <code>number</code> | 1 | | step | <code>number</code> | 1 |
| max | <code>number</code> | - | | max | <code>number</code> | - |
| min | <code>number</code> | - | | min | <code>number</code> | - |
| light | <code>boolean</code> | false | | light | <code>boolean</code> | false |
| readonly | <code>boolean</code> | false | | readonly | <code>boolean</code> | false |
| mobile | <code>boolean</code> | false | | mobile | <code>boolean</code> | false |
| allowEmpty | <code>boolean</code> | false | | allowEmpty | <code>boolean</code> | false |
| disabled | <code>boolean</code> | false | | disabled | <code>boolean</code> | false |
| iconDescription | <code>string</code> | "" | | iconDescription | <code>string</code> | "" |
| invalid | <code>boolean</code> | false | | invalid | <code>boolean</code> | false |
| invalidText | <code>string</code> | "Provide invalidText" | | invalidText | <code>string</code> | "Provide invalidText" |
| helperText | <code>string</code> | "" | | helperText | <code>string</code> | "" |
| label | <code>string</code> | "" | | label | <code>string</code> | "" |
| hideLabel | <code>boolean</code> | false | | hideLabel | <code>boolean</code> | false |
| translateWithId | <code>(id: NumberInputTranslationId) => string;</code> | (id: NumberInputTranslationId) => string; | | translateWithId | <code>(id: NumberInputTranslationId) => string</code> | (id: NumberInputTranslationId) => string |
| | <code>{ increment: "increment"; decrement: "decrement" }</code> | - | | id | <code>string</code> | - |
| id | <code>string</code> | - | | name | <code>string</code> | - |
| name | <code>string</code> | - | | ref | <code>null &#124; HTMLInputElement</code> | null |
| ref | <code>null &#124; HTMLInputElement</code> | null |
</details> </details>
@ -2163,23 +2158,23 @@ import { Pagination } from "carbon-components-svelte";
**API** **API**
| Prop name | Type | Default | | Prop name | Type | Default |
| :---------------- | :---------------------------------------------------------------- | :--------------------------------------------------- | | :---------------- | :--------------------------------------------------------------- | :-------------------------------------------------- |
| page | <code>number</code> | 1 | | page | <code>number</code> | 1 |
| total | <code>number</code> | 0 | | total | <code>number</code> | 0 |
| disabled | <code>boolean</code> | false | | disabled | <code>boolean</code> | false |
| forwardText | <code>string</code> | "Next page" | | forwardText | <code>string</code> | "Next page" |
| backwardText | <code>string</code> | "Previous page" | | backwardText | <code>string</code> | "Previous page" |
| itemsPerPageText | <code>string</code> | "Items per page:" | | itemsPerPageText | <code>string</code> | "Items per page:" |
| itemText | <code>(min: number, max: number) => string;</code> | (min: number, max: number) => string; | | itemText | <code>(min: number, max: number) => string</code> | (min: number, max: number) => string |
| itemRangeText | <code>(min: number, max: number, total: number) => string;</code> | (min: number, max: number, total: number) => string; | | itemRangeText | <code>(min: number, max: number, total: number) => string</code> | (min: number, max: number, total: number) => string |
| pageInputDisabled | <code>boolean</code> | false | | pageInputDisabled | <code>boolean</code> | false |
| pageSize | <code>number</code> | 10 | | pageSize | <code>number</code> | 10 |
| pageSizes | <code>number[]</code> | [10] | | pageSizes | <code>number[]</code> | [10] |
| pagesUnknown | <code>boolean</code> | false | | pagesUnknown | <code>boolean</code> | false |
| pageText | <code>(page: number) => string;</code> | (current: number) => string; | | pageText | <code>(page: number) => string</code> | (current: number) => string |
| pageRangeText | <code>(current: number, total: number) => string;</code> | (current: number, total: number) => string; | | pageRangeText | <code>(current: number, total: number) => string</code> | (current: number, total: number) => string |
| id | <code>string</code> | - | | id | <code>string</code> | - |
</details> </details>
@ -2230,7 +2225,6 @@ import { PaginationNav } from "carbon-components-svelte";
| loop | <code>boolean</code> | false | | loop | <code>boolean</code> | false |
| forwardText | <code>string</code> | "Next page" | | forwardText | <code>string</code> | "Next page" |
| backwardText | <code>string</code> | "Next page" | | backwardText | <code>string</code> | "Next page" |
| | <code>4</code> | - |
</details> </details>
@ -2595,13 +2589,12 @@ import { SkeletonText } from "carbon-components-svelte";
**API** **API**
| Prop name | Type | Default | | Prop name | Type | Default |
| :-------- | :-------------------- | :------ | | :-------- | :------------------- | :------ |
| lines | <code>number</code> | 3 | | lines | <code>number</code> | 3 |
| heading | <code>boolean</code> | false | | heading | <code>boolean</code> | false |
| paragraph | <code>boolean</code> | false | | paragraph | <code>boolean</code> | false |
| width | <code>string</code> | "100%" | | width | <code>string</code> | "100%" |
| | <code>number[]</code> | - |
</details> </details>

View file

@ -6,6 +6,7 @@
"svelte": "./src/index.js", "svelte": "./src/index.js",
"main": "./lib/index.js", "main": "./lib/index.js",
"module": "./lib/index.mjs", "module": "./lib/index.mjs",
"types": "./types/index.d.ts",
"scripts": { "scripts": {
"start": "start-storybook -p 9090", "start": "start-storybook -p 9090",
"build": "build-storybook", "build": "build-storybook",

View file

@ -11,7 +11,7 @@
/** /**
* Override the display of a combobox item * Override the display of a combobox item
* @type {(item: ComboBoxItem) => string;} [itemToString = (item: ComboBoxItem) => string;] * @type {(item: ComboBoxItem) => string} [itemToString = (item: ComboBoxItem) => string]
*/ */
export let itemToString = (item) => item.text || item.id; export let itemToString = (item) => item.text || item.id;
@ -89,7 +89,7 @@
/** /**
* Override the default translation ids * Override the default translation ids
* @type {(id: any) => string;} [translateWithId] * @type {(id: any) => string} [translateWithId]
*/ */
export let translateWithId = undefined; export let translateWithId = undefined;

View file

@ -7,7 +7,7 @@
/** /**
* Override the default id translations * Override the default id translations
* @type {() => string;} [translateWithId = () => "";] * @type {() => string} [translateWithId = () => ""]
*/ */
export let translateWithId = () => ""; export let translateWithId = () => "";

View file

@ -13,7 +13,7 @@
/** /**
* Override the display of a dropdown item * Override the display of a dropdown item
* @type {(item: DropdownItem) => string;} [itemToString = (item: DropdownItem) => DropdownItemText | DropdownItemId;] * @type {(item: DropdownItem) => string} [itemToString = (item: DropdownItem) => DropdownItemText | DropdownItemId]
*/ */
export let itemToString = (item) => item.text || item.id; export let itemToString = (item) => item.text || item.id;
@ -91,7 +91,7 @@
/** /**
* Override the default translation ids * Override the default translation ids
* @type {(id: any) => string;} [translateWithId] * @type {(id: any) => string} [translateWithId]
*/ */
export let translateWithId = undefined; export let translateWithId = undefined;

View file

@ -25,7 +25,7 @@
/** /**
* Override the default behavior of clearing the array of uploaded files * Override the default behavior of clearing the array of uploaded files
* @type {() => any;} [clearFiles = () => void;] * @type {() => any} [clearFiles = () => void]
*/ */
export const clearFiles = () => { export const clearFiles = () => {
files = []; files = [];

View file

@ -18,7 +18,7 @@
/** /**
* Override the default behavior of validating uploaded files * Override the default behavior of validating uploaded files
* The default behavior does not validate files * The default behavior does not validate files
* @type {(files: Files) => Files} [validateFiles = (files: Files) => Files;] * @type {(files: Files) => Files} [validateFiles = (files: Files) => Files]
*/ */
export let validateFiles = (files) => files; export let validateFiles = (files) => files;

View file

@ -32,7 +32,7 @@
/** /**
* @typedef {boolean | number} ColumnSize * @typedef {boolean | number} ColumnSize
* @typedef {{span?: ColumnSize: offset: number;}} ColumnSizeDescriptor * @typedef {{span?: ColumnSize; offset: number;}} ColumnSizeDescriptor
* @typedef {ColumnSize | ColumnSizeDescriptor} ColumnBreakpoint * @typedef {ColumnSize | ColumnSizeDescriptor} ColumnBreakpoint
*/ */

View file

@ -30,7 +30,7 @@
/** /**
* Override the default translation ids * Override the default translation ids
* @type {(id: ListBoxFieldTranslationId) => string;} [translateWithId = (id) => string;] * @type {(id: ListBoxFieldTranslationId) => string} [translateWithId = (id) => string]
*/ */
export let translateWithId = (id) => defaultTranslations[id]; export let translateWithId = (id) => defaultTranslations[id];

View file

@ -18,7 +18,7 @@
/** /**
* Override the default translation ids * Override the default translation ids
* @type {(id: ListBoxMenuIconTranslationId) => string;} [translateWithId = (id) => string;] * @type {(id: ListBoxMenuIconTranslationId) => string} [translateWithId = (id) => string]
*/ */
export let translateWithId = (id) => defaultTranslations[id]; export let translateWithId = (id) => defaultTranslations[id];

View file

@ -1,7 +1,7 @@
<script> <script>
/** /**
* Specify the number of selected items * Specify the number of selected items
* @type {*} [selectionCount] * @type {any} [selectionCount]
*/ */
export let selectionCount = undefined; export let selectionCount = undefined;
@ -27,7 +27,7 @@
/** /**
* Override the default translation ids * Override the default translation ids
* @type {(id: ListBoxSelectionTranslationId) => string;} [translateWithId = (id) => string;] * @type {(id: ListBoxSelectionTranslationId) => string} [translateWithId = (id) => string]
*/ */
export let translateWithId = (id) => defaultTranslations[id]; export let translateWithId = (id) => defaultTranslations[id];

View file

@ -13,7 +13,7 @@
/** /**
* Override the display of a multiselect item * Override the display of a multiselect item
* @type {(item: MultiSelectItem) => string;} [itemToString = (item: MultiSelectItem) => MultiSelectItemText | MultiSelectItemId;] * @type {(item: MultiSelectItem) => string} [itemToString = (item: MultiSelectItem) => MultiSelectItemText | MultiSelectItemId]
*/ */
export let itemToString = (item) => item.text || item.id; export let itemToString = (item) => item.text || item.id;
@ -62,7 +62,7 @@
/** /**
* Override the filtering logic * Override the filtering logic
* The default filtering is an exact string comparison * The default filtering is an exact string comparison
* @type {(item: MultiSelectItem, value: string) => string;} [filterItem = ((item: MultiSelectItem, value: string) => string;)] * @type {(item: MultiSelectItem, value: string) => string} [filterItem = (item: MultiSelectItem, value: string) => string]
*/ */
export let filterItem = (item, value) => export let filterItem = (item, value) =>
item.text.toLowerCase().includes(value.toLowerCase()); item.text.toLowerCase().includes(value.toLowerCase());
@ -94,14 +94,14 @@
/** /**
* Override the sorting logic * Override the sorting logic
* The default sorting compare the item text value * The default sorting compare the item text value
* @type {(a: MultiSelectItem, b: MultiSelectItem) => MultiSelectItem;} [sortItem = (a: MultiSelectItem, b: MultiSelectItem) => MultiSelectItem] * @type {(a: MultiSelectItem, b: MultiSelectItem) => MultiSelectItem} [sortItem = (a: MultiSelectItem, b: MultiSelectItem) => MultiSelectItem]
*/ */
export let sortItem = (a, b) => export let sortItem = (a, b) =>
a.text.localeCompare(b.text, locale, { numeric: true }); a.text.localeCompare(b.text, locale, { numeric: true });
/** /**
* Override the default translation ids * Override the default translation ids
* @type {(id: any) => string;} [translateWithId] * @type {(id: any) => string} [translateWithId]
*/ */
export let translateWithId = undefined; export let translateWithId = undefined;

View file

@ -1,6 +1,4 @@
<script> <script>
/** /**
* Set the size of the input * Set the size of the input
* @type {"sm" | "xl"} [size] * @type {"sm" | "xl"} [size]
@ -100,10 +98,10 @@
/** /**
* @typedef {"increment" | "decrement"} NumberInputTranslationId * @typedef {"increment" | "decrement"} NumberInputTranslationId
*/ */
/** /**
* Override the default translation ids * Override the default translation ids
* @type {(id: NumberInputTranslationId) => string;} [translateWithId = (id: NumberInputTranslationId) => string;] * @type {(id: NumberInputTranslationId) => string} [translateWithId = (id: NumberInputTranslationId) => string]
*/ */
export let translateWithId = (id) => defaultTranslations[id]; export let translateWithId = (id) => defaultTranslations[id];

View file

@ -37,13 +37,13 @@
/** /**
* Override the item text * Override the item text
* @type {(min: number, max: number) => string;} [itemText = (min: number, max: number) => string;] * @type {(min: number, max: number) => string} [itemText = (min: number, max: number) => string]
*/ */
export let itemText = (min, max) => `${min}${max} items`; export let itemText = (min, max) => `${min}${max} items`;
/** /**
* Override the item range text * Override the item range text
* @type {(min: number, max: number, total: number) => string;} [itemRangeText = (min: number, max: number, total: number) => string;] * @type {(min: number, max: number, total: number) => string} [itemRangeText = (min: number, max: number, total: number) => string]
*/ */
export let itemRangeText = (min, max, total) => export let itemRangeText = (min, max, total) =>
`${min}${max} of ${total} items`; `${min}${max} of ${total} items`;
@ -74,13 +74,13 @@
/** /**
* Override the page text * Override the page text
* @type {(page: number) => string;} [pageText = (current: number) => string;] * @type {(page: number) => string} [pageText = (current: number) => string]
*/ */
export let pageText = (page) => `page ${page}`; export let pageText = (page) => `page ${page}`;
/** /**
* Override the page range text * Override the page range text
* @type {(current: number, total: number) => string;} [pageRangeText = (current: number, total: number) => string;] * @type {(current: number, total: number) => string} [pageRangeText = (current: number, total: number) => string]
*/ */
export let pageRangeText = (current, total) => `of ${total} pages`; export let pageRangeText = (current, total) => `of ${total} pages`;

1474
types/index.d.ts vendored Normal file

File diff suppressed because it is too large Load diff