@majapisoftwares/ui 4.1.6 → 4.1.8
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/components/FileInput/FileInput.d.ts +2 -1
- package/components/FileInput/FileInput.jsx +11 -10
- package/components/FileInput/PreviewFile.d.ts +3 -1
- package/components/FileInput/PreviewFile.jsx +13 -4
- package/components/MultiSelect/MultiSelect.d.ts +1 -1
- package/components/MultiSelect/MultiSelect.jsx +43 -57
- package/components/MultiSelect/MultiSelectInput.d.ts +11 -0
- package/components/MultiSelect/MultiSelectInput.jsx +22 -0
- package/components/MultiSelect/index.d.ts +2 -0
- package/components/MultiSelect/index.jsx +2 -0
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -47,4 +47,5 @@ declare function FileInput<PFP extends object>({ error, className, helpText, onC
|
|
|
47
47
|
previewFileProps?: PFP;
|
|
48
48
|
}): import("react").JSX.Element;
|
|
49
49
|
export type FileInputProps = ComponentPropsWithRef<typeof FileInput>;
|
|
50
|
-
|
|
50
|
+
declare const _default: typeof FileInput;
|
|
51
|
+
export default _default;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import clsx from "../../utils/clsx";
|
|
2
|
-
import { useCallback, useEffect, useRef, useState, } from "react";
|
|
3
|
-
import { useDeepCompareEffect
|
|
2
|
+
import { memo, useCallback, useEffect, useMemo, useRef, useState, } from "react";
|
|
3
|
+
import { useDeepCompareEffect } from "react-use";
|
|
4
4
|
import { defaultHelpTextClassName, defaultLabelClassName, } from "../Input";
|
|
5
5
|
import FileSelect from "../FileSelect";
|
|
6
6
|
import isomorphicObjectId from "@majapisoftwares/next/utils/isomorphicObjectId";
|
|
7
7
|
import { isEqual } from "lodash-es";
|
|
8
8
|
import Text from "../Text";
|
|
9
|
-
import
|
|
9
|
+
import PreviewFile from "./PreviewFile";
|
|
10
10
|
import concurrentForOf from "@majapisoftwares/next/utils/concurrentForOf";
|
|
11
11
|
import paginated from "@majapisoftwares/next/utils/paginated";
|
|
12
12
|
import Pagination from "../Pagination";
|
|
@@ -14,7 +14,7 @@ function FileInput({ error, className, helpText, onChange, name, limit, label, i
|
|
|
14
14
|
const [uploading, setUploading] = useState(false);
|
|
15
15
|
const [innerValue, setInnerValue] = useState(value || []);
|
|
16
16
|
const [currentPage, setCurrentPage] = useState(1);
|
|
17
|
-
const PreviewFileComponent = previewFileComponent || PreviewFile;
|
|
17
|
+
const PreviewFileComponent = useMemo(() => memo(previewFileComponent || PreviewFile, isEqual), [previewFileComponent]);
|
|
18
18
|
const paginatedValue = paginated(innerValue, currentPage - 1, filesPerPage);
|
|
19
19
|
useEffect(() => {
|
|
20
20
|
const totalPages = Math.ceil(innerValue.length / filesPerPage);
|
|
@@ -26,7 +26,7 @@ function FileInput({ error, className, helpText, onChange, name, limit, label, i
|
|
|
26
26
|
if (value && !isEqual(value, innerValue)) {
|
|
27
27
|
setInnerValue(value);
|
|
28
28
|
}
|
|
29
|
-
}, [{ value
|
|
29
|
+
}, [{ value }]);
|
|
30
30
|
const innerRef = useRef({
|
|
31
31
|
get value() {
|
|
32
32
|
return innerValue;
|
|
@@ -98,16 +98,17 @@ function FileInput({ error, className, helpText, onChange, name, limit, label, i
|
|
|
98
98
|
setUploading(false);
|
|
99
99
|
}
|
|
100
100
|
};
|
|
101
|
-
|
|
101
|
+
useDeepCompareEffect(() => {
|
|
102
102
|
if (onChange) {
|
|
103
103
|
onChange({
|
|
104
104
|
target: {
|
|
105
105
|
name,
|
|
106
106
|
value: innerValue.map((file) => ({
|
|
107
107
|
...file,
|
|
108
|
-
url: file.
|
|
109
|
-
|
|
110
|
-
|
|
108
|
+
url: file.url ||
|
|
109
|
+
(file.file
|
|
110
|
+
? URL.createObjectURL(file.file)
|
|
111
|
+
: undefined),
|
|
111
112
|
})),
|
|
112
113
|
},
|
|
113
114
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -141,4 +142,4 @@ function FileInput({ error, className, helpText, onChange, name, limit, label, i
|
|
|
141
142
|
</div>)}
|
|
142
143
|
</div>);
|
|
143
144
|
}
|
|
144
|
-
export default FileInput;
|
|
145
|
+
export default memo(FileInput, isEqual);
|
|
@@ -13,4 +13,6 @@ export type PreviewFileProps = {
|
|
|
13
13
|
filesPerPage: number;
|
|
14
14
|
currentPage: number;
|
|
15
15
|
};
|
|
16
|
-
|
|
16
|
+
declare function PreviewFile({ file, readOnly, handleDeleteClick, downloadText, openText, display, additionalInfo, index, className, filesPerPage, currentPage, }: PreviewFileProps): import("react").JSX.Element;
|
|
17
|
+
declare const _default: import("react").MemoExoticComponent<typeof PreviewFile>;
|
|
18
|
+
export default _default;
|
|
@@ -5,13 +5,21 @@ import Text from "../Text";
|
|
|
5
5
|
import numeral from "numeral";
|
|
6
6
|
import Button from "../Button";
|
|
7
7
|
import { ArrowTopRightOnSquareIcon, TrashIcon, } from "@heroicons/react/20/solid";
|
|
8
|
+
import { memo } from "react";
|
|
8
9
|
import clsx from "../../utils/clsx";
|
|
9
10
|
import checkIsVideo from "./isVideo";
|
|
10
11
|
import checkIsImage from "./isImage";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
import { isEqual } from "lodash-es";
|
|
13
|
+
function PreviewFile({ file, readOnly, handleDeleteClick, downloadText, openText, display = "info", additionalInfo, index, className, filesPerPage, currentPage, }) {
|
|
14
|
+
const url = file.url ||
|
|
15
|
+
(file.file
|
|
16
|
+
? URL.createObjectURL(file.file)
|
|
17
|
+
: undefined);
|
|
18
|
+
if (!url) {
|
|
19
|
+
return (<div className={clsx("p-4 text-red-500", className)}>
|
|
20
|
+
Error: No URL or file provided for preview.
|
|
21
|
+
</div>);
|
|
22
|
+
}
|
|
15
23
|
const isVideo = file.type?.startsWith("video") || checkIsVideo(url);
|
|
16
24
|
const isImage = file.type?.startsWith("image") || checkIsImage(url);
|
|
17
25
|
if (display === "preview" && !isVideo && !isImage) {
|
|
@@ -52,3 +60,4 @@ export function PreviewFile({ file, readOnly, handleDeleteClick, downloadText, o
|
|
|
52
60
|
</Button>)}
|
|
53
61
|
</div>);
|
|
54
62
|
}
|
|
63
|
+
export default memo(PreviewFile, isEqual);
|
|
@@ -25,4 +25,4 @@ export interface MultiSelectProps<T extends object | string> extends Omit<Unstyl
|
|
|
25
25
|
itemsRenderLimit?: number;
|
|
26
26
|
valueProperty?: string | number;
|
|
27
27
|
}
|
|
28
|
-
export default function MultiSelect<T extends object | string>({ placeholder, emptyText, items, renderProperty, renderFunction, filterProperty, filterFunction, onChange, query: defaultQuery, onChangeQuery, loading, inputInnerClassName, inputElementClassName, as, trailing, trailingClassName, trailingInputClassName, leadingInputClassName, static: isStatic, displayValue, value, labelClassName, creatable, getCreateLabel, itemsRenderLimit, className, valueProperty, label, required, readOnly, ...props }: MultiSelectProps<T>): import("react").JSX.Element;
|
|
28
|
+
export default function MultiSelect<T extends object | string>({ placeholder, emptyText, items, renderProperty, renderFunction, filterProperty, filterFunction, onChange, query: defaultQuery, onChangeQuery, loading, inputInnerClassName, inputElementClassName, as, trailing, trailingClassName, trailingInputClassName, leadingInputClassName, static: isStatic, displayValue, value, labelClassName, creatable, getCreateLabel, itemsRenderLimit, className, valueProperty, label, required, readOnly, error, ...props }: MultiSelectProps<T>): import("react").JSX.Element;
|
|
@@ -1,34 +1,16 @@
|
|
|
1
1
|
import { Combobox } from "@headlessui/react";
|
|
2
2
|
import Loading from "../Loading";
|
|
3
|
-
import { useCallback, useEffect, useMemo,
|
|
4
|
-
import { defaultInputClassName, defaultLabelClassName, defaultLeadingInputClassName, defaultTrailingClassName, defaultTrailingInputClassName, UnstyledInput, } from "../Input";
|
|
3
|
+
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
4
|
+
import { defaultHelpTextClassName, defaultInputClassName, defaultLabelClassName, defaultLeadingInputClassName, defaultTrailingClassName, defaultTrailingInputClassName, UnstyledInput, } from "../Input";
|
|
5
5
|
import clsx from "../../utils/clsx";
|
|
6
6
|
import { isEqual, take } from "lodash-es";
|
|
7
7
|
import { CheckIcon, ChevronUpDownIcon } from "@heroicons/react/20/solid";
|
|
8
|
-
import Badge from "../Badge";
|
|
9
8
|
import { useDeepCompareEffect } from "react-use";
|
|
9
|
+
import { getValue, MultiSelectInput } from "./MultiSelectInput";
|
|
10
10
|
const defaultMenuItemsClassName = "z-10 rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-hidden dark:bg-zinc-800";
|
|
11
|
-
function getValue(id, item) {
|
|
12
|
-
return typeof item === "string"
|
|
13
|
-
? item
|
|
14
|
-
: item[id];
|
|
15
|
-
}
|
|
16
|
-
function MultiSelectInput({ className, selectedItems, doRender, removeItem, valueProperty, readOnly, ...props }) {
|
|
17
|
-
const ref = useRef(null);
|
|
18
|
-
return (<div className={clsx("flex flex-wrap border focus-within:border-primary-500 focus-within:ring-1 focus-within:ring-primary-500 dark:focus-within:border-primary-500", className)} onClick={() => ref.current?.focus()}>
|
|
19
|
-
{!!selectedItems.length && (<div className="flex flex-wrap items-center gap-1 p-1.5 pb-0">
|
|
20
|
-
{selectedItems.map((item) => (<Badge key={getValue(valueProperty, item)} onActionClick={!readOnly ? removeItem(item) : undefined}>
|
|
21
|
-
{doRender(item)}
|
|
22
|
-
</Badge>))}
|
|
23
|
-
</div>)}
|
|
24
|
-
{!readOnly && (<Combobox.Input
|
|
25
|
-
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
26
|
-
{...props} ref={ref} className="rounded-md border-none ring-transparent! disabled:cursor-not-allowed disabled:text-zinc-500 dark:bg-zinc-800 dark:disabled:bg-zinc-900/90 sm:text-sm" readOnly={readOnly}/>)}
|
|
27
|
-
</div>);
|
|
28
|
-
}
|
|
29
11
|
export default function MultiSelect({ placeholder, emptyText = "No item found.", items = [], renderProperty = "title", renderFunction, filterProperty = "title", filterFunction, onChange, query: defaultQuery = "", onChangeQuery, loading, inputInnerClassName, inputElementClassName, as, trailing, trailingClassName, trailingInputClassName, leadingInputClassName, static: isStatic,
|
|
30
12
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
31
|
-
displayValue = (item) => item?.[renderProperty] || "", value, labelClassName, creatable, getCreateLabel = (query) => `+ create "${query}"`, itemsRenderLimit, className, valueProperty = "_id", label, required, readOnly, ...props }) {
|
|
13
|
+
displayValue = (item) => item?.[renderProperty] || "", value, labelClassName, creatable, getCreateLabel = (query) => `+ create "${query}"`, itemsRenderLimit, className, valueProperty = "_id", label, required, readOnly, error, ...props }) {
|
|
32
14
|
const [query, setQuery] = useState(defaultQuery);
|
|
33
15
|
const [selectedItems, setSelectedItems] = useState(value || []);
|
|
34
16
|
// noinspection DuplicatedCode
|
|
@@ -53,8 +35,8 @@ displayValue = (item) => item?.[renderProperty] || "", value, labelClassName, cr
|
|
|
53
35
|
.toLowerCase()
|
|
54
36
|
.includes(query.toLowerCase()))), [filterFunction, filterProperty, items, query]);
|
|
55
37
|
trailing = loading ? (<Loading />) : (trailing ||
|
|
56
|
-
(!readOnly ? (<Combobox.Button className="pointer-events-auto -mr-1 flex items-center">
|
|
57
|
-
<ChevronUpDownIcon className="h-5 w-5 text-zinc-400" aria-hidden="true"/>
|
|
38
|
+
(!readOnly ? (<Combobox.Button className="pointer-events-auto -mr-1 flex items-center">
|
|
39
|
+
<ChevronUpDownIcon className="h-5 w-5 text-zinc-400" aria-hidden="true"/>
|
|
58
40
|
</Combobox.Button>) : undefined));
|
|
59
41
|
const ComponentInput = as || UnstyledInput;
|
|
60
42
|
const doRender = useCallback((item) => renderFunction
|
|
@@ -64,67 +46,71 @@ displayValue = (item) => item?.[renderProperty] || "", value, labelClassName, cr
|
|
|
64
46
|
: item[renderProperty], [renderFunction, renderProperty]);
|
|
65
47
|
useDeepCompareEffect(() => {
|
|
66
48
|
onChange?.(selectedItems);
|
|
67
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
68
49
|
}, [selectedItems || {}]);
|
|
69
50
|
useDeepCompareEffect(() => {
|
|
70
51
|
if (!isEqual(selectedItems, value)) {
|
|
71
52
|
setSelectedItems(value || []);
|
|
72
53
|
}
|
|
73
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
74
54
|
}, [value || {}]);
|
|
75
55
|
const removeItem = useCallback((item) => () => setSelectedItems((selectedItems) => [
|
|
76
56
|
...selectedItems.filter((i) => getValue(valueProperty, i) !== getValue(valueProperty, item)),
|
|
77
57
|
]), [valueProperty]);
|
|
78
58
|
if (label && required) {
|
|
79
|
-
label = (<>
|
|
80
|
-
{label} <span className="text-red-500">*</span>
|
|
59
|
+
label = (<>
|
|
60
|
+
{label} <span className="text-red-500">*</span>
|
|
81
61
|
</>);
|
|
82
62
|
}
|
|
83
63
|
const renderedItems = itemsRenderLimit
|
|
84
64
|
? take(filteredItems, itemsRenderLimit)
|
|
85
65
|
: filteredItems;
|
|
86
|
-
|
|
66
|
+
let inputClassName = clsx(defaultInputClassName, "bg-white dark:bg-zinc-800 pl-0", inputElementClassName, {
|
|
67
|
+
"border-dashed": readOnly,
|
|
68
|
+
});
|
|
69
|
+
let helpTextClassName = defaultHelpTextClassName;
|
|
70
|
+
if (error) {
|
|
71
|
+
inputClassName = clsx(inputClassName, "border-error-300 dark:border-error-500 text-error-900 dark:text-error-500 placeholder-error-300 focus:border-error-500 dark:focus:border-error-500 focus:ring-error-500");
|
|
72
|
+
helpTextClassName = clsx(helpTextClassName, "text-error-600 dark:text-error-500");
|
|
73
|
+
}
|
|
74
|
+
return (<div className={clsx("relative", className)}>
|
|
87
75
|
<Combobox
|
|
88
76
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
89
|
-
onChange={setSelectedItems} value={selectedItems} multiple>
|
|
90
|
-
{({ open }) => (<div>
|
|
77
|
+
onChange={setSelectedItems} value={selectedItems} multiple>
|
|
78
|
+
{({ open }) => (<div>
|
|
91
79
|
<ComponentInput
|
|
92
80
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
93
|
-
{...props} as={MultiSelectInput} placeholder={!readOnly ? placeholder : undefined} value={query} onChange={(event) => setQuery(event.target.value)} trailing={trailing} trailingClassName={clsx(defaultTrailingClassName, trailingClassName)} inputClassName={clsx(
|
|
94
|
-
|
|
95
|
-
})} innerClassName={inputInnerClassName} trailingInputClassName={clsx(defaultTrailingInputClassName, trailingInputClassName)} leadingInputClassName={clsx(defaultLeadingInputClassName, leadingInputClassName)} displayValue={displayValue} labelClassName={clsx(defaultLabelClassName, labelClassName)} selectedItems={selectedItems} doRender={doRender} removeItem={removeItem} required={required && !selectedItems.length} label={label} readOnly={readOnly} valueProperty={valueProperty}/>
|
|
96
|
-
|
|
81
|
+
{...props} as={MultiSelectInput} placeholder={!readOnly ? placeholder : undefined} value={query} onChange={(event) => setQuery(event.target.value)} trailing={trailing} trailingClassName={clsx(defaultTrailingClassName, trailingClassName)} inputClassName={inputClassName} innerClassName={inputInnerClassName} trailingInputClassName={clsx(defaultTrailingInputClassName, trailingInputClassName)} leadingInputClassName={clsx(defaultLeadingInputClassName, leadingInputClassName)} displayValue={displayValue} labelClassName={clsx(defaultLabelClassName, labelClassName)} selectedItems={selectedItems} doRender={doRender} removeItem={removeItem} required={required && !selectedItems.length} label={label} readOnly={readOnly} valueProperty={valueProperty} helpTextClassName={helpTextClassName}/>
|
|
82
|
+
|
|
97
83
|
{!readOnly &&
|
|
98
|
-
((creatable && query) || filteredItems.length > 0) && (<Combobox.Options static={isStatic} className={clsx(defaultMenuItemsClassName, "absolute z-10 mt-1 max-h-72 w-full scroll-py-2 overflow-y-auto py-2 text-sm text-zinc-800 dark:text-zinc-200")}>
|
|
84
|
+
((creatable && query) || filteredItems.length > 0) && (<Combobox.Options static={isStatic} className={clsx(defaultMenuItemsClassName, "absolute z-10 mt-1 max-h-72 w-full scroll-py-2 overflow-y-auto py-2 text-sm text-zinc-800 dark:text-zinc-200")}>
|
|
99
85
|
{!renderedItems.some((item) => getValue(valueProperty, item) === query) &&
|
|
100
86
|
creatable &&
|
|
101
|
-
!!query && (<Combobox.Option value={query} className={({ active }) => clsx("cursor-default
|
|
87
|
+
!!query && (<Combobox.Option value={query} className={({ active }) => clsx("cursor-default px-4 py-2 select-none", {
|
|
102
88
|
"bg-primary-600 text-white": active,
|
|
103
|
-
})}>
|
|
104
|
-
{({ selected }) => (<div className="flex">
|
|
105
|
-
{selected && <CheckIcon className="mr-2 w-5"/>}
|
|
106
|
-
{selected ? query : getCreateLabel(query)}
|
|
107
|
-
</div>)}
|
|
108
|
-
</Combobox.Option>)}
|
|
109
|
-
{renderedItems.map((item) => (<Combobox.Option key={getValue(valueProperty, item)} value={item} className={({ active }) => clsx("cursor-default
|
|
89
|
+
})}>
|
|
90
|
+
{({ selected }) => (<div className="flex">
|
|
91
|
+
{selected && <CheckIcon className="mr-2 w-5"/>}
|
|
92
|
+
{selected ? query : getCreateLabel(query)}
|
|
93
|
+
</div>)}
|
|
94
|
+
</Combobox.Option>)}
|
|
95
|
+
{renderedItems.map((item) => (<Combobox.Option key={getValue(valueProperty, item)} value={item} className={({ active }) => clsx("cursor-default px-4 py-2 select-none", {
|
|
110
96
|
"bg-primary-600 text-white": active,
|
|
111
|
-
})}>
|
|
112
|
-
{({ selected }) => (<div className="flex">
|
|
113
|
-
{selected && <CheckIcon className="mr-2 w-5"/>}
|
|
114
|
-
{doRender(item)}
|
|
115
|
-
</div>)}
|
|
116
|
-
</Combobox.Option>))}
|
|
117
|
-
</Combobox.Options>)}
|
|
118
|
-
|
|
97
|
+
})}>
|
|
98
|
+
{({ selected }) => (<div className="flex">
|
|
99
|
+
{selected && <CheckIcon className="mr-2 w-5"/>}
|
|
100
|
+
{doRender(item)}
|
|
101
|
+
</div>)}
|
|
102
|
+
</Combobox.Option>))}
|
|
103
|
+
</Combobox.Options>)}
|
|
104
|
+
|
|
119
105
|
{!readOnly &&
|
|
120
106
|
!creatable &&
|
|
121
107
|
open &&
|
|
122
108
|
emptyText &&
|
|
123
109
|
query !== "" &&
|
|
124
|
-
filteredItems.length === 0 && (<p className={clsx(defaultMenuItemsClassName, "absolute mt-1 w-full p-4 text-sm text-zinc-500 dark:text-zinc-400")}>
|
|
125
|
-
{emptyText}
|
|
126
|
-
</p>)}
|
|
127
|
-
</div>)}
|
|
128
|
-
</Combobox>
|
|
110
|
+
filteredItems.length === 0 && (<p className={clsx(defaultMenuItemsClassName, "absolute mt-1 w-full p-4 text-sm text-zinc-500 dark:text-zinc-400")}>
|
|
111
|
+
{emptyText}
|
|
112
|
+
</p>)}
|
|
113
|
+
</div>)}
|
|
114
|
+
</Combobox>
|
|
129
115
|
</div>);
|
|
130
116
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
export declare function getValue<Id extends string | number, T extends object | string>(id: Id, item: T): string | number;
|
|
3
|
+
export declare function MultiSelectInput<Id extends string | number, T extends object | string>({ className, selectedItems, doRender, removeItem, valueProperty, readOnly, ...props }: {
|
|
4
|
+
className?: string;
|
|
5
|
+
selectedItems: T[];
|
|
6
|
+
doRender: (item: T) => ReactNode;
|
|
7
|
+
removeItem: (item: T) => () => void;
|
|
8
|
+
valueProperty: Id;
|
|
9
|
+
readOnly?: boolean;
|
|
10
|
+
error?: boolean;
|
|
11
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { useRef } from "react";
|
|
2
|
+
import clsx from "../../utils/clsx";
|
|
3
|
+
import Badge from "../Badge";
|
|
4
|
+
import { Combobox } from "@headlessui/react";
|
|
5
|
+
export function getValue(id, item) {
|
|
6
|
+
return typeof item === "string"
|
|
7
|
+
? item
|
|
8
|
+
: item[id];
|
|
9
|
+
}
|
|
10
|
+
export function MultiSelectInput({ className, selectedItems, doRender, removeItem, valueProperty, readOnly, ...props }) {
|
|
11
|
+
const ref = useRef(null);
|
|
12
|
+
return (<div className={clsx("focus-within:border-primary-500 focus-within:ring-primary-500 dark:focus-within:border-primary-500 flex flex-wrap border focus-within:ring-1", className)} onClick={() => ref.current?.focus()}>
|
|
13
|
+
{!!selectedItems.length && (<div className="flex flex-wrap items-center gap-1 p-1.5 pb-0">
|
|
14
|
+
{selectedItems.map((item) => (<Badge key={getValue(valueProperty, item)} onActionClick={!readOnly ? removeItem(item) : undefined}>
|
|
15
|
+
{doRender(item)}
|
|
16
|
+
</Badge>))}
|
|
17
|
+
</div>)}
|
|
18
|
+
{!readOnly && (<Combobox.Input
|
|
19
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
20
|
+
{...props} ref={ref} className="rounded-md border-none ring-transparent! disabled:cursor-not-allowed disabled:text-zinc-500 sm:text-sm dark:bg-zinc-800 dark:disabled:bg-zinc-900/90" readOnly={readOnly}/>)}
|
|
21
|
+
</div>);
|
|
22
|
+
}
|