@mirai/ui 1.0.43 → 1.0.45
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.js +2 -2
- package/build/components/Form/Form.js.map +1 -1
- package/build/components/Form/__tests__/__snapshots__/Form.test.jsx.snap +3 -1
- package/build/components/Form/helpers/getChildrenErrors.js +3 -4
- package/build/components/Form/helpers/getChildrenErrors.js.map +1 -1
- package/build/components/Form/helpers/getChildrenValues.js +13 -17
- package/build/components/Form/helpers/getChildrenValues.js.map +1 -1
- package/build/components/Notification/Notification.js +8 -2
- package/build/components/Notification/Notification.js.map +1 -1
- package/build/components/Notification/Notification.module.css +12 -3
- package/build/components/Notification/__tests__/__snapshots__/Notification.test.js.snap +86 -8
- package/package.json +1 -1
|
@@ -176,8 +176,8 @@ var Form = function Form(_ref) {
|
|
|
176
176
|
return (0, _react.useMemo)(function () {
|
|
177
177
|
return /*#__PURE__*/_react.default.createElement("form", {
|
|
178
178
|
"data-testid": others['data-testid'],
|
|
179
|
-
|
|
180
|
-
|
|
179
|
+
onSubmit: handleSubmit,
|
|
180
|
+
className: others.className
|
|
181
181
|
}, _react.default.Children.map(children, function (child, index) {
|
|
182
182
|
if (!child || child === null) return;
|
|
183
183
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Form.js","names":["Form","children","debounce","DEFAULT_TIMEOUT_ONCHANGE","schema","showErrors","validateOnMount","onBlur","onChange","onError","onFocus","onSubmit","others","error","setError","initialValue","setInitialValue","touched","setTouched","values","setValues","nextValues","nextChildrenKeys","Object","keys","sort","length","JSON","stringify","nextError","collision","some","key","timer","setTimeout","value","clearTimeout","handleChange","field","fieldValue","handleError","DEFAULT_TIMEOUT_ONERROR","hasError","changed","errors","handleFocus","event","handleSubmit","preventDefault","style","React","Children","map","child","index","props","type","cloneElement","undefined","onPress","displayName","propTypes","PropTypes","node","number","shape","bool","func"],"sources":["../../../src/components/Form/Form.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React, { useEffect, useMemo, useState } from 'react';\n\nimport { DEFAULT_TIMEOUT_ONCHANGE, DEFAULT_TIMEOUT_ONERROR } from './Form.constants';\nimport { getChildrenErrors, getChildrenValues, getField, groupState } from './helpers';\n\nconst Form = ({\n children,\n debounce = DEFAULT_TIMEOUT_ONCHANGE,\n schema = {},\n showErrors,\n validateOnMount = false,\n onBlur,\n onChange,\n onError,\n onFocus,\n onSubmit,\n ...others\n}) => {\n const [error, setError] = useState({});\n const [initialValue, setInitialValue] = useState({});\n const [touched, setTouched] = useState({});\n const [values, setValues] = useState({});\n\n useEffect(() => {\n const nextValues = getChildrenValues(children);\n const nextChildrenKeys = Object.keys(nextValues).sort();\n\n if (!Object.keys(nextValues).length) return;\n\n if (JSON.stringify(nextChildrenKeys) !== JSON.stringify(Object.keys(initialValue).sort())) {\n setInitialValue(nextValues);\n setValues(nextValues);\n\n if (validateOnMount) {\n const nextError = getChildrenErrors({ children, schema, values: nextValues });\n setError(nextError);\n onError && onError(nextError);\n } else {\n setError({});\n }\n setTouched({});\n } else {\n const collision = nextChildrenKeys.some((key) => JSON.stringify(values[key]) !== JSON.stringify(nextValues[key]));\n if (collision) setValues(nextValues);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [children]);\n\n useEffect(() => {\n if (!onChange || values === initialValue || !Object.keys(values).length) return;\n\n const timer = setTimeout(() => onChange(values, groupState({ initialValue, value: values, touched })), debounce);\n return () => clearTimeout(timer);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [values]);\n\n const handleChange = (field, fieldValue) => {\n const nextValues = { ...values, [field]: fieldValue };\n\n setValues(nextValues);\n setTimeout(() => handleError(nextValues), DEFAULT_TIMEOUT_ONERROR);\n };\n\n const handleError = (values) => {\n const nextError = getChildrenErrors({ children, schema, values });\n const hasError = Object.keys(nextError).length > 0;\n const changed = JSON.stringify(error) !== JSON.stringify(nextError);\n\n if (changed) {\n setError(nextError);\n onError && onError(nextError, hasError);\n }\n\n return { changed, errors: nextError, hasError };\n };\n\n const handleFocus = (field, event) => {\n setTouched({ ...touched, [field]: true });\n if (onFocus) onFocus(field, event);\n };\n\n const handleSubmit = (event) => {\n const { errors, hasError } = handleError(values);\n\n if (hasError && onError) onError(errors, hasError);\n else if (onSubmit) onSubmit(values, groupState({ initialValue, value: values, touched }), event);\n event.preventDefault();\n };\n\n return useMemo(\n () => (\n <form data-testid={others['data-testid']} style={others.style} onSubmit={handleSubmit}>\n {React.Children.map(children, (child, index) => {\n if (!child || child === null) return;\n\n const { props = {} } = child || {};\n const { type } = props;\n const field = getField(props);\n\n return React.cloneElement(child, {\n key: index,\n ...(field\n ? {\n ...props,\n ...schema[field],\n error: props.error ? props.error : showErrors && error[field],\n onBlur: onBlur ? (event) => onBlur(field, event) : undefined,\n onChange: (value) => handleChange(field, value),\n onFocus: (event) => handleFocus(field, event),\n }\n : type === 'submit'\n ? { ...props, onPress: handleSubmit }\n : undefined),\n });\n })}\n </form>\n ),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [children, error, others, schema],\n );\n};\n\nForm.displayName = 'Component:Form';\n\nForm.propTypes = {\n children: PropTypes.node,\n debounce: PropTypes.number,\n schema: PropTypes.shape({}),\n showErrors: PropTypes.bool,\n validateOnMount: PropTypes.bool,\n onBlur: PropTypes.func,\n onChange: PropTypes.func,\n onError: PropTypes.func,\n onFocus: PropTypes.func,\n onSubmit: PropTypes.func,\n};\n\nexport { Form };\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AAEA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAMA,IAAI,GAAG,SAAPA,IAAO,OAYP;EAAA,IAXJC,QAWI,QAXJA,QAWI;EAAA,yBAVJC,QAUI;EAAA,IAVJA,QAUI,8BAVOC,8BAUP;EAAA,uBATJC,MASI;EAAA,IATJA,MASI,4BATK,EASL;EAAA,IARJC,UAQI,QARJA,UAQI;EAAA,gCAPJC,eAOI;EAAA,IAP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AAkBD,MAAlB,EAA0BR,MAA1B,CA7BK,CAAP;AA+BD,CAnHD;;;AAqHAJ,IAAI,CAAC4D,WAAL,GAAmB,gBAAnB;AAEA5D,IAAI,CAAC6D,SAAL,GAAiB;EACf5D,QAAQ,EAAE6D,mBAAUC,IADL;EAEf7D,QAAQ,EAAE4D,mBAAUE,MAFL;EAGf5D,MAAM,EAAE0D,mBAAUG,KAAV,CAAgB,EAAhB,CAHO;EAIf5D,UAAU,EAAEyD,mBAAUI,IAJP;EAKf5D,eAAe,EAAEwD,mBAAUI,IALZ;EAMf3D,MAAM,EAAEuD,mBAAUK,IANH;EAOf3D,QAAQ,EAAEsD,mBAAUK,IAPL;EAQf1D,OAAO,EAAEqD,mBAAUK,IARJ;EASfzD,OAAO,EAAEoD,mBAAUK,IATJ;EAUfxD,QAAQ,EAAEmD,mBAAUK;AAVL,CAAjB"}
|
|
1
|
+
{"version":3,"file":"Form.js","names":["Form","children","debounce","DEFAULT_TIMEOUT_ONCHANGE","schema","showErrors","validateOnMount","onBlur","onChange","onError","onFocus","onSubmit","others","error","setError","initialValue","setInitialValue","touched","setTouched","values","setValues","nextValues","nextChildrenKeys","Object","keys","sort","length","JSON","stringify","nextError","collision","some","key","timer","setTimeout","value","clearTimeout","handleChange","field","fieldValue","handleError","DEFAULT_TIMEOUT_ONERROR","hasError","changed","errors","handleFocus","event","handleSubmit","preventDefault","className","React","Children","map","child","index","props","type","cloneElement","undefined","onPress","displayName","propTypes","PropTypes","node","number","shape","bool","func"],"sources":["../../../src/components/Form/Form.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React, { useEffect, useMemo, useState } from 'react';\n\nimport { DEFAULT_TIMEOUT_ONCHANGE, DEFAULT_TIMEOUT_ONERROR } from './Form.constants';\nimport { getChildrenErrors, getChildrenValues, getField, groupState } from './helpers';\n\nconst Form = ({\n children,\n debounce = DEFAULT_TIMEOUT_ONCHANGE,\n schema = {},\n showErrors,\n validateOnMount = false,\n onBlur,\n onChange,\n onError,\n onFocus,\n onSubmit,\n ...others\n}) => {\n const [error, setError] = useState({});\n const [initialValue, setInitialValue] = useState({});\n const [touched, setTouched] = useState({});\n const [values, setValues] = useState({});\n\n useEffect(() => {\n const nextValues = getChildrenValues(children);\n const nextChildrenKeys = Object.keys(nextValues).sort();\n\n if (!Object.keys(nextValues).length) return;\n\n if (JSON.stringify(nextChildrenKeys) !== JSON.stringify(Object.keys(initialValue).sort())) {\n setInitialValue(nextValues);\n setValues(nextValues);\n\n if (validateOnMount) {\n const nextError = getChildrenErrors({ children, schema, values: nextValues });\n setError(nextError);\n onError && onError(nextError);\n } else {\n setError({});\n }\n setTouched({});\n } else {\n const collision = nextChildrenKeys.some((key) => JSON.stringify(values[key]) !== JSON.stringify(nextValues[key]));\n if (collision) setValues(nextValues);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [children]);\n\n useEffect(() => {\n if (!onChange || values === initialValue || !Object.keys(values).length) return;\n\n const timer = setTimeout(() => onChange(values, groupState({ initialValue, value: values, touched })), debounce);\n return () => clearTimeout(timer);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [values]);\n\n const handleChange = (field, fieldValue) => {\n const nextValues = { ...values, [field]: fieldValue };\n\n setValues(nextValues);\n setTimeout(() => handleError(nextValues), DEFAULT_TIMEOUT_ONERROR);\n };\n\n const handleError = (values) => {\n const nextError = getChildrenErrors({ children, schema, values });\n const hasError = Object.keys(nextError).length > 0;\n const changed = JSON.stringify(error) !== JSON.stringify(nextError);\n\n if (changed) {\n setError(nextError);\n onError && onError(nextError, hasError);\n }\n\n return { changed, errors: nextError, hasError };\n };\n\n const handleFocus = (field, event) => {\n setTouched({ ...touched, [field]: true });\n if (onFocus) onFocus(field, event);\n };\n\n const handleSubmit = (event) => {\n const { errors, hasError } = handleError(values);\n\n if (hasError && onError) onError(errors, hasError);\n else if (onSubmit) onSubmit(values, groupState({ initialValue, value: values, touched }), event);\n event.preventDefault();\n };\n\n return useMemo(\n () => (\n <form data-testid={others['data-testid']} onSubmit={handleSubmit} className={others.className}>\n {React.Children.map(children, (child, index) => {\n if (!child || child === null) return;\n\n const { props = {} } = child || {};\n const { type } = props;\n const field = getField(props);\n\n return React.cloneElement(child, {\n key: index,\n ...(field\n ? {\n ...props,\n ...schema[field],\n error: props.error ? props.error : showErrors && error[field],\n onBlur: onBlur ? (event) => onBlur(field, event) : undefined,\n onChange: (value) => handleChange(field, value),\n onFocus: (event) => handleFocus(field, event),\n }\n : type === 'submit'\n ? { ...props, onPress: handleSubmit }\n : undefined),\n });\n })}\n </form>\n ),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [children, error, others, schema],\n );\n};\n\nForm.displayName = 'Component:Form';\n\nForm.propTypes = {\n children: PropTypes.node,\n debounce: PropTypes.number,\n schema: PropTypes.shape({}),\n showErrors: PropTypes.bool,\n validateOnMount: PropTypes.bool,\n onBlur: PropTypes.func,\n onChange: PropTypes.func,\n onError: PropTypes.func,\n onFocus: PropTypes.func,\n onSubmit: PropTypes.func,\n};\n\nexport { Form };\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AAEA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAMA,IAAI,GAAG,SAAPA,IAAO,OAYP;EAAA,IAXJC,QAWI,QAXJA,QAWI;EAAA,yBAVJC,QAUI;EAAA,IAVJA,QAUI,8BAVOC,8BAUP;EAAA,uBATJC,MASI;EAAA,IATJA,MASI,4BATK,EASL;EAAA,IARJC,UAQI,QARJA,UAQI;EAAA,gCAPJC,eAOI;EAAA,IAPJA,eAOI,qCAPc,KAOd;EAAA,IANJC,MAMI,QANJA,MAMI;EAAA,IALJC,QAKI,QALJA,QAKI;EAAA,IAJJC,OAII,QAJJA,OAII;EAAA,IAHJC,OAGI,QAHJA,OAGI;EAAA,IAFJC,QAEI,QAFJA,QAEI;EAAA,IADDC,MACC;;EACJ,gBAA0B,qBAAS,EAAT,CAA1B;EAAA;EAAA,IAAOC,KAAP;EAAA,IAAcC,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AHO;EAIf5D,UAAU,EAAEyD,mBAAUI,IAJP;EAKf5D,eAAe,EAAEwD,mBAAUI,IALZ;EAMf3D,MAAM,EAAEuD,mBAAUK,IANH;EAOf3D,QAAQ,EAAEsD,mBAAUK,IAPL;EAQf1D,OAAO,EAAEqD,mBAAUK,IARJ;EASfzD,OAAO,EAAEoD,mBAAUK,IATJ;EAUfxD,QAAQ,EAAEmD,mBAAUK;AAVL,CAAjB"}
|
|
@@ -29,10 +29,9 @@ var getChildrenErrors = function getChildrenErrors() {
|
|
|
29
29
|
|
|
30
30
|
var errors = {};
|
|
31
31
|
|
|
32
|
-
_react.default.Children.forEach(children, function () {
|
|
33
|
-
var _ref2 =
|
|
34
|
-
|
|
35
|
-
props = _ref2$props === void 0 ? {} : _ref2$props;
|
|
32
|
+
_react.default.Children.forEach(children, function (child) {
|
|
33
|
+
var _ref2 = child || {},
|
|
34
|
+
props = _ref2.props;
|
|
36
35
|
|
|
37
36
|
var field = (0, _getField.getField)(props);
|
|
38
37
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getChildrenErrors.js","names":["getChildrenErrors","children","schema","values","errors","React","Children","forEach","props","field","inputErrors","value"],"sources":["../../../../src/components/Form/helpers/getChildrenErrors.js"],"sourcesContent":["import React from 'react';\n\nimport { getInputErrors } from '../../../helpers';\nimport { getField } from './getField';\n\nexport const getChildrenErrors = ({ children, schema = {}, values = {} } = {}) => {\n const errors = {};\n\n React.Children.forEach(children, (
|
|
1
|
+
{"version":3,"file":"getChildrenErrors.js","names":["getChildrenErrors","children","schema","values","errors","React","Children","forEach","child","props","field","inputErrors","value"],"sources":["../../../../src/components/Form/helpers/getChildrenErrors.js"],"sourcesContent":["import React from 'react';\n\nimport { getInputErrors } from '../../../helpers';\nimport { getField } from './getField';\n\nexport const getChildrenErrors = ({ children, schema = {}, values = {} } = {}) => {\n const errors = {};\n\n React.Children.forEach(children, (child) => {\n const { props } = child || {};\n const field = getField(props);\n\n if (field) {\n const inputErrors = getInputErrors({ ...props, ...schema[field], value: values[field] });\n if (inputErrors) errors[field] = inputErrors;\n }\n });\n\n return errors;\n};\n"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;;;;;;;;;AAEO,IAAMA,iBAAiB,GAAG,SAApBA,iBAAoB,GAAiD;EAAA,+EAAP,EAAO;EAAA,IAA9CC,QAA8C,QAA9CA,QAA8C;EAAA,uBAApCC,MAAoC;EAAA,IAApCA,MAAoC,4BAA3B,EAA2B;EAAA,uBAAvBC,MAAuB;EAAA,IAAvBA,MAAuB,4BAAd,EAAc;;EAChF,IAAMC,MAAM,GAAG,EAAf;;EAEAC,eAAMC,QAAN,CAAeC,OAAf,CAAuBN,QAAvB,EAAiC,UAACO,KAAD,EAAW;IAC1C,YAAkBA,KAAK,IAAI,EAA3B;IAAA,IAAQC,KAAR,SAAQA,KAAR;;IACA,IAAMC,KAAK,GAAG,wBAASD,KAAT,CAAd;;IAEA,IAAIC,KAAJ,EAAW;MACT,IAAMC,WAAW,GAAG,2EAAoBF,KAApB,GAA8BP,MAAM,CAACQ,KAAD,CAApC;QAA6CE,KAAK,EAAET,MAAM,CAACO,KAAD;MAA1D,GAApB;MACA,IAAIC,WAAJ,EAAiBP,MAAM,CAACM,KAAD,CAAN,GAAgBC,WAAhB;IAClB;EACF,CARD;;EAUA,OAAOP,MAAP;AACD,CAdM"}
|
|
@@ -22,23 +22,19 @@ var BOOLEAN_TYPES = ['checkbox', 'radio'];
|
|
|
22
22
|
var getChildrenValues = function getChildrenValues(children) {
|
|
23
23
|
var values = {};
|
|
24
24
|
|
|
25
|
-
_react.default.Children.forEach(children, function () {
|
|
26
|
-
var _ref =
|
|
27
|
-
_ref$
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
_ref$
|
|
34
|
-
|
|
35
|
-
_ref$
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
type = _ref$props$type === void 0 ? undefined : _ref$props$type,
|
|
39
|
-
_ref$props$value = _ref$props.value,
|
|
40
|
-
value = _ref$props$value === void 0 ? undefined : _ref$props$value,
|
|
41
|
-
props = _objectWithoutProperties(_ref$props, _excluded);
|
|
25
|
+
_react.default.Children.forEach(children, function (child) {
|
|
26
|
+
var _ref = (child === null || child === void 0 ? void 0 : child.props) || {},
|
|
27
|
+
_ref$checked = _ref.checked,
|
|
28
|
+
checked = _ref$checked === void 0 ? false : _ref$checked,
|
|
29
|
+
_ref$defaultChecked = _ref.defaultChecked,
|
|
30
|
+
defaultChecked = _ref$defaultChecked === void 0 ? false : _ref$defaultChecked,
|
|
31
|
+
_ref$defaultValue = _ref.defaultValue,
|
|
32
|
+
defaultValue = _ref$defaultValue === void 0 ? undefined : _ref$defaultValue,
|
|
33
|
+
_ref$type = _ref.type,
|
|
34
|
+
type = _ref$type === void 0 ? undefined : _ref$type,
|
|
35
|
+
_ref$value = _ref.value,
|
|
36
|
+
value = _ref$value === void 0 ? undefined : _ref$value,
|
|
37
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
42
38
|
|
|
43
39
|
var field = (0, _getField.getField)(props);
|
|
44
40
|
if (field) values[field] = BOOLEAN_TYPES.includes(type) ? checked || defaultChecked : value || defaultValue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getChildrenValues.js","names":["BOOLEAN_TYPES","getChildrenValues","children","values","React","Children","forEach","props","checked","defaultChecked","defaultValue","undefined","type","value","field","includes"],"sources":["../../../../src/components/Form/helpers/getChildrenValues.js"],"sourcesContent":["import React from 'react';\n\nimport { getField } from './getField';\n\nconst BOOLEAN_TYPES = ['checkbox', 'radio'];\n\nexport const getChildrenValues = (children) => {\n const values = {};\n\n React.Children.forEach(
|
|
1
|
+
{"version":3,"file":"getChildrenValues.js","names":["BOOLEAN_TYPES","getChildrenValues","children","values","React","Children","forEach","child","props","checked","defaultChecked","defaultValue","undefined","type","value","field","includes"],"sources":["../../../../src/components/Form/helpers/getChildrenValues.js"],"sourcesContent":["import React from 'react';\n\nimport { getField } from './getField';\n\nconst BOOLEAN_TYPES = ['checkbox', 'radio'];\n\nexport const getChildrenValues = (children) => {\n const values = {};\n\n React.Children.forEach(children, (child) => {\n const {\n checked = false,\n defaultChecked = false,\n defaultValue = undefined,\n type = undefined,\n value = undefined,\n ...props\n } = child?.props || {};\n\n const field = getField(props);\n if (field) values[field] = BOOLEAN_TYPES.includes(type) ? checked || defaultChecked : value || defaultValue;\n });\n\n return values;\n};\n"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;;;;;AAEA,IAAMA,aAAa,GAAG,CAAC,UAAD,EAAa,OAAb,CAAtB;;AAEO,IAAMC,iBAAiB,GAAG,SAApBA,iBAAoB,CAACC,QAAD,EAAc;EAC7C,IAAMC,MAAM,GAAG,EAAf;;EAEAC,eAAMC,QAAN,CAAeC,OAAf,CAAuBJ,QAAvB,EAAiC,UAACK,KAAD,EAAW;IAC1C,WAOI,CAAAA,KAAK,SAAL,IAAAA,KAAK,WAAL,YAAAA,KAAK,CAAEC,KAAP,KAAgB,EAPpB;IAAA,wBACEC,OADF;IAAA,IACEA,OADF,6BACY,KADZ;IAAA,+BAEEC,cAFF;IAAA,IAEEA,cAFF,oCAEmB,KAFnB;IAAA,6BAGEC,YAHF;IAAA,IAGEA,YAHF,kCAGiBC,SAHjB;IAAA,qBAIEC,IAJF;IAAA,IAIEA,IAJF,0BAISD,SAJT;IAAA,sBAKEE,KALF;IAAA,IAKEA,KALF,2BAKUF,SALV;IAAA,IAMKJ,KANL;;IASA,IAAMO,KAAK,GAAG,wBAASP,KAAT,CAAd;IACA,IAAIO,KAAJ,EAAWZ,MAAM,CAACY,KAAD,CAAN,GAAgBf,aAAa,CAACgB,QAAd,CAAuBH,IAAvB,IAA+BJ,OAAO,IAAIC,cAA1C,GAA2DI,KAAK,IAAIH,YAApF;EACZ,CAZD;;EAcA,OAAOR,MAAP;AACD,CAlBM"}
|
|
@@ -15,7 +15,7 @@ var _primitives = require("../../primitives");
|
|
|
15
15
|
|
|
16
16
|
var _NotificationModule = _interopRequireDefault(require("./Notification.module.css"));
|
|
17
17
|
|
|
18
|
-
var _excluded = ["children", "error", "success", "title", "warning", "onClose"];
|
|
18
|
+
var _excluded = ["children", "error", "outlined", "small", "success", "title", "warning", "onClose"];
|
|
19
19
|
|
|
20
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
21
|
|
|
@@ -28,6 +28,10 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
28
28
|
var Notification = function Notification(_ref) {
|
|
29
29
|
var children = _ref.children,
|
|
30
30
|
error = _ref.error,
|
|
31
|
+
_ref$outlined = _ref.outlined,
|
|
32
|
+
outlined = _ref$outlined === void 0 ? true : _ref$outlined,
|
|
33
|
+
_ref$small = _ref.small,
|
|
34
|
+
small = _ref$small === void 0 ? false : _ref$small,
|
|
31
35
|
success = _ref.success,
|
|
32
36
|
title = _ref.title,
|
|
33
37
|
warning = _ref.warning,
|
|
@@ -36,7 +40,7 @@ var Notification = function Notification(_ref) {
|
|
|
36
40
|
|
|
37
41
|
return /*#__PURE__*/_react.default.createElement(_primitives.View, _extends({}, others, {
|
|
38
42
|
row: true,
|
|
39
|
-
className: (0, _helpers.styles)(_NotificationModule.default.notification, error ? _NotificationModule.default.error : warning ? _NotificationModule.default.warning : success ? _NotificationModule.default.success : undefined, others.className)
|
|
43
|
+
className: (0, _helpers.styles)(_NotificationModule.default.notification, error ? _NotificationModule.default.error : warning ? _NotificationModule.default.warning : success ? _NotificationModule.default.success : undefined, outlined && _NotificationModule.default.outlined, small && _NotificationModule.default.small, others.className)
|
|
40
44
|
}), /*#__PURE__*/_react.default.createElement(_primitives.Icon, {
|
|
41
45
|
name: error ? 'Error' : warning ? 'Warning' : success ? 'Success' : 'Info',
|
|
42
46
|
className: _NotificationModule.default.icon
|
|
@@ -61,6 +65,8 @@ Notification.displayName = 'Component:Notification';
|
|
|
61
65
|
Notification.propTypes = {
|
|
62
66
|
children: _propTypes.default.string.isRequired,
|
|
63
67
|
error: _propTypes.default.bool,
|
|
68
|
+
outlined: _propTypes.default.bool,
|
|
69
|
+
small: _propTypes.default.bool,
|
|
64
70
|
success: _propTypes.default.bool,
|
|
65
71
|
title: _propTypes.default.string,
|
|
66
72
|
warning: _propTypes.default.bool,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Notification.js","names":["Notification","children","error","success","title","warning","onClose","others","style","notification","undefined","className","icon","text","pressable","displayName","propTypes","PropTypes","string","isRequired","bool","func"],"sources":["../../../src/components/Notification/Notification.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\n\nimport { styles } from '../../helpers';\nimport { Icon, Pressable, Text, View } from '../../primitives';\nimport style from './Notification.module.css';\n\nconst Notification = ({
|
|
1
|
+
{"version":3,"file":"Notification.js","names":["Notification","children","error","outlined","small","success","title","warning","onClose","others","style","notification","undefined","className","icon","text","pressable","displayName","propTypes","PropTypes","string","isRequired","bool","func"],"sources":["../../../src/components/Notification/Notification.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\n\nimport { styles } from '../../helpers';\nimport { Icon, Pressable, Text, View } from '../../primitives';\nimport style from './Notification.module.css';\n\nconst Notification = ({\n children,\n error,\n outlined = true,\n small = false,\n success,\n title,\n warning,\n onClose,\n ...others\n}) => (\n <View\n {...others}\n row\n className={styles(\n style.notification,\n error ? style.error : warning ? style.warning : success ? style.success : undefined,\n outlined && style.outlined,\n small && style.small,\n others.className,\n )}\n >\n <Icon name={error ? 'Error' : warning ? 'Warning' : success ? 'Success' : 'Info'} className={style.icon} />\n <View\n className={styles(\n style.text,\n error ? style.error : warning ? style.warning : success ? style.success : undefined,\n )}\n >\n {title && (\n <Text bold action>\n Title\n </Text>\n )}\n <Text action>{children}</Text>\n </View>\n {onClose && (\n <Pressable className={style.pressable} onPress={onClose}>\n <Icon name=\"Close\" className={style.icon} />\n </Pressable>\n )}\n </View>\n);\n\nNotification.displayName = 'Component:Notification';\n\nNotification.propTypes = {\n children: PropTypes.string.isRequired,\n error: PropTypes.bool,\n outlined: PropTypes.bool,\n small: PropTypes.bool,\n success: PropTypes.bool,\n title: PropTypes.string,\n warning: PropTypes.bool,\n onClose: PropTypes.func,\n};\n\nexport { Notification };\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;;;;;;;;;;;AAEA,IAAMA,YAAY,GAAG,SAAfA,YAAe;EAAA,IACnBC,QADmB,QACnBA,QADmB;EAAA,IAEnBC,KAFmB,QAEnBA,KAFmB;EAAA,yBAGnBC,QAHmB;EAAA,IAGnBA,QAHmB,8BAGR,IAHQ;EAAA,sBAInBC,KAJmB;EAAA,IAInBA,KAJmB,2BAIX,KAJW;EAAA,IAKnBC,OALmB,QAKnBA,OALmB;EAAA,IAMnBC,KANmB,QAMnBA,KANmB;EAAA,IAOnBC,OAPmB,QAOnBA,OAPmB;EAAA,IAQnBC,OARmB,QAQnBA,OARmB;EAAA,IAShBC,MATgB;;EAAA,oBAWnB,6BAAC,gBAAD,eACMA,MADN;IAEE,GAAG,MAFL;IAGE,SAAS,EAAE,qBACTC,4BAAMC,YADG,EAETT,KAAK,GAAGQ,4BAAMR,KAAT,GAAiBK,OAAO,GAAGG,4BAAMH,OAAT,GAAmBF,OAAO,GAAGK,4BAAML,OAAT,GAAmBO,SAFjE,EAGTT,QAAQ,IAAIO,4BAAMP,QAHT,EAITC,KAAK,IAAIM,4BAAMN,KAJN,EAKTK,MAAM,CAACI,SALE;EAHb,iBAWE,6BAAC,gBAAD;IAAM,IAAI,EAAEX,KAAK,GAAG,OAAH,GAAaK,OAAO,GAAG,SAAH,GAAeF,OAAO,GAAG,SAAH,GAAe,MAA1E;IAAkF,SAAS,EAAEK,4BAAMI;EAAnG,EAXF,eAYE,6BAAC,gBAAD;IACE,SAAS,EAAE,qBACTJ,4BAAMK,IADG,EAETb,KAAK,GAAGQ,4BAAMR,KAAT,GAAiBK,OAAO,GAAGG,4BAAMH,OAAT,GAAmBF,OAAO,GAAGK,4BAAML,OAAT,GAAmBO,SAFjE;EADb,GAMGN,KAAK,iBACJ,6BAAC,gBAAD;IAAM,IAAI,MAAV;IAAW,MAAM;EAAjB,WAPJ,eAWE,6BAAC,gBAAD;IAAM,MAAM;EAAZ,GAAcL,QAAd,CAXF,CAZF,EAyBGO,OAAO,iBACN,6BAAC,qBAAD;IAAW,SAAS,EAAEE,4BAAMM,SAA5B;IAAuC,OAAO,EAAER;EAAhD,gBACE,6BAAC,gBAAD;IAAM,IAAI,EAAC,OAAX;IAAmB,SAAS,EAAEE,4BAAMI;EAApC,EADF,CA1BJ,CAXmB;AAAA,CAArB;;;AA4CAd,YAAY,CAACiB,WAAb,GAA2B,wBAA3B;AAEAjB,YAAY,CAACkB,SAAb,GAAyB;EACvBjB,QAAQ,EAAEkB,mBAAUC,MAAV,CAAiBC,UADJ;EAEvBnB,KAAK,EAAEiB,mBAAUG,IAFM;EAGvBnB,QAAQ,EAAEgB,mBAAUG,IAHG;EAIvBlB,KAAK,EAAEe,mBAAUG,IAJM;EAKvBjB,OAAO,EAAEc,mBAAUG,IALI;EAMvBhB,KAAK,EAAEa,mBAAUC,MANM;EAOvBb,OAAO,EAAEY,mBAAUG,IAPI;EAQvBd,OAAO,EAAEW,mBAAUI;AARI,CAAzB"}
|
|
@@ -9,14 +9,23 @@
|
|
|
9
9
|
background-color: var(--mirai-ui-accent-background);
|
|
10
10
|
border-radius: var(--mirai-ui-notification-border-radius);
|
|
11
11
|
padding: var(--mirai-ui-notification-padding);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.notification.outlined {
|
|
12
15
|
border: solid 1px var(--mirai-ui-accent-border);
|
|
13
16
|
}
|
|
14
17
|
|
|
18
|
+
.notification.small {
|
|
19
|
+
padding: 0;
|
|
20
|
+
border: none;
|
|
21
|
+
background-color: transparent;
|
|
22
|
+
}
|
|
23
|
+
|
|
15
24
|
.notification * {
|
|
16
25
|
color: var(--mirai-ui-accent);
|
|
17
26
|
}
|
|
18
27
|
|
|
19
|
-
.notification.success {
|
|
28
|
+
.notification.success:not(.small) {
|
|
20
29
|
background-color: var(--mirai-ui-success-background);
|
|
21
30
|
border-color: var(--mirai-ui-success-border);
|
|
22
31
|
}
|
|
@@ -25,7 +34,7 @@
|
|
|
25
34
|
color: var(--mirai-ui-success);
|
|
26
35
|
}
|
|
27
36
|
|
|
28
|
-
.notification.error {
|
|
37
|
+
.notification.error:not(.small) {
|
|
29
38
|
background-color: var(--mirai-ui-error-background);
|
|
30
39
|
border-color: var(--mirai-ui-error-border);
|
|
31
40
|
}
|
|
@@ -34,7 +43,7 @@
|
|
|
34
43
|
color: var(--mirai-ui-error);
|
|
35
44
|
}
|
|
36
45
|
|
|
37
|
-
.notification.warning {
|
|
46
|
+
.notification.warning:not(.small) {
|
|
38
47
|
background-color: var(--mirai-ui-warning-background);
|
|
39
48
|
border-color: var(--mirai-ui-warning-border);
|
|
40
49
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
exports[`component:<Notification> inherit:className 1`] = `
|
|
4
4
|
<DocumentFragment>
|
|
5
5
|
<div
|
|
6
|
-
class="view row notification mirai"
|
|
6
|
+
class="view row notification outlined mirai"
|
|
7
7
|
>
|
|
8
8
|
<span
|
|
9
9
|
class="icon icon"
|
|
@@ -42,7 +42,7 @@ exports[`component:<Notification> inherit:className 1`] = `
|
|
|
42
42
|
exports[`component:<Notification> prop:error 1`] = `
|
|
43
43
|
<DocumentFragment>
|
|
44
44
|
<div
|
|
45
|
-
class="view row notification error"
|
|
45
|
+
class="view row notification error outlined"
|
|
46
46
|
>
|
|
47
47
|
<span
|
|
48
48
|
class="icon icon"
|
|
@@ -81,7 +81,7 @@ exports[`component:<Notification> prop:error 1`] = `
|
|
|
81
81
|
exports[`component:<Notification> prop:onClose 1`] = `
|
|
82
82
|
<DocumentFragment>
|
|
83
83
|
<div
|
|
84
|
-
class="view row notification"
|
|
84
|
+
class="view row notification outlined"
|
|
85
85
|
>
|
|
86
86
|
<span
|
|
87
87
|
class="icon icon"
|
|
@@ -149,10 +149,88 @@ exports[`component:<Notification> prop:onClose 1`] = `
|
|
|
149
149
|
</DocumentFragment>
|
|
150
150
|
`;
|
|
151
151
|
|
|
152
|
+
exports[`component:<Notification> prop:outlined 1`] = `
|
|
153
|
+
<DocumentFragment>
|
|
154
|
+
<div
|
|
155
|
+
class="view row notification"
|
|
156
|
+
>
|
|
157
|
+
<span
|
|
158
|
+
class="icon icon"
|
|
159
|
+
>
|
|
160
|
+
<svg
|
|
161
|
+
fill="currentColor"
|
|
162
|
+
height="1em"
|
|
163
|
+
stroke="currentColor"
|
|
164
|
+
stroke-width="0"
|
|
165
|
+
viewBox="0 0 24 24"
|
|
166
|
+
width="1em"
|
|
167
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
168
|
+
>
|
|
169
|
+
<path
|
|
170
|
+
d="M0 0h24v24H0z"
|
|
171
|
+
fill="none"
|
|
172
|
+
/>
|
|
173
|
+
<path
|
|
174
|
+
d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"
|
|
175
|
+
/>
|
|
176
|
+
</svg>
|
|
177
|
+
</span>
|
|
178
|
+
<div
|
|
179
|
+
class="view text"
|
|
180
|
+
>
|
|
181
|
+
<span
|
|
182
|
+
class="text action"
|
|
183
|
+
>
|
|
184
|
+
Lorem Ipsum...
|
|
185
|
+
</span>
|
|
186
|
+
</div>
|
|
187
|
+
</div>
|
|
188
|
+
</DocumentFragment>
|
|
189
|
+
`;
|
|
190
|
+
|
|
191
|
+
exports[`component:<Notification> prop:small 1`] = `
|
|
192
|
+
<DocumentFragment>
|
|
193
|
+
<div
|
|
194
|
+
class="view row notification outlined small"
|
|
195
|
+
>
|
|
196
|
+
<span
|
|
197
|
+
class="icon icon"
|
|
198
|
+
>
|
|
199
|
+
<svg
|
|
200
|
+
fill="currentColor"
|
|
201
|
+
height="1em"
|
|
202
|
+
stroke="currentColor"
|
|
203
|
+
stroke-width="0"
|
|
204
|
+
viewBox="0 0 24 24"
|
|
205
|
+
width="1em"
|
|
206
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
207
|
+
>
|
|
208
|
+
<path
|
|
209
|
+
d="M0 0h24v24H0z"
|
|
210
|
+
fill="none"
|
|
211
|
+
/>
|
|
212
|
+
<path
|
|
213
|
+
d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"
|
|
214
|
+
/>
|
|
215
|
+
</svg>
|
|
216
|
+
</span>
|
|
217
|
+
<div
|
|
218
|
+
class="view text"
|
|
219
|
+
>
|
|
220
|
+
<span
|
|
221
|
+
class="text action"
|
|
222
|
+
>
|
|
223
|
+
Lorem Ipsum...
|
|
224
|
+
</span>
|
|
225
|
+
</div>
|
|
226
|
+
</div>
|
|
227
|
+
</DocumentFragment>
|
|
228
|
+
`;
|
|
229
|
+
|
|
152
230
|
exports[`component:<Notification> prop:success 1`] = `
|
|
153
231
|
<DocumentFragment>
|
|
154
232
|
<div
|
|
155
|
-
class="view row notification success"
|
|
233
|
+
class="view row notification success outlined"
|
|
156
234
|
>
|
|
157
235
|
<span
|
|
158
236
|
class="icon icon"
|
|
@@ -191,7 +269,7 @@ exports[`component:<Notification> prop:success 1`] = `
|
|
|
191
269
|
exports[`component:<Notification> prop:title 1`] = `
|
|
192
270
|
<DocumentFragment>
|
|
193
271
|
<div
|
|
194
|
-
class="view row notification"
|
|
272
|
+
class="view row notification outlined"
|
|
195
273
|
>
|
|
196
274
|
<span
|
|
197
275
|
class="icon icon"
|
|
@@ -235,7 +313,7 @@ exports[`component:<Notification> prop:title 1`] = `
|
|
|
235
313
|
exports[`component:<Notification> prop:warning 1`] = `
|
|
236
314
|
<DocumentFragment>
|
|
237
315
|
<div
|
|
238
|
-
class="view row notification warning"
|
|
316
|
+
class="view row notification warning outlined"
|
|
239
317
|
>
|
|
240
318
|
<span
|
|
241
319
|
class="icon icon"
|
|
@@ -274,7 +352,7 @@ exports[`component:<Notification> prop:warning 1`] = `
|
|
|
274
352
|
exports[`component:<Notification> renders 1`] = `
|
|
275
353
|
<DocumentFragment>
|
|
276
354
|
<div
|
|
277
|
-
class="view row notification"
|
|
355
|
+
class="view row notification outlined"
|
|
278
356
|
>
|
|
279
357
|
<span
|
|
280
358
|
class="icon icon"
|
|
@@ -313,7 +391,7 @@ exports[`component:<Notification> renders 1`] = `
|
|
|
313
391
|
exports[`component:<Notification> testID 1`] = `
|
|
314
392
|
<DocumentFragment>
|
|
315
393
|
<div
|
|
316
|
-
class="view row notification"
|
|
394
|
+
class="view row notification outlined"
|
|
317
395
|
data-testid="mirai"
|
|
318
396
|
>
|
|
319
397
|
<span
|