@skyscanner/backpack-web 36.7.1 → 36.8.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.
@@ -125,7 +125,6 @@ class BpkCalendarDate extends PureComponent {
125
125
  type: "button",
126
126
  style: style,
127
127
  className: classNames.join(' '),
128
- "aria-hidden": isBlocked,
129
128
  "aria-label": `${date.getDate()}`,
130
129
  disabled: isBlocked,
131
130
  tabIndex: isKeyboardFocusable && isFocused ? 0 : -1,
@@ -18,7 +18,6 @@
18
18
 
19
19
  import { Component } from 'react';
20
20
  import { cssModules, isDeviceIos } from "../../bpk-react-utils";
21
- import deferCallback from "../../bpk-react-utils/src/deferCallback";
22
21
  import { addCalendarGridTransition } from "./BpkCalendarGridTransition";
23
22
  import BpkCalendarWeek from "./BpkCalendarWeek";
24
23
  import { CALENDAR_SELECTION_TYPE } from "./custom-proptypes";
@@ -65,10 +64,9 @@ class BpkCalendarGrid extends Component {
65
64
  };
66
65
  }
67
66
  componentDidMount() {
68
- // Defer expensive date formatting until after render to improve INP.
69
- deferCallback(() => this.setState({
67
+ this.setState({
70
68
  calendarMonthWeeks: getCalendar(this.props.month, this.props.weekStartsOn, this.props.formatDateFull)
71
- }));
69
+ });
72
70
  }
73
71
  UNSAFE_componentWillReceiveProps(nextProps) {
74
72
  // We cache expensive calculations (and identities) in state
@@ -106,7 +104,9 @@ class BpkCalendarGrid extends Component {
106
104
  return /*#__PURE__*/_jsx("div", {
107
105
  className: classNames,
108
106
  "aria-hidden": !isKeyboardFocusable,
107
+ role: "grid",
109
108
  children: /*#__PURE__*/_jsx("div", {
109
+ role: "rowgroup",
110
110
  children: calendarMonthWeeks.map(dates => /*#__PURE__*/_jsx(BpkCalendarWeek, {
111
111
  month: month,
112
112
  dates: dates,
@@ -267,6 +267,7 @@ class BpkCalendarWeek extends Component {
267
267
  }
268
268
  return /*#__PURE__*/_jsx("div", {
269
269
  className: getClassName('bpk-calendar-week'),
270
+ role: "row",
270
271
  children: this.props.dates.map(date => {
271
272
  const isBlocked = minDate && maxDate ? !isWithinRange(date.val, {
272
273
  start: minDate,
@@ -276,7 +277,6 @@ class BpkCalendarWeek extends Component {
276
277
  return /*#__PURE__*/_jsx(DateContainer, {
277
278
  className: cellClassName,
278
279
  isEmptyCell: !isSameMonth(date.val, month) && ignoreOutsideDate,
279
- isBlocked: isBlocked,
280
280
  selectionType: dateSelectionType,
281
281
  children: /*#__PURE__*/_jsx(DateComponent, {
282
282
  date: date.val,
@@ -306,14 +306,14 @@ class BpkCalendarWeek extends Component {
306
306
  const DateContainer = ({
307
307
  children,
308
308
  className = null,
309
- isBlocked,
310
309
  isEmptyCell,
311
310
  selectionType
312
311
  }) => {
313
312
  const classNames = getClassName('bpk-calendar-week__date', `bpk-calendar-week__date--${selectionType}`, className);
314
313
  return /*#__PURE__*/_jsx("div", {
315
- "aria-hidden": isEmptyCell || isBlocked,
314
+ "aria-hidden": isEmptyCell,
316
315
  className: classNames,
316
+ role: "gridcell",
317
317
  children: children
318
318
  });
319
319
  };
@@ -33,6 +33,7 @@ export type Props = CloseButtonProps & {
33
33
  actionText?: string;
34
34
  onAction?: () => void;
35
35
  renderTarget?: () => HTMLElement | HTMLElement | undefined;
36
+ [rest: string]: any;
36
37
  };
37
38
  declare const BpkPopover: ({ actionText, children, className, closeButtonIcon, closeButtonLabel, closeButtonProps, closeButtonText, hoverable, id, isOpen, label, labelAsTitle, onAction, onClose, padded, placement, renderTarget, showArrow, target, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
38
39
  export default BpkPopover;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skyscanner/backpack-web",
3
- "version": "36.7.1",
3
+ "version": "36.8.1",
4
4
  "description": "Backpack Design System web library",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,9 +0,0 @@
1
- /**
2
- * Mock deferCallback to immediately invoke the callback. This ensures that
3
- * asynchronous state updates triggered by `deferCallback` run before asserting.
4
- * https://developer.mozilla.org/en-US/docs/Web/API/Window/requestIdleCallback
5
- * @param {function} callback - callback to execute, value cannot be returned.
6
- * You'll typically want to wrap the callback `setState` to update React state.
7
- * @returns {void}
8
- */
9
- export default function deferCallback(callback: () => void): void;
@@ -1,29 +0,0 @@
1
- /*
2
- * Backpack - Skyscanner's Design System
3
- *
4
- * Copyright 2016 Skyscanner Ltd
5
- *
6
- * Licensed under the Apache License, Version 2.0 (the "License");
7
- * you may not use this file except in compliance with the License.
8
- * You may obtain a copy of the License at
9
- *
10
- * http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software
13
- * distributed under the License is distributed on an "AS IS" BASIS,
14
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- * See the License for the specific language governing permissions and
16
- * limitations under the License.
17
- */
18
-
19
- /**
20
- * Mock deferCallback to immediately invoke the callback. This ensures that
21
- * asynchronous state updates triggered by `deferCallback` run before asserting.
22
- * https://developer.mozilla.org/en-US/docs/Web/API/Window/requestIdleCallback
23
- * @param {function} callback - callback to execute, value cannot be returned.
24
- * You'll typically want to wrap the callback `setState` to update React state.
25
- * @returns {void}
26
- */
27
- export default function deferCallback(callback) {
28
- callback();
29
- }
@@ -1,13 +0,0 @@
1
- /**
2
- * Defer a task until the browser is idle, or till the next "tick" if the
3
- * browser does not support the idle callback API. This is useful for deferring
4
- * computationally heavy, non-essential tasks to keep the UI responsive. If the
5
- * task has not completed within the timeout, it will be executed regardless.
6
- *
7
- * https://developer.mozilla.org/en-US/docs/Web/API/Window/requestIdleCallback
8
- * @param {function} callback - callback to execute, value cannot be returned.
9
- * You'll typically want to wrap the callback `setState` to update React state.
10
- * @returns {void}
11
- */
12
- declare const deferCallback: (callback: () => void) => void;
13
- export default deferCallback;
@@ -1,39 +0,0 @@
1
- /*
2
- * Backpack - Skyscanner's Design System
3
- *
4
- * Copyright 2016 Skyscanner Ltd
5
- *
6
- * Licensed under the Apache License, Version 2.0 (the "License");
7
- * you may not use this file except in compliance with the License.
8
- * You may obtain a copy of the License at
9
- *
10
- * http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software
13
- * distributed under the License is distributed on an "AS IS" BASIS,
14
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- * See the License for the specific language governing permissions and
16
- * limitations under the License.
17
- */
18
-
19
- /**
20
- * Defer a task until the browser is idle, or till the next "tick" if the
21
- * browser does not support the idle callback API. This is useful for deferring
22
- * computationally heavy, non-essential tasks to keep the UI responsive. If the
23
- * task has not completed within the timeout, it will be executed regardless.
24
- *
25
- * https://developer.mozilla.org/en-US/docs/Web/API/Window/requestIdleCallback
26
- * @param {function} callback - callback to execute, value cannot be returned.
27
- * You'll typically want to wrap the callback `setState` to update React state.
28
- * @returns {void}
29
- */
30
- const deferCallback = callback => {
31
- if (window.requestIdleCallback) {
32
- window.requestIdleCallback(callback, {
33
- timeout: 500
34
- });
35
- } else {
36
- setTimeout(callback, 0);
37
- }
38
- };
39
- export default deferCallback;