epages-essence 0.1.0 → 0.2.0

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 (107) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/README.md +4 -3
  4. data/app/assets/images/essence/icon_component/arrow_right.svg +1 -0
  5. data/app/assets/images/essence/icon_component/chevron_up_down.svg +3 -0
  6. data/app/assets/images/essence/icon_component/power_off.svg +1 -0
  7. data/app/assets/images/essence/icon_component/sparkles.svg +1 -0
  8. data/app/assets/images/essence/icon_component/x_mark.svg +3 -0
  9. data/app/assets/stylesheets/essence/beyond/{_base.scss → layout/base.css} +0 -5
  10. data/app/assets/stylesheets/essence/beyond/layout/{_content.scss → content.css} +1 -1
  11. data/app/assets/stylesheets/essence/beyond/simple_form/control.css +249 -0
  12. data/app/assets/stylesheets/essence/beyond/simple_form/error.css +29 -0
  13. data/app/assets/stylesheets/essence/beyond/simple_form/fieldset.css +32 -0
  14. data/app/assets/stylesheets/essence/beyond/simple_form/group.css +21 -0
  15. data/app/assets/stylesheets/essence/beyond/simple_form/hint.css +6 -0
  16. data/app/assets/stylesheets/essence/beyond/simple_form/label.css +38 -0
  17. data/app/assets/stylesheets/essence/beyond/simple_form/row.css +5 -0
  18. data/app/assets/stylesheets/essence/beyond/simple_form/wrapper.css +3 -0
  19. data/app/assets/stylesheets/essence/beyond/utils/margin.css +15 -0
  20. data/app/assets/stylesheets/essence/beyond/variables.css +281 -0
  21. data/app/assets/stylesheets/essence/beyond.css +39 -0
  22. data/app/components/essence/action_bar_component/action_bar_component.css +23 -0
  23. data/app/components/essence/action_bar_component.rb +2 -1
  24. data/app/components/essence/app_info_component/app_info_component.css +45 -0
  25. data/app/components/essence/application_component.rb +1 -3
  26. data/app/components/essence/breadcrumb_component/breadcrumb_component.css +35 -0
  27. data/app/components/essence/button_component/button_component.css +140 -0
  28. data/app/components/essence/button_component/button_component.html.erb +2 -0
  29. data/app/components/essence/button_component/button_component_controller.js +27 -0
  30. data/app/components/essence/button_component.rb +27 -2
  31. data/app/components/essence/button_group_component/button_group_component.css +21 -0
  32. data/app/components/essence/button_group_component/button_group_component.html.erb +5 -0
  33. data/app/components/essence/button_group_component.rb +28 -0
  34. data/app/components/essence/card_component/card_component.css +66 -0
  35. data/app/components/essence/card_component/card_component.html.erb +6 -0
  36. data/app/components/essence/card_component/ribbon_component.html.erb +3 -0
  37. data/app/components/essence/card_component.rb +38 -4
  38. data/app/components/essence/clipboard_copy_component/{clipboard_copy_component.scss → clipboard_copy_component.css} +4 -4
  39. data/app/components/essence/empty_state_component/empty_state_component.css +42 -0
  40. data/app/components/essence/expandable_component/expandable_component.css +36 -0
  41. data/app/components/essence/expandable_component/expandable_component.html.erb +8 -0
  42. data/app/components/essence/expandable_component/expandable_component_controller.js +32 -0
  43. data/app/components/essence/expandable_component.rb +30 -0
  44. data/app/components/essence/expandable_toggle_component/expandable_toggle_component.css +7 -0
  45. data/app/components/essence/expandable_toggle_component/expandable_toggle_component.html.erb +3 -0
  46. data/app/components/essence/expandable_toggle_component/expandable_toggle_component.yml +4 -0
  47. data/app/components/essence/expandable_toggle_component/expandable_toggle_component_controller.js +52 -0
  48. data/app/components/essence/expandable_toggle_component.rb +38 -0
  49. data/app/components/essence/flash_component/container_component.html.erb +7 -0
  50. data/app/components/essence/flash_component/flash_component.css +101 -0
  51. data/app/components/essence/flash_component/flash_component.html.erb +11 -0
  52. data/app/components/essence/flash_component/flash_component_controller.js +24 -0
  53. data/app/components/essence/flash_component.rb +29 -0
  54. data/app/components/essence/link_component/link_component.css +49 -0
  55. data/app/components/essence/notification_component/notification_component.css +55 -0
  56. data/app/components/essence/notification_component.rb +6 -2
  57. data/app/components/essence/paragraph_component/{paragraph_component.scss → paragraph_component.css} +0 -5
  58. data/app/components/essence/scroll_shadow_component/{scroll_shadow_component.scss → scroll_shadow_component.css} +4 -0
  59. data/app/components/essence/spinner_component/{spinner_component.scss → spinner_component.css} +5 -12
  60. data/app/components/essence/spinner_component/spinner_component.html.erb +1 -1
  61. data/app/components/essence/spinner_component.rb +4 -2
  62. data/app/components/essence/status_component/status_component.css +64 -0
  63. data/app/components/essence/status_component.rb +1 -1
  64. data/app/components/essence/step_list_component/step_list_component.css +72 -0
  65. data/app/components/essence/step_list_component/step_list_component.html.erb +3 -1
  66. data/app/components/essence/step_list_component.rb +7 -1
  67. data/app/components/essence/table_component/{table_component.scss → table_component.css} +5 -8
  68. data/app/components/essence/title_component/{title_component.scss → title_component.css} +0 -4
  69. data/app/components/essence/tooltip_component/tooltip_component.css +55 -0
  70. data/app/inputs/file_input.rb +73 -0
  71. data/app/javascript/essence/application.js +2 -2
  72. data/app/javascript/essence/controllers/file_input_controller.js +41 -0
  73. data/app/javascript/essence/controllers/index.js +18 -3
  74. data/app/views/essence/beyond/body.html.erb +1 -0
  75. data/config/importmap.rb +3 -0
  76. data/config/initializers/essence/inline_svg.rb +5 -0
  77. data/config/initializers/essence/simple_form.rb +29 -8
  78. data/config/locales/essence.en.yml +3 -0
  79. data/lib/components/input_group.rb +19 -0
  80. data/lib/essence/engine.rb +20 -5
  81. data/lib/essence/version.rb +1 -1
  82. data/lib/essence.rb +1 -1
  83. data/vendor/assets/stylesheets/essence/flexboxgrid.css +824 -0
  84. metadata +78 -53
  85. data/app/assets/config/essence_manifest.js +0 -5
  86. data/app/assets/stylesheets/essence/beyond/components/_index.scss +0 -17
  87. data/app/assets/stylesheets/essence/beyond/layout/_index.scss +0 -1
  88. data/app/assets/stylesheets/essence/beyond/simple_form/_control.scss +0 -172
  89. data/app/assets/stylesheets/essence/beyond/simple_form/_error.scss +0 -27
  90. data/app/assets/stylesheets/essence/beyond/simple_form/_fieldset.scss +0 -34
  91. data/app/assets/stylesheets/essence/beyond/simple_form/_group.scss +0 -6
  92. data/app/assets/stylesheets/essence/beyond/simple_form/_hint.scss +0 -8
  93. data/app/assets/stylesheets/essence/beyond/simple_form/_index.scss +0 -43
  94. data/app/assets/stylesheets/essence/beyond/simple_form/_label.scss +0 -26
  95. data/app/assets/stylesheets/essence/beyond/simple_form/_wrapper.scss +0 -5
  96. data/app/assets/stylesheets/essence/beyond.scss +0 -4
  97. data/app/components/essence/action_bar_component/action_bar_component.scss +0 -29
  98. data/app/components/essence/app_info_component/app_info_component.scss +0 -45
  99. data/app/components/essence/breadcrumb_component/breadcrumb_component.scss +0 -39
  100. data/app/components/essence/button_component/button_component.scss +0 -105
  101. data/app/components/essence/card_component/card_component.scss +0 -21
  102. data/app/components/essence/empty_state_component/empty_state_component.scss +0 -50
  103. data/app/components/essence/link_component/link_component.scss +0 -58
  104. data/app/components/essence/notification_component/notification_component.scss +0 -63
  105. data/app/components/essence/status_component/status_component.scss +0 -80
  106. data/app/components/essence/step_list_component/step_list_component.scss +0 -79
  107. data/app/components/essence/tooltip_component/tooltip_component.scss +0 -63
@@ -4,7 +4,7 @@
4
4
  # components.
5
5
  # See https://github.com/heartcombo/simple_form#custom-components
6
6
  # to know more about custom components.
7
- # Dir[Rails.root.join('lib/components/**/*.rb')].each { |f| require f }
7
+ Essence::Engine.root.glob('lib/components/**/*.rb').each { |f| require f }
8
8
 
9
9
  # Use this setup block to configure all options available in SimpleForm.
10
10
  SimpleForm.setup do |config|
@@ -33,7 +33,6 @@ SimpleForm.setup do |config|
33
33
 
34
34
  config.wrappers :vertical_text,
35
35
  class: 'form-row' do |b|
36
- b.use :html5 # rubocop:disable Naming/VariableNumber
37
36
  b.use :placeholder
38
37
 
39
38
  b.optional :maxlength
@@ -56,8 +55,18 @@ SimpleForm.setup do |config|
56
55
 
57
56
  config.wrappers :vertical_select,
58
57
  class: 'form-row' do |b|
59
- b.use :html5 # rubocop:disable Naming/VariableNumber
58
+ b.use :label, class: 'form-label'
59
+ b.wrapper class: 'form-wrapper' do |bb|
60
+ bb.wrapper class: 'form-group' do |bbb|
61
+ bbb.use :input, class: 'form-control', error_class: 'invalid', valid_class: 'valid'
62
+ end
63
+ bb.use :error, wrap_with: { tag: :p, class: 'form-error' }
64
+ end
65
+ b.use :hint, wrap_with: { tag: :div, class: 'form-hint' }
66
+ end
60
67
 
68
+ config.wrappers :vertical_multi_select,
69
+ class: 'form-row' do |b|
61
70
  b.use :label, class: 'form-label'
62
71
  b.wrapper class: 'form-wrapper' do |bb|
63
72
  bb.wrapper class: 'form-group' do |bbb|
@@ -68,10 +77,22 @@ SimpleForm.setup do |config|
68
77
  b.use :hint, wrap_with: { tag: :div, class: 'form-hint' }
69
78
  end
70
79
 
71
- config.wrappers :vertical_boolean,
80
+ config.wrappers :vertical_file,
72
81
  class: 'form-row' do |b|
73
- b.use :html5 # rubocop:disable Naming/VariableNumber
82
+ b.use :html5
74
83
 
84
+ b.use :label, class: 'form-label'
85
+ b.wrapper class: 'form-wrapper' do |bb|
86
+ bb.wrapper class: 'form-group' do |bbb|
87
+ bbb.use :input, class: 'button button-outline form-control', error_class: 'invalid', valid_class: 'valid'
88
+ end
89
+ bb.use :error, wrap_with: { tag: :p, class: 'form-error' }
90
+ end
91
+ b.use :hint, wrap_with: { tag: :div, class: 'form-hint' }
92
+ end
93
+
94
+ config.wrappers :vertical_boolean,
95
+ class: 'form-row' do |b|
75
96
  b.wrapper class: 'form-wrapper' do |bb|
76
97
  bb.wrapper class: 'form-group' do |bbb|
77
98
  bbb.use :input, class: 'form-control', error_class: 'invalid', valid_class: 'valid'
@@ -86,8 +107,6 @@ SimpleForm.setup do |config|
86
107
  item_label_class: 'form-label',
87
108
  tag: :fieldset,
88
109
  class: 'form-row form-fieldset' do |b|
89
- b.use :html5 # rubocop:disable Naming/VariableNumber
90
-
91
110
  b.wrapper :legend_tag, tag: :legend, class: 'form-legend' do |bb|
92
111
  bb.use :label_text
93
112
  end
@@ -105,9 +124,11 @@ SimpleForm.setup do |config|
105
124
  config.wrapper_mappings = {
106
125
  boolean: :vertical_boolean,
107
126
  check_boxes: :vertical_collection,
127
+ country: :vertical_select,
128
+ date: :vertical_multi_select,
129
+ file: :vertical_file,
108
130
  radio_buttons: :vertical_collection,
109
131
  select: :vertical_select,
110
- country: :vertical_select,
111
132
  toggle: :vertical_boolean
112
133
  }
113
134
 
@@ -6,3 +6,6 @@ en:
6
6
  html: '*'
7
7
  error_notification:
8
8
  default_message: "Please review the problems below:"
9
+ file_input:
10
+ change_file: "Change file"
11
+ choose_file: "Choose file"
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Components
4
+ module InputGroup
5
+ def prepend(_wrapper_options = nil)
6
+ return if options[:prepend].blank?
7
+
8
+ @prepend ||= template.content_tag(:div, options[:prepend], class: 'form-control-prepend')
9
+ end
10
+
11
+ def append(_wrapper_options = nil)
12
+ return if options[:append].blank?
13
+
14
+ @append ||= template.content_tag(:div, options[:append], class: 'form-control-append')
15
+ end
16
+ end
17
+ end
18
+
19
+ SimpleForm.include_component(Components::InputGroup)
@@ -4,9 +4,9 @@ require 'country_select'
4
4
  require 'gretel'
5
5
  require 'importmap-rails'
6
6
  require 'inline_svg'
7
- require 'sassc-rails'
8
7
  require 'simple_form'
9
8
  require 'stimulus-rails'
9
+ require 'turbo-rails'
10
10
  require 'view_component'
11
11
 
12
12
  module Essence
@@ -26,16 +26,31 @@ module Essence
26
26
  config.view_component.preview_paths << root.join('site/app/previews')
27
27
  config.view_component.component_parent_class = 'ApplicationComponent'
28
28
 
29
+ initializer 'essence.add_default_flash_types' do
30
+ ActiveSupport.on_load(:action_controller_base) do
31
+ add_flash_types(*NotificationComponent::VARIANT_OPTIONS)
32
+ end
33
+ end
34
+
29
35
  initializer 'essence.assets' do |app|
30
36
  app.config.assets.paths << root.join('app/javascript')
31
37
  app.config.assets.paths << root.join('app/components')
32
38
  app.config.assets.paths << root.join('vendor/javascript')
33
- app.config.assets.precompile += ['essence_manifest']
34
39
  end
35
40
 
36
- initializer 'essence.importmap', before: 'importmap' do |app|
37
- app.config.importmap.paths << root.join('config/importmap.rb')
38
- app.config.importmap.cache_sweepers << root.join('app/javascript')
41
+ initializer 'essence.importmap', after: 'importmap' do |app|
42
+ Essence.importmap.draw(app.root.join('config/importmap.rb'))
43
+ Essence.importmap.draw(root.join('config/importmap.rb'))
44
+
45
+ if app.config.importmap.sweep_cache && app.config.reloading_enabled?
46
+ Essence.importmap.cache_sweeper(watches: [app.root.join('app/javascript'),
47
+ root.join('app/javascript'),
48
+ root.join('app/components')])
49
+
50
+ ActiveSupport.on_load(:action_controller_base) do
51
+ before_action { Essence.importmap.cache_sweeper.execute_if_updated }
52
+ end
53
+ end
39
54
  end
40
55
  end
41
56
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Essence
4
- VERSION = '0.1.0'
4
+ VERSION = '0.2.0'
5
5
  end
data/lib/essence.rb CHANGED
@@ -4,5 +4,5 @@ require 'essence/version'
4
4
  require 'essence/engine'
5
5
 
6
6
  module Essence
7
- # Your code goes here...
7
+ mattr_accessor :importmap, default: Importmap::Map.new
8
8
  end