@skyscanner/backpack-web 23.2.2 → 24.0.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-aria-live/src/BpkAriaLive.js +0 -1
- package/bpk-component-badge/src/BpkBadge.js +0 -1
- package/{bpk-scrim-utils/src/customPropTypes.js → bpk-component-banner-alert/index.d.ts} +16 -14
- package/bpk-component-banner-alert/src/AnimateAndFade.d.ts +61 -0
- package/bpk-component-banner-alert/src/AnimateAndFade.js +3 -9
- package/bpk-component-banner-alert/src/BpkBannerAlert.d.ts +29 -0
- package/bpk-component-banner-alert/src/BpkBannerAlert.js +42 -21
- package/bpk-component-banner-alert/src/BpkBannerAlertDismissable.d.ts +30 -0
- package/bpk-component-banner-alert/src/BpkBannerAlertDismissable.js +31 -33
- package/bpk-component-banner-alert/src/BpkBannerAlertExpandable.d.ts +35 -0
- package/bpk-component-banner-alert/src/BpkBannerAlertExpandable.js +15 -28
- package/bpk-component-banner-alert/src/BpkBannerAlertInner.d.ts +58 -0
- package/bpk-component-banner-alert/src/BpkBannerAlertInner.js +65 -87
- package/bpk-component-banner-alert/src/common-types.d.ts +44 -0
- package/bpk-component-banner-alert/src/common-types.js +5 -23
- package/bpk-component-banner-alert/src/themeAttributes.d.ts +20 -0
- package/bpk-component-banner-alert/src/withBannerAlertState.d.ts +169 -0
- package/bpk-component-banner-alert/src/withBannerAlertState.js +10 -29
- package/bpk-component-boilerplate/src/BpkBoilerplate.js +0 -1
- package/bpk-component-button/src/BpkButtonV2/BpkButton.js +0 -1
- package/bpk-component-calendar/index.d.ts +30 -0
- package/bpk-component-calendar/index.js +5 -4
- package/bpk-component-calendar/src/BpkCalendarContainer.d.ts +464 -0
- package/bpk-component-calendar/src/BpkCalendarContainer.js +19 -29
- package/bpk-component-calendar/src/BpkCalendarDate.d.ts +62 -0
- package/bpk-component-calendar/src/BpkCalendarDate.js +15 -39
- package/bpk-component-calendar/src/BpkCalendarGrid.d.ts +68 -0
- package/bpk-component-calendar/src/BpkCalendarGrid.js +9 -40
- package/bpk-component-calendar/src/BpkCalendarGridHeader.d.ts +36 -0
- package/bpk-component-calendar/src/BpkCalendarGridHeader.js +33 -52
- package/bpk-component-calendar/src/BpkCalendarGridTransition.d.ts +56 -0
- package/bpk-component-calendar/src/BpkCalendarGridTransition.js +43 -42
- package/bpk-component-calendar/src/BpkCalendarNav.d.ts +37 -0
- package/bpk-component-calendar/src/BpkCalendarNav.js +18 -32
- package/bpk-component-calendar/src/Week.d.ts +51 -0
- package/bpk-component-calendar/src/Week.js +48 -70
- package/bpk-component-calendar/src/composeCalendar.d.ts +55 -0
- package/bpk-component-calendar/src/composeCalendar.js +34 -95
- package/bpk-component-calendar/src/custom-proptypes-legacy.js +140 -0
- package/bpk-component-calendar/src/custom-proptypes.d.ts +46 -0
- package/bpk-component-calendar/src/custom-proptypes.js +2 -61
- package/bpk-component-calendar/src/date-utils.d.ts +54 -0
- package/bpk-component-calendar/src/utils.d.ts +26 -0
- package/bpk-component-calendar/src/utils.js +1 -0
- package/bpk-component-calendar/test-utils.d.ts +56 -0
- package/bpk-component-calendar/test-utils.js +2 -2
- package/bpk-component-card/index.d.ts +24 -0
- package/bpk-component-card/src/BpkCard.d.ts +39 -0
- package/bpk-component-card/src/BpkCard.js +9 -25
- package/bpk-component-card/src/BpkCardWrapper.d.ts +33 -0
- package/bpk-component-card/src/BpkCardWrapper.js +10 -18
- package/bpk-component-card/src/BpkDividedCard.d.ts +43 -0
- package/bpk-component-card/src/BpkDividedCard.js +9 -24
- package/bpk-component-chip/index.d.ts +32 -0
- package/bpk-component-chip/src/BpkDismissibleChip.d.ts +28 -0
- package/bpk-component-chip/src/BpkDismissibleChip.js +9 -8
- package/bpk-component-chip/src/BpkDropdownChip.d.ts +29 -0
- package/bpk-component-chip/src/BpkDropdownChip.js +39 -25
- package/bpk-component-chip/src/BpkSelectableChip.d.ts +39 -0
- package/bpk-component-chip/src/BpkSelectableChip.js +33 -48
- package/bpk-component-chip/src/commonTypes.d.ts +56 -0
- package/bpk-component-chip/src/commonTypes.js +8 -2
- package/bpk-component-dialog/src/BpkDialog.d.ts +1 -12
- package/bpk-component-dialog/src/BpkDialog.js +1 -2
- package/bpk-component-dialog/src/BpkDialogInner.d.ts +256 -2
- package/bpk-component-dialog/src/BpkDialogInner.js +0 -4
- package/bpk-component-dialog/src/common-types.d.ts +20 -21
- package/bpk-component-graphic-promotion/src/BpkGraphicPromo.js +0 -4
- package/bpk-component-icon/src/classNameModifierHOCFactory.js +0 -1
- package/bpk-component-icon/src/withAlignment.js +1 -1
- package/bpk-component-icon/src/withDescription.js +1 -1
- package/bpk-component-icon/src/withRtlSupport.js +0 -2
- package/bpk-component-input/index.d.ts +39 -0
- package/bpk-component-input/src/BpkClearButton.d.ts +28 -0
- package/bpk-component-input/src/BpkClearButton.js +6 -14
- package/bpk-component-input/src/BpkInput.d.ts +46 -0
- package/bpk-component-input/src/BpkInput.js +7 -3
- package/bpk-component-input/src/common-types.d.ts +91 -0
- package/bpk-component-input/src/common-types.js +4 -1
- package/bpk-component-input/src/withOpenEvents.d.ts +121 -0
- package/bpk-component-input/src/withOpenEvents.js +14 -25
- package/bpk-component-modal/index.d.ts +26 -0
- package/bpk-component-modal/index.js +13 -6
- package/bpk-component-modal/src/BpkModal.d.ts +32 -0
- package/bpk-component-modal/src/BpkModal.js +24 -44
- package/bpk-component-modal/src/BpkModalInner.d.ts +39 -0
- package/bpk-component-modal/src/BpkModalInner.js +67 -84
- package/bpk-component-modal/src/BpkModalV2/BpKModal.module.css +18 -0
- package/bpk-component-modal/src/BpkModalV2/BpkModal.d.ts +35 -0
- package/bpk-component-modal/src/BpkModalV2/BpkModal.js +131 -0
- package/bpk-component-modal/src/legacy-prop-types.js +86 -0
- package/bpk-component-modal/src/themeAttributes.js +1 -0
- package/bpk-component-rtl-toggle/index.d.ts +23 -0
- package/bpk-component-rtl-toggle/src/BpkRtlToggle.d.ts +41 -0
- package/bpk-component-rtl-toggle/src/BpkRtlToggle.js +9 -12
- package/bpk-component-rtl-toggle/src/updateOnDirectionChange.d.ts +151 -0
- package/bpk-component-rtl-toggle/src/updateOnDirectionChange.js +9 -2
- package/bpk-component-rtl-toggle/src/utils.d.ts +25 -0
- package/bpk-component-text/index.d.ts +21 -0
- package/bpk-component-text/index.js +0 -6
- package/bpk-component-text/src/BpkText.d.ts +60 -0
- package/bpk-component-text/src/BpkText.js +16 -56
- package/bpk-component-text/src/BpkText.module.css +1 -1
- package/bpk-component-tooltip/index.d.ts +24 -0
- package/bpk-component-tooltip/src/BpkTooltip.d.ts +29 -0
- package/bpk-component-tooltip/src/BpkTooltip.js +9 -26
- package/bpk-component-tooltip/src/BpkTooltipPortal.d.ts +60 -0
- package/bpk-component-tooltip/src/BpkTooltipPortal.js +13 -21
- package/bpk-component-tooltip/src/constants.d.ts +31 -0
- package/bpk-component-tooltip/src/constants.js +3 -1
- package/bpk-react-utils/index.d.ts +58 -0
- package/bpk-react-utils/index.js +1 -0
- package/bpk-react-utils/src/Portal.d.ts +76 -0
- package/bpk-react-utils/src/Portal.js +33 -43
- package/bpk-react-utils/src/TransitionInitialMount.d.ts +27 -0
- package/bpk-react-utils/src/TransitionInitialMount.js +7 -8
- package/bpk-react-utils/src/cssModules.d.ts +22 -0
- package/bpk-react-utils/src/deprecated.js +2 -1
- package/bpk-react-utils/src/deviceDetection.d.ts +22 -0
- package/bpk-react-utils/src/deviceDetection.js +3 -1
- package/bpk-react-utils/src/isRTL.d.ts +20 -0
- package/bpk-react-utils/src/isRTL.js +3 -1
- package/bpk-react-utils/src/withDefaultProps.d.ts +33 -0
- package/bpk-react-utils/src/withDefaultProps.js +11 -24
- package/bpk-react-utils/src/wrapDisplayName.d.ts +21 -0
- package/bpk-scrim-utils/index.d.ts +283 -0
- package/bpk-scrim-utils/src/BpkScrim.d.ts +24 -0
- package/bpk-scrim-utils/src/BpkScrim.js +5 -10
- package/bpk-scrim-utils/src/scroll-utils.d.ts +24 -0
- package/bpk-scrim-utils/src/scroll-utils.js +1 -1
- package/bpk-scrim-utils/src/withScrim.d.ts +96 -0
- package/bpk-scrim-utils/src/withScrim.js +5 -12
- package/package.json +1 -1
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = exports.CONFIGURATION = void 0;
|
|
7
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
8
7
|
var _base = require("@skyscanner/bpk-foundations-web/tokens/base.es6");
|
|
9
8
|
var _bpkComponentIcon = require("../../bpk-component-icon");
|
|
10
9
|
var _bpkAnimateHeight = _interopRequireDefault(require("../../bpk-animate-height"));
|
|
@@ -38,6 +37,12 @@ const _excluded = ["animateOnEnter", "animateOnLeave", "bannerClassName", "child
|
|
|
38
37
|
/* This is an internal component to Backpack that powers `BpkBannerAlert`,
|
|
39
38
|
* `BpkBannerAlertDismissable` and `BpkBannerAlertExpandable`.
|
|
40
39
|
*/
|
|
40
|
+
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
41
|
+
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
42
|
+
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
43
|
+
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
44
|
+
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
45
|
+
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
41
46
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
42
47
|
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; }
|
|
43
48
|
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; }
|
|
@@ -92,32 +97,32 @@ const ToggleButton = props => {
|
|
|
92
97
|
})
|
|
93
98
|
});
|
|
94
99
|
};
|
|
95
|
-
const BpkBannerAlertInner =
|
|
96
|
-
|
|
97
|
-
animateOnEnter,
|
|
98
|
-
animateOnLeave,
|
|
100
|
+
const BpkBannerAlertInner = _ref => {
|
|
101
|
+
let {
|
|
102
|
+
animateOnEnter = false,
|
|
103
|
+
animateOnLeave = false,
|
|
99
104
|
bannerClassName,
|
|
100
|
-
children,
|
|
105
|
+
children = null,
|
|
101
106
|
configuration,
|
|
102
|
-
dismissButtonLabel,
|
|
103
|
-
expanded,
|
|
104
|
-
icon,
|
|
107
|
+
dismissButtonLabel = '',
|
|
108
|
+
expanded = false,
|
|
109
|
+
icon = null,
|
|
105
110
|
message,
|
|
106
|
-
onDismiss,
|
|
107
|
-
onExpandToggle,
|
|
108
|
-
show,
|
|
109
|
-
toggleButtonLabel,
|
|
111
|
+
onDismiss = null,
|
|
112
|
+
onExpandToggle = null,
|
|
113
|
+
show = true,
|
|
114
|
+
toggleButtonLabel = '',
|
|
110
115
|
type
|
|
111
|
-
} =
|
|
112
|
-
rest = _objectWithoutProperties(
|
|
116
|
+
} = _ref,
|
|
117
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
113
118
|
const onBannerExpandToggle = () => {
|
|
114
|
-
if (
|
|
115
|
-
|
|
119
|
+
if (onExpandToggle) {
|
|
120
|
+
onExpandToggle(!expanded);
|
|
116
121
|
}
|
|
117
122
|
};
|
|
118
123
|
const onBannerDismiss = () => {
|
|
119
|
-
if (
|
|
120
|
-
|
|
124
|
+
if (onDismiss) {
|
|
125
|
+
onDismiss();
|
|
121
126
|
}
|
|
122
127
|
};
|
|
123
128
|
const isExpandable = configuration === CONFIGURATION.EXPANDABLE;
|
|
@@ -138,77 +143,50 @@ const BpkBannerAlertInner = props => {
|
|
|
138
143
|
*/
|
|
139
144
|
// Disabling 'click-events-have-key-events and interactive-supports-focus' because header element is not focusable.
|
|
140
145
|
// ToggleButton is focusable and works for this.
|
|
141
|
-
return (
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
className:
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
onClick: onBannerDismiss,
|
|
173
|
-
"aria-label": dismissButtonLabel,
|
|
174
|
-
label: dismissButtonLabel
|
|
175
|
-
})
|
|
176
|
-
})]
|
|
177
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_bpkAnimateHeight.default, {
|
|
178
|
-
duration: parseInt(_base.durationSm, 10),
|
|
179
|
-
height: showChildren ? 'auto' : 0,
|
|
180
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
181
|
-
className: getClassName('bpk-banner-alert__children-container'),
|
|
182
|
-
children: children
|
|
146
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_AnimateAndFade.default, _objectSpread(_objectSpread({
|
|
147
|
+
animateOnEnter: animateOnEnter,
|
|
148
|
+
animateOnLeave: dismissable || animateOnLeave,
|
|
149
|
+
show: show
|
|
150
|
+
}, rest), {}, {
|
|
151
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("section", {
|
|
152
|
+
className: sectionClassNames.join(' '),
|
|
153
|
+
role: "alert",
|
|
154
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
155
|
+
role: isExpandable ? 'button' : undefined,
|
|
156
|
+
className: headerClassNames.join(' '),
|
|
157
|
+
onClick: onBannerExpandToggle,
|
|
158
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
159
|
+
className: getClassName('bpk-banner-alert__icon'),
|
|
160
|
+
children: getIconForType(type, icon)
|
|
161
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
162
|
+
className: getClassName('bpk-banner-alert__message'),
|
|
163
|
+
children: message
|
|
164
|
+
}), isExpandable && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
165
|
+
className: getClassName('bpk-banner-alert__toggle'),
|
|
166
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ToggleButton, {
|
|
167
|
+
expanded: expanded,
|
|
168
|
+
label: toggleButtonLabel
|
|
169
|
+
})
|
|
170
|
+
}), dismissable && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
171
|
+
className: getClassName('bpk-banner-alert__toggle'),
|
|
172
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_bpkComponentCloseButton.default, {
|
|
173
|
+
className: getClassName('bpk-banner-alert__toggle-button'),
|
|
174
|
+
onClick: onBannerDismiss,
|
|
175
|
+
"aria-label": dismissButtonLabel,
|
|
176
|
+
label: dismissButtonLabel
|
|
183
177
|
})
|
|
184
178
|
})]
|
|
185
|
-
})
|
|
186
|
-
|
|
187
|
-
|
|
179
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_bpkAnimateHeight.default, {
|
|
180
|
+
duration: parseInt(_base.durationSm, 10),
|
|
181
|
+
height: showChildren ? 'auto' : 0,
|
|
182
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
183
|
+
className: getClassName('bpk-banner-alert__children-container'),
|
|
184
|
+
children: children
|
|
185
|
+
})
|
|
186
|
+
})]
|
|
187
|
+
})
|
|
188
|
+
}));
|
|
188
189
|
/* eslint-enable */
|
|
189
190
|
};
|
|
190
|
-
|
|
191
|
-
BpkBannerAlertInner.propTypes = _objectSpread(_objectSpread({}, _commonTypes.COMMON_PROP_TYPES), {}, {
|
|
192
|
-
configuration: _propTypes.default.oneOf([CONFIGURATION.NONE, CONFIGURATION.DISMISSABLE, CONFIGURATION.EXPANDABLE]).isRequired,
|
|
193
|
-
// Only relevant when configuration == CONFIGURATION.EXPANDABLE
|
|
194
|
-
children: _propTypes.default.node,
|
|
195
|
-
expanded: _propTypes.default.bool,
|
|
196
|
-
toggleButtonLabel: _propTypes.default.string,
|
|
197
|
-
onExpandToggle: _propTypes.default.func,
|
|
198
|
-
// Only relevant when configuration == CONFIGURATION.DISMISSABLE
|
|
199
|
-
dismissButtonLabel: _propTypes.default.string,
|
|
200
|
-
onDismiss: _propTypes.default.func
|
|
201
|
-
});
|
|
202
|
-
BpkBannerAlertInner.defaultProps = _objectSpread(_objectSpread({}, _commonTypes.COMMON_DEFAULT_PROPS), {}, {
|
|
203
|
-
configuration: CONFIGURATION.NONE,
|
|
204
|
-
// Only relevant when configuration == CONFIGURATION.EXPANDABLE
|
|
205
|
-
children: null,
|
|
206
|
-
expanded: false,
|
|
207
|
-
toggleButtonLabel: null,
|
|
208
|
-
onExpandToggle: null,
|
|
209
|
-
// Only relevant when configuration == CONFIGURATION.DISMISSABLE
|
|
210
|
-
dismissButtonLabel: '',
|
|
211
|
-
onDismiss: null
|
|
212
|
-
});
|
|
213
191
|
var _default = BpkBannerAlertInner;
|
|
214
192
|
exports.default = _default;
|
|
@@ -0,0 +1,44 @@
|
|
|
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 { FunctionComponent, ReactNode } from 'react';
|
|
20
|
+
|
|
21
|
+
export declare const ALERT_TYPES: {
|
|
22
|
+
readonly PRIMARY: 'primary';
|
|
23
|
+
readonly SUCCESS: 'success';
|
|
24
|
+
readonly WARN: 'warn';
|
|
25
|
+
readonly ERROR: 'error';
|
|
26
|
+
readonly NEUTRAL: 'neutral';
|
|
27
|
+
};
|
|
28
|
+
export type AlertTypeValue = typeof ALERT_TYPES[keyof typeof ALERT_TYPES];
|
|
29
|
+
export type CommonProps = {
|
|
30
|
+
type: AlertTypeValue;
|
|
31
|
+
message: ReactNode | string;
|
|
32
|
+
animateOnEnter?: boolean;
|
|
33
|
+
animateOnLeave?: boolean;
|
|
34
|
+
show?: boolean;
|
|
35
|
+
bannerClassName?: string | null;
|
|
36
|
+
icon?: FunctionComponent<any> | null;
|
|
37
|
+
[rest: string]: any;
|
|
38
|
+
};
|
|
39
|
+
export type OnExpandToggleHandler =
|
|
40
|
+
| ((expanded: boolean) => void)
|
|
41
|
+
| null
|
|
42
|
+
| undefined;
|
|
43
|
+
export type OnDismissHandler = (() => void) | null | undefined;
|
|
44
|
+
export type OnHideHandler = (() => void) | null | undefined;
|
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
8
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
6
|
+
exports.ALERT_TYPES = void 0;
|
|
9
7
|
/*
|
|
10
8
|
* Backpack - Skyscanner's Design System
|
|
11
9
|
*
|
|
@@ -22,29 +20,13 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
22
20
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
23
21
|
* See the License for the specific language governing permissions and
|
|
24
22
|
* limitations under the License.
|
|
25
|
-
*/
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
const ALERT_TYPES = {
|
|
26
26
|
PRIMARY: 'primary',
|
|
27
27
|
SUCCESS: 'success',
|
|
28
28
|
WARN: 'warn',
|
|
29
29
|
ERROR: 'error',
|
|
30
30
|
NEUTRAL: 'neutral'
|
|
31
31
|
};
|
|
32
|
-
exports.ALERT_TYPES = ALERT_TYPES;
|
|
33
|
-
const COMMON_PROP_TYPES = {
|
|
34
|
-
type: _propTypes.default.oneOf(Object.values(ALERT_TYPES)).isRequired,
|
|
35
|
-
message: _propTypes.default.node.isRequired,
|
|
36
|
-
animateOnEnter: _propTypes.default.bool,
|
|
37
|
-
animateOnLeave: _propTypes.default.bool,
|
|
38
|
-
show: _propTypes.default.bool,
|
|
39
|
-
bannerClassName: _propTypes.default.string,
|
|
40
|
-
icon: _propTypes.default.func
|
|
41
|
-
};
|
|
42
|
-
exports.COMMON_PROP_TYPES = COMMON_PROP_TYPES;
|
|
43
|
-
const COMMON_DEFAULT_PROPS = {
|
|
44
|
-
animateOnEnter: false,
|
|
45
|
-
animateOnLeave: false,
|
|
46
|
-
show: true,
|
|
47
|
-
bannerClassName: null,
|
|
48
|
-
icon: null
|
|
49
|
-
};
|
|
50
|
-
exports.COMMON_DEFAULT_PROPS = COMMON_DEFAULT_PROPS;
|
|
32
|
+
exports.ALERT_TYPES = ALERT_TYPES;
|
|
@@ -0,0 +1,20 @@
|
|
|
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 _default: string[];
|
|
20
|
+
export default _default;
|
|
@@ -0,0 +1,169 @@
|
|
|
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
|
+
/// <reference types="node" />
|
|
20
|
+
import type { ComponentType } from 'react';
|
|
21
|
+
|
|
22
|
+
type WithBannerAlertStateProps = {
|
|
23
|
+
onHide?: () => void;
|
|
24
|
+
hideAfter?: number;
|
|
25
|
+
};
|
|
26
|
+
declare const withBannerAlertState: <
|
|
27
|
+
P extends Partial<
|
|
28
|
+
import('./common-types').CommonProps & {
|
|
29
|
+
dismissButtonLabel: string;
|
|
30
|
+
onDismiss?: import('./common-types').OnDismissHandler;
|
|
31
|
+
} & {
|
|
32
|
+
children: import('react').ReactNode;
|
|
33
|
+
expanded?: boolean | undefined;
|
|
34
|
+
toggleButtonLabel: string;
|
|
35
|
+
onExpandToggle?: import('./common-types').OnExpandToggleHandler;
|
|
36
|
+
}
|
|
37
|
+
>,
|
|
38
|
+
>(
|
|
39
|
+
WrappedComponent: ComponentType<P>,
|
|
40
|
+
) => {
|
|
41
|
+
new (props: P & WithBannerAlertStateProps): {
|
|
42
|
+
hideIntervalId?: NodeJS.Timeout | null | undefined;
|
|
43
|
+
componentDidMount(): void;
|
|
44
|
+
componentWillUnmount(): void;
|
|
45
|
+
onExpandToggle: () => void;
|
|
46
|
+
onDismiss: () => void;
|
|
47
|
+
onHide: () => void;
|
|
48
|
+
render(): JSX.Element;
|
|
49
|
+
context: any;
|
|
50
|
+
setState<
|
|
51
|
+
K extends keyof {
|
|
52
|
+
expanded?: boolean | undefined;
|
|
53
|
+
show?: boolean | undefined;
|
|
54
|
+
},
|
|
55
|
+
>(
|
|
56
|
+
state:
|
|
57
|
+
| {
|
|
58
|
+
expanded?: boolean | undefined;
|
|
59
|
+
show?: boolean | undefined;
|
|
60
|
+
}
|
|
61
|
+
| ((
|
|
62
|
+
prevState: Readonly<{
|
|
63
|
+
expanded?: boolean | undefined;
|
|
64
|
+
show?: boolean | undefined;
|
|
65
|
+
}>,
|
|
66
|
+
props: Readonly<P & WithBannerAlertStateProps>,
|
|
67
|
+
) =>
|
|
68
|
+
| {
|
|
69
|
+
expanded?: boolean | undefined;
|
|
70
|
+
show?: boolean | undefined;
|
|
71
|
+
}
|
|
72
|
+
| Pick<
|
|
73
|
+
{
|
|
74
|
+
expanded?: boolean | undefined;
|
|
75
|
+
show?: boolean | undefined;
|
|
76
|
+
},
|
|
77
|
+
K
|
|
78
|
+
>
|
|
79
|
+
| null)
|
|
80
|
+
| Pick<
|
|
81
|
+
{
|
|
82
|
+
expanded?: boolean | undefined;
|
|
83
|
+
show?: boolean | undefined;
|
|
84
|
+
},
|
|
85
|
+
K
|
|
86
|
+
>
|
|
87
|
+
| null,
|
|
88
|
+
callback?: (() => void) | undefined,
|
|
89
|
+
): void;
|
|
90
|
+
forceUpdate(callback?: (() => void) | undefined): void;
|
|
91
|
+
readonly props: Readonly<P & WithBannerAlertStateProps> &
|
|
92
|
+
Readonly<{
|
|
93
|
+
children?: import('react').ReactNode;
|
|
94
|
+
}>;
|
|
95
|
+
state: Readonly<{
|
|
96
|
+
expanded?: boolean | undefined;
|
|
97
|
+
show?: boolean | undefined;
|
|
98
|
+
}>;
|
|
99
|
+
refs: {
|
|
100
|
+
[key: string]: import('react').ReactInstance;
|
|
101
|
+
};
|
|
102
|
+
shouldComponentUpdate?(
|
|
103
|
+
nextProps: Readonly<P & WithBannerAlertStateProps>,
|
|
104
|
+
nextState: Readonly<{
|
|
105
|
+
expanded?: boolean | undefined;
|
|
106
|
+
show?: boolean | undefined;
|
|
107
|
+
}>,
|
|
108
|
+
nextContext: any,
|
|
109
|
+
): boolean;
|
|
110
|
+
componentDidCatch?(
|
|
111
|
+
error: Error,
|
|
112
|
+
errorInfo: import('react').ErrorInfo,
|
|
113
|
+
): void;
|
|
114
|
+
getSnapshotBeforeUpdate?(
|
|
115
|
+
prevProps: Readonly<P & WithBannerAlertStateProps>,
|
|
116
|
+
prevState: Readonly<{
|
|
117
|
+
expanded?: boolean | undefined;
|
|
118
|
+
show?: boolean | undefined;
|
|
119
|
+
}>,
|
|
120
|
+
): any;
|
|
121
|
+
componentDidUpdate?(
|
|
122
|
+
prevProps: Readonly<P & WithBannerAlertStateProps>,
|
|
123
|
+
prevState: Readonly<{
|
|
124
|
+
expanded?: boolean | undefined;
|
|
125
|
+
show?: boolean | undefined;
|
|
126
|
+
}>,
|
|
127
|
+
snapshot?: any,
|
|
128
|
+
): void;
|
|
129
|
+
componentWillMount?(): void;
|
|
130
|
+
UNSAFE_componentWillMount?(): void;
|
|
131
|
+
componentWillReceiveProps?(
|
|
132
|
+
nextProps: Readonly<P & WithBannerAlertStateProps>,
|
|
133
|
+
nextContext: any,
|
|
134
|
+
): void;
|
|
135
|
+
UNSAFE_componentWillReceiveProps?(
|
|
136
|
+
nextProps: Readonly<P & WithBannerAlertStateProps>,
|
|
137
|
+
nextContext: any,
|
|
138
|
+
): void;
|
|
139
|
+
componentWillUpdate?(
|
|
140
|
+
nextProps: Readonly<P & WithBannerAlertStateProps>,
|
|
141
|
+
nextState: Readonly<{
|
|
142
|
+
expanded?: boolean | undefined;
|
|
143
|
+
show?: boolean | undefined;
|
|
144
|
+
}>,
|
|
145
|
+
nextContext: any,
|
|
146
|
+
): void;
|
|
147
|
+
UNSAFE_componentWillUpdate?(
|
|
148
|
+
nextProps: Readonly<P & WithBannerAlertStateProps>,
|
|
149
|
+
nextState: Readonly<{
|
|
150
|
+
expanded?: boolean | undefined;
|
|
151
|
+
show?: boolean | undefined;
|
|
152
|
+
}>,
|
|
153
|
+
nextContext: any,
|
|
154
|
+
): void;
|
|
155
|
+
};
|
|
156
|
+
displayName: string;
|
|
157
|
+
defaultProps: {
|
|
158
|
+
onDismiss: null;
|
|
159
|
+
onExpandToggle: null;
|
|
160
|
+
onHide: null;
|
|
161
|
+
expanded: boolean;
|
|
162
|
+
show: boolean;
|
|
163
|
+
hideAfter: null;
|
|
164
|
+
animateOnLeave: boolean;
|
|
165
|
+
children: null;
|
|
166
|
+
};
|
|
167
|
+
contextType?: import('react').Context<any> | undefined;
|
|
168
|
+
};
|
|
169
|
+
export default withBannerAlertState;
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
8
|
var _bpkReactUtils = require("../../bpk-react-utils");
|
|
10
9
|
var _BpkBannerAlertExpandable = _interopRequireDefault(require("./BpkBannerAlertExpandable"));
|
|
11
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -100,36 +99,18 @@ const withBannerAlertState = WrappedComponent => {
|
|
|
100
99
|
show
|
|
101
100
|
} = _this$props,
|
|
102
101
|
rest = _objectWithoutProperties(_this$props, _excluded);
|
|
103
|
-
return (
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}, rest), {}, {
|
|
113
|
-
children: children
|
|
114
|
-
}))
|
|
115
|
-
);
|
|
102
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(WrappedComponent, _objectSpread(_objectSpread({
|
|
103
|
+
expanded: this.state.expanded,
|
|
104
|
+
onExpandToggle: this.onExpandToggle,
|
|
105
|
+
onDismiss: this.onDismiss,
|
|
106
|
+
show: this.state.show,
|
|
107
|
+
animateOnLeave: hideAfter && hideAfter > 0 || animateOnLeave
|
|
108
|
+
}, rest), {}, {
|
|
109
|
+
children: children
|
|
110
|
+
}));
|
|
116
111
|
}
|
|
117
112
|
}
|
|
118
|
-
_defineProperty(component, "
|
|
119
|
-
onDismiss: _propTypes.default.func,
|
|
120
|
-
onExpandToggle: _propTypes.default.func,
|
|
121
|
-
onHide: _propTypes.default.func,
|
|
122
|
-
expanded: _propTypes.default.bool,
|
|
123
|
-
show: _propTypes.default.bool,
|
|
124
|
-
hideAfter: (props, propName, componentName, ...rest) => {
|
|
125
|
-
if (WrappedComponent === _BpkBannerAlertExpandable.default && typeof props[propName] === 'number') {
|
|
126
|
-
return new Error(`Invalid prop \`${propName}\` supplied to ${componentName}. \`${propName}\` is not supported for expandable banner alerts.`);
|
|
127
|
-
}
|
|
128
|
-
return _propTypes.default.number(props, propName, componentName, ...rest);
|
|
129
|
-
},
|
|
130
|
-
animateOnLeave: _propTypes.default.bool,
|
|
131
|
-
children: _propTypes.default.node
|
|
132
|
-
});
|
|
113
|
+
_defineProperty(component, "displayName", void 0);
|
|
133
114
|
_defineProperty(component, "defaultProps", {
|
|
134
115
|
onDismiss: null,
|
|
135
116
|
onExpandToggle: null,
|
|
@@ -25,7 +25,6 @@ const _excluded = ["className"];
|
|
|
25
25
|
* See the License for the specific language governing permissions and
|
|
26
26
|
* limitations under the License.
|
|
27
27
|
*/
|
|
28
|
-
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
29
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
30
29
|
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
30
|
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; }
|
|
@@ -26,7 +26,6 @@ const _excluded = ["children", "type", "size", "className", "href", "disabled",
|
|
|
26
26
|
* See the License for the specific language governing permissions and
|
|
27
27
|
* limitations under the License.
|
|
28
28
|
*/
|
|
29
|
-
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
30
29
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
31
30
|
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; }
|
|
32
31
|
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; }
|
|
@@ -0,0 +1,30 @@
|
|
|
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 BpkCalendarContainer, { withCalendarState } from './src/BpkCalendarContainer';
|
|
20
|
+
import BpkCalendarGrid, { BpkCalendarGridWithTransition } from './src/BpkCalendarGrid';
|
|
21
|
+
import BpkCalendarGridHeader from './src/BpkCalendarGridHeader';
|
|
22
|
+
import BpkCalendarNav from './src/BpkCalendarNav';
|
|
23
|
+
import BpkCalendarDate, { ROW_TYPES, SELECTION_TYPES } from './src/BpkCalendarDate';
|
|
24
|
+
import composeCalendar from './src/composeCalendar';
|
|
25
|
+
import { CALENDAR_SELECTION_TYPE } from './src/custom-proptypes';
|
|
26
|
+
import CustomPropTypes, { BpkCalendarGridPropTypes, BpkCalendarDatePropTypes } from './src/custom-proptypes-legacy';
|
|
27
|
+
import * as DateUtils from './src/date-utils';
|
|
28
|
+
import themeAttributes from './src/themeAttributes';
|
|
29
|
+
export default BpkCalendarContainer;
|
|
30
|
+
export { BpkCalendarGrid, BpkCalendarGridHeader, BpkCalendarNav, BpkCalendarDate, DateUtils, CALENDAR_SELECTION_TYPE, ROW_TYPES, SELECTION_TYPES, composeCalendar, withCalendarState, themeAttributes, BpkCalendarGridWithTransition, CustomPropTypes, BpkCalendarGridPropTypes, BpkCalendarDatePropTypes, };
|
|
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "BpkCalendarDate", {
|
|
|
12
12
|
Object.defineProperty(exports, "BpkCalendarDatePropTypes", {
|
|
13
13
|
enumerable: true,
|
|
14
14
|
get: function () {
|
|
15
|
-
return
|
|
15
|
+
return _customProptypesLegacy.BpkCalendarDatePropTypes;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
18
|
Object.defineProperty(exports, "BpkCalendarGrid", {
|
|
@@ -30,7 +30,7 @@ Object.defineProperty(exports, "BpkCalendarGridHeader", {
|
|
|
30
30
|
Object.defineProperty(exports, "BpkCalendarGridPropTypes", {
|
|
31
31
|
enumerable: true,
|
|
32
32
|
get: function () {
|
|
33
|
-
return
|
|
33
|
+
return _customProptypesLegacy.BpkCalendarGridPropTypes;
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
36
|
Object.defineProperty(exports, "BpkCalendarGridWithTransition", {
|
|
@@ -54,7 +54,7 @@ Object.defineProperty(exports, "CALENDAR_SELECTION_TYPE", {
|
|
|
54
54
|
Object.defineProperty(exports, "CustomPropTypes", {
|
|
55
55
|
enumerable: true,
|
|
56
56
|
get: function () {
|
|
57
|
-
return
|
|
57
|
+
return _customProptypesLegacy.default;
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
60
|
exports.DateUtils = void 0;
|
|
@@ -95,7 +95,8 @@ var _BpkCalendarGridHeader = _interopRequireDefault(require("./src/BpkCalendarGr
|
|
|
95
95
|
var _BpkCalendarNav = _interopRequireDefault(require("./src/BpkCalendarNav"));
|
|
96
96
|
var _BpkCalendarDate = _interopRequireWildcard(require("./src/BpkCalendarDate"));
|
|
97
97
|
var _composeCalendar = _interopRequireDefault(require("./src/composeCalendar"));
|
|
98
|
-
var _customProptypes =
|
|
98
|
+
var _customProptypes = require("./src/custom-proptypes");
|
|
99
|
+
var _customProptypesLegacy = _interopRequireWildcard(require("./src/custom-proptypes-legacy"));
|
|
99
100
|
var DateUtils = _interopRequireWildcard(require("./src/date-utils"));
|
|
100
101
|
exports.DateUtils = DateUtils;
|
|
101
102
|
var _themeAttributes = _interopRequireDefault(require("./src/themeAttributes"));
|