File tree Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import DOM.HTML.Indexed.ButtonType (ButtonType)
44import DOM.HTML.Indexed.CrossOriginValue (CrossOriginValue )
55import DOM.HTML.Indexed.DirValue (DirValue )
66import DOM.HTML.Indexed.FormMethod (FormMethod )
7+ import DOM.HTML.Indexed.InputAcceptType (InputAcceptType )
78import DOM.HTML.Indexed.InputType (InputType )
89import DOM.HTML.Indexed.KindValue (KindValue )
910import DOM.HTML.Indexed.MenuType (MenuType )
@@ -338,7 +339,7 @@ type HTMLimg = Interactive
338339 )
339340
340341type HTMLinput = Interactive
341- ( accept :: MediaType
342+ ( accept :: InputAcceptType
342343 , autocomplete :: OnOff
343344 , autofocus :: Boolean
344345 , checked :: Boolean
Original file line number Diff line number Diff line change 1+ module DOM.HTML.Indexed.InputAcceptType where
2+
3+ import Prelude
4+
5+ import Data.MediaType (MediaType (..))
6+ import Data.String as String
7+
8+ newtype InputAcceptType = InputAcceptType (Array InputAcceptTypeAtom )
9+
10+ instance semigroupInputAcceptType :: Semigroup InputAcceptType where
11+ append (InputAcceptType a) (InputAcceptType b) = InputAcceptType (a <> b)
12+
13+ mediaType :: MediaType -> InputAcceptType
14+ mediaType mt = InputAcceptType [AcceptMediaType mt]
15+
16+ extension :: String -> InputAcceptType
17+ extension ext = InputAcceptType [AcceptFileExtension ext]
18+
19+ data InputAcceptTypeAtom
20+ = AcceptMediaType MediaType
21+ | AcceptFileExtension String
22+
23+ renderInputAcceptType :: InputAcceptType -> String
24+ renderInputAcceptType (InputAcceptType atoms) =
25+ String .joinWith " ," (map renderInputAcceptTypeAtom atoms)
26+
27+ renderInputAcceptTypeAtom :: InputAcceptTypeAtom -> String
28+ renderInputAcceptTypeAtom = case _ of
29+ AcceptMediaType (MediaType mt) -> mt
30+ AcceptFileExtension ext -> ext
You can’t perform that action at this time.
0 commit comments