ui_bibz 3.0.0.beta14 → 3.0.0.beta19

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +1 -1
  3. data/.rubocop.yml +0 -1
  4. data/.ruby-version +1 -1
  5. data/Gemfile.lock +101 -97
  6. data/lib/ui_bibz.rb +2 -0
  7. data/lib/ui_bibz/concerns/models/searchable.rb +9 -7
  8. data/lib/ui_bibz/infos.rb +3 -3
  9. data/lib/ui_bibz/inputs/ui_bibz_form/ui_bibz_form_builder.rb +10 -13
  10. data/lib/ui_bibz/inputs/ui_bibz_inputs/collection_input.rb +6 -8
  11. data/lib/ui_bibz/ui/concerns/navigation_concern.rb +12 -0
  12. data/lib/ui_bibz/ui/concerns/notification_concern.rb +13 -0
  13. data/lib/ui_bibz/ui/core/boxes/card.rb +1 -1
  14. data/lib/ui_bibz/ui/core/boxes/components/card_body.rb +1 -1
  15. data/lib/ui_bibz/ui/core/component.rb +5 -1
  16. data/lib/ui_bibz/ui/core/forms/buttons/button.rb +4 -4
  17. data/lib/ui_bibz/ui/core/forms/buttons/button_link.rb +3 -3
  18. data/lib/ui_bibz/ui/core/forms/choices/choice_group.rb +1 -1
  19. data/lib/ui_bibz/ui/core/forms/choices/components/choice.rb +8 -4
  20. data/lib/ui_bibz/ui/core/forms/numbers/formula_field.rb +2 -2
  21. data/lib/ui_bibz/ui/core/forms/numbers/slider_header.rb +2 -2
  22. data/lib/ui_bibz/ui/core/forms/selects/dropdown_select_field.rb +11 -0
  23. data/lib/ui_bibz/ui/core/forms/surrounds/surround_field.rb +1 -1
  24. data/lib/ui_bibz/ui/core/navigations/breadcrumb.rb +1 -1
  25. data/lib/ui_bibz/ui/core/navigations/components/breadcrumb_link.rb +1 -1
  26. data/lib/ui_bibz/ui/core/navigations/components/nav_link_link.rb +1 -1
  27. data/lib/ui_bibz/ui/core/navigations/link.rb +1 -1
  28. data/lib/ui_bibz/ui/core/navigations/nav.rb +1 -5
  29. data/lib/ui_bibz/ui/core/navigations/navbar.rb +2 -6
  30. data/lib/ui_bibz/ui/core/notifications/components/bar.rb +1 -1
  31. data/lib/ui_bibz/ui/core/notifications/components/toast_header.rb +1 -1
  32. data/lib/ui_bibz/ui/core/notifications/popover.rb +2 -6
  33. data/lib/ui_bibz/ui/core/notifications/toast.rb +33 -3
  34. data/lib/ui_bibz/ui/core/notifications/tooltip.rb +2 -6
  35. data/lib/ui_bibz/ui/ux/tables/components/actions.rb +1 -1
  36. data/lib/ui_bibz/ui/ux/tables/components/store.rb +3 -0
  37. data/lib/ui_bibz/ui/ux/tables/extensions/paginable.rb +0 -3
  38. data/lib/ui_bibz/ui/ux/tables/table.rb +6 -2
  39. data/lib/ui_bibz/ui/ux/tables/table_pagination.rb +0 -3
  40. data/lib/ui_bibz/ui/ux/tables/table_pagination_per_page.rb +0 -3
  41. data/lib/ui_bibz/ui/ux/tables/table_search_field.rb +1 -0
  42. data/lib/ui_bibz/utils/breakdown_class_name_generator.rb +2 -2
  43. data/lib/ui_bibz/utils/screwdriver.rb +1 -1
  44. data/test/simple_form_test.rb +36 -27
  45. data/test/ui/core/forms/choices/checkbox_field_test.rb +7 -0
  46. data/test/ui/core/forms/selects/{multi_select_field_test.rb → dropdown_select_field_test.rb} +5 -5
  47. data/test/ui/core/notifications/toast_test.rb +2 -2
  48. data/ui_bibz.gemspec +3 -2
  49. metadata +28 -12
@@ -60,14 +60,12 @@ module UiBibzInputs
60
60
  end
61
61
 
62
62
  def collection
63
- @collection ||= begin
64
- if options[:grouped]
65
- grouped_collection.map { |collection| collection.try(:send, group_method) }.detect(&:present?) || []
66
- else
67
- collection = options.delete(:collection) || self.class.boolean_collection
68
- collection.respond_to?(:call) ? collection.call : collection.to_a
69
- end
70
- end
63
+ @collection ||= if options[:grouped]
64
+ grouped_collection.map { |collection| collection.try(:send, group_method) }.detect(&:present?) || []
65
+ else
66
+ collection = options.delete(:collection) || self.class.boolean_collection
67
+ collection.respond_to?(:call) ? collection.call : collection.to_a
68
+ end
71
69
  end
72
70
 
73
71
  def group_method
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UiBibz::Ui::Concerns::NavigationConcern #:nodoc:
4
+ extend ActiveSupport::Concern
5
+
6
+ included do
7
+ def spacer(num = 'auto')
8
+ kls = " me-#{num}"
9
+ @items.last.html_options[:class].nil? ? @items.last.html_options[:class] = kls : @items.last.html_options[:class] << kls
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UiBibz::Ui::Concerns::NotificationConcern #:nodoc:
4
+ extend ActiveSupport::Concern
5
+
6
+ included do
7
+ def data_attributes
8
+ self.class.const_get('DATA_ATTRIBUTES').filter_map do |data_attribute|
9
+ options[data_attribute].to_s.blank? ? nil : { "data-bs-#{data_attribute}" => data_attribute_value(data_attribute) }
10
+ end.reduce(&:merge) || {}
11
+ end
12
+ end
13
+ end
@@ -90,7 +90,7 @@ module UiBibz::Ui::Core::Boxes
90
90
  class Card < UiBibz::Ui::Core::Component
91
91
  include UiBibz::Ui::Concerns::CardItemableConcern
92
92
 
93
- # See UiBibz::Ui::Core::Component.initialize
93
+ # (see UiBibz::Ui::Core::Component#initialize)
94
94
  def initialize(content = nil, options = nil, html_options = nil, &block)
95
95
  super
96
96
  @items = @content.nil? ? [] : [UiBibz::Ui::Core::Boxes::Components::CardBody.new(@content).render]
@@ -46,7 +46,7 @@ module UiBibz::Ui::Core::Boxes::Components
46
46
  # Render html tag
47
47
  def pre_render
48
48
  if options[:collapse]
49
- content_tag :div, class: join_classes('collapse', show), id: options[:collapse], "data-bs-parent": "##{options[:parent_collapse]}" do
49
+ content_tag :div, class: join_classes('collapse', show), id: options[:collapse], 'data-bs-parent': "##{options[:parent_collapse]}" do
50
50
  content_tag :div, @items.join.html_safe, html_options
51
51
  end
52
52
  else
@@ -122,6 +122,10 @@ module UiBibz::Ui::Core
122
122
  # To turbolinks
123
123
  data_turbolinks = html_options.try(:[], :data).try(:[], :turbolinks) || options.try(:delete, :turbolinks)
124
124
  add_html_data(:turbolinks, value: data_turbolinks) unless data_turbolinks.nil?
125
+
126
+ # To Turbo
127
+ data_turbo = html_options.try(:[], :data).try(:[], :turbo) || options.try(:delete, :turbo)
128
+ add_html_data(:turbo, value: data_turbo) unless data_turbo.nil?
125
129
  end
126
130
 
127
131
  # Override this method to add html Options
@@ -145,7 +149,7 @@ module UiBibz::Ui::Core
145
149
  def add_html_data(name, value: true)
146
150
  html_options[:data] = {} if html_options[:data].nil?
147
151
  value = value.is_a?(String) ? value.strip : value
148
- html_options[:data].update(Hash[name, value])
152
+ html_options[:data].update({ name => value })
149
153
  end
150
154
 
151
155
  def disabled?
@@ -83,10 +83,10 @@ module UiBibz::Ui::Core::Forms::Buttons
83
83
  def collapse
84
84
  # Must be flat hash not deep hash
85
85
  {
86
- "data-bs-toggle": :collapse,
87
- "data-bs-target": "##{options[:collapse]}",
88
- "aria-controls": options[:collapse],
89
- "aria-expanded": options[:expand_collapse].nil? ? false : options[:expand_collapse]
86
+ 'data-bs-toggle': :collapse,
87
+ 'data-bs-target': "##{options[:collapse]}",
88
+ 'aria-controls': options[:collapse],
89
+ 'aria-expanded': options[:expand_collapse].nil? ? false : options[:expand_collapse]
90
90
  }
91
91
  end
92
92
 
@@ -78,9 +78,9 @@ module UiBibz::Ui::Core::Forms::Buttons
78
78
  def collapse
79
79
  # Must be flat hash not deep hash
80
80
  {
81
- "data-bs-toggle": :collapse,
82
- "aria-controls": options[:collapse],
83
- "aria-expanded": options[:expand_collaspe].nil? ? false : options[:expand_collaspe]
81
+ 'data-bs-toggle': :collapse,
82
+ 'aria-controls': options[:collapse],
83
+ 'aria-expanded': options[:expand_collaspe].nil? ? false : options[:expand_collaspe]
84
84
  }
85
85
  end
86
86
  end
@@ -94,7 +94,7 @@ module UiBibz::Ui::Core::Forms::Choices
94
94
 
95
95
  def component_html_data
96
96
  super
97
- add_html_data 'toggle', value: 'buttons'
97
+ add_html_data 'toggle', value: 'buttons' if @options[:form].nil?
98
98
  end
99
99
  end
100
100
  end
@@ -82,10 +82,14 @@ module UiBibz::Ui::Core::Forms::Choices
82
82
  if options[:label]
83
83
  content_tag :label, options[:label], html_options.merge(for: input_id)
84
84
  else
85
- content_tag :label, html_options.merge(for: input_id) do
86
- concat glyph_and_content_html(options[:text].nil? ? @content : ' ')
87
- concat badge_html unless options[:badge].nil?
88
- end
85
+ generated_label
86
+ end
87
+ end
88
+
89
+ def generated_label
90
+ content_tag :label, html_options.merge(for: input_id) do
91
+ concat glyph_and_content_html(options[:text].nil? ? @content : ' ')
92
+ concat badge_html unless options[:badge].nil?
89
93
  end
90
94
  end
91
95
 
@@ -53,7 +53,7 @@ module UiBibz::Ui::Core::Forms::Numbers
53
53
  sf.text_field formula_field_name, nil, text_field_formula_html_options
54
54
  sf.addon '=', class: 'formula-field-sign'
55
55
  sf.text_field content, nil, text_field_input_html_options
56
- sf.addon formula_field_alert_glyph, { class: 'formula-field-alert' }, { data: { "bs-toggle": 'tooltip' } }
56
+ sf.addon formula_field_alert_glyph, { class: 'formula-field-alert' }, { data: { 'bs-toggle': 'tooltip' } }
57
57
  sf.addon @options[:prepend] unless @options[:prepend].nil?
58
58
  end.render
59
59
  end
@@ -86,7 +86,7 @@ module UiBibz::Ui::Core::Forms::Numbers
86
86
  end
87
87
 
88
88
  def content_formula_name
89
- content.to_s.split('').count { |i| i == ']' }.positive? ? content.to_s.gsub(/]$/, '_formula]') : "#{content}_formula"
89
+ content.to_s.chars.count { |i| i == ']' }.positive? ? content.to_s.gsub(/]$/, '_formula]') : "#{content}_formula"
90
90
  end
91
91
 
92
92
  def state
@@ -53,14 +53,14 @@ module UiBibz::Ui::Core::Forms::Numbers
53
53
  def header_min
54
54
  content_tag :div, class: 'slider-header-min' do
55
55
  concat content_tag :label, options[:label_min] || 'Min: ', for: options[:label_for_min]
56
- concat content_tag :span, options[:thumb_min], "data-unit": options[:unit] || options[:unit_min]
56
+ concat content_tag :span, options[:thumb_min], 'data-unit': options[:unit] || options[:unit_min]
57
57
  end
58
58
  end
59
59
 
60
60
  def header_max
61
61
  content_tag :div, class: 'slider-header-max' do
62
62
  concat content_tag :label, options[:label_max] || 'Max: ', for: options[:label_for_max]
63
- concat content_tag :span, options[:thumb_max], "data-unit": options[:unit] || options[:unit_max]
63
+ concat content_tag :span, options[:thumb_max], 'data-unit': options[:unit] || options[:unit_max]
64
64
  end
65
65
  end
66
66
 
@@ -25,6 +25,7 @@ module UiBibz::Ui::Core::Forms::Selects
25
25
  # * +searchable+ - Boolean
26
26
  # * +select_all_option+ - Boolean
27
27
  # * +append+ - String, Html
28
+ # * +non_selected_text+ - String
28
29
  # * +open+ - Boolean
29
30
  # * +theme+ - Symbol, defaut: +:dark+
30
31
  # * +prepend+ - String, Html
@@ -83,10 +84,12 @@ module UiBibz::Ui::Core::Forms::Selects
83
84
  clickable_opt_group
84
85
  collapsible_opt_group
85
86
  searchable
87
+ non_selected_text
86
88
  select_all_options
87
89
  number_displayed
88
90
  dropdown_menu_classes
89
91
  dropdown_classes
92
+ n_selected_text
90
93
  end
91
94
 
92
95
  def clickable_opt_group
@@ -101,6 +104,10 @@ module UiBibz::Ui::Core::Forms::Selects
101
104
  add_html_data('enable_filtering') if options[:searchable]
102
105
  end
103
106
 
107
+ def n_selected_text
108
+ add_html_data('n_selected_text', value: options[:n_selected_text]) if options[:n_selected_text]
109
+ end
110
+
104
111
  def number_displayed
105
112
  add_html_data('number_displayed') if options[:number_displayed]
106
113
  end
@@ -109,6 +116,10 @@ module UiBibz::Ui::Core::Forms::Selects
109
116
  add_html_data('include_select_all_option') if options[:select_all_options]
110
117
  end
111
118
 
119
+ def non_selected_text
120
+ add_html_data('non_selected_text', value: options[:non_selected_text]) if options[:non_selected_text]
121
+ end
122
+
112
123
  def dropdown_menu_classes
113
124
  classes = join_classes(theme, alignment, open)
114
125
  add_html_data('dropdown_menu_classes', value: classes.nil? ? nil : classes.join(' '))
@@ -116,7 +116,7 @@ module UiBibz::Ui::Core::Forms::Surrounds
116
116
  end
117
117
 
118
118
  def dropdown_select_field(content = nil, options = nil, html_options = nil, &block)
119
- html_options = (html_options || {}).merge("data-wrapper-classes": 'input-group-btn')
119
+ html_options = (html_options || {}).merge('data-wrapper-classes': 'input-group-btn')
120
120
  @items << UiBibz::Ui::Core::Forms::Selects::DropdownSelectField.new(content, options, html_options, &block).render
121
121
  end
122
122
 
@@ -93,7 +93,7 @@ module UiBibz::Ui::Core::Navigations
93
93
  private
94
94
 
95
95
  def component_html_options
96
- super.merge({ "arial-label": 'breadcrumb' })
96
+ super.merge({ 'arial-label': 'breadcrumb' })
97
97
  end
98
98
 
99
99
  def model_name
@@ -50,7 +50,7 @@ module UiBibz::Ui::Core::Navigations::Components
50
50
  private
51
51
 
52
52
  def component_html_options
53
- super.merge(options[:current] ? { "aria-current": 'page' } : {})
53
+ super.merge(options[:current] ? { 'aria-current': 'page' } : {})
54
54
  end
55
55
 
56
56
  def component_html_classes
@@ -45,7 +45,7 @@ module UiBibz::Ui::Core::Navigations
45
45
  when 'nav-tabs'
46
46
  html_tag_base
47
47
  when 'list-group'
48
- html_tag_base.merge("aria-controls": sanitize_text(content).parameterize)
48
+ html_tag_base.merge('aria-controls': sanitize_text(content).parameterize)
49
49
  else
50
50
  {}
51
51
  end.merge(options[:a_html] || {})
@@ -58,7 +58,7 @@ module UiBibz::Ui::Core::Navigations
58
58
  def collapse
59
59
  {
60
60
  role: 'button',
61
- data: { "bs-toggle": :collapse },
61
+ data: { 'bs-toggle': :collapse },
62
62
  aria: {
63
63
  controls: options[:collapse],
64
64
  expanded: options[:active_collapse].nil? ? false : options[:active_collapse]
@@ -67,6 +67,7 @@ module UiBibz::Ui::Core::Navigations
67
67
  #
68
68
  class Nav < UiBibz::Ui::Core::Component
69
69
  include UiBibz::Ui::Concerns::HtmlConcern
70
+ include UiBibz::Ui::Concerns::NavigationConcern
70
71
 
71
72
  # See UiBibz::Ui::Core::Component.initialize
72
73
  def initialize(content = nil, options = nil, html_options = nil, &block)
@@ -108,11 +109,6 @@ module UiBibz::Ui::Core::Navigations
108
109
  @items << NavDropdown.new(content, options, html_options).tap(&block)
109
110
  end
110
111
 
111
- def spacer(num = 'auto')
112
- kls = " me-#{num}"
113
- @items.last.html_options[:class].nil? ? @items.last.html_options[:class] = kls : @items.last.html_options[:class] << kls
114
- end
115
-
116
112
  protected
117
113
 
118
114
  def component_html_classes
@@ -75,6 +75,7 @@ module UiBibz::Ui::Core::Navigations
75
75
  #
76
76
  class Navbar < UiBibz::Ui::Core::Component
77
77
  include UiBibz::Ui::Concerns::HtmlConcern
78
+ include UiBibz::Ui::Concerns::NavigationConcern
78
79
 
79
80
  # See UiBibz::Ui::Core::Component.initialize
80
81
  def initialize(content = nil, options = nil, html_options = nil, &block)
@@ -124,11 +125,6 @@ module UiBibz::Ui::Core::Navigations
124
125
  @brand = UiBibz::Ui::Core::Navigations::NavbarBrand.new(content, options, html_options, &block).render
125
126
  end
126
127
 
127
- def spacer(num = 'auto')
128
- kls = " me-#{num}"
129
- @items.last.html_options[:class].nil? ? @items.last.html_options[:class] = kls : @items.last.html_options[:class] << kls
130
- end
131
-
132
128
  def id
133
129
  @id ||= generate_id('navbar-id')
134
130
  end
@@ -163,7 +159,7 @@ module UiBibz::Ui::Core::Navigations
163
159
  end
164
160
 
165
161
  def navbar_toggle_button_html
166
- content_tag :button, '☰', class: 'navbar-toggler hidden-sm-up', type: :button, data: { "bs-toggle": 'collapse', "bs-target": "##{id}" }
162
+ content_tag :button, '☰', class: 'navbar-toggler hidden-sm-up', type: :button, data: { 'bs-toggle': 'collapse', 'bs-target': "##{id}" }
167
163
  end
168
164
 
169
165
  def expand_size
@@ -56,7 +56,7 @@ module UiBibz::Ui::Core::Notifications::Components
56
56
  end
57
57
 
58
58
  def component_html_options
59
- { "aria-valuenow": value, "aria-valuemin": min, "aria-valuemax": max, style: "width: #{value}%", role: 'progressbar' }
59
+ { 'aria-valuenow': value, 'aria-valuemin': min, 'aria-valuemax': max, style: "width: #{value}%", role: 'progressbar' }
60
60
  end
61
61
 
62
62
  def striped
@@ -60,7 +60,7 @@ module UiBibz::Ui::Core::Notifications::Components
60
60
  end
61
61
 
62
62
  def close_button
63
- content_tag :button, '', class: 'ml-2 mb-1 btn-close', "data-bs-dismiss": 'toast', "aria-label": 'Close'
63
+ content_tag :button, '', class: 'ml-2 mb-1 btn-close', 'data-bs-dismiss': 'toast', 'aria-label': 'Close'
64
64
  end
65
65
 
66
66
  def component_html_classes
@@ -47,6 +47,8 @@ module UiBibz::Ui::Core::Notifications
47
47
  # ui_glyph("diamond", popover: { title: "My content", position: :right})
48
48
  #
49
49
  class Popover < UiBibz::Ui::Core::Component
50
+ include UiBibz::Ui::Concerns::NotificationConcern
51
+
50
52
  # Note that for security reasons the sanitize, sanitizeFn, and allowList
51
53
  # options cannot be supplied using data attributes.
52
54
  # https://getbootstrap.com/docs/5.0/components/popovers/#options
@@ -76,12 +78,6 @@ module UiBibz::Ui::Core::Notifications
76
78
  end
77
79
  end
78
80
 
79
- def data_attributes
80
- DATA_ATTRIBUTES.map do |data_attribute|
81
- options[data_attribute].to_s.blank? ? nil : { "data-bs-#{data_attribute}" => data_attribute_value(data_attribute) }
82
- end.compact.reduce(&:merge) || {}
83
- end
84
-
85
81
  def data_attribute_value(data_attribute)
86
82
  options[data_attribute].is_a?(String) ? options[data_attribute].html_safe : options[data_attribute]
87
83
  end
@@ -76,17 +76,33 @@ module UiBibz::Ui::Core::Notifications
76
76
 
77
77
  # Add Body which is a component
78
78
  def body(content = nil, options = nil, html_options = nil, &block)
79
- @body = UiBibz::Ui::Core::Notifications::Components::ToastBody.new(content, options, html_options, &block).render
79
+ @body = if @header.nil?
80
+ content_tag :div, class: 'd-flex' do
81
+ concat UiBibz::Ui::Core::Notifications::Components::ToastBody.new(content, options, html_options, &block).render
82
+ concat close_html if (options || {})[:closable]
83
+ end
84
+ else
85
+ UiBibz::Ui::Core::Notifications::Components::ToastBody.new(content, options, html_options, &block).render
86
+ end
80
87
  end
81
88
 
82
89
  private
83
90
 
91
+ def only_body_html
92
+ @body = UiBibz::Ui::Core::Notifications::Components::ToastBody.new(content, options, html_options, &block).render
93
+ end
94
+
95
+ def close_html
96
+ content_tag :button, '', type: 'button', class: close_button_classes,
97
+ 'data-bs-dismiss' => 'toast', 'aria-label' => 'Close'
98
+ end
99
+
84
100
  def component_html_classes
85
- super << ['toast', status, white_text_color]
101
+ super << ['toast', status, white_text_color, align_items_center]
86
102
  end
87
103
 
88
104
  def component_html_options
89
- { role: 'alert', "aria-live": 'assertive', "aria-atomic": true }
105
+ { role: 'alert', 'aria-live': 'assertive', 'aria-atomic': true }
90
106
  end
91
107
 
92
108
  def component_html_data
@@ -98,10 +114,24 @@ module UiBibz::Ui::Core::Notifications
98
114
  "bg-#{options[:status]}" if options[:status]
99
115
  end
100
116
 
117
+ def align_items_center
118
+ 'align-items-center' if @header.nil?
119
+ end
120
+
101
121
  def white_text_color
102
122
  return if options[:status].nil?
103
123
 
104
124
  'text-white' unless %i[info warning info light].include?(options[:status])
105
125
  end
126
+
127
+ def white_btn_color
128
+ return if options[:status].nil?
129
+
130
+ 'btn-close-white' unless %i[info warning info light].include?(options[:status])
131
+ end
132
+
133
+ def close_button_classes
134
+ UiBibz::Utils::Screwdriver.join_classes('btn-close', 'me-2', 'm-auto', white_btn_color)
135
+ end
106
136
  end
107
137
  end
@@ -48,6 +48,8 @@ module UiBibz::Ui::Core::Notifications
48
48
  # ui_glyph("diamond", tooltip: { title: "My content", position: :right})
49
49
  #
50
50
  class Tooltip < UiBibz::Ui::Core::Component
51
+ include UiBibz::Ui::Concerns::NotificationConcern
52
+
51
53
  # Note that for security reasons the sanitize, sanitizeFn, and allowList
52
54
  # options cannot be supplied using data attributes.
53
55
  # https://getbootstrap.com/docs/5.0/components/tooltips/#options
@@ -76,12 +78,6 @@ module UiBibz::Ui::Core::Notifications
76
78
  end
77
79
  end
78
80
 
79
- def data_attributes
80
- DATA_ATTRIBUTES.map do |data_attribute|
81
- options[data_attribute].to_s.blank? ? nil : { "data-bs-#{data_attribute}" => data_attribute_value(data_attribute) }
82
- end.compact.reduce(&:merge) || {}
83
- end
84
-
85
81
  def data_attribute_value(data_attribute)
86
82
  options[data_attribute].is_a?(String) ? options[data_attribute].html_safe : options[data_attribute]
87
83
  end