@skyscanner/backpack-web 31.9.0 → 31.9.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.
- package/bpk-component-swap-button/index.d.ts +2 -4
- package/bpk-component-swap-button/index.js +3 -2
- package/bpk-component-swap-button/src/BpkSwapButton.d.ts +12 -6
- package/bpk-component-swap-button/src/BpkSwapButton.js +11 -16
- package/bpk-component-swap-button/src/BpkSwapButton.module.css +1 -1
- package/bpk-mixins/src/mixins/_utils.scss +2 -4
- package/bpk-stylesheets/base.css +1 -1
- package/package.json +1 -1
|
@@ -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
|
-
|
|
21
|
-
|
|
22
|
-
|
|
26
|
+
onClick: () => void;
|
|
27
|
+
ariaLabel: string;
|
|
28
|
+
swapButtonStyle?: SwapButtonStyle;
|
|
23
29
|
};
|
|
24
30
|
declare const BpkSwapButton: ({
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
-
|
|
32
|
-
|
|
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__*/
|
|
45
|
+
return /*#__PURE__*/_jsx("div", {
|
|
49
46
|
className: getClassName('bpk-swap-button'),
|
|
50
|
-
children:
|
|
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
|
-
})
|
|
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}}
|
|
@@ -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
|
|
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.
|
package/bpk-stylesheets/base.css
CHANGED
|
@@ -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
|
|
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
|
|