mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 02:11:05 +00:00
* chore(deps-dev): upgrade carbon-components to v10.31.0 * fix(slider): use CSS to hide input if hideTextInput is true * docs(slider): add hidden text input, invalid, disabled examples * feat(tabs): support "container" type for TabsSkeleton * chore(list-box): remove hotfix inline style to center dropdown chevron * fix(number-input): use add, subtract icons and update markup * feat(select): add warning state * docs(select): add invalid state example * docs(select): add helper text example * fix(structured-list): add "rowgroup" role to StructuredListBody * docs: release code snippet max-width * docs(select): add skeleton hidden label example * feat(popover): add Popover component * feat(pagination): dispatch button click events to be consistent with PaginationNav * fix(multi-select): type clear as a custom event * docs(radio-button): add disabled buttons example * chore(tabs): use absolute icon import * fix(link): remove line breaks within anchor link * docs(radio-button): adjust section copy verbiage * chore(deps-dev): upgrade carbon-icons-svelte to v10.27 v10.27 uses the SvelteComponentTyped interface * docs(accordion): adjust section title verbiage * test(types): fix warnings from svelte-check * fix(search): only set autofocus attribute if equals true * feat(popover): add closeOnOutsideClick prop * docs: style [data-outline] as relative positioned * feat(context-menu): add initial ContextMenu * feat(context-menu): annotate props, generate types * feat(context-menu): add initial focus logic * fix(context-menu): correctly tab in/out of nested menus * chore(context-menu): update types * fix(context-menu): obtain radio id from node directly * docs(context-menu): add examples and test * fix(context-menu): prevent default keydown behavior
111 lines
2.3 KiB
TypeScript
111 lines
2.3 KiB
TypeScript
/// <reference types="svelte" />
|
||
import { SvelteComponentTyped } from "svelte";
|
||
|
||
export interface PaginationProps
|
||
extends svelte.JSX.HTMLAttributes<HTMLElementTagNameMap["div"]> {
|
||
/**
|
||
* Specify the current page index
|
||
* @default 1
|
||
*/
|
||
page?: number;
|
||
|
||
/**
|
||
* Specify the total number of items
|
||
* @default 0
|
||
*/
|
||
totalItems?: number;
|
||
|
||
/**
|
||
* Set to `true` to disable the pagination
|
||
* @default false
|
||
*/
|
||
disabled?: boolean;
|
||
|
||
/**
|
||
* Specify the forward button text
|
||
* @default "Next page"
|
||
*/
|
||
forwardText?: string;
|
||
|
||
/**
|
||
* Specify the backward button text
|
||
* @default "Previous page"
|
||
*/
|
||
backwardText?: string;
|
||
|
||
/**
|
||
* Specify the items per page text
|
||
* @default "Items per page:"
|
||
*/
|
||
itemsPerPageText?: string;
|
||
|
||
/**
|
||
* Override the item text
|
||
* @default (min, max) => `${min}–${max} items`
|
||
*/
|
||
itemText?: (min: number, max: number) => string;
|
||
|
||
/**
|
||
* Override the item range text
|
||
* @default (min, max, total) => `${min}–${max} of ${total} items`
|
||
*/
|
||
itemRangeText?: (min: number, max: number, total: number) => string;
|
||
|
||
/**
|
||
* Set to `true` to disable the page input
|
||
* @default false
|
||
*/
|
||
pageInputDisabled?: boolean;
|
||
|
||
/**
|
||
* Set to `true` to disable the page size input
|
||
* @default false
|
||
*/
|
||
pageSizeInputDisabled?: boolean;
|
||
|
||
/**
|
||
* Specify the number of items to display in a page
|
||
* @default 10
|
||
*/
|
||
pageSize?: number;
|
||
|
||
/**
|
||
* Specify the available page sizes
|
||
* @default [10]
|
||
*/
|
||
pageSizes?: number[];
|
||
|
||
/**
|
||
* Set to `true` if the number of pages is unknown
|
||
* @default false
|
||
*/
|
||
pagesUnknown?: boolean;
|
||
|
||
/**
|
||
* Override the page text
|
||
* @default (page) => `page ${page}`
|
||
*/
|
||
pageText?: (page: number) => string;
|
||
|
||
/**
|
||
* Override the page range text
|
||
* @default (current, total) => `of ${total} page${total === 1 ? "" : "s"}`
|
||
*/
|
||
pageRangeText?: (current: number, total: number) => string;
|
||
|
||
/**
|
||
* Set an id for the top-level element
|
||
* @default "ccs-" + Math.random().toString(36)
|
||
*/
|
||
id?: string;
|
||
}
|
||
|
||
export default class Pagination extends SvelteComponentTyped<
|
||
PaginationProps,
|
||
{
|
||
update: CustomEvent<{ pageSize: number; page: number }>;
|
||
["click:button--previous"]: CustomEvent<{ page: number }>;
|
||
["click:button--next"]: CustomEvent<{ page: number }>;
|
||
},
|
||
{}
|
||
> {}
|