@bigbinary/neeto-molecules 1.9.5 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Currency.js","sources":["../../node_modules/@babel/runtime/helpers/esm/extends.js","../../node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js","../../node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js","../../src/components/Currency/index.jsx"],"sourcesContent":["export default function _extends() {\n _extends = Object.assign ? Object.assign.bind() : function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n };\n return _extends.apply(this, arguments);\n}","export default function _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n return target;\n}","import objectWithoutPropertiesLoose from \"./objectWithoutPropertiesLoose.js\";\nexport default function _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n var target = objectWithoutPropertiesLoose(source, excluded);\n var key, i;\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n return target;\n}","import React, { useMemo } from \"react\";\n\nimport { isPresent, isNotEmpty } from \"neetocist\";\nimport { Select } from \"neetoui\";\nimport { Select as FormSelect } from \"neetoui/formik\";\nimport PropTypes from \"prop-types\";\nimport { useTranslation } from \"react-i18next\";\n\nimport currencyData from \"./currencyData.json\";\n\nconst Currency = ({\n label,\n name = \"currency\",\n standalone = false,\n allowedCurrencies,\n ...otherSelectProps\n}) => {\n const { t } = useTranslation();\n\n const data = useMemo(() => {\n if (isPresent(allowedCurrencies) && isNotEmpty(allowedCurrencies)) {\n return currencyData.filter(item =>\n allowedCurrencies.includes(item.value)\n );\n }\n\n return currencyData;\n }, [allowedCurrencies]);\n\n const Component = standalone ? Select : FormSelect;\n\n return (\n <Component\n {...{ name }}\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 * Name for the currency input.\n */\n name: PropTypes.string,\n /**\n * To specify whether Currency can be used outside of formik.\n */\n standalone: PropTypes.bool,\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"],"names":["objectWithoutPropertiesLoose","Currency","_ref","label","_ref$name","name","_ref$standalone","standalone","allowedCurrencies","otherSelectProps","_objectWithoutProperties","_excluded","_useTranslation","useTranslation","t","data","useMemo","isPresent","isNotEmpty","currencyData","filter","item","includes","value","Component","Select","FormSelect","React","createElement","_extends","options"],"mappings":";;;;;;;;;;;;AAAe,SAAS,QAAQ,GAAG;AACnC,EAAE,QAAQ,GAAG,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,UAAU,MAAM,EAAE;AACtE,IAAI,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AAC/C,MAAM,IAAI,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;AAChC,MAAM,KAAK,IAAI,GAAG,IAAI,MAAM,EAAE;AAC9B,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE;AAC/D,UAAU,MAAM,CAAC,GAAG,C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C,aAAU,CAAA;AAElD,EAAA,oBACEC,yBAAA,CAAAC,aAAA,CAACJ,SAAS,EAAAK,QAAA,CAAA;AACFxB,IAAAA,IAAI,EAAJA,IAAI;AACVF,IAAAA,KAAK,EAAEA,KAAK,IAAIW,CAAC,CAAC,gCAAgC,CAAE;AACpDgB,IAAAA,OAAO,EAAEf,IAAAA;GACLN,EAAAA,gBAAgB,CACrB,CAAC,CAAA;AAEN;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigbinary/neeto-molecules",
3
- "version": "1.9.5",
3
+ "version": "1.10.0",
4
4
  "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>",
@@ -37,6 +37,7 @@
37
37
  "download": "Download",
38
38
  "filter": "Filter",
39
39
  "somethingWentWrong": "Something went wrong. Please try again.",
40
+ "currency": "Currency",
40
41
  "emojiPicker": "Emoji picker"
41
42
  },
42
43
  "columns": {
@@ -0,0 +1,35 @@
1
+ import React from "react";
2
+ import { SelectProps } from "@bigbinary/neetoui";
3
+ /**
4
+ *
5
+ * Used in neeto products to select currencies.
6
+ *
7
+ * ![Screenshot](https://github.com/bigbinary/neeto-molecules/assets/10956193/422f706f-8873-4091-866f-f09c24958b69|height=200|width=300)
8
+ *
9
+ * @example
10
+ *
11
+ * import * as yup from "yup";
12
+ * import Currency from "@bigbinary/neeto-molecules/Currency";
13
+ *
14
+ * const CurrencyContainer = () => {
15
+ * return (
16
+ * <Form
17
+ * formikProps={{
18
+ * initialValues: { currency: null },
19
+ * validationSchema: yup.object().shape({
20
+ * currency: yup.object().required(),
21
+ * }),
22
+ * }}
23
+ * >
24
+ * <Currency />
25
+ * <Button className="mt-5" label="Submit" type="submit" />
26
+ * </Form>
27
+ * );
28
+ * };
29
+ * @endexample
30
+ */
31
+ const Currency: React.FC<{
32
+ standalone?: boolean;
33
+ allowedCurrencies?: string[];
34
+ }> & SelectProps;
35
+ export default Currency;