@skyscanner/backpack-web 31.3.1 → 31.4.1-dev.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.
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ declare const _default: ({ styles, ...props }: {
3
+ [x: string]: any;
4
+ styles?: {} | undefined;
5
+ }) => JSX.Element;
6
+ export default _default;
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ declare const _default: ({ styles, ...props }: {
3
+ [x: string]: any;
4
+ styles?: {} | undefined;
5
+ }) => JSX.Element;
6
+ export default _default;
@@ -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)}}.bpk-link{padding:0;border:0;background-color:transparent;text-decoration:none;cursor:pointer;appearance:none;color:#0062e3;color:var(--bpk-link-color, #0062e3)}.bpk-no-touch-support .bpk-link:hover:not(:active):not(:disabled){text-decoration:underline;color:#0062e3;color:var(--bpk-link-hover-color, #0062e3)}:global(.bpk-no-touch-support) .bpk-link:hover:not(:active):not(:disabled){text-decoration:underline;color:#0062e3;color:var(--bpk-link-hover-color, #0062e3)}.bpk-link:visited{color:#0062e3;color:var(--bpk-link-visited-color, #0062e3)}.bpk-link:active{text-decoration:underline;color:#0062e3;color:var(--bpk-link-active-color, #0062e3)}.bpk-link--active{color:#0062e3}.bpk-link--active:visited{color:#0062e3}.bpk-link--active:active{color:#0062e3}.bpk-link--alternate{color:#fff;color:var(--bpk-link-alternate-color, #fff)}.bpk-no-touch-support .bpk-link--alternate:hover:not(:active):not(:disabled){color:#fff;color:var(--bpk-link-alternate-hover-color, #fff)}:global(.bpk-no-touch-support) .bpk-link--alternate:hover:not(:active):not(:disabled){color:#fff;color:var(--bpk-link-alternate-hover-color, #fff)}.bpk-link--alternate:visited{color:#fff;color:var(--bpk-link-alternate-visited-color, #fff)}.bpk-link--alternate:active{color:#fff;color:var(--bpk-link-alternate-active-color, #fff)}
18
+ @layer component{@keyframes bpk-keyframe-spin{100%{transform:rotate(1turn)}}.bpk-link{padding:0;border:0;background-color:transparent;text-decoration:none;cursor:pointer;appearance:none;color:#0062e3;color:var(--bpk-link-color, #0062e3)}.bpk-no-touch-support .bpk-link:hover:not(:active):not(:disabled){text-decoration:underline;color:#0062e3;color:var(--bpk-link-hover-color, #0062e3)}:global(.bpk-no-touch-support) .bpk-link:hover:not(:active):not(:disabled){text-decoration:underline;color:#0062e3;color:var(--bpk-link-hover-color, #0062e3)}.bpk-link:visited{color:#0062e3;color:var(--bpk-link-visited-color, #0062e3)}.bpk-link:active{text-decoration:underline;color:#0062e3;color:var(--bpk-link-active-color, #0062e3)}.bpk-link--active{color:#0062e3}.bpk-link--active:visited{color:#0062e3}.bpk-link--active:active{color:#0062e3}.bpk-link--alternate{color:#fff;color:var(--bpk-link-alternate-color, #fff)}.bpk-no-touch-support .bpk-link--alternate:hover:not(:active):not(:disabled){color:#fff;color:var(--bpk-link-alternate-hover-color, #fff)}:global(.bpk-no-touch-support) .bpk-link--alternate:hover:not(:active):not(:disabled){color:#fff;color:var(--bpk-link-alternate-hover-color, #fff)}.bpk-link--alternate:visited{color:#fff;color:var(--bpk-link-alternate-visited-color, #fff)}.bpk-link--alternate:active{color:#fff;color:var(--bpk-link-alternate-active-color, #fff)}}
@@ -19,6 +19,7 @@
19
19
  import { useState, useEffect } from 'react';
20
20
  import { createPortal } from 'react-dom';
21
21
  import withScrim from "./withScrim";
22
+ import BpkScrim from "./BpkScrim";
22
23
  import { jsx as _jsx } from "react/jsx-runtime";
23
24
  const getPortalElement = target => {
24
25
  const portalElement = target && typeof target === 'function' ? target() : null;
@@ -28,7 +29,7 @@ const getPortalElement = target => {
28
29
  if (document.body) {
29
30
  return document.body;
30
31
  }
31
- throw new Error('Render target and fallback unavailable');
32
+ throw new Error('Render target and fallback unavailable.');
32
33
  };
33
34
  const withScrimmedPortal = WrappedComponent => {
34
35
  const Scrimmed = withScrim(WrappedComponent);
@@ -36,15 +37,29 @@ const withScrimmedPortal = WrappedComponent => {
36
37
  renderTarget,
37
38
  ...rest
38
39
  }) => {
39
- const portalElement = getPortalElement(renderTarget);
40
40
  const [isPortalReady, setIsPortalReady] = useState(false);
41
41
  useEffect(() => {
42
42
  setIsPortalReady(true);
43
43
  }, []);
44
- return /*#__PURE__*/createPortal( /*#__PURE__*/_jsx(Scrimmed, {
45
- ...rest,
46
- isPortalReady: isPortalReady
47
- }), portalElement);
44
+
45
+ /**
46
+ * The following code runs only on the client - only once the component has been mounted.
47
+ */
48
+ if (isPortalReady) {
49
+ const portalElement = getPortalElement(renderTarget);
50
+ return /*#__PURE__*/createPortal( /*#__PURE__*/_jsx(Scrimmed, {
51
+ ...rest,
52
+ isPortalReady: isPortalReady
53
+ }), portalElement);
54
+ }
55
+
56
+ /**
57
+ * The following code will run on both server and on the intial render on the client.
58
+ * This is to ensure the snapshotted markup (initial render before the component has been mounted) is the same on both server and client.
59
+ * This is the recommended approach from React for those cases that require rendering something different on the server and the client
60
+ * https://react.dev/reference/react-dom/hydrate#handling-different-client-and-server-content
61
+ */
62
+ return /*#__PURE__*/_jsx(BpkScrim, {});
48
63
  };
49
64
  return ScrimmedComponent;
50
65
  };
@@ -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}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 base{/*! 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}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}}
20
20
 
@@ -16,65 +16,67 @@
16
16
  * limitations under the License.
17
17
  */
18
18
 
19
- @import '~normalize.css';
20
- @import '../bpk-mixins/index.scss';
19
+ @layer base {
20
+ @import '~normalize.css';
21
+ @import '../bpk-mixins/index.scss';
21
22
 
22
- // stylelint-disable-next-line selector-max-type
23
- html {
24
- font-size: $bpk-font-size-root;
25
- box-sizing: border-box;
26
- }
27
-
28
- * {
29
- box-sizing: inherit;
23
+ // stylelint-disable-next-line selector-max-type
24
+ html {
25
+ font-size: $bpk-font-size-root;
26
+ box-sizing: border-box;
27
+ }
30
28
 
31
- &::before,
32
- &::after {
29
+ * {
33
30
  box-sizing: inherit;
31
+
32
+ &::before,
33
+ &::after {
34
+ box-sizing: inherit;
35
+ }
34
36
  }
35
- }
36
37
 
37
- /* stylelint-disable selector-class-pattern */
38
- body {
39
- color: $bpk-font-color-base;
40
- font-family: $bpk-font-family-base;
41
- font-size: $bpk-font-size-base;
42
- line-height: 1.3rem; /* stylelint-disable-line scale-unlimited/declaration-strict-value */
38
+ /* stylelint-disable selector-class-pattern */
39
+ body {
40
+ color: $bpk-font-color-base;
41
+ font-family: $bpk-font-family-base;
42
+ font-size: $bpk-font-size-base;
43
+ line-height: 1.3rem; /* stylelint-disable-line scale-unlimited/declaration-strict-value */
43
44
 
44
- :global(&.scaffold-font-size) {
45
- font-size: 13px; /* stylelint-disable-line unit-disallowed-list, scale-unlimited/declaration-strict-value */
46
- }
45
+ :global(&.scaffold-font-size) {
46
+ font-size: 13px; /* stylelint-disable-line unit-disallowed-list, scale-unlimited/declaration-strict-value */
47
+ }
47
48
 
48
- :global(&.enable-font-smoothing) {
49
- -webkit-font-smoothing: antialiased;
49
+ :global(&.enable-font-smoothing) {
50
+ -webkit-font-smoothing: antialiased;
51
+ }
50
52
  }
51
- }
52
53
 
53
- :focus-visible {
54
- @include bpk-focus-indicator;
55
- }
54
+ :focus-visible {
55
+ @include bpk-focus-indicator;
56
+ }
56
57
 
57
- :global(.hidden),
58
- :global(.hide) {
59
- @include bpk-hidden;
60
- }
58
+ :global(.hidden),
59
+ :global(.hide) {
60
+ @include bpk-hidden;
61
+ }
61
62
 
62
- :global(.visuallyhidden),
63
- :global(.visually-hidden) {
64
- @include bpk-visually-hidden;
65
- }
63
+ :global(.visuallyhidden),
64
+ :global(.visually-hidden) {
65
+ @include bpk-visually-hidden;
66
+ }
66
67
 
67
- :global(.visuallyhidden.focusable),
68
- :global(.visually-hidden.focusable) {
69
- @include bpk-visually-hidden--focusable;
70
- }
68
+ :global(.visuallyhidden.focusable),
69
+ :global(.visually-hidden.focusable) {
70
+ @include bpk-visually-hidden--focusable;
71
+ }
71
72
 
72
- :global(.invisible) {
73
- @include bpk-invisible;
74
- }
73
+ :global(.invisible) {
74
+ @include bpk-invisible;
75
+ }
75
76
 
76
- :global(.clearfix) {
77
- @include bpk-clearfix;
77
+ :global(.clearfix) {
78
+ @include bpk-clearfix;
79
+ }
78
80
  }
79
81
 
80
82
  /* stylelint-enable */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skyscanner/backpack-web",
3
- "version": "31.3.1",
3
+ "version": "31.4.1-dev.0",
4
4
  "description": "Backpack Design System web library",
5
5
  "repository": {
6
6
  "type": "git",