nexaas-ui-components 1.0.12 → 1.0.14

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/index.cjs CHANGED
@@ -9,7 +9,7 @@ var zustand = require('zustand');
9
9
  var dateFns = require('date-fns');
10
10
  var react = require('@headlessui/react');
11
11
  var react$1 = require('@headlessui-float/react');
12
- var IntlCurrencyInput = require('react-intl-currency-input');
12
+ var IntlCurrencyInputRaw = require('react-intl-currency-input');
13
13
  var _debounce = require('lodash/debounce');
14
14
  var InputMask = require('react-input-mask');
15
15
  var ReactModalNamespace = require('react-modal');
@@ -41,7 +41,7 @@ function _interopNamespace(e) {
41
41
 
42
42
  var clsx7__default = /*#__PURE__*/_interopDefault(clsx7);
43
43
  var React2__namespace = /*#__PURE__*/_interopNamespace(React2);
44
- var IntlCurrencyInput__default = /*#__PURE__*/_interopDefault(IntlCurrencyInput);
44
+ var IntlCurrencyInputRaw__default = /*#__PURE__*/_interopDefault(IntlCurrencyInputRaw);
45
45
  var _debounce__default = /*#__PURE__*/_interopDefault(_debounce);
46
46
  var InputMask__default = /*#__PURE__*/_interopDefault(InputMask);
47
47
  var ReactModalNamespace__namespace = /*#__PURE__*/_interopNamespace(ReactModalNamespace);
@@ -1732,143 +1732,142 @@ var FilterOptions = ({
1732
1732
  }
1733
1733
  );
1734
1734
  };
1735
- var InputMoney = React2.forwardRef(
1736
- ({
1737
- label,
1738
- type,
1739
- onClick,
1740
- error,
1741
- onBlur,
1742
- onChangeValue,
1743
- inputProps,
1744
- icon,
1745
- clearField,
1746
- name,
1747
- required,
1748
- disabled,
1749
- value,
1750
- placeholder,
1751
- control,
1752
- defaultValue,
1753
- isWeightField,
1754
- minFractionDigits = 2
1755
- }, ref) => {
1756
- const numberConfig = isWeightField ? {
1757
- currency: "BRL",
1758
- minimumFractionDigits: minFractionDigits,
1759
- maximumFractionDigits: minFractionDigits,
1760
- useGrouping: false
1761
- } : {
1762
- style: "currency",
1763
- currency: "BRL",
1764
- minimumFractionDigits: minFractionDigits,
1765
- maximumFractionDigits: minFractionDigits
1766
- };
1767
- const currencyConfig = {
1768
- locale: "pt-BR",
1769
- formats: {
1770
- number: {
1771
- BRL: numberConfig
1772
- }
1735
+ var IntlCurrencyInput = IntlCurrencyInputRaw__default.default.default || IntlCurrencyInputRaw__default.default;
1736
+ var intl_currency_input_default = IntlCurrencyInput;
1737
+ function InputMoney({
1738
+ label,
1739
+ type,
1740
+ onClick,
1741
+ error,
1742
+ onBlur,
1743
+ onChangeValue,
1744
+ inputProps,
1745
+ icon,
1746
+ clearField,
1747
+ name,
1748
+ required,
1749
+ disabled,
1750
+ value,
1751
+ placeholder,
1752
+ control,
1753
+ defaultValue,
1754
+ isWeightField,
1755
+ minFractionDigits = 2
1756
+ }) {
1757
+ const numberConfig = isWeightField ? {
1758
+ currency: "BRL",
1759
+ minimumFractionDigits: minFractionDigits,
1760
+ maximumFractionDigits: minFractionDigits,
1761
+ useGrouping: false
1762
+ } : {
1763
+ style: "currency",
1764
+ currency: "BRL",
1765
+ minimumFractionDigits: minFractionDigits,
1766
+ maximumFractionDigits: minFractionDigits
1767
+ };
1768
+ const currencyConfig = {
1769
+ locale: "pt-BR",
1770
+ formats: {
1771
+ number: {
1772
+ BRL: numberConfig
1773
1773
  }
1774
- };
1775
- const fieldValidationMessages = [error == null ? void 0 : error.message];
1776
- const hasError = fieldValidationMessages.some((item) => item !== void 0);
1777
- const styles = {
1778
- input: `text-p-md pl-2 peer text-paragraph shadow-input border rounded-lg outline-none block pb-[10px] h-[46px] w-full disabled:bg-neutral-100 focus-visible:border ${label ? "pt-[22px]" : "pt-[10px]"} ${hasError ? "border-dangerous-500 text-dangerous-500" : "border-neutral-300 focus-visible:border-blue-500"}`,
1779
- icon: `absolute bg-neutral-100 h-[44px] top-[1px] left-[1px] w-[38px] rounded-l-lg ${hasError ? "text-dangerous-500" : "text-label"}
1774
+ }
1775
+ };
1776
+ const fieldValidationMessages = [error == null ? void 0 : error.message];
1777
+ const hasError = fieldValidationMessages.some((item) => item !== void 0);
1778
+ const styles = {
1779
+ input: `text-p-md pl-2 peer text-paragraph shadow-input border rounded-lg outline-none block pb-[10px] h-[46px] w-full disabled:bg-neutral-100 focus-visible:border ${label ? "pt-[22px]" : "pt-[10px]"} ${hasError ? "border-dangerous-500 text-dangerous-500" : "border-neutral-300 focus-visible:border-blue-500"}`,
1780
+ icon: `absolute bg-neutral-100 h-[44px] top-[1px] left-[1px] w-[38px] rounded-l-lg ${hasError ? "text-dangerous-500" : "text-label"}
1780
1781
  `,
1781
- label: "absolute text-label top-[0.80rem] z-10 origin-[0] transform -translate-y-3 scale-75 duration-300 text-sm peer-focus:text-blue-500 peer-focus:scale-75 peer-focus:-translate-y-3 peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-y-0"};
1782
- return /* @__PURE__ */ jsxRuntime.jsx(
1783
- reactHookForm.Controller,
1784
- {
1785
- control,
1786
- name,
1787
- defaultValue,
1788
- render: ({ field }) => {
1789
- const handleChange = (event, value2, maskedValue) => {
1790
- event.preventDefault();
1791
- field.onChange(value2);
1792
- if (onChangeValue) {
1793
- onChangeValue(value2);
1794
- }
1795
- };
1796
- if (typeof field.value === "string")
1797
- field.value = Number(field.value);
1798
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1799
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative outline-none", children: [
1800
- icon && /* @__PURE__ */ jsxRuntime.jsx(
1801
- "div",
1782
+ label: "absolute text-label top-[0.80rem] z-10 origin-[0] transform -translate-y-3 scale-75 duration-300 text-sm peer-focus:text-blue-500 peer-focus:scale-75 peer-focus:-translate-y-3 peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-y-0"};
1783
+ return /* @__PURE__ */ jsxRuntime.jsx(
1784
+ reactHookForm.Controller,
1785
+ {
1786
+ control,
1787
+ name,
1788
+ defaultValue,
1789
+ render: ({ field }) => {
1790
+ const handleChange = (event, value2, maskedValue) => {
1791
+ event.preventDefault();
1792
+ field.onChange(value2);
1793
+ if (onChangeValue) {
1794
+ onChangeValue(value2);
1795
+ }
1796
+ };
1797
+ if (typeof field.value === "string")
1798
+ field.value = Number(field.value);
1799
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1800
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative outline-none", children: [
1801
+ icon && /* @__PURE__ */ jsxRuntime.jsx(
1802
+ "div",
1803
+ {
1804
+ className: clsx7__default.default(
1805
+ styles.icon,
1806
+ "flex justify-center items-center"
1807
+ ),
1808
+ children: icon
1809
+ }
1810
+ ),
1811
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1812
+ /* @__PURE__ */ jsxRuntime.jsx(
1813
+ intl_currency_input_default,
1814
+ {
1815
+ ...inputProps,
1816
+ ...field,
1817
+ type: "text",
1818
+ className: clsx7__default.default({
1819
+ [styles.input]: true,
1820
+ ["pr-10"]: clearField,
1821
+ ["pr-2"]: !clearField,
1822
+ ["pl-[46px]"]: !label && placeholder && icon || icon
1823
+ }),
1824
+ placeholder: !label && placeholder ? placeholder : " ",
1825
+ onClick,
1826
+ disabled,
1827
+ currency: "BRL",
1828
+ config: currencyConfig,
1829
+ onChange: handleChange,
1830
+ onBlur: () => {
1831
+ if (onBlur) {
1832
+ onBlur(field.value);
1833
+ }
1834
+ }
1835
+ }
1836
+ ),
1837
+ /* @__PURE__ */ jsxRuntime.jsxs(
1838
+ "label",
1802
1839
  {
1803
1840
  className: clsx7__default.default(
1804
- styles.icon,
1805
- "flex justify-center items-center"
1841
+ {
1842
+ [styles.label]: true,
1843
+ ["left-[46px]"]: icon,
1844
+ ["left-2.5"]: !icon
1845
+ },
1846
+ "cursor-text"
1806
1847
  ),
1807
- children: icon
1848
+ children: [
1849
+ label,
1850
+ required && label && /* @__PURE__ */ jsxRuntime.jsx("strong", { className: "text-dangerous-500", children: "\xA0*" })
1851
+ ]
1808
1852
  }
1809
- ),
1810
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1811
- /* @__PURE__ */ jsxRuntime.jsx(
1812
- IntlCurrencyInput__default.default,
1813
- {
1814
- ...inputProps,
1815
- ...field,
1816
- type: "text",
1817
- ref,
1818
- className: clsx7__default.default({
1819
- [styles.input]: true,
1820
- ["pr-10"]: clearField,
1821
- ["pr-2"]: !clearField,
1822
- ["pl-[46px]"]: !label && placeholder && icon || icon
1823
- }),
1824
- placeholder: !label && placeholder ? placeholder : " ",
1825
- onClick,
1826
- disabled,
1827
- currency: "BRL",
1828
- config: currencyConfig,
1829
- onChange: handleChange,
1830
- onBlur: () => {
1831
- if (onBlur) {
1832
- onBlur(field.value);
1833
- }
1834
- }
1835
- }
1836
- ),
1837
- /* @__PURE__ */ jsxRuntime.jsxs(
1838
- "label",
1839
- {
1840
- className: clsx7__default.default(
1841
- {
1842
- [styles.label]: true,
1843
- ["left-[46px]"]: icon,
1844
- ["left-2.5"]: !icon
1845
- },
1846
- "cursor-text"
1847
- ),
1848
- children: [
1849
- label,
1850
- required && label && /* @__PURE__ */ jsxRuntime.jsx("strong", { className: "text-dangerous-500", children: "\xA0*" })
1851
- ]
1852
- }
1853
- )
1854
- ] })
1855
- ] }),
1856
- fieldValidationMessages.map((message, index) => /* @__PURE__ */ jsxRuntime.jsx(
1857
- "div",
1858
- {
1859
- className: "text-dangerous-500 text-xs mt-1 ml-[2px]",
1860
- role: "alert",
1861
- "aria-label": message,
1862
- children: message
1863
- },
1864
- index
1865
- ))
1866
- ] });
1867
- }
1853
+ )
1854
+ ] })
1855
+ ] }),
1856
+ fieldValidationMessages.map((message, index) => /* @__PURE__ */ jsxRuntime.jsx(
1857
+ "div",
1858
+ {
1859
+ className: "text-dangerous-500 text-xs mt-1 ml-[2px]",
1860
+ role: "alert",
1861
+ "aria-label": message,
1862
+ children: message
1863
+ },
1864
+ index
1865
+ ))
1866
+ ] });
1868
1867
  }
1869
- );
1870
- }
1871
- );
1868
+ }
1869
+ );
1870
+ }
1872
1871
  InputMoney.displayName = "InputMoney";
1873
1872
  function InputNumber({
1874
1873
  label,
@@ -2107,7 +2106,6 @@ function InputPercentage({
2107
2106
  }
2108
2107
  }
2109
2108
  };
2110
- let inputRef = React2.useRef(null);
2111
2109
  const fieldValidationMessages = [error == null ? void 0 : error.message];
2112
2110
  const hasError = fieldValidationMessages.some((item) => item !== void 0);
2113
2111
  const styles = {
@@ -2145,12 +2143,11 @@ function InputPercentage({
2145
2143
  ),
2146
2144
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
2147
2145
  /* @__PURE__ */ jsxRuntime.jsx(
2148
- IntlCurrencyInput__default.default,
2146
+ intl_currency_input_default,
2149
2147
  {
2150
2148
  ...inputProps,
2151
2149
  ...field,
2152
2150
  type: "text",
2153
- ref: inputRef,
2154
2151
  className: clsx7__default.default({
2155
2152
  [styles.input]: true,
2156
2153
  ["pr-10"]: clearField,
@@ -2280,61 +2277,6 @@ var MaskedInput = ({
2280
2277
  }
2281
2278
  );
2282
2279
  };
2283
- function InputTest({
2284
- label,
2285
- name,
2286
- control,
2287
- error,
2288
- required,
2289
- placeholder,
2290
- disabled,
2291
- defaultValue
2292
- }) {
2293
- const fieldValidationMessages = [error == null ? void 0 : error.message];
2294
- const hasError = fieldValidationMessages.some((item) => item !== void 0);
2295
- const styles = {
2296
- input: `text-p-md pl-2 peer shadow-input border rounded-lg outline-none block pb-[10px] h-[46px] w-full disabled:bg-neutral-100 focus-visible:border-1 ${label ? "pt-[22px]" : "pt-[10px]"} ${hasError ? "border-dangerous-500 text-dangerous-500" : "border-neutral-300 focus-visible:border-blue-500"}`,
2297
- label: "absolute text-label top-[0.80rem] z-10 origin-[0] transform -translate-y-3 scale-75 duration-300 text-sm peer-focus:text-blue-500 peer-focus:scale-75 peer-focus:-translate-y-3 peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-y-0 left-2.5 cursor-text"
2298
- };
2299
- return /* @__PURE__ */ jsxRuntime.jsx(
2300
- reactHookForm.Controller,
2301
- {
2302
- control,
2303
- name,
2304
- defaultValue,
2305
- render: ({ field }) => {
2306
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
2307
- /* @__PURE__ */ jsxRuntime.jsx(
2308
- "input",
2309
- {
2310
- ...field,
2311
- type: "text",
2312
- id: name,
2313
- className: clsx7__default.default(styles.input),
2314
- placeholder: !label && placeholder ? placeholder : " ",
2315
- disabled
2316
- }
2317
- ),
2318
- /* @__PURE__ */ jsxRuntime.jsxs("label", { className: clsx7__default.default(styles.label), children: [
2319
- label,
2320
- required && label && /* @__PURE__ */ jsxRuntime.jsx("strong", { className: "text-dangerous-500", children: "\xA0*" })
2321
- ] }),
2322
- fieldValidationMessages.map((message, index) => /* @__PURE__ */ jsxRuntime.jsx(
2323
- "div",
2324
- {
2325
- className: "text-dangerous-500 text-xs mt-1 ml-[2px]",
2326
- role: "alert",
2327
- "aria-label": message,
2328
- children: message
2329
- },
2330
- index
2331
- ))
2332
- ] });
2333
- }
2334
- }
2335
- );
2336
- }
2337
- InputTest.displayName = "InputTest";
2338
2280
  var Modal = ReactModalNamespace__namespace.default || ReactModalNamespace__namespace;
2339
2281
  var alertTypes = {
2340
2282
  success: "text-success-500",
@@ -3802,7 +3744,6 @@ exports.Input = Input;
3802
3744
  exports.InputMoney = InputMoney;
3803
3745
  exports.InputNumber = InputNumber;
3804
3746
  exports.InputPercentage = InputPercentage;
3805
- exports.InputTest = InputTest;
3806
3747
  exports.Logo = Logo;
3807
3748
  exports.MaskedInput = MaskedInput;
3808
3749
  exports.ModalDialog = ModalDialog;