@skyscanner/backpack-web 34.16.0 → 35.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.d.ts +1 -1
- package/bpk-component-badge/src/BpkBadge.d.ts +1 -1
- package/bpk-component-banner-alert/src/AnimateAndFade.d.ts +1 -1
- package/bpk-component-banner-alert/src/BpkBannerAlert.d.ts +1 -1
- package/bpk-component-banner-alert/src/BpkBannerAlertDismissable.d.ts +1 -1
- package/bpk-component-banner-alert/src/BpkBannerAlertExpandable.d.ts +1 -1
- package/bpk-component-banner-alert/src/BpkBannerAlertInner.d.ts +1 -1
- package/bpk-component-banner-alert/src/withBannerAlertState.d.ts +3 -5
- package/bpk-component-boilerplate/src/BpkBoilerplate.d.ts +1 -1
- package/bpk-component-bottom-sheet/src/BpkBottomSheet.d.ts +1 -1
- package/bpk-component-button/BpkButtonDestructive.d.ts +1 -1
- package/bpk-component-button/BpkButtonFeatured.d.ts +1 -1
- package/bpk-component-button/BpkButtonLink.d.ts +1 -1
- package/bpk-component-button/BpkButtonLinkOnDark.d.ts +1 -1
- package/bpk-component-button/BpkButtonPrimary.d.ts +1 -1
- package/bpk-component-button/BpkButtonPrimaryOnDark.d.ts +1 -1
- package/bpk-component-button/BpkButtonPrimaryOnLight.d.ts +1 -1
- package/bpk-component-button/BpkButtonSecondary.d.ts +1 -1
- package/bpk-component-button/BpkButtonSecondaryOnDark.d.ts +1 -1
- package/bpk-component-button/src/BpkButton.d.ts +1 -1
- package/bpk-component-button/src/BpkButtonBase.d.ts +1 -1
- package/bpk-component-button/src/BpkButtonV2/BpkButton.d.ts +1 -1
- package/bpk-component-calendar/src/BpkCalendarContainer.d.ts +6 -10
- package/bpk-component-calendar/src/BpkCalendarDate.d.ts +1 -1
- package/bpk-component-calendar/src/BpkCalendarGrid.d.ts +2 -2
- package/bpk-component-calendar/src/BpkCalendarGridHeader.d.ts +1 -1
- package/bpk-component-calendar/src/BpkCalendarGridTransition.d.ts +2 -2
- package/bpk-component-calendar/src/BpkCalendarNav.d.ts +1 -1
- package/bpk-component-calendar/src/BpkCalendarWeek.d.ts +1 -1
- package/bpk-component-calendar/src/composeCalendar.d.ts +1 -1
- package/bpk-component-card/src/BpkCard.d.ts +1 -1
- package/bpk-component-card/src/BpkCardWrapper.d.ts +1 -1
- package/bpk-component-card/src/BpkDividedCard.d.ts +1 -1
- package/bpk-component-card-button/src/BpkSaveButton.d.ts +1 -1
- package/bpk-component-carousel/src/BpkCarousel.d.ts +1 -1
- package/bpk-component-carousel/src/BpkCarouselContainer.d.ts +1 -1
- package/bpk-component-carousel/src/utils.test.js +30 -0
- package/bpk-component-chip/src/BpkDismissibleChip.d.ts +1 -1
- package/bpk-component-chip/src/BpkDropdownChip.d.ts +1 -1
- package/bpk-component-chip/src/BpkIconChip.d.ts +1 -1
- package/bpk-component-chip/src/BpkSelectableChip.d.ts +1 -1
- package/bpk-component-chip-group/src/BpkMultiSelectChipGroup.d.ts +1 -1
- package/bpk-component-chip-group/src/BpkSingleSelectChipGroup.d.ts +1 -1
- package/bpk-component-chip-group/src/Nudger.d.ts +1 -1
- package/bpk-component-close-button/src/BpkCloseButton.d.ts +10 -0
- package/bpk-component-close-button/src/BpkCloseButton.js +21 -37
- package/bpk-component-datatable/src/BpkDataTable.d.ts +1 -1
- package/bpk-component-datatable/src/BpkDataTableHeader.d.ts +1 -1
- package/bpk-component-datepicker/src/BpkDatepicker.d.ts +3 -5
- package/bpk-component-description-list/src/BpkDescriptionDetails.d.ts +1 -1
- package/bpk-component-description-list/src/BpkDescriptionList.d.ts +1 -1
- package/bpk-component-description-list/src/BpkDescriptionTerm.d.ts +1 -1
- package/bpk-component-dialog/src/BpkDialog.d.ts +1 -1
- package/bpk-component-dialog/src/BpkDialogInner.d.ts +7 -11
- package/bpk-component-floating-notification/src/BpkFloatingNotification.d.ts +1 -1
- package/bpk-component-graphic-promotion/src/BpkGraphicPromo.d.ts +1 -1
- package/bpk-component-icon/index.d.ts +2 -2
- package/bpk-component-icon/src/classNameModifierHOCFactory.d.ts +1 -1
- package/bpk-component-icon/src/withAlignment.d.ts +1 -1
- package/bpk-component-icon/src/withRtlSupport.d.ts +1 -1
- package/bpk-component-image/src/BpkBackgroundImage.d.ts +1 -1
- package/bpk-component-image/src/BpkImage.d.ts +1 -1
- package/bpk-component-image/src/withLazyLoading.d.ts +3 -5
- package/bpk-component-image/src/withLoadingBehavior.d.ts +3 -5
- package/bpk-component-info-banner/src/AnimateAndFade.d.ts +1 -1
- package/bpk-component-info-banner/src/BpkInfoBanner.d.ts +1 -1
- package/bpk-component-info-banner/src/BpkInfoBannerDismissable.d.ts +1 -1
- package/bpk-component-info-banner/src/BpkInfoBannerExpandable.d.ts +1 -1
- package/bpk-component-info-banner/src/BpkInfoBannerInner.d.ts +1 -1
- package/bpk-component-info-banner/src/withBannerAlertState.d.ts +3 -5
- package/bpk-component-input/src/BpkInput.d.ts +1 -1
- package/bpk-component-input/src/BpkInput.js +1 -1
- package/bpk-component-input/src/common-types.d.ts +1 -1
- package/bpk-component-input/src/withOpenEvents.d.ts +2 -4
- package/bpk-component-inset-banner/src/BpkInsetBanner.d.ts +1 -1
- package/bpk-component-journey-arrow/src/BpkJourneyArrow.d.ts +1 -1
- package/bpk-component-loading-button/src/BpkLoadingButton.d.ts +6 -38
- package/bpk-component-loading-button/src/BpkLoadingButton.js +13 -44
- package/bpk-component-map/src/BpkBasicMapMarker.d.ts +1 -1
- package/bpk-component-map/src/BpkPriceMarkerV2/BpkPriceMarker.d.ts +1 -1
- package/bpk-component-modal/src/BpkModal.d.ts +1 -1
- package/bpk-component-modal/src/BpkModalInner.d.ts +1 -1
- package/bpk-component-modal/src/BpkModalV2/BpkModal.d.ts +1 -1
- package/bpk-component-navigation-bar/src/BpkNavigationBar.d.ts +1 -1
- package/bpk-component-navigation-bar/src/BpkNavigationBarButtonLink.d.ts +1 -1
- package/bpk-component-navigation-bar/src/BpkNavigationBarIconButton.d.ts +1 -1
- package/bpk-component-nudger/index.d.ts +1 -2
- package/bpk-component-nudger/index.js +1 -2
- package/bpk-component-nudger/src/BpkNudger.d.ts +1 -1
- package/bpk-component-nudger/src/BpkNudger.js +102 -20
- package/bpk-component-nudger/src/BpkNudger.module.css +1 -1
- package/bpk-component-nudger/src/common-types.d.ts +7 -5
- package/bpk-component-overlay/src/BpkOverlay.d.ts +1 -1
- package/bpk-component-popover/src/BpkPopover.d.ts +1 -1
- package/bpk-component-rating/src/BpkRating.d.ts +1 -1
- package/bpk-component-rtl-toggle/src/BpkRtlToggle.d.ts +1 -1
- package/bpk-component-rtl-toggle/src/updateOnDirectionChange.d.ts +7 -11
- package/bpk-component-scrollable-calendar/src/BpkScrollableCalendar.d.ts +2 -4
- package/bpk-component-scrollable-calendar/src/BpkScrollableCalendarDate.d.ts +1 -1
- package/bpk-component-scrollable-calendar/src/BpkScrollableCalendarGrid.d.ts +3 -3
- package/bpk-component-scrollable-calendar/src/BpkScrollableCalendarGridList.d.ts +3 -3
- package/bpk-component-section-header/src/BpkSectionHeader.d.ts +1 -1
- package/bpk-component-segmented-control/src/BpkSegmentedControl.d.ts +1 -1
- package/bpk-component-skeleton/src/BpkBaseSkeleton.d.ts +1 -1
- package/bpk-component-skeleton/src/BpkSkeleton.d.ts +1 -1
- package/bpk-component-slider/src/BpkSlider.d.ts +4 -1
- package/bpk-component-slider/src/BpkSlider.js +51 -3
- package/bpk-component-snippet/src/BpkSnippet.d.ts +1 -1
- package/bpk-component-spinner/src/BpkExtraLargeSpinner.d.ts +4 -14
- package/bpk-component-spinner/src/BpkExtraLargeSpinner.js +5 -16
- package/bpk-component-spinner/src/BpkLargeSpinner.d.ts +5 -17
- package/bpk-component-spinner/src/BpkLargeSpinner.js +6 -19
- package/bpk-component-spinner/src/BpkSpinner.d.ts +5 -17
- package/bpk-component-spinner/src/BpkSpinner.js +6 -19
- package/bpk-component-split-input/src/BpkInputField.d.ts +21 -0
- package/bpk-component-split-input/src/BpkInputField.js +12 -17
- package/bpk-component-split-input/src/BpkSplitInput.d.ts +44 -0
- package/bpk-component-split-input/src/BpkSplitInput.js +21 -40
- package/bpk-component-swap-button/src/BpkSwapButton.d.ts +1 -1
- package/bpk-component-switch/index.d.ts +5 -0
- package/bpk-component-switch/src/BpkSwitch.d.ts +8 -0
- package/bpk-component-switch/src/BpkSwitch.js +9 -22
- package/bpk-component-switch/src/BpkSwitch.module.css +1 -1
- package/bpk-component-switch/src/themeAttributes.d.ts +2 -0
- package/bpk-component-text/src/BpkText.d.ts +1 -1
- package/bpk-component-tooltip/src/BpkTooltip.d.ts +1 -1
- package/bpk-component-tooltip/src/BpkTooltipPortal.d.ts +1 -1
- package/bpk-react-utils/index.d.ts +3 -3
- package/bpk-react-utils/src/BpkDialogWrapper/BpkDialogWrapper.d.ts +1 -1
- package/bpk-react-utils/src/TransitionInitialMount.d.ts +1 -1
- package/bpk-react-utils/src/nativeEventHandler.d.ts +1 -1
- package/bpk-react-utils/src/nativeEventHandler.js +7 -5
- package/bpk-react-utils/src/withDefaultProps.d.ts +1 -1
- package/bpk-scrim-utils/index.d.ts +7 -11
- package/bpk-scrim-utils/src/BpkScrim.d.ts +1 -1
- package/bpk-scrim-utils/src/withScrim.d.ts +7 -11
- package/bpk-scrim-utils/src/withScrimmedPortal.d.ts +1 -1
- package/bpk-theming/src/BpkThemeProvider.js +19 -30
- package/package.json +5 -3
- package/bpk-component-nudger/src/BpkConfigurableNudger.d.ts +0 -26
- package/bpk-component-nudger/src/BpkConfigurableNudger.js +0 -96
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
import PropTypes from 'prop-types';
|
|
20
|
-
import { Component } from 'react';
|
|
21
20
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
21
|
const uniq = (arr = []) => {
|
|
23
22
|
const seen = {};
|
|
@@ -50,35 +49,25 @@ const createStyle = (theme, themeAttributes) => {
|
|
|
50
49
|
}
|
|
51
50
|
return style;
|
|
52
51
|
};
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
...
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
...userStyle,
|
|
73
|
-
...style
|
|
74
|
-
},
|
|
75
|
-
...rest,
|
|
76
|
-
children: children
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
BpkThemeProvider.childContextTypes = {
|
|
81
|
-
theme: PropTypes.object // eslint-disable-line react/forbid-prop-types
|
|
52
|
+
const BpkThemeProvider = props => {
|
|
53
|
+
const {
|
|
54
|
+
children,
|
|
55
|
+
component: WrapperComponent,
|
|
56
|
+
style: userStyle,
|
|
57
|
+
theme,
|
|
58
|
+
themeAttributes,
|
|
59
|
+
...rest
|
|
60
|
+
} = props;
|
|
61
|
+
const dedupedThemeAttributes = uniq(themeAttributes);
|
|
62
|
+
const style = createStyle(theme, dedupedThemeAttributes);
|
|
63
|
+
return /*#__PURE__*/_jsx(WrapperComponent, {
|
|
64
|
+
style: {
|
|
65
|
+
...userStyle,
|
|
66
|
+
...style
|
|
67
|
+
},
|
|
68
|
+
...rest,
|
|
69
|
+
children: children
|
|
70
|
+
});
|
|
82
71
|
};
|
|
83
72
|
const themeAttributesPropType = (props, propName, componentName) => {
|
|
84
73
|
const {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skyscanner/backpack-web",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "35.0.0",
|
|
4
4
|
"description": "Backpack Design System web library",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -24,7 +24,9 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@floating-ui/react": "^0.26.12",
|
|
26
26
|
"@popperjs/core": "^2.11.8",
|
|
27
|
+
"@radix-ui/react-compose-refs": "^1.1.0",
|
|
27
28
|
"@radix-ui/react-slider": "^1.1.2",
|
|
29
|
+
"@radix-ui/react-use-previous": "^1.1.0",
|
|
28
30
|
"@react-google-maps/api": "^2.19.3",
|
|
29
31
|
"@skyscanner/bpk-foundations-web": "^18.1.0",
|
|
30
32
|
"@skyscanner/bpk-svgs": "^19.3.0",
|
|
@@ -47,8 +49,8 @@
|
|
|
47
49
|
},
|
|
48
50
|
"peerDependencies": {
|
|
49
51
|
"node-sass": ">= 7",
|
|
50
|
-
"react": "^17.0.2",
|
|
51
|
-
"react-dom": "^17.0.2",
|
|
52
|
+
"react": "^17.0.2 - 18.3.1",
|
|
53
|
+
"react-dom": "^17.0.2 - 18.3.1",
|
|
52
54
|
"react-transition-group": "^4.4.5",
|
|
53
55
|
"sass": "^1",
|
|
54
56
|
"sass-embedded": "^1"
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { type CommonProps } from './common-types';
|
|
2
|
-
type Props = CommonProps & {
|
|
3
|
-
inputClassName?: string | null;
|
|
4
|
-
/**
|
|
5
|
-
* A simple function that will allow you to set the format of the display value e.g. local dates or times.
|
|
6
|
-
*/
|
|
7
|
-
formatValue: (arg0: any) => string;
|
|
8
|
-
/**
|
|
9
|
-
* Function that handle the incrementing of the current selected value.
|
|
10
|
-
*/
|
|
11
|
-
incrementValue: (arg0: any) => string | number;
|
|
12
|
-
/**
|
|
13
|
-
* Function that handle the decrementing of the current selected value.
|
|
14
|
-
*/
|
|
15
|
-
decrementValue: (arg0: any) => string | number;
|
|
16
|
-
/**
|
|
17
|
-
* Given `a` and `b`:
|
|
18
|
-
* - If `a` is less than `b` then `compareValues(a, b)` should return a value less than `0`
|
|
19
|
-
* - If `a` and `b` are equal then `compareValues(a, b)` should return exactly `0`
|
|
20
|
-
* - If `a` is greater than `b` then `compareValues(a, b)` should return a value greater than `0`
|
|
21
|
-
* We use this along with the `min` and `max` values to determine when we should disable the increment and decrement buttons. This is inspired by the `compareFunction` in [Array.prototype.sort](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#Description)
|
|
22
|
-
*/
|
|
23
|
-
compareValues: (arg0: any, arg1: any) => number;
|
|
24
|
-
};
|
|
25
|
-
declare const BpkConfigurableNudger: ({ buttonType, className, compareValues, decreaseButtonLabel, decrementValue, formatValue, id, increaseButtonLabel, incrementValue, inputClassName, max, min, name, onChange, value, ...rest }: Props) => JSX.Element;
|
|
26
|
-
export default BpkConfigurableNudger;
|
|
@@ -1,96 +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
|
-
import { useRef } from 'react';
|
|
20
|
-
import { BpkButtonV2, BUTTON_TYPES } from "../../bpk-component-button";
|
|
21
|
-
import { withButtonAlignment } from "../../bpk-component-icon";
|
|
22
|
-
import MinusIcon from "../../bpk-component-icon/sm/minus";
|
|
23
|
-
import PlusIcon from "../../bpk-component-icon/sm/plus";
|
|
24
|
-
import { cssModules, setNativeValue } from "../../bpk-react-utils";
|
|
25
|
-
import STYLES from "./BpkNudger.module.css";
|
|
26
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
27
|
-
const getClassName = cssModules(STYLES);
|
|
28
|
-
const AlignedMinusIcon = withButtonAlignment(MinusIcon);
|
|
29
|
-
const AlignedPlusIcon = withButtonAlignment(PlusIcon);
|
|
30
|
-
const BpkConfigurableNudger = ({
|
|
31
|
-
buttonType = 'secondary',
|
|
32
|
-
className = null,
|
|
33
|
-
compareValues,
|
|
34
|
-
decreaseButtonLabel,
|
|
35
|
-
decrementValue,
|
|
36
|
-
formatValue,
|
|
37
|
-
id,
|
|
38
|
-
increaseButtonLabel,
|
|
39
|
-
incrementValue,
|
|
40
|
-
inputClassName = null,
|
|
41
|
-
max,
|
|
42
|
-
min,
|
|
43
|
-
name,
|
|
44
|
-
onChange,
|
|
45
|
-
value,
|
|
46
|
-
...rest
|
|
47
|
-
}) => {
|
|
48
|
-
const classNames = getClassName('bpk-nudger', className);
|
|
49
|
-
const maxButtonDisabled = compareValues(value, max) >= 0;
|
|
50
|
-
const minButtonDisabled = compareValues(value, min) <= 0;
|
|
51
|
-
const inputStyles = getClassName('bpk-nudger__input', inputClassName && inputClassName, buttonType === 'secondaryOnDark' && 'bpk-nudger__input--secondary-on-dark');
|
|
52
|
-
const inputRef = useRef(null);
|
|
53
|
-
return /*#__PURE__*/_jsxs("div", {
|
|
54
|
-
className: classNames,
|
|
55
|
-
children: [/*#__PURE__*/_jsx(BpkButtonV2, {
|
|
56
|
-
type: BUTTON_TYPES[buttonType],
|
|
57
|
-
iconOnly: true,
|
|
58
|
-
onClick: () => {
|
|
59
|
-
const newValue = decrementValue(value);
|
|
60
|
-
onChange(newValue);
|
|
61
|
-
// We want to maintain native input events across our form components. Along with react updating
|
|
62
|
-
// the value attribute we can set it via native handlers and emit a "change" event.
|
|
63
|
-
inputRef.current && setNativeValue(inputRef.current, `${newValue}`);
|
|
64
|
-
},
|
|
65
|
-
disabled: minButtonDisabled,
|
|
66
|
-
title: decreaseButtonLabel,
|
|
67
|
-
"aria-controls": id,
|
|
68
|
-
children: /*#__PURE__*/_jsx(AlignedMinusIcon, {})
|
|
69
|
-
}), /*#__PURE__*/_jsx("input", {
|
|
70
|
-
type: "text",
|
|
71
|
-
"aria-live": "polite",
|
|
72
|
-
defaultValue: formatValue(value),
|
|
73
|
-
id: id,
|
|
74
|
-
ref: inputRef,
|
|
75
|
-
name: name || id,
|
|
76
|
-
onChange: event => onChange(parseInt(event?.target.value, 10)),
|
|
77
|
-
className: inputStyles,
|
|
78
|
-
...rest
|
|
79
|
-
}), /*#__PURE__*/_jsx(BpkButtonV2, {
|
|
80
|
-
type: BUTTON_TYPES[buttonType],
|
|
81
|
-
iconOnly: true,
|
|
82
|
-
onClick: () => {
|
|
83
|
-
const newValue = incrementValue(value);
|
|
84
|
-
onChange(newValue);
|
|
85
|
-
// We want to maintain native input events across our form components. Along with react updating
|
|
86
|
-
// the value attribute we can set it via native handlers and emit a "change" event.
|
|
87
|
-
inputRef.current && setNativeValue(inputRef.current, `${newValue}`);
|
|
88
|
-
},
|
|
89
|
-
disabled: maxButtonDisabled,
|
|
90
|
-
title: increaseButtonLabel,
|
|
91
|
-
"aria-controls": id,
|
|
92
|
-
children: /*#__PURE__*/_jsx(AlignedPlusIcon, {})
|
|
93
|
-
})]
|
|
94
|
-
});
|
|
95
|
-
};
|
|
96
|
-
export default BpkConfigurableNudger;
|