@pingux/astro 2.119.0-alpha.2 → 2.119.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/components/Button/Buttons.styles.d.ts +40 -0
- package/lib/cjs/components/Button/Buttons.styles.js +4 -0
- package/lib/cjs/components/ListView/ListView.stories.d.ts +3 -0
- package/lib/cjs/components/ListView/ListView.stories.js +2 -1
- package/lib/cjs/components/Pagination/Pagination.d.ts +4 -0
- package/lib/cjs/components/Pagination/Pagination.js +78 -0
- package/lib/cjs/components/Pagination/Pagination.mdx +68 -0
- package/lib/cjs/components/Pagination/Pagination.stories.d.ts +39 -0
- package/lib/cjs/components/Pagination/Pagination.stories.js +159 -0
- package/lib/cjs/components/Pagination/Pagination.styles.d.ts +17 -0
- package/lib/cjs/components/Pagination/Pagination.styles.js +27 -0
- package/lib/cjs/components/Pagination/Pagination.test.d.ts +1 -0
- package/lib/cjs/components/Pagination/Pagination.test.js +208 -0
- package/lib/cjs/components/Pagination/PaginationProvider.d.ts +4 -0
- package/lib/cjs/components/Pagination/PaginationProvider.js +38 -0
- package/lib/cjs/components/Pagination/index.d.ts +2 -0
- package/lib/cjs/components/Pagination/index.js +33 -0
- package/lib/cjs/context/PaginationContext/index.d.ts +10 -0
- package/lib/cjs/context/PaginationContext/index.js +20 -0
- package/lib/cjs/hooks/index.d.ts +2 -0
- package/lib/cjs/hooks/index.js +14 -0
- package/lib/cjs/hooks/usePagination/index.d.ts +1 -0
- package/lib/cjs/hooks/usePagination/index.js +14 -0
- package/lib/cjs/hooks/usePagination/usePagination.d.ts +682 -0
- package/lib/cjs/hooks/usePagination/usePagination.js +178 -0
- package/lib/cjs/hooks/usePaginationState/index.d.ts +1 -0
- package/lib/cjs/hooks/usePaginationState/index.js +14 -0
- package/lib/cjs/hooks/usePaginationState/usePaginationState.d.ts +4 -0
- package/lib/cjs/hooks/usePaginationState/usePaginationState.js +18 -0
- package/lib/cjs/index.d.ts +3 -0
- package/lib/cjs/index.js +24 -0
- package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/buttons.d.ts +3 -0
- package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/buttons.js +3 -0
- package/lib/cjs/styles/themes/next-gen/convertedComponentList.js +1 -1
- package/lib/cjs/styles/themes/next-gen/next-gen.d.ts +17 -0
- package/lib/cjs/styles/themes/next-gen/variants/button.d.ts +17 -0
- package/lib/cjs/styles/themes/next-gen/variants/button.js +7 -1
- package/lib/cjs/styles/variants/variants.js +3 -1
- package/lib/cjs/types/pagination.d.ts +46 -0
- package/lib/cjs/types/pagination.js +6 -0
- package/lib/components/Button/Buttons.styles.js +4 -0
- package/lib/components/ListView/ListView.stories.js +1 -1
- package/lib/components/Pagination/Pagination.js +64 -0
- package/lib/components/Pagination/Pagination.mdx +68 -0
- package/lib/components/Pagination/Pagination.stories.js +141 -0
- package/lib/components/Pagination/Pagination.styles.js +19 -0
- package/lib/components/Pagination/Pagination.test.js +205 -0
- package/lib/components/Pagination/PaginationProvider.js +24 -0
- package/lib/components/Pagination/index.js +2 -0
- package/lib/context/PaginationContext/index.js +11 -0
- package/lib/hooks/index.js +2 -0
- package/lib/hooks/usePagination/index.js +1 -0
- package/lib/hooks/usePagination/usePagination.js +170 -0
- package/lib/hooks/usePaginationState/index.js +1 -0
- package/lib/hooks/usePaginationState/usePaginationState.js +10 -0
- package/lib/index.js +3 -0
- package/lib/styles/themeOverrides/nextGenDarkMode/variants/buttons.js +3 -0
- package/lib/styles/themes/next-gen/convertedComponentList.js +1 -1
- package/lib/styles/themes/next-gen/variants/button.js +7 -1
- package/lib/styles/variants/variants.js +3 -1
- package/lib/types/pagination.js +1 -0
- package/package.json +1 -1
@@ -712,6 +712,46 @@ declare const _default: {
|
|
712
712
|
flexShrink: number;
|
713
713
|
whiteSpace: string;
|
714
714
|
};
|
715
|
+
paginationMenu: {
|
716
|
+
fontWeight: number;
|
717
|
+
lineHeight: string;
|
718
|
+
textDecoration: string;
|
719
|
+
display: string;
|
720
|
+
justifyContent: string;
|
721
|
+
width: string;
|
722
|
+
'&.is-current': {
|
723
|
+
cursor: string;
|
724
|
+
color: string;
|
725
|
+
};
|
726
|
+
'&.is-focused': {
|
727
|
+
boxShadow: string;
|
728
|
+
outline: string;
|
729
|
+
outlineColor: string;
|
730
|
+
outlineOffset: string;
|
731
|
+
};
|
732
|
+
bg: string;
|
733
|
+
border: string;
|
734
|
+
borderColor: string;
|
735
|
+
color: string;
|
736
|
+
height: string;
|
737
|
+
padding: string;
|
738
|
+
'&.is-hovered': {
|
739
|
+
textDecoration: string;
|
740
|
+
};
|
741
|
+
fontSize: string;
|
742
|
+
fontFamily: string;
|
743
|
+
overflowWrap: import("../..").overflowWrap;
|
744
|
+
maxWidth: string;
|
745
|
+
wordWrap: import("../..").wordWrap;
|
746
|
+
wordBreak: import("../..").wordBreak;
|
747
|
+
cursor: string;
|
748
|
+
minWidth: string;
|
749
|
+
outline: string;
|
750
|
+
alignItems: string;
|
751
|
+
borderRadius: string;
|
752
|
+
flexShrink: number;
|
753
|
+
whiteSpace: string;
|
754
|
+
};
|
715
755
|
primary: {
|
716
756
|
display: string;
|
717
757
|
bg: string;
|
@@ -289,6 +289,9 @@ var exampleText = _objectSpread(_objectSpread({}, base), {}, {
|
|
289
289
|
background: 'none',
|
290
290
|
'&.is-focused': _objectSpread({}, defaultFocus)
|
291
291
|
});
|
292
|
+
var paginationMenu = _objectSpread(_objectSpread({}, link), {}, {
|
293
|
+
fontWeight: 0
|
294
|
+
});
|
292
295
|
var _default = {
|
293
296
|
colorBlock: colorBlock,
|
294
297
|
colorBlockPrimary: colorBlockPrimary,
|
@@ -309,6 +312,7 @@ var _default = {
|
|
309
312
|
inlinePrimaryWithIcon: inlinePrimaryWithIcon,
|
310
313
|
inlineWithIcon: inlineWithIcon,
|
311
314
|
link: link,
|
315
|
+
paginationMenu: paginationMenu,
|
312
316
|
primary: primary,
|
313
317
|
primaryWithIcon: primaryWithIcon,
|
314
318
|
quiet: quiet,
|
@@ -21,7 +21,7 @@ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequ
|
|
21
21
|
_Object$defineProperty(exports, "__esModule", {
|
22
22
|
value: true
|
23
23
|
});
|
24
|
-
exports["default"] = exports.WithExpandableItems = exports.WithCharts = exports.OnLoadPrev = exports.InfiniteLoadingList = exports.Default = exports.ControlledExpandableItems = void 0;
|
24
|
+
exports["default"] = exports.animals = exports.WithExpandableItems = exports.WithCharts = exports.OnLoadPrev = exports.InfiniteLoadingList = exports.Default = exports.ControlledExpandableItems = void 0;
|
25
25
|
var _from = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/from"));
|
26
26
|
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
27
27
|
var _indexOf = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
|
@@ -538,6 +538,7 @@ var animals = [{
|
|
538
538
|
}, {
|
539
539
|
name: 'Zebra'
|
540
540
|
}];
|
541
|
+
exports.animals = animals;
|
541
542
|
var props = {
|
542
543
|
disabledKeys: ['Snake']
|
543
544
|
};
|
@@ -0,0 +1,78 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _typeof = require("@babel/runtime-corejs3/helpers/typeof");
|
4
|
+
var _WeakMap = require("@babel/runtime-corejs3/core-js-stable/weak-map");
|
5
|
+
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
6
|
+
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
|
7
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
8
|
+
_Object$defineProperty(exports, "__esModule", {
|
9
|
+
value: true
|
10
|
+
});
|
11
|
+
exports["default"] = void 0;
|
12
|
+
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
13
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
14
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectWithoutProperties"));
|
15
|
+
var _react = _interopRequireWildcard(require("react"));
|
16
|
+
var _ChevronLeftIcon = _interopRequireDefault(require("@pingux/mdi-react/ChevronLeftIcon"));
|
17
|
+
var _ChevronRightIcon = _interopRequireDefault(require("@pingux/mdi-react/ChevronRightIcon"));
|
18
|
+
var _hooks = require("../../hooks");
|
19
|
+
var _usePagination2 = _interopRequireDefault(require("../../hooks/usePagination"));
|
20
|
+
var _index = require("../../index");
|
21
|
+
var _react2 = require("@emotion/react");
|
22
|
+
var _excluded = ["setOffsetCount", "offsetOptions"];
|
23
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
24
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = _Object$defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { _Object$defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
25
|
+
var RangeSelectPopover = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
26
|
+
var state = props.state,
|
27
|
+
buttonProps = props.buttonProps;
|
28
|
+
var setOffsetCount = state.setOffsetCount,
|
29
|
+
offsetOptions = state.offsetOptions,
|
30
|
+
others = (0, _objectWithoutProperties2["default"])(state, _excluded);
|
31
|
+
var menuRef = (0, _hooks.useLocalOrForwardRef)(ref);
|
32
|
+
return (0, _react2.jsx)(_index.OverlayProvider, null, (0, _react2.jsx)(_index.Box, {
|
33
|
+
sx: {
|
34
|
+
flexGrow: 1
|
35
|
+
}
|
36
|
+
}, (0, _react2.jsx)(_index.PopoverMenu, {
|
37
|
+
ref: menuRef
|
38
|
+
}, (0, _react2.jsx)(_index.Button, (0, _extends2["default"])({}, buttonProps, {
|
39
|
+
variant: "paginationMenu"
|
40
|
+
}), state.popoverButtonString), (0, _react2.jsx)(_index.Menu, (0, _extends2["default"])({
|
41
|
+
onSelectionChange: setOffsetCount,
|
42
|
+
selectionMode: "single"
|
43
|
+
}, others), (0, _map["default"])(offsetOptions).call(offsetOptions, function (option) {
|
44
|
+
return (0, _react2.jsx)(_index.Item, {
|
45
|
+
key: option,
|
46
|
+
textValue: "".concat(option)
|
47
|
+
}, "Show", ' ', option, ' ', "Results");
|
48
|
+
})))));
|
49
|
+
});
|
50
|
+
var Pagination = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
51
|
+
var _usePagination = (0, _usePagination2["default"])(props),
|
52
|
+
state = _usePagination.state,
|
53
|
+
previousButtonProps = _usePagination.previousButtonProps,
|
54
|
+
nextButtonProps = _usePagination.nextButtonProps,
|
55
|
+
containerProps = _usePagination.containerProps,
|
56
|
+
offsetMenuProps = _usePagination.offsetMenuProps;
|
57
|
+
var paginationRef = (0, _hooks.useLocalOrForwardRef)(ref);
|
58
|
+
return (0, _react2.jsx)(_index.Box, (0, _extends2["default"])({
|
59
|
+
isRow: true,
|
60
|
+
variant: "pagination.container"
|
61
|
+
}, containerProps, {
|
62
|
+
ref: paginationRef
|
63
|
+
}), (0, _react2.jsx)(_index.Box, {
|
64
|
+
variant: "pagination.wrapper",
|
65
|
+
isRow: true
|
66
|
+
}, (0, _react2.jsx)(RangeSelectPopover, (0, _extends2["default"])({}, offsetMenuProps, {
|
67
|
+
state: state
|
68
|
+
})), (0, _react2.jsx)(_index.Box, {
|
69
|
+
variant: "pagination.iconWrapper",
|
70
|
+
isRow: true
|
71
|
+
}, (0, _react2.jsx)(_index.IconButton, previousButtonProps, (0, _react2.jsx)(_index.Icon, {
|
72
|
+
icon: _ChevronLeftIcon["default"]
|
73
|
+
})), (0, _react2.jsx)(_index.IconButton, nextButtonProps, (0, _react2.jsx)(_index.Icon, {
|
74
|
+
icon: _ChevronRightIcon["default"]
|
75
|
+
})))));
|
76
|
+
});
|
77
|
+
var _default = Pagination;
|
78
|
+
exports["default"] = _default;
|
@@ -0,0 +1,68 @@
|
|
1
|
+
import { Meta } from '@storybook/addon-docs';
|
2
|
+
|
3
|
+
<Meta title="Components/Pagination/Pagination" />
|
4
|
+
|
5
|
+
# Pagination
|
6
|
+
|
7
|
+
The Pagination component allows users to navigate through large datasets by dividing them into smaller, more manageable pages. It provides controls for navigating between pages and selecting the number of items displayed per page.
|
8
|
+
|
9
|
+
### Features
|
10
|
+
|
11
|
+
- Customizable offset options to control the number of items displayed per page.
|
12
|
+
- Next/Previous navigation buttons for seamless page transitions.
|
13
|
+
- Works in both controlled and uncontrolled states.
|
14
|
+
- Integrates with `PaginationContext` for managing state.
|
15
|
+
|
16
|
+
### Required Components
|
17
|
+
|
18
|
+
This component requires the following components:
|
19
|
+
- `PaginationProvider`
|
20
|
+
- `ListView` (optional for displaying paginated data)
|
21
|
+
|
22
|
+
### Accessibility
|
23
|
+
|
24
|
+
This component adheres to the [WCAG 2.1 - 2.4.4 Link Purpose (In Context)](https://www.w3.org/WAI/WCAG21/Understanding/link-purpose-in-context.html) accessibility guidelines.
|
25
|
+
|
26
|
+
#### Keyboard Navigation
|
27
|
+
|
28
|
+
| Key | Functions |
|
29
|
+
|---------------|-----------------------------------|
|
30
|
+
| Tab | Moves focus between controls. |
|
31
|
+
| Enter | Activates the focused control. |
|
32
|
+
|
33
|
+
#### Screen Readers
|
34
|
+
|
35
|
+
This component uses the following attributes to assist screen readers:
|
36
|
+
- **`aria-label`**: Provides an accessible name for the pagination controls.
|
37
|
+
- **`aria-disabled`**: Indicates when navigation buttons are disabled.
|
38
|
+
- **`aria-live`**: Updates screen readers with changes in pagination state.
|
39
|
+
|
40
|
+
### Usage
|
41
|
+
|
42
|
+
```tsx
|
43
|
+
import { Pagination, PaginationProvider } from '@pingux/astro';
|
44
|
+
|
45
|
+
<PaginationProvider>
|
46
|
+
<Pagination totalCount={250} />
|
47
|
+
<ListView
|
48
|
+
items={animals.slice(paginationState.firstRenderedIndex, paginationState.lastRenderedIndex).map(item => ({
|
49
|
+
name: item.name,
|
50
|
+
key: item.name,
|
51
|
+
id: item.name,
|
52
|
+
}))}
|
53
|
+
>
|
54
|
+
{(item) => (
|
55
|
+
<Item key={item.name}>
|
56
|
+
<ListViewItem
|
57
|
+
data={{
|
58
|
+
text: item.name,
|
59
|
+
icon: FormSelectIcon,
|
60
|
+
}}
|
61
|
+
iconProps={{
|
62
|
+
color: 'text.secondary',
|
63
|
+
}}
|
64
|
+
/>
|
65
|
+
</Item>
|
66
|
+
)}
|
67
|
+
</ListView>
|
68
|
+
</PaginationProvider>
|
@@ -0,0 +1,39 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
declare const _default: {
|
3
|
+
title: string;
|
4
|
+
component: React.ForwardRefExoticComponent<import("../../types/pagination").PaginationProps & React.RefAttributes<HTMLDivElement>>;
|
5
|
+
parameters: {
|
6
|
+
docs: {
|
7
|
+
page: () => React.JSX.Element;
|
8
|
+
};
|
9
|
+
};
|
10
|
+
argTypes: {
|
11
|
+
totalCount: {
|
12
|
+
control: {
|
13
|
+
type: string;
|
14
|
+
};
|
15
|
+
};
|
16
|
+
currentPageIndex: {
|
17
|
+
control: {
|
18
|
+
type: string;
|
19
|
+
};
|
20
|
+
};
|
21
|
+
offsetCount: {
|
22
|
+
control: {
|
23
|
+
type: string;
|
24
|
+
};
|
25
|
+
};
|
26
|
+
offsetOptions: {
|
27
|
+
control: {
|
28
|
+
type: string;
|
29
|
+
};
|
30
|
+
};
|
31
|
+
onPageIndexChange: {};
|
32
|
+
onOffsetCountChange: {};
|
33
|
+
};
|
34
|
+
};
|
35
|
+
export default _default;
|
36
|
+
export declare const Default: (args: any) => React.JSX.Element;
|
37
|
+
export declare const WithListView: () => React.JSX.Element;
|
38
|
+
export declare const Controlled: () => React.JSX.Element;
|
39
|
+
export declare const CustomOptions: () => React.JSX.Element;
|
@@ -0,0 +1,159 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _typeof = require("@babel/runtime-corejs3/helpers/typeof");
|
4
|
+
var _WeakMap = require("@babel/runtime-corejs3/core-js-stable/weak-map");
|
5
|
+
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
6
|
+
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
|
7
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
8
|
+
_Object$defineProperty(exports, "__esModule", {
|
9
|
+
value: true
|
10
|
+
});
|
11
|
+
exports["default"] = exports.WithListView = exports.Default = exports.CustomOptions = exports.Controlled = void 0;
|
12
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/slicedToArray"));
|
13
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
14
|
+
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
15
|
+
var _slice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/slice"));
|
16
|
+
var _react = _interopRequireWildcard(require("react"));
|
17
|
+
var _FormSelectIcon = _interopRequireDefault(require("@pingux/mdi-react/FormSelectIcon"));
|
18
|
+
var _usePaginationState2 = _interopRequireDefault(require("../../hooks/usePaginationState"));
|
19
|
+
var _index = require("../../index");
|
20
|
+
var _ListView = require("../ListView/ListView.stories");
|
21
|
+
var _Pagination = _interopRequireDefault(require("./Pagination.mdx"));
|
22
|
+
var _react2 = require("@emotion/react");
|
23
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
24
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = _Object$defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { _Object$defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
25
|
+
var _default = {
|
26
|
+
title: 'Components/Pagination',
|
27
|
+
component: _index.Pagination,
|
28
|
+
parameters: {
|
29
|
+
docs: {
|
30
|
+
page: function page() {
|
31
|
+
return (0, _react2.jsx)(_Pagination["default"], null);
|
32
|
+
}
|
33
|
+
}
|
34
|
+
},
|
35
|
+
argTypes: {
|
36
|
+
totalCount: {
|
37
|
+
control: {
|
38
|
+
type: 'number'
|
39
|
+
}
|
40
|
+
},
|
41
|
+
currentPageIndex: {
|
42
|
+
control: {
|
43
|
+
type: 'number'
|
44
|
+
}
|
45
|
+
},
|
46
|
+
offsetCount: {
|
47
|
+
control: {
|
48
|
+
type: 'number'
|
49
|
+
}
|
50
|
+
},
|
51
|
+
offsetOptions: {
|
52
|
+
control: {
|
53
|
+
type: 'array'
|
54
|
+
}
|
55
|
+
},
|
56
|
+
onPageIndexChange: {},
|
57
|
+
onOffsetCountChange: {}
|
58
|
+
}
|
59
|
+
};
|
60
|
+
exports["default"] = _default;
|
61
|
+
var ExampleComponent = function ExampleComponent() {
|
62
|
+
var _context;
|
63
|
+
var _usePaginationState = (0, _usePaginationState2["default"])(),
|
64
|
+
paginationState = _usePaginationState.paginationState;
|
65
|
+
return (0, _react2.jsx)(_index.ScrollBox, {
|
66
|
+
maxHeight: "400px"
|
67
|
+
}, (0, _react2.jsx)(_index.ListView, {
|
68
|
+
items: (0, _map["default"])(_context = (0, _slice["default"])(_ListView.animals).call(_ListView.animals, paginationState.firstRenderedIndex, paginationState.lastRenderedIndex + 1)).call(_context, function (_item) {
|
69
|
+
return {
|
70
|
+
name: _item.name,
|
71
|
+
key: _item.name,
|
72
|
+
id: _item.name
|
73
|
+
};
|
74
|
+
})
|
75
|
+
}, function (item) {
|
76
|
+
return (0, _react2.jsx)(_index.Item, {
|
77
|
+
key: item.name
|
78
|
+
}, (0, _react2.jsx)(_index.ListViewItem, {
|
79
|
+
data: {
|
80
|
+
text: item.name,
|
81
|
+
icon: _FormSelectIcon["default"]
|
82
|
+
},
|
83
|
+
iconProps: {
|
84
|
+
color: 'text.secondary'
|
85
|
+
}
|
86
|
+
}));
|
87
|
+
}));
|
88
|
+
};
|
89
|
+
var Default = function Default(args) {
|
90
|
+
return (0, _react2.jsx)(_index.Box, {
|
91
|
+
sx: {
|
92
|
+
maxWidth: '350px',
|
93
|
+
gap: 'sm'
|
94
|
+
}
|
95
|
+
}, (0, _react2.jsx)(_index.Pagination, (0, _extends2["default"])({
|
96
|
+
totalCount: 250
|
97
|
+
}, args)));
|
98
|
+
};
|
99
|
+
exports.Default = Default;
|
100
|
+
var WithListView = function WithListView() {
|
101
|
+
return (0, _react2.jsx)(_index.PaginationProvider, null, (0, _react2.jsx)(_index.Box, {
|
102
|
+
gap: "sm"
|
103
|
+
}, (0, _react2.jsx)(ExampleComponent, null), (0, _react2.jsx)(_index.Pagination, {
|
104
|
+
totalCount: _ListView.animals.length
|
105
|
+
})));
|
106
|
+
};
|
107
|
+
exports.WithListView = WithListView;
|
108
|
+
var Controlled = function Controlled() {
|
109
|
+
var _useState = (0, _react.useState)(24),
|
110
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
111
|
+
index = _useState2[0],
|
112
|
+
setIndex = _useState2[1];
|
113
|
+
var _useState3 = (0, _react.useState)(10),
|
114
|
+
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
115
|
+
offsetCount = _useState4[0],
|
116
|
+
setOffsetCount = _useState4[1];
|
117
|
+
return (0, _react2.jsx)(_index.Box, {
|
118
|
+
sx: {
|
119
|
+
maxWidth: '350px',
|
120
|
+
gap: 'sm'
|
121
|
+
}
|
122
|
+
}, (0, _react2.jsx)(_index.Button, {
|
123
|
+
onPress: function onPress() {
|
124
|
+
return setIndex(0);
|
125
|
+
}
|
126
|
+
}, "Reset Index"), (0, _react2.jsx)(_index.Pagination, {
|
127
|
+
totalCount: 250,
|
128
|
+
currentPageIndex: index,
|
129
|
+
offsetCount: offsetCount,
|
130
|
+
onOffsetCountChange: setOffsetCount,
|
131
|
+
onPageIndexChange: function onPageIndexChange(i) {
|
132
|
+
setIndex(i);
|
133
|
+
}
|
134
|
+
}));
|
135
|
+
};
|
136
|
+
exports.Controlled = Controlled;
|
137
|
+
var CustomOptions = function CustomOptions() {
|
138
|
+
var _useState5 = (0, _react.useState)(24),
|
139
|
+
_useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
|
140
|
+
index = _useState6[0],
|
141
|
+
setIndex = _useState6[1];
|
142
|
+
var testFunc = function testFunc(key) {
|
143
|
+
setIndex(key);
|
144
|
+
};
|
145
|
+
return (0, _react2.jsx)(_index.Box, {
|
146
|
+
sx: {
|
147
|
+
maxWidth: '350px',
|
148
|
+
gap: 'sm'
|
149
|
+
}
|
150
|
+
}, (0, _react2.jsx)(_index.Pagination, {
|
151
|
+
totalCount: 250,
|
152
|
+
currentPageIndex: index,
|
153
|
+
offsetOptions: [10, 15, 25, 50, 100],
|
154
|
+
onPageIndexChange: function onPageIndexChange(key) {
|
155
|
+
testFunc(key);
|
156
|
+
}
|
157
|
+
}));
|
158
|
+
};
|
159
|
+
exports.CustomOptions = CustomOptions;
|
@@ -0,0 +1,17 @@
|
|
1
|
+
declare const _default: {
|
2
|
+
container: {
|
3
|
+
alignItems: string;
|
4
|
+
minWidth: string;
|
5
|
+
with: string;
|
6
|
+
ml: string;
|
7
|
+
flexGrow: number;
|
8
|
+
};
|
9
|
+
iconWrapper: {
|
10
|
+
ml: string;
|
11
|
+
};
|
12
|
+
wrapper: {
|
13
|
+
ml: string;
|
14
|
+
alignItems: string;
|
15
|
+
};
|
16
|
+
};
|
17
|
+
export default _default;
|
@@ -0,0 +1,27 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
4
|
+
_Object$defineProperty(exports, "__esModule", {
|
5
|
+
value: true
|
6
|
+
});
|
7
|
+
exports["default"] = void 0;
|
8
|
+
var container = {
|
9
|
+
alignItems: 'center',
|
10
|
+
minWidth: '100%',
|
11
|
+
"with": '100%',
|
12
|
+
ml: 'auto',
|
13
|
+
flexGrow: 1
|
14
|
+
};
|
15
|
+
var iconWrapper = {
|
16
|
+
ml: 'md'
|
17
|
+
};
|
18
|
+
var wrapper = {
|
19
|
+
ml: 'auto',
|
20
|
+
alignItems: 'center'
|
21
|
+
};
|
22
|
+
var _default = {
|
23
|
+
container: container,
|
24
|
+
iconWrapper: iconWrapper,
|
25
|
+
wrapper: wrapper
|
26
|
+
};
|
27
|
+
exports["default"] = _default;
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|