@skyscanner/backpack-web 25.1.0 → 25.2.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.
- package/bpk-component-badge/src/BpkBadge.js +4 -4
- package/bpk-component-breakpoint/index.d.ts +21 -0
- package/bpk-component-breakpoint/src/BpkBreakpoint.d.ts +39 -0
- package/bpk-component-breakpoint/src/BpkBreakpoint.js +18 -24
- package/bpk-component-button/src/BpkButtonV2/BpkButton.js +7 -7
- package/bpk-component-calendar/index.d.ts +3 -1
- package/bpk-component-calendar/src/BpkCalendarContainer.d.ts +9 -7
- package/bpk-component-calendar/src/BpkCalendarContainer.js +1 -1
- package/bpk-component-calendar/src/BpkCalendarDate.d.ts +12 -12
- package/bpk-component-calendar/src/BpkCalendarGrid.d.ts +4 -4
- package/bpk-component-calendar/src/BpkCalendarGridHeader.d.ts +1 -1
- package/bpk-component-calendar/src/Week.d.ts +9 -9
- package/bpk-component-calendar/src/Week.js +2 -2
- package/bpk-component-card/src/BpkCardWrapper.module.css +1 -1
- package/bpk-component-card/src/BpkDividedCard.js +3 -3
- package/bpk-component-chip/src/BpkDismissibleChip.js +3 -3
- package/bpk-component-chip/src/BpkSelectableChip.js +7 -7
- package/bpk-component-image/index.d.ts +27 -0
- package/bpk-component-image/src/BpkBackgroundImage.d.ts +50 -0
- package/bpk-component-image/src/BpkBackgroundImage.js +4 -16
- package/bpk-component-image/src/BpkImage.d.ts +48 -0
- package/bpk-component-image/src/BpkImage.js +10 -36
- package/bpk-component-image/src/BpkImageBorderRadiusStyles.d.ts +23 -0
- package/bpk-component-image/src/BpkImageBorderRadiusStyles.js +3 -1
- package/bpk-component-image/src/withLazyLoading.d.ts +73 -0
- package/bpk-component-image/src/withLazyLoading.js +18 -28
- package/bpk-component-image/src/withLoadingBehavior.d.ts +57 -0
- package/bpk-component-image/src/withLoadingBehavior.js +3 -2
- package/bpk-component-modal/src/BpkModal.js +13 -13
- package/bpk-component-modal/src/BpkModalInner.js +10 -10
- package/bpk-component-radio/src/BpkRadio.module.css +1 -1
- package/bpk-component-scrollable-calendar/index.d.ts +25 -0
- package/bpk-component-scrollable-calendar/src/BpkScrollableCalendar.d.ts +596 -0
- package/bpk-component-scrollable-calendar/src/BpkScrollableCalendarDate.d.ts +32 -0
- package/bpk-component-scrollable-calendar/src/BpkScrollableCalendarDate.js +21 -28
- package/bpk-component-scrollable-calendar/src/BpkScrollableCalendarGrid.d.ts +29 -0
- package/bpk-component-scrollable-calendar/src/BpkScrollableCalendarGrid.js +8 -7
- package/bpk-component-scrollable-calendar/src/BpkScrollableCalendarGridList.d.ts +56 -0
- package/bpk-component-scrollable-calendar/src/BpkScrollableCalendarGridList.js +8 -15
- package/bpk-component-scrollable-calendar/src/utils.d.ts +21 -0
- package/bpk-component-scrollable-calendar/src/utils.js +1 -1
- package/bpk-component-scrollable-calendar/test-utils.d.ts +52 -0
- package/bpk-component-scrollable-calendar/test-utils.js +2 -2
- package/bpk-component-text/src/BpkText.js +4 -4
- package/bpk-scrim-utils/src/withScrim.js +28 -31
- package/package.json +4 -4
|
@@ -4,36 +4,33 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
8
7
|
var _react = require("react");
|
|
9
8
|
var _bpkComponentCalendar = require("../../bpk-component-calendar");
|
|
10
9
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
10
|
const _excluded = ["isOutside"];
|
|
12
|
-
/*
|
|
13
|
-
* Backpack - Skyscanner's Design System
|
|
14
|
-
*
|
|
15
|
-
* Copyright 2016 Skyscanner Ltd
|
|
16
|
-
*
|
|
17
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
18
|
-
* you may not use this file except in compliance with the License.
|
|
19
|
-
* You may obtain a copy of the License at
|
|
20
|
-
*
|
|
21
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
22
|
-
*
|
|
23
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
24
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
25
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
26
|
-
* See the License for the specific language governing permissions and
|
|
27
|
-
* limitations under the License.
|
|
28
|
-
*/
|
|
29
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
30
11
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
31
12
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
32
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
33
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
34
|
-
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
35
13
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
36
14
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
15
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
16
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
17
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } /*
|
|
18
|
+
* Backpack - Skyscanner's Design System
|
|
19
|
+
*
|
|
20
|
+
* Copyright 2016 Skyscanner Ltd
|
|
21
|
+
*
|
|
22
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
23
|
+
* you may not use this file except in compliance with the License.
|
|
24
|
+
* You may obtain a copy of the License at
|
|
25
|
+
*
|
|
26
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
27
|
+
*
|
|
28
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
29
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
30
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
31
|
+
* See the License for the specific language governing permissions and
|
|
32
|
+
* limitations under the License.
|
|
33
|
+
*/
|
|
37
34
|
class BpkScrollableCalendarDate extends _react.PureComponent {
|
|
38
35
|
render() {
|
|
39
36
|
const _this$props = this.props,
|
|
@@ -41,16 +38,12 @@ class BpkScrollableCalendarDate extends _react.PureComponent {
|
|
|
41
38
|
isOutside
|
|
42
39
|
} = _this$props,
|
|
43
40
|
rest = _objectWithoutProperties(_this$props, _excluded);
|
|
44
|
-
|
|
45
41
|
// Returning null when isOutside is true ensures only focused month displays in grid
|
|
46
42
|
return !isOutside ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_bpkComponentCalendar.BpkCalendarDate, _objectSpread({}, rest)) : null;
|
|
47
43
|
}
|
|
48
44
|
}
|
|
49
|
-
BpkScrollableCalendarDate
|
|
50
|
-
isOutside: _propTypes.default.bool
|
|
51
|
-
});
|
|
52
|
-
BpkScrollableCalendarDate.defaultProps = {
|
|
45
|
+
_defineProperty(BpkScrollableCalendarDate, "defaultProps", {
|
|
53
46
|
isOutside: false
|
|
54
|
-
};
|
|
47
|
+
});
|
|
55
48
|
var _default = BpkScrollableCalendarDate;
|
|
56
49
|
exports.default = _default;
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
import type { ElementType } from 'react';
|
|
20
|
+
import type { BpkCalendarGridProps } from '../../bpk-component-calendar';
|
|
21
|
+
type Props = Partial<BpkCalendarGridProps> & {
|
|
22
|
+
DateComponent: ElementType;
|
|
23
|
+
month: Date;
|
|
24
|
+
formatDateFull: (date: Date) => Date | string;
|
|
25
|
+
weekStartsOn: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
26
|
+
formatMonth: (date: Date) => Date | string;
|
|
27
|
+
};
|
|
28
|
+
declare const BpkScrollableCalendarGrid: ({ className, formatMonth, ignoreOutsideDate, month, ...rest }: Props) => JSX.Element;
|
|
29
|
+
export default BpkScrollableCalendarGrid;
|
|
@@ -9,7 +9,7 @@ var _bpkComponentText = _interopRequireWildcard(require("../../bpk-component-tex
|
|
|
9
9
|
var _bpkComponentCalendar = require("../../bpk-component-calendar");
|
|
10
10
|
var _BpkScrollableCalendarGridModule = _interopRequireDefault(require("./BpkScrollableCalendarGrid.module.css"));
|
|
11
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
-
const _excluded = ["className", "month"];
|
|
12
|
+
const _excluded = ["className", "formatMonth", "ignoreOutsideDate", "month"];
|
|
13
13
|
/*
|
|
14
14
|
* Backpack - Skyscanner's Design System
|
|
15
15
|
*
|
|
@@ -38,12 +38,14 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
|
|
|
38
38
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
39
39
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
40
40
|
const getClassName = (0, _bpkReactUtils.cssModules)(_BpkScrollableCalendarGridModule.default);
|
|
41
|
-
const BpkScrollableCalendarGrid =
|
|
42
|
-
|
|
41
|
+
const BpkScrollableCalendarGrid = _ref => {
|
|
42
|
+
let {
|
|
43
43
|
className,
|
|
44
|
+
formatMonth,
|
|
45
|
+
ignoreOutsideDate,
|
|
44
46
|
month
|
|
45
|
-
} =
|
|
46
|
-
rest = _objectWithoutProperties(
|
|
47
|
+
} = _ref,
|
|
48
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
47
49
|
const classNames = getClassName('bpk-scrollable-calendar-grid', className);
|
|
48
50
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
49
51
|
className: classNames,
|
|
@@ -51,13 +53,12 @@ const BpkScrollableCalendarGrid = props => {
|
|
|
51
53
|
className: getClassName('bpk-scrollable-calendar-grid__title'),
|
|
52
54
|
tagName: "h1",
|
|
53
55
|
textStyle: _bpkComponentText.TEXT_STYLES.heading4,
|
|
54
|
-
children:
|
|
56
|
+
children: formatMonth(month)
|
|
55
57
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_bpkComponentCalendar.BpkCalendarGrid, _objectSpread({
|
|
56
58
|
month: month,
|
|
57
59
|
ignoreOutsideDate: true
|
|
58
60
|
}, rest))]
|
|
59
61
|
});
|
|
60
62
|
};
|
|
61
|
-
BpkScrollableCalendarGrid.propTypes = _objectSpread({}, _bpkComponentCalendar.BpkCalendarGridPropTypes);
|
|
62
63
|
var _default = BpkScrollableCalendarGrid;
|
|
63
64
|
exports.default = _default;
|
|
@@ -0,0 +1,56 @@
|
|
|
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
|
+
import { Component } from 'react';
|
|
20
|
+
import type { ElementType } from 'react';
|
|
21
|
+
import type { BpkCalendarGridProps } from '../../bpk-component-calendar';
|
|
22
|
+
type Props = Partial<BpkCalendarGridProps> & {
|
|
23
|
+
minDate: Date;
|
|
24
|
+
maxDate: Date;
|
|
25
|
+
DateComponent: ElementType;
|
|
26
|
+
formatDateFull: (date: Date) => Date | string;
|
|
27
|
+
month: Date;
|
|
28
|
+
weekStartsOn: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
29
|
+
formatMonth: (date: Date) => Date | string;
|
|
30
|
+
focusedDate?: Date | null;
|
|
31
|
+
};
|
|
32
|
+
type State = {
|
|
33
|
+
months: Date[];
|
|
34
|
+
monthItemHeights: number[];
|
|
35
|
+
outerHeight: number;
|
|
36
|
+
};
|
|
37
|
+
declare class BpkScrollableCalendarGridList extends Component<Props, State> {
|
|
38
|
+
outerDiv: HTMLDivElement | null;
|
|
39
|
+
static defaultProps: {
|
|
40
|
+
className: null;
|
|
41
|
+
focusedDate: null;
|
|
42
|
+
};
|
|
43
|
+
constructor(props: Props);
|
|
44
|
+
componentDidMount: () => void;
|
|
45
|
+
componentWillUnmount: () => void;
|
|
46
|
+
getHtmlElement: () => {} | null;
|
|
47
|
+
getItemSize: (index: number) => number;
|
|
48
|
+
setComponentHeight: () => void;
|
|
49
|
+
rowRenderer: ({ index, style }: {
|
|
50
|
+
index: number;
|
|
51
|
+
style: {};
|
|
52
|
+
}) => JSX.Element;
|
|
53
|
+
calculateOffsetInPixels: (numberOfMonths: number) => number;
|
|
54
|
+
render(): JSX.Element;
|
|
55
|
+
}
|
|
56
|
+
export default BpkScrollableCalendarGridList;
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
8
7
|
var _react = require("react");
|
|
9
8
|
var _dateFns = require("date-fns");
|
|
10
9
|
var _reactWindow = require("react-window");
|
|
@@ -35,7 +34,7 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
|
|
|
35
34
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
36
35
|
* See the License for the specific language governing permissions and
|
|
37
36
|
* limitations under the License.
|
|
38
|
-
*/
|
|
37
|
+
*/ // @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
39
38
|
const getClassName = (0, _bpkReactUtils.cssModules)(_BpkScrollableCalendarGridListModule.default);
|
|
40
39
|
|
|
41
40
|
// The `react-window` API requires the height in pixels to be specified.
|
|
@@ -49,6 +48,7 @@ const ESTIMATED_MONTH_ITEM_HEIGHT = BASE_MONTH_ITEM_HEIGHT + 5 * ROW_HEIGHT;
|
|
|
49
48
|
class BpkScrollableCalendarGridList extends _react.Component {
|
|
50
49
|
constructor(props) {
|
|
51
50
|
super(props);
|
|
51
|
+
_defineProperty(this, "outerDiv", void 0);
|
|
52
52
|
_defineProperty(this, "componentDidMount", () => {
|
|
53
53
|
this.setComponentHeight();
|
|
54
54
|
if (typeof document !== 'undefined') {
|
|
@@ -123,11 +123,8 @@ class BpkScrollableCalendarGridList extends _react.Component {
|
|
|
123
123
|
minDate,
|
|
124
124
|
selectionConfiguration
|
|
125
125
|
} = this.props;
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
startDate
|
|
129
|
-
} = selectionConfiguration || {};
|
|
130
|
-
const selectedDate = focusedDate || date || startDate;
|
|
126
|
+
const date = selectionConfiguration?.type === _bpkComponentCalendar.CALENDAR_SELECTION_TYPE.single ? selectionConfiguration?.date : selectionConfiguration?.startDate;
|
|
127
|
+
const selectedDate = focusedDate || date;
|
|
131
128
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
132
129
|
className: getClassName('bpk-scrollable-calendar-grid-list', this.props.className),
|
|
133
130
|
ref: div => {
|
|
@@ -151,15 +148,11 @@ class BpkScrollableCalendarGridList extends _react.Component {
|
|
|
151
148
|
});
|
|
152
149
|
}
|
|
153
150
|
}
|
|
154
|
-
BpkScrollableCalendarGridList
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
maxDate: _propTypes.default.instanceOf(Date).isRequired,
|
|
158
|
-
focusedDate: _propTypes.default.instanceOf(Date)
|
|
159
|
-
}, _bpkComponentCalendar.BpkCalendarGridPropTypes);
|
|
160
|
-
BpkScrollableCalendarGridList.defaultProps = {
|
|
151
|
+
_defineProperty(BpkScrollableCalendarGridList, "defaultProps", {
|
|
152
|
+
// Disabling as the rule doesn't work when types are defined in a different file
|
|
153
|
+
/* eslint-disable react/default-props-match-prop-types */
|
|
161
154
|
className: null,
|
|
162
155
|
focusedDate: null
|
|
163
|
-
};
|
|
156
|
+
});
|
|
164
157
|
var _default = BpkScrollableCalendarGridList;
|
|
165
158
|
exports.default = _default;
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
declare const getMonthsArray: (startDate: Date, count: number) => Date[];
|
|
20
|
+
declare const getMonthItemHeights: (months: Date[], weekStartsOn: 0 | 1 | 2 | 3 | 4 | 5 | 6, columnCount: number, rowHeight: number, baseMonthItemHeight: number) => number[];
|
|
21
|
+
export { getMonthsArray, getMonthItemHeights };
|
|
@@ -37,7 +37,7 @@ exports.getMonthsArray = getMonthsArray;
|
|
|
37
37
|
const getMonthItemHeights = (months, weekStartsOn, columnCount, rowHeight, baseMonthItemHeight) => {
|
|
38
38
|
const monthItemHeights = months.map(month => {
|
|
39
39
|
const firstDayOffset = (month.getDay() + 7 - weekStartsOn) % 7;
|
|
40
|
-
const monthLength = _bpkComponentCalendar.DateUtils.daysInMonth(month.
|
|
40
|
+
const monthLength = _bpkComponentCalendar.DateUtils.daysInMonth(month.getFullYear(), month.getMonth());
|
|
41
41
|
const calendarGridSpaces = firstDayOffset + monthLength;
|
|
42
42
|
const rowCount = Math.ceil(calendarGridSpaces / columnCount);
|
|
43
43
|
return baseMonthItemHeight + rowHeight * rowCount;
|
|
@@ -0,0 +1,52 @@
|
|
|
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
|
+
export declare const formatDateFull: (date: Date) => string;
|
|
20
|
+
export declare const formatDateFullArabic: (date: Date) => string;
|
|
21
|
+
export declare const formatDateFullJapanese: (date: Date) => string;
|
|
22
|
+
export declare const formatMonth: (date: Date) => string;
|
|
23
|
+
export declare const formatMonthArabic: (date: Date) => string;
|
|
24
|
+
export declare const formatMonthJapanese: (date: Date) => string;
|
|
25
|
+
export declare const weekDays: {
|
|
26
|
+
name: string;
|
|
27
|
+
nameAbbr: string;
|
|
28
|
+
index: number;
|
|
29
|
+
isWeekend: boolean;
|
|
30
|
+
}[];
|
|
31
|
+
export declare const weekDaysMoreWeekend: {
|
|
32
|
+
name: string;
|
|
33
|
+
nameAbbr: string;
|
|
34
|
+
index: number;
|
|
35
|
+
isWeekend: boolean;
|
|
36
|
+
}[];
|
|
37
|
+
export declare const weekDaysArabic: {
|
|
38
|
+
name: string;
|
|
39
|
+
nameAbbr: string;
|
|
40
|
+
nameShort: string;
|
|
41
|
+
index: number;
|
|
42
|
+
cldrKey: string;
|
|
43
|
+
isWeekend: boolean;
|
|
44
|
+
}[];
|
|
45
|
+
export declare const weekDaysJapanese: {
|
|
46
|
+
name: string;
|
|
47
|
+
nameAbbr: string;
|
|
48
|
+
nameShort: string;
|
|
49
|
+
index: number;
|
|
50
|
+
cldrKey: string;
|
|
51
|
+
isWeekend: boolean;
|
|
52
|
+
}[];
|
|
@@ -28,13 +28,13 @@ const formatDateFull = date => (0, _format.default)(date, 'EEEE, do MMMM yyyy');
|
|
|
28
28
|
exports.formatDateFull = formatDateFull;
|
|
29
29
|
const formatDateFullArabic = date => {
|
|
30
30
|
const dateString = 'EEEE, dd، MMMM، yyyy';
|
|
31
|
-
const newString = dateString.replace('yyyy', date.getUTCFullYear());
|
|
31
|
+
const newString = dateString.replace('yyyy', `${date.getUTCFullYear()}`);
|
|
32
32
|
return (0, _format.default)(date, newString);
|
|
33
33
|
};
|
|
34
34
|
exports.formatDateFullArabic = formatDateFullArabic;
|
|
35
35
|
const formatDateFullJapanese = date => {
|
|
36
36
|
const dateString = 'Y年M月d日EEEE';
|
|
37
|
-
const newString = dateString.replace('Y', date.getUTCFullYear());
|
|
37
|
+
const newString = dateString.replace('Y', `${date.getUTCFullYear()}`);
|
|
38
38
|
return (0, _format.default)(date, newString);
|
|
39
39
|
};
|
|
40
40
|
exports.formatDateFullJapanese = formatDateFullJapanese;
|
|
@@ -7,7 +7,7 @@ exports.default = exports.TEXT_STYLES = void 0;
|
|
|
7
7
|
var _bpkReactUtils = require("../../bpk-react-utils");
|
|
8
8
|
var _BpkTextModule = _interopRequireDefault(require("./BpkText.module.css"));
|
|
9
9
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
-
const _excluded = ["
|
|
10
|
+
const _excluded = ["children", "className", "tagName", "textStyle"];
|
|
11
11
|
/*
|
|
12
12
|
* Backpack - Skyscanner's Design System
|
|
13
13
|
*
|
|
@@ -66,10 +66,10 @@ const TEXT_STYLES = {
|
|
|
66
66
|
exports.TEXT_STYLES = TEXT_STYLES;
|
|
67
67
|
const BpkText = _ref => {
|
|
68
68
|
let {
|
|
69
|
-
|
|
70
|
-
tagName: TagName = 'span',
|
|
69
|
+
children,
|
|
71
70
|
className = null,
|
|
72
|
-
|
|
71
|
+
tagName: TagName = 'span',
|
|
72
|
+
textStyle = TEXT_STYLES.bodyDefault
|
|
73
73
|
} = _ref,
|
|
74
74
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
75
75
|
const classNames = getClassName('bpk-text', `bpk-text--${textStyle}`, className);
|
|
@@ -56,25 +56,28 @@ const withScrim = WrappedComponent => {
|
|
|
56
56
|
} = this.props;
|
|
57
57
|
const applicationElement = getApplicationElement();
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
/**
|
|
60
|
+
* iPhones & iPads need to have a fixed body
|
|
61
|
+
* and scrolling stored to prevent some iOS specific issues occuring
|
|
62
|
+
*
|
|
63
|
+
* Issue description:
|
|
64
|
+
* iOS safari does not prevent scrolling on the underlying content.
|
|
65
|
+
* Without the below fixes this results in users being able to scroll below any modal or dialog that uses withScrim.
|
|
66
|
+
*
|
|
67
|
+
* The fixes can be summaried here: https://markus.oberlehner.net/blog/simple-solution-to-prevent-body-scrolling-on-ios/
|
|
68
|
+
*
|
|
69
|
+
* The most dangerous of the fixes below is the fixBody, this function applies changes to the <body> style.
|
|
70
|
+
* This has the potential to override any custom styles already applied. The assumption here is that no one internally is making these changes to body.
|
|
71
|
+
*
|
|
72
|
+
* There is a corresponding set of functions in the componentWillUnmount block that deals with undoing these changes.
|
|
73
|
+
*/
|
|
74
|
+
if (isIphone || isIpad) {
|
|
63
75
|
(0, _scrollUtils.storeScroll)();
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
if (isIpad) {
|
|
70
|
-
(0, _scrollUtils.storeScroll)();
|
|
71
|
-
(0, _scrollUtils.fixBody)();
|
|
72
|
-
} else {
|
|
73
|
-
(0, _scrollUtils.lockScroll)();
|
|
74
|
-
}
|
|
75
|
-
if (applicationElement) {
|
|
76
|
-
applicationElement.setAttribute('aria-hidden', 'true');
|
|
77
|
-
}
|
|
76
|
+
(0, _scrollUtils.lockScroll)();
|
|
77
|
+
(0, _scrollUtils.fixBody)();
|
|
78
|
+
}
|
|
79
|
+
if (applicationElement) {
|
|
80
|
+
applicationElement.setAttribute('aria-hidden', 'true');
|
|
78
81
|
}
|
|
79
82
|
_a11yFocusStore.default.storeFocus();
|
|
80
83
|
if (this.dialogElement) {
|
|
@@ -88,19 +91,13 @@ const withScrim = WrappedComponent => {
|
|
|
88
91
|
isIphone
|
|
89
92
|
} = this.props;
|
|
90
93
|
const applicationElement = getApplicationElement();
|
|
91
|
-
if (isIphone
|
|
92
|
-
|
|
93
|
-
(0, _scrollUtils.
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
} else {
|
|
99
|
-
(0, _scrollUtils.unlockScroll)();
|
|
100
|
-
}
|
|
101
|
-
if (applicationElement) {
|
|
102
|
-
applicationElement.removeAttribute('aria-hidden');
|
|
103
|
-
}
|
|
94
|
+
if (isIphone || isIpad) {
|
|
95
|
+
setTimeout(_scrollUtils.restoreScroll, 0);
|
|
96
|
+
(0, _scrollUtils.unlockScroll)();
|
|
97
|
+
(0, _scrollUtils.unfixBody)();
|
|
98
|
+
}
|
|
99
|
+
if (applicationElement) {
|
|
100
|
+
applicationElement.removeAttribute('aria-hidden');
|
|
104
101
|
}
|
|
105
102
|
_a11yFocusScope.default.unscopeFocus();
|
|
106
103
|
_a11yFocusStore.default.restoreFocus();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skyscanner/backpack-web",
|
|
3
|
-
"version": "25.
|
|
3
|
+
"version": "25.2.0",
|
|
4
4
|
"description": "Backpack Design System web library",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -24,11 +24,11 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@popperjs/core": "^2.11.5",
|
|
26
26
|
"@react-google-maps/api": "^2.12.0",
|
|
27
|
-
"@skyscanner/bpk-foundations-web": "^
|
|
28
|
-
"@skyscanner/bpk-svgs": "^16.3.
|
|
27
|
+
"@skyscanner/bpk-foundations-web": "^16.1.0",
|
|
28
|
+
"@skyscanner/bpk-svgs": "^16.3.4",
|
|
29
29
|
"a11y-focus-scope": "^1.1.3",
|
|
30
30
|
"a11y-focus-store": "^1.0.0",
|
|
31
|
-
"bpk-mixins": "^
|
|
31
|
+
"bpk-mixins": "^41.1.0",
|
|
32
32
|
"d3-path": "^2.0.0",
|
|
33
33
|
"d3-scale": "^4.0.2",
|
|
34
34
|
"date-fns": "^2.21.1",
|