@skyscanner/backpack-web 29.3.1 → 29.4.1

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 (54) hide show
  1. package/bpk-component-banner-alert/src/withBannerAlertState.d.ts +86 -143
  2. package/bpk-component-barchart/src/BpkBarchart.js +24 -2
  3. package/bpk-component-barchart/src/BpkChartAxis.js +2 -2
  4. package/bpk-component-breakpoint/src/BpkBreakpoint.d.ts +3 -0
  5. package/bpk-component-button/index.js +1 -1
  6. package/bpk-component-button/src/BpkButtonLink.module.css +1 -1
  7. package/bpk-component-button/src/BpkButtonLinkOnDark.module.css +1 -1
  8. package/bpk-component-button/src/BpkButtonV2/BpkButton.d.ts +1 -16
  9. package/bpk-component-button/src/BpkButtonV2/BpkButton.js +4 -3
  10. package/bpk-component-button/src/BpkButtonV2/BpkButton.module.css +1 -1
  11. package/bpk-component-calendar/index.d.ts +1 -1
  12. package/bpk-component-calendar/src/BpkCalendarContainer.d.ts +21 -331
  13. package/bpk-component-calendar/src/BpkCalendarDate.d.ts +8 -1
  14. package/bpk-component-calendar/src/BpkCalendarGrid.d.ts +15 -0
  15. package/bpk-component-calendar/src/BpkCalendarGridHeader.d.ts +9 -0
  16. package/bpk-component-calendar/src/BpkCalendarNav.d.ts +4 -0
  17. package/bpk-component-calendar/src/composeCalendar.d.ts +42 -1
  18. package/bpk-component-card-button/src/BpkSaveButton.js +1 -1
  19. package/bpk-component-chip/src/BpkDismissibleChip.d.ts +2 -7
  20. package/bpk-component-datatable/src/BpkDataTable.js +50 -1
  21. package/bpk-component-datepicker/src/BpkDatepicker.d.ts +25 -461
  22. package/bpk-component-dialog/src/common-types.d.ts +12 -0
  23. package/bpk-component-drawer/src/BpkDrawer.js +24 -4
  24. package/bpk-component-fieldset/src/BpkFieldset.js +3 -0
  25. package/bpk-component-floating-notification/src/BpkFloatingNotification.module.css +1 -1
  26. package/bpk-component-graphic-promotion/src/BpkGraphicPromo.d.ts +23 -31
  27. package/bpk-component-horizontal-nav/src/BpkHorizontalNav.js +24 -17
  28. package/bpk-component-horizontal-nav/src/BpkHorizontalNavItem.js +25 -17
  29. package/bpk-component-image/src/BpkImage.d.ts +4 -1
  30. package/bpk-component-input/src/common-types.d.ts +17 -3
  31. package/bpk-component-input/src/common-types.js +7 -0
  32. package/bpk-component-input/src/withOpenEvents.d.ts +13 -1
  33. package/bpk-component-list/src/BpkList.js +4 -1
  34. package/bpk-component-map/index.js +1 -1
  35. package/bpk-component-map/src/BpkMap.js +6 -0
  36. package/bpk-component-map/src/BpkPriceMarkerV2/BpkPriceMarker.d.ts +21 -32
  37. package/bpk-component-map/src/BpkPriceMarkerV2/BpkPriceMarker.js +2 -3
  38. package/bpk-component-mobile-scroll-container/src/BpkMobileScrollContainer.js +25 -20
  39. package/bpk-component-modal/src/BpkModal.d.ts +7 -1
  40. package/bpk-component-modal/src/BpkModalInner.d.ts +4 -1
  41. package/bpk-component-navigation-bar/src/BpkNavigationBar.js +1 -0
  42. package/bpk-component-nudger/src/BpkConfigurableNudger.d.ts +16 -0
  43. package/bpk-component-nudger/src/common-types.d.ts +17 -1
  44. package/bpk-component-nudger/src/common-types.js +22 -1
  45. package/bpk-component-overlay/src/BpkOverlay.d.ts +8 -3
  46. package/bpk-component-popover/src/BpkPopoverPortal.js +50 -24
  47. package/bpk-component-progress/src/BpkProgress.js +25 -19
  48. package/bpk-component-select/src/BpkSelect.js +7 -5
  49. package/bpk-component-tooltip/src/BpkTooltipPortal.d.ts +12 -0
  50. package/bpk-mixins/src/mixins/_buttons.scss +0 -1
  51. package/bpk-mixins/src/mixins/_utils.scss +14 -0
  52. package/bpk-stylesheets/base.css +1 -1
  53. package/bpk-stylesheets/index.scss +4 -0
  54. package/package.json +1 -1
@@ -21,35 +21,12 @@ import focusStore from 'a11y-focus-store';
21
21
  import { Portal, cssModules } from "../../bpk-react-utils";
22
22
  import keyboardFocusScope from "./keyboardFocusScope";
23
23
  import STYLES from "./BpkPopover.module.css";
24
- import BpkPopover, { propTypes as popoverPropTypes, defaultProps as popoverDefaultProps } from "./BpkPopover";
24
+ import BpkPopover from "./BpkPopover";
25
25
  import { jsx as _jsx } from "react/jsx-runtime";
26
26
  import { Fragment as _Fragment } from "react/jsx-runtime";
27
27
  import { jsxs as _jsxs } from "react/jsx-runtime";
28
28
  const getClassName = cssModules(STYLES);
29
- export const propTypes = {
30
- ...popoverPropTypes,
31
- target: PropTypes.oneOfType([PropTypes.func, PropTypes.node]).isRequired,
32
- isOpen: PropTypes.bool.isRequired,
33
- onClose: PropTypes.func.isRequired,
34
- placement: PropTypes.oneOf(['top', 'right', 'bottom', 'left']),
35
- portalStyle: PropTypes.object,
36
- // eslint-disable-line react/forbid-prop-types
37
- portalClassName: PropTypes.string,
38
- renderTarget: PropTypes.func,
39
- popperModifiers: PropTypes.arrayOf(PropTypes.object) // eslint-disable-line react/forbid-prop-types
40
- };
41
-
42
- export const defaultProps = {
43
- ...popoverDefaultProps,
44
- placement: 'bottom',
45
- portalStyle: null,
46
- portalClassName: null,
47
- renderTarget: null,
48
- popperModifiers: null
49
- };
50
29
  class BpkPopoverPortal extends Component {
51
- static propTypes = propTypes;
52
- static defaultProps = defaultProps;
53
30
  constructor() {
54
31
  super();
55
32
  this.popper = null;
@@ -189,4 +166,53 @@ class BpkPopoverPortal extends Component {
189
166
  });
190
167
  }
191
168
  }
169
+ const propTypes = {
170
+ // BpkPopover props - when migrating the popover to TS, we can import the type from BpkPopover
171
+ children: PropTypes.node.isRequired,
172
+ closeButtonText: PropTypes.string.isRequired,
173
+ id: PropTypes.string.isRequired,
174
+ label: PropTypes.string.isRequired,
175
+ onClose: PropTypes.func.isRequired,
176
+ className: PropTypes.string,
177
+ closeButtonIcon: PropTypes.bool,
178
+ closeButtonProps: PropTypes.object,
179
+ labelAsTitle: PropTypes.bool,
180
+ padded: PropTypes.bool,
181
+ // BpkPopoverPortal additional props
182
+ /**
183
+ * In order to attach the popover to a regular DOM element, provide a function which returns it to `target`.
184
+ * `target` can be a DOM element with a `ref` attached to it or a function that returns a DOM element.
185
+ */
186
+ target: PropTypes.oneOfType([PropTypes.func, PropTypes.node]).isRequired,
187
+ isOpen: PropTypes.bool.isRequired,
188
+ placement: PropTypes.oneOf(['top', 'right', 'bottom', 'left']),
189
+ portalStyle: PropTypes.object,
190
+ portalClassName: PropTypes.string,
191
+ renderTarget: PropTypes.func,
192
+ /**
193
+ * Please refer to the [documentation](https://popper.js.org/docs/v2/modifiers/) for the underlying positioning library "Popper.js".
194
+ * You can achieve various behaviours such as allowing the popover to overflow the viewport etc.
195
+ */
196
+ popperModifiers: PropTypes.arrayOf(PropTypes.object)
197
+ };
198
+ const defaultProps = {
199
+ // BpkPopover props - when migrating the popover to TS, we can import the type from BpkPopover
200
+ className: null,
201
+ closeButtonIcon: true,
202
+ closeButtonProps: null,
203
+ labelAsTitle: false,
204
+ padded: true,
205
+ // BpkPopoverPortal additional props
206
+ placement: 'bottom',
207
+ portalStyle: null,
208
+ portalClassName: null,
209
+ renderTarget: null,
210
+ popperModifiers: null
211
+ };
212
+ BpkPopoverPortal.propTypes = {
213
+ ...propTypes
214
+ };
215
+ BpkPopoverPortal.defaultProps = {
216
+ ...defaultProps
217
+ };
192
218
  export default BpkPopoverPortal;
@@ -36,26 +36,26 @@ const renderSteps = numberOfSteps => {
36
36
  }
37
37
  return steps;
38
38
  };
39
+ const propTypes = {
40
+ max: PropTypes.number.isRequired,
41
+ min: PropTypes.number.isRequired,
42
+ value: PropTypes.number.isRequired,
43
+ stepped: PropTypes.bool,
44
+ small: PropTypes.bool,
45
+ className: PropTypes.string,
46
+ onComplete: PropTypes.func,
47
+ onCompleteTransitionEnd: PropTypes.func,
48
+ getValueText: PropTypes.func
49
+ };
50
+ const defaultProps = {
51
+ className: null,
52
+ stepped: false,
53
+ small: false,
54
+ onComplete: () => null,
55
+ onCompleteTransitionEnd: () => null,
56
+ getValueText: null
57
+ };
39
58
  class BpkProgress extends Component {
40
- static propTypes = {
41
- max: PropTypes.number.isRequired,
42
- min: PropTypes.number.isRequired,
43
- value: PropTypes.number.isRequired,
44
- stepped: PropTypes.bool,
45
- small: PropTypes.bool,
46
- className: PropTypes.string,
47
- onComplete: PropTypes.func,
48
- onCompleteTransitionEnd: PropTypes.func,
49
- getValueText: PropTypes.func
50
- };
51
- static defaultProps = {
52
- className: null,
53
- stepped: false,
54
- small: false,
55
- onComplete: () => null,
56
- onCompleteTransitionEnd: () => null,
57
- getValueText: null
58
- };
59
59
  componentDidUpdate(previousProps) {
60
60
  const {
61
61
  max,
@@ -119,4 +119,10 @@ class BpkProgress extends Component {
119
119
  );
120
120
  }
121
121
  }
122
+ BpkProgress.propTypes = {
123
+ ...propTypes
124
+ };
125
+ BpkProgress.defaultProps = {
126
+ ...defaultProps
127
+ };
122
128
  export default BpkProgress;
@@ -62,11 +62,13 @@ const BpkSelect = props => {
62
62
  BpkSelect.propTypes = {
63
63
  id: PropTypes.string.isRequired,
64
64
  name: PropTypes.string.isRequired,
65
- // The below "value" prop is only relevant if the user is wanting a controlled component
66
- // In some cases, users may want to create an uncontrolled select as described here: https://beta.reactjs.org/reference/react-dom/components/select
67
- // In this case value is not required and nor should it be given a default value (as the linter thinks)
68
- // Prop types are not expressive enough (without a drastic increase in complexity of writing a custom validator) to encode this relationship. Equally, this wouldn't actually solve the linting issue (AFAIK).
69
- // As a solution, the require-default-props has been disabled for this line.
65
+ /**
66
+ * The "value" prop is only relevant if the user is wanting a controlled component
67
+ * In some cases, users may want to create an uncontrolled select as described here: https://beta.reactjs.org/reference/react-dom/components/select
68
+ * In this case value is not required and nor should it be given a default value (as the linter thinks)
69
+ * Prop types are not expressive enough (without a drastic increase in complexity of writing a custom validator) to encode this relationship. Equally, this wouldn't actually solve the linting issue (AFAIK).
70
+ * As a solution, the require-default-props has been disabled for this line.
71
+ */
70
72
 
71
73
  value: PropTypes.string,
72
74
  className: PropTypes.string,
@@ -21,7 +21,15 @@ import { Component } from 'react';
21
21
  import type { ReactNode, ReactElement } from 'react';
22
22
  import type { TooltipProps } from './BpkTooltip';
23
23
  export type Props = TooltipProps & {
24
+ /**
25
+ * Tooltips are invisible to assistive technologies such as screen readers.
26
+ * To improve accessibility, `ariaLabel` is required to describe the content of the tooltip to assistive technologies.
27
+ * The label will be used on the `target` element, so any existing `aria-label` attached to `target` will be overridden.
28
+ */
24
29
  ariaLabel: string;
30
+ /**
31
+ * "target" should be a DOM element with a "ref" attached to it.
32
+ */
25
33
  target: ReactElement<any>;
26
34
  children: ReactNode | string;
27
35
  placement?: 'top' | 'right' | 'bottom' | 'left' | 'auto';
@@ -29,6 +37,10 @@ export type Props = TooltipProps & {
29
37
  portalStyle?: object;
30
38
  portalClassName?: string;
31
39
  renderTarget: null | (() => null | HTMLElement);
40
+ /**
41
+ * Please refer to the [documentation](https://popper.js.org/docs/v2/modifiers/) for the underlying positioning library "Popper.js".
42
+ * You can achieve various behaviours such as allowing the tooltip to overflow the viewport etc.
43
+ */
32
44
  popperModifiers?: object[];
33
45
  };
34
46
  type State = {
@@ -389,7 +389,6 @@
389
389
  $vertical-padding: $bpk-one-pixel-rem * 6;
390
390
  $vertical-padding-large: $bpk-one-pixel-rem * 12;
391
391
 
392
- border-radius: 0;
393
392
  background: none; /* stylelint-disable-line order/order, order/properties-order */
394
393
  box-shadow: none;
395
394
 
@@ -20,6 +20,20 @@
20
20
  /// @group utils
21
21
  ////
22
22
 
23
+ /// Standard focus indicator for elements.
24
+ ///
25
+ /// @example scss
26
+ /// .selector {
27
+ /// @include bpk-focus-indicator();
28
+ /// }
29
+
30
+ @mixin bpk-focus-indicator {
31
+ outline: ($bpk-one-pixel-rem * 2) solid $bpk-text-link-day !important; /* stylelint-disable-line declaration-no-important */
32
+ outline-offset: (
33
+ $bpk-one-pixel-rem * 2
34
+ ) !important; /* stylelint-disable-line declaration-no-important */
35
+ }
36
+
23
37
  /// Hide visually and from screen readers.
24
38
  ///
25
39
  /// @example scss
@@ -16,5 +16,5 @@
16
16
  * See the License for the specific language governing permissions and
17
17
  * limitations under the License.
18
18
  *
19
- *//*! normalize.css v4.1.1 | MIT License | github.com/necolas/normalize.css */html{font-family:sans-serif;line-height:1.15;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block}audio:not([controls]){display:none;height:0}progress{vertical-align:baseline}template,[hidden]{display:none}a{background-color:transparent;-webkit-text-decoration-skip:objects}a:active,a:hover{outline-width:0}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:inherit}b,strong{font-weight:bolder}dfn{font-style:italic}h1{font-size:2em;margin:0.67em 0}mark{background-color:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}img{border-style:none}svg:not(:root){overflow:hidden}code,kbd,pre,samp{font-family:monospace, monospace;font-size:1em}figure{margin:1em 40px}hr{box-sizing:content-box;height:0;overflow:visible}button,input,optgroup,select,textarea{font:inherit;margin:0}optgroup{font-weight:bold}button,input{overflow:visible}button,select{text-transform:none}button,html [type="button"],[type="reset"],[type="submit"]{-webkit-appearance:button}button::-moz-focus-inner,[type="button"]::-moz-focus-inner,[type="reset"]::-moz-focus-inner,[type="submit"]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type="button"]:-moz-focusring,[type="reset"]:-moz-focusring,[type="submit"]:-moz-focusring{outline:1px dotted ButtonText}fieldset{border:1px solid #c0c0c0;margin:0 2px;padding:0.35em 0.625em 0.75em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}textarea{overflow:auto}[type="checkbox"],[type="radio"]{box-sizing:border-box;padding:0}[type="number"]::-webkit-inner-spin-button,[type="number"]::-webkit-outer-spin-button{height:auto}[type="search"]{-webkit-appearance:textfield;outline-offset:-2px}[type="search"]::-webkit-search-cancel-button,[type="search"]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-input-placeholder{color:inherit;opacity:0.54}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}@keyframes bpk-keyframe-spin{100%{transform:rotate(1turn)}}html{font-size:100%;box-sizing:border-box}*{box-sizing:inherit}*::before,*::after{box-sizing:inherit}body{color:#161616;font-family:"Skyscanner Relative",-apple-system,BlinkMacSystemFont,"Roboto","Oxygen","Ubuntu","Cantarell","Fira Sans","Droid Sans","Helvetica Neue",sans-serif;font-size:1rem;line-height:1.3rem}:global(body.scaffold-font-size){font-size:13px}:global(body.enable-font-smoothing){-webkit-font-smoothing:antialiased}:global(.hidden),:global(.hide){display:none !important}:global(.visuallyhidden),:global(.visually-hidden){position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;overflow:hidden;clip:rect(0 0 0 0)}:global(.visuallyhidden.focusable):active,:global(.visuallyhidden.focusable):focus,:global(.visually-hidden.focusable):active,:global(.visually-hidden.focusable):focus{position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto}:global(.invisible){visibility:hidden}:global(.clearfix)::before,:global(.clearfix)::after{content:'';display:table}:global(.clearfix)::after{clear:both}
19
+ *//*! normalize.css v4.1.1 | MIT License | github.com/necolas/normalize.css */html{font-family:sans-serif;line-height:1.15;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block}audio:not([controls]){display:none;height:0}progress{vertical-align:baseline}template,[hidden]{display:none}a{background-color:transparent;-webkit-text-decoration-skip:objects}a:active,a:hover{outline-width:0}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:inherit}b,strong{font-weight:bolder}dfn{font-style:italic}h1{font-size:2em;margin:0.67em 0}mark{background-color:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}img{border-style:none}svg:not(:root){overflow:hidden}code,kbd,pre,samp{font-family:monospace, monospace;font-size:1em}figure{margin:1em 40px}hr{box-sizing:content-box;height:0;overflow:visible}button,input,optgroup,select,textarea{font:inherit;margin:0}optgroup{font-weight:bold}button,input{overflow:visible}button,select{text-transform:none}button,html [type="button"],[type="reset"],[type="submit"]{-webkit-appearance:button}button::-moz-focus-inner,[type="button"]::-moz-focus-inner,[type="reset"]::-moz-focus-inner,[type="submit"]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type="button"]:-moz-focusring,[type="reset"]:-moz-focusring,[type="submit"]:-moz-focusring{outline:1px dotted ButtonText}fieldset{border:1px solid #c0c0c0;margin:0 2px;padding:0.35em 0.625em 0.75em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}textarea{overflow:auto}[type="checkbox"],[type="radio"]{box-sizing:border-box;padding:0}[type="number"]::-webkit-inner-spin-button,[type="number"]::-webkit-outer-spin-button{height:auto}[type="search"]{-webkit-appearance:textfield;outline-offset:-2px}[type="search"]::-webkit-search-cancel-button,[type="search"]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-input-placeholder{color:inherit;opacity:0.54}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}@keyframes bpk-keyframe-spin{100%{transform:rotate(1turn)}}html{font-size:100%;box-sizing:border-box}*{box-sizing:inherit}*::before,*::after{box-sizing:inherit}body{color:#161616;font-family:"Skyscanner Relative",-apple-system,BlinkMacSystemFont,"Roboto","Oxygen","Ubuntu","Cantarell","Fira Sans","Droid Sans","Helvetica Neue",sans-serif;font-size:1rem;line-height:1.3rem}:global(body.scaffold-font-size){font-size:13px}:global(body.enable-font-smoothing){-webkit-font-smoothing:antialiased}:focus-visible{outline:.125rem solid #0062e3 !important;outline-offset:.125rem !important}:global(.hidden),:global(.hide){display:none !important}:global(.visuallyhidden),:global(.visually-hidden){position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;overflow:hidden;clip:rect(0 0 0 0)}:global(.visuallyhidden.focusable):active,:global(.visuallyhidden.focusable):focus,:global(.visually-hidden.focusable):active,:global(.visually-hidden.focusable):focus{position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto}:global(.invisible){visibility:hidden}:global(.clearfix)::before,:global(.clearfix)::after{content:'';display:table}:global(.clearfix)::after{clear:both}
20
20
 
@@ -50,6 +50,10 @@ body {
50
50
  }
51
51
  }
52
52
 
53
+ :focus-visible {
54
+ @include bpk-focus-indicator;
55
+ }
56
+
53
57
  :global(.hidden),
54
58
  :global(.hide) {
55
59
  @include bpk-hidden;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skyscanner/backpack-web",
3
- "version": "29.3.1",
3
+ "version": "29.4.1",
4
4
  "description": "Backpack Design System web library",
5
5
  "repository": {
6
6
  "type": "git",