From e8e381675e4bc945dc714619821541986180cdcd Mon Sep 17 00:00:00 2001 From: Irwin Zaid Date: Sun, 18 Sep 2016 18:40:37 +0100 Subject: [PATCH 1/3] Added paper-listbox --- assets/bower.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/assets/bower.json b/assets/bower.json index e01ef9b..a619179 100644 --- a/assets/bower.json +++ b/assets/bower.json @@ -52,6 +52,7 @@ "paper-dropdown-menu": "PolymerElements/paper-dropdown-menu#^1.0.0", "neon-animation": "PolymerElements/neon-animation#^1.0.0", "paper-icon-button": "PolymerElements/paper-icon-button#^1.0.0", - "code-mirror": "shashi/code-mirror#master" + "code-mirror": "shashi/code-mirror#master", + "paper-listbox": "polymerelements/paper-listbox#^1.1.2" } } From 103c343dc54ebcef62c78cbf73d759fc6355d592 Mon Sep 17 00:00:00 2001 From: Irwin Zaid Date: Sun, 18 Sep 2016 18:43:03 +0100 Subject: [PATCH 2/3] Added missing files --- assets/bower.json | 2 +- .../bower_components/paper-listbox/README.md | 5 + .../bower_components/paper-listbox/bower.json | 38 ++++++++ .../paper-listbox/demo/index.html | 93 ++++++++++++++++++ .../bower_components/paper-listbox/hero.svg | 35 +++++++ .../bower_components/paper-listbox/index.html | 30 ++++++ .../paper-listbox/paper-listbox.html | 96 +++++++++++++++++++ .../paper-listbox/test/index.html | 34 +++++++ .../paper-listbox/test/paper-listbox.html | 64 +++++++++++++ 9 files changed, 396 insertions(+), 1 deletion(-) create mode 100644 assets/bower_components/paper-listbox/README.md create mode 100644 assets/bower_components/paper-listbox/bower.json create mode 100644 assets/bower_components/paper-listbox/demo/index.html create mode 100755 assets/bower_components/paper-listbox/hero.svg create mode 100644 assets/bower_components/paper-listbox/index.html create mode 100644 assets/bower_components/paper-listbox/paper-listbox.html create mode 100644 assets/bower_components/paper-listbox/test/index.html create mode 100644 assets/bower_components/paper-listbox/test/paper-listbox.html diff --git a/assets/bower.json b/assets/bower.json index a619179..c1da51d 100644 --- a/assets/bower.json +++ b/assets/bower.json @@ -53,6 +53,6 @@ "neon-animation": "PolymerElements/neon-animation#^1.0.0", "paper-icon-button": "PolymerElements/paper-icon-button#^1.0.0", "code-mirror": "shashi/code-mirror#master", - "paper-listbox": "polymerelements/paper-listbox#^1.1.2" + "paper-listbox": "PolymerElements/paper-listbox#^1.1.2" } } diff --git a/assets/bower_components/paper-listbox/README.md b/assets/bower_components/paper-listbox/README.md new file mode 100644 index 0000000..95f0106 --- /dev/null +++ b/assets/bower_components/paper-listbox/README.md @@ -0,0 +1,5 @@ +# paper-listbox + +![Build status](https://api.travis-ci.org/PolymerElements/paper-listbox.svg?branch=master) + +`` implements an accessible listbox control with Material Design styling. diff --git a/assets/bower_components/paper-listbox/bower.json b/assets/bower_components/paper-listbox/bower.json new file mode 100644 index 0000000..66a0910 --- /dev/null +++ b/assets/bower_components/paper-listbox/bower.json @@ -0,0 +1,38 @@ +{ + "name": "paper-listbox", + "version": "1.1.2", + "description": "Implements an accessible material design listbox", + "authors": "The Polymer Authors", + "keywords": [ + "web-components", + "polymer", + "listbox" + ], + "main": [ + "paper-listbox.html", + "paper-sublistbox.html" + ], + "private": true, + "repository": { + "type": "git", + "url": "git://github.com/PolymerElements/paper-listbox" + }, + "license": "http://polymer.github.io/LICENSE.txt", + "homepage": "https://github.com/PolymerElements/paper-listbox", + "ignore": [], + "dependencies": { + "polymer": "Polymer/polymer#^1.1.0", + "iron-behaviors": "PolymerElements/iron-behaviors#^1.0.0", + "iron-collapse": "PolymerElements/iron-collapse#^1.0.0", + "iron-menu-behavior": "PolymerElements/iron-menu-behavior#^1.0.0", + "paper-styles": "PolymerElements/paper-styles#^1.0.0" + }, + "devDependencies": { + "iron-component-page": "PolymerElements/iron-component-page#^1.0.0", + "iron-test-helpers": "PolymerElements/iron-test-helpers#^1.0.0", + "paper-item": "PolymerElements/paper-item#^1.0.0", + "test-fixture": "PolymerElements/test-fixture#^1.0.0", + "web-component-tester": "Polymer/web-component-tester#^3.4.0", + "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" + } +} diff --git a/assets/bower_components/paper-listbox/demo/index.html b/assets/bower_components/paper-listbox/demo/index.html new file mode 100644 index 0000000..c79e63e --- /dev/null +++ b/assets/bower_components/paper-listbox/demo/index.html @@ -0,0 +1,93 @@ + + + + + + + + + + paper-listbox demo + + + + + + + + + + + +
+
+

Standard

+
+ + Inbox + Starred + Sent mail + Drafts + +
+
+ +
+

Pre-selected

+
+ + Inbox + Starred + Sent mail + Drafts + +
+
+ +
+

Multi-select

+
+ + Bold + Italic + Underline + Strikethrough + +
+
+
+ + diff --git a/assets/bower_components/paper-listbox/hero.svg b/assets/bower_components/paper-listbox/hero.svg new file mode 100755 index 0000000..eaa0fb5 --- /dev/null +++ b/assets/bower_components/paper-listbox/hero.svg @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/bower_components/paper-listbox/index.html b/assets/bower_components/paper-listbox/index.html new file mode 100644 index 0000000..b9dad4b --- /dev/null +++ b/assets/bower_components/paper-listbox/index.html @@ -0,0 +1,30 @@ + + + + + + + + + paper-listbox + + + + + + + + + + + + + diff --git a/assets/bower_components/paper-listbox/paper-listbox.html b/assets/bower_components/paper-listbox/paper-listbox.html new file mode 100644 index 0000000..15d6cf0 --- /dev/null +++ b/assets/bower_components/paper-listbox/paper-listbox.html @@ -0,0 +1,96 @@ + + + + + + + + + + + + + diff --git a/assets/bower_components/paper-listbox/test/index.html b/assets/bower_components/paper-listbox/test/index.html new file mode 100644 index 0000000..59a5e2b --- /dev/null +++ b/assets/bower_components/paper-listbox/test/index.html @@ -0,0 +1,34 @@ + + + + + + paper-listbox tests + + + + + + + + + + + + + + diff --git a/assets/bower_components/paper-listbox/test/paper-listbox.html b/assets/bower_components/paper-listbox/test/paper-listbox.html new file mode 100644 index 0000000..58a4fa3 --- /dev/null +++ b/assets/bower_components/paper-listbox/test/paper-listbox.html @@ -0,0 +1,64 @@ + + + + + + paper-listbox tests + + + + + + + + + + + + + + + + + + + + + From 616d60efcf3b47327c79291aa035e4a3d1df62ef Mon Sep 17 00:00:00 2001 From: Irwin Zaid Date: Sun, 18 Sep 2016 22:31:04 +0100 Subject: [PATCH 3/3] Added listbox example --- assets/layout2.html | 1 + examples/listbox.jl | 22 ++++++++++++++++++++++ src/library/layout2.jl | 30 +++++++++++++++++++++++++++++- 3 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 examples/listbox.jl diff --git a/assets/layout2.html b/assets/layout2.html index 79c9228..a5fd945 100644 --- a/assets/layout2.html +++ b/assets/layout2.html @@ -7,3 +7,4 @@ + diff --git a/examples/listbox.jl b/examples/listbox.jl new file mode 100644 index 0000000..edc11b9 --- /dev/null +++ b/examples/listbox.jl @@ -0,0 +1,22 @@ +import Escher: slider, listbox, wrapitem, menu + +main(window) = begin + push!(window.assets, "layout2") + push!(window.assets, "icons") + push!(window.assets, "widgets") + +# l = listbox(["1", "2", "3"]) +# res = render(l, Dict()) +# show(res) + + s = Signal(1) + l = listbox(["a", "b", "c"]) + + connected_l = subscribe(s, l) + + map(s) do x + println(x) + + connected_l + end +end diff --git a/src/library/layout2.jl b/src/library/layout2.jl index 635505c..f41ed73 100644 --- a/src/library/layout2.jl +++ b/src/library/layout2.jl @@ -7,7 +7,8 @@ export tabs, menuitem, icon, iconbutton, - toolbar + toolbar, + listbox # Higher-order layouts: e.g. tabs, pages # Icons and icon button @@ -215,3 +216,30 @@ render(dm::DropdownMenu, state) = begin ) end wrapbehavior(d::DropdownMenu) = selectable(d, selector=".dropdown-content") + + +@api listbox => (ListBox <: Selection) begin + doc("A list box.") + arg( + items::TileList, + doc="list-box items. Some of the items can also be sub-menus" + ) + kwarg( + multi::Bool=false, + doc="Can multiple items be selected? If set, output signal contains a vector of indices" + ) + kwarg(selected::Integer=1, doc="Index of the currently selected menu item.") + + +# arg(date::Date=today(), doc=md"The date. Requires the `Dates` module on Julia v0.3") +# kwarg( +# range::Range{Date}=Date("1971-01-01"):Date("2100-12-31"), +# doc="The range of selectable dates." +# ) +end +render(l::ListBox, state) = + Elem("paper-listbox", + map(x -> render(wrapitem(x), state), l.items.tiles) +# attributes = @d(:selected=>l.selected-1, :multi=>boolattr(l.multi)) + ) +wrapbehavior(l::ListBox) = selectable(l)