alveole 0.0.1 → 1.0.0.pre.alpha.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (139) hide show
  1. checksums.yaml +4 -4
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +21 -26
  4. data/Rakefile +6 -8
  5. data/app/assets/config/alveole_manifest.js +5 -0
  6. data/app/assets/images/alveole/icons/favicon-150.png +0 -0
  7. data/app/assets/javascripts/alveole/application.js +10 -0
  8. data/app/assets/stylesheets/alveole/application.css +15 -0
  9. data/app/assets/stylesheets/application.tailwind.css +13 -0
  10. data/app/components/alveole/button_component.html.erb +10 -0
  11. data/app/components/alveole/button_component.rb +46 -0
  12. data/app/components/alveole/chip_component.html.erb +3 -0
  13. data/app/components/alveole/chip_component.rb +23 -0
  14. data/app/components/alveole/dropdown/menu_item_component.html.erb +2 -0
  15. data/app/components/alveole/dropdown/menu_item_component.rb +5 -0
  16. data/app/components/alveole/dropdown_component.html.erb +27 -0
  17. data/app/components/alveole/dropdown_component.rb +21 -0
  18. data/app/components/alveole/footer/link_component.html.erb +6 -0
  19. data/app/components/alveole/footer/link_component.rb +8 -0
  20. data/app/components/alveole/footer_component.html.erb +14 -0
  21. data/app/components/alveole/footer_component.rb +9 -0
  22. data/app/components/alveole/form_layout_component.html.erb +32 -0
  23. data/app/components/alveole/form_layout_component.rb +43 -0
  24. data/app/components/alveole/icon_component.html.erb +1 -0
  25. data/app/components/alveole/icon_component.rb +20 -0
  26. data/app/components/alveole/input/avatar_component.html.erb +16 -0
  27. data/app/components/alveole/input/avatar_component.rb +4 -0
  28. data/app/components/alveole/input/base_component.rb +16 -0
  29. data/app/components/alveole/input/comment_component.html.erb +153 -0
  30. data/app/components/alveole/input/comment_component.rb +5 -0
  31. data/app/components/alveole/input/counter_component.html.erb +16 -0
  32. data/app/components/alveole/input/counter_component.rb +4 -0
  33. data/app/components/alveole/input/email_component.html.erb +17 -0
  34. data/app/components/alveole/input/email_component.rb +4 -0
  35. data/app/components/alveole/input/file_component.html.erb +4 -0
  36. data/app/components/alveole/input/file_component.rb +4 -0
  37. data/app/components/alveole/input/search_component.html.erb +7 -0
  38. data/app/components/alveole/input/search_component.rb +5 -0
  39. data/app/components/alveole/input/select_component.html.erb +4 -0
  40. data/app/components/alveole/input/select_component.rb +12 -0
  41. data/app/components/alveole/input/text_component.html.erb +17 -0
  42. data/app/components/alveole/input/text_component.rb +4 -0
  43. data/app/components/alveole/input/textarea_component.html.erb +16 -0
  44. data/app/components/alveole/input/textarea_component.rb +4 -0
  45. data/app/components/alveole/mega_menu_component.html.erb +107 -0
  46. data/app/components/alveole/mega_menu_component.rb +6 -0
  47. data/app/components/alveole/sidebar/divider_component.html.erb +5 -0
  48. data/app/components/alveole/sidebar/divider_component.rb +5 -0
  49. data/app/components/alveole/sidebar/group_component.html.erb +7 -0
  50. data/app/components/alveole/sidebar/group_component.rb +37 -0
  51. data/app/components/alveole/sidebar/heading_component.html.erb +3 -0
  52. data/app/components/alveole/sidebar/heading_component.rb +8 -0
  53. data/app/components/alveole/sidebar/item_component.html.erb +14 -0
  54. data/app/components/alveole/sidebar/item_component.rb +17 -0
  55. data/app/components/alveole/sidebar_component.html.erb +13 -0
  56. data/app/components/alveole/sidebar_component.rb +40 -0
  57. data/app/controllers/alveole/application_controller.rb +4 -0
  58. data/app/helpers/alveole/application_helper.rb +4 -0
  59. data/app/jobs/alveole/application_job.rb +4 -0
  60. data/app/mailers/alveole/application_mailer.rb +6 -0
  61. data/app/models/alveole/application_record.rb +5 -0
  62. data/app/views/layouts/alveole/application.html.erb +28 -0
  63. data/config/importmap.rb +7 -0
  64. data/config/routes.rb +2 -0
  65. data/config/tailwind.config.js +42 -0
  66. data/lib/alveole/engine.rb +18 -21
  67. data/lib/alveole/version.rb +1 -1
  68. data/lib/alveole.rb +2 -12
  69. data/lib/tasks/alveole_tasks.rake +14 -0
  70. metadata +110 -110
  71. data/.gitignore +0 -8
  72. data/.gitlab-ci.yml +0 -55
  73. data/.rubocop.yml +0 -63
  74. data/.rubocop_todo.yml +0 -12
  75. data/.travis.yml +0 -6
  76. data/CODE_OF_CONDUCT.md +0 -74
  77. data/Gemfile +0 -7
  78. data/Gemfile.lock +0 -171
  79. data/LICENSE.txt +0 -21
  80. data/alveole.gemspec +0 -35
  81. data/bin/console +0 -14
  82. data/bin/setup +0 -8
  83. data/lib/alveole/components/avatar_component/avatar_component.html.slim +0 -6
  84. data/lib/alveole/components/avatar_component.rb +0 -9
  85. data/lib/alveole/components/badge_component/badge_component.html.slim +0 -2
  86. data/lib/alveole/components/badge_component.rb +0 -8
  87. data/lib/alveole/components/breadcrumb_component/breadcrumb_component.html.slim +0 -2
  88. data/lib/alveole/components/breadcrumb_component.rb +0 -8
  89. data/lib/alveole/components/breadcrumbs_component.rb +0 -7
  90. data/lib/alveole/components/button_component/button_component.html.slim +0 -5
  91. data/lib/alveole/components/button_component.rb +0 -15
  92. data/lib/alveole/components/definition_component/definition_component.html.slim +0 -4
  93. data/lib/alveole/components/definition_component.rb +0 -13
  94. data/lib/alveole/components/form_component/form_component.html.slim +0 -3
  95. data/lib/alveole/components/form_component.rb +0 -3
  96. data/lib/alveole/components/form_submit_component/form_submit_component.html.slim +0 -1
  97. data/lib/alveole/components/form_submit_component.rb +0 -7
  98. data/lib/alveole/components/heading_component/heading_component.html.slim +0 -4
  99. data/lib/alveole/components/heading_component.rb +0 -8
  100. data/lib/alveole/components/input_component/input_component.html.slim +0 -17
  101. data/lib/alveole/components/input_component.rb +0 -42
  102. data/lib/alveole/components/notice_component/notice_component.html.slim +0 -5
  103. data/lib/alveole/components/notice_component.rb +0 -15
  104. data/lib/alveole/components/page_component/page_component.html.slim +0 -10
  105. data/lib/alveole/components/page_component.rb +0 -4
  106. data/lib/alveole/components/sidebar_component/sidebar_component.html.slim +0 -7
  107. data/lib/alveole/components/sidebar_component.rb +0 -4
  108. data/lib/alveole/components/table_column_component/table_column_component.html.slim +0 -3
  109. data/lib/alveole/components/table_column_component.rb +0 -12
  110. data/lib/alveole/components/table_component/table_component.html.slim +0 -7
  111. data/lib/alveole/components/table_component.rb +0 -3
  112. data/lib/alveole/components/table_header_component/table_header_component.html.slim +0 -2
  113. data/lib/alveole/components/table_header_component.rb +0 -8
  114. data/lib/alveole/components/table_row_component/table_row_component.html.slim +0 -4
  115. data/lib/alveole/components/table_row_component.rb +0 -3
  116. data/lib/alveole/components/toolbar_component/toolbar_component.html.slim +0 -7
  117. data/lib/alveole/components/toolbar_component.rb +0 -4
  118. data/lib/alveole/concerns/bem.rb +0 -21
  119. data/lib/alveole/helpers/method_helper.rb +0 -31
  120. data/lib/alveole/javascript/components.js +0 -5
  121. data/lib/alveole/previews/avatar_component_preview.rb +0 -11
  122. data/lib/alveole/previews/badge_component_preview.rb +0 -11
  123. data/lib/alveole/previews/breadcrumb_component_preview.rb +0 -15
  124. data/lib/alveole/previews/button_component_preview.rb +0 -7
  125. data/lib/alveole/previews/definition_component_preview.rb +0 -33
  126. data/lib/alveole/previews/form_component_preview.rb +0 -18
  127. data/lib/alveole/previews/form_submit_component_preview.rb +0 -7
  128. data/lib/alveole/previews/heading_component_preview.rb +0 -11
  129. data/lib/alveole/previews/input_component_preview.rb +0 -32
  130. data/lib/alveole/previews/notice_component_preview.rb +0 -15
  131. data/lib/alveole/previews/page_component_preview.rb +0 -33
  132. data/lib/alveole/previews/sidebar_component_preview.rb +0 -33
  133. data/lib/alveole/previews/table_column_component_preview.rb +0 -36
  134. data/lib/alveole/previews/table_component_preview.rb +0 -12
  135. data/lib/alveole/previews/table_header_component_preview.rb +0 -27
  136. data/lib/alveole/previews/table_row_component_preview.rb +0 -18
  137. data/lib/alveole/previews/toolbar_component_preview.rb +0 -33
  138. data/lib/generators/alveole/config_generator.rb +0 -17
  139. data/lib/generators/alveole/templates/alveole_config.rb +0 -1
@@ -1,21 +0,0 @@
1
- module Alveole
2
- module Concerns
3
- module Bem
4
- extend ActiveSupport::Concern
5
-
6
- included do
7
- const_set('COMPONENT_NAME', name.gsub('Component', '').underscore.dasherize)
8
- const_set('MODIFIERS', [])
9
- end
10
-
11
- def modifiers=(values)
12
- @bem_classes ||= []
13
- @modifiers = values & self.class::MODIFIERS
14
-
15
- @modifiers.each do |modifier|
16
- @bem_classes << "#{self.class::COMPONENT_NAME}--#{modifier.to_s.dasherize}"
17
- end
18
- end
19
- end
20
- end
21
- end
@@ -1,31 +0,0 @@
1
- module Alveole
2
- module Helper
3
- module ComponentHelper
4
- def component(name, *args, &block)
5
- component_args = {}
6
- component_args = args.pop if args[-1].is_a? Hash
7
- component_args[:modifiers] = args unless args.empty?
8
- component_class = "#{name}_component".camelize.constantize
9
-
10
- render(component_class.new(**component_args), &block)
11
- end
12
-
13
- def format_value(value, options = {})
14
- return if value.nil?
15
-
16
- v = value
17
- v = I18n.l(v.to_date, format: :short) if options[:date]
18
- v = I18n.l(v.to_datetime, format: :short) if options[:time]
19
-
20
- v
21
- end
22
-
23
- def label_for(obj, fieldname)
24
- return unless obj && fieldname
25
-
26
- return obj.class.human_attribute_name(fieldname) if obj.class.respond_to?(:human_attribute_name)
27
- return obj.klass.human_attribute_name(fieldname) if obj.respond_to?(:klass) && obj.klass.respond_to?(:human_attribute_name)
28
- end
29
- end
30
- end
31
- end
@@ -1,5 +0,0 @@
1
- // Import in Application.js:
2
- // import '../components';
3
-
4
- // BUTTON
5
- import '../components/button_component/button_component.scss'
@@ -1,11 +0,0 @@
1
- class AvatarComponentPreview < ViewComponent::Preview
2
- layout false
3
-
4
- def default
5
- render(AvatarComponent.new(image: '/example/image', url: '/example/url'))
6
- end
7
-
8
- def without_url
9
- render(AvatarComponent.new(image: '/example/image'))
10
- end
11
- end
@@ -1,11 +0,0 @@
1
- class BadgeComponentPreview < ViewComponent::Preview
2
- layout false
3
-
4
- def default
5
- render(BadgeComponent.new(label: 'example de badge'))
6
- end
7
-
8
- def with_options
9
- render(BadgeComponent.new(label: 'example de badge', options: { data: 'example-option' }))
10
- end
11
- end
@@ -1,15 +0,0 @@
1
- class BreadcrumbComponentPreview < ViewComponent::Preview
2
- layout false
3
-
4
- def default
5
- render(BreadcrumbComponent.new(label: 'Example Breadcrumb', url: '/example/url'))
6
- end
7
-
8
- def without_url
9
- render(BreadcrumbComponent.new(label: 'Example Breadcrumb'))
10
- end
11
-
12
- def breadcrumbs
13
- render(BreadcrumbsComponent.new)
14
- end
15
- end
@@ -1,7 +0,0 @@
1
- class ButtonComponentPreview < ViewComponent::Preview
2
- layout false
3
-
4
- def default
5
- render(ButtonComponent.new(label: 'Example button', url: '/example/url'))
6
- end
7
- end
@@ -1,33 +0,0 @@
1
- class DefinitionComponentPreview < ViewComponent::Preview
2
- class TempObj
3
- def self.human_attribute_name(_)
4
- 'label'
5
- end
6
-
7
- def fieldname
8
- 'value'
9
- end
10
- end
11
-
12
- layout false
13
-
14
- def default
15
- temp_obj = TempObj.new
16
- render(DefinitionComponent.new(label: nil, value: nil, obj: temp_obj, fieldname: :fieldname, options: {}))
17
- end
18
-
19
- def with_label
20
- temp_obj = TempObj.new
21
- render(DefinitionComponent.new(label: 'custom label', value: nil, obj: temp_obj, fieldname: :fieldname, options: {}))
22
- end
23
-
24
- def with_value
25
- temp_obj = TempObj.new
26
- render(DefinitionComponent.new(label: nil, value: 'custom value', obj: temp_obj, fieldname: :fieldname, options: {}))
27
- end
28
-
29
- def with_options
30
- temp_obj = TempObj.new
31
- render(DefinitionComponent.new(label: nil, value: nil, obj: temp_obj, fieldname: :fieldname, options: { style: 'color:red' }))
32
- end
33
- end
@@ -1,18 +0,0 @@
1
- class FormComponentPreview < ViewComponent::Preview
2
- layout false
3
-
4
- def default
5
- render(FormComponent.new) do |form|
6
- form.actions do
7
- tag.span('Example actions')
8
- end
9
- tag.span('Example content')
10
- end
11
- end
12
-
13
- def without_actions
14
- render(FormComponent.new) do |_form|
15
- tag.span('Example content')
16
- end
17
- end
18
- end
@@ -1,7 +0,0 @@
1
- class FormSubmitComponentPreview < ViewComponent::Preview
2
- layout false
3
-
4
- def default
5
- render(FormSubmitComponent.new(label: 'Example label'))
6
- end
7
- end
@@ -1,11 +0,0 @@
1
- class HeadingComponentPreview < ViewComponent::Preview
2
- layout false
3
-
4
- def default
5
- render(HeadingComponent.new(heading: 'Example heading', sub: 'Example sub title'))
6
- end
7
-
8
- def without_sub
9
- render(HeadingComponent.new(heading: 'Example heading', sub: nil))
10
- end
11
- end
@@ -1,32 +0,0 @@
1
- class InputComponentPreview < ViewComponent::Preview
2
- class TempObj
3
- attr_accessor :fieldname
4
-
5
- def initialize(fieldname = 'Example value')
6
- @fieldname = fieldname
7
- end
8
-
9
- def self.human_attribute_name(_)
10
- 'label'
11
- end
12
- end
13
-
14
- layout false
15
-
16
- def default
17
- raise 'not implemented yet'
18
- # temp_obj = TempObj.new
19
-
20
- # ActionView::Helpers.form_for temp_obj do |form_builder|
21
- # # form_builder = ActionView::Helpers::FormBuilder.new(:temp_obj, temp_obj, {}, {})
22
-
23
- # render(InputComponent.new(type: :text,
24
- # label: nil,
25
- # value: nil,
26
- # form: form_builder,
27
- # fieldname: :fieldname,
28
- # collection: nil,
29
- # options: {}))
30
- # end
31
- end
32
- end
@@ -1,15 +0,0 @@
1
- class NoticeComponentPreview < ViewComponent::Preview
2
- layout false
3
-
4
- def default
5
- render(NoticeComponent.new(title: 'Example Alert', messages: ['Message 1', 'Message 2']))
6
- end
7
-
8
- def without_messages
9
- render(NoticeComponent.new(title: 'Example Notice'))
10
- end
11
-
12
- def with_type_notice
13
- render(NoticeComponent.new(title: 'Example Notice', messages: ['Message 1', 'Message 2'], type: 'notice'))
14
- end
15
- end
@@ -1,33 +0,0 @@
1
- class PageComponentPreview < ViewComponent::Preview
2
- layout false
3
-
4
- def default
5
- render(PageComponent.new) do |page|
6
- page.actions do
7
- tag.span('Example actions')
8
- end
9
- page.header do
10
- tag.span('Example header')
11
- end
12
- tag.span('Example content')
13
- end
14
- end
15
-
16
- def without_actions
17
- render(PageComponent.new) do |page|
18
- page.header do
19
- tag.span('Example header')
20
- end
21
- tag.span('Example content')
22
- end
23
- end
24
-
25
- def without_header
26
- render(PageComponent.new) do |page|
27
- page.actions do
28
- tag.span('Example actions')
29
- end
30
- tag.span('Example content')
31
- end
32
- end
33
- end
@@ -1,33 +0,0 @@
1
- class SidebarComponentPreview < ViewComponent::Preview
2
- layout false
3
-
4
- def default
5
- render(SidebarComponent.new) do |sidebar|
6
- sidebar.top do
7
- tag.span('Example top')
8
- end
9
- sidebar.bottom do
10
- tag.span('Example bottom')
11
- end
12
- tag.span('Example content')
13
- end
14
- end
15
-
16
- def without_top
17
- render(SidebarComponent.new) do |sidebar|
18
- sidebar.bottom do
19
- tag.span('Example bottom')
20
- end
21
- tag.span('Example content')
22
- end
23
- end
24
-
25
- def without_bottom
26
- render(SidebarComponent.new) do |sidebar|
27
- sidebar.top do
28
- tag.span('Example top')
29
- end
30
- tag.span('Example content')
31
- end
32
- end
33
- end
@@ -1,36 +0,0 @@
1
- class TableColumnComponentPreview < ViewComponent::Preview
2
- class TempObj
3
- attr_accessor :fieldname
4
-
5
- def initialize(fieldname = 'Example value')
6
- @fieldname = fieldname
7
- end
8
- end
9
-
10
- layout false
11
-
12
- def default
13
- temp_obj = TempObj.new
14
- render(TableColumnComponent.new(value: nil, obj: temp_obj, fieldname: :fieldname, url: nil, options: {}))
15
- end
16
-
17
- def with_url
18
- temp_obj = TempObj.new
19
- render(TableColumnComponent.new(value: nil, obj: temp_obj, fieldname: :fieldname, url: 'example/url', options: {}))
20
- end
21
-
22
- def with_date
23
- temp_obj = TempObj.new(Time.zone.today)
24
- render(TableColumnComponent.new(value: nil, obj: temp_obj, fieldname: :fieldname, url: 'example/url', options: { date: true }))
25
- end
26
-
27
- def with_time
28
- temp_obj = TempObj.new(Time.zone.now)
29
- render(TableColumnComponent.new(value: nil, obj: temp_obj, fieldname: :fieldname, url: 'example/url', options: { time: true }))
30
- end
31
-
32
- def with_custom_value
33
- temp_obj = TempObj.new
34
- render(TableColumnComponent.new(value: 'custom value', obj: temp_obj, fieldname: :fieldname, url: nil, options: {}))
35
- end
36
- end
@@ -1,12 +0,0 @@
1
- class TableComponentPreview < ViewComponent::Preview
2
- layout false
3
-
4
- def default
5
- render(TableComponent.new) do |table|
6
- table.headers do
7
- tag.th('Example header')
8
- end
9
- tag.tr(tag.td('Example column'))
10
- end
11
- end
12
- end
@@ -1,27 +0,0 @@
1
- class TableHeaderComponentPreview < ViewComponent::Preview
2
- class TempObj
3
- def self.human_attribute_name(_)
4
- 'label'
5
- end
6
-
7
- def fieldname
8
- 'value'
9
- end
10
- end
11
-
12
- layout false
13
-
14
- def default
15
- temp_obj = TempObj.new
16
- render(TableHeaderComponent.new(label: nil, url: nil, obj: temp_obj, fieldname: :fieldname))
17
- end
18
-
19
- def with_url
20
- temp_obj = TempObj.new
21
- render(TableHeaderComponent.new(label: nil, url: 'example/url', obj: temp_obj, fieldname: :fieldname))
22
- end
23
-
24
- def with_custom_label
25
- render(TableHeaderComponent.new(label: 'Custom label', url: nil, obj: nil, fieldname: nil))
26
- end
27
- end
@@ -1,18 +0,0 @@
1
- class TableRowComponentPreview < ViewComponent::Preview
2
- layout false
3
-
4
- def default
5
- render(TableRowComponent.new) do |tablerow|
6
- tablerow.actions do
7
- tag.td('Example actions')
8
- end
9
- tag.td('Example content')
10
- end
11
- end
12
-
13
- def without_actions
14
- render(TableRowComponent.new) do |_tablerow|
15
- tag.td('Example content')
16
- end
17
- end
18
- end
@@ -1,33 +0,0 @@
1
- class ToolbarComponentPreview < ViewComponent::Preview
2
- layout false
3
-
4
- def default
5
- render(ToolbarComponent.new) do |toolbar|
6
- toolbar.left do
7
- tag.span('Example left')
8
- end
9
- toolbar.right do
10
- tag.span('Example right')
11
- end
12
- tag.span('Example content')
13
- end
14
- end
15
-
16
- def without_left
17
- render(ToolbarComponent.new) do |toolbar|
18
- toolbar.right do
19
- tag.span('Example right')
20
- end
21
- tag.span('Example content')
22
- end
23
- end
24
-
25
- def without_right
26
- render(ToolbarComponent.new) do |toolbar|
27
- toolbar.left do
28
- tag.span('Example left')
29
- end
30
- tag.span('Example content')
31
- end
32
- end
33
- end
@@ -1,17 +0,0 @@
1
- module Alveole
2
- module Generators
3
- # rails g alveole:config
4
- class ConfigGenerator < Rails::Generators::Base # :nodoc:
5
- source_root File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
6
-
7
- desc <<~DESC
8
- Description:
9
- Copies Alveole configuration file to your application's initializer directory.
10
- DESC
11
-
12
- def copy_config_file
13
- template 'alveole_config.rb', 'config/initializers/alveole_config.rb'
14
- end
15
- end
16
- end
17
- end
@@ -1 +0,0 @@
1
- # Alveole