voom-presenters 0.1.5 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +4 -1
  3. data/Gemfile +1 -0
  4. data/Gemfile.lock +8 -0
  5. data/README.md +12 -0
  6. data/app/demo/components/date_fields.pom +96 -0
  7. data/app/demo/components/datetime_fields.pom +106 -0
  8. data/app/demo/components/nav/drawer.pom +1 -1
  9. data/app/demo/components/nav/menu.pom +1 -1
  10. data/app/demo/components/time_fields.pom +59 -0
  11. data/app/demo/components/toggles.pom +28 -1
  12. data/app/demo/events/actions/autocomplete.pom +32 -0
  13. data/app/demo/events/actions/deletes.pom +24 -0
  14. data/app/demo/events/actions/dialog.pom +19 -0
  15. data/app/demo/{event/actions/dialog → events/actions/dialogs}/show_dialog.pom +0 -0
  16. data/app/demo/{event/actions/dialog → events/actions/dialogs}/trigger.pom +0 -0
  17. data/app/demo/events/actions/loads.pom +19 -0
  18. data/app/demo/events/actions/posts.pom +23 -0
  19. data/app/demo/{event/new_text.pom → events/actions/replace_text.pom} +0 -0
  20. data/app/demo/events/actions/replaces.pom +21 -0
  21. data/app/demo/events/actions/snackbar.pom +19 -0
  22. data/app/demo/events/actions/toggle_visiblity.pom +21 -0
  23. data/app/demo/events/actions/updates.pom +24 -0
  24. data/app/demo/events/field_level.pom +20 -0
  25. data/app/demo/events/form_level.pom +24 -0
  26. data/app/demo/events/nav/drawer.pom +21 -0
  27. data/app/demo/events.pom +8 -77
  28. data/app/demo/formatting_tokens.pom +125 -0
  29. data/app/demo/index.pom +12 -5
  30. data/app/demo/markdown.pom +33 -40
  31. data/app/demo/shared/context_list.pom +2 -2
  32. data/app/demo/styles.pom +1 -0
  33. data/config.ru +9 -0
  34. data/lib/voom/presenters/dsl/components/base.rb +5 -0
  35. data/lib/voom/presenters/dsl/components/card.rb +2 -0
  36. data/lib/voom/presenters/dsl/components/content.rb +2 -0
  37. data/lib/voom/presenters/dsl/components/date_field.rb +21 -0
  38. data/lib/voom/presenters/dsl/components/datetime_base.rb +48 -0
  39. data/lib/voom/presenters/dsl/components/datetime_field.rb +23 -0
  40. data/lib/voom/presenters/dsl/components/expansion_panel.rb +1 -0
  41. data/lib/voom/presenters/dsl/components/form.rb +2 -0
  42. data/lib/voom/presenters/dsl/components/grid.rb +2 -0
  43. data/lib/voom/presenters/dsl/components/mixins/date_time_fields.rb +29 -0
  44. data/lib/voom/presenters/dsl/components/mixins/text_fields.rb +0 -6
  45. data/lib/voom/presenters/dsl/components/table.rb +1 -1
  46. data/lib/voom/presenters/dsl/components/time_field.rb +21 -0
  47. data/lib/voom/presenters/dsl/user_interface.rb +3 -0
  48. data/lib/voom/presenters/helpers/rails/currency.rb +16 -0
  49. data/lib/voom/presenters/helpers/rails/model_table.rb +52 -0
  50. data/lib/voom/presenters/helpers/rails.rb +4 -34
  51. data/lib/voom/presenters/settings.rb +14 -0
  52. data/lib/voom/presenters/version.rb +1 -1
  53. data/lib/voom/presenters/web_client/app.rb +8 -0
  54. data/public/bundle.css +676 -0
  55. data/public/bundle.js +3314 -1151
  56. data/views/mdc/assets/js/components/datetime.js +36 -0
  57. data/views/mdc/assets/js/components/events/base.js +5 -5
  58. data/views/mdc/assets/js/components/forms.js +2 -2
  59. data/views/mdc/assets/js/components/initialize.js +2 -2
  60. data/views/mdc/assets/js/components/switches.js +1 -1
  61. data/views/mdc/assets/js/components/text-fields.js +2 -4
  62. data/views/mdc/assets/scss/components/datetime.scss +19 -0
  63. data/views/mdc/assets/scss/components/textfield.scss +7 -0
  64. data/views/mdc/assets/scss/components/vendor/flatpickr.min.css +13 -0
  65. data/views/mdc/components/date.erb +1 -0
  66. data/views/mdc/components/{date_time.erb → datetime.erb} +13 -8
  67. data/views/mdc/components/icon.erb +2 -0
  68. data/views/mdc/components/text_field.erb +3 -2
  69. data/views/mdc/components/time.erb +1 -0
  70. data/views/mdc/layout.erb +1 -0
  71. data/views/mdc/package-lock.json +5 -0
  72. data/views/mdc/package.json +1 -1
  73. metadata +33 -18
  74. data/LICENSE.txt +0 -21
  75. data/app/demo/event/actions/nav/drawer.pom +0 -5
  76. data/app/demo/event/actions/nav/menu.pom +0 -19
  77. data/app/demo/event/actions.rb +0 -86
  78. data/app/demo/event/autocomplete.pom +0 -27
  79. data/app/demo/event/field_level.pom +0 -22
  80. data/app/demo/event/form_level.pom +0 -26
  81. data/app/demo/event/nav/drawer.pom +0 -5
  82. data/app/demo/event/nav/menu.pom +0 -14
  83. data/lib/voom/presenters/dsl/components/date_time.rb +0 -17
  84. data/lib/voom/presenters/helpers/currency.rb +0 -14
  85. data/views/mdc/assets/js/components/date-time.js +0 -6
@@ -0,0 +1,21 @@
1
+ Voom::Presenters.define(:events_drawer) do
2
+ helpers Voom::Presenters::Helpers::Inflector
3
+ drawer 'Events' do
4
+ menu do
5
+ %i(field_level_events form_level_events).sort.each do |comp|
6
+ item titleize(comp) do
7
+ event :click do
8
+ loads comp
9
+ end
10
+ end
11
+ end
12
+ %i(dialog autocomplete replaces toggle_visibility snackbar updates deletes posts).sort.each do |comp|
13
+ item titleize(comp) do
14
+ event :click do
15
+ loads "#{comp}_action"
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
data/app/demo/events.pom CHANGED
@@ -1,60 +1,20 @@
1
- require_relative 'helpers/indented_grid'
2
-
3
1
  Voom::Presenters.define(:events) do
4
2
  helpers Demo::Helpers::IndentedGrid
5
3
  attach :top_nav
6
4
  attach :events_drawer
7
5
 
8
-
9
6
  indented_grid do
10
7
  heading 'Events'
11
8
  body 'Events are able to be attached to most components. ',
12
9
  'Common examples include `click` and `change` events. ',
10
+ 'Events have actions.',
13
11
  "To see how an individual component handles events, visit the [component page](#{presenters_path(:components)})"
14
12
 
15
- subheading 'Dialog'
16
- button 'dialog' do
17
- event :click do
18
- dialog :my_dialog
19
- end
20
- end
21
- attach :show_dialog
22
-
23
- subheading 'Replaces'
24
- button 'replaces' do
25
- event :click do
26
- replaces :replace_me, :replace_text, text: "I was replaced"
27
- end
28
- end
29
- attach :replace_text
30
-
31
- subheading 'Toggle Visibility'
32
- button 'toggle visiblity' do
33
- event :click do
34
- toggle_visiblity :toggle_me
35
- end
36
- end
37
- heading 'Sometimes I appear', id: :toggle_me
38
-
39
- subheading 'Snackbar'
40
- button 'snackbar' do
41
- event :click do
42
- snackbar 'I want a snack!'
43
- end
44
- end
45
-
46
- subheading context['reloaded'] ? "Reloaded" : 'Loads'
47
- button 'loads' do
48
- event :click do
49
- loads :events, reloaded: true
50
- end
51
- end
52
- heading context['reloaded'] ? "Reloaded" : 'Loaded'
53
-
54
- title "A Note on errors:"
55
- body 'The following event actions will display an error.',
56
- nil,
57
- 'Errors are automatically displayed in the following locations.',
13
+ icon 'fa-hand-point-left', position: :left
14
+ subheading 'Select an event action'
15
+ body ' '
16
+ title "Event Action Error Handling"
17
+ body 'Errors are automatically displayed in the following locations.',
58
18
  '1. Field/input level errors will display on the field/input.',
59
19
  '1. At the top of all forms.',
60
20
  '1. At the top of all dialogs.',
@@ -63,36 +23,7 @@ Voom::Presenters.define(:events) do
63
23
  '1. At the top of the page', level: 2
64
24
 
65
25
  body 'The closest error element will be used.'\
66
- 'If you want to control where errors appear. Use the attribute `show_errors=(true|false)`'
67
-
68
-
69
- subheading 'Update'
70
- body 'issues a PUT to the passed path'
71
- content shows_errors: true do
72
- button 'updates' do
73
- event :click do
74
- updates 'updatepath', {optional: :params}
75
- end
76
- end
77
-
78
- subheading 'Delete'
79
- body 'issues a DELETE to the passed path'
80
- content shows_errors: true do
81
- button 'deletes' do
82
- event :click do
83
- deletes 'deletepath', {optional: :params}
84
- end
85
- end
86
- subheading 'Posts'
87
- body "issues a POST to the passed path\nAlias: creates"
88
- content do
89
- button 'posts' do
90
- event :click do
91
- posts 'postpath', {optional: :params}
92
- end
93
- end
94
- end
95
- end
96
- end
26
+ 'If you want to control where errors appear. Use the attribute `show_errors=(true|false)`'
97
27
  end
28
+ attach :code, file: __FILE__
98
29
  end
@@ -0,0 +1,125 @@
1
+ Voom::Presenters.define(:formatting_tokens) do
2
+ helpers Demo::Helpers::IndentedGrid
3
+ indented_grid do
4
+ display 'Date Formatting Tokens', id: :date
5
+ table do
6
+ header do
7
+ column 'Character'
8
+ column 'Description'
9
+ column 'Example'
10
+ end
11
+ row do
12
+ column 'd'
13
+ column 'Day of the month, 2 digits with leading zeros'
14
+ column '01 to 31'
15
+ end
16
+ row do
17
+ column 'D'
18
+ column 'A textual representation of a day'
19
+ column 'Mon through Sun'
20
+ end
21
+ row do
22
+ column "l (lowercase 'L')"
23
+ column 'A full textual representation of the day of the week'
24
+ column 'Sunday through Saturday'
25
+ end
26
+
27
+ row do
28
+ column 'j'
29
+ column 'Day of the month without leading zeros'
30
+ column '1 to 31'
31
+ end
32
+ row do
33
+ column 'J'
34
+ column 'Day of the month without leading zeros and ordinal suffix'
35
+ column '1st, 2nd, to 31st'
36
+ end
37
+ row do
38
+ column 'w'
39
+ column 'Numeric representation of the day of the week'
40
+ column '0 (for Sunday) through 6 (for Saturday)'
41
+ end
42
+ row do
43
+ column 'F'
44
+ column 'A full textual representation of a month'
45
+ column 'January through December'
46
+ end
47
+ row do
48
+ column 'm'
49
+ column 'Numeric representation of a month, with leading zero'
50
+ column '01 through 12'
51
+ end
52
+ row do
53
+ column 'n'
54
+ column 'Numeric representation of a month, without leading zeros'
55
+ column '1 through 12'
56
+ end
57
+ row do
58
+ column 'M'
59
+ column 'A short textual representation of a month'
60
+ column 'Jan through Dec'
61
+ end
62
+ row do
63
+ column 'U'
64
+ column 'The number of seconds since the Unix Epoch'
65
+ column '1413704993', numeric: false
66
+ end
67
+
68
+ row do
69
+ column 'y'
70
+ column 'A two digit representation of a year'
71
+ column '99 or 03'
72
+ end
73
+
74
+ row do
75
+ column 'Y'
76
+ column 'A full numeric representation of a year, 4 digits'
77
+ column '1999 or 2003'
78
+ end
79
+ row do
80
+ column 'Z'
81
+ column 'ISO Date format'
82
+ column '2017-03-04T01:23:43.000Z'
83
+ end
84
+ end
85
+
86
+ display 'Time Formatting Tokens', id: :time
87
+ table do
88
+ header do
89
+ column 'Character '
90
+ column 'Description'
91
+ column 'Example'
92
+ end
93
+ row do
94
+ column 'H'
95
+ column 'Hours (24 hours)'
96
+ column '00 to 23'
97
+ end
98
+ row do
99
+ column 'h'
100
+ column 'Hours'
101
+ column '1 to 12'
102
+ end
103
+ row do
104
+ column 'i'
105
+ column 'Minutes'
106
+ column '00 to 59'
107
+ end
108
+ row do
109
+ column 'S'
110
+ column 'Seconds, 2 digits'
111
+ column '00 to 59'
112
+ end
113
+ row do
114
+ column 's'
115
+ column 'Seconds'
116
+ column '0, 1 to 59'
117
+ end
118
+ row do
119
+ column 'K'
120
+ column 'AM/PM'
121
+ column 'AM or PM'
122
+ end
123
+ end
124
+ end
125
+ end
data/app/demo/index.pom CHANGED
@@ -7,13 +7,20 @@ Voom::Presenters.define(:index) do
7
7
  indented_grid do
8
8
  headline 'Presenters', id: :headline
9
9
  subheading 'Presenters are to HTML what C is to assembly'
10
- body ['A presenter describes a user interface. It is evaluated and a presenter object model (POM) is returned.',
11
- 'A client that renders POM can display the given user interface.']
12
10
 
13
- subheading 'For example this is the presentation for this page:', level: 2
11
+ body ['A presenter describes a user interface using a ruby DSL.',
12
+ 'The presenter is evaluated and a presenter object model (POM) is generated.',
13
+ 'A client that renders POM can display the given user interface.']
14
14
 
15
- attach 'code', file: __FILE__
16
- end
15
+ body 'To get started checkout the components and events.'
17
16
 
17
+ subheading 'For example this is the presenter dsl for this page:', level: 2
18
18
 
19
+ source = File.read(__FILE__)
20
+ body <<~HEREDOC
21
+ ```
22
+ #{source}
23
+ ```
24
+ HEREDOC
25
+ end
19
26
  end
@@ -28,46 +28,39 @@ Voom::Presenters.define(:markdown) do
28
28
  body '1. Item 1', '2. Item 2'
29
29
 
30
30
  title 'Full Sample'
31
- body <<-HEREDOC
32
- # Markdown Sample
33
-
34
- ----
35
- ## what is Markdown?
36
- see [Wikipedia](http://en.wikipedia.org/wiki/Markdown)
37
-
38
- > Markdown is a lightweight markup language, originally created by John Gruber and Aaron Swartz allowing people "to write using an easy-to-read, easy-to-write plain text format, then convert it to structurally valid XHTML (or HTML)".
39
-
40
- ----
41
- ## markdown quick reference
42
- # headers
43
-
44
- *emphasis*
45
-
46
- **strong**
47
-
48
- * list
49
-
50
- >block quote
51
-
52
- `code inline`
53
-
54
- ```ruby
55
- require 'redcarpet'
56
- markdown = Redcarpet.new("Hello World!")
57
- puts markdown.to_html
58
- ```
59
- [links](http://wikipedia.org)
60
-
61
- ----
62
- ## changelog
63
- * 17-Feb-2013 re-design
64
-
65
- ----
66
- ## thanks
67
- * [markdown-js](https://github.com/evilstreak/markdown-js)
68
-
31
+ body <<~HEREDOC
32
+ # Markdown Sample
33
+
34
+ ----
35
+ ## what is Markdown?
36
+ see [Wikipedia](http://en.wikipedia.org/wiki/Markdown)
37
+
38
+ > Markdown is a lightweight markup language, originally created by John Gruber and Aaron Swartz allowing people "to write using an easy-to-read, easy-to-write plain text format, then convert it to structurally valid XHTML (or HTML)".
39
+
40
+ ----
41
+ ## markdown quick reference
42
+ # headers
43
+
44
+ *emphasis*
45
+
46
+ **strong**
47
+
48
+ * list
49
+
50
+ >block quote
51
+
52
+ `code inline`
53
+
54
+ ```ruby
55
+ require 'redcarpet'
56
+ markdown = Redcarpet.new("Hello World!")
57
+ puts markdown.to_html
58
+ ```
59
+ [links](http://wikipedia.org)
60
+
61
+ ----
62
+ ## changelog
63
+ * 17-Feb-2013 re-design
69
64
  HEREDOC
70
-
71
-
72
65
  end
73
66
  end
@@ -5,11 +5,11 @@ Voom::Presenters.define(:context_list) do
5
5
  end
6
6
 
7
7
  def time
8
- Time.now unless context.fetch('testing') {false}
8
+ Time.now unless context.fetch(:hide_time) {false}
9
9
  end
10
10
 
11
11
  def scrubbed_context
12
- scrubbed_keys = context.fetch(:exclude) {%w{title file testing}}
12
+ scrubbed_keys = context.fetch(:exclude) {%w{title file hide_time}}
13
13
  context.select {|k, _| !scrubbed_keys.include?(k.to_s)}
14
14
  end
15
15
  end
data/app/demo/styles.pom CHANGED
@@ -22,5 +22,6 @@ Voom::Presenters.define(:styles) do
22
22
  'aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat',
23
23
  'nulla pariatur.'], level: 1
24
24
  body 'Body 2 text, calling something out.', level: 2
25
+ body 'You can use [markdown](/markdown) in your typography'
25
26
  end
26
27
  end
data/config.ru CHANGED
@@ -1,4 +1,13 @@
1
1
  #!/usr/bin/env ruby
2
+ if ENV['VOOM_ENV']=='integration_testing'
3
+ require 'simplecov'
4
+ if ENV['CIRCLE_ARTIFACTS']
5
+ dir = File.join(ENV['CIRCLE_ARTIFACTS'], "coverage")
6
+ SimpleCov.coverage_dir(dir)
7
+ end
8
+ SimpleCov.start
9
+ end
10
+
2
11
  ENV['VOOM_ROOT'] = File.expand_path(__dir__)
3
12
  libdir = File.join(ENV['VOOM_ROOT'], 'lib')
4
13
  $:.unshift(libdir) unless $:.include?(libdir)
@@ -72,6 +72,11 @@ module Voom
72
72
  @parent.send(:_helpers_) if @parent
73
73
  end
74
74
 
75
+
76
+ def default(key)
77
+ Settings.config.presenters.components.defaults&.public_send(type)&.public_send(key)
78
+ end
79
+
75
80
  end
76
81
  end
77
82
  end
@@ -7,6 +7,7 @@ require_relative 'mixins/avatar'
7
7
  require_relative 'mixins/text_fields'
8
8
  require_relative 'mixins/icons'
9
9
  require_relative 'mixins/snackbars'
10
+ require_relative 'mixins/date_time_fields'
10
11
 
11
12
  module Voom
12
13
  module Presenters
@@ -16,6 +17,7 @@ module Voom
16
17
  include Mixins::Common
17
18
  include Mixins::Attaches
18
19
  include Mixins::TextFields
20
+ include Mixins::DateTimeFields
19
21
  include Mixins::Icons
20
22
  include Mixins::Snackbars
21
23
 
@@ -5,6 +5,7 @@ require_relative 'mixins/attaches'
5
5
  require_relative 'mixins/text_fields'
6
6
  require_relative 'mixins/selects'
7
7
  require_relative 'mixins/snackbars'
8
+ require_relative 'mixins/date_time_fields'
8
9
 
9
10
  module Voom
10
11
  module Presenters
@@ -14,6 +15,7 @@ module Voom
14
15
  include Mixins::Common
15
16
  include Mixins::Attaches
16
17
  include Mixins::TextFields
18
+ include Mixins::DateTimeFields
17
19
  include Mixins::Selects
18
20
  include Mixins::Snackbars
19
21
 
@@ -0,0 +1,21 @@
1
+ require_relative 'datetime_base'
2
+
3
+ module Voom
4
+ module Presenters
5
+ module DSL
6
+ module Components
7
+ class DateField < DatetimeBase
8
+ attr_reader :config
9
+
10
+ def initialize(**attribs_, &block)
11
+ super(type: :date, **attribs_, &block)
12
+ merge_config(:min_date)
13
+ merge_config(:max_date)
14
+ expand!
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+
@@ -0,0 +1,48 @@
1
+ require_relative 'text_field'
2
+
3
+ module Voom
4
+ module Presenters
5
+ module DSL
6
+ module Components
7
+ class DatetimeBase < TextField
8
+ attr_reader :config
9
+
10
+ def initialize(**attribs_, &block)
11
+ super(**attribs_, &block)
12
+ @config = {}
13
+ map_config(:format, :alt_format, true)
14
+ merge_config(:disable)
15
+ merge_config(:enable)
16
+ merge_config(:mode)
17
+ merge_config(:time_24hr, true)
18
+
19
+ clear_icon(:clear) do
20
+ event :click do
21
+ snackbar 'Clicked'
22
+ end
23
+ end
24
+ end
25
+
26
+ def clear_icon(icon=nil, **attribs, &block)
27
+ return @clear_icon if locked?
28
+ @clear_icon = icon ? Components::Icon.new(parent: self, icon: icon,
29
+ context: context,
30
+ **attribs, &block) : nil
31
+ end
32
+
33
+ private
34
+ def merge_config(attrib, default=false)
35
+ attrib_value = attribs.delete(attrib) {default ? default(attrib) : nil}
36
+ @config.merge!({attrib => attrib_value}) if attrib_value
37
+ end
38
+
39
+ def map_config(attrib, new_attrib, default=false)
40
+ attrib_value = attribs.delete(attrib) {default ? default(attrib) : nil}
41
+ @config.merge!({new_attrib => attrib_value}) if attrib_value
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
48
+
@@ -0,0 +1,23 @@
1
+ require_relative 'datetime_base'
2
+
3
+ module Voom
4
+ module Presenters
5
+ module DSL
6
+ module Components
7
+ class DatetimeField < DatetimeBase
8
+ attr_reader :config
9
+
10
+ def initialize(**attribs_, &block)
11
+ super(type: :datetime, **attribs_, &block)
12
+ merge_config(:min_date)
13
+ merge_config(:max_date)
14
+ merge_config(:min_time)
15
+ merge_config(:max_time)
16
+ expand!
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+
@@ -1,4 +1,5 @@
1
1
  require_relative 'mixins/common'
2
+ require_relative 'mixins/attaches'
2
3
 
3
4
  module Voom
4
5
  module Presenters
@@ -12,6 +12,7 @@ require_relative 'mixins/attaches'
12
12
  require_relative 'mixins/expansion_panels'
13
13
  require_relative 'mixins/content'
14
14
  require_relative 'mixins/typography'
15
+ require_relative 'mixins/date_time_fields'
15
16
 
16
17
  module Voom
17
18
  module Presenters
@@ -21,6 +22,7 @@ module Voom
21
22
  include Mixins::Append
22
23
  include Mixins::Grids
23
24
  include Mixins::TextFields
25
+ include Mixins::DateTimeFields
24
26
  include Mixins::Selects
25
27
  include Mixins::Toggles
26
28
  include Mixins::Buttons
@@ -8,6 +8,7 @@ require_relative 'mixins/chips'
8
8
  require_relative 'mixins/snackbars'
9
9
  require_relative 'mixins/selects'
10
10
  require_relative 'mixins/text_fields'
11
+ require_relative 'mixins/date_time_fields'
11
12
 
12
13
  module Voom
13
14
  module Presenters
@@ -42,6 +43,7 @@ module Voom
42
43
  include Mixins::Dialogs
43
44
  include Mixins::Chips
44
45
  include Mixins::TextFields
46
+ include Mixins::DateTimeFields
45
47
  include Mixins::Selects
46
48
  include Mixins::Toggles
47
49
  include Mixins::Snackbars
@@ -0,0 +1,29 @@
1
+ module Voom
2
+ module Presenters
3
+ module DSL
4
+ module Components
5
+ module Mixins
6
+ module DateTimeFields
7
+ def datetime_field(**attribs, &block)
8
+ self << Components::DatetimeField.new(parent: self,
9
+ context: context,
10
+ **attribs, &block)
11
+ end
12
+
13
+ def date_field(**attribs, &block)
14
+ self << Components::DateField.new(parent: self,
15
+ context: context,
16
+ **attribs, &block)
17
+ end
18
+
19
+ def time_field(**attribs, &block)
20
+ self << Components::TimeField.new(parent: self,
21
+ context: context,
22
+ **attribs, &block)
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -21,12 +21,6 @@ module Voom
21
21
  context: context,
22
22
  **attribs, &block)
23
23
  end
24
-
25
- def datetime_field(**attribs, &block)
26
- self << Components::DateTime.new(parent: self,
27
- context: context,
28
- **attribs, &block)
29
- end
30
24
  end
31
25
  end
32
26
  end
@@ -66,7 +66,7 @@ module Voom
66
66
  def initialize(**attribs_, &block)
67
67
  super(type: :column, **attribs_, &block)
68
68
  value = attribs.delete(:value)
69
- @numeric = attribs.delete(:numeric) || numeric?(value)
69
+ @numeric = attribs.delete(:numeric){numeric?(value)}
70
70
  self.value(value) if value
71
71
  @color = attribs.delete(:color)
72
72
  @components = []
@@ -0,0 +1,21 @@
1
+ require_relative 'datetime_base'
2
+
3
+ module Voom
4
+ module Presenters
5
+ module DSL
6
+ module Components
7
+ class TimeField < DatetimeBase
8
+ attr_reader :config
9
+
10
+ def initialize(**attribs_, &block)
11
+ super(type: :time, **attribs_, &block)
12
+ map_config(:min_time, :min_date)
13
+ map_config(:max_time, :max_date)
14
+ expand!
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+
@@ -5,6 +5,7 @@ require_relative 'components/mixins/helpers'
5
5
  require_relative 'components/mixins/dialogs'
6
6
  require_relative 'components/mixins/snackbars'
7
7
  require_relative 'components/mixins/text_fields'
8
+ require_relative 'components/mixins/date_time_fields'
8
9
  require_relative 'invalid_presenter'
9
10
 
10
11
  require 'voom/serializer'
@@ -23,6 +24,8 @@ module Voom
23
24
  include Components::Mixins::Snackbars
24
25
  include Components::Mixins::Icons
25
26
  include Components::Mixins::TextFields
27
+ include Components::Mixins::DateTimeFields
28
+
26
29
 
27
30
  include Voom::Serializer
28
31
  include Voom::Trace