mirror of
https://github.com/Orasund/elm-ui-widgets.git
synced 2024-11-22 13:14:10 +03:00
Merge pull request #62 from Orasund/unstable
Streamline Pages in Explorer
This commit is contained in:
commit
f92c7e2d51
@ -1,12 +1,17 @@
|
|||||||
module Main exposing (main)
|
module Main exposing (main)
|
||||||
|
|
||||||
import Element
|
import Element
|
||||||
import Pages.Button
|
import Page.Button
|
||||||
|
import Page.PasswordInput
|
||||||
import UIExplorer
|
import UIExplorer
|
||||||
|
|
||||||
|
|
||||||
pages =
|
pages =
|
||||||
UIExplorer.firstPage "Button" Pages.Button.page
|
UIExplorer.firstPage "Button" Page.Button.page
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--|> UIExplorer.nextPage "Password Input" Page.PasswordInput.page
|
||||||
|
|
||||||
|
|
||||||
main =
|
main =
|
||||||
|
61
explorer/src/Page.elm
Normal file
61
explorer/src/Page.elm
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
module Page exposing (create, viewTile)
|
||||||
|
|
||||||
|
import Element exposing (Element)
|
||||||
|
import UIExplorer exposing (Page)
|
||||||
|
import UIExplorer.Story as Story exposing (StorySelectorModel, StorySelectorMsg)
|
||||||
|
import UIExplorer.Tile as Tile exposing (Group, Tile, TileMsg)
|
||||||
|
import Widget.Material as Material exposing (Palette)
|
||||||
|
import Widget.Material.Typography as Typography
|
||||||
|
|
||||||
|
|
||||||
|
{-| Creates a Page.
|
||||||
|
|
||||||
|
- `title` - Should match the name of the Page
|
||||||
|
- `description` - Should match the first paragraph of the documentation.
|
||||||
|
|
||||||
|
-}
|
||||||
|
create :
|
||||||
|
{ title : String
|
||||||
|
, description : String
|
||||||
|
, book : Group ( StorySelectorModel, () ) (TileMsg StorySelectorMsg ()) ()
|
||||||
|
, demo : Tile model msg ()
|
||||||
|
}
|
||||||
|
-> Page ( ( ( (), () ), ( StorySelectorModel, () ) ), model ) (TileMsg (TileMsg (TileMsg () msg1) (TileMsg StorySelectorMsg ())) msg) ()
|
||||||
|
create { title, description, book, demo } =
|
||||||
|
Tile.static []
|
||||||
|
(\_ _ ->
|
||||||
|
[ title |> Element.text |> Element.el Typography.h3
|
||||||
|
, description |> Element.text |> Element.el []
|
||||||
|
]
|
||||||
|
|> Element.column [ Element.spacing 32 ]
|
||||||
|
)
|
||||||
|
|> Tile.first
|
||||||
|
|> Tile.nextGroup book
|
||||||
|
|> Tile.next demo
|
||||||
|
|> Tile.page
|
||||||
|
|
||||||
|
|
||||||
|
viewTile :
|
||||||
|
String
|
||||||
|
-> Element msg
|
||||||
|
->
|
||||||
|
{ attributes : List (Element.Attribute msg)
|
||||||
|
, body : Element msg
|
||||||
|
, position : Tile.Position
|
||||||
|
, title : Maybe String
|
||||||
|
}
|
||||||
|
viewTile title content =
|
||||||
|
{ title = Nothing
|
||||||
|
, position = Tile.LeftColumnTile
|
||||||
|
, attributes = []
|
||||||
|
, body =
|
||||||
|
Element.column
|
||||||
|
[ Element.width Element.fill
|
||||||
|
, Element.spacing 8
|
||||||
|
]
|
||||||
|
[ title
|
||||||
|
|> Element.text
|
||||||
|
|> Element.el Typography.caption
|
||||||
|
, content
|
||||||
|
]
|
||||||
|
}
|
@ -1,14 +1,18 @@
|
|||||||
module Pages.Button exposing (page)
|
module Page.Button exposing (page)
|
||||||
|
|
||||||
|
{-| This is an example Page. If you want to add your own pages, simple copy and modify this one.
|
||||||
|
-}
|
||||||
|
|
||||||
import Element exposing (Element)
|
import Element exposing (Element)
|
||||||
import Element.Background as Background
|
import Element.Background as Background
|
||||||
import Element.Font
|
import Element.Font
|
||||||
import Material.Icons as MaterialIcons exposing (offline_bolt)
|
import Material.Icons as MaterialIcons exposing (offline_bolt)
|
||||||
import Material.Icons.Types exposing (Coloring(..))
|
import Material.Icons.Types exposing (Coloring(..))
|
||||||
|
import Page
|
||||||
import UIExplorer
|
import UIExplorer
|
||||||
import UIExplorer.Story as Story
|
import UIExplorer.Story as Story exposing (StorySelectorModel, StorySelectorMsg)
|
||||||
import UIExplorer.Tile as Tile
|
import UIExplorer.Tile as Tile exposing (Context, Position, Tile, TileMsg)
|
||||||
import Widget
|
import Widget exposing (ButtonStyle)
|
||||||
import Widget.Customize as Customize
|
import Widget.Customize as Customize
|
||||||
import Widget.Icon as Icon exposing (Icon)
|
import Widget.Icon as Icon exposing (Icon)
|
||||||
import Widget.Material as Material
|
import Widget.Material as Material
|
||||||
@ -24,46 +28,88 @@ import Widget.Material.Color as MaterialColor
|
|||||||
import Widget.Material.Typography as Typography
|
import Widget.Material.Typography as Typography
|
||||||
|
|
||||||
|
|
||||||
page =
|
{-| The title of this page
|
||||||
Tile.first (intro |> Tile.withTitle "Button")
|
-}
|
||||||
|> Tile.nextGroup book
|
title : String
|
||||||
|> Tile.next demo
|
title =
|
||||||
|> Tile.page
|
"Button"
|
||||||
|
|
||||||
|
|
||||||
intro =
|
{-| The description. I've taken this description directly from the [Material-UI-Specification](https://material.io/components/buttons)
|
||||||
Tile.markdown []
|
-}
|
||||||
""" A simple button """
|
description : String
|
||||||
|
description =
|
||||||
|
"Buttons allow users to take actions, and make choices, with a single tap."
|
||||||
|
|
||||||
|
|
||||||
|
{-| List of view functions. Essentially, anything that takes a Button as input.
|
||||||
|
-}
|
||||||
|
viewFunctions =
|
||||||
|
let
|
||||||
|
viewButton button text icon onPress { palette } () =
|
||||||
|
Widget.button (button palette)
|
||||||
|
{ text = text
|
||||||
|
, icon = icon
|
||||||
|
, onPress = onPress
|
||||||
|
}
|
||||||
|
--Don't forget to change the title
|
||||||
|
|> Page.viewTile "Widget.button"
|
||||||
|
|
||||||
|
viewTextButton button text icon onPress { palette } () =
|
||||||
|
Widget.textButton
|
||||||
|
(button palette
|
||||||
|
|> Customize.elementButton
|
||||||
|
[ Element.alignLeft
|
||||||
|
, Element.centerY
|
||||||
|
]
|
||||||
|
)
|
||||||
|
{ text = text
|
||||||
|
, onPress = onPress
|
||||||
|
}
|
||||||
|
--Don't forget to change the title
|
||||||
|
|> Page.viewTile "Widget.textButton"
|
||||||
|
|
||||||
|
viewIconButton button text icon onPress { palette } () =
|
||||||
|
Widget.iconButton
|
||||||
|
(button palette
|
||||||
|
|> Customize.elementButton
|
||||||
|
[ Element.alignLeft
|
||||||
|
, Element.centerY
|
||||||
|
]
|
||||||
|
)
|
||||||
|
{ text = text
|
||||||
|
, icon = icon
|
||||||
|
, onPress = onPress
|
||||||
|
}
|
||||||
|
|> Page.viewTile "Widget.itemButton"
|
||||||
|
in
|
||||||
|
[ viewButton, viewTextButton, viewIconButton ]
|
||||||
|
|> List.foldl Story.addTile
|
||||||
|
Story.initStaticTiles
|
||||||
|
|
||||||
|
|
||||||
|
{-| Let's you play around with the options.
|
||||||
|
Note that the order of these stories must follow the order of the arguments from the view functions.
|
||||||
|
-}
|
||||||
|
book : Tile.Group ( StorySelectorModel, () ) (TileMsg StorySelectorMsg ()) ()
|
||||||
book =
|
book =
|
||||||
Story.book (Just "options")
|
Story.book (Just "Options")
|
||||||
(Story.initStaticTiles
|
viewFunctions
|
||||||
|> Story.addTile viewButton
|
--Adding a option for different styles.
|
||||||
|> Story.addTile viewTextButton
|
|
||||||
|> Story.addTile viewIconButton
|
|
||||||
|> Story.addTile viewSelectButton
|
|
||||||
--|> Story.addTile viewButtonSource
|
|
||||||
)
|
|
||||||
|> Story.addStory
|
|> Story.addStory
|
||||||
(Story.optionListStory "Palette"
|
(Story.optionListStory "Style"
|
||||||
darkPalette
|
|
||||||
[ ( "dark", darkPalette )
|
|
||||||
, ( "default", defaultPalette )
|
|
||||||
]
|
|
||||||
)
|
|
||||||
|> Story.addStory
|
|
||||||
(Story.optionListStory "Material button"
|
|
||||||
containedButton
|
containedButton
|
||||||
[ ( "contained", containedButton )
|
[ ( "contained", containedButton )
|
||||||
, ( "outlined", outlinedButton )
|
, ( "outlined", outlinedButton )
|
||||||
, ( "text", textButton )
|
, ( "text", textButton )
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
--Changing the text of the label
|
||||||
|> Story.addStory
|
|> Story.addStory
|
||||||
(Story.textStory "Label"
|
(Story.textStory "Label"
|
||||||
"OK"
|
"OK"
|
||||||
)
|
)
|
||||||
|
--Change the Icon
|
||||||
|> Story.addStory
|
|> Story.addStory
|
||||||
(Story.optionListStory "Icon"
|
(Story.optionListStory "Icon"
|
||||||
(MaterialIcons.done
|
(MaterialIcons.done
|
||||||
@ -75,6 +121,7 @@ book =
|
|||||||
)
|
)
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
--Should an event be triggered when pressing the button?
|
||||||
|> Story.addStory
|
|> Story.addStory
|
||||||
(Story.boolStory "with event handler"
|
(Story.boolStory "with event handler"
|
||||||
( Just (), Nothing )
|
( Just (), Nothing )
|
||||||
@ -83,159 +130,11 @@ book =
|
|||||||
|> Story.build
|
|> Story.build
|
||||||
|
|
||||||
|
|
||||||
viewLabel : String -> Element msg
|
|
||||||
viewLabel =
|
|
||||||
Element.el [ Element.width <| Element.px 250 ] << Element.text
|
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
viewButton palette button text icon onPress _ _ =
|
-- Interactive Demonstration
|
||||||
{ title = Nothing
|
--------------------------------------------------------------------------------
|
||||||
, position = Tile.LeftColumnTile
|
{- This section here is essentially just a normal Elm program. -}
|
||||||
, attributes = [ Background.color <| MaterialColor.fromColor palette.surface ]
|
|
||||||
, body =
|
|
||||||
Element.row
|
|
||||||
[ Element.width Element.fill
|
|
||||||
, Element.centerY
|
|
||||||
, Element.Font.color <| MaterialColor.fromColor palette.on.surface
|
|
||||||
]
|
|
||||||
[ viewLabel "button"
|
|
||||||
, Widget.button
|
|
||||||
(button palette
|
|
||||||
|> Customize.elementButton
|
|
||||||
[ Element.alignLeft
|
|
||||||
, Element.centerY
|
|
||||||
]
|
|
||||||
)
|
|
||||||
{ text = text
|
|
||||||
, icon = icon
|
|
||||||
, onPress = onPress
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
viewTextButton palette button text icon onPress _ _ =
|
|
||||||
{ title = Nothing
|
|
||||||
, position = Tile.LeftColumnTile
|
|
||||||
, attributes = [ Background.color <| MaterialColor.fromColor palette.surface ]
|
|
||||||
, body =
|
|
||||||
Element.row
|
|
||||||
[ Element.width Element.fill
|
|
||||||
, Element.centerY
|
|
||||||
, Element.Font.color <| MaterialColor.fromColor palette.on.surface
|
|
||||||
]
|
|
||||||
[ viewLabel "textButton"
|
|
||||||
, Widget.textButton
|
|
||||||
(button palette
|
|
||||||
|> Customize.elementButton
|
|
||||||
[ Element.alignLeft
|
|
||||||
, Element.centerY
|
|
||||||
]
|
|
||||||
)
|
|
||||||
{ text = text
|
|
||||||
, onPress = onPress
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
viewIconButton palette button text icon onPress _ _ =
|
|
||||||
{ title = Nothing
|
|
||||||
, position = Tile.LeftColumnTile
|
|
||||||
, attributes = [ Background.color <| MaterialColor.fromColor palette.surface ]
|
|
||||||
, body =
|
|
||||||
Element.row
|
|
||||||
[ Element.width Element.fill
|
|
||||||
, Element.centerY
|
|
||||||
, Element.Font.color <| MaterialColor.fromColor palette.on.surface
|
|
||||||
]
|
|
||||||
[ viewLabel "textButton"
|
|
||||||
, Widget.iconButton
|
|
||||||
(button palette
|
|
||||||
|> Customize.elementButton
|
|
||||||
[ Element.alignLeft
|
|
||||||
, Element.centerY
|
|
||||||
]
|
|
||||||
)
|
|
||||||
{ text = text
|
|
||||||
, icon = icon
|
|
||||||
, onPress = onPress
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
viewSelectButton palette button text icon onPress _ _ =
|
|
||||||
{ title = Nothing
|
|
||||||
, position = Tile.LeftColumnTile
|
|
||||||
, attributes = [ Background.color <| MaterialColor.fromColor palette.surface ]
|
|
||||||
, body =
|
|
||||||
Element.row
|
|
||||||
[ Element.width Element.fill
|
|
||||||
, Element.centerY
|
|
||||||
, Element.Font.color <| MaterialColor.fromColor palette.on.surface
|
|
||||||
]
|
|
||||||
[ viewLabel "select button"
|
|
||||||
, Element.column [ Element.width Element.fill, Element.spacing 8 ]
|
|
||||||
[ Widget.selectButton
|
|
||||||
(button palette
|
|
||||||
|> Customize.elementButton
|
|
||||||
[ Element.centerY
|
|
||||||
, Element.alignLeft
|
|
||||||
]
|
|
||||||
)
|
|
||||||
( False
|
|
||||||
, { text = text
|
|
||||||
, icon = icon
|
|
||||||
, onPress = onPress
|
|
||||||
}
|
|
||||||
)
|
|
||||||
, Widget.selectButton
|
|
||||||
(button palette
|
|
||||||
|> Customize.elementButton
|
|
||||||
[ Element.centerY
|
|
||||||
, Element.alignLeft
|
|
||||||
]
|
|
||||||
)
|
|
||||||
( True
|
|
||||||
, { text = text
|
|
||||||
, icon = icon
|
|
||||||
, onPress = onPress
|
|
||||||
}
|
|
||||||
)
|
|
||||||
]
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
viewButtonSource palette text icon onPress size _ _ =
|
|
||||||
{ title = Just "source code"
|
|
||||||
, position = Tile.FullWidthTile
|
|
||||||
, attributes = []
|
|
||||||
, body =
|
|
||||||
Tile.sourceCode <|
|
|
||||||
"""Widget.button
|
|
||||||
(Material.containedButton palette
|
|
||||||
|> Customize.elementButton [ Element.height <| Element.px """
|
|
||||||
++ String.fromInt size
|
|
||||||
++ """ ]
|
|
||||||
)
|
|
||||||
{ text =\""""
|
|
||||||
++ text
|
|
||||||
++ """"
|
|
||||||
, icon = MaterialIcons.done |> Icon.elmMaterialIcons Widget.Material.Types.Color
|
|
||||||
, onPress = """
|
|
||||||
++ (case onPress of
|
|
||||||
Nothing ->
|
|
||||||
"Nothing"
|
|
||||||
|
|
||||||
Just () ->
|
|
||||||
"Just ()"
|
|
||||||
)
|
|
||||||
++ """
|
|
||||||
}
|
|
||||||
"""
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
type alias Model =
|
type alias Model =
|
||||||
@ -253,14 +152,6 @@ type Msg
|
|||||||
--|> Story.addTile (Just "Interactive example") view
|
--|> Story.addTile (Just "Interactive example") view
|
||||||
|
|
||||||
|
|
||||||
demo =
|
|
||||||
{ init = always init
|
|
||||||
, update = update
|
|
||||||
, view = view
|
|
||||||
, subscriptions = subscriptions
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
init : ( Model, Cmd Msg )
|
init : ( Model, Cmd Msg )
|
||||||
init =
|
init =
|
||||||
( 0, Cmd.none )
|
( 0, Cmd.none )
|
||||||
@ -297,11 +188,9 @@ subscriptions _ =
|
|||||||
Sub.none
|
Sub.none
|
||||||
|
|
||||||
|
|
||||||
view _ model =
|
view : Context -> Int -> { title : Maybe String, position : Position, attributes : List b, body : Element Msg }
|
||||||
|
view { palette } model =
|
||||||
let
|
let
|
||||||
palette =
|
|
||||||
Material.defaultPalette
|
|
||||||
|
|
||||||
style =
|
style =
|
||||||
{ containedButton = Material.containedButton palette
|
{ containedButton = Material.containedButton palette
|
||||||
, outlinedButton = Material.outlinedButton palette
|
, outlinedButton = Material.outlinedButton palette
|
||||||
@ -397,3 +286,27 @@ view _ model =
|
|||||||
|> Customize.mapContent (Customize.element [ Element.width <| Element.fill ])
|
|> Customize.mapContent (Customize.element [ Element.width <| Element.fill ])
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
demo : Tile Model Msg ()
|
||||||
|
demo =
|
||||||
|
{ init = always init
|
||||||
|
, update = update
|
||||||
|
, view = view
|
||||||
|
, subscriptions = subscriptions
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
-- DO NOT MODIFY ANTHING AFTER THIS LINE
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
page =
|
||||||
|
Page.create
|
||||||
|
{ title = title
|
||||||
|
, description = description
|
||||||
|
, book = book
|
||||||
|
, demo = demo
|
||||||
|
}
|
173
explorer/src/Page/PasswordInput.elm
Normal file
173
explorer/src/Page/PasswordInput.elm
Normal file
@ -0,0 +1,173 @@
|
|||||||
|
module Page.PasswordInput exposing (Model, Msg, init, page, subscriptions, update, view)
|
||||||
|
|
||||||
|
import Browser
|
||||||
|
import Element exposing (Element)
|
||||||
|
import Element.Background as Background
|
||||||
|
import Element.Font
|
||||||
|
import Element.Input as Input
|
||||||
|
import Material.Icons as MaterialIcons exposing (offline_bolt)
|
||||||
|
import Material.Icons.Types exposing (Coloring(..))
|
||||||
|
import Set exposing (Set)
|
||||||
|
import UIExplorer
|
||||||
|
import UIExplorer.Story as Story
|
||||||
|
import UIExplorer.Tile as Tile
|
||||||
|
import Widget exposing (ColumnStyle, PasswordInputStyle)
|
||||||
|
import Widget.Customize as Customize
|
||||||
|
import Widget.Icon as Icon exposing (Icon)
|
||||||
|
import Widget.Material as Material
|
||||||
|
exposing
|
||||||
|
( Palette
|
||||||
|
, containedButton
|
||||||
|
, darkPalette
|
||||||
|
, defaultPalette
|
||||||
|
, outlinedButton
|
||||||
|
, textButton
|
||||||
|
)
|
||||||
|
import Widget.Material.Color as MaterialColor
|
||||||
|
import Widget.Material.Typography as Typography
|
||||||
|
|
||||||
|
|
||||||
|
page =
|
||||||
|
Tile.first (intro |> Tile.withTitle "Password Input")
|
||||||
|
|> Tile.nextGroup book
|
||||||
|
|> Tile.next demo
|
||||||
|
|> Tile.page
|
||||||
|
|
||||||
|
|
||||||
|
intro =
|
||||||
|
Tile.markdown []
|
||||||
|
""" An input field for a password. """
|
||||||
|
|
||||||
|
|
||||||
|
book =
|
||||||
|
Story.book (Just "options")
|
||||||
|
(Story.initStaticTiles
|
||||||
|
|> Story.addTile viewPassword
|
||||||
|
)
|
||||||
|
|> Story.addStory
|
||||||
|
(Story.optionListStory "Palette"
|
||||||
|
darkPalette
|
||||||
|
[ ( "dark", darkPalette )
|
||||||
|
, ( "default", defaultPalette )
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|> Story.addStory
|
||||||
|
(Story.textStory "Text"
|
||||||
|
"123456789"
|
||||||
|
)
|
||||||
|
|> Story.addStory
|
||||||
|
(Story.optionListStory "Placeholder"
|
||||||
|
Nothing
|
||||||
|
[ ( "Yes"
|
||||||
|
, "password"
|
||||||
|
|> Element.text
|
||||||
|
|> Input.placeholder []
|
||||||
|
|> Just
|
||||||
|
)
|
||||||
|
, ( "No", Nothing )
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|> Story.addStory
|
||||||
|
(Story.textStory "Label"
|
||||||
|
"Password"
|
||||||
|
)
|
||||||
|
|> Story.build
|
||||||
|
|
||||||
|
|
||||||
|
type alias Style style msg =
|
||||||
|
{ style
|
||||||
|
| passwordInput : PasswordInputStyle msg
|
||||||
|
, column : ColumnStyle msg
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
viewLabel : String -> Element msg
|
||||||
|
viewLabel =
|
||||||
|
Element.el [ Element.width <| Element.px 250 ] << Element.text
|
||||||
|
|
||||||
|
|
||||||
|
viewPassword palette text placeholder label _ _ =
|
||||||
|
{ title = Nothing
|
||||||
|
, position = Tile.LeftColumnTile
|
||||||
|
, attributes = [ Background.color <| MaterialColor.fromColor palette.surface ]
|
||||||
|
, body =
|
||||||
|
Element.column
|
||||||
|
[ Element.width Element.fill
|
||||||
|
, Element.centerY
|
||||||
|
, Element.Font.color <| MaterialColor.fromColor palette.on.surface
|
||||||
|
]
|
||||||
|
[ viewLabel "Current Password"
|
||||||
|
, { text = text
|
||||||
|
, placeholder = placeholder
|
||||||
|
, label = label
|
||||||
|
, onChange = always ()
|
||||||
|
, show = False
|
||||||
|
}
|
||||||
|
|> Widget.currentPasswordInput (Material.passwordInput palette)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
-- Example
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
materialStyle : Style {} msg
|
||||||
|
materialStyle =
|
||||||
|
{ passwordInput = Material.passwordInput Material.defaultPalette
|
||||||
|
, column = Material.column
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
type alias Model =
|
||||||
|
{ passwordInput : String
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
type Msg
|
||||||
|
= SetPasswordInput String
|
||||||
|
|
||||||
|
|
||||||
|
init : ( Model, Cmd Msg )
|
||||||
|
init =
|
||||||
|
( { passwordInput = ""
|
||||||
|
}
|
||||||
|
, Cmd.none
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
update : Msg -> Model -> ( Model, Cmd Msg )
|
||||||
|
update msg model =
|
||||||
|
case msg of
|
||||||
|
SetPasswordInput string ->
|
||||||
|
( { model | passwordInput = string }, Cmd.none )
|
||||||
|
|
||||||
|
|
||||||
|
subscriptions : Model -> Sub Msg
|
||||||
|
subscriptions _ =
|
||||||
|
Sub.none
|
||||||
|
|
||||||
|
|
||||||
|
view _ model =
|
||||||
|
{ title = Just "Interactive Demo"
|
||||||
|
, position = Tile.FullWidthTile
|
||||||
|
, attributes = []
|
||||||
|
, body =
|
||||||
|
{ text = model.passwordInput
|
||||||
|
, placeholder = Nothing
|
||||||
|
, label = "Chips"
|
||||||
|
, onChange = SetPasswordInput
|
||||||
|
, show = False
|
||||||
|
}
|
||||||
|
|> Widget.currentPasswordInput (Material.passwordInput Material.defaultPalette)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
demo =
|
||||||
|
{ init = always init
|
||||||
|
, update = update
|
||||||
|
, view = view
|
||||||
|
, subscriptions = subscriptions
|
||||||
|
}
|
@ -57,6 +57,7 @@ import Url.Builder
|
|||||||
import Url.Parser exposing ((</>))
|
import Url.Parser exposing ((</>))
|
||||||
import Widget exposing (Item)
|
import Widget exposing (Item)
|
||||||
import Widget.Material as Material
|
import Widget.Material as Material
|
||||||
|
import Widget.Material.Typography as Typography
|
||||||
|
|
||||||
|
|
||||||
{-| The first page in your UI explorer. This is the default page if the user doesn't specify a url path.
|
{-| The first page in your UI explorer. This is the default page if the user doesn't specify a url path.
|
||||||
@ -587,21 +588,36 @@ updateSuccess (PageBuilder pages) config msg model =
|
|||||||
)
|
)
|
||||||
|
|
||||||
PressedPageSizeOption pageSizeOption ->
|
PressedPageSizeOption pageSizeOption ->
|
||||||
( { model | pageSizeOption = pageSizeOption
|
( { model
|
||||||
, expandPageSizeOptions = False }, Cmd.none )
|
| pageSizeOption = pageSizeOption
|
||||||
|
, expandPageSizeOptions = False
|
||||||
|
}
|
||||||
|
, Cmd.none
|
||||||
|
)
|
||||||
|
|
||||||
ToggledPageSizeGroup ->
|
ToggledPageSizeGroup ->
|
||||||
( { model | expandPageSizeOptions = not model.expandPageSizeOptions
|
( { model
|
||||||
, expandColorBlindOptions = False
|
| expandPageSizeOptions = not model.expandPageSizeOptions
|
||||||
}, Cmd.none )
|
, expandColorBlindOptions = False
|
||||||
|
}
|
||||||
|
, Cmd.none
|
||||||
|
)
|
||||||
|
|
||||||
PressedColorBlindOption colorBlindOption ->
|
PressedColorBlindOption colorBlindOption ->
|
||||||
( { model | colorBlindOption = colorBlindOption
|
( { model
|
||||||
, expandColorBlindOptions = False}, Cmd.none )
|
| colorBlindOption = colorBlindOption
|
||||||
|
, expandColorBlindOptions = False
|
||||||
|
}
|
||||||
|
, Cmd.none
|
||||||
|
)
|
||||||
|
|
||||||
ToggledColorBlindGroup ->
|
ToggledColorBlindGroup ->
|
||||||
( { model | expandColorBlindOptions = not model.expandColorBlindOptions
|
( { model
|
||||||
, expandPageSizeOptions = False }, Cmd.none )
|
| expandColorBlindOptions = not model.expandColorBlindOptions
|
||||||
|
, expandPageSizeOptions = False
|
||||||
|
}
|
||||||
|
, Cmd.none
|
||||||
|
)
|
||||||
|
|
||||||
ChangeDarkTheme enabled ->
|
ChangeDarkTheme enabled ->
|
||||||
( { model | darkThemeEnabled = enabled }, Cmd.none )
|
( { model | darkThemeEnabled = enabled }, Cmd.none )
|
||||||
@ -796,10 +812,19 @@ viewSidebar pages config model =
|
|||||||
)
|
)
|
||||||
|
|
||||||
else
|
else
|
||||||
[ [ Element.row
|
[ [ Widget.insetItem (Material.insetItem palette)
|
||||||
[ Element.width Element.fill ]
|
{ text = ""
|
||||||
[ config.sidebarTitle, minimizeSidebarButton ]
|
, onPress = Just PressedToggleSidebar
|
||||||
|> Widget.asItem
|
, icon =
|
||||||
|
\_ ->
|
||||||
|
config.sidebarTitle
|
||||||
|
|> Element.el Typography.h6
|
||||||
|
, content =
|
||||||
|
\{ size } ->
|
||||||
|
Element.text "❮"
|
||||||
|
|> Element.el [ Element.Font.size size ]
|
||||||
|
}
|
||||||
|
, Widget.divider (Material.fullBleedDivider palette)
|
||||||
, Widget.fullBleedItem (Material.fullBleedItem palette)
|
, Widget.fullBleedItem (Material.fullBleedItem palette)
|
||||||
{ text = "Dark Theme"
|
{ text = "Dark Theme"
|
||||||
, onPress = Just <| ChangeDarkTheme <| not <| model.darkThemeEnabled
|
, onPress = Just <| ChangeDarkTheme <| not <| model.darkThemeEnabled
|
||||||
|
@ -7,6 +7,7 @@ import SelectList exposing (SelectList)
|
|||||||
import UIExplorer.Tile as Tile exposing (Context)
|
import UIExplorer.Tile as Tile exposing (Context)
|
||||||
import Widget
|
import Widget
|
||||||
import Widget.Material as Material
|
import Widget.Material as Material
|
||||||
|
import Widget.Material.Typography as Typography
|
||||||
|
|
||||||
|
|
||||||
type StoryInfo
|
type StoryInfo
|
||||||
@ -319,7 +320,13 @@ storyView context model =
|
|||||||
case model of
|
case model of
|
||||||
RangeStoryModel label { unit, min, max, value } ->
|
RangeStoryModel label { unit, min, max, value } ->
|
||||||
Element.column [ Element.spacing 8 ]
|
Element.column [ Element.spacing 8 ]
|
||||||
[ Element.text <| label ++ " (" ++ String.fromInt value ++ unit ++ ")"
|
[ label
|
||||||
|
++ " ("
|
||||||
|
++ String.fromInt value
|
||||||
|
++ unit
|
||||||
|
++ ")"
|
||||||
|
|> Element.text
|
||||||
|
|> Element.el Typography.caption
|
||||||
, Input.slider []
|
, Input.slider []
|
||||||
{ onChange = round >> String.fromInt >> StorySelect label
|
{ onChange = round >> String.fromInt >> StorySelect label
|
||||||
, label = Input.labelHidden label
|
, label = Input.labelHidden label
|
||||||
@ -333,7 +340,7 @@ storyView context model =
|
|||||||
|
|
||||||
TextStoryModel label value ->
|
TextStoryModel label value ->
|
||||||
Element.column [ Element.spacing 8 ]
|
Element.column [ Element.spacing 8 ]
|
||||||
[ Element.text label
|
[ Element.text label |> Element.el Typography.caption
|
||||||
, Widget.textInput (Material.textInput context.palette)
|
, Widget.textInput (Material.textInput context.palette)
|
||||||
{ chips = []
|
{ chips = []
|
||||||
, onChange = StorySelect label
|
, onChange = StorySelect label
|
||||||
@ -345,7 +352,7 @@ storyView context model =
|
|||||||
|
|
||||||
OptionListStoryModel label options ->
|
OptionListStoryModel label options ->
|
||||||
Element.column [ Element.spacing 8 ]
|
Element.column [ Element.spacing 8 ]
|
||||||
[ Element.text label
|
[ Element.text label |> Element.el Typography.caption
|
||||||
, { selected =
|
, { selected =
|
||||||
Just <| SelectList.index options
|
Just <| SelectList.index options
|
||||||
, options =
|
, options =
|
||||||
@ -374,8 +381,9 @@ storyView context model =
|
|||||||
]
|
]
|
||||||
|
|
||||||
BoolStoryModel label value ->
|
BoolStoryModel label value ->
|
||||||
Element.row [ Element.spacing 8 ]
|
Element.row [ Element.spaceEvenly, Element.width Element.fill ]
|
||||||
[ Widget.switch (Material.switch context.palette)
|
[ Element.text label |> Element.el Typography.caption
|
||||||
|
, Widget.switch (Material.switch context.palette)
|
||||||
{ description = label
|
{ description = label
|
||||||
, onPress =
|
, onPress =
|
||||||
Just <|
|
Just <|
|
||||||
@ -387,7 +395,6 @@ storyView context model =
|
|||||||
"t"
|
"t"
|
||||||
, active = value
|
, active = value
|
||||||
}
|
}
|
||||||
, Element.text label
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,9 +7,9 @@ import Element.Font as Font
|
|||||||
import Markdown
|
import Markdown
|
||||||
import SelectList exposing (SelectList)
|
import SelectList exposing (SelectList)
|
||||||
import UIExplorer exposing (Page, PageSize)
|
import UIExplorer exposing (Page, PageSize)
|
||||||
import Widget
|
import Widget exposing (Item)
|
||||||
import Widget.Customize as Customize
|
import Widget.Customize as Customize
|
||||||
import Widget.Material as Material
|
import Widget.Material as Material exposing (Palette)
|
||||||
import Widget.Material.Color as MaterialColor
|
import Widget.Material.Color as MaterialColor
|
||||||
import Widget.Material.Typography as Typography
|
import Widget.Material.Typography as Typography
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ mapView map view =
|
|||||||
{ title = view.title
|
{ title = view.title
|
||||||
, position = view.position
|
, position = view.position
|
||||||
, attributes = List.map (Element.mapAttribute map) view.attributes
|
, attributes = List.map (Element.mapAttribute map) view.attributes
|
||||||
, body = Element.map map view.body
|
, body = view.body |> Element.map map
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -278,19 +278,17 @@ layoutAddTile view layout =
|
|||||||
|
|
||||||
|
|
||||||
layoutView : Material.Palette -> List (Attribute msg) -> View msg -> Element msg
|
layoutView : Material.Palette -> List (Attribute msg) -> View msg -> Element msg
|
||||||
layoutView palette attributes view =
|
layoutView palette _ view =
|
||||||
Widget.column
|
case view.title of
|
||||||
(Material.cardColumn palette
|
Just string ->
|
||||||
|> Customize.elementColumn attributes
|
[ string
|
||||||
|> Customize.mapContent (Customize.element <| Element.height Element.fill :: view.attributes)
|
|> Widget.headerItem (Material.fullBleedHeader palette)
|
||||||
)
|
, view.body |> Widget.asItem
|
||||||
<|
|
|
||||||
List.filterMap identity
|
|
||||||
[ view.title
|
|
||||||
|> Maybe.map Element.text
|
|
||||||
|> Maybe.map (Element.el Typography.h3)
|
|
||||||
, Just view.body
|
|
||||||
]
|
]
|
||||||
|
|> Widget.itemList (Material.cardColumn palette)
|
||||||
|
|
||||||
|
Nothing ->
|
||||||
|
view.body
|
||||||
|
|
||||||
|
|
||||||
layoutRowView : Material.Palette -> LayoutRow msg -> List (Element msg)
|
layoutRowView : Material.Palette -> LayoutRow msg -> List (Element msg)
|
||||||
@ -304,12 +302,12 @@ layoutRowView palette row =
|
|||||||
TwoColumn left right ->
|
TwoColumn left right ->
|
||||||
Element.row
|
Element.row
|
||||||
[ Element.width Element.fill
|
[ Element.width Element.fill
|
||||||
, Element.spacing 10
|
, Element.spacing 8
|
||||||
]
|
]
|
||||||
[ Element.column
|
[ Element.column
|
||||||
[ Element.width <| Element.fillPortion 2
|
[ Element.width <| Element.fillPortion 2
|
||||||
, Element.height Element.fill
|
, Element.height Element.fill
|
||||||
, Element.spacing 10
|
, Element.spacing 32
|
||||||
]
|
]
|
||||||
<|
|
<|
|
||||||
List.map
|
List.map
|
||||||
@ -321,7 +319,7 @@ layoutRowView palette row =
|
|||||||
, Element.column
|
, Element.column
|
||||||
[ Element.width <| Element.fillPortion 1
|
[ Element.width <| Element.fillPortion 1
|
||||||
, Element.height Element.fill
|
, Element.height Element.fill
|
||||||
, Element.spacing 10
|
, Element.spacing 8
|
||||||
]
|
]
|
||||||
<|
|
<|
|
||||||
List.map
|
List.map
|
||||||
@ -357,8 +355,8 @@ page (Builder config) =
|
|||||||
|> List.reverse
|
|> List.reverse
|
||||||
|> List.concatMap (layoutRowView palette)
|
|> List.concatMap (layoutRowView palette)
|
||||||
|> Element.column
|
|> Element.column
|
||||||
([ Element.padding 10
|
([ Element.padding 16
|
||||||
, Element.spacing 10
|
, Element.spacing 32
|
||||||
, Element.px 800 |> Element.width
|
, Element.px 800 |> Element.width
|
||||||
, Element.centerX
|
, Element.centerX
|
||||||
, Font.family
|
, Font.family
|
||||||
@ -413,12 +411,12 @@ withTitle title tile =
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
canvas : Element msg -> Element msg
|
canvas : Palette -> Element msg -> Element msg
|
||||||
canvas view =
|
canvas palette view =
|
||||||
Element.el
|
Element.el
|
||||||
[ Element.padding 30
|
[ Element.padding 30
|
||||||
, Element.width Element.fill
|
, Element.width Element.fill
|
||||||
, Background.color <| MaterialColor.fromColor <| MaterialColor.gray
|
, Background.color <| MaterialColor.fromColor <| Material.gray palette
|
||||||
]
|
]
|
||||||
<|
|
<|
|
||||||
Element.el
|
Element.el
|
||||||
|
@ -8,7 +8,7 @@ import Internal.AppBar exposing (AppBarStyle)
|
|||||||
import Internal.Button exposing (ButtonStyle)
|
import Internal.Button exposing (ButtonStyle)
|
||||||
import Internal.Material.Button as Button
|
import Internal.Material.Button as Button
|
||||||
import Internal.Material.Icon as Icon
|
import Internal.Material.Icon as Icon
|
||||||
import Internal.Material.Palette exposing (Palette)
|
import Internal.Material.Palette as Palette exposing (Palette)
|
||||||
import Internal.Material.TextInput as TextInput
|
import Internal.Material.TextInput as TextInput
|
||||||
import Widget.Customize as Customize
|
import Widget.Customize as Customize
|
||||||
import Widget.Icon as Icon exposing (Icon)
|
import Widget.Icon as Icon exposing (Icon)
|
||||||
@ -52,7 +52,7 @@ menuTabButton palette =
|
|||||||
]
|
]
|
||||||
, ifDisabled =
|
, ifDisabled =
|
||||||
(Button.baseButton palette |> .ifDisabled)
|
(Button.baseButton palette |> .ifDisabled)
|
||||||
++ [ MaterialColor.gray
|
++ [ Palette.gray palette
|
||||||
|> MaterialColor.fromColor
|
|> MaterialColor.fromColor
|
||||||
|> Font.color
|
|> Font.color
|
||||||
, Element.mouseDown []
|
, Element.mouseDown []
|
||||||
@ -84,7 +84,7 @@ menuTabButton palette =
|
|||||||
}
|
}
|
||||||
, ifDisabled =
|
, ifDisabled =
|
||||||
{ size = 18
|
{ size = 18
|
||||||
, color = MaterialColor.gray
|
, color = Palette.gray palette
|
||||||
}
|
}
|
||||||
, otherwise =
|
, otherwise =
|
||||||
{ size = 18
|
{ size = 18
|
||||||
|
@ -6,13 +6,13 @@ import Element.Border as Border
|
|||||||
import Element.Font as Font
|
import Element.Font as Font
|
||||||
import Html.Attributes as Attributes
|
import Html.Attributes as Attributes
|
||||||
import Internal.Button exposing (ButtonStyle)
|
import Internal.Button exposing (ButtonStyle)
|
||||||
import Internal.Material.Palette exposing (Palette)
|
import Internal.Material.Palette as Palette exposing (Palette)
|
||||||
import Widget.Material.Color as MaterialColor
|
import Widget.Material.Color as MaterialColor
|
||||||
import Widget.Material.Typography as Typography
|
import Widget.Material.Typography as Typography
|
||||||
|
|
||||||
|
|
||||||
baseButton : Palette -> ButtonStyle msg
|
baseButton : Palette -> ButtonStyle msg
|
||||||
baseButton _ =
|
baseButton palette =
|
||||||
{ elementButton =
|
{ elementButton =
|
||||||
Typography.button
|
Typography.button
|
||||||
++ [ Element.height <| Element.px 36
|
++ [ Element.height <| Element.px 36
|
||||||
@ -35,15 +35,15 @@ baseButton _ =
|
|||||||
, icon =
|
, icon =
|
||||||
{ ifDisabled =
|
{ ifDisabled =
|
||||||
{ size = 18
|
{ size = 18
|
||||||
, color = MaterialColor.gray
|
, color = Palette.gray palette
|
||||||
}
|
}
|
||||||
, ifActive =
|
, ifActive =
|
||||||
{ size = 18
|
{ size = 18
|
||||||
, color = MaterialColor.gray
|
, color = Palette.gray palette
|
||||||
}
|
}
|
||||||
, otherwise =
|
, otherwise =
|
||||||
{ size = 18
|
{ size = 18
|
||||||
, color = MaterialColor.gray
|
, color = Palette.gray palette
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -82,11 +82,11 @@ containedButton palette =
|
|||||||
]
|
]
|
||||||
, ifDisabled =
|
, ifDisabled =
|
||||||
(baseButton palette |> .ifDisabled)
|
(baseButton palette |> .ifDisabled)
|
||||||
++ [ MaterialColor.gray
|
++ [ Palette.gray palette
|
||||||
|> MaterialColor.scaleOpacity MaterialColor.buttonDisabledOpacity
|
|> MaterialColor.scaleOpacity MaterialColor.buttonDisabledOpacity
|
||||||
|> MaterialColor.fromColor
|
|> MaterialColor.fromColor
|
||||||
|> Background.color
|
|> Background.color
|
||||||
, Font.color <| MaterialColor.fromColor <| MaterialColor.gray
|
, Font.color <| MaterialColor.fromColor <| Palette.gray palette
|
||||||
, Border.shadow <| MaterialColor.shadow 0
|
, Border.shadow <| MaterialColor.shadow 0
|
||||||
, Element.mouseDown []
|
, Element.mouseDown []
|
||||||
, Element.mouseOver []
|
, Element.mouseOver []
|
||||||
@ -126,7 +126,8 @@ containedButton palette =
|
|||||||
}
|
}
|
||||||
, ifDisabled =
|
, ifDisabled =
|
||||||
{ size = 18
|
{ size = 18
|
||||||
, color = MaterialColor.gray
|
, color =
|
||||||
|
Palette.gray palette
|
||||||
}
|
}
|
||||||
, otherwise =
|
, otherwise =
|
||||||
{ size = 18
|
{ size = 18
|
||||||
@ -174,7 +175,7 @@ outlinedButton palette =
|
|||||||
]
|
]
|
||||||
, ifDisabled =
|
, ifDisabled =
|
||||||
(baseButton palette |> .ifDisabled)
|
(baseButton palette |> .ifDisabled)
|
||||||
++ [ MaterialColor.gray
|
++ [ Palette.gray palette
|
||||||
|> MaterialColor.fromColor
|
|> MaterialColor.fromColor
|
||||||
|> Font.color
|
|> Font.color
|
||||||
, Element.mouseDown []
|
, Element.mouseDown []
|
||||||
@ -212,7 +213,7 @@ outlinedButton palette =
|
|||||||
}
|
}
|
||||||
, ifDisabled =
|
, ifDisabled =
|
||||||
{ size = 18
|
{ size = 18
|
||||||
, color = MaterialColor.gray
|
, color = Palette.gray palette
|
||||||
}
|
}
|
||||||
, otherwise =
|
, otherwise =
|
||||||
{ size = 18
|
{ size = 18
|
||||||
@ -252,7 +253,7 @@ textButton palette =
|
|||||||
]
|
]
|
||||||
, ifDisabled =
|
, ifDisabled =
|
||||||
(baseButton palette |> .ifDisabled)
|
(baseButton palette |> .ifDisabled)
|
||||||
++ [ MaterialColor.gray
|
++ [ Palette.gray palette
|
||||||
|> MaterialColor.fromColor
|
|> MaterialColor.fromColor
|
||||||
|> Font.color
|
|> Font.color
|
||||||
, Element.mouseDown []
|
, Element.mouseDown []
|
||||||
@ -278,7 +279,7 @@ textButton palette =
|
|||||||
}
|
}
|
||||||
, ifDisabled =
|
, ifDisabled =
|
||||||
{ size = 18
|
{ size = 18
|
||||||
, color = MaterialColor.gray
|
, color = Palette.gray palette
|
||||||
}
|
}
|
||||||
, otherwise =
|
, otherwise =
|
||||||
{ size = 18
|
{ size = 18
|
||||||
@ -342,7 +343,7 @@ toggleButton palette =
|
|||||||
|> MaterialColor.scaleOpacity 0.14
|
|> MaterialColor.scaleOpacity 0.14
|
||||||
|> MaterialColor.fromColor
|
|> MaterialColor.fromColor
|
||||||
|> Border.color
|
|> Border.color
|
||||||
, MaterialColor.gray
|
, Palette.gray palette
|
||||||
|> MaterialColor.fromColor
|
|> MaterialColor.fromColor
|
||||||
|> Font.color
|
|> Font.color
|
||||||
, Element.mouseDown []
|
, Element.mouseDown []
|
||||||
@ -401,7 +402,7 @@ toggleButton palette =
|
|||||||
}
|
}
|
||||||
, ifDisabled =
|
, ifDisabled =
|
||||||
{ size = 24
|
{ size = 24
|
||||||
, color = MaterialColor.gray
|
, color = Palette.gray palette
|
||||||
}
|
}
|
||||||
, otherwise =
|
, otherwise =
|
||||||
{ size = 24
|
{ size = 24
|
||||||
@ -450,7 +451,7 @@ iconButton palette =
|
|||||||
]
|
]
|
||||||
, ifDisabled =
|
, ifDisabled =
|
||||||
(baseButton palette |> .ifDisabled)
|
(baseButton palette |> .ifDisabled)
|
||||||
++ [ MaterialColor.gray
|
++ [ Palette.gray palette
|
||||||
|> MaterialColor.fromColor
|
|> MaterialColor.fromColor
|
||||||
|> Font.color
|
|> Font.color
|
||||||
, Element.mouseDown []
|
, Element.mouseDown []
|
||||||
@ -481,7 +482,7 @@ iconButton palette =
|
|||||||
}
|
}
|
||||||
, ifDisabled =
|
, ifDisabled =
|
||||||
{ size = 18
|
{ size = 18
|
||||||
, color = MaterialColor.gray
|
, color = Palette.gray palette
|
||||||
}
|
}
|
||||||
, otherwise =
|
, otherwise =
|
||||||
{ size = 18
|
{ size = 18
|
||||||
|
@ -22,13 +22,13 @@ import Internal.Button exposing (ButtonStyle)
|
|||||||
import Internal.Item exposing (DividerStyle, ExpansionItemStyle, FullBleedItemStyle, HeaderStyle, ImageItemStyle, InsetItemStyle, ItemStyle, MultiLineItemStyle)
|
import Internal.Item exposing (DividerStyle, ExpansionItemStyle, FullBleedItemStyle, HeaderStyle, ImageItemStyle, InsetItemStyle, ItemStyle, MultiLineItemStyle)
|
||||||
import Internal.Material.Button as Button
|
import Internal.Material.Button as Button
|
||||||
import Internal.Material.Icon as Icon
|
import Internal.Material.Icon as Icon
|
||||||
import Internal.Material.Palette exposing (Palette)
|
import Internal.Material.Palette as Palette exposing (Palette)
|
||||||
import Widget.Material.Color as MaterialColor
|
import Widget.Material.Color as MaterialColor
|
||||||
import Widget.Material.Typography as Typography
|
import Widget.Material.Typography as Typography
|
||||||
|
|
||||||
|
|
||||||
fullBleedDivider : Palette -> ItemStyle (DividerStyle msg) msg
|
fullBleedDivider : Palette -> ItemStyle (DividerStyle msg) msg
|
||||||
fullBleedDivider _ =
|
fullBleedDivider palette =
|
||||||
{ element =
|
{ element =
|
||||||
[ Element.width <| Element.fill
|
[ Element.width <| Element.fill
|
||||||
, Element.height <| Element.px 1
|
, Element.height <| Element.px 1
|
||||||
@ -39,7 +39,7 @@ fullBleedDivider _ =
|
|||||||
{ element =
|
{ element =
|
||||||
[ Element.width <| Element.fill
|
[ Element.width <| Element.fill
|
||||||
, Element.height <| Element.px 1
|
, Element.height <| Element.px 1
|
||||||
, MaterialColor.gray
|
, Palette.lightGray palette
|
||||||
|> MaterialColor.fromColor
|
|> MaterialColor.fromColor
|
||||||
|> Background.color
|
|> Background.color
|
||||||
]
|
]
|
||||||
@ -48,7 +48,7 @@ fullBleedDivider _ =
|
|||||||
|
|
||||||
|
|
||||||
insetDivider : Palette -> ItemStyle (DividerStyle msg) msg
|
insetDivider : Palette -> ItemStyle (DividerStyle msg) msg
|
||||||
insetDivider _ =
|
insetDivider palette =
|
||||||
{ element =
|
{ element =
|
||||||
[ Element.width <| Element.fill
|
[ Element.width <| Element.fill
|
||||||
, Element.height <| Element.px 1
|
, Element.height <| Element.px 1
|
||||||
@ -64,7 +64,7 @@ insetDivider _ =
|
|||||||
{ element =
|
{ element =
|
||||||
[ Element.width <| Element.fill
|
[ Element.width <| Element.fill
|
||||||
, Element.height <| Element.px 1
|
, Element.height <| Element.px 1
|
||||||
, MaterialColor.gray
|
, Palette.lightGray palette
|
||||||
|> MaterialColor.fromColor
|
|> MaterialColor.fromColor
|
||||||
|> Background.color
|
|> Background.color
|
||||||
]
|
]
|
||||||
@ -73,7 +73,7 @@ insetDivider _ =
|
|||||||
|
|
||||||
|
|
||||||
middleDivider : Palette -> ItemStyle (DividerStyle msg) msg
|
middleDivider : Palette -> ItemStyle (DividerStyle msg) msg
|
||||||
middleDivider _ =
|
middleDivider palette =
|
||||||
{ element =
|
{ element =
|
||||||
[ Element.width <| Element.fill
|
[ Element.width <| Element.fill
|
||||||
, Element.height <| Element.px 1
|
, Element.height <| Element.px 1
|
||||||
@ -89,7 +89,7 @@ middleDivider _ =
|
|||||||
{ element =
|
{ element =
|
||||||
[ Element.width <| Element.fill
|
[ Element.width <| Element.fill
|
||||||
, Element.height <| Element.px 1
|
, Element.height <| Element.px 1
|
||||||
, MaterialColor.gray
|
, Palette.lightGray palette
|
||||||
|> MaterialColor.fromColor
|
|> MaterialColor.fromColor
|
||||||
|> Background.color
|
|> Background.color
|
||||||
]
|
]
|
||||||
@ -120,8 +120,8 @@ insetHeader palette =
|
|||||||
insetDivider palette
|
insetDivider palette
|
||||||
|> .content
|
|> .content
|
||||||
, title =
|
, title =
|
||||||
Typography.body2
|
Typography.caption
|
||||||
++ [ MaterialColor.gray
|
++ [ Palette.textGray palette
|
||||||
|> MaterialColor.fromColor
|
|> MaterialColor.fromColor
|
||||||
|> Font.color
|
|> Font.color
|
||||||
]
|
]
|
||||||
@ -142,6 +142,9 @@ fullBleedHeader palette =
|
|||||||
, right = 0
|
, right = 0
|
||||||
, top = 1
|
, top = 1
|
||||||
}
|
}
|
||||||
|
, Palette.lightGray palette
|
||||||
|
|> MaterialColor.fromColor
|
||||||
|
|> Border.color
|
||||||
]
|
]
|
||||||
, content =
|
, content =
|
||||||
{ elementColumn =
|
{ elementColumn =
|
||||||
@ -151,11 +154,11 @@ fullBleedHeader palette =
|
|||||||
, content =
|
, content =
|
||||||
{ divider = { element = [] }
|
{ divider = { element = [] }
|
||||||
, title =
|
, title =
|
||||||
Typography.caption
|
Typography.subtitle2
|
||||||
++ [ MaterialColor.gray
|
++ [ Palette.textGray palette
|
||||||
|> MaterialColor.fromColor
|
|> MaterialColor.fromColor
|
||||||
|> Font.color
|
|> Font.color
|
||||||
, Element.paddingXY 16 0
|
, Element.paddingXY 16 8
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -185,7 +188,7 @@ fullBleedItem palette =
|
|||||||
|
|
||||||
|
|
||||||
insetItem : Palette -> ItemStyle (InsetItemStyle msg) msg
|
insetItem : Palette -> ItemStyle (InsetItemStyle msg) msg
|
||||||
insetItem _ =
|
insetItem palette =
|
||||||
{ element = [ Element.padding 0 ]
|
{ element = [ Element.padding 0 ]
|
||||||
, content =
|
, content =
|
||||||
{ elementButton =
|
{ elementButton =
|
||||||
@ -200,19 +203,19 @@ insetItem _ =
|
|||||||
]
|
]
|
||||||
, otherwise =
|
, otherwise =
|
||||||
[ Element.mouseDown <|
|
[ Element.mouseDown <|
|
||||||
[ MaterialColor.gray
|
[ Palette.gray palette
|
||||||
|> MaterialColor.scaleOpacity MaterialColor.buttonPressedOpacity
|
|> MaterialColor.scaleOpacity MaterialColor.buttonPressedOpacity
|
||||||
|> MaterialColor.fromColor
|
|> MaterialColor.fromColor
|
||||||
|> Background.color
|
|> Background.color
|
||||||
]
|
]
|
||||||
, Element.focused <|
|
, Element.focused <|
|
||||||
[ MaterialColor.gray
|
[ Palette.gray palette
|
||||||
|> MaterialColor.scaleOpacity MaterialColor.buttonFocusOpacity
|
|> MaterialColor.scaleOpacity MaterialColor.buttonFocusOpacity
|
||||||
|> MaterialColor.fromColor
|
|> MaterialColor.fromColor
|
||||||
|> Background.color
|
|> Background.color
|
||||||
]
|
]
|
||||||
, Element.mouseOver <|
|
, Element.mouseOver <|
|
||||||
[ MaterialColor.gray
|
[ Palette.gray palette
|
||||||
|> MaterialColor.scaleOpacity MaterialColor.buttonHoverOpacity
|
|> MaterialColor.scaleOpacity MaterialColor.buttonHoverOpacity
|
||||||
|> MaterialColor.fromColor
|
|> MaterialColor.fromColor
|
||||||
|> Background.color
|
|> Background.color
|
||||||
@ -229,12 +232,12 @@ insetItem _ =
|
|||||||
]
|
]
|
||||||
, content =
|
, content =
|
||||||
{ size = 24
|
{ size = 24
|
||||||
, color = MaterialColor.gray
|
, color = Palette.gray palette
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
, content =
|
, content =
|
||||||
{ size = 24
|
{ size = 24
|
||||||
, color = MaterialColor.gray
|
, color = Palette.gray palette
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -243,7 +246,7 @@ insetItem _ =
|
|||||||
|
|
||||||
|
|
||||||
multiLineItem : Palette -> ItemStyle (MultiLineItemStyle msg) msg
|
multiLineItem : Palette -> ItemStyle (MultiLineItemStyle msg) msg
|
||||||
multiLineItem _ =
|
multiLineItem palette =
|
||||||
{ element = [ Element.padding 0 ]
|
{ element = [ Element.padding 0 ]
|
||||||
, content =
|
, content =
|
||||||
{ elementButton =
|
{ elementButton =
|
||||||
@ -258,19 +261,19 @@ multiLineItem _ =
|
|||||||
]
|
]
|
||||||
, otherwise =
|
, otherwise =
|
||||||
[ Element.mouseDown <|
|
[ Element.mouseDown <|
|
||||||
[ MaterialColor.gray
|
[ Palette.gray palette
|
||||||
|> MaterialColor.scaleOpacity MaterialColor.buttonPressedOpacity
|
|> MaterialColor.scaleOpacity MaterialColor.buttonPressedOpacity
|
||||||
|> MaterialColor.fromColor
|
|> MaterialColor.fromColor
|
||||||
|> Background.color
|
|> Background.color
|
||||||
]
|
]
|
||||||
, Element.focused <|
|
, Element.focused <|
|
||||||
[ MaterialColor.gray
|
[ Palette.gray palette
|
||||||
|> MaterialColor.scaleOpacity MaterialColor.buttonFocusOpacity
|
|> MaterialColor.scaleOpacity MaterialColor.buttonFocusOpacity
|
||||||
|> MaterialColor.fromColor
|
|> MaterialColor.fromColor
|
||||||
|> Background.color
|
|> Background.color
|
||||||
]
|
]
|
||||||
, Element.mouseOver <|
|
, Element.mouseOver <|
|
||||||
[ MaterialColor.gray
|
[ Palette.gray palette
|
||||||
|> MaterialColor.scaleOpacity MaterialColor.buttonHoverOpacity
|
|> MaterialColor.scaleOpacity MaterialColor.buttonHoverOpacity
|
||||||
|> MaterialColor.fromColor
|
|> MaterialColor.fromColor
|
||||||
|> Background.color
|
|> Background.color
|
||||||
@ -289,7 +292,7 @@ multiLineItem _ =
|
|||||||
, text =
|
, text =
|
||||||
{ elementText =
|
{ elementText =
|
||||||
Typography.body2
|
Typography.body2
|
||||||
++ [ MaterialColor.gray
|
++ [ Palette.gray palette
|
||||||
|> MaterialColor.fromColor
|
|> MaterialColor.fromColor
|
||||||
|> Font.color
|
|> Font.color
|
||||||
]
|
]
|
||||||
@ -303,12 +306,12 @@ multiLineItem _ =
|
|||||||
]
|
]
|
||||||
, content =
|
, content =
|
||||||
{ size = 24
|
{ size = 24
|
||||||
, color = MaterialColor.gray
|
, color = Palette.textGray palette
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
, content =
|
, content =
|
||||||
{ size = 24
|
{ size = 24
|
||||||
, color = MaterialColor.gray
|
, color = Palette.textGray palette
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -317,7 +320,7 @@ multiLineItem _ =
|
|||||||
|
|
||||||
|
|
||||||
imageItem : Palette -> ItemStyle (ImageItemStyle msg) msg
|
imageItem : Palette -> ItemStyle (ImageItemStyle msg) msg
|
||||||
imageItem _ =
|
imageItem palette =
|
||||||
{ element = [ Element.padding 0 ]
|
{ element = [ Element.padding 0 ]
|
||||||
, content =
|
, content =
|
||||||
{ elementButton =
|
{ elementButton =
|
||||||
@ -332,19 +335,19 @@ imageItem _ =
|
|||||||
]
|
]
|
||||||
, otherwise =
|
, otherwise =
|
||||||
[ Element.mouseDown <|
|
[ Element.mouseDown <|
|
||||||
[ MaterialColor.gray
|
[ Palette.gray palette
|
||||||
|> MaterialColor.scaleOpacity MaterialColor.buttonPressedOpacity
|
|> MaterialColor.scaleOpacity MaterialColor.buttonPressedOpacity
|
||||||
|> MaterialColor.fromColor
|
|> MaterialColor.fromColor
|
||||||
|> Background.color
|
|> Background.color
|
||||||
]
|
]
|
||||||
, Element.focused <|
|
, Element.focused <|
|
||||||
[ MaterialColor.gray
|
[ Palette.gray palette
|
||||||
|> MaterialColor.scaleOpacity MaterialColor.buttonFocusOpacity
|
|> MaterialColor.scaleOpacity MaterialColor.buttonFocusOpacity
|
||||||
|> MaterialColor.fromColor
|
|> MaterialColor.fromColor
|
||||||
|> Background.color
|
|> Background.color
|
||||||
]
|
]
|
||||||
, Element.mouseOver <|
|
, Element.mouseOver <|
|
||||||
[ MaterialColor.gray
|
[ Palette.gray palette
|
||||||
|> MaterialColor.scaleOpacity MaterialColor.buttonHoverOpacity
|
|> MaterialColor.scaleOpacity MaterialColor.buttonHoverOpacity
|
||||||
|> MaterialColor.fromColor
|
|> MaterialColor.fromColor
|
||||||
|> Background.color
|
|> Background.color
|
||||||
@ -366,7 +369,7 @@ imageItem _ =
|
|||||||
}
|
}
|
||||||
, content =
|
, content =
|
||||||
{ size = 24
|
{ size = 24
|
||||||
, color = MaterialColor.gray
|
, color = Palette.gray palette
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -419,7 +422,7 @@ selectItem palette =
|
|||||||
]
|
]
|
||||||
, ifDisabled =
|
, ifDisabled =
|
||||||
(Button.baseButton palette |> .ifDisabled)
|
(Button.baseButton palette |> .ifDisabled)
|
||||||
++ [ MaterialColor.gray
|
++ [ Palette.gray palette
|
||||||
|> MaterialColor.fromColor
|
|> MaterialColor.fromColor
|
||||||
|> Font.color
|
|> Font.color
|
||||||
, Element.mouseDown []
|
, Element.mouseDown []
|
||||||
@ -454,7 +457,7 @@ selectItem palette =
|
|||||||
}
|
}
|
||||||
, ifDisabled =
|
, ifDisabled =
|
||||||
{ size = 18
|
{ size = 18
|
||||||
, color = MaterialColor.gray
|
, color = Palette.gray palette
|
||||||
}
|
}
|
||||||
, otherwise =
|
, otherwise =
|
||||||
{ size = 18
|
{ size = 18
|
||||||
|
@ -13,7 +13,7 @@ import Element.Background as Background
|
|||||||
import Element.Border as Border
|
import Element.Border as Border
|
||||||
import Element.Font as Font
|
import Element.Font as Font
|
||||||
import Internal.List exposing (ColumnStyle, RowStyle)
|
import Internal.List exposing (ColumnStyle, RowStyle)
|
||||||
import Internal.Material.Palette exposing (Palette)
|
import Internal.Material.Palette as Palette exposing (Palette)
|
||||||
import Widget.Material.Color as MaterialColor
|
import Widget.Material.Color as MaterialColor
|
||||||
|
|
||||||
|
|
||||||
@ -88,6 +88,11 @@ cardColumn palette =
|
|||||||
[ Border.shadow <| MaterialColor.shadow 4 ]
|
[ Border.shadow <| MaterialColor.shadow 4 ]
|
||||||
, Element.alignTop
|
, Element.alignTop
|
||||||
, Border.rounded 4
|
, Border.rounded 4
|
||||||
|
, Border.width 1
|
||||||
|
, palette.on.surface
|
||||||
|
|> MaterialColor.scaleOpacity 0.14
|
||||||
|
|> MaterialColor.fromColor
|
||||||
|
|> Border.color
|
||||||
]
|
]
|
||||||
, content =
|
, content =
|
||||||
{ element =
|
{ element =
|
||||||
@ -119,12 +124,6 @@ cardColumn palette =
|
|||||||
, bottomLeft = 0
|
, bottomLeft = 0
|
||||||
, bottomRight = 0
|
, bottomRight = 0
|
||||||
}
|
}
|
||||||
, Border.widthEach
|
|
||||||
{ top = 1
|
|
||||||
, left = 1
|
|
||||||
, right = 1
|
|
||||||
, bottom = 0
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
, ifLast =
|
, ifLast =
|
||||||
[ Border.roundEach
|
[ Border.roundEach
|
||||||
@ -133,21 +132,9 @@ cardColumn palette =
|
|||||||
, bottomLeft = 4
|
, bottomLeft = 4
|
||||||
, bottomRight = 4
|
, bottomRight = 4
|
||||||
}
|
}
|
||||||
, Border.widthEach
|
|
||||||
{ top = 0
|
|
||||||
, left = 1
|
|
||||||
, right = 1
|
|
||||||
, bottom = 1
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
, otherwise =
|
, otherwise =
|
||||||
[ Border.rounded 0
|
[ Border.rounded 0
|
||||||
, Border.widthEach
|
|
||||||
{ top = 0
|
|
||||||
, left = 1
|
|
||||||
, right = 1
|
|
||||||
, bottom = 0
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -160,14 +147,14 @@ sideSheet palette =
|
|||||||
++ [ Element.width <| Element.maximum 360 <| Element.fill
|
++ [ Element.width <| Element.maximum 360 <| Element.fill
|
||||||
, Element.height <| Element.fill
|
, Element.height <| Element.fill
|
||||||
, Element.paddingXY 0 8
|
, Element.paddingXY 0 8
|
||||||
, MaterialColor.gray
|
, Palette.gray palette
|
||||||
|> MaterialColor.fromColor
|
|> MaterialColor.fromColor
|
||||||
|> Border.color
|
|> Border.color
|
||||||
]
|
]
|
||||||
, content =
|
, content =
|
||||||
{ element =
|
{ element =
|
||||||
[ Element.width <| Element.fill
|
[ Element.width <| Element.fill
|
||||||
, MaterialColor.gray
|
, Palette.gray palette
|
||||||
|> MaterialColor.fromColor
|
|> MaterialColor.fromColor
|
||||||
|> Border.color
|
|> Border.color
|
||||||
]
|
]
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
module Internal.Material.Palette exposing (Palette, darkPalette, defaultPalette)
|
module Internal.Material.Palette exposing (Palette, darkPalette, defaultPalette, gray, lightGray, textGray)
|
||||||
|
|
||||||
import Color exposing (Color)
|
import Color exposing (Color)
|
||||||
|
import Widget.Material.Color as MaterialColor
|
||||||
|
|
||||||
|
|
||||||
type alias Palette =
|
type alias Palette =
|
||||||
@ -51,3 +52,21 @@ darkPalette =
|
|||||||
, error = Color.rgb255 0x00 0x00 0x00
|
, error = Color.rgb255 0x00 0x00 0x00
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
gray : Palette -> Color
|
||||||
|
gray palette =
|
||||||
|
palette.surface
|
||||||
|
|> MaterialColor.withShade palette.on.surface 0.5
|
||||||
|
|
||||||
|
|
||||||
|
lightGray : Palette -> Color
|
||||||
|
lightGray palette =
|
||||||
|
palette.surface
|
||||||
|
|> MaterialColor.withShade palette.on.surface 0.14
|
||||||
|
|
||||||
|
|
||||||
|
textGray : Palette -> Color
|
||||||
|
textGray palette =
|
||||||
|
palette.surface
|
||||||
|
|> MaterialColor.withShade palette.on.surface 0.77
|
||||||
|
@ -5,7 +5,7 @@ import Element
|
|||||||
import Element.Background as Background
|
import Element.Background as Background
|
||||||
import Element.Border as Border
|
import Element.Border as Border
|
||||||
import Html.Attributes as Attributes
|
import Html.Attributes as Attributes
|
||||||
import Internal.Material.Palette exposing (Palette)
|
import Internal.Material.Palette as Palette exposing (Palette)
|
||||||
import Internal.Switch exposing (SwitchStyle)
|
import Internal.Switch exposing (SwitchStyle)
|
||||||
import Widget.Material.Color as MaterialColor
|
import Widget.Material.Color as MaterialColor
|
||||||
|
|
||||||
@ -30,7 +30,8 @@ switch palette =
|
|||||||
, ifDisabled =
|
, ifDisabled =
|
||||||
[ Element.htmlAttribute <| Attributes.style "cursor" "not-allowed"
|
[ Element.htmlAttribute <| Attributes.style "cursor" "not-allowed"
|
||||||
, palette.surface
|
, palette.surface
|
||||||
|> MaterialColor.withShade MaterialColor.gray (0.5 * MaterialColor.buttonDisabledOpacity)
|
|> MaterialColor.withShade (Palette.gray palette)
|
||||||
|
(0.5 * MaterialColor.buttonDisabledOpacity)
|
||||||
|> MaterialColor.fromColor
|
|> MaterialColor.fromColor
|
||||||
|> Background.color
|
|> Background.color
|
||||||
]
|
]
|
||||||
@ -41,7 +42,7 @@ switch palette =
|
|||||||
|> Background.color
|
|> Background.color
|
||||||
]
|
]
|
||||||
, otherwise =
|
, otherwise =
|
||||||
[ MaterialColor.gray
|
[ Palette.gray palette
|
||||||
|> MaterialColor.scaleOpacity 0.5
|
|> MaterialColor.scaleOpacity 0.5
|
||||||
|> MaterialColor.fromColor
|
|> MaterialColor.fromColor
|
||||||
|> Background.color
|
|> Background.color
|
||||||
|
@ -6,7 +6,7 @@ import Element.Border as Border
|
|||||||
import Element.Font as Font
|
import Element.Font as Font
|
||||||
import Internal.Button exposing (ButtonStyle)
|
import Internal.Button exposing (ButtonStyle)
|
||||||
import Internal.Material.Button as Button
|
import Internal.Material.Button as Button
|
||||||
import Internal.Material.Palette exposing (Palette)
|
import Internal.Material.Palette as Palette exposing (Palette)
|
||||||
import Internal.Tab exposing (TabStyle)
|
import Internal.Tab exposing (TabStyle)
|
||||||
import Widget.Material.Color as MaterialColor
|
import Widget.Material.Color as MaterialColor
|
||||||
import Widget.Material.Typography as Typography
|
import Widget.Material.Typography as Typography
|
||||||
@ -44,7 +44,7 @@ tabButton palette =
|
|||||||
]
|
]
|
||||||
, ifDisabled =
|
, ifDisabled =
|
||||||
(Button.baseButton palette |> .ifDisabled)
|
(Button.baseButton palette |> .ifDisabled)
|
||||||
++ [ MaterialColor.gray
|
++ [ Palette.gray palette
|
||||||
|> MaterialColor.fromColor
|
|> MaterialColor.fromColor
|
||||||
|> Font.color
|
|> Font.color
|
||||||
, Element.mouseDown []
|
, Element.mouseDown []
|
||||||
@ -77,7 +77,7 @@ tabButton palette =
|
|||||||
}
|
}
|
||||||
, ifDisabled =
|
, ifDisabled =
|
||||||
{ size = 18
|
{ size = 18
|
||||||
, color = MaterialColor.gray
|
, color = Palette.gray palette
|
||||||
}
|
}
|
||||||
, otherwise =
|
, otherwise =
|
||||||
{ size = 18
|
{ size = 18
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
module Widget.Material exposing
|
module Widget.Material exposing
|
||||||
( Palette, defaultPalette, darkPalette
|
( Palette, defaultPalette, darkPalette, gray
|
||||||
, containedButton, outlinedButton, textButton
|
, containedButton, outlinedButton, textButton
|
||||||
, iconButton, toggleButton, buttonRow
|
, iconButton, toggleButton, buttonRow
|
||||||
, switch
|
, switch
|
||||||
@ -16,6 +16,7 @@ module Widget.Material exposing
|
|||||||
, sortTable
|
, sortTable
|
||||||
, snackbar
|
, snackbar
|
||||||
, tab, tabButton
|
, tab, tabButton
|
||||||
|
, textGray
|
||||||
)
|
)
|
||||||
|
|
||||||
{-| This module implements a Material design theme for all widgets.
|
{-| This module implements a Material design theme for all widgets.
|
||||||
@ -33,7 +34,7 @@ If you have any suggestions or improvements, be sure to leave a [PR or a Issue](
|
|||||||
|
|
||||||
# Palette
|
# Palette
|
||||||
|
|
||||||
@docs Palette, defaultPalette, darkPalette
|
@docs Palette, defaultPalette, darkPalette, gray
|
||||||
|
|
||||||
|
|
||||||
# Button
|
# Button
|
||||||
@ -213,6 +214,27 @@ darkPalette =
|
|||||||
Palette.darkPalette
|
Palette.darkPalette
|
||||||
|
|
||||||
|
|
||||||
|
{-| generates a "grayish 50%" color that matches the on-surface color.
|
||||||
|
-}
|
||||||
|
gray : Palette -> Color
|
||||||
|
gray =
|
||||||
|
Palette.gray
|
||||||
|
|
||||||
|
|
||||||
|
{-| generates a "grayish 14%" color that matches the on-surface color.
|
||||||
|
-}
|
||||||
|
lightGray : Palette -> Color
|
||||||
|
lightGray =
|
||||||
|
Palette.lightGray
|
||||||
|
|
||||||
|
|
||||||
|
{-| generates a grayer text color
|
||||||
|
-}
|
||||||
|
textGray : Palette -> Color
|
||||||
|
textGray =
|
||||||
|
Palette.textGray
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
-- B U T T O N
|
-- B U T T O N
|
||||||
|
@ -2,8 +2,9 @@ module Widget.Material.Color exposing
|
|||||||
( buttonHoverOpacity, buttonFocusOpacity, buttonPressedOpacity, buttonDisabledOpacity, buttonSelectedOpacity
|
( buttonHoverOpacity, buttonFocusOpacity, buttonPressedOpacity, buttonDisabledOpacity, buttonSelectedOpacity
|
||||||
, accessibleTextColor, accessibleWithTextColor
|
, accessibleTextColor, accessibleWithTextColor
|
||||||
, withShade, scaleOpacity
|
, withShade, scaleOpacity
|
||||||
, dark, gray
|
, dark
|
||||||
, toCIELCH, fromCIELCH, shadow, fromColor, textAndBackground
|
, toCIELCH, fromCIELCH, shadow, fromColor, textAndBackground
|
||||||
|
, gray
|
||||||
)
|
)
|
||||||
|
|
||||||
{-| This module contains functions to adapt color in various ways.
|
{-| This module contains functions to adapt color in various ways.
|
||||||
@ -33,13 +34,18 @@ then the javascript material design implementation.
|
|||||||
|
|
||||||
## Predefined Colors
|
## Predefined Colors
|
||||||
|
|
||||||
@docs dark, gray
|
@docs dark
|
||||||
|
|
||||||
|
|
||||||
## Utility Functions
|
## Utility Functions
|
||||||
|
|
||||||
@docs toCIELCH, fromCIELCH, shadow, fromColor, textAndBackground
|
@docs toCIELCH, fromCIELCH, shadow, fromColor, textAndBackground
|
||||||
|
|
||||||
|
|
||||||
|
## DEPRECATED
|
||||||
|
|
||||||
|
@docs gray
|
||||||
|
|
||||||
-}
|
-}
|
||||||
|
|
||||||
import Color exposing (Color)
|
import Color exposing (Color)
|
||||||
@ -237,7 +243,7 @@ scaleOpacity opacity =
|
|||||||
>> Color.fromRgba
|
>> Color.fromRgba
|
||||||
|
|
||||||
|
|
||||||
{-| gray
|
{-| DEPRECATED use Material.gray instead.
|
||||||
-}
|
-}
|
||||||
gray : Color
|
gray : Color
|
||||||
gray =
|
gray =
|
||||||
|
Loading…
Reference in New Issue
Block a user