@instructure/ui-pagination 8.17.1-snapshot.21 → 8.17.1-snapshot.30

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.
@@ -104,15 +104,11 @@ let PaginationPageInput = (_dec = withStyle(generateStyle, generateComponentThem
104
104
  }
105
105
 
106
106
  componentDidMount() {
107
- var _this$props$makeStyle, _this$props;
108
-
109
- (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
107
+ this.props.makeStyles?.();
110
108
  }
111
109
 
112
110
  componentDidUpdate(prevProps) {
113
- var _this$props$makeStyle2, _this$props2;
114
-
115
- (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2); // when the current page changes from outside (e.g.: from arrow buttons),
111
+ this.props.makeStyles?.(); // when the current page changes from outside (e.g.: from arrow buttons),
116
112
  // we update the initial state
117
113
 
118
114
  if (this.props.currentPageIndex !== prevProps.currentPageIndex) {
@@ -157,31 +153,31 @@ let PaginationPageInput = (_dec = withStyle(generateStyle, generateComponentThem
157
153
  }
158
154
 
159
155
  renderLabel() {
160
- const _this$props3 = this.props,
161
- label = _this$props3.label,
162
- numberOfPages = _this$props3.numberOfPages,
163
- styles = _this$props3.styles;
156
+ const _this$props = this.props,
157
+ label = _this$props.label,
158
+ numberOfPages = _this$props.numberOfPages,
159
+ styles = _this$props.styles;
164
160
  return typeof label === 'function' && label(numberOfPages) ? jsx("span", {
165
- css: styles === null || styles === void 0 ? void 0 : styles.inputLabel
161
+ css: styles?.inputLabel
166
162
  }, label(numberOfPages)) : null;
167
163
  }
168
164
 
169
165
  renderScreenReaderLabel() {
170
- const _this$props4 = this.props,
171
- screenReaderLabel = _this$props4.screenReaderLabel,
172
- numberOfPages = _this$props4.numberOfPages;
166
+ const _this$props2 = this.props,
167
+ screenReaderLabel = _this$props2.screenReaderLabel,
168
+ numberOfPages = _this$props2.numberOfPages;
173
169
  return jsx(ScreenReaderContent, null, screenReaderLabel(this.currentPage, numberOfPages));
174
170
  }
175
171
 
176
172
  render() {
177
- const _this$props5 = this.props,
178
- styles = _this$props5.styles,
179
- disabled = _this$props5.disabled;
173
+ const _this$props3 = this.props,
174
+ styles = _this$props3.styles,
175
+ disabled = _this$props3.disabled;
180
176
  return jsx("span", {
181
- css: styles === null || styles === void 0 ? void 0 : styles.paginationPageInput,
177
+ css: styles?.paginationPageInput,
182
178
  ref: this.handleRef
183
179
  }, jsx("span", {
184
- css: styles === null || styles === void 0 ? void 0 : styles.numberInput
180
+ css: styles?.numberInput
185
181
  }, jsx(NumberInput, {
186
182
  renderLabel: this.renderScreenReaderLabel(),
187
183
  onBlur: this.handleBlur,
@@ -123,15 +123,11 @@ let Pagination = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle,
123
123
  }
124
124
 
125
125
  componentDidMount() {
126
- var _this$props$makeStyle, _this$props;
127
-
128
- (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
126
+ this.props.makeStyles?.();
129
127
  }
130
128
 
131
129
  componentDidUpdate(prevProps, _prevState, snapshot) {
132
- var _this$props$makeStyle2, _this$props2;
133
-
134
- (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
130
+ this.props.makeStyles?.();
135
131
 
136
132
  if (!this.props.shouldHandleFocus || !propsHaveCompactView(prevProps) && !propsHaveCompactView(this.props)) {
137
133
  return;
@@ -199,9 +195,7 @@ let Pagination = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle,
199
195
  }
200
196
 
201
197
  handleInputChange(event, pageIndex) {
202
- var _this$childPages$page, _this$childPages$page2;
203
-
204
- (_this$childPages$page = (_this$childPages$page2 = this.childPages[pageIndex].props).onClick) === null || _this$childPages$page === void 0 ? void 0 : _this$childPages$page.call(_this$childPages$page2, event);
198
+ this.childPages[pageIndex].props.onClick?.(event);
205
199
  }
206
200
 
207
201
  renderPages(currentPageIndex) {
@@ -278,8 +272,6 @@ let Pagination = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle,
278
272
  }
279
273
 
280
274
  renderArrowButton(direction, currentPageIndex) {
281
- var _page$props, _page$props2;
282
-
283
275
  const childPages = this.childPages; // We don't display the arrows in "compact" variant under 6 items
284
276
 
285
277
  if (!(propsHaveCompactView(this.props) || this.inputMode)) {
@@ -297,8 +289,8 @@ let Pagination = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle,
297
289
  handleButtonRef = _this$getArrowVariant.handleButtonRef;
298
290
 
299
291
  const page = childPages[pageIndex];
300
- const disabled = (page === null || page === void 0 ? void 0 : (_page$props = page.props) === null || _page$props === void 0 ? void 0 : _page$props.disabled) || this.props.disabled || !shouldEnableIcon;
301
- const onClick = page === null || page === void 0 ? void 0 : (_page$props2 = page.props) === null || _page$props2 === void 0 ? void 0 : _page$props2.onClick;
292
+ const disabled = page?.props?.disabled || this.props.disabled || !shouldEnableIcon;
293
+ const onClick = page?.props?.onClick;
302
294
  return shouldEnableIcon || this.showDisabledButtons ? jsx(PaginationArrowButton, {
303
295
  direction: direction,
304
296
  "data-direction": direction,
@@ -310,8 +302,6 @@ let Pagination = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle,
310
302
  }
311
303
 
312
304
  render() {
313
- var _this$props$styles, _this$props$styles2;
314
-
315
305
  if (!this.props.children) return null;
316
306
  const currentPageIndex = fastFindIndex(this.childPages, p => p && p.props && p.props.current);
317
307
  const passthroughProps = View.omitViewProps(omitProps(this.props, Pagination.allowedProps), Pagination);
@@ -320,11 +310,11 @@ let Pagination = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle,
320
310
  as: this.props.as,
321
311
  elementRef: this.handleElementRef,
322
312
  margin: this.props.margin,
323
- css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.pagination,
313
+ css: this.props.styles?.pagination,
324
314
  "aria-labelledby": this.props.label ? this._labelId : void 0
325
315
  }), this.props.label && this.renderLabel(), jsx(View, {
326
316
  display: "inline-block",
327
- css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.pages
317
+ css: this.props.styles?.pages
328
318
  }, this.renderArrowButton('first', currentPageIndex), this.renderArrowButton('prev', currentPageIndex), this.inputMode ? this.renderPageInput(currentPageIndex) : this.renderPages(currentPageIndex), this.renderArrowButton('next', currentPageIndex), this.renderArrowButton('last', currentPageIndex)));
329
319
  }
330
320
 
@@ -97,15 +97,11 @@ let PaginationPageInput = (_dec = (0, _emotion.withStyle)(_styles.default, _them
97
97
  }
98
98
 
99
99
  componentDidMount() {
100
- var _this$props$makeStyle, _this$props;
101
-
102
- (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
100
+ this.props.makeStyles?.();
103
101
  }
104
102
 
105
103
  componentDidUpdate(prevProps) {
106
- var _this$props$makeStyle2, _this$props2;
107
-
108
- (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2); // when the current page changes from outside (e.g.: from arrow buttons),
104
+ this.props.makeStyles?.(); // when the current page changes from outside (e.g.: from arrow buttons),
109
105
  // we update the initial state
110
106
 
111
107
  if (this.props.currentPageIndex !== prevProps.currentPageIndex) {
@@ -150,31 +146,31 @@ let PaginationPageInput = (_dec = (0, _emotion.withStyle)(_styles.default, _them
150
146
  }
151
147
 
152
148
  renderLabel() {
153
- const _this$props3 = this.props,
154
- label = _this$props3.label,
155
- numberOfPages = _this$props3.numberOfPages,
156
- styles = _this$props3.styles;
149
+ const _this$props = this.props,
150
+ label = _this$props.label,
151
+ numberOfPages = _this$props.numberOfPages,
152
+ styles = _this$props.styles;
157
153
  return typeof label === 'function' && label(numberOfPages) ? (0, _emotion.jsx)("span", {
158
- css: styles === null || styles === void 0 ? void 0 : styles.inputLabel
154
+ css: styles?.inputLabel
159
155
  }, label(numberOfPages)) : null;
160
156
  }
161
157
 
162
158
  renderScreenReaderLabel() {
163
- const _this$props4 = this.props,
164
- screenReaderLabel = _this$props4.screenReaderLabel,
165
- numberOfPages = _this$props4.numberOfPages;
159
+ const _this$props2 = this.props,
160
+ screenReaderLabel = _this$props2.screenReaderLabel,
161
+ numberOfPages = _this$props2.numberOfPages;
166
162
  return (0, _emotion.jsx)(_ScreenReaderContent.ScreenReaderContent, null, screenReaderLabel(this.currentPage, numberOfPages));
167
163
  }
168
164
 
169
165
  render() {
170
- const _this$props5 = this.props,
171
- styles = _this$props5.styles,
172
- disabled = _this$props5.disabled;
166
+ const _this$props3 = this.props,
167
+ styles = _this$props3.styles,
168
+ disabled = _this$props3.disabled;
173
169
  return (0, _emotion.jsx)("span", {
174
- css: styles === null || styles === void 0 ? void 0 : styles.paginationPageInput,
170
+ css: styles?.paginationPageInput,
175
171
  ref: this.handleRef
176
172
  }, (0, _emotion.jsx)("span", {
177
- css: styles === null || styles === void 0 ? void 0 : styles.numberInput
173
+ css: styles?.numberInput
178
174
  }, (0, _emotion.jsx)(_NumberInput.NumberInput, {
179
175
  renderLabel: this.renderScreenReaderLabel(),
180
176
  onBlur: this.handleBlur,
@@ -131,15 +131,11 @@ let Pagination = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2
131
131
  }
132
132
 
133
133
  componentDidMount() {
134
- var _this$props$makeStyle, _this$props;
135
-
136
- (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
134
+ this.props.makeStyles?.();
137
135
  }
138
136
 
139
137
  componentDidUpdate(prevProps, _prevState, snapshot) {
140
- var _this$props$makeStyle2, _this$props2;
141
-
142
- (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
138
+ this.props.makeStyles?.();
143
139
 
144
140
  if (!this.props.shouldHandleFocus || !propsHaveCompactView(prevProps) && !propsHaveCompactView(this.props)) {
145
141
  return;
@@ -207,9 +203,7 @@ let Pagination = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2
207
203
  }
208
204
 
209
205
  handleInputChange(event, pageIndex) {
210
- var _this$childPages$page, _this$childPages$page2;
211
-
212
- (_this$childPages$page = (_this$childPages$page2 = this.childPages[pageIndex].props).onClick) === null || _this$childPages$page === void 0 ? void 0 : _this$childPages$page.call(_this$childPages$page2, event);
206
+ this.childPages[pageIndex].props.onClick?.(event);
213
207
  }
214
208
 
215
209
  renderPages(currentPageIndex) {
@@ -286,8 +280,6 @@ let Pagination = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2
286
280
  }
287
281
 
288
282
  renderArrowButton(direction, currentPageIndex) {
289
- var _page$props, _page$props2;
290
-
291
283
  const childPages = this.childPages; // We don't display the arrows in "compact" variant under 6 items
292
284
 
293
285
  if (!(propsHaveCompactView(this.props) || this.inputMode)) {
@@ -305,8 +297,8 @@ let Pagination = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2
305
297
  handleButtonRef = _this$getArrowVariant.handleButtonRef;
306
298
 
307
299
  const page = childPages[pageIndex];
308
- const disabled = (page === null || page === void 0 ? void 0 : (_page$props = page.props) === null || _page$props === void 0 ? void 0 : _page$props.disabled) || this.props.disabled || !shouldEnableIcon;
309
- const onClick = page === null || page === void 0 ? void 0 : (_page$props2 = page.props) === null || _page$props2 === void 0 ? void 0 : _page$props2.onClick;
300
+ const disabled = page?.props?.disabled || this.props.disabled || !shouldEnableIcon;
301
+ const onClick = page?.props?.onClick;
310
302
  return shouldEnableIcon || this.showDisabledButtons ? (0, _emotion.jsx)(_PaginationArrowButton.PaginationArrowButton, {
311
303
  direction: direction,
312
304
  "data-direction": direction,
@@ -318,8 +310,6 @@ let Pagination = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2
318
310
  }
319
311
 
320
312
  render() {
321
- var _this$props$styles, _this$props$styles2;
322
-
323
313
  if (!this.props.children) return null;
324
314
  const currentPageIndex = fastFindIndex(this.childPages, p => p && p.props && p.props.current);
325
315
 
@@ -330,11 +320,11 @@ let Pagination = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2
330
320
  as: this.props.as,
331
321
  elementRef: this.handleElementRef,
332
322
  margin: this.props.margin,
333
- css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.pagination,
323
+ css: this.props.styles?.pagination,
334
324
  "aria-labelledby": this.props.label ? this._labelId : void 0
335
325
  }), this.props.label && this.renderLabel(), (0, _emotion.jsx)(_View.View, {
336
326
  display: "inline-block",
337
- css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.pages
327
+ css: this.props.styles?.pages
338
328
  }, this.renderArrowButton('first', currentPageIndex), this.renderArrowButton('prev', currentPageIndex), this.inputMode ? this.renderPageInput(currentPageIndex) : this.renderPages(currentPageIndex), this.renderArrowButton('next', currentPageIndex), this.renderArrowButton('last', currentPageIndex)));
339
329
  }
340
330
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-pagination",
3
- "version": "8.17.1-snapshot.21+79d490548",
3
+ "version": "8.17.1-snapshot.30+cb1322c25",
4
4
  "description": "A UI component library made by Instructure Inc.",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "module": "./es/index.js",
@@ -23,29 +23,29 @@
23
23
  },
24
24
  "license": "MIT",
25
25
  "devDependencies": {
26
- "@instructure/ui-babel-preset": "8.17.1-snapshot.21+79d490548",
27
- "@instructure/ui-test-locator": "8.17.1-snapshot.21+79d490548",
28
- "@instructure/ui-test-queries": "8.17.1-snapshot.21+79d490548",
29
- "@instructure/ui-test-utils": "8.17.1-snapshot.21+79d490548"
26
+ "@instructure/ui-babel-preset": "8.17.1-snapshot.30+cb1322c25",
27
+ "@instructure/ui-test-locator": "8.17.1-snapshot.30+cb1322c25",
28
+ "@instructure/ui-test-queries": "8.17.1-snapshot.30+cb1322c25",
29
+ "@instructure/ui-test-utils": "8.17.1-snapshot.30+cb1322c25"
30
30
  },
31
31
  "dependencies": {
32
32
  "@babel/runtime": "^7.13.10",
33
- "@instructure/emotion": "8.17.1-snapshot.21+79d490548",
34
- "@instructure/shared-types": "8.17.1-snapshot.21+79d490548",
35
- "@instructure/ui-a11y-content": "8.17.1-snapshot.21+79d490548",
36
- "@instructure/ui-a11y-utils": "8.17.1-snapshot.21+79d490548",
37
- "@instructure/ui-buttons": "8.17.1-snapshot.21+79d490548",
38
- "@instructure/ui-dom-utils": "8.17.1-snapshot.21+79d490548",
39
- "@instructure/ui-icons": "8.17.1-snapshot.21+79d490548",
40
- "@instructure/ui-number-input": "8.17.1-snapshot.21+79d490548",
41
- "@instructure/ui-portal": "8.17.1-snapshot.21+79d490548",
42
- "@instructure/ui-prop-types": "8.17.1-snapshot.21+79d490548",
43
- "@instructure/ui-react-utils": "8.17.1-snapshot.21+79d490548",
44
- "@instructure/ui-testable": "8.17.1-snapshot.21+79d490548",
45
- "@instructure/ui-tooltip": "8.17.1-snapshot.21+79d490548",
46
- "@instructure/ui-utils": "8.17.1-snapshot.21+79d490548",
47
- "@instructure/ui-view": "8.17.1-snapshot.21+79d490548",
48
- "@instructure/uid": "8.17.1-snapshot.21+79d490548",
33
+ "@instructure/emotion": "8.17.1-snapshot.30+cb1322c25",
34
+ "@instructure/shared-types": "8.17.1-snapshot.30+cb1322c25",
35
+ "@instructure/ui-a11y-content": "8.17.1-snapshot.30+cb1322c25",
36
+ "@instructure/ui-a11y-utils": "8.17.1-snapshot.30+cb1322c25",
37
+ "@instructure/ui-buttons": "8.17.1-snapshot.30+cb1322c25",
38
+ "@instructure/ui-dom-utils": "8.17.1-snapshot.30+cb1322c25",
39
+ "@instructure/ui-icons": "8.17.1-snapshot.30+cb1322c25",
40
+ "@instructure/ui-number-input": "8.17.1-snapshot.30+cb1322c25",
41
+ "@instructure/ui-portal": "8.17.1-snapshot.30+cb1322c25",
42
+ "@instructure/ui-prop-types": "8.17.1-snapshot.30+cb1322c25",
43
+ "@instructure/ui-react-utils": "8.17.1-snapshot.30+cb1322c25",
44
+ "@instructure/ui-testable": "8.17.1-snapshot.30+cb1322c25",
45
+ "@instructure/ui-tooltip": "8.17.1-snapshot.30+cb1322c25",
46
+ "@instructure/ui-utils": "8.17.1-snapshot.30+cb1322c25",
47
+ "@instructure/ui-view": "8.17.1-snapshot.30+cb1322c25",
48
+ "@instructure/uid": "8.17.1-snapshot.30+cb1322c25",
49
49
  "keycode": "^2",
50
50
  "prop-types": "^15"
51
51
  },
@@ -56,5 +56,5 @@
56
56
  "access": "public"
57
57
  },
58
58
  "sideEffects": false,
59
- "gitHead": "79d490548a0736feb2a7232bf5918857317b178b"
59
+ "gitHead": "cb1322c25257139750149d7a817f1fb32571c1ed"
60
60
  }