voom-presenters 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +1 -1
- data/Gemfile.lock +5 -5
- data/app/demo/components/date_fields.pom +2 -2
- data/app/demo/components/datetime_fields.pom +6 -5
- data/app/demo/components/headers.pom +5 -0
- data/app/demo/components/lists.pom +11 -0
- data/app/demo/components/time_fields.pom +2 -2
- data/app/demo/events/actions/dialogs/trigger.pom +2 -2
- data/app/demo/events/actions/toggle_visiblity.pom +4 -4
- data/app/demo/shared/context_list.pom +1 -1
- data/component-status.yml +11 -11
- data/lib/voom/presenters/dsl/components/button.rb +2 -2
- data/lib/voom/presenters/dsl/components/checkbox.rb +2 -1
- data/lib/voom/presenters/dsl/components/datetime_base.rb +2 -1
- data/lib/voom/presenters/dsl/components/event.rb +25 -6
- data/lib/voom/presenters/dsl/components/expansion_panel.rb +3 -0
- data/lib/voom/presenters/dsl/components/header.rb +23 -0
- data/lib/voom/presenters/dsl/components/icon_toggle.rb +2 -2
- data/lib/voom/presenters/dsl/components/list.rb +18 -4
- data/lib/voom/presenters/dsl/components/lists/action.rb +1 -1
- data/lib/voom/presenters/dsl/components/lists/header.rb +19 -0
- data/lib/voom/presenters/dsl/components/lists/line.rb +15 -5
- data/lib/voom/presenters/dsl/components/menu.rb +2 -1
- data/lib/voom/presenters/dsl/components/mixins/typography.rb +0 -1
- data/lib/voom/presenters/dsl/components/toggle_base.rb +2 -2
- data/lib/voom/presenters/version.rb +1 -1
- data/lib/voom/presenters/web_client/app.rb +23 -5
- data/public/bundle.css +266 -153
- data/public/bundle.js +148 -41
- data/scripts/bump.sh +3 -0
- data/scripts/deploy-demo.sh +2 -0
- data/scripts/release.sh +4 -0
- data/views/mdc/assets/js/components/datetime.js +9 -5
- data/views/mdc/assets/js/components/events.js +6 -7
- data/views/mdc/assets/js/components/events/clears.js +26 -0
- data/views/mdc/assets/js/components/events/toggle_visibility.js +26 -0
- data/views/mdc/assets/js/components/forms.js +8 -0
- data/views/mdc/assets/js/components/lists.js +84 -1
- data/views/mdc/assets/js/components/text-fields.js +8 -0
- data/views/mdc/assets/scss/components/datetime.scss +5 -0
- data/views/mdc/assets/scss/components/list.scss +11 -0
- data/views/mdc/assets/scss/theme.scss +49 -2
- data/views/mdc/body/drawer.erb +2 -2
- data/views/mdc/body/header.erb +6 -0
- data/views/mdc/components/checkbox.erb +4 -1
- data/views/mdc/components/datetime.erb +2 -2
- data/views/mdc/components/expansion_panel.erb +1 -1
- data/views/mdc/components/list.erb +2 -1
- data/views/mdc/components/list/checkbox.erb +1 -1
- data/views/mdc/components/list/header.erb +35 -0
- data/views/mdc/components/list/line.erb +2 -1
- data/views/mdc/components/menu.erb +1 -1
- metadata +9 -4
- data/views/mdc/assets/js/components/events/selects.js +0 -28
- data/views/mdc/assets/js/components/events/toggle_visiblity.js +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae9fe537c82c38d72bd3c5b1b8b4039fa1eda4acb8e239d99606fae2e863b54a
|
4
|
+
data.tar.gz: 5bf2378799b7c857993bb311d6c011620fcfc91d57279c11c8294485af6a6842
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cca44edbb9a96d37245af4f362df6229d19646f0631616abcb0800958259e72c991c5c35a0702cc68bb04dd04518253c94f27ce29a08ef2328f3eac6d65b0f0f
|
7
|
+
data.tar.gz: 3b17dae8e2bf6111c0e015c93749e1ffa855f90579dcbd8a98f7ced7c07c9a455fdc5a5f01387753cb77983980db6d6e3d952baf4df25d380ff4c563e5f4f703
|
data/.circleci/config.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
voom-presenters (0.1.
|
4
|
+
voom-presenters (0.1.7)
|
5
5
|
dry-configurable (> 0.1, <= 7.0)
|
6
6
|
dry-container (~> 0.6)
|
7
7
|
dry-inflector (~> 0.1)
|
@@ -38,8 +38,8 @@ GEM
|
|
38
38
|
coderay (~> 1.1.0)
|
39
39
|
method_source (~> 0.8.1)
|
40
40
|
slop (~> 3.4)
|
41
|
-
rack (2.0.
|
42
|
-
rack-protection (2.0.
|
41
|
+
rack (2.0.5)
|
42
|
+
rack-protection (2.0.3)
|
43
43
|
rack
|
44
44
|
rack-test (0.8.2)
|
45
45
|
rack (>= 1.0, < 3)
|
@@ -72,10 +72,10 @@ GEM
|
|
72
72
|
json (>= 1.8, < 3)
|
73
73
|
simplecov-html (~> 0.10.0)
|
74
74
|
simplecov-html (0.10.2)
|
75
|
-
sinatra (2.0.
|
75
|
+
sinatra (2.0.3)
|
76
76
|
mustermann (~> 1.0)
|
77
77
|
rack (~> 2.0)
|
78
|
-
rack-protection (= 2.0.
|
78
|
+
rack-protection (= 2.0.3)
|
79
79
|
tilt (~> 2.0)
|
80
80
|
slop (3.6.0)
|
81
81
|
thread_safe (0.3.6)
|
@@ -30,12 +30,12 @@ Voom::Presenters.define(:date_fields) do
|
|
30
30
|
label 'Select your date to skydive'
|
31
31
|
icon :event
|
32
32
|
event :change do
|
33
|
-
replaces :context_list, :context_list
|
33
|
+
replaces :context_list, :context_list
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
37
37
|
column 6 do
|
38
|
-
attach :context_list
|
38
|
+
attach :context_list
|
39
39
|
end
|
40
40
|
end
|
41
41
|
grid do
|
@@ -27,16 +27,17 @@ Voom::Presenters.define(:datetime_fields) do
|
|
27
27
|
grid do
|
28
28
|
column 6 do
|
29
29
|
datetime_field name: :skydive_at,
|
30
|
-
format: 'F j, Y h:i' do
|
30
|
+
format: 'F j, Y h:i K' do
|
31
|
+
value Time.new(2019, 10, 31)
|
31
32
|
label 'Select your date and time to skydive'
|
32
33
|
icon :event
|
33
34
|
event :change do
|
34
|
-
replaces :context_list, :context_list
|
35
|
+
replaces :context_list, :context_list
|
35
36
|
end
|
36
37
|
end
|
37
38
|
end
|
38
39
|
column 6 do
|
39
|
-
attach :context_list
|
40
|
+
attach :context_list
|
40
41
|
end
|
41
42
|
end
|
42
43
|
grid do
|
@@ -50,8 +51,8 @@ Voom::Presenters.define(:datetime_fields) do
|
|
50
51
|
title 'Min Date (today)'
|
51
52
|
datetime_field min_date: :today
|
52
53
|
|
53
|
-
title 'Min (today), Max (
|
54
|
-
datetime_field min_date: :today, max_date:
|
54
|
+
title 'Min (today), Max (Halloween 2025)'
|
55
|
+
datetime_field min_date: :today, max_date: Time.new(2025, 10, 31) # Or in rails Time.now + 14.days
|
55
56
|
|
56
57
|
title 'Disabling specific dates'
|
57
58
|
datetime_field disable: ["2025-01-30", "2025-02-21", "2025-03-08", DateTime.new(2025, 4, 9)]
|
@@ -8,6 +8,10 @@ Voom::Presenters.define(:headers) do
|
|
8
8
|
|
9
9
|
|
10
10
|
header 'Presenters Demo' do
|
11
|
+
page_title 'Page about headers' do
|
12
|
+
icon :subtitles
|
13
|
+
end
|
14
|
+
|
11
15
|
menu do
|
12
16
|
item 'About (Header)' do
|
13
17
|
event :click do
|
@@ -29,6 +33,7 @@ Voom::Presenters.define(:headers) do
|
|
29
33
|
end
|
30
34
|
end
|
31
35
|
|
36
|
+
|
32
37
|
indented_grid do
|
33
38
|
display 'Headers'
|
34
39
|
|
@@ -119,6 +119,17 @@ Voom::Presenters.define(:lists) do
|
|
119
119
|
# end
|
120
120
|
# end
|
121
121
|
|
122
|
+
headline 'Selectable List'
|
123
|
+
list selectable: true do
|
124
|
+
actors.each do |actor|
|
125
|
+
line do
|
126
|
+
text actor.name
|
127
|
+
avatar :person
|
128
|
+
subtitle "#{actor.episodes} episodes"
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
122
133
|
attach :code, file: __FILE__
|
123
134
|
end
|
124
135
|
end
|
@@ -30,12 +30,12 @@ Voom::Presenters.define(:time_fields) do
|
|
30
30
|
label 'Select your time to skydive'
|
31
31
|
icon :event
|
32
32
|
event :change do
|
33
|
-
replaces :context_list, :context_list
|
33
|
+
replaces :context_list, :context_list
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
37
37
|
column 6 do
|
38
|
-
attach :context_list
|
38
|
+
attach :context_list
|
39
39
|
end
|
40
40
|
end
|
41
41
|
grid do
|
@@ -24,9 +24,9 @@ Voom::Presenters.define(:trigger_dialog) do
|
|
24
24
|
attach :replace_text
|
25
25
|
|
26
26
|
subheading 'Toggle Visibility'
|
27
|
-
button 'toggle
|
27
|
+
button 'toggle visibility' do
|
28
28
|
event :click do
|
29
|
-
|
29
|
+
toggle_visibility :toggle_me
|
30
30
|
end
|
31
31
|
end
|
32
32
|
heading 'Sometimes I appear', id: :toggle_me
|
@@ -5,14 +5,14 @@ Voom::Presenters.define(:toggle_visibility_action) do
|
|
5
5
|
|
6
6
|
indented_grid do
|
7
7
|
heading 'Toggle Visibility'
|
8
|
-
body 'Allows you to toggle
|
8
|
+
body 'Allows you to toggle visibility of content on and off on events.',
|
9
9
|
'Takes the id of the element to toggle.',
|
10
|
-
"Optionally takes :on or :off to force
|
10
|
+
"Optionally takes :on or :off to force visibility."
|
11
11
|
|
12
12
|
subheading 'Toggle Visibility'
|
13
|
-
button 'toggle
|
13
|
+
button 'toggle visibility' do
|
14
14
|
event :click do
|
15
|
-
|
15
|
+
toggle_visibility :toggle_me
|
16
16
|
end
|
17
17
|
end
|
18
18
|
heading 'Sometimes I appear', id: :toggle_me
|
data/component-status.yml
CHANGED
@@ -29,8 +29,8 @@
|
|
29
29
|
MDL:
|
30
30
|
MDC:
|
31
31
|
Priority:
|
32
|
-
Completeness:
|
33
|
-
Notes:
|
32
|
+
Completeness: 2
|
33
|
+
Notes: Needs absolute placement so a scroll does not hide the FAB.
|
34
34
|
-
|
35
35
|
Components: Cards
|
36
36
|
Implementation: MDL
|
@@ -60,9 +60,9 @@
|
|
60
60
|
Implementation: MDL
|
61
61
|
MDL:
|
62
62
|
MDC: Y
|
63
|
-
Priority:
|
64
|
-
Completeness:
|
65
|
-
Notes:
|
63
|
+
Priority: High
|
64
|
+
Completeness: 1
|
65
|
+
Notes: Current implementation from MDL and polyfil does not work on iOS/Safari. Port to MDC.
|
66
66
|
-
|
67
67
|
Components: Dividers
|
68
68
|
Implementation: N
|
@@ -113,12 +113,12 @@
|
|
113
113
|
Notes:
|
114
114
|
-
|
115
115
|
Components: Pickers
|
116
|
-
Implementation:
|
116
|
+
Implementation: Flatpickr
|
117
117
|
MDL: N
|
118
118
|
MDC: N
|
119
119
|
Priority: medium
|
120
|
-
Completeness:
|
121
|
-
Notes:
|
120
|
+
Completeness: 3
|
121
|
+
Notes: Date, time, datetime are supported.
|
122
122
|
-
|
123
123
|
Components: Progress & activity
|
124
124
|
Implementation: N
|
@@ -134,7 +134,7 @@
|
|
134
134
|
MDC: Y
|
135
135
|
Priority:
|
136
136
|
Completeness: 1
|
137
|
-
Notes: The checkboxes and radio buttons from MDL need to be ported.
|
137
|
+
Notes: The checkboxes and radio buttons from MDL need to be ported to MDC.
|
138
138
|
-
|
139
139
|
Components: Select fields
|
140
140
|
Implementation: MDC
|
@@ -214,6 +214,6 @@
|
|
214
214
|
Implementation: N
|
215
215
|
MDL: N
|
216
216
|
MDC: N
|
217
|
-
Priority:
|
217
|
+
Priority: medium
|
218
218
|
Completeness:
|
219
|
-
Notes:
|
219
|
+
Notes: Need extension/plugin design with ace editor and charts as available plugins.
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require_relative 'mixins/common'
|
2
|
-
require_relative 'mixins/event'
|
3
2
|
require_relative 'mixins/tooltips'
|
4
3
|
|
5
4
|
module Voom
|
@@ -8,6 +7,7 @@ module Voom
|
|
8
7
|
module Components
|
9
8
|
class Button < EventBase
|
10
9
|
include Mixins::Tooltips
|
10
|
+
|
11
11
|
BUTTON_TYPES = %i(raised flat fab icon)
|
12
12
|
|
13
13
|
attr_accessor :text, :icon, :button_type, :color, :disabled, :size, :position
|
@@ -18,7 +18,7 @@ module Voom
|
|
18
18
|
self.icon(attribs.delete(:icon)) if attribs.key?(:icon)
|
19
19
|
@text = attribs.delete(:text)
|
20
20
|
@color = attribs.delete(:color)
|
21
|
-
@disabled = attribs.delete(:disabled)
|
21
|
+
@disabled = attribs.delete(:disabled) { false }
|
22
22
|
@size = attribs.delete(:size)
|
23
23
|
@position = Array(attribs.delete(:position)).compact
|
24
24
|
expand!
|
@@ -59,18 +59,25 @@ module Voom
|
|
59
59
|
params: params, &block)
|
60
60
|
end
|
61
61
|
|
62
|
-
def
|
62
|
+
def toggle_visibility(component_id, **params, &block)
|
63
63
|
@actions << Components::Action.new(parent: self,
|
64
64
|
type: :toggle_visibility,
|
65
65
|
target: component_id,
|
66
66
|
params: params, &block)
|
67
67
|
end
|
68
68
|
|
69
|
-
def
|
69
|
+
def show(component_id, **params, &block)
|
70
70
|
@actions << Components::Action.new(parent: self,
|
71
|
-
type: :
|
72
|
-
target:
|
73
|
-
params: params, &block)
|
71
|
+
type: :toggle_visibility,
|
72
|
+
target: component_id,
|
73
|
+
params: params.merge(action: :show), &block)
|
74
|
+
end
|
75
|
+
|
76
|
+
def hide(component_id, **params, &block)
|
77
|
+
@actions << Components::Action.new(parent: self,
|
78
|
+
type: :toggle_visibility,
|
79
|
+
target: component_id,
|
80
|
+
params: params.merge(action: :hide), &block)
|
74
81
|
end
|
75
82
|
|
76
83
|
def snackbar(text, **params, &block)
|
@@ -91,9 +98,21 @@ module Voom
|
|
91
98
|
@actions << Components::Action.new(parent: self,
|
92
99
|
type: :navigates,
|
93
100
|
direction: direction,
|
94
|
-
params: params, &block)
|
101
|
+
params: params.merge(direction: direction), &block)
|
95
102
|
end
|
103
|
+
|
96
104
|
alias navigate navigates
|
105
|
+
|
106
|
+
# Clears or blanks out a control or form.
|
107
|
+
# Takes either an id or a list of ids.
|
108
|
+
# If the id is that of a form then all the clearable inputs on the form will be cleared.
|
109
|
+
def clear(*ids, **params, &block)
|
110
|
+
@actions << Components::Action.new(parent: self,
|
111
|
+
type: :clear,
|
112
|
+
params: params.merge(ids: ids), &block)
|
113
|
+
end
|
114
|
+
|
115
|
+
alias clears clear
|
97
116
|
end
|
98
117
|
end
|
99
118
|
end
|
@@ -8,10 +8,13 @@ module Voom
|
|
8
8
|
class ExpansionPanel < EventBase
|
9
9
|
include Mixins::Common
|
10
10
|
|
11
|
+
attr_accessor :open
|
12
|
+
|
11
13
|
def initialize(**attribs_, &block)
|
12
14
|
super(type: :expansion_panel, **attribs_, &block)
|
13
15
|
self.text(attribs.delete(:text)) if attribs.key?(:text)
|
14
16
|
self.secondary_text(attribs.delete(:secondary_text)) if attribs.key?(:secondary_text)
|
17
|
+
@open = attribs.delete(:open) { false }
|
15
18
|
expand!
|
16
19
|
end
|
17
20
|
|
@@ -26,6 +26,29 @@ module Voom
|
|
26
26
|
@title = Components::Typography.new(parent: self, type: :text, text: text, context: context, **attribs, &block)
|
27
27
|
end
|
28
28
|
|
29
|
+
def page_title(*text, **attribs, &block)
|
30
|
+
return @page_title if locked?
|
31
|
+
@page_title = PageTitle.new(parent: self, text: text, context: context, **attribs, &block)
|
32
|
+
end
|
33
|
+
|
34
|
+
class PageTitle < Base
|
35
|
+
|
36
|
+
attr_accessor :text
|
37
|
+
|
38
|
+
def initialize(**attribs_, &block)
|
39
|
+
super(type: :page_title, **attribs_, &block)
|
40
|
+
@text = attribs.delete(:text)
|
41
|
+
expand!
|
42
|
+
end
|
43
|
+
|
44
|
+
def icon(icon=nil, **attribs, &block)
|
45
|
+
return @icon if locked?
|
46
|
+
@icon = Icon.new(parent: self, icon: icon,
|
47
|
+
context: context,
|
48
|
+
**attribs, &block)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
29
52
|
end
|
30
53
|
end
|
31
54
|
end
|
@@ -10,8 +10,8 @@ module Voom
|
|
10
10
|
def initialize(**attribs_, &block)
|
11
11
|
super(type: :icon_toggle, context: context, **attribs_, &block)
|
12
12
|
@icon = attribs.delete(:icon)
|
13
|
-
@selected = attribs.delete(:selected)
|
14
|
-
@disabled = attribs.delete(:disabled)
|
13
|
+
@selected = attribs.delete(:selected) { false }
|
14
|
+
@disabled = attribs.delete(:disabled) { false }
|
15
15
|
expand!
|
16
16
|
end
|
17
17
|
end
|
@@ -1,7 +1,9 @@
|
|
1
1
|
require_relative 'lists/line'
|
2
2
|
require_relative 'lists/separator'
|
3
|
+
require_relative 'lists/header'
|
3
4
|
require_relative 'mixins/content'
|
4
5
|
require_relative 'mixins/append'
|
6
|
+
require_relative 'mixins/attaches'
|
5
7
|
|
6
8
|
module Voom
|
7
9
|
module Presenters
|
@@ -10,21 +12,33 @@ module Voom
|
|
10
12
|
class List < Base
|
11
13
|
include Mixins::Content
|
12
14
|
include Mixins::Append
|
15
|
+
include Mixins::Attaches
|
13
16
|
|
14
|
-
attr_reader :lines, :lines_only
|
17
|
+
attr_reader :lines, :lines_only, :selectable, :total_lines
|
15
18
|
attr_accessor :components
|
16
19
|
|
17
20
|
def initialize(**attribs_, &block)
|
18
21
|
super(type: :list, context: context,
|
19
22
|
**attribs_, &block)
|
20
|
-
@lines_only = attribs.delete(:lines_only)
|
23
|
+
@lines_only = attribs.delete(:lines_only) { false }
|
24
|
+
@selectable = attribs.delete(:selectable) { false }
|
21
25
|
@lines = []
|
22
26
|
@components = []
|
27
|
+
@total_lines = attribs.delete(:total_lines) || 0
|
28
|
+
add_select_control!( attribs.fetch(:select_control_label) { 'Select All' } )
|
23
29
|
expand!
|
24
30
|
end
|
25
|
-
|
31
|
+
|
32
|
+
def add_select_control!(text)
|
33
|
+
return unless @selectable && !@lines_only
|
34
|
+
@lines << Lists::Header.new(parent: self,
|
35
|
+
context: context,
|
36
|
+
total_lines: @total_lines,
|
37
|
+
checkbox: {text: text})
|
38
|
+
end
|
39
|
+
|
26
40
|
def line(text=nil, **attribs, &block)
|
27
|
-
@lines << Lists::Line.new(parent:self, context: context, text: text, **attribs, &block)
|
41
|
+
@lines << Lists::Line.new(parent:self, context: context, text: text, selectable: selectable, **attribs, &block)
|
28
42
|
end
|
29
43
|
|
30
44
|
def separator(**attribs, &block)
|