@deepnoid/ui 0.0.111 → 0.0.112
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.
- package/dist/{chunk-UZL66GNP.mjs → chunk-YRMFIXXC.mjs} +39 -3
- package/dist/components/pagination/index.js +3875 -19
- package/dist/components/pagination/index.mjs +6 -1
- package/dist/components/pagination/pagination.d.mts +1 -0
- package/dist/components/pagination/pagination.d.ts +1 -0
- package/dist/components/pagination/pagination.js +3875 -19
- package/dist/components/pagination/pagination.mjs +6 -1
- package/dist/components/pagination/pagination.test.js +3876 -30
- package/dist/components/pagination/pagination.test.mjs +6 -1
- package/dist/components/select/index.mjs +2 -2
- package/dist/components/select/select.mjs +2 -2
- package/dist/components/select/select.test.mjs +2 -2
- package/dist/index.js +50 -3
- package/dist/index.mjs +34 -20
- package/package.json +1 -1
- package/dist/{chunk-2BCJZILI.mjs → chunk-JN7EGKJL.mjs} +3 -3
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
import {
|
|
3
3
|
usePagination_default
|
|
4
4
|
} from "./chunk-F3HENRVM.mjs";
|
|
5
|
+
import {
|
|
6
|
+
input_default
|
|
7
|
+
} from "./chunk-ZNEEYSIK.mjs";
|
|
5
8
|
import {
|
|
6
9
|
mapPropsVariants
|
|
7
10
|
} from "./chunk-E3G5QXSH.mjs";
|
|
@@ -21,6 +24,7 @@ var Pagination = forwardRef((originalProps, ref) => {
|
|
|
21
24
|
totalPage,
|
|
22
25
|
showPageNumber = true,
|
|
23
26
|
showPageLabel,
|
|
27
|
+
showPageInput,
|
|
24
28
|
showFirstLastButtons,
|
|
25
29
|
handleChangePage
|
|
26
30
|
} = props;
|
|
@@ -33,8 +37,8 @@ var Pagination = forwardRef((originalProps, ref) => {
|
|
|
33
37
|
const slots = useMemo(() => pagination({ ...variantProps }), [variantProps]);
|
|
34
38
|
const getBaseProps = useCallback(() => ({ className: slots.base({ class: classNames == null ? void 0 : classNames.base }) }), [slots, classNames]);
|
|
35
39
|
const getLabelProps = useCallback(
|
|
36
|
-
() => ({ className: slots.label({ class: classNames == null ? void 0 : classNames.label }) }),
|
|
37
|
-
[slots, classNames]
|
|
40
|
+
() => ({ className: `${slots.label({ class: classNames == null ? void 0 : classNames.label })} + ${showPageInput && " !min-w-[55px]"}` }),
|
|
41
|
+
[slots, classNames, showPageInput]
|
|
38
42
|
);
|
|
39
43
|
const getWrapperProps = useCallback(
|
|
40
44
|
() => ({ className: slots.wrapper({ class: classNames == null ? void 0 : classNames.wrapper }) }),
|
|
@@ -45,8 +49,40 @@ var Pagination = forwardRef((originalProps, ref) => {
|
|
|
45
49
|
() => ({ className: slots.button({ class: classNames == null ? void 0 : classNames.button }) }),
|
|
46
50
|
[slots, classNames]
|
|
47
51
|
);
|
|
52
|
+
const getLabelWrapperProps = useCallback(
|
|
53
|
+
() => ({
|
|
54
|
+
className: "flex shrink-0",
|
|
55
|
+
onSubmit: (e) => {
|
|
56
|
+
e.preventDefault();
|
|
57
|
+
if (showPageInput && handleChangePage) {
|
|
58
|
+
const formData = new FormData(e.target);
|
|
59
|
+
const page = formData.get("pagination-input");
|
|
60
|
+
if (page) handleChangePage(+page);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}),
|
|
64
|
+
[handleChangePage, showPageInput]
|
|
65
|
+
);
|
|
66
|
+
const getInputProps = useCallback(
|
|
67
|
+
() => ({
|
|
68
|
+
defaultValue: currentPage,
|
|
69
|
+
size: "sm",
|
|
70
|
+
name: "pagination-input",
|
|
71
|
+
type: "number",
|
|
72
|
+
max: totalPage,
|
|
73
|
+
min: 1,
|
|
74
|
+
classNames: { inputWrapper: "!w-[48px] h-[20px] px-[6px]", input: "input-arrow-hide" }
|
|
75
|
+
}),
|
|
76
|
+
[currentPage, totalPage]
|
|
77
|
+
);
|
|
48
78
|
return /* @__PURE__ */ jsxs("div", { ...getBaseProps(), children: [
|
|
49
|
-
|
|
79
|
+
/* @__PURE__ */ jsxs("form", { ...getLabelWrapperProps(), children: [
|
|
80
|
+
showPageInput && /* @__PURE__ */ jsx(input_default, { ...getInputProps() }, `${currentPage}+pagination-input`),
|
|
81
|
+
showPageLabel && /* @__PURE__ */ jsxs("span", { ...getLabelProps(), children: [
|
|
82
|
+
!showPageInput && currentPage,
|
|
83
|
+
` of ${totalPage}`
|
|
84
|
+
] })
|
|
85
|
+
] }),
|
|
50
86
|
/* @__PURE__ */ jsxs("div", { ...getWrapperProps(), children: [
|
|
51
87
|
showFirstLastButtons && /* @__PURE__ */ jsx(
|
|
52
88
|
"div",
|