@elliemae/ds-pagination 3.80.0-next.50 → 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.
Files changed (202) hide show
  1. package/dist/cjs/parts/DSPaginator/DSPaginator.js +10 -166
  2. package/dist/cjs/parts/DSPaginator/DSPaginator.js.map +2 -2
  3. package/dist/cjs/parts/DSPaginator/{config/usePaginationSearch.js → DSPaginatorCTX.js} +7 -32
  4. package/dist/cjs/parts/DSPaginator/DSPaginatorCTX.js.map +7 -0
  5. package/dist/cjs/parts/DSPaginator/config/{createPaginatorHeader.js → getAmountOfPages.js} +8 -23
  6. package/dist/cjs/parts/DSPaginator/config/getAmountOfPages.js.map +7 -0
  7. package/dist/cjs/parts/DSPaginator/config/getInstanceIds.js +40 -0
  8. package/dist/cjs/parts/DSPaginator/config/getInstanceIds.js.map +7 -0
  9. package/dist/cjs/parts/DSPaginator/config/navigationKeys.js +44 -0
  10. package/dist/cjs/parts/DSPaginator/config/navigationKeys.js.map +7 -0
  11. package/dist/cjs/parts/DSPaginator/config/useFocusTracker.js +77 -0
  12. package/dist/cjs/parts/DSPaginator/config/useFocusTracker.js.map +7 -0
  13. package/dist/cjs/parts/DSPaginator/config/usePaginator.js +73 -49
  14. package/dist/cjs/parts/DSPaginator/config/usePaginator.js.map +2 -2
  15. package/dist/cjs/parts/DSPaginator/config/usePaginatorFloatingContext.js +86 -0
  16. package/dist/cjs/parts/DSPaginator/config/usePaginatorFloatingContext.js.map +7 -0
  17. package/dist/cjs/parts/DSPaginator/config/usePaginatorInteractions.js +170 -0
  18. package/dist/cjs/parts/DSPaginator/config/usePaginatorInteractions.js.map +7 -0
  19. package/dist/cjs/parts/DSPaginator/config/usePaginatorSizing.js +80 -0
  20. package/dist/cjs/parts/DSPaginator/config/usePaginatorSizing.js.map +7 -0
  21. package/dist/cjs/parts/DSPaginator/config/useValidateProps.js.map +2 -2
  22. package/dist/cjs/parts/DSPaginator/constants/index.js +49 -3
  23. package/dist/cjs/parts/DSPaginator/constants/index.js.map +2 -2
  24. package/dist/cjs/parts/DSPaginator/parts/OptionRenderer.js +98 -0
  25. package/dist/cjs/parts/DSPaginator/parts/OptionRenderer.js.map +7 -0
  26. package/dist/cjs/parts/DSPaginator/parts/Panel.js +131 -0
  27. package/dist/cjs/parts/DSPaginator/parts/Panel.js.map +7 -0
  28. package/dist/cjs/parts/DSPaginator/parts/Trigger.js +124 -0
  29. package/dist/cjs/parts/DSPaginator/parts/Trigger.js.map +7 -0
  30. package/dist/cjs/parts/DSPaginator/react-desc-prop-types.js +6 -1
  31. package/dist/cjs/parts/DSPaginator/react-desc-prop-types.js.map +2 -2
  32. package/dist/cjs/parts/DSPaginator/styled.js +113 -38
  33. package/dist/cjs/parts/DSPaginator/styled.js.map +3 -3
  34. package/dist/cjs/parts/DSPaginator/typescript-testing/slot-props.js +12 -1
  35. package/dist/cjs/parts/DSPaginator/typescript-testing/slot-props.js.map +2 -2
  36. package/dist/cjs/parts/DSPaginator/typescript-testing/typescript-testing.js +2 -1
  37. package/dist/cjs/parts/DSPaginator/typescript-testing/typescript-testing.js.map +2 -2
  38. package/dist/cjs/parts/DSPerPageSelector/DSPerPageSelector.js +10 -79
  39. package/dist/cjs/parts/DSPerPageSelector/DSPerPageSelector.js.map +3 -3
  40. package/dist/cjs/parts/DSPerPageSelector/DSPerPageSelectorCTX.js +38 -0
  41. package/dist/cjs/parts/DSPerPageSelector/DSPerPageSelectorCTX.js.map +7 -0
  42. package/dist/cjs/parts/DSPerPageSelector/config/getInstanceIds.js +40 -0
  43. package/dist/cjs/parts/DSPerPageSelector/config/getInstanceIds.js.map +7 -0
  44. package/dist/cjs/parts/DSPerPageSelector/config/getOptions.js.map +2 -2
  45. package/dist/cjs/parts/DSPerPageSelector/config/getSelectedOptionIndex.js +36 -0
  46. package/dist/cjs/parts/DSPerPageSelector/config/getSelectedOptionIndex.js.map +7 -0
  47. package/dist/cjs/parts/DSPerPageSelector/config/navigationKeys.js +44 -0
  48. package/dist/cjs/parts/DSPerPageSelector/config/navigationKeys.js.map +7 -0
  49. package/dist/cjs/parts/DSPerPageSelector/config/useFocusTracker.js +83 -0
  50. package/dist/cjs/parts/DSPerPageSelector/config/useFocusTracker.js.map +7 -0
  51. package/dist/cjs/parts/DSPerPageSelector/config/usePerPageSelector.js +68 -20
  52. package/dist/cjs/parts/DSPerPageSelector/config/usePerPageSelector.js.map +2 -2
  53. package/dist/cjs/parts/DSPerPageSelector/config/usePerPageSelectorFloatingContext.js +82 -0
  54. package/dist/cjs/parts/DSPerPageSelector/config/usePerPageSelectorFloatingContext.js.map +7 -0
  55. package/dist/cjs/parts/DSPerPageSelector/config/usePerPageSelectorInteractions.js +175 -0
  56. package/dist/cjs/parts/DSPerPageSelector/config/usePerPageSelectorInteractions.js.map +7 -0
  57. package/dist/cjs/parts/DSPerPageSelector/config/usePerPageSelectorSizing.js +66 -0
  58. package/dist/cjs/parts/DSPerPageSelector/config/usePerPageSelectorSizing.js.map +7 -0
  59. package/dist/cjs/parts/DSPerPageSelector/constants/index.js +47 -8
  60. package/dist/cjs/parts/DSPerPageSelector/constants/index.js.map +2 -2
  61. package/dist/cjs/parts/DSPerPageSelector/parts/OptionRenderer.js +94 -0
  62. package/dist/cjs/parts/DSPerPageSelector/parts/OptionRenderer.js.map +7 -0
  63. package/dist/cjs/parts/DSPerPageSelector/parts/Panel.js +120 -0
  64. package/dist/cjs/parts/DSPerPageSelector/parts/Panel.js.map +7 -0
  65. package/dist/cjs/parts/DSPerPageSelector/parts/Trigger.js +95 -0
  66. package/dist/cjs/parts/DSPerPageSelector/parts/Trigger.js.map +7 -0
  67. package/dist/cjs/parts/DSPerPageSelector/react-desc-prop-types.js +19 -2
  68. package/dist/cjs/parts/DSPerPageSelector/react-desc-prop-types.js.map +2 -2
  69. package/dist/cjs/parts/DSPerPageSelector/styled.js +104 -32
  70. package/dist/cjs/parts/DSPerPageSelector/styled.js.map +2 -2
  71. package/dist/cjs/parts/DSPerPageSelector/typescript-testing/slots-props.js +10 -1
  72. package/dist/cjs/parts/DSPerPageSelector/typescript-testing/slots-props.js.map +2 -2
  73. package/dist/cjs/parts/DSPerPageSelector/typescript-testing/typescript-testing.js +60 -1
  74. package/dist/cjs/parts/DSPerPageSelector/typescript-testing/typescript-testing.js.map +2 -2
  75. package/dist/cjs/react-desc-prop-types.js.map +1 -1
  76. package/dist/esm/parts/DSPaginator/DSPaginator.js +12 -168
  77. package/dist/esm/parts/DSPaginator/DSPaginator.js.map +2 -2
  78. package/dist/esm/parts/DSPaginator/DSPaginatorCTX.js +8 -0
  79. package/dist/esm/parts/DSPaginator/DSPaginatorCTX.js.map +7 -0
  80. package/dist/esm/parts/DSPaginator/config/getAmountOfPages.js +9 -0
  81. package/dist/esm/parts/DSPaginator/config/getAmountOfPages.js.map +7 -0
  82. package/dist/esm/parts/DSPaginator/config/getInstanceIds.js +10 -0
  83. package/dist/esm/parts/DSPaginator/config/getInstanceIds.js.map +7 -0
  84. package/dist/esm/parts/DSPaginator/config/navigationKeys.js +14 -0
  85. package/dist/esm/parts/DSPaginator/config/navigationKeys.js.map +7 -0
  86. package/dist/esm/parts/DSPaginator/config/useFocusTracker.js +47 -0
  87. package/dist/esm/parts/DSPaginator/config/useFocusTracker.js.map +7 -0
  88. package/dist/esm/parts/DSPaginator/config/usePaginator.js +74 -50
  89. package/dist/esm/parts/DSPaginator/config/usePaginator.js.map +2 -2
  90. package/dist/esm/parts/DSPaginator/config/usePaginatorFloatingContext.js +56 -0
  91. package/dist/esm/parts/DSPaginator/config/usePaginatorFloatingContext.js.map +7 -0
  92. package/dist/esm/parts/DSPaginator/config/usePaginatorInteractions.js +140 -0
  93. package/dist/esm/parts/DSPaginator/config/usePaginatorInteractions.js.map +7 -0
  94. package/dist/esm/parts/DSPaginator/config/usePaginatorSizing.js +56 -0
  95. package/dist/esm/parts/DSPaginator/config/usePaginatorSizing.js.map +7 -0
  96. package/dist/esm/parts/DSPaginator/config/useValidateProps.js.map +2 -2
  97. package/dist/esm/parts/DSPaginator/constants/index.js +49 -3
  98. package/dist/esm/parts/DSPaginator/constants/index.js.map +2 -2
  99. package/dist/esm/parts/DSPaginator/parts/OptionRenderer.js +68 -0
  100. package/dist/esm/parts/DSPaginator/parts/OptionRenderer.js.map +7 -0
  101. package/dist/esm/parts/DSPaginator/parts/Panel.js +101 -0
  102. package/dist/esm/parts/DSPaginator/parts/Panel.js.map +7 -0
  103. package/dist/esm/parts/DSPaginator/parts/Trigger.js +94 -0
  104. package/dist/esm/parts/DSPaginator/parts/Trigger.js.map +7 -0
  105. package/dist/esm/parts/DSPaginator/react-desc-prop-types.js +6 -1
  106. package/dist/esm/parts/DSPaginator/react-desc-prop-types.js.map +2 -2
  107. package/dist/esm/parts/DSPaginator/styled.js +120 -39
  108. package/dist/esm/parts/DSPaginator/styled.js.map +2 -2
  109. package/dist/esm/parts/DSPaginator/typescript-testing/slot-props.js +12 -1
  110. package/dist/esm/parts/DSPaginator/typescript-testing/slot-props.js.map +2 -2
  111. package/dist/esm/parts/DSPaginator/typescript-testing/typescript-testing.js +2 -1
  112. package/dist/esm/parts/DSPaginator/typescript-testing/typescript-testing.js.map +2 -2
  113. package/dist/esm/parts/DSPerPageSelector/DSPerPageSelector.js +11 -80
  114. package/dist/esm/parts/DSPerPageSelector/DSPerPageSelector.js.map +3 -3
  115. package/dist/esm/parts/DSPerPageSelector/DSPerPageSelectorCTX.js +8 -0
  116. package/dist/esm/parts/DSPerPageSelector/DSPerPageSelectorCTX.js.map +7 -0
  117. package/dist/esm/parts/DSPerPageSelector/config/getInstanceIds.js +10 -0
  118. package/dist/esm/parts/DSPerPageSelector/config/getInstanceIds.js.map +7 -0
  119. package/dist/esm/parts/DSPerPageSelector/config/getOptions.js.map +2 -2
  120. package/dist/esm/parts/DSPerPageSelector/config/getSelectedOptionIndex.js +6 -0
  121. package/dist/esm/parts/DSPerPageSelector/config/getSelectedOptionIndex.js.map +7 -0
  122. package/dist/esm/parts/DSPerPageSelector/config/navigationKeys.js +14 -0
  123. package/dist/esm/parts/DSPerPageSelector/config/navigationKeys.js.map +7 -0
  124. package/dist/esm/parts/DSPerPageSelector/config/useFocusTracker.js +53 -0
  125. package/dist/esm/parts/DSPerPageSelector/config/useFocusTracker.js.map +7 -0
  126. package/dist/esm/parts/DSPerPageSelector/config/usePerPageSelector.js +69 -21
  127. package/dist/esm/parts/DSPerPageSelector/config/usePerPageSelector.js.map +2 -2
  128. package/dist/esm/parts/DSPerPageSelector/config/usePerPageSelectorFloatingContext.js +52 -0
  129. package/dist/esm/parts/DSPerPageSelector/config/usePerPageSelectorFloatingContext.js.map +7 -0
  130. package/dist/esm/parts/DSPerPageSelector/config/usePerPageSelectorInteractions.js +145 -0
  131. package/dist/esm/parts/DSPerPageSelector/config/usePerPageSelectorInteractions.js.map +7 -0
  132. package/dist/esm/parts/DSPerPageSelector/config/usePerPageSelectorSizing.js +42 -0
  133. package/dist/esm/parts/DSPerPageSelector/config/usePerPageSelectorSizing.js.map +7 -0
  134. package/dist/esm/parts/DSPerPageSelector/constants/index.js +47 -8
  135. package/dist/esm/parts/DSPerPageSelector/constants/index.js.map +2 -2
  136. package/dist/esm/parts/DSPerPageSelector/parts/OptionRenderer.js +64 -0
  137. package/dist/esm/parts/DSPerPageSelector/parts/OptionRenderer.js.map +7 -0
  138. package/dist/esm/parts/DSPerPageSelector/parts/Panel.js +90 -0
  139. package/dist/esm/parts/DSPerPageSelector/parts/Panel.js.map +7 -0
  140. package/dist/esm/parts/DSPerPageSelector/parts/Trigger.js +65 -0
  141. package/dist/esm/parts/DSPerPageSelector/parts/Trigger.js.map +7 -0
  142. package/dist/esm/parts/DSPerPageSelector/react-desc-prop-types.js +19 -2
  143. package/dist/esm/parts/DSPerPageSelector/react-desc-prop-types.js.map +2 -2
  144. package/dist/esm/parts/DSPerPageSelector/styled.js +111 -33
  145. package/dist/esm/parts/DSPerPageSelector/styled.js.map +2 -2
  146. package/dist/esm/parts/DSPerPageSelector/typescript-testing/slots-props.js +10 -1
  147. package/dist/esm/parts/DSPerPageSelector/typescript-testing/slots-props.js.map +2 -2
  148. package/dist/esm/parts/DSPerPageSelector/typescript-testing/typescript-testing.js +60 -1
  149. package/dist/esm/parts/DSPerPageSelector/typescript-testing/typescript-testing.js.map +2 -2
  150. package/dist/esm/react-desc-prop-types.js.map +1 -1
  151. package/dist/types/parts/DSPageNextButton/config/usePageNextButton.d.ts +4 -4
  152. package/dist/types/parts/DSPagePrevButton/config/usePagePrevButton.d.ts +4 -4
  153. package/dist/types/parts/DSPaginationContainer/config/usePaginationContainer.d.ts +4 -4
  154. package/dist/types/parts/DSPaginationSeparator/config/usePaginationSeparator.d.ts +4 -4
  155. package/dist/types/parts/DSPaginator/DSPaginator.d.ts +5 -0
  156. package/dist/types/parts/DSPaginator/DSPaginatorCTX.d.ts +5 -0
  157. package/dist/types/parts/DSPaginator/config/getAmountOfPages.d.ts +1 -0
  158. package/dist/types/parts/DSPaginator/config/getInstanceIds.d.ts +3 -0
  159. package/dist/types/parts/DSPaginator/config/navigationKeys.d.ts +3 -0
  160. package/dist/types/parts/DSPaginator/config/useFocusTracker.d.ts +20 -0
  161. package/dist/types/parts/DSPaginator/config/usePaginator.d.ts +52 -18
  162. package/dist/types/parts/DSPaginator/config/usePaginatorFloatingContext.d.ts +31 -0
  163. package/dist/types/parts/DSPaginator/config/usePaginatorInteractions.d.ts +37 -0
  164. package/dist/types/parts/DSPaginator/config/usePaginatorSizing.d.ts +37 -0
  165. package/dist/types/parts/DSPaginator/constants/index.d.ts +36 -1
  166. package/dist/types/parts/DSPaginator/parts/OptionRenderer.d.ts +11 -0
  167. package/dist/types/parts/DSPaginator/parts/Panel.d.ts +5 -0
  168. package/dist/types/parts/DSPaginator/parts/Trigger.d.ts +5 -0
  169. package/dist/types/parts/DSPaginator/react-desc-prop-types.d.ts +17 -0
  170. package/dist/types/parts/DSPaginator/styled.d.ts +17 -4
  171. package/dist/types/parts/DSPerPageSelector/DSPerPageSelector.d.ts +5 -0
  172. package/dist/types/parts/DSPerPageSelector/DSPerPageSelectorCTX.d.ts +5 -0
  173. package/dist/types/parts/DSPerPageSelector/config/getInstanceIds.d.ts +3 -0
  174. package/dist/types/parts/DSPerPageSelector/config/getOptions.d.ts +3 -3
  175. package/dist/types/parts/DSPerPageSelector/config/getSelectedOptionIndex.d.ts +2 -0
  176. package/dist/types/parts/DSPerPageSelector/config/navigationKeys.d.ts +3 -0
  177. package/dist/types/parts/DSPerPageSelector/config/useFocusTracker.d.ts +22 -0
  178. package/dist/types/parts/DSPerPageSelector/config/usePerPageSelector.d.ts +43 -10
  179. package/dist/types/parts/DSPerPageSelector/config/usePerPageSelectorFloatingContext.d.ts +31 -0
  180. package/dist/types/parts/DSPerPageSelector/config/usePerPageSelectorInteractions.d.ts +38 -0
  181. package/dist/types/parts/DSPerPageSelector/config/usePerPageSelectorSizing.d.ts +25 -0
  182. package/dist/types/parts/DSPerPageSelector/constants/index.d.ts +32 -5
  183. package/dist/types/parts/DSPerPageSelector/parts/OptionRenderer.d.ts +11 -0
  184. package/dist/types/parts/DSPerPageSelector/parts/Panel.d.ts +5 -0
  185. package/dist/types/parts/DSPerPageSelector/parts/Trigger.d.ts +5 -0
  186. package/dist/types/parts/DSPerPageSelector/react-desc-prop-types.d.ts +27 -2
  187. package/dist/types/parts/DSPerPageSelector/styled.d.ts +15 -2
  188. package/dist/types/react-desc-prop-types.d.ts +2 -2
  189. package/package.json +15 -13
  190. package/dist/cjs/parts/DSPaginator/config/createPaginatorHeader.js.map +0 -7
  191. package/dist/cjs/parts/DSPaginator/config/getOptions.js +0 -76
  192. package/dist/cjs/parts/DSPaginator/config/getOptions.js.map +0 -7
  193. package/dist/cjs/parts/DSPaginator/config/usePaginationSearch.js.map +0 -7
  194. package/dist/esm/parts/DSPaginator/config/createPaginatorHeader.js +0 -24
  195. package/dist/esm/parts/DSPaginator/config/createPaginatorHeader.js.map +0 -7
  196. package/dist/esm/parts/DSPaginator/config/getOptions.js +0 -46
  197. package/dist/esm/parts/DSPaginator/config/getOptions.js.map +0 -7
  198. package/dist/esm/parts/DSPaginator/config/usePaginationSearch.js +0 -33
  199. package/dist/esm/parts/DSPaginator/config/usePaginationSearch.js.map +0 -7
  200. package/dist/types/parts/DSPaginator/config/createPaginatorHeader.d.ts +0 -9
  201. package/dist/types/parts/DSPaginator/config/getOptions.d.ts +0 -8
  202. package/dist/types/parts/DSPaginator/config/usePaginationSearch.d.ts +0 -1
@@ -1,9 +1,16 @@
1
1
  import * as React from "react";
2
2
  import { DSButtonV3 } from "@elliemae/ds-button-v2";
3
- import { DSDropdownMenuV2 } from "@elliemae/ds-dropdownmenu-v2";
4
- import Grid from "@elliemae/ds-grid";
3
+ import { FloatingWrapper } from "@elliemae/ds-floating-context";
4
+ import { DSFastList } from "@elliemae/ds-fast-list";
5
+ import { Grid } from "@elliemae/ds-grid";
5
6
  import { css, styled } from "@elliemae/ds-system";
6
- import { DSPaginationName, PAGINATOR_SLOTS } from "./constants/index.js";
7
+ import {
8
+ DSPaginationName,
9
+ PAGINATOR_HEADER_HEIGHT,
10
+ PAGINATOR_OPTION_HEIGHT,
11
+ PAGINATOR_PANEL_PADDING_BOTTOM,
12
+ PAGINATOR_SLOTS
13
+ } from "./constants/index.js";
7
14
  const fontSize13Base13 = 13 / 13;
8
15
  const fontSize13Base16 = 13 / 16;
9
16
  const fontSize18Base13 = 18 / 13;
@@ -24,14 +31,11 @@ const styledFocusCss = css`
24
31
  z-index: 7;
25
32
  }
26
33
  `;
27
- const InvisibleDiv = styled.div`
28
- opacity: 0;
29
- white-space: nowrap;
30
- overflow: hidden;
31
- text-overflow: ellipsis;
32
- position: absolute;
33
- `;
34
- const paginationDropdownButtonCommonStyles = css`
34
+ const StyledTrigger = styled(DSButtonV3, {
35
+ name: DSPaginationName,
36
+ slot: PAGINATOR_SLOTS.PAGINATOR,
37
+ preserveLegacyDataTestId: true
38
+ })`
35
39
  min-height: 42px;
36
40
  display: grid;
37
41
  grid-auto-flow: column;
@@ -42,7 +46,9 @@ const paginationDropdownButtonCommonStyles = css`
42
46
  padding-right: 16px;
43
47
  grid-gap: 8px;
44
48
  font-size: 13px;
45
- color: neutral-700;
49
+ /* the existing DSPaginator declares \`color: neutral-700\` here, but inside its \`css\` helper the token is never
50
+ resolved, so the declaration is dropped and the text renders with the browser's button color (black, greyed when
51
+ disabled). Not copied: the paginator keeps what is rendered today (see dimsum_compliance_status_report.md) */
46
52
  cursor: pointer;
47
53
  border-radius: 0;
48
54
  font-weight: ${(props) => props.theme.fontWeights.regular};
@@ -53,25 +59,15 @@ const paginationDropdownButtonCommonStyles = css`
53
59
  cursor: not-allowed;
54
60
  }
55
61
  white-space: nowrap;
56
- `;
57
- const PaginationDropdownButtonPaginator = styled(DSButtonV3, {
58
- name: DSPaginationName,
59
- slot: PAGINATOR_SLOTS.PAGINATOR,
60
- preserveLegacyDataTestId: true
61
- })`
62
- ${paginationDropdownButtonCommonStyles}
63
- `;
64
- const StyledDropdown = styled(DSDropdownMenuV2)`
65
- /**
66
- * Pagination uses DSTypography internally, but each typography variant defines
67
- * its own font-size. When these components are placed inside a styled() wrapper,
68
- * trying to style them via styled(DSTypography) triggers TypeScript errors
69
- * because DSTypography exposes "as" props and variant-specific overrides.
70
- *
71
- * Instead of wrapping DSTypography directly in styled(), we target the
72
- * underlying rendered elements via className/id. This avoids the TS conflicts
73
- * while still allowing us to override their font-size reliably.
74
- */
62
+
63
+ /* same approach as the existing DSPaginator: the typography variants own their font-size, so we target the
64
+ rendered elements by className instead of wrapping DSTypography in styled() */
65
+ /* the detail of the current page wraps when it reaches the list width (the trigger does not reserve the width of the
66
+ widest detail: it follows the current one) */
67
+ .typography-paginator-detail {
68
+ white-space: normal;
69
+ overflow-wrap: anywhere;
70
+ }
75
71
  #typography-page-index {
76
72
  font-size: ${fontSize18Base16}rem;
77
73
  @media (min-width: ${({ theme }) => theme.breakpoints.small}) {
@@ -85,21 +81,106 @@ const StyledDropdown = styled(DSDropdownMenuV2)`
85
81
  }
86
82
  }
87
83
  `;
88
- const StyledHeader = styled(Grid)`
84
+ const StyledTriggerWrapper = styled("div", {
85
+ name: DSPaginationName,
86
+ slot: PAGINATOR_SLOTS.TRIGGER_WRAPPER
87
+ })`
88
+ display: contents;
89
+ `;
90
+ const StyledPageInfo = styled("div", { name: DSPaginationName, slot: PAGINATOR_SLOTS.PAGE_INFO })`
91
+ display: flex;
92
+ gap: 4px;
93
+ `;
94
+ const StyledFloatingWrapper = styled(FloatingWrapper, {
95
+ name: DSPaginationName,
96
+ slot: PAGINATOR_SLOTS.FLOATING_WRAPPER
97
+ })``;
98
+ const StyledPanel = styled("div", { name: DSPaginationName, slot: PAGINATOR_SLOTS.PANEL })`
99
+ display: grid;
100
+ grid-template-rows: auto 1fr;
101
+ /* same as the previous DSDropdownMenuV2 wrapper: 4px of padding below the list */
102
+ padding-bottom: ${PAGINATOR_PANEL_PADDING_BOTTOM}px;
103
+ background-color: ${({ theme }) => theme.colors.neutral["000"]};
104
+ `;
105
+ const StyledHeader = styled(Grid, { name: DSPaginationName, slot: PAGINATOR_SLOTS.HEADER })`
106
+ align-items: center;
107
+ box-sizing: border-box;
108
+ min-height: ${PAGINATOR_HEADER_HEIGHT}px;
109
+ padding: 0 0 0 4px;
110
+ border-bottom: 1px solid ${({ theme }) => theme.colors.neutral[300]};
89
111
  font-size: ${fontSize12Base16}rem;
112
+ color: ${({ theme }) => theme.colors.neutral[500]};
90
113
  @media (min-width: ${({ theme }) => theme.breakpoints.small}) {
91
114
  font-size: ${fontSize12Base13}rem;
92
115
  }
93
116
  `;
94
- const StyledPageInfo = styled.div`
95
- display: flex;
96
- gap: 4px;
117
+ const StyledListWrapper = styled("div", {
118
+ name: DSPaginationName,
119
+ slot: PAGINATOR_SLOTS.LIST_WRAPPER
120
+ })``;
121
+ const StyledList = styled(DSFastList, { name: DSPaginationName, slot: PAGINATOR_SLOTS.LIST })``;
122
+ const StyledOption = styled("div", { name: DSPaginationName, slot: PAGINATOR_SLOTS.OPTION })`
123
+ position: relative;
124
+ display: grid;
125
+ align-items: center;
126
+ column-gap: 8px;
127
+ min-height: ${PAGINATOR_OPTION_HEIGHT}px;
128
+ padding: 4px 16px;
129
+ cursor: pointer;
130
+ list-style: none;
131
+ font-size: ${fontSize13Base16}rem;
132
+ @media (min-width: ${({ theme }) => theme.breakpoints.small}) {
133
+ font-size: ${fontSize13Base13}rem;
134
+ }
135
+ background-color: ${({ theme }) => theme.colors.neutral["000"]};
136
+ &:hover {
137
+ background-color: ${({ theme }) => theme.colors.brand[200]};
138
+ }
139
+ &:focus {
140
+ outline: none;
141
+ background-color: ${({ theme }) => theme.colors.brand[200]};
142
+ &:after {
143
+ display: block;
144
+ content: ' ';
145
+ position: absolute;
146
+ top: 0;
147
+ left: 0;
148
+ right: 0;
149
+ bottom: 0;
150
+ border: 1px solid ${({ theme }) => theme.colors.brand[500]};
151
+ pointer-events: none;
152
+ z-index: 7;
153
+ }
154
+ }
155
+ `;
156
+ const StyledOptionCheckmark = styled("span", {
157
+ name: DSPaginationName,
158
+ slot: PAGINATOR_SLOTS.OPTION_CHECKMARK
159
+ })`
160
+ display: grid;
161
+ place-items: center;
162
+ `;
163
+ const StyledOptionPage = styled("span", { name: DSPaginationName, slot: PAGINATOR_SLOTS.OPTION_PAGE })``;
164
+ const StyledOptionDetail = styled("span", {
165
+ name: DSPaginationName,
166
+ slot: PAGINATOR_SLOTS.OPTION_DETAIL
167
+ })`
168
+ /* details wrap, they are never truncated (see stories/docs/principles/a11y/TextTruncationCriticalities.md) */
169
+ white-space: normal;
170
+ overflow-wrap: anywhere;
97
171
  `;
98
172
  export {
99
- InvisibleDiv,
100
- PaginationDropdownButtonPaginator,
101
- StyledDropdown,
173
+ StyledFloatingWrapper,
102
174
  StyledHeader,
103
- StyledPageInfo
175
+ StyledList,
176
+ StyledListWrapper,
177
+ StyledOption,
178
+ StyledOptionCheckmark,
179
+ StyledOptionDetail,
180
+ StyledOptionPage,
181
+ StyledPageInfo,
182
+ StyledPanel,
183
+ StyledTrigger,
184
+ StyledTriggerWrapper
104
185
  };
105
186
  //# sourceMappingURL=styled.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/DSPaginator/styled.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { DSButtonV3 } from '@elliemae/ds-button-v2';\n\nimport { DSDropdownMenuV2 } from '@elliemae/ds-dropdownmenu-v2';\nimport Grid from '@elliemae/ds-grid';\nimport { css, styled } from '@elliemae/ds-system';\nimport type {} from '@xstyled/system';\nimport { DSPaginationName, PAGINATOR_SLOTS } from './constants/index.js';\n\nconst fontSize13Base13 = 13 / 13;\nconst fontSize13Base16 = 13 / 16;\nconst fontSize18Base13 = 18 / 13;\nconst fontSize18Base16 = 18 / 16;\nconst fontSize12Base13 = 12 / 13;\nconst fontSize12Base16 = 12 / 16;\n\nconst styledFocusCss = css`\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 }) => theme.colors.brand[700]};\n pointer-events: none;\n z-index: 7;\n }\n`;\n\nexport const InvisibleDiv = styled.div`\n opacity: 0;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n position: absolute;\n`;\n\nconst paginationDropdownButtonCommonStyles = css`\n min-height: 42px;\n display: grid;\n grid-auto-flow: column;\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: neutral-700;\n cursor: pointer;\n border-radius: 0;\n font-weight: ${(props) => props.theme.fontWeights.regular};\n :focus {\n ${styledFocusCss}\n }\n &:disabled {\n cursor: not-allowed;\n }\n white-space: nowrap;\n`;\nexport const PaginationDropdownButtonPaginator = styled(DSButtonV3, {\n name: DSPaginationName,\n slot: PAGINATOR_SLOTS.PAGINATOR,\n preserveLegacyDataTestId: true,\n})`\n ${paginationDropdownButtonCommonStyles}\n`;\n\nexport const StyledDropdown = styled(DSDropdownMenuV2)`\n /**\n * Pagination uses DSTypography internally, but each typography variant defines\n * its own font-size. When these components are placed inside a styled() wrapper,\n * trying to style them via styled(DSTypography) triggers TypeScript errors\n * because DSTypography exposes \"as\" props and variant-specific overrides.\n *\n * Instead of wrapping DSTypography directly in styled(), we target the\n * underlying rendered elements via className/id. This avoids the TS conflicts\n * while still allowing us to override their font-size reliably.\n */\n #typography-page-index {\n font-size: ${fontSize18Base16}rem;\n @media (min-width: ${({ theme }) => theme.breakpoints.small}) {\n font-size: ${fontSize18Base13}rem;\n }\n }\n .typography-page-info-and-detail {\n font-size: ${fontSize13Base16}rem;\n @media (min-width: ${({ theme }) => theme.breakpoints.small}) {\n font-size: ${fontSize13Base13}rem;\n }\n }\n`;\nexport const StyledHeader = styled(Grid)`\n font-size: ${fontSize12Base16}rem;\n @media (min-width: ${({ theme }) => theme.breakpoints.small}) {\n font-size: ${fontSize12Base13}rem;\n }\n`;\n\nexport const StyledPageInfo = styled.div`\n display: flex;\n gap: 4px;\n`;\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,kBAAkB;AAE3B,SAAS,wBAAwB;AACjC,OAAO,UAAU;AACjB,SAAS,KAAK,cAAc;AAE5B,SAAS,kBAAkB,uBAAuB;AAElD,MAAM,mBAAmB,KAAK;AAC9B,MAAM,mBAAmB,KAAK;AAC9B,MAAM,mBAAmB,KAAK;AAC9B,MAAM,mBAAmB,KAAK;AAC9B,MAAM,mBAAmB,KAAK;AAC9B,MAAM,mBAAmB,KAAK;AAE9B,MAAM,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBASC,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,MAAM,GAAG,CAAC;AAAA;AAAA;AAAA;AAAA;AAMvD,MAAM,eAAe,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQnC,MAAM,uCAAuC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAc5B,CAAC,UAAU,MAAM,MAAM,YAAY,OAAO;AAAA;AAAA,MAErD,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOb,MAAM,oCAAoC,OAAO,YAAY;AAAA,EAClE,MAAM;AAAA,EACN,MAAM,gBAAgB;AAAA,EACtB,0BAA0B;AAC5B,CAAC;AAAA,IACG,oCAAoC;AAAA;AAGjC,MAAM,iBAAiB,OAAO,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAYpC,gBAAgB;AAAA,yBACR,CAAC,EAAE,MAAM,MAAM,MAAM,YAAY,KAAK;AAAA,mBAC5C,gBAAgB;AAAA;AAAA;AAAA;AAAA,iBAIlB,gBAAgB;AAAA,yBACR,CAAC,EAAE,MAAM,MAAM,MAAM,YAAY,KAAK;AAAA,mBAC5C,gBAAgB;AAAA;AAAA;AAAA;AAI5B,MAAM,eAAe,OAAO,IAAI;AAAA,eACxB,gBAAgB;AAAA,uBACR,CAAC,EAAE,MAAM,MAAM,MAAM,YAAY,KAAK;AAAA,iBAC5C,gBAAgB;AAAA;AAAA;AAI1B,MAAM,iBAAiB,OAAO;AAAA;AAAA;AAAA;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { DSButtonV3 } from '@elliemae/ds-button-v2';\nimport { FloatingWrapper } from '@elliemae/ds-floating-context';\nimport { DSFastList } from '@elliemae/ds-fast-list';\nimport { Grid } from '@elliemae/ds-grid';\nimport { css, styled } from '@elliemae/ds-system';\nimport type {} from '@xstyled/system';\nimport {\n DSPaginationName,\n PAGINATOR_HEADER_HEIGHT,\n PAGINATOR_OPTION_HEIGHT,\n PAGINATOR_PANEL_PADDING_BOTTOM,\n PAGINATOR_SLOTS,\n} from './constants/index.js';\n\n// the font sizes are the ones of the existing DSPaginator (same rem/px dance between the 13px and 16px base)\nconst fontSize13Base13 = 13 / 13;\nconst fontSize13Base16 = 13 / 16;\nconst fontSize18Base13 = 18 / 13;\nconst fontSize18Base16 = 18 / 16;\nconst fontSize12Base13 = 12 / 13;\nconst fontSize12Base16 = 12 / 16;\n\nconst styledFocusCss = css`\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 }) => theme.colors.brand[700]};\n pointer-events: none;\n z-index: 7;\n }\n`;\n\nexport const StyledTrigger = styled(DSButtonV3, {\n name: DSPaginationName,\n slot: PAGINATOR_SLOTS.PAGINATOR,\n preserveLegacyDataTestId: true,\n})`\n min-height: 42px;\n display: grid;\n grid-auto-flow: column;\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 /* the existing DSPaginator declares \\`color: neutral-700\\` here, but inside its \\`css\\` helper the token is never\n resolved, so the declaration is dropped and the text renders with the browser's button color (black, greyed when\n disabled). Not copied: the paginator keeps what is rendered today (see dimsum_compliance_status_report.md) */\n cursor: pointer;\n border-radius: 0;\n font-weight: ${(props) => props.theme.fontWeights.regular};\n :focus {\n ${styledFocusCss}\n }\n &:disabled {\n cursor: not-allowed;\n }\n white-space: nowrap;\n\n /* same approach as the existing DSPaginator: the typography variants own their font-size, so we target the\n rendered elements by className instead of wrapping DSTypography in styled() */\n /* the detail of the current page wraps when it reaches the list width (the trigger does not reserve the width of the\n widest detail: it follows the current one) */\n .typography-paginator-detail {\n white-space: normal;\n overflow-wrap: anywhere;\n }\n #typography-page-index {\n font-size: ${fontSize18Base16}rem;\n @media (min-width: ${({ theme }) => theme.breakpoints.small}) {\n font-size: ${fontSize18Base13}rem;\n }\n }\n .typography-page-info-and-detail {\n font-size: ${fontSize13Base16}rem;\n @media (min-width: ${({ theme }) => theme.breakpoints.small}) {\n font-size: ${fontSize13Base13}rem;\n }\n }\n`;\n\nexport const StyledTriggerWrapper = styled('div', {\n name: DSPaginationName,\n slot: PAGINATOR_SLOTS.TRIGGER_WRAPPER,\n})`\n display: contents;\n`;\n\nexport const StyledPageInfo = styled('div', { name: DSPaginationName, slot: PAGINATOR_SLOTS.PAGE_INFO })`\n display: flex;\n gap: 4px;\n`;\n\nexport const StyledFloatingWrapper = styled(FloatingWrapper, {\n name: DSPaginationName,\n slot: PAGINATOR_SLOTS.FLOATING_WRAPPER,\n})``;\n\nexport const StyledPanel = styled('div', { name: DSPaginationName, slot: PAGINATOR_SLOTS.PANEL })`\n display: grid;\n grid-template-rows: auto 1fr;\n /* same as the previous DSDropdownMenuV2 wrapper: 4px of padding below the list */\n padding-bottom: ${PAGINATOR_PANEL_PADDING_BOTTOM}px;\n background-color: ${({ theme }) => theme.colors.neutral['000']};\n`;\n\nexport const StyledHeader = styled(Grid, { name: DSPaginationName, slot: PAGINATOR_SLOTS.HEADER })`\n align-items: center;\n box-sizing: border-box;\n min-height: ${PAGINATOR_HEADER_HEIGHT}px;\n padding: 0 0 0 4px;\n border-bottom: 1px solid ${({ theme }) => theme.colors.neutral[300]};\n font-size: ${fontSize12Base16}rem;\n color: ${({ theme }) => theme.colors.neutral[500]};\n @media (min-width: ${({ theme }) => theme.breakpoints.small}) {\n font-size: ${fontSize12Base13}rem;\n }\n`;\n\n// explicit height: the virtual list needs a constrained box to scroll (its own container is height: 100%)\nexport const StyledListWrapper = styled('div', {\n name: DSPaginationName,\n slot: PAGINATOR_SLOTS.LIST_WRAPPER,\n})``;\n\nexport const StyledList = styled(DSFastList, { name: DSPaginationName, slot: PAGINATOR_SLOTS.LIST })``;\n\nexport const StyledOption = styled('div', { name: DSPaginationName, slot: PAGINATOR_SLOTS.OPTION })`\n position: relative;\n display: grid;\n align-items: center;\n column-gap: 8px;\n min-height: ${PAGINATOR_OPTION_HEIGHT}px;\n padding: 4px 16px;\n cursor: pointer;\n list-style: none;\n font-size: ${fontSize13Base16}rem;\n @media (min-width: ${({ theme }) => theme.breakpoints.small}) {\n font-size: ${fontSize13Base13}rem;\n }\n background-color: ${({ theme }) => theme.colors.neutral['000']};\n &:hover {\n background-color: ${({ theme }) => theme.colors.brand[200]};\n }\n &:focus {\n outline: none;\n background-color: ${({ theme }) => theme.colors.brand[200]};\n &:after {\n display: block;\n content: ' ';\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n border: 1px solid ${({ theme }) => theme.colors.brand[500]};\n pointer-events: none;\n z-index: 7;\n }\n }\n`;\n\nexport const StyledOptionCheckmark = styled('span', {\n name: DSPaginationName,\n slot: PAGINATOR_SLOTS.OPTION_CHECKMARK,\n})`\n display: grid;\n place-items: center;\n`;\n\nexport const StyledOptionPage = styled('span', { name: DSPaginationName, slot: PAGINATOR_SLOTS.OPTION_PAGE })``;\n\nexport const StyledOptionDetail = styled('span', {\n name: DSPaginationName,\n slot: PAGINATOR_SLOTS.OPTION_DETAIL,\n})`\n /* details wrap, they are never truncated (see stories/docs/principles/a11y/TextTruncationCriticalities.md) */\n white-space: normal;\n overflow-wrap: anywhere;\n`;\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,kBAAkB;AAC3B,SAAS,uBAAuB;AAChC,SAAS,kBAAkB;AAC3B,SAAS,YAAY;AACrB,SAAS,KAAK,cAAc;AAE5B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP,MAAM,mBAAmB,KAAK;AAC9B,MAAM,mBAAmB,KAAK;AAC9B,MAAM,mBAAmB,KAAK;AAC9B,MAAM,mBAAmB,KAAK;AAC9B,MAAM,mBAAmB,KAAK;AAC9B,MAAM,mBAAmB,KAAK;AAE9B,MAAM,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBASC,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,MAAM,GAAG,CAAC;AAAA;AAAA;AAAA;AAAA;AAMvD,MAAM,gBAAgB,OAAO,YAAY;AAAA,EAC9C,MAAM;AAAA,EACN,MAAM,gBAAgB;AAAA,EACtB,0BAA0B;AAC5B,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAgBgB,CAAC,UAAU,MAAM,MAAM,YAAY,OAAO;AAAA;AAAA,MAErD,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAgBH,gBAAgB;AAAA,yBACR,CAAC,EAAE,MAAM,MAAM,MAAM,YAAY,KAAK;AAAA,mBAC5C,gBAAgB;AAAA;AAAA;AAAA;AAAA,iBAIlB,gBAAgB;AAAA,yBACR,CAAC,EAAE,MAAM,MAAM,MAAM,YAAY,KAAK;AAAA,mBAC5C,gBAAgB;AAAA;AAAA;AAAA;AAK5B,MAAM,uBAAuB,OAAO,OAAO;AAAA,EAChD,MAAM;AAAA,EACN,MAAM,gBAAgB;AACxB,CAAC;AAAA;AAAA;AAIM,MAAM,iBAAiB,OAAO,OAAO,EAAE,MAAM,kBAAkB,MAAM,gBAAgB,UAAU,CAAC;AAAA;AAAA;AAAA;AAKhG,MAAM,wBAAwB,OAAO,iBAAiB;AAAA,EAC3D,MAAM;AAAA,EACN,MAAM,gBAAgB;AACxB,CAAC;AAEM,MAAM,cAAc,OAAO,OAAO,EAAE,MAAM,kBAAkB,MAAM,gBAAgB,MAAM,CAAC;AAAA;AAAA;AAAA;AAAA,oBAI5E,8BAA8B;AAAA,sBAC5B,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,QAAQ,KAAK,CAAC;AAAA;AAGzD,MAAM,eAAe,OAAO,MAAM,EAAE,MAAM,kBAAkB,MAAM,gBAAgB,OAAO,CAAC;AAAA;AAAA;AAAA,gBAGjF,uBAAuB;AAAA;AAAA,6BAEV,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,QAAQ,GAAG,CAAC;AAAA,eACtD,gBAAgB;AAAA,WACpB,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,QAAQ,GAAG,CAAC;AAAA,uBAC5B,CAAC,EAAE,MAAM,MAAM,MAAM,YAAY,KAAK;AAAA,iBAC5C,gBAAgB;AAAA;AAAA;AAK1B,MAAM,oBAAoB,OAAO,OAAO;AAAA,EAC7C,MAAM;AAAA,EACN,MAAM,gBAAgB;AACxB,CAAC;AAEM,MAAM,aAAa,OAAO,YAAY,EAAE,MAAM,kBAAkB,MAAM,gBAAgB,KAAK,CAAC;AAE5F,MAAM,eAAe,OAAO,OAAO,EAAE,MAAM,kBAAkB,MAAM,gBAAgB,OAAO,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,gBAKlF,uBAAuB;AAAA;AAAA;AAAA;AAAA,eAIxB,gBAAgB;AAAA,uBACR,CAAC,EAAE,MAAM,MAAM,MAAM,YAAY,KAAK;AAAA,iBAC5C,gBAAgB;AAAA;AAAA,sBAEX,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,QAAQ,KAAK,CAAC;AAAA;AAAA,wBAExC,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,MAAM,GAAG,CAAC;AAAA;AAAA;AAAA;AAAA,wBAItC,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,MAAM,GAAG,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BASpC,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,MAAM,GAAG,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAOzD,MAAM,wBAAwB,OAAO,QAAQ;AAAA,EAClD,MAAM;AAAA,EACN,MAAM,gBAAgB;AACxB,CAAC;AAAA;AAAA;AAAA;AAKM,MAAM,mBAAmB,OAAO,QAAQ,EAAE,MAAM,kBAAkB,MAAM,gBAAgB,YAAY,CAAC;AAErG,MAAM,qBAAqB,OAAO,QAAQ;AAAA,EAC/C,MAAM;AAAA,EACN,MAAM,gBAAgB;AACxB,CAAC;AAAA;AAAA;AAAA;AAAA;",
6
6
  "names": []
7
7
  }
@@ -3,7 +3,18 @@ const SlotPropsAsObj = {
3
3
  dsPaginationPaginator: { "aria-label": "just a typescript test" }
4
4
  };
5
5
  const SlotPropsAsFunctions = {
6
- dsPaginationPaginator: () => ({ "aria-label": "just a typescript test" })
6
+ dsPaginationPaginator: () => ({ "aria-label": "just a typescript test" }),
7
+ dsPaginationPaginatorTriggerWrapper: () => ({ "aria-label": "just a typescript test" }),
8
+ dsPaginationPaginatorPageInfo: () => ({ "aria-label": "just a typescript test" }),
9
+ dsPaginationPaginatorFloatingWrapper: () => ({ "aria-label": "just a typescript test" }),
10
+ dsPaginationPaginatorPanel: () => ({ "aria-label": "just a typescript test" }),
11
+ dsPaginationPaginatorHeader: () => ({ "aria-label": "just a typescript test" }),
12
+ dsPaginationPaginatorListWrapper: () => ({ "aria-label": "just a typescript test" }),
13
+ dsPaginationPaginatorList: () => ({ "aria-label": "just a typescript test" }),
14
+ dsPaginationPaginatorOption: () => ({ "aria-label": "just a typescript test" }),
15
+ dsPaginationPaginatorOptionCheckmark: () => ({ "aria-label": "just a typescript test" }),
16
+ dsPaginationPaginatorOptionPage: () => ({ "aria-label": "just a typescript test" }),
17
+ dsPaginationPaginatorOptionDetail: () => ({ "aria-label": "just a typescript test" })
7
18
  };
8
19
  const EnsureAllSlotsExistInSlotFunctionArguments = SlotPropsAsFunctions;
9
20
  //# sourceMappingURL=slot-props.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../src/parts/DSPaginator/typescript-testing/slot-props.ts"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\n\nimport type { TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport type { DSPaginationName, PAGINATOR_SLOTS } from '../constants/index.js';\nimport type { DSPaginatorT } from '../react-desc-prop-types.js';\n\nconst SlotPropsAsObj: Partial<DSPaginatorT.Props> = {\n dsPaginationPaginator: { 'aria-label': 'just a typescript test' },\n};\nconst SlotPropsAsFunctions: DSPaginatorT.SlotFunctionArguments = {\n dsPaginationPaginator: () => ({ 'aria-label': 'just a typescript test' }),\n};\nconst EnsureAllSlotsExistInSlotFunctionArguments: Required<\n TypescriptHelpersT.PropsForSlots<typeof DSPaginationName, typeof PAGINATOR_SLOTS>\n> = SlotPropsAsFunctions;\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACMvB,MAAM,iBAA8C;AAAA,EAClD,uBAAuB,EAAE,cAAc,yBAAyB;AAClE;AACA,MAAM,uBAA2D;AAAA,EAC/D,uBAAuB,OAAO,EAAE,cAAc,yBAAyB;AACzE;AACA,MAAM,6CAEF;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\n\nimport type { TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport type { DSPaginationName, PAGINATOR_SLOTS } from '../constants/index.js';\nimport type { DSPaginatorT } from '../react-desc-prop-types.js';\n\nconst SlotPropsAsObj: Partial<DSPaginatorT.Props> = {\n dsPaginationPaginator: { 'aria-label': 'just a typescript test' },\n};\nconst SlotPropsAsFunctions: DSPaginatorT.SlotFunctionArguments = {\n dsPaginationPaginator: () => ({ 'aria-label': 'just a typescript test' }),\n dsPaginationPaginatorTriggerWrapper: () => ({ 'aria-label': 'just a typescript test' }),\n dsPaginationPaginatorPageInfo: () => ({ 'aria-label': 'just a typescript test' }),\n dsPaginationPaginatorFloatingWrapper: () => ({ 'aria-label': 'just a typescript test' }),\n dsPaginationPaginatorPanel: () => ({ 'aria-label': 'just a typescript test' }),\n dsPaginationPaginatorHeader: () => ({ 'aria-label': 'just a typescript test' }),\n dsPaginationPaginatorListWrapper: () => ({ 'aria-label': 'just a typescript test' }),\n dsPaginationPaginatorList: () => ({ 'aria-label': 'just a typescript test' }),\n dsPaginationPaginatorOption: () => ({ 'aria-label': 'just a typescript test' }),\n dsPaginationPaginatorOptionCheckmark: () => ({ 'aria-label': 'just a typescript test' }),\n dsPaginationPaginatorOptionPage: () => ({ 'aria-label': 'just a typescript test' }),\n dsPaginationPaginatorOptionDetail: () => ({ 'aria-label': 'just a typescript test' }),\n};\nconst EnsureAllSlotsExistInSlotFunctionArguments: Required<\n TypescriptHelpersT.PropsForSlots<typeof DSPaginationName, typeof PAGINATOR_SLOTS>\n> = SlotPropsAsFunctions;\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACMvB,MAAM,iBAA8C;AAAA,EAClD,uBAAuB,EAAE,cAAc,yBAAyB;AAClE;AACA,MAAM,uBAA2D;AAAA,EAC/D,uBAAuB,OAAO,EAAE,cAAc,yBAAyB;AAAA,EACvE,qCAAqC,OAAO,EAAE,cAAc,yBAAyB;AAAA,EACrF,+BAA+B,OAAO,EAAE,cAAc,yBAAyB;AAAA,EAC/E,sCAAsC,OAAO,EAAE,cAAc,yBAAyB;AAAA,EACtF,4BAA4B,OAAO,EAAE,cAAc,yBAAyB;AAAA,EAC5E,6BAA6B,OAAO,EAAE,cAAc,yBAAyB;AAAA,EAC7E,kCAAkC,OAAO,EAAE,cAAc,yBAAyB;AAAA,EAClF,2BAA2B,OAAO,EAAE,cAAc,yBAAyB;AAAA,EAC3E,6BAA6B,OAAO,EAAE,cAAc,yBAAyB;AAAA,EAC7E,sCAAsC,OAAO,EAAE,cAAc,yBAAyB;AAAA,EACtF,iCAAiC,OAAO,EAAE,cAAc,yBAAyB;AAAA,EACjF,mCAAmC,OAAO,EAAE,cAAc,yBAAyB;AACrF;AACA,MAAM,6CAEF;",
6
6
  "names": []
7
7
  }
@@ -2,7 +2,8 @@ import * as React from "react";
2
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
3
  import { DSPaginator } from "../index.js";
4
4
  const testRequiredProps = {};
5
- const testOptionalProps = {};
5
+ const testOptionalProps = { listWidth: 320 };
6
+ const testOptionalPropsCssLength = { listWidth: "24rem" };
6
7
  const testPartialDefaults = {
7
8
  pageCount: 0,
8
9
  isLoadingPageCount: false,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../src/parts/DSPaginator/typescript-testing/typescript-testing.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport { DSPaginator } from '../index.js';\nimport type { DSPaginatorT } from '../index.js';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\ntype ComponentPropsForApp = DSPaginatorT.Props;\ntype ComponentPropsInternals = DSPaginatorT.InternalProps;\ntype ComponentPropsDefaultProps = DSPaginatorT.DefaultProps;\ntype ComponentPropsOptionalProps = DSPaginatorT.OptionalProps;\ntype ComponentPropsRequiredProps = DSPaginatorT.RequiredProps;\n\nconst testRequiredProps: ComponentPropsRequiredProps = {};\n\nconst testOptionalProps: ComponentPropsOptionalProps = {};\n\n// difference Props and InternalProps is that InternalProps has all the default props filled in\n// Props allows for partial defaults\nconst testPartialDefaults: Partial<ComponentPropsDefaultProps> = {\n pageCount: 0,\n isLoadingPageCount: false,\n onPageChange: () => null,\n};\n\nconst testProps: ComponentPropsForApp = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n};\n\nconst testPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n} as ComponentPropsForApp;\n\n// InternalProps requires all defaults to be filled in\nconst testCompleteDefaults: Required<ComponentPropsDefaultProps> = {\n pageCount: 0,\n isLoadingPageCount: false,\n pageIndex: 1,\n onPageChange: () => null,\n pageDetails: [],\n pageDetailsTitle: '',\n};\n\nconst testInternalProps: ComponentPropsInternals = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n};\n\nconst testInternalPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n} as ComponentPropsInternals;\n\n// using the explicit type definition, if there is an error, it will be marked on the key that is wrong\nconst testExplicitDefinition: ComponentPropsForApp = {\n pageCount: 0,\n isLoadingPageCount: false,\n pageIndex: 1,\n onPageChange: () => null,\n pageDetails: [],\n pageDetailsTitle: '',\n};\n\n// using the \"as\" syntax, if there is an error, it will be marking the whole object as wrong because it is not compatible with the type\nconst testInferedTypeCompatibility = {\n pageCount: 0,\n isLoadingPageCount: false,\n pageIndex: 1,\n onPageChange: () => null,\n pageDetails: [],\n pageDetailsTitle: '',\n} as ComponentPropsForApp;\n\nconst testDefinitionAsConst = {\n pageCount: 0,\n isLoadingPageCount: false,\n pageIndex: 1,\n onPageChange: () => null,\n pageDetails: [],\n pageDetailsTitle: '',\n} as const;\n\nconst ExampleUsageComponent = () => (\n <>\n {/* works with explicitly casted props, all syntaxes */}\n <DSPaginator {...testExplicitDefinition} />\n <DSPaginator {...testInferedTypeCompatibility} />\n <DSPaginator {...testDefinitionAsConst} />\n {/* works with inline values */}\n <DSPaginator\n pageCount={0}\n isLoadingPageCount={false}\n pageIndex={1}\n onPageChange={() => null}\n pageDetails={[]}\n pageDetailsTitle=\"\"\n />\n </>\n);\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACuFrB,mBAEE,KAFF;AAtFF,SAAS,mBAAmB;AAU5B,MAAM,oBAAiD,CAAC;AAExD,MAAM,oBAAiD,CAAC;AAIxD,MAAM,sBAA2D;AAAA,EAC/D,WAAW;AAAA,EACX,oBAAoB;AAAA,EACpB,cAAc,MAAM;AACtB;AAEA,MAAM,YAAkC;AAAA,EACtC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,oBAAoB;AAAA,EACxB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,uBAA6D;AAAA,EACjE,WAAW;AAAA,EACX,oBAAoB;AAAA,EACpB,WAAW;AAAA,EACX,cAAc,MAAM;AAAA,EACpB,aAAa,CAAC;AAAA,EACd,kBAAkB;AACpB;AAEA,MAAM,oBAA6C;AAAA,EACjD,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,4BAA4B;AAAA,EAChC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,yBAA+C;AAAA,EACnD,WAAW;AAAA,EACX,oBAAoB;AAAA,EACpB,WAAW;AAAA,EACX,cAAc,MAAM;AAAA,EACpB,aAAa,CAAC;AAAA,EACd,kBAAkB;AACpB;AAGA,MAAM,+BAA+B;AAAA,EACnC,WAAW;AAAA,EACX,oBAAoB;AAAA,EACpB,WAAW;AAAA,EACX,cAAc,MAAM;AAAA,EACpB,aAAa,CAAC;AAAA,EACd,kBAAkB;AACpB;AAEA,MAAM,wBAAwB;AAAA,EAC5B,WAAW;AAAA,EACX,oBAAoB;AAAA,EACpB,WAAW;AAAA,EACX,cAAc,MAAM;AAAA,EACpB,aAAa,CAAC;AAAA,EACd,kBAAkB;AACpB;AAEA,MAAM,wBAAwB,MAC5B,iCAEE;AAAA,sBAAC,eAAa,GAAG,wBAAwB;AAAA,EACzC,oBAAC,eAAa,GAAG,8BAA8B;AAAA,EAC/C,oBAAC,eAAa,GAAG,uBAAuB;AAAA,EAExC;AAAA,IAAC;AAAA;AAAA,MACC,WAAW;AAAA,MACX,oBAAoB;AAAA,MACpB,WAAW;AAAA,MACX,cAAc,MAAM;AAAA,MACpB,aAAa,CAAC;AAAA,MACd,kBAAiB;AAAA;AAAA,EACnB;AAAA,GACF;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport { DSPaginator } from '../index.js';\nimport type { DSPaginatorT } from '../index.js';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\ntype ComponentPropsForApp = DSPaginatorT.Props;\ntype ComponentPropsInternals = DSPaginatorT.InternalProps;\ntype ComponentPropsDefaultProps = DSPaginatorT.DefaultProps;\ntype ComponentPropsOptionalProps = DSPaginatorT.OptionalProps;\ntype ComponentPropsRequiredProps = DSPaginatorT.RequiredProps;\n\nconst testRequiredProps: ComponentPropsRequiredProps = {};\n\nconst testOptionalProps: ComponentPropsOptionalProps = { listWidth: 320 };\nconst testOptionalPropsCssLength: ComponentPropsOptionalProps = { listWidth: '24rem' };\n\n// difference Props and InternalProps is that InternalProps has all the default props filled in\n// Props allows for partial defaults\nconst testPartialDefaults: Partial<ComponentPropsDefaultProps> = {\n pageCount: 0,\n isLoadingPageCount: false,\n onPageChange: () => null,\n};\n\nconst testProps: ComponentPropsForApp = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n};\n\nconst testPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n} as ComponentPropsForApp;\n\n// InternalProps requires all defaults to be filled in\nconst testCompleteDefaults: Required<ComponentPropsDefaultProps> = {\n pageCount: 0,\n isLoadingPageCount: false,\n pageIndex: 1,\n onPageChange: () => null,\n pageDetails: [],\n pageDetailsTitle: '',\n};\n\nconst testInternalProps: ComponentPropsInternals = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n};\n\nconst testInternalPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n} as ComponentPropsInternals;\n\n// using the explicit type definition, if there is an error, it will be marked on the key that is wrong\nconst testExplicitDefinition: ComponentPropsForApp = {\n pageCount: 0,\n isLoadingPageCount: false,\n pageIndex: 1,\n onPageChange: () => null,\n pageDetails: [],\n pageDetailsTitle: '',\n};\n\n// using the \"as\" syntax, if there is an error, it will be marking the whole object as wrong because it is not compatible with the type\nconst testInferedTypeCompatibility = {\n pageCount: 0,\n isLoadingPageCount: false,\n pageIndex: 1,\n onPageChange: () => null,\n pageDetails: [],\n pageDetailsTitle: '',\n} as ComponentPropsForApp;\n\nconst testDefinitionAsConst = {\n pageCount: 0,\n isLoadingPageCount: false,\n pageIndex: 1,\n onPageChange: () => null,\n pageDetails: [],\n pageDetailsTitle: '',\n} as const;\n\nconst ExampleUsageComponent = () => (\n <>\n {/* works with explicitly casted props, all syntaxes */}\n <DSPaginator {...testExplicitDefinition} />\n <DSPaginator {...testInferedTypeCompatibility} />\n <DSPaginator {...testDefinitionAsConst} />\n {/* works with inline values */}\n <DSPaginator\n pageCount={0}\n isLoadingPageCount={false}\n pageIndex={1}\n onPageChange={() => null}\n pageDetails={[]}\n pageDetailsTitle=\"\"\n />\n </>\n);\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACwFrB,mBAEE,KAFF;AAvFF,SAAS,mBAAmB;AAU5B,MAAM,oBAAiD,CAAC;AAExD,MAAM,oBAAiD,EAAE,WAAW,IAAI;AACxE,MAAM,6BAA0D,EAAE,WAAW,QAAQ;AAIrF,MAAM,sBAA2D;AAAA,EAC/D,WAAW;AAAA,EACX,oBAAoB;AAAA,EACpB,cAAc,MAAM;AACtB;AAEA,MAAM,YAAkC;AAAA,EACtC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,oBAAoB;AAAA,EACxB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,uBAA6D;AAAA,EACjE,WAAW;AAAA,EACX,oBAAoB;AAAA,EACpB,WAAW;AAAA,EACX,cAAc,MAAM;AAAA,EACpB,aAAa,CAAC;AAAA,EACd,kBAAkB;AACpB;AAEA,MAAM,oBAA6C;AAAA,EACjD,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,4BAA4B;AAAA,EAChC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,yBAA+C;AAAA,EACnD,WAAW;AAAA,EACX,oBAAoB;AAAA,EACpB,WAAW;AAAA,EACX,cAAc,MAAM;AAAA,EACpB,aAAa,CAAC;AAAA,EACd,kBAAkB;AACpB;AAGA,MAAM,+BAA+B;AAAA,EACnC,WAAW;AAAA,EACX,oBAAoB;AAAA,EACpB,WAAW;AAAA,EACX,cAAc,MAAM;AAAA,EACpB,aAAa,CAAC;AAAA,EACd,kBAAkB;AACpB;AAEA,MAAM,wBAAwB;AAAA,EAC5B,WAAW;AAAA,EACX,oBAAoB;AAAA,EACpB,WAAW;AAAA,EACX,cAAc,MAAM;AAAA,EACpB,aAAa,CAAC;AAAA,EACd,kBAAkB;AACpB;AAEA,MAAM,wBAAwB,MAC5B,iCAEE;AAAA,sBAAC,eAAa,GAAG,wBAAwB;AAAA,EACzC,oBAAC,eAAa,GAAG,8BAA8B;AAAA,EAC/C,oBAAC,eAAa,GAAG,uBAAuB;AAAA,EAExC;AAAA,IAAC;AAAA;AAAA,MACC,WAAW;AAAA,MACX,oBAAoB;AAAA,MACpB,WAAW;AAAA,MACX,cAAc,MAAM;AAAA,MACpB,aAAa,CAAC;AAAA,MACd,kBAAiB;AAAA;AAAA,EACnB;AAAA,GACF;",
6
6
  "names": []
7
7
  }
@@ -1,89 +1,20 @@
1
1
  import * as React from "react";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
- import { DSDropdownMenuV2 } from "@elliemae/ds-dropdownmenu-v2";
4
- import { ChevronDown } from "@elliemae/ds-icons";
5
3
  import { describe } from "@elliemae/ds-props-helpers";
6
- import { DSTypography } from "@elliemae/ds-typography";
7
- import { useMemo } from "react";
4
+ import React2 from "react";
8
5
  import { usePerPageSelector } from "./config/usePerPageSelector.js";
9
- import { DSPerPageSelectorName, PER_PAGE_SELECTOR_DATA_TESTID } from "./constants/index.js";
6
+ import { DSPerPageSelectorName } from "./constants/index.js";
7
+ import { DSPerPageSelectorContext } from "./DSPerPageSelectorCTX.js";
8
+ import { Panel } from "./parts/Panel.js";
9
+ import { Trigger } from "./parts/Trigger.js";
10
10
  import { DSPerPageSelectorPropTypesSchema } from "./react-desc-prop-types.js";
11
- import { PaginationDropdownButtonPerPageSelector, StyledHeader } from "./styled.js";
12
- const Header = () => /* @__PURE__ */ jsx(StyledHeader, { children: "Per Page" });
13
11
  const DSPerPageSelector = (props) => {
14
- const {
15
- propsWithDefault: { pageSize, onPageSizeChange },
16
- xstyledProps,
17
- globalAttributes,
18
- ownerPropsConfig,
19
- actionRef,
20
- btnRef,
21
- chevronRef,
22
- chevronWidth,
23
- isOpened,
24
- options,
25
- setIsOpened
26
- } = usePerPageSelector(props);
27
- const buttonOnClick = useMemo(() => {
28
- if (globalAttributes.onClick) return globalAttributes.onClick;
29
- return () => setIsOpened((prev) => !prev);
30
- }, [globalAttributes.onClick, setIsOpened]);
31
- const maxOptionsLength = useMemo(() => {
32
- const maxLength = options.reduce((acc, cur) => Math.max(acc, ("label" in cur ? cur.label : "").length), 0);
33
- return maxLength;
34
- }, [options]);
35
- return /* @__PURE__ */ jsx(
36
- DSDropdownMenuV2,
37
- {
38
- isOpened,
39
- options,
40
- selectedOptions: { [pageSize.toString()]: true },
41
- onOptionClick: (_, clickedOption) => {
42
- onPageSizeChange(clickedOption.value);
43
- setIsOpened(false);
44
- btnRef.current?.focus();
45
- },
46
- onClickOutside: () => {
47
- setIsOpened(false);
48
- btnRef.current?.focus();
49
- },
50
- customOffset: [-(chevronWidth + 7), 2],
51
- startPlacementPreference: "top-start",
52
- actionRef,
53
- minWidth: `calc(${chevronWidth + 60}px + ${maxOptionsLength}ch)`,
54
- maxHeight: 300,
55
- HeaderComp: Header,
56
- children: /* @__PURE__ */ jsxs(
57
- PaginationDropdownButtonPerPageSelector,
58
- {
59
- buttonType: "raw",
60
- innerRef: btnRef,
61
- "aria-pressed": isOpened,
62
- "aria-label": `${pageSize} rows per page. Press to select rows per page`,
63
- "data-testid": PER_PAGE_SELECTOR_DATA_TESTID.PER_PAGE_SELECTOR,
64
- ...globalAttributes,
65
- ...xstyledProps,
66
- ...ownerPropsConfig,
67
- onClick: buttonOnClick,
68
- children: [
69
- /* @__PURE__ */ jsxs(
70
- DSTypography,
71
- {
72
- variant: "b1",
73
- as: "span",
74
- className: "typography-per-page-selector",
75
- children: [
76
- pageSize,
77
- " / page"
78
- ]
79
- }
80
- ),
81
- /* @__PURE__ */ jsx(ChevronDown, { color: ["brand-primary", "700"], innerRef: chevronRef })
82
- ]
83
- }
84
- )
85
- }
86
- );
12
+ const config = usePerPageSelector(props);
13
+ const ctx = React2.useMemo(() => ({ ...config }), [config]);
14
+ return /* @__PURE__ */ jsxs(DSPerPageSelectorContext.Provider, { value: ctx, children: [
15
+ /* @__PURE__ */ jsx(Trigger, {}),
16
+ /* @__PURE__ */ jsx(Panel, {})
17
+ ] });
87
18
  };
88
19
  DSPerPageSelector.displayName = DSPerPageSelectorName;
89
20
  const DSPerPageSelectorWithSchema = describe(DSPerPageSelector);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/DSPerPageSelector/DSPerPageSelector.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type { DSButtonT } from '@elliemae/ds-button-v2';\nimport { DSDropdownMenuV2, type DSDropdownMenuT } from '@elliemae/ds-dropdownmenu-v2';\nimport { ChevronDown } from '@elliemae/ds-icons';\nimport { describe } from '@elliemae/ds-props-helpers';\nimport { DSTypography } from '@elliemae/ds-typography';\nimport React, { useMemo } from 'react';\nimport { usePerPageSelector } from './config/usePerPageSelector.js';\nimport { DSPerPageSelectorName, PER_PAGE_SELECTOR_DATA_TESTID } from './constants/index.js';\nimport { DSPerPageSelectorPropTypesSchema, type DSPerPageSelectorT } from './react-desc-prop-types.js';\nimport { PaginationDropdownButtonPerPageSelector, StyledHeader } from './styled.js';\n\nconst Header = () => <StyledHeader>Per Page</StyledHeader>;\n\nconst DSPerPageSelector: React.ComponentType<DSPerPageSelectorT.Props> = (props) => {\n const {\n propsWithDefault: { pageSize, onPageSizeChange },\n xstyledProps,\n globalAttributes,\n ownerPropsConfig,\n actionRef,\n btnRef,\n chevronRef,\n chevronWidth,\n isOpened,\n options,\n setIsOpened,\n } = usePerPageSelector(props);\n const buttonOnClick: DSButtonT.Props['onClick'] = useMemo(() => {\n if (globalAttributes.onClick) return globalAttributes.onClick as DSButtonT.Props['onClick'];\n return () => setIsOpened((prev) => !prev);\n }, [globalAttributes.onClick, setIsOpened]);\n\n const maxOptionsLength = useMemo(() => {\n const maxLength = options.reduce((acc, cur) => Math.max(acc, ('label' in cur ? cur.label : '').length), 0);\n return maxLength;\n }, [options]);\n\n return (\n <DSDropdownMenuV2\n isOpened={isOpened}\n options={options}\n selectedOptions={{ [pageSize.toString()]: true }}\n onOptionClick={(_, clickedOption) => {\n onPageSizeChange((clickedOption as DSDropdownMenuT.ItemSingleOptions).value as number);\n setIsOpened(false);\n btnRef.current?.focus();\n }}\n onClickOutside={() => {\n setIsOpened(false);\n btnRef.current?.focus();\n }}\n customOffset={[-(chevronWidth + 7), 2]}\n startPlacementPreference=\"top-start\"\n actionRef={actionRef}\n /**\n * Calculate the dynamic minWidth for the Dropdown:\n *\n * Structure of the width:\n * 16px (left padding)\n * + chevronWidth (size of the chevron icon)\n * + 8px (spacing between chevron and text)\n * + maxOptionsLength ch (longest option label measured in characters)\n * + 16px (right padding)\n * + a small scrollbar placeholder (to avoid text wrapping when scrollbars appear)\n *\n * Why `calc()`?\n * - When using pure px values, the initial render works correctly.\n * - But when switching between different stories in Storybook \u2014 especially those\n * that modify font-size or typography scale \u2014 the measured width from the ref\n * becomes outdated and ends up returning a smaller value than it should.\n * - That incorrect (underestimated) width causes the longest option label to wrap,\n * even though there is actually enough space.\n *\n * By using `calc()` + `ch` units, the component stays responsive to font-size changes\n * without requiring an extra ref to measure the page size text width.\n */\n minWidth={`calc(${chevronWidth + 60}px + ${maxOptionsLength}ch)`}\n maxHeight={300}\n HeaderComp={Header}\n >\n <PaginationDropdownButtonPerPageSelector\n buttonType=\"raw\"\n innerRef={btnRef}\n aria-pressed={isOpened}\n aria-label={`${pageSize} rows per page. Press to select rows per page`}\n data-testid={PER_PAGE_SELECTOR_DATA_TESTID.PER_PAGE_SELECTOR}\n {...globalAttributes}\n {...xstyledProps}\n {...ownerPropsConfig}\n onClick={buttonOnClick}\n >\n <DSTypography\n variant=\"b1\"\n as=\"span\"\n /**\n * Pagination uses DSTypography internally, but each typography variant defines\n * its own font-size. When these components are placed inside a styled() wrapper,\n * trying to style them via styled(DSTypography) triggers TypeScript errors\n * because DSTypography exposes \"as\" props and variant-specific overrides.\n *\n * Instead of wrapping DSTypography directly in styled(), we target the\n * underlying rendered elements via className/id. This avoids the TS conflicts\n * while still allowing us to override their font-size reliably.\n */\n className=\"typography-per-page-selector\"\n >\n {pageSize} / page\n </DSTypography>\n\n <ChevronDown color={['brand-primary', '700']} innerRef={chevronRef} />\n </PaginationDropdownButtonPerPageSelector>\n </DSDropdownMenuV2>\n );\n};\n\nDSPerPageSelector.displayName = DSPerPageSelectorName;\nconst DSPerPageSelectorWithSchema = describe(DSPerPageSelector);\nDSPerPageSelectorWithSchema.propTypes = DSPerPageSelectorPropTypesSchema;\n\nexport { DSPerPageSelector, DSPerPageSelectorWithSchema };\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACWF,cAgFb,YAhFa;AAVrB,SAAS,wBAA8C;AACvD,SAAS,mBAAmB;AAC5B,SAAS,gBAAgB;AACzB,SAAS,oBAAoB;AAC7B,SAAgB,eAAe;AAC/B,SAAS,0BAA0B;AACnC,SAAS,uBAAuB,qCAAqC;AACrE,SAAS,wCAAiE;AAC1E,SAAS,yCAAyC,oBAAoB;AAEtE,MAAM,SAAS,MAAM,oBAAC,gBAAa,sBAAQ;AAE3C,MAAM,oBAAmE,CAAC,UAAU;AAClF,QAAM;AAAA,IACJ,kBAAkB,EAAE,UAAU,iBAAiB;AAAA,IAC/C;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,mBAAmB,KAAK;AAC5B,QAAM,gBAA4C,QAAQ,MAAM;AAC9D,QAAI,iBAAiB,QAAS,QAAO,iBAAiB;AACtD,WAAO,MAAM,YAAY,CAAC,SAAS,CAAC,IAAI;AAAA,EAC1C,GAAG,CAAC,iBAAiB,SAAS,WAAW,CAAC;AAE1C,QAAM,mBAAmB,QAAQ,MAAM;AACrC,UAAM,YAAY,QAAQ,OAAO,CAAC,KAAK,QAAQ,KAAK,IAAI,MAAM,WAAW,MAAM,IAAI,QAAQ,IAAI,MAAM,GAAG,CAAC;AACzG,WAAO;AAAA,EACT,GAAG,CAAC,OAAO,CAAC;AAEZ,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,iBAAiB,EAAE,CAAC,SAAS,SAAS,CAAC,GAAG,KAAK;AAAA,MAC/C,eAAe,CAAC,GAAG,kBAAkB;AACnC,yBAAkB,cAAoD,KAAe;AACrF,oBAAY,KAAK;AACjB,eAAO,SAAS,MAAM;AAAA,MACxB;AAAA,MACA,gBAAgB,MAAM;AACpB,oBAAY,KAAK;AACjB,eAAO,SAAS,MAAM;AAAA,MACxB;AAAA,MACA,cAAc,CAAC,EAAE,eAAe,IAAI,CAAC;AAAA,MACrC,0BAAyB;AAAA,MACzB;AAAA,MAuBA,UAAU,QAAQ,eAAe,EAAE,QAAQ,gBAAgB;AAAA,MAC3D,WAAW;AAAA,MACX,YAAY;AAAA,MAEZ;AAAA,QAAC;AAAA;AAAA,UACC,YAAW;AAAA,UACX,UAAU;AAAA,UACV,gBAAc;AAAA,UACd,cAAY,GAAG,QAAQ;AAAA,UACvB,eAAa,8BAA8B;AAAA,UAC1C,GAAG;AAAA,UACH,GAAG;AAAA,UACH,GAAG;AAAA,UACJ,SAAS;AAAA,UAET;AAAA;AAAA,cAAC;AAAA;AAAA,gBACC,SAAQ;AAAA,gBACR,IAAG;AAAA,gBAWH,WAAU;AAAA,gBAET;AAAA;AAAA,kBAAS;AAAA;AAAA;AAAA,YACZ;AAAA,YAEA,oBAAC,eAAY,OAAO,CAAC,iBAAiB,KAAK,GAAG,UAAU,YAAY;AAAA;AAAA;AAAA,MACtE;AAAA;AAAA,EACF;AAEJ;AAEA,kBAAkB,cAAc;AAChC,MAAM,8BAA8B,SAAS,iBAAiB;AAC9D,4BAA4B,YAAY;",
6
- "names": []
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { describe } from '@elliemae/ds-props-helpers';\nimport React from 'react';\nimport { usePerPageSelector } from './config/usePerPageSelector.js';\nimport { DSPerPageSelectorName } from './constants/index.js';\nimport { DSPerPageSelectorContext, type DSPerPageSelectorCTX } from './DSPerPageSelectorCTX.js';\nimport { Panel } from './parts/Panel.js';\nimport { Trigger } from './parts/Trigger.js';\nimport { DSPerPageSelectorPropTypesSchema, type DSPerPageSelectorT } 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 page sizes (virtualized with DSFastList). It replaced a DSDropdownMenuV2 based implementation keeping its\n * public contract; same widget as DSPaginator (accepted deviations: KNOWN_INTENTIONAL_DEVIATIONS.md, package root).\n */\nconst DSPerPageSelector: React.ComponentType<DSPerPageSelectorT.Props> = (props) => {\n const config = usePerPageSelector(props);\n const ctx: DSPerPageSelectorCTX = React.useMemo(() => ({ ...config }), [config]);\n\n return (\n <DSPerPageSelectorContext.Provider value={ctx}>\n <Trigger />\n <Panel />\n </DSPerPageSelectorContext.Provider>\n );\n};\n\nDSPerPageSelector.displayName = DSPerPageSelectorName;\nconst DSPerPageSelectorWithSchema = describe(DSPerPageSelector);\nDSPerPageSelectorWithSchema.propTypes = DSPerPageSelectorPropTypesSchema;\n\nexport { DSPerPageSelector, DSPerPageSelectorWithSchema };\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACmBnB,SACE,KADF;AAnBJ,SAAS,gBAAgB;AACzB,OAAOA,YAAW;AAClB,SAAS,0BAA0B;AACnC,SAAS,6BAA6B;AACtC,SAAS,gCAA2D;AACpE,SAAS,aAAa;AACtB,SAAS,eAAe;AACxB,SAAS,wCAAiE;AAO1E,MAAM,oBAAmE,CAAC,UAAU;AAClF,QAAM,SAAS,mBAAmB,KAAK;AACvC,QAAM,MAA4BA,OAAM,QAAQ,OAAO,EAAE,GAAG,OAAO,IAAI,CAAC,MAAM,CAAC;AAE/E,SACE,qBAAC,yBAAyB,UAAzB,EAAkC,OAAO,KACxC;AAAA,wBAAC,WAAQ;AAAA,IACT,oBAAC,SAAM;AAAA,KACT;AAEJ;AAEA,kBAAkB,cAAc;AAChC,MAAM,8BAA8B,SAAS,iBAAiB;AAC9D,4BAA4B,YAAY;",
6
+ "names": ["React"]
7
7
  }
@@ -0,0 +1,8 @@
1
+ import * as React from "react";
2
+ import { createContext } from "react";
3
+ const defaultContext = {};
4
+ const DSPerPageSelectorContext = createContext(defaultContext);
5
+ export {
6
+ DSPerPageSelectorContext
7
+ };
8
+ //# sourceMappingURL=DSPerPageSelectorCTX.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/DSPerPageSelector/DSPerPageSelectorCTX.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { createContext } from 'react';\nimport type { usePerPageSelector } from './config/usePerPageSelector.js';\n\nexport interface DSPerPageSelectorCTX extends ReturnType<typeof usePerPageSelector> {}\n\nconst defaultContext = {} as DSPerPageSelectorCTX;\n\n/** Single source of truth for the parts of DSPerPageSelector: props, owner props, floating context, focus tracker. */\nexport const DSPerPageSelectorContext = createContext<DSPerPageSelectorCTX>(defaultContext);\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,qBAAqB;AAK9B,MAAM,iBAAiB,CAAC;AAGjB,MAAM,2BAA2B,cAAoC,cAAc;",
6
+ "names": []
7
+ }
@@ -0,0 +1,10 @@
1
+ import * as React from "react";
2
+ const getHeaderId = (instanceUid) => `ds-per-page-selector-header-${instanceUid}`;
3
+ const getListId = (instanceUid) => `ds-per-page-selector-list-${instanceUid}`;
4
+ const getDialogId = (instanceUid) => `ds-per-page-selector-dialog-${instanceUid}`;
5
+ export {
6
+ getDialogId,
7
+ getHeaderId,
8
+ getListId
9
+ };
10
+ //# sourceMappingURL=getInstanceIds.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../src/parts/DSPerPageSelector/config/getInstanceIds.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "// one place composes the ids so the parts and the aria relationships cannot drift apart\nexport const getHeaderId = (instanceUid: string) => `ds-per-page-selector-header-${instanceUid}`;\nexport const getListId = (instanceUid: string) => `ds-per-page-selector-list-${instanceUid}`;\nexport const getDialogId = (instanceUid: string) => `ds-per-page-selector-dialog-${instanceUid}`;\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACChB,MAAM,cAAc,CAAC,gBAAwB,+BAA+B,WAAW;AACvF,MAAM,YAAY,CAAC,gBAAwB,6BAA6B,WAAW;AACnF,MAAM,cAAc,CAAC,gBAAwB,+BAA+B,WAAW;",
6
+ "names": []
7
+ }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../src/parts/DSPerPageSelector/config/getOptions.ts"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { range } from 'lodash-es';\nimport type { DSDropdownMenuT } from '@elliemae/ds-dropdownmenu-v2';\n\nexport const generateOption = (\n value: number | DSDropdownMenuT.ItemSingleOptions,\n): DSDropdownMenuT.ItemSingleOptions => {\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 } as const;\n};\n\nexport const getOptions = (step: number, min: number, max: number) => {\n const options = range(min, max + step, step).map(generateOption);\n return min === 0 ? options.slice(1, options.length) : options;\n};\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,aAAa;AAGf,MAAM,iBAAiB,CAC5B,UACsC;AACtC,MAAI,OAAO,UAAU,UAAU;AAC7B,WAAO;AAAA,EACT;AACA,SAAO;AAAA,IACL,MAAM,MAAM,SAAS;AAAA,IACrB;AAAA,IACA,OAAO,MAAM,SAAS;AAAA,IACtB,MAAM;AAAA,EACR;AACF;AAEO,MAAM,aAAa,CAAC,MAAc,KAAa,QAAgB;AACpE,QAAM,UAAU,MAAM,KAAK,MAAM,MAAM,IAAI,EAAE,IAAI,cAAc;AAC/D,SAAO,QAAQ,IAAI,QAAQ,MAAM,GAAG,QAAQ,MAAM,IAAI;AACxD;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { range } from 'lodash-es';\nimport type { DSPerPageSelectorT } from '../react-desc-prop-types.js';\n\nexport const generateOption = (value: number | DSPerPageSelectorT.PerPageOption): DSPerPageSelectorT.PerPageOption => {\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 } as const;\n};\n\nexport const getOptions = (step: number, min: number, max: number) => {\n const options = range(min, max + step, step).map(generateOption);\n return min === 0 ? options.slice(1, options.length) : options;\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,aAAa;AAGf,MAAM,iBAAiB,CAAC,UAAuF;AACpH,MAAI,OAAO,UAAU,UAAU;AAC7B,WAAO;AAAA,EACT;AACA,SAAO;AAAA,IACL,MAAM,MAAM,SAAS;AAAA,IACrB;AAAA,IACA,OAAO,MAAM,SAAS;AAAA,IACtB,MAAM;AAAA,EACR;AACF;AAEO,MAAM,aAAa,CAAC,MAAc,KAAa,QAAgB;AACpE,QAAM,UAAU,MAAM,KAAK,MAAM,MAAM,IAAI,EAAE,IAAI,cAAc;AAC/D,SAAO,QAAQ,IAAI,QAAQ,MAAM,GAAG,QAAQ,MAAM,IAAI;AACxD;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,6 @@
1
+ import * as React from "react";
2
+ const getSelectedOptionIndex = (options, pageSize) => options.findIndex((option) => option.dsId === pageSize.toString());
3
+ export {
4
+ getSelectedOptionIndex
5
+ };
6
+ //# sourceMappingURL=getSelectedOptionIndex.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../src/parts/DSPerPageSelector/config/getSelectedOptionIndex.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type { DSPerPageSelectorT } from '../react-desc-prop-types.js';\n\n// the selected option is the one whose `dsId` is the current page size, as in the previous implementation: `value`s are not\n// guaranteed to be unique, `dsId`s are, so it is the one identity the component can control. A consequence kept on purpose: an\n// option like { dsId: 'all', value: 1000 } is not shown as selected when the page size is 1000\nexport const getSelectedOptionIndex = (options: DSPerPageSelectorT.PerPageOption[], pageSize: number) =>\n options.findIndex((option) => option.dsId === pageSize.toString());\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACKhB,MAAM,yBAAyB,CAAC,SAA6C,aAClF,QAAQ,UAAU,CAAC,WAAW,OAAO,SAAS,SAAS,SAAS,CAAC;",
6
+ "names": []
7
+ }
@@ -0,0 +1,14 @@
1
+ import * as React from "react";
2
+ import { PER_PAGE_SELECTOR_PAGE_JUMP } from "../constants/index.js";
3
+ const NAVIGATION_KEYS = {
4
+ ArrowDown: (currentIndex) => currentIndex + 1,
5
+ ArrowUp: (currentIndex) => currentIndex - 1,
6
+ PageDown: (currentIndex) => currentIndex + PER_PAGE_SELECTOR_PAGE_JUMP,
7
+ PageUp: (currentIndex) => currentIndex - PER_PAGE_SELECTOR_PAGE_JUMP,
8
+ Home: () => 0,
9
+ End: (_currentIndex, amountOfOptions) => amountOfOptions - 1
10
+ };
11
+ export {
12
+ NAVIGATION_KEYS
13
+ };
14
+ //# sourceMappingURL=navigationKeys.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../src/parts/DSPerPageSelector/config/navigationKeys.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { PER_PAGE_SELECTOR_PAGE_JUMP } from '../constants/index.js';\n\ntype GetTargetIndex = (currentIndex: number, amountOfOptions: 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, GetTargetIndex> = {\n ArrowDown: (currentIndex) => currentIndex + 1,\n ArrowUp: (currentIndex) => currentIndex - 1,\n PageDown: (currentIndex) => currentIndex + PER_PAGE_SELECTOR_PAGE_JUMP,\n PageUp: (currentIndex) => currentIndex - PER_PAGE_SELECTOR_PAGE_JUMP,\n Home: () => 0,\n End: (_currentIndex, amountOfOptions) => amountOfOptions - 1,\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,mCAAmC;AAKrC,MAAM,kBAAkD;AAAA,EAC7D,WAAW,CAAC,iBAAiB,eAAe;AAAA,EAC5C,SAAS,CAAC,iBAAiB,eAAe;AAAA,EAC1C,UAAU,CAAC,iBAAiB,eAAe;AAAA,EAC3C,QAAQ,CAAC,iBAAiB,eAAe;AAAA,EACzC,MAAM,MAAM;AAAA,EACZ,KAAK,CAAC,eAAe,oBAAoB,kBAAkB;AAC7D;",
6
+ "names": []
7
+ }
@@ -0,0 +1,53 @@
1
+ import * as React from "react";
2
+ import { useCallback, useMemo, useState } from "react";
3
+ import { PER_PAGE_SELECTOR_REGION_FOCUSES } from "../constants/index.js";
4
+ import { getSelectedOptionIndex } from "./getSelectedOptionIndex.js";
5
+ const getOptionRegionId = (dsId) => `${PER_PAGE_SELECTOR_REGION_FOCUSES.OPTION_PREFIX}${dsId}`;
6
+ const useFocusTracker = ({ options, pageSize }) => {
7
+ const [focusRegion, setFocusRegion] = useState(PER_PAGE_SELECTOR_REGION_FOCUSES.RESET);
8
+ const focusedIndex = useMemo(
9
+ () => options.findIndex((option) => getOptionRegionId(option.dsId) === focusRegion),
10
+ [focusRegion, options]
11
+ );
12
+ const clampIndex = useCallback((index) => Math.min(Math.max(index, 0), options.length - 1), [options.length]);
13
+ const trackFocusRegionReset = useCallback(() => setFocusRegion(PER_PAGE_SELECTOR_REGION_FOCUSES.RESET), []);
14
+ const trackFocusTrigger = useCallback(() => setFocusRegion(PER_PAGE_SELECTOR_REGION_FOCUSES.TRIGGER), []);
15
+ const trackFocusOptionAtIndex = useCallback(
16
+ (index) => {
17
+ if (options.length > 0) setFocusRegion(getOptionRegionId(options[clampIndex(index)].dsId));
18
+ },
19
+ [clampIndex, options]
20
+ );
21
+ const trackFocusOption = useCallback((dsId) => setFocusRegion(getOptionRegionId(dsId)), []);
22
+ const trackFocusSelectedOption = useCallback(
23
+ () => trackFocusOptionAtIndex(Math.max(getSelectedOptionIndex(options, pageSize), 0)),
24
+ [options, pageSize, trackFocusOptionAtIndex]
25
+ );
26
+ return useMemo(
27
+ () => ({
28
+ focusRegion,
29
+ focusedIndex,
30
+ clampIndex,
31
+ trackFocusRegionReset,
32
+ trackFocusTrigger,
33
+ trackFocusOption,
34
+ trackFocusOptionAtIndex,
35
+ trackFocusSelectedOption
36
+ }),
37
+ [
38
+ focusRegion,
39
+ focusedIndex,
40
+ clampIndex,
41
+ trackFocusRegionReset,
42
+ trackFocusTrigger,
43
+ trackFocusOption,
44
+ trackFocusOptionAtIndex,
45
+ trackFocusSelectedOption
46
+ ]
47
+ );
48
+ };
49
+ export {
50
+ getOptionRegionId,
51
+ useFocusTracker
52
+ };
53
+ //# sourceMappingURL=useFocusTracker.js.map