matestack-ui-bootstrap 1.4.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +17 -5
  3. data/README.md +53 -19
  4. data/lib/matestack/ui/bootstrap.rb +97 -17
  5. data/{app/concepts → lib}/matestack/ui/bootstrap/apps/admin_template.rb +14 -7
  6. data/lib/matestack/ui/bootstrap/base_component.rb +13 -0
  7. data/lib/matestack/ui/bootstrap/base_vue_js_component.rb +13 -0
  8. data/lib/matestack/ui/bootstrap/components/accordion.rb +58 -0
  9. data/{app/concepts → lib}/matestack/ui/bootstrap/components/alert.js +12 -9
  10. data/lib/matestack/ui/bootstrap/components/alert.rb +43 -0
  11. data/lib/matestack/ui/bootstrap/components/avatar.rb +27 -0
  12. data/lib/matestack/ui/bootstrap/components/badge.rb +32 -0
  13. data/lib/matestack/ui/bootstrap/components/breadcrumb.rb +50 -0
  14. data/lib/matestack/ui/bootstrap/components/button.rb +71 -0
  15. data/lib/matestack/ui/bootstrap/components/button_group.rb +36 -0
  16. data/lib/matestack/ui/bootstrap/components/card.rb +105 -0
  17. data/{app/concepts → lib}/matestack/ui/bootstrap/components/carousel.js +21 -18
  18. data/lib/matestack/ui/bootstrap/components/carousel.rb +103 -0
  19. data/{app/concepts → lib}/matestack/ui/bootstrap/components/close.rb +10 -9
  20. data/{app/concepts → lib}/matestack/ui/bootstrap/components/collapse.js +20 -17
  21. data/lib/matestack/ui/bootstrap/components/collapse.rb +54 -0
  22. data/{app/concepts → lib}/matestack/ui/bootstrap/components/dropdown.js +5 -2
  23. data/{app/concepts → lib}/matestack/ui/bootstrap/components/dropdown.rb +31 -26
  24. data/lib/matestack/ui/bootstrap/components/icon.rb +21 -0
  25. data/lib/matestack/ui/bootstrap/components/list_group.rb +148 -0
  26. data/{app/concepts → lib}/matestack/ui/bootstrap/components/modal.js +24 -21
  27. data/lib/matestack/ui/bootstrap/components/modal.rb +121 -0
  28. data/lib/matestack/ui/bootstrap/components/navbar.rb +163 -0
  29. data/{app/concepts → lib}/matestack/ui/bootstrap/components/page_heading.rb +7 -5
  30. data/{app/concepts → lib}/matestack/ui/bootstrap/components/pagination.rb +15 -13
  31. data/{app/concepts → lib}/matestack/ui/bootstrap/components/popover.js +4 -1
  32. data/{app/concepts → lib}/matestack/ui/bootstrap/components/popover.rb +26 -22
  33. data/{app/concepts → lib}/matestack/ui/bootstrap/components/progress.rb +24 -24
  34. data/lib/matestack/ui/bootstrap/components/scrollspy.rb +50 -0
  35. data/lib/matestack/ui/bootstrap/components/section_card.rb +33 -0
  36. data/lib/matestack/ui/bootstrap/components/spinner.rb +35 -0
  37. data/lib/matestack/ui/bootstrap/components/tab_nav.rb +79 -0
  38. data/lib/matestack/ui/bootstrap/components/tab_nav_content.rb +35 -0
  39. data/{app/concepts → lib}/matestack/ui/bootstrap/components/toast.js +27 -18
  40. data/lib/matestack/ui/bootstrap/components/toast.rb +113 -0
  41. data/{app/concepts → lib}/matestack/ui/bootstrap/components/tooltip.js +4 -1
  42. data/lib/matestack/ui/bootstrap/components/tooltip.rb +66 -0
  43. data/{app/concepts → lib}/matestack/ui/bootstrap/content/figure.rb +4 -2
  44. data/lib/matestack/ui/bootstrap/content/smart_collection/collection.rb +120 -0
  45. data/{app/concepts/matestack/ui/bootstrap/content/collection → lib/matestack/ui/bootstrap/content/smart_collection}/collection.scss +0 -0
  46. data/lib/matestack/ui/bootstrap/content/smart_collection/content.rb +118 -0
  47. data/{app/concepts/matestack/ui/bootstrap/content/collection → lib/matestack/ui/bootstrap/content/smart_collection}/filter.rb +7 -3
  48. data/{app/concepts/matestack/ui/bootstrap/content/collection → lib/matestack/ui/bootstrap/content/smart_collection}/paginate.rb +19 -14
  49. data/lib/matestack/ui/bootstrap/form/checkbox.rb +90 -0
  50. data/lib/matestack/ui/bootstrap/form/input.rb +118 -0
  51. data/lib/matestack/ui/bootstrap/form/radio.rb +57 -0
  52. data/lib/matestack/ui/bootstrap/form/select.rb +63 -0
  53. data/lib/matestack/ui/bootstrap/form/submit.rb +20 -0
  54. data/lib/matestack/ui/bootstrap/form/switch.rb +32 -0
  55. data/lib/matestack/ui/bootstrap/form/textarea.rb +49 -0
  56. data/lib/matestack/ui/bootstrap/index.js +24 -0
  57. data/lib/matestack/ui/bootstrap/layout/column.rb +49 -0
  58. data/{app/concepts → lib}/matestack/ui/bootstrap/layout/container.rb +12 -9
  59. data/lib/matestack/ui/bootstrap/layout/row.rb +25 -0
  60. data/{app/concepts → lib}/matestack/ui/bootstrap/layout/sidebar.js +5 -2
  61. data/{app/concepts → lib}/matestack/ui/bootstrap/layout/sidebar.rb +10 -10
  62. data/{app/concepts → lib}/matestack/ui/bootstrap/layout/sidebar.scss +0 -0
  63. data/lib/matestack/ui/bootstrap/registry.rb +173 -0
  64. data/{app/javascript/matestack-ui-bootstrap → lib/matestack/ui/bootstrap}/stylesheets/matestack-ui-bootstrap.scss +0 -0
  65. data/lib/matestack/ui/bootstrap/version.rb +1 -1
  66. data/lib/tasks/matestack/ui/bootstrap_tasks.rake +25 -25
  67. metadata +68 -76
  68. data/app/assets/images/avatar-placeholder.png +0 -0
  69. data/app/assets/images/icons/bootstrap-icons.svg +0 -1
  70. data/app/concepts/matestack/ui/bootstrap/components/accordion.rb +0 -53
  71. data/app/concepts/matestack/ui/bootstrap/components/alert.rb +0 -34
  72. data/app/concepts/matestack/ui/bootstrap/components/avatar.rb +0 -27
  73. data/app/concepts/matestack/ui/bootstrap/components/badge.rb +0 -30
  74. data/app/concepts/matestack/ui/bootstrap/components/breadcrumb.rb +0 -46
  75. data/app/concepts/matestack/ui/bootstrap/components/button.rb +0 -54
  76. data/app/concepts/matestack/ui/bootstrap/components/button_group.rb +0 -36
  77. data/app/concepts/matestack/ui/bootstrap/components/card.rb +0 -100
  78. data/app/concepts/matestack/ui/bootstrap/components/carousel.rb +0 -85
  79. data/app/concepts/matestack/ui/bootstrap/components/chart.js +0 -232
  80. data/app/concepts/matestack/ui/bootstrap/components/chart.rb +0 -71
  81. data/app/concepts/matestack/ui/bootstrap/components/collapse.rb +0 -43
  82. data/app/concepts/matestack/ui/bootstrap/components/icon.rb +0 -19
  83. data/app/concepts/matestack/ui/bootstrap/components/list_group.rb +0 -83
  84. data/app/concepts/matestack/ui/bootstrap/components/modal.rb +0 -106
  85. data/app/concepts/matestack/ui/bootstrap/components/navbar.rb +0 -120
  86. data/app/concepts/matestack/ui/bootstrap/components/scrollspy.rb +0 -33
  87. data/app/concepts/matestack/ui/bootstrap/components/section_card.rb +0 -31
  88. data/app/concepts/matestack/ui/bootstrap/components/spinner.rb +0 -31
  89. data/app/concepts/matestack/ui/bootstrap/components/tab_nav.rb +0 -81
  90. data/app/concepts/matestack/ui/bootstrap/components/tab_nav_content.rb +0 -32
  91. data/app/concepts/matestack/ui/bootstrap/components/toast.rb +0 -99
  92. data/app/concepts/matestack/ui/bootstrap/components/tooltip.rb +0 -82
  93. data/app/concepts/matestack/ui/bootstrap/content/collection/collection.rb +0 -112
  94. data/app/concepts/matestack/ui/bootstrap/content/collection/content.rb +0 -101
  95. data/app/concepts/matestack/ui/bootstrap/form/checkbox.rb +0 -90
  96. data/app/concepts/matestack/ui/bootstrap/form/date.js +0 -38
  97. data/app/concepts/matestack/ui/bootstrap/form/date.rb +0 -98
  98. data/app/concepts/matestack/ui/bootstrap/form/input.rb +0 -123
  99. data/app/concepts/matestack/ui/bootstrap/form/radio.rb +0 -65
  100. data/app/concepts/matestack/ui/bootstrap/form/select.haml +0 -11
  101. data/app/concepts/matestack/ui/bootstrap/form/select.rb +0 -74
  102. data/app/concepts/matestack/ui/bootstrap/form/submit.rb +0 -20
  103. data/app/concepts/matestack/ui/bootstrap/form/switch.rb +0 -90
  104. data/app/concepts/matestack/ui/bootstrap/layout/column.rb +0 -47
  105. data/app/concepts/matestack/ui/bootstrap/layout/row.rb +0 -15
  106. data/app/concepts/matestack/ui/bootstrap/pages/devise/sign_in.rb +0 -40
  107. data/app/concepts/matestack/ui/bootstrap/registry.rb +0 -63
  108. data/app/helpers/matestack/ui/bootstrap/application_helper.rb +0 -13
  109. data/app/javascript/matestack-ui-bootstrap/index.js +0 -26
  110. data/app/javascript/packs/matestack-ui-bootstrap.js +0 -2
  111. data/config/routes.rb +0 -2
  112. data/lib/matestack/ui/bootstrap/engine.rb +0 -26
@@ -1,71 +0,0 @@
1
- class Matestack::Ui::Bootstrap::Components::Chart < Matestack::Ui::VueJsComponent
2
- vue_js_component_name "matestack-ui-bootstrap-chart"
3
-
4
- requires :type
5
- requires :datasets
6
- optional :labels
7
- optional :height
8
- optional :width
9
- optional :display_legend
10
- optional :display_x_axes
11
- optional :display_y_axes
12
- optional :cutout_percentage
13
- optional class: { as: :bs_class }
14
-
15
- def setup
16
- @component_config[:type] = type
17
- @component_config[:datasets] = datasets
18
- @component_config[:labels] = labels
19
- @component_config[:display_legend] = !display_legend.nil? ? display_legend : false
20
- @component_config[:display_x_axes] = !display_x_axes.nil? ? display_x_axes : true
21
- @component_config[:display_y_axes] = !display_y_axes.nil? ? display_y_axes : true
22
- @component_config[:display_y_axes] = !display_y_axes.nil? ? display_y_axes : true
23
- @component_config[:cutout_percentage] = !cutout_percentage.nil? ? cutout_percentage : 70
24
- end
25
-
26
- def response
27
- div class: "chart-container #{bs_class}", attributes: { style: "width: 100%; height: 100%;" } do
28
- plain "<canvas ref='chart'></canvas>".html_safe
29
- end
30
- end
31
-
32
- end
33
-
34
- # chart class: "w-50", type: :bar, datasets: [
35
- # {
36
- # label: "€",
37
- # data: [total, last_7_days, last_30_days],
38
- # backgroundColor: :primary
39
- # },
40
- # ], labels: ["total", "last 7 days", "last 30 days"]
41
-
42
- # chart type: :doughnut, datasets: [
43
- # {
44
- # label: "€",
45
- # data: [total, last_7_days, last_30_days],
46
- # backgroundColor: [:orange, :secondary, :primary]
47
- # },
48
- # ], labels: ["total", "last 7 days", "last 30 days"]
49
-
50
- # chart type: :line, datasets: [
51
- # {
52
- # label: "€",
53
- # data: [total, last_7_days, last_30_days],
54
- # borderColor: :primary,
55
- # pointRadius: 0
56
- # },
57
- # {
58
- # label: "€",
59
- # data: [last_7_days, total, last_30_days],
60
- # borderColor: :danger,
61
- # fill: false
62
- # },
63
- # ], labels: ["total", "last 7 days", "last 30 days"], display_x_axes: false, display_y_axes: false
64
-
65
- # chart type: :pie, datasets: [
66
- # {
67
- # label: "€",
68
- # data: [total, last_7_days, last_30_days],
69
- # backgroundColor: [:orange, :secondary, :primary]
70
- # },
71
- # ], labels: ["total", "last 7 days", "last 30 days"]
@@ -1,43 +0,0 @@
1
- class Matestack::Ui::Bootstrap::Components::Collapse < Matestack::Ui::VueJsComponent
2
- vue_js_component_name "matestack-ui-bootstrap-collapse"
3
-
4
- optional :multi, :labelledby, :parent, class: { as: :bs_class }
5
- optional :card # possible keys: class, text
6
- # event trigger
7
- optional :toggle_on, :show_on, :hide_on, :dispose_on
8
-
9
- def response
10
- div collapse_attributes do
11
- card_partial if card
12
- yield_components
13
- end
14
- end
15
-
16
- protected
17
-
18
- def card_partial
19
- tmp_card = card.is_a?(Hash) ? self.card : { text: self.card }
20
- div class: "card card-body #{tmp_card[:class]}".strip do
21
- plain tmp_card[:text]
22
- end
23
- end
24
-
25
- def collapse_attributes
26
- html_attributes.merge(
27
- class: collapse_classes,
28
- data: { parent: parent },
29
- attributes: { 'aria-labelledby': "#{labelledby}" }
30
- )
31
- end
32
-
33
- def collapse_classes
34
- [].tap do |classes|
35
- classes << 'collapse'
36
- # mulit target
37
- classes << 'multi-collapse' if multi
38
- #custom classes
39
- classes << bs_class
40
- end.join(' ').strip
41
- end
42
-
43
- end
@@ -1,19 +0,0 @@
1
- class Matestack::Ui::Bootstrap::Components::Icon < Matestack::Ui::Component
2
-
3
- requires :name
4
- optional :size
5
- optional class: { as: :bs_class }
6
-
7
- def response
8
- plain " <svg class='bi #{bs_class}' width='#{get_size}' height='#{get_size}' fill='currentColor'>
9
- <use xlink:href='#{image_url("icons/bootstrap-icons.svg")}##{name}'/>
10
- </svg>".html_safe
11
- end
12
-
13
- def get_size
14
- size || 20
15
- end
16
-
17
-
18
-
19
- end
@@ -1,83 +0,0 @@
1
- class Matestack::Ui::Bootstrap::Components::ListGroup < Matestack::Ui::Component
2
- html_attributes :role
3
-
4
- # optional :id
5
- optional :items
6
- optional :horizontal, :horizontal_size, :checkbox
7
- optional :flush, :tablist, class: { as: :bs_class }
8
-
9
-
10
- def response
11
- ul list_group_attributes do
12
- yield_components unless items
13
- list_partial if items
14
- end
15
- end
16
-
17
- protected
18
-
19
- def list_partial
20
- items.each do |item|
21
- case item[:type]
22
- when :link
23
- link link_attrs(item) do
24
- plain item[:text]
25
- end
26
- when :transition
27
- transition link_attrs(item) do
28
- plain item[:text]
29
- end
30
- when :label
31
- label id: item[:id], class: "#{list_classes item, false}" do
32
- input class: "form-check-input me-1", attributes: { 'type': "checkbox", 'value': "" } if checkbox
33
- plain item[:text]
34
- end
35
- else
36
- li id: item[:id], class: "#{list_classes item, false}" do
37
- input class: "form-check-input me-1", attributes: { 'type': "checkbox", 'value': "", 'aria-label': "#{item[:text]}" } if checkbox
38
- plain item[:text]
39
- end
40
- end
41
- end
42
- end
43
-
44
- def list_group_attributes
45
- attributes = {}.tap do |hash|
46
- hash[:class] = list_group_classes
47
- hash[:attributes] = { role: "tablist" } if tablist
48
- end
49
- html_attributes.merge(
50
- attributes
51
- )
52
- end
53
-
54
- def list_group_classes
55
- [].tap do |classes|
56
- classes << 'list-group'
57
- classes << (horizontal_size.present? ? "list-group-horizontal-#{horizontal_size}": "list-group-horizontal") if horizontal
58
- classes << 'list-group-flush' if flush
59
- classes << bs_class
60
- end.join(' ').strip
61
- end
62
-
63
- def link_attrs(item)
64
- {}.tap do |hash|
65
- hash[:id] = item[:id]
66
- hash[:class] = "#{list_classes item, true}"
67
- hash[:data] = { toggle: "list" } if tablist
68
- hash[:attributes] = { 'aria-controls': "#{id}", role: "tab" } if tablist
69
- hash[:path] = item[:path]
70
- end
71
- end
72
-
73
- def list_classes(item, action)
74
- [].tap do |classes|
75
- classes << 'list-group-item'
76
- classes << 'list-group-item-action' if action
77
- classes << "list-group-item-#{item[:variant]}" if item[:variant].present?
78
- classes << 'active' if item[:active]
79
- classes << item[:class]
80
- end.join(' ').strip
81
- end
82
-
83
- end
@@ -1,106 +0,0 @@
1
- class Matestack::Ui::Bootstrap::Components::Modal < Matestack::Ui::VueJsComponent
2
- vue_js_component_name 'matestack-ui-bootstrap-modal'
3
-
4
- # header attributes, expects a hash or string
5
- # possible keys `:class, :text, :size`
6
- optional :header
7
- # body attributes, expects a hash or string
8
- # possible keys `:class, :text`
9
- optional :body
10
- # footer is a dismiss button, expects a hash or string for button text
11
- # possible keys `:class, :text`
12
- optional :footer
13
- optional :fade, :size
14
- optional :fullscreen # fullscreen attribute, expects boolean or bootstrap breakpoint
15
- optional :static, :keyboard, :scrollable, :centered
16
- optional :modal_dialog_class, class: { as: :bs_class }, id: { as: :bs_id }
17
- # event trigger
18
- optional :toggle_on, :show_on, :hide_on, :handle_update_on, :dispose_on
19
-
20
- optional :slots
21
-
22
- def response
23
- div modal_attributes do
24
- div class: dialog_classes do
25
- div class: "modal-content" do
26
- header_partial if header || (slots && slots[:header])
27
- body_partial if body || slots && slots[:body]
28
- footer_partial if footer || (slots && slots[:footer])
29
- yield_components
30
- end
31
- end
32
- end
33
- end
34
-
35
- protected
36
-
37
- def header_partial
38
- header = self.header.is_a?(Hash) ? self.header : { text: self.header }
39
- div class: "modal-header" do
40
- if slots && slots[:header]
41
- slot slots[:header]
42
- else
43
- heading size: (header[:size] || 5), class: "modal-title #{header[:class]}", text: header[:text] if header[:text].present?
44
- bs_close dismiss: 'modal'
45
- end
46
- end
47
- end
48
-
49
- def body_partial
50
- body = self.body.is_a?(Hash) ? self.body : { text: self.body }
51
- div class: "modal-body #{body[:class]}".strip do
52
- if slots && slots[:body]
53
- slot slots[:body]
54
- else
55
- plain body[:text] if body[:text].present?
56
- end
57
- end
58
- end
59
-
60
- def footer_partial
61
- footer = self.footer.is_a?(Hash) ? self.footer : { text: self.footer }
62
- div class: "modal-footer" do
63
- slot slots[:footer] if slots && slots[:footer]
64
- if footer[:text].present?
65
- button class: "btn #{footer[:class].present? ? footer[:class] : 'btn-secondary'}",
66
- data: { dismiss: 'modal' }, attributes: { type: 'button' },
67
- text: footer[:text]
68
- end
69
- end
70
- end
71
-
72
- def modal_attributes
73
- attributes = {}.tap do |hash|
74
- hash[:class] = modal_classes
75
- hash[:attributes] = { 'tabindex': "-1", 'aria-labelledby': "#{bs_id}Label", 'aria-hidden': "true" }
76
- hash[:data] = {}.tap do |data|
77
- data[:backdrop] = "static" if static
78
- data[:keyboard] = "false" if keyboard
79
- end
80
- end
81
- html_attributes.merge(
82
- attributes
83
- )
84
- end
85
-
86
- def modal_classes
87
- [].tap do |classes|
88
- classes << 'modal'
89
- classes << 'fade' if fade || !fade.present?
90
- classes << bs_class
91
- end.join(' ').strip
92
- end
93
-
94
- def dialog_classes
95
- [].tap do |classes|
96
- classes << 'modal-dialog'
97
- classes << 'modal-dialog-centered' if centered
98
- classes << 'modal-dialog-scrollable' if scrollable
99
- classes << "modal-#{size}" if size
100
- if fullscreen.present?
101
- classes << (fullscreen == true ? 'modal-fullscreen' : "modal-fullscreen-#{fullscreen}-down")
102
- end
103
- classes << modal_dialog_class
104
- end.join(' ').strip
105
- end
106
- end
@@ -1,120 +0,0 @@
1
- class Matestack::Ui::Bootstrap::Components::Navbar < Matestack::Ui::Component
2
-
3
- POS_ATTRIBUTES = %i[fixed_top fixed_bottom sticky_top]
4
- optional *POS_ATTRIBUTES
5
-
6
- optional class: { as: :bs_class }
7
- optional :items, :items_class, :theme, :hide_at, :color, :container_size
8
- optional :collapse_class
9
- # brand expect hash or string, possible keys for hash: text, path, img
10
- optional :brand
11
- # toogle expect hash or a symbol (:left or :right),
12
- # possible keys for hash: position, class
13
- optional :toggle
14
-
15
- def prepare
16
- @toggle = self.toggle.is_a?(Hash) ? self.toggle : { position: self.toggle }
17
- end
18
-
19
- def response
20
- nav navbar_attributes do
21
- bs_container size: "#{container_size.present? ? container_size : "fluid" }" do
22
- # custom elements for navbar
23
- if options[:slots] && options[:slots][:custom_items]
24
- slot options[:slots][:custom_items]
25
- else
26
- toggle_button if @toggle[:position] == :left
27
- brand_partial
28
- toggle_button if !@toggle[:position].present? || @toggle[:position] == :right
29
- navbar_content_partial
30
- end
31
- end
32
- end
33
- end
34
-
35
- protected
36
-
37
- def brand_partial
38
- brand = self.brand.is_a?(Hash) ? self.brand : { text: self.brand }
39
- path = brand[:path].present? ? brand[:path] : "/"
40
- link class: "navbar-brand", path: path do
41
- img height: 40, path: brand[:img], attributes: { loading: "lazy" } if brand[:img].present?
42
- plain brand[:text]
43
- end
44
- end
45
-
46
- def navbar_content_partial
47
- div class: "collapse navbar-collapse #{collapse_class}", id: 'matestackNavbarContent' do
48
- ul class: items_classes do
49
- items.each do |item|
50
- li class: "nav-item" do
51
- if item[:type] == :link
52
- link class: "nav-link", path: item[:path] do
53
- bs_icon name: item[:icon], size: 20 if item[:icon]
54
- span class: "ps-3", text: item[:text] if item[:text]
55
- end
56
- else
57
- transition class: "nav-link", path: item[:path], delay: item[:delay] do
58
- bs_icon name: item[:icon], size: 20 if item[:icon]
59
- span class: "ps-3", text: item[:text] if item[:text]
60
- end
61
- end
62
- end
63
- end
64
- end
65
- yield_components
66
- end
67
- end
68
-
69
- def navbar_attributes
70
- html_attributes.merge(
71
- class: navbar_classes
72
- )
73
- end
74
-
75
- def navbar_classes
76
- [].tap do |classes|
77
- classes << "navbar"
78
- POS_ATTRIBUTES.each do |pos|
79
- classes << "#{pos}".gsub('_','-') if self.send("#{pos}")
80
- end
81
- classes << "navbar-expand-#{ (hide_at.present? ? hide_at : "lg") }"
82
- classes << "navbar-#{theme}" if theme.present?
83
- classes << (color.present? ? "bg-#{color}" : "bg-#{theme}") if theme || color
84
- classes << bs_class
85
- end.join(' ').strip
86
- end
87
-
88
- def toggle_button
89
- button toggle_attributes do
90
- bs_icon name: "list", size: 25, class: "text-muted"
91
- end
92
- # button toggle_attributes do
93
- # span class: "navbar-toggler-icon"
94
- # end
95
- end
96
-
97
- def toggle_attributes
98
- toggle_classes = [].tap do |classes|
99
- classes << 'd-lg-none'
100
- classes << 'btn btn-link'
101
- classes << "ms-auto" if @toggle[:position] == :right
102
- classes << "me-auto" if @toggle[:position] == :left
103
- classes << @toggle[:class] if @toggle[:class]
104
- end.join(' ').strip
105
-
106
- {}.tap do |hash|
107
- hash[:class] = toggle_classes
108
- hash[:data] = { toggle: 'collapse', target: '#matestackNavbarContent' }
109
- hash[:attributes] = { 'aria-controls': 'matestackNavbarContent', 'aria-expanded': 'false', 'aria-label': 'Toggle navigation' }
110
- end
111
- end
112
-
113
- def items_classes
114
- [].tap do |classes|
115
- classes << 'navbar-nav'
116
- classes << (items_class.present? ? items_class : "ms-auto mb-2 mb-lg-0")
117
- # classes << "ms-auto" unless items_class.present?
118
- end.join(' ').strip
119
- end
120
- end