@elliemae/ds-pagination 3.80.0-next.51 → 3.80.0-next.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/parts/DSPaginator/DSPaginator.js +10 -166
- package/dist/cjs/parts/DSPaginator/DSPaginator.js.map +2 -2
- package/dist/cjs/parts/DSPaginator/{config/usePaginationSearch.js → DSPaginatorCTX.js} +7 -32
- package/dist/cjs/parts/DSPaginator/DSPaginatorCTX.js.map +7 -0
- package/dist/cjs/parts/DSPaginator/config/{createPaginatorHeader.js → getAmountOfPages.js} +8 -23
- package/dist/cjs/parts/DSPaginator/config/getAmountOfPages.js.map +7 -0
- package/dist/cjs/parts/DSPaginator/config/getInstanceIds.js +40 -0
- package/dist/cjs/parts/DSPaginator/config/getInstanceIds.js.map +7 -0
- package/dist/cjs/parts/DSPaginator/config/navigationKeys.js +44 -0
- package/dist/cjs/parts/DSPaginator/config/navigationKeys.js.map +7 -0
- package/dist/cjs/parts/DSPaginator/config/useFocusTracker.js +77 -0
- package/dist/cjs/parts/DSPaginator/config/useFocusTracker.js.map +7 -0
- package/dist/cjs/parts/DSPaginator/config/usePaginator.js +73 -49
- package/dist/cjs/parts/DSPaginator/config/usePaginator.js.map +2 -2
- package/dist/cjs/parts/DSPaginator/config/usePaginatorFloatingContext.js +86 -0
- package/dist/cjs/parts/DSPaginator/config/usePaginatorFloatingContext.js.map +7 -0
- package/dist/cjs/parts/DSPaginator/config/usePaginatorInteractions.js +170 -0
- package/dist/cjs/parts/DSPaginator/config/usePaginatorInteractions.js.map +7 -0
- package/dist/cjs/parts/DSPaginator/config/usePaginatorSizing.js +80 -0
- package/dist/cjs/parts/DSPaginator/config/usePaginatorSizing.js.map +7 -0
- package/dist/cjs/parts/DSPaginator/config/useValidateProps.js.map +2 -2
- package/dist/cjs/parts/DSPaginator/constants/index.js +49 -3
- package/dist/cjs/parts/DSPaginator/constants/index.js.map +2 -2
- package/dist/cjs/parts/DSPaginator/parts/OptionRenderer.js +98 -0
- package/dist/cjs/parts/DSPaginator/parts/OptionRenderer.js.map +7 -0
- package/dist/cjs/parts/DSPaginator/parts/Panel.js +131 -0
- package/dist/cjs/parts/DSPaginator/parts/Panel.js.map +7 -0
- package/dist/cjs/parts/DSPaginator/parts/Trigger.js +124 -0
- package/dist/cjs/parts/DSPaginator/parts/Trigger.js.map +7 -0
- package/dist/cjs/parts/DSPaginator/react-desc-prop-types.js +6 -1
- package/dist/cjs/parts/DSPaginator/react-desc-prop-types.js.map +2 -2
- package/dist/cjs/parts/DSPaginator/styled.js +113 -38
- package/dist/cjs/parts/DSPaginator/styled.js.map +3 -3
- package/dist/cjs/parts/DSPaginator/typescript-testing/slot-props.js +12 -1
- package/dist/cjs/parts/DSPaginator/typescript-testing/slot-props.js.map +2 -2
- package/dist/cjs/parts/DSPaginator/typescript-testing/typescript-testing.js +2 -1
- package/dist/cjs/parts/DSPaginator/typescript-testing/typescript-testing.js.map +2 -2
- package/dist/cjs/parts/DSPerPageSelector/DSPerPageSelector.js +10 -79
- package/dist/cjs/parts/DSPerPageSelector/DSPerPageSelector.js.map +3 -3
- package/dist/cjs/parts/DSPerPageSelector/DSPerPageSelectorCTX.js +38 -0
- package/dist/cjs/parts/DSPerPageSelector/DSPerPageSelectorCTX.js.map +7 -0
- package/dist/cjs/parts/DSPerPageSelector/config/getInstanceIds.js +40 -0
- package/dist/cjs/parts/DSPerPageSelector/config/getInstanceIds.js.map +7 -0
- package/dist/cjs/parts/DSPerPageSelector/config/getOptions.js.map +2 -2
- package/dist/cjs/parts/DSPerPageSelector/config/getSelectedOptionIndex.js +36 -0
- package/dist/cjs/parts/DSPerPageSelector/config/getSelectedOptionIndex.js.map +7 -0
- package/dist/cjs/parts/DSPerPageSelector/config/navigationKeys.js +44 -0
- package/dist/cjs/parts/DSPerPageSelector/config/navigationKeys.js.map +7 -0
- package/dist/cjs/parts/DSPerPageSelector/config/useFocusTracker.js +83 -0
- package/dist/cjs/parts/DSPerPageSelector/config/useFocusTracker.js.map +7 -0
- package/dist/cjs/parts/DSPerPageSelector/config/usePerPageSelector.js +68 -20
- package/dist/cjs/parts/DSPerPageSelector/config/usePerPageSelector.js.map +2 -2
- package/dist/cjs/parts/DSPerPageSelector/config/usePerPageSelectorFloatingContext.js +82 -0
- package/dist/cjs/parts/DSPerPageSelector/config/usePerPageSelectorFloatingContext.js.map +7 -0
- package/dist/cjs/parts/DSPerPageSelector/config/usePerPageSelectorInteractions.js +175 -0
- package/dist/cjs/parts/DSPerPageSelector/config/usePerPageSelectorInteractions.js.map +7 -0
- package/dist/cjs/parts/DSPerPageSelector/config/usePerPageSelectorSizing.js +66 -0
- package/dist/cjs/parts/DSPerPageSelector/config/usePerPageSelectorSizing.js.map +7 -0
- package/dist/cjs/parts/DSPerPageSelector/constants/index.js +47 -8
- package/dist/cjs/parts/DSPerPageSelector/constants/index.js.map +2 -2
- package/dist/cjs/parts/DSPerPageSelector/parts/OptionRenderer.js +94 -0
- package/dist/cjs/parts/DSPerPageSelector/parts/OptionRenderer.js.map +7 -0
- package/dist/cjs/parts/DSPerPageSelector/parts/Panel.js +120 -0
- package/dist/cjs/parts/DSPerPageSelector/parts/Panel.js.map +7 -0
- package/dist/cjs/parts/DSPerPageSelector/parts/Trigger.js +95 -0
- package/dist/cjs/parts/DSPerPageSelector/parts/Trigger.js.map +7 -0
- package/dist/cjs/parts/DSPerPageSelector/react-desc-prop-types.js +19 -2
- package/dist/cjs/parts/DSPerPageSelector/react-desc-prop-types.js.map +2 -2
- package/dist/cjs/parts/DSPerPageSelector/styled.js +104 -32
- package/dist/cjs/parts/DSPerPageSelector/styled.js.map +2 -2
- package/dist/cjs/parts/DSPerPageSelector/typescript-testing/slots-props.js +10 -1
- package/dist/cjs/parts/DSPerPageSelector/typescript-testing/slots-props.js.map +2 -2
- package/dist/cjs/parts/DSPerPageSelector/typescript-testing/typescript-testing.js +60 -1
- package/dist/cjs/parts/DSPerPageSelector/typescript-testing/typescript-testing.js.map +2 -2
- package/dist/cjs/react-desc-prop-types.js.map +1 -1
- package/dist/esm/parts/DSPaginator/DSPaginator.js +12 -168
- package/dist/esm/parts/DSPaginator/DSPaginator.js.map +2 -2
- package/dist/esm/parts/DSPaginator/DSPaginatorCTX.js +8 -0
- package/dist/esm/parts/DSPaginator/DSPaginatorCTX.js.map +7 -0
- package/dist/esm/parts/DSPaginator/config/getAmountOfPages.js +9 -0
- package/dist/esm/parts/DSPaginator/config/getAmountOfPages.js.map +7 -0
- package/dist/esm/parts/DSPaginator/config/getInstanceIds.js +10 -0
- package/dist/esm/parts/DSPaginator/config/getInstanceIds.js.map +7 -0
- package/dist/esm/parts/DSPaginator/config/navigationKeys.js +14 -0
- package/dist/esm/parts/DSPaginator/config/navigationKeys.js.map +7 -0
- package/dist/esm/parts/DSPaginator/config/useFocusTracker.js +47 -0
- package/dist/esm/parts/DSPaginator/config/useFocusTracker.js.map +7 -0
- package/dist/esm/parts/DSPaginator/config/usePaginator.js +74 -50
- package/dist/esm/parts/DSPaginator/config/usePaginator.js.map +2 -2
- package/dist/esm/parts/DSPaginator/config/usePaginatorFloatingContext.js +56 -0
- package/dist/esm/parts/DSPaginator/config/usePaginatorFloatingContext.js.map +7 -0
- package/dist/esm/parts/DSPaginator/config/usePaginatorInteractions.js +140 -0
- package/dist/esm/parts/DSPaginator/config/usePaginatorInteractions.js.map +7 -0
- package/dist/esm/parts/DSPaginator/config/usePaginatorSizing.js +56 -0
- package/dist/esm/parts/DSPaginator/config/usePaginatorSizing.js.map +7 -0
- package/dist/esm/parts/DSPaginator/config/useValidateProps.js.map +2 -2
- package/dist/esm/parts/DSPaginator/constants/index.js +49 -3
- package/dist/esm/parts/DSPaginator/constants/index.js.map +2 -2
- package/dist/esm/parts/DSPaginator/parts/OptionRenderer.js +68 -0
- package/dist/esm/parts/DSPaginator/parts/OptionRenderer.js.map +7 -0
- package/dist/esm/parts/DSPaginator/parts/Panel.js +101 -0
- package/dist/esm/parts/DSPaginator/parts/Panel.js.map +7 -0
- package/dist/esm/parts/DSPaginator/parts/Trigger.js +94 -0
- package/dist/esm/parts/DSPaginator/parts/Trigger.js.map +7 -0
- package/dist/esm/parts/DSPaginator/react-desc-prop-types.js +6 -1
- package/dist/esm/parts/DSPaginator/react-desc-prop-types.js.map +2 -2
- package/dist/esm/parts/DSPaginator/styled.js +120 -39
- package/dist/esm/parts/DSPaginator/styled.js.map +2 -2
- package/dist/esm/parts/DSPaginator/typescript-testing/slot-props.js +12 -1
- package/dist/esm/parts/DSPaginator/typescript-testing/slot-props.js.map +2 -2
- package/dist/esm/parts/DSPaginator/typescript-testing/typescript-testing.js +2 -1
- package/dist/esm/parts/DSPaginator/typescript-testing/typescript-testing.js.map +2 -2
- package/dist/esm/parts/DSPerPageSelector/DSPerPageSelector.js +11 -80
- package/dist/esm/parts/DSPerPageSelector/DSPerPageSelector.js.map +3 -3
- package/dist/esm/parts/DSPerPageSelector/DSPerPageSelectorCTX.js +8 -0
- package/dist/esm/parts/DSPerPageSelector/DSPerPageSelectorCTX.js.map +7 -0
- package/dist/esm/parts/DSPerPageSelector/config/getInstanceIds.js +10 -0
- package/dist/esm/parts/DSPerPageSelector/config/getInstanceIds.js.map +7 -0
- package/dist/esm/parts/DSPerPageSelector/config/getOptions.js.map +2 -2
- package/dist/esm/parts/DSPerPageSelector/config/getSelectedOptionIndex.js +6 -0
- package/dist/esm/parts/DSPerPageSelector/config/getSelectedOptionIndex.js.map +7 -0
- package/dist/esm/parts/DSPerPageSelector/config/navigationKeys.js +14 -0
- package/dist/esm/parts/DSPerPageSelector/config/navigationKeys.js.map +7 -0
- package/dist/esm/parts/DSPerPageSelector/config/useFocusTracker.js +53 -0
- package/dist/esm/parts/DSPerPageSelector/config/useFocusTracker.js.map +7 -0
- package/dist/esm/parts/DSPerPageSelector/config/usePerPageSelector.js +69 -21
- package/dist/esm/parts/DSPerPageSelector/config/usePerPageSelector.js.map +2 -2
- package/dist/esm/parts/DSPerPageSelector/config/usePerPageSelectorFloatingContext.js +52 -0
- package/dist/esm/parts/DSPerPageSelector/config/usePerPageSelectorFloatingContext.js.map +7 -0
- package/dist/esm/parts/DSPerPageSelector/config/usePerPageSelectorInteractions.js +145 -0
- package/dist/esm/parts/DSPerPageSelector/config/usePerPageSelectorInteractions.js.map +7 -0
- package/dist/esm/parts/DSPerPageSelector/config/usePerPageSelectorSizing.js +42 -0
- package/dist/esm/parts/DSPerPageSelector/config/usePerPageSelectorSizing.js.map +7 -0
- package/dist/esm/parts/DSPerPageSelector/constants/index.js +47 -8
- package/dist/esm/parts/DSPerPageSelector/constants/index.js.map +2 -2
- package/dist/esm/parts/DSPerPageSelector/parts/OptionRenderer.js +64 -0
- package/dist/esm/parts/DSPerPageSelector/parts/OptionRenderer.js.map +7 -0
- package/dist/esm/parts/DSPerPageSelector/parts/Panel.js +90 -0
- package/dist/esm/parts/DSPerPageSelector/parts/Panel.js.map +7 -0
- package/dist/esm/parts/DSPerPageSelector/parts/Trigger.js +65 -0
- package/dist/esm/parts/DSPerPageSelector/parts/Trigger.js.map +7 -0
- package/dist/esm/parts/DSPerPageSelector/react-desc-prop-types.js +19 -2
- package/dist/esm/parts/DSPerPageSelector/react-desc-prop-types.js.map +2 -2
- package/dist/esm/parts/DSPerPageSelector/styled.js +111 -33
- package/dist/esm/parts/DSPerPageSelector/styled.js.map +2 -2
- package/dist/esm/parts/DSPerPageSelector/typescript-testing/slots-props.js +10 -1
- package/dist/esm/parts/DSPerPageSelector/typescript-testing/slots-props.js.map +2 -2
- package/dist/esm/parts/DSPerPageSelector/typescript-testing/typescript-testing.js +60 -1
- package/dist/esm/parts/DSPerPageSelector/typescript-testing/typescript-testing.js.map +2 -2
- package/dist/esm/react-desc-prop-types.js.map +1 -1
- package/dist/types/parts/DSPageNextButton/config/usePageNextButton.d.ts +4 -4
- package/dist/types/parts/DSPagePrevButton/config/usePagePrevButton.d.ts +4 -4
- package/dist/types/parts/DSPaginationContainer/config/usePaginationContainer.d.ts +4 -4
- package/dist/types/parts/DSPaginationSeparator/config/usePaginationSeparator.d.ts +4 -4
- package/dist/types/parts/DSPaginator/DSPaginator.d.ts +5 -0
- package/dist/types/parts/DSPaginator/DSPaginatorCTX.d.ts +5 -0
- package/dist/types/parts/DSPaginator/config/getAmountOfPages.d.ts +1 -0
- package/dist/types/parts/DSPaginator/config/getInstanceIds.d.ts +3 -0
- package/dist/types/parts/DSPaginator/config/navigationKeys.d.ts +3 -0
- package/dist/types/parts/DSPaginator/config/useFocusTracker.d.ts +20 -0
- package/dist/types/parts/DSPaginator/config/usePaginator.d.ts +52 -18
- package/dist/types/parts/DSPaginator/config/usePaginatorFloatingContext.d.ts +31 -0
- package/dist/types/parts/DSPaginator/config/usePaginatorInteractions.d.ts +37 -0
- package/dist/types/parts/DSPaginator/config/usePaginatorSizing.d.ts +37 -0
- package/dist/types/parts/DSPaginator/constants/index.d.ts +36 -1
- package/dist/types/parts/DSPaginator/parts/OptionRenderer.d.ts +11 -0
- package/dist/types/parts/DSPaginator/parts/Panel.d.ts +5 -0
- package/dist/types/parts/DSPaginator/parts/Trigger.d.ts +5 -0
- package/dist/types/parts/DSPaginator/react-desc-prop-types.d.ts +17 -0
- package/dist/types/parts/DSPaginator/styled.d.ts +17 -4
- package/dist/types/parts/DSPerPageSelector/DSPerPageSelector.d.ts +5 -0
- package/dist/types/parts/DSPerPageSelector/DSPerPageSelectorCTX.d.ts +5 -0
- package/dist/types/parts/DSPerPageSelector/config/getInstanceIds.d.ts +3 -0
- package/dist/types/parts/DSPerPageSelector/config/getOptions.d.ts +3 -3
- package/dist/types/parts/DSPerPageSelector/config/getSelectedOptionIndex.d.ts +2 -0
- package/dist/types/parts/DSPerPageSelector/config/navigationKeys.d.ts +3 -0
- package/dist/types/parts/DSPerPageSelector/config/useFocusTracker.d.ts +22 -0
- package/dist/types/parts/DSPerPageSelector/config/usePerPageSelector.d.ts +43 -10
- package/dist/types/parts/DSPerPageSelector/config/usePerPageSelectorFloatingContext.d.ts +31 -0
- package/dist/types/parts/DSPerPageSelector/config/usePerPageSelectorInteractions.d.ts +38 -0
- package/dist/types/parts/DSPerPageSelector/config/usePerPageSelectorSizing.d.ts +25 -0
- package/dist/types/parts/DSPerPageSelector/constants/index.d.ts +32 -5
- package/dist/types/parts/DSPerPageSelector/parts/OptionRenderer.d.ts +11 -0
- package/dist/types/parts/DSPerPageSelector/parts/Panel.d.ts +5 -0
- package/dist/types/parts/DSPerPageSelector/parts/Trigger.d.ts +5 -0
- package/dist/types/parts/DSPerPageSelector/react-desc-prop-types.d.ts +27 -2
- package/dist/types/parts/DSPerPageSelector/styled.d.ts +15 -2
- package/dist/types/react-desc-prop-types.d.ts +2 -2
- package/package.json +15 -13
- package/dist/cjs/parts/DSPaginator/config/createPaginatorHeader.js.map +0 -7
- package/dist/cjs/parts/DSPaginator/config/getOptions.js +0 -76
- package/dist/cjs/parts/DSPaginator/config/getOptions.js.map +0 -7
- package/dist/cjs/parts/DSPaginator/config/usePaginationSearch.js.map +0 -7
- package/dist/esm/parts/DSPaginator/config/createPaginatorHeader.js +0 -24
- package/dist/esm/parts/DSPaginator/config/createPaginatorHeader.js.map +0 -7
- package/dist/esm/parts/DSPaginator/config/getOptions.js +0 -46
- package/dist/esm/parts/DSPaginator/config/getOptions.js.map +0 -7
- package/dist/esm/parts/DSPaginator/config/usePaginationSearch.js +0 -33
- package/dist/esm/parts/DSPaginator/config/usePaginationSearch.js.map +0 -7
- package/dist/types/parts/DSPaginator/config/createPaginatorHeader.d.ts +0 -9
- package/dist/types/parts/DSPaginator/config/getOptions.d.ts +0 -8
- package/dist/types/parts/DSPaginator/config/usePaginationSearch.d.ts +0 -1
|
@@ -34,177 +34,21 @@ __export(DSPaginator_exports, {
|
|
|
34
34
|
module.exports = __toCommonJS(DSPaginator_exports);
|
|
35
35
|
var React = __toESM(require("react"));
|
|
36
36
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
37
|
-
var import_react = __toESM(require("react"));
|
|
38
|
-
var import_ds_circular_progress_indicator = require("@elliemae/ds-circular-progress-indicator");
|
|
39
|
-
var import_ds_grid = require("@elliemae/ds-grid");
|
|
40
|
-
var import_ds_icons = require("@elliemae/ds-icons");
|
|
41
37
|
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
42
|
-
var
|
|
43
|
-
var import_DSPaginationSeparator = require("../DSPaginationSeparator/index.js");
|
|
44
|
-
var import_createPaginatorHeader = require("./config/createPaginatorHeader.js");
|
|
38
|
+
var import_react = __toESM(require("react"));
|
|
45
39
|
var import_usePaginator = require("./config/usePaginator.js");
|
|
46
40
|
var import_constants = require("./constants/index.js");
|
|
41
|
+
var import_DSPaginatorCTX = require("./DSPaginatorCTX.js");
|
|
42
|
+
var import_Panel = require("./parts/Panel.js");
|
|
43
|
+
var import_Trigger = require("./parts/Trigger.js");
|
|
47
44
|
var import_react_desc_prop_types = require("./react-desc-prop-types.js");
|
|
48
|
-
var import_styled = require("./styled.js");
|
|
49
45
|
const DSPaginator = (props) => {
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
btnWidth,
|
|
57
|
-
pageInfoWidth,
|
|
58
|
-
options,
|
|
59
|
-
isOpened,
|
|
60
|
-
actionRef,
|
|
61
|
-
widestChildRef,
|
|
62
|
-
pageInfoRef,
|
|
63
|
-
checkMarkRef,
|
|
64
|
-
checkMarkWidth,
|
|
65
|
-
onKeyDown,
|
|
66
|
-
setIsOpened
|
|
67
|
-
} = (0, import_usePaginator.usePaginator)(props);
|
|
68
|
-
const widestTypographyRef = import_react.default.useRef(null);
|
|
69
|
-
const Header = (0, import_react.useMemo)(
|
|
70
|
-
() => (0, import_createPaginatorHeader.createPaginatorHeader)({ pageDetailsTitle, pageInfoWidth, ownerPropsConfig, checkMarkWidth }),
|
|
71
|
-
[pageDetailsTitle, pageInfoWidth, ownerPropsConfig, checkMarkWidth]
|
|
72
|
-
);
|
|
73
|
-
const buttonOnClick = (0, import_react.useMemo)(() => {
|
|
74
|
-
if (globalAttributes.onClick) return globalAttributes.onClick;
|
|
75
|
-
return () => setIsOpened((prev) => !prev);
|
|
76
|
-
}, [globalAttributes.onClick, setIsOpened]);
|
|
77
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
78
|
-
import_styled.StyledDropdown,
|
|
79
|
-
{
|
|
80
|
-
isOpened,
|
|
81
|
-
options,
|
|
82
|
-
selectedOptions: { [pageIndex.toString()]: true },
|
|
83
|
-
onOptionClick: (_, clickedOption) => {
|
|
84
|
-
onPageChange(clickedOption.value);
|
|
85
|
-
setIsOpened(false);
|
|
86
|
-
btnRef.current?.focus();
|
|
87
|
-
},
|
|
88
|
-
onClickOutside: () => {
|
|
89
|
-
setIsOpened(false);
|
|
90
|
-
btnRef.current?.focus();
|
|
91
|
-
},
|
|
92
|
-
customOffset: [-(checkMarkWidth + 7), 2],
|
|
93
|
-
startPlacementPreference: "top-start",
|
|
94
|
-
actionRef,
|
|
95
|
-
onKeyDown,
|
|
96
|
-
minWidth: pageDetails.length !== 0 ? btnWidth + checkMarkWidth + 7 : (
|
|
97
|
-
/**
|
|
98
|
-
* Structure of the width:
|
|
99
|
-
* 16px (left padding)
|
|
100
|
-
* + chevronWidth (size of the chevron icon)
|
|
101
|
-
* + 8px (spacing between chevron and text)
|
|
102
|
-
* + pageCount length in ch
|
|
103
|
-
* + 16px (right padding)
|
|
104
|
-
* + a small scrollbar placeholder (to avoid text wrapping when scrollbars appear)
|
|
105
|
-
* By using `calc()` + `ch` units, the component stays responsive to font-size changes
|
|
106
|
-
* without requiring an extra ref to measure the page count text width.
|
|
107
|
-
*/
|
|
108
|
-
`calc(${checkMarkWidth + 60}px + ${pageCount.toString().length}ch)`
|
|
109
|
-
),
|
|
110
|
-
maxHeight: 300,
|
|
111
|
-
HeaderComp: Header,
|
|
112
|
-
children: [
|
|
113
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
114
|
-
import_styled.PaginationDropdownButtonPaginator,
|
|
115
|
-
{
|
|
116
|
-
buttonType: "raw",
|
|
117
|
-
disabled: isLoadingPageCount,
|
|
118
|
-
innerRef: btnRef,
|
|
119
|
-
"aria-pressed": isOpened,
|
|
120
|
-
"aria-label": `Page ${pageIndex} out of ${pageCount}, ${pageDetails.length !== 0 ? pageDetails[pageIndex - 1] : "\b\b"}. Press to change the current page`,
|
|
121
|
-
"data-testid": import_constants.PAGINATOR_DATA_TESTID.PAGINATOR,
|
|
122
|
-
...globalAttributes,
|
|
123
|
-
...xstyledProps,
|
|
124
|
-
...ownerPropsConfig,
|
|
125
|
-
onClick: buttonOnClick,
|
|
126
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ds_grid.Grid, { gutter: "xxxs", alignItems: "center", style: { gridAutoFlow: "column" }, children: [
|
|
127
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_styled.StyledPageInfo, { innerRef: pageInfoRef, children: [
|
|
128
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
129
|
-
import_ds_typography.DSTypography,
|
|
130
|
-
{
|
|
131
|
-
id: "typography-page-index",
|
|
132
|
-
variant: "b1",
|
|
133
|
-
as: "span",
|
|
134
|
-
fontWeight: "semibold",
|
|
135
|
-
textAlign: "start",
|
|
136
|
-
children: pageIndex
|
|
137
|
-
}
|
|
138
|
-
),
|
|
139
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
140
|
-
import_ds_typography.DSTypography,
|
|
141
|
-
{
|
|
142
|
-
variant: "b1",
|
|
143
|
-
as: "span",
|
|
144
|
-
className: "typography-page-info-and-detail",
|
|
145
|
-
children: [
|
|
146
|
-
"/ ",
|
|
147
|
-
pageCount
|
|
148
|
-
]
|
|
149
|
-
}
|
|
150
|
-
)
|
|
151
|
-
] }),
|
|
152
|
-
isLoadingPageCount && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_circular_progress_indicator.DSCircularIndeterminateIndicator, { ml: "xxxs", mr: "xxxs", size: "xs" }),
|
|
153
|
-
pageDetails.length !== 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
154
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DSPaginationSeparator.DSPaginationSeparator, { height: "12px", ml: "12px", mr: "xxxs", ...ownerPropsConfig }),
|
|
155
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
156
|
-
import_ds_typography.DSTypography,
|
|
157
|
-
{
|
|
158
|
-
className: "typography-page-info-and-detail",
|
|
159
|
-
innerRef: widestTypographyRef,
|
|
160
|
-
mr: "xxs",
|
|
161
|
-
variant: "b1",
|
|
162
|
-
as: "span",
|
|
163
|
-
fontWeight: "semibold",
|
|
164
|
-
textAlign: "start",
|
|
165
|
-
children: pageDetails[pageIndex - 1]
|
|
166
|
-
}
|
|
167
|
-
)
|
|
168
|
-
] }),
|
|
169
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_icons.ChevronDown, { ml: "xxxs", color: ["brand-primary", "700"], innerRef: checkMarkRef })
|
|
170
|
-
] })
|
|
171
|
-
}
|
|
172
|
-
),
|
|
173
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_grid.Grid, { style: { position: "relative" }, children: pageDetails.map((pageDetail, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
174
|
-
import_styled.InvisibleDiv,
|
|
175
|
-
{
|
|
176
|
-
innerRef: (el) => {
|
|
177
|
-
if (!el) return;
|
|
178
|
-
if (!widestChildRef.current) {
|
|
179
|
-
widestChildRef.current = el;
|
|
180
|
-
return;
|
|
181
|
-
}
|
|
182
|
-
if (el.offsetWidth > widestChildRef.current.offsetWidth) {
|
|
183
|
-
widestChildRef.current = el;
|
|
184
|
-
}
|
|
185
|
-
if (index === pageDetails.length - 1) {
|
|
186
|
-
widestTypographyRef.current?.style.setProperty("min-width", `${widestChildRef.current?.offsetWidth}px`);
|
|
187
|
-
}
|
|
188
|
-
},
|
|
189
|
-
"data-testid": "ds-pagination-invisible-detail-for-width-calc",
|
|
190
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
191
|
-
import_ds_typography.DSTypography,
|
|
192
|
-
{
|
|
193
|
-
className: "typography-page-info-and-detail",
|
|
194
|
-
mr: "xxs",
|
|
195
|
-
variant: "b1",
|
|
196
|
-
as: "span",
|
|
197
|
-
fontWeight: "semibold",
|
|
198
|
-
textAlign: "start",
|
|
199
|
-
children: pageDetail
|
|
200
|
-
}
|
|
201
|
-
)
|
|
202
|
-
},
|
|
203
|
-
pageDetail
|
|
204
|
-
)) })
|
|
205
|
-
]
|
|
206
|
-
}
|
|
207
|
-
);
|
|
46
|
+
const config = (0, import_usePaginator.usePaginator)(props);
|
|
47
|
+
const ctx = import_react.default.useMemo(() => ({ ...config }), [config]);
|
|
48
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_DSPaginatorCTX.DSPaginatorContext.Provider, { value: ctx, children: [
|
|
49
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Trigger.Trigger, {}),
|
|
50
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Panel.Panel, {})
|
|
51
|
+
] });
|
|
208
52
|
};
|
|
209
53
|
DSPaginator.displayName = import_constants.DSPaginatorName;
|
|
210
54
|
const DSPaginatorWithSchema = (0, import_ds_props_helpers.describe)(DSPaginator);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/DSPaginator/DSPaginator.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["import { describe } from '@elliemae/ds-props-helpers';\nimport React from 'react';\nimport { usePaginator } from './config/usePaginator.js';\nimport { DSPaginatorName } from './constants/index.js';\nimport { DSPaginatorContext, type DSPaginatorCTX } from './DSPaginatorCTX.js';\nimport { Panel } from './parts/Panel.js';\nimport { Trigger } from './parts/Trigger.js';\nimport { DSPaginatorPropTypesSchema, type DSPaginatorT } from './react-desc-prop-types.js';\n\n/**\n * A trigger (aria-haspopup=\"dialog\") that owns a non-modal dialog, positioned by the floating context, whose content is\n * a listbox of pages (virtualized with DSFastList). It replaced a DSDropdownMenuV2 based implementation keeping its\n * public contract; see KNOWN_INTENTIONAL_DEVIATIONS.md (package root) for the accepted deviations and the release notes for the behavior changes.\n */\nconst DSPaginator: React.ComponentType<DSPaginatorT.Props> = (props) => {\n const config = usePaginator(props);\n const ctx: DSPaginatorCTX = React.useMemo(() => ({ ...config }), [config]);\n\n return (\n <DSPaginatorContext.Provider value={ctx}>\n <Trigger />\n <Panel />\n </DSPaginatorContext.Provider>\n );\n};\n\nDSPaginator.displayName = DSPaginatorName;\nconst DSPaginatorWithSchema = describe(DSPaginator);\nDSPaginatorWithSchema.propTypes = DSPaginatorPropTypesSchema;\n\nexport { DSPaginator, DSPaginatorWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADmBnB;AAnBJ,8BAAyB;AACzB,mBAAkB;AAClB,0BAA6B;AAC7B,uBAAgC;AAChC,4BAAwD;AACxD,mBAAsB;AACtB,qBAAwB;AACxB,mCAA8D;AAO9D,MAAM,cAAuD,CAAC,UAAU;AACtE,QAAM,aAAS,kCAAa,KAAK;AACjC,QAAM,MAAsB,aAAAA,QAAM,QAAQ,OAAO,EAAE,GAAG,OAAO,IAAI,CAAC,MAAM,CAAC;AAEzE,SACE,6CAAC,yCAAmB,UAAnB,EAA4B,OAAO,KAClC;AAAA,gDAAC,0BAAQ;AAAA,IACT,4CAAC,sBAAM;AAAA,KACT;AAEJ;AAEA,YAAY,cAAc;AAC1B,MAAM,4BAAwB,kCAAS,WAAW;AAClD,sBAAsB,YAAY;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -26,38 +26,13 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
31
|
-
|
|
29
|
+
var DSPaginatorCTX_exports = {};
|
|
30
|
+
__export(DSPaginatorCTX_exports, {
|
|
31
|
+
DSPaginatorContext: () => DSPaginatorContext
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
33
|
+
module.exports = __toCommonJS(DSPaginatorCTX_exports);
|
|
34
34
|
var React = __toESM(require("react"));
|
|
35
35
|
var import_react = require("react");
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const timeoutRef = (0, import_react.useRef)();
|
|
40
|
-
(0, import_react.useEffect)(() => {
|
|
41
|
-
if (typeof pageCount === "string") return;
|
|
42
|
-
if (searchValue !== "" && Number.parseInt(searchValue, 10) <= pageCount) {
|
|
43
|
-
actionRef.current.setActiveDescendant(searchValue);
|
|
44
|
-
actionRef.current.scrollOptionIntoView(searchValue);
|
|
45
|
-
}
|
|
46
|
-
}, [searchValue]);
|
|
47
|
-
const onKeyDown = (0, import_react.useCallback)(
|
|
48
|
-
(e) => {
|
|
49
|
-
if (e.code.startsWith("Digit")) {
|
|
50
|
-
if (shouldResetSearchValue) setSearchValue(e.key);
|
|
51
|
-
else setSearchValue((prevValue) => prevValue + e.key);
|
|
52
|
-
setShouldResetSearchValue(false);
|
|
53
|
-
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
54
|
-
timeoutRef.current = setTimeout(() => {
|
|
55
|
-
setShouldResetSearchValue(true);
|
|
56
|
-
}, 1e3);
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
[shouldResetSearchValue]
|
|
60
|
-
);
|
|
61
|
-
return onKeyDown;
|
|
62
|
-
};
|
|
63
|
-
//# sourceMappingURL=usePaginationSearch.js.map
|
|
36
|
+
const defaultContext = {};
|
|
37
|
+
const DSPaginatorContext = (0, import_react.createContext)(defaultContext);
|
|
38
|
+
//# sourceMappingURL=DSPaginatorCTX.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/parts/DSPaginator/DSPaginatorCTX.ts", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import { createContext } from 'react';\nimport type { usePaginator } from './config/usePaginator.js';\n\nexport interface DSPaginatorCTX extends ReturnType<typeof usePaginator> {}\n\nconst defaultContext = {} as DSPaginatorCTX;\n\n/** Single source of truth for the parts of DSPaginator: props, owner props, floating context, focus tracker. */\nexport const DSPaginatorContext = createContext<DSPaginatorCTX>(defaultContext);\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA8B;AAK9B,MAAM,iBAAiB,CAAC;AAGjB,MAAM,yBAAqB,4BAA8B,cAAc;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -26,29 +26,14 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
31
|
-
|
|
29
|
+
var getAmountOfPages_exports = {};
|
|
30
|
+
__export(getAmountOfPages_exports, {
|
|
31
|
+
getAmountOfPages: () => getAmountOfPages
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
33
|
+
module.exports = __toCommonJS(getAmountOfPages_exports);
|
|
34
34
|
var React = __toESM(require("react"));
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const createPaginatorHeader = ({
|
|
39
|
-
pageDetailsTitle,
|
|
40
|
-
pageInfoWidth,
|
|
41
|
-
ownerPropsConfig,
|
|
42
|
-
checkMarkWidth
|
|
43
|
-
}) => {
|
|
44
|
-
const Comp = () => {
|
|
45
|
-
if (pageDetailsTitle === "") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styled.StyledHeader, { children: "Page" });
|
|
46
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_styled.StyledHeader, { cols: [`${pageInfoWidth + checkMarkWidth + 34}px`, "8px", "auto"], children: [
|
|
47
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: { marginLeft: "8px" }, children: "Page" }),
|
|
48
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DSPaginationSeparator.DSPaginationSeparator, { height: "100%", ...ownerPropsConfig }),
|
|
49
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: pageDetailsTitle })
|
|
50
|
-
] });
|
|
51
|
-
};
|
|
52
|
-
return Comp;
|
|
35
|
+
const getAmountOfPages = (pageCount, pageIndex) => {
|
|
36
|
+
const amount = typeof pageCount === "string" ? pageIndex + 1 : pageCount;
|
|
37
|
+
return Number.isFinite(amount) && amount > 0 ? Math.floor(amount) : 0;
|
|
53
38
|
};
|
|
54
|
-
//# sourceMappingURL=
|
|
39
|
+
//# sourceMappingURL=getAmountOfPages.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/parts/DSPaginator/config/getAmountOfPages.ts", "../../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["// same rule as the existing DSPaginator: when the page count is not known (a string, e.g. \"many\"),\n// the user can only reach the pages up to the one after the current\nexport const getAmountOfPages = (pageCount: number | string, pageIndex: number): number => {\n const amount = typeof pageCount === 'string' ? pageIndex + 1 : pageCount;\n return Number.isFinite(amount) && amount > 0 ? Math.floor(amount) : 0;\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEhB,MAAM,mBAAmB,CAAC,WAA4B,cAA8B;AACzF,QAAM,SAAS,OAAO,cAAc,WAAW,YAAY,IAAI;AAC/D,SAAO,OAAO,SAAS,MAAM,KAAK,SAAS,IAAI,KAAK,MAAM,MAAM,IAAI;AACtE;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var getInstanceIds_exports = {};
|
|
30
|
+
__export(getInstanceIds_exports, {
|
|
31
|
+
getDialogId: () => getDialogId,
|
|
32
|
+
getHeaderId: () => getHeaderId,
|
|
33
|
+
getListId: () => getListId
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(getInstanceIds_exports);
|
|
36
|
+
var React = __toESM(require("react"));
|
|
37
|
+
const getHeaderId = (instanceUid) => `ds-paginator-header-${instanceUid}`;
|
|
38
|
+
const getListId = (instanceUid) => `ds-paginator-list-${instanceUid}`;
|
|
39
|
+
const getDialogId = (instanceUid) => `ds-paginator-dialog-${instanceUid}`;
|
|
40
|
+
//# sourceMappingURL=getInstanceIds.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/parts/DSPaginator/config/getInstanceIds.ts", "../../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["// one place composes the ids so the parts and the aria relationships cannot drift apart\nexport const getHeaderId = (instanceUid: string) => `ds-paginator-header-${instanceUid}`;\nexport const getListId = (instanceUid: string) => `ds-paginator-list-${instanceUid}`;\nexport const getDialogId = (instanceUid: string) => `ds-paginator-dialog-${instanceUid}`;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADChB,MAAM,cAAc,CAAC,gBAAwB,uBAAuB,WAAW;AAC/E,MAAM,YAAY,CAAC,gBAAwB,qBAAqB,WAAW;AAC3E,MAAM,cAAc,CAAC,gBAAwB,uBAAuB,WAAW;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var navigationKeys_exports = {};
|
|
30
|
+
__export(navigationKeys_exports, {
|
|
31
|
+
NAVIGATION_KEYS: () => NAVIGATION_KEYS
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(navigationKeys_exports);
|
|
34
|
+
var React = __toESM(require("react"));
|
|
35
|
+
var import_constants = require("../constants/index.js");
|
|
36
|
+
const NAVIGATION_KEYS = {
|
|
37
|
+
ArrowDown: (currentPage) => currentPage + 1,
|
|
38
|
+
ArrowUp: (currentPage) => currentPage - 1,
|
|
39
|
+
PageDown: (currentPage) => currentPage + import_constants.PAGINATOR_PAGE_JUMP,
|
|
40
|
+
PageUp: (currentPage) => currentPage - import_constants.PAGINATOR_PAGE_JUMP,
|
|
41
|
+
Home: () => 1,
|
|
42
|
+
End: (_currentPage, amountOfPages) => amountOfPages
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=navigationKeys.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/parts/DSPaginator/config/navigationKeys.ts", "../../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import { PAGINATOR_PAGE_JUMP } from '../constants/index.js';\n\ntype GetTargetPage = (currentPage: number, amountOfPages: number) => number;\n\n// the keys that only MOVE the focus through the options (APG listbox / select-only combobox navigation)\nexport const NAVIGATION_KEYS: Record<string, GetTargetPage> = {\n ArrowDown: (currentPage) => currentPage + 1,\n ArrowUp: (currentPage) => currentPage - 1,\n PageDown: (currentPage) => currentPage + PAGINATOR_PAGE_JUMP,\n PageUp: (currentPage) => currentPage - PAGINATOR_PAGE_JUMP,\n Home: () => 1,\n End: (_currentPage, amountOfPages) => amountOfPages,\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAoC;AAK7B,MAAM,kBAAiD;AAAA,EAC5D,WAAW,CAAC,gBAAgB,cAAc;AAAA,EAC1C,SAAS,CAAC,gBAAgB,cAAc;AAAA,EACxC,UAAU,CAAC,gBAAgB,cAAc;AAAA,EACzC,QAAQ,CAAC,gBAAgB,cAAc;AAAA,EACvC,MAAM,MAAM;AAAA,EACZ,KAAK,CAAC,cAAc,kBAAkB;AACxC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var useFocusTracker_exports = {};
|
|
30
|
+
__export(useFocusTracker_exports, {
|
|
31
|
+
getOptionRegionId: () => getOptionRegionId,
|
|
32
|
+
useFocusTracker: () => useFocusTracker
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(useFocusTracker_exports);
|
|
35
|
+
var React = __toESM(require("react"));
|
|
36
|
+
var import_react = require("react");
|
|
37
|
+
var import_constants = require("../constants/index.js");
|
|
38
|
+
const getOptionRegionId = (page) => `${import_constants.PAGINATOR_REGION_FOCUSES.OPTION_PREFIX}${page}`;
|
|
39
|
+
const getPageFromRegion = (region) => {
|
|
40
|
+
if (!region.startsWith(import_constants.PAGINATOR_REGION_FOCUSES.OPTION_PREFIX)) return null;
|
|
41
|
+
return Number(region.slice(import_constants.PAGINATOR_REGION_FOCUSES.OPTION_PREFIX.length));
|
|
42
|
+
};
|
|
43
|
+
const useFocusTracker = ({ amountOfPages, pageIndex }) => {
|
|
44
|
+
const [focusRegion, setFocusRegion] = (0, import_react.useState)(import_constants.PAGINATOR_REGION_FOCUSES.RESET);
|
|
45
|
+
const focusedPage = (0, import_react.useMemo)(() => getPageFromRegion(focusRegion), [focusRegion]);
|
|
46
|
+
const clampPage = (0, import_react.useCallback)((page) => Math.min(Math.max(page, 1), amountOfPages), [amountOfPages]);
|
|
47
|
+
const trackFocusRegionReset = (0, import_react.useCallback)(() => setFocusRegion(import_constants.PAGINATOR_REGION_FOCUSES.RESET), []);
|
|
48
|
+
const trackFocusTrigger = (0, import_react.useCallback)(() => setFocusRegion(import_constants.PAGINATOR_REGION_FOCUSES.TRIGGER), []);
|
|
49
|
+
const trackFocusOption = (0, import_react.useCallback)(
|
|
50
|
+
(page) => {
|
|
51
|
+
if (amountOfPages > 0) setFocusRegion(getOptionRegionId(clampPage(page)));
|
|
52
|
+
},
|
|
53
|
+
[amountOfPages, clampPage]
|
|
54
|
+
);
|
|
55
|
+
const trackFocusSelectedOption = (0, import_react.useCallback)(() => trackFocusOption(pageIndex), [pageIndex, trackFocusOption]);
|
|
56
|
+
return (0, import_react.useMemo)(
|
|
57
|
+
() => ({
|
|
58
|
+
focusRegion,
|
|
59
|
+
focusedPage,
|
|
60
|
+
clampPage,
|
|
61
|
+
trackFocusRegionReset,
|
|
62
|
+
trackFocusTrigger,
|
|
63
|
+
trackFocusOption,
|
|
64
|
+
trackFocusSelectedOption
|
|
65
|
+
}),
|
|
66
|
+
[
|
|
67
|
+
focusRegion,
|
|
68
|
+
focusedPage,
|
|
69
|
+
clampPage,
|
|
70
|
+
trackFocusRegionReset,
|
|
71
|
+
trackFocusTrigger,
|
|
72
|
+
trackFocusOption,
|
|
73
|
+
trackFocusSelectedOption
|
|
74
|
+
]
|
|
75
|
+
);
|
|
76
|
+
};
|
|
77
|
+
//# sourceMappingURL=useFocusTracker.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/parts/DSPaginator/config/useFocusTracker.ts", "../../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import { useCallback, useMemo, useState } from 'react';\nimport { PAGINATOR_REGION_FOCUSES } from '../constants/index.js';\n\ntype FocusTrackerConfigT = {\n amountOfPages: number;\n pageIndex: number;\n};\n\n// the identity of an option is the page it represents: stable, never the position in the (virtualized) DOM\nexport const getOptionRegionId = (page: number) => `${PAGINATOR_REGION_FOCUSES.OPTION_PREFIX}${page}`;\n\nconst getPageFromRegion = (region: string): number | null => {\n if (!region.startsWith(PAGINATOR_REGION_FOCUSES.OPTION_PREFIX)) return null;\n return Number(region.slice(PAGINATOR_REGION_FOCUSES.OPTION_PREFIX.length));\n};\n\n/**\n * Focus tracker (see .github/memories/project_focus_tracker.md): the handlers declare WHAT must receive focus\n * (a semantic identity), each part checks whether it IS that identity, and only the matching part focuses itself\n * from its ref callback. Nothing in here calls `.focus()`.\n */\nexport const useFocusTracker = ({ amountOfPages, pageIndex }: FocusTrackerConfigT) => {\n const [focusRegion, setFocusRegion] = useState<string>(PAGINATOR_REGION_FOCUSES.RESET);\n\n const focusedPage = useMemo(() => getPageFromRegion(focusRegion), [focusRegion]);\n\n const clampPage = useCallback((page: number) => Math.min(Math.max(page, 1), amountOfPages), [amountOfPages]);\n\n const trackFocusRegionReset = useCallback(() => setFocusRegion(PAGINATOR_REGION_FOCUSES.RESET), []);\n const trackFocusTrigger = useCallback(() => setFocusRegion(PAGINATOR_REGION_FOCUSES.TRIGGER), []);\n const trackFocusOption = useCallback(\n (page: number) => {\n if (amountOfPages > 0) setFocusRegion(getOptionRegionId(clampPage(page)));\n },\n [amountOfPages, clampPage],\n );\n const trackFocusSelectedOption = useCallback(() => trackFocusOption(pageIndex), [pageIndex, trackFocusOption]);\n\n return useMemo(\n () => ({\n focusRegion,\n focusedPage,\n clampPage,\n trackFocusRegionReset,\n trackFocusTrigger,\n trackFocusOption,\n trackFocusSelectedOption,\n }),\n [\n focusRegion,\n focusedPage,\n clampPage,\n trackFocusRegionReset,\n trackFocusTrigger,\n trackFocusOption,\n trackFocusSelectedOption,\n ],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA+C;AAC/C,uBAAyC;AAQlC,MAAM,oBAAoB,CAAC,SAAiB,GAAG,0CAAyB,aAAa,GAAG,IAAI;AAEnG,MAAM,oBAAoB,CAAC,WAAkC;AAC3D,MAAI,CAAC,OAAO,WAAW,0CAAyB,aAAa,EAAG,QAAO;AACvE,SAAO,OAAO,OAAO,MAAM,0CAAyB,cAAc,MAAM,CAAC;AAC3E;AAOO,MAAM,kBAAkB,CAAC,EAAE,eAAe,UAAU,MAA2B;AACpF,QAAM,CAAC,aAAa,cAAc,QAAI,uBAAiB,0CAAyB,KAAK;AAErF,QAAM,kBAAc,sBAAQ,MAAM,kBAAkB,WAAW,GAAG,CAAC,WAAW,CAAC;AAE/E,QAAM,gBAAY,0BAAY,CAAC,SAAiB,KAAK,IAAI,KAAK,IAAI,MAAM,CAAC,GAAG,aAAa,GAAG,CAAC,aAAa,CAAC;AAE3G,QAAM,4BAAwB,0BAAY,MAAM,eAAe,0CAAyB,KAAK,GAAG,CAAC,CAAC;AAClG,QAAM,wBAAoB,0BAAY,MAAM,eAAe,0CAAyB,OAAO,GAAG,CAAC,CAAC;AAChG,QAAM,uBAAmB;AAAA,IACvB,CAAC,SAAiB;AAChB,UAAI,gBAAgB,EAAG,gBAAe,kBAAkB,UAAU,IAAI,CAAC,CAAC;AAAA,IAC1E;AAAA,IACA,CAAC,eAAe,SAAS;AAAA,EAC3B;AACA,QAAM,+BAA2B,0BAAY,MAAM,iBAAiB,SAAS,GAAG,CAAC,WAAW,gBAAgB,CAAC;AAE7G,aAAO;AAAA,IACL,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|