@via-profit/ui-kit 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (311) hide show
  1. package/Accordion/AccordionActions.d.ts +1 -1
  2. package/Accordion/AccordionActions.js +2 -1
  3. package/Accordion/AccordionContainer.d.ts +1 -1
  4. package/Accordion/AccordionContainer.js +2 -14
  5. package/Accordion/AccordionContent.d.ts +1 -1
  6. package/Accordion/AccordionContent.js +5 -1
  7. package/Accordion/AccordionHeader.d.ts +2 -2
  8. package/Accordion/AccordionHeader.js +6 -2
  9. package/Accordion/index.d.ts +9 -9
  10. package/Accordion/index.js +18 -9
  11. package/Autocomplete/AutocompleteContainer.d.ts +2 -2
  12. package/Autocomplete/AutocompleteContainer.js +17 -7
  13. package/Autocomplete/AutocompleteItem.js +2 -1
  14. package/Autocomplete/context.d.ts +3 -3
  15. package/Autocomplete/index.d.ts +2 -2
  16. package/Avatar/AvatarContainer.d.ts +2 -2
  17. package/Avatar/AvatarPicture.d.ts +2 -2
  18. package/Avatar/index.js +1 -2
  19. package/Badge/BadgeBase.d.ts +1 -1
  20. package/Badge/BadgeContainer.d.ts +1 -1
  21. package/Badge/BadgeDeleteButton.d.ts +2 -2
  22. package/Badge/BadgeStyled.js +1 -1
  23. package/Badge/index.d.ts +1 -1
  24. package/Badge/index.js +1 -2
  25. package/Button/ButtonBase.d.ts +2 -2
  26. package/Button/ButtonContainer.d.ts +4 -4
  27. package/Button/ButtonContainer.js +22 -5
  28. package/Button/ButtonIconWrapper.d.ts +1 -1
  29. package/Button/ButtonStyled.d.ts +1 -1
  30. package/Button/ButtonTextWrapper.d.ts +1 -1
  31. package/Button/buttonVariants.d.ts +1 -1
  32. package/Button/buttonVariants.js +3 -2
  33. package/Button/index.d.ts +1 -1
  34. package/Button/index.js +1 -20
  35. package/ButtonGroup/index.js +4 -3
  36. package/CHANGELOG.md +49 -1
  37. package/Calendar/CalendarComponent.js +18 -9
  38. package/Calendar/CalendarControlButton.d.ts +2 -2
  39. package/Calendar/CalendarPaper.js +1 -1
  40. package/Calendar/CalendarWeekDayLabel.d.ts +2 -2
  41. package/Calendar/CalendarWeekRowButton.d.ts +1 -1
  42. package/Calendar/IconChevronDown.js +17 -7
  43. package/Calendar/index.d.ts +1 -1
  44. package/Calendar/index.js +17 -7
  45. package/Checkbox/CheckboxAsterisk.js +17 -7
  46. package/Checkbox/CheckboxBox.d.ts +2 -2
  47. package/Checkbox/CheckboxBox.js +1 -1
  48. package/Checkbox/CheckboxContainer.d.ts +2 -2
  49. package/Checkbox/CheckboxErrorText.js +17 -7
  50. package/Checkbox/index.d.ts +10 -10
  51. package/Checkbox/index.js +1 -2
  52. package/Checkbox/useCheckboxColor.d.ts +1 -1
  53. package/ClickOutside/index.js +5 -2
  54. package/DatePicker/index.d.ts +1 -1
  55. package/ErrorBoundary/RenderError.js +17 -7
  56. package/ErrorBoundary/index.d.ts +1 -1
  57. package/Grid/index.d.ts +17 -5
  58. package/Grid/index.js +7 -2
  59. package/Highlighted/index.js +1 -2
  60. package/LoadingIndicator/LoadingOverlay.js +17 -7
  61. package/LoadingIndicator/Spinner.js +17 -7
  62. package/LoadingIndicator/SpinnerCircle.d.ts +2 -3
  63. package/Menu/MenuContainer.d.ts +2 -2
  64. package/Menu/MenuContainer.js +19 -10
  65. package/Menu/MenuItem.js +5 -1
  66. package/Menu/MenuList.js +1 -1
  67. package/Menu/context.d.ts +1 -1
  68. package/Menu/index.d.ts +1 -1
  69. package/Modal/BaseModal/ModalInner.js +2 -0
  70. package/Modal/BaseModal/ModalWrapper.js +30 -37
  71. package/Modal/BaseModal/context.d.ts +1 -1
  72. package/Modal/BaseModal/index.js +1 -2
  73. package/Modal/ConfirmBox/ConfirmBoxContent.js +5 -1
  74. package/Modal/ConfirmBox/ConfirmBoxFooter.js +5 -1
  75. package/Modal/ConfirmBox/ConfirmBoxHeader.js +5 -1
  76. package/Modal/ConfirmBox/index.js +1 -2
  77. package/Modal/Dialog/DialogInner.js +5 -1
  78. package/Modal/Dialog/index.js +18 -9
  79. package/Modal/Drawer/DrawerCloseIcon.js +17 -7
  80. package/Modal/Drawer/DrawerFooter.js +5 -1
  81. package/Modal/Drawer/DrawerHeader.d.ts +4 -4
  82. package/Modal/Drawer/DrawerHeader.js +5 -1
  83. package/Modal/Drawer/index.js +18 -9
  84. package/Modal/MessageBox/MessageBoxContent.js +5 -1
  85. package/Modal/MessageBox/MessageBoxFooter.js +5 -1
  86. package/Modal/MessageBox/MessageBoxHeader.js +5 -1
  87. package/Modal/MessageBox/index.js +18 -9
  88. package/Modal/index.js +17 -7
  89. package/Pagination/PaginationContainer.d.ts +9 -0
  90. package/Pagination/PaginationContainer.js +34 -0
  91. package/Pagination/PaginationGap.d.ts +4 -0
  92. package/Pagination/PaginationGap.js +22 -0
  93. package/Pagination/PaginationIcons.d.ts +6 -0
  94. package/Pagination/PaginationIcons.js +21 -0
  95. package/Pagination/PaginationItem.d.ts +44 -0
  96. package/Pagination/PaginationItem.js +59 -0
  97. package/Pagination/getPaginationItems.d.ts +22 -0
  98. package/Pagination/getPaginationItems.js +42 -0
  99. package/Pagination/index.d.ts +104 -0
  100. package/Pagination/index.js +98 -0
  101. package/Pagination/usePagination.d.ts +105 -0
  102. package/Pagination/usePagination.js +66 -0
  103. package/PhoneField/CountryFlagComponent.d.ts +1 -1
  104. package/PhoneField/UnknownFlag.d.ts +0 -1
  105. package/PhoneField/flags/BY.js +17 -7
  106. package/PhoneField/flags/CN.js +17 -7
  107. package/PhoneField/flags/IL.js +17 -7
  108. package/PhoneField/flags/JP.js +17 -7
  109. package/PhoneField/flags/KZ.js +17 -7
  110. package/PhoneField/flags/RU.js +17 -7
  111. package/PhoneField/flags/UA.js +17 -7
  112. package/PhoneField/flags/US.js +17 -7
  113. package/PhoneField/flags/Unknown.js +17 -7
  114. package/PhoneField/templates.d.ts +2 -2
  115. package/Popper/Popper.js +1 -2
  116. package/Radio/RadioBox.d.ts +1 -1
  117. package/Radio/RadioBox.js +1 -1
  118. package/Radio/RadioContainer.d.ts +2 -2
  119. package/Radio/index.d.ts +5 -5
  120. package/Radio/index.js +1 -2
  121. package/Radio/useRadioColor.d.ts +1 -1
  122. package/RadioGroup/RadioGroupAsterisk.js +17 -7
  123. package/RadioGroup/RadioGroupErrorText.js +17 -7
  124. package/RadioGroup/RadioGroupItems.d.ts +1 -1
  125. package/RadioGroup/index.d.ts +11 -11
  126. package/RadioGroup/index.js +1 -2
  127. package/Selectbox/SelectboxButton.d.ts +4 -4
  128. package/Selectbox/SelectboxButton.js +25 -10
  129. package/Selectbox/SelectboxButtonWrapper.d.ts +2 -2
  130. package/Selectbox/SelectboxButtonWrapper.js +19 -10
  131. package/Selectbox/SelectboxMenu.d.ts +2 -2
  132. package/Selectbox/SelectboxMenu.js +17 -7
  133. package/Selectbox/index.d.ts +2 -2
  134. package/Selectbox/index.js +18 -9
  135. package/Slider/SliderRail.d.ts +1 -1
  136. package/Slider/SliderThumb.d.ts +1 -1
  137. package/Slider/SliderTrack.d.ts +1 -1
  138. package/Slider/index.js +1 -2
  139. package/Slider/useSliderColor.d.ts +1 -1
  140. package/Stack/index.d.ts +18 -6
  141. package/Stack/index.js +7 -2
  142. package/Surface/SurfaceContainer.d.ts +3 -3
  143. package/Surface/SurfaceContainer.js +1 -1
  144. package/Surface/SurfaceContent.d.ts +2 -2
  145. package/Surface/SurfaceContent.js +18 -11
  146. package/Surface/SurfaceFooter.d.ts +2 -2
  147. package/Surface/SurfaceFooter.js +5 -1
  148. package/Surface/SurfaceHeader.d.ts +2 -2
  149. package/Surface/SurfaceHeader.js +6 -2
  150. package/Surface/SurfaceSubheader.d.ts +2 -2
  151. package/Surface/SurfaceSubheader.js +6 -2
  152. package/Surface/index.d.ts +10 -10
  153. package/Surface/index.js +18 -9
  154. package/Swiper/Swiper.d.ts +83 -15
  155. package/Swiper/Swiper.js +285 -143
  156. package/Swiper/SwiperContainer.d.ts +2 -2
  157. package/Swiper/SwiperSlide.js +20 -7
  158. package/Swiper/SwiperSlidesRenderer.d.ts +4 -0
  159. package/Swiper/SwiperSlidesRenderer.js +19 -8
  160. package/Swiper/SwiperTrack.d.ts +22 -2
  161. package/Swiper/SwiperTrack.js +45 -12
  162. package/Swiper/SwiperWrapper.d.ts +5 -2
  163. package/Swiper/SwiperWrapper.js +22 -11
  164. package/Switch/SwitchAsterisk.js +17 -7
  165. package/Switch/SwitchContainer.d.ts +2 -2
  166. package/Switch/SwitchDot.d.ts +1 -1
  167. package/Switch/SwitchDot.js +2 -4
  168. package/Switch/SwitchErrorText.js +17 -7
  169. package/Switch/SwitchTrack.d.ts +1 -1
  170. package/Switch/index.d.ts +9 -9
  171. package/Switch/index.js +1 -2
  172. package/Switch/useSwitchColor.d.ts +1 -1
  173. package/Table/Table.d.ts +1 -1
  174. package/Table/Table.js +1 -1
  175. package/Table/TableCaption.js +5 -1
  176. package/Table/TableCell.js +6 -2
  177. package/Table/TableFooter.js +2 -1
  178. package/Table/TableHeaderCell.js +6 -2
  179. package/Tabs/Tab.js +4 -1
  180. package/Tabs/TabPanel.d.ts +1 -1
  181. package/Tabs/Tabs.d.ts +7 -7
  182. package/Tabs/Tabs.js +1 -2
  183. package/Tabs/useTabsColor.d.ts +1 -1
  184. package/TextArea/TextAreaIconWrapper.d.ts +3 -3
  185. package/TextArea/TextAreaIconWrapper.js +17 -7
  186. package/TextArea/TextAreaInput.js +23 -8
  187. package/TextArea/index.js +18 -9
  188. package/TextField/TextFieldContainer.js +17 -7
  189. package/TextField/TextFieldErrorText.js +17 -7
  190. package/TextField/TextFieldIconWrapper.d.ts +3 -3
  191. package/TextField/TextFieldIconWrapper.js +17 -7
  192. package/TextField/TextFieldInput.js +23 -8
  193. package/TextField/TextFieldInputWrapper.d.ts +5 -5
  194. package/TextField/TextFieldInputWrapper.js +22 -9
  195. package/TextField/TextFieldLabel.js +17 -7
  196. package/TextField/TextFieldLabelAsterisk.js +17 -7
  197. package/TextField/index.d.ts +1 -1
  198. package/TextField/index.js +18 -9
  199. package/ThemeProvider/createTheme.js +7 -3
  200. package/ThemeProvider/index.d.ts +45 -12
  201. package/ThemeProvider/index.js +1 -4
  202. package/ThemeProvider/tokens.d.ts +54 -3
  203. package/ThemeProvider/tokens.js +61 -3
  204. package/Toast/ToastCard.js +5 -2
  205. package/Toast/ToastContainer.js +1 -2
  206. package/Tooltip/TooltipContainer.js +2 -0
  207. package/Tooltip/index.js +3 -4
  208. package/Typography/Base.d.ts +2 -3
  209. package/Typography/Blockquote.d.ts +2 -3
  210. package/Typography/List.d.ts +6 -7
  211. package/Typography/Paragraph.d.ts +1 -1
  212. package/Typography/Paragraph.js +17 -7
  213. package/Typography/SectionDescription.d.ts +2 -3
  214. package/Typography/U.d.ts +2 -3
  215. package/esm/Accordion/AccordionActions.js +2 -1
  216. package/esm/Accordion/AccordionContainer.js +2 -14
  217. package/esm/Accordion/AccordionContent.js +5 -1
  218. package/esm/Accordion/AccordionHeader.js +7 -3
  219. package/esm/Accordion/index.js +1 -2
  220. package/esm/Autocomplete/AutocompleteItem.js +2 -1
  221. package/esm/Avatar/index.js +1 -2
  222. package/esm/Badge/BadgeStyled.js +2 -2
  223. package/esm/Badge/index.js +1 -2
  224. package/esm/Button/ButtonContainer.js +23 -6
  225. package/esm/Button/buttonVariants.js +3 -2
  226. package/esm/Button/index.js +1 -20
  227. package/esm/ButtonGroup/index.js +4 -3
  228. package/esm/Calendar/CalendarComponent.js +1 -2
  229. package/esm/Calendar/CalendarPaper.js +1 -1
  230. package/esm/Checkbox/CheckboxBox.js +2 -2
  231. package/esm/Checkbox/index.js +1 -2
  232. package/esm/ClickOutside/index.js +5 -2
  233. package/esm/Grid/index.js +7 -2
  234. package/esm/Highlighted/index.js +1 -2
  235. package/esm/Menu/MenuContainer.js +2 -3
  236. package/esm/Menu/MenuItem.js +5 -1
  237. package/esm/Menu/MenuList.js +1 -1
  238. package/esm/Modal/BaseModal/ModalInner.js +2 -0
  239. package/esm/Modal/BaseModal/ModalWrapper.js +30 -37
  240. package/esm/Modal/BaseModal/index.js +1 -2
  241. package/esm/Modal/ConfirmBox/ConfirmBoxContent.js +5 -1
  242. package/esm/Modal/ConfirmBox/ConfirmBoxFooter.js +5 -1
  243. package/esm/Modal/ConfirmBox/ConfirmBoxHeader.js +5 -1
  244. package/esm/Modal/ConfirmBox/index.js +1 -2
  245. package/esm/Modal/Dialog/DialogInner.js +5 -1
  246. package/esm/Modal/Dialog/index.js +1 -2
  247. package/esm/Modal/Drawer/DrawerFooter.js +5 -1
  248. package/esm/Modal/Drawer/DrawerHeader.js +5 -1
  249. package/esm/Modal/Drawer/index.js +1 -2
  250. package/esm/Modal/MessageBox/MessageBoxContent.js +5 -1
  251. package/esm/Modal/MessageBox/MessageBoxFooter.js +5 -1
  252. package/esm/Modal/MessageBox/MessageBoxHeader.js +5 -1
  253. package/esm/Modal/MessageBox/index.js +1 -2
  254. package/esm/Pagination/PaginationContainer.js +29 -0
  255. package/esm/Pagination/PaginationGap.js +17 -0
  256. package/esm/Pagination/PaginationIcons.js +15 -0
  257. package/esm/Pagination/PaginationItem.js +54 -0
  258. package/esm/Pagination/getPaginationItems.js +40 -0
  259. package/esm/Pagination/index.js +77 -0
  260. package/esm/Pagination/usePagination.js +61 -0
  261. package/esm/Popper/Popper.js +1 -2
  262. package/esm/Radio/RadioBox.js +2 -2
  263. package/esm/Radio/index.js +1 -2
  264. package/esm/RadioGroup/index.js +1 -2
  265. package/esm/Selectbox/SelectboxButton.js +8 -3
  266. package/esm/Selectbox/SelectboxButtonWrapper.js +2 -3
  267. package/esm/Selectbox/index.js +1 -2
  268. package/esm/Slider/index.js +1 -2
  269. package/esm/Stack/index.js +7 -2
  270. package/esm/Surface/SurfaceContainer.js +1 -1
  271. package/esm/Surface/SurfaceContent.js +18 -11
  272. package/esm/Surface/SurfaceFooter.js +5 -1
  273. package/esm/Surface/SurfaceHeader.js +6 -2
  274. package/esm/Surface/SurfaceSubheader.js +6 -2
  275. package/esm/Surface/index.js +1 -2
  276. package/esm/Swiper/Swiper.js +268 -136
  277. package/esm/Swiper/SwiperSlide.js +3 -0
  278. package/esm/Swiper/SwiperSlidesRenderer.js +2 -1
  279. package/esm/Swiper/SwiperTrack.js +28 -5
  280. package/esm/Swiper/SwiperWrapper.js +5 -4
  281. package/esm/Switch/SwitchDot.js +2 -4
  282. package/esm/Switch/index.js +1 -2
  283. package/esm/Table/Table.js +1 -1
  284. package/esm/Table/TableCaption.js +5 -1
  285. package/esm/Table/TableCell.js +6 -2
  286. package/esm/Table/TableFooter.js +2 -1
  287. package/esm/Table/TableHeaderCell.js +6 -2
  288. package/esm/Tabs/Tab.js +5 -2
  289. package/esm/Tabs/Tabs.js +1 -2
  290. package/esm/TextArea/TextAreaInput.js +6 -1
  291. package/esm/TextArea/index.js +1 -2
  292. package/esm/TextField/TextFieldInput.js +6 -1
  293. package/esm/TextField/TextFieldInputWrapper.js +5 -2
  294. package/esm/TextField/index.js +1 -2
  295. package/esm/ThemeProvider/createTheme.js +7 -3
  296. package/esm/ThemeProvider/index.js +0 -2
  297. package/esm/ThemeProvider/tokens.js +55 -2
  298. package/esm/Toast/ToastCard.js +6 -3
  299. package/esm/Toast/ToastContainer.js +1 -2
  300. package/esm/Tooltip/TooltipContainer.js +2 -0
  301. package/esm/Tooltip/index.js +3 -4
  302. package/esm/utils/getElementRef.js +13 -0
  303. package/package.json +46 -11
  304. package/utils/getElementRef.d.ts +8 -0
  305. package/utils/getElementRef.js +18 -0
  306. package/ThemeProvider/components.d.ts +0 -79
  307. package/ThemeProvider/components.js +0 -3
  308. package/ThemeProvider/useThemeProps.d.ts +0 -7
  309. package/ThemeProvider/useThemeProps.js +0 -34
  310. package/esm/ThemeProvider/components.js +0 -2
  311. package/esm/ThemeProvider/useThemeProps.js +0 -29
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  var __rest = (this && this.__rest) || function (s, e) {
26
36
  var t = {};
27
37
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -45,9 +55,8 @@ const MessageBoxFooter_1 = __importDefault(require("./MessageBoxFooter"));
45
55
  const MessageBoxHeader_1 = __importDefault(require("./MessageBoxHeader"));
46
56
  const ModalOverlay_1 = __importDefault(require("../BaseModal/ModalOverlay"));
47
57
  const useDialogID_1 = __importDefault(require("../BaseModal/useDialogID"));
48
- const useThemeProps_1 = __importDefault(require("../../ThemeProvider/useThemeProps"));
49
58
  const MessageBox = props => {
50
- const _a = (0, useThemeProps_1.default)('MessageBox', props), { header, children, onRequestClose, overrides, okButtonLabel, isOpen } = _a, otherProps = __rest(_a, ["header", "children", "onRequestClose", "overrides", "okButtonLabel", "isOpen"]);
59
+ const { header, children, onRequestClose, overrides, okButtonLabel, isOpen } = props, otherProps = __rest(props, ["header", "children", "onRequestClose", "overrides", "okButtonLabel", "isOpen"]);
51
60
  const dialogID = (0, useDialogID_1.default)('dialog-message');
52
61
  const buttonRef = React.useRef(null);
53
62
  React.useEffect(() => {
package/Modal/index.js CHANGED
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
26
36
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
27
37
  };
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ export type PaginationSize = 'medium' | 'small';
3
+ export type PaginationContainerProps = React.HTMLAttributes<HTMLElement> & {
4
+ readonly size?: PaginationSize;
5
+ };
6
+ declare const _default: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLElement> & {
7
+ readonly size?: PaginationSize;
8
+ } & React.RefAttributes<HTMLElement>>;
9
+ export default _default;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ const react_1 = __importDefault(require("react"));
18
+ const styled_1 = __importDefault(require("@emotion/styled"));
19
+ /**
20
+ * The sizes of the buttons are in `em`, so the small variant only changes the font size.
21
+ * The height of the buttons is the height of the controls: `theme.padding.control`
22
+ */
23
+ const StyledNav = styled_1.default.nav `
24
+ display: inline-flex;
25
+ align-items: center;
26
+ flex-wrap: wrap;
27
+ gap: 0.5em;
28
+ font-size: ${({ $size }) => ($size === 'small' ? '0.8em' : '1em')};
29
+ `;
30
+ const PaginationContainer = (props, ref) => {
31
+ const { size = 'medium', children } = props, nativeProps = __rest(props, ["size", "children"]);
32
+ return (react_1.default.createElement(StyledNav, Object.assign({ "$size": size }, nativeProps, { ref: ref }), children));
33
+ };
34
+ exports.default = react_1.default.forwardRef(PaginationContainer);
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ export type PaginationGapProps = React.HTMLAttributes<HTMLSpanElement>;
3
+ declare const _default: React.ForwardRefExoticComponent<PaginationGapProps & React.RefAttributes<HTMLSpanElement>>;
4
+ export default _default;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const react_1 = __importDefault(require("react"));
7
+ const styled_1 = __importDefault(require("@emotion/styled"));
8
+ const tokens_1 = require("../ThemeProvider/tokens");
9
+ const StyledGap = styled_1.default.span `
10
+ display: inline-flex;
11
+ align-items: center;
12
+ justify-content: center;
13
+ min-width: 1.6em;
14
+ height: ${({ theme }) => (0, tokens_1.controlHeight)(theme)};
15
+ color: ${({ theme }) => theme.color.textSecondary.toString()};
16
+ user-select: none;
17
+ `;
18
+ /**
19
+ * The skipped range of the pages
20
+ */
21
+ const PaginationGap = (props, ref) => (react_1.default.createElement(StyledGap, Object.assign({ "aria-hidden": true }, props, { ref: ref }), "\u2026"));
22
+ exports.default = react_1.default.forwardRef(PaginationGap);
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ export type PaginationIconProps = React.SVGAttributes<SVGSVGElement>;
3
+ export declare const IconPrevious: React.ForwardRefExoticComponent<PaginationIconProps & React.RefAttributes<SVGSVGElement>>;
4
+ export declare const IconNext: React.ForwardRefExoticComponent<PaginationIconProps & React.RefAttributes<SVGSVGElement>>;
5
+ export declare const IconFirst: React.ForwardRefExoticComponent<PaginationIconProps & React.RefAttributes<SVGSVGElement>>;
6
+ export declare const IconLast: React.ForwardRefExoticComponent<PaginationIconProps & React.RefAttributes<SVGSVGElement>>;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.IconLast = exports.IconFirst = exports.IconNext = exports.IconPrevious = void 0;
7
+ const react_1 = __importDefault(require("react"));
8
+ const styled_1 = __importDefault(require("@emotion/styled"));
9
+ const Path = styled_1.default.path `
10
+ fill: currentColor;
11
+ `;
12
+ const createIcon = (path, displayName) => {
13
+ const Icon = (props, ref) => (react_1.default.createElement("svg", Object.assign({ xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 24 24", "aria-hidden": true }, props, { ref: ref }),
14
+ react_1.default.createElement(Path, { d: path })));
15
+ Icon.displayName = displayName;
16
+ return react_1.default.forwardRef(Icon);
17
+ };
18
+ exports.IconPrevious = createIcon('M15.41,16.58L10.83,12L15.41,7.41L14,6L8,12L14,18L15.41,16.58Z', 'IconPrevious');
19
+ exports.IconNext = createIcon('M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z', 'IconNext');
20
+ exports.IconFirst = createIcon('M18.41,16.59L13.82,12L18.41,7.41L17,6L11,12L17,18L18.41,16.59M12.41,16.59L7.82,12L12.41,7.41L11,6L5,12L11,18L12.41,16.59Z', 'IconFirst');
21
+ exports.IconLast = createIcon('M5.59,7.41L10.18,12L5.59,16.59L7,18L13,12L7,6L5.59,7.41M11.59,7.41L16.18,12L11.59,16.59L13,18L19,12L13,6L11.59,7.41Z', 'IconLast');
@@ -0,0 +1,44 @@
1
+ import React from 'react';
2
+ import { ButtonProps } from '../Button';
3
+ import type { PaginationItemKind } from './usePagination';
4
+ export type PaginationItemProps = ButtonProps & {
5
+ /**
6
+ * What the button does: opens a page or goes to the first, previous, next or last page
7
+ */
8
+ readonly kind: PaginationItemKind;
9
+ /**
10
+ * The page the button opens, starts from 1
11
+ */
12
+ readonly page: number;
13
+ /**
14
+ * The button of the current page
15
+ */
16
+ readonly selected?: boolean;
17
+ /**
18
+ * The not selected page in the `standard` variant: a soft fill instead of the surface color,
19
+ * so the buttons are visible on the surface
20
+ */
21
+ readonly soft?: boolean;
22
+ };
23
+ declare const _default: React.ForwardRefExoticComponent<import("../Button/ButtonBase").ButtonBaseProps & {
24
+ readonly variant?: "standard" | "outlined" | "plain";
25
+ } & {
26
+ /**
27
+ * What the button does: opens a page or goes to the first, previous, next or last page
28
+ */
29
+ readonly kind: PaginationItemKind;
30
+ /**
31
+ * The page the button opens, starts from 1
32
+ */
33
+ readonly page: number;
34
+ /**
35
+ * The button of the current page
36
+ */
37
+ readonly selected?: boolean;
38
+ /**
39
+ * The not selected page in the `standard` variant: a soft fill instead of the surface color,
40
+ * so the buttons are visible on the surface
41
+ */
42
+ readonly soft?: boolean;
43
+ } & React.RefAttributes<HTMLButtonElement>>;
44
+ export default _default;
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ const react_1 = __importDefault(require("react"));
18
+ const styled_1 = __importDefault(require("@emotion/styled"));
19
+ const react_2 = require("@emotion/react");
20
+ const Button_1 = __importDefault(require("../Button"));
21
+ const tokens_1 = require("../ThemeProvider/tokens");
22
+ /**
23
+ * `&&` raises the specificity above the own styles of the button.
24
+ * The button is a square of the height of the controls, the numbers of several digits make it wider
25
+ */
26
+ const StyledButton = (0, styled_1.default)(Button_1.default) `
27
+ && {
28
+ box-sizing: border-box;
29
+ min-width: ${({ theme }) => (0, tokens_1.controlHeight)(theme)};
30
+ height: ${({ theme }) => (0, tokens_1.controlHeight)(theme)};
31
+ padding: 0 0.6em;
32
+ justify-content: center;
33
+ font-variant-numeric: tabular-nums;
34
+ }
35
+
36
+ ${({ $soft, disabled, theme }) => $soft &&
37
+ (0, react_2.css) `
38
+ && {
39
+ background-color: ${theme.color.textPrimary.alpha(0.06).toString()};
40
+ color: ${disabled
41
+ ? theme.color.textPrimary.alpha(0.3).toString()
42
+ : theme.color.textPrimary.toString()};
43
+ }
44
+
45
+ &&:hover {
46
+ background-color: ${disabled
47
+ ? theme.color.textPrimary.alpha(0.06).toString()
48
+ : theme.color.textPrimary.alpha(0.1).toString()};
49
+ }
50
+ `}
51
+ `;
52
+ /**
53
+ * The button of the page or of the navigation (first, previous, next, last)
54
+ */
55
+ const PaginationItem = (props, ref) => {
56
+ const { selected, soft, kind, page } = props, buttonProps = __rest(props, ["selected", "soft", "kind", "page"]);
57
+ return (react_1.default.createElement(StyledButton, Object.assign({ type: "button", "aria-current": selected ? 'page' : undefined, "data-kind": kind, "$soft": Boolean(soft) }, buttonProps, { ref: ref })));
58
+ };
59
+ exports.default = react_1.default.forwardRef(PaginationItem);
@@ -0,0 +1,22 @@
1
+ export type PaginationItemType = 'page' | 'gap-start' | 'gap-end';
2
+ export type PaginationItemData = {
3
+ readonly type: 'page';
4
+ readonly page: number;
5
+ } | {
6
+ readonly type: 'gap-start' | 'gap-end';
7
+ };
8
+ /**
9
+ * Returns the items of the pagination: the boundary pages, the current page with the siblings
10
+ * and the gaps instead of the skipped ranges. The pages start from 1.
11
+ * The count of the items does not depend on the current page, so the buttons do not jump
12
+ *
13
+ * @example getPaginationItems({ count: 10, page: 5, siblings: 1, boundaries: 1 })
14
+ * // 1 … 4 5 6 … 10
15
+ */
16
+ declare const getPaginationItems: (params: {
17
+ readonly count: number;
18
+ readonly page: number;
19
+ readonly siblings: number;
20
+ readonly boundaries: number;
21
+ }) => PaginationItemData[];
22
+ export default getPaginationItems;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const range = (start, end) => Array.from({ length: Math.max(end - start + 1, 0) }, (_, index) => start + index);
4
+ /**
5
+ * Returns the items of the pagination: the boundary pages, the current page with the siblings
6
+ * and the gaps instead of the skipped ranges. The pages start from 1.
7
+ * The count of the items does not depend on the current page, so the buttons do not jump
8
+ *
9
+ * @example getPaginationItems({ count: 10, page: 5, siblings: 1, boundaries: 1 })
10
+ * // 1 … 4 5 6 … 10
11
+ */
12
+ const getPaginationItems = (params) => {
13
+ const { count, siblings, boundaries } = params;
14
+ const page = Math.min(Math.max(params.page, 1), Math.max(count, 1));
15
+ // boundaries on both sides + current + siblings + two gaps
16
+ if (count <= boundaries * 2 + siblings * 2 + 3) {
17
+ return range(1, count).map(item => ({ type: 'page', page: item }));
18
+ }
19
+ const startPages = range(1, boundaries);
20
+ const endPages = range(count - boundaries + 1, count);
21
+ // the window of the siblings keeps its size near the start and the end
22
+ const siblingsStart = Math.max(Math.min(page - siblings, count - boundaries - siblings * 2 - 1), boundaries + 2);
23
+ const siblingsEnd = Math.min(Math.max(page + siblings, boundaries + siblings * 2 + 2), count - boundaries - 1);
24
+ const items = startPages.map(item => ({ type: 'page', page: item }));
25
+ // a gap of one page is shown as the page itself
26
+ if (siblingsStart > boundaries + 2) {
27
+ items.push({ type: 'gap-start' });
28
+ }
29
+ else if (boundaries + 1 < count - boundaries) {
30
+ items.push({ type: 'page', page: boundaries + 1 });
31
+ }
32
+ range(siblingsStart, siblingsEnd).forEach(item => items.push({ type: 'page', page: item }));
33
+ if (siblingsEnd < count - boundaries - 1) {
34
+ items.push({ type: 'gap-end' });
35
+ }
36
+ else if (count - boundaries > boundaries) {
37
+ items.push({ type: 'page', page: count - boundaries });
38
+ }
39
+ endPages.forEach(item => items.push({ type: 'page', page: item }));
40
+ return items;
41
+ };
42
+ exports.default = getPaginationItems;
@@ -0,0 +1,104 @@
1
+ import React from 'react';
2
+ import type { ButtonProps } from '../Button';
3
+ import { PaginationContainerProps, PaginationSize } from './PaginationContainer';
4
+ import { PaginationItemProps } from './PaginationItem';
5
+ import { PaginationGapProps } from './PaginationGap';
6
+ import usePagination, { UsePaginationParams, PaginationItemKind } from './usePagination';
7
+ import getPaginationItems from './getPaginationItems';
8
+ export * from './usePagination';
9
+ export * from './PaginationContainer';
10
+ export * from './PaginationItem';
11
+ export * from './PaginationGap';
12
+ export * from './PaginationIcons';
13
+ export * from './getPaginationItems';
14
+ export { usePagination, getPaginationItems };
15
+ type ButtonVariant = NonNullable<ButtonProps['variant']>;
16
+ export type PaginationColor = 'default' | 'primary' | 'secondary' | string;
17
+ export type PaginationProps = Omit<React.HTMLAttributes<HTMLElement>, 'onChange' | 'color'> & UsePaginationParams & {
18
+ /**
19
+ * The variant of the not selected page buttons\
20
+ * **Default:** `standard`
21
+ */
22
+ readonly variant?: ButtonVariant;
23
+ /**
24
+ * The color of the selected page button\
25
+ * **Default:** `primary`
26
+ */
27
+ readonly color?: PaginationColor;
28
+ /**
29
+ * The variant of the navigation buttons (first, previous, next, last)\
30
+ * **Default:** `outlined`
31
+ */
32
+ readonly navigationVariant?: ButtonVariant;
33
+ /**
34
+ * The color of the navigation buttons\
35
+ * **Default:** the `color` for the `standard` navigation variant, otherwise `default`
36
+ */
37
+ readonly navigationColor?: PaginationColor;
38
+ /**
39
+ * `small` — the compact variant\
40
+ * **Default:** `medium`
41
+ */
42
+ readonly size?: PaginationSize;
43
+ /**
44
+ * Returns the label of the button for the screen readers\
45
+ * **Default:** the english labels, e.g. «Go to page 3»
46
+ */
47
+ readonly getItemLabel?: (kind: PaginationItemKind, page: number, selected: boolean) => string;
48
+ /**
49
+ * Overridable components map
50
+ */
51
+ readonly overrides?: PaginationOverrides;
52
+ };
53
+ export interface PaginationOverrides {
54
+ /**
55
+ * The `<nav>` around the buttons
56
+ */
57
+ readonly Container?: React.ComponentType<PaginationContainerProps & React.RefAttributes<HTMLElement>>;
58
+ /**
59
+ * The button of the page and the navigation buttons. Gets the `kind` and the `page` it opens:
60
+ * e.g. render a link of your router instead of the button
61
+ */
62
+ readonly Item?: React.ComponentType<PaginationItemProps & React.RefAttributes<HTMLButtonElement>>;
63
+ /**
64
+ * The skipped range of the pages, `…`
65
+ */
66
+ readonly Gap?: React.ComponentType<PaginationGapProps & React.RefAttributes<HTMLSpanElement>>;
67
+ }
68
+ declare const _default: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<HTMLElement>, "color" | "onChange"> & UsePaginationParams & {
69
+ /**
70
+ * The variant of the not selected page buttons\
71
+ * **Default:** `standard`
72
+ */
73
+ readonly variant?: ButtonVariant;
74
+ /**
75
+ * The color of the selected page button\
76
+ * **Default:** `primary`
77
+ */
78
+ readonly color?: PaginationColor;
79
+ /**
80
+ * The variant of the navigation buttons (first, previous, next, last)\
81
+ * **Default:** `outlined`
82
+ */
83
+ readonly navigationVariant?: ButtonVariant;
84
+ /**
85
+ * The color of the navigation buttons\
86
+ * **Default:** the `color` for the `standard` navigation variant, otherwise `default`
87
+ */
88
+ readonly navigationColor?: PaginationColor;
89
+ /**
90
+ * `small` — the compact variant\
91
+ * **Default:** `medium`
92
+ */
93
+ readonly size?: PaginationSize;
94
+ /**
95
+ * Returns the label of the button for the screen readers\
96
+ * **Default:** the english labels, e.g. «Go to page 3»
97
+ */
98
+ readonly getItemLabel?: (kind: PaginationItemKind, page: number, selected: boolean) => string;
99
+ /**
100
+ * Overridable components map
101
+ */
102
+ readonly overrides?: PaginationOverrides;
103
+ } & React.RefAttributes<HTMLElement>>;
104
+ export default _default;
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ var __rest = (this && this.__rest) || function (s, e) {
17
+ var t = {};
18
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
19
+ t[p] = s[p];
20
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
21
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
22
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
23
+ t[p[i]] = s[p[i]];
24
+ }
25
+ return t;
26
+ };
27
+ var __importDefault = (this && this.__importDefault) || function (mod) {
28
+ return (mod && mod.__esModule) ? mod : { "default": mod };
29
+ };
30
+ Object.defineProperty(exports, "__esModule", { value: true });
31
+ exports.getPaginationItems = exports.usePagination = void 0;
32
+ const react_1 = __importDefault(require("react"));
33
+ const PaginationContainer_1 = __importDefault(require("./PaginationContainer"));
34
+ const PaginationItem_1 = __importDefault(require("./PaginationItem"));
35
+ const PaginationGap_1 = __importDefault(require("./PaginationGap"));
36
+ const PaginationIcons_1 = require("./PaginationIcons");
37
+ const usePagination_1 = __importDefault(require("./usePagination"));
38
+ exports.usePagination = usePagination_1.default;
39
+ const getPaginationItems_1 = __importDefault(require("./getPaginationItems"));
40
+ exports.getPaginationItems = getPaginationItems_1.default;
41
+ __exportStar(require("./usePagination"), exports);
42
+ __exportStar(require("./PaginationContainer"), exports);
43
+ __exportStar(require("./PaginationItem"), exports);
44
+ __exportStar(require("./PaginationGap"), exports);
45
+ __exportStar(require("./PaginationIcons"), exports);
46
+ __exportStar(require("./getPaginationItems"), exports);
47
+ const defaultGetItemLabel = (kind, page, selected) => {
48
+ switch (kind) {
49
+ case 'first':
50
+ return 'Go to first page';
51
+ case 'previous':
52
+ return 'Go to previous page';
53
+ case 'next':
54
+ return 'Go to next page';
55
+ case 'last':
56
+ return 'Go to last page';
57
+ default:
58
+ return selected ? `Page ${page}` : `Go to page ${page}`;
59
+ }
60
+ };
61
+ const navigationIcons = {
62
+ first: react_1.default.createElement(PaginationIcons_1.IconFirst, null),
63
+ previous: react_1.default.createElement(PaginationIcons_1.IconPrevious, null),
64
+ next: react_1.default.createElement(PaginationIcons_1.IconNext, null),
65
+ last: react_1.default.createElement(PaginationIcons_1.IconLast, null),
66
+ };
67
+ const Pagination = (props, ref) => {
68
+ const { count, page, defaultPage, onChange, siblings, boundaries, showPrevNext, showFirstLast, disabled, variant = 'standard', color = 'primary', navigationVariant = 'outlined', navigationColor, size = 'medium', getItemLabel = defaultGetItemLabel, overrides, 'aria-label': ariaLabel = 'Pagination' } = props, nativeProps = __rest(props, ["count", "page", "defaultPage", "onChange", "siblings", "boundaries", "showPrevNext", "showFirstLast", "disabled", "variant", "color", "navigationVariant", "navigationColor", "size", "getItemLabel", "overrides", 'aria-label']);
69
+ const { items } = (0, usePagination_1.default)({
70
+ count,
71
+ page,
72
+ defaultPage,
73
+ onChange,
74
+ siblings,
75
+ boundaries,
76
+ showPrevNext,
77
+ showFirstLast,
78
+ disabled,
79
+ });
80
+ const overridesMap = react_1.default.useMemo(() => ({
81
+ Container: (overrides === null || overrides === void 0 ? void 0 : overrides.Container) || PaginationContainer_1.default,
82
+ Item: (overrides === null || overrides === void 0 ? void 0 : overrides.Item) || PaginationItem_1.default,
83
+ Gap: (overrides === null || overrides === void 0 ? void 0 : overrides.Gap) || PaginationGap_1.default,
84
+ }), [overrides]);
85
+ const navColor = navigationColor !== null && navigationColor !== void 0 ? navigationColor : (navigationVariant === 'standard' ? color : 'default');
86
+ return (react_1.default.createElement(overridesMap.Container, Object.assign({ size: size, "aria-label": ariaLabel }, nativeProps, { ref: ref }), items.map(item => {
87
+ if (item.type === 'gap') {
88
+ return react_1.default.createElement(overridesMap.Gap, { key: `gap-${item.position}` });
89
+ }
90
+ const label = getItemLabel(item.type, item.page, item.selected);
91
+ if (item.type !== 'page') {
92
+ // The disabled navigation button gets the soft fill, as the not selected page
93
+ return (react_1.default.createElement(overridesMap.Item, { key: item.type, kind: item.type, page: item.page, variant: item.disabled ? 'standard' : navigationVariant, color: item.disabled ? 'default' : navColor, soft: item.disabled, disabled: item.disabled, "aria-label": label, onClick: item.onClick }, navigationIcons[item.type]));
94
+ }
95
+ return (react_1.default.createElement(overridesMap.Item, { key: item.page, kind: "page", page: item.page, selected: item.selected, variant: item.selected ? 'standard' : variant, color: item.selected ? color : 'default', soft: !item.selected && variant === 'standard', disabled: item.disabled, "aria-label": label, onClick: item.onClick }, item.page));
96
+ })));
97
+ };
98
+ exports.default = react_1.default.forwardRef(Pagination);
@@ -0,0 +1,105 @@
1
+ import React from 'react';
2
+ export type PaginationItemKind = 'page' | 'first' | 'previous' | 'next' | 'last';
3
+ export type PaginationNavigationKind = Exclude<PaginationItemKind, 'page'>;
4
+ /**
5
+ * The button of the pagination: a page or a navigation button
6
+ */
7
+ export type PaginationButtonEntry = {
8
+ readonly type: PaginationItemKind;
9
+ /**
10
+ * The page the button opens, starts from 1
11
+ */
12
+ readonly page: number;
13
+ /**
14
+ * The button of the current page. The navigation buttons are never selected
15
+ */
16
+ readonly selected: boolean;
17
+ /**
18
+ * The button does nothing: the whole pagination is disabled
19
+ * or the navigation button leads out of the pages or to the current page
20
+ */
21
+ readonly disabled: boolean;
22
+ /**
23
+ * Opens the `page`
24
+ */
25
+ readonly onClick: (event: React.SyntheticEvent) => void;
26
+ };
27
+ /**
28
+ * The skipped range of the pages
29
+ */
30
+ export type PaginationGapEntry = {
31
+ readonly type: 'gap';
32
+ /**
33
+ * The gap before the current page or after it
34
+ */
35
+ readonly position: 'start' | 'end';
36
+ };
37
+ export type PaginationEntry = PaginationButtonEntry | PaginationGapEntry;
38
+ export type UsePaginationParams = {
39
+ /**
40
+ * Total count of the pages
41
+ */
42
+ readonly count: number;
43
+ /**
44
+ * The current page of the controlled pagination, starts from 1
45
+ */
46
+ readonly page?: number;
47
+ /**
48
+ * The initial page of the uncontrolled pagination\
49
+ * **Default:** `1`
50
+ */
51
+ readonly defaultPage?: number;
52
+ /**
53
+ * Called with the selected page
54
+ */
55
+ readonly onChange?: (page: number, event: React.SyntheticEvent) => void;
56
+ /**
57
+ * Count of the pages shown on each side of the current one\
58
+ * **Default:** `1`
59
+ */
60
+ readonly siblings?: number;
61
+ /**
62
+ * Count of the pages always shown at the start and at the end\
63
+ * **Default:** `1`
64
+ */
65
+ readonly boundaries?: number;
66
+ /**
67
+ * Show the previous and the next buttons\
68
+ * **Default:** `true`
69
+ */
70
+ readonly showPrevNext?: boolean;
71
+ /**
72
+ * Show the first and the last buttons\
73
+ * **Default:** `false`
74
+ */
75
+ readonly showFirstLast?: boolean;
76
+ /**
77
+ * Disables all the buttons
78
+ */
79
+ readonly disabled?: boolean;
80
+ };
81
+ export type UsePaginationResult = {
82
+ /**
83
+ * The current page, starts from 1. Always in the range of the pages
84
+ */
85
+ readonly page: number;
86
+ /**
87
+ * The count of the pages, at least 1
88
+ */
89
+ readonly count: number;
90
+ /**
91
+ * The buttons and the gaps in the order of the display
92
+ */
93
+ readonly items: readonly PaginationEntry[];
94
+ /**
95
+ * Opens the page: calls `onChange`, and changes the page of the uncontrolled pagination.
96
+ * The pages out of the range, the current page and any page of the disabled pagination are ignored
97
+ */
98
+ readonly setPage: (page: number, event: React.SyntheticEvent) => void;
99
+ };
100
+ /**
101
+ * The logic of the pagination without the markup: the current page, the buttons and the gaps.
102
+ * `<Pagination>` is built on it, use it for the pagination of your own design
103
+ */
104
+ declare const usePagination: (params: UsePaginationParams) => UsePaginationResult;
105
+ export default usePagination;