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.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +1 -1
  3. data/Gemfile.lock +5 -5
  4. data/app/demo/components/date_fields.pom +2 -2
  5. data/app/demo/components/datetime_fields.pom +6 -5
  6. data/app/demo/components/headers.pom +5 -0
  7. data/app/demo/components/lists.pom +11 -0
  8. data/app/demo/components/time_fields.pom +2 -2
  9. data/app/demo/events/actions/dialogs/trigger.pom +2 -2
  10. data/app/demo/events/actions/toggle_visiblity.pom +4 -4
  11. data/app/demo/shared/context_list.pom +1 -1
  12. data/component-status.yml +11 -11
  13. data/lib/voom/presenters/dsl/components/button.rb +2 -2
  14. data/lib/voom/presenters/dsl/components/checkbox.rb +2 -1
  15. data/lib/voom/presenters/dsl/components/datetime_base.rb +2 -1
  16. data/lib/voom/presenters/dsl/components/event.rb +25 -6
  17. data/lib/voom/presenters/dsl/components/expansion_panel.rb +3 -0
  18. data/lib/voom/presenters/dsl/components/header.rb +23 -0
  19. data/lib/voom/presenters/dsl/components/icon_toggle.rb +2 -2
  20. data/lib/voom/presenters/dsl/components/list.rb +18 -4
  21. data/lib/voom/presenters/dsl/components/lists/action.rb +1 -1
  22. data/lib/voom/presenters/dsl/components/lists/header.rb +19 -0
  23. data/lib/voom/presenters/dsl/components/lists/line.rb +15 -5
  24. data/lib/voom/presenters/dsl/components/menu.rb +2 -1
  25. data/lib/voom/presenters/dsl/components/mixins/typography.rb +0 -1
  26. data/lib/voom/presenters/dsl/components/toggle_base.rb +2 -2
  27. data/lib/voom/presenters/version.rb +1 -1
  28. data/lib/voom/presenters/web_client/app.rb +23 -5
  29. data/public/bundle.css +266 -153
  30. data/public/bundle.js +148 -41
  31. data/scripts/bump.sh +3 -0
  32. data/scripts/deploy-demo.sh +2 -0
  33. data/scripts/release.sh +4 -0
  34. data/views/mdc/assets/js/components/datetime.js +9 -5
  35. data/views/mdc/assets/js/components/events.js +6 -7
  36. data/views/mdc/assets/js/components/events/clears.js +26 -0
  37. data/views/mdc/assets/js/components/events/toggle_visibility.js +26 -0
  38. data/views/mdc/assets/js/components/forms.js +8 -0
  39. data/views/mdc/assets/js/components/lists.js +84 -1
  40. data/views/mdc/assets/js/components/text-fields.js +8 -0
  41. data/views/mdc/assets/scss/components/datetime.scss +5 -0
  42. data/views/mdc/assets/scss/components/list.scss +11 -0
  43. data/views/mdc/assets/scss/theme.scss +49 -2
  44. data/views/mdc/body/drawer.erb +2 -2
  45. data/views/mdc/body/header.erb +6 -0
  46. data/views/mdc/components/checkbox.erb +4 -1
  47. data/views/mdc/components/datetime.erb +2 -2
  48. data/views/mdc/components/expansion_panel.erb +1 -1
  49. data/views/mdc/components/list.erb +2 -1
  50. data/views/mdc/components/list/checkbox.erb +1 -1
  51. data/views/mdc/components/list/header.erb +35 -0
  52. data/views/mdc/components/list/line.erb +2 -1
  53. data/views/mdc/components/menu.erb +1 -1
  54. metadata +9 -4
  55. data/views/mdc/assets/js/components/events/selects.js +0 -28
  56. 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: 040b8f4d4b32723f1c20f1b9c14a098b6f36536e0ed8376ad4ec0b7dedadcb83
4
- data.tar.gz: 1b6a5d156ab1b9e43547fddd95ae1eecc446f9c2ed1487ef2b2286f710d9631f
3
+ metadata.gz: ae9fe537c82c38d72bd3c5b1b8b4039fa1eda4acb8e239d99606fae2e863b54a
4
+ data.tar.gz: 5bf2378799b7c857993bb311d6c011620fcfc91d57279c11c8294485af6a6842
5
5
  SHA512:
6
- metadata.gz: d91726c9d500eedc14a3bfec6de9ebfd5ee78d635781d993e8728ccc871fce4a6e4aa1a63530799812f0a239e1bb055db239db1a3f94bc2d3fc6590768cd164e
7
- data.tar.gz: acf3115a808804a2dd027edd936244cc2e68153d92ffa7c7d76a9ec273acc99c270047c2c081c24dec700e03c8c170ee5395e01991b08c06c493b236bf06bf42
6
+ metadata.gz: cca44edbb9a96d37245af4f362df6229d19646f0631616abcb0800958259e72c991c5c35a0702cc68bb04dd04518253c94f27ce29a08ef2328f3eac6d65b0f0f
7
+ data.tar.gz: 3b17dae8e2bf6111c0e015c93749e1ffa855f90579dcbd8a98f7ced7c07c9a455fdc5a5f01387753cb77983980db6d6e3d952baf4df25d380ff4c563e5f4f703
data/.circleci/config.yml CHANGED
@@ -7,7 +7,7 @@ jobs:
7
7
  build:
8
8
  docker:
9
9
  # specify the version you desire here
10
- - image: circleci/ruby:2.4.1-node-browsers
10
+ - image: circleci/ruby:2.5-node-browsers
11
11
 
12
12
  # Specify service dependencies here if necessary
13
13
  # CircleCI maintains a library of pre-built images
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- voom-presenters (0.1.6)
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.4)
42
- rack-protection (2.0.1)
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.1)
75
+ sinatra (2.0.3)
76
76
  mustermann (~> 1.0)
77
77
  rack (~> 2.0)
78
- rack-protection (= 2.0.1)
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, hide_time: true
33
+ replaces :context_list, :context_list
34
34
  end
35
35
  end
36
36
  end
37
37
  column 6 do
38
- attach :context_list, hide_time: true
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, hide_time: true
35
+ replaces :context_list, :context_list
35
36
  end
36
37
  end
37
38
  end
38
39
  column 6 do
39
- attach :context_list, hide_time: true
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 (14 days from now)'
54
- datetime_field min_date: :today, max_date: DateTime.now.next_day(14) # Or in rails Time.now + 14.days
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, hide_time: true
33
+ replaces :context_list, :context_list
34
34
  end
35
35
  end
36
36
  end
37
37
  column 6 do
38
- attach :context_list, hide_time: true
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 visiblity' do
27
+ button 'toggle visibility' do
28
28
  event :click do
29
- toggle_visiblity :toggle_me
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 visiblity of content on and off on events.',
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 visiblity."
10
+ "Optionally takes :on or :off to force visibility."
11
11
 
12
12
  subheading 'Toggle Visibility'
13
- button 'toggle visiblity' do
13
+ button 'toggle visibility' do
14
14
  event :click do
15
- toggle_visiblity :toggle_me
15
+ toggle_visibility :toggle_me
16
16
  end
17
17
  end
18
18
  heading 'Sometimes I appear', id: :toggle_me
@@ -5,7 +5,7 @@ Voom::Presenters.define(:context_list) do
5
5
  end
6
6
 
7
7
  def time
8
- Time.now unless context.fetch(:hide_time) {false}
8
+ Time.now unless context.fetch(:hide_time) {true}
9
9
  end
10
10
 
11
11
  def scrubbed_context
data/component-status.yml CHANGED
@@ -29,8 +29,8 @@
29
29
  MDL:
30
30
  MDC:
31
31
  Priority:
32
- Completeness: 3
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: 3
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: N
116
+ Implementation: Flatpickr
117
117
  MDL: N
118
118
  MDC: N
119
119
  Priority: medium
120
- Completeness:
121
- Notes: Need date/time selection
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: not planned
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) || false
21
+ @disabled = attribs.delete(:disabled) { false }
22
22
  @size = attribs.delete(:size)
23
23
  @position = Array(attribs.delete(:position)).compact
24
24
  expand!
@@ -5,8 +5,9 @@ module Voom
5
5
  module DSL
6
6
  module Components
7
7
  class Checkbox < ToggleBase
8
+
8
9
  def initialize(**attribs_, &block)
9
- super(type: :checkbox, **attribs_, &block)
10
+ super(type: :checkbox, **attribs_, &block)
10
11
  expand!
11
12
  end
12
13
  end
@@ -15,9 +15,10 @@ module Voom
15
15
  merge_config(:enable)
16
16
  merge_config(:mode)
17
17
 
18
+ my_id = self.id
18
19
  clear_icon(:clear) do
19
20
  event :click do
20
- snackbar 'Clicked'
21
+ clear my_id
21
22
  end
22
23
  end
23
24
  end
@@ -59,18 +59,25 @@ module Voom
59
59
  params: params, &block)
60
60
  end
61
61
 
62
- def toggle_visiblity(component_id, **params, &block)
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 selects(input_name=nil, **params, &block)
69
+ def show(component_id, **params, &block)
70
70
  @actions << Components::Action.new(parent: self,
71
- type: :selects,
72
- target: input_name,
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) || false
14
- @disabled = attribs.delete(:disabled) || false
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)||false
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)