@hyphen/hyphen-components 2.20.0 → 2.22.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.
@@ -3,7 +3,7 @@
3
3
  \***************************************************************************************************************************/
4
4
  /**
5
5
  * Do not edit directly
6
- * Generated on Wed, 30 Oct 2024 16:46:04 GMT
6
+ * Generated on Thu, 31 Oct 2024 00:26:05 GMT
7
7
  */
8
8
 
9
9
  .font-family-monospace { font-family: var(--assets-font-family-monospace); }
@@ -3,7 +3,7 @@
3
3
  \*********************************************************************************************************************/
4
4
  /**
5
5
  * Do not edit directly
6
- * Generated on Wed, 30 Oct 2024 16:46:04 GMT
6
+ * Generated on Thu, 31 Oct 2024 00:26:05 GMT
7
7
  */
8
8
 
9
9
  :root {
@@ -314,7 +314,7 @@
314
314
  \*******************************************************************************************************************************/
315
315
  /**
316
316
  * Do not edit directly
317
- * Generated on Wed, 30 Oct 2024 16:46:04 GMT
317
+ * Generated on Thu, 31 Oct 2024 00:26:05 GMT
318
318
  */
319
319
 
320
320
  :root.dark {
@@ -1,4 +1,5 @@
1
1
  export * from './useBreakpoint/useBreakpoint';
2
+ export * from './useIsMobile/useIsMobile';
2
3
  export * from './useIsomorphicLayoutEffect/useIsomorphicLayouEffect';
3
4
  export * from './useOpenClose/useOpenClose';
4
5
  export * from './useTheme/useTheme';
@@ -0,0 +1 @@
1
+ export declare function useIsMobile(): Boolean;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import type { Meta } from '@storybook/react';
3
+ import { useIsMobile } from '../useIsMobile/useIsMobile';
4
+ declare const meta: Meta<typeof useIsMobile>;
5
+ export default meta;
6
+ export declare const BasicUsage: () => React.JSX.Element;
@@ -23,6 +23,25 @@ var AsyncSelect = require('react-select/async');
23
23
  var CreatableSelect = require('react-select/creatable');
24
24
  var uuid = require('uuid');
25
25
 
26
+ function _interopNamespaceDefault(e) {
27
+ var n = Object.create(null);
28
+ if (e) {
29
+ Object.keys(e).forEach(function (k) {
30
+ if (k !== 'default') {
31
+ var d = Object.getOwnPropertyDescriptor(e, k);
32
+ Object.defineProperty(n, k, d.get ? d : {
33
+ enumerable: true,
34
+ get: function () { return e[k]; }
35
+ });
36
+ }
37
+ });
38
+ }
39
+ n.default = e;
40
+ return n;
41
+ }
42
+
43
+ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
44
+
26
45
  function _extends() {
27
46
  return _extends = Object.assign ? Object.assign.bind() : function (n) {
28
47
  for (var e = 1; e < arguments.length; e++) {
@@ -4652,6 +4671,28 @@ var useBreakpoint = function useBreakpoint() {
4652
4671
  };
4653
4672
  };
4654
4673
 
4674
+ var desktopBreakpoint = /*#__PURE__*/BREAKPOINTS.find(function (b) {
4675
+ return b.name === 'desktop';
4676
+ });
4677
+ var MOBILE_BREAKPOINT = desktopBreakpoint ? desktopBreakpoint.minWidth : 0; // min width in pixels
4678
+ function useIsMobile() {
4679
+ var _React$useState = React__namespace.useState(undefined),
4680
+ isMobile = _React$useState[0],
4681
+ setIsMobile = _React$useState[1];
4682
+ React__namespace.useEffect(function () {
4683
+ var mql = window.matchMedia("(max-width: " + (MOBILE_BREAKPOINT - 1) + "px)");
4684
+ var onChange = function onChange() {
4685
+ setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
4686
+ };
4687
+ mql.addEventListener('change', onChange);
4688
+ setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
4689
+ return function () {
4690
+ return mql.removeEventListener('change', onChange);
4691
+ };
4692
+ }, []);
4693
+ return !!isMobile;
4694
+ }
4695
+
4655
4696
  var useOpenClose = function useOpenClose(props) {
4656
4697
  if (props === void 0) {
4657
4698
  props = {};
@@ -4762,6 +4803,7 @@ exports.boxPropsKeys = boxPropsKeys;
4762
4803
  exports.createRectRef = createRectRef;
4763
4804
  exports.toast = toast;
4764
4805
  exports.useBreakpoint = useBreakpoint;
4806
+ exports.useIsMobile = useIsMobile;
4765
4807
  exports.useIsomorphicLayoutEffect = useIsomorphicLayoutEffect;
4766
4808
  exports.useOpenClose = useOpenClose;
4767
4809
  exports.useTheme = useTheme;