@skyscanner/backpack-web 31.9.0 → 31.9.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.
@@ -68,7 +68,7 @@ const BpkBottomSheetInner = ({
68
68
  children: /*#__PURE__*/_jsx(BpkNavigationBar, {
69
69
  id: headingId,
70
70
  className: getClassName('bpk-bottom-sheet--navigation'),
71
- title: /*#__PURE__*/_jsx("h2", {
71
+ title: title && /*#__PURE__*/_jsx("h2", {
72
72
  id: headingId,
73
73
  className: getClassName('bpk-bottom-sheet--heading'),
74
74
  children: title
@@ -16,9 +16,7 @@
16
16
  * limitations under the License.
17
17
  */
18
18
 
19
- import BpkSwapButton, {
20
- type Props as BpkSwapButtonProps,
21
- } from './src/BpkSwapButton.tsx';
22
-
19
+ import BpkSwapButton, { type Props as BpkSwapButtonProps, SWAPBUTTON_STYLES } from './src/BpkSwapButton';
23
20
  export type { BpkSwapButtonProps };
24
21
  export default BpkSwapButton;
22
+ export { SWAPBUTTON_STYLES };
@@ -16,5 +16,6 @@
16
16
  * limitations under the License.
17
17
  */
18
18
 
19
- import BpkSwapButton from "./src/BpkSwapButton";
20
- export default BpkSwapButton;
19
+ import BpkSwapButton, { SWAPBUTTON_STYLES } from "./src/BpkSwapButton";
20
+ export default BpkSwapButton;
21
+ export { SWAPBUTTON_STYLES };
@@ -16,14 +16,20 @@
16
16
  * limitations under the License.
17
17
  */
18
18
 
19
+ export declare const SWAPBUTTON_STYLES: {
20
+ surfaceContrast: string;
21
+ canvasDefault: string;
22
+ canvasContrast: string;
23
+ };
24
+ export type SwapButtonStyle = (typeof SWAPBUTTON_STYLES)[keyof typeof SWAPBUTTON_STYLES];
19
25
  export type Props = {
20
- ariaLabel: string;
21
- ariaLiveTextProps: string;
22
- onClick: () => void;
26
+ onClick: () => void;
27
+ ariaLabel: string;
28
+ swapButtonStyle?: SwapButtonStyle;
23
29
  };
24
30
  declare const BpkSwapButton: ({
25
- ariaLabel,
26
- ariaLiveTextProps,
27
- onClick,
31
+ ariaLabel,
32
+ onClick,
33
+ swapButtonStyle,
28
34
  } : Props) => JSX.Element;
29
35
  export default BpkSwapButton;
@@ -18,38 +18,35 @@
18
18
 
19
19
  import { useState } from 'react';
20
20
  import { cssModules } from "../../bpk-react-utils";
21
- import BpkAriaLive from "../../bpk-component-aria-live";
22
21
  // @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
23
22
  import SwapVertical from "../../bpk-component-icon/sm/swap--vertical";
24
23
  import STYLES from "./BpkSwapButton.module.css";
25
24
  import { jsx as _jsx } from "react/jsx-runtime";
26
- import { jsxs as _jsxs } from "react/jsx-runtime";
27
25
  const getClassName = cssModules(STYLES);
26
+ export const SWAPBUTTON_STYLES = {
27
+ surfaceContrast: 'surface-contrast',
28
+ canvasDefault: 'canvas-default',
29
+ canvasContrast: 'canvas-contrast'
30
+ };
28
31
  const BpkSwapButton = props => {
29
32
  const {
30
33
  ariaLabel,
31
- ariaLiveTextProp,
32
- onClick
34
+ onClick,
35
+ swapButtonStyle = SWAPBUTTON_STYLES.surfaceContrast
33
36
  } = props;
34
37
  const [rotationDegree, setRotationDegree] = useState(0);
35
- const [ariaLiveText, setAriaLiveText] = useState('');
36
38
  const handleRotation = () => {
37
39
  if (rotationDegree === 0) {
38
40
  setRotationDegree(-180);
39
41
  } else {
40
42
  setRotationDegree(0);
41
43
  }
42
- setAriaLiveText(ariaLiveTextProp);
43
- // without set timeout, the aria-live text would not change and screenreader would read out 'swapped' for the first time only.
44
- setTimeout(() => {
45
- setAriaLiveText('');
46
- }, 250);
47
44
  };
48
- return /*#__PURE__*/_jsxs("div", {
45
+ return /*#__PURE__*/_jsx("div", {
49
46
  className: getClassName('bpk-swap-button'),
50
- children: [/*#__PURE__*/_jsx("button", {
47
+ children: /*#__PURE__*/_jsx("button", {
51
48
  type: "button",
52
- className: getClassName('bpk-swap-button__button'),
49
+ className: getClassName('bpk-swap-button__button', `bpk-swap-button__button--${swapButtonStyle}`),
53
50
  style: {
54
51
  transform: `rotate(${rotationDegree}deg)`
55
52
  },
@@ -61,9 +58,7 @@ const BpkSwapButton = props => {
61
58
  children: /*#__PURE__*/_jsx(SwapVertical, {
62
59
  className: getClassName('bpk-swap-button__icon')
63
60
  })
64
- }), /*#__PURE__*/_jsx(BpkAriaLive, {
65
- children: ariaLiveText
66
- })]
61
+ })
67
62
  });
68
63
  };
69
64
  export default BpkSwapButton;
@@ -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
- @keyframes bpk-keyframe-spin{100%{transform:rotate(1turn)}}@layer bpk-component{.bpk-swap-button{width:2.5rem;height:2.5rem;transform:translateY(-50%) rotate(90deg)}@media (max-width: 48rem){.bpk-swap-button{transform:rotate(0deg)}}.bpk-swap-button :focus-visible{box-shadow:0 0 0 0.125rem #fff,0 0 0 0.25rem #0062e3}.bpk-swap-button__button{display:flex;width:100%;height:100%;justify-content:center;align-items:center;transition:transform 400ms;border:3px solid #05203c;border-radius:50%;background-color:#fff}@media (max-width: 48rem){.bpk-swap-button__button{border:2px solid #05203c}}.bpk-no-touch-support .bpk-swap-button__button:hover:not(:active):not(:disabled){background-color:#e0e3e5}:global(.bpk-no-touch-support) .bpk-swap-button__button:hover:not(:active):not(:disabled){background-color:#e0e3e5}.bpk-swap-button__icon{max-width:1rem;max-height:1rem}}
18
+ @keyframes bpk-keyframe-spin{100%{transform:rotate(1turn)}}@layer bpk-component{.bpk-swap-button{width:2.5rem;height:2.5rem;transform:translateY(-50%) rotate(90deg)}@media (max-width: 48rem){.bpk-swap-button{transform:rotate(0deg)}}.bpk-swap-button :focus-visible{box-shadow:0 0 0 0.125rem #fff,0 0 0 0.25rem #0062e3}.bpk-swap-button__button{display:flex;width:100%;height:100%;justify-content:center;align-items:center;transition:transform 400ms;border:3px solid #05203c;border-radius:50%;background-color:#fff}@media (max-width: 48rem){.bpk-swap-button__button{border:2px solid #05203c}}.bpk-no-touch-support .bpk-swap-button__button:hover:not(:active):not(:disabled){background-color:#e0e3e5}:global(.bpk-no-touch-support) .bpk-swap-button__button:hover:not(:active):not(:disabled){background-color:#e0e3e5}.bpk-swap-button__button--canvas-default{border:3px solid #fff;background-color:#eff1f2}.bpk-swap-button__button--canvas-contrast{border:3px solid #eff1f2}.bpk-swap-button__icon{max-width:1rem;max-height:1rem}}
@@ -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
- @keyframes bpk-keyframe-spin{100%{transform:rotate(1turn)}}@layer bpk-component{.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, #0062e3)}.bpk-switch__checkbox:checked ~ .bpk-switch__switch::before{left:1.375rem}.bpk-switch__label{line-height:2rem;margin-inline-end:0.5rem}.bpk-switch__switch{position:relative;float:right;display:block;width:3.25rem;height:2rem;transition:background 200ms linear;border-radius:1rem;background:rgba(0,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,0.3)}.bpk-switch__switch--small{width:2.5rem;height:1.25rem}.bpk-switch__switch--small::before{width:1rem;height:1rem}}
18
+ @keyframes bpk-keyframe-spin{100%{transform:rotate(1turn)}}@layer bpk-component{.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, #0062e3)}.bpk-switch__checkbox:checked ~ .bpk-switch__switch::before{left:1.375rem}.bpk-switch__label{line-height:2rem;margin-inline-end:0.5rem}.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,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,0.3)}.bpk-switch__switch--small{min-width:2.5rem;height:1.25rem}.bpk-switch__switch--small::before{width:1rem;height:1rem}}
@@ -28,10 +28,8 @@
28
28
  /// }
29
29
 
30
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 */
31
+ outline: ($bpk-one-pixel-rem * 2) solid $bpk-text-link-day;
32
+ outline-offset: ($bpk-one-pixel-rem * 2);
35
33
  }
36
34
 
37
35
  /// Hide visually and from screen readers.
@@ -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
- */@layer bpk-reset, bpk-base, bpk-component, bpk-utility;@layer bpk-reset{/*! 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}}@layer bpk-base{@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}body.scaffold-font-size{font-size:13px}body.enable-font-smoothing{-webkit-font-smoothing:antialiased}:focus-visible{outline:.125rem solid #0062e3 !important;outline-offset:.125rem !important}.hidden,.hide{display:none !important}.visuallyhidden,.visually-hidden{position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;overflow:hidden;clip:rect(0 0 0 0)}.visuallyhidden.focusable:active,.visuallyhidden.focusable:focus,.visually-hidden.focusable:active,.visually-hidden.focusable:focus{position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto}.invisible{visibility:hidden}.clearfix::before,.clearfix::after{content:'';display:table}.clearfix::after{clear:both}}
19
+ */@layer bpk-reset, bpk-base, bpk-component, bpk-utility;@layer bpk-reset{/*! 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}}@layer bpk-base{@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}body.scaffold-font-size{font-size:13px}body.enable-font-smoothing{-webkit-font-smoothing:antialiased}:focus-visible{outline:.125rem solid #0062e3;outline-offset:.125rem}.hidden,.hide{display:none !important}.visuallyhidden,.visually-hidden{position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;overflow:hidden;clip:rect(0 0 0 0)}.visuallyhidden.focusable:active,.visuallyhidden.focusable:focus,.visually-hidden.focusable:active,.visually-hidden.focusable:focus{position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto}.invisible{visibility:hidden}.clearfix::before,.clearfix::after{content:'';display:table}.clearfix::after{clear:both}}
20
20
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skyscanner/backpack-web",
3
- "version": "31.9.0",
3
+ "version": "31.9.2",
4
4
  "description": "Backpack Design System web library",
5
5
  "repository": {
6
6
  "type": "git",
@@ -25,7 +25,7 @@
25
25
  "@popperjs/core": "^2.11.5",
26
26
  "@react-google-maps/api": "^2.12.0",
27
27
  "@skyscanner/bpk-foundations-web": "^17.5.3",
28
- "@skyscanner/bpk-svgs": "^19.0.0",
28
+ "@skyscanner/bpk-svgs": "^19.0.1",
29
29
  "a11y-focus-scope": "^1.1.3",
30
30
  "a11y-focus-store": "^1.0.0",
31
31
  "d3-path": "^2.0.0",