@pallasoft/ps-internal-components 1.1.1 → 1.3.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.
Files changed (61) hide show
  1. package/dist/components/ps-pagination-bar.d.ts +5 -0
  2. package/dist/components/ps-pagination-bar.js +16 -0
  3. package/dist/components/ps-pagination-content.d.ts +3 -0
  4. package/dist/components/ps-pagination-content.js +41 -0
  5. package/dist/components/ps-pagination-ellipsis.d.ts +5 -0
  6. package/dist/components/ps-pagination-ellipsis.js +10 -0
  7. package/dist/components/ps-pagination-item.d.ts +3 -0
  8. package/dist/components/ps-pagination-item.js +40 -0
  9. package/dist/components/ps-pagination-link.d.ts +3 -0
  10. package/dist/components/ps-pagination-link.js +46 -0
  11. package/dist/components/ps-pagination-next.d.ts +3 -0
  12. package/dist/components/ps-pagination-next.js +44 -0
  13. package/dist/components/ps-pagination-previous.d.ts +3 -0
  14. package/dist/components/ps-pagination-previous.js +44 -0
  15. package/dist/components/ps-pagination.d.ts +5 -0
  16. package/dist/components/ps-pagination.js +9 -0
  17. package/dist/components/ps-search-input.d.ts +3 -0
  18. package/dist/components/ps-search-input.js +49 -0
  19. package/dist/constants/ps-pagination-config.d.ts +10 -0
  20. package/dist/constants/ps-pagination-config.js +13 -0
  21. package/dist/esm/components/ps-pagination-bar.js +12 -0
  22. package/dist/esm/components/ps-pagination-content.js +5 -0
  23. package/dist/esm/components/ps-pagination-ellipsis.js +6 -0
  24. package/dist/esm/components/ps-pagination-item.js +4 -0
  25. package/dist/esm/components/ps-pagination-link.js +10 -0
  26. package/dist/esm/components/ps-pagination-next.js +8 -0
  27. package/dist/esm/components/ps-pagination-previous.js +8 -0
  28. package/dist/esm/components/ps-pagination.js +5 -0
  29. package/dist/esm/components/ps-search-input.js +13 -0
  30. package/dist/esm/constants/ps-pagination-config.js +10 -0
  31. package/dist/esm/index.js +19 -0
  32. package/dist/esm/models/ps-pagination-bar-props.js +1 -0
  33. package/dist/esm/models/ps-pagination-content-props.js +1 -0
  34. package/dist/esm/models/ps-pagination-ellipsis-props.js +1 -0
  35. package/dist/esm/models/ps-pagination-entry.js +1 -0
  36. package/dist/esm/models/ps-pagination-item-props.js +1 -0
  37. package/dist/esm/models/ps-pagination-link-props.js +1 -0
  38. package/dist/esm/models/ps-pagination-props.js +1 -0
  39. package/dist/esm/models/ps-search-input-props.js +1 -0
  40. package/dist/esm/services/ps-pagination-service.js +21 -0
  41. package/dist/index.d.ts +19 -0
  42. package/dist/index.js +19 -0
  43. package/dist/models/ps-pagination-bar-props.d.ts +8 -0
  44. package/dist/models/ps-pagination-bar-props.js +2 -0
  45. package/dist/models/ps-pagination-content-props.d.ts +3 -0
  46. package/dist/models/ps-pagination-content-props.js +2 -0
  47. package/dist/models/ps-pagination-ellipsis-props.d.ts +3 -0
  48. package/dist/models/ps-pagination-ellipsis-props.js +2 -0
  49. package/dist/models/ps-pagination-entry.d.ts +4 -0
  50. package/dist/models/ps-pagination-entry.js +2 -0
  51. package/dist/models/ps-pagination-item-props.d.ts +3 -0
  52. package/dist/models/ps-pagination-item-props.js +2 -0
  53. package/dist/models/ps-pagination-link-props.d.ts +7 -0
  54. package/dist/models/ps-pagination-link-props.js +2 -0
  55. package/dist/models/ps-pagination-props.d.ts +3 -0
  56. package/dist/models/ps-pagination-props.js +2 -0
  57. package/dist/models/ps-search-input-props.d.ts +4 -0
  58. package/dist/models/ps-search-input-props.js +2 -0
  59. package/dist/services/ps-pagination-service.d.ts +4 -0
  60. package/dist/services/ps-pagination-service.js +25 -0
  61. package/package.json +1 -1
@@ -0,0 +1,5 @@
1
+ import type { PsPaginationBarProps } from '../models/ps-pagination-bar-props.js';
2
+ export declare const PsPaginationBar: {
3
+ ({ className, page, pageCount, renderLink, summary, }: PsPaginationBarProps): import("react").JSX.Element;
4
+ displayName: string;
5
+ };
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PsPaginationBar = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const ps_class_name_service_js_1 = require("../services/ps-class-name-service.js");
6
+ const ps_pagination_service_js_1 = require("../services/ps-pagination-service.js");
7
+ const ps_pagination_content_js_1 = require("./ps-pagination-content.js");
8
+ const ps_pagination_ellipsis_js_1 = require("./ps-pagination-ellipsis.js");
9
+ const ps_pagination_item_js_1 = require("./ps-pagination-item.js");
10
+ const ps_pagination_link_js_1 = require("./ps-pagination-link.js");
11
+ const ps_pagination_next_js_1 = require("./ps-pagination-next.js");
12
+ const ps_pagination_previous_js_1 = require("./ps-pagination-previous.js");
13
+ const ps_pagination_js_1 = require("./ps-pagination.js");
14
+ const PsPaginationBar = ({ className, page, pageCount, renderLink, summary, }) => ((0, jsx_runtime_1.jsxs)("div", { className: ps_class_name_service_js_1.PsClassNameService.merge('flex flex-wrap items-center justify-between gap-3 text-sm text-muted-foreground', className), children: [(0, jsx_runtime_1.jsx)("span", { children: summary }), pageCount > 1 ? ((0, jsx_runtime_1.jsx)(ps_pagination_js_1.PsPagination, { className: 'mx-0 w-auto justify-end', children: (0, jsx_runtime_1.jsxs)(ps_pagination_content_js_1.PsPaginationContent, { children: [(0, jsx_runtime_1.jsx)(ps_pagination_item_js_1.PsPaginationItem, { children: (0, jsx_runtime_1.jsx)(ps_pagination_previous_js_1.PsPaginationPrevious, { asChild: true, isDisabled: page <= 1, children: renderLink(Math.max(page - 1, 1), undefined) }) }), ps_pagination_service_js_1.PsPaginationService.entries(page, pageCount).map((entry) => ((0, jsx_runtime_1.jsx)(ps_pagination_item_js_1.PsPaginationItem, { children: entry.isGap ? ((0, jsx_runtime_1.jsx)(ps_pagination_ellipsis_js_1.PsPaginationEllipsis, {})) : ((0, jsx_runtime_1.jsx)(ps_pagination_link_js_1.PsPaginationLink, { asChild: true, isActive: entry.page === page, children: renderLink(entry.page, entry.page) })) }, `${entry.isGap ? 'gap' : 'page'}-${entry.page}`))), (0, jsx_runtime_1.jsx)(ps_pagination_item_js_1.PsPaginationItem, { children: (0, jsx_runtime_1.jsx)(ps_pagination_next_js_1.PsPaginationNext, { asChild: true, isDisabled: page >= pageCount, children: renderLink(Math.min(page + 1, pageCount), undefined) }) })] }) })) : null] }));
15
+ exports.PsPaginationBar = PsPaginationBar;
16
+ exports.PsPaginationBar.displayName = 'PsPaginationBar';
@@ -0,0 +1,3 @@
1
+ import * as React from 'react';
2
+ import type { PsPaginationContentProps } from '../models/ps-pagination-content-props.js';
3
+ export declare const PsPaginationContent: React.ForwardRefExoticComponent<PsPaginationContentProps & React.RefAttributes<HTMLUListElement>>;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.PsPaginationContent = void 0;
37
+ const jsx_runtime_1 = require("react/jsx-runtime");
38
+ const React = __importStar(require("react"));
39
+ const ps_class_name_service_js_1 = require("../services/ps-class-name-service.js");
40
+ exports.PsPaginationContent = React.forwardRef(({ className, ...props }, ref) => ((0, jsx_runtime_1.jsx)("ul", { ref: ref, className: ps_class_name_service_js_1.PsClassNameService.merge('flex flex-row items-center gap-1', className), ...props })));
41
+ exports.PsPaginationContent.displayName = 'PsPaginationContent';
@@ -0,0 +1,5 @@
1
+ import type { PsPaginationEllipsisProps } from '../models/ps-pagination-ellipsis-props.js';
2
+ export declare const PsPaginationEllipsis: {
3
+ ({ className, ...props }: PsPaginationEllipsisProps): import("react").JSX.Element;
4
+ displayName: string;
5
+ };
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PsPaginationEllipsis = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const lucide_react_1 = require("lucide-react");
6
+ const ps_pagination_config_js_1 = require("../constants/ps-pagination-config.js");
7
+ const ps_class_name_service_js_1 = require("../services/ps-class-name-service.js");
8
+ const PsPaginationEllipsis = ({ className, ...props }) => ((0, jsx_runtime_1.jsxs)("span", { "aria-hidden": 'true', className: ps_class_name_service_js_1.PsClassNameService.merge('flex h-9 w-9 items-center justify-center', className), ...props, children: [(0, jsx_runtime_1.jsx)(lucide_react_1.MoreHorizontal, { className: 'h-4 w-4' }), (0, jsx_runtime_1.jsx)("span", { className: 'sr-only', children: ps_pagination_config_js_1.PsPaginationConfig.morePages })] }));
9
+ exports.PsPaginationEllipsis = PsPaginationEllipsis;
10
+ exports.PsPaginationEllipsis.displayName = 'PsPaginationEllipsis';
@@ -0,0 +1,3 @@
1
+ import * as React from 'react';
2
+ import type { PsPaginationItemProps } from '../models/ps-pagination-item-props.js';
3
+ export declare const PsPaginationItem: React.ForwardRefExoticComponent<PsPaginationItemProps & React.RefAttributes<HTMLLIElement>>;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.PsPaginationItem = void 0;
37
+ const jsx_runtime_1 = require("react/jsx-runtime");
38
+ const React = __importStar(require("react"));
39
+ exports.PsPaginationItem = React.forwardRef((props, ref) => (0, jsx_runtime_1.jsx)("li", { ref: ref, ...props }));
40
+ exports.PsPaginationItem.displayName = 'PsPaginationItem';
@@ -0,0 +1,3 @@
1
+ import * as React from 'react';
2
+ import type { PsPaginationLinkProps } from '../models/ps-pagination-link-props.js';
3
+ export declare const PsPaginationLink: React.ForwardRefExoticComponent<PsPaginationLinkProps & React.RefAttributes<HTMLAnchorElement>>;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.PsPaginationLink = void 0;
37
+ const jsx_runtime_1 = require("react/jsx-runtime");
38
+ const React = __importStar(require("react"));
39
+ const react_slot_1 = require("@radix-ui/react-slot");
40
+ const ps_button_variants_js_1 = require("../constants/ps-button-variants.js");
41
+ const ps_class_name_service_js_1 = require("../services/ps-class-name-service.js");
42
+ exports.PsPaginationLink = React.forwardRef(({ asChild = false, className, isActive = false, isDisabled = false, size = 'icon', ...props }, ref) => {
43
+ const Comp = asChild ? react_slot_1.Slot : 'a';
44
+ return ((0, jsx_runtime_1.jsx)(Comp, { ref: ref, "aria-current": isActive ? 'page' : undefined, "aria-disabled": isDisabled ? true : undefined, className: ps_class_name_service_js_1.PsClassNameService.merge((0, ps_button_variants_js_1.PsButtonVariants)({ variant: isActive ? 'outline' : 'ghost', size }), isDisabled ? 'pointer-events-none opacity-50' : '', className), tabIndex: isDisabled ? -1 : undefined, ...props }));
45
+ });
46
+ exports.PsPaginationLink.displayName = 'PsPaginationLink';
@@ -0,0 +1,3 @@
1
+ import * as React from 'react';
2
+ import type { PsPaginationLinkProps } from '../models/ps-pagination-link-props.js';
3
+ export declare const PsPaginationNext: React.ForwardRefExoticComponent<PsPaginationLinkProps & React.RefAttributes<HTMLAnchorElement>>;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.PsPaginationNext = void 0;
37
+ const jsx_runtime_1 = require("react/jsx-runtime");
38
+ const React = __importStar(require("react"));
39
+ const lucide_react_1 = require("lucide-react");
40
+ const ps_pagination_config_js_1 = require("../constants/ps-pagination-config.js");
41
+ const ps_class_name_service_js_1 = require("../services/ps-class-name-service.js");
42
+ const ps_pagination_link_js_1 = require("./ps-pagination-link.js");
43
+ exports.PsPaginationNext = React.forwardRef(({ className, children, ...props }, ref) => ((0, jsx_runtime_1.jsx)(ps_pagination_link_js_1.PsPaginationLink, { ref: ref, "aria-label": ps_pagination_config_js_1.PsPaginationConfig.nextLabel, className: ps_class_name_service_js_1.PsClassNameService.merge('gap-1 pr-2.5', className), size: 'default', ...props, children: children !== undefined ? (children) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", { children: ps_pagination_config_js_1.PsPaginationConfig.next }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: 'h-4 w-4' })] })) })));
44
+ exports.PsPaginationNext.displayName = 'PsPaginationNext';
@@ -0,0 +1,3 @@
1
+ import * as React from 'react';
2
+ import type { PsPaginationLinkProps } from '../models/ps-pagination-link-props.js';
3
+ export declare const PsPaginationPrevious: React.ForwardRefExoticComponent<PsPaginationLinkProps & React.RefAttributes<HTMLAnchorElement>>;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.PsPaginationPrevious = void 0;
37
+ const jsx_runtime_1 = require("react/jsx-runtime");
38
+ const React = __importStar(require("react"));
39
+ const lucide_react_1 = require("lucide-react");
40
+ const ps_pagination_config_js_1 = require("../constants/ps-pagination-config.js");
41
+ const ps_class_name_service_js_1 = require("../services/ps-class-name-service.js");
42
+ const ps_pagination_link_js_1 = require("./ps-pagination-link.js");
43
+ exports.PsPaginationPrevious = React.forwardRef(({ className, children, ...props }, ref) => ((0, jsx_runtime_1.jsx)(ps_pagination_link_js_1.PsPaginationLink, { ref: ref, "aria-label": ps_pagination_config_js_1.PsPaginationConfig.previousLabel, className: ps_class_name_service_js_1.PsClassNameService.merge('gap-1 pl-2.5', className), size: 'default', ...props, children: children !== undefined ? (children) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(lucide_react_1.ChevronLeft, { className: 'h-4 w-4' }), (0, jsx_runtime_1.jsx)("span", { children: ps_pagination_config_js_1.PsPaginationConfig.previous })] })) })));
44
+ exports.PsPaginationPrevious.displayName = 'PsPaginationPrevious';
@@ -0,0 +1,5 @@
1
+ import type { PsPaginationProps } from '../models/ps-pagination-props.js';
2
+ export declare const PsPagination: {
3
+ ({ className, ...props }: PsPaginationProps): import("react").JSX.Element;
4
+ displayName: string;
5
+ };
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PsPagination = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const ps_pagination_config_js_1 = require("../constants/ps-pagination-config.js");
6
+ const ps_class_name_service_js_1 = require("../services/ps-class-name-service.js");
7
+ const PsPagination = ({ className, ...props }) => ((0, jsx_runtime_1.jsx)("nav", { "aria-label": ps_pagination_config_js_1.PsPaginationConfig.label, className: ps_class_name_service_js_1.PsClassNameService.merge('mx-auto flex w-full justify-center', className), role: 'navigation', ...props }));
8
+ exports.PsPagination = PsPagination;
9
+ exports.PsPagination.displayName = 'PsPagination';
@@ -0,0 +1,3 @@
1
+ import * as React from 'react';
2
+ import type { PsSearchInputProps } from '../models/ps-search-input-props.js';
3
+ export declare const PsSearchInput: React.ForwardRefExoticComponent<Omit<PsSearchInputProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.PsSearchInput = void 0;
37
+ const jsx_runtime_1 = require("react/jsx-runtime");
38
+ const React = __importStar(require("react"));
39
+ const lucide_react_1 = require("lucide-react");
40
+ const ps_class_name_service_js_1 = require("../services/ps-class-name-service.js");
41
+ const ps_input_group_js_1 = require("./ps-input-group.js");
42
+ const ps_skeleton_js_1 = require("./ps-skeleton.js");
43
+ const ps_spinner_js_1 = require("./ps-spinner.js");
44
+ exports.PsSearchInput = React.forwardRef(({ className, isLoading = false, isBusy = false, ...props }, ref) => {
45
+ if (isLoading)
46
+ return ((0, jsx_runtime_1.jsx)(ps_skeleton_js_1.PsSkeleton, { className: ps_class_name_service_js_1.PsClassNameService.merge('h-9 w-full rounded-md', className) }));
47
+ return ((0, jsx_runtime_1.jsx)(ps_input_group_js_1.PsInputGroup, { prefix: (0, jsx_runtime_1.jsx)(lucide_react_1.Search, { "aria-hidden": 'true' }), suffix: isBusy ? (0, jsx_runtime_1.jsx)(ps_spinner_js_1.PsSpinner, { className: 'size-4' }) : null, className: className, children: (0, jsx_runtime_1.jsx)("input", { ref: ref, type: 'search', className: 'h-full w-full min-w-0 rounded-none border-0 bg-transparent px-3 py-0 text-base shadow-none outline-none placeholder:text-muted-foreground focus-visible:ring-0 disabled:cursor-not-allowed md:text-sm', ...props }) }));
48
+ });
49
+ exports.PsSearchInput.displayName = 'PsSearchInput';
@@ -0,0 +1,10 @@
1
+ export declare const PsPaginationConfig: {
2
+ readonly edgePages: 1;
3
+ readonly label: "pagination";
4
+ readonly morePages: "More pages";
5
+ readonly next: "Next";
6
+ readonly nextLabel: "Go to next page";
7
+ readonly previous: "Previous";
8
+ readonly previousLabel: "Go to previous page";
9
+ readonly siblingPages: 1;
10
+ };
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PsPaginationConfig = void 0;
4
+ exports.PsPaginationConfig = {
5
+ edgePages: 1,
6
+ label: 'pagination',
7
+ morePages: 'More pages',
8
+ next: 'Next',
9
+ nextLabel: 'Go to next page',
10
+ previous: 'Previous',
11
+ previousLabel: 'Go to previous page',
12
+ siblingPages: 1,
13
+ };
@@ -0,0 +1,12 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { PsClassNameService } from '../services/ps-class-name-service.js';
3
+ import { PsPaginationService } from '../services/ps-pagination-service.js';
4
+ import { PsPaginationContent } from './ps-pagination-content.js';
5
+ import { PsPaginationEllipsis } from './ps-pagination-ellipsis.js';
6
+ import { PsPaginationItem } from './ps-pagination-item.js';
7
+ import { PsPaginationLink } from './ps-pagination-link.js';
8
+ import { PsPaginationNext } from './ps-pagination-next.js';
9
+ import { PsPaginationPrevious } from './ps-pagination-previous.js';
10
+ import { PsPagination } from './ps-pagination.js';
11
+ export const PsPaginationBar = ({ className, page, pageCount, renderLink, summary, }) => (_jsxs("div", { className: PsClassNameService.merge('flex flex-wrap items-center justify-between gap-3 text-sm text-muted-foreground', className), children: [_jsx("span", { children: summary }), pageCount > 1 ? (_jsx(PsPagination, { className: 'mx-0 w-auto justify-end', children: _jsxs(PsPaginationContent, { children: [_jsx(PsPaginationItem, { children: _jsx(PsPaginationPrevious, { asChild: true, isDisabled: page <= 1, children: renderLink(Math.max(page - 1, 1), undefined) }) }), PsPaginationService.entries(page, pageCount).map((entry) => (_jsx(PsPaginationItem, { children: entry.isGap ? (_jsx(PsPaginationEllipsis, {})) : (_jsx(PsPaginationLink, { asChild: true, isActive: entry.page === page, children: renderLink(entry.page, entry.page) })) }, `${entry.isGap ? 'gap' : 'page'}-${entry.page}`))), _jsx(PsPaginationItem, { children: _jsx(PsPaginationNext, { asChild: true, isDisabled: page >= pageCount, children: renderLink(Math.min(page + 1, pageCount), undefined) }) })] }) })) : null] }));
12
+ PsPaginationBar.displayName = 'PsPaginationBar';
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import * as React from 'react';
3
+ import { PsClassNameService } from '../services/ps-class-name-service.js';
4
+ export const PsPaginationContent = React.forwardRef(({ className, ...props }, ref) => (_jsx("ul", { ref: ref, className: PsClassNameService.merge('flex flex-row items-center gap-1', className), ...props })));
5
+ PsPaginationContent.displayName = 'PsPaginationContent';
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { MoreHorizontal } from 'lucide-react';
3
+ import { PsPaginationConfig } from '../constants/ps-pagination-config.js';
4
+ import { PsClassNameService } from '../services/ps-class-name-service.js';
5
+ export const PsPaginationEllipsis = ({ className, ...props }) => (_jsxs("span", { "aria-hidden": 'true', className: PsClassNameService.merge('flex h-9 w-9 items-center justify-center', className), ...props, children: [_jsx(MoreHorizontal, { className: 'h-4 w-4' }), _jsx("span", { className: 'sr-only', children: PsPaginationConfig.morePages })] }));
6
+ PsPaginationEllipsis.displayName = 'PsPaginationEllipsis';
@@ -0,0 +1,4 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import * as React from 'react';
3
+ export const PsPaginationItem = React.forwardRef((props, ref) => _jsx("li", { ref: ref, ...props }));
4
+ PsPaginationItem.displayName = 'PsPaginationItem';
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import * as React from 'react';
3
+ import { Slot } from '@radix-ui/react-slot';
4
+ import { PsButtonVariants } from '../constants/ps-button-variants.js';
5
+ import { PsClassNameService } from '../services/ps-class-name-service.js';
6
+ export const PsPaginationLink = React.forwardRef(({ asChild = false, className, isActive = false, isDisabled = false, size = 'icon', ...props }, ref) => {
7
+ const Comp = asChild ? Slot : 'a';
8
+ return (_jsx(Comp, { ref: ref, "aria-current": isActive ? 'page' : undefined, "aria-disabled": isDisabled ? true : undefined, className: PsClassNameService.merge(PsButtonVariants({ variant: isActive ? 'outline' : 'ghost', size }), isDisabled ? 'pointer-events-none opacity-50' : '', className), tabIndex: isDisabled ? -1 : undefined, ...props }));
9
+ });
10
+ PsPaginationLink.displayName = 'PsPaginationLink';
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import * as React from 'react';
3
+ import { ChevronRight } from 'lucide-react';
4
+ import { PsPaginationConfig } from '../constants/ps-pagination-config.js';
5
+ import { PsClassNameService } from '../services/ps-class-name-service.js';
6
+ import { PsPaginationLink } from './ps-pagination-link.js';
7
+ export const PsPaginationNext = React.forwardRef(({ className, children, ...props }, ref) => (_jsx(PsPaginationLink, { ref: ref, "aria-label": PsPaginationConfig.nextLabel, className: PsClassNameService.merge('gap-1 pr-2.5', className), size: 'default', ...props, children: children !== undefined ? (children) : (_jsxs(_Fragment, { children: [_jsx("span", { children: PsPaginationConfig.next }), _jsx(ChevronRight, { className: 'h-4 w-4' })] })) })));
8
+ PsPaginationNext.displayName = 'PsPaginationNext';
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import * as React from 'react';
3
+ import { ChevronLeft } from 'lucide-react';
4
+ import { PsPaginationConfig } from '../constants/ps-pagination-config.js';
5
+ import { PsClassNameService } from '../services/ps-class-name-service.js';
6
+ import { PsPaginationLink } from './ps-pagination-link.js';
7
+ export const PsPaginationPrevious = React.forwardRef(({ className, children, ...props }, ref) => (_jsx(PsPaginationLink, { ref: ref, "aria-label": PsPaginationConfig.previousLabel, className: PsClassNameService.merge('gap-1 pl-2.5', className), size: 'default', ...props, children: children !== undefined ? (children) : (_jsxs(_Fragment, { children: [_jsx(ChevronLeft, { className: 'h-4 w-4' }), _jsx("span", { children: PsPaginationConfig.previous })] })) })));
8
+ PsPaginationPrevious.displayName = 'PsPaginationPrevious';
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { PsPaginationConfig } from '../constants/ps-pagination-config.js';
3
+ import { PsClassNameService } from '../services/ps-class-name-service.js';
4
+ export const PsPagination = ({ className, ...props }) => (_jsx("nav", { "aria-label": PsPaginationConfig.label, className: PsClassNameService.merge('mx-auto flex w-full justify-center', className), role: 'navigation', ...props }));
5
+ PsPagination.displayName = 'PsPagination';
@@ -0,0 +1,13 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import * as React from 'react';
3
+ import { Search } from 'lucide-react';
4
+ import { PsClassNameService } from '../services/ps-class-name-service.js';
5
+ import { PsInputGroup } from './ps-input-group.js';
6
+ import { PsSkeleton } from './ps-skeleton.js';
7
+ import { PsSpinner } from './ps-spinner.js';
8
+ export const PsSearchInput = React.forwardRef(({ className, isLoading = false, isBusy = false, ...props }, ref) => {
9
+ if (isLoading)
10
+ return (_jsx(PsSkeleton, { className: PsClassNameService.merge('h-9 w-full rounded-md', className) }));
11
+ return (_jsx(PsInputGroup, { prefix: _jsx(Search, { "aria-hidden": 'true' }), suffix: isBusy ? _jsx(PsSpinner, { className: 'size-4' }) : null, className: className, children: _jsx("input", { ref: ref, type: 'search', className: 'h-full w-full min-w-0 rounded-none border-0 bg-transparent px-3 py-0 text-base shadow-none outline-none placeholder:text-muted-foreground focus-visible:ring-0 disabled:cursor-not-allowed md:text-sm', ...props }) }));
12
+ });
13
+ PsSearchInput.displayName = 'PsSearchInput';
@@ -0,0 +1,10 @@
1
+ export const PsPaginationConfig = {
2
+ edgePages: 1,
3
+ label: 'pagination',
4
+ morePages: 'More pages',
5
+ next: 'Next',
6
+ nextLabel: 'Go to next page',
7
+ previous: 'Previous',
8
+ previousLabel: 'Go to previous page',
9
+ siblingPages: 1,
10
+ };
package/dist/esm/index.js CHANGED
@@ -114,6 +114,7 @@ export * from './components/ps-radio-group.js';
114
114
  export * from './components/ps-root-error.js';
115
115
  export * from './components/ps-scroll-area.js';
116
116
  export * from './components/ps-scroll-bar.js';
117
+ export * from './components/ps-search-input.js';
117
118
  export * from './components/ps-select-content.js';
118
119
  export * from './components/ps-select-group.js';
119
120
  export * from './components/ps-select-item.js';
@@ -305,6 +306,7 @@ export * from './models/ps-radio-group-props.js';
305
306
  export * from './models/ps-root-error-props.js';
306
307
  export * from './models/ps-scroll-area-props.js';
307
308
  export * from './models/ps-scroll-bar-props.js';
309
+ export * from './models/ps-search-input-props.js';
308
310
  export * from './models/ps-select-content-props.js';
309
311
  export * from './models/ps-select-item-props.js';
310
312
  export * from './models/ps-select-label-props.js';
@@ -356,3 +358,20 @@ export * from './services/ps-chart-service.js';
356
358
  export * from './services/ps-class-name-service.js';
357
359
  export * from './services/ps-field-format-service.js';
358
360
  export * from './services/ps-file-size-service.js';
361
+ export * from './components/ps-pagination.js';
362
+ export * from './components/ps-pagination-bar.js';
363
+ export * from './components/ps-pagination-content.js';
364
+ export * from './components/ps-pagination-ellipsis.js';
365
+ export * from './components/ps-pagination-item.js';
366
+ export * from './components/ps-pagination-link.js';
367
+ export * from './components/ps-pagination-next.js';
368
+ export * from './components/ps-pagination-previous.js';
369
+ export * from './models/ps-pagination-bar-props.js';
370
+ export * from './models/ps-pagination-content-props.js';
371
+ export * from './models/ps-pagination-ellipsis-props.js';
372
+ export * from './models/ps-pagination-entry.js';
373
+ export * from './models/ps-pagination-item-props.js';
374
+ export * from './models/ps-pagination-link-props.js';
375
+ export * from './models/ps-pagination-props.js';
376
+ export * from './constants/ps-pagination-config.js';
377
+ export * from './services/ps-pagination-service.js';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,21 @@
1
+ import { PsPaginationConfig } from '../constants/ps-pagination-config.js';
2
+ export class PsPaginationService {
3
+ static entries(page, pageCount) {
4
+ const shown = new Set();
5
+ for (let index = 1; index <= Math.min(PsPaginationConfig.edgePages, pageCount); index += 1)
6
+ shown.add(index);
7
+ for (let index = Math.max(1, pageCount - PsPaginationConfig.edgePages + 1); index <= pageCount; index += 1)
8
+ shown.add(index);
9
+ for (let index = Math.max(1, page - PsPaginationConfig.siblingPages); index <= Math.min(pageCount, page + PsPaginationConfig.siblingPages); index += 1)
10
+ shown.add(index);
11
+ const sorted = [...shown].sort((left, right) => left - right);
12
+ const entries = [];
13
+ sorted.forEach((value, index) => {
14
+ const previous = sorted[index - 1];
15
+ if (previous !== undefined && value - previous > 1)
16
+ entries.push({ isGap: true, page: previous + 1 });
17
+ entries.push({ isGap: false, page: value });
18
+ });
19
+ return entries;
20
+ }
21
+ }
package/dist/index.d.ts CHANGED
@@ -114,6 +114,7 @@ export * from './components/ps-radio-group.js';
114
114
  export * from './components/ps-root-error.js';
115
115
  export * from './components/ps-scroll-area.js';
116
116
  export * from './components/ps-scroll-bar.js';
117
+ export * from './components/ps-search-input.js';
117
118
  export * from './components/ps-select-content.js';
118
119
  export * from './components/ps-select-group.js';
119
120
  export * from './components/ps-select-item.js';
@@ -305,6 +306,7 @@ export * from './models/ps-radio-group-props.js';
305
306
  export * from './models/ps-root-error-props.js';
306
307
  export * from './models/ps-scroll-area-props.js';
307
308
  export * from './models/ps-scroll-bar-props.js';
309
+ export * from './models/ps-search-input-props.js';
308
310
  export * from './models/ps-select-content-props.js';
309
311
  export * from './models/ps-select-item-props.js';
310
312
  export * from './models/ps-select-label-props.js';
@@ -356,3 +358,20 @@ export * from './services/ps-chart-service.js';
356
358
  export * from './services/ps-class-name-service.js';
357
359
  export * from './services/ps-field-format-service.js';
358
360
  export * from './services/ps-file-size-service.js';
361
+ export * from './components/ps-pagination.js';
362
+ export * from './components/ps-pagination-bar.js';
363
+ export * from './components/ps-pagination-content.js';
364
+ export * from './components/ps-pagination-ellipsis.js';
365
+ export * from './components/ps-pagination-item.js';
366
+ export * from './components/ps-pagination-link.js';
367
+ export * from './components/ps-pagination-next.js';
368
+ export * from './components/ps-pagination-previous.js';
369
+ export * from './models/ps-pagination-bar-props.js';
370
+ export * from './models/ps-pagination-content-props.js';
371
+ export * from './models/ps-pagination-ellipsis-props.js';
372
+ export * from './models/ps-pagination-entry.js';
373
+ export * from './models/ps-pagination-item-props.js';
374
+ export * from './models/ps-pagination-link-props.js';
375
+ export * from './models/ps-pagination-props.js';
376
+ export * from './constants/ps-pagination-config.js';
377
+ export * from './services/ps-pagination-service.js';
package/dist/index.js CHANGED
@@ -130,6 +130,7 @@ __exportStar(require("./components/ps-radio-group.js"), exports);
130
130
  __exportStar(require("./components/ps-root-error.js"), exports);
131
131
  __exportStar(require("./components/ps-scroll-area.js"), exports);
132
132
  __exportStar(require("./components/ps-scroll-bar.js"), exports);
133
+ __exportStar(require("./components/ps-search-input.js"), exports);
133
134
  __exportStar(require("./components/ps-select-content.js"), exports);
134
135
  __exportStar(require("./components/ps-select-group.js"), exports);
135
136
  __exportStar(require("./components/ps-select-item.js"), exports);
@@ -321,6 +322,7 @@ __exportStar(require("./models/ps-radio-group-props.js"), exports);
321
322
  __exportStar(require("./models/ps-root-error-props.js"), exports);
322
323
  __exportStar(require("./models/ps-scroll-area-props.js"), exports);
323
324
  __exportStar(require("./models/ps-scroll-bar-props.js"), exports);
325
+ __exportStar(require("./models/ps-search-input-props.js"), exports);
324
326
  __exportStar(require("./models/ps-select-content-props.js"), exports);
325
327
  __exportStar(require("./models/ps-select-item-props.js"), exports);
326
328
  __exportStar(require("./models/ps-select-label-props.js"), exports);
@@ -372,3 +374,20 @@ __exportStar(require("./services/ps-chart-service.js"), exports);
372
374
  __exportStar(require("./services/ps-class-name-service.js"), exports);
373
375
  __exportStar(require("./services/ps-field-format-service.js"), exports);
374
376
  __exportStar(require("./services/ps-file-size-service.js"), exports);
377
+ __exportStar(require("./components/ps-pagination.js"), exports);
378
+ __exportStar(require("./components/ps-pagination-bar.js"), exports);
379
+ __exportStar(require("./components/ps-pagination-content.js"), exports);
380
+ __exportStar(require("./components/ps-pagination-ellipsis.js"), exports);
381
+ __exportStar(require("./components/ps-pagination-item.js"), exports);
382
+ __exportStar(require("./components/ps-pagination-link.js"), exports);
383
+ __exportStar(require("./components/ps-pagination-next.js"), exports);
384
+ __exportStar(require("./components/ps-pagination-previous.js"), exports);
385
+ __exportStar(require("./models/ps-pagination-bar-props.js"), exports);
386
+ __exportStar(require("./models/ps-pagination-content-props.js"), exports);
387
+ __exportStar(require("./models/ps-pagination-ellipsis-props.js"), exports);
388
+ __exportStar(require("./models/ps-pagination-entry.js"), exports);
389
+ __exportStar(require("./models/ps-pagination-item-props.js"), exports);
390
+ __exportStar(require("./models/ps-pagination-link-props.js"), exports);
391
+ __exportStar(require("./models/ps-pagination-props.js"), exports);
392
+ __exportStar(require("./constants/ps-pagination-config.js"), exports);
393
+ __exportStar(require("./services/ps-pagination-service.js"), exports);
@@ -0,0 +1,8 @@
1
+ import type * as React from 'react';
2
+ export interface PsPaginationBarProps {
3
+ className?: string;
4
+ pageCount: number;
5
+ page: number;
6
+ renderLink: (page: number, children: React.ReactNode) => React.ReactElement;
7
+ summary?: React.ReactNode;
8
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ import type * as React from 'react';
2
+ export interface PsPaginationContentProps extends React.ComponentPropsWithoutRef<'ul'> {
3
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ import type * as React from 'react';
2
+ export interface PsPaginationEllipsisProps extends React.ComponentProps<'span'> {
3
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ export interface PsPaginationEntry {
2
+ isGap: boolean;
3
+ page: number;
4
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ import type * as React from 'react';
2
+ export interface PsPaginationItemProps extends React.ComponentPropsWithoutRef<'li'> {
3
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ import type * as React from 'react';
2
+ export interface PsPaginationLinkProps extends React.ComponentPropsWithoutRef<'a'> {
3
+ asChild?: boolean;
4
+ isActive?: boolean;
5
+ isDisabled?: boolean;
6
+ size?: 'default' | 'icon';
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ import type * as React from 'react';
2
+ export interface PsPaginationProps extends React.ComponentProps<'nav'> {
3
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ import type { PsFieldInputProps } from './ps-field-input-props.js';
2
+ export interface PsSearchInputProps extends PsFieldInputProps {
3
+ isBusy?: boolean;
4
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ import type { PsPaginationEntry } from '../models/ps-pagination-entry.js';
2
+ export declare class PsPaginationService {
3
+ static entries(page: number, pageCount: number): PsPaginationEntry[];
4
+ }
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PsPaginationService = void 0;
4
+ const ps_pagination_config_js_1 = require("../constants/ps-pagination-config.js");
5
+ class PsPaginationService {
6
+ static entries(page, pageCount) {
7
+ const shown = new Set();
8
+ for (let index = 1; index <= Math.min(ps_pagination_config_js_1.PsPaginationConfig.edgePages, pageCount); index += 1)
9
+ shown.add(index);
10
+ for (let index = Math.max(1, pageCount - ps_pagination_config_js_1.PsPaginationConfig.edgePages + 1); index <= pageCount; index += 1)
11
+ shown.add(index);
12
+ for (let index = Math.max(1, page - ps_pagination_config_js_1.PsPaginationConfig.siblingPages); index <= Math.min(pageCount, page + ps_pagination_config_js_1.PsPaginationConfig.siblingPages); index += 1)
13
+ shown.add(index);
14
+ const sorted = [...shown].sort((left, right) => left - right);
15
+ const entries = [];
16
+ sorted.forEach((value, index) => {
17
+ const previous = sorted[index - 1];
18
+ if (previous !== undefined && value - previous > 1)
19
+ entries.push({ isGap: true, page: previous + 1 });
20
+ entries.push({ isGap: false, page: value });
21
+ });
22
+ return entries;
23
+ }
24
+ }
25
+ exports.PsPaginationService = PsPaginationService;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pallasoft/ps-internal-components",
3
- "version": "1.1.1",
3
+ "version": "1.3.0",
4
4
  "private": false,
5
5
  "description": "Shared Pallasoft internal UI: app header, app switcher and shadcn primitives for staff tools",
6
6
  "main": "./dist/index.js",