@cloudscape-design/components 3.0.893 → 3.0.894

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.
@@ -1,4 +1,4 @@
1
1
  export var PACKAGE_SOURCE = "components";
2
- export var PACKAGE_VERSION = "3.0.0 (6038d566)";
2
+ export var PACKAGE_VERSION = "3.0.0 (ded92333)";
3
3
  export var THEME = "open-source-visual-refresh";
4
4
  export var ALWAYS_VISUAL_REFRESH = true;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "PACKAGE_SOURCE": "components",
3
- "PACKAGE_VERSION": "3.0.0 (6038d566)",
3
+ "PACKAGE_VERSION": "3.0.0 (ded92333)",
4
4
  "THEME": "default",
5
5
  "ALWAYS_VISUAL_REFRESH": false
6
6
  }
@@ -1,2 +1,3 @@
1
+ export declare const forceMobileModeSymbol: unique symbol;
1
2
  export declare const useMobile: () => boolean;
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-mobile/index.ts"],"names":[],"mappings":"AA0BA,eAAO,MAAM,SAAS,eASpB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-mobile/index.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,qBAAqB,eAAwC,CAAC;AA4B3E,eAAO,MAAM,SAAS,eASpB,CAAC"}
@@ -2,7 +2,14 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  import { createSingletonState } from '@cloudscape-design/component-toolkit/internal';
4
4
  import { getMatchingBreakpoint, mobileBreakpoint } from '../../breakpoints';
5
+ export const forceMobileModeSymbol = Symbol.for('awsui-force-mobile-mode');
5
6
  function getIsMobile() {
7
+ // allow overriding the mobile mode in tests
8
+ // any is needed because of this https://github.com/microsoft/TypeScript/issues/36813
9
+ const forceMobileMode = globalThis[forceMobileModeSymbol];
10
+ if (typeof forceMobileMode !== 'undefined') {
11
+ return forceMobileMode;
12
+ }
6
13
  if (typeof window === 'undefined') {
7
14
  // assume desktop in server-rendering
8
15
  return false;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-mobile/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,oBAAoB,EAAE,MAAM,+CAA+C,CAAC;AAErF,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE5E,SAAS,WAAW;IAClB,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QACjC,qCAAqC;QACrC,OAAO,KAAK,CAAC;KACd;IAED,IAAI,MAAM,CAAC,UAAU,EAAE;QACrB;;;;;;WAMG;QACH,OAAO,MAAM,CAAC,UAAU,CAAC,eAAe,gBAAgB,KAAK,CAAC,CAAC,OAAO,CAAC;KACxE;IAED,OAAO,qBAAqB,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC;AACnE,CAAC;AAED,MAAM,CAAC,MAAM,SAAS,GAAG,oBAAoB,CAAU;IACrD,YAAY,EAAE,GAAG,EAAE,CAAC,WAAW,EAAE;IACjC,OAAO,EAAE,OAAO,CAAC,EAAE;QACjB,MAAM,QAAQ,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;QAC9C,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAC5C,OAAO,GAAG,EAAE;YACV,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QACjD,CAAC,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { createSingletonState } from '@cloudscape-design/component-toolkit/internal';\n\nimport { getMatchingBreakpoint, mobileBreakpoint } from '../../breakpoints';\n\nfunction getIsMobile() {\n if (typeof window === 'undefined') {\n // assume desktop in server-rendering\n return false;\n }\n\n if (window.matchMedia) {\n /**\n * Some browsers include the scrollbar width in their media query calculations, but\n * some browsers don't. Thus we can't use `window.innerWidth` or\n * `document.documentElement.clientWidth` to get a very accurate result (since we\n * wouldn't know which one of them to use).\n * Instead, we use the media query here in JS too.\n */\n return window.matchMedia(`(max-width: ${mobileBreakpoint}px)`).matches;\n }\n\n return getMatchingBreakpoint(window.innerWidth, ['xs']) !== 'xs';\n}\n\nexport const useMobile = createSingletonState<boolean>({\n initialState: () => getIsMobile(),\n factory: handler => {\n const listener = () => handler(getIsMobile());\n window.addEventListener('resize', listener);\n return () => {\n window.removeEventListener('resize', listener);\n };\n },\n});\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-mobile/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,oBAAoB,EAAE,MAAM,+CAA+C,CAAC;AAErF,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE5E,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;AAE3E,SAAS,WAAW;IAClB,4CAA4C;IAC5C,qFAAqF;IACrF,MAAM,eAAe,GAAI,UAAkB,CAAC,qBAAqB,CAAC,CAAC;IACnE,IAAI,OAAO,eAAe,KAAK,WAAW,EAAE;QAC1C,OAAO,eAAe,CAAC;KACxB;IACD,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QACjC,qCAAqC;QACrC,OAAO,KAAK,CAAC;KACd;IAED,IAAI,MAAM,CAAC,UAAU,EAAE;QACrB;;;;;;WAMG;QACH,OAAO,MAAM,CAAC,UAAU,CAAC,eAAe,gBAAgB,KAAK,CAAC,CAAC,OAAO,CAAC;KACxE;IAED,OAAO,qBAAqB,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC;AACnE,CAAC;AAED,MAAM,CAAC,MAAM,SAAS,GAAG,oBAAoB,CAAU;IACrD,YAAY,EAAE,GAAG,EAAE,CAAC,WAAW,EAAE;IACjC,OAAO,EAAE,OAAO,CAAC,EAAE;QACjB,MAAM,QAAQ,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;QAC9C,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAC5C,OAAO,GAAG,EAAE;YACV,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QACjD,CAAC,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { createSingletonState } from '@cloudscape-design/component-toolkit/internal';\n\nimport { getMatchingBreakpoint, mobileBreakpoint } from '../../breakpoints';\n\nexport const forceMobileModeSymbol = Symbol.for('awsui-force-mobile-mode');\n\nfunction getIsMobile() {\n // allow overriding the mobile mode in tests\n // any is needed because of this https://github.com/microsoft/TypeScript/issues/36813\n const forceMobileMode = (globalThis as any)[forceMobileModeSymbol];\n if (typeof forceMobileMode !== 'undefined') {\n return forceMobileMode;\n }\n if (typeof window === 'undefined') {\n // assume desktop in server-rendering\n return false;\n }\n\n if (window.matchMedia) {\n /**\n * Some browsers include the scrollbar width in their media query calculations, but\n * some browsers don't. Thus we can't use `window.innerWidth` or\n * `document.documentElement.clientWidth` to get a very accurate result (since we\n * wouldn't know which one of them to use).\n * Instead, we use the media query here in JS too.\n */\n return window.matchMedia(`(max-width: ${mobileBreakpoint}px)`).matches;\n }\n\n return getMatchingBreakpoint(window.innerWidth, ['xs']) !== 'xs';\n}\n\nexport const useMobile = createSingletonState<boolean>({\n initialState: () => getIsMobile(),\n factory: handler => {\n const listener = () => handler(getIsMobile());\n window.addEventListener('resize', listener);\n return () => {\n window.removeEventListener('resize', listener);\n };\n },\n});\n"]}
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "6038d566e883b032719d174a8032c97dae1be916"
2
+ "commit": "ded92333d1f7de07e5244da6e712be03cfe439cd"
3
3
  }
package/package.json CHANGED
@@ -132,7 +132,7 @@
132
132
  "./internal/base-component/index.js",
133
133
  "./internal/base-component/styles.css.js"
134
134
  ],
135
- "version": "3.0.893",
135
+ "version": "3.0.894",
136
136
  "repository": {
137
137
  "type": "git",
138
138
  "url": "https://github.com/cloudscape-design/components.git"