@megafon/ui-core 9.3.0 → 9.4.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.
Files changed (41) hide show
  1. package/dist/es/components/Modal/Modal.js +27 -3
  2. package/dist/es/components/Modal/_ModalMobile/ModalMobile.css +1 -1
  3. package/dist/es/components/Modal/_ModalMobile/ModalMobile.d.ts +1 -0
  4. package/dist/es/components/Modal/_ModalMobile/ModalMobile.js +9 -4
  5. package/dist/es/components/Modal/utils/usePreventScroll.d.ts +17 -0
  6. package/dist/es/components/Modal/utils/usePreventScroll.js +252 -0
  7. package/dist/es/components/Modal/utils/utils.d.ts +1 -0
  8. package/dist/es/components/Modal/utils/utils.js +3 -2
  9. package/dist/es/hooks/useEvent.d.ts +3 -0
  10. package/dist/es/hooks/useEvent.js +11 -0
  11. package/dist/es/hooks/useLatest.d.ts +2 -0
  12. package/dist/es/hooks/useLatest.js +8 -0
  13. package/dist/es/hooks/useVisualViewport.d.ts +10 -0
  14. package/dist/es/hooks/useVisualViewport.js +55 -0
  15. package/dist/es/index.d.ts +1 -0
  16. package/dist/es/index.js +1 -0
  17. package/dist/es/utils/browser.d.ts +7 -0
  18. package/dist/es/utils/browser.js +30 -0
  19. package/dist/es/utils/is.d.ts +19 -0
  20. package/dist/es/utils/is.js +70 -0
  21. package/dist/lib/components/Modal/Modal.js +27 -3
  22. package/dist/lib/components/Modal/_ModalMobile/ModalMobile.css +1 -1
  23. package/dist/lib/components/Modal/_ModalMobile/ModalMobile.d.ts +1 -0
  24. package/dist/lib/components/Modal/_ModalMobile/ModalMobile.js +9 -4
  25. package/dist/lib/components/Modal/utils/usePreventScroll.d.ts +17 -0
  26. package/dist/lib/components/Modal/utils/usePreventScroll.js +263 -0
  27. package/dist/lib/components/Modal/utils/utils.d.ts +1 -0
  28. package/dist/lib/components/Modal/utils/utils.js +3 -2
  29. package/dist/lib/hooks/useEvent.d.ts +3 -0
  30. package/dist/lib/hooks/useEvent.js +17 -0
  31. package/dist/lib/hooks/useLatest.d.ts +2 -0
  32. package/dist/lib/hooks/useLatest.js +14 -0
  33. package/dist/lib/hooks/useVisualViewport.d.ts +10 -0
  34. package/dist/lib/hooks/useVisualViewport.js +62 -0
  35. package/dist/lib/index.d.ts +1 -0
  36. package/dist/lib/index.js +7 -0
  37. package/dist/lib/utils/browser.d.ts +7 -0
  38. package/dist/lib/utils/browser.js +42 -0
  39. package/dist/lib/utils/is.d.ts +19 -0
  40. package/dist/lib/utils/is.js +92 -0
  41. package/package.json +2 -2
package/dist/lib/index.js CHANGED
@@ -555,6 +555,12 @@ Object.defineProperty(exports, "usePagination", {
555
555
  return _usePagination["default"];
556
556
  }
557
557
  });
558
+ Object.defineProperty(exports, "usePreventScroll", {
559
+ enumerable: true,
560
+ get: function get() {
561
+ return _usePreventScroll["default"];
562
+ }
563
+ });
558
564
  Object.defineProperty(exports, "utils", {
559
565
  enumerable: true,
560
566
  get: function get() {
@@ -652,6 +658,7 @@ var _UploadFileItemIcon = _interopRequireDefault(require("./components/UploadFor
652
658
  var _useDragAndDrop = _interopRequireDefault(require("./components/UploadForm/UploadField/components/useDragAndDrop"));
653
659
  var _useGradient = _interopRequireDefault(require("./components/Carousel/useGradient"));
654
660
  var _usePagination = _interopRequireDefault(require("./components/Pagination/usePagination"));
661
+ var _usePreventScroll = _interopRequireDefault(require("./components/Modal/utils/usePreventScroll"));
655
662
  var _utils = _interopRequireDefault(require("./components/Modal/utils/utils"));
656
663
  var _ValueField = _interopRequireDefault(require("./components/ValueField/ValueField"));
657
664
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
@@ -0,0 +1,7 @@
1
+ export declare function isMobileFirefox(): boolean | undefined;
2
+ export declare function testPlatform(re: RegExp): boolean | undefined;
3
+ export declare function isMac(): boolean | undefined;
4
+ export declare function isIPhone(): boolean | undefined;
5
+ export declare function isSafari(): boolean | undefined;
6
+ export declare function isIPad(): boolean | undefined;
7
+ export declare function isIOS(): boolean | undefined;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isIOS = isIOS;
7
+ exports.isIPad = isIPad;
8
+ exports.isIPhone = isIPhone;
9
+ exports.isMac = isMac;
10
+ exports.isMobileFirefox = isMobileFirefox;
11
+ exports.isSafari = isSafari;
12
+ exports.testPlatform = testPlatform;
13
+ require("core-js/modules/es.regexp.exec.js");
14
+ require("core-js/modules/es.regexp.test.js");
15
+ function isMobileFirefox() {
16
+ var _navigator = navigator,
17
+ userAgent = _navigator.userAgent;
18
+ return typeof window !== 'undefined' && (/Firefox/.test(userAgent) && /Mobile/.test(userAgent) ||
19
+ // Android Firefox
20
+ /FxiOS/.test(userAgent)) // iOS Firefox
21
+ ;
22
+ }
23
+ function testPlatform(re) {
24
+ return typeof window !== 'undefined' && window.navigator != null ? re.test(window.navigator.platform) : undefined;
25
+ }
26
+ function isMac() {
27
+ return testPlatform(/^Mac/);
28
+ }
29
+ function isIPhone() {
30
+ return testPlatform(/^iPhone/);
31
+ }
32
+ function isSafari() {
33
+ return /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
34
+ }
35
+ function isIPad() {
36
+ return testPlatform(/^iPad/) ||
37
+ // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
38
+ isMac() && navigator.maxTouchPoints > 1;
39
+ }
40
+ function isIOS() {
41
+ return isIPhone() || isIPad();
42
+ }
@@ -0,0 +1,19 @@
1
+ export declare function isNumber(value: unknown): value is number;
2
+ export declare function isInteger(v: unknown): boolean;
3
+ export declare function isArray<T>(value: unknown): value is Array<T>;
4
+ export declare function isEmptyArray(value: unknown): boolean;
5
+ type AnyFunction = (...args: unknown[]) => unknown;
6
+ export declare function isFunction<T extends AnyFunction = AnyFunction>(value: unknown): value is T;
7
+ export declare function isDefined(value: unknown): boolean;
8
+ export declare function isUndefined(value: unknown): value is undefined;
9
+ export declare function isObject(value: unknown): value is Record<string, unknown>;
10
+ export declare function isEmptyObject(value: unknown): boolean;
11
+ export declare function isNull(value: unknown): value is null;
12
+ export declare function isString(value: unknown): value is string;
13
+ export declare function isCssVar(value: string): boolean;
14
+ export declare function isEmpty(value: unknown): boolean;
15
+ export declare const isBoolean: (value: unknown) => value is boolean;
16
+ type Falsy = false | 0 | '' | null | undefined | bigint;
17
+ export declare const isTruthy: <T>(value: T) => value is Exclude<T, Falsy>;
18
+ export declare const isHTMLElement: (value: unknown) => value is HTMLElement;
19
+ export {};
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isArray = isArray;
7
+ exports.isBoolean = void 0;
8
+ exports.isCssVar = isCssVar;
9
+ exports.isDefined = isDefined;
10
+ exports.isEmpty = isEmpty;
11
+ exports.isEmptyArray = isEmptyArray;
12
+ exports.isEmptyObject = isEmptyObject;
13
+ exports.isFunction = isFunction;
14
+ exports.isHTMLElement = void 0;
15
+ exports.isInteger = isInteger;
16
+ exports.isNull = isNull;
17
+ exports.isNumber = isNumber;
18
+ exports.isObject = isObject;
19
+ exports.isString = isString;
20
+ exports.isTruthy = void 0;
21
+ exports.isUndefined = isUndefined;
22
+ var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
23
+ require("core-js/modules/es.array.is-array.js");
24
+ require("core-js/modules/es.date.to-string.js");
25
+ require("core-js/modules/es.number.constructor.js");
26
+ require("core-js/modules/es.number.is-finite.js");
27
+ require("core-js/modules/es.number.is-nan.js");
28
+ require("core-js/modules/es.object.keys.js");
29
+ require("core-js/modules/es.object.to-string.js");
30
+ require("core-js/modules/es.regexp.exec.js");
31
+ require("core-js/modules/es.regexp.test.js");
32
+ require("core-js/modules/es.regexp.to-string.js");
33
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
34
+ function isNumber(value) {
35
+ return typeof value === 'number';
36
+ }
37
+ function isInteger(v) {
38
+ var value = Number(v);
39
+ return typeof value === 'number' && !Number.isNaN(value) && Number.isFinite(value) && Math.floor(value) === value;
40
+ }
41
+ function isArray(value) {
42
+ return Array.isArray(value);
43
+ }
44
+ function isEmptyArray(value) {
45
+ return isArray(value) && value.length === 0;
46
+ }
47
+ function isFunction(value) {
48
+ return typeof value === 'function';
49
+ }
50
+ function isDefined(value) {
51
+ return typeof value !== 'undefined' && value !== undefined;
52
+ }
53
+ function isUndefined(value) {
54
+ return typeof value === 'undefined' || value === undefined;
55
+ }
56
+ function isObject(value) {
57
+ var type = (0, _typeof2["default"])(value);
58
+ return value != null && (type === 'object' || type === 'function') && !isArray(value);
59
+ }
60
+ function isEmptyObject(value) {
61
+ return isObject(value) && Object.keys(value).length === 0;
62
+ }
63
+ function isNull(value) {
64
+ return value === null;
65
+ }
66
+ function isString(value) {
67
+ return Object.prototype.toString.call(value) === '[object String]';
68
+ }
69
+ function isCssVar(value) {
70
+ return /^var\(--.+\)$/.test(value);
71
+ }
72
+ function isEmpty(value) {
73
+ if (isArray(value)) {
74
+ return isEmptyArray(value);
75
+ }
76
+ if (isObject(value)) {
77
+ return isEmptyObject(value);
78
+ }
79
+ if (value == null || value === '') {
80
+ return true;
81
+ }
82
+ return false;
83
+ }
84
+ var isBoolean = exports.isBoolean = function isBoolean(value) {
85
+ return typeof value === 'boolean';
86
+ };
87
+ var isTruthy = exports.isTruthy = function isTruthy(value) {
88
+ return Boolean(value);
89
+ };
90
+ var isHTMLElement = exports.isHTMLElement = function isHTMLElement(value) {
91
+ return value instanceof HTMLElement;
92
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@megafon/ui-core",
3
- "version": "9.3.0",
3
+ "version": "9.4.0",
4
4
  "files": [
5
5
  "dist",
6
6
  "styles"
@@ -104,5 +104,5 @@
104
104
  "simplebar-react": "^3.2.5",
105
105
  "swiper": "^12.1.2"
106
106
  },
107
- "gitHead": "e090c9565de565ddb498c09b2ae596972996828c"
107
+ "gitHead": "c28ce3fb0ec00755000ff405a4ae1efe950064fb"
108
108
  }