@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
|
@@ -16,8 +16,6 @@ import React from "react";
|
|
|
16
16
|
* See the License for the specific language governing permissions and
|
|
17
17
|
* limitations under the License.
|
|
18
18
|
*/
|
|
19
|
-
|
|
20
|
-
import PropTypes from 'prop-types';
|
|
21
19
|
var SmSpinner = function SmSpinner(props) {
|
|
22
20
|
return /*#__PURE__*/_jsxs("svg", {
|
|
23
21
|
...props,
|
|
@@ -68,13 +66,12 @@ import SPINNER_TYPES from "./spinnerTypes";
|
|
|
68
66
|
import STYLES from "./BpkSpinner.module.css";
|
|
69
67
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
70
68
|
const getClassName = cssModules(STYLES);
|
|
71
|
-
const BpkSpinner =
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
} = props;
|
|
69
|
+
const BpkSpinner = ({
|
|
70
|
+
alignToButton = false,
|
|
71
|
+
className = null,
|
|
72
|
+
type = SPINNER_TYPES.dark,
|
|
73
|
+
...rest
|
|
74
|
+
}) => {
|
|
78
75
|
const classNames = getClassName('bpk-spinner', `bpk-spinner--${type}`, alignToButton && 'bpk-spinner--align-to-button', className);
|
|
79
76
|
return /*#__PURE__*/_jsx("span", {
|
|
80
77
|
className: classNames,
|
|
@@ -83,14 +80,4 @@ const BpkSpinner = props => {
|
|
|
83
80
|
})
|
|
84
81
|
});
|
|
85
82
|
};
|
|
86
|
-
BpkSpinner.propTypes = {
|
|
87
|
-
type: PropTypes.oneOf(Object.keys(SPINNER_TYPES)),
|
|
88
|
-
className: PropTypes.string,
|
|
89
|
-
alignToButton: PropTypes.bool
|
|
90
|
-
};
|
|
91
|
-
BpkSpinner.defaultProps = {
|
|
92
|
-
type: SPINNER_TYPES.dark,
|
|
93
|
-
className: null,
|
|
94
|
-
alignToButton: false
|
|
95
|
-
};
|
|
96
83
|
export default BpkSpinner;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { PureComponent } from 'react';
|
|
2
|
+
export type Props = DefaultProps;
|
|
3
|
+
type DefaultProps = {
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
value: string | number;
|
|
7
|
+
focus: boolean;
|
|
8
|
+
index: number;
|
|
9
|
+
name: string;
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
};
|
|
12
|
+
declare class BpkInputField extends PureComponent<Props> {
|
|
13
|
+
static defaultProps: {
|
|
14
|
+
value: string;
|
|
15
|
+
name: string;
|
|
16
|
+
};
|
|
17
|
+
componentDidUpdate(prevProps: Props): void;
|
|
18
|
+
private input;
|
|
19
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
}
|
|
21
|
+
export default BpkInputField;
|
|
@@ -14,14 +14,19 @@
|
|
|
14
14
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
|
-
*/
|
|
18
|
-
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import { PureComponent } from 'react';
|
|
19
20
|
import BpkInput from "../../bpk-component-input";
|
|
20
21
|
import { cssModules } from "../../bpk-react-utils";
|
|
21
22
|
import STYLES from "./BpkInputField.module.css";
|
|
22
23
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
24
|
const getClassName = cssModules(STYLES);
|
|
24
|
-
class BpkInputField extends
|
|
25
|
+
class BpkInputField extends PureComponent {
|
|
26
|
+
static defaultProps = {
|
|
27
|
+
value: '',
|
|
28
|
+
name: ''
|
|
29
|
+
};
|
|
25
30
|
componentDidUpdate(prevProps) {
|
|
26
31
|
const {
|
|
27
32
|
focus
|
|
@@ -31,6 +36,7 @@ class BpkInputField extends Component {
|
|
|
31
36
|
this.input.select();
|
|
32
37
|
}
|
|
33
38
|
}
|
|
39
|
+
input = null;
|
|
34
40
|
render() {
|
|
35
41
|
const {
|
|
36
42
|
focus,
|
|
@@ -46,27 +52,16 @@ class BpkInputField extends Component {
|
|
|
46
52
|
children: /*#__PURE__*/_jsx(BpkInput, {
|
|
47
53
|
id: id,
|
|
48
54
|
autoComplete: "off",
|
|
49
|
-
|
|
55
|
+
name: name,
|
|
56
|
+
maxLength: 1,
|
|
50
57
|
"aria-label": `${label} ${index}`,
|
|
51
58
|
inputRef: input => {
|
|
52
59
|
this.input = input;
|
|
53
60
|
},
|
|
54
|
-
value: value
|
|
55
|
-
name: name || '',
|
|
61
|
+
value: value,
|
|
56
62
|
...rest
|
|
57
63
|
})
|
|
58
64
|
}, index);
|
|
59
65
|
}
|
|
60
66
|
}
|
|
61
|
-
BpkInputField.propTypes = {
|
|
62
|
-
id: PropTypes.string.isRequired,
|
|
63
|
-
label: PropTypes.string.isRequired,
|
|
64
|
-
value: PropTypes.string,
|
|
65
|
-
focus: PropTypes.bool.isRequired,
|
|
66
|
-
index: PropTypes.number.isRequired,
|
|
67
|
-
name: PropTypes.string
|
|
68
|
-
};
|
|
69
|
-
BpkInputField.defaultProps = {
|
|
70
|
-
value: ''
|
|
71
|
-
};
|
|
72
67
|
export default BpkInputField;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Component } from 'react';
|
|
2
|
+
import type { ChangeEvent, ClipboardEvent, FocusEvent, KeyboardEvent } from 'react';
|
|
3
|
+
import { INPUT_TYPES } from '../../bpk-component-input';
|
|
4
|
+
interface Props {
|
|
5
|
+
type?: string | number;
|
|
6
|
+
id: string;
|
|
7
|
+
label: string;
|
|
8
|
+
name: string;
|
|
9
|
+
inputLength?: number;
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
onInputChange: (value: string | number) => void;
|
|
12
|
+
onSubmit: (value: string | number) => void;
|
|
13
|
+
large?: boolean;
|
|
14
|
+
}
|
|
15
|
+
interface State {
|
|
16
|
+
focusedInput: number;
|
|
17
|
+
inputValue: string[] | number[];
|
|
18
|
+
}
|
|
19
|
+
declare class BpkSplitInput extends Component<Props, State> {
|
|
20
|
+
static defaultProps: {
|
|
21
|
+
type: "number";
|
|
22
|
+
inputLength: number;
|
|
23
|
+
large: boolean;
|
|
24
|
+
placeholder: string;
|
|
25
|
+
};
|
|
26
|
+
constructor(props: Props);
|
|
27
|
+
onInputChange: (input: string[] | number[]) => void;
|
|
28
|
+
updateInputValue: (value: string | number) => void;
|
|
29
|
+
handleSubmit: () => void;
|
|
30
|
+
validateInput: (inputValue: string[] | number[]) => boolean;
|
|
31
|
+
isNumeric: () => boolean;
|
|
32
|
+
isInputValid: (value: string | number) => boolean;
|
|
33
|
+
focusInput: (inputIndex: number) => void;
|
|
34
|
+
focusNextInput: () => void;
|
|
35
|
+
focusPreviousInput: () => void;
|
|
36
|
+
handleOnPaste: (e: ClipboardEvent<HTMLInputElement>) => void;
|
|
37
|
+
handleOnKeyDown: (e: KeyboardEvent<HTMLInputElement>) => void;
|
|
38
|
+
handleOnChange: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
39
|
+
handleOnFocus: (e: FocusEvent<HTMLInputElement>, index: number) => void;
|
|
40
|
+
renderInputs: () => import("react/jsx-runtime").JSX.Element[];
|
|
41
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
42
|
+
}
|
|
43
|
+
export default BpkSplitInput;
|
|
44
|
+
export { INPUT_TYPES };
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
|
-
*/
|
|
17
|
+
*/
|
|
18
|
+
|
|
18
19
|
import { Component } from 'react';
|
|
19
20
|
import { INPUT_TYPES } from "../../bpk-component-input";
|
|
20
21
|
import { cssModules } from "../../bpk-react-utils";
|
|
@@ -22,15 +23,13 @@ import InputField from "./BpkInputField";
|
|
|
22
23
|
import STYLES from "./BpkSplitInput.module.css";
|
|
23
24
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
25
|
const getClassName = cssModules(STYLES);
|
|
25
|
-
|
|
26
|
-
// keyCode constants
|
|
27
|
-
const BACKSPACE = 8;
|
|
28
|
-
const LEFT_ARROW = 37;
|
|
29
|
-
const RIGHT_ARROW = 39;
|
|
30
|
-
const DELETE = 46;
|
|
31
|
-
const SPACEBAR = 32;
|
|
32
|
-
const ENTER = 13;
|
|
33
26
|
class BpkSplitInput extends Component {
|
|
27
|
+
static defaultProps = {
|
|
28
|
+
type: INPUT_TYPES.number,
|
|
29
|
+
inputLength: 4,
|
|
30
|
+
large: true,
|
|
31
|
+
placeholder: ''
|
|
32
|
+
};
|
|
34
33
|
constructor(props) {
|
|
35
34
|
super(props);
|
|
36
35
|
this.state = {
|
|
@@ -42,11 +41,8 @@ class BpkSplitInput extends Component {
|
|
|
42
41
|
this.setState({
|
|
43
42
|
inputValue: input
|
|
44
43
|
});
|
|
45
|
-
const {
|
|
46
|
-
onChange
|
|
47
|
-
} = this.props;
|
|
48
44
|
const value = input.join('');
|
|
49
|
-
|
|
45
|
+
this.props.onInputChange(value);
|
|
50
46
|
};
|
|
51
47
|
updateInputValue = value => {
|
|
52
48
|
const {
|
|
@@ -83,8 +79,8 @@ class BpkSplitInput extends Component {
|
|
|
83
79
|
};
|
|
84
80
|
isNumeric = () => this.props.type === INPUT_TYPES.number;
|
|
85
81
|
isInputValid = value => {
|
|
86
|
-
const isTypeValid = this.isNumeric() ? /^\d$/.test(value) : typeof value === 'string';
|
|
87
|
-
return isTypeValid && value
|
|
82
|
+
const isTypeValid = this.isNumeric() ? /^\d$/.test(`${value}`) : typeof value === 'string';
|
|
83
|
+
return isTypeValid && `${value}`.trim().length === 1;
|
|
88
84
|
};
|
|
89
85
|
focusInput = inputIndex => {
|
|
90
86
|
const {
|
|
@@ -132,23 +128,23 @@ class BpkSplitInput extends Component {
|
|
|
132
128
|
this.onInputChange(inputValue);
|
|
133
129
|
};
|
|
134
130
|
handleOnKeyDown = e => {
|
|
135
|
-
if (e.
|
|
131
|
+
if (e.key === 'Backspace') {
|
|
136
132
|
e.preventDefault();
|
|
137
133
|
this.updateInputValue('');
|
|
138
134
|
this.focusPreviousInput();
|
|
139
|
-
} else if (e.
|
|
135
|
+
} else if (e.key === 'Delete') {
|
|
140
136
|
e.preventDefault();
|
|
141
137
|
this.updateInputValue('');
|
|
142
|
-
} else if (e.
|
|
138
|
+
} else if (e.key === 'Left' || e.key === 'ArrowLeft') {
|
|
143
139
|
e.preventDefault();
|
|
144
140
|
this.focusPreviousInput();
|
|
145
|
-
} else if (e.
|
|
141
|
+
} else if (e.key === 'Right' || e.key === 'ArrowRight') {
|
|
146
142
|
e.preventDefault();
|
|
147
143
|
this.focusNextInput();
|
|
148
|
-
} else if (e.
|
|
144
|
+
} else if (e.key === 'Enter') {
|
|
149
145
|
e.preventDefault();
|
|
150
146
|
this.handleSubmit();
|
|
151
|
-
} else if (e.
|
|
147
|
+
} else if (e.key === ' ' || e.key === 'Spacebar' || e.key === 'Space') {
|
|
152
148
|
e.preventDefault();
|
|
153
149
|
}
|
|
154
150
|
};
|
|
@@ -179,7 +175,8 @@ class BpkSplitInput extends Component {
|
|
|
179
175
|
large,
|
|
180
176
|
name,
|
|
181
177
|
placeholder,
|
|
182
|
-
type
|
|
178
|
+
type,
|
|
179
|
+
...rest
|
|
183
180
|
} = this.props;
|
|
184
181
|
const inputs = [];
|
|
185
182
|
for (let index = 0; index < inputLength; index += 1) {
|
|
@@ -197,7 +194,8 @@ class BpkSplitInput extends Component {
|
|
|
197
194
|
onInput: this.handleOnChange,
|
|
198
195
|
onKeyDown: this.handleOnKeyDown,
|
|
199
196
|
onPaste: this.handleOnPaste,
|
|
200
|
-
onFocus: e => this.handleOnFocus(e, index)
|
|
197
|
+
onFocus: e => this.handleOnFocus(e, index),
|
|
198
|
+
...rest
|
|
201
199
|
}, index));
|
|
202
200
|
}
|
|
203
201
|
return inputs;
|
|
@@ -209,22 +207,5 @@ class BpkSplitInput extends Component {
|
|
|
209
207
|
});
|
|
210
208
|
}
|
|
211
209
|
}
|
|
212
|
-
BpkSplitInput.propTypes = {
|
|
213
|
-
type: PropTypes.oneOf([INPUT_TYPES.text, INPUT_TYPES.number]),
|
|
214
|
-
id: PropTypes.string.isRequired,
|
|
215
|
-
label: PropTypes.string.isRequired,
|
|
216
|
-
name: PropTypes.string.isRequired,
|
|
217
|
-
inputLength: PropTypes.number,
|
|
218
|
-
placeholder: PropTypes.string,
|
|
219
|
-
onChange: PropTypes.func.isRequired,
|
|
220
|
-
onSubmit: PropTypes.func.isRequired,
|
|
221
|
-
large: PropTypes.bool
|
|
222
|
-
};
|
|
223
|
-
BpkSplitInput.defaultProps = {
|
|
224
|
-
type: INPUT_TYPES.number,
|
|
225
|
-
inputLength: 4,
|
|
226
|
-
large: true,
|
|
227
|
-
placeholder: ''
|
|
228
|
-
};
|
|
229
210
|
export default BpkSplitInput;
|
|
230
211
|
export { INPUT_TYPES };
|
|
@@ -9,5 +9,5 @@ export type Props = {
|
|
|
9
9
|
ariaLabel: string;
|
|
10
10
|
swapButtonStyle?: SwapButtonStyle;
|
|
11
11
|
};
|
|
12
|
-
declare const BpkSwapButton: (props: Props) => JSX.Element;
|
|
12
|
+
declare const BpkSwapButton: (props: Props) => import("react/jsx-runtime").JSX.Element;
|
|
13
13
|
export default BpkSwapButton;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type Props = {
|
|
2
|
+
ariaLabel: string;
|
|
3
|
+
className?: string | null;
|
|
4
|
+
small?: boolean;
|
|
5
|
+
[rest: string]: any;
|
|
6
|
+
};
|
|
7
|
+
declare const BpkSwitch: ({ ariaLabel, className, small, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default BpkSwitch;
|
|
@@ -14,43 +14,30 @@
|
|
|
14
14
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
|
-
*/
|
|
17
|
+
*/
|
|
18
|
+
|
|
18
19
|
import { cssModules } from "../../bpk-react-utils";
|
|
19
20
|
import STYLES from "./BpkSwitch.module.css";
|
|
20
21
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
21
22
|
const getClassName = cssModules(STYLES);
|
|
22
|
-
const BpkSwitch =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
} = props;
|
|
23
|
+
const BpkSwitch = ({
|
|
24
|
+
ariaLabel,
|
|
25
|
+
className = null,
|
|
26
|
+
small = false,
|
|
27
|
+
...rest
|
|
28
|
+
}) => {
|
|
29
29
|
const switchClassNames = getClassName('bpk-switch__switch', small && 'bpk-switch__switch--small');
|
|
30
30
|
return /*#__PURE__*/_jsxs("label", {
|
|
31
31
|
className: getClassName('bpk-switch', className),
|
|
32
32
|
children: [/*#__PURE__*/_jsx("input", {
|
|
33
33
|
type: "checkbox",
|
|
34
34
|
className: getClassName('bpk-switch__checkbox'),
|
|
35
|
-
"aria-label":
|
|
35
|
+
"aria-label": ariaLabel,
|
|
36
36
|
...rest
|
|
37
|
-
}), /*#__PURE__*/_jsx("span", {
|
|
38
|
-
"aria-hidden": true,
|
|
39
|
-
className: getClassName('bpk-switch__label'),
|
|
40
|
-
children: label
|
|
41
37
|
}), /*#__PURE__*/_jsx("span", {
|
|
42
38
|
"aria-hidden": true,
|
|
43
39
|
className: switchClassNames
|
|
44
40
|
})]
|
|
45
41
|
});
|
|
46
42
|
};
|
|
47
|
-
BpkSwitch.propTypes = {
|
|
48
|
-
label: PropTypes.node.isRequired,
|
|
49
|
-
className: PropTypes.string,
|
|
50
|
-
small: PropTypes.bool
|
|
51
|
-
};
|
|
52
|
-
BpkSwitch.defaultProps = {
|
|
53
|
-
className: null,
|
|
54
|
-
small: false
|
|
55
|
-
};
|
|
56
43
|
export default BpkSwitch;
|
|
@@ -15,4 +15,4 @@
|
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
|
-
.bpk-switch{position:relative;display:flex;align-items:center}.bpk-switch__checkbox{position:absolute;opacity:0}.bpk-switch__checkbox:checked~.bpk-switch__switch{background:#0062e3;background:var(--bpk-switch-checked-color, rgb(0, 98, 227))}.bpk-switch__checkbox:checked~.bpk-switch__switch::before{left:1.375rem}.bpk-
|
|
18
|
+
.bpk-switch{position:relative;display:flex;align-items:center}.bpk-switch__checkbox{position:absolute;opacity:0}.bpk-switch__checkbox:checked~.bpk-switch__switch{background:#0062e3;background:var(--bpk-switch-checked-color, rgb(0, 98, 227))}.bpk-switch__checkbox:checked~.bpk-switch__switch::before{left:1.375rem}.bpk-switch__switch{position:relative;float:right;display:block;min-width:3.25rem;height:2rem;transition:background 200ms linear;border-radius:1rem;background:rgba(0,0,0,.2);cursor:pointer}.bpk-switch__switch::before{position:absolute;top:.125rem;left:.125rem;content:"";display:block;width:1.75rem;height:1.75rem;transition:left 200ms ease-out;border-radius:50%;background:#fff;box-shadow:0px 1px 3px 0px rgba(37,32,31,.3)}.bpk-switch__switch--small{min-width:2.5rem;height:1.25rem}.bpk-switch__switch--small::before{width:1rem;height:1rem}
|
|
@@ -42,5 +42,5 @@ type Props = {
|
|
|
42
42
|
id?: string;
|
|
43
43
|
[rest: string]: any;
|
|
44
44
|
};
|
|
45
|
-
declare const BpkText: ({ children, className, tagName: TagName, textStyle, ...rest }: Props) => JSX.Element;
|
|
45
|
+
declare const BpkText: ({ children, className, tagName: TagName, textStyle, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
46
46
|
export default BpkText;
|
|
@@ -7,5 +7,5 @@ export type TooltipProps = {
|
|
|
7
7
|
padded?: boolean;
|
|
8
8
|
className?: string | null;
|
|
9
9
|
};
|
|
10
|
-
declare const BpkTooltip: ({ children, className, id, padded, type, ...rest }: TooltipProps) => JSX.Element;
|
|
10
|
+
declare const BpkTooltip: ({ children, className, id, padded, type, ...rest }: TooltipProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
11
|
export default BpkTooltip;
|
|
@@ -49,6 +49,6 @@ declare class BpkTooltipPortal extends Component<Props, State> {
|
|
|
49
49
|
beforeClose: (done: () => void | null) => void;
|
|
50
50
|
openTooltip: () => void;
|
|
51
51
|
closeTooltip: () => void;
|
|
52
|
-
render(): JSX.Element;
|
|
52
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
53
53
|
}
|
|
54
54
|
export default BpkTooltipPortal;
|
|
@@ -16,7 +16,7 @@ declare const _default: {
|
|
|
16
16
|
appearActiveClassName: string;
|
|
17
17
|
transitionTimeout: number;
|
|
18
18
|
children: string | import("react").ReactNode;
|
|
19
|
-
}) => JSX.Element;
|
|
19
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
20
20
|
cssModules: (styles?: {
|
|
21
21
|
[key: string]: any;
|
|
22
22
|
}) => (...classNames: Array<string | boolean | number | {} | null | undefined>) => string;
|
|
@@ -29,7 +29,7 @@ declare const _default: {
|
|
|
29
29
|
[rest: string]: any;
|
|
30
30
|
children?: import("react").ReactNode | string;
|
|
31
31
|
className?: string | null;
|
|
32
|
-
}): JSX.Element;
|
|
32
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
33
33
|
displayName: string;
|
|
34
34
|
};
|
|
35
35
|
wrapDisplayName: (Component: import("react").ComponentType<any> | string | null, hoc: string) => string;
|
|
@@ -37,7 +37,7 @@ declare const _default: {
|
|
|
37
37
|
isDeviceIpad: () => boolean;
|
|
38
38
|
isDeviceIos: () => boolean;
|
|
39
39
|
isRTL: () => boolean;
|
|
40
|
-
BpkDialogWrapper: ({ children, closeOnEscPressed, closeOnScrimClick, dialogClassName, exiting, id, isOpen, onClose, timeout, transitionClassNames, ...ariaProps }: import("./src/BpkDialogWrapper/BpkDialogWrapper").Props) => JSX.Element | null;
|
|
40
|
+
BpkDialogWrapper: ({ children, closeOnEscPressed, closeOnScrimClick, dialogClassName, exiting, id, isOpen, onClose, timeout, transitionClassNames, ...ariaProps }: import("./src/BpkDialogWrapper/BpkDialogWrapper").Props) => import("react/jsx-runtime").JSX.Element | null;
|
|
41
41
|
setNativeValue: typeof setNativeValue;
|
|
42
42
|
};
|
|
43
43
|
export default _default;
|
|
@@ -25,5 +25,5 @@ export type Props = CommonProps & ({
|
|
|
25
25
|
} | {
|
|
26
26
|
ariaLabel: string;
|
|
27
27
|
});
|
|
28
|
-
export declare const BpkDialogWrapper: ({ children, closeOnEscPressed, closeOnScrimClick, dialogClassName, exiting, id, isOpen, onClose, timeout, transitionClassNames, ...ariaProps }: Props) => JSX.Element | null;
|
|
28
|
+
export declare const BpkDialogWrapper: ({ children, closeOnEscPressed, closeOnScrimClick, dialogClassName, exiting, id, isOpen, onClose, timeout, transitionClassNames, ...ariaProps }: Props) => import("react/jsx-runtime").JSX.Element | null;
|
|
29
29
|
export {};
|
|
@@ -5,5 +5,5 @@ type Props = {
|
|
|
5
5
|
transitionTimeout: number;
|
|
6
6
|
children: string | ReactNode;
|
|
7
7
|
};
|
|
8
|
-
declare const TransitionInitialMount: ({ appearActiveClassName, appearClassName, children, transitionTimeout, }: Props) => JSX.Element;
|
|
8
|
+
declare const TransitionInitialMount: ({ appearActiveClassName, appearClassName, children, transitionTimeout, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
9
9
|
export default TransitionInitialMount;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare function setNativeValue(element: HTMLInputElement, value: string): void;
|
|
1
|
+
declare function setNativeValue(element: HTMLInputElement, value: string | number, shouldDispatchChange?: boolean): void;
|
|
2
2
|
export { setNativeValue };
|
|
@@ -20,16 +20,18 @@
|
|
|
20
20
|
// This causes the elements to not emit events that would have been if they had been modified by the user directly.
|
|
21
21
|
// In order to maintain the expected native behaviour of the input element, It's possible to call this function during an
|
|
22
22
|
// "onEvent" handler and update the element value, together with updating react it's own state which isn't mapped to the elements value prop.
|
|
23
|
-
function setNativeValue(element, value) {
|
|
23
|
+
function setNativeValue(element, value, shouldDispatchChange = true) {
|
|
24
24
|
const inputProto = window.HTMLInputElement.prototype;
|
|
25
25
|
const descriptor = Object.getOwnPropertyDescriptor(inputProto, 'value');
|
|
26
26
|
const setValue = descriptor.set;
|
|
27
27
|
if (setValue) {
|
|
28
|
-
const event = new Event('change', {
|
|
29
|
-
bubbles: true
|
|
30
|
-
});
|
|
31
28
|
setValue.call(element, value);
|
|
32
|
-
|
|
29
|
+
if (shouldDispatchChange) {
|
|
30
|
+
const event = new Event('change', {
|
|
31
|
+
bubbles: true
|
|
32
|
+
});
|
|
33
|
+
element.dispatchEvent(event);
|
|
34
|
+
}
|
|
33
35
|
}
|
|
34
36
|
}
|
|
35
37
|
|
|
@@ -9,7 +9,7 @@ type DefaultProps = {
|
|
|
9
9
|
[rest: string]: any;
|
|
10
10
|
};
|
|
11
11
|
declare const withDefaultProps: (WrappedComponent: ComponentType<any>, defaultProps: DefaultProps) => {
|
|
12
|
-
({ children, className: innerClassName, ...rest }: Props): JSX.Element;
|
|
12
|
+
({ children, className: innerClassName, ...rest }: Props): import("react/jsx-runtime").JSX.Element;
|
|
13
13
|
displayName: string;
|
|
14
14
|
};
|
|
15
15
|
export default withDefaultProps;
|
|
@@ -3,18 +3,16 @@ import withScrimmedPortal from './src/withScrimmedPortal';
|
|
|
3
3
|
export { withScrim, withScrimmedPortal };
|
|
4
4
|
declare const _default: {
|
|
5
5
|
withScrim: <P extends object>(WrappedComponent: import("react").ComponentType<P> | string) => {
|
|
6
|
-
new (props:
|
|
6
|
+
new (props: import("./src/withScrim").Props & Omit<P, "dialogRef">): {
|
|
7
7
|
dialogElement?: HTMLElement | null | undefined;
|
|
8
8
|
componentDidMount(): void;
|
|
9
9
|
componentWillUnmount(): void;
|
|
10
10
|
dialogRef: (ref: HTMLElement | null | undefined) => void;
|
|
11
|
-
render(): JSX.Element;
|
|
12
|
-
context:
|
|
11
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
context: unknown;
|
|
13
13
|
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<import("./src/withScrim").Props & Omit<P, "dialogRef">>) => Pick<{}, K> | {} | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
14
14
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
15
|
-
readonly props: Readonly<import("./src/withScrim").Props & Omit<P, "dialogRef"
|
|
16
|
-
children?: import("react").ReactNode | undefined;
|
|
17
|
-
}>;
|
|
15
|
+
readonly props: Readonly<import("./src/withScrim").Props & Omit<P, "dialogRef">>;
|
|
18
16
|
state: Readonly<{}>;
|
|
19
17
|
refs: {
|
|
20
18
|
[key: string]: import("react").ReactInstance;
|
|
@@ -35,13 +33,11 @@ declare const _default: {
|
|
|
35
33
|
componentDidMount(): void;
|
|
36
34
|
componentWillUnmount(): void;
|
|
37
35
|
dialogRef: (ref: HTMLElement | null | undefined) => void;
|
|
38
|
-
render(): JSX.Element;
|
|
39
|
-
context:
|
|
36
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
37
|
+
context: unknown;
|
|
40
38
|
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<import("./src/withScrim").Props & Omit<P, "dialogRef">>) => Pick<{}, K> | {} | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
41
39
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
42
|
-
readonly props: Readonly<import("./src/withScrim").Props & Omit<P, "dialogRef"
|
|
43
|
-
children?: import("react").ReactNode | undefined;
|
|
44
|
-
}>;
|
|
40
|
+
readonly props: Readonly<import("./src/withScrim").Props & Omit<P, "dialogRef">>;
|
|
45
41
|
state: Readonly<{}>;
|
|
46
42
|
refs: {
|
|
47
43
|
[key: string]: import("react").ReactInstance;
|
|
@@ -2,5 +2,5 @@ import type { SyntheticEvent } from 'react';
|
|
|
2
2
|
type Props = {
|
|
3
3
|
onClose?: (e?: SyntheticEvent) => void | null;
|
|
4
4
|
};
|
|
5
|
-
declare const BpkScrim: ({ onClose }: Props) => JSX.Element;
|
|
5
|
+
declare const BpkScrim: ({ onClose }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
export default BpkScrim;
|
|
@@ -21,18 +21,16 @@ export type Props = {
|
|
|
21
21
|
[rest: string]: any;
|
|
22
22
|
};
|
|
23
23
|
declare const withScrim: <P extends object>(WrappedComponent: ComponentType<P> | string) => {
|
|
24
|
-
new (props:
|
|
24
|
+
new (props: Props & Omit<P, "dialogRef">): {
|
|
25
25
|
dialogElement?: HTMLElement | null | undefined;
|
|
26
26
|
componentDidMount(): void;
|
|
27
27
|
componentWillUnmount(): void;
|
|
28
28
|
dialogRef: (ref: HTMLElement | null | undefined) => void;
|
|
29
|
-
render(): JSX.Element;
|
|
30
|
-
context:
|
|
29
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
context: unknown;
|
|
31
31
|
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Props & Omit<P, "dialogRef">>) => Pick<{}, K> | {} | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
32
32
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
33
|
-
readonly props: Readonly<Props & Omit<P, "dialogRef"
|
|
34
|
-
children?: import("react").ReactNode | undefined;
|
|
35
|
-
}>;
|
|
33
|
+
readonly props: Readonly<Props & Omit<P, "dialogRef">>;
|
|
36
34
|
state: Readonly<{}>;
|
|
37
35
|
refs: {
|
|
38
36
|
[key: string]: import("react").ReactInstance;
|
|
@@ -53,13 +51,11 @@ declare const withScrim: <P extends object>(WrappedComponent: ComponentType<P> |
|
|
|
53
51
|
componentDidMount(): void;
|
|
54
52
|
componentWillUnmount(): void;
|
|
55
53
|
dialogRef: (ref: HTMLElement | null | undefined) => void;
|
|
56
|
-
render(): JSX.Element;
|
|
57
|
-
context:
|
|
54
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
55
|
+
context: unknown;
|
|
58
56
|
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Props & Omit<P, "dialogRef">>) => Pick<{}, K> | {} | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
59
57
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
60
|
-
readonly props: Readonly<Props & Omit<P, "dialogRef"
|
|
61
|
-
children?: import("react").ReactNode | undefined;
|
|
62
|
-
}>;
|
|
58
|
+
readonly props: Readonly<Props & Omit<P, "dialogRef">>;
|
|
63
59
|
state: Readonly<{}>;
|
|
64
60
|
refs: {
|
|
65
61
|
[key: string]: import("react").ReactInstance;
|
|
@@ -3,5 +3,5 @@ import type { Props as ScrimProps } from './withScrim';
|
|
|
3
3
|
export type Props = ScrimProps & {
|
|
4
4
|
renderTarget?: (() => HTMLElement | null) | null;
|
|
5
5
|
};
|
|
6
|
-
declare const withScrimmedPortal: (WrappedComponent: ComponentType<ScrimProps>) => ({ renderTarget, ...rest }: Props) => JSX.Element;
|
|
6
|
+
declare const withScrimmedPortal: (WrappedComponent: ComponentType<ScrimProps>) => ({ renderTarget, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
export default withScrimmedPortal;
|