bianic-ui 1.9.0 → 1.9.1
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/cjs/index.js
CHANGED
|
@@ -2270,10 +2270,11 @@ DropdownItem.defaultProps = {
|
|
|
2270
2270
|
};
|
|
2271
2271
|
|
|
2272
2272
|
function LiveSearch(_a) {
|
|
2273
|
-
var descText = _a.descText, _b = _a.disabled, disabled = _b === void 0 ? false : _b, id = _a.id, _c = _a.size, size = _c === void 0 ? 'md' : _c, label = _a.label, placeholder = _a.placeholder, _d = _a.required, required = _d === void 0 ? false : _d, options = _a.options, setValue = _a.setValue, value = _a.value, _e = _a.readOnly, readOnly = _e === void 0 ? false : _e, _f = _a.onChangeText, onChangeText = _f === void 0 ? function () { } : _f, _g = _a.onClickDropdown, onClickDropdown = _g === void 0 ? function () { } : _g, _h = _a.autoComplete, autoComplete = _h === void 0 ? 'off' : _h, _j = _a.children, children = _j === void 0 ? undefined : _j, _k = _a.
|
|
2274
|
-
var
|
|
2275
|
-
var
|
|
2276
|
-
var
|
|
2273
|
+
var descText = _a.descText, _b = _a.disabled, disabled = _b === void 0 ? false : _b, id = _a.id, _c = _a.size, size = _c === void 0 ? 'md' : _c, label = _a.label, placeholder = _a.placeholder, _d = _a.required, required = _d === void 0 ? false : _d, options = _a.options, setValue = _a.setValue, value = _a.value, _e = _a.readOnly, readOnly = _e === void 0 ? false : _e, _f = _a.onChangeText, onChangeText = _f === void 0 ? function () { } : _f, _g = _a.onClickDropdown, onClickDropdown = _g === void 0 ? function () { } : _g, _h = _a.autoComplete, autoComplete = _h === void 0 ? 'off' : _h, _j = _a.children, children = _j === void 0 ? undefined : _j, _k = _a.dropContProps, dropContProps = _k === void 0 ? { className: undefined } : _k;
|
|
2274
|
+
var _l = React.useState(false), isOpen = _l[0], setIsOpen = _l[1];
|
|
2275
|
+
var _m = React.useState(value.label || ''), searchTerm = _m[0], setSearchTerm = _m[1];
|
|
2276
|
+
var _o = sizeConfig$6[size], iconClass = _o.iconClass, iconSize = _o.iconSize, inputClass = _o.inputClass;
|
|
2277
|
+
var dropContClassName = dropContProps.className, restDropContProps = __rest(dropContProps, ["className"]);
|
|
2277
2278
|
var inputRef = React.useRef(null);
|
|
2278
2279
|
var handleOutsideClick = function (e) {
|
|
2279
2280
|
if (inputRef.current && !inputRef.current.contains(e.target)) {
|
|
@@ -2376,15 +2377,15 @@ function LiveSearch(_a) {
|
|
|
2376
2377
|
React.createElement(TbX, { className: "text-primary-black", style: { fontSize: iconSize } }))),
|
|
2377
2378
|
children === undefined && isOpen && (React.createElement("div", { className: "border-grey-100 absolute z-10 max-h-60 w-full overflow-y-auto rounded-b-md border bg-primary-white shadow-lg", onClick: onClickDropdown }, filteredOptions.map(function (option) {
|
|
2378
2379
|
var isSelected = value && value.id && option.id === value.id;
|
|
2379
|
-
return option.custom ? (React.createElement(CustomDropdownItem, { size: size, isSelected: isSelected, className:
|
|
2380
|
+
return option.custom ? (React.createElement(CustomDropdownItem, { size: size, isSelected: isSelected, className: dropContClassName, onClick: function () {
|
|
2380
2381
|
setValue(option);
|
|
2381
2382
|
setIsOpen(false);
|
|
2382
|
-
} }, option.custom)) : (React.createElement(DefaultDropdownItem, { label: option.label, size: size, isSelected: isSelected, className:
|
|
2383
|
+
} }, option.custom)) : (React.createElement(DefaultDropdownItem, { label: option.label, size: size, isSelected: isSelected, className: dropContClassName, onClick: function () {
|
|
2383
2384
|
setValue(option);
|
|
2384
2385
|
setIsOpen(false);
|
|
2385
2386
|
} }));
|
|
2386
2387
|
}))),
|
|
2387
|
-
children && isOpen && (React.createElement(DropdownContainer, __assign({ open: isOpen, onClose: function () { return setIsOpen(false); }, size: size, isTopFlat: true, className: "bianic-livesearch-dropdown absolute z-10 mt-1 w-full overflow-hidden rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none ".concat(
|
|
2388
|
+
children && isOpen && (React.createElement(DropdownContainer, __assign({ open: isOpen, onClose: function () { return setIsOpen(false); }, size: size, isTopFlat: true, className: "bianic-livesearch-dropdown absolute z-10 mt-1 w-full overflow-hidden rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none ".concat(dropContClassName) }, restDropContProps), hasFilteredResults
|
|
2388
2389
|
? renderedChildren
|
|
2389
2390
|
: // If no results and searchTerm is present
|
|
2390
2391
|
searchTerm.length > 0 && (React.createElement(DropdownItem, { content: React.createElement("div", { className: "px-4 py-2 text-gray-500" }, "Tidak ada hasil ditemukan.") }))))),
|
|
@@ -4,7 +4,7 @@ export interface LiveSearchOption {
|
|
|
4
4
|
id: string | number | null;
|
|
5
5
|
label: string | number;
|
|
6
6
|
}
|
|
7
|
-
declare function LiveSearch({ descText, disabled, id, size, label, placeholder, required, options, setValue, value, readOnly, onChangeText, onClickDropdown, autoComplete, children,
|
|
7
|
+
declare function LiveSearch({ descText, disabled, id, size, label, placeholder, required, options, setValue, value, readOnly, onChangeText, onClickDropdown, autoComplete, children, dropContProps, }: LiveSearchProps): React.JSX.Element;
|
|
8
8
|
declare namespace LiveSearch {
|
|
9
9
|
var defaultProps: {
|
|
10
10
|
descText: string;
|
package/dist/esm/index.js
CHANGED
|
@@ -2268,10 +2268,11 @@ DropdownItem.defaultProps = {
|
|
|
2268
2268
|
};
|
|
2269
2269
|
|
|
2270
2270
|
function LiveSearch(_a) {
|
|
2271
|
-
var descText = _a.descText, _b = _a.disabled, disabled = _b === void 0 ? false : _b, id = _a.id, _c = _a.size, size = _c === void 0 ? 'md' : _c, label = _a.label, placeholder = _a.placeholder, _d = _a.required, required = _d === void 0 ? false : _d, options = _a.options, setValue = _a.setValue, value = _a.value, _e = _a.readOnly, readOnly = _e === void 0 ? false : _e, _f = _a.onChangeText, onChangeText = _f === void 0 ? function () { } : _f, _g = _a.onClickDropdown, onClickDropdown = _g === void 0 ? function () { } : _g, _h = _a.autoComplete, autoComplete = _h === void 0 ? 'off' : _h, _j = _a.children, children = _j === void 0 ? undefined : _j, _k = _a.
|
|
2272
|
-
var
|
|
2273
|
-
var
|
|
2274
|
-
var
|
|
2271
|
+
var descText = _a.descText, _b = _a.disabled, disabled = _b === void 0 ? false : _b, id = _a.id, _c = _a.size, size = _c === void 0 ? 'md' : _c, label = _a.label, placeholder = _a.placeholder, _d = _a.required, required = _d === void 0 ? false : _d, options = _a.options, setValue = _a.setValue, value = _a.value, _e = _a.readOnly, readOnly = _e === void 0 ? false : _e, _f = _a.onChangeText, onChangeText = _f === void 0 ? function () { } : _f, _g = _a.onClickDropdown, onClickDropdown = _g === void 0 ? function () { } : _g, _h = _a.autoComplete, autoComplete = _h === void 0 ? 'off' : _h, _j = _a.children, children = _j === void 0 ? undefined : _j, _k = _a.dropContProps, dropContProps = _k === void 0 ? { className: undefined } : _k;
|
|
2272
|
+
var _l = useState(false), isOpen = _l[0], setIsOpen = _l[1];
|
|
2273
|
+
var _m = useState(value.label || ''), searchTerm = _m[0], setSearchTerm = _m[1];
|
|
2274
|
+
var _o = sizeConfig$6[size], iconClass = _o.iconClass, iconSize = _o.iconSize, inputClass = _o.inputClass;
|
|
2275
|
+
var dropContClassName = dropContProps.className, restDropContProps = __rest(dropContProps, ["className"]);
|
|
2275
2276
|
var inputRef = useRef(null);
|
|
2276
2277
|
var handleOutsideClick = function (e) {
|
|
2277
2278
|
if (inputRef.current && !inputRef.current.contains(e.target)) {
|
|
@@ -2374,15 +2375,15 @@ function LiveSearch(_a) {
|
|
|
2374
2375
|
React.createElement(TbX, { className: "text-primary-black", style: { fontSize: iconSize } }))),
|
|
2375
2376
|
children === undefined && isOpen && (React.createElement("div", { className: "border-grey-100 absolute z-10 max-h-60 w-full overflow-y-auto rounded-b-md border bg-primary-white shadow-lg", onClick: onClickDropdown }, filteredOptions.map(function (option) {
|
|
2376
2377
|
var isSelected = value && value.id && option.id === value.id;
|
|
2377
|
-
return option.custom ? (React.createElement(CustomDropdownItem, { size: size, isSelected: isSelected, className:
|
|
2378
|
+
return option.custom ? (React.createElement(CustomDropdownItem, { size: size, isSelected: isSelected, className: dropContClassName, onClick: function () {
|
|
2378
2379
|
setValue(option);
|
|
2379
2380
|
setIsOpen(false);
|
|
2380
|
-
} }, option.custom)) : (React.createElement(DefaultDropdownItem, { label: option.label, size: size, isSelected: isSelected, className:
|
|
2381
|
+
} }, option.custom)) : (React.createElement(DefaultDropdownItem, { label: option.label, size: size, isSelected: isSelected, className: dropContClassName, onClick: function () {
|
|
2381
2382
|
setValue(option);
|
|
2382
2383
|
setIsOpen(false);
|
|
2383
2384
|
} }));
|
|
2384
2385
|
}))),
|
|
2385
|
-
children && isOpen && (React.createElement(DropdownContainer, __assign({ open: isOpen, onClose: function () { return setIsOpen(false); }, size: size, isTopFlat: true, className: "bianic-livesearch-dropdown absolute z-10 mt-1 w-full overflow-hidden rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none ".concat(
|
|
2386
|
+
children && isOpen && (React.createElement(DropdownContainer, __assign({ open: isOpen, onClose: function () { return setIsOpen(false); }, size: size, isTopFlat: true, className: "bianic-livesearch-dropdown absolute z-10 mt-1 w-full overflow-hidden rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none ".concat(dropContClassName) }, restDropContProps), hasFilteredResults
|
|
2386
2387
|
? renderedChildren
|
|
2387
2388
|
: // If no results and searchTerm is present
|
|
2388
2389
|
searchTerm.length > 0 && (React.createElement(DropdownItem, { content: React.createElement("div", { className: "px-4 py-2 text-gray-500" }, "Tidak ada hasil ditemukan.") }))))),
|
|
@@ -4,7 +4,7 @@ export interface LiveSearchOption {
|
|
|
4
4
|
id: string | number | null;
|
|
5
5
|
label: string | number;
|
|
6
6
|
}
|
|
7
|
-
declare function LiveSearch({ descText, disabled, id, size, label, placeholder, required, options, setValue, value, readOnly, onChangeText, onClickDropdown, autoComplete, children,
|
|
7
|
+
declare function LiveSearch({ descText, disabled, id, size, label, placeholder, required, options, setValue, value, readOnly, onChangeText, onClickDropdown, autoComplete, children, dropContProps, }: LiveSearchProps): React.JSX.Element;
|
|
8
8
|
declare namespace LiveSearch {
|
|
9
9
|
var defaultProps: {
|
|
10
10
|
descText: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -365,7 +365,7 @@ interface LiveSearchProps extends Omit<ComponentPropsWithoutRef<'input'>, 'size'
|
|
|
365
365
|
dropContProps?: Omit<DropdownContainerProps, 'children'>;
|
|
366
366
|
}
|
|
367
367
|
|
|
368
|
-
declare function LiveSearch({ descText, disabled, id, size, label, placeholder, required, options, setValue, value, readOnly, onChangeText, onClickDropdown, autoComplete, children,
|
|
368
|
+
declare function LiveSearch({ descText, disabled, id, size, label, placeholder, required, options, setValue, value, readOnly, onChangeText, onClickDropdown, autoComplete, children, dropContProps, }: LiveSearchProps): React$1.JSX.Element;
|
|
369
369
|
declare namespace LiveSearch {
|
|
370
370
|
var defaultProps: {
|
|
371
371
|
descText: string;
|
package/package.json
CHANGED