@mirai/ui 1.0.12 → 1.0.13
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/build/components/Button/Button.js +67 -0
- package/build/components/Button/Button.js.map +1 -0
- package/build/components/Button/Button.module.css +90 -0
- package/build/components/Button/__tests__/__snapshots__/Button.test.js.snap +113 -0
- package/build/components/Button/index.js +19 -0
- package/build/components/Button/index.js.map +1 -0
- package/build/components/Calendar/Calendar.Month.js +129 -0
- package/build/components/Calendar/Calendar.Month.js.map +1 -0
- package/build/components/Calendar/Calendar.Week.js +177 -0
- package/build/components/Calendar/Calendar.Week.js.map +1 -0
- package/build/components/Calendar/Calendar.Weekdays.js +45 -0
- package/build/components/Calendar/Calendar.Weekdays.js.map +1 -0
- package/build/components/Calendar/Calendar.constants.js +11 -0
- package/build/components/Calendar/Calendar.constants.js.map +1 -0
- package/build/components/Calendar/Calendar.js +196 -0
- package/build/components/Calendar/Calendar.js.map +1 -0
- package/build/components/Calendar/Calendar.module.css +127 -0
- package/build/components/Calendar/__tests__/__snapshots__/Calendar.test.jsx.snap +20477 -0
- package/build/components/Calendar/helpers/getFirstDateOfMonth.js +16 -0
- package/build/components/Calendar/helpers/getFirstDateOfMonth.js.map +1 -0
- package/build/components/Calendar/helpers/getFirstDateOfWeek.js +20 -0
- package/build/components/Calendar/helpers/getFirstDateOfWeek.js.map +1 -0
- package/build/components/Calendar/helpers/getHeader.js +23 -0
- package/build/components/Calendar/helpers/getHeader.js.map +1 -0
- package/build/components/Calendar/helpers/getToday.js +15 -0
- package/build/components/Calendar/helpers/getToday.js.map +1 -0
- package/build/components/Calendar/helpers/getWeekDays.js +27 -0
- package/build/components/Calendar/helpers/getWeekDays.js.map +1 -0
- package/build/components/Calendar/helpers/getWeekNumber.js +17 -0
- package/build/components/Calendar/helpers/getWeekNumber.js.map +1 -0
- package/build/components/Calendar/helpers/index.js +97 -0
- package/build/components/Calendar/helpers/index.js.map +1 -0
- package/build/components/Calendar/helpers/isJest.js +9 -0
- package/build/components/Calendar/helpers/isJest.js.map +1 -0
- package/build/components/Calendar/index.js +19 -0
- package/build/components/Calendar/index.js.map +1 -0
- package/build/components/Form/Form.js +217 -0
- package/build/components/Form/Form.js.map +1 -0
- package/build/components/Form/__tests__/__snapshots__/Form.test.jsx.snap +47 -0
- package/build/components/Form/helpers/getChildrenErrors.js +51 -0
- package/build/components/Form/helpers/getChildrenErrors.js.map +1 -0
- package/build/components/Form/helpers/getChildrenValues.js +51 -0
- package/build/components/Form/helpers/getChildrenValues.js.map +1 -0
- package/build/components/Form/helpers/getField.js +17 -0
- package/build/components/Form/helpers/getField.js.map +1 -0
- package/build/components/Form/helpers/groupState.js +29 -0
- package/build/components/Form/helpers/groupState.js.map +1 -0
- package/build/components/Form/helpers/index.js +58 -0
- package/build/components/Form/helpers/index.js.map +1 -0
- package/build/components/Form/index.js +19 -0
- package/build/components/Form/index.js.map +1 -0
- package/build/components/InputNumber/InputNumber.js +91 -0
- package/build/components/InputNumber/InputNumber.js.map +1 -0
- package/build/components/InputNumber/InputNumber.module.css +25 -0
- package/build/components/InputNumber/__tests__/__snapshots__/InputNumber.test.js.snap +698 -0
- package/build/components/InputNumber/index.js +19 -0
- package/build/components/InputNumber/index.js.map +1 -0
- package/build/components/InputOption/InputOption.constants.js +13 -0
- package/build/components/InputOption/InputOption.constants.js.map +1 -0
- package/build/components/InputOption/InputOption.js +80 -0
- package/build/components/InputOption/InputOption.js.map +1 -0
- package/build/components/InputOption/InputOption.module.css +43 -0
- package/build/components/InputOption/__tests__/__snapshots__/InputOption.test.js.snap +232 -0
- package/build/components/InputOption/index.js +19 -0
- package/build/components/InputOption/index.js.map +1 -0
- package/build/components/InputSelect/InputSelect.js +123 -0
- package/build/components/InputSelect/InputSelect.js.map +1 -0
- package/build/components/InputSelect/__tests__/__snapshots__/InputSelect.test.js.snap +490 -0
- package/build/components/InputSelect/index.js +19 -0
- package/build/components/InputSelect/index.js.map +1 -0
- package/build/components/InputText/InputText.js +141 -0
- package/build/components/InputText/InputText.js.map +1 -0
- package/build/components/InputText/InputText.module.css +107 -0
- package/build/components/InputText/__tests__/__snapshots__/InputText.test.js.snap +255 -0
- package/build/components/InputText/index.js +19 -0
- package/build/components/InputText/index.js.map +1 -0
- package/build/components/Menu/Menu.Option.js +58 -0
- package/build/components/Menu/Menu.Option.js.map +1 -0
- package/build/components/Menu/Menu.js +73 -0
- package/build/components/Menu/Menu.js.map +1 -0
- package/build/components/Menu/Menu.module.css +50 -0
- package/build/components/Menu/__tests__/__snapshots__/Menu.test.jsx.snap +178 -0
- package/build/components/Menu/index.js +19 -0
- package/build/components/Menu/index.js.map +1 -0
- package/build/components/Modal/Modal.js +61 -0
- package/build/components/Modal/Modal.js.map +1 -0
- package/build/components/Modal/Modal.module.css +72 -0
- package/build/components/Modal/__tests__/__snapshots__/Modal.test.js.snap +150 -0
- package/build/components/Modal/index.js +19 -0
- package/build/components/Modal/index.js.map +1 -0
- package/build/components/Table/Table.Row.js +92 -0
- package/build/components/Table/Table.Row.js.map +1 -0
- package/build/components/Table/Table.js +119 -0
- package/build/components/Table/Table.js.map +1 -0
- package/build/components/Table/Table.module.css +78 -0
- package/build/components/Table/__tests__/__snapshots__/Table.test.js.snap +2285 -0
- package/build/components/Table/helpers/index.js +19 -0
- package/build/components/Table/helpers/index.js.map +1 -0
- package/build/components/Table/helpers/select.js +29 -0
- package/build/components/Table/helpers/select.js.map +1 -0
- package/build/components/Table/index.js +19 -0
- package/build/components/Table/index.js.map +1 -0
- package/build/components/Tooltip/Tooltip.js +95 -0
- package/build/components/Tooltip/Tooltip.js.map +1 -0
- package/build/components/Tooltip/Tooltip.module.css +26 -0
- package/build/components/Tooltip/__tests__/__snapshots__/Tooltip.test.jsx.snap +117 -0
- package/build/components/Tooltip/index.js +19 -0
- package/build/components/Tooltip/index.js.map +1 -0
- package/build/components/index.js +149 -0
- package/build/components/index.js.map +1 -0
- package/build/helpers/getInputErrors.js +45 -0
- package/build/helpers/getInputErrors.js.map +1 -0
- package/build/helpers/index.js +32 -0
- package/build/helpers/index.js.map +1 -0
- package/build/helpers/isValidDate.js +72 -0
- package/build/helpers/isValidDate.js.map +1 -0
- package/build/helpers/isValidEmail.js +15 -0
- package/build/helpers/isValidEmail.js.map +1 -0
- package/build/helpers/isValidPhone.js +25 -0
- package/build/helpers/isValidPhone.js.map +1 -0
- package/build/helpers/styles.js +21 -0
- package/build/helpers/styles.js.map +1 -0
- package/build/hooks/helpers/getNavigator.js +33 -0
- package/build/hooks/helpers/getNavigator.js.map +1 -0
- package/build/hooks/helpers/getResolution.js +22 -0
- package/build/hooks/helpers/getResolution.js.map +1 -0
- package/build/hooks/helpers/index.js +32 -0
- package/build/hooks/helpers/index.js.map +1 -0
- package/build/hooks/index.js +19 -0
- package/build/hooks/index.js.map +1 -0
- package/build/hooks/useDevice.js +60 -0
- package/build/hooks/useDevice.js.map +1 -0
- package/build/index.js +71 -0
- package/build/index.js.map +1 -0
- package/build/primitives/Checkbox/Checkbox.js +66 -0
- package/build/primitives/Checkbox/Checkbox.js.map +1 -0
- package/build/primitives/Checkbox/Checkbox.module.css +45 -0
- package/build/primitives/Checkbox/__tests__/__snapshots__/Checkbox.test.js.snap +127 -0
- package/build/primitives/Checkbox/index.js +19 -0
- package/build/primitives/Checkbox/index.js.map +1 -0
- package/build/primitives/Icon/Icon.constants.js +30 -0
- package/build/primitives/Icon/Icon.constants.js.map +1 -0
- package/build/primitives/Icon/Icon.js +46 -0
- package/build/primitives/Icon/Icon.js.map +1 -0
- package/build/primitives/Icon/Icon.module.css +11 -0
- package/build/primitives/Icon/__tests__/__snapshots__/Icon.test.js.snap +133 -0
- package/build/primitives/Icon/index.js +31 -0
- package/build/primitives/Icon/index.js.map +1 -0
- package/build/primitives/Input/Input.js +85 -0
- package/build/primitives/Input/Input.js.map +1 -0
- package/build/primitives/Input/Input.module.css +32 -0
- package/build/primitives/Input/__tests__/__snapshots__/Input.test.js.snap +74 -0
- package/build/primitives/Input/helpers/index.js +19 -0
- package/build/primitives/Input/helpers/index.js.map +1 -0
- package/build/primitives/Input/helpers/parseValue.js +17 -0
- package/build/primitives/Input/helpers/parseValue.js.map +1 -0
- package/build/primitives/Input/index.js +19 -0
- package/build/primitives/Input/index.js.map +1 -0
- package/build/primitives/Layer/Layer.js +115 -0
- package/build/primitives/Layer/Layer.js.map +1 -0
- package/build/primitives/Layer/Layer.module.css +10 -0
- package/build/primitives/Layer/LayerContent.js +22 -0
- package/build/primitives/Layer/LayerContent.js.map +1 -0
- package/build/primitives/Layer/__tests__/__snapshots__/Layer.test.js.snap +89 -0
- package/build/primitives/Layer/helpers/getElementLayout.js +23 -0
- package/build/primitives/Layer/helpers/getElementLayout.js.map +1 -0
- package/build/primitives/Layer/helpers/getLayerPosition.js +45 -0
- package/build/primitives/Layer/helpers/getLayerPosition.js.map +1 -0
- package/build/primitives/Layer/helpers/index.js +32 -0
- package/build/primitives/Layer/helpers/index.js.map +1 -0
- package/build/primitives/Layer/index.js +32 -0
- package/build/primitives/Layer/index.js.map +1 -0
- package/build/primitives/Pressable/Pressable.constants.js +9 -0
- package/build/primitives/Pressable/Pressable.constants.js.map +1 -0
- package/build/primitives/Pressable/Pressable.js +67 -0
- package/build/primitives/Pressable/Pressable.js.map +1 -0
- package/build/primitives/Pressable/Pressable.module.css +18 -0
- package/build/primitives/Pressable/__tests__/__snapshots__/Pressable.test.js.snap +53 -0
- package/build/primitives/Pressable/index.js +19 -0
- package/build/primitives/Pressable/index.js.map +1 -0
- package/build/primitives/Radio/Radio.js +62 -0
- package/build/primitives/Radio/Radio.js.map +1 -0
- package/build/primitives/Radio/Radio.module.css +60 -0
- package/build/primitives/Radio/__tests__/__snapshots__/Radio.test.js.snap +125 -0
- package/build/primitives/Radio/index.js +19 -0
- package/build/primitives/Radio/index.js.map +1 -0
- package/build/primitives/ScrollView/ScrollView.js +112 -0
- package/build/primitives/ScrollView/ScrollView.js.map +1 -0
- package/build/primitives/ScrollView/ScrollView.module.css +35 -0
- package/build/primitives/ScrollView/__tests__/__snapshots__/ScrollView.test.js.snap +535 -0
- package/build/primitives/ScrollView/index.js +19 -0
- package/build/primitives/ScrollView/index.js.map +1 -0
- package/build/primitives/Select/Select.js +95 -0
- package/build/primitives/Select/Select.js.map +1 -0
- package/build/primitives/Select/Select.module.css +27 -0
- package/build/primitives/Select/__tests__/__snapshots__/Select.test.js.snap +178 -0
- package/build/primitives/Select/index.js +19 -0
- package/build/primitives/Select/index.js.map +1 -0
- package/build/primitives/Switch/Switch.js +60 -0
- package/build/primitives/Switch/Switch.js.map +1 -0
- package/build/primitives/Switch/Switch.module.css +65 -0
- package/build/primitives/Switch/__tests__/__snapshots__/Switch.test.js.snap +104 -0
- package/build/primitives/Switch/index.js +19 -0
- package/build/primitives/Switch/index.js.map +1 -0
- package/build/primitives/Text/Text.js +57 -0
- package/build/primitives/Text/Text.js.map +1 -0
- package/build/primitives/Text/Text.module.css +33 -0
- package/build/primitives/Text/__tests__/__snapshots__/Text.test.js.snap +92 -0
- package/build/primitives/Text/index.js +19 -0
- package/build/primitives/Text/index.js.map +1 -0
- package/build/primitives/View/View.js +52 -0
- package/build/primitives/View/View.js.map +1 -0
- package/build/primitives/View/View.module.css +17 -0
- package/build/primitives/View/__tests__/__snapshots__/View.test.js.snap +62 -0
- package/build/primitives/View/index.js +19 -0
- package/build/primitives/View/index.js.map +1 -0
- package/build/primitives/index.js +149 -0
- package/build/primitives/index.js.map +1 -0
- package/build/theme/default.theme.css +55 -0
- package/build/theme/helpers/camelcase.js +16 -0
- package/build/theme/helpers/camelcase.js.map +1 -0
- package/build/theme/helpers/index.js +19 -0
- package/build/theme/helpers/index.js.map +1 -0
- package/build/theme/index.js +19 -0
- package/build/theme/index.js.map +1 -0
- package/build/theme/theme.js +53 -0
- package/build/theme/theme.js.map +1 -0
- package/package.json +3 -1
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isValidDate = void 0;
|
|
7
|
+
|
|
8
|
+
var _locale = require("@mirai/locale");
|
|
9
|
+
|
|
10
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
11
|
+
|
|
12
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
13
|
+
|
|
14
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
15
|
+
|
|
16
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
17
|
+
|
|
18
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
19
|
+
|
|
20
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
21
|
+
|
|
22
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
23
|
+
|
|
24
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
25
|
+
|
|
26
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
27
|
+
|
|
28
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
29
|
+
|
|
30
|
+
var getDateProps = function getDateProps() {
|
|
31
|
+
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
32
|
+
return value.split('/').map(function (part) {
|
|
33
|
+
return part ? parseInt(part, 10) : undefined;
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
var createDate = function createDate(year, month, day) {
|
|
38
|
+
return (0, _locale.UTC)(new Date(year, month - 1, day, 12, 0, 0));
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
var isValidDate = function isValidDate() {
|
|
42
|
+
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
43
|
+
|
|
44
|
+
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
45
|
+
min = _ref.min,
|
|
46
|
+
max = _ref.max;
|
|
47
|
+
|
|
48
|
+
var _getDateProps = getDateProps(value),
|
|
49
|
+
_getDateProps2 = _slicedToArray(_getDateProps, 3),
|
|
50
|
+
year = _getDateProps2[0],
|
|
51
|
+
month = _getDateProps2[1],
|
|
52
|
+
day = _getDateProps2[2];
|
|
53
|
+
|
|
54
|
+
if (!year || !month || !day) return false;
|
|
55
|
+
var date = createDate(year, month, day);
|
|
56
|
+
var isValid = parseInt(year, 10) === date.getFullYear() && parseInt(month, 10) === date.getMonth() + 1 && parseInt(day, 10) === date.getDate();
|
|
57
|
+
var inRange = true;
|
|
58
|
+
|
|
59
|
+
if (min || max) {
|
|
60
|
+
var minTs = min ? (0, _locale.UTC)(new Date(createDate.apply(void 0, _toConsumableArray(getDateProps(min))))) : undefined;
|
|
61
|
+
var maxTs = max ? (0, _locale.UTC)(new Date(createDate.apply(void 0, _toConsumableArray(getDateProps(max))))) : undefined;
|
|
62
|
+
var dateTs = date.getTime();
|
|
63
|
+
var inMinRange = minTs ? dateTs >= minTs : true;
|
|
64
|
+
var inMaxRange = maxTs ? dateTs <= maxTs : true;
|
|
65
|
+
inRange = inMinRange && inMaxRange;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return isValid && inRange;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
exports.isValidDate = isValidDate;
|
|
72
|
+
//# sourceMappingURL=isValidDate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isValidDate.js","names":["getDateProps","value","split","map","part","parseInt","undefined","createDate","year","month","day","Date","isValidDate","min","max","date","isValid","getFullYear","getMonth","getDate","inRange","minTs","maxTs","dateTs","getTime","inMinRange","inMaxRange"],"sources":["../../src/helpers/isValidDate.js"],"sourcesContent":["import { UTC } from '@mirai/locale';\n\nconst getDateProps = (value = '') => value.split('/').map((part) => (part ? parseInt(part, 10) : undefined));\n\nconst createDate = (year, month, day) => UTC(new Date(year, month - 1, day, 12, 0, 0));\n\nexport const isValidDate = (value = '', { min, max } = {}) => {\n const [year, month, day] = getDateProps(value);\n if (!year || !month || !day) return false;\n\n const date = createDate(year, month, day);\n\n const isValid =\n parseInt(year, 10) === date.getFullYear() &&\n parseInt(month, 10) === date.getMonth() + 1 &&\n parseInt(day, 10) === date.getDate();\n\n let inRange = true;\n if (min || max) {\n const minTs = min ? UTC(new Date(createDate(...getDateProps(min)))) : undefined;\n const maxTs = max ? UTC(new Date(createDate(...getDateProps(max)))) : undefined;\n const dateTs = date.getTime();\n\n const inMinRange = minTs ? dateTs >= minTs : true;\n const inMaxRange = maxTs ? dateTs <= maxTs : true;\n\n inRange = inMinRange && inMaxRange;\n }\n\n return isValid && inRange;\n};\n"],"mappings":";;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAMA,YAAY,GAAG,SAAfA,YAAe;EAAA,IAACC,KAAD,uEAAS,EAAT;EAAA,OAAgBA,KAAK,CAACC,KAAN,CAAY,GAAZ,EAAiBC,GAAjB,CAAqB,UAACC,IAAD;IAAA,OAAWA,IAAI,GAAGC,QAAQ,CAACD,IAAD,EAAO,EAAP,CAAX,GAAwBE,SAAvC;EAAA,CAArB,CAAhB;AAAA,CAArB;;AAEA,IAAMC,UAAU,GAAG,SAAbA,UAAa,CAACC,IAAD,EAAOC,KAAP,EAAcC,GAAd;EAAA,OAAsB,iBAAI,IAAIC,IAAJ,CAASH,IAAT,EAAeC,KAAK,GAAG,CAAvB,EAA0BC,GAA1B,EAA+B,EAA/B,EAAmC,CAAnC,EAAsC,CAAtC,CAAJ,CAAtB;AAAA,CAAnB;;AAEO,IAAME,WAAW,GAAG,SAAdA,WAAc,GAAmC;EAAA,IAAlCX,KAAkC,uEAA1B,EAA0B;;EAAA,+EAAP,EAAO;EAAA,IAApBY,GAAoB,QAApBA,GAAoB;EAAA,IAAfC,GAAe,QAAfA,GAAe;;EAC5D,oBAA2Bd,YAAY,CAACC,KAAD,CAAvC;EAAA;EAAA,IAAOO,IAAP;EAAA,IAAaC,KAAb;EAAA,IAAoBC,GAApB;;EACA,IAAI,CAACF,IAAD,IAAS,CAACC,KAAV,IAAmB,CAACC,GAAxB,EAA6B,OAAO,KAAP;EAE7B,IAAMK,IAAI,GAAGR,UAAU,CAACC,IAAD,EAAOC,KAAP,EAAcC,GAAd,CAAvB;EAEA,IAAMM,OAAO,GACXX,QAAQ,CAACG,IAAD,EAAO,EAAP,CAAR,KAAuBO,IAAI,CAACE,WAAL,EAAvB,IACAZ,QAAQ,CAACI,KAAD,EAAQ,EAAR,CAAR,KAAwBM,IAAI,CAACG,QAAL,KAAkB,CAD1C,IAEAb,QAAQ,CAACK,GAAD,EAAM,EAAN,CAAR,KAAsBK,IAAI,CAACI,OAAL,EAHxB;EAKA,IAAIC,OAAO,GAAG,IAAd;;EACA,IAAIP,GAAG,IAAIC,GAAX,EAAgB;IACd,IAAMO,KAAK,GAAGR,GAAG,GAAG,iBAAI,IAAIF,IAAJ,CAASJ,UAAU,MAAV,4BAAcP,YAAY,CAACa,GAAD,CAA1B,EAAT,CAAJ,CAAH,GAAqDP,SAAtE;IACA,IAAMgB,KAAK,GAAGR,GAAG,GAAG,iBAAI,IAAIH,IAAJ,CAASJ,UAAU,MAAV,4BAAcP,YAAY,CAACc,GAAD,CAA1B,EAAT,CAAJ,CAAH,GAAqDR,SAAtE;IACA,IAAMiB,MAAM,GAAGR,IAAI,CAACS,OAAL,EAAf;IAEA,IAAMC,UAAU,GAAGJ,KAAK,GAAGE,MAAM,IAAIF,KAAb,GAAqB,IAA7C;IACA,IAAMK,UAAU,GAAGJ,KAAK,GAAGC,MAAM,IAAID,KAAb,GAAqB,IAA7C;IAEAF,OAAO,GAAGK,UAAU,IAAIC,UAAxB;EACD;;EAED,OAAOV,OAAO,IAAII,OAAlB;AACD,CAxBM"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isValidEmail = void 0;
|
|
7
|
+
var REGEXP = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; // eslint-disable-line
|
|
8
|
+
|
|
9
|
+
var isValidEmail = function isValidEmail() {
|
|
10
|
+
var email = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
11
|
+
return email !== '' ? REGEXP.test(email) : true;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
exports.isValidEmail = isValidEmail;
|
|
15
|
+
//# sourceMappingURL=isValidEmail.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isValidEmail.js","names":["REGEXP","isValidEmail","email","test"],"sources":["../../src/helpers/isValidEmail.js"],"sourcesContent":["const REGEXP = /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/; // eslint-disable-line\n\nexport const isValidEmail = (email = '') => (email !== '' ? REGEXP.test(email) : true);\n"],"mappings":";;;;;;AAAA,IAAMA,MAAM,GAAG,yJAAf,C,CAA0K;;AAEnK,IAAMC,YAAY,GAAG,SAAfA,YAAe;EAAA,IAACC,KAAD,uEAAS,EAAT;EAAA,OAAiBA,KAAK,KAAK,EAAV,GAAeF,MAAM,CAACG,IAAP,CAAYD,KAAZ,CAAf,GAAoC,IAArD;AAAA,CAArB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isValidPhone = void 0;
|
|
7
|
+
|
|
8
|
+
var isValidPhone = function isValidPhone() {
|
|
9
|
+
var phone = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
10
|
+
|
|
11
|
+
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
12
|
+
_ref$countryCode = _ref.countryCode,
|
|
13
|
+
countryCode = _ref$countryCode === void 0 ? false : _ref$countryCode;
|
|
14
|
+
|
|
15
|
+
if (phone === '') return true;
|
|
16
|
+
var minLength = countryCode ? 10 : 8;
|
|
17
|
+
|
|
18
|
+
var _phone$replace = phone.replace(/\D/g, ''),
|
|
19
|
+
length = _phone$replace.length;
|
|
20
|
+
|
|
21
|
+
return length >= minLength && length <= 15;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
exports.isValidPhone = isValidPhone;
|
|
25
|
+
//# sourceMappingURL=isValidPhone.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isValidPhone.js","names":["isValidPhone","phone","countryCode","minLength","replace","length"],"sources":["../../src/helpers/isValidPhone.js"],"sourcesContent":["export const isValidPhone = (phone = '', { countryCode = false } = {}) => {\n if (phone === '') return true;\n const minLength = countryCode ? 10 : 8;\n\n const { length } = phone.replace(/\\D/g, '');\n return length >= minLength && length <= 15;\n};\n"],"mappings":";;;;;;;AAAO,IAAMA,YAAY,GAAG,SAAfA,YAAe,GAA8C;EAAA,IAA7CC,KAA6C,uEAArC,EAAqC;;EAAA,+EAAP,EAAO;EAAA,4BAA/BC,WAA+B;EAAA,IAA/BA,WAA+B,iCAAjB,KAAiB;;EACxE,IAAID,KAAK,KAAK,EAAd,EAAkB,OAAO,IAAP;EAClB,IAAME,SAAS,GAAGD,WAAW,GAAG,EAAH,GAAQ,CAArC;;EAEA,qBAAmBD,KAAK,CAACG,OAAN,CAAc,KAAd,EAAqB,EAArB,CAAnB;EAAA,IAAQC,MAAR,kBAAQA,MAAR;;EACA,OAAOA,MAAM,IAAIF,SAAV,IAAuBE,MAAM,IAAI,EAAxC;AACD,CANM"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.styles = void 0;
|
|
7
|
+
|
|
8
|
+
var styles = function styles() {
|
|
9
|
+
for (var _len = arguments.length, stylesheets = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
10
|
+
stylesheets[_key] = arguments[_key];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return stylesheets.flat(Infinity).filter(function (value) {
|
|
14
|
+
return value !== false;
|
|
15
|
+
}).filter(function (value) {
|
|
16
|
+
return value !== undefined && value !== null;
|
|
17
|
+
}).join(' ').trim();
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
exports.styles = styles;
|
|
21
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","names":["styles","stylesheets","flat","Infinity","filter","value","undefined","join","trim"],"sources":["../../src/helpers/styles.js"],"sourcesContent":["export const styles = (...stylesheets) =>\n stylesheets\n .flat(Infinity)\n .filter((value) => value !== false)\n .filter((value) => value !== undefined && value !== null)\n .join(' ')\n .trim();\n"],"mappings":";;;;;;;AAAO,IAAMA,MAAM,GAAG,SAATA,MAAS;EAAA,kCAAIC,WAAJ;IAAIA,WAAJ;EAAA;;EAAA,OACpBA,WAAW,CACRC,IADH,CACQC,QADR,EAEGC,MAFH,CAEU,UAACC,KAAD;IAAA,OAAWA,KAAK,KAAK,KAArB;EAAA,CAFV,EAGGD,MAHH,CAGU,UAACC,KAAD;IAAA,OAAWA,KAAK,KAAKC,SAAV,IAAuBD,KAAK,KAAK,IAA5C;EAAA,CAHV,EAIGE,IAJH,CAIQ,GAJR,EAKGC,IALH,EADoB;AAAA,CAAf"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getNavigator = void 0;
|
|
7
|
+
var MATCH_SAFARI = /^((?!chrome|android).)*safari/i;
|
|
8
|
+
var MATCH_MOBILE = /^Mobile|iP(hone|od|ad)|Android|BlackBerry|IEMobile/i;
|
|
9
|
+
var FB_IN_APP = /fb_iab|fban/;
|
|
10
|
+
var PINTEREST_IN_APP = /pinterest/;
|
|
11
|
+
|
|
12
|
+
var getNavigator = function getNavigator() {
|
|
13
|
+
var _ref = typeof navigator !== 'undefined' ? navigator : {},
|
|
14
|
+
_ref$userAgent = _ref.userAgent,
|
|
15
|
+
userAgent = _ref$userAgent === void 0 ? '' : _ref$userAgent;
|
|
16
|
+
|
|
17
|
+
var ua = userAgent.toLowerCase();
|
|
18
|
+
var safari = Boolean(ua.match(MATCH_SAFARI));
|
|
19
|
+
return {
|
|
20
|
+
userAgent: userAgent,
|
|
21
|
+
// browsers
|
|
22
|
+
chrome: !safari && Boolean(ua.indexOf('chrome') !== -1),
|
|
23
|
+
firefox: Boolean(ua.indexOf('firefox') !== -1),
|
|
24
|
+
inApp: FB_IN_APP.test(ua) || PINTEREST_IN_APP.test(ua),
|
|
25
|
+
mobile: Boolean(ua.match(MATCH_MOBILE)),
|
|
26
|
+
safari: safari,
|
|
27
|
+
// touch
|
|
28
|
+
touch: /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Mobile|mobile|CriOS/i.test(userAgent)
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
exports.getNavigator = getNavigator;
|
|
33
|
+
//# sourceMappingURL=getNavigator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getNavigator.js","names":["MATCH_SAFARI","MATCH_MOBILE","FB_IN_APP","PINTEREST_IN_APP","getNavigator","navigator","userAgent","ua","toLowerCase","safari","Boolean","match","chrome","indexOf","firefox","inApp","test","mobile","touch"],"sources":["../../../src/hooks/helpers/getNavigator.js"],"sourcesContent":["const MATCH_SAFARI = /^((?!chrome|android).)*safari/i;\nconst MATCH_MOBILE = /^Mobile|iP(hone|od|ad)|Android|BlackBerry|IEMobile/i;\nconst FB_IN_APP = /fb_iab|fban/;\nconst PINTEREST_IN_APP = /pinterest/;\n\nexport const getNavigator = () => {\n const { userAgent = '' } = typeof navigator !== 'undefined' ? navigator : {};\n\n const ua = userAgent.toLowerCase();\n const safari = Boolean(ua.match(MATCH_SAFARI));\n\n return {\n userAgent,\n // browsers\n chrome: !safari && Boolean(ua.indexOf('chrome') !== -1),\n firefox: Boolean(ua.indexOf('firefox') !== -1),\n inApp: FB_IN_APP.test(ua) || PINTEREST_IN_APP.test(ua),\n mobile: Boolean(ua.match(MATCH_MOBILE)),\n safari,\n // touch\n touch: /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Mobile|mobile|CriOS/i.test(userAgent),\n };\n};\n"],"mappings":";;;;;;AAAA,IAAMA,YAAY,GAAG,gCAArB;AACA,IAAMC,YAAY,GAAG,qDAArB;AACA,IAAMC,SAAS,GAAG,aAAlB;AACA,IAAMC,gBAAgB,GAAG,WAAzB;;AAEO,IAAMC,YAAY,GAAG,SAAfA,YAAe,GAAM;EAChC,WAA2B,OAAOC,SAAP,KAAqB,WAArB,GAAmCA,SAAnC,GAA+C,EAA1E;EAAA,0BAAQC,SAAR;EAAA,IAAQA,SAAR,+BAAoB,EAApB;;EAEA,IAAMC,EAAE,GAAGD,SAAS,CAACE,WAAV,EAAX;EACA,IAAMC,MAAM,GAAGC,OAAO,CAACH,EAAE,CAACI,KAAH,CAASX,YAAT,CAAD,CAAtB;EAEA,OAAO;IACLM,SAAS,EAATA,SADK;IAEL;IACAM,MAAM,EAAE,CAACH,MAAD,IAAWC,OAAO,CAACH,EAAE,CAACM,OAAH,CAAW,QAAX,MAAyB,CAAC,CAA3B,CAHrB;IAILC,OAAO,EAAEJ,OAAO,CAACH,EAAE,CAACM,OAAH,CAAW,SAAX,MAA0B,CAAC,CAA5B,CAJX;IAKLE,KAAK,EAAEb,SAAS,CAACc,IAAV,CAAeT,EAAf,KAAsBJ,gBAAgB,CAACa,IAAjB,CAAsBT,EAAtB,CALxB;IAMLU,MAAM,EAAEP,OAAO,CAACH,EAAE,CAACI,KAAH,CAASV,YAAT,CAAD,CANV;IAOLQ,MAAM,EAANA,MAPK;IAQL;IACAS,KAAK,EAAE,qFAAqFF,IAArF,CAA0FV,SAA1F;EATF,CAAP;AAWD,CAjBM"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getResolution = void 0;
|
|
7
|
+
|
|
8
|
+
var getResolution = function getResolution() {
|
|
9
|
+
var _ref = window || {},
|
|
10
|
+
_ref$innerHeight = _ref.innerHeight,
|
|
11
|
+
height = _ref$innerHeight === void 0 ? 0 : _ref$innerHeight,
|
|
12
|
+
_ref$innerWidth = _ref.innerWidth,
|
|
13
|
+
width = _ref$innerWidth === void 0 ? 0 : _ref$innerWidth;
|
|
14
|
+
|
|
15
|
+
return {
|
|
16
|
+
height: height,
|
|
17
|
+
width: width
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
exports.getResolution = getResolution;
|
|
22
|
+
//# sourceMappingURL=getResolution.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getResolution.js","names":["getResolution","window","innerHeight","height","innerWidth","width"],"sources":["../../../src/hooks/helpers/getResolution.js"],"sourcesContent":["export const getResolution = () => {\n const { innerHeight: height = 0, innerWidth: width = 0 } = window || {};\n\n return { height, width };\n};\n"],"mappings":";;;;;;;AAAO,IAAMA,aAAa,GAAG,SAAhBA,aAAgB,GAAM;EACjC,WAA2DC,MAAM,IAAI,EAArE;EAAA,4BAAQC,WAAR;EAAA,IAAqBC,MAArB,iCAA8B,CAA9B;EAAA,2BAAiCC,UAAjC;EAAA,IAA6CC,KAA7C,gCAAqD,CAArD;;EAEA,OAAO;IAAEF,MAAM,EAANA,MAAF;IAAUE,KAAK,EAALA;EAAV,CAAP;AACD,CAJM"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _getResolution = require("./getResolution");
|
|
8
|
+
|
|
9
|
+
Object.keys(_getResolution).forEach(function (key) {
|
|
10
|
+
if (key === "default" || key === "__esModule") return;
|
|
11
|
+
if (key in exports && exports[key] === _getResolution[key]) return;
|
|
12
|
+
Object.defineProperty(exports, key, {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _getResolution[key];
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
var _getNavigator = require("./getNavigator");
|
|
21
|
+
|
|
22
|
+
Object.keys(_getNavigator).forEach(function (key) {
|
|
23
|
+
if (key === "default" || key === "__esModule") return;
|
|
24
|
+
if (key in exports && exports[key] === _getNavigator[key]) return;
|
|
25
|
+
Object.defineProperty(exports, key, {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function get() {
|
|
28
|
+
return _getNavigator[key];
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/hooks/helpers/index.js"],"sourcesContent":["export * from './getResolution';\nexport * from './getNavigator';\n"],"mappings":";;;;;;AAAA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _useDevice = require("./useDevice");
|
|
8
|
+
|
|
9
|
+
Object.keys(_useDevice).forEach(function (key) {
|
|
10
|
+
if (key === "default" || key === "__esModule") return;
|
|
11
|
+
if (key in exports && exports[key] === _useDevice[key]) return;
|
|
12
|
+
Object.defineProperty(exports, key, {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _useDevice[key];
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/hooks/index.js"],"sourcesContent":["export * from './useDevice';\n"],"mappings":";;;;;;AAAA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useDevice = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
|
|
10
|
+
var _helpers = require("./helpers");
|
|
11
|
+
|
|
12
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
13
|
+
|
|
14
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
15
|
+
|
|
16
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
17
|
+
|
|
18
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
19
|
+
|
|
20
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
21
|
+
|
|
22
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
23
|
+
|
|
24
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
25
|
+
|
|
26
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
27
|
+
|
|
28
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
29
|
+
|
|
30
|
+
var useDevice = function useDevice() {
|
|
31
|
+
var _useState = (0, _react.useState)((0, _helpers.getResolution)()),
|
|
32
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
33
|
+
resolution = _useState2[0],
|
|
34
|
+
setResolution = _useState2[1];
|
|
35
|
+
|
|
36
|
+
(0, _react.useEffect)(function () {
|
|
37
|
+
var handleResize = function handleResize() {
|
|
38
|
+
return setResolution((0, _helpers.getResolution)());
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
window.addEventListener('resize', handleResize);
|
|
42
|
+
return function () {
|
|
43
|
+
return window.removeEventListener('resize', handleResize);
|
|
44
|
+
};
|
|
45
|
+
}, []);
|
|
46
|
+
return (0, _react.useMemo)(function () {
|
|
47
|
+
var isLandscape = resolution.width >= resolution.height;
|
|
48
|
+
var isMobile = resolution.width < 512;
|
|
49
|
+
var navigator = (0, _helpers.getNavigator)();
|
|
50
|
+
return _objectSpread(_objectSpread(_objectSpread({}, resolution), navigator), {}, {
|
|
51
|
+
isLandscape: isLandscape,
|
|
52
|
+
isPortrait: !isLandscape,
|
|
53
|
+
isMobile: isMobile,
|
|
54
|
+
isDesktop: !isMobile
|
|
55
|
+
});
|
|
56
|
+
}, [resolution]);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
exports.useDevice = useDevice;
|
|
60
|
+
//# sourceMappingURL=useDevice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDevice.js","names":["useDevice","resolution","setResolution","handleResize","window","addEventListener","removeEventListener","isLandscape","width","height","isMobile","navigator","isPortrait","isDesktop"],"sources":["../../src/hooks/useDevice.js"],"sourcesContent":["import { useEffect, useMemo, useState } from 'react';\n\nimport { getResolution, getNavigator } from './helpers';\n\nexport const useDevice = () => {\n const [resolution, setResolution] = useState(getResolution());\n\n useEffect(() => {\n const handleResize = () => setResolution(getResolution());\n\n window.addEventListener('resize', handleResize);\n\n return () => window.removeEventListener('resize', handleResize);\n }, []);\n\n return useMemo(() => {\n const isLandscape = resolution.width >= resolution.height;\n const isMobile = resolution.width < 512;\n const navigator = getNavigator();\n\n return {\n ...resolution,\n ...navigator,\n isLandscape,\n isPortrait: !isLandscape,\n isMobile,\n isDesktop: !isMobile,\n };\n }, [resolution]);\n};\n"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;;;;;;;;;;;;;;;AAEO,IAAMA,SAAS,GAAG,SAAZA,SAAY,GAAM;EAC7B,gBAAoC,qBAAS,6BAAT,CAApC;EAAA;EAAA,IAAOC,UAAP;EAAA,IAAmBC,aAAnB;;EAEA,sBAAU,YAAM;IACd,IAAMC,YAAY,GAAG,SAAfA,YAAe;MAAA,OAAMD,aAAa,CAAC,6BAAD,CAAnB;IAAA,CAArB;;IAEAE,MAAM,CAACC,gBAAP,CAAwB,QAAxB,EAAkCF,YAAlC;IAEA,OAAO;MAAA,OAAMC,MAAM,CAACE,mBAAP,CAA2B,QAA3B,EAAqCH,YAArC,CAAN;IAAA,CAAP;EACD,CAND,EAMG,EANH;EAQA,OAAO,oBAAQ,YAAM;IACnB,IAAMI,WAAW,GAAGN,UAAU,CAACO,KAAX,IAAoBP,UAAU,CAACQ,MAAnD;IACA,IAAMC,QAAQ,GAAGT,UAAU,CAACO,KAAX,GAAmB,GAApC;IACA,IAAMG,SAAS,GAAG,4BAAlB;IAEA,qDACKV,UADL,GAEKU,SAFL;MAGEJ,WAAW,EAAXA,WAHF;MAIEK,UAAU,EAAE,CAACL,WAJf;MAKEG,QAAQ,EAARA,QALF;MAMEG,SAAS,EAAE,CAACH;IANd;EAQD,CAbM,EAaJ,CAACT,UAAD,CAbI,CAAP;AAcD,CAzBM"}
|
package/build/index.js
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _components = require("./components");
|
|
8
|
+
|
|
9
|
+
Object.keys(_components).forEach(function (key) {
|
|
10
|
+
if (key === "default" || key === "__esModule") return;
|
|
11
|
+
if (key in exports && exports[key] === _components[key]) return;
|
|
12
|
+
Object.defineProperty(exports, key, {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _components[key];
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
var _helpers = require("./helpers");
|
|
21
|
+
|
|
22
|
+
Object.keys(_helpers).forEach(function (key) {
|
|
23
|
+
if (key === "default" || key === "__esModule") return;
|
|
24
|
+
if (key in exports && exports[key] === _helpers[key]) return;
|
|
25
|
+
Object.defineProperty(exports, key, {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function get() {
|
|
28
|
+
return _helpers[key];
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
var _hooks = require("./hooks");
|
|
34
|
+
|
|
35
|
+
Object.keys(_hooks).forEach(function (key) {
|
|
36
|
+
if (key === "default" || key === "__esModule") return;
|
|
37
|
+
if (key in exports && exports[key] === _hooks[key]) return;
|
|
38
|
+
Object.defineProperty(exports, key, {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
get: function get() {
|
|
41
|
+
return _hooks[key];
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
var _primitives = require("./primitives");
|
|
47
|
+
|
|
48
|
+
Object.keys(_primitives).forEach(function (key) {
|
|
49
|
+
if (key === "default" || key === "__esModule") return;
|
|
50
|
+
if (key in exports && exports[key] === _primitives[key]) return;
|
|
51
|
+
Object.defineProperty(exports, key, {
|
|
52
|
+
enumerable: true,
|
|
53
|
+
get: function get() {
|
|
54
|
+
return _primitives[key];
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
var _theme = require("./theme");
|
|
60
|
+
|
|
61
|
+
Object.keys(_theme).forEach(function (key) {
|
|
62
|
+
if (key === "default" || key === "__esModule") return;
|
|
63
|
+
if (key in exports && exports[key] === _theme[key]) return;
|
|
64
|
+
Object.defineProperty(exports, key, {
|
|
65
|
+
enumerable: true,
|
|
66
|
+
get: function get() {
|
|
67
|
+
return _theme[key];
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.js"],"sourcesContent":["export * from './components';\nexport * from './helpers';\nexport * from './hooks';\nexport * from './primitives';\nexport * from './theme';\n"],"mappings":";;;;;;AAAA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Checkbox = void 0;
|
|
7
|
+
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
|
|
12
|
+
var _helpers = require("../../helpers");
|
|
13
|
+
|
|
14
|
+
var _CheckboxModule = _interopRequireDefault(require("./Checkbox.module.css"));
|
|
15
|
+
|
|
16
|
+
var _excluded = ["checked", "children", "disabled", "name", "value", "onChange"];
|
|
17
|
+
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
+
|
|
20
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
21
|
+
|
|
22
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
23
|
+
|
|
24
|
+
var Checkbox = function Checkbox(_ref) {
|
|
25
|
+
var checked = _ref.checked,
|
|
26
|
+
children = _ref.children,
|
|
27
|
+
disabled = _ref.disabled,
|
|
28
|
+
name = _ref.name,
|
|
29
|
+
_ref$value = _ref.value,
|
|
30
|
+
value = _ref$value === void 0 ? '' : _ref$value,
|
|
31
|
+
onChange = _ref.onChange,
|
|
32
|
+
others = _objectWithoutProperties(_ref, _excluded);
|
|
33
|
+
|
|
34
|
+
var handleChange = function handleChange(event) {
|
|
35
|
+
var _event$target = event.target,
|
|
36
|
+
value = _event$target.value,
|
|
37
|
+
checked = _event$target.checked;
|
|
38
|
+
onChange && onChange(value, checked, event);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
42
|
+
className: (0, _helpers.styles)(_CheckboxModule.default.checkbox, others.className),
|
|
43
|
+
style: others.style
|
|
44
|
+
}, /*#__PURE__*/_react.default.createElement("input", {
|
|
45
|
+
checked: checked,
|
|
46
|
+
"data-testid": others['data-testid'],
|
|
47
|
+
disabled: disabled,
|
|
48
|
+
name: name,
|
|
49
|
+
type: "checkbox",
|
|
50
|
+
value: value,
|
|
51
|
+
className: (0, _helpers.styles)(checked && _CheckboxModule.default.checked),
|
|
52
|
+
onChange: !disabled ? handleChange : undefined
|
|
53
|
+
}), children);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
exports.Checkbox = Checkbox;
|
|
57
|
+
Checkbox.displayName = 'Primitive:Checkbox';
|
|
58
|
+
Checkbox.propTypes = {
|
|
59
|
+
checked: _propTypes.default.bool,
|
|
60
|
+
children: _propTypes.default.node,
|
|
61
|
+
disabled: _propTypes.default.bool,
|
|
62
|
+
name: _propTypes.default.string.isRequired,
|
|
63
|
+
value: _propTypes.default.string,
|
|
64
|
+
onChange: _propTypes.default.func
|
|
65
|
+
};
|
|
66
|
+
//# sourceMappingURL=Checkbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Checkbox.js","names":["Checkbox","checked","children","disabled","name","value","onChange","others","handleChange","event","target","style","checkbox","className","undefined","displayName","propTypes","PropTypes","bool","node","string","isRequired","func"],"sources":["../../../src/primitives/Checkbox/Checkbox.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\n\nimport { styles } from '../../helpers';\nimport style from './Checkbox.module.css';\n\nconst Checkbox = ({ checked, children, disabled, name, value = '', onChange, ...others }) => {\n const handleChange = (event) => {\n const {\n target: { value, checked },\n } = event;\n\n onChange && onChange(value, checked, event);\n };\n\n return (\n <div className={styles(style.checkbox, others.className)} style={others.style}>\n <input\n checked={checked}\n data-testid={others['data-testid']}\n disabled={disabled}\n name={name}\n type=\"checkbox\"\n value={value}\n className={styles(checked && style.checked)}\n onChange={!disabled ? handleChange : undefined}\n />\n {children}\n </div>\n );\n};\n\nCheckbox.displayName = 'Primitive:Checkbox';\n\nCheckbox.propTypes = {\n checked: PropTypes.bool,\n children: PropTypes.node,\n disabled: PropTypes.bool,\n name: PropTypes.string.isRequired,\n value: PropTypes.string,\n onChange: PropTypes.func,\n};\n\nexport { Checkbox };\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;;;;;;;;;AAEA,IAAMA,QAAQ,GAAG,SAAXA,QAAW,OAA4E;EAAA,IAAzEC,OAAyE,QAAzEA,OAAyE;EAAA,IAAhEC,QAAgE,QAAhEA,QAAgE;EAAA,IAAtDC,QAAsD,QAAtDA,QAAsD;EAAA,IAA5CC,IAA4C,QAA5CA,IAA4C;EAAA,sBAAtCC,KAAsC;EAAA,IAAtCA,KAAsC,2BAA9B,EAA8B;EAAA,IAA1BC,QAA0B,QAA1BA,QAA0B;EAAA,IAAbC,MAAa;;EAC3F,IAAMC,YAAY,GAAG,SAAfA,YAAe,CAACC,KAAD,EAAW;IAC9B,oBAEIA,KAFJ,CACEC,MADF;IAAA,IACYL,KADZ,iBACYA,KADZ;IAAA,IACmBJ,OADnB,iBACmBA,OADnB;IAIAK,QAAQ,IAAIA,QAAQ,CAACD,KAAD,EAAQJ,OAAR,EAAiBQ,KAAjB,CAApB;EACD,CAND;;EAQA,oBACE;IAAK,SAAS,EAAE,qBAAOE,wBAAMC,QAAb,EAAuBL,MAAM,CAACM,SAA9B,CAAhB;IAA0D,KAAK,EAAEN,MAAM,CAACI;EAAxE,gBACE;IACE,OAAO,EAAEV,OADX;IAEE,eAAaM,MAAM,CAAC,aAAD,CAFrB;IAGE,QAAQ,EAAEJ,QAHZ;IAIE,IAAI,EAAEC,IAJR;IAKE,IAAI,EAAC,UALP;IAME,KAAK,EAAEC,KANT;IAOE,SAAS,EAAE,qBAAOJ,OAAO,IAAIU,wBAAMV,OAAxB,CAPb;IAQE,QAAQ,EAAE,CAACE,QAAD,GAAYK,YAAZ,GAA2BM;EARvC,EADF,EAWGZ,QAXH,CADF;AAeD,CAxBD;;;AA0BAF,QAAQ,CAACe,WAAT,GAAuB,oBAAvB;AAEAf,QAAQ,CAACgB,SAAT,GAAqB;EACnBf,OAAO,EAAEgB,mBAAUC,IADA;EAEnBhB,QAAQ,EAAEe,mBAAUE,IAFD;EAGnBhB,QAAQ,EAAEc,mBAAUC,IAHD;EAInBd,IAAI,EAAEa,mBAAUG,MAAV,CAAiBC,UAJJ;EAKnBhB,KAAK,EAAEY,mBAAUG,MALE;EAMnBd,QAAQ,EAAEW,mBAAUK;AAND,CAArB"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--mirai-ui-checkbox-base: var(--mirai-ui-base);
|
|
3
|
+
--mirai-ui-checkbox-border-color: var(--mirai-ui-content-400);
|
|
4
|
+
--mirai-ui-checkbox-border-radius: var(--mirai-ui-border-radius);
|
|
5
|
+
--mirai-ui-checkbox-checked: var(--mirai-ui-accent);
|
|
6
|
+
--mirai-ui-checkbox-disabled: var(--mirai-ui-content-300);
|
|
7
|
+
--mirai-ui-checkbox-size: var(--mirai-ui-space-L);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.checkbox {
|
|
11
|
+
cursor: pointer;
|
|
12
|
+
height: var(--mirai-ui-checkbox-size);
|
|
13
|
+
width: var(--mirai-ui-checkbox-size);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.checkbox input {
|
|
17
|
+
background-color: var(--mirai-ui-checkbox-base);
|
|
18
|
+
border: 1px solid var(--mirai-ui-checkbox-border-color);
|
|
19
|
+
border-radius: var(--mirai-ui-checkbox-border-radius);
|
|
20
|
+
box-sizing: border-box;
|
|
21
|
+
height: var(--mirai-ui-checkbox-size);
|
|
22
|
+
margin: 0;
|
|
23
|
+
outline: none;
|
|
24
|
+
transition: background-color var(--mirai-ui-motion-collapse) var(--mirai-ui-motion-easing),
|
|
25
|
+
border-color var(--mirai-ui-motion-collapse) var(--mirai-ui-motion-easing);
|
|
26
|
+
user-select: none;
|
|
27
|
+
width: var(--mirai-ui-checkbox-size);
|
|
28
|
+
|
|
29
|
+
appearance: none;
|
|
30
|
+
-webkit-appearance: none;
|
|
31
|
+
-moz-appearance: none;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.checkbox input:disabled {
|
|
35
|
+
border-color: var(--mirai-ui-checkbox-disabled);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.checkbox input:disabled.checked {
|
|
39
|
+
background-color: var(--mirai-ui-checkbox-disabled);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.checkbox input:not(:disabled).checked {
|
|
43
|
+
background-color: var(--mirai-ui-checkbox-checked);
|
|
44
|
+
border-color: var(--mirai-ui-checkbox-checked);
|
|
45
|
+
}
|