cr-ui-lib 1.1.97 → 1.1.100
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.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +38 -58
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +38 -58
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -253,7 +253,7 @@ declare type SingleSelectDropdownProps = {
|
|
|
253
253
|
uniqueSearch?: boolean;
|
|
254
254
|
};
|
|
255
255
|
declare function SingleSelectDropdown({ label, value, onChange, options, placeholder, onScrollToEnd, onSearch, hasMore, isLoading, searchable, searchDebounceMs, requiresSearch, minSearchLength, emptyMessage, loadingMessage, searchPlaceholder, disabled, hasIcon, buttonClass, labelClass, displayItemClass, displayMainClass, hasSearchIcon, searchInputClass, placeholderSearchClass, usePortal, // default true
|
|
256
|
-
iconClass, placeholderClass, displayContainerClass, selectedColorDropdownItem, uniqueSearch }: SingleSelectDropdownProps): JSX.Element;
|
|
256
|
+
iconClass, placeholderClass, displayContainerClass, selectedColorDropdownItem, uniqueSearch, }: SingleSelectDropdownProps): JSX.Element;
|
|
257
257
|
|
|
258
258
|
interface SelectionButton {
|
|
259
259
|
data: string[];
|
package/dist/index.d.ts
CHANGED
|
@@ -253,7 +253,7 @@ declare type SingleSelectDropdownProps = {
|
|
|
253
253
|
uniqueSearch?: boolean;
|
|
254
254
|
};
|
|
255
255
|
declare function SingleSelectDropdown({ label, value, onChange, options, placeholder, onScrollToEnd, onSearch, hasMore, isLoading, searchable, searchDebounceMs, requiresSearch, minSearchLength, emptyMessage, loadingMessage, searchPlaceholder, disabled, hasIcon, buttonClass, labelClass, displayItemClass, displayMainClass, hasSearchIcon, searchInputClass, placeholderSearchClass, usePortal, // default true
|
|
256
|
-
iconClass, placeholderClass, displayContainerClass, selectedColorDropdownItem, uniqueSearch }: SingleSelectDropdownProps): JSX.Element;
|
|
256
|
+
iconClass, placeholderClass, displayContainerClass, selectedColorDropdownItem, uniqueSearch, }: SingleSelectDropdownProps): JSX.Element;
|
|
257
257
|
|
|
258
258
|
interface SelectionButton {
|
|
259
259
|
data: string[];
|
package/dist/index.js
CHANGED
|
@@ -3614,6 +3614,11 @@ function SingleSelectDropdown({
|
|
|
3614
3614
|
setIsOpen(!isOpen);
|
|
3615
3615
|
}
|
|
3616
3616
|
};
|
|
3617
|
+
const openList = () => {
|
|
3618
|
+
if (!disabled) {
|
|
3619
|
+
setIsOpen(true);
|
|
3620
|
+
}
|
|
3621
|
+
};
|
|
3617
3622
|
const DropdownMenu = /* @__PURE__ */ jsxRuntime.jsx(
|
|
3618
3623
|
"div",
|
|
3619
3624
|
{
|
|
@@ -3643,71 +3648,19 @@ function SingleSelectDropdown({
|
|
|
3643
3648
|
),
|
|
3644
3649
|
children: [
|
|
3645
3650
|
searchable && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
|
|
3646
|
-
|
|
3647
|
-
"div",
|
|
3648
|
-
{
|
|
3649
|
-
onClick: handleToggle,
|
|
3650
|
-
className: tailwindMerge.twMerge(
|
|
3651
|
-
`border-[1.5px] rounded-md h-[40px] pl-3 pr-2 py-2 bg-[#F8F8F8] cursor-pointer flex items-center justify-between ${disabled ? "bg-gray-100 cursor-not-allowed border-gray-200" : isOpen ? "border-[#4683B4]" : "border-[#E2E2E2]"}`,
|
|
3652
|
-
buttonClass
|
|
3653
|
-
),
|
|
3654
|
-
children: [
|
|
3655
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3656
|
-
"span",
|
|
3657
|
-
{
|
|
3658
|
-
className: `text-sm ${disabled ? "text-gray-400" : selectedOption ? "text-gray-700" : "text-gray-[#757575]"} ${placeholderClass}`,
|
|
3659
|
-
children: (selectedOption == null ? void 0 : selectedOption.name) || placeholder
|
|
3660
|
-
}
|
|
3661
|
-
),
|
|
3662
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3663
|
-
"div",
|
|
3664
|
-
{
|
|
3665
|
-
className: `transition-transform duration-200 ${!isOpen ? "rotate-180" : ""} ${disabled ? "text-gray-400" : ""} ${hasIcon ? "block" : "hidden"} ${iconClass}`,
|
|
3666
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3667
|
-
"svg",
|
|
3668
|
-
{
|
|
3669
|
-
width: "20",
|
|
3670
|
-
height: "20",
|
|
3671
|
-
viewBox: "0 0 20 20",
|
|
3672
|
-
fill: "none",
|
|
3673
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
3674
|
-
children: [
|
|
3675
|
-
/* @__PURE__ */ jsxRuntime.jsx("g", { clipPath: "url(#clip0_10508_5931)", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3676
|
-
"path",
|
|
3677
|
-
{
|
|
3678
|
-
d: "M5.83333 11.6665L10 7.49984L14.1667 11.6665H5.83333Z",
|
|
3679
|
-
fill: "currentColor"
|
|
3680
|
-
}
|
|
3681
|
-
) }),
|
|
3682
|
-
/* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip0_10508_5931", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3683
|
-
"rect",
|
|
3684
|
-
{
|
|
3685
|
-
width: "20",
|
|
3686
|
-
height: "20",
|
|
3687
|
-
fill: "white",
|
|
3688
|
-
transform: "matrix(1 0 0 -1 0 20)"
|
|
3689
|
-
}
|
|
3690
|
-
) }) })
|
|
3691
|
-
]
|
|
3692
|
-
}
|
|
3693
|
-
)
|
|
3694
|
-
}
|
|
3695
|
-
)
|
|
3696
|
-
]
|
|
3697
|
-
}
|
|
3698
|
-
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
3651
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3699
3652
|
"input",
|
|
3700
3653
|
{
|
|
3701
3654
|
type: "text",
|
|
3702
|
-
onClick: handleToggle,
|
|
3703
3655
|
autoFocus: true,
|
|
3704
3656
|
className: tailwindMerge.twMerge(
|
|
3705
3657
|
"input-placeholder-ellipsis w-full pr-[30px] h-[40px] px-2 py-1 rounded-md border border-gray-300 text-sm focus:border-1 focus:border-[#4683B4] focus:outline-none",
|
|
3706
3658
|
searchInputClass
|
|
3707
3659
|
),
|
|
3708
3660
|
value: searchTerm,
|
|
3709
|
-
|
|
3710
|
-
|
|
3661
|
+
onChange: (e) => {
|
|
3662
|
+
handleSearchChange(e.target.value);
|
|
3663
|
+
}
|
|
3711
3664
|
}
|
|
3712
3665
|
),
|
|
3713
3666
|
!searchTerm && /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3747,6 +3700,15 @@ function SingleSelectDropdown({
|
|
|
3747
3700
|
}
|
|
3748
3701
|
)
|
|
3749
3702
|
] }),
|
|
3703
|
+
uniqueSearch && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3704
|
+
"div",
|
|
3705
|
+
{
|
|
3706
|
+
className: tailwindMerge.twMerge(
|
|
3707
|
+
"absolute right-2 top-1/2 transform -translate-y-1/2 pointer-events-none",
|
|
3708
|
+
hasSearchIcon ? "block" : "hidden"
|
|
3709
|
+
)
|
|
3710
|
+
}
|
|
3711
|
+
) }),
|
|
3750
3712
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3751
3713
|
"div",
|
|
3752
3714
|
{
|
|
@@ -3763,12 +3725,15 @@ function SingleSelectDropdown({
|
|
|
3763
3725
|
"div",
|
|
3764
3726
|
{
|
|
3765
3727
|
className: tailwindMerge.twMerge(
|
|
3766
|
-
`h-[40px] px-2 py-2 my-1 text-sm cursor-pointer select-none rounded-md hover:bg-gray-100 ${opt.id === value ? "bg-[#ECF3F7] font-semibold
|
|
3728
|
+
`h-[40px] px-2 py-2 my-1 text-sm cursor-pointer select-none rounded-md hover:bg-gray-100 ${opt.id === value ? "bg-[#ECF3F7] font-semibold" + selectedColorDropdownItem : "text-[#131414]"}`,
|
|
3767
3729
|
displayItemClass
|
|
3768
3730
|
),
|
|
3769
3731
|
onClick: () => {
|
|
3770
3732
|
onChange(opt.id);
|
|
3771
3733
|
setIsOpen(false);
|
|
3734
|
+
if (uniqueSearch) {
|
|
3735
|
+
setSearchTerm("");
|
|
3736
|
+
}
|
|
3772
3737
|
},
|
|
3773
3738
|
children: opt.name
|
|
3774
3739
|
},
|
|
@@ -3799,7 +3764,7 @@ function SingleSelectDropdown({
|
|
|
3799
3764
|
}
|
|
3800
3765
|
),
|
|
3801
3766
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { ref: dropdownRef, className: "relative", children: [
|
|
3802
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3767
|
+
!uniqueSearch ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3803
3768
|
"div",
|
|
3804
3769
|
{
|
|
3805
3770
|
onClick: handleToggle,
|
|
@@ -3851,6 +3816,21 @@ function SingleSelectDropdown({
|
|
|
3851
3816
|
)
|
|
3852
3817
|
]
|
|
3853
3818
|
}
|
|
3819
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
3820
|
+
"input",
|
|
3821
|
+
{
|
|
3822
|
+
type: "text",
|
|
3823
|
+
autoFocus: true,
|
|
3824
|
+
onClick: openList,
|
|
3825
|
+
className: tailwindMerge.twMerge(
|
|
3826
|
+
"input-placeholder-ellipsis w-full pr-[30px] h-[48px] px-2 py-1 rounded-md border border-gray-300 text-sm focus:border-1 focus:border-[#4683B4] focus:outline-none",
|
|
3827
|
+
searchInputClass,
|
|
3828
|
+
uniqueSearch && "placeholder:opacity-100 placeholder:text-[#131414]"
|
|
3829
|
+
),
|
|
3830
|
+
value: searchTerm,
|
|
3831
|
+
placeholder: (selectedOption == null ? void 0 : selectedOption.name) || placeholder,
|
|
3832
|
+
onChange: (e) => handleSearchChange(e.target.value)
|
|
3833
|
+
}
|
|
3854
3834
|
),
|
|
3855
3835
|
isOpen && !disabled && (usePortal ? reactDom.createPortal(DropdownMenu, document.body) : DropdownMenu)
|
|
3856
3836
|
] })
|