+ {switch searchable {
+ | Some(val) =>
+ if val {
+ searchInputUI
+ } else {
+ React.null
+ }
+ | None =>
+ if isDropDown && options->Array.length > 5 {
+ searchInputUI
+ } else {
+ React.null
+ }
+ }}
+ {if showSelectAll && isDropDown {
+ if !isMobileView {
+ let clearAllCondition = noOfSelected > 0
+
Array.length > 1 &&
+ filteredOptions->Array.find(item => item.value === "Loading...")->Option.isNone}>
+
+
+ {{clearAllCondition ? "Clear All" : "Select All"}->React.string}
+
+
+ } else {
+
Array.length)}
+ className={`flex ${isHorizontal
+ ? "flex-col"
+ : "flex-row"} justify-between pr-4 pl-5 pt-6 pb-1 text-base font-semibold ${font.textColor.primaryNormal} cursor-pointer`}>
+ {"SELECT ALL"->React.string}
+ Array.length} />
+
+ }
+ } else {
+ React.null
+ }}
+ {if showToggle {
+
+
+
+ {React.string(heading)}
+
+ {if showSelectAll {
+
+ {switch allSelectType {
+ | Icon =>
+
+ | Text =>
+
+ {
+ toggleSelectAll(!isChooseAllToggleSelected)
+ }}>
+ {if isChooseAllToggleSelected {
+ "Deselect All"->React.string
+ } else {
+ "Select All"->React.string
+ }}
+
+
+ }}
+
+ } else {
+ React.null
+ }}
+
+ {if !hideBorder {
+
+ } else {
+ React.null
+ }}
+
+ } else {
+ React.null
+ }}
+
LogicUtils.isEmptyString ? "" : " flex flex-wrap justify-between"
+ }}>
+ {if filteredOptions->Array.length === 0 {
+
+ {React.string("No matching records found")}
+
+ } else if filteredOptions->Array.find(item => item.value === "Loading...")->Option.isSome {
+
+ } else {
+ {
+ filteredOptions
+ ->Array.mapWithIndex((item, indx) => {
+ let valueToConsider = item.value
+ let index = Array.findIndex(saneValue, sv => sv === valueToConsider)
+ let isPrevSelected = switch filteredOptions->Array.get(indx - 1) {
+ | Some(prevItem) => Array.findIndex(saneValue, sv => sv === prevItem.value) > -1
+ | None => false
+ }
+ let isNextSelected = switch filteredOptions->Array.get(indx + 1) {
+ | Some(nextItem) => Array.findIndex(saneValue, sv => sv === nextItem.value) > -1
+ | None => false
+ }
+ let isSelected = index > -1
+ let serialNumber =
+ isSelected && showSerialNumber ? Some(Int.toString(index + 1)) : None
+ let leftVacennt = isDropDown && textIconPresent && item.icon === NoIcon
+
+
+ {switch optionRigthElement {
+ | Some(rightElement) => rightElement
+ | None => React.null
+ }}
+
+ })
+ ->React.array
+ }
+ }}
+
+
+
+
+ }
+}
+
+module BaseSelectButton = {
+ @react.component
+ let make = (
+ ~showDropDown=false,
+ ~isDropDown=true,
+ ~isHorizontal=false,
+ ~options: array