@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.
Files changed (141) 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 -1
  5. package/bpk-component-banner-alert/src/BpkBannerAlertDismissable.d.ts +1 -1
  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 +3 -5
  9. package/bpk-component-boilerplate/src/BpkBoilerplate.d.ts +1 -1
  10. package/bpk-component-bottom-sheet/src/BpkBottomSheet.d.ts +1 -1
  11. package/bpk-component-button/BpkButtonDestructive.d.ts +1 -1
  12. package/bpk-component-button/BpkButtonFeatured.d.ts +1 -1
  13. package/bpk-component-button/BpkButtonLink.d.ts +1 -1
  14. package/bpk-component-button/BpkButtonLinkOnDark.d.ts +1 -1
  15. package/bpk-component-button/BpkButtonPrimary.d.ts +1 -1
  16. package/bpk-component-button/BpkButtonPrimaryOnDark.d.ts +1 -1
  17. package/bpk-component-button/BpkButtonPrimaryOnLight.d.ts +1 -1
  18. package/bpk-component-button/BpkButtonSecondary.d.ts +1 -1
  19. package/bpk-component-button/BpkButtonSecondaryOnDark.d.ts +1 -1
  20. package/bpk-component-button/src/BpkButton.d.ts +1 -1
  21. package/bpk-component-button/src/BpkButtonBase.d.ts +1 -1
  22. package/bpk-component-button/src/BpkButtonV2/BpkButton.d.ts +1 -1
  23. package/bpk-component-calendar/src/BpkCalendarContainer.d.ts +6 -10
  24. package/bpk-component-calendar/src/BpkCalendarDate.d.ts +1 -1
  25. package/bpk-component-calendar/src/BpkCalendarGrid.d.ts +2 -2
  26. package/bpk-component-calendar/src/BpkCalendarGridHeader.d.ts +1 -1
  27. package/bpk-component-calendar/src/BpkCalendarGridTransition.d.ts +2 -2
  28. package/bpk-component-calendar/src/BpkCalendarNav.d.ts +1 -1
  29. package/bpk-component-calendar/src/BpkCalendarWeek.d.ts +1 -1
  30. package/bpk-component-calendar/src/composeCalendar.d.ts +1 -1
  31. package/bpk-component-card/src/BpkCard.d.ts +1 -1
  32. package/bpk-component-card/src/BpkCardWrapper.d.ts +1 -1
  33. package/bpk-component-card/src/BpkDividedCard.d.ts +1 -1
  34. package/bpk-component-card-button/src/BpkSaveButton.d.ts +1 -1
  35. package/bpk-component-carousel/src/BpkCarousel.d.ts +1 -1
  36. package/bpk-component-carousel/src/BpkCarouselContainer.d.ts +1 -1
  37. package/bpk-component-carousel/src/utils.test.js +30 -0
  38. package/bpk-component-chip/src/BpkDismissibleChip.d.ts +1 -1
  39. package/bpk-component-chip/src/BpkDropdownChip.d.ts +1 -1
  40. package/bpk-component-chip/src/BpkIconChip.d.ts +1 -1
  41. package/bpk-component-chip/src/BpkSelectableChip.d.ts +1 -1
  42. package/bpk-component-chip-group/src/BpkMultiSelectChipGroup.d.ts +1 -1
  43. package/bpk-component-chip-group/src/BpkSingleSelectChipGroup.d.ts +1 -1
  44. package/bpk-component-chip-group/src/Nudger.d.ts +1 -1
  45. package/bpk-component-close-button/src/BpkCloseButton.d.ts +10 -0
  46. package/bpk-component-close-button/src/BpkCloseButton.js +21 -37
  47. package/bpk-component-datatable/src/BpkDataTable.d.ts +1 -1
  48. package/bpk-component-datatable/src/BpkDataTableHeader.d.ts +1 -1
  49. package/bpk-component-datepicker/src/BpkDatepicker.d.ts +3 -5
  50. package/bpk-component-description-list/src/BpkDescriptionDetails.d.ts +1 -1
  51. package/bpk-component-description-list/src/BpkDescriptionList.d.ts +1 -1
  52. package/bpk-component-description-list/src/BpkDescriptionTerm.d.ts +1 -1
  53. package/bpk-component-dialog/src/BpkDialog.d.ts +1 -1
  54. package/bpk-component-dialog/src/BpkDialogInner.d.ts +7 -11
  55. package/bpk-component-floating-notification/src/BpkFloatingNotification.d.ts +1 -1
  56. package/bpk-component-graphic-promotion/src/BpkGraphicPromo.d.ts +1 -1
  57. package/bpk-component-icon/index.d.ts +2 -2
  58. package/bpk-component-icon/src/classNameModifierHOCFactory.d.ts +1 -1
  59. package/bpk-component-icon/src/withAlignment.d.ts +1 -1
  60. package/bpk-component-icon/src/withRtlSupport.d.ts +1 -1
  61. package/bpk-component-image/src/BpkBackgroundImage.d.ts +1 -1
  62. package/bpk-component-image/src/BpkImage.d.ts +1 -1
  63. package/bpk-component-image/src/withLazyLoading.d.ts +3 -5
  64. package/bpk-component-image/src/withLoadingBehavior.d.ts +3 -5
  65. package/bpk-component-info-banner/src/AnimateAndFade.d.ts +1 -1
  66. package/bpk-component-info-banner/src/BpkInfoBanner.d.ts +1 -1
  67. package/bpk-component-info-banner/src/BpkInfoBannerDismissable.d.ts +1 -1
  68. package/bpk-component-info-banner/src/BpkInfoBannerExpandable.d.ts +1 -1
  69. package/bpk-component-info-banner/src/BpkInfoBannerInner.d.ts +1 -1
  70. package/bpk-component-info-banner/src/withBannerAlertState.d.ts +3 -5
  71. package/bpk-component-input/src/BpkInput.d.ts +1 -1
  72. package/bpk-component-input/src/BpkInput.js +1 -1
  73. package/bpk-component-input/src/common-types.d.ts +1 -1
  74. package/bpk-component-input/src/withOpenEvents.d.ts +2 -4
  75. package/bpk-component-inset-banner/src/BpkInsetBanner.d.ts +1 -1
  76. package/bpk-component-journey-arrow/src/BpkJourneyArrow.d.ts +1 -1
  77. package/bpk-component-loading-button/src/BpkLoadingButton.d.ts +6 -38
  78. package/bpk-component-loading-button/src/BpkLoadingButton.js +13 -44
  79. package/bpk-component-map/src/BpkBasicMapMarker.d.ts +1 -1
  80. package/bpk-component-map/src/BpkPriceMarkerV2/BpkPriceMarker.d.ts +1 -1
  81. package/bpk-component-modal/src/BpkModal.d.ts +1 -1
  82. package/bpk-component-modal/src/BpkModalInner.d.ts +1 -1
  83. package/bpk-component-modal/src/BpkModalV2/BpkModal.d.ts +1 -1
  84. package/bpk-component-navigation-bar/src/BpkNavigationBar.d.ts +1 -1
  85. package/bpk-component-navigation-bar/src/BpkNavigationBarButtonLink.d.ts +1 -1
  86. package/bpk-component-navigation-bar/src/BpkNavigationBarIconButton.d.ts +1 -1
  87. package/bpk-component-nudger/index.d.ts +1 -2
  88. package/bpk-component-nudger/index.js +1 -2
  89. package/bpk-component-nudger/src/BpkNudger.d.ts +1 -1
  90. package/bpk-component-nudger/src/BpkNudger.js +102 -20
  91. package/bpk-component-nudger/src/BpkNudger.module.css +1 -1
  92. package/bpk-component-nudger/src/common-types.d.ts +7 -5
  93. package/bpk-component-overlay/src/BpkOverlay.d.ts +1 -1
  94. package/bpk-component-popover/src/BpkPopover.d.ts +1 -1
  95. package/bpk-component-rating/src/BpkRating.d.ts +1 -1
  96. package/bpk-component-rtl-toggle/src/BpkRtlToggle.d.ts +1 -1
  97. package/bpk-component-rtl-toggle/src/updateOnDirectionChange.d.ts +7 -11
  98. package/bpk-component-scrollable-calendar/src/BpkScrollableCalendar.d.ts +2 -4
  99. package/bpk-component-scrollable-calendar/src/BpkScrollableCalendarDate.d.ts +1 -1
  100. package/bpk-component-scrollable-calendar/src/BpkScrollableCalendarGrid.d.ts +3 -3
  101. package/bpk-component-scrollable-calendar/src/BpkScrollableCalendarGridList.d.ts +3 -3
  102. package/bpk-component-section-header/src/BpkSectionHeader.d.ts +1 -1
  103. package/bpk-component-segmented-control/src/BpkSegmentedControl.d.ts +1 -1
  104. package/bpk-component-skeleton/src/BpkBaseSkeleton.d.ts +1 -1
  105. package/bpk-component-skeleton/src/BpkSkeleton.d.ts +1 -1
  106. package/bpk-component-slider/src/BpkSlider.d.ts +4 -1
  107. package/bpk-component-slider/src/BpkSlider.js +51 -3
  108. package/bpk-component-snippet/src/BpkSnippet.d.ts +1 -1
  109. package/bpk-component-spinner/src/BpkExtraLargeSpinner.d.ts +4 -14
  110. package/bpk-component-spinner/src/BpkExtraLargeSpinner.js +5 -16
  111. package/bpk-component-spinner/src/BpkLargeSpinner.d.ts +5 -17
  112. package/bpk-component-spinner/src/BpkLargeSpinner.js +6 -19
  113. package/bpk-component-spinner/src/BpkSpinner.d.ts +5 -17
  114. package/bpk-component-spinner/src/BpkSpinner.js +6 -19
  115. package/bpk-component-split-input/src/BpkInputField.d.ts +21 -0
  116. package/bpk-component-split-input/src/BpkInputField.js +12 -17
  117. package/bpk-component-split-input/src/BpkSplitInput.d.ts +44 -0
  118. package/bpk-component-split-input/src/BpkSplitInput.js +21 -40
  119. package/bpk-component-swap-button/src/BpkSwapButton.d.ts +1 -1
  120. package/bpk-component-switch/index.d.ts +5 -0
  121. package/bpk-component-switch/src/BpkSwitch.d.ts +8 -0
  122. package/bpk-component-switch/src/BpkSwitch.js +9 -22
  123. package/bpk-component-switch/src/BpkSwitch.module.css +1 -1
  124. package/bpk-component-switch/src/themeAttributes.d.ts +2 -0
  125. package/bpk-component-text/src/BpkText.d.ts +1 -1
  126. package/bpk-component-tooltip/src/BpkTooltip.d.ts +1 -1
  127. package/bpk-component-tooltip/src/BpkTooltipPortal.d.ts +1 -1
  128. package/bpk-react-utils/index.d.ts +3 -3
  129. package/bpk-react-utils/src/BpkDialogWrapper/BpkDialogWrapper.d.ts +1 -1
  130. package/bpk-react-utils/src/TransitionInitialMount.d.ts +1 -1
  131. package/bpk-react-utils/src/nativeEventHandler.d.ts +1 -1
  132. package/bpk-react-utils/src/nativeEventHandler.js +7 -5
  133. package/bpk-react-utils/src/withDefaultProps.d.ts +1 -1
  134. package/bpk-scrim-utils/index.d.ts +7 -11
  135. package/bpk-scrim-utils/src/BpkScrim.d.ts +1 -1
  136. package/bpk-scrim-utils/src/withScrim.d.ts +7 -11
  137. package/bpk-scrim-utils/src/withScrimmedPortal.d.ts +1 -1
  138. package/bpk-theming/src/BpkThemeProvider.js +19 -30
  139. package/package.json +5 -3
  140. package/bpk-component-nudger/src/BpkConfigurableNudger.d.ts +0 -26
  141. package/bpk-component-nudger/src/BpkConfigurableNudger.js +0 -96
@@ -16,30 +16,63 @@
16
16
  * limitations under the License.
17
17
  */
18
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";
19
24
  // @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
20
25
  import BpkLabel from "../../bpk-component-label";
21
26
  import BpkText, { TEXT_STYLES } from "../../bpk-component-text";
22
- import { cssModules } from "../../bpk-react-utils";
23
- import BpkConfigurableNudger from "./BpkConfigurableNudger";
27
+ import { cssModules, setNativeValue } from "../../bpk-react-utils";
24
28
  import STYLES from "./BpkNudger.module.css";
25
29
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
26
30
  const getClassName = cssModules(STYLES);
27
31
  const compareValues = (a, b) => a - b;
28
- const incrementValue = currentValue => currentValue + 1;
29
- const decrementValue = currentValue => currentValue - 1;
30
- const formatValue = currentValue => currentValue.toString();
31
32
  const BpkNudger = ({
32
33
  buttonType = 'secondary',
33
34
  className = null,
35
+ decreaseButtonLabel,
34
36
  icon,
35
37
  id,
38
+ increaseButtonLabel,
39
+ inputClassName,
40
+ max,
41
+ min,
42
+ name,
43
+ onValueChange,
44
+ step = 1,
36
45
  subtitle,
37
46
  title,
47
+ value,
38
48
  ...rest
39
49
  }) => {
40
- const classNames = getClassName(title && 'bpk-nudger__container');
50
+ // Ensure that the minimum value is 0 or greater it's not designed to handle negative values.
51
+ const minimum = min < 0 ? 0 : min;
52
+ const containerClassNames = getClassName(title && 'bpk-nudger__container');
53
+ const inputClassNames = getClassName('bpk-nudger__input', 'bpk-nudger__input--numeric', inputClassName && inputClassName, buttonType === 'secondaryOnDark' && 'bpk-nudger__input--secondary-on-dark');
54
+ const nudgerClassNames = getClassName('bpk-nudger', className);
55
+ const maxButtonDisabled = compareValues(value, max) >= 0;
56
+ const minButtonDisabled = compareValues(value, minimum) <= 0;
57
+ const AlignedMinusIcon = withButtonAlignment(MinusIcon);
58
+ const AlignedPlusIcon = withButtonAlignment(PlusIcon);
59
+ const inputRef = useRef(null);
60
+ const incrementValue = currentValue => currentValue + step;
61
+ const decrementValue = currentValue => currentValue - step;
62
+ const valueLimitter = element => {
63
+ if (element.valueAsNumber < minimum) {
64
+ onValueChange(minimum);
65
+ setNativeValue(element, minimum, false);
66
+ } else if (element.valueAsNumber > max) {
67
+ onValueChange(max);
68
+ setNativeValue(element, max, false);
69
+ }
70
+ if (element.valueAsNumber >= minimum && element.valueAsNumber <= max) {
71
+ onValueChange(element.valueAsNumber);
72
+ }
73
+ };
41
74
  return /*#__PURE__*/_jsxs("div", {
42
- className: classNames,
75
+ className: containerClassNames,
43
76
  children: [title && /*#__PURE__*/_jsxs("div", {
44
77
  className: getClassName('bpk-nudger__label'),
45
78
  children: [/*#__PURE__*/_jsx(BpkLabel, {
@@ -60,19 +93,68 @@ const BpkNudger = ({
60
93
  })
61
94
  })]
62
95
  })]
63
- }), /*#__PURE__*/_jsx(BpkConfigurableNudger, {
64
- inputClassName: getClassName('bpk-nudger__input--numeric'),
65
- compareValues: compareValues,
66
- incrementValue: incrementValue,
67
- decrementValue: decrementValue,
68
- formatValue: formatValue
69
- // TODO: className to be removed
70
- // eslint-disable-next-line @skyscanner/rules/forbid-component-props
71
- ,
72
- className: className,
73
- buttonType: buttonType,
74
- id: id,
75
- ...rest
96
+ }), /*#__PURE__*/_jsxs("div", {
97
+ className: nudgerClassNames,
98
+ children: [/*#__PURE__*/_jsx(BpkButtonV2, {
99
+ type: BUTTON_TYPES[buttonType],
100
+ iconOnly: true,
101
+ onClick: () => {
102
+ if (Number.isNaN(value)) {
103
+ onValueChange(minimum);
104
+ inputRef.current && setNativeValue(inputRef.current, minimum);
105
+ return;
106
+ }
107
+ const newValue = decrementValue(value);
108
+ onValueChange(newValue);
109
+ // We want to maintain native input events across our form components. Along with react updating
110
+ // the value attribute we can set it via native handlers and emit a "change" event.
111
+ inputRef.current && setNativeValue(inputRef.current, newValue);
112
+ },
113
+ disabled: minButtonDisabled,
114
+ title: decreaseButtonLabel,
115
+ "aria-controls": id,
116
+ children: /*#__PURE__*/_jsx(AlignedMinusIcon, {})
117
+ }), /*#__PURE__*/_jsx("input", {
118
+ type: "number",
119
+ "aria-live": "polite",
120
+ defaultValue: value,
121
+ id: id,
122
+ ref: inputRef,
123
+ name: name || id,
124
+ step: step,
125
+ onInput: event => {
126
+ const inputElement = event.target;
127
+ if (!inputElement.validity.valid &&
128
+ // allow the removal of a value
129
+ Number.isNaN(inputElement.valueAsNumber)) {
130
+ // set prev value if entry invalid
131
+ onValueChange(value);
132
+ setNativeValue(inputElement, value, false);
133
+ }
134
+ valueLimitter(inputElement);
135
+ },
136
+ className: inputClassNames,
137
+ ...rest
138
+ }), /*#__PURE__*/_jsx(BpkButtonV2, {
139
+ type: BUTTON_TYPES[buttonType],
140
+ iconOnly: true,
141
+ onClick: () => {
142
+ if (Number.isNaN(value)) {
143
+ onValueChange(max);
144
+ inputRef.current && setNativeValue(inputRef.current, max);
145
+ return;
146
+ }
147
+ const newValue = incrementValue(value);
148
+ onValueChange(newValue);
149
+ // We want to maintain native input events across our form components. Along with react updating
150
+ // the value attribute we can set it via native handlers and emit a "change" event.
151
+ inputRef.current && setNativeValue(inputRef.current, newValue);
152
+ },
153
+ disabled: maxButtonDisabled,
154
+ title: increaseButtonLabel,
155
+ "aria-controls": id,
156
+ children: /*#__PURE__*/_jsx(AlignedPlusIcon, {})
157
+ })]
76
158
  })]
77
159
  });
78
160
  };
@@ -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
- html[dir=rtl] .bpk-nudger{display:flex;flex-direction:row-reverse}.bpk-nudger__input{display:inline-block;padding:.5rem 0;border:none;color:#161616;text-align:center;vertical-align:middle;margin:0;font-size:1rem;line-height:1.25rem;font-weight:700}.bpk-nudger__input--secondary-on-dark{background-color:rgba(0,0,0,0);color:#fff}.bpk-nudger__input--numeric{width:2.5rem}.bpk-nudger__container{display:flex;justify-content:space-between;align-items:center}.bpk-nudger__label{display:flex;gap:.5rem}.bpk-nudger__label--title-subtitle{display:inline-flex;flex-direction:column;justify-content:space-between}.bpk-nudger__label--subtitle{color:#626971}
18
+ html[dir=rtl] .bpk-nudger{display:flex}.bpk-nudger__input{display:inline-block;padding:.5rem 0;border:none;color:#161616;text-align:center;vertical-align:middle;margin:0;font-size:1rem;line-height:1.25rem;font-weight:700}.bpk-nudger__input::-webkit-outer-spin-button,.bpk-nudger__input::-webkit-inner-spin-button{margin:0;appearance:none}.bpk-nudger__input[type=number]{appearance:textfield}.bpk-nudger__input--secondary-on-dark{background-color:rgba(0,0,0,0);color:#fff}.bpk-nudger__input--numeric{width:2.5rem}.bpk-nudger__container{display:flex;justify-content:space-between;align-items:center}.bpk-nudger__label{display:flex;gap:.5rem}.bpk-nudger__label--title-subtitle{display:inline-flex;flex-direction:column;justify-content:space-between}.bpk-nudger__label--subtitle{color:#626971}
@@ -5,11 +5,12 @@ export declare const BUTTON_TYPES: {
5
5
  };
6
6
  export type CommonProps = {
7
7
  id: string;
8
- min: string | number;
9
- max: string | number;
10
- value: string | number;
11
- onChange: (arg0: any) => void | null;
12
- name?: string | null;
8
+ min: number;
9
+ max: number;
10
+ value: number;
11
+ onValueChange: (arg0: number) => void;
12
+ name?: string | undefined;
13
+ step?: number;
13
14
  className?: string | null;
14
15
  /**
15
16
  * This is the label that will be read out when screen reader users tab to the increase button. Make sure you use a descriptive label.
@@ -18,6 +19,7 @@ export type CommonProps = {
18
19
  * Function that handle the incrementing of the current selected value.
19
20
  */
20
21
  increaseButtonLabel: string;
22
+ inputClassName?: string | undefined;
21
23
  /**
22
24
  * This is the label that will be read out when screen reader users tab to the decrease button. Make sure you use a descriptive label
23
25
  */
@@ -30,5 +30,5 @@ export type Props = BpkOverlayProps & ComponentProps<'div'> & {
30
30
  overlayType?: OverlayType;
31
31
  foregroundContent?: ReactNode;
32
32
  };
33
- declare const BpkOverlay: (props: Props) => JSX.Element;
33
+ declare const BpkOverlay: (props: Props) => import("react/jsx-runtime").JSX.Element;
34
34
  export default BpkOverlay;
@@ -33,5 +33,5 @@ export type Props = CloseButtonProps & {
33
33
  onAction?: () => void;
34
34
  renderTarget?: () => HTMLElement | HTMLElement | null;
35
35
  };
36
- declare const BpkPopover: ({ actionText, children, className, closeButtonIcon, closeButtonLabel, closeButtonProps, closeButtonText, id, isOpen, label, labelAsTitle, onAction, onClose, padded, placement, renderTarget, showArrow, target, ...rest }: Props) => JSX.Element;
36
+ declare const BpkPopover: ({ actionText, children, className, closeButtonIcon, closeButtonLabel, closeButtonProps, closeButtonText, id, isOpen, label, labelAsTitle, onAction, onClose, padded, placement, renderTarget, showArrow, target, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
37
37
  export default BpkPopover;
@@ -13,7 +13,7 @@ type Props = {
13
13
  value: string | number;
14
14
  };
15
15
  declare const BpkRating: {
16
- (props: Props): JSX.Element;
16
+ (props: Props): import("react/jsx-runtime").JSX.Element;
17
17
  propTypes: {
18
18
  ariaLabel: PropTypes.Validator<string>;
19
19
  value: PropTypes.Validator<NonNullable<NonNullable<string | number | null | undefined>>>;
@@ -10,6 +10,6 @@ declare class BpkRtlToggle extends Component<Props, State> {
10
10
  componentWillUnmount(): void;
11
11
  handleKeyDown: (e: KeyboardEvent) => void;
12
12
  toggleRtl: (e: InteractionEvents) => void;
13
- render(): JSX.Element;
13
+ render(): import("react/jsx-runtime").JSX.Element;
14
14
  }
15
15
  export default BpkRtlToggle;
@@ -1,16 +1,14 @@
1
1
  import type { ComponentType } from 'react';
2
2
  declare const updateOnDirectionChange: (EnhancedComponent: ComponentType<any> | string) => {
3
- new (props: {} | Readonly<{}>): {
3
+ new (props: {}): {
4
4
  componentDidMount(): void;
5
5
  componentWillUnmount(): void;
6
6
  onDirectionChange: () => void;
7
- render(): JSX.Element;
8
- context: any;
7
+ render(): import("react/jsx-runtime").JSX.Element;
8
+ context: unknown;
9
9
  setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<{}>) => Pick<{}, K> | {} | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
10
10
  forceUpdate(callback?: (() => void) | undefined): void;
11
- readonly props: Readonly<{}> & Readonly<{
12
- children?: import("react").ReactNode | undefined;
13
- }>;
11
+ readonly props: Readonly<{}>;
14
12
  state: Readonly<{}>;
15
13
  refs: {
16
14
  [key: string]: import("react").ReactInstance;
@@ -30,13 +28,11 @@ declare const updateOnDirectionChange: (EnhancedComponent: ComponentType<any> |
30
28
  componentDidMount(): void;
31
29
  componentWillUnmount(): void;
32
30
  onDirectionChange: () => void;
33
- render(): JSX.Element;
34
- context: any;
31
+ render(): import("react/jsx-runtime").JSX.Element;
32
+ context: unknown;
35
33
  setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<{}>) => Pick<{}, K> | {} | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
36
34
  forceUpdate(callback?: (() => void) | undefined): void;
37
- readonly props: Readonly<{}> & Readonly<{
38
- children?: import("react").ReactNode | undefined;
39
- }>;
35
+ readonly props: Readonly<{}>;
40
36
  state: Readonly<{}>;
41
37
  refs: {
42
38
  [key: string]: import("react").ReactInstance;
@@ -27,8 +27,8 @@ declare const _default: {
27
27
  source: string;
28
28
  }) => void;
29
29
  handleDateKeyDown: (event: KeyboardEvent) => void;
30
- render(): JSX.Element;
31
- context: any;
30
+ render(): import("react/jsx-runtime").JSX.Element;
31
+ context: unknown;
32
32
  setState<K extends keyof {
33
33
  preventKeyboardFocus: boolean;
34
34
  focusedDate: Date;
@@ -65,8 +65,6 @@ declare const _default: {
65
65
  maxDate: Date;
66
66
  }> & {
67
67
  [rest: string]: any;
68
- }> & Readonly<{
69
- children?: import("react").ReactNode | undefined;
70
68
  }>;
71
69
  state: Readonly<{
72
70
  preventKeyboardFocus: boolean;
@@ -4,5 +4,5 @@ type Props = Partial<BpkCalendarDateProps> & {
4
4
  isOutside?: boolean;
5
5
  [rest: string]: any;
6
6
  };
7
- declare const BpkScrollableCalendarDate: ({ isOutside, ...rest }: Props) => JSX.Element | null;
7
+ declare const BpkScrollableCalendarDate: ({ isOutside, ...rest }: Props) => import("react/jsx-runtime").JSX.Element | null;
8
8
  export default BpkScrollableCalendarDate;
@@ -1,11 +1,11 @@
1
- import type { ElementType } from 'react';
1
+ import type { ElementType, ReactNode } from 'react';
2
2
  import type { BpkCalendarGridProps } from '../../bpk-component-calendar';
3
3
  type Props = Partial<BpkCalendarGridProps> & {
4
4
  DateComponent: ElementType;
5
5
  month: Date;
6
6
  formatDateFull: (date: Date) => Date | string;
7
7
  weekStartsOn: 0 | 1 | 2 | 3 | 4 | 5 | 6;
8
- formatMonth: (date: Date) => Date | string;
8
+ formatMonth: (date: Date) => ReactNode | string;
9
9
  };
10
- declare const BpkScrollableCalendarGrid: ({ className, formatMonth, ignoreOutsideDate, month, ...rest }: Props) => JSX.Element;
10
+ declare const BpkScrollableCalendarGrid: ({ className, formatMonth, ignoreOutsideDate, month, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
11
11
  export default BpkScrollableCalendarGrid;
@@ -1,4 +1,4 @@
1
- import type { ElementType } from 'react';
1
+ import type { ElementType, ReactNode } from 'react';
2
2
  import type { BpkCalendarGridProps, SelectionConfiguration } from '../../bpk-component-calendar';
3
3
  type Props = Partial<BpkCalendarGridProps> & {
4
4
  minDate: Date;
@@ -7,7 +7,7 @@ type Props = Partial<BpkCalendarGridProps> & {
7
7
  formatDateFull: (date: Date) => Date | string;
8
8
  month: Date;
9
9
  weekStartsOn: 0 | 1 | 2 | 3 | 4 | 5 | 6;
10
- formatMonth: (date: Date) => Date | string;
10
+ formatMonth: (date: Date) => ReactNode | string;
11
11
  focusedDate?: Date | null;
12
12
  selectionConfiguration?: SelectionConfiguration;
13
13
  className?: string | null;
@@ -16,5 +16,5 @@ type Props = Partial<BpkCalendarGridProps> & {
16
16
  */
17
17
  customRowHeight?: number;
18
18
  };
19
- declare const BpkScrollableCalendarGridList: (props: Props) => JSX.Element;
19
+ declare const BpkScrollableCalendarGridList: (props: Props) => import("react/jsx-runtime").JSX.Element;
20
20
  export default BpkScrollableCalendarGridList;
@@ -10,5 +10,5 @@ type Props = {
10
10
  button?: ReactNode;
11
11
  type?: SectionType;
12
12
  };
13
- declare const BpkSectionHeader: ({ button, description, title, type, }: Props) => JSX.Element;
13
+ declare const BpkSectionHeader: ({ button, description, title, type, }: Props) => import("react/jsx-runtime").JSX.Element;
14
14
  export default BpkSectionHeader;
@@ -13,5 +13,5 @@ export type Props = {
13
13
  selectedIndex: number;
14
14
  shadow?: boolean;
15
15
  };
16
- declare const BpkSegmentedControl: ({ buttonContents, onItemClick, selectedIndex, shadow, type, }: Props) => JSX.Element;
16
+ declare const BpkSegmentedControl: ({ buttonContents, onItemClick, selectedIndex, shadow, type, }: Props) => import("react/jsx-runtime").JSX.Element;
17
17
  export default BpkSegmentedControl;
@@ -3,5 +3,5 @@ type Props = {
3
3
  skeletonStyle: string;
4
4
  styleObj?: CUSTOM_SIZE_TYPE;
5
5
  };
6
- declare const BpkBaseSkeleton: ({ skeletonStyle, styleObj, }: Props) => JSX.Element;
6
+ declare const BpkBaseSkeleton: ({ skeletonStyle, styleObj, }: Props) => import("react/jsx-runtime").JSX.Element;
7
7
  export default BpkBaseSkeleton;
@@ -1,3 +1,3 @@
1
1
  import type { ComponentProps } from './common-types';
2
- declare const BpkSkeleton: (props: ComponentProps) => JSX.Element;
2
+ declare const BpkSkeleton: (props: ComponentProps) => import("react/jsx-runtime").JSX.Element;
3
3
  export default BpkSkeleton;
@@ -8,7 +8,10 @@ export type Props = {
8
8
  value: number[] | number;
9
9
  ariaLabel: string[];
10
10
  ariaValuetext?: string[];
11
+ inputProps?: [{
12
+ [key: string]: any;
13
+ }];
11
14
  [rest: string]: any;
12
15
  };
13
- declare const BpkSlider: ({ ariaLabel, ariaValuetext, max, min, minDistance, onAfterChange, onChange, step, value, ...rest }: Props) => JSX.Element;
16
+ declare const BpkSlider: ({ ariaLabel, ariaValuetext, inputProps, max, min, minDistance, onAfterChange, onChange, step, value, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
14
17
  export default BpkSlider;
@@ -15,15 +15,18 @@
15
15
  * See the License for the specific language governing permissions and
16
16
  * limitations under the License.
17
17
  */
18
-
18
+ import { forwardRef, useRef, useEffect } from 'react';
19
+ import { useComposedRefs } from '@radix-ui/react-compose-refs';
19
20
  import * as Slider from '@radix-ui/react-slider';
20
- import { cssModules, isRTL } from "../../bpk-react-utils";
21
+ import { usePrevious } from '@radix-ui/react-use-previous';
22
+ import { cssModules, isRTL, setNativeValue } from "../../bpk-react-utils";
21
23
  import STYLES from "./BpkSlider.module.css";
22
24
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
23
25
  const getClassName = cssModules(STYLES);
24
26
  const BpkSlider = ({
25
27
  ariaLabel,
26
28
  ariaValuetext,
29
+ inputProps,
27
30
  max,
28
31
  min,
29
32
  minDistance,
@@ -67,8 +70,53 @@ const BpkSlider = ({
67
70
  "aria-label": ariaLabel[index],
68
71
  "aria-valuetext": ariaValuetext ? ariaValuetext[index] : val.toString(),
69
72
  className: getClassName('bpk-slider__thumb'),
70
- "aria-valuenow": currentValue[index]
73
+ "aria-valuenow": currentValue[index],
74
+ asChild: true,
75
+ children: /*#__PURE__*/_jsx("span", {
76
+ children: /*#__PURE__*/_jsx(BubbleInput, {
77
+ value: currentValue[index],
78
+ ...(inputProps && inputProps[index])
79
+ })
80
+ })
71
81
  }, ariaLabel[index]))]
72
82
  });
73
83
  };
84
+
85
+ // Work around until radix-ui/react-slider is updated to accept an inputRef prop https://github.com/radix-ui/primitives/pull/3033
86
+ const BubbleInput = /*#__PURE__*/forwardRef((props, forwardedRef) => {
87
+ const {
88
+ value,
89
+ ...inputProps
90
+ } = props;
91
+ const ref = useRef();
92
+ const composedRefs = useComposedRefs(forwardedRef, ref);
93
+ const prevValue = usePrevious(value);
94
+
95
+ // Bubble value change to parents (e.g form change event)
96
+ useEffect(() => {
97
+ const input = ref.current;
98
+ if (prevValue !== value) {
99
+ setNativeValue(input, `${value}`);
100
+ }
101
+ }, [prevValue, value]);
102
+
103
+ /**
104
+ * We purposefully do not use `type="hidden"` here otherwise forms that
105
+ * wrap it will not be able to access its value via the FormData API.
106
+ *
107
+ * We purposefully do not add the `value` attribute here to allow the value
108
+ * to be set programatically and bubble to any parent form `onChange` event.
109
+ * Adding the `value` will cause React to consider the programatic
110
+ * dispatch a duplicate and it will get swallowed.
111
+ */
112
+ return /*#__PURE__*/_jsx("input", {
113
+ style: {
114
+ display: 'none'
115
+ },
116
+ ...inputProps,
117
+ ref: composedRefs,
118
+ type: "number",
119
+ defaultValue: value
120
+ });
121
+ });
74
122
  export default BpkSlider;
@@ -44,5 +44,5 @@ export type Props = {
44
44
  imageRadius?: boolean;
45
45
  onClick?: (event: MouseEvent<HTMLButtonElement & HTMLAnchorElement>) => void;
46
46
  };
47
- declare const BpkSnippet: ({ altText, bodyStyle, bodyText, buttonStyle, buttonText, desktopLayout, headline, headlineStyle, imageOrientation, imageRadius, onClick, src, subheading, }: Props) => JSX.Element;
47
+ declare const BpkSnippet: ({ altText, bodyStyle, bodyText, buttonStyle, buttonText, desktopLayout, headline, headlineStyle, imageOrientation, imageRadius, onClick, src, subheading, }: Props) => import("react/jsx-runtime").JSX.Element;
48
48
  export default BpkSnippet;
@@ -1,18 +1,8 @@
1
- import PropTypes from 'prop-types';
2
1
  import type { SpinnerTypes } from './spinnerTypes';
3
2
  type Props = {
4
- type: SpinnerTypes;
5
- className?: string;
6
- };
7
- declare const BpkExtraLargeSpinner: {
8
- (props: Props): JSX.Element;
9
- propTypes: {
10
- type: PropTypes.Requireable<string>;
11
- className: PropTypes.Requireable<string>;
12
- };
13
- defaultProps: {
14
- type: "dark";
15
- className: null;
16
- };
3
+ type?: SpinnerTypes;
4
+ className?: string | null;
5
+ [rest: string]: any;
17
6
  };
7
+ declare const BpkExtraLargeSpinner: ({ className, type, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
18
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,21 +1,9 @@
1
- import PropTypes from 'prop-types';
2
1
  import type { SpinnerTypes } from './spinnerTypes';
3
2
  type Props = {
4
- type: SpinnerTypes;
5
- className?: string;
6
- alignToButton: boolean;
7
- };
8
- declare const BpkLargeSpinner: {
9
- (props: Props): JSX.Element;
10
- propTypes: {
11
- type: PropTypes.Requireable<string>;
12
- className: PropTypes.Requireable<string>;
13
- alignToButton: PropTypes.Requireable<boolean>;
14
- };
15
- defaultProps: {
16
- type: "dark";
17
- className: null;
18
- alignToButton: boolean;
19
- };
3
+ type?: SpinnerTypes;
4
+ className?: string | null;
5
+ alignToButton?: boolean;
6
+ [rest: string]: any;
20
7
  };
8
+ declare const BpkLargeSpinner: ({ alignToButton, className, type, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
21
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,21 +1,9 @@
1
- import PropTypes from 'prop-types';
2
1
  import type { SpinnerTypes } from './spinnerTypes';
3
2
  type Props = {
4
- type: SpinnerTypes;
5
- className?: string;
6
- alignToButton: boolean;
7
- };
8
- declare const BpkSpinner: {
9
- (props: Props): JSX.Element;
10
- propTypes: {
11
- type: PropTypes.Requireable<string>;
12
- className: PropTypes.Requireable<string>;
13
- alignToButton: PropTypes.Requireable<boolean>;
14
- };
15
- defaultProps: {
16
- type: "dark";
17
- className: null;
18
- alignToButton: boolean;
19
- };
3
+ type?: SpinnerTypes;
4
+ className?: string | null;
5
+ alignToButton?: boolean;
6
+ [rest: string]: any;
20
7
  };
8
+ declare const BpkSpinner: ({ alignToButton, className, type, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
21
9
  export default BpkSpinner;