nexaas-ui-components 1.0.11 → 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.cjs +188 -135
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -2
- package/dist/index.d.ts +17 -2
- package/dist/index.js +187 -135
- package/dist/index.js.map +1 -1
- package/package.json +3 -1
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
|
|
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
|
|
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
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
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
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
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
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
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
|
-
|
|
1805
|
-
|
|
1841
|
+
{
|
|
1842
|
+
[styles.label]: true,
|
|
1843
|
+
["left-[46px]"]: icon,
|
|
1844
|
+
["left-2.5"]: !icon
|
|
1845
|
+
},
|
|
1846
|
+
"cursor-text"
|
|
1806
1847
|
),
|
|
1807
|
-
children:
|
|
1848
|
+
children: [
|
|
1849
|
+
label,
|
|
1850
|
+
required && label && /* @__PURE__ */ jsxRuntime.jsx("strong", { className: "text-dangerous-500", children: "\xA0*" })
|
|
1851
|
+
]
|
|
1808
1852
|
}
|
|
1809
|
-
)
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
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
|
-
|
|
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,6 +2277,61 @@ var MaskedInput = ({
|
|
|
2280
2277
|
}
|
|
2281
2278
|
);
|
|
2282
2279
|
};
|
|
2280
|
+
function InputTest({
|
|
2281
|
+
label,
|
|
2282
|
+
name,
|
|
2283
|
+
control,
|
|
2284
|
+
error,
|
|
2285
|
+
required,
|
|
2286
|
+
placeholder,
|
|
2287
|
+
disabled,
|
|
2288
|
+
defaultValue
|
|
2289
|
+
}) {
|
|
2290
|
+
const fieldValidationMessages = [error == null ? void 0 : error.message];
|
|
2291
|
+
const hasError = fieldValidationMessages.some((item) => item !== void 0);
|
|
2292
|
+
const styles = {
|
|
2293
|
+
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"}`,
|
|
2294
|
+
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"
|
|
2295
|
+
};
|
|
2296
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2297
|
+
reactHookForm.Controller,
|
|
2298
|
+
{
|
|
2299
|
+
control,
|
|
2300
|
+
name,
|
|
2301
|
+
defaultValue,
|
|
2302
|
+
render: ({ field }) => {
|
|
2303
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
|
|
2304
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2305
|
+
"input",
|
|
2306
|
+
{
|
|
2307
|
+
...field,
|
|
2308
|
+
type: "text",
|
|
2309
|
+
id: name,
|
|
2310
|
+
className: clsx7__default.default(styles.input),
|
|
2311
|
+
placeholder: !label && placeholder ? placeholder : " ",
|
|
2312
|
+
disabled
|
|
2313
|
+
}
|
|
2314
|
+
),
|
|
2315
|
+
/* @__PURE__ */ jsxRuntime.jsxs("label", { className: clsx7__default.default(styles.label), children: [
|
|
2316
|
+
label,
|
|
2317
|
+
required && label && /* @__PURE__ */ jsxRuntime.jsx("strong", { className: "text-dangerous-500", children: "\xA0*" })
|
|
2318
|
+
] }),
|
|
2319
|
+
fieldValidationMessages.map((message, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2320
|
+
"div",
|
|
2321
|
+
{
|
|
2322
|
+
className: "text-dangerous-500 text-xs mt-1 ml-[2px]",
|
|
2323
|
+
role: "alert",
|
|
2324
|
+
"aria-label": message,
|
|
2325
|
+
children: message
|
|
2326
|
+
},
|
|
2327
|
+
index
|
|
2328
|
+
))
|
|
2329
|
+
] });
|
|
2330
|
+
}
|
|
2331
|
+
}
|
|
2332
|
+
);
|
|
2333
|
+
}
|
|
2334
|
+
InputTest.displayName = "InputTest";
|
|
2283
2335
|
var Modal = ReactModalNamespace__namespace.default || ReactModalNamespace__namespace;
|
|
2284
2336
|
var alertTypes = {
|
|
2285
2337
|
success: "text-success-500",
|
|
@@ -3747,6 +3799,7 @@ exports.Input = Input;
|
|
|
3747
3799
|
exports.InputMoney = InputMoney;
|
|
3748
3800
|
exports.InputNumber = InputNumber;
|
|
3749
3801
|
exports.InputPercentage = InputPercentage;
|
|
3802
|
+
exports.InputTest = InputTest;
|
|
3750
3803
|
exports.Logo = Logo;
|
|
3751
3804
|
exports.MaskedInput = MaskedInput;
|
|
3752
3805
|
exports.ModalDialog = ModalDialog;
|