@yamada-ui/pagination 0.2.4 → 0.2.6

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.
@@ -0,0 +1,5 @@
1
+ export { Pagination, PaginationProps } from './pagination.mjs';
2
+ export { UsePaginationProps, UsePaginationReturn, usePagination } from './use-pagination.mjs';
3
+ import '@yamada-ui/core';
4
+ import 'react';
5
+ import './pagination-item.mjs';
@@ -0,0 +1,10 @@
1
+ import { IconProps } from '@yamada-ui/icon';
2
+ import { FC } from 'react';
3
+
4
+ declare const DotsIcon: FC<IconProps>;
5
+ declare const FirstIcon: FC<IconProps>;
6
+ declare const LastIcon: FC<IconProps>;
7
+ declare const PrevIcon: FC<IconProps>;
8
+ declare const NextIcon: FC<IconProps>;
9
+
10
+ export { DotsIcon, FirstIcon, LastIcon, NextIcon, PrevIcon };
@@ -0,0 +1,24 @@
1
+ import { ComponentPropsWithoutRef, FC } from 'react';
2
+
3
+ type PaginationItemOptions = {
4
+ /**
5
+ * The type of the page or item assigned to the pagination item.
6
+ */
7
+ page: number | 'dots' | 'prev' | 'next' | 'first' | 'last';
8
+ /**
9
+ * If `true`, the pagination item will be actived.
10
+ *
11
+ * @default false
12
+ */
13
+ isActive?: boolean;
14
+ /**
15
+ * If `true`, the pagination item will be disabled.
16
+ *
17
+ * @default false
18
+ */
19
+ isDisabled?: boolean;
20
+ };
21
+ type PaginationItemProps = ComponentPropsWithoutRef<'button'> & PaginationItemOptions;
22
+ declare const PaginationItem: FC<PaginationItemProps>;
23
+
24
+ export { PaginationItem, PaginationItemProps };
@@ -0,0 +1,56 @@
1
+ import * as _yamada_ui_core from '@yamada-ui/core';
2
+ import { HTMLUIProps, ThemeProps, Token } from '@yamada-ui/core';
3
+ import { FC } from 'react';
4
+ import { PaginationItemProps } from './pagination-item.mjs';
5
+ import { UsePaginationProps } from './use-pagination.mjs';
6
+
7
+ type PaginationOptions = {
8
+ /**
9
+ * The pagination button component to use.
10
+ */
11
+ component?: FC<PaginationItemProps>;
12
+ /**
13
+ * Props for button element.
14
+ */
15
+ itemProps?: HTMLUIProps<'button'>;
16
+ /**
17
+ * If `true`, display the control buttons.
18
+ *
19
+ * @default true
20
+ */
21
+ withControls?: Token<boolean>;
22
+ /**
23
+ * Props for control button element.
24
+ */
25
+ controlProps?: HTMLUIProps<'button'>;
26
+ /**
27
+ * Props for previous of the control button element.
28
+ */
29
+ controlPrevProps?: HTMLUIProps<'button'>;
30
+ /**
31
+ * Props for next of the control button element.
32
+ */
33
+ controlNextProps?: HTMLUIProps<'button'>;
34
+ /**
35
+ * If `true`, display the edge buttons.
36
+ *
37
+ * @default false
38
+ */
39
+ withEdges?: Token<boolean>;
40
+ /**
41
+ * Props for edge button element.
42
+ */
43
+ edgeProps?: HTMLUIProps<'button'>;
44
+ /**
45
+ * Props for first of the edge button element.
46
+ */
47
+ edgeFirstProps?: HTMLUIProps<'button'>;
48
+ /**
49
+ * Props for last of the edge button element.
50
+ */
51
+ edgeLastProps?: HTMLUIProps<'button'>;
52
+ };
53
+ type PaginationProps = Omit<HTMLUIProps<'div'>, 'onChange' | 'children'> & ThemeProps<'Pagination'> & UsePaginationProps & PaginationOptions;
54
+ declare const Pagination: _yamada_ui_core.Component<"div", PaginationProps>;
55
+
56
+ export { Pagination, PaginationProps };
@@ -0,0 +1,60 @@
1
+ import * as react from 'react';
2
+ import { Token, CSSUIObject } from '@yamada-ui/core';
3
+
4
+ type PaginationContext = Record<string, CSSUIObject>;
5
+ declare const PaginationProvider: react.Provider<PaginationContext>;
6
+ declare const usePaginationContext: () => PaginationContext;
7
+ type UsePaginationProps = {
8
+ /**
9
+ * The page of the pagination.
10
+ * Should be less than `total` and greater than `1`.
11
+ */
12
+ page?: number;
13
+ /**
14
+ * The initial page of the pagination.
15
+ * Should be less than `total` and greater than `1`.
16
+ *
17
+ * @default 1
18
+ */
19
+ defaultPage?: number;
20
+ /**
21
+ * The total number of pages in pagination.
22
+ */
23
+ total: number;
24
+ /** Number of siblings displayed on the left/right side of selected page.
25
+ *
26
+ * @default 1
27
+ */
28
+ siblings?: Token<number>;
29
+ /**
30
+ * Number of elements visible on the left/right edges.
31
+ *
32
+ * @default 1
33
+ */
34
+ boundaries?: Token<number>;
35
+ /**
36
+ * If `true`, the pagination all item will be disabled.
37
+ *
38
+ * @default false
39
+ */
40
+ isDisabled?: boolean;
41
+ /**
42
+ * The callback invoked when the page changes.
43
+ */
44
+ onChange?: (page: number) => void;
45
+ };
46
+ declare const computedRange: (start: number, end: number) => number[];
47
+ declare const usePagination: ({ page, defaultPage, total, siblings, boundaries, isDisabled, ...rest }: UsePaginationProps) => {
48
+ currentPage: number;
49
+ total: number;
50
+ isDisabled: boolean;
51
+ onFirst: () => void;
52
+ onLast: () => void;
53
+ onPrev: () => void;
54
+ onNext: () => void;
55
+ onChange: (page: number) => void;
56
+ range: (number | "dots")[];
57
+ };
58
+ type UsePaginationReturn = ReturnType<typeof usePagination>;
59
+
60
+ export { PaginationProvider, UsePaginationProps, UsePaginationReturn, computedRange, usePagination, usePaginationContext };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yamada-ui/pagination",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "description": "Yamada UI pagination component",
5
5
  "keywords": [
6
6
  "yamada",
@@ -35,11 +35,11 @@
35
35
  "url": "https://github.com/hirotomoyamada/yamada-ui/issues"
36
36
  },
37
37
  "dependencies": {
38
- "@yamada-ui/core": "0.4.3",
39
- "@yamada-ui/utils": "0.1.2",
40
- "@yamada-ui/icon": "0.2.4",
41
- "@yamada-ui/use-controllable-state": "0.1.3",
42
- "@yamada-ui/use-value": "0.1.16"
38
+ "@yamada-ui/core": "0.5.1",
39
+ "@yamada-ui/utils": "0.1.3",
40
+ "@yamada-ui/icon": "0.2.6",
41
+ "@yamada-ui/use-controllable-state": "0.1.4",
42
+ "@yamada-ui/use-value": "0.1.18"
43
43
  },
44
44
  "devDependencies": {
45
45
  "react": "^18.0.0",