hi-tm 0.9.8 → 0.9.9
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.
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { SelectOption, CreatableSelectProps } from "../../types/DropDown/CreatableDropDown";
|
|
3
|
-
export default function CreatableSelect<T = SelectOption>({ options, value, onChange, onClick, onValueChange, onCreateOption, placeholder, isLoading, isDisabled, isCreatable, isMultiSelect, noOptionsMessage, noResultsFound, loadingMessage, createOptionMessage, className, tailwindStyle, iconSrc, fetchOptions, label, onAddClick, getOptionLabel, getOptionValue, }: CreatableSelectProps<T>): React.JSX.Element;
|
|
3
|
+
export default function CreatableSelect<T = SelectOption>({ options, value, onChange, onClick, onValueChange, onCreateOption, placeholder, isLoading, isDisabled, isCreatable, isMultiSelect, noOptionsMessage, noResultsFound, loadingMessage, createOptionMessage, className, tailwindStyle, iconSrc, fetchOptions, label, onAddClick, getOptionLabel, getOptionValue, onFocusShowAllData, }: CreatableSelectProps<T>): React.JSX.Element;
|
|
@@ -89,7 +89,7 @@ const renderNoResults = (noResults, className, searchIcon) => {
|
|
|
89
89
|
return noResults;
|
|
90
90
|
}
|
|
91
91
|
};
|
|
92
|
-
function CreatableSelect({ options = [], value, onChange, onClick, onValueChange, onCreateOption, placeholder = "جستوجو", isLoading = false, isDisabled = false, isCreatable = true, isMultiSelect = false, noOptionsMessage = "مقدار پیشفرضی وجود ندارد", noResultsFound, loadingMessage = "در حال بارگذاری...", createOptionMessage = "ایجاد ", className = "", tailwindStyle = {}, iconSrc = {}, fetchOptions, label, onAddClick, getOptionLabel, getOptionValue, }) {
|
|
92
|
+
function CreatableSelect({ options = [], value, onChange, onClick, onValueChange, onCreateOption, placeholder = "جستوجو", isLoading = false, isDisabled = false, isCreatable = true, isMultiSelect = false, noOptionsMessage = "مقدار پیشفرضی وجود ندارد", noResultsFound, loadingMessage = "در حال بارگذاری...", createOptionMessage = "ایجاد ", className = "", tailwindStyle = {}, iconSrc = {}, fetchOptions, label, onAddClick, getOptionLabel, getOptionValue, onFocusShowAllData, }) {
|
|
93
93
|
// Default icons
|
|
94
94
|
const defaultIcons = {
|
|
95
95
|
dropdownOpen: "▼",
|
|
@@ -389,7 +389,9 @@ function CreatableSelect({ options = [], value, onChange, onClick, onValueChange
|
|
|
389
389
|
selectedValues.map((val) => (react_1.default.createElement("div", { key: deriveValue(val), className: "flex-shrink-0 flex items-center bg-gray-200 rounded-md px-2 py-1" },
|
|
390
390
|
react_1.default.createElement("span", { className: "truncate" }, deriveLabel(val)),
|
|
391
391
|
react_1.default.createElement("button", { type: "button", onClick: (e) => clearValue(e, val), className: styles.clearButton }, renderIcon(icons.clear, styles.icon))))),
|
|
392
|
-
react_1.default.createElement("input", { ref: inputRef, type: "text", className: `${styles.input} ${isDisabled ? "bg-gray-100" : ""} min-w-[80px] flex-shrink-0`, placeholder: selectedValues.length > 0 ? "" : placeholder, value: inputValue, onChange: handleInputChange, disabled: isDisabled, onClick: (e) => e.stopPropagation()
|
|
392
|
+
react_1.default.createElement("input", { ref: inputRef, type: "text", className: `${styles.input} ${isDisabled ? "bg-gray-100" : ""} min-w-[80px] flex-shrink-0`, placeholder: selectedValues.length > 0 ? "" : placeholder, value: inputValue, onChange: handleInputChange, disabled: isDisabled, onClick: (e) => e.stopPropagation(), onFocus: () => {
|
|
393
|
+
console.log("focus");
|
|
394
|
+
} }))),
|
|
393
395
|
react_1.default.createElement("div", { className: "flex-shrink-0 flex items-center gap-1 ml-2" },
|
|
394
396
|
iconSrc.hasAdd && (react_1.default.createElement("button", { type: "button", onClick: handleAddIconClick, className: styles.clearButton }, renderIcon(iconSrc.hasAdd, styles.icon))),
|
|
395
397
|
styles.separator && react_1.default.createElement("div", { className: styles.separator }),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode } from
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
2
|
export type IconType = ReactNode | string | {
|
|
3
3
|
src: string;
|
|
4
4
|
alt?: string;
|
|
@@ -71,4 +71,5 @@ export type CreatableSelectProps<T = SelectOption> = {
|
|
|
71
71
|
isMultiSelect?: boolean;
|
|
72
72
|
getOptionLabel?: OptionLabelGetter<T>;
|
|
73
73
|
getOptionValue?: OptionValueGetter<T>;
|
|
74
|
+
onFocusShowAllData?: boolean;
|
|
74
75
|
};
|