@stokelp/ui 1.31.0 → 1.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -23,4 +23,5 @@ export * from './alert';
23
23
  export * from './table';
24
24
  export * from './breadcrumb';
25
25
  export * from './popover';
26
+ export * from './pagination';
26
27
  export * from './app';
@@ -0,0 +1,20 @@
1
+ import { ComponentProps, FC } from 'react';
2
+ import { ComponentVariants } from '../../utils/slots';
3
+ import { StyledComponent } from '@stokelp/styled-system/jsx';
4
+ import { PaginationRecipe } from '@stokelp/styled-system/recipes';
5
+
6
+ declare const StyledPagination: ComponentVariants<StyledComponent<"div", {}>, PaginationRecipe>;
7
+ type StyledPaginationProps = ComponentProps<typeof StyledPagination>;
8
+ export interface PaginationProps extends Omit<StyledPaginationProps, 'children' | 'defaultValue' | 'onChange'> {
9
+ total: number;
10
+ value?: number;
11
+ defaultValue?: number;
12
+ onChange?: (value: number) => void;
13
+ disabled?: boolean;
14
+ siblings?: number;
15
+ boundaries?: number;
16
+ onNextPage?: () => void;
17
+ onPrevPage?: () => void;
18
+ }
19
+ export declare const Pagination: FC<PaginationProps>;
20
+ export {};
@@ -0,0 +1 @@
1
+ export * from './Pagination';
@@ -0,0 +1,18 @@
1
+ export declare const DOTS: unique symbol;
2
+ export interface PaginationParams {
3
+ initialPage?: number;
4
+ page?: number;
5
+ total: number;
6
+ siblings?: number;
7
+ boundaries?: number;
8
+ onChange?: (page: number) => void;
9
+ }
10
+ export declare const usePagination: ({ total, siblings, boundaries, page, initialPage, onChange, }: PaginationParams) => {
11
+ range: (number | typeof DOTS)[];
12
+ active: number;
13
+ setPage: (pageNumber: number) => void;
14
+ next: () => void;
15
+ previous: () => void;
16
+ first: () => void;
17
+ last: () => void;
18
+ };
@@ -0,0 +1,12 @@
1
+ interface UseUncontrolledInput<T> {
2
+ /** Value for controlled state */
3
+ value?: T;
4
+ /** Initial value for uncontrolled state */
5
+ defaultValue?: T;
6
+ /** Final value for uncontrolled state when value and defaultValue are not provided */
7
+ finalValue?: T;
8
+ /** Controlled state onChange handler */
9
+ onChange?: (value: T, ...payload: any[]) => void;
10
+ }
11
+ export declare function useUncontrolled<T>({ value, defaultValue, finalValue, onChange, }: UseUncontrolledInput<T>): [T, (value: T, ...payload: any[]) => void, boolean];
12
+ export {};
@@ -0,0 +1,3 @@
1
+ type EventHandler<Event> = ((event?: Event) => void) | undefined;
2
+ export declare const createEventHandler: <Event>(parentEventHandler: EventHandler<Event>, eventHandler: EventHandler<Event>) => (event?: Event) => void;
3
+ export {};