nexaas-ui-components 1.0.12 → 1.0.13

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.d.cts CHANGED
@@ -222,7 +222,10 @@ type InputMoneyProps = DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>,
222
222
  isWeightField?: boolean;
223
223
  minFractionDigits?: number;
224
224
  };
225
- declare const InputMoney: React__default.ForwardRefExoticComponent<Omit<InputMoneyProps, "ref"> & React__default.RefAttributes<unknown>>;
225
+ declare function InputMoney({ label, type, onClick, error, onBlur, onChangeValue, inputProps, icon, clearField, name, required, disabled, value, placeholder, control, defaultValue, isWeightField, minFractionDigits, }: InputMoneyProps): react_jsx_runtime.JSX.Element;
226
+ declare namespace InputMoney {
227
+ var displayName: string;
228
+ }
226
229
 
227
230
  type InputNumberProps = DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement> & {
228
231
  label?: string;
package/dist/index.d.ts CHANGED
@@ -222,7 +222,10 @@ type InputMoneyProps = DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>,
222
222
  isWeightField?: boolean;
223
223
  minFractionDigits?: number;
224
224
  };
225
- declare const InputMoney: React__default.ForwardRefExoticComponent<Omit<InputMoneyProps, "ref"> & React__default.RefAttributes<unknown>>;
225
+ declare function InputMoney({ label, type, onClick, error, onBlur, onChangeValue, inputProps, icon, clearField, name, required, disabled, value, placeholder, control, defaultValue, isWeightField, minFractionDigits, }: InputMoneyProps): react_jsx_runtime.JSX.Element;
226
+ declare namespace InputMoney {
227
+ var displayName: string;
228
+ }
226
229
 
227
230
  type InputNumberProps = DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement> & {
228
231
  label?: string;
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ import { create } from 'zustand';
8
8
  import { parse, format, set, startOfWeek, endOfWeek, startOfMonth, endOfMonth, sub, subYears } from 'date-fns';
9
9
  import { Switch, Popover, PopoverButton, PopoverPanel, Listbox, ListboxOptions, Combobox, ListboxOption } from '@headlessui/react';
10
10
  import { Float } from '@headlessui-float/react';
11
- import IntlCurrencyInput from 'react-intl-currency-input';
11
+ import IntlCurrencyInputRaw from 'react-intl-currency-input';
12
12
  import _debounce from 'lodash/debounce';
13
13
  import InputMask from 'react-input-mask';
14
14
  import * as ReactModalNamespace from 'react-modal';
@@ -1703,143 +1703,142 @@ var FilterOptions = ({
1703
1703
  }
1704
1704
  );
1705
1705
  };
1706
- var InputMoney = forwardRef(
1707
- ({
1708
- label,
1709
- type,
1710
- onClick,
1711
- error,
1712
- onBlur,
1713
- onChangeValue,
1714
- inputProps,
1715
- icon,
1716
- clearField,
1717
- name,
1718
- required,
1719
- disabled,
1720
- value,
1721
- placeholder,
1722
- control,
1723
- defaultValue,
1724
- isWeightField,
1725
- minFractionDigits = 2
1726
- }, ref) => {
1727
- const numberConfig = isWeightField ? {
1728
- currency: "BRL",
1729
- minimumFractionDigits: minFractionDigits,
1730
- maximumFractionDigits: minFractionDigits,
1731
- useGrouping: false
1732
- } : {
1733
- style: "currency",
1734
- currency: "BRL",
1735
- minimumFractionDigits: minFractionDigits,
1736
- maximumFractionDigits: minFractionDigits
1737
- };
1738
- const currencyConfig = {
1739
- locale: "pt-BR",
1740
- formats: {
1741
- number: {
1742
- BRL: numberConfig
1743
- }
1706
+ var IntlCurrencyInput = IntlCurrencyInputRaw.default || IntlCurrencyInputRaw;
1707
+ var intl_currency_input_default = IntlCurrencyInput;
1708
+ function InputMoney({
1709
+ label,
1710
+ type,
1711
+ onClick,
1712
+ error,
1713
+ onBlur,
1714
+ onChangeValue,
1715
+ inputProps,
1716
+ icon,
1717
+ clearField,
1718
+ name,
1719
+ required,
1720
+ disabled,
1721
+ value,
1722
+ placeholder,
1723
+ control,
1724
+ defaultValue,
1725
+ isWeightField,
1726
+ minFractionDigits = 2
1727
+ }) {
1728
+ const numberConfig = isWeightField ? {
1729
+ currency: "BRL",
1730
+ minimumFractionDigits: minFractionDigits,
1731
+ maximumFractionDigits: minFractionDigits,
1732
+ useGrouping: false
1733
+ } : {
1734
+ style: "currency",
1735
+ currency: "BRL",
1736
+ minimumFractionDigits: minFractionDigits,
1737
+ maximumFractionDigits: minFractionDigits
1738
+ };
1739
+ const currencyConfig = {
1740
+ locale: "pt-BR",
1741
+ formats: {
1742
+ number: {
1743
+ BRL: numberConfig
1744
1744
  }
1745
- };
1746
- const fieldValidationMessages = [error == null ? void 0 : error.message];
1747
- const hasError = fieldValidationMessages.some((item) => item !== void 0);
1748
- const styles = {
1749
- 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"}`,
1750
- icon: `absolute bg-neutral-100 h-[44px] top-[1px] left-[1px] w-[38px] rounded-l-lg ${hasError ? "text-dangerous-500" : "text-label"}
1745
+ }
1746
+ };
1747
+ const fieldValidationMessages = [error == null ? void 0 : error.message];
1748
+ const hasError = fieldValidationMessages.some((item) => item !== void 0);
1749
+ const styles = {
1750
+ 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"}`,
1751
+ icon: `absolute bg-neutral-100 h-[44px] top-[1px] left-[1px] w-[38px] rounded-l-lg ${hasError ? "text-dangerous-500" : "text-label"}
1751
1752
  `,
1752
- 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"};
1753
- return /* @__PURE__ */ jsx(
1754
- Controller,
1755
- {
1756
- control,
1757
- name,
1758
- defaultValue,
1759
- render: ({ field }) => {
1760
- const handleChange = (event, value2, maskedValue) => {
1761
- event.preventDefault();
1762
- field.onChange(value2);
1763
- if (onChangeValue) {
1764
- onChangeValue(value2);
1765
- }
1766
- };
1767
- if (typeof field.value === "string")
1768
- field.value = Number(field.value);
1769
- return /* @__PURE__ */ jsxs("div", { children: [
1770
- /* @__PURE__ */ jsxs("div", { className: "relative outline-none", children: [
1771
- icon && /* @__PURE__ */ jsx(
1772
- "div",
1753
+ 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"};
1754
+ return /* @__PURE__ */ jsx(
1755
+ Controller,
1756
+ {
1757
+ control,
1758
+ name,
1759
+ defaultValue,
1760
+ render: ({ field }) => {
1761
+ const handleChange = (event, value2, maskedValue) => {
1762
+ event.preventDefault();
1763
+ field.onChange(value2);
1764
+ if (onChangeValue) {
1765
+ onChangeValue(value2);
1766
+ }
1767
+ };
1768
+ if (typeof field.value === "string")
1769
+ field.value = Number(field.value);
1770
+ return /* @__PURE__ */ jsxs("div", { children: [
1771
+ /* @__PURE__ */ jsxs("div", { className: "relative outline-none", children: [
1772
+ icon && /* @__PURE__ */ jsx(
1773
+ "div",
1774
+ {
1775
+ className: clsx7(
1776
+ styles.icon,
1777
+ "flex justify-center items-center"
1778
+ ),
1779
+ children: icon
1780
+ }
1781
+ ),
1782
+ /* @__PURE__ */ jsxs("div", { children: [
1783
+ /* @__PURE__ */ jsx(
1784
+ intl_currency_input_default,
1785
+ {
1786
+ ...inputProps,
1787
+ ...field,
1788
+ type: "text",
1789
+ className: clsx7({
1790
+ [styles.input]: true,
1791
+ ["pr-10"]: clearField,
1792
+ ["pr-2"]: !clearField,
1793
+ ["pl-[46px]"]: !label && placeholder && icon || icon
1794
+ }),
1795
+ placeholder: !label && placeholder ? placeholder : " ",
1796
+ onClick,
1797
+ disabled,
1798
+ currency: "BRL",
1799
+ config: currencyConfig,
1800
+ onChange: handleChange,
1801
+ onBlur: () => {
1802
+ if (onBlur) {
1803
+ onBlur(field.value);
1804
+ }
1805
+ }
1806
+ }
1807
+ ),
1808
+ /* @__PURE__ */ jsxs(
1809
+ "label",
1773
1810
  {
1774
1811
  className: clsx7(
1775
- styles.icon,
1776
- "flex justify-center items-center"
1812
+ {
1813
+ [styles.label]: true,
1814
+ ["left-[46px]"]: icon,
1815
+ ["left-2.5"]: !icon
1816
+ },
1817
+ "cursor-text"
1777
1818
  ),
1778
- children: icon
1819
+ children: [
1820
+ label,
1821
+ required && label && /* @__PURE__ */ jsx("strong", { className: "text-dangerous-500", children: "\xA0*" })
1822
+ ]
1779
1823
  }
1780
- ),
1781
- /* @__PURE__ */ jsxs("div", { children: [
1782
- /* @__PURE__ */ jsx(
1783
- IntlCurrencyInput,
1784
- {
1785
- ...inputProps,
1786
- ...field,
1787
- type: "text",
1788
- ref,
1789
- className: clsx7({
1790
- [styles.input]: true,
1791
- ["pr-10"]: clearField,
1792
- ["pr-2"]: !clearField,
1793
- ["pl-[46px]"]: !label && placeholder && icon || icon
1794
- }),
1795
- placeholder: !label && placeholder ? placeholder : " ",
1796
- onClick,
1797
- disabled,
1798
- currency: "BRL",
1799
- config: currencyConfig,
1800
- onChange: handleChange,
1801
- onBlur: () => {
1802
- if (onBlur) {
1803
- onBlur(field.value);
1804
- }
1805
- }
1806
- }
1807
- ),
1808
- /* @__PURE__ */ jsxs(
1809
- "label",
1810
- {
1811
- className: clsx7(
1812
- {
1813
- [styles.label]: true,
1814
- ["left-[46px]"]: icon,
1815
- ["left-2.5"]: !icon
1816
- },
1817
- "cursor-text"
1818
- ),
1819
- children: [
1820
- label,
1821
- required && label && /* @__PURE__ */ jsx("strong", { className: "text-dangerous-500", children: "\xA0*" })
1822
- ]
1823
- }
1824
- )
1825
- ] })
1826
- ] }),
1827
- fieldValidationMessages.map((message, index) => /* @__PURE__ */ jsx(
1828
- "div",
1829
- {
1830
- className: "text-dangerous-500 text-xs mt-1 ml-[2px]",
1831
- role: "alert",
1832
- "aria-label": message,
1833
- children: message
1834
- },
1835
- index
1836
- ))
1837
- ] });
1838
- }
1824
+ )
1825
+ ] })
1826
+ ] }),
1827
+ fieldValidationMessages.map((message, index) => /* @__PURE__ */ jsx(
1828
+ "div",
1829
+ {
1830
+ className: "text-dangerous-500 text-xs mt-1 ml-[2px]",
1831
+ role: "alert",
1832
+ "aria-label": message,
1833
+ children: message
1834
+ },
1835
+ index
1836
+ ))
1837
+ ] });
1839
1838
  }
1840
- );
1841
- }
1842
- );
1839
+ }
1840
+ );
1841
+ }
1843
1842
  InputMoney.displayName = "InputMoney";
1844
1843
  function InputNumber({
1845
1844
  label,
@@ -2078,7 +2077,6 @@ function InputPercentage({
2078
2077
  }
2079
2078
  }
2080
2079
  };
2081
- let inputRef = useRef(null);
2082
2080
  const fieldValidationMessages = [error == null ? void 0 : error.message];
2083
2081
  const hasError = fieldValidationMessages.some((item) => item !== void 0);
2084
2082
  const styles = {
@@ -2116,12 +2114,11 @@ function InputPercentage({
2116
2114
  ),
2117
2115
  /* @__PURE__ */ jsxs("div", { children: [
2118
2116
  /* @__PURE__ */ jsx(
2119
- IntlCurrencyInput,
2117
+ intl_currency_input_default,
2120
2118
  {
2121
2119
  ...inputProps,
2122
2120
  ...field,
2123
2121
  type: "text",
2124
- ref: inputRef,
2125
2122
  className: clsx7({
2126
2123
  [styles.input]: true,
2127
2124
  ["pr-10"]: clearField,