nexaas-ui-components 1.0.15 → 1.0.18
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 +416 -39
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.cts +40 -3
- package/dist/index.d.ts +40 -3
- package/dist/index.js +415 -39
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import { parse, format, set, startOfWeek, endOfWeek, startOfMonth, endOfMonth, s
|
|
|
9
9
|
import { Switch, Popover, PopoverButton, PopoverPanel, Listbox, ListboxOptions, Combobox, ListboxOption } from '@headlessui/react';
|
|
10
10
|
import { Float } from '@headlessui-float/react';
|
|
11
11
|
import IntlCurrencyInputRaw from 'react-intl-currency-input';
|
|
12
|
-
import
|
|
12
|
+
import * as lodashNamespace from 'lodash';
|
|
13
13
|
import InputMask from 'react-input-mask';
|
|
14
14
|
import * as ReactModalNamespace from 'react-modal';
|
|
15
15
|
import { Tooltip } from 'react-tooltip';
|
|
@@ -19,36 +19,22 @@ import { useReactTable, getExpandedRowModel, getFacetedUniqueValues, getFacetedR
|
|
|
19
19
|
import { rankItem } from '@tanstack/match-sorter-utils';
|
|
20
20
|
|
|
21
21
|
// src/assets/spinner.tsx
|
|
22
|
-
var SpinnerIcon = (props) => /* @__PURE__ */
|
|
22
|
+
var SpinnerIcon = (props) => /* @__PURE__ */ jsx(
|
|
23
23
|
"svg",
|
|
24
24
|
{
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
...props,
|
|
26
|
+
width: `${props.width || 33}`,
|
|
27
|
+
height: `${props.height || 33}`,
|
|
28
|
+
viewBox: "0 0 33 33",
|
|
28
29
|
fill: "none",
|
|
29
30
|
xmlns: "http://www.w3.org/2000/svg",
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
cy: "12",
|
|
38
|
-
r: "10",
|
|
39
|
-
stroke: "currentColor",
|
|
40
|
-
strokeWidth: "4"
|
|
41
|
-
}
|
|
42
|
-
),
|
|
43
|
-
/* @__PURE__ */ jsx(
|
|
44
|
-
"path",
|
|
45
|
-
{
|
|
46
|
-
className: "opacity-75",
|
|
47
|
-
fill: "currentColor",
|
|
48
|
-
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
49
|
-
}
|
|
50
|
-
)
|
|
51
|
-
]
|
|
31
|
+
children: /* @__PURE__ */ jsx(
|
|
32
|
+
"path",
|
|
33
|
+
{
|
|
34
|
+
d: "M21.4671 32.1821C18.269 33.1951 14.8378 33.2061 11.6333 32.2137C8.42885 31.2213 5.6044 29.2729 3.53866 26.6297C1.47293 23.9866 0.264665 20.7751 0.0758752 17.4258C-0.112914 14.0765 0.726798 10.7495 2.48242 7.89096C4.23804 5.03242 6.82565 2.77896 9.89828 1.43272C12.9709 0.0864894 16.3817 -0.288163 19.6733 0.359002C22.9649 1.00617 25.98 2.64421 28.3142 5.0535C30.6485 7.46279 32.1903 10.5282 32.7331 13.8386L28.9102 14.4653C28.4953 11.9345 27.3165 9.59102 25.532 7.74911C23.7474 5.9072 21.4424 4.65491 18.926 4.16015C16.4095 3.66539 13.802 3.95181 11.4529 4.98101C9.10388 6.01021 7.12564 7.73299 5.78346 9.91835C4.44128 12.1037 3.79932 14.6472 3.94365 17.2077C4.08798 19.7683 5.01171 22.2235 6.59097 24.2442C8.17023 26.2649 10.3295 27.7544 12.7794 28.5132C15.2292 29.2719 17.8524 29.2634 20.2973 28.489L21.4671 32.1821Z",
|
|
35
|
+
fill: "#009EDB"
|
|
36
|
+
}
|
|
37
|
+
)
|
|
52
38
|
}
|
|
53
39
|
);
|
|
54
40
|
var sizes = {
|
|
@@ -1840,6 +1826,9 @@ function InputMoney({
|
|
|
1840
1826
|
);
|
|
1841
1827
|
}
|
|
1842
1828
|
InputMoney.displayName = "InputMoney";
|
|
1829
|
+
var lodash = lodashNamespace.default || lodashNamespace;
|
|
1830
|
+
var debounce = lodash.debounce;
|
|
1831
|
+
var debounce_default = debounce;
|
|
1843
1832
|
function InputNumber({
|
|
1844
1833
|
label,
|
|
1845
1834
|
type,
|
|
@@ -1881,7 +1870,7 @@ function InputNumber({
|
|
|
1881
1870
|
}
|
|
1882
1871
|
};
|
|
1883
1872
|
const updateCount = useMemo(() => {
|
|
1884
|
-
return
|
|
1873
|
+
return debounce_default(() => {
|
|
1885
1874
|
save();
|
|
1886
1875
|
}, 1e3);
|
|
1887
1876
|
}, []);
|
|
@@ -2280,7 +2269,7 @@ var ModalDialog = ({
|
|
|
2280
2269
|
description,
|
|
2281
2270
|
children
|
|
2282
2271
|
}) => {
|
|
2283
|
-
const
|
|
2272
|
+
const customStyles3 = {
|
|
2284
2273
|
content: {
|
|
2285
2274
|
top: "50%",
|
|
2286
2275
|
left: "50%",
|
|
@@ -2311,7 +2300,7 @@ var ModalDialog = ({
|
|
|
2311
2300
|
ariaHideApp: false,
|
|
2312
2301
|
isOpen: open,
|
|
2313
2302
|
onRequestClose: onClose,
|
|
2314
|
-
style:
|
|
2303
|
+
style: customStyles3,
|
|
2315
2304
|
contentLabel: "Example Modal",
|
|
2316
2305
|
children: /* @__PURE__ */ jsxs("div", { className: clsx7(sizes2[size]), children: [
|
|
2317
2306
|
/* @__PURE__ */ jsxs("div", { className: "pb-2 border-b border-b-neutral-200 flex items-center justify-between", children: [
|
|
@@ -2507,7 +2496,7 @@ var SelectField = ({
|
|
|
2507
2496
|
isClearable = false,
|
|
2508
2497
|
onChange,
|
|
2509
2498
|
required,
|
|
2510
|
-
debounce = 0,
|
|
2499
|
+
debounce: debounce2 = 0,
|
|
2511
2500
|
filterOptions,
|
|
2512
2501
|
optionsList,
|
|
2513
2502
|
disabled,
|
|
@@ -2546,7 +2535,7 @@ var SelectField = ({
|
|
|
2546
2535
|
const loadOptions = (inputValue2) => {
|
|
2547
2536
|
setLoading(true);
|
|
2548
2537
|
if (isSearchable && filterOptions) {
|
|
2549
|
-
if (
|
|
2538
|
+
if (debounce2 && inputValue2.length >= debounce2 || !debounce2) {
|
|
2550
2539
|
const result = filterOptions(inputValue2);
|
|
2551
2540
|
setLoading(false);
|
|
2552
2541
|
return result;
|
|
@@ -2605,7 +2594,7 @@ var SelectField = ({
|
|
|
2605
2594
|
) });
|
|
2606
2595
|
};
|
|
2607
2596
|
const LoadingMessage = (props) => {
|
|
2608
|
-
if (!
|
|
2597
|
+
if (!debounce2 || debounce2 && inputValue.length >= debounce2) {
|
|
2609
2598
|
return /* @__PURE__ */ jsxs(
|
|
2610
2599
|
"div",
|
|
2611
2600
|
{
|
|
@@ -2626,20 +2615,20 @@ var SelectField = ({
|
|
|
2626
2615
|
]
|
|
2627
2616
|
}
|
|
2628
2617
|
);
|
|
2629
|
-
} else if (
|
|
2618
|
+
} else if (debounce2 && inputValue.length < debounce2) {
|
|
2630
2619
|
return /* @__PURE__ */ jsxs("div", { className: "p-2 text-neutral-300", children: [
|
|
2631
2620
|
"Digite ",
|
|
2632
|
-
|
|
2621
|
+
debounce2,
|
|
2633
2622
|
" ou mais caracteres para pesquisar"
|
|
2634
2623
|
] });
|
|
2635
2624
|
}
|
|
2636
2625
|
};
|
|
2637
2626
|
const NoOptionsMessage = (props) => {
|
|
2638
2627
|
var _a2;
|
|
2639
|
-
if (props.selectProps.inputValue.length == 0 &&
|
|
2628
|
+
if (props.selectProps.inputValue.length == 0 && debounce2 > 0 || debounce2 > 0 && props.selectProps.inputValue.length < debounce2) {
|
|
2640
2629
|
return /* @__PURE__ */ jsxs("div", { className: "text-dangerous-500 text-sm", children: [
|
|
2641
2630
|
"Digite ",
|
|
2642
|
-
|
|
2631
|
+
debounce2,
|
|
2643
2632
|
" ou mais caracteres para pesquisar"
|
|
2644
2633
|
] });
|
|
2645
2634
|
} else if (props.selectProps.inputValue.length > 0 && ((_a2 = props == null ? void 0 : props.options) == null ? void 0 : _a2.length) == 0) {
|
|
@@ -2702,7 +2691,7 @@ var SelectField = ({
|
|
|
2702
2691
|
onBlur: () => setIsFocused(false),
|
|
2703
2692
|
loadingMessage: () => /* @__PURE__ */ jsx("div", { children: "Carregando" }),
|
|
2704
2693
|
isLoading: loading,
|
|
2705
|
-
defaultOptions:
|
|
2694
|
+
defaultOptions: debounce2 > 0 ? false : optionsList ? options : true,
|
|
2706
2695
|
loadOptions,
|
|
2707
2696
|
name: field.name,
|
|
2708
2697
|
isClearable,
|
|
@@ -2764,6 +2753,393 @@ var SelectField = ({
|
|
|
2764
2753
|
var ValueContainer = ({ children, ...props }) => {
|
|
2765
2754
|
return /* @__PURE__ */ jsx(components.ValueContainer, { ...props, children });
|
|
2766
2755
|
};
|
|
2756
|
+
|
|
2757
|
+
// src/components/SelectFieldBip/SelectFieldBip.styles.tsx
|
|
2758
|
+
var customStyles2 = {
|
|
2759
|
+
indicatorSeparator: (provided, props) => {
|
|
2760
|
+
var _a;
|
|
2761
|
+
return {
|
|
2762
|
+
...provided,
|
|
2763
|
+
backgroundColor: props.hasValue && ((_a = provided == null ? void 0 : provided.selectProps) == null ? void 0 : _a.isSearchable) ? "var(--input)" : "transparent",
|
|
2764
|
+
padding: "0px"
|
|
2765
|
+
};
|
|
2766
|
+
},
|
|
2767
|
+
clearIndicator: (provided) => ({
|
|
2768
|
+
...provided,
|
|
2769
|
+
color: "var(--label)",
|
|
2770
|
+
":hover": {
|
|
2771
|
+
color: "var(--label)"
|
|
2772
|
+
}
|
|
2773
|
+
}),
|
|
2774
|
+
dropdownIndicator: (provided, state) => {
|
|
2775
|
+
var _a;
|
|
2776
|
+
return {
|
|
2777
|
+
...provided,
|
|
2778
|
+
color: "var(--paragraph)",
|
|
2779
|
+
transform: ((_a = state == null ? void 0 : state.selectProps) == null ? void 0 : _a.menuIsOpen) ? "rotate(180deg)" : "rotate(0)",
|
|
2780
|
+
":hover": {
|
|
2781
|
+
color: "var(--paragraph)"
|
|
2782
|
+
}
|
|
2783
|
+
};
|
|
2784
|
+
},
|
|
2785
|
+
input: (provided, state) => ({
|
|
2786
|
+
...provided,
|
|
2787
|
+
paddingLeft: state.selectProps.hasIcon ? "34px" : "0px",
|
|
2788
|
+
paddingTop: state.selectProps.hasLabel ? "10px" : "0px"
|
|
2789
|
+
}),
|
|
2790
|
+
menu: (provided) => ({
|
|
2791
|
+
...provided,
|
|
2792
|
+
marginTop: "4px",
|
|
2793
|
+
border: "1px solid var(--dark-blue-300)",
|
|
2794
|
+
boxShadow: "none",
|
|
2795
|
+
borderRadius: "8px",
|
|
2796
|
+
background: "white",
|
|
2797
|
+
zIndex: 60
|
|
2798
|
+
}),
|
|
2799
|
+
menuList: (provided) => ({
|
|
2800
|
+
...provided,
|
|
2801
|
+
padding: "0px 8px"
|
|
2802
|
+
}),
|
|
2803
|
+
singleValue: (base, state) => ({
|
|
2804
|
+
...base,
|
|
2805
|
+
paddingLeft: state.selectProps.hasIcon ? "34px" : "0px",
|
|
2806
|
+
paddingTop: state.selectProps.hasLabel ? "10px" : "0",
|
|
2807
|
+
color: state.data.value === "active" ? "#0EAF86" : "black",
|
|
2808
|
+
display: "flex"
|
|
2809
|
+
}),
|
|
2810
|
+
placeholder: (provided, state) => ({
|
|
2811
|
+
...provided,
|
|
2812
|
+
paddingLeft: state.selectProps.hasIcon ? "34px" : "0px"
|
|
2813
|
+
}),
|
|
2814
|
+
control: (provided, state) => ({
|
|
2815
|
+
...provided,
|
|
2816
|
+
cursor: "pointer",
|
|
2817
|
+
border: state.selectProps.hasError ? "1px solid var(--dangerous-700)" : state.menuIsOpen ? "1px solid var(--blue-700)" : "1px solid var(--dark-blue-300)",
|
|
2818
|
+
boxShadow: "none",
|
|
2819
|
+
outline: "none",
|
|
2820
|
+
borderRadius: "0.5rem",
|
|
2821
|
+
placeholder: " ",
|
|
2822
|
+
height: "46px",
|
|
2823
|
+
backgroundColor: state.isDisabled ? "var(--light-100)" : "white",
|
|
2824
|
+
":hover": {
|
|
2825
|
+
border: state.selectProps.hasError ? "1px solid var(--dangerous-700)" : state.menuIsOpen ? "1px solid var(--blue-700)" : "1px solid var(--dark-blue-300)"
|
|
2826
|
+
}
|
|
2827
|
+
}),
|
|
2828
|
+
multiValue: (provided) => ({
|
|
2829
|
+
...provided,
|
|
2830
|
+
borderRadius: "20px",
|
|
2831
|
+
backgroundColor: "var(--light-100)",
|
|
2832
|
+
padding: "0px 8px"
|
|
2833
|
+
}),
|
|
2834
|
+
multiValueLabel: (provided) => ({
|
|
2835
|
+
...provided,
|
|
2836
|
+
color: "var(--paragraph)"
|
|
2837
|
+
}),
|
|
2838
|
+
multiValueRemove: (provided) => ({
|
|
2839
|
+
...provided,
|
|
2840
|
+
color: "var(--dark-blue-400)",
|
|
2841
|
+
":hover": {
|
|
2842
|
+
color: "var(--dangerous-700)"
|
|
2843
|
+
}
|
|
2844
|
+
}),
|
|
2845
|
+
option: (provided, state) => {
|
|
2846
|
+
let color = state.isSelected ? "white" : (state == null ? void 0 : state.isDisabled) ? "var(--label)" : "var(--paragraph)";
|
|
2847
|
+
return {
|
|
2848
|
+
...provided,
|
|
2849
|
+
cursor: state.isDisabled ? "auto" : "pointer",
|
|
2850
|
+
pointerEvents: state.isDisabled ? "none" : "",
|
|
2851
|
+
borderRadius: "8px",
|
|
2852
|
+
margin: "4px 0px",
|
|
2853
|
+
padding: "10px 12px",
|
|
2854
|
+
backgroundColor: state.isSelected ? "var(--blue-700)" : "white",
|
|
2855
|
+
color,
|
|
2856
|
+
fontWeight: state.isSelected ? 700 : 400,
|
|
2857
|
+
"&:hover": {
|
|
2858
|
+
backgroundColor: state.isSelected ? "var(--blue-700)" : "var(--light-200)"
|
|
2859
|
+
},
|
|
2860
|
+
"&:active": {
|
|
2861
|
+
backgroundColor: "var(--blue-700)",
|
|
2862
|
+
color: "white !important",
|
|
2863
|
+
fontWeight: 700
|
|
2864
|
+
},
|
|
2865
|
+
"&:active i": {
|
|
2866
|
+
color: "white !important",
|
|
2867
|
+
fontWeight: 700
|
|
2868
|
+
},
|
|
2869
|
+
" i": {
|
|
2870
|
+
color: "white !important"
|
|
2871
|
+
}
|
|
2872
|
+
};
|
|
2873
|
+
},
|
|
2874
|
+
container: (provided) => ({
|
|
2875
|
+
...provided,
|
|
2876
|
+
border: "none",
|
|
2877
|
+
outline: "none",
|
|
2878
|
+
boxShadow: "none",
|
|
2879
|
+
padding: "none",
|
|
2880
|
+
margin: "none"
|
|
2881
|
+
})
|
|
2882
|
+
};
|
|
2883
|
+
var SelectFieldBip = ({
|
|
2884
|
+
name,
|
|
2885
|
+
label,
|
|
2886
|
+
error,
|
|
2887
|
+
defaultValue,
|
|
2888
|
+
control,
|
|
2889
|
+
placeholder,
|
|
2890
|
+
isSearchable = false,
|
|
2891
|
+
required,
|
|
2892
|
+
debounce: debounce2,
|
|
2893
|
+
filterOptions,
|
|
2894
|
+
disabled,
|
|
2895
|
+
onChangeValue,
|
|
2896
|
+
optionStyle,
|
|
2897
|
+
valueStyle,
|
|
2898
|
+
icon,
|
|
2899
|
+
onErrorBip,
|
|
2900
|
+
clearAfterSelect = true,
|
|
2901
|
+
messages = {
|
|
2902
|
+
searching: "Searching...",
|
|
2903
|
+
debounce: `Type at least {debounce} characters`,
|
|
2904
|
+
emptyMessage: "No options found",
|
|
2905
|
+
loading: "Loading..."
|
|
2906
|
+
}
|
|
2907
|
+
}) => {
|
|
2908
|
+
var _a;
|
|
2909
|
+
const { Option, SingleValue } = components;
|
|
2910
|
+
const selectRef = useRef(null);
|
|
2911
|
+
const [inputValue, setInputValue] = useState("");
|
|
2912
|
+
const [loading, setLoading] = useState(false);
|
|
2913
|
+
const [cachedOptions, setCachedOptions] = useState([]);
|
|
2914
|
+
const fetchOptions = async (value) => {
|
|
2915
|
+
if (isSearchable && filterOptions) {
|
|
2916
|
+
if (!debounce2 || debounce2 && value.length >= debounce2) {
|
|
2917
|
+
setLoading(true);
|
|
2918
|
+
const result = await filterOptions(value);
|
|
2919
|
+
setCachedOptions(result);
|
|
2920
|
+
setLoading(false);
|
|
2921
|
+
return result;
|
|
2922
|
+
}
|
|
2923
|
+
}
|
|
2924
|
+
return [];
|
|
2925
|
+
};
|
|
2926
|
+
const fieldValidation = useFieldErrorsStore((state) => state.field);
|
|
2927
|
+
const fieldValidationMessages = [
|
|
2928
|
+
(_a = fieldValidation[name]) == null ? void 0 : _a.message,
|
|
2929
|
+
error == null ? void 0 : error.message
|
|
2930
|
+
];
|
|
2931
|
+
const hasError = {
|
|
2932
|
+
hasError: fieldValidationMessages.some((item) => item !== void 0)
|
|
2933
|
+
};
|
|
2934
|
+
const hasLabel = {
|
|
2935
|
+
hasLabel: (label == null ? void 0 : label.length) > 0
|
|
2936
|
+
};
|
|
2937
|
+
const hasIcon = {
|
|
2938
|
+
hasIcon: icon
|
|
2939
|
+
};
|
|
2940
|
+
const iconStyle = `z-[70] absolute bg-neutral-100 h-[44px] top-[1px] left-[1px] rounded-l-lg flex justify-center items-center w-[38px] text-[22px] ${hasError.hasError ? "text-dangerous-500" : "text-label"}`;
|
|
2941
|
+
const debouncedFetchOptions = useMemo(() => {
|
|
2942
|
+
return debounce_default((value, callback) => {
|
|
2943
|
+
fetchOptions(value).then(callback);
|
|
2944
|
+
}, 300);
|
|
2945
|
+
}, [filterOptions]);
|
|
2946
|
+
useEffect(() => {
|
|
2947
|
+
return () => {
|
|
2948
|
+
debouncedFetchOptions.cancel();
|
|
2949
|
+
};
|
|
2950
|
+
}, [debouncedFetchOptions]);
|
|
2951
|
+
return /* @__PURE__ */ jsx(
|
|
2952
|
+
Controller,
|
|
2953
|
+
{
|
|
2954
|
+
name,
|
|
2955
|
+
control,
|
|
2956
|
+
defaultValue,
|
|
2957
|
+
render: ({ field }) => {
|
|
2958
|
+
const CustomSingleValue = (props) => {
|
|
2959
|
+
return /* @__PURE__ */ jsx(SingleValue, { ...props, children: valueStyle ? valueStyle(props == null ? void 0 : props.data) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2960
|
+
props.data.label,
|
|
2961
|
+
" "
|
|
2962
|
+
] }) });
|
|
2963
|
+
};
|
|
2964
|
+
const IconOption = (props) => {
|
|
2965
|
+
return /* @__PURE__ */ jsx(Option, { ...props, children: optionStyle ? optionStyle(props == null ? void 0 : props.data) : /* @__PURE__ */ jsx(
|
|
2966
|
+
"div",
|
|
2967
|
+
{
|
|
2968
|
+
style: {
|
|
2969
|
+
display: "flex",
|
|
2970
|
+
alignItems: "center",
|
|
2971
|
+
justifyContent: "space-between"
|
|
2972
|
+
},
|
|
2973
|
+
children: /* @__PURE__ */ jsx("span", { className: clsx7("text-p-md focus:text-white"), children: props.data.label })
|
|
2974
|
+
}
|
|
2975
|
+
) });
|
|
2976
|
+
};
|
|
2977
|
+
const LoadingMessage = (props) => {
|
|
2978
|
+
if (!debounce2 || debounce2 && inputValue.length >= debounce2) {
|
|
2979
|
+
return /* @__PURE__ */ jsxs(
|
|
2980
|
+
"div",
|
|
2981
|
+
{
|
|
2982
|
+
...props.innerProps,
|
|
2983
|
+
className: "flex items-center gap-[6px] p-2",
|
|
2984
|
+
children: [
|
|
2985
|
+
/* @__PURE__ */ jsx(SpinnerIcon, { width: 16, height: 16, className: "animate-spin" }),
|
|
2986
|
+
messages.searching
|
|
2987
|
+
]
|
|
2988
|
+
}
|
|
2989
|
+
);
|
|
2990
|
+
} else if (debounce2 && inputValue.length < debounce2) {
|
|
2991
|
+
return /* @__PURE__ */ jsx("div", { className: "p-2 text-dark-blue-300", children: messages.debounce.replace("{debounce}", String(debounce2)) });
|
|
2992
|
+
}
|
|
2993
|
+
};
|
|
2994
|
+
const NoOptionsMessage = (props) => {
|
|
2995
|
+
var _a2;
|
|
2996
|
+
if (inputValue.length == 0 && debounce2 > 0 || debounce2 > 0 && inputValue.length < debounce2) {
|
|
2997
|
+
return /* @__PURE__ */ jsx("div", { className: "p-2 text-dark-blue-300", children: messages.debounce.replace("{debounce}", String(debounce2)) });
|
|
2998
|
+
} else if (inputValue.length > 0 && ((_a2 = props == null ? void 0 : props.options) == null ? void 0 : _a2.length) == 0) {
|
|
2999
|
+
return /* @__PURE__ */ jsx("div", { className: "p-2 text-dark-blue-300", children: messages.emptyMessage });
|
|
3000
|
+
}
|
|
3001
|
+
};
|
|
3002
|
+
const DropdownIndicatorCustom = (props) => {
|
|
3003
|
+
return null;
|
|
3004
|
+
};
|
|
3005
|
+
const handleKeyDown = async (event) => {
|
|
3006
|
+
var _a2;
|
|
3007
|
+
if (event.key === "Enter") {
|
|
3008
|
+
event.preventDefault();
|
|
3009
|
+
debouncedFetchOptions.cancel();
|
|
3010
|
+
const fetchedOptions = await fetchOptions(event.target.value);
|
|
3011
|
+
if ((fetchedOptions == null ? void 0 : fetchedOptions.length) > 0) {
|
|
3012
|
+
onChange(fetchedOptions[0]);
|
|
3013
|
+
setTimeout(() => {
|
|
3014
|
+
var _a3, _b, _c;
|
|
3015
|
+
setInputValue("");
|
|
3016
|
+
(_a3 = selectRef == null ? void 0 : selectRef.current) == null ? void 0 : _a3.clearValue();
|
|
3017
|
+
(_b = selectRef == null ? void 0 : selectRef.current) == null ? void 0 : _b.focus();
|
|
3018
|
+
(_c = selectRef == null ? void 0 : selectRef.current) == null ? void 0 : _c.onMenuClose();
|
|
3019
|
+
field.onChange(null);
|
|
3020
|
+
}, 10);
|
|
3021
|
+
} else {
|
|
3022
|
+
onErrorBip((_a2 = event == null ? void 0 : event.target) == null ? void 0 : _a2.value);
|
|
3023
|
+
selectRef.current.inputRef.select();
|
|
3024
|
+
selectRef.current.onMenuClose();
|
|
3025
|
+
}
|
|
3026
|
+
}
|
|
3027
|
+
};
|
|
3028
|
+
const handleInputChange = (value, actionMeta) => {
|
|
3029
|
+
if (actionMeta.action === "input-change") {
|
|
3030
|
+
setInputValue(value);
|
|
3031
|
+
}
|
|
3032
|
+
return value;
|
|
3033
|
+
};
|
|
3034
|
+
const onChange = async (value, action) => {
|
|
3035
|
+
var _a2, _b, _c, _d, _e;
|
|
3036
|
+
if (onChangeValue) onChangeValue(value);
|
|
3037
|
+
if ((action == null ? void 0 : action.action) === "select-option") {
|
|
3038
|
+
if (clearAfterSelect) {
|
|
3039
|
+
setInputValue("");
|
|
3040
|
+
(_a2 = selectRef == null ? void 0 : selectRef.current) == null ? void 0 : _a2.clearValue();
|
|
3041
|
+
(_b = selectRef == null ? void 0 : selectRef.current) == null ? void 0 : _b.onMenuClose();
|
|
3042
|
+
(_c = selectRef == null ? void 0 : selectRef.current) == null ? void 0 : _c.focus();
|
|
3043
|
+
field.onChange(null);
|
|
3044
|
+
} else {
|
|
3045
|
+
field.onChange(value);
|
|
3046
|
+
setInputValue("");
|
|
3047
|
+
(_d = selectRef == null ? void 0 : selectRef.current) == null ? void 0 : _d.onMenuClose();
|
|
3048
|
+
}
|
|
3049
|
+
}
|
|
3050
|
+
if (action === "clear-value") {
|
|
3051
|
+
setInputValue("");
|
|
3052
|
+
setCachedOptions([]);
|
|
3053
|
+
(_e = selectRef == null ? void 0 : selectRef.current) == null ? void 0 : _e.clearValue();
|
|
3054
|
+
field.onChange(null);
|
|
3055
|
+
}
|
|
3056
|
+
};
|
|
3057
|
+
const loadOptions = (value, callback) => {
|
|
3058
|
+
debouncedFetchOptions(value, callback);
|
|
3059
|
+
};
|
|
3060
|
+
return /* @__PURE__ */ jsxs("div", { className: "relative", id: "multiselect", children: [
|
|
3061
|
+
icon && /* @__PURE__ */ jsx("div", { className: iconStyle, children: icon }),
|
|
3062
|
+
/* @__PURE__ */ jsx(
|
|
3063
|
+
AsyncSelect,
|
|
3064
|
+
{
|
|
3065
|
+
onKeyDown: handleKeyDown,
|
|
3066
|
+
...field,
|
|
3067
|
+
...hasError,
|
|
3068
|
+
...hasLabel,
|
|
3069
|
+
...hasIcon,
|
|
3070
|
+
ref: selectRef,
|
|
3071
|
+
isDisabled: disabled,
|
|
3072
|
+
onBlur: () => handleInputChange("", {
|
|
3073
|
+
action: "input-change"
|
|
3074
|
+
}),
|
|
3075
|
+
loadingMessage: () => /* @__PURE__ */ jsx("div", { children: messages.loading }),
|
|
3076
|
+
isLoading: loading,
|
|
3077
|
+
loadOptions,
|
|
3078
|
+
defaultOptions: false,
|
|
3079
|
+
name: field.name,
|
|
3080
|
+
isClearable: false,
|
|
3081
|
+
styles: customStyles2,
|
|
3082
|
+
placeholder: placeholder || " ",
|
|
3083
|
+
isSearchable,
|
|
3084
|
+
tabSelectsValue: true,
|
|
3085
|
+
components: {
|
|
3086
|
+
SingleValue: CustomSingleValue,
|
|
3087
|
+
ValueContainer: ValueContainer2,
|
|
3088
|
+
Option: IconOption,
|
|
3089
|
+
LoadingIndicator: () => /* @__PURE__ */ jsx(Fragment, {}),
|
|
3090
|
+
LoadingMessage,
|
|
3091
|
+
NoOptionsMessage,
|
|
3092
|
+
DropdownIndicator: DropdownIndicatorCustom
|
|
3093
|
+
},
|
|
3094
|
+
closeMenuOnSelect: false,
|
|
3095
|
+
blurInputOnSelect: true,
|
|
3096
|
+
hideSelectedOptions: false,
|
|
3097
|
+
onChange,
|
|
3098
|
+
inputValue,
|
|
3099
|
+
onInputChange: handleInputChange
|
|
3100
|
+
}
|
|
3101
|
+
),
|
|
3102
|
+
inputValue !== "" && /* @__PURE__ */ jsx(
|
|
3103
|
+
"i",
|
|
3104
|
+
{
|
|
3105
|
+
onClick: () => onChange(null, "clear-value"),
|
|
3106
|
+
className: "uil uil-times text-[18px] absolute right-2 top-[11px] cursor-pointer text-label"
|
|
3107
|
+
}
|
|
3108
|
+
),
|
|
3109
|
+
/* @__PURE__ */ jsxs(
|
|
3110
|
+
"span",
|
|
3111
|
+
{
|
|
3112
|
+
className: clsx7(
|
|
3113
|
+
"text-label text-sm left-2.5 cursor-pointer pointer-events-none",
|
|
3114
|
+
{
|
|
3115
|
+
[" scale-75 -translate-y-3 "]: field.value,
|
|
3116
|
+
["text-dangerous-700"]: hasError.hasError
|
|
3117
|
+
}
|
|
3118
|
+
),
|
|
3119
|
+
children: [
|
|
3120
|
+
label,
|
|
3121
|
+
required && label && /* @__PURE__ */ jsx("strong", { className: "text-dangerous-700", children: "\xA0*" })
|
|
3122
|
+
]
|
|
3123
|
+
}
|
|
3124
|
+
),
|
|
3125
|
+
fieldValidationMessages.map((message, index) => /* @__PURE__ */ jsx(
|
|
3126
|
+
"div",
|
|
3127
|
+
{
|
|
3128
|
+
className: "text-dangerous-700 text-xs mt-1 ml-[2px]",
|
|
3129
|
+
role: "alert",
|
|
3130
|
+
"aria-label": message,
|
|
3131
|
+
children: message
|
|
3132
|
+
},
|
|
3133
|
+
index
|
|
3134
|
+
))
|
|
3135
|
+
] });
|
|
3136
|
+
}
|
|
3137
|
+
}
|
|
3138
|
+
);
|
|
3139
|
+
};
|
|
3140
|
+
var ValueContainer2 = ({ children, ...props }) => {
|
|
3141
|
+
return /* @__PURE__ */ jsx(components.ValueContainer, { ...props, children });
|
|
3142
|
+
};
|
|
2767
3143
|
var Radio = ({
|
|
2768
3144
|
disabled,
|
|
2769
3145
|
control,
|
|
@@ -3702,6 +4078,6 @@ function DataTable({
|
|
|
3702
4078
|
] });
|
|
3703
4079
|
}
|
|
3704
4080
|
|
|
3705
|
-
export { Badge, Button, Calendar, Checkbox, DataTable, DataTablePagination, DatePickerInput, FilterCalendar, FilterOptions, Input, InputMoney, InputNumber, InputPercentage, Logo, MaskedInput, ModalDialog, PaginationSelect, Popover3 as Popover, Radio, RocketIcon, SelectField, SpinnerIcon, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Toggle, ValueContainer };
|
|
4081
|
+
export { Badge, Button, Calendar, Checkbox, DataTable, DataTablePagination, DatePickerInput, FilterCalendar, FilterOptions, Input, InputMoney, InputNumber, InputPercentage, Logo, MaskedInput, ModalDialog, PaginationSelect, Popover3 as Popover, Radio, RocketIcon, SelectField, SelectFieldBip, SpinnerIcon, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Toggle, ValueContainer };
|
|
3706
4082
|
//# sourceMappingURL=index.js.map
|
|
3707
4083
|
//# sourceMappingURL=index.js.map
|