akeyless-client-commons 1.0.10 → 1.0.11
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/components/index.d.mts +3 -1
- package/dist/components/index.d.ts +3 -1
- package/dist/components/index.js +77 -36
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +79 -38
- package/dist/components/index.mjs.map +1 -1
- package/dist/types/index.d.mts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -4018,19 +4018,36 @@ import { CheckIcon, ChevronDownIcon } from "lucide-react";
|
|
|
4018
4018
|
import { useId, useMemo as useMemo5, useState as useState5 } from "react";
|
|
4019
4019
|
import { jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
4020
4020
|
function SearchSelect(param) {
|
|
4021
|
-
var options = param.options, name = param.name, _param_selectPlaceholder = param.selectPlaceholder, selectPlaceholder = _param_selectPlaceholder === void 0 ? "Select" : _param_selectPlaceholder, defaultValue = param.defaultValue,
|
|
4021
|
+
var options = param.options, name = param.name, _param_selectPlaceholder = param.selectPlaceholder, selectPlaceholder = _param_selectPlaceholder === void 0 ? "Select" : _param_selectPlaceholder, defaultValue = param.defaultValue, _param_searchPlaceholder = param.searchPlaceholder, searchPlaceholder = _param_searchPlaceholder === void 0 ? "Search" : _param_searchPlaceholder, dropdownClassName = param.dropdownClassName, dropdownOptionClassName = param.dropdownOptionClassName, notFoundLabel = param.notFoundLabel, notFoundLabelClassName = param.notFoundLabelClassName, elementClassName = param.elementClassName, searchClassName = param.searchClassName, selectButtonClassName = param.selectButtonClassName, value = param.value, disabled = param.disabled, onChange = param.onChange, direction = param.direction, createNewOptionLabel = param.createNewOptionLabel;
|
|
4022
4022
|
var id = useId();
|
|
4023
4023
|
var _useState5 = _sliced_to_array(useState5(false), 2), open = _useState5[0], setOpen = _useState5[1];
|
|
4024
4024
|
var _ref;
|
|
4025
4025
|
var _useState51 = _sliced_to_array(useState5((_ref = value !== null && value !== void 0 ? value : defaultValue) !== null && _ref !== void 0 ? _ref : ""), 2), selectedValue = _useState51[0], setSelectedValue = _useState51[1];
|
|
4026
|
+
var _useState52 = _sliced_to_array(useState5(""), 2), searchQuery = _useState52[0], setSearchQuery = _useState52[1];
|
|
4027
|
+
var _useState53 = _sliced_to_array(useState5([]), 2), newOptions = _useState53[0], setNewOptions = _useState53[1];
|
|
4028
|
+
var allOptions = useMemo5(function() {
|
|
4029
|
+
return _to_consumable_array(options).concat(_to_consumable_array(newOptions));
|
|
4030
|
+
}, [
|
|
4031
|
+
options,
|
|
4032
|
+
newOptions
|
|
4033
|
+
]);
|
|
4034
|
+
var filteredOptions = useMemo5(function() {
|
|
4035
|
+
if (!searchQuery) return allOptions;
|
|
4036
|
+
return allOptions.filter(function(option) {
|
|
4037
|
+
return option.label.toLowerCase().includes(searchQuery.toLowerCase());
|
|
4038
|
+
});
|
|
4039
|
+
}, [
|
|
4040
|
+
allOptions,
|
|
4041
|
+
searchQuery
|
|
4042
|
+
]);
|
|
4026
4043
|
var selectLabel = useMemo5(function() {
|
|
4027
|
-
var
|
|
4028
|
-
return selectedValue ? (
|
|
4044
|
+
var _allOptions_find;
|
|
4045
|
+
return selectedValue ? (_allOptions_find = allOptions.find(function(item) {
|
|
4029
4046
|
return item.value === selectedValue;
|
|
4030
|
-
})) === null ||
|
|
4047
|
+
})) === null || _allOptions_find === void 0 ? void 0 : _allOptions_find.label : selectPlaceholder;
|
|
4031
4048
|
}, [
|
|
4032
4049
|
selectedValue,
|
|
4033
|
-
|
|
4050
|
+
allOptions,
|
|
4034
4051
|
selectPlaceholder
|
|
4035
4052
|
]);
|
|
4036
4053
|
return /* @__PURE__ */ jsxs10("div", {
|
|
@@ -4041,7 +4058,10 @@ function SearchSelect(param) {
|
|
|
4041
4058
|
children: [
|
|
4042
4059
|
/* @__PURE__ */ jsxs10(Popover, {
|
|
4043
4060
|
open: open,
|
|
4044
|
-
onOpenChange:
|
|
4061
|
+
onOpenChange: function(isOpen) {
|
|
4062
|
+
setOpen(isOpen);
|
|
4063
|
+
if (!isOpen) setSearchQuery("");
|
|
4064
|
+
},
|
|
4045
4065
|
children: [
|
|
4046
4066
|
/* @__PURE__ */ jsx15(PopoverTrigger, {
|
|
4047
4067
|
asChild: true,
|
|
@@ -4075,37 +4095,57 @@ function SearchSelect(param) {
|
|
|
4075
4095
|
direction: direction
|
|
4076
4096
|
},
|
|
4077
4097
|
className: cn(searchClassName),
|
|
4078
|
-
placeholder: searchPlaceholder
|
|
4098
|
+
placeholder: searchPlaceholder,
|
|
4099
|
+
value: searchQuery,
|
|
4100
|
+
onValueChange: function(val) {
|
|
4101
|
+
return setSearchQuery(val);
|
|
4102
|
+
}
|
|
4079
4103
|
}),
|
|
4080
|
-
/* @__PURE__ */
|
|
4081
|
-
children:
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4104
|
+
/* @__PURE__ */ jsx15(CommandList, {
|
|
4105
|
+
children: filteredOptions.length === 0 && searchQuery ? createNewOptionLabel ? /* @__PURE__ */ jsx15(CommandItem, {
|
|
4106
|
+
onSelect: function() {
|
|
4107
|
+
var newOption = {
|
|
4108
|
+
value: searchQuery,
|
|
4109
|
+
label: searchQuery
|
|
4110
|
+
};
|
|
4111
|
+
setNewOptions(function(prev) {
|
|
4112
|
+
return _to_consumable_array(prev).concat([
|
|
4113
|
+
newOption
|
|
4114
|
+
]);
|
|
4115
|
+
});
|
|
4116
|
+
setSelectedValue(newOption.value);
|
|
4117
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newOption.value);
|
|
4118
|
+
setOpen(false);
|
|
4119
|
+
setSearchQuery("");
|
|
4120
|
+
},
|
|
4121
|
+
className: "hover:bg-[#cccbcb] cursor-pointer",
|
|
4122
|
+
children: "".concat(createNewOptionLabel, ": ").concat(searchQuery)
|
|
4123
|
+
}) : /* @__PURE__ */ jsx15(CommandEmpty, {
|
|
4124
|
+
className: cn("w-full py-2 text-center", notFoundLabelClassName),
|
|
4125
|
+
children: notFoundLabel
|
|
4126
|
+
}) : /* @__PURE__ */ jsx15(CommandGroup, {
|
|
4127
|
+
className: cn("max-h-52 overflow-y-auto", dropdownClassName),
|
|
4128
|
+
children: filteredOptions.map(function(option) {
|
|
4129
|
+
return /* @__PURE__ */ jsxs10(CommandItem, {
|
|
4130
|
+
className: cn("hover:bg-[#cccbcb] cursor-pointer", dropdownOptionClassName, selectedValue === option.value && "bg-[#cccbcb]"),
|
|
4131
|
+
value: JSON.stringify(option),
|
|
4132
|
+
onSelect: function(currentValue) {
|
|
4133
|
+
var parsedValue = JSON.parse(currentValue);
|
|
4134
|
+
setSelectedValue(parsedValue.value);
|
|
4135
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(parsedValue.value);
|
|
4136
|
+
setOpen(false);
|
|
4137
|
+
setSearchQuery("");
|
|
4138
|
+
},
|
|
4139
|
+
children: [
|
|
4140
|
+
option.label,
|
|
4141
|
+
selectedValue === option.value && /* @__PURE__ */ jsx15(CheckIcon, {
|
|
4142
|
+
size: 16,
|
|
4143
|
+
className: "ml-auto"
|
|
4144
|
+
})
|
|
4145
|
+
]
|
|
4146
|
+
}, option.value);
|
|
4107
4147
|
})
|
|
4108
|
-
|
|
4148
|
+
})
|
|
4109
4149
|
})
|
|
4110
4150
|
]
|
|
4111
4151
|
})
|
|
@@ -4604,7 +4644,7 @@ var NumberUI = function(param) {
|
|
|
4604
4644
|
// src/components/forms/ModularForm/ModularForm.tsx
|
|
4605
4645
|
import { cloneElement, useState as useState8 } from "react";
|
|
4606
4646
|
// src/components/forms/ModularForm/formElements.tsx
|
|
4607
|
-
import { useCallback as
|
|
4647
|
+
import { useCallback as useCallback3, useMemo as useMemo8, useState as useState7 } from "react";
|
|
4608
4648
|
// src/components/forms/ModularForm/InternationalPhonePicker.tsx
|
|
4609
4649
|
import { ChevronDown, Phone } from "lucide-react";
|
|
4610
4650
|
import { forwardRef as forwardRef7, useEffect as useEffect5, useMemo as useMemo7, useRef as useRef4, useState as useState6 } from "react";
|
|
@@ -4801,7 +4841,7 @@ var useSortValues = function(options, sortDirection, sortAsNumber) {
|
|
|
4801
4841
|
};
|
|
4802
4842
|
var InputContainer = function(param) {
|
|
4803
4843
|
var validationError = param.validationError, _param_name = param.name, name = _param_name === void 0 ? "" : _param_name, _param_inputType = param.inputType, inputType = _param_inputType === void 0 ? "text" : _param_inputType, _param_labelContent = param.labelContent, labelContent = _param_labelContent === void 0 ? "" : _param_labelContent, _param_defaultValue = param.defaultValue, defaultValue = _param_defaultValue === void 0 ? "" : _param_defaultValue, _param_validationName = param.validationName, validationName = _param_validationName === void 0 ? "textNumbers" : _param_validationName, _param_containerClassName = param.containerClassName, containerClassName = _param_containerClassName === void 0 ? "" : _param_containerClassName, _param_labelClassName = param.labelClassName, labelClassName = _param_labelClassName === void 0 ? "" : _param_labelClassName, _param_elementClassName = param.elementClassName, elementClassName = _param_elementClassName === void 0 ? "" : _param_elementClassName, _param_required = param.required, required = _param_required === void 0 ? false : _param_required, placeholder = param.placeholder, props = param.props, minLength = param.minLength, onKeyDown = param.onKeyDown, onChange = param.onChange, direction = param.direction, value = param.value;
|
|
4804
|
-
var handleChangeFunction =
|
|
4844
|
+
var handleChangeFunction = useCallback3(function(e) {
|
|
4805
4845
|
handleChange(e);
|
|
4806
4846
|
onChange === null || onChange === void 0 ? void 0 : onChange(e);
|
|
4807
4847
|
}, [
|
|
@@ -4949,7 +4989,7 @@ function MultiSelect(param) {
|
|
|
4949
4989
|
});
|
|
4950
4990
|
}
|
|
4951
4991
|
var SelectWithSearch = function(param) {
|
|
4952
|
-
var options = param.options, labelClassName = param.labelClassName, labelContent = param.labelContent, name = param.name, onChange = param.onChange, value = param.value, placeholder = param.placeholder, required = param.required, defaultValue = param.defaultValue, notFoundLabel = param.notFoundLabel, searchPlaceholder = param.searchPlaceholder, containerClassName = param.containerClassName, dropdownClassName = param.dropdownClassName, dropdownOptionClassName = param.dropdownOptionClassName, elementClassName = param.elementClassName, notFoundLabelClassName = param.notFoundLabelClassName, searchClassName = param.searchClassName, selectButtonClassName = param.selectButtonClassName, _param_sortDirection = param.sortDirection, sortDirection = _param_sortDirection === void 0 ? "abc" : _param_sortDirection, sortAsNumber = param.sortAsNumber, disabled = param.disabled, direction = param.direction;
|
|
4992
|
+
var options = param.options, labelClassName = param.labelClassName, labelContent = param.labelContent, name = param.name, onChange = param.onChange, value = param.value, placeholder = param.placeholder, required = param.required, defaultValue = param.defaultValue, notFoundLabel = param.notFoundLabel, searchPlaceholder = param.searchPlaceholder, containerClassName = param.containerClassName, dropdownClassName = param.dropdownClassName, dropdownOptionClassName = param.dropdownOptionClassName, elementClassName = param.elementClassName, notFoundLabelClassName = param.notFoundLabelClassName, searchClassName = param.searchClassName, selectButtonClassName = param.selectButtonClassName, _param_sortDirection = param.sortDirection, sortDirection = _param_sortDirection === void 0 ? "abc" : _param_sortDirection, sortAsNumber = param.sortAsNumber, disabled = param.disabled, direction = param.direction, createNewOptionLabel = param.createNewOptionLabel;
|
|
4953
4993
|
var sortOptions = useSortValues(options, sortDirection, sortAsNumber);
|
|
4954
4994
|
return /* @__PURE__ */ jsxs13("div", {
|
|
4955
4995
|
className: cn("flex justify-between items-center w-full", containerClassName),
|
|
@@ -4963,6 +5003,7 @@ var SelectWithSearch = function(param) {
|
|
|
4963
5003
|
}),
|
|
4964
5004
|
/* @__PURE__ */ jsx18(SearchSelect, {
|
|
4965
5005
|
direction: direction,
|
|
5006
|
+
createNewOptionLabel: createNewOptionLabel,
|
|
4966
5007
|
options: sortOptions,
|
|
4967
5008
|
value: value,
|
|
4968
5009
|
onChange: onChange,
|