bootstrap5_helper 1.1.1 → 1.1.2
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.
- checksums.yaml +4 -4
- data/README.md +113 -85
- data/lib/bootstrap5_helper/offcanvas.rb +5 -2
- data/lib/bootstrap5_helper/tab.rb +3 -3
- data/lib/bootstrap5_helper/version.rb +1 -1
- metadata +3 -3
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 50b1e83426c0845570591efbaaf2c7071a528039ec8c5a051304784ab13e7f91
         | 
| 4 | 
            +
              data.tar.gz: 2a543eca14020820fa8fcbfdbe208a97b925a4ca5371483d98249914ee9a4c06
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: fa6a248942c919c442e4602781401de5b383394733c4a89eeba5fc5cfe50f066a58711d7f70411a708f84570d0b3ef07cd1b6bfebaa2638d1cc48ee15d9483f4
         | 
| 7 | 
            +
              data.tar.gz: e2b0deb1b20740897688cb60d9a31c9e17477d57d93dbd0ddf19a586eb8b1cd967268c7db15ba3f5cd88dd07506cab8c58bad35696a2bd9ad0740e74cd18e024
         | 
    
        data/README.md
    CHANGED
    
    | @@ -49,11 +49,10 @@ end | |
| 49 49 | 
             
            # @option opts [Hash]    :data
         | 
| 50 50 | 
             
            # @option opts [Boolean] :always_open
         | 
| 51 51 | 
             
            # @option opts [Boolean] :flush
         | 
| 52 | 
            +
            # @yield  [Accordion]
         | 
| 52 53 | 
             
            # @return [Accordion]
         | 
| 53 54 | 
             
            #
         | 
| 54 | 
            -
             | 
| 55 | 
            -
              Accordion.new(self, opts, &block)
         | 
| 56 | 
            -
            end
         | 
| 55 | 
            +
            accordion_helper(opts = {}, &block)
         | 
| 57 56 | 
             
            ```
         | 
| 58 57 |  | 
| 59 58 | 
             
            #### Example:
         | 
| @@ -99,9 +98,7 @@ Alerts use the context helper, where you can pass the context of the object and | |
| 99 98 | 
             
            #
         | 
| 100 99 | 
             
            # @return [String]
         | 
| 101 100 | 
             
            #
         | 
| 102 | 
            -
             | 
| 103 | 
            -
              Alert.new(self, *args, &block)
         | 
| 104 | 
            -
            end
         | 
| 101 | 
            +
            alert_helper(*args, &block)
         | 
| 105 102 | 
             
            ```
         | 
| 106 103 |  | 
| 107 104 | 
             
            #### Example:
         | 
| @@ -132,9 +129,7 @@ The badge helper will build badges realitively quickly. If you are just passing | |
| 132 129 | 
             
            #
         | 
| 133 130 | 
             
            # @return [String]
         | 
| 134 131 | 
             
            #
         | 
| 135 | 
            -
             | 
| 136 | 
            -
              Badge.new(self, *args, &block)
         | 
| 137 | 
            -
            end
         | 
| 132 | 
            +
            badge_helper(*args, &block)
         | 
| 138 133 | 
             
            ```
         | 
| 139 134 |  | 
| 140 135 | 
             
            #### Example
         | 
| @@ -164,18 +159,15 @@ Cards support a few methods that make building them easier: | |
| 164 159 | 
             
            - `text`
         | 
| 165 160 | 
             
            - `title`
         | 
| 166 161 |  | 
| 167 | 
            -
            For usage on various card sub components, @see https://getbootstrap.com/docs/4.0/components/card/
         | 
| 168 | 
            -
             | 
| 169 162 | 
             
            ```ruby
         | 
| 170 163 | 
             
            # @param  [Hash] opts
         | 
| 171 164 | 
             
            # @option opts [String] :id
         | 
| 172 165 | 
             
            # @option opts [String] :class
         | 
| 173 166 | 
             
            # @option opts [Hash]   :data
         | 
| 174 | 
            -
            # @ | 
| 167 | 
            +
            # @yield  [Card]
         | 
| 168 | 
            +
            # @return [Card]
         | 
| 175 169 | 
             
            #
         | 
| 176 | 
            -
             | 
| 177 | 
            -
              Card.new(self, opts, &block)
         | 
| 178 | 
            -
            end
         | 
| 170 | 
            +
            card_helper(opts = {}, &block)
         | 
| 179 171 | 
             
            ```
         | 
| 180 172 |  | 
| 181 173 | 
             
            #### Example
         | 
| @@ -236,79 +228,70 @@ Dropdowns support the following methods: | |
| 236 228 | 
             
              - `divider` - A dividing element
         | 
| 237 229 |  | 
| 238 230 | 
             
            ```ruby
         | 
| 239 | 
            -
            # @overload dropdown_helper( | 
| 240 | 
            -
            #   @param [Symbol|String]  | 
| 241 | 
            -
            #   @param [Hash] | 
| 231 | 
            +
            # @overload dropdown_helper(tag, opts)
         | 
| 232 | 
            +
            #   @param [Symbol|String] tag - The HTML element to use to wrap the component.
         | 
| 233 | 
            +
            #   @param [Hash]          opts
         | 
| 242 234 | 
             
            #   @option opts [String]  :id
         | 
| 243 235 | 
             
            #   @option opts [String]  :class
         | 
| 244 236 | 
             
            #   @option opts [Hash]    :data
         | 
| 245 | 
            -
            #   @option opts [Boolean] : | 
| 237 | 
            +
            #   @option opts [Boolean] :centered
         | 
| 246 238 | 
             
            #
         | 
| 247 | 
            -
            # @overload  | 
| 248 | 
            -
            #   @param [Hash] | 
| 239 | 
            +
            # @overload dropdown_helper(opts)
         | 
| 240 | 
            +
            #   @param [Hash]          opts
         | 
| 249 241 | 
             
            #   @option opts [String]  :id
         | 
| 250 242 | 
             
            #   @option opts [String]  :class
         | 
| 251 243 | 
             
            #   @option opts [Hash]    :data
         | 
| 252 | 
            -
            #   @option opts [Boolean] : | 
| 244 | 
            +
            #   @option opts [Boolean] :centered
         | 
| 253 245 | 
             
            #
         | 
| 254 | 
            -
            # @ | 
| 246 | 
            +
            # @yield  [Dropdown]
         | 
| 247 | 
            +
            # @return [Dropdown]
         | 
| 255 248 | 
             
            #
         | 
| 256 | 
            -
             | 
| 257 | 
            -
              Dropdown.new(self, *args, &block)
         | 
| 258 | 
            -
            end
         | 
| 249 | 
            +
            dropdown_helper(*args, &block)
         | 
| 259 250 | 
             
            ```
         | 
| 260 251 |  | 
| 261 252 | 
             
            #### Example
         | 
| 262 253 |  | 
| 263 254 | 
             
            ```erb
         | 
| 264 | 
            -
            <%= dropdown_helper do |dropdown| %>
         | 
| 265 | 
            -
             | 
| 266 | 
            -
             | 
| 267 | 
            -
             | 
| 268 | 
            -
             | 
| 269 | 
            -
             | 
| 270 | 
            -
             | 
| 255 | 
            +
            <%= dropdown_helper class: "btn-group" do |dropdown| %>
         | 
| 256 | 
            +
              <button type="button" class="btn btn-primary">Dropdown</button>
         | 
| 257 | 
            +
              <%= dropdown.caret :primary >
         | 
| 258 | 
            +
              <%= dropdown.menu do |menu| %>
         | 
| 259 | 
            +
                <%= menu.link 'Dropdown Link', '#' %>
         | 
| 260 | 
            +
                <%= menu.link 'Dropdown Link', '#' %>
         | 
| 261 | 
            +
              <% end %>
         | 
| 271 262 | 
             
            <% end %>
         | 
| 272 263 |  | 
| 273 | 
            -
             | 
| 274 | 
            -
             | 
| 275 | 
            -
                <%= dropdown.button(:danger, split: true) %>
         | 
| 276 | 
            -
                <%= dropdown.menu do |menu| %>
         | 
| 277 | 
            -
                    <%= menu.header "Crud operations" %>
         | 
| 278 | 
            -
                    <%= menu.divider %>
         | 
| 279 | 
            -
                    <%= menu.link 'Edit', 'SOME-URL' %>
         | 
| 280 | 
            -
                    <%= menu.link 'Delete', 'SOME-URL' %>
         | 
| 281 | 
            -
                <% end %>
         | 
| 282 | 
            -
            <% end %>
         | 
| 264 | 
            +
             | 
| 265 | 
            +
            // Dropdown menu with a login form inside the menu
         | 
| 283 266 |  | 
| 284 267 | 
             
            <%= dropdown_helper do |dropdown| %>
         | 
| 285 | 
            -
             | 
| 286 | 
            -
             | 
| 287 | 
            -
             | 
| 288 | 
            -
             | 
| 289 | 
            -
             | 
| 290 | 
            -
             | 
| 291 | 
            -
             | 
| 292 | 
            -
             | 
| 293 | 
            -
             | 
| 294 | 
            -
             | 
| 295 | 
            -
             | 
| 296 | 
            -
             | 
| 297 | 
            -
             | 
| 298 | 
            -
             | 
| 299 | 
            -
             | 
| 300 | 
            -
             | 
| 301 | 
            -
             | 
| 302 | 
            -
             | 
| 303 | 
            -
             | 
| 304 | 
            -
             | 
| 305 | 
            -
             | 
| 306 | 
            -
             | 
| 307 | 
            -
             | 
| 308 | 
            -
             | 
| 309 | 
            -
             | 
| 310 | 
            -
             | 
| 311 | 
            -
             | 
| 268 | 
            +
              <%= dropdown.button :primary do %>
         | 
| 269 | 
            +
                Login
         | 
| 270 | 
            +
              <% end %>
         | 
| 271 | 
            +
              <%= dropdown.menu do |menu| %>
         | 
| 272 | 
            +
                <form class="px-4 py-3">
         | 
| 273 | 
            +
                  <div class="form-group">
         | 
| 274 | 
            +
                    <label for="exampleDropdownFormEmail1">Email address</label>
         | 
| 275 | 
            +
                    <input type="email" class="form-control" id="exampleDropdownFormEmail1" placeholder="email@example.com">
         | 
| 276 | 
            +
                  </div>
         | 
| 277 | 
            +
                  <div class="form-group">
         | 
| 278 | 
            +
                    <label for="exampleDropdownFormPassword1">Password</label>
         | 
| 279 | 
            +
                    <input type="password" class="form-control" id="exampleDropdownFormPassword1" placeholder="Password">
         | 
| 280 | 
            +
                  </div>
         | 
| 281 | 
            +
                  <div class="form-group">
         | 
| 282 | 
            +
                    <div class="form-check">
         | 
| 283 | 
            +
                      <input type="checkbox" class="form-check-input" id="dropdownCheck">
         | 
| 284 | 
            +
                      <label class="form-check-label" for="dropdownCheck">
         | 
| 285 | 
            +
                        Remember me
         | 
| 286 | 
            +
                      </label>
         | 
| 287 | 
            +
                    </div>
         | 
| 288 | 
            +
                  </div>
         | 
| 289 | 
            +
                  <button type="submit" class="btn btn-primary">Sign in</button>
         | 
| 290 | 
            +
                </form>
         | 
| 291 | 
            +
                <%= menu.divider %>
         | 
| 292 | 
            +
                <%= menu.link "New around here? Sign up", "#" %>
         | 
| 293 | 
            +
                <%= menu.link "Forgot password", "#" %>
         | 
| 294 | 
            +
              <% end %>
         | 
| 312 295 | 
             
            <% end %>
         | 
| 313 296 | 
             
            ```
         | 
| 314 297 |  | 
| @@ -324,11 +307,10 @@ end | |
| 324 307 | 
             
            # @option opts [Boolean] :static
         | 
| 325 308 | 
             
            # @option opts [Boolean|Symbol] :fullscreen - true, :sm, :lg, :xl etc
         | 
| 326 309 | 
             
            # @option opts [Symbol]  :size - :sm, :md, :lg etc
         | 
| 327 | 
            -
            # @ | 
| 310 | 
            +
            # @yield  [Modal]
         | 
| 311 | 
            +
            # @return [Modal]
         | 
| 328 312 | 
             
            #
         | 
| 329 | 
            -
             | 
| 330 | 
            -
              Modal.new(self, opts, &block)
         | 
| 331 | 
            -
            end
         | 
| 313 | 
            +
            modal_helper(opts = {}, &block)
         | 
| 332 314 | 
             
            ```
         | 
| 333 315 |  | 
| 334 316 | 
             
            > Note: When the `close_button` is not passed a block, it will default to the X icon.
         | 
| @@ -381,9 +363,7 @@ The Nav component has the following methods: | |
| 381 363 | 
             
            #
         | 
| 382 364 | 
             
            # @return [String]
         | 
| 383 365 | 
             
            #
         | 
| 384 | 
            -
             | 
| 385 | 
            -
              Nav.new(self, *args, &block)
         | 
| 386 | 
            -
            end
         | 
| 366 | 
            +
            nav_helper(*args, &block)
         | 
| 387 367 | 
             
            ```
         | 
| 388 368 |  | 
| 389 369 | 
             
            #### Example
         | 
| @@ -405,10 +385,60 @@ end | |
| 405 385 | 
             
            <% end %>
         | 
| 406 386 | 
             
            ```
         | 
| 407 387 |  | 
| 388 | 
            +
            ### Offcanvas
         | 
| 389 | 
            +
             | 
| 390 | 
            +
            ```ruby
         | 
| 391 | 
            +
            # @overload offcanvas_helper(position, options)
         | 
| 392 | 
            +
            #   @param  [Symbol] position - :start, :end, :top, :bottom
         | 
| 393 | 
            +
            #   @param  [Hash] opts
         | 
| 394 | 
            +
            #   @option opts [String]  :id
         | 
| 395 | 
            +
            #   @option opts [String]  :class
         | 
| 396 | 
            +
            #   @option opts [Hash]    :data
         | 
| 397 | 
            +
            #   @option opts [Hash]    :aria
         | 
| 398 | 
            +
            #   @option opts [Boolean] :scrollable
         | 
| 399 | 
            +
            #   @option opts [Boolean|String] :backdrop - true, false, 'static'
         | 
| 400 | 
            +
            #
         | 
| 401 | 
            +
            # @overload offcanvas_helper(options)
         | 
| 402 | 
            +
            #   @param  [Hash] opts
         | 
| 403 | 
            +
            #   @option opts [String]  :id
         | 
| 404 | 
            +
            #   @option opts [String]  :class
         | 
| 405 | 
            +
            #   @option opts [Hash]    :data
         | 
| 406 | 
            +
            #   @option opts [Hash]    :aria
         | 
| 407 | 
            +
            #   @option opts [Boolean] :scrollable
         | 
| 408 | 
            +
            #   @option opts [Boolean|String] :backdrop - true, false, 'static'
         | 
| 409 | 
            +
            #
         | 
| 410 | 
            +
            # @yield  [Offcanvas]
         | 
| 411 | 
            +
            # @return [Offcanvas]
         | 
| 412 | 
            +
            #
         | 
| 413 | 
            +
            def offcanvas_helper(*args, &block)
         | 
| 414 | 
            +
            ```
         | 
| 415 | 
            +
             | 
| 416 | 
            +
            #### Example
         | 
| 417 | 
            +
             | 
| 418 | 
            +
            ```erb
         | 
| 419 | 
            +
            <%= offcanvas_helper scrollable: true do |off| %>
         | 
| 420 | 
            +
              <%= off.link class: 'btn btn-danger' do %>
         | 
| 421 | 
            +
                  <strong>*</strong> Open sidebar
         | 
| 422 | 
            +
              <% end %>
         | 
| 423 | 
            +
             | 
| 424 | 
            +
              <%= off.content do |c| %>
         | 
| 425 | 
            +
                  <%= c.header do %>
         | 
| 426 | 
            +
                      <%= c.title { 'Sidebar content' } %>
         | 
| 427 | 
            +
                      <%= c.close_button class: 'btn btn-info' do %>
         | 
| 428 | 
            +
                          Close
         | 
| 429 | 
            +
                      <% end %>
         | 
| 430 | 
            +
                  <% end %>
         | 
| 431 | 
            +
                  <%= c.body do %>
         | 
| 432 | 
            +
                      <p>Some content in the sidebar!</p>
         | 
| 433 | 
            +
                  <% end %>
         | 
| 434 | 
            +
              <% end %>
         | 
| 435 | 
            +
            <% end %>
         | 
| 436 | 
            +
            ```
         | 
| 437 | 
            +
             | 
| 408 438 | 
             
            ### Tabs
         | 
| 409 439 |  | 
| 410 440 | 
             
            ```ruby
         | 
| 411 | 
            -
             | 
| 441 | 
            +
            # @overload tab_helper(type, opts)
         | 
| 412 442 | 
             
            #   @param [Symbol|String] type - :tabs, :pills
         | 
| 413 443 | 
             
            #   @param  [Hash] opts
         | 
| 414 444 | 
             
            #   @option opts [String]  :id
         | 
| @@ -421,11 +451,10 @@ end | |
| 421 451 | 
             
            #   @option opts [String]  :class
         | 
| 422 452 | 
             
            #   @option opts [Hash]    :data
         | 
| 423 453 | 
             
            #
         | 
| 424 | 
            -
            # @ | 
| 454 | 
            +
            # @yield  [Tab]
         | 
| 455 | 
            +
            # @return [Tab]
         | 
| 425 456 | 
             
            #
         | 
| 426 457 | 
             
            def tab_helper(*args, &block)
         | 
| 427 | 
            -
              Tab.new(self, *args, &block)
         | 
| 428 | 
            -
            end
         | 
| 429 458 | 
             
            ```
         | 
| 430 459 |  | 
| 431 460 | 
             
            #### Example
         | 
| @@ -478,14 +507,13 @@ end | |
| 478 507 | 
             
            ```ruby
         | 
| 479 508 | 
             
            # @param  [Hash] args
         | 
| 480 509 | 
             
            # @option opts [Symbol]  :type - :border, :grow
         | 
| 510 | 
            +
            # @option opts [Symbol]  :size - :sm
         | 
| 481 511 | 
             
            # @option opts [String]  :id
         | 
| 482 512 | 
             
            # @option opts [String]  :class
         | 
| 483 513 | 
             
            # @option opts [Hash]    :data
         | 
| 484 | 
            -
            # @return [ | 
| 514 | 
            +
            # @return [Spinner]
         | 
| 485 515 | 
             
            #
         | 
| 486 | 
            -
             | 
| 487 | 
            -
              Spinner.new(self, opts, &block)
         | 
| 488 | 
            -
            end
         | 
| 516 | 
            +
            spinner_helper(opts = {}, &block)
         | 
| 489 517 | 
             
            ```
         | 
| 490 518 |  | 
| 491 519 | 
             
            #### Example
         | 
| @@ -146,12 +146,15 @@ module Bootstrap5Helper | |
| 146 146 |  | 
| 147 147 | 
             
                # Renders the component as a String, but only to the output bugger.
         | 
| 148 148 | 
             
                #
         | 
| 149 | 
            -
                # @return  | 
| 149 | 
            +
                # @note Was updated to return an empty string opposed to nil.
         | 
| 150 | 
            +
                # @see changelog.md
         | 
| 151 | 
            +
                #
         | 
| 152 | 
            +
                # @return [String]
         | 
| 150 153 | 
             
                #
         | 
| 151 154 | 
             
                def to_s
         | 
| 152 155 | 
             
                  @content.call(self)
         | 
| 153 156 |  | 
| 154 | 
            -
                   | 
| 157 | 
            +
                  ''
         | 
| 155 158 | 
             
                end
         | 
| 156 159 |  | 
| 157 160 | 
             
                private
         | 
| @@ -68,13 +68,13 @@ module Bootstrap5Helper | |
| 68 68 | 
             
                #   string or DOM element, we want to return nil, so that only the output buffer on the sub components are
         | 
| 69 69 | 
             
                #   returned.
         | 
| 70 70 | 
             
                #
         | 
| 71 | 
            -
                # | 
| 72 | 
            -
                # | 
| 71 | 
            +
                # @note Was updated to return an empty string opposed to nil.
         | 
| 72 | 
            +
                # @see changelog.md
         | 
| 73 73 | 
             
                #
         | 
| 74 74 | 
             
                def to_s
         | 
| 75 75 | 
             
                  @content.call(self)
         | 
| 76 76 |  | 
| 77 | 
            -
                   | 
| 77 | 
            +
                  ''
         | 
| 78 78 | 
             
                end
         | 
| 79 79 |  | 
| 80 80 | 
             
                def type_or_options(*args)
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: bootstrap5_helper
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1.1. | 
| 4 | 
            +
              version: 1.1.2
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Robert David
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2024-05-01 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: bootstrap
         | 
| @@ -150,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 150 150 | 
             
                - !ruby/object:Gem::Version
         | 
| 151 151 | 
             
                  version: '0'
         | 
| 152 152 | 
             
            requirements: []
         | 
| 153 | 
            -
            rubygems_version: 3. | 
| 153 | 
            +
            rubygems_version: 3.3.26
         | 
| 154 154 | 
             
            signing_key: 
         | 
| 155 155 | 
             
            specification_version: 4
         | 
| 156 156 | 
             
            summary: Rails helpers for generating Bootstrap 5 components.
         |