@bigbinary/neeto-molecules 1.13.2 → 1.13.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Currency.js +31 -14
- package/dist/Currency.js.map +1 -1
- package/dist/TimezoneMismatchModal.js +8 -1
- package/dist/TimezoneMismatchModal.js.map +1 -1
- package/dist/cjs/Currency.js +34 -14
- package/dist/cjs/Currency.js.map +1 -1
- package/dist/cjs/TimezoneMismatchModal.js +10 -1
- package/dist/cjs/TimezoneMismatchModal.js.map +1 -1
- package/package.json +3 -3
- package/types/Currency.d.ts +21 -8
package/dist/Currency.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { _ as _extends } from './extends-093996c9.js';
|
|
2
2
|
import { _ as _objectWithoutProperties } from './objectWithoutProperties-a0edb288.js';
|
|
3
3
|
import React__default, { useMemo } from 'react';
|
|
4
|
-
import { isPresent, isNotEmpty } from '@bigbinary/neeto-cist';
|
|
5
4
|
import { Select } from '@bigbinary/neetoui';
|
|
6
|
-
import { Select as Select$1 } from '@bigbinary/neetoui/formik';
|
|
7
5
|
import { useTranslation } from 'react-i18next';
|
|
6
|
+
import { isPresent, isNotEmpty } from '@bigbinary/neeto-cist';
|
|
7
|
+
import { Select as Select$1 } from '@bigbinary/neetoui/formik';
|
|
8
8
|
|
|
9
9
|
var currencyData = [
|
|
10
10
|
{
|
|
@@ -864,32 +864,49 @@ var currencyData = [
|
|
|
864
864
|
}
|
|
865
865
|
];
|
|
866
866
|
|
|
867
|
-
var
|
|
867
|
+
var getCurrencies = function getCurrencies(allowedCurrencies) {
|
|
868
|
+
if (isPresent(allowedCurrencies) && isNotEmpty(allowedCurrencies)) {
|
|
869
|
+
return currencyData.filter(function (item) {
|
|
870
|
+
return allowedCurrencies.includes(item.value);
|
|
871
|
+
});
|
|
872
|
+
}
|
|
873
|
+
return currencyData;
|
|
874
|
+
};
|
|
875
|
+
|
|
876
|
+
var _excluded$1 = ["label", "allowedCurrencies"];
|
|
868
877
|
var Currency = function Currency(_ref) {
|
|
878
|
+
var label = _ref.label,
|
|
879
|
+
allowedCurrencies = _ref.allowedCurrencies,
|
|
880
|
+
otherSelectProps = _objectWithoutProperties(_ref, _excluded$1);
|
|
881
|
+
var _useTranslation = useTranslation(),
|
|
882
|
+
t = _useTranslation.t;
|
|
883
|
+
var data = useMemo(function () {
|
|
884
|
+
return getCurrencies(allowedCurrencies);
|
|
885
|
+
}, [allowedCurrencies]);
|
|
886
|
+
return /*#__PURE__*/React__default.createElement(Select, _extends({
|
|
887
|
+
label: label || t("neetoMolecules.common.currency"),
|
|
888
|
+
options: data
|
|
889
|
+
}, otherSelectProps));
|
|
890
|
+
};
|
|
891
|
+
|
|
892
|
+
var _excluded = ["label", "name", "allowedCurrencies"];
|
|
893
|
+
var FormikCurrency = function FormikCurrency(_ref) {
|
|
869
894
|
var label = _ref.label,
|
|
870
895
|
_ref$name = _ref.name,
|
|
871
896
|
name = _ref$name === void 0 ? "currency" : _ref$name,
|
|
872
|
-
_ref$standalone = _ref.standalone,
|
|
873
|
-
standalone = _ref$standalone === void 0 ? false : _ref$standalone,
|
|
874
897
|
allowedCurrencies = _ref.allowedCurrencies,
|
|
875
898
|
otherSelectProps = _objectWithoutProperties(_ref, _excluded);
|
|
876
899
|
var _useTranslation = useTranslation(),
|
|
877
900
|
t = _useTranslation.t;
|
|
878
901
|
var data = useMemo(function () {
|
|
879
|
-
|
|
880
|
-
return currencyData.filter(function (item) {
|
|
881
|
-
return allowedCurrencies.includes(item.value);
|
|
882
|
-
});
|
|
883
|
-
}
|
|
884
|
-
return currencyData;
|
|
902
|
+
return getCurrencies(allowedCurrencies);
|
|
885
903
|
}, [allowedCurrencies]);
|
|
886
|
-
|
|
887
|
-
return /*#__PURE__*/React__default.createElement(Component, _extends({
|
|
904
|
+
return /*#__PURE__*/React__default.createElement(Select$1, _extends({
|
|
888
905
|
name: name,
|
|
889
906
|
label: label || t("neetoMolecules.common.currency"),
|
|
890
907
|
options: data
|
|
891
908
|
}, otherSelectProps));
|
|
892
909
|
};
|
|
893
910
|
|
|
894
|
-
export { Currency
|
|
911
|
+
export { Currency, FormikCurrency };
|
|
895
912
|
//# sourceMappingURL=Currency.js.map
|
package/dist/Currency.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Currency.js","sources":["../src/components/Currency/
|
|
1
|
+
{"version":3,"file":"Currency.js","sources":["../src/components/Currency/utils.js","../src/components/Currency/Currency.jsx","../src/components/Currency/FormikCurrency.jsx"],"sourcesContent":["import { isPresent, isNotEmpty } from \"neetocist\";\n\nimport currencyData from \"./currencyData.json\";\n\nexport const getCurrencies = allowedCurrencies => {\n if (isPresent(allowedCurrencies) && isNotEmpty(allowedCurrencies)) {\n return currencyData.filter(item => allowedCurrencies.includes(item.value));\n }\n\n return currencyData;\n};\n","import React, { useMemo } from \"react\";\n\nimport { Select } from \"neetoui\";\nimport PropTypes from \"prop-types\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { getCurrencies } from \"./utils\";\n\nconst Currency = ({ label, allowedCurrencies, ...otherSelectProps }) => {\n const { t } = useTranslation();\n\n const data = useMemo(\n () => getCurrencies(allowedCurrencies),\n [allowedCurrencies]\n );\n\n return (\n <Select\n label={label || t(\"neetoMolecules.common.currency\")}\n options={data}\n {...otherSelectProps}\n />\n );\n};\n\nCurrency.propTypes = {\n /**\n * Label for the currency input.\n */\n label: PropTypes.string,\n /**\n * To specify only a selected list of currencies to be used.\n */\n allowedCurrencies: PropTypes.arrayOf(PropTypes.string),\n};\n\nexport default Currency;\n","import React, { useMemo } from \"react\";\n\nimport { Select } from \"neetoui/formik\";\nimport PropTypes from \"prop-types\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { getCurrencies } from \"./utils\";\n\nconst FormikCurrency = ({\n label,\n name = \"currency\",\n allowedCurrencies,\n ...otherSelectProps\n}) => {\n const { t } = useTranslation();\n\n const data = useMemo(\n () => getCurrencies(allowedCurrencies),\n [allowedCurrencies]\n );\n\n return (\n <Select\n {...{ name }}\n label={label || t(\"neetoMolecules.common.currency\")}\n options={data}\n {...otherSelectProps}\n />\n );\n};\n\nFormikCurrency.propTypes = {\n /**\n * Label for the currency input.\n */\n label: PropTypes.string,\n /**\n * Name for the currency input.\n */\n name: PropTypes.string,\n /**\n * To specify only a selected list of currencies to be used.\n */\n allowedCurrencies: PropTypes.arrayOf(PropTypes.string),\n};\n\nexport default FormikCurrency;\n"],"names":["getCurrencies","allowedCurrencies","isPresent","isNotEmpty","currencyData","filter","item","includes","value","Currency","_ref","label","otherSelectProps","_objectWithoutProperties","_excluded","_useTranslation","useTranslation","t","data","useMemo","React","createElement","Select","_extends","options","FormikCurrency","_ref$name","name"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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ACpDO,IAAAA,OAAO,EAAEN,IAAAA;GACLN,EAAAA,gBAAgB,CACrB,CAAC,CAAA;AAEN;;;ACfA,IAAMa,cAAc,GAAG,SAAjBA,cAAcA,CAAAf,IAAA,EAKd;AAAA,EAAA,IAJJC,KAAK,GAAAD,IAAA,CAALC,KAAK;IAAAe,SAAA,GAAAhB,IAAA,CACLiB,IAAI;AAAJA,IAAAA,IAAI,GAAAD,SAAA,KAAG,KAAA,CAAA,GAAA,UAAU,GAAAA,SAAA;IACjBzB,iBAAiB,GAAAS,IAAA,CAAjBT,iBAAiB;AACdW,IAAAA,gBAAgB,GAAAC,wBAAA,CAAAH,IAAA,EAAAI,SAAA,CAAA,CAAA;AAEnB,EAAA,IAAAC,eAAA,GAAcC,cAAc,EAAE;IAAtBC,CAAC,GAAAF,eAAA,CAADE,CAAC,CAAA;EAET,IAAMC,IAAI,GAAGC,OAAO,CAClB,YAAA;IAAA,OAAMnB,aAAa,CAACC,iBAAiB,CAAC,CAAA;GACtC,EAAA,CAACA,iBAAiB,CACpB,CAAC,CAAA;AAED,EAAA,oBACEmB,cAAA,CAAAC,aAAA,CAACC,QAAM,EAAAC,QAAA,CAAA;AACCI,IAAAA,IAAI,EAAJA,IAAI;AACVhB,IAAAA,KAAK,EAAEA,KAAK,IAAIM,CAAC,CAAC,gCAAgC,CAAE;AACpDO,IAAAA,OAAO,EAAEN,IAAAA;GACLN,EAAAA,gBAAgB,CACrB,CAAC,CAAA;AAEN;;;;"}
|
|
@@ -5,6 +5,8 @@ import { useTranslation } from 'react-i18next';
|
|
|
5
5
|
import { useMutation } from 'react-query';
|
|
6
6
|
import axios from 'axios';
|
|
7
7
|
import dayjs from 'dayjs';
|
|
8
|
+
import timezone from 'dayjs/plugin/timezone';
|
|
9
|
+
import utc from 'dayjs/plugin/utc';
|
|
8
10
|
import { globalProps as globalProps$1 } from '@bigbinary/neeto-commons-frontend/initializers';
|
|
9
11
|
|
|
10
12
|
var timeZoneUrl = "api/v1/time_zone";
|
|
@@ -23,6 +25,8 @@ var useUpdateTimeZone = function useUpdateTimeZone() {
|
|
|
23
25
|
});
|
|
24
26
|
};
|
|
25
27
|
|
|
28
|
+
dayjs.extend(utc);
|
|
29
|
+
dayjs.extend(timezone);
|
|
26
30
|
var getBrowserTimeZone = function getBrowserTimeZone() {
|
|
27
31
|
return dayjs.tz.guess();
|
|
28
32
|
};
|
|
@@ -31,7 +35,10 @@ var getUserTimeZone = function getUserTimeZone() {
|
|
|
31
35
|
return (_globalProps$user = globalProps$1.user) === null || _globalProps$user === void 0 ? void 0 : _globalProps$user.timeZone;
|
|
32
36
|
};
|
|
33
37
|
var checkIfTwoTimeZonesAreSame = function checkIfTwoTimeZonesAreSame(timeZone1, timeZone2) {
|
|
34
|
-
return
|
|
38
|
+
return (
|
|
39
|
+
// eslint-disable-next-line @bigbinary/neeto/use-standard-date-time-formats
|
|
40
|
+
dayjs().tz(timeZone1).format("Z") === dayjs().tz(timeZone2).format("Z")
|
|
41
|
+
);
|
|
35
42
|
};
|
|
36
43
|
|
|
37
44
|
var TimezoneMismatchModal = function TimezoneMismatchModal(_ref) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimezoneMismatchModal.js","sources":["../src/components/TimezoneMismatchModal/apis/time_zone.js","../src/components/TimezoneMismatchModal/useTimeZoneApi.js","../src/components/TimezoneMismatchModal/utils.js","../src/components/TimezoneMismatchModal/index.jsx"],"sourcesContent":["import axios from \"axios\";\n\nconst timeZoneUrl = \"api/v1/time_zone\";\n\nconst updateTimeZone = payload => axios.patch(timeZoneUrl, payload);\n\nconst timeZoneApi = { updateTimeZone };\n\nexport default timeZoneApi;\n","import { useMutation } from \"react-query\";\n\nimport timeZoneApi from \"./apis/time_zone\";\n\nconst useUpdateTimeZone = () =>\n useMutation(timeZoneApi.updateTimeZone, {\n onSuccess: () => window.location.reload(),\n });\n\nexport { useUpdateTimeZone };\n","import dayjs from \"dayjs\";\nimport { globalProps } from \"neetocommons/initializers\";\n\nexport const getBrowserTimeZone = () => dayjs.tz.guess();\n\nexport const getUserTimeZone = () => globalProps.user?.timeZone;\n\nexport const checkIfTwoTimeZonesAreSame = (timeZone1, timeZone2) =>\n dayjs().tz(timeZone1).format(\"Z\") === dayjs().tz(timeZone2).format(\"Z\");\n","/* eslint-disable @bigbinary/neeto/use-webpack-alias */\nimport React, { useEffect, useState } from \"react\";\n\nimport { Button, Modal, Typography } from \"@bigbinary/neetoui\";\nimport PropTypes from \"prop-types\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { useUpdateTimeZone } from \"./useTimeZoneApi\";\nimport {\n checkIfTwoTimeZonesAreSame,\n getBrowserTimeZone,\n getUserTimeZone,\n} from \"./utils\";\n\nconst TimezoneMismatchModal = ({ isOpen = false, onClose = () => {} }) => {\n const { t } = useTranslation();\n const [isTimezoneModalOpen, setIsTimezoneModalOpen] = useState(false);\n const { isLoading, mutate: updateTimeZone } = useUpdateTimeZone();\n const isUserAndBrowserTimeZoneSame = checkIfTwoTimeZonesAreSame(\n getUserTimeZone(),\n getBrowserTimeZone()\n );\n\n const handleUpdateTimeZone = () => {\n const payload = { timeZone: getBrowserTimeZone() };\n\n updateTimeZone(payload, {\n onSuccess: () => {\n setIsTimezoneModalOpen(false);\n onClose();\n },\n });\n };\n\n const handleCancel = () => {\n setIsTimezoneModalOpen(false);\n onClose();\n };\n\n useEffect(() => {\n if (process.env.RAILS_ENV !== \"heroku\") {\n setIsTimezoneModalOpen(!isUserAndBrowserTimeZoneSame);\n }\n }, []);\n\n return (\n <Modal\n closeOnOutsideClick={false}\n isOpen={isTimezoneModalOpen || isOpen}\n size=\"large\"\n onClose={handleCancel}\n >\n <Modal.Header>\n <Typography style=\"h2\" weight=\"normal\">\n {t(\"neetoMolecules.alert.timezone.title\")}\n </Typography>\n </Modal.Header>\n <Modal.Body>\n <span className=\"flex flex-col space-y-4\">\n <Typography component=\"span\" style=\"body2\">\n {t(\"neetoMolecules.alert.timezone.message\", {\n entity: globalProps.appName,\n })}\n </Typography>\n <Typography component=\"span\" style=\"h4\">\n {t(\"neetoMolecules.alert.timezone.userTimezone\", {\n entity: getUserTimeZone(),\n })}\n </Typography>\n <Typography component=\"span\" style=\"h4\">\n {t(\"neetoMolecules.alert.timezone.browserTimezone\", {\n entity: getBrowserTimeZone(),\n })}\n </Typography>\n </span>\n </Modal.Body>\n <Modal.Footer className=\"space-x-2\">\n <Button\n data-testid=\"update-timezone-button\"\n disabled={isLoading}\n label={t(\"neetoMolecules.alert.timezone.updateProfile\")}\n loading={isLoading}\n style=\"primary\"\n onClick={handleUpdateTimeZone}\n />\n <Button\n label={t(\"neetoMolecules.common.actions.cancel\")}\n style=\"text\"\n onClick={handleCancel}\n />\n </Modal.Footer>\n </Modal>\n );\n};\n\nTimezoneMismatchModal.propTypes = {\n /**\n * Boolean value to toggle the modal.\n */\n isOpen: PropTypes.bool,\n /**\n * The function that's called after the modal is closed.\n */\n onClose: PropTypes.func,\n};\n\nexport default TimezoneMismatchModal;\n"],"names":["timeZoneUrl","updateTimeZone","payload","axios","patch","timeZoneApi","useUpdateTimeZone","useMutation","onSuccess","window","location","reload","
|
|
1
|
+
{"version":3,"file":"TimezoneMismatchModal.js","sources":["../src/components/TimezoneMismatchModal/apis/time_zone.js","../src/components/TimezoneMismatchModal/useTimeZoneApi.js","../src/components/TimezoneMismatchModal/utils.js","../src/components/TimezoneMismatchModal/index.jsx"],"sourcesContent":["import axios from \"axios\";\n\nconst timeZoneUrl = \"api/v1/time_zone\";\n\nconst updateTimeZone = payload => axios.patch(timeZoneUrl, payload);\n\nconst timeZoneApi = { updateTimeZone };\n\nexport default timeZoneApi;\n","import { useMutation } from \"react-query\";\n\nimport timeZoneApi from \"./apis/time_zone\";\n\nconst useUpdateTimeZone = () =>\n useMutation(timeZoneApi.updateTimeZone, {\n onSuccess: () => window.location.reload(),\n });\n\nexport { useUpdateTimeZone };\n","import dayjs from \"dayjs\";\nimport timezone from \"dayjs/plugin/timezone\";\nimport utc from \"dayjs/plugin/utc\";\nimport { globalProps } from \"neetocommons/initializers\";\n\ndayjs.extend(utc);\ndayjs.extend(timezone);\n\nexport const getBrowserTimeZone = () => dayjs.tz.guess();\n\nexport const getUserTimeZone = () => globalProps.user?.timeZone;\n\nexport const checkIfTwoTimeZonesAreSame = (timeZone1, timeZone2) =>\n // eslint-disable-next-line @bigbinary/neeto/use-standard-date-time-formats\n dayjs().tz(timeZone1).format(\"Z\") === dayjs().tz(timeZone2).format(\"Z\");\n","/* eslint-disable @bigbinary/neeto/use-webpack-alias */\nimport React, { useEffect, useState } from \"react\";\n\nimport { Button, Modal, Typography } from \"@bigbinary/neetoui\";\nimport PropTypes from \"prop-types\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { useUpdateTimeZone } from \"./useTimeZoneApi\";\nimport {\n checkIfTwoTimeZonesAreSame,\n getBrowserTimeZone,\n getUserTimeZone,\n} from \"./utils\";\n\nconst TimezoneMismatchModal = ({ isOpen = false, onClose = () => {} }) => {\n const { t } = useTranslation();\n const [isTimezoneModalOpen, setIsTimezoneModalOpen] = useState(false);\n const { isLoading, mutate: updateTimeZone } = useUpdateTimeZone();\n const isUserAndBrowserTimeZoneSame = checkIfTwoTimeZonesAreSame(\n getUserTimeZone(),\n getBrowserTimeZone()\n );\n\n const handleUpdateTimeZone = () => {\n const payload = { timeZone: getBrowserTimeZone() };\n\n updateTimeZone(payload, {\n onSuccess: () => {\n setIsTimezoneModalOpen(false);\n onClose();\n },\n });\n };\n\n const handleCancel = () => {\n setIsTimezoneModalOpen(false);\n onClose();\n };\n\n useEffect(() => {\n if (process.env.RAILS_ENV !== \"heroku\") {\n setIsTimezoneModalOpen(!isUserAndBrowserTimeZoneSame);\n }\n }, []);\n\n return (\n <Modal\n closeOnOutsideClick={false}\n isOpen={isTimezoneModalOpen || isOpen}\n size=\"large\"\n onClose={handleCancel}\n >\n <Modal.Header>\n <Typography style=\"h2\" weight=\"normal\">\n {t(\"neetoMolecules.alert.timezone.title\")}\n </Typography>\n </Modal.Header>\n <Modal.Body>\n <span className=\"flex flex-col space-y-4\">\n <Typography component=\"span\" style=\"body2\">\n {t(\"neetoMolecules.alert.timezone.message\", {\n entity: globalProps.appName,\n })}\n </Typography>\n <Typography component=\"span\" style=\"h4\">\n {t(\"neetoMolecules.alert.timezone.userTimezone\", {\n entity: getUserTimeZone(),\n })}\n </Typography>\n <Typography component=\"span\" style=\"h4\">\n {t(\"neetoMolecules.alert.timezone.browserTimezone\", {\n entity: getBrowserTimeZone(),\n })}\n </Typography>\n </span>\n </Modal.Body>\n <Modal.Footer className=\"space-x-2\">\n <Button\n data-testid=\"update-timezone-button\"\n disabled={isLoading}\n label={t(\"neetoMolecules.alert.timezone.updateProfile\")}\n loading={isLoading}\n style=\"primary\"\n onClick={handleUpdateTimeZone}\n />\n <Button\n label={t(\"neetoMolecules.common.actions.cancel\")}\n style=\"text\"\n onClick={handleCancel}\n />\n </Modal.Footer>\n </Modal>\n );\n};\n\nTimezoneMismatchModal.propTypes = {\n /**\n * Boolean value to toggle the modal.\n */\n isOpen: PropTypes.bool,\n /**\n * The function that's called after the modal is closed.\n */\n onClose: PropTypes.func,\n};\n\nexport default TimezoneMismatchModal;\n"],"names":["timeZoneUrl","updateTimeZone","payload","axios","patch","timeZoneApi","useUpdateTimeZone","useMutation","onSuccess","window","location","reload","dayjs","extend","utc","timezone","getBrowserTimeZone","tz","guess","getUserTimeZone","_globalProps$user","globalProps","user","timeZone","checkIfTwoTimeZonesAreSame","timeZone1","timeZone2","format","TimezoneMismatchModal","_ref","_ref$isOpen","isOpen","_ref$onClose","onClose","_useTranslation","useTranslation","t","_useState","useState","_useState2","_slicedToArray","isTimezoneModalOpen","setIsTimezoneModalOpen","_useUpdateTimeZone","isLoading","mutate","isUserAndBrowserTimeZoneSame","handleUpdateTimeZone","handleCancel","useEffect","process","env","RAILS_ENV","React","createElement","Modal","closeOnOutsideClick","size","Header","Typography","style","weight","Body","className","component","entity","appName","Footer","Button","disabled","label","loading","onClick"],"mappings":";;;;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AA,SAAS,EAAC,MAAM;AAACJ,IAAAA,KAAK,EAAC,IAAA;GAChCxB,EAAAA,CAAC,CAAC,4CAA4C,EAAE;IAC/C6B,MAAM,EAAE9C,eAAe,EAAC;AAC1B,GAAC,CACS,CAAC,eACbkC,cAAA,CAAAC,aAAA,CAACK,UAAU,EAAA;AAACK,IAAAA,SAAS,EAAC,MAAM;AAACJ,IAAAA,KAAK,EAAC,IAAA;GAChCxB,EAAAA,CAAC,CAAC,+CAA+C,EAAE;IAClD6B,MAAM,EAAEjD,kBAAkB,EAAC;GAC5B,CACS,CACR,CACI,CAAC,eACbqC,cAAA,CAAAC,aAAA,CAACC,KAAK,CAACY,MAAM,EAAA;AAACJ,IAAAA,SAAS,EAAC,WAAA;AAAW,GAAA,eACjCV,cAAA,CAAAC,aAAA,CAACc,MAAM,EAAA;AACL,IAAA,aAAA,EAAY,wBAAwB;AACpCC,IAAAA,QAAQ,EAAEzB,SAAU;AACpB0B,IAAAA,KAAK,EAAElC,CAAC,CAAC,6CAA6C,CAAE;AACxDmC,IAAAA,OAAO,EAAE3B,SAAU;AACnBgB,IAAAA,KAAK,EAAC,SAAS;AACfY,IAAAA,OAAO,EAAEzB,oBAAAA;AAAqB,GAC/B,CAAC,eACFM,cAAA,CAAAC,aAAA,CAACc,MAAM,EAAA;AACLE,IAAAA,KAAK,EAAElC,CAAC,CAAC,sCAAsC,CAAE;AACjDwB,IAAAA,KAAK,EAAC,MAAM;AACZY,IAAAA,OAAO,EAAExB,YAAAA;GACV,CACW,CACT,CAAC,CAAA;AAEZ;;;;"}
|
package/dist/cjs/Currency.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
3
5
|
var _extends = require('./extends-1b35a664.js');
|
|
4
6
|
var objectWithoutProperties = require('./objectWithoutProperties-2fed2d7d.js');
|
|
5
7
|
var React = require('react');
|
|
6
|
-
var neetoCist = require('@bigbinary/neeto-cist');
|
|
7
8
|
var neetoui = require('@bigbinary/neetoui');
|
|
8
|
-
var formik = require('@bigbinary/neetoui/formik');
|
|
9
9
|
var reactI18next = require('react-i18next');
|
|
10
|
+
var neetoCist = require('@bigbinary/neeto-cist');
|
|
11
|
+
var formik = require('@bigbinary/neetoui/formik');
|
|
10
12
|
|
|
11
13
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
12
14
|
|
|
@@ -870,32 +872,50 @@ var currencyData = [
|
|
|
870
872
|
}
|
|
871
873
|
];
|
|
872
874
|
|
|
873
|
-
var
|
|
875
|
+
var getCurrencies = function getCurrencies(allowedCurrencies) {
|
|
876
|
+
if (neetoCist.isPresent(allowedCurrencies) && neetoCist.isNotEmpty(allowedCurrencies)) {
|
|
877
|
+
return currencyData.filter(function (item) {
|
|
878
|
+
return allowedCurrencies.includes(item.value);
|
|
879
|
+
});
|
|
880
|
+
}
|
|
881
|
+
return currencyData;
|
|
882
|
+
};
|
|
883
|
+
|
|
884
|
+
var _excluded$1 = ["label", "allowedCurrencies"];
|
|
874
885
|
var Currency = function Currency(_ref) {
|
|
886
|
+
var label = _ref.label,
|
|
887
|
+
allowedCurrencies = _ref.allowedCurrencies,
|
|
888
|
+
otherSelectProps = objectWithoutProperties._objectWithoutProperties(_ref, _excluded$1);
|
|
889
|
+
var _useTranslation = reactI18next.useTranslation(),
|
|
890
|
+
t = _useTranslation.t;
|
|
891
|
+
var data = React.useMemo(function () {
|
|
892
|
+
return getCurrencies(allowedCurrencies);
|
|
893
|
+
}, [allowedCurrencies]);
|
|
894
|
+
return /*#__PURE__*/React__default["default"].createElement(neetoui.Select, _extends._extends({
|
|
895
|
+
label: label || t("neetoMolecules.common.currency"),
|
|
896
|
+
options: data
|
|
897
|
+
}, otherSelectProps));
|
|
898
|
+
};
|
|
899
|
+
|
|
900
|
+
var _excluded = ["label", "name", "allowedCurrencies"];
|
|
901
|
+
var FormikCurrency = function FormikCurrency(_ref) {
|
|
875
902
|
var label = _ref.label,
|
|
876
903
|
_ref$name = _ref.name,
|
|
877
904
|
name = _ref$name === void 0 ? "currency" : _ref$name,
|
|
878
|
-
_ref$standalone = _ref.standalone,
|
|
879
|
-
standalone = _ref$standalone === void 0 ? false : _ref$standalone,
|
|
880
905
|
allowedCurrencies = _ref.allowedCurrencies,
|
|
881
906
|
otherSelectProps = objectWithoutProperties._objectWithoutProperties(_ref, _excluded);
|
|
882
907
|
var _useTranslation = reactI18next.useTranslation(),
|
|
883
908
|
t = _useTranslation.t;
|
|
884
909
|
var data = React.useMemo(function () {
|
|
885
|
-
|
|
886
|
-
return currencyData.filter(function (item) {
|
|
887
|
-
return allowedCurrencies.includes(item.value);
|
|
888
|
-
});
|
|
889
|
-
}
|
|
890
|
-
return currencyData;
|
|
910
|
+
return getCurrencies(allowedCurrencies);
|
|
891
911
|
}, [allowedCurrencies]);
|
|
892
|
-
|
|
893
|
-
return /*#__PURE__*/React__default["default"].createElement(Component, _extends._extends({
|
|
912
|
+
return /*#__PURE__*/React__default["default"].createElement(formik.Select, _extends._extends({
|
|
894
913
|
name: name,
|
|
895
914
|
label: label || t("neetoMolecules.common.currency"),
|
|
896
915
|
options: data
|
|
897
916
|
}, otherSelectProps));
|
|
898
917
|
};
|
|
899
918
|
|
|
900
|
-
|
|
919
|
+
exports.Currency = Currency;
|
|
920
|
+
exports.FormikCurrency = FormikCurrency;
|
|
901
921
|
//# sourceMappingURL=Currency.js.map
|
package/dist/cjs/Currency.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Currency.js","sources":["../../src/components/Currency/
|
|
1
|
+
{"version":3,"file":"Currency.js","sources":["../../src/components/Currency/utils.js","../../src/components/Currency/Currency.jsx","../../src/components/Currency/FormikCurrency.jsx"],"sourcesContent":["import { isPresent, isNotEmpty } from \"neetocist\";\n\nimport currencyData from \"./currencyData.json\";\n\nexport const getCurrencies = allowedCurrencies => {\n if (isPresent(allowedCurrencies) && isNotEmpty(allowedCurrencies)) {\n return currencyData.filter(item => allowedCurrencies.includes(item.value));\n }\n\n return currencyData;\n};\n","import React, { useMemo } from \"react\";\n\nimport { Select } from \"neetoui\";\nimport PropTypes from \"prop-types\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { getCurrencies } from \"./utils\";\n\nconst Currency = ({ label, allowedCurrencies, ...otherSelectProps }) => {\n const { t } = useTranslation();\n\n const data = useMemo(\n () => getCurrencies(allowedCurrencies),\n [allowedCurrencies]\n );\n\n return (\n <Select\n label={label || t(\"neetoMolecules.common.currency\")}\n options={data}\n {...otherSelectProps}\n />\n );\n};\n\nCurrency.propTypes = {\n /**\n * Label for the currency input.\n */\n label: PropTypes.string,\n /**\n * To specify only a selected list of currencies to be used.\n */\n allowedCurrencies: PropTypes.arrayOf(PropTypes.string),\n};\n\nexport default Currency;\n","import React, { useMemo } from \"react\";\n\nimport { Select } from \"neetoui/formik\";\nimport PropTypes from \"prop-types\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { getCurrencies } from \"./utils\";\n\nconst FormikCurrency = ({\n label,\n name = \"currency\",\n allowedCurrencies,\n ...otherSelectProps\n}) => {\n const { t } = useTranslation();\n\n const data = useMemo(\n () => getCurrencies(allowedCurrencies),\n [allowedCurrencies]\n );\n\n return (\n <Select\n {...{ name }}\n label={label || t(\"neetoMolecules.common.currency\")}\n options={data}\n {...otherSelectProps}\n />\n );\n};\n\nFormikCurrency.propTypes = {\n /**\n * Label for the currency input.\n */\n label: PropTypes.string,\n /**\n * Name for the currency input.\n */\n name: PropTypes.string,\n /**\n * To specify only a selected list of currencies to be used.\n */\n allowedCurrencies: PropTypes.arrayOf(PropTypes.string),\n};\n\nexport default FormikCurrency;\n"],"names":["getCurrencies","allowedCurrencies","isPresent","isNotEmpty","currencyData","filter","item","includes","value","Currency","_ref","label","otherSelectProps","_objectWithoutProperties","_excluded","_useTranslation","useTranslation","t","data","useMemo","React","createElement","Select","_extends","options","FormikC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AAA;AAEnB,EAAA,IAAAC,eAAA,GAAcC,2BAAc,EAAE;IAAtBC,CAAC,GAAAF,eAAA,CAADE,CAAC,CAAA;EAET,IAAMC,IAAI,GAAGC,aAAO,CAClB,YAAA;IAAA,OAAMnB,aAAa,CAACC,iBAAiB,CAAC,CAAA;GACtC,EAAA,CAACA,iBAAiB,CACpB,CAAC,CAAA;AAED,EAAA,oBACEmB,yBAAA,CAAAC,aAAA,CAACC,aAAM,EAAAC,iBAAA,CAAA;AACCI,IAAAA,IAAI,EAAJA,IAAI;AACVhB,IAAAA,KAAK,EAAEA,KAAK,IAAIM,CAAC,CAAC,gCAAgC,CAAE;AACpDO,IAAAA,OAAO,EAAEN,IAAAA;GACLN,EAAAA,gBAAgB,CACrB,CAAC,CAAA;AAEN;;;;;"}
|
|
@@ -7,6 +7,8 @@ var reactI18next = require('react-i18next');
|
|
|
7
7
|
var reactQuery = require('react-query');
|
|
8
8
|
var axios = require('axios');
|
|
9
9
|
var dayjs = require('dayjs');
|
|
10
|
+
var timezone = require('dayjs/plugin/timezone');
|
|
11
|
+
var utc = require('dayjs/plugin/utc');
|
|
10
12
|
var initializers = require('@bigbinary/neeto-commons-frontend/initializers');
|
|
11
13
|
|
|
12
14
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -14,6 +16,8 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
14
16
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
15
17
|
var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
|
|
16
18
|
var dayjs__default = /*#__PURE__*/_interopDefaultLegacy(dayjs);
|
|
19
|
+
var timezone__default = /*#__PURE__*/_interopDefaultLegacy(timezone);
|
|
20
|
+
var utc__default = /*#__PURE__*/_interopDefaultLegacy(utc);
|
|
17
21
|
|
|
18
22
|
var timeZoneUrl = "api/v1/time_zone";
|
|
19
23
|
var updateTimeZone = function updateTimeZone(payload) {
|
|
@@ -31,6 +35,8 @@ var useUpdateTimeZone = function useUpdateTimeZone() {
|
|
|
31
35
|
});
|
|
32
36
|
};
|
|
33
37
|
|
|
38
|
+
dayjs__default["default"].extend(utc__default["default"]);
|
|
39
|
+
dayjs__default["default"].extend(timezone__default["default"]);
|
|
34
40
|
var getBrowserTimeZone = function getBrowserTimeZone() {
|
|
35
41
|
return dayjs__default["default"].tz.guess();
|
|
36
42
|
};
|
|
@@ -39,7 +45,10 @@ var getUserTimeZone = function getUserTimeZone() {
|
|
|
39
45
|
return (_globalProps$user = initializers.globalProps.user) === null || _globalProps$user === void 0 ? void 0 : _globalProps$user.timeZone;
|
|
40
46
|
};
|
|
41
47
|
var checkIfTwoTimeZonesAreSame = function checkIfTwoTimeZonesAreSame(timeZone1, timeZone2) {
|
|
42
|
-
return
|
|
48
|
+
return (
|
|
49
|
+
// eslint-disable-next-line @bigbinary/neeto/use-standard-date-time-formats
|
|
50
|
+
dayjs__default["default"]().tz(timeZone1).format("Z") === dayjs__default["default"]().tz(timeZone2).format("Z")
|
|
51
|
+
);
|
|
43
52
|
};
|
|
44
53
|
|
|
45
54
|
var TimezoneMismatchModal = function TimezoneMismatchModal(_ref) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimezoneMismatchModal.js","sources":["../../src/components/TimezoneMismatchModal/apis/time_zone.js","../../src/components/TimezoneMismatchModal/useTimeZoneApi.js","../../src/components/TimezoneMismatchModal/utils.js","../../src/components/TimezoneMismatchModal/index.jsx"],"sourcesContent":["import axios from \"axios\";\n\nconst timeZoneUrl = \"api/v1/time_zone\";\n\nconst updateTimeZone = payload => axios.patch(timeZoneUrl, payload);\n\nconst timeZoneApi = { updateTimeZone };\n\nexport default timeZoneApi;\n","import { useMutation } from \"react-query\";\n\nimport timeZoneApi from \"./apis/time_zone\";\n\nconst useUpdateTimeZone = () =>\n useMutation(timeZoneApi.updateTimeZone, {\n onSuccess: () => window.location.reload(),\n });\n\nexport { useUpdateTimeZone };\n","import dayjs from \"dayjs\";\nimport { globalProps } from \"neetocommons/initializers\";\n\nexport const getBrowserTimeZone = () => dayjs.tz.guess();\n\nexport const getUserTimeZone = () => globalProps.user?.timeZone;\n\nexport const checkIfTwoTimeZonesAreSame = (timeZone1, timeZone2) =>\n dayjs().tz(timeZone1).format(\"Z\") === dayjs().tz(timeZone2).format(\"Z\");\n","/* eslint-disable @bigbinary/neeto/use-webpack-alias */\nimport React, { useEffect, useState } from \"react\";\n\nimport { Button, Modal, Typography } from \"@bigbinary/neetoui\";\nimport PropTypes from \"prop-types\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { useUpdateTimeZone } from \"./useTimeZoneApi\";\nimport {\n checkIfTwoTimeZonesAreSame,\n getBrowserTimeZone,\n getUserTimeZone,\n} from \"./utils\";\n\nconst TimezoneMismatchModal = ({ isOpen = false, onClose = () => {} }) => {\n const { t } = useTranslation();\n const [isTimezoneModalOpen, setIsTimezoneModalOpen] = useState(false);\n const { isLoading, mutate: updateTimeZone } = useUpdateTimeZone();\n const isUserAndBrowserTimeZoneSame = checkIfTwoTimeZonesAreSame(\n getUserTimeZone(),\n getBrowserTimeZone()\n );\n\n const handleUpdateTimeZone = () => {\n const payload = { timeZone: getBrowserTimeZone() };\n\n updateTimeZone(payload, {\n onSuccess: () => {\n setIsTimezoneModalOpen(false);\n onClose();\n },\n });\n };\n\n const handleCancel = () => {\n setIsTimezoneModalOpen(false);\n onClose();\n };\n\n useEffect(() => {\n if (process.env.RAILS_ENV !== \"heroku\") {\n setIsTimezoneModalOpen(!isUserAndBrowserTimeZoneSame);\n }\n }, []);\n\n return (\n <Modal\n closeOnOutsideClick={false}\n isOpen={isTimezoneModalOpen || isOpen}\n size=\"large\"\n onClose={handleCancel}\n >\n <Modal.Header>\n <Typography style=\"h2\" weight=\"normal\">\n {t(\"neetoMolecules.alert.timezone.title\")}\n </Typography>\n </Modal.Header>\n <Modal.Body>\n <span className=\"flex flex-col space-y-4\">\n <Typography component=\"span\" style=\"body2\">\n {t(\"neetoMolecules.alert.timezone.message\", {\n entity: globalProps.appName,\n })}\n </Typography>\n <Typography component=\"span\" style=\"h4\">\n {t(\"neetoMolecules.alert.timezone.userTimezone\", {\n entity: getUserTimeZone(),\n })}\n </Typography>\n <Typography component=\"span\" style=\"h4\">\n {t(\"neetoMolecules.alert.timezone.browserTimezone\", {\n entity: getBrowserTimeZone(),\n })}\n </Typography>\n </span>\n </Modal.Body>\n <Modal.Footer className=\"space-x-2\">\n <Button\n data-testid=\"update-timezone-button\"\n disabled={isLoading}\n label={t(\"neetoMolecules.alert.timezone.updateProfile\")}\n loading={isLoading}\n style=\"primary\"\n onClick={handleUpdateTimeZone}\n />\n <Button\n label={t(\"neetoMolecules.common.actions.cancel\")}\n style=\"text\"\n onClick={handleCancel}\n />\n </Modal.Footer>\n </Modal>\n );\n};\n\nTimezoneMismatchModal.propTypes = {\n /**\n * Boolean value to toggle the modal.\n */\n isOpen: PropTypes.bool,\n /**\n * The function that's called after the modal is closed.\n */\n onClose: PropTypes.func,\n};\n\nexport default TimezoneMismatchModal;\n"],"names":["timeZoneUrl","updateTimeZone","payload","axios","patch","timeZoneApi","useUpdateTimeZone","useMutation","onSuccess","window","location","reload","
|
|
1
|
+
{"version":3,"file":"TimezoneMismatchModal.js","sources":["../../src/components/TimezoneMismatchModal/apis/time_zone.js","../../src/components/TimezoneMismatchModal/useTimeZoneApi.js","../../src/components/TimezoneMismatchModal/utils.js","../../src/components/TimezoneMismatchModal/index.jsx"],"sourcesContent":["import axios from \"axios\";\n\nconst timeZoneUrl = \"api/v1/time_zone\";\n\nconst updateTimeZone = payload => axios.patch(timeZoneUrl, payload);\n\nconst timeZoneApi = { updateTimeZone };\n\nexport default timeZoneApi;\n","import { useMutation } from \"react-query\";\n\nimport timeZoneApi from \"./apis/time_zone\";\n\nconst useUpdateTimeZone = () =>\n useMutation(timeZoneApi.updateTimeZone, {\n onSuccess: () => window.location.reload(),\n });\n\nexport { useUpdateTimeZone };\n","import dayjs from \"dayjs\";\nimport timezone from \"dayjs/plugin/timezone\";\nimport utc from \"dayjs/plugin/utc\";\nimport { globalProps } from \"neetocommons/initializers\";\n\ndayjs.extend(utc);\ndayjs.extend(timezone);\n\nexport const getBrowserTimeZone = () => dayjs.tz.guess();\n\nexport const getUserTimeZone = () => globalProps.user?.timeZone;\n\nexport const checkIfTwoTimeZonesAreSame = (timeZone1, timeZone2) =>\n // eslint-disable-next-line @bigbinary/neeto/use-standard-date-time-formats\n dayjs().tz(timeZone1).format(\"Z\") === dayjs().tz(timeZone2).format(\"Z\");\n","/* eslint-disable @bigbinary/neeto/use-webpack-alias */\nimport React, { useEffect, useState } from \"react\";\n\nimport { Button, Modal, Typography } from \"@bigbinary/neetoui\";\nimport PropTypes from \"prop-types\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { useUpdateTimeZone } from \"./useTimeZoneApi\";\nimport {\n checkIfTwoTimeZonesAreSame,\n getBrowserTimeZone,\n getUserTimeZone,\n} from \"./utils\";\n\nconst TimezoneMismatchModal = ({ isOpen = false, onClose = () => {} }) => {\n const { t } = useTranslation();\n const [isTimezoneModalOpen, setIsTimezoneModalOpen] = useState(false);\n const { isLoading, mutate: updateTimeZone } = useUpdateTimeZone();\n const isUserAndBrowserTimeZoneSame = checkIfTwoTimeZonesAreSame(\n getUserTimeZone(),\n getBrowserTimeZone()\n );\n\n const handleUpdateTimeZone = () => {\n const payload = { timeZone: getBrowserTimeZone() };\n\n updateTimeZone(payload, {\n onSuccess: () => {\n setIsTimezoneModalOpen(false);\n onClose();\n },\n });\n };\n\n const handleCancel = () => {\n setIsTimezoneModalOpen(false);\n onClose();\n };\n\n useEffect(() => {\n if (process.env.RAILS_ENV !== \"heroku\") {\n setIsTimezoneModalOpen(!isUserAndBrowserTimeZoneSame);\n }\n }, []);\n\n return (\n <Modal\n closeOnOutsideClick={false}\n isOpen={isTimezoneModalOpen || isOpen}\n size=\"large\"\n onClose={handleCancel}\n >\n <Modal.Header>\n <Typography style=\"h2\" weight=\"normal\">\n {t(\"neetoMolecules.alert.timezone.title\")}\n </Typography>\n </Modal.Header>\n <Modal.Body>\n <span className=\"flex flex-col space-y-4\">\n <Typography component=\"span\" style=\"body2\">\n {t(\"neetoMolecules.alert.timezone.message\", {\n entity: globalProps.appName,\n })}\n </Typography>\n <Typography component=\"span\" style=\"h4\">\n {t(\"neetoMolecules.alert.timezone.userTimezone\", {\n entity: getUserTimeZone(),\n })}\n </Typography>\n <Typography component=\"span\" style=\"h4\">\n {t(\"neetoMolecules.alert.timezone.browserTimezone\", {\n entity: getBrowserTimeZone(),\n })}\n </Typography>\n </span>\n </Modal.Body>\n <Modal.Footer className=\"space-x-2\">\n <Button\n data-testid=\"update-timezone-button\"\n disabled={isLoading}\n label={t(\"neetoMolecules.alert.timezone.updateProfile\")}\n loading={isLoading}\n style=\"primary\"\n onClick={handleUpdateTimeZone}\n />\n <Button\n label={t(\"neetoMolecules.common.actions.cancel\")}\n style=\"text\"\n onClick={handleCancel}\n />\n </Modal.Footer>\n </Modal>\n );\n};\n\nTimezoneMismatchModal.propTypes = {\n /**\n * Boolean value to toggle the modal.\n */\n isOpen: PropTypes.bool,\n /**\n * The function that's called after the modal is closed.\n */\n onClose: PropTypes.func,\n};\n\nexport default TimezoneMismatchModal;\n"],"names":["timeZoneUrl","updateTimeZone","payload","axios","patch","timeZoneApi","useUpdateTimeZone","useMutation","onSuccess","window","location","reload","dayjs","extend","utc","timezone","getBrowserTimeZone","tz","guess","getUserTimeZone","_globalProps$user","globalProps","user","timeZone","checkIfTwoTimeZonesAreSame","timeZone1","timeZone2","format","TimezoneMismatchModal","_ref","_ref$isOpen","isOpen","_ref$onClose","onClose","_useTranslation","useTranslation","t","_useState","useState","_useState2","_slicedToArray","isTimezoneModalOpen","setIsTimezoneModalOpen","_useUpdateTimeZone","isLoading","mutate","isUserAndBrowserTimeZoneSame","handleUpdateTimeZone","handleCancel","useEffect","process","env","RAILS_ENV","React","createElement","Modal","closeOnOutsideClick","size","Header","Typography","style","weight","Body","className","component","entity","appName","Footer","Button","disabled","label","loading","onClick"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAEA,IAAMA,WAAW,GAAG,kBAAkB,CAAA;AAEtC,IAAMC,cAAc,GAAG,SAAjBA,cAAcA,CAAGC,OAAO,EAAA;AAAA,EAAA,OAAIC,yBAAK,CAACC,KAAK,CAACJ,WAAW,EAAEE,OAAO,CAAC,CAAA;AAAA,CAAA,CAAA;AAEnE,IAAMG,WAAW,GAAG;AAAEJ,EAAAA,cAAc,EAAdA,cAAAA;AAAe,CAAC;;ACFtC,IAAMK,iBAAiB,GAAG,SAApBA,iBAAiBA,GAAA;AAAA,EAAA,OACrBC,sBAAW,CAACF,WAAW,CAACJ,cAAc,EAAE;IACtCO,SAAS,EAAE,SAAAA,SAAA,GAAA;AAAA,MAAA,OAAMC,MAAM,CAACC,QAAQ,CAACC,MAAM,EAAE,CAAA;AAAA,KAAA;AAC3C,GAAC,CAAC,CAAA;AAAA,CAAA;;ACFJC,yBAAK,CAACC,MAAM,CAACC,uBAAG,CAAC,CAAA;AACjBF,yBAAK,CAACC,MAAM,CAACE,4BAAQ,CAAC,CAAA;AAEf,IAAMC,kBAAkB,GAAG,SAArBA,kBAAkBA,GAAA;AAAA,EAAA,OAASJ,yBAAK,CAACK,EAAE,CAACC,KAAK,EAAE,CAAA;AAAA,CAAA,CAAA;AAEjD,IAAMC,eAAe,GAAG,SAAlBA,eAAeA,GAAA;AAAA,EAAA,IAAAC,iBAAA,CAAA;EAAA,OAAAA,CAAAA,iBAAA,GAASC,wBAAW,CAACC,IAAI,cAAAF,iBAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAhBA,iBAAA,CAAkBG,QAAQ,CAAA;AAAA,CAAA,CAAA;AAExD,IAAMC,0BAA0B,GAAG,SAA7BA,0BAA0BA,CAAIC,SAAS,EAAEC,SAAS,EAAA;AAAA,EAAA;AAC7D;IACAd,yBAAK,EAAE,CAACK,EAAE,CAACQ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
|
"description": "A package of reusable molecular components for neeto products.",
|
|
5
5
|
"repository": "git@github.com:bigbinary/neeto-molecules.git",
|
|
6
6
|
"author": "Amaljith K <amaljith.k@bigbinary.com>",
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
"browserify": "^17.0.0",
|
|
121
121
|
"classnames": "^2.3.2",
|
|
122
122
|
"css-loader": "4.3.0",
|
|
123
|
-
"dayjs": "1.11.
|
|
123
|
+
"dayjs": "1.11.10",
|
|
124
124
|
"emoji-mart": "^5.5.2",
|
|
125
125
|
"eslint": "8.14.0",
|
|
126
126
|
"eslint-config-prettier": "8.5.0",
|
|
@@ -200,7 +200,7 @@
|
|
|
200
200
|
"antd": "5.9.2",
|
|
201
201
|
"axios": "^0.27.2",
|
|
202
202
|
"classnames": "^2.3.2",
|
|
203
|
-
"dayjs": "1.11.
|
|
203
|
+
"dayjs": "1.11.10",
|
|
204
204
|
"emoji-mart": "^5.5.2",
|
|
205
205
|
"formik": "2.4.5",
|
|
206
206
|
"i18next": "^22.5.1",
|
package/types/Currency.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { SelectProps } from "@bigbinary/neetoui";
|
|
3
|
+
type CurrencyProps = {
|
|
4
|
+
allowedCurrencies?: string[];
|
|
5
|
+
} & SelectProps;
|
|
3
6
|
/**
|
|
4
7
|
*
|
|
5
8
|
* A component that allows you to select a currency.
|
|
@@ -8,10 +11,22 @@ import { SelectProps } from "@bigbinary/neetoui";
|
|
|
8
11
|
*
|
|
9
12
|
* @example
|
|
10
13
|
*
|
|
11
|
-
* import
|
|
12
|
-
* import Currency from "@bigbinary/neeto-molecules/Currency";
|
|
14
|
+
* import { useState } from "react";
|
|
15
|
+
* import { Currency } from "@bigbinary/neeto-molecules/Currency";
|
|
13
16
|
*
|
|
14
17
|
* const CurrencyContainer = () => {
|
|
18
|
+
* const [currency, setCurrency] = useState();
|
|
19
|
+
* return <Currency onChange={setCurrency} />;
|
|
20
|
+
* };
|
|
21
|
+
* @endexample
|
|
22
|
+
* The Currency component wrapped in Formik.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
*
|
|
26
|
+
* import * as yup from "yup";
|
|
27
|
+
* import { FormikCurrency } from "@bigbinary/neeto-molecules/Currency";
|
|
28
|
+
*
|
|
29
|
+
* const FormikCurrencyContainer = () => {
|
|
15
30
|
* return (
|
|
16
31
|
* <Form
|
|
17
32
|
* formikProps={{
|
|
@@ -21,15 +36,13 @@ import { SelectProps } from "@bigbinary/neetoui";
|
|
|
21
36
|
* }),
|
|
22
37
|
* }}
|
|
23
38
|
* >
|
|
24
|
-
* <
|
|
39
|
+
* <FormikCurrency />
|
|
25
40
|
* <Button className="mt-5" label="Submit" type="submit" />
|
|
26
41
|
* </Form>
|
|
27
42
|
* );
|
|
28
43
|
* };
|
|
29
44
|
* @endexample
|
|
30
45
|
*/
|
|
31
|
-
const Currency: React.FC<
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}> & SelectProps;
|
|
35
|
-
export default Currency;
|
|
46
|
+
const Currency: React.FC<CurrencyProps>;
|
|
47
|
+
const FormikCurrency: React.FC<CurrencyProps>;
|
|
48
|
+
export { Currency, FormikCurrency };
|