@bigbinary/neeto-molecules 1.3.8 → 1.3.10

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/dist/Security.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import React__default, { forwardRef } from 'react';
2
+ import React__default, { forwardRef, useState, useEffect } from 'react';
3
3
  import { isNotEmpty, noop } from '@bigbinary/neeto-cist';
4
4
  import { Input, Radio, Form, ActionBlock } from '@bigbinary/neetoui/formik';
5
5
  import classnames from 'classnames';
@@ -17,6 +17,61 @@ import { useMutationWithInvalidation } from '@bigbinary/neeto-commons-frontend/r
17
17
  import { useQuery } from 'react-query';
18
18
  import axios from 'axios';
19
19
 
20
+ function _arrayWithHoles(arr) {
21
+ if (Array.isArray(arr)) return arr;
22
+ }
23
+
24
+ function _iterableToArrayLimit(r, l) {
25
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
26
+ if (null != t) {
27
+ var e,
28
+ n,
29
+ i,
30
+ u,
31
+ a = [],
32
+ f = !0,
33
+ o = !1;
34
+ try {
35
+ if (i = (t = t.call(r)).next, 0 === l) {
36
+ if (Object(t) !== t) return;
37
+ f = !1;
38
+ } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
39
+ } catch (r) {
40
+ o = !0, n = r;
41
+ } finally {
42
+ try {
43
+ if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
44
+ } finally {
45
+ if (o) throw n;
46
+ }
47
+ }
48
+ return a;
49
+ }
50
+ }
51
+
52
+ function _arrayLikeToArray(arr, len) {
53
+ if (len == null || len > arr.length) len = arr.length;
54
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
55
+ return arr2;
56
+ }
57
+
58
+ function _unsupportedIterableToArray(o, minLen) {
59
+ if (!o) return;
60
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
61
+ var n = Object.prototype.toString.call(o).slice(8, -1);
62
+ if (n === "Object" && o.constructor) n = o.constructor.name;
63
+ if (n === "Map" || n === "Set") return Array.from(o);
64
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
65
+ }
66
+
67
+ function _nonIterableRest() {
68
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
69
+ }
70
+
71
+ function _slicedToArray(arr, i) {
72
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
73
+ }
74
+
20
75
  var propTypes = {exports: {}};
21
76
 
22
77
  var reactIs = {exports: {}};
@@ -1524,12 +1579,6 @@ var Scrollable = function Scrollable(_ref) {
1524
1579
  }, otherProps), children);
1525
1580
  };
1526
1581
 
1527
- function _arrayLikeToArray(arr, len) {
1528
- if (len == null || len > arr.length) len = arr.length;
1529
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
1530
- return arr2;
1531
- }
1532
-
1533
1582
  function _arrayWithoutHoles(arr) {
1534
1583
  if (Array.isArray(arr)) return _arrayLikeToArray(arr);
1535
1584
  }
@@ -1538,15 +1587,6 @@ function _iterableToArray(iter) {
1538
1587
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
1539
1588
  }
1540
1589
 
1541
- function _unsupportedIterableToArray(o, minLen) {
1542
- if (!o) return;
1543
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
1544
- var n = Object.prototype.toString.call(o).slice(8, -1);
1545
- if (n === "Object" && o.constructor) n = o.constructor.name;
1546
- if (n === "Map" || n === "Set") return Array.from(o);
1547
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
1548
- }
1549
-
1550
1590
  function _nonIterableSpread() {
1551
1591
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1552
1592
  }
@@ -1797,6 +1837,13 @@ var Security = function Security(_ref) {
1797
1837
  isLoading = _useFetchSettings.isLoading;
1798
1838
  var _useUpdateSetting = useUpdateSetting(url),
1799
1839
  updateSettings = _useUpdateSetting.mutate;
1840
+ var _useState = useState(false),
1841
+ _useState2 = _slicedToArray(_useState, 2),
1842
+ isMobileScreen = _useState2[0],
1843
+ setIsMobileScreen = _useState2[1];
1844
+ var isLargerScreen = function isLargerScreen() {
1845
+ return window.innerWidth > 1024;
1846
+ };
1800
1847
  var handleSubmit = function handleSubmit(values, _ref2) {
1801
1848
  var setSubmitting = _ref2.setSubmitting;
1802
1849
  updateSettings(values, {
@@ -1805,13 +1852,23 @@ var Security = function Security(_ref) {
1805
1852
  }
1806
1853
  });
1807
1854
  };
1855
+ useEffect(function () {
1856
+ var handleResize = function handleResize() {
1857
+ if (isLargerScreen()) setIsMobileScreen(false);else setIsMobileScreen(true);
1858
+ };
1859
+ window.addEventListener("resize", handleResize);
1860
+ return function () {
1861
+ return window.removeEventListener("resize", handleResize);
1862
+ };
1863
+ }, []);
1808
1864
  if (isLoading) return /*#__PURE__*/React__default.createElement(PageLoader$1, null);
1809
1865
  return /*#__PURE__*/React__default.createElement(Container, {
1810
1866
  isHeaderFixed: true
1811
1867
  }, /*#__PURE__*/React__default.createElement(Header, {
1812
- "data-cy": "general-settings-heading",
1813
1868
  breadcrumbs: breadcrumbs,
1814
- title: title
1869
+ title: title,
1870
+ "data-cy": "general-settings-heading",
1871
+ size: isMobileScreen ? "small" : "large"
1815
1872
  }), /*#__PURE__*/React__default.createElement(Scrollable, {
1816
1873
  className: "w-full pb-6"
1817
1874
  }, /*#__PURE__*/React__default.createElement(Form, {