@elliemae/ds-pagination 2.3.0-alpha.8 → 2.3.0-next.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.
Files changed (83) hide show
  1. package/cjs/Pagination.js +35 -0
  2. package/cjs/PaginationDataTestID.js +11 -0
  3. package/cjs/hooks/usePaginationSearch.js +32 -0
  4. package/cjs/index.d.js +2 -0
  5. package/cjs/index.js +10 -0
  6. package/cjs/parts/PageNextButton.js +33 -0
  7. package/cjs/parts/PagePrevButton.js +32 -0
  8. package/cjs/parts/PaginationContent.js +95 -0
  9. package/cjs/parts/Paginator.js +153 -0
  10. package/cjs/parts/PerPageSelector.js +102 -0
  11. package/cjs/props.js +53 -0
  12. package/cjs/styled.js +57 -0
  13. package/esm/Pagination.js +26 -0
  14. package/esm/PaginationDataTestID.js +7 -0
  15. package/{dist/esm → esm}/hooks/usePaginationSearch.js +13 -16
  16. package/esm/index.d.js +1 -0
  17. package/esm/index.js +1 -0
  18. package/esm/parts/PageNextButton.js +25 -0
  19. package/esm/parts/PagePrevButton.js +24 -0
  20. package/esm/parts/PaginationContent.js +85 -0
  21. package/esm/parts/Paginator.js +146 -0
  22. package/esm/parts/PerPageSelector.js +95 -0
  23. package/esm/props.js +48 -0
  24. package/esm/styled.js +40 -0
  25. package/package.json +44 -44
  26. package/types/Pagination.d.ts +5 -0
  27. package/types/PaginationDataTestID.d.ts +5 -0
  28. package/types/hooks/usePaginationSearch.d.ts +1 -0
  29. package/types/index.d.ts +1 -0
  30. package/types/parts/PageNextButton.d.ts +3 -0
  31. package/types/parts/PagePrevButton.d.ts +3 -0
  32. package/types/parts/PaginationContent.d.ts +3 -0
  33. package/types/parts/Paginator.d.ts +10 -0
  34. package/types/parts/PerPageSelector.d.ts +4 -0
  35. package/types/props.d.ts +20 -0
  36. package/types/styled.d.ts +16 -0
  37. package/dist/cjs/Pagination.js +0 -50
  38. package/dist/cjs/Pagination.js.map +0 -7
  39. package/dist/cjs/PaginationDataTestID.js +0 -39
  40. package/dist/cjs/PaginationDataTestID.js.map +0 -7
  41. package/dist/cjs/hooks/usePaginationSearch.js +0 -60
  42. package/dist/cjs/hooks/usePaginationSearch.js.map +0 -7
  43. package/dist/cjs/index.d.js +0 -27
  44. package/dist/cjs/index.d.js.map +0 -7
  45. package/dist/cjs/index.js +0 -28
  46. package/dist/cjs/index.js.map +0 -7
  47. package/dist/cjs/parts/PageNextButton.js +0 -53
  48. package/dist/cjs/parts/PageNextButton.js.map +0 -7
  49. package/dist/cjs/parts/PagePrevButton.js +0 -52
  50. package/dist/cjs/parts/PagePrevButton.js.map +0 -7
  51. package/dist/cjs/parts/PaginationContent.js +0 -92
  52. package/dist/cjs/parts/PaginationContent.js.map +0 -7
  53. package/dist/cjs/parts/Paginator.js +0 -131
  54. package/dist/cjs/parts/Paginator.js.map +0 -7
  55. package/dist/cjs/parts/PerPageSelector.js +0 -103
  56. package/dist/cjs/parts/PerPageSelector.js.map +0 -7
  57. package/dist/cjs/props.js +0 -82
  58. package/dist/cjs/props.js.map +0 -7
  59. package/dist/cjs/styled.js +0 -113
  60. package/dist/cjs/styled.js.map +0 -7
  61. package/dist/esm/Pagination.js +0 -21
  62. package/dist/esm/Pagination.js.map +0 -7
  63. package/dist/esm/PaginationDataTestID.js +0 -10
  64. package/dist/esm/PaginationDataTestID.js.map +0 -7
  65. package/dist/esm/hooks/usePaginationSearch.js.map +0 -7
  66. package/dist/esm/index.d.js +0 -2
  67. package/dist/esm/index.d.js.map +0 -7
  68. package/dist/esm/index.js +0 -3
  69. package/dist/esm/index.js.map +0 -7
  70. package/dist/esm/parts/PageNextButton.js +0 -24
  71. package/dist/esm/parts/PageNextButton.js.map +0 -7
  72. package/dist/esm/parts/PagePrevButton.js +0 -23
  73. package/dist/esm/parts/PagePrevButton.js.map +0 -7
  74. package/dist/esm/parts/PaginationContent.js +0 -63
  75. package/dist/esm/parts/PaginationContent.js.map +0 -7
  76. package/dist/esm/parts/Paginator.js +0 -102
  77. package/dist/esm/parts/Paginator.js.map +0 -7
  78. package/dist/esm/parts/PerPageSelector.js +0 -74
  79. package/dist/esm/parts/PerPageSelector.js.map +0 -7
  80. package/dist/esm/props.js +0 -53
  81. package/dist/esm/props.js.map +0 -7
  82. package/dist/esm/styled.js +0 -84
  83. package/dist/esm/styled.js.map +0 -7
@@ -1,131 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __reExport = (target, module2, copyDefault, desc) => {
13
- if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
- for (let key of __getOwnPropNames(module2))
15
- if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
16
- __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
17
- }
18
- return target;
19
- };
20
- var __toESM = (module2, isNodeMode) => {
21
- return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
22
- };
23
- var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
- return (module2, temp) => {
25
- return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
26
- };
27
- })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
28
- var Paginator_exports = {};
29
- __export(Paginator_exports, {
30
- default: () => Paginator_default
31
- });
32
- var React = __toESM(require("react"));
33
- var import_react = __toESM(require("react"));
34
- var import_ds_icons = require("@elliemae/ds-icons");
35
- var import_ds_utilities = require("@elliemae/ds-utilities");
36
- var import_ds_grid = require("@elliemae/ds-grid");
37
- var import_ds_dropdownmenu = require("@elliemae/ds-dropdownmenu");
38
- var import_styled = require("../styled");
39
- var import_usePaginationSearch = require("../hooks/usePaginationSearch");
40
- const Paginator = (props) => {
41
- const { pageIndex, pageCount, onPageChange, pageDetails, pageDetailsTitle } = props;
42
- const [isOpened, setIsOpened] = (0, import_react.useState)(false);
43
- const btnRef = (0, import_react.useRef)(null);
44
- const pageInfoRef = (0, import_react.useRef)(null);
45
- const { width: btnWidth } = (0, import_ds_utilities.useOnElementResize)(btnRef);
46
- const { width: txtWidth } = (0, import_ds_utilities.useOnElementResize)(pageInfoRef);
47
- const options = (0, import_react.useMemo)(() => new Array(pageCount).fill(0).map((_, index) => {
48
- const option = {
49
- dsId: (index + 1).toString(),
50
- label: (index + 1).toString(),
51
- value: index + 1,
52
- type: "single"
53
- };
54
- if (pageDetails.length) {
55
- option.render = () => /* @__PURE__ */ import_react.default.createElement(import_ds_grid.Grid, {
56
- cols: ["16px", `${txtWidth + 16}px`, "auto"],
57
- gutter: "xxs",
58
- alignItems: "center"
59
- }, pageIndex === index ? /* @__PURE__ */ import_react.default.createElement(import_ds_icons.Checkmark, {
60
- size: "s",
61
- color: ["brand-primary", "600"]
62
- }) : /* @__PURE__ */ import_react.default.createElement("div", null), /* @__PURE__ */ import_react.default.createElement("span", null, index + 1), /* @__PURE__ */ import_react.default.createElement("span", {
63
- style: {
64
- whiteSpace: "nowrap",
65
- textOverflow: "ellipsis",
66
- overflow: "hidden"
67
- }
68
- }, pageDetails[index]));
69
- }
70
- return option;
71
- }), [pageCount, pageDetails, pageIndex, txtWidth]);
72
- const actionRef = (0, import_react.useRef)({});
73
- (0, import_react.useEffect)(() => {
74
- if (isOpened) {
75
- actionRef.current.setActiveDescendant((pageIndex + 1).toString());
76
- actionRef.current.scrollOptionIntoView((pageIndex + 1).toString());
77
- }
78
- }, [isOpened]);
79
- const onKeyDown = (0, import_usePaginationSearch.usePaginationSearch)(pageCount, actionRef);
80
- return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(import_styled.PaginationSeparator, null), /* @__PURE__ */ import_react.default.createElement(import_ds_dropdownmenu.DSDropdownMenuV2, {
81
- isOpened,
82
- options,
83
- selectedOptions: { [(pageIndex + 1).toString()]: true },
84
- onOptionClick: (_, clickedOption) => {
85
- onPageChange(clickedOption.value);
86
- setIsOpened(false);
87
- btnRef.current.focus();
88
- },
89
- onClickOutside: () => {
90
- setIsOpened(false);
91
- btnRef.current.focus();
92
- },
93
- customOffset: [0, 2],
94
- startPlacementPreference: "top-end",
95
- actionRef,
96
- onKeyDown,
97
- minWidth: btnWidth + 23,
98
- maxHeight: 300,
99
- HeaderComp: () => pageDetailsTitle !== "" ? /* @__PURE__ */ import_react.default.createElement(import_ds_grid.Grid, {
100
- cols: [`${txtWidth + 50}px`, "8px", "auto"]
101
- }, /* @__PURE__ */ import_react.default.createElement("span", {
102
- style: { marginLeft: "8px" }
103
- }, "Page"), /* @__PURE__ */ import_react.default.createElement(import_styled.PaginationSeparator, {
104
- height: "100%"
105
- }), /* @__PURE__ */ import_react.default.createElement("span", null, pageDetailsTitle)) : "Page"
106
- }, /* @__PURE__ */ import_react.default.createElement(import_styled.PaginationDropdownButton, {
107
- buttonType: "raw",
108
- onClick: () => setIsOpened(true),
109
- innerRef: btnRef
110
- }, /* @__PURE__ */ import_react.default.createElement("div", {
111
- style: { display: "flex", gridGap: "8px", alignItems: "center" }
112
- }, /* @__PURE__ */ import_react.default.createElement(import_ds_grid.Grid, {
113
- cols: ["auto", "auto", "auto"],
114
- alignItems: "center",
115
- gutter: "xxxs",
116
- ref: pageInfoRef
117
- }, /* @__PURE__ */ import_react.default.createElement(import_styled.PaginationBoldText, {
118
- fontSize: "18px"
119
- }, pageIndex + 1), " / ", pageCount), pageDetails.length !== 0 && /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(import_styled.PaginationSeparator, {
120
- height: "12px",
121
- ml: "8px"
122
- }), /* @__PURE__ */ import_react.default.createElement(import_styled.PaginationBoldText, {
123
- fontSize: "13px",
124
- mr: "8px"
125
- }, pageDetails[pageIndex])), /* @__PURE__ */ import_react.default.createElement(import_ds_icons.ChevronDown, {
126
- color: ["brand-primary", "700"]
127
- })))), /* @__PURE__ */ import_react.default.createElement(import_styled.PaginationSeparator, null));
128
- };
129
- var Paginator_default = Paginator;
130
- module.exports = __toCommonJS(Paginator_exports);
131
- //# sourceMappingURL=Paginator.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/parts/Paginator.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["/* eslint-disable react/prop-types */\nimport React, { useEffect, useMemo, useRef, useState } from 'react';\nimport { Checkmark, ChevronDown } from '@elliemae/ds-icons';\nimport { useOnElementResize } from '@elliemae/ds-utilities';\nimport { Grid } from '@elliemae/ds-grid';\nimport { DSDropdownMenuV2 } from '@elliemae/ds-dropdownmenu';\nimport { PaginationBoldText, PaginationDropdownButton, PaginationSeparator } from '../styled';\nimport { usePaginationSearch } from '../hooks/usePaginationSearch';\nimport { DSPaginationProps } from '../index.d';\n\nconst Paginator: React.ComponentType<DSPaginationProps> = (props) => {\n const { pageIndex, pageCount, onPageChange, pageDetails, pageDetailsTitle } = props;\n\n const [isOpened, setIsOpened] = useState(false);\n\n const btnRef = useRef(null);\n const pageInfoRef = useRef(null);\n\n const { width: btnWidth } = useOnElementResize(btnRef);\n const { width: txtWidth } = useOnElementResize(pageInfoRef);\n\n const options = useMemo(\n () =>\n new Array(pageCount).fill(0).map((_, index) => {\n const option: Record<string, unknown> = {\n dsId: (index + 1).toString(),\n label: (index + 1).toString(),\n value: index + 1,\n type: 'single',\n };\n if (pageDetails.length) {\n option.render = () => (\n <Grid cols={['16px', `${txtWidth + 16}px`, 'auto']} gutter=\"xxs\" alignItems=\"center\">\n {pageIndex === index ? <Checkmark size=\"s\" color={['brand-primary', '600']} /> : <div />}\n <span>{index + 1}</span>\n <span\n style={{\n whiteSpace: 'nowrap',\n textOverflow: 'ellipsis',\n overflow: 'hidden',\n }}\n >\n {pageDetails[index]}\n </span>\n </Grid>\n );\n }\n return option;\n }),\n [pageCount, pageDetails, pageIndex, txtWidth],\n );\n\n const actionRef = useRef<Record<string, (dsId: string) => void>>({});\n\n useEffect(() => {\n if (isOpened) {\n actionRef.current.setActiveDescendant((pageIndex + 1).toString());\n actionRef.current.scrollOptionIntoView((pageIndex + 1).toString());\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isOpened]);\n\n const onKeyDown = usePaginationSearch(pageCount, actionRef);\n\n return (\n <>\n <PaginationSeparator />\n <DSDropdownMenuV2\n isOpened={isOpened}\n options={options}\n selectedOptions={{ [(pageIndex + 1).toString()]: true }}\n onOptionClick={(_, clickedOption) => {\n onPageChange(clickedOption.value);\n setIsOpened(false);\n btnRef.current.focus();\n }}\n onClickOutside={() => {\n setIsOpened(false);\n btnRef.current.focus();\n }}\n customOffset={[0, 2]}\n startPlacementPreference=\"top-end\"\n actionRef={actionRef}\n onKeyDown={onKeyDown}\n minWidth={btnWidth + 23}\n maxHeight={300}\n HeaderComp={() =>\n pageDetailsTitle !== '' ? (\n <Grid cols={[`${txtWidth + 50}px`, '8px', 'auto']}>\n <span style={{ marginLeft: '8px' }}>Page</span>\n <PaginationSeparator height=\"100%\" />\n <span>{pageDetailsTitle}</span>\n </Grid>\n ) : (\n 'Page'\n )\n }\n >\n <PaginationDropdownButton buttonType=\"raw\" onClick={() => setIsOpened(true)} innerRef={btnRef}>\n <div style={{ display: 'flex', gridGap: '8px', alignItems: 'center' }}>\n <Grid cols={['auto', 'auto', 'auto']} alignItems=\"center\" gutter=\"xxxs\" ref={pageInfoRef}>\n <PaginationBoldText fontSize=\"18px\">{pageIndex + 1}</PaginationBoldText> / {pageCount}\n </Grid>\n {pageDetails.length !== 0 && (\n <>\n <PaginationSeparator height=\"12px\" ml=\"8px\" />\n <PaginationBoldText fontSize=\"13px\" mr=\"8px\">\n {pageDetails[pageIndex]}\n </PaginationBoldText>\n </>\n )}\n <ChevronDown color={['brand-primary', '700']} />\n </div>\n </PaginationDropdownButton>\n </DSDropdownMenuV2>\n <PaginationSeparator />\n </>\n );\n};\n\nexport default Paginator;\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,mBAA4D;AAC5D,sBAAuC;AACvC,0BAAmC;AACnC,qBAAqB;AACrB,6BAAiC;AACjC,oBAAkF;AAClF,iCAAoC;AAGpC,MAAM,YAAoD,CAAC,UAAU;AACnE,QAAM,EAAE,WAAW,WAAW,cAAc,aAAa,qBAAqB;AAE9E,QAAM,CAAC,UAAU,eAAe,2BAAS;AAEzC,QAAM,SAAS,yBAAO;AACtB,QAAM,cAAc,yBAAO;AAE3B,QAAM,EAAE,OAAO,aAAa,4CAAmB;AAC/C,QAAM,EAAE,OAAO,aAAa,4CAAmB;AAE/C,QAAM,UAAU,0BACd,MACE,IAAI,MAAM,WAAW,KAAK,GAAG,IAAI,CAAC,GAAG,UAAU;AAC7C,UAAM,SAAkC;AAAA,MACtC,MAAO,SAAQ,GAAG;AAAA,MAClB,OAAQ,SAAQ,GAAG;AAAA,MACnB,OAAO,QAAQ;AAAA,MACf,MAAM;AAAA;AAER,QAAI,YAAY,QAAQ;AACtB,aAAO,SAAS,MACd,mDAAC,qBAAD;AAAA,QAAM,MAAM,CAAC,QAAQ,GAAG,WAAW,QAAQ;AAAA,QAAS,QAAO;AAAA,QAAM,YAAW;AAAA,SACzE,cAAc,QAAQ,mDAAC,2BAAD;AAAA,QAAW,MAAK;AAAA,QAAI,OAAO,CAAC,iBAAiB;AAAA,WAAa,mDAAC,OAAD,OACjF,mDAAC,QAAD,MAAO,QAAQ,IACf,mDA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QAAQ,QAAQ;AAAA,IAAS,YAAW;AAAA,IAAS,QAAO;AAAA,IAAO,KAAK;AAAA,KAC3E,mDAAC,kCAAD;AAAA,IAAoB,UAAS;AAAA,KAAQ,YAAY,IAAuB,OAAI,YAE7E,YAAY,WAAW,KACtB,wFACE,mDAAC,mCAAD;AAAA,IAAqB,QAAO;AAAA,IAAO,IAAG;AAAA,MACtC,mDAAC,kCAAD;AAAA,IAAoB,UAAS;AAAA,IAAO,IAAG;AAAA,KACpC,YAAY,cAInB,mDAAC,6BAAD;AAAA,IAAa,OAAO,CAAC,iBAAiB;AAAA,SAI5C,mDAAC,mCAAD;AAAA;AAKN,IAAO,oBAAQ;",
6
- "names": []
7
- }
@@ -1,103 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __reExport = (target, module2, copyDefault, desc) => {
13
- if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
- for (let key of __getOwnPropNames(module2))
15
- if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
16
- __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
17
- }
18
- return target;
19
- };
20
- var __toESM = (module2, isNodeMode) => {
21
- return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
22
- };
23
- var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
- return (module2, temp) => {
25
- return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
26
- };
27
- })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
28
- var PerPageSelector_exports = {};
29
- __export(PerPageSelector_exports, {
30
- default: () => PerPageSelector_default
31
- });
32
- var React = __toESM(require("react"));
33
- var import_react = __toESM(require("react"));
34
- var import_memoize_one = __toESM(require("memoize-one"));
35
- var import_ds_utilities = require("@elliemae/ds-utilities");
36
- var import_ds_dropdownmenu = require("@elliemae/ds-dropdownmenu");
37
- var import_ds_icons = require("@elliemae/ds-icons");
38
- var import_styled = require("../styled");
39
- const generateOption = (value) => {
40
- if (typeof value === "object") {
41
- return value;
42
- }
43
- return {
44
- dsId: value.toString(),
45
- value,
46
- label: value.toString(),
47
- type: "single"
48
- };
49
- };
50
- const getOptions = (0, import_memoize_one.default)((step, min, max) => {
51
- const options = (0, import_ds_utilities.range)(min, max + step, step).map(generateOption);
52
- return min === 0 ? options.slice(1, options.length) : options;
53
- });
54
- const PerPageSelector = (props) => {
55
- const [isOpened, setIsOpened] = (0, import_react.useState)(false);
56
- const { pageSize, onPageSizeChange, perPageOptions, maxPerPage, perPageStep, minPerPage } = props;
57
- const options = (0, import_react.useMemo)(() => {
58
- if (perPageOptions)
59
- return perPageOptions.map(generateOption);
60
- return getOptions(perPageStep, minPerPage, maxPerPage);
61
- }, [maxPerPage, minPerPage, perPageOptions, perPageStep]);
62
- const actionRef = (0, import_react.useRef)({});
63
- const btnRef = (0, import_react.useRef)(null);
64
- (0, import_react.useEffect)(() => {
65
- if (isOpened) {
66
- actionRef.current.setActiveDescendant(pageSize.toString());
67
- actionRef.current.scrollOptionIntoView(pageSize.toString());
68
- }
69
- }, [isOpened]);
70
- const { width } = (0, import_ds_utilities.useOnElementResize)(btnRef);
71
- return /* @__PURE__ */ import_react.default.createElement(import_ds_dropdownmenu.DSDropdownMenuV2, {
72
- isOpened,
73
- options,
74
- selectedOptions: { [pageSize.toString()]: true },
75
- onOptionClick: (_, clickedOption) => {
76
- onPageSizeChange(clickedOption.value);
77
- setIsOpened(false);
78
- btnRef.current.focus();
79
- },
80
- onClickOutside: () => {
81
- setIsOpened(false);
82
- btnRef.current.focus();
83
- },
84
- customOffset: [0, 2],
85
- startPlacementPreference: "top-end",
86
- actionRef,
87
- minWidth: width + 25,
88
- maxHeight: 300,
89
- HeaderComp: () => "Per Page"
90
- }, /* @__PURE__ */ import_react.default.createElement("div", {
91
- style: { marginLeft: "32px" }
92
- }, /* @__PURE__ */ import_react.default.createElement(import_styled.PaginationDropdownButton, {
93
- buttonType: "raw",
94
- onClick: () => setIsOpened(true),
95
- "aria-pressed": isOpened,
96
- innerRef: btnRef
97
- }, pageSize, " / page", /* @__PURE__ */ import_react.default.createElement(import_ds_icons.ChevronDown, {
98
- color: ["brand-primary", "700"]
99
- }))));
100
- };
101
- var PerPageSelector_default = PerPageSelector;
102
- module.exports = __toCommonJS(PerPageSelector_exports);
103
- //# sourceMappingURL=PerPageSelector.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/parts/PerPageSelector.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["/* eslint-disable react/prop-types */\nimport React, { useEffect, useMemo, useRef, useState } from 'react';\nimport memoize from 'memoize-one';\nimport { range, useOnElementResize } from '@elliemae/ds-utilities';\nimport { DSDropdownMenuV2 } from '@elliemae/ds-dropdownmenu';\nimport { ChevronDown } from '@elliemae/ds-icons';\nimport { DSPaginationProps } from '../index.d';\nimport { PaginationDropdownButton } from '../styled';\n\nconst generateOption = (value) => {\n if (typeof value === 'object') {\n return value;\n }\n return {\n dsId: value.toString(),\n value,\n label: value.toString(),\n type: 'single',\n };\n};\n\nconst getOptions = memoize((step, min, max) => {\n const options = range(min, max + step, step).map(generateOption);\n return min === 0 ? options.slice(1, options.length) : options;\n});\n\nconst PerPageSelector: React.ComponentType<\n Pick<\n DSPaginationProps,\n 'pageSize' | 'onPageSizeChange' | 'perPageOptions' | 'perPageStep' | 'minPerPage' | 'maxPerPage'\n >\n> = (props) => {\n const [isOpened, setIsOpened] = useState(false);\n const { pageSize, onPageSizeChange, perPageOptions, maxPerPage, perPageStep, minPerPage } = props;\n\n const options = useMemo(() => {\n if (perPageOptions) return perPageOptions.map(generateOption);\n return getOptions(perPageStep, minPerPage, maxPerPage);\n }, [maxPerPage, minPerPage, perPageOptions, perPageStep]);\n\n const actionRef = useRef<Record<string, (dsId: string) => void>>({});\n const btnRef = useRef<HTMLButtonElement>(null);\n\n useEffect(() => {\n if (isOpened) {\n actionRef.current.setActiveDescendant(pageSize.toString());\n actionRef.current.scrollOptionIntoView(pageSize.toString());\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isOpened]);\n\n const { width } = useOnElementResize(btnRef);\n\n return (\n <DSDropdownMenuV2\n isOpened={isOpened}\n options={options}\n selectedOptions={{ [pageSize.toString()]: true }}\n onOptionClick={(_, clickedOption) => {\n onPageSizeChange(clickedOption.value);\n setIsOpened(false);\n btnRef.current.focus();\n }}\n onClickOutside={() => {\n setIsOpened(false);\n btnRef.current.focus();\n }}\n customOffset={[0, 2]}\n startPlacementPreference=\"top-end\"\n actionRef={actionRef}\n minWidth={width + 25}\n maxHeight={300}\n HeaderComp={() => 'Per Page'}\n >\n <div style={{ marginLeft: '32px' }}>\n <PaginationDropdownButton\n buttonType=\"raw\"\n onClick={() => setIsOpened(true)}\n aria-pressed={isOpened}\n innerRef={btnRef}\n >\n {pageSize} / page\n <ChevronDown color={['brand-primary', '700']} />\n </PaginationDropdownButton>\n </div>\n </DSDropdownMenuV2>\n );\n};\n\nexport default PerPageSelector;\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,mBAA4D;AAC5D,yBAAoB;AACpB,0BAA0C;AAC1C,6BAAiC;AACjC,sBAA4B;AAE5B,oBAAyC;AAEzC,MAAM,iB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;AAAA,IAAK,OAAO,EAAE,YAAY;AAAA,KACxB,mDAAC,wCAAD;AAAA,IACE,YAAW;AAAA,IACX,SAAS,MAAM,YAAY;AAAA,IAC3B,gBAAc;AAAA,IACd,UAAU;AAAA,KAET,UAAS,WACV,mDAAC,6BAAD;AAAA,IAAa,OAAO,CAAC,iBAAiB;AAAA;AAAA;AAOhD,IAAO,0BAAQ;",
6
- "names": []
7
- }
package/dist/cjs/props.js DELETED
@@ -1,82 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __reExport = (target, module2, copyDefault, desc) => {
13
- if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
- for (let key of __getOwnPropNames(module2))
15
- if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
16
- __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
17
- }
18
- return target;
19
- };
20
- var __toESM = (module2, isNodeMode) => {
21
- return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
22
- };
23
- var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
- return (module2, temp) => {
25
- return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
26
- };
27
- })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
28
- var props_exports = {};
29
- __export(props_exports, {
30
- defaultProps: () => defaultProps,
31
- propTypes: () => propTypes
32
- });
33
- var React = __toESM(require("react"));
34
- var import_react_desc = require("react-desc");
35
- const emptyFunc = () => null;
36
- const propTypes = {
37
- pageCount: import_react_desc.PropTypes.number.description("How many pages are there"),
38
- pageIndex: import_react_desc.PropTypes.number.description("Index of the current page, starting from 1").defaultValue(1),
39
- canPreviousPage: import_react_desc.PropTypes.bool.description("Whether the previous button is disabled or not").defaultValue(true),
40
- canNextPage: import_react_desc.PropTypes.bool.description("Whether the next button is disabled or not").defaultValue(true),
41
- pageSize: import_react_desc.PropTypes.number.description("The current page size").defaultValue(10),
42
- showPerPageSelector: import_react_desc.PropTypes.bool.description("Whether to show the page selector").defaultValue(true),
43
- perPageOptions: import_react_desc.PropTypes.arrayOf(import_react_desc.PropTypes.oneOfType([
44
- import_react_desc.PropTypes.number,
45
- import_react_desc.PropTypes.shape({
46
- dsId: import_react_desc.PropTypes.string,
47
- value: import_react_desc.PropTypes.number,
48
- label: import_react_desc.PropTypes.string,
49
- type: import_react_desc.PropTypes.oneOf(["single"])
50
- })
51
- ])).description("The available options for page size").defaultValue([10]),
52
- perPageStep: import_react_desc.PropTypes.number.description("Step for the per page options").defaultValue(5),
53
- minPerPage: import_react_desc.PropTypes.number.description("Step for the per page options").defaultValue(0),
54
- maxPerPage: import_react_desc.PropTypes.number.description("Step for the per page options").defaultValue(100),
55
- onPageSizeChange: import_react_desc.PropTypes.func.description("Function invoked when the page size changes").defaultValue(() => null),
56
- onPreviousPage: import_react_desc.PropTypes.func.description("Function invoked when the previous button is pressed").defaultValue(() => null),
57
- onPageChange: import_react_desc.PropTypes.func.description("Function invoked when the page changes").defaultValue(() => null),
58
- onNextPage: import_react_desc.PropTypes.func.description("Function invoked when next button is pressed").defaultValue(() => null),
59
- pageDetails: import_react_desc.PropTypes.arrayOf(import_react_desc.PropTypes.string).description("Details to provide for each page").defaultValue([]),
60
- pageDetailsTitle: import_react_desc.PropTypes.string.description("The title of the details (usually a column of your dataset)").defaultValue(""),
61
- width: import_react_desc.PropTypes.any.description("Width for the container of the pagination").defaultValue("100%")
62
- };
63
- const defaultProps = {
64
- pageIndex: 1,
65
- canPreviousPage: true,
66
- canNextPage: true,
67
- pageSize: 10,
68
- showPerPageSelector: true,
69
- perPageOptions: [10],
70
- perPageStep: 5,
71
- minPerPage: 0,
72
- maxPerPage: 100,
73
- onPageSizeChange: emptyFunc,
74
- onPreviousPage: emptyFunc,
75
- onNextPage: emptyFunc,
76
- onPageChange: emptyFunc,
77
- pageDetails: [],
78
- pageDetailsTitle: "",
79
- width: "100%"
80
- };
81
- module.exports = __toCommonJS(props_exports);
82
- //# sourceMappingURL=props.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/props.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import { PropTypes } from 'react-desc';\n\nconst emptyFunc = (): void => null;\n\nexport const propTypes = {\n pageCount: PropTypes.number.description('How many pages are there'),\n pageIndex: PropTypes.number.description('Index of the current page, starting from 1').defaultValue(1),\n canPreviousPage: PropTypes.bool.description('Whether the previous button is disabled or not').defaultValue(true),\n canNextPage: PropTypes.bool.description('Whether the next button is disabled or not').defaultValue(true),\n pageSize: PropTypes.number.description('The current page size').defaultValue(10),\n showPerPageSelector: PropTypes.bool.description('Whether to show the page selector').defaultValue(true),\n perPageOptions: PropTypes.arrayOf(\n PropTypes.oneOfType([\n PropTypes.number,\n PropTypes.shape({\n dsId: PropTypes.string,\n value: PropTypes.number,\n label: PropTypes.string,\n type: PropTypes.oneOf(['single']),\n }),\n ]),\n )\n .description('The available options for page size')\n .defaultValue([10]),\n perPageStep: PropTypes.number.description('Step for the per page options').defaultValue(5),\n minPerPage: PropTypes.number.description('Step for the per page options').defaultValue(0),\n maxPerPage: PropTypes.number.description('Step for the per page options').defaultValue(100),\n onPageSizeChange: PropTypes.func.description('Function invoked when the page size changes').defaultValue(() => null),\n onPreviousPage: PropTypes.func\n .description('Function invoked when the previous button is pressed')\n .defaultValue(() => null),\n onPageChange: PropTypes.func.description('Function invoked when the page changes').defaultValue(() => null),\n onNextPage: PropTypes.func.description('Function invoked when next button is pressed').defaultValue(() => null),\n pageDetails: PropTypes.arrayOf(PropTypes.string).description('Details to provide for each page').defaultValue([]),\n pageDetailsTitle: PropTypes.string\n .description('The title of the details (usually a column of your dataset)')\n .defaultValue(''),\n width: PropTypes.any.description('Width for the container of the pagination').defaultValue('100%'),\n};\n\nexport const defaultProps = {\n pageIndex: 1,\n canPreviousPage: true,\n canNextPage: true,\n pageSize: 10,\n showPerPageSelector: true,\n perPageOptions: [10],\n perPageStep: 5,\n minPerPage: 0,\n maxPerPage: 100,\n onPageSizeChange: emptyFunc,\n onPreviousPage: emptyFunc,\n onNextPage: emptyFunc,\n onPageChange: emptyFunc,\n pageDetails: [],\n pageDetailsTitle: '',\n width: '100%',\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,wBAA0B;AAE1B,MAAM,YAAY,MAAY;AAEvB,MAAM,YAAY;AAAA,EACvB,WAAW,4BAAU,OAAO,YAAY;AAAA,EACxC,WAAW,4BAAU,OAAO,YAAY,8CAA8C,aAAa;AAAA,EACnG,iBAAiB,4BAAU,KAAK,YAAY,kDAAkD,aAAa;AAAA,EAC3G,aAAa,4BAAU,KAAK,YAAY,8CAA8C,aAAa;AAAA,EACnG,UAAU,4BAAU,OAAO,YAAY,yBAAyB,aAAa;AAAA,EAC7E,qBAAqB,4BAAU,KAAK,YAAY,qCAAqC,aAAa;AAAA,EAClG,gBAAgB,4BAAU,QACxB,4BAAU,UAAU;AAAA,IAClB,4BAAU;AAAA,IACV,4BAAU,MAAM;AAAA,MACd,MAAM,4BAAU;AAAA,MAChB,OAAO,4BAAU;AAAA,MACjB,OAAO,4BAAU;AAAA,MACjB,MAAM,4BAAU,MAAM,CAAC;AAAA;AAAA,MAI1B,YAAY,uCACZ,aAAa,CAAC;AAAA,EACjB,aAAa,4BAAU,OAAO,YAAY,iCAAiC,aAAa;AAAA,EACxF,YAAY,4BAAU,OAAO,YAAY,iCAAiC,aAAa;AAAA,EACvF,YAAY,4BAAU,OAAO,YAAY,iCAAiC,aAAa;AAAA,EACvF,kBAAkB,4BAAU,KAAK,YAAY,+CAA+C,aAAa,MAAM;AAAA,EAC/G,gBAAgB,4BAAU,KACvB,YAAY,wDACZ,aAAa,MAAM;AAAA,EACtB,cAAc,4BAAU,KAAK,YAAY,0CAA0C,aAAa,MAAM;AAAA,EACtG,YAAY,4BAAU,KAAK,YAAY,gDAAgD,aAAa,MAAM;AAAA,EAC1G,aAAa,4BAAU,QAAQ,4BAAU,QAAQ,YAAY,oCAAoC,aAAa;AAAA,EAC9G,kBAAkB,4BAAU,OACzB,YAAY,+DACZ,aAAa;AAAA,EAChB,OAAO,4BAAU,IAAI,YAAY,6CAA6C,aAAa;AAAA;AAGtF,MAAM,eAAe;AAAA,EAC1B,WAAW;AAAA,EACX,iBAAiB;AAAA,EACjB,aAAa;AAAA,EACb,UAAU;AAAA,EACV,qBAAqB;AAAA,EACrB,gBAAgB,CAAC;AAAA,EACjB,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,kBAAkB;AAAA,EAClB,gBAAgB;AAAA,EAChB,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,aAAa;AAAA,EACb,kBAAkB;AAAA,EAClB,OAAO;AAAA;",
6
- "names": []
7
- }
@@ -1,113 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __reExport = (target, module2, copyDefault, desc) => {
13
- if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
- for (let key of __getOwnPropNames(module2))
15
- if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
16
- __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
17
- }
18
- return target;
19
- };
20
- var __toESM = (module2, isNodeMode) => {
21
- return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
22
- };
23
- var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
- return (module2, temp) => {
25
- return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
26
- };
27
- })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
28
- var styled_exports = {};
29
- __export(styled_exports, {
30
- PaginationBoldText: () => PaginationBoldText,
31
- PaginationContainer: () => PaginationContainer,
32
- PaginationDropdownButton: () => PaginationDropdownButton,
33
- PaginationSeparator: () => PaginationSeparator,
34
- PaginationWrapper: () => PaginationWrapper,
35
- PreviousNextPageButton: () => PreviousNextPageButton
36
- });
37
- var React = __toESM(require("react"));
38
- var import_ds_grid = require("@elliemae/ds-grid");
39
- var import_ds_button = require("@elliemae/ds-button");
40
- var import_styled_components = __toESM(require("styled-components"));
41
- var import_styled_components2 = require("@xstyled/styled-components");
42
- const sizeToCss = (size) => typeof size === "number" && !Number.isNaN(size) ? `${size}px` : size;
43
- const styledFocusCss = ({ theme }) => `
44
- &:after {
45
- display: block;
46
- content: ' ';
47
- position: absolute;
48
- top: 0;
49
- left: 0;
50
- right: 0;
51
- bottom: 0;
52
- border: 2px solid ${theme.colors.brand[700]};
53
- pointer-events: none;
54
- z-index: 7;
55
- }`;
56
- const PaginationContainer = (0, import_styled_components.default)(import_ds_grid.Grid)`
57
- padding: 0 ${(props) => props.theme.space.xs};
58
- height: 42px;
59
- width: ${(props) => sizeToCss(props.width) || "100%"};
60
- max-width: 100%;
61
- align-items: center;
62
- box-shadow: 0 -1px 3px 0 rgba(0, 0, 0, 0.5);
63
- `;
64
- const PaginationWrapper = import_styled_components.default.div`
65
- display: flex;
66
- justify-content: center;
67
- align-items: center;
68
- margin: 0 32px;
69
- `;
70
- const PaginationSeparator = (0, import_styled_components.default)(import_ds_grid.Grid)`
71
- background-color: ${(props) => props.theme.colors.neutral[300]};
72
- width: 1px;
73
- height: ${(props) => props.height || "30px"};
74
- `;
75
- const PaginationBoldText = import_styled_components.default.span`
76
- font-weight: ${(props) => props.theme.fontWeights.semibold};
77
- ${import_styled_components2.typography}
78
- ${import_styled_components2.space}
79
- position: relative;
80
- `;
81
- const PaginationDropdownButton = (0, import_styled_components.default)(import_ds_button.DSButtonV2)`
82
- height: 42px;
83
- display: flex;
84
- justify-content: center;
85
- align-items: center;
86
- position: relative;
87
- padding-left: 16px;
88
- padding-right: 16px;
89
- grid-gap: 8px;
90
- font-size: 13px;
91
- color: ${(props) => props.theme.colors.neutral[700]};
92
- cursor: pointer;
93
- border-radius: 0;
94
- font-weight: ${(props) => props.theme.fontWeights.regular};
95
- :focus {
96
- ${styledFocusCss}
97
- }
98
- `;
99
- const PreviousNextPageButton = (0, import_styled_components.default)(import_ds_button.DSButtonV2)`
100
- height: 42px;
101
- display: grid;
102
- place-items: center;
103
- position: relative;
104
- padding-left: 8px;
105
- padding-right: 8px;
106
- border-radius: 0;
107
- cursor: ${(props) => props.disabled ? "not-allowed" : "pointer"};
108
- :focus {
109
- ${styledFocusCss}
110
- }
111
- `;
112
- module.exports = __toCommonJS(styled_exports);
113
- //# sourceMappingURL=styled.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/styled.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import { Grid } from '@elliemae/ds-grid';\nimport { DSButtonV2 } from '@elliemae/ds-button';\nimport styled from 'styled-components';\nimport { space, typography, TypographyProps } from '@xstyled/styled-components';\n\nconst sizeToCss = (size) => (typeof size === 'number' && !Number.isNaN(size) ? `${size}px` : size);\n\nconst styledFocusCss = ({ theme }) => `\n&:after {\n display: block;\n content: ' ';\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n border: 2px solid ${theme.colors.brand[700]};\n pointer-events: none;\n z-index: 7;\n}`;\n\nexport const PaginationContainer = styled(Grid)`\n padding: 0 ${(props) => props.theme.space.xs};\n height: 42px;\n width: ${(props) => sizeToCss(props.width) || '100%'};\n max-width: 100%;\n align-items: center;\n box-shadow: 0 -1px 3px 0 rgba(0, 0, 0, 0.5);\n`;\n\nexport const PaginationWrapper = styled.div`\n display: flex;\n justify-content: center;\n align-items: center;\n margin: 0 32px;\n`;\n\nexport const PaginationSeparator = styled(Grid)`\n background-color: ${(props) => props.theme.colors.neutral[300]};\n width: 1px;\n height: ${(props) => props.height || '30px'};\n`;\n\nexport const PaginationBoldText = styled.span<TypographyProps>`\n font-weight: ${(props) => props.theme.fontWeights.semibold};\n ${typography}\n ${space}\n position: relative;\n`;\n\nexport const PaginationDropdownButton = styled(DSButtonV2)`\n height: 42px;\n display: flex;\n justify-content: center;\n align-items: center;\n position: relative;\n padding-left: 16px;\n padding-right: 16px;\n grid-gap: 8px;\n font-size: 13px;\n color: ${(props) => props.theme.colors.neutral[700]};\n cursor: pointer;\n border-radius: 0;\n font-weight: ${(props) => props.theme.fontWeights.regular};\n :focus {\n ${styledFocusCss}\n }\n`;\n\nexport const PreviousNextPageButton = styled(DSButtonV2)`\n height: 42px;\n display: grid;\n place-items: center;\n position: relative;\n padding-left: 8px;\n padding-right: 8px;\n border-radius: 0;\n cursor: ${(props) => (props.disabled ? 'not-allowed' : 'pointer')};\n :focus {\n ${styledFocusCss}\n }\n`;\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;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
3
- import { useMemoMergePropsWithDefault, useValidateTypescriptPropTypes } from "@elliemae/ds-props-helpers";
4
- import { describe } from "react-desc";
5
- import { PaginationContent } from "./parts/PaginationContent";
6
- import { propTypes, defaultProps } from "./props";
7
- const DSPagination = (props) => {
8
- const propsWithDefault = useMemoMergePropsWithDefault(props, defaultProps);
9
- useValidateTypescriptPropTypes(propsWithDefault, propTypes);
10
- return /* @__PURE__ */ React2.createElement(PaginationContent, {
11
- ...propsWithDefault
12
- });
13
- };
14
- DSPagination.propTypes = propTypes;
15
- const DSPaginationWithSchema = describe(DSPagination).description("DSPagination");
16
- DSPaginationWithSchema.propTypes = propTypes;
17
- export {
18
- DSPagination,
19
- DSPaginationWithSchema
20
- };
21
- //# sourceMappingURL=Pagination.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/Pagination.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { useMemoMergePropsWithDefault, useValidateTypescriptPropTypes } from '@elliemae/ds-props-helpers';\nimport { describe } from 'react-desc';\nimport { PaginationContent } from './parts/PaginationContent';\nimport { propTypes, defaultProps } from './props';\nimport { DSPaginationProps } from './index.d';\n\nconst DSPagination: React.ComponentType<DSPaginationProps> = (props) => {\n const propsWithDefault = useMemoMergePropsWithDefault(props, defaultProps);\n useValidateTypescriptPropTypes(propsWithDefault, propTypes);\n\n return <PaginationContent {...propsWithDefault} />;\n};\n\nDSPagination.propTypes = propTypes;\nconst DSPaginationWithSchema = describe(DSPagination).description('DSPagination');\nDSPaginationWithSchema.propTypes = propTypes;\n\nexport { DSPagination, DSPaginationWithSchema };\n"],
5
- "mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AAGA,MAAM,eAAuD,CAAC,UAAU;AACtE,QAAM,mBAAmB,6BAA6B,OAAO;AAC7D,iCAA+B,kBAAkB;AAEjD,SAAO,qCAAC,mBAAD;AAAA,OAAuB;AAAA;AAAA;AAGhC,aAAa,YAAY;AACzB,MAAM,yBAAyB,SAAS,cAAc,YAAY;AAClE,uBAAuB,YAAY;",
6
- "names": []
7
- }
@@ -1,10 +0,0 @@
1
- import * as React from "react";
2
- const PAGINATION_DATA_TESTID = {
3
- PREVIOUS_BUTTON: "data-table-pagination-prev-button",
4
- NEXT_BUTTON: "data-table-pagination-next-button",
5
- CONTAINER: "data-table-pagination-container"
6
- };
7
- export {
8
- PAGINATION_DATA_TESTID
9
- };
10
- //# sourceMappingURL=PaginationDataTestID.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/PaginationDataTestID.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const PAGINATION_DATA_TESTID = {\n PREVIOUS_BUTTON: 'data-table-pagination-prev-button',\n NEXT_BUTTON: 'data-table-pagination-next-button',\n CONTAINER: 'data-table-pagination-container',\n};\n"],
5
- "mappings": "AAAA;ACAO,MAAM,yBAAyB;AAAA,EACpC,iBAAiB;AAAA,EACjB,aAAa;AAAA,EACb,WAAW;AAAA;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/hooks/usePaginationSearch.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useCallback, useEffect, useRef, useState } from 'react';\n\nexport const usePaginationSearch = (\n pageCount: number,\n actionRef: React.MutableRefObject<any>,\n): React.KeyboardEventHandler => {\n const [searchValue, setSearchValue] = useState('');\n const [shouldResetSearchValue, setShouldResetSearchValue] = useState(true);\n\n const timeoutRef = useRef<NodeJS.Timeout>(null);\n\n useEffect(() => {\n if (searchValue !== '' && Number.parseInt(searchValue, 10) <= pageCount) {\n actionRef.current.setActiveDescendant(searchValue);\n actionRef.current.scrollOptionIntoView(searchValue);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [searchValue]);\n\n const onKeyDown = useCallback(\n (e) => {\n if (e.code.startsWith('Digit')) {\n if (shouldResetSearchValue) setSearchValue(e.key);\n else setSearchValue((prevValue) => prevValue + e.key);\n\n setShouldResetSearchValue(false);\n clearTimeout(timeoutRef.current);\n timeoutRef.current = setTimeout(() => {\n setShouldResetSearchValue(true);\n }, 1000);\n }\n },\n [shouldResetSearchValue],\n );\n\n return onKeyDown;\n};\n"],
5
- "mappings": "AAAA;ACAA;AAEO,MAAM,sBAAsB,CACjC,WACA,cAC+B;AAC/B,QAAM,CAAC,aAAa,kBAAkB,SAAS;AAC/C,QAAM,CAAC,wBAAwB,6BAA6B,SAAS;AAErE,QAAM,aAAa,OAAuB;AAE1C,YAAU,MAAM;AACd,QAAI,gBAAgB,MAAM,OAAO,SAAS,aAAa,OAAO,WAAW;AACvE,gBAAU,QAAQ,oBAAoB;AACtC,gBAAU,QAAQ,qBAAqB;AAAA;AAAA,KAGxC,CAAC;AAEJ,QAAM,YAAY,YAChB,CAAC,MAAM;AACL,QAAI,EAAE,KAAK,WAAW,UAAU;AAC9B,UAAI;AAAwB,uBAAe,EAAE;AAAA;AACxC,uBAAe,CAAC,cAAc,YAAY,EAAE;AAEjD,gCAA0B;AAC1B,mBAAa,WAAW;AACxB,iBAAW,UAAU,WAAW,MAAM;AACpC,kCAA0B;AAAA,SACzB;AAAA;AAAA,KAGP,CAAC;AAGH,SAAO;AAAA;",
6
- "names": []
7
- }
@@ -1,2 +0,0 @@
1
- import * as React from "react";
2
- //# sourceMappingURL=index.d.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n"],
5
- "mappings": "AAAA;",
6
- "names": []
7
- }
package/dist/esm/index.js DELETED
@@ -1,3 +0,0 @@
1
- import * as React from "react";
2
- export * from "./Pagination";
3
- //# sourceMappingURL=index.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/index.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export * from './Pagination';\n"],
5
- "mappings": "AAAA;ACAA;",
6
- "names": []
7
- }
@@ -1,24 +0,0 @@
1
- import * as React from "react";
2
- import React2 from "react";
3
- import { ChevronRight } from "@elliemae/ds-icons";
4
- import { PAGINATION_DATA_TESTID } from "../PaginationDataTestID";
5
- import { PreviousNextPageButton } from "../styled";
6
- const PageNextButton = ({
7
- onNextPage,
8
- canNextPage
9
- }) => /* @__PURE__ */ React2.createElement(PreviousNextPageButton, {
10
- onClick: () => {
11
- if (canNextPage)
12
- onNextPage();
13
- },
14
- disabled: !canNextPage,
15
- buttonType: "raw",
16
- "data-testid": PAGINATION_DATA_TESTID.NEXT_BUTTON,
17
- HeaderComp: () => "Page"
18
- }, /* @__PURE__ */ React2.createElement(ChevronRight, {
19
- color: canNextPage ? ["brand-primary", "700"] : ["neutral", "500"]
20
- }));
21
- export {
22
- PageNextButton
23
- };
24
- //# sourceMappingURL=PageNextButton.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/parts/PageNextButton.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/prop-types */\nimport React from 'react';\nimport { ChevronRight } from '@elliemae/ds-icons';\nimport { PAGINATION_DATA_TESTID } from '../PaginationDataTestID';\nimport { PreviousNextPageButton } from '../styled';\nimport { DSPaginationProps } from '../index.d';\n\nexport const PageNextButton: React.ComponentType<Pick<DSPaginationProps, 'onNextPage' | 'canNextPage'>> = ({\n onNextPage,\n canNextPage,\n}) => (\n <PreviousNextPageButton\n onClick={() => {\n if (canNextPage) onNextPage();\n }}\n disabled={!canNextPage}\n buttonType=\"raw\"\n data-testid={PAGINATION_DATA_TESTID.NEXT_BUTTON}\n HeaderComp={() => 'Page'}\n >\n <ChevronRight color={canNextPage ? ['brand-primary', '700'] : ['neutral', '500']} />\n </PreviousNextPageButton>\n);\n"],
5
- "mappings": "AAAA;ACCA;AACA;AACA;AACA;AAGO,MAAM,iBAA6F,CAAC;AAAA,EACzG;AAAA,EACA;AAAA,MAEA,qCAAC,wBAAD;AAAA,EACE,SAAS,MAAM;AACb,QAAI;AAAa;AAAA;AAAA,EAEnB,UAAU,CAAC;AAAA,EACX,YAAW;AAAA,EACX,eAAa,uBAAuB;AAAA,EACpC,YAAY,MAAM;AAAA,GAElB,qCAAC,cAAD;AAAA,EAAc,OAAO,cAAc,CAAC,iBAAiB,SAAS,CAAC,WAAW;AAAA;",
6
- "names": []
7
- }