@vnejs/uis.react.page-selector 0.1.2

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,12 @@
1
+ export declare const PageSelector: ({ page, pagesCount, pagesMinCount, gap, size, transition, itemWidth, onNextPage, onPrevPage }: {
2
+ page: any;
3
+ pagesCount: any;
4
+ pagesMinCount: any;
5
+ gap?: number;
6
+ size?: number;
7
+ transition?: number;
8
+ itemWidth?: number;
9
+ onNextPage: any;
10
+ onPrevPage: any;
11
+ }) => import("react/jsx-runtime").JSX.Element;
12
+ //# sourceMappingURL=PageSelector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PageSelector.d.ts","sourceRoot":"","sources":["../src/PageSelector.tsx"],"names":[],"mappings":"AA8BA,eAAO,MAAM,YAAY,GAAI;;;;;;;;;;CAAoH,4CAqChJ,CAAC"}
@@ -0,0 +1,28 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useCallback, useMemo } from "react";
3
+ import { getVneLength } from "@vnejs/uis.utils";
4
+ import { Text, Flex } from "@vnejs/uis.react";
5
+ const LINE_ARGS = { x1: "3", y1: "24", x2: "60", y2: "60" };
6
+ const LINE_ARGS_1 = { ...LINE_ARGS, y1: "24" };
7
+ const LINE_ARGS_2 = { ...LINE_ARGS, y1: "96" };
8
+ const renderArrow = (style, angle, shift, onClick) => (_jsx("svg", { width: "60", height: "60", viewBox: "0 0 60 120", xmlns: "http://www.w3.org/2000/Text", fill: "none", stroke: "white", strokeWidth: "6", strokeLinecap: "round", style: style, onClick: onClick, children: _jsxs("g", { transform: `rotate(${angle} ${shift} 60)`, children: [_jsx("line", { ...LINE_ARGS_1 }), _jsx("line", { ...LINE_ARGS_2 })] }) }));
9
+ export const PageSelector = ({ page, pagesCount, pagesMinCount, gap = 120, size = 60, transition = 300, itemWidth = 720, onNextPage, onPrevPage }) => {
10
+ const styleArrow = useMemo(() => {
11
+ const result = {};
12
+ if (size)
13
+ result.height = getVneLength(size);
14
+ if (itemWidth)
15
+ result.width = getVneLength(itemWidth);
16
+ if (transition)
17
+ result.transition = `${transition}ms`;
18
+ return result;
19
+ }, [size, itemWidth, transition]);
20
+ const showArrowLeft = page > pagesMinCount;
21
+ const showArrowRight = page < pagesCount;
22
+ const styleArrowLeft = useMemo(() => ({ ...styleArrow, opacity: showArrowLeft ? 1 : 0 }), [styleArrow, showArrowLeft]);
23
+ const styleArrowRight = useMemo(() => ({ ...styleArrow, opacity: showArrowRight ? 1 : 0 }), [styleArrow, showArrowRight]);
24
+ const onPrevPageHandler = useCallback(() => showArrowLeft && onPrevPage && onPrevPage(), [onPrevPage, showArrowLeft]);
25
+ const onNextPageHandler = useCallback(() => showArrowRight && onNextPage && onNextPage(), [onNextPage, showArrowRight]);
26
+ return (_jsxs(Flex, { align: Flex.ALIGN.CENTER, justify: Flex.JUSTIFY.CENTER, direction: Flex.DIRECTION.ROW, gap: gap, children: [renderArrow(styleArrowLeft, 180, 30, onPrevPageHandler), _jsx(Text, { width: itemWidth, size: size, text: `${page} / ${pagesCount}`, align: Text.ALIGNS.CENTER }), renderArrow(styleArrowRight, 0, 60, onNextPageHandler)] }));
27
+ };
28
+ //# sourceMappingURL=PageSelector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PageSelector.js","sourceRoot":"","sources":["../src/PageSelector.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAE7C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAE9C,MAAM,SAAS,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;AAC5D,MAAM,WAAW,GAAG,EAAE,GAAG,SAA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C,eAAe,EAAE,CAAC,EAAE,EAAE,EAAE,iBAAiB,CAAC,IAClD,CACR,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./PageSelector";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export * from "./PageSelector";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "@vnejs/uis.react.page-selector",
3
+ "version": "0.1.2",
4
+ "main": "dist/index.js",
5
+ "types": "dist/index.d.ts",
6
+ "scripts": {
7
+ "build": "node ../../scripts/build-package.mjs",
8
+ "publish:major:plugin": "npm run publish:major",
9
+ "publish:minor:plugin": "npm run publish:minor",
10
+ "publish:patch:plugin": "npm run publish:patch",
11
+ "publish:major": "npm run build && npm version major && npm publish --access public",
12
+ "publish:minor": "npm run build && npm version minor && npm publish --access public",
13
+ "publish:patch": "npm run build && npm version patch && npm publish --access public"
14
+ },
15
+ "peerDependencies": {
16
+ "@bem-react/classname": "1.5.12",
17
+ "@vnejs/uis.utils": "~0.1.0",
18
+ "react": "19.2.4",
19
+ "react-dom": "19.2.4",
20
+ "@vnejs/uis.react": "~0.1.0"
21
+ },
22
+ "devDependencies": {
23
+ "@vnejs/uis.react": "~0.1.0",
24
+ "typescript": "^5.7.3",
25
+ "@types/react": "^19.0.10",
26
+ "@types/react-dom": "^19.0.4"
27
+ },
28
+ "files": [
29
+ "dist",
30
+ "package.json"
31
+ ]
32
+ }