@@ -68,7 +68,6 @@ import Data.Foldable as Data.Foldable
6868import Data.Fuzzy as Data.Fuzzy
6969import Data.Maybe (Maybe (..))
7070import Data.Maybe as Data.Maybe
71- import Data.Newtype as Data.Newtype
7271import Data.Rational ((%))
7372import Data.String as Data.String
7473import Data.Time.Duration as Data.Time.Duration
@@ -914,12 +913,13 @@ renderMultiInput input renderContainer st =
914913 ]
915914
916915renderSearchDropdown
917- :: ∀ action item m
916+ :: ∀ action f item m
918917 . Eq item
918+ => Data.Foldable.Foldable f
919919 => String
920920 -> Halogen.HTML.PlainHTML
921921 -> (Data.Fuzzy.Fuzzy item -> Halogen.HTML.PlainHTML )
922- -> CompositeComponentRender action Maybe item m
922+ -> CompositeComponentRender action f item m
923923renderSearchDropdown resetLabel label renderFuzzy st =
924924 Halogen.HTML .label
925925 [ Ocelot.HTML.Properties .css " relative" ]
@@ -934,12 +934,14 @@ renderSearchDropdown resetLabel label renderFuzzy st =
934934 [ Ocelot.Block.ItemContainer .dropdownContainer
935935 [ renderInput, renderReset ]
936936 renderFuzzy
937- ((==) st.selected <<< Just <<< _.original <<< Data.Newtype .unwrap)
937+ isSelected
938938 st.fuzzyItems
939939 st.highlightedIndex
940940 ]
941941 ]
942942 where
943+ isSelected :: Data.Fuzzy.Fuzzy item -> Boolean
944+ isSelected (Data.Fuzzy.Fuzzy { original }) = Data.Foldable .elem original st.selected
943945 renderInput =
944946 Halogen.HTML .div
945947 [ Ocelot.HTML.Properties .css " m-4 border-b-2 border-blue-88 pb-2 flex" ]
@@ -954,7 +956,7 @@ renderSearchDropdown resetLabel label renderFuzzy st =
954956 [ Halogen.HTML.Events .onClick \_ -> Select.Action $ RemoveAll
955957 ]
956958 [ Halogen.HTML .text resetLabel ]
957- ( Data.Maybe .isNothing st.selected )
959+ ( Data.Foldable .null st.selected )
958960 false
959961
960962renderSingle
@@ -1013,14 +1015,14 @@ renderSingle iprops renderItem renderContainer st =
10131015 showSelected = Data.Maybe .isJust st.selected && st.visibility == Select.Off
10141016
10151017renderToolbarSearchDropdown
1016- :: ∀ action item m
1018+ :: ∀ action f item m
10171019 . Eq item
1020+ => Data.Foldable.Foldable f
10181021 => String
1019- -> String
1020- -> (item -> Halogen.HTML.PlainHTML )
1022+ -> (f item -> Halogen.HTML.PlainHTML )
10211023 -> (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 =
10241026 renderSearchDropdown resetLabel label renderFuzzy st
10251027 where
10261028 label = Ocelot.Block.ItemContainer .dropdownButton
@@ -1030,7 +1032,7 @@ renderToolbarSearchDropdown defaultLabel resetLabel renderItem renderFuzzy st =
10301032 : Ocelot.Block.Button .buttonMainClasses
10311033 <> Ocelot.Block.Button .buttonClearClasses
10321034 ]
1033- [ Data.Maybe .maybe (Halogen.HTML .text defaultLabel) ( Halogen.HTML . fromPlainHTML <<< renderItem ) st.selected ]
1035+ [ (Halogen.HTML .fromPlainHTML <<< renderText ) st.selected ]
10341036
10351037replaceSelected
10361038 :: forall action f item m
0 commit comments