@@ -68,7 +68,6 @@ import Data.Foldable as Data.Foldable
68
68
import Data.Fuzzy as Data.Fuzzy
69
69
import Data.Maybe (Maybe (..))
70
70
import Data.Maybe as Data.Maybe
71
- import Data.Newtype as Data.Newtype
72
71
import Data.Rational ((%))
73
72
import Data.String as Data.String
74
73
import Data.Time.Duration as Data.Time.Duration
@@ -914,12 +913,13 @@ renderMultiInput input renderContainer st =
914
913
]
915
914
916
915
renderSearchDropdown
917
- :: ∀ action item m
916
+ :: ∀ action f item m
918
917
. Eq item
918
+ => Data.Foldable.Foldable f
919
919
=> String
920
920
-> Halogen.HTML.PlainHTML
921
921
-> (Data.Fuzzy.Fuzzy item -> Halogen.HTML.PlainHTML )
922
- -> CompositeComponentRender action Maybe item m
922
+ -> CompositeComponentRender action f item m
923
923
renderSearchDropdown resetLabel label renderFuzzy st =
924
924
Halogen.HTML .label
925
925
[ Ocelot.HTML.Properties .css " relative" ]
@@ -934,12 +934,14 @@ renderSearchDropdown resetLabel label renderFuzzy st =
934
934
[ Ocelot.Block.ItemContainer .dropdownContainer
935
935
[ renderInput, renderReset ]
936
936
renderFuzzy
937
- ((==) st.selected <<< Just <<< _.original <<< Data.Newtype .unwrap)
937
+ isSelected
938
938
st.fuzzyItems
939
939
st.highlightedIndex
940
940
]
941
941
]
942
942
where
943
+ isSelected :: Data.Fuzzy.Fuzzy item -> Boolean
944
+ isSelected (Data.Fuzzy.Fuzzy { original }) = Data.Foldable .elem original st.selected
943
945
renderInput =
944
946
Halogen.HTML .div
945
947
[ Ocelot.HTML.Properties .css " m-4 border-b-2 border-blue-88 pb-2 flex" ]
@@ -954,7 +956,7 @@ renderSearchDropdown resetLabel label renderFuzzy st =
954
956
[ Halogen.HTML.Events .onClick \_ -> Select.Action $ RemoveAll
955
957
]
956
958
[ Halogen.HTML .text resetLabel ]
957
- ( Data.Maybe .isNothing st.selected )
959
+ ( Data.Foldable .null st.selected )
958
960
false
959
961
960
962
renderSingle
@@ -1013,14 +1015,14 @@ renderSingle iprops renderItem renderContainer st =
1013
1015
showSelected = Data.Maybe .isJust st.selected && st.visibility == Select.Off
1014
1016
1015
1017
renderToolbarSearchDropdown
1016
- :: ∀ action item m
1018
+ :: ∀ action f item m
1017
1019
. Eq item
1020
+ => Data.Foldable.Foldable f
1018
1021
=> String
1019
- -> String
1020
- -> (item -> Halogen.HTML.PlainHTML )
1022
+ -> (f item -> Halogen.HTML.PlainHTML )
1021
1023
-> (Data.Fuzzy.Fuzzy item -> Halogen.HTML.PlainHTML )
1022
- -> CompositeComponentRender action Maybe item m
1023
- renderToolbarSearchDropdown defaultLabel resetLabel renderItem renderFuzzy st =
1024
+ -> CompositeComponentRender action f item m
1025
+ renderToolbarSearchDropdown resetLabel renderText renderFuzzy st =
1024
1026
renderSearchDropdown resetLabel label renderFuzzy st
1025
1027
where
1026
1028
label = Ocelot.Block.ItemContainer .dropdownButton
@@ -1030,7 +1032,7 @@ renderToolbarSearchDropdown defaultLabel resetLabel renderItem renderFuzzy st =
1030
1032
: Ocelot.Block.Button .buttonMainClasses
1031
1033
<> Ocelot.Block.Button .buttonClearClasses
1032
1034
]
1033
- [ Data.Maybe .maybe (Halogen.HTML .text defaultLabel) ( Halogen.HTML . fromPlainHTML <<< renderItem ) st.selected ]
1035
+ [ (Halogen.HTML .fromPlainHTML <<< renderText ) st.selected ]
1034
1036
1035
1037
replaceSelected
1036
1038
:: forall action f item m
0 commit comments