@skyscanner/backpack-web 34.15.1 → 34.16.0-preminor.2

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.
Files changed (157) hide show
  1. package/bpk-component-aria-live/src/BpkAriaLive.d.ts +1 -1
  2. package/bpk-component-badge/src/BpkBadge.d.ts +1 -1
  3. package/bpk-component-banner-alert/src/AnimateAndFade.d.ts +1 -1
  4. package/bpk-component-banner-alert/src/BpkBannerAlert.d.ts +1 -2
  5. package/bpk-component-banner-alert/src/BpkBannerAlertDismissable.d.ts +1 -2
  6. package/bpk-component-banner-alert/src/BpkBannerAlertExpandable.d.ts +1 -1
  7. package/bpk-component-banner-alert/src/BpkBannerAlertInner.d.ts +1 -1
  8. package/bpk-component-banner-alert/src/withBannerAlertState.d.ts +36 -44
  9. package/bpk-component-boilerplate/src/BpkBoilerplate.d.ts +1 -2
  10. package/bpk-component-bottom-sheet/src/BpkBottomSheet.d.ts +1 -1
  11. package/bpk-component-button/BpkButtonDestructive.d.ts +1 -2
  12. package/bpk-component-button/BpkButtonFeatured.d.ts +1 -2
  13. package/bpk-component-button/BpkButtonLink.d.ts +1 -2
  14. package/bpk-component-button/BpkButtonLinkOnDark.d.ts +1 -2
  15. package/bpk-component-button/BpkButtonPrimary.d.ts +1 -2
  16. package/bpk-component-button/BpkButtonPrimaryOnDark.d.ts +1 -2
  17. package/bpk-component-button/BpkButtonPrimaryOnLight.d.ts +1 -2
  18. package/bpk-component-button/BpkButtonSecondary.d.ts +1 -2
  19. package/bpk-component-button/BpkButtonSecondaryOnDark.d.ts +1 -2
  20. package/bpk-component-button/src/BpkButton.d.ts +1 -2
  21. package/bpk-component-button/src/BpkButtonBase.d.ts +2 -13
  22. package/bpk-component-button/src/BpkButtonDestructive.module.css +18 -0
  23. package/bpk-component-button/src/BpkButtonFeatured.module.css +18 -0
  24. package/bpk-component-button/src/BpkButtonLink.module.css +18 -0
  25. package/bpk-component-button/src/BpkButtonLinkOnDark.module.css +18 -0
  26. package/bpk-component-button/src/BpkButtonPrimaryOnDark.module.css +18 -0
  27. package/bpk-component-button/src/BpkButtonPrimaryOnLight.module.css +18 -0
  28. package/bpk-component-button/src/BpkButtonSecondary.module.css +18 -0
  29. package/bpk-component-button/src/BpkButtonSecondaryOnDark.module.css +18 -0
  30. package/bpk-component-button/src/BpkButtonV2/BpkButton.d.ts +1 -2
  31. package/bpk-component-calendar/src/BpkCalendarContainer.d.ts +10 -14
  32. package/bpk-component-calendar/src/BpkCalendarDate.d.ts +1 -1
  33. package/bpk-component-calendar/src/BpkCalendarGrid.d.ts +5 -5
  34. package/bpk-component-calendar/src/BpkCalendarGridHeader.d.ts +1 -1
  35. package/bpk-component-calendar/src/BpkCalendarGridTransition.d.ts +2 -2
  36. package/bpk-component-calendar/src/BpkCalendarNav.d.ts +1 -1
  37. package/bpk-component-calendar/src/BpkCalendarWeek.d.ts +1 -1
  38. package/bpk-component-calendar/src/composeCalendar.d.ts +1 -1
  39. package/bpk-component-card/src/BpkCard.d.ts +1 -1
  40. package/bpk-component-card/src/BpkCardWrapper.d.ts +1 -1
  41. package/bpk-component-card/src/BpkDividedCard.d.ts +1 -1
  42. package/bpk-component-card/src/CardContext.d.ts +0 -1
  43. package/bpk-component-card-button/src/BpkSaveButton.d.ts +1 -1
  44. package/bpk-component-carousel/src/BpkCarousel.d.ts +1 -2
  45. package/bpk-component-carousel/src/BpkCarouselContainer.d.ts +1 -1
  46. package/bpk-component-carousel/src/utils.test.js +30 -0
  47. package/bpk-component-chip/src/BpkDismissibleChip.d.ts +1 -2
  48. package/bpk-component-chip/src/BpkDropdownChip.d.ts +1 -2
  49. package/bpk-component-chip/src/BpkIconChip.d.ts +1 -1
  50. package/bpk-component-chip/src/BpkSelectableChip.d.ts +1 -1
  51. package/bpk-component-chip-group/src/BpkMultiSelectChipGroup.d.ts +1 -1
  52. package/bpk-component-chip-group/src/BpkSingleSelectChipGroup.d.ts +1 -2
  53. package/bpk-component-chip-group/src/Nudger.d.ts +1 -1
  54. package/bpk-component-close-button/src/BpkCloseButton.d.ts +10 -0
  55. package/bpk-component-close-button/src/BpkCloseButton.js +21 -37
  56. package/bpk-component-datatable/src/BpkDataTable.d.ts +1 -2
  57. package/bpk-component-datatable/src/BpkDataTableHeader.d.ts +1 -2
  58. package/bpk-component-datepicker/src/BpkDatepicker.d.ts +7 -9
  59. package/bpk-component-datepicker/src/BpkDatepicker.module.css +18 -0
  60. package/bpk-component-description-list/src/BpkDescriptionDetails.d.ts +1 -1
  61. package/bpk-component-description-list/src/BpkDescriptionList.d.ts +1 -1
  62. package/bpk-component-description-list/src/BpkDescriptionTerm.d.ts +1 -1
  63. package/bpk-component-dialog/src/BpkDialog.d.ts +1 -2
  64. package/bpk-component-dialog/src/BpkDialogInner.d.ts +11 -16
  65. package/bpk-component-flare/src/__generated__/js/corner-radius.d.ts +5 -0
  66. package/bpk-component-flare/src/__generated__/js/pointer.d.ts +5 -0
  67. package/bpk-component-floating-notification/src/BpkFloatingNotification.d.ts +1 -1
  68. package/bpk-component-graphic-promotion/src/BpkGraphicPromo.d.ts +1 -2
  69. package/bpk-component-icon/index.d.ts +2 -2
  70. package/bpk-component-icon/src/classNameModifierHOCFactory.d.ts +2 -2
  71. package/bpk-component-icon/src/withAlignment.d.ts +1 -1
  72. package/bpk-component-icon/src/withRtlSupport.d.ts +3 -4
  73. package/bpk-component-image/src/BpkBackgroundImage.d.ts +1 -1
  74. package/bpk-component-image/src/BpkImage.d.ts +1 -1
  75. package/bpk-component-image/src/withLazyLoading.d.ts +8 -11
  76. package/bpk-component-image/src/withLoadingBehavior.d.ts +5 -7
  77. package/bpk-component-info-banner/src/AnimateAndFade.d.ts +1 -1
  78. package/bpk-component-info-banner/src/BpkInfoBanner.d.ts +1 -2
  79. package/bpk-component-info-banner/src/BpkInfoBannerDismissable.d.ts +1 -2
  80. package/bpk-component-info-banner/src/BpkInfoBannerExpandable.d.ts +1 -1
  81. package/bpk-component-info-banner/src/BpkInfoBannerInner.d.ts +1 -1
  82. package/bpk-component-info-banner/src/withBannerAlertState.d.ts +36 -45
  83. package/bpk-component-input/src/BpkClearButton.module.css +18 -0
  84. package/bpk-component-input/src/BpkInput.d.ts +1 -1
  85. package/bpk-component-input/src/BpkInput.js +1 -1
  86. package/bpk-component-input/src/common-types.d.ts +1 -1
  87. package/bpk-component-input/src/withOpenEvents.d.ts +4 -6
  88. package/bpk-component-inset-banner/src/BpkInsetBanner.d.ts +1 -2
  89. package/bpk-component-journey-arrow/src/BpkJourneyArrow.d.ts +1 -2
  90. package/bpk-component-loading-button/src/BpkLoadingButton.d.ts +6 -38
  91. package/bpk-component-loading-button/src/BpkLoadingButton.js +13 -44
  92. package/bpk-component-map/src/BpkBasicMapMarker.d.ts +1 -1
  93. package/bpk-component-map/src/BpkPriceMarkerV2/BpkPriceMarker.d.ts +1 -1
  94. package/bpk-component-modal/src/BpkModal.d.ts +1 -1
  95. package/bpk-component-modal/src/BpkModalInner.d.ts +1 -1
  96. package/bpk-component-modal/src/BpkModalV2/BpkModal.d.ts +1 -1
  97. package/bpk-component-navigation-bar/src/BpkNavigationBar.d.ts +1 -1
  98. package/bpk-component-navigation-bar/src/BpkNavigationBarButtonLink.d.ts +1 -1
  99. package/bpk-component-navigation-bar/src/BpkNavigationBarButtonLink.module.css +18 -0
  100. package/bpk-component-navigation-bar/src/BpkNavigationBarIconButton.d.ts +1 -1
  101. package/bpk-component-nudger/index.d.ts +1 -2
  102. package/bpk-component-nudger/index.js +1 -2
  103. package/bpk-component-nudger/src/BpkNudger.d.ts +1 -2
  104. package/bpk-component-nudger/src/BpkNudger.js +102 -20
  105. package/bpk-component-nudger/src/BpkNudger.module.css +1 -1
  106. package/bpk-component-nudger/src/common-types.d.ts +7 -5
  107. package/bpk-component-overlay/src/BpkOverlay.d.ts +1 -1
  108. package/bpk-component-popover/src/BpkPopover.d.ts +1 -1
  109. package/bpk-component-rating/src/BpkRating.d.ts +1 -1
  110. package/bpk-component-rtl-toggle/src/BpkRtlToggle.d.ts +1 -1
  111. package/bpk-component-rtl-toggle/src/updateOnDirectionChange.d.ts +11 -15
  112. package/bpk-component-scrollable-calendar/src/BpkScrollableCalendar.d.ts +6 -9
  113. package/bpk-component-scrollable-calendar/src/BpkScrollableCalendarDate.d.ts +1 -2
  114. package/bpk-component-scrollable-calendar/src/BpkScrollableCalendarGrid.d.ts +3 -3
  115. package/bpk-component-scrollable-calendar/src/BpkScrollableCalendarGridList.d.ts +3 -3
  116. package/bpk-component-section-header/src/BpkSectionHeader.d.ts +1 -1
  117. package/bpk-component-segmented-control/src/BpkSegmentedControl.d.ts +1 -1
  118. package/bpk-component-skeleton/src/BpkBaseSkeleton.d.d.ts +0 -1
  119. package/bpk-component-skeleton/src/BpkBaseSkeleton.d.ts +1 -2
  120. package/bpk-component-skeleton/src/BpkSkeleton.d.d.ts +0 -1
  121. package/bpk-component-skeleton/src/BpkSkeleton.d.ts +1 -2
  122. package/bpk-component-slider/src/BpkSlider.d.ts +4 -2
  123. package/bpk-component-slider/src/BpkSlider.js +51 -3
  124. package/bpk-component-snippet/index.d.ts +3 -0
  125. package/bpk-component-snippet/index.js +21 -0
  126. package/bpk-component-snippet/src/BpkSnippet.d.ts +48 -0
  127. package/bpk-component-snippet/src/BpkSnippet.js +131 -0
  128. package/bpk-component-snippet/src/BpkSnippet.module.css +18 -0
  129. package/bpk-component-spinner/src/BpkExtraLargeSpinner.d.ts +4 -15
  130. package/bpk-component-spinner/src/BpkExtraLargeSpinner.js +5 -16
  131. package/bpk-component-spinner/src/BpkLargeSpinner.d.ts +5 -18
  132. package/bpk-component-spinner/src/BpkLargeSpinner.js +6 -19
  133. package/bpk-component-spinner/src/BpkSpinner.d.ts +5 -18
  134. package/bpk-component-spinner/src/BpkSpinner.js +6 -19
  135. package/bpk-component-split-input/src/BpkInputField.d.ts +21 -0
  136. package/bpk-component-split-input/src/BpkInputField.js +13 -15
  137. package/bpk-component-split-input/src/BpkSplitInput.d.ts +44 -0
  138. package/bpk-component-split-input/src/BpkSplitInput.js +23 -34
  139. package/bpk-component-swap-button/src/BpkSwapButton.d.ts +1 -2
  140. package/bpk-component-text/src/BpkText.d.ts +1 -1
  141. package/bpk-component-tooltip/src/BpkTooltip.d.ts +1 -1
  142. package/bpk-component-tooltip/src/BpkTooltipPortal.d.ts +1 -1
  143. package/bpk-react-utils/index.d.ts +9 -10
  144. package/bpk-react-utils/src/BpkDialogWrapper/BpkDialogWrapper.d.ts +1 -1
  145. package/bpk-react-utils/src/TransitionInitialMount.d.ts +1 -1
  146. package/bpk-react-utils/src/nativeEventHandler.d.ts +1 -1
  147. package/bpk-react-utils/src/nativeEventHandler.js +7 -5
  148. package/bpk-react-utils/src/withDefaultProps.d.ts +1 -1
  149. package/bpk-scrim-utils/index.d.ts +12 -17
  150. package/bpk-scrim-utils/src/BpkScrim.d.ts +1 -1
  151. package/bpk-scrim-utils/src/withScrim.d.ts +11 -15
  152. package/bpk-scrim-utils/src/withScrimmedPortal.d.ts +1 -1
  153. package/bpk-stylesheets/test.css +164 -0
  154. package/bpk-theming/src/BpkThemeProvider.js +19 -30
  155. package/package.json +5 -3
  156. package/bpk-component-nudger/src/BpkConfigurableNudger.d.ts +0 -27
  157. package/bpk-component-nudger/src/BpkConfigurableNudger.js +0 -96
@@ -0,0 +1,131 @@
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 BpkBreakpoint, { BREAKPOINTS } from "../../bpk-component-breakpoint";
20
+ import { BpkButtonV2, BUTTON_TYPES } from "../../bpk-component-button";
21
+ import BpkImage, { BORDER_RADIUS_STYLES, withLazyLoading } from "../../bpk-component-image";
22
+ import BpkText, { TEXT_STYLES } from "../../bpk-component-text/src/BpkText";
23
+ import { cssModules } from "../../bpk-react-utils";
24
+ import STYLES from "./BpkSnippet.module.css";
25
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
26
+ const getClassName = cssModules(STYLES);
27
+ export const BODY_STYLE = {
28
+ bodyDefault: TEXT_STYLES.bodyDefault,
29
+ bodyLongform: TEXT_STYLES.bodyLongform
30
+ };
31
+ export const BUTTON_STYLE = {
32
+ primary: BUTTON_TYPES.primary,
33
+ featured: BUTTON_TYPES.featured
34
+ };
35
+ export const HEADLINE_STYLE = {
36
+ heading1: TEXT_STYLES.heading1,
37
+ heading2: TEXT_STYLES.heading2,
38
+ heading3: TEXT_STYLES.heading3,
39
+ heading4: TEXT_STYLES.heading4,
40
+ heading5: TEXT_STYLES.heading5,
41
+ hero1: TEXT_STYLES.hero1,
42
+ hero2: TEXT_STYLES.hero2,
43
+ hero3: TEXT_STYLES.hero3,
44
+ hero4: TEXT_STYLES.hero4,
45
+ hero5: TEXT_STYLES.hero5
46
+ };
47
+ export const DESKTOP_LAYOUT = {
48
+ imageLeft: 'imageLeft',
49
+ imageRight: 'imageRight',
50
+ vertical: 'vertical'
51
+ };
52
+ export const IMAGE_ORIENTATION = {
53
+ landscape: 'landscape',
54
+ portrait: 'portrait',
55
+ square: 'square'
56
+ };
57
+ const documentIfExists = typeof window !== 'undefined' ? document : null;
58
+ const LazyLoadedImage = withLazyLoading(BpkImage, documentIfExists);
59
+ const getImageAspectRatio = imageOrientation => {
60
+ let imageAspectRatio;
61
+ switch (imageOrientation) {
62
+ case 'landscape':
63
+ imageAspectRatio = 3 / 2;
64
+ break;
65
+ case 'square':
66
+ imageAspectRatio = 1;
67
+ break;
68
+ case 'portrait':
69
+ imageAspectRatio = 5 / 7;
70
+ break;
71
+ default:
72
+ imageAspectRatio = 3 / 2;
73
+ break;
74
+ }
75
+ return imageAspectRatio;
76
+ };
77
+ const BpkSnippet = ({
78
+ altText,
79
+ bodyStyle = BODY_STYLE.bodyDefault,
80
+ bodyText,
81
+ buttonStyle = BUTTON_STYLE.primary,
82
+ buttonText,
83
+ desktopLayout = DESKTOP_LAYOUT.imageLeft,
84
+ headline,
85
+ headlineStyle = HEADLINE_STYLE.hero5,
86
+ imageOrientation,
87
+ imageRadius = true,
88
+ onClick,
89
+ src,
90
+ subheading
91
+ }) => /*#__PURE__*/_jsx(BpkBreakpoint, {
92
+ query: BREAKPOINTS.MOBILE,
93
+ children: isMobile => /*#__PURE__*/_jsxs("div", {
94
+ className: getClassName('bpk-snippet', desktopLayout === 'imageRight' && 'bpk-snippet--row-reverse', desktopLayout === 'vertical' && 'bpk-snippet--vertical'),
95
+ children: [/*#__PURE__*/_jsx("div", {
96
+ className: getClassName('bpk-snippet--image', desktopLayout === 'vertical' ? 'bpk-snippet--vertical--container' : 'bpk-snippet--container'),
97
+ children: /*#__PURE__*/_jsx(LazyLoadedImage, {
98
+ altText: altText,
99
+ aspectRatio: getImageAspectRatio(imageOrientation),
100
+ borderRadiusStyle: imageRadius ? BORDER_RADIUS_STYLES.sm : BORDER_RADIUS_STYLES.none,
101
+ src: src
102
+ })
103
+ }), /*#__PURE__*/_jsxs("div", {
104
+ className: desktopLayout === 'vertical' ? getClassName('bpk-snippet--vertical--container', 'bpk-snippet--vertical--content') : getClassName('bpk-snippet--container', 'bpk-snippet--content'),
105
+ children: [headline && /*#__PURE__*/_jsx("div", {
106
+ className: getClassName('bpk-snippet--headline'),
107
+ children: /*#__PURE__*/_jsx(BpkText, {
108
+ textStyle: isMobile ? HEADLINE_STYLE.heading4 : headlineStyle,
109
+ children: headline
110
+ })
111
+ }), subheading && /*#__PURE__*/_jsx("div", {
112
+ className: getClassName('bpk-snippet--subheading'),
113
+ children: /*#__PURE__*/_jsx(BpkText, {
114
+ textStyle: TEXT_STYLES.subheading,
115
+ children: subheading
116
+ })
117
+ }), bodyText && /*#__PURE__*/_jsx("div", {
118
+ className: getClassName('bpk-snippet--bodyText'),
119
+ children: /*#__PURE__*/_jsx(BpkText, {
120
+ textStyle: isMobile ? BODY_STYLE.bodyDefault : bodyStyle,
121
+ children: bodyText
122
+ })
123
+ }), buttonText && onClick && /*#__PURE__*/_jsx(BpkButtonV2, {
124
+ type: buttonStyle,
125
+ onClick: onClick,
126
+ children: buttonText
127
+ })]
128
+ })]
129
+ })
130
+ });
131
+ export default BpkSnippet;
@@ -0,0 +1,18 @@
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
+ .bpk-snippet{display:flex;flex-direction:row;align-items:center}@media(max-width: 48rem){.bpk-snippet{flex-direction:column;gap:1rem}}.bpk-snippet--row-reverse{flex-direction:row-reverse}@media(max-width: 48rem){.bpk-snippet--row-reverse{flex-direction:column;gap:1rem}}.bpk-snippet--vertical{flex-direction:column;gap:1rem}.bpk-snippet--vertical--container{width:100%}.bpk-snippet--vertical--content{padding:0}.bpk-snippet--container{width:50%}@media(max-width: 48rem){.bpk-snippet--container{width:100%}}.bpk-snippet--image img{height:100%;object-fit:cover}.bpk-snippet--content{display:flex;padding:4rem;flex-direction:column;justify-content:center;align-items:flex-start}@media(max-width: 48rem){.bpk-snippet--content{padding:0}}.bpk-snippet--headline,.bpk-snippet--subheading,.bpk-snippet--bodyText{padding-bottom:1rem}@media(max-width: 48rem){.bpk-snippet--headline,.bpk-snippet--subheading,.bpk-snippet--bodyText{padding-bottom:.5rem}}
@@ -1,19 +1,8 @@
1
- /// <reference types="react" />
2
- import PropTypes from 'prop-types';
3
1
  import type { SpinnerTypes } from './spinnerTypes';
4
2
  type Props = {
5
- type: SpinnerTypes;
6
- className?: string;
7
- };
8
- declare const BpkExtraLargeSpinner: {
9
- (props: Props): JSX.Element;
10
- propTypes: {
11
- type: PropTypes.Requireable<string>;
12
- className: PropTypes.Requireable<string>;
13
- };
14
- defaultProps: {
15
- type: "dark";
16
- className: null;
17
- };
3
+ type?: SpinnerTypes;
4
+ className?: string | null;
5
+ [rest: string]: any;
18
6
  };
7
+ declare const BpkExtraLargeSpinner: ({ className, type, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
19
8
  export default BpkExtraLargeSpinner;
@@ -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 XlSpinner = function XlSpinner(props) {
22
20
  return /*#__PURE__*/_jsxs("svg", {
23
21
  ...props,
@@ -81,12 +79,11 @@ import SPINNER_TYPES from "./spinnerTypes";
81
79
  import STYLES from "./BpkSpinner.module.css";
82
80
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
83
81
  const getClassName = cssModules(STYLES);
84
- const BpkExtraLargeSpinner = props => {
85
- const {
86
- className,
87
- type,
88
- ...rest
89
- } = props;
82
+ const BpkExtraLargeSpinner = ({
83
+ className = null,
84
+ type = SPINNER_TYPES.dark,
85
+ ...rest
86
+ }) => {
90
87
  const classNames = getClassName('bpk-spinner', 'bpk-spinner--extra-large', `bpk-spinner--${type}`, className);
91
88
  return /*#__PURE__*/_jsx("span", {
92
89
  className: classNames,
@@ -95,12 +92,4 @@ const BpkExtraLargeSpinner = props => {
95
92
  })
96
93
  });
97
94
  };
98
- BpkExtraLargeSpinner.propTypes = {
99
- type: PropTypes.oneOf(Object.keys(SPINNER_TYPES)),
100
- className: PropTypes.string
101
- };
102
- BpkExtraLargeSpinner.defaultProps = {
103
- type: SPINNER_TYPES.dark,
104
- className: null
105
- };
106
95
  export default BpkExtraLargeSpinner;
@@ -1,22 +1,9 @@
1
- /// <reference types="react" />
2
- import PropTypes from 'prop-types';
3
1
  import type { SpinnerTypes } from './spinnerTypes';
4
2
  type Props = {
5
- type: SpinnerTypes;
6
- className?: string;
7
- alignToButton: boolean;
8
- };
9
- declare const BpkLargeSpinner: {
10
- (props: Props): JSX.Element;
11
- propTypes: {
12
- type: PropTypes.Requireable<string>;
13
- className: PropTypes.Requireable<string>;
14
- alignToButton: PropTypes.Requireable<boolean>;
15
- };
16
- defaultProps: {
17
- type: "dark";
18
- className: null;
19
- alignToButton: boolean;
20
- };
3
+ type?: SpinnerTypes;
4
+ className?: string | null;
5
+ alignToButton?: boolean;
6
+ [rest: string]: any;
21
7
  };
8
+ declare const BpkLargeSpinner: ({ alignToButton, className, type, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
22
9
  export default BpkLargeSpinner;
@@ -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 LgSpinner = function LgSpinner(props) {
22
20
  return /*#__PURE__*/_jsxs("svg", {
23
21
  ...props,
@@ -81,13 +79,12 @@ import SPINNER_TYPES from "./spinnerTypes";
81
79
  import STYLES from "./BpkSpinner.module.css";
82
80
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
83
81
  const getClassName = cssModules(STYLES);
84
- const BpkLargeSpinner = props => {
85
- const {
86
- alignToButton,
87
- className,
88
- type,
89
- ...rest
90
- } = props;
82
+ const BpkLargeSpinner = ({
83
+ alignToButton = false,
84
+ className = null,
85
+ type = SPINNER_TYPES.dark,
86
+ ...rest
87
+ }) => {
91
88
  const classNames = getClassName('bpk-spinner', 'bpk-spinner--large', `bpk-spinner--${type}`, alignToButton && 'bpk-spinner--align-to-large-button', className);
92
89
  return /*#__PURE__*/_jsx("span", {
93
90
  className: classNames,
@@ -96,14 +93,4 @@ const BpkLargeSpinner = props => {
96
93
  })
97
94
  });
98
95
  };
99
- BpkLargeSpinner.propTypes = {
100
- type: PropTypes.oneOf(Object.keys(SPINNER_TYPES)),
101
- className: PropTypes.string,
102
- alignToButton: PropTypes.bool
103
- };
104
- BpkLargeSpinner.defaultProps = {
105
- type: SPINNER_TYPES.dark,
106
- className: null,
107
- alignToButton: false
108
- };
109
96
  export default BpkLargeSpinner;
@@ -1,22 +1,9 @@
1
- /// <reference types="react" />
2
- import PropTypes from 'prop-types';
3
1
  import type { SpinnerTypes } from './spinnerTypes';
4
2
  type Props = {
5
- type: SpinnerTypes;
6
- className?: string;
7
- alignToButton: boolean;
8
- };
9
- declare const BpkSpinner: {
10
- (props: Props): JSX.Element;
11
- propTypes: {
12
- type: PropTypes.Requireable<string>;
13
- className: PropTypes.Requireable<string>;
14
- alignToButton: PropTypes.Requireable<boolean>;
15
- };
16
- defaultProps: {
17
- type: "dark";
18
- className: null;
19
- alignToButton: boolean;
20
- };
3
+ type?: SpinnerTypes;
4
+ className?: string | null;
5
+ alignToButton?: boolean;
6
+ [rest: string]: any;
21
7
  };
8
+ declare const BpkSpinner: ({ alignToButton, className, type, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
22
9
  export default BpkSpinner;
@@ -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 = props => {
72
- const {
73
- alignToButton,
74
- className,
75
- type,
76
- ...rest
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
- */import PropTypes from 'prop-types';
18
- import { Component } from 'react';
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 Component {
25
+ class BpkInputField extends PureComponent {
26
+ static defaultProps = {
27
+ value: '',
28
+ name: ''
29
+ };
25
30
  componentDidUpdate(prevProps) {
26
31
  const {
27
32
  focus
@@ -31,12 +36,14 @@ 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,
37
43
  id,
38
44
  index,
39
45
  label,
46
+ name,
40
47
  value,
41
48
  ...rest
42
49
  } = this.props;
@@ -45,25 +52,16 @@ class BpkInputField extends Component {
45
52
  children: /*#__PURE__*/_jsx(BpkInput, {
46
53
  id: id,
47
54
  autoComplete: "off",
48
- maxLength: "1",
55
+ name: name,
56
+ maxLength: 1,
49
57
  "aria-label": `${label} ${index}`,
50
58
  inputRef: input => {
51
59
  this.input = input;
52
60
  },
53
- value: value || '',
61
+ value: value,
54
62
  ...rest
55
63
  })
56
64
  }, index);
57
65
  }
58
66
  }
59
- BpkInputField.propTypes = {
60
- id: PropTypes.string.isRequired,
61
- label: PropTypes.string.isRequired,
62
- value: PropTypes.string,
63
- focus: PropTypes.bool.isRequired,
64
- index: PropTypes.number.isRequired
65
- };
66
- BpkInputField.defaultProps = {
67
- value: ''
68
- };
69
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
- */import PropTypes from 'prop-types';
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";
@@ -31,22 +32,25 @@ const DELETE = 46;
31
32
  const SPACEBAR = 32;
32
33
  const ENTER = 13;
33
34
  class BpkSplitInput extends Component {
35
+ static defaultProps = {
36
+ type: INPUT_TYPES.number,
37
+ inputLength: 4,
38
+ large: true,
39
+ placeholder: ''
40
+ };
34
41
  constructor(props) {
35
42
  super(props);
36
43
  this.state = {
37
44
  focusedInput: 0,
38
- inputValue: []
45
+ inputValue: Array(props.inputLength).fill('')
39
46
  };
40
47
  }
41
48
  onInputChange = input => {
42
49
  this.setState({
43
50
  inputValue: input
44
51
  });
45
- const {
46
- onChange
47
- } = this.props;
48
52
  const value = input.join('');
49
- onChange(value);
53
+ this.props.onInputChange(value);
50
54
  };
51
55
  updateInputValue = value => {
52
56
  const {
@@ -83,8 +87,8 @@ class BpkSplitInput extends Component {
83
87
  };
84
88
  isNumeric = () => this.props.type === INPUT_TYPES.number;
85
89
  isInputValid = value => {
86
- const isTypeValid = this.isNumeric() ? /^\d$/.test(value) : typeof value === 'string';
87
- return isTypeValid && value.trim().length === 1;
90
+ const isTypeValid = this.isNumeric() ? /^\d$/.test(`${value}`) : typeof value === 'string';
91
+ return isTypeValid && `${value}`.trim().length === 1;
88
92
  };
89
93
  focusInput = inputIndex => {
90
94
  const {
@@ -132,23 +136,23 @@ class BpkSplitInput extends Component {
132
136
  this.onInputChange(inputValue);
133
137
  };
134
138
  handleOnKeyDown = e => {
135
- if (e.keyCode === BACKSPACE || e.key === 'Backspace') {
139
+ if (e.key === 'Backspace') {
136
140
  e.preventDefault();
137
141
  this.updateInputValue('');
138
142
  this.focusPreviousInput();
139
- } else if (e.keyCode === DELETE || e.key === 'Delete') {
143
+ } else if (e.key === 'Delete') {
140
144
  e.preventDefault();
141
145
  this.updateInputValue('');
142
- } else if (e.keyCode === LEFT_ARROW || e.key === 'Left' || e.key === 'ArrowLeft') {
146
+ } else if (e.key === 'Left' || e.key === 'ArrowLeft') {
143
147
  e.preventDefault();
144
148
  this.focusPreviousInput();
145
- } else if (e.keyCode === RIGHT_ARROW || e.key === 'Right' || e.key === 'ArrowRight') {
149
+ } else if (e.key === 'Right' || e.key === 'ArrowRight') {
146
150
  e.preventDefault();
147
151
  this.focusNextInput();
148
- } else if (e.keyCode === ENTER || e.key === 'Enter') {
152
+ } else if (e.key === 'Enter') {
149
153
  e.preventDefault();
150
154
  this.handleSubmit();
151
- } else if (e.keyCode === SPACEBAR || e.key === ' ' || e.key === 'Spacebar' || e.key === 'Space') {
155
+ } else if (e.key === ' ' || e.key === 'Spacebar' || e.key === 'Space') {
152
156
  e.preventDefault();
153
157
  }
154
158
  };
@@ -179,7 +183,8 @@ class BpkSplitInput extends Component {
179
183
  large,
180
184
  name,
181
185
  placeholder,
182
- type
186
+ type,
187
+ ...rest
183
188
  } = this.props;
184
189
  const inputs = [];
185
190
  for (let index = 0; index < inputLength; index += 1) {
@@ -188,7 +193,7 @@ class BpkSplitInput extends Component {
188
193
  focus: focusedInput === index,
189
194
  id: `${id}-${index}`,
190
195
  label: label,
191
- name: name,
196
+ name: `${name}-${index}`,
192
197
  type: type,
193
198
  large: large,
194
199
  value: inputValue && inputValue[index],
@@ -197,7 +202,8 @@ class BpkSplitInput extends Component {
197
202
  onInput: this.handleOnChange,
198
203
  onKeyDown: this.handleOnKeyDown,
199
204
  onPaste: this.handleOnPaste,
200
- onFocus: e => this.handleOnFocus(e, index)
205
+ onFocus: e => this.handleOnFocus(e, index),
206
+ ...rest
201
207
  }, index));
202
208
  }
203
209
  return inputs;
@@ -209,22 +215,5 @@ class BpkSplitInput extends Component {
209
215
  });
210
216
  }
211
217
  }
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
218
  export default BpkSplitInput;
230
219
  export { INPUT_TYPES };
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const SWAPBUTTON_STYLES: {
3
2
  surfaceContrast: string;
4
3
  canvasDefault: string;
@@ -10,5 +9,5 @@ export type Props = {
10
9
  ariaLabel: string;
11
10
  swapButtonStyle?: SwapButtonStyle;
12
11
  };
13
- declare const BpkSwapButton: (props: Props) => JSX.Element;
12
+ declare const BpkSwapButton: (props: Props) => import("react/jsx-runtime").JSX.Element;
14
13
  export default BpkSwapButton;
@@ -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;