@mirai/ui 1.0.263 → 1.0.265
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/Form/Form.constants.js +1 -1
- package/build/components/Form/Form.constants.js.map +1 -1
- package/build/components/Form/Form.stories.js +6 -1
- package/build/components/Form/Form.stories.js.map +1 -1
- package/build/components/InputPhone/helpers/sanitizePrefixes.js +10 -1
- package/build/components/InputPhone/helpers/sanitizePrefixes.js.map +1 -1
- package/package.json +1 -1
|
@@ -10,6 +10,6 @@ var DEFAULT_TIMEOUT_ONERROR = 10;
|
|
|
10
10
|
exports.DEFAULT_TIMEOUT_ONERROR = DEFAULT_TIMEOUT_ONERROR;
|
|
11
11
|
var FIELDS_BOOLEAN = ['Component:InputOption', 'Primitive:Checkbox', 'Primitive:Radio', 'Primitive.Switch'];
|
|
12
12
|
exports.FIELDS_BOOLEAN = FIELDS_BOOLEAN;
|
|
13
|
-
var FIELDS_WITHOUT_ERROR = [
|
|
13
|
+
var FIELDS_WITHOUT_ERROR = ['Primitive:Radio', 'Component:InputNumber'];
|
|
14
14
|
exports.FIELDS_WITHOUT_ERROR = FIELDS_WITHOUT_ERROR;
|
|
15
15
|
//# sourceMappingURL=Form.constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Form.constants.js","names":["DEFAULT_TIMEOUT_ONCHANGE","DEFAULT_TIMEOUT_ONERROR","FIELDS_BOOLEAN","FIELDS_WITHOUT_ERROR"],"sources":["../../../src/components/Form/Form.constants.js"],"sourcesContent":["const DEFAULT_TIMEOUT_ONCHANGE = 0;\nconst DEFAULT_TIMEOUT_ONERROR = 10;\nconst FIELDS_BOOLEAN = ['Component:InputOption', 'Primitive:Checkbox', 'Primitive:Radio', 'Primitive.Switch'];\nconst FIELDS_WITHOUT_ERROR = [
|
|
1
|
+
{"version":3,"file":"Form.constants.js","names":["DEFAULT_TIMEOUT_ONCHANGE","DEFAULT_TIMEOUT_ONERROR","FIELDS_BOOLEAN","FIELDS_WITHOUT_ERROR"],"sources":["../../../src/components/Form/Form.constants.js"],"sourcesContent":["const DEFAULT_TIMEOUT_ONCHANGE = 0;\nconst DEFAULT_TIMEOUT_ONERROR = 10;\nconst FIELDS_BOOLEAN = ['Component:InputOption', 'Primitive:Checkbox', 'Primitive:Radio', 'Primitive.Switch'];\nconst FIELDS_WITHOUT_ERROR = ['Primitive:Radio', 'Component:InputNumber'];\n\nexport { DEFAULT_TIMEOUT_ONCHANGE, DEFAULT_TIMEOUT_ONERROR, FIELDS_BOOLEAN, FIELDS_WITHOUT_ERROR };\n"],"mappings":";;;;;;AAAA,IAAMA,wBAAwB,GAAG,CAAC;AAAC;AACnC,IAAMC,uBAAuB,GAAG,EAAE;AAAC;AACnC,IAAMC,cAAc,GAAG,CAAC,uBAAuB,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,kBAAkB,CAAC;AAAC;AAC9G,IAAMC,oBAAoB,GAAG,CAAC,iBAAiB,EAAE,uBAAuB,CAAC;AAAC"}
|
|
@@ -171,7 +171,12 @@ var Story = function Story(props) {
|
|
|
171
171
|
type: "checkbox",
|
|
172
172
|
name: "checkbox",
|
|
173
173
|
label: "checkbox",
|
|
174
|
-
checked: form.checkbox
|
|
174
|
+
checked: form.checkbox
|
|
175
|
+
}), /*#__PURE__*/_react.default.createElement(_.InputOption, {
|
|
176
|
+
type: "checkbox",
|
|
177
|
+
name: "checkboxRequired",
|
|
178
|
+
label: "checkbox",
|
|
179
|
+
checked: form.checkboxRequired,
|
|
175
180
|
required: true,
|
|
176
181
|
showRequired: true
|
|
177
182
|
}), /*#__PURE__*/_react.default.createElement(_.InputOption, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Form.stories.js","names":["title","Story","props","useState","condition","setCondition","email","checkbox","dateOfBirth","switch","radio","form","setForm","error","setError","useEffect","setTimeout","password","phone","handleChange","next","others","console","log","handleEnter","handleError","handleLeave","handleSubmit","value","includes","gender","undefined","bio","children","Array","from","keys","map","index","Object","length","justifyContent","marginTop","marginRight","storyName","args","debounce","schema","showErrors","validateOnMount","testId","style","argTypes"],"sources":["../../../src/components/Form/Form.stories.jsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\n\nimport { Button, InputDate, InputNumber, InputOption, InputPhone, InputText, InputSelect, Text, View } from '../../';\nimport { Form } from './Form';\n\nexport default { title: 'Components' };\n\nexport const Story = (props) => {\n const [condition, setCondition] = useState(false);\n const [form, setForm] = useState({\n email: 'javi@mirai.com',\n checkbox: true,\n dateOfBirth: '04/10/1980',\n switch: true,\n radio: 'radio-0',\n });\n const [error, setError] = useState({});\n\n useEffect(\n () =>\n setTimeout(() => {\n setForm({\n ...form,\n email: 'javi@hotmail.com',\n password: '1234567890',\n dateOfBirth: '',\n switch: false,\n phone: '+34 61570',\n radio: 'radio-1',\n });\n }, 1000),\n\n [],\n ); // * Simulate a state hydration\n\n const handleChange = (next, ...others) => {\n setForm(next);\n console.log('<Form>::onChange', next, ...others);\n };\n\n const handleEnter = (...others) => console.log('<Form>::onEnter', ...others);\n\n const handleError = (next, ...others) => {\n setError(next);\n console.log('<Form>::onError', next, ...others);\n };\n\n const handleLeave = (...others) => console.log('<Form>::onLeave', ...others);\n\n const handleSubmit = (...others) => console.log('<Form>::onSubmit', ...others);\n\n return (\n <>\n <Form\n {...props}\n onLeave={handleLeave}\n onChange={handleChange}\n onError={handleError}\n onEnter={handleEnter}\n onSubmit={handleSubmit}\n >\n <View row>\n <Text headline>Form component</Text>\n </View>\n\n <InputText\n name=\"email\"\n error={!!error.email}\n test={(value) => value.includes('@mirai.com')}\n label=\"Email\"\n hint=\"Should contains @mirai.com\"\n required\n showRequired\n type=\"email\"\n value={form.email}\n />\n <InputText\n name=\"password\"\n error={!!error.password}\n hint=\"At least 10 chars.\"\n label=\"Password\"\n required\n showRequired\n minLength={10}\n type=\"password\"\n value={form.password}\n />\n <InputSelect\n name=\"gender\"\n emptyOption=\"Select...\"\n error={!!error.gender}\n label=\"Your gender\"\n options={['one', 'two', 'three', 'four', 'five']}\n value={form.gender}\n required\n showRequired\n />\n <InputDate\n name=\"dateOfBirth\"\n error={!!error.dateOfBirth}\n label=\"Your birthdate\"\n max=\"31/12/2022\"\n min=\"10/04/1980\"\n required\n showRequired\n type=\"inputDate\"\n value={form.dateOfBirth}\n />\n <InputPhone\n name=\"phone\"\n emptyOption={!form.phone ? 'Select...' : undefined}\n error={!!error.phone}\n label=\"Phone\"\n labelPrefix=\"Prefix\"\n prefixes={['+34', '+44', '+001', '+999', '+39', '+56']}\n required\n showRequired\n type=\"inputPhone\"\n value={form.phone}\n />\n <InputText name=\"bio\" label=\"Bio\" multiLine value={form.bio} />\n <InputNumber name=\"children\" label=\"Children\" hint=\"Ages 0 - 17\" value={form.children} />\n <InputOption type=\"checkbox\" name=\"checkbox\" label=\"checkbox\" checked={form.checkbox} required showRequired />\n <InputOption type=\"switch\" name=\"switch\" label=\"switch\" checked={form.switch} />\n\n {Array.from(Array(3).keys()).map((index) => (\n <InputOption\n key={index}\n type=\"radio\"\n name=\"radio\"\n value={`radio-${index}`}\n label={`radio-${index}`}\n checked={form.radio === `radio-${index}`}\n />\n ))}\n {condition && <InputText label=\"condition\" name=\"condition\" />}\n\n <Button disabled={Object.keys(error).length !== 0} type=\"submit\" wide>\n Submit\n </Button>\n </Form>\n\n <View row style={{ justifyContent: 'flex-end', marginTop: 'var(--mirai-ui-space-L)' }}>\n <Button small secondary onPress={() => setForm({})} style={{ marginRight: 'var(--mirai-ui-space-M)' }}>\n Reset\n </Button>\n <Button small secondary onPress={() => setCondition(!condition)}>\n {`${condition ? 'Hide' : 'Show'} dynamic field`}\n </Button>\n </View>\n </>\n );\n};\n\nStory.storyName = 'Form';\n\nStory.args = {\n debounce: 0,\n schema: {},\n showErrors: false,\n validateOnMount: false,\n // inherited properties\n testId: 'test-story',\n style: {},\n};\n\nStory.argTypes = {};\n"],"mappings":";;;;;;;AAAA;AAEA;AACA;AAA8B;AAAA;AA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AAO,EAAE;MAAA,OAAM9B,OAAO,CAAC,CAAC,CAAC,CAAC;IAAA,CAAC;IAAC,KAAK,EAAE;MAAE+B,WAAW,EAAE;IAA0B;EAAE,WAE7F,eACT,6BAAC,QAAM;IAAC,KAAK;IAAC,SAAS;IAAC,OAAO,EAAE;MAAA,OAAMtC,YAAY,CAAC,CAACD,SAAS,CAAC;IAAA;EAAC,aAC1DA,SAAS,GAAG,MAAM,GAAG,MAAM,oBACxB,CACJ,CACN;AAEP,CAAC;AAAC;AAEFH,KAAK,CAAC2C,SAAS,GAAG,MAAM;AAExB3C,KAAK,CAAC4C,IAAI,GAAG;EACXC,QAAQ,EAAE,CAAC;EACXC,MAAM,EAAE,CAAC,CAAC;EACVC,UAAU,EAAE,KAAK;EACjBC,eAAe,EAAE,KAAK;EACtB;EACAC,MAAM,EAAE,YAAY;EACpBC,KAAK,EAAE,CAAC;AACV,CAAC;AAEDlD,KAAK,CAACmD,QAAQ,GAAG,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"Form.stories.js","names":["title","Story","props","useState","condition","setCondition","email","checkbox","dateOfBirth","switch","radio","form","setForm","error","setError","useEffect","setTimeout","password","phone","handleChange","next","others","console","log","handleEnter","handleError","handleLeave","handleSubmit","value","includes","gender","undefined","bio","children","checkboxRequired","Array","from","keys","map","index","Object","length","justifyContent","marginTop","marginRight","storyName","args","debounce","schema","showErrors","validateOnMount","testId","style","argTypes"],"sources":["../../../src/components/Form/Form.stories.jsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\n\nimport { Button, InputDate, InputNumber, InputOption, InputPhone, InputText, InputSelect, Text, View } from '../../';\nimport { Form } from './Form';\n\nexport default { title: 'Components' };\n\nexport const Story = (props) => {\n const [condition, setCondition] = useState(false);\n const [form, setForm] = useState({\n email: 'javi@mirai.com',\n checkbox: true,\n dateOfBirth: '04/10/1980',\n switch: true,\n radio: 'radio-0',\n });\n const [error, setError] = useState({});\n\n useEffect(\n () =>\n setTimeout(() => {\n setForm({\n ...form,\n email: 'javi@hotmail.com',\n password: '1234567890',\n dateOfBirth: '',\n switch: false,\n phone: '+34 61570',\n radio: 'radio-1',\n });\n }, 1000),\n\n [],\n ); // * Simulate a state hydration\n\n const handleChange = (next, ...others) => {\n setForm(next);\n console.log('<Form>::onChange', next, ...others);\n };\n\n const handleEnter = (...others) => console.log('<Form>::onEnter', ...others);\n\n const handleError = (next, ...others) => {\n setError(next);\n console.log('<Form>::onError', next, ...others);\n };\n\n const handleLeave = (...others) => console.log('<Form>::onLeave', ...others);\n\n const handleSubmit = (...others) => console.log('<Form>::onSubmit', ...others);\n\n return (\n <>\n <Form\n {...props}\n onLeave={handleLeave}\n onChange={handleChange}\n onError={handleError}\n onEnter={handleEnter}\n onSubmit={handleSubmit}\n >\n <View row>\n <Text headline>Form component</Text>\n </View>\n\n <InputText\n name=\"email\"\n error={!!error.email}\n test={(value) => value.includes('@mirai.com')}\n label=\"Email\"\n hint=\"Should contains @mirai.com\"\n required\n showRequired\n type=\"email\"\n value={form.email}\n />\n <InputText\n name=\"password\"\n error={!!error.password}\n hint=\"At least 10 chars.\"\n label=\"Password\"\n required\n showRequired\n minLength={10}\n type=\"password\"\n value={form.password}\n />\n <InputSelect\n name=\"gender\"\n emptyOption=\"Select...\"\n error={!!error.gender}\n label=\"Your gender\"\n options={['one', 'two', 'three', 'four', 'five']}\n value={form.gender}\n required\n showRequired\n />\n <InputDate\n name=\"dateOfBirth\"\n error={!!error.dateOfBirth}\n label=\"Your birthdate\"\n max=\"31/12/2022\"\n min=\"10/04/1980\"\n required\n showRequired\n type=\"inputDate\"\n value={form.dateOfBirth}\n />\n <InputPhone\n name=\"phone\"\n emptyOption={!form.phone ? 'Select...' : undefined}\n error={!!error.phone}\n label=\"Phone\"\n labelPrefix=\"Prefix\"\n prefixes={['+34', '+44', '+001', '+999', '+39', '+56']}\n required\n showRequired\n type=\"inputPhone\"\n value={form.phone}\n />\n <InputText name=\"bio\" label=\"Bio\" multiLine value={form.bio} />\n <InputNumber name=\"children\" label=\"Children\" hint=\"Ages 0 - 17\" value={form.children} />\n <InputOption type=\"checkbox\" name=\"checkbox\" label=\"checkbox\" checked={form.checkbox} />\n <InputOption\n type=\"checkbox\"\n name=\"checkboxRequired\"\n label=\"checkbox\"\n checked={form.checkboxRequired}\n required\n showRequired\n />\n <InputOption type=\"switch\" name=\"switch\" label=\"switch\" checked={form.switch} />\n\n {Array.from(Array(3).keys()).map((index) => (\n <InputOption\n key={index}\n type=\"radio\"\n name=\"radio\"\n value={`radio-${index}`}\n label={`radio-${index}`}\n checked={form.radio === `radio-${index}`}\n />\n ))}\n {condition && <InputText label=\"condition\" name=\"condition\" />}\n\n <Button disabled={Object.keys(error).length !== 0} type=\"submit\" wide>\n Submit\n </Button>\n </Form>\n\n <View row style={{ justifyContent: 'flex-end', marginTop: 'var(--mirai-ui-space-L)' }}>\n <Button small secondary onPress={() => setForm({})} style={{ marginRight: 'var(--mirai-ui-space-M)' }}>\n Reset\n </Button>\n <Button small secondary onPress={() => setCondition(!condition)}>\n {`${condition ? 'Hide' : 'Show'} dynamic field`}\n </Button>\n </View>\n </>\n );\n};\n\nStory.storyName = 'Form';\n\nStory.args = {\n debounce: 0,\n schema: {},\n showErrors: false,\n validateOnMount: false,\n // inherited properties\n testId: 'test-story',\n style: {},\n};\n\nStory.argTypes = {};\n"],"mappings":";;;;;;;AAAA;AAEA;AACA;AAA8B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,eAEf;EAAEA,KAAK,EAAE;AAAa,CAAC;AAAA;AAE/B,IAAMC,KAAK,GAAG,SAARA,KAAK,CAAIC,KAAK,EAAK;EAC9B,gBAAkC,IAAAC,eAAQ,EAAC,KAAK,CAAC;IAAA;IAA1CC,SAAS;IAAEC,YAAY;EAC9B,iBAAwB,IAAAF,eAAQ,EAAC;MAC/BG,KAAK,EAAE,gBAAgB;MACvBC,QAAQ,EAAE,IAAI;MACdC,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SAAS,CAAC;IAAA;EAAC,aAC1DA,SAAS,GAAG,MAAM,GAAG,MAAM,oBACxB,CACJ,CACN;AAEP,CAAC;AAAC;AAEFH,KAAK,CAAC4C,SAAS,GAAG,MAAM;AAExB5C,KAAK,CAAC6C,IAAI,GAAG;EACXC,QAAQ,EAAE,CAAC;EACXC,MAAM,EAAE,CAAC,CAAC;EACVC,UAAU,EAAE,KAAK;EACjBC,eAAe,EAAE,KAAK;EACtB;EACAC,MAAM,EAAE,YAAY;EACpBC,KAAK,EAAE,CAAC;AACV,CAAC;AAEDnD,KAAK,CAACoD,QAAQ,GAAG,CAAC,CAAC"}
|
|
@@ -4,11 +4,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.sanitizePrefixes = void 0;
|
|
7
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
|
+
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."); }
|
|
9
|
+
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); }
|
|
10
|
+
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; }
|
|
11
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { ; } } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
12
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
13
|
var sanitizePrefixes = function sanitizePrefixes() {
|
|
8
14
|
var prefixes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
9
15
|
return prefixes.length ? prefixes.map(function () {
|
|
10
16
|
var prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
11
|
-
|
|
17
|
+
var _ref = prefix.match(/\+(\d+)/) || [],
|
|
18
|
+
_ref2 = _slicedToArray(_ref, 1),
|
|
19
|
+
result = _ref2[0];
|
|
20
|
+
return result || undefined;
|
|
12
21
|
}) : undefined;
|
|
13
22
|
};
|
|
14
23
|
exports.sanitizePrefixes = sanitizePrefixes;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sanitizePrefixes.js","names":["sanitizePrefixes","prefixes","length","map","prefix","
|
|
1
|
+
{"version":3,"file":"sanitizePrefixes.js","names":["sanitizePrefixes","prefixes","length","map","prefix","match","result","undefined"],"sources":["../../../../src/components/InputPhone/helpers/sanitizePrefixes.js"],"sourcesContent":["export const sanitizePrefixes = (prefixes = []) =>\n prefixes.length\n ? prefixes.map((prefix = '') => {\n const [result] = prefix.match(/\\+(\\d+)/) || [];\n\n return result || undefined;\n })\n : undefined;\n"],"mappings":";;;;;;;;;;;;AAAO,IAAMA,gBAAgB,GAAG,SAAnBA,gBAAgB;EAAA,IAAIC,QAAQ,uEAAG,EAAE;EAAA,OAC5CA,QAAQ,CAACC,MAAM,GACXD,QAAQ,CAACE,GAAG,CAAC,YAAiB;IAAA,IAAhBC,MAAM,uEAAG,EAAE;IACvB,WAAiBA,MAAM,CAACC,KAAK,CAAC,SAAS,CAAC,IAAI,EAAE;MAAA;MAAvCC,MAAM;IAEb,OAAOA,MAAM,IAAIC,SAAS;EAC5B,CAAC,CAAC,GACFA,SAAS;AAAA;AAAC"}
|