nexaas-ui-components 1.0.52 → 1.0.53
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 +72 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.cts +14 -1
- package/dist/index.d.ts +14 -1
- package/dist/index.js +72 -21
- package/dist/index.js.map +1 -1
- package/package.json +13 -12
package/dist/index.cjs
CHANGED
|
@@ -75,23 +75,27 @@ var SpinnerIcon = (props) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
|
75
75
|
var sizes = {
|
|
76
76
|
xxs: {
|
|
77
77
|
text: "h-[18px]",
|
|
78
|
-
icon: "text-[
|
|
78
|
+
icon: "text-[12px] leading-3"
|
|
79
|
+
},
|
|
80
|
+
xxsm: {
|
|
81
|
+
text: "h-6 min-w-6 max-w-6",
|
|
82
|
+
icon: "text-[12px] leading-3"
|
|
79
83
|
},
|
|
80
84
|
xs: {
|
|
81
85
|
text: "h-8 min-w-8 max-w-20",
|
|
82
|
-
icon: "text-[16px]"
|
|
86
|
+
icon: "text-[16px] leading-4"
|
|
83
87
|
},
|
|
84
88
|
sm: {
|
|
85
89
|
text: "h-[32px] text-[12px]",
|
|
86
|
-
icon: "text-[12px]"
|
|
90
|
+
icon: "text-[12px] leading-3"
|
|
87
91
|
},
|
|
88
92
|
md: {
|
|
89
93
|
text: "h-[38px]",
|
|
90
|
-
icon: "text-[20px]"
|
|
94
|
+
icon: "text-[20px] leading-5"
|
|
91
95
|
},
|
|
92
96
|
lg: {
|
|
93
97
|
text: "h-[46px]",
|
|
94
|
-
icon: "text-[20px]"
|
|
98
|
+
icon: "text-[20px] leading-5"
|
|
95
99
|
}
|
|
96
100
|
};
|
|
97
101
|
var variants = {
|
|
@@ -99,7 +103,7 @@ var variants = {
|
|
|
99
103
|
text: "bg-gradient-to-b from-[#FF4D8B] to-[#DA3063] text-white shadow-[0_2px_6px_0_rgba(218,48,99,0.25)] hover:from-[#ff4d84] hover:to-[#df4573] active:from-[#ae264f] active:to-[#ae264f] disabled:opacity-50 disabled:shadow-none active:shadow-none disabled:hover:from-[#FF4D8B] disabled:hover:to-[#DA3063]"
|
|
100
104
|
},
|
|
101
105
|
secondary: {
|
|
102
|
-
text: "shadow-button bg-surface border-[0.5px] border-neutral-300 text-neutral-
|
|
106
|
+
text: "shadow-button bg-surface border-[0.5px] border-neutral-300 text-neutral-600 hover:bg-neutral-100 hover:text-neutral-600 active:text-neutral-600 active:bg-neutral-200 active:shadow-none disabled:text-neutral-400 disabled:opacity-50"
|
|
103
107
|
},
|
|
104
108
|
icon: {
|
|
105
109
|
text: "shadow-button gap-1 bg-white border-[0.5px] border-neutral-300 text-neutral-500 hover:bg-[#f5f5f5] hover:text-neutral-600 active:bg-neutral-100 active:text-neutral-600 disabled:text-neutral-400 disabled:border-[0.5px] disabled:border-disabled disabled:bg-white disabled:opacity-50 active:shadow-none"
|
|
@@ -136,6 +140,9 @@ var variants = {
|
|
|
136
140
|
},
|
|
137
141
|
dangerLight: {
|
|
138
142
|
text: "active:shadow-none shadow-red-sm text-danger-500 font-bold bg-white border-[0.5px] border-danger-500 hover:bg-dangerous-100 active:bg-danger-500 active:text-white disabled:opacity-50 disabled:bg-white disabled:text-danger-500"
|
|
143
|
+
},
|
|
144
|
+
ghost: {
|
|
145
|
+
text: "bg-transparent hover:bg-neutral-100 !rounded-full text-paragraph active:bg-neutral-200 disabled:opacity-50"
|
|
139
146
|
}
|
|
140
147
|
};
|
|
141
148
|
var paddingConfig = {
|
|
@@ -143,6 +150,10 @@ var paddingConfig = {
|
|
|
143
150
|
normal: "",
|
|
144
151
|
icon: ""
|
|
145
152
|
},
|
|
153
|
+
xxsm: {
|
|
154
|
+
normal: "p-[6px]",
|
|
155
|
+
icon: "p-[6px]"
|
|
156
|
+
},
|
|
146
157
|
xs: {
|
|
147
158
|
normal: "p-2",
|
|
148
159
|
icon: "p-2"
|
|
@@ -750,6 +761,18 @@ var DatePickerInput = React5.forwardRef(
|
|
|
750
761
|
control,
|
|
751
762
|
name,
|
|
752
763
|
render: ({ field }) => {
|
|
764
|
+
const normalizeDate = (value) => {
|
|
765
|
+
if (!value) return null;
|
|
766
|
+
if (value instanceof Date) {
|
|
767
|
+
return isNaN(value.getTime()) ? null : value.toISOString();
|
|
768
|
+
}
|
|
769
|
+
if (typeof value === "string") {
|
|
770
|
+
const parsed = new Date(value);
|
|
771
|
+
return isNaN(parsed.getTime()) ? null : parsed.toISOString();
|
|
772
|
+
}
|
|
773
|
+
return null;
|
|
774
|
+
};
|
|
775
|
+
const normalizedValue = normalizeDate(field.value);
|
|
753
776
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
754
777
|
"div",
|
|
755
778
|
{
|
|
@@ -785,7 +808,7 @@ var DatePickerInput = React5.forwardRef(
|
|
|
785
808
|
outOfRangeMessage: "Data n\xE3o permitida",
|
|
786
809
|
invalidDateMessage: "Data inv\xE1lida",
|
|
787
810
|
onError: () => setInvalidDate(true),
|
|
788
|
-
defaultValue:
|
|
811
|
+
defaultValue: normalizedValue,
|
|
789
812
|
inputProps: {
|
|
790
813
|
className: styles.input,
|
|
791
814
|
style: { height: "46px" }
|
|
@@ -807,13 +830,13 @@ var DatePickerInput = React5.forwardRef(
|
|
|
807
830
|
setInvalidDate(false);
|
|
808
831
|
}
|
|
809
832
|
},
|
|
810
|
-
value:
|
|
833
|
+
value: normalizedValue,
|
|
811
834
|
locale: "pt-BR",
|
|
812
835
|
highlightCurrentDay: true,
|
|
813
836
|
formatDate: (value) => dateFns.format(value, dateFnsFormat),
|
|
814
837
|
parseDate: (value) => dateFns.parse(value, dateFnsFormat, /* @__PURE__ */ new Date()),
|
|
815
|
-
maxDate,
|
|
816
|
-
minDate
|
|
838
|
+
maxDate: maxDate || new Date((/* @__PURE__ */ new Date()).getFullYear() + 5, 11, 31),
|
|
839
|
+
minDate: minDate || new Date(1900, 0, 1)
|
|
817
840
|
}
|
|
818
841
|
),
|
|
819
842
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -2551,6 +2574,7 @@ var alertTypes = {
|
|
|
2551
2574
|
};
|
|
2552
2575
|
var sizes3 = {
|
|
2553
2576
|
xs: "w-[350px]",
|
|
2577
|
+
xsm: "w-[470px]",
|
|
2554
2578
|
sm: "w-[662px]",
|
|
2555
2579
|
md: "w-[960px]",
|
|
2556
2580
|
lg: "w-[80%] min-w-[800px]",
|
|
@@ -2618,11 +2642,12 @@ var ModalDialog = ({
|
|
|
2618
2642
|
title
|
|
2619
2643
|
] }),
|
|
2620
2644
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2621
|
-
|
|
2645
|
+
Button,
|
|
2622
2646
|
{
|
|
2623
2647
|
onClick: onCancel,
|
|
2624
|
-
|
|
2625
|
-
|
|
2648
|
+
variant: "ghost",
|
|
2649
|
+
size: "xs",
|
|
2650
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx("i", { className: "uil uil-times" })
|
|
2626
2651
|
}
|
|
2627
2652
|
)
|
|
2628
2653
|
] }),
|
|
@@ -2714,7 +2739,7 @@ var customStyles = {
|
|
|
2714
2739
|
}),
|
|
2715
2740
|
menu: (provided) => ({
|
|
2716
2741
|
...provided,
|
|
2717
|
-
marginTop: "
|
|
2742
|
+
marginTop: "8px",
|
|
2718
2743
|
border: "1px solid var(--neutral-300)",
|
|
2719
2744
|
boxShadow: "none",
|
|
2720
2745
|
borderRadius: "8px",
|
|
@@ -2823,7 +2848,12 @@ var SelectField = ({
|
|
|
2823
2848
|
icon,
|
|
2824
2849
|
emptyMessage,
|
|
2825
2850
|
small = false,
|
|
2826
|
-
initialMessage
|
|
2851
|
+
initialMessage,
|
|
2852
|
+
menuIsEverOpen = false,
|
|
2853
|
+
clearOnBlur = true,
|
|
2854
|
+
onMenuClose,
|
|
2855
|
+
clearOnMenuClose,
|
|
2856
|
+
showArrow = true
|
|
2827
2857
|
}) => {
|
|
2828
2858
|
var _a;
|
|
2829
2859
|
const { Option, DropdownIndicator, ClearIndicator, SingleValue } = Select.components;
|
|
@@ -2831,6 +2861,7 @@ var SelectField = ({
|
|
|
2831
2861
|
const [inputValue, setInputValue] = React5.useState("");
|
|
2832
2862
|
const [loading, setLoading] = React5.useState(false);
|
|
2833
2863
|
const [options, setOptions] = React5.useState(() => optionsList || []);
|
|
2864
|
+
const [cachedOptions, setCachedOptions] = React5.useState([]);
|
|
2834
2865
|
const [availableHeight, setAvailableHeight] = React5.useState(300);
|
|
2835
2866
|
const [isFocused, setIsFocused] = React5.useState(false);
|
|
2836
2867
|
React5.useEffect(() => {
|
|
@@ -2849,17 +2880,20 @@ var SelectField = ({
|
|
|
2849
2880
|
window.removeEventListener("resize", updateAvailableHeight);
|
|
2850
2881
|
};
|
|
2851
2882
|
}, [selectRef]);
|
|
2852
|
-
const loadOptions = (inputValue2) => {
|
|
2883
|
+
const loadOptions = async (inputValue2) => {
|
|
2853
2884
|
setLoading(true);
|
|
2854
2885
|
if (isSearchable && filterOptions) {
|
|
2855
2886
|
if (debounce2 && inputValue2.length >= debounce2 || !debounce2) {
|
|
2856
|
-
const result = filterOptions(inputValue2);
|
|
2887
|
+
const result = await filterOptions(inputValue2);
|
|
2888
|
+
setCachedOptions(result || []);
|
|
2857
2889
|
setLoading(false);
|
|
2858
2890
|
return result;
|
|
2859
2891
|
}
|
|
2860
2892
|
} else {
|
|
2861
2893
|
setOptions(optionsList);
|
|
2862
2894
|
}
|
|
2895
|
+
setLoading(false);
|
|
2896
|
+
return cachedOptions;
|
|
2863
2897
|
};
|
|
2864
2898
|
const fieldValidation = useFieldErrorsStore((state) => state.field);
|
|
2865
2899
|
const fieldValidationMessages = [
|
|
@@ -2977,7 +3011,7 @@ var SelectField = ({
|
|
|
2977
3011
|
"div",
|
|
2978
3012
|
{
|
|
2979
3013
|
className: clsx9__default.default(
|
|
2980
|
-
"z-[70] absolute bg-neutral-100 top-[1px] left-[1px] rounded-l-lg flex justify-center items-center h-[44px] w-[38px] text-[22px] text-
|
|
3014
|
+
"z-[70] absolute bg-neutral-100 top-[1px] left-[1px] rounded-l-lg flex justify-center items-center h-[44px] w-[38px] text-[22px] text-label",
|
|
2981
3015
|
{
|
|
2982
3016
|
"text-blue-500": isFocused && hasIcon.hasIcon,
|
|
2983
3017
|
"text-red-500": hasError.hasError && hasIcon.hasIcon
|
|
@@ -2998,10 +3032,27 @@ var SelectField = ({
|
|
|
2998
3032
|
...smallField,
|
|
2999
3033
|
isDisabled: disabled,
|
|
3000
3034
|
onFocus: () => setIsFocused(true),
|
|
3001
|
-
onBlur: () =>
|
|
3035
|
+
onBlur: () => {
|
|
3036
|
+
setIsFocused(false);
|
|
3037
|
+
},
|
|
3038
|
+
onMenuClose: () => {
|
|
3039
|
+
const shouldClear = typeof clearOnMenuClose !== "undefined" ? clearOnMenuClose : clearOnBlur;
|
|
3040
|
+
if (shouldClear) setInputValue("");
|
|
3041
|
+
if (onMenuClose) onMenuClose();
|
|
3042
|
+
},
|
|
3043
|
+
inputValue,
|
|
3044
|
+
onInputChange: (val, meta) => {
|
|
3045
|
+
if (meta.action === "input-change") {
|
|
3046
|
+
setInputValue(val);
|
|
3047
|
+
} else if (meta.action === "menu-close" || meta.action === "input-blur") {
|
|
3048
|
+
const shouldClear = typeof clearOnMenuClose !== "undefined" ? clearOnMenuClose : clearOnBlur;
|
|
3049
|
+
if (shouldClear) setInputValue("");
|
|
3050
|
+
}
|
|
3051
|
+
},
|
|
3052
|
+
menuIsOpen: menuIsEverOpen ? true : void 0,
|
|
3002
3053
|
loadingMessage: () => /* @__PURE__ */ jsxRuntime.jsx("div", { children: "Carregando" }),
|
|
3003
3054
|
isLoading: loading,
|
|
3004
|
-
defaultOptions: debounce2 > 0 ? false : optionsList ? options : true,
|
|
3055
|
+
defaultOptions: menuIsEverOpen && cachedOptions.length > 0 ? cachedOptions : debounce2 > 0 ? false : optionsList ? options : true,
|
|
3005
3056
|
loadOptions,
|
|
3006
3057
|
name: field.name,
|
|
3007
3058
|
isClearable,
|
|
@@ -3017,7 +3068,7 @@ var SelectField = ({
|
|
|
3017
3068
|
LoadingIndicator: () => /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {}),
|
|
3018
3069
|
LoadingMessage,
|
|
3019
3070
|
NoOptionsMessage,
|
|
3020
|
-
DropdownIndicator: DropdownIndicatorCustom,
|
|
3071
|
+
DropdownIndicator: showArrow ? DropdownIndicatorCustom : null,
|
|
3021
3072
|
ClearIndicator: ClearIndicatorCustom
|
|
3022
3073
|
},
|
|
3023
3074
|
closeMenuOnSelect: true,
|