@instructure/ui-pagination 8.8.1-snapshot.8 → 8.9.1

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 (47) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/es/Pagination/PaginationArrowButton/index.js +3 -8
  3. package/{src/Pagination/PaginationArrowButton/types.ts → es/Pagination/PaginationArrowButton/props.js} +8 -8
  4. package/es/Pagination/PaginationButton/index.js +2 -12
  5. package/{src/Pagination/PaginationButton/types.ts → es/Pagination/PaginationButton/props.js} +13 -3
  6. package/es/Pagination/index.js +7 -71
  7. package/es/Pagination/props.js +86 -0
  8. package/lib/Pagination/PaginationArrowButton/index.js +3 -8
  9. package/lib/Pagination/PaginationArrowButton/props.js +42 -0
  10. package/lib/Pagination/PaginationButton/index.js +3 -15
  11. package/{src/Pagination/types.ts → lib/Pagination/PaginationButton/props.js} +24 -17
  12. package/lib/Pagination/index.js +7 -72
  13. package/lib/Pagination/props.js +100 -0
  14. package/package.json +21 -22
  15. package/src/Pagination/PaginationArrowButton/index.tsx +4 -8
  16. package/src/Pagination/PaginationArrowButton/props.ts +51 -0
  17. package/src/Pagination/PaginationButton/index.tsx +5 -13
  18. package/src/Pagination/PaginationButton/props.ts +55 -0
  19. package/src/Pagination/index.tsx +8 -63
  20. package/src/Pagination/props.ts +118 -0
  21. package/src/index.ts +3 -3
  22. package/types/Pagination/PaginationArrowButton/index.d.ts +12 -9
  23. package/types/Pagination/PaginationArrowButton/index.d.ts.map +1 -1
  24. package/types/Pagination/PaginationArrowButton/props.d.ts +15 -0
  25. package/types/Pagination/PaginationArrowButton/props.d.ts.map +1 -0
  26. package/types/Pagination/PaginationButton/index.d.ts +10 -13
  27. package/types/Pagination/PaginationButton/index.d.ts.map +1 -1
  28. package/types/Pagination/PaginationButton/props.d.ts +14 -0
  29. package/types/Pagination/PaginationButton/props.d.ts.map +1 -0
  30. package/types/Pagination/index.d.ts +26 -60
  31. package/types/Pagination/index.d.ts.map +1 -1
  32. package/types/Pagination/props.d.ts +23 -0
  33. package/types/Pagination/props.d.ts.map +1 -0
  34. package/types/index.d.ts +3 -3
  35. package/LICENSE.md +0 -27
  36. package/es/Pagination/PaginationArrowButton/types.js +0 -1
  37. package/es/Pagination/PaginationButton/types.js +0 -1
  38. package/es/Pagination/types.js +0 -1
  39. package/lib/Pagination/PaginationArrowButton/types.js +0 -1
  40. package/lib/Pagination/PaginationButton/types.js +0 -1
  41. package/lib/Pagination/types.js +0 -1
  42. package/types/Pagination/PaginationArrowButton/types.d.ts +0 -7
  43. package/types/Pagination/PaginationArrowButton/types.d.ts.map +0 -1
  44. package/types/Pagination/PaginationButton/types.d.ts +0 -4
  45. package/types/Pagination/PaginationButton/types.d.ts.map +0 -1
  46. package/types/Pagination/types.d.ts +0 -17
  47. package/types/Pagination/types.d.ts.map +0 -1
@@ -1,3 +1,14 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.allowedProps = exports.propTypes = void 0;
9
+
10
+ var _propTypes = _interopRequireDefault(require("prop-types"));
11
+
1
12
  /*
2
13
  * The MIT License (MIT)
3
14
  *
@@ -21,21 +32,17 @@
21
32
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
33
  * SOFTWARE.
23
34
  */
35
+ const propTypes = {
36
+ /**
37
+ * Content to render as page selection
38
+ */
39
+ children: _propTypes.default.node.isRequired,
24
40
 
25
- import React from 'react'
26
- import type { Spacing } from '@instructure/emotion'
27
- import { AsElementType } from '@instructure/shared-types'
28
-
29
- export type PaginationProps = {
30
- makeStyles?: (...args: any[]) => any
31
- styles?: any
32
- disabled?: boolean
33
- label?: React.ReactNode
34
- labelNext?: string
35
- labelPrev?: string
36
- variant?: 'full' | 'compact'
37
- margin?: Spacing
38
- as?: AsElementType
39
- elementRef?: (...args: any[]) => any
40
- shouldHandleFocus?: boolean
41
- }
41
+ /**
42
+ * Whether the page is currently displayed
43
+ */
44
+ current: _propTypes.default.bool
45
+ };
46
+ exports.propTypes = propTypes;
47
+ const allowedProps = ['children', 'current'];
48
+ exports.allowedProps = allowedProps;
@@ -17,8 +17,6 @@ exports.Pagination = exports.default = void 0;
17
17
 
18
18
  var _react = _interopRequireWildcard(require("react"));
19
19
 
20
- var _propTypes = _interopRequireDefault(require("prop-types"));
21
-
22
20
  var _View = require("@instructure/ui-view/lib/View");
23
21
 
24
22
  var _testable = require("@instructure/ui-testable/lib/testable.js");
@@ -27,8 +25,6 @@ var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
27
25
 
28
26
  var _uid = require("@instructure/uid");
29
27
 
30
- var _Children = require("@instructure/ui-prop-types/lib/Children.js");
31
-
32
28
  var _hasVisibleChildren = require("@instructure/ui-a11y-utils/lib/hasVisibleChildren.js");
33
29
 
34
30
  var _findTabbable = require("@instructure/ui-dom-utils/lib/findTabbable.js");
@@ -43,6 +39,8 @@ var _PaginationArrowButton = require("./PaginationArrowButton");
43
39
 
44
40
  var _styles = _interopRequireDefault(require("./styles"));
45
41
 
42
+ var _props = require("./props");
43
+
46
44
  var _dec, _dec2, _class, _class2, _temp, _span, _span2;
47
45
 
48
46
  /** This is an [].findIndex optimized to work on really big, but sparse, arrays */
@@ -191,6 +189,8 @@ let Pagination = (_dec = (0, _emotion.withStyle)(_styles.default, null), _dec2 =
191
189
  }
192
190
 
193
191
  render() {
192
+ var _this$props$styles, _this$props$styles2;
193
+
194
194
  if (!this.props.children) return null;
195
195
  const currentPageIndex = fastFindIndex(this.props.children, p => p && p.props && p.props.current);
196
196
 
@@ -201,81 +201,16 @@ let Pagination = (_dec = (0, _emotion.withStyle)(_styles.default, null), _dec2 =
201
201
  as: this.props.as,
202
202
  elementRef: this.handleElementRef,
203
203
  margin: this.props.margin,
204
- css: this.props.styles.pagination,
204
+ css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.pagination,
205
205
  "aria-labelledby": this.props.label && this._labelId
206
206
  }), this.props.label && this.renderLabel(), (0, _emotion.jsx)(_View.View, {
207
207
  display: "inline-block",
208
- css: this.props.styles.pages
208
+ css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.pages
209
209
  }, shouldShowPrevButton(this.props, currentPageIndex) && this.renderArrowButton(this.props.labelPrev, -1, currentPageIndex), this.renderPages(currentPageIndex), shouldShowNextButton(this.props, currentPageIndex) && this.renderArrowButton(this.props.labelNext, 1, currentPageIndex)));
210
210
  }
211
211
 
212
- }, _class2.displayName = "Pagination", _class2.componentId = 'Pagination', _class2.propTypes = {
213
- // eslint-disable-next-line react/require-default-props
214
- makeStyles: _propTypes.default.func,
215
- // eslint-disable-next-line react/require-default-props
216
- styles: _propTypes.default.object,
217
-
218
- /**
219
- * children of type Pagination.Page
220
- */
221
- children: _Children.Children.oneOf([_PaginationButton.PaginationButton]),
222
-
223
- /**
224
- * Disables interaction with all pages
225
- */
226
- disabled: _propTypes.default.bool,
227
-
228
- /**
229
- * Visible label for component
230
- */
231
- label: _propTypes.default.node,
232
-
233
- /**
234
- * Accessible label for next button
235
- */
236
- labelNext: _propTypes.default.string,
237
-
238
- /**
239
- * Accessible label for previous button
240
- */
241
- labelPrev: _propTypes.default.string,
242
-
243
- /**
244
- * The compact variant truncates the page navigation to show only the first,
245
- * last, and pages immediately surrounding the current page. Fewer than 5 pages,
246
- * no next/previous arrow buttons will be shown, and all pages will be listed
247
- */
248
- variant: _propTypes.default.oneOf(['full', 'compact']),
249
-
250
- /**
251
- * Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
252
- * `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
253
- * familiar CSS-like shorthand. For example: `margin="small auto large"`.
254
- */
255
- margin: _emotion.ThemeablePropTypes.spacing,
256
-
257
- /**
258
- * the element type to render as
259
- */
260
- as: _propTypes.default.elementType,
261
-
262
- /**
263
- * provides a reference to the underlying html root element
264
- */
265
- elementRef: _propTypes.default.func,
266
-
267
- /**
268
- * For accessibility, Pagination sets focus on the first or last Pagination.Pages,
269
- * respectively, when the Previous or Next arrow buttons are removed from the DOM.
270
- * Set this property to `false` to prevent this behavior.
271
- */
272
- shouldHandleFocus: _propTypes.default.bool
273
- }, _class2.defaultProps = {
212
+ }, _class2.displayName = "Pagination", _class2.componentId = 'Pagination', _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.defaultProps = {
274
213
  children: null,
275
- label: void 0,
276
- labelNext: void 0,
277
- labelPrev: void 0,
278
- margin: void 0,
279
214
  disabled: false,
280
215
  variant: 'full',
281
216
  as: 'div',
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.allowedProps = exports.propTypes = void 0;
9
+
10
+ var _propTypes = _interopRequireDefault(require("prop-types"));
11
+
12
+ var _Children = require("@instructure/ui-prop-types/lib/Children.js");
13
+
14
+ var _emotion = require("@instructure/emotion");
15
+
16
+ var _PaginationButton = require("./PaginationButton");
17
+
18
+ /*
19
+ * The MIT License (MIT)
20
+ *
21
+ * Copyright (c) 2015 - present Instructure, Inc.
22
+ *
23
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
24
+ * of this software and associated documentation files (the "Software"), to deal
25
+ * in the Software without restriction, including without limitation the rights
26
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
27
+ * copies of the Software, and to permit persons to whom the Software is
28
+ * furnished to do so, subject to the following conditions:
29
+ *
30
+ * The above copyright notice and this permission notice shall be included in all
31
+ * copies or substantial portions of the Software.
32
+ *
33
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
34
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
35
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
36
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
37
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
38
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
39
+ * SOFTWARE.
40
+ */
41
+ const propTypes = {
42
+ /**
43
+ * children of type Pagination.Page
44
+ */
45
+ children: _Children.Children.oneOf([_PaginationButton.PaginationButton]),
46
+
47
+ /**
48
+ * Disables interaction with all pages
49
+ */
50
+ disabled: _propTypes.default.bool,
51
+
52
+ /**
53
+ * Visible label for component
54
+ */
55
+ label: _propTypes.default.node,
56
+
57
+ /**
58
+ * Accessible label for next button
59
+ */
60
+ labelNext: _propTypes.default.string,
61
+
62
+ /**
63
+ * Accessible label for previous button
64
+ */
65
+ labelPrev: _propTypes.default.string,
66
+
67
+ /**
68
+ * The compact variant truncates the page navigation to show only the first,
69
+ * last, and pages immediately surrounding the current page. Fewer than 5 pages,
70
+ * no next/previous arrow buttons will be shown, and all pages will be listed
71
+ */
72
+ variant: _propTypes.default.oneOf(['full', 'compact']),
73
+
74
+ /**
75
+ * Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
76
+ * `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
77
+ * familiar CSS-like shorthand. For example: `margin="small auto large"`.
78
+ */
79
+ margin: _emotion.ThemeablePropTypes.spacing,
80
+
81
+ /**
82
+ * the element type to render as
83
+ */
84
+ as: _propTypes.default.elementType,
85
+
86
+ /**
87
+ * provides a reference to the underlying html root element
88
+ */
89
+ elementRef: _propTypes.default.func,
90
+
91
+ /**
92
+ * For accessibility, Pagination sets focus on the first or last Pagination.Pages,
93
+ * respectively, when the Previous or Next arrow buttons are removed from the DOM.
94
+ * Set this property to `false` to prevent this behavior.
95
+ */
96
+ shouldHandleFocus: _propTypes.default.bool
97
+ };
98
+ exports.propTypes = propTypes;
99
+ const allowedProps = ['children', 'disabled', 'label', 'labelNext', 'labelPrev', 'variant', 'margin', 'as', 'elementRef', 'shouldHandleFocus'];
100
+ exports.allowedProps = allowedProps;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-pagination",
3
- "version": "8.8.1-snapshot.8+7b83164f4",
3
+ "version": "8.9.1",
4
4
  "description": "A UI component library made by Instructure Inc.",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "type": "commonjs",
@@ -24,28 +24,28 @@
24
24
  },
25
25
  "license": "MIT",
26
26
  "devDependencies": {
27
- "@instructure/ui-babel-preset": "8.8.1-snapshot.8+7b83164f4",
28
- "@instructure/ui-test-locator": "8.8.1-snapshot.8+7b83164f4",
29
- "@instructure/ui-test-queries": "8.8.1-snapshot.8+7b83164f4",
30
- "@instructure/ui-test-utils": "8.8.1-snapshot.8+7b83164f4"
27
+ "@instructure/ui-babel-preset": "8.9.1",
28
+ "@instructure/ui-test-locator": "8.9.1",
29
+ "@instructure/ui-test-queries": "8.9.1",
30
+ "@instructure/ui-test-utils": "8.9.1"
31
31
  },
32
32
  "dependencies": {
33
33
  "@babel/runtime": "^7.13.10",
34
- "@instructure/emotion": "8.8.1-snapshot.8+7b83164f4",
35
- "@instructure/shared-types": "8.8.1-snapshot.8+7b83164f4",
36
- "@instructure/ui-a11y-content": "8.8.1-snapshot.8+7b83164f4",
37
- "@instructure/ui-a11y-utils": "8.8.1-snapshot.8+7b83164f4",
38
- "@instructure/ui-buttons": "8.8.1-snapshot.8+7b83164f4",
39
- "@instructure/ui-dom-utils": "8.8.1-snapshot.8+7b83164f4",
40
- "@instructure/ui-icons": "8.8.1-snapshot.8+7b83164f4",
41
- "@instructure/ui-portal": "8.8.1-snapshot.8+7b83164f4",
42
- "@instructure/ui-prop-types": "8.8.1-snapshot.8+7b83164f4",
43
- "@instructure/ui-react-utils": "8.8.1-snapshot.8+7b83164f4",
44
- "@instructure/ui-testable": "8.8.1-snapshot.8+7b83164f4",
45
- "@instructure/ui-tooltip": "8.8.1-snapshot.8+7b83164f4",
46
- "@instructure/ui-utils": "8.8.1-snapshot.8+7b83164f4",
47
- "@instructure/ui-view": "8.8.1-snapshot.8+7b83164f4",
48
- "@instructure/uid": "8.8.1-snapshot.8+7b83164f4",
34
+ "@instructure/emotion": "8.9.1",
35
+ "@instructure/shared-types": "8.9.1",
36
+ "@instructure/ui-a11y-content": "8.9.1",
37
+ "@instructure/ui-a11y-utils": "8.9.1",
38
+ "@instructure/ui-buttons": "8.9.1",
39
+ "@instructure/ui-dom-utils": "8.9.1",
40
+ "@instructure/ui-icons": "8.9.1",
41
+ "@instructure/ui-portal": "8.9.1",
42
+ "@instructure/ui-prop-types": "8.9.1",
43
+ "@instructure/ui-react-utils": "8.9.1",
44
+ "@instructure/ui-testable": "8.9.1",
45
+ "@instructure/ui-tooltip": "8.9.1",
46
+ "@instructure/ui-utils": "8.9.1",
47
+ "@instructure/ui-view": "8.9.1",
48
+ "@instructure/uid": "8.9.1",
49
49
  "prop-types": "^15"
50
50
  },
51
51
  "peerDependencies": {
@@ -54,6 +54,5 @@
54
54
  "publishConfig": {
55
55
  "access": "public"
56
56
  },
57
- "sideEffects": false,
58
- "gitHead": "7b83164f4c5872f3a217e010563f59bf584ae4fc"
57
+ "sideEffects": false
59
58
  }
@@ -23,7 +23,6 @@
23
23
  */
24
24
 
25
25
  import React, { Component } from 'react'
26
- import PropTypes from 'prop-types'
27
26
 
28
27
  import { IconButton } from '@instructure/ui-buttons'
29
28
  import { PresentationContent } from '@instructure/ui-a11y-content'
@@ -33,7 +32,8 @@ import {
33
32
  IconArrowOpenEndSolid
34
33
  } from '@instructure/ui-icons'
35
34
  import { testable } from '@instructure/ui-testable'
36
- import { PaginationNavigationProps } from './types'
35
+ import type { PaginationNavigationProps } from './props'
36
+ import { allowedProps, propTypes } from './props'
37
37
 
38
38
  /**
39
39
  ---
@@ -45,14 +45,10 @@ id: Pagination.Navigation
45
45
  class PaginationArrowButton extends Component<PaginationNavigationProps> {
46
46
  static readonly componentId = 'Pagination.Navigation'
47
47
 
48
- static propTypes = {
49
- direction: PropTypes.oneOf(['next', 'prev']),
50
- label: PropTypes.oneOfType([PropTypes.string, PropTypes.node]).isRequired,
51
- buttonRef: PropTypes.func
52
- }
48
+ static allowedProps = allowedProps
49
+ static propTypes = propTypes
53
50
 
54
51
  static defaultProps = {
55
- direction: undefined,
56
52
  // @ts-expect-error ts-migrate(6133) FIXME: 'el' is declared but its value is never read.
57
53
  buttonRef: (el) => {}
58
54
  }
@@ -0,0 +1,51 @@
1
+ /*
2
+ * The MIT License (MIT)
3
+ *
4
+ * Copyright (c) 2015 - present Instructure, Inc.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ import React from 'react'
26
+ import PropTypes from 'prop-types'
27
+
28
+ import type { PropValidators } from '@instructure/shared-types'
29
+
30
+ type PaginationNavigationOwnProps = {
31
+ direction?: 'next' | 'prev'
32
+ label: string | React.ReactNode
33
+ buttonRef?: (...args: any[]) => any
34
+ }
35
+
36
+ type PropKeys = keyof PaginationNavigationOwnProps
37
+
38
+ type AllowedPropKeys = Readonly<Array<PropKeys>>
39
+
40
+ type PaginationNavigationProps = PaginationNavigationOwnProps
41
+
42
+ const propTypes: PropValidators<PropKeys> = {
43
+ direction: PropTypes.oneOf(['next', 'prev']),
44
+ label: PropTypes.oneOfType([PropTypes.string, PropTypes.node]).isRequired,
45
+ buttonRef: PropTypes.func
46
+ }
47
+
48
+ const allowedProps: AllowedPropKeys = ['direction', 'label', 'buttonRef']
49
+
50
+ export type { PaginationNavigationProps }
51
+ export { propTypes, allowedProps }
@@ -23,12 +23,13 @@
23
23
  */
24
24
 
25
25
  import React, { Component } from 'react'
26
- import PropTypes from 'prop-types'
27
26
 
28
27
  import { BaseButton } from '@instructure/ui-buttons'
29
28
  import { omitProps } from '@instructure/ui-react-utils'
30
29
  import { testable } from '@instructure/ui-testable'
31
- import { PaginationPageProps } from './types'
30
+
31
+ import { propTypes, allowedProps } from './props'
32
+ import type { PaginationPageProps } from './props'
32
33
 
33
34
  /**
34
35
  ---
@@ -41,17 +42,8 @@ id: Pagination.Page
41
42
  class PaginationButton extends Component<PaginationPageProps> {
42
43
  static readonly componentId = 'Pagination.Page'
43
44
 
44
- static propTypes = {
45
- /**
46
- * Content to render as page selection
47
- */
48
- children: PropTypes.node.isRequired,
49
- /**
50
- * Whether the page is currently displayed
51
- */
52
- current: PropTypes.bool
53
- }
54
-
45
+ static propTypes = propTypes
46
+ static allowedProps = allowedProps
55
47
  static defaultProps = {
56
48
  current: false
57
49
  }