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.cjs
CHANGED
|
@@ -10,7 +10,7 @@ var dateFns = require('date-fns');
|
|
|
10
10
|
var react = require('@headlessui/react');
|
|
11
11
|
var react$1 = require('@headlessui-float/react');
|
|
12
12
|
var IntlCurrencyInputRaw = require('react-intl-currency-input');
|
|
13
|
-
var
|
|
13
|
+
var lodashNamespace = require('lodash');
|
|
14
14
|
var InputMask = require('react-input-mask');
|
|
15
15
|
var ReactModalNamespace = require('react-modal');
|
|
16
16
|
var reactTooltip = require('react-tooltip');
|
|
@@ -42,42 +42,28 @@ function _interopNamespace(e) {
|
|
|
42
42
|
var clsx7__default = /*#__PURE__*/_interopDefault(clsx7);
|
|
43
43
|
var React2__namespace = /*#__PURE__*/_interopNamespace(React2);
|
|
44
44
|
var IntlCurrencyInputRaw__default = /*#__PURE__*/_interopDefault(IntlCurrencyInputRaw);
|
|
45
|
-
var
|
|
45
|
+
var lodashNamespace__namespace = /*#__PURE__*/_interopNamespace(lodashNamespace);
|
|
46
46
|
var InputMask__default = /*#__PURE__*/_interopDefault(InputMask);
|
|
47
47
|
var ReactModalNamespace__namespace = /*#__PURE__*/_interopNamespace(ReactModalNamespace);
|
|
48
48
|
var AsyncSelect__default = /*#__PURE__*/_interopDefault(AsyncSelect);
|
|
49
49
|
|
|
50
50
|
// src/assets/spinner.tsx
|
|
51
|
-
var SpinnerIcon = (props) => /* @__PURE__ */ jsxRuntime.
|
|
51
|
+
var SpinnerIcon = (props) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
52
52
|
"svg",
|
|
53
53
|
{
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
...props,
|
|
55
|
+
width: `${props.width || 33}`,
|
|
56
|
+
height: `${props.height || 33}`,
|
|
57
|
+
viewBox: "0 0 33 33",
|
|
57
58
|
fill: "none",
|
|
58
59
|
xmlns: "http://www.w3.org/2000/svg",
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
"
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
cy: "12",
|
|
67
|
-
r: "10",
|
|
68
|
-
stroke: "currentColor",
|
|
69
|
-
strokeWidth: "4"
|
|
70
|
-
}
|
|
71
|
-
),
|
|
72
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
73
|
-
"path",
|
|
74
|
-
{
|
|
75
|
-
className: "opacity-75",
|
|
76
|
-
fill: "currentColor",
|
|
77
|
-
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"
|
|
78
|
-
}
|
|
79
|
-
)
|
|
80
|
-
]
|
|
60
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
61
|
+
"path",
|
|
62
|
+
{
|
|
63
|
+
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",
|
|
64
|
+
fill: "#009EDB"
|
|
65
|
+
}
|
|
66
|
+
)
|
|
81
67
|
}
|
|
82
68
|
);
|
|
83
69
|
var sizes = {
|
|
@@ -1869,6 +1855,9 @@ function InputMoney({
|
|
|
1869
1855
|
);
|
|
1870
1856
|
}
|
|
1871
1857
|
InputMoney.displayName = "InputMoney";
|
|
1858
|
+
var lodash = lodashNamespace__namespace.default || lodashNamespace__namespace;
|
|
1859
|
+
var debounce = lodash.debounce;
|
|
1860
|
+
var debounce_default = debounce;
|
|
1872
1861
|
function InputNumber({
|
|
1873
1862
|
label,
|
|
1874
1863
|
type,
|
|
@@ -1910,7 +1899,7 @@ function InputNumber({
|
|
|
1910
1899
|
}
|
|
1911
1900
|
};
|
|
1912
1901
|
const updateCount = React2.useMemo(() => {
|
|
1913
|
-
return
|
|
1902
|
+
return debounce_default(() => {
|
|
1914
1903
|
save();
|
|
1915
1904
|
}, 1e3);
|
|
1916
1905
|
}, []);
|
|
@@ -2309,7 +2298,7 @@ var ModalDialog = ({
|
|
|
2309
2298
|
description,
|
|
2310
2299
|
children
|
|
2311
2300
|
}) => {
|
|
2312
|
-
const
|
|
2301
|
+
const customStyles3 = {
|
|
2313
2302
|
content: {
|
|
2314
2303
|
top: "50%",
|
|
2315
2304
|
left: "50%",
|
|
@@ -2340,7 +2329,7 @@ var ModalDialog = ({
|
|
|
2340
2329
|
ariaHideApp: false,
|
|
2341
2330
|
isOpen: open,
|
|
2342
2331
|
onRequestClose: onClose,
|
|
2343
|
-
style:
|
|
2332
|
+
style: customStyles3,
|
|
2344
2333
|
contentLabel: "Example Modal",
|
|
2345
2334
|
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: clsx7__default.default(sizes2[size]), children: [
|
|
2346
2335
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pb-2 border-b border-b-neutral-200 flex items-center justify-between", children: [
|
|
@@ -2536,7 +2525,7 @@ var SelectField = ({
|
|
|
2536
2525
|
isClearable = false,
|
|
2537
2526
|
onChange,
|
|
2538
2527
|
required,
|
|
2539
|
-
debounce = 0,
|
|
2528
|
+
debounce: debounce2 = 0,
|
|
2540
2529
|
filterOptions,
|
|
2541
2530
|
optionsList,
|
|
2542
2531
|
disabled,
|
|
@@ -2575,7 +2564,7 @@ var SelectField = ({
|
|
|
2575
2564
|
const loadOptions = (inputValue2) => {
|
|
2576
2565
|
setLoading(true);
|
|
2577
2566
|
if (isSearchable && filterOptions) {
|
|
2578
|
-
if (
|
|
2567
|
+
if (debounce2 && inputValue2.length >= debounce2 || !debounce2) {
|
|
2579
2568
|
const result = filterOptions(inputValue2);
|
|
2580
2569
|
setLoading(false);
|
|
2581
2570
|
return result;
|
|
@@ -2634,7 +2623,7 @@ var SelectField = ({
|
|
|
2634
2623
|
) });
|
|
2635
2624
|
};
|
|
2636
2625
|
const LoadingMessage = (props) => {
|
|
2637
|
-
if (!
|
|
2626
|
+
if (!debounce2 || debounce2 && inputValue.length >= debounce2) {
|
|
2638
2627
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2639
2628
|
"div",
|
|
2640
2629
|
{
|
|
@@ -2655,20 +2644,20 @@ var SelectField = ({
|
|
|
2655
2644
|
]
|
|
2656
2645
|
}
|
|
2657
2646
|
);
|
|
2658
|
-
} else if (
|
|
2647
|
+
} else if (debounce2 && inputValue.length < debounce2) {
|
|
2659
2648
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-2 text-neutral-300", children: [
|
|
2660
2649
|
"Digite ",
|
|
2661
|
-
|
|
2650
|
+
debounce2,
|
|
2662
2651
|
" ou mais caracteres para pesquisar"
|
|
2663
2652
|
] });
|
|
2664
2653
|
}
|
|
2665
2654
|
};
|
|
2666
2655
|
const NoOptionsMessage = (props) => {
|
|
2667
2656
|
var _a2;
|
|
2668
|
-
if (props.selectProps.inputValue.length == 0 &&
|
|
2657
|
+
if (props.selectProps.inputValue.length == 0 && debounce2 > 0 || debounce2 > 0 && props.selectProps.inputValue.length < debounce2) {
|
|
2669
2658
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-dangerous-500 text-sm", children: [
|
|
2670
2659
|
"Digite ",
|
|
2671
|
-
|
|
2660
|
+
debounce2,
|
|
2672
2661
|
" ou mais caracteres para pesquisar"
|
|
2673
2662
|
] });
|
|
2674
2663
|
} else if (props.selectProps.inputValue.length > 0 && ((_a2 = props == null ? void 0 : props.options) == null ? void 0 : _a2.length) == 0) {
|
|
@@ -2731,7 +2720,7 @@ var SelectField = ({
|
|
|
2731
2720
|
onBlur: () => setIsFocused(false),
|
|
2732
2721
|
loadingMessage: () => /* @__PURE__ */ jsxRuntime.jsx("div", { children: "Carregando" }),
|
|
2733
2722
|
isLoading: loading,
|
|
2734
|
-
defaultOptions:
|
|
2723
|
+
defaultOptions: debounce2 > 0 ? false : optionsList ? options : true,
|
|
2735
2724
|
loadOptions,
|
|
2736
2725
|
name: field.name,
|
|
2737
2726
|
isClearable,
|
|
@@ -2793,6 +2782,393 @@ var SelectField = ({
|
|
|
2793
2782
|
var ValueContainer = ({ children, ...props }) => {
|
|
2794
2783
|
return /* @__PURE__ */ jsxRuntime.jsx(reactSelect.components.ValueContainer, { ...props, children });
|
|
2795
2784
|
};
|
|
2785
|
+
|
|
2786
|
+
// src/components/SelectFieldBip/SelectFieldBip.styles.tsx
|
|
2787
|
+
var customStyles2 = {
|
|
2788
|
+
indicatorSeparator: (provided, props) => {
|
|
2789
|
+
var _a;
|
|
2790
|
+
return {
|
|
2791
|
+
...provided,
|
|
2792
|
+
backgroundColor: props.hasValue && ((_a = provided == null ? void 0 : provided.selectProps) == null ? void 0 : _a.isSearchable) ? "var(--input)" : "transparent",
|
|
2793
|
+
padding: "0px"
|
|
2794
|
+
};
|
|
2795
|
+
},
|
|
2796
|
+
clearIndicator: (provided) => ({
|
|
2797
|
+
...provided,
|
|
2798
|
+
color: "var(--label)",
|
|
2799
|
+
":hover": {
|
|
2800
|
+
color: "var(--label)"
|
|
2801
|
+
}
|
|
2802
|
+
}),
|
|
2803
|
+
dropdownIndicator: (provided, state) => {
|
|
2804
|
+
var _a;
|
|
2805
|
+
return {
|
|
2806
|
+
...provided,
|
|
2807
|
+
color: "var(--paragraph)",
|
|
2808
|
+
transform: ((_a = state == null ? void 0 : state.selectProps) == null ? void 0 : _a.menuIsOpen) ? "rotate(180deg)" : "rotate(0)",
|
|
2809
|
+
":hover": {
|
|
2810
|
+
color: "var(--paragraph)"
|
|
2811
|
+
}
|
|
2812
|
+
};
|
|
2813
|
+
},
|
|
2814
|
+
input: (provided, state) => ({
|
|
2815
|
+
...provided,
|
|
2816
|
+
paddingLeft: state.selectProps.hasIcon ? "34px" : "0px",
|
|
2817
|
+
paddingTop: state.selectProps.hasLabel ? "10px" : "0px"
|
|
2818
|
+
}),
|
|
2819
|
+
menu: (provided) => ({
|
|
2820
|
+
...provided,
|
|
2821
|
+
marginTop: "4px",
|
|
2822
|
+
border: "1px solid var(--dark-blue-300)",
|
|
2823
|
+
boxShadow: "none",
|
|
2824
|
+
borderRadius: "8px",
|
|
2825
|
+
background: "white",
|
|
2826
|
+
zIndex: 60
|
|
2827
|
+
}),
|
|
2828
|
+
menuList: (provided) => ({
|
|
2829
|
+
...provided,
|
|
2830
|
+
padding: "0px 8px"
|
|
2831
|
+
}),
|
|
2832
|
+
singleValue: (base, state) => ({
|
|
2833
|
+
...base,
|
|
2834
|
+
paddingLeft: state.selectProps.hasIcon ? "34px" : "0px",
|
|
2835
|
+
paddingTop: state.selectProps.hasLabel ? "10px" : "0",
|
|
2836
|
+
color: state.data.value === "active" ? "#0EAF86" : "black",
|
|
2837
|
+
display: "flex"
|
|
2838
|
+
}),
|
|
2839
|
+
placeholder: (provided, state) => ({
|
|
2840
|
+
...provided,
|
|
2841
|
+
paddingLeft: state.selectProps.hasIcon ? "34px" : "0px"
|
|
2842
|
+
}),
|
|
2843
|
+
control: (provided, state) => ({
|
|
2844
|
+
...provided,
|
|
2845
|
+
cursor: "pointer",
|
|
2846
|
+
border: state.selectProps.hasError ? "1px solid var(--dangerous-700)" : state.menuIsOpen ? "1px solid var(--blue-700)" : "1px solid var(--dark-blue-300)",
|
|
2847
|
+
boxShadow: "none",
|
|
2848
|
+
outline: "none",
|
|
2849
|
+
borderRadius: "0.5rem",
|
|
2850
|
+
placeholder: " ",
|
|
2851
|
+
height: "46px",
|
|
2852
|
+
backgroundColor: state.isDisabled ? "var(--light-100)" : "white",
|
|
2853
|
+
":hover": {
|
|
2854
|
+
border: state.selectProps.hasError ? "1px solid var(--dangerous-700)" : state.menuIsOpen ? "1px solid var(--blue-700)" : "1px solid var(--dark-blue-300)"
|
|
2855
|
+
}
|
|
2856
|
+
}),
|
|
2857
|
+
multiValue: (provided) => ({
|
|
2858
|
+
...provided,
|
|
2859
|
+
borderRadius: "20px",
|
|
2860
|
+
backgroundColor: "var(--light-100)",
|
|
2861
|
+
padding: "0px 8px"
|
|
2862
|
+
}),
|
|
2863
|
+
multiValueLabel: (provided) => ({
|
|
2864
|
+
...provided,
|
|
2865
|
+
color: "var(--paragraph)"
|
|
2866
|
+
}),
|
|
2867
|
+
multiValueRemove: (provided) => ({
|
|
2868
|
+
...provided,
|
|
2869
|
+
color: "var(--dark-blue-400)",
|
|
2870
|
+
":hover": {
|
|
2871
|
+
color: "var(--dangerous-700)"
|
|
2872
|
+
}
|
|
2873
|
+
}),
|
|
2874
|
+
option: (provided, state) => {
|
|
2875
|
+
let color = state.isSelected ? "white" : (state == null ? void 0 : state.isDisabled) ? "var(--label)" : "var(--paragraph)";
|
|
2876
|
+
return {
|
|
2877
|
+
...provided,
|
|
2878
|
+
cursor: state.isDisabled ? "auto" : "pointer",
|
|
2879
|
+
pointerEvents: state.isDisabled ? "none" : "",
|
|
2880
|
+
borderRadius: "8px",
|
|
2881
|
+
margin: "4px 0px",
|
|
2882
|
+
padding: "10px 12px",
|
|
2883
|
+
backgroundColor: state.isSelected ? "var(--blue-700)" : "white",
|
|
2884
|
+
color,
|
|
2885
|
+
fontWeight: state.isSelected ? 700 : 400,
|
|
2886
|
+
"&:hover": {
|
|
2887
|
+
backgroundColor: state.isSelected ? "var(--blue-700)" : "var(--light-200)"
|
|
2888
|
+
},
|
|
2889
|
+
"&:active": {
|
|
2890
|
+
backgroundColor: "var(--blue-700)",
|
|
2891
|
+
color: "white !important",
|
|
2892
|
+
fontWeight: 700
|
|
2893
|
+
},
|
|
2894
|
+
"&:active i": {
|
|
2895
|
+
color: "white !important",
|
|
2896
|
+
fontWeight: 700
|
|
2897
|
+
},
|
|
2898
|
+
" i": {
|
|
2899
|
+
color: "white !important"
|
|
2900
|
+
}
|
|
2901
|
+
};
|
|
2902
|
+
},
|
|
2903
|
+
container: (provided) => ({
|
|
2904
|
+
...provided,
|
|
2905
|
+
border: "none",
|
|
2906
|
+
outline: "none",
|
|
2907
|
+
boxShadow: "none",
|
|
2908
|
+
padding: "none",
|
|
2909
|
+
margin: "none"
|
|
2910
|
+
})
|
|
2911
|
+
};
|
|
2912
|
+
var SelectFieldBip = ({
|
|
2913
|
+
name,
|
|
2914
|
+
label,
|
|
2915
|
+
error,
|
|
2916
|
+
defaultValue,
|
|
2917
|
+
control,
|
|
2918
|
+
placeholder,
|
|
2919
|
+
isSearchable = false,
|
|
2920
|
+
required,
|
|
2921
|
+
debounce: debounce2,
|
|
2922
|
+
filterOptions,
|
|
2923
|
+
disabled,
|
|
2924
|
+
onChangeValue,
|
|
2925
|
+
optionStyle,
|
|
2926
|
+
valueStyle,
|
|
2927
|
+
icon,
|
|
2928
|
+
onErrorBip,
|
|
2929
|
+
clearAfterSelect = true,
|
|
2930
|
+
messages = {
|
|
2931
|
+
searching: "Searching...",
|
|
2932
|
+
debounce: `Type at least {debounce} characters`,
|
|
2933
|
+
emptyMessage: "No options found",
|
|
2934
|
+
loading: "Loading..."
|
|
2935
|
+
}
|
|
2936
|
+
}) => {
|
|
2937
|
+
var _a;
|
|
2938
|
+
const { Option, SingleValue } = reactSelect.components;
|
|
2939
|
+
const selectRef = React2.useRef(null);
|
|
2940
|
+
const [inputValue, setInputValue] = React2.useState("");
|
|
2941
|
+
const [loading, setLoading] = React2.useState(false);
|
|
2942
|
+
const [cachedOptions, setCachedOptions] = React2.useState([]);
|
|
2943
|
+
const fetchOptions = async (value) => {
|
|
2944
|
+
if (isSearchable && filterOptions) {
|
|
2945
|
+
if (!debounce2 || debounce2 && value.length >= debounce2) {
|
|
2946
|
+
setLoading(true);
|
|
2947
|
+
const result = await filterOptions(value);
|
|
2948
|
+
setCachedOptions(result);
|
|
2949
|
+
setLoading(false);
|
|
2950
|
+
return result;
|
|
2951
|
+
}
|
|
2952
|
+
}
|
|
2953
|
+
return [];
|
|
2954
|
+
};
|
|
2955
|
+
const fieldValidation = useFieldErrorsStore((state) => state.field);
|
|
2956
|
+
const fieldValidationMessages = [
|
|
2957
|
+
(_a = fieldValidation[name]) == null ? void 0 : _a.message,
|
|
2958
|
+
error == null ? void 0 : error.message
|
|
2959
|
+
];
|
|
2960
|
+
const hasError = {
|
|
2961
|
+
hasError: fieldValidationMessages.some((item) => item !== void 0)
|
|
2962
|
+
};
|
|
2963
|
+
const hasLabel = {
|
|
2964
|
+
hasLabel: (label == null ? void 0 : label.length) > 0
|
|
2965
|
+
};
|
|
2966
|
+
const hasIcon = {
|
|
2967
|
+
hasIcon: icon
|
|
2968
|
+
};
|
|
2969
|
+
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"}`;
|
|
2970
|
+
const debouncedFetchOptions = React2.useMemo(() => {
|
|
2971
|
+
return debounce_default((value, callback) => {
|
|
2972
|
+
fetchOptions(value).then(callback);
|
|
2973
|
+
}, 300);
|
|
2974
|
+
}, [filterOptions]);
|
|
2975
|
+
React2.useEffect(() => {
|
|
2976
|
+
return () => {
|
|
2977
|
+
debouncedFetchOptions.cancel();
|
|
2978
|
+
};
|
|
2979
|
+
}, [debouncedFetchOptions]);
|
|
2980
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2981
|
+
reactHookForm.Controller,
|
|
2982
|
+
{
|
|
2983
|
+
name,
|
|
2984
|
+
control,
|
|
2985
|
+
defaultValue,
|
|
2986
|
+
render: ({ field }) => {
|
|
2987
|
+
const CustomSingleValue = (props) => {
|
|
2988
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SingleValue, { ...props, children: valueStyle ? valueStyle(props == null ? void 0 : props.data) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2989
|
+
props.data.label,
|
|
2990
|
+
" "
|
|
2991
|
+
] }) });
|
|
2992
|
+
};
|
|
2993
|
+
const IconOption = (props) => {
|
|
2994
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Option, { ...props, children: optionStyle ? optionStyle(props == null ? void 0 : props.data) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
2995
|
+
"div",
|
|
2996
|
+
{
|
|
2997
|
+
style: {
|
|
2998
|
+
display: "flex",
|
|
2999
|
+
alignItems: "center",
|
|
3000
|
+
justifyContent: "space-between"
|
|
3001
|
+
},
|
|
3002
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: clsx7__default.default("text-p-md focus:text-white"), children: props.data.label })
|
|
3003
|
+
}
|
|
3004
|
+
) });
|
|
3005
|
+
};
|
|
3006
|
+
const LoadingMessage = (props) => {
|
|
3007
|
+
if (!debounce2 || debounce2 && inputValue.length >= debounce2) {
|
|
3008
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3009
|
+
"div",
|
|
3010
|
+
{
|
|
3011
|
+
...props.innerProps,
|
|
3012
|
+
className: "flex items-center gap-[6px] p-2",
|
|
3013
|
+
children: [
|
|
3014
|
+
/* @__PURE__ */ jsxRuntime.jsx(SpinnerIcon, { width: 16, height: 16, className: "animate-spin" }),
|
|
3015
|
+
messages.searching
|
|
3016
|
+
]
|
|
3017
|
+
}
|
|
3018
|
+
);
|
|
3019
|
+
} else if (debounce2 && inputValue.length < debounce2) {
|
|
3020
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-2 text-dark-blue-300", children: messages.debounce.replace("{debounce}", String(debounce2)) });
|
|
3021
|
+
}
|
|
3022
|
+
};
|
|
3023
|
+
const NoOptionsMessage = (props) => {
|
|
3024
|
+
var _a2;
|
|
3025
|
+
if (inputValue.length == 0 && debounce2 > 0 || debounce2 > 0 && inputValue.length < debounce2) {
|
|
3026
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-2 text-dark-blue-300", children: messages.debounce.replace("{debounce}", String(debounce2)) });
|
|
3027
|
+
} else if (inputValue.length > 0 && ((_a2 = props == null ? void 0 : props.options) == null ? void 0 : _a2.length) == 0) {
|
|
3028
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-2 text-dark-blue-300", children: messages.emptyMessage });
|
|
3029
|
+
}
|
|
3030
|
+
};
|
|
3031
|
+
const DropdownIndicatorCustom = (props) => {
|
|
3032
|
+
return null;
|
|
3033
|
+
};
|
|
3034
|
+
const handleKeyDown = async (event) => {
|
|
3035
|
+
var _a2;
|
|
3036
|
+
if (event.key === "Enter") {
|
|
3037
|
+
event.preventDefault();
|
|
3038
|
+
debouncedFetchOptions.cancel();
|
|
3039
|
+
const fetchedOptions = await fetchOptions(event.target.value);
|
|
3040
|
+
if ((fetchedOptions == null ? void 0 : fetchedOptions.length) > 0) {
|
|
3041
|
+
onChange(fetchedOptions[0]);
|
|
3042
|
+
setTimeout(() => {
|
|
3043
|
+
var _a3, _b, _c;
|
|
3044
|
+
setInputValue("");
|
|
3045
|
+
(_a3 = selectRef == null ? void 0 : selectRef.current) == null ? void 0 : _a3.clearValue();
|
|
3046
|
+
(_b = selectRef == null ? void 0 : selectRef.current) == null ? void 0 : _b.focus();
|
|
3047
|
+
(_c = selectRef == null ? void 0 : selectRef.current) == null ? void 0 : _c.onMenuClose();
|
|
3048
|
+
field.onChange(null);
|
|
3049
|
+
}, 10);
|
|
3050
|
+
} else {
|
|
3051
|
+
onErrorBip((_a2 = event == null ? void 0 : event.target) == null ? void 0 : _a2.value);
|
|
3052
|
+
selectRef.current.inputRef.select();
|
|
3053
|
+
selectRef.current.onMenuClose();
|
|
3054
|
+
}
|
|
3055
|
+
}
|
|
3056
|
+
};
|
|
3057
|
+
const handleInputChange = (value, actionMeta) => {
|
|
3058
|
+
if (actionMeta.action === "input-change") {
|
|
3059
|
+
setInputValue(value);
|
|
3060
|
+
}
|
|
3061
|
+
return value;
|
|
3062
|
+
};
|
|
3063
|
+
const onChange = async (value, action) => {
|
|
3064
|
+
var _a2, _b, _c, _d, _e;
|
|
3065
|
+
if (onChangeValue) onChangeValue(value);
|
|
3066
|
+
if ((action == null ? void 0 : action.action) === "select-option") {
|
|
3067
|
+
if (clearAfterSelect) {
|
|
3068
|
+
setInputValue("");
|
|
3069
|
+
(_a2 = selectRef == null ? void 0 : selectRef.current) == null ? void 0 : _a2.clearValue();
|
|
3070
|
+
(_b = selectRef == null ? void 0 : selectRef.current) == null ? void 0 : _b.onMenuClose();
|
|
3071
|
+
(_c = selectRef == null ? void 0 : selectRef.current) == null ? void 0 : _c.focus();
|
|
3072
|
+
field.onChange(null);
|
|
3073
|
+
} else {
|
|
3074
|
+
field.onChange(value);
|
|
3075
|
+
setInputValue("");
|
|
3076
|
+
(_d = selectRef == null ? void 0 : selectRef.current) == null ? void 0 : _d.onMenuClose();
|
|
3077
|
+
}
|
|
3078
|
+
}
|
|
3079
|
+
if (action === "clear-value") {
|
|
3080
|
+
setInputValue("");
|
|
3081
|
+
setCachedOptions([]);
|
|
3082
|
+
(_e = selectRef == null ? void 0 : selectRef.current) == null ? void 0 : _e.clearValue();
|
|
3083
|
+
field.onChange(null);
|
|
3084
|
+
}
|
|
3085
|
+
};
|
|
3086
|
+
const loadOptions = (value, callback) => {
|
|
3087
|
+
debouncedFetchOptions(value, callback);
|
|
3088
|
+
};
|
|
3089
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", id: "multiselect", children: [
|
|
3090
|
+
icon && /* @__PURE__ */ jsxRuntime.jsx("div", { className: iconStyle, children: icon }),
|
|
3091
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3092
|
+
AsyncSelect__default.default,
|
|
3093
|
+
{
|
|
3094
|
+
onKeyDown: handleKeyDown,
|
|
3095
|
+
...field,
|
|
3096
|
+
...hasError,
|
|
3097
|
+
...hasLabel,
|
|
3098
|
+
...hasIcon,
|
|
3099
|
+
ref: selectRef,
|
|
3100
|
+
isDisabled: disabled,
|
|
3101
|
+
onBlur: () => handleInputChange("", {
|
|
3102
|
+
action: "input-change"
|
|
3103
|
+
}),
|
|
3104
|
+
loadingMessage: () => /* @__PURE__ */ jsxRuntime.jsx("div", { children: messages.loading }),
|
|
3105
|
+
isLoading: loading,
|
|
3106
|
+
loadOptions,
|
|
3107
|
+
defaultOptions: false,
|
|
3108
|
+
name: field.name,
|
|
3109
|
+
isClearable: false,
|
|
3110
|
+
styles: customStyles2,
|
|
3111
|
+
placeholder: placeholder || " ",
|
|
3112
|
+
isSearchable,
|
|
3113
|
+
tabSelectsValue: true,
|
|
3114
|
+
components: {
|
|
3115
|
+
SingleValue: CustomSingleValue,
|
|
3116
|
+
ValueContainer: ValueContainer2,
|
|
3117
|
+
Option: IconOption,
|
|
3118
|
+
LoadingIndicator: () => /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {}),
|
|
3119
|
+
LoadingMessage,
|
|
3120
|
+
NoOptionsMessage,
|
|
3121
|
+
DropdownIndicator: DropdownIndicatorCustom
|
|
3122
|
+
},
|
|
3123
|
+
closeMenuOnSelect: false,
|
|
3124
|
+
blurInputOnSelect: true,
|
|
3125
|
+
hideSelectedOptions: false,
|
|
3126
|
+
onChange,
|
|
3127
|
+
inputValue,
|
|
3128
|
+
onInputChange: handleInputChange
|
|
3129
|
+
}
|
|
3130
|
+
),
|
|
3131
|
+
inputValue !== "" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3132
|
+
"i",
|
|
3133
|
+
{
|
|
3134
|
+
onClick: () => onChange(null, "clear-value"),
|
|
3135
|
+
className: "uil uil-times text-[18px] absolute right-2 top-[11px] cursor-pointer text-label"
|
|
3136
|
+
}
|
|
3137
|
+
),
|
|
3138
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3139
|
+
"span",
|
|
3140
|
+
{
|
|
3141
|
+
className: clsx7__default.default(
|
|
3142
|
+
"text-label text-sm left-2.5 cursor-pointer pointer-events-none",
|
|
3143
|
+
{
|
|
3144
|
+
[" scale-75 -translate-y-3 "]: field.value,
|
|
3145
|
+
["text-dangerous-700"]: hasError.hasError
|
|
3146
|
+
}
|
|
3147
|
+
),
|
|
3148
|
+
children: [
|
|
3149
|
+
label,
|
|
3150
|
+
required && label && /* @__PURE__ */ jsxRuntime.jsx("strong", { className: "text-dangerous-700", children: "\xA0*" })
|
|
3151
|
+
]
|
|
3152
|
+
}
|
|
3153
|
+
),
|
|
3154
|
+
fieldValidationMessages.map((message, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3155
|
+
"div",
|
|
3156
|
+
{
|
|
3157
|
+
className: "text-dangerous-700 text-xs mt-1 ml-[2px]",
|
|
3158
|
+
role: "alert",
|
|
3159
|
+
"aria-label": message,
|
|
3160
|
+
children: message
|
|
3161
|
+
},
|
|
3162
|
+
index
|
|
3163
|
+
))
|
|
3164
|
+
] });
|
|
3165
|
+
}
|
|
3166
|
+
}
|
|
3167
|
+
);
|
|
3168
|
+
};
|
|
3169
|
+
var ValueContainer2 = ({ children, ...props }) => {
|
|
3170
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactSelect.components.ValueContainer, { ...props, children });
|
|
3171
|
+
};
|
|
2796
3172
|
var Radio = ({
|
|
2797
3173
|
disabled,
|
|
2798
3174
|
control,
|
|
@@ -3752,6 +4128,7 @@ exports.Popover = Popover3;
|
|
|
3752
4128
|
exports.Radio = Radio;
|
|
3753
4129
|
exports.RocketIcon = RocketIcon;
|
|
3754
4130
|
exports.SelectField = SelectField;
|
|
4131
|
+
exports.SelectFieldBip = SelectFieldBip;
|
|
3755
4132
|
exports.SpinnerIcon = SpinnerIcon;
|
|
3756
4133
|
exports.Table = Table;
|
|
3757
4134
|
exports.TableBody = TableBody;
|