@snack-uikit/pagination
Advanced tools
Comparing version 0.5.4 to 0.6.0
@@ -6,2 +6,13 @@ # Change Log | ||
# 0.6.0 (2023-12-28) | ||
### Features | ||
* **FF-3960:** add size Xs ([e1f3116](https://github.com/cloud-ru-tech/snack-uikit/commit/e1f3116715c0e541721d33a372c44446dc77e026)) | ||
## 0.5.4 (2023-12-18) | ||
@@ -8,0 +19,0 @@ |
@@ -14,6 +14,8 @@ var __rest = (this && this.__rest) || function (s, e) { | ||
import { extractSupportProps } from '@snack-uikit/utils'; | ||
import { usePaginationContext } from '../../contexts'; | ||
import styles from './styles.module.css'; | ||
export function PageButton(_a) { | ||
var { label, activated, onClick, setButtonRef } = _a, rest = __rest(_a, ["label", "activated", "onClick", "setButtonRef"]); | ||
return (_jsx("button", Object.assign({ className: styles.pageButton, onClick: onClick, ref: setButtonRef }, extractSupportProps(rest), { "data-activated": activated || undefined, children: label }))); | ||
const { size } = usePaginationContext(); | ||
return (_jsx("button", Object.assign({ className: styles.pageButton, onClick: onClick, ref: setButtonRef, "data-size": size }, extractSupportProps(rest), { "data-activated": activated || undefined, children: label }))); | ||
} |
import { WithSupportProps } from '@snack-uikit/utils'; | ||
import { Size } from '../../types'; | ||
export type PaginationProps = WithSupportProps<{ | ||
@@ -9,4 +10,9 @@ /** Общее количество страниц */ | ||
onChange(page: number): void; | ||
/** CSS класснейм */ | ||
className?: string; | ||
/** Размер | ||
* @default 's' | ||
*/ | ||
size?: Size; | ||
}>; | ||
export declare function Pagination({ total, page, onChange, className, ...rest }: PaginationProps): import("react/jsx-runtime").JSX.Element; | ||
export declare function Pagination({ total, page, onChange, className, size, ...rest }: PaginationProps): import("react/jsx-runtime").JSX.Element; |
@@ -17,2 +17,4 @@ var __rest = (this && this.__rest) || function (s, e) { | ||
import { extractSupportProps } from '@snack-uikit/utils'; | ||
import { SIZE } from '../../constants'; | ||
import { PaginationContext } from '../../contexts'; | ||
import { getPaginationEntries, PaginationEntryKind } from '../../utils'; | ||
@@ -26,3 +28,3 @@ import { PageMoreButton } from '../PageMoreButton'; | ||
export function Pagination(_a) { | ||
var { total, page, onChange, className } = _a, rest = __rest(_a, ["total", "page", "onChange", "className"]); | ||
var { total, page, onChange, className, size = SIZE.S } = _a, rest = __rest(_a, ["total", "page", "onChange", "className", "size"]); | ||
const entries = getPaginationEntries({ | ||
@@ -69,3 +71,3 @@ firstPage: FIRST_PAGE, | ||
}; | ||
return (_jsx("nav", Object.assign({ className: className }, extractSupportProps(rest), { children: _jsxs("ul", { className: styles.pagination, children: [_jsx("li", { children: _jsx(ButtonFunction, { icon: _jsx(ChevronLeftSVG, {}), onClick: handlePreviousPageButtonClick, disabled: page === FIRST_PAGE, "data-test-id": 'page-prev-button' }) }), entries.map(renderEntry), _jsx("li", { children: _jsx(ButtonFunction, { icon: _jsx(ChevronRightSVG, {}), onClick: handleNextPageButtonClick, disabled: page === total, "data-test-id": 'page-next-button' }) })] }) }))); | ||
return (_jsx(PaginationContext.Provider, { value: { size }, children: _jsx("nav", Object.assign({ className: className }, extractSupportProps(rest), { children: _jsxs("ul", { className: styles.pagination, children: [_jsx("li", { children: _jsx(ButtonFunction, { icon: _jsx(ChevronLeftSVG, {}), onClick: handlePreviousPageButtonClick, disabled: page === FIRST_PAGE, "data-test-id": 'page-prev-button', size: size }) }), entries.map(renderEntry), _jsx("li", { children: _jsx(ButtonFunction, { icon: _jsx(ChevronRightSVG, {}), onClick: handleNextPageButtonClick, disabled: page === total, "data-test-id": 'page-next-button', size: size }) })] }) })) })); | ||
} |
@@ -9,4 +9,5 @@ import { WithSupportProps } from '@snack-uikit/utils'; | ||
onChange(page: number): void; | ||
/** CSS класснейм */ | ||
className?: string; | ||
}>; | ||
export declare function PaginationSlider({ total, page, onChange, className, ...rest }: PaginationSliderProps): import("react/jsx-runtime").JSX.Element; |
@@ -7,3 +7,3 @@ { | ||
"title": "Pagination", | ||
"version": "0.5.4", | ||
"version": "0.6.0", | ||
"sideEffects": [ | ||
@@ -36,7 +36,7 @@ "*.css", | ||
"dependencies": { | ||
"@snack-uikit/button": "0.15.0", | ||
"@snack-uikit/button": "0.15.1", | ||
"@snack-uikit/icons": "0.19.2", | ||
"@snack-uikit/utils": "3.2.0" | ||
}, | ||
"gitHead": "50ef9bb113ec40897ffb3eeae62539ce82ade899" | ||
"gitHead": "57c597a3eebaf6528c0c61b6b27dd244753de1cf" | ||
} |
@@ -40,3 +40,4 @@ # Pagination | ||
| total* | `number` | - | Общее количество страниц | | ||
| className | `string` | - | CSS-класс | | ||
| className | `string` | - | CSS класснейм | | ||
| size | enum Size: `"xs"`, `"s"` | s | Размер | | ||
## PaginationSlider | ||
@@ -49,3 +50,3 @@ ### Props | ||
| total* | `number` | - | Общее количество страниц | | ||
| className | `string` | - | CSS-класс | | ||
| className | `string` | - | CSS класснейм | | ||
@@ -52,0 +53,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
65165
73
854
54
+ Added@snack-uikit/button@0.15.1(transitive)
+ Added@snack-uikit/counter@0.6.0(transitive)
- Removed@snack-uikit/button@0.15.0(transitive)
- Removed@snack-uikit/counter@0.5.0(transitive)
Updated@snack-uikit/button@0.15.1