ariadne_view_components 0.0.95.5 → 0.0.96
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/CHANGELOG.md +14 -0
 - data/app/assets/javascripts/ariadne_view_components.js +13 -13
 - data/app/assets/javascripts/ariadne_view_components.js.br +0 -0
 - data/app/assets/javascripts/ariadne_view_components.js.gz +0 -0
 - data/app/assets/javascripts/ariadne_view_components.js.map +1 -1
 - data/app/assets/stylesheets/ariadne_view_components.css +1 -1
 - data/app/assets/stylesheets/ariadne_view_components.css.br +0 -0
 - data/app/assets/stylesheets/ariadne_view_components.css.gz +0 -0
 - data/app/components/ariadne/form/base_component.rb +2 -0
 - data/app/components/ariadne/form/base_input_component.rb +15 -0
 - data/app/components/ariadne/form/label_helper.rb +35 -0
 - data/app/components/ariadne/form/radio_button/component.rb +0 -7
 - data/app/components/ariadne/form/select/component.html.erb +6 -10
 - data/app/components/ariadne/form/select/component.rb +8 -14
 - data/app/components/ariadne/form/text_field/component.html.erb +8 -8
 - data/app/components/ariadne/form/text_field/component.rb +37 -51
 - data/app/components/ariadne/layout/sidebar/component.html.erb +10 -0
 - data/app/components/ariadne/layout/sidebar/component.rb +45 -0
 - data/app/components/ariadne/ui/avatar/component.rb +1 -1
 - data/app/components/ariadne/ui/badge/component.rb +0 -2
 - data/app/components/ariadne/ui/clipboard_copy/component.ts +7 -0
 - data/app/components/ariadne/ui/dialog/component.html.erb +4 -8
 - data/app/components/ariadne/ui/dialog/component.rb +4 -6
 - data/app/components/ariadne/ui/dialog/component.ts +4 -8
 - data/app/components/ariadne/ui/popover/component.html.erb +1 -1
 - data/app/components/ariadne/ui/popover/component.rb +6 -8
 - data/app/components/ariadne/ui/popover/component.ts +5 -1
 - data/app/components/ariadne/ui/sidebar/component.html.erb +24 -0
 - data/app/components/ariadne/ui/sidebar/component.rb +82 -0
 - data/app/components/ariadne/ui/sidebar/content/component.html.erb +14 -0
 - data/app/components/ariadne/ui/sidebar/content/component.rb +47 -0
 - data/app/components/ariadne/ui/sidebar/footer/component.html.erb +13 -0
 - data/app/components/ariadne/ui/sidebar/footer/component.rb +54 -0
 - data/app/components/ariadne/ui/sidebar/group/component.html.erb +36 -0
 - data/app/components/ariadne/ui/sidebar/group/component.rb +84 -0
 - data/app/components/ariadne/ui/sidebar/group/component.ts +72 -0
 - data/app/components/ariadne/ui/sidebar/header/component.html.erb +13 -0
 - data/app/components/ariadne/ui/sidebar/header/component.rb +54 -0
 - data/app/components/ariadne/ui/sidebar/item/component.html.erb +24 -0
 - data/app/components/ariadne/ui/sidebar/item/component.rb +78 -0
 - data/app/frontend/stylesheets/ariadne_view_components.css +8 -1
 - data/app/helpers/ariadne/form_helper.rb +4 -1
 - data/lib/ariadne/view_components/version.rb +1 -1
 - metadata +18 -4
 - data/app/components/ariadne/ui/dialog/body/component.html.erb +0 -3
 - data/app/components/ariadne/ui/dialog/body/component.rb +0 -28
 
| 
         @@ -0,0 +1,84 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # typed: false
         
     | 
| 
      
 2 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            module Ariadne
         
     | 
| 
      
 5 
     | 
    
         
            +
              module UI
         
     | 
| 
      
 6 
     | 
    
         
            +
                module Sidebar
         
     | 
| 
      
 7 
     | 
    
         
            +
                  module Group
         
     | 
| 
      
 8 
     | 
    
         
            +
                    # Group component for the sidebar.
         
     | 
| 
      
 9 
     | 
    
         
            +
                    # Used to organize related navigation items.
         
     | 
| 
      
 10 
     | 
    
         
            +
                    class Component < Ariadne::BaseComponent
         
     | 
| 
      
 11 
     | 
    
         
            +
                      # @param [String] label Label for the group
         
     | 
| 
      
 12 
     | 
    
         
            +
                      option :label, default: -> { nil }
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                      # @param [Boolean] collapsible Whether the group can be collapsed
         
     | 
| 
      
 15 
     | 
    
         
            +
                      option :collapsible, default: -> { false }
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                      # @param [Boolean] default_open Whether the group is open by default (if collapsible)
         
     | 
| 
      
 18 
     | 
    
         
            +
                      option :default_open, default: -> { true }
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                      # Individual items in the group
         
     | 
| 
      
 21 
     | 
    
         
            +
                      renders_many :items, Ariadne::UI::Sidebar::Item::Component
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                      # Custom content for the group
         
     | 
| 
      
 24 
     | 
    
         
            +
                      renders_one :custom_content, BaseComponent::ACCEPT_ANYTHING
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                      style do
         
     | 
| 
      
 27 
     | 
    
         
            +
                        base do
         
     | 
| 
      
 28 
     | 
    
         
            +
                          [
         
     | 
| 
      
 29 
     | 
    
         
            +
                            "ariadne:flex",
         
     | 
| 
      
 30 
     | 
    
         
            +
                            "ariadne:flex-col",
         
     | 
| 
      
 31 
     | 
    
         
            +
                            "ariadne:gap-1",
         
     | 
| 
      
 32 
     | 
    
         
            +
                            "ariadne:px-3",
         
     | 
| 
      
 33 
     | 
    
         
            +
                          ]
         
     | 
| 
      
 34 
     | 
    
         
            +
                        end
         
     | 
| 
      
 35 
     | 
    
         
            +
                      end
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                      style(:label) do
         
     | 
| 
      
 38 
     | 
    
         
            +
                        base do
         
     | 
| 
      
 39 
     | 
    
         
            +
                          [
         
     | 
| 
      
 40 
     | 
    
         
            +
                            "ariadne:text-xs",
         
     | 
| 
      
 41 
     | 
    
         
            +
                            "ariadne:font-medium",
         
     | 
| 
      
 42 
     | 
    
         
            +
                            "ariadne:text-zinc-500",
         
     | 
| 
      
 43 
     | 
    
         
            +
                            "ariadne:dark:text-zinc-400",
         
     | 
| 
      
 44 
     | 
    
         
            +
                            "ariadne:uppercase",
         
     | 
| 
      
 45 
     | 
    
         
            +
                            "ariadne:tracking-wider",
         
     | 
| 
      
 46 
     | 
    
         
            +
                            "ariadne:py-2",
         
     | 
| 
      
 47 
     | 
    
         
            +
                            "ariadne:px-3",
         
     | 
| 
      
 48 
     | 
    
         
            +
                            "ariadne:flex",
         
     | 
| 
      
 49 
     | 
    
         
            +
                            "ariadne:items-center",
         
     | 
| 
      
 50 
     | 
    
         
            +
                            "ariadne:justify-between",
         
     | 
| 
      
 51 
     | 
    
         
            +
                          ]
         
     | 
| 
      
 52 
     | 
    
         
            +
                        end
         
     | 
| 
      
 53 
     | 
    
         
            +
                      end
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
                      style(:items_container) do
         
     | 
| 
      
 56 
     | 
    
         
            +
                        base do
         
     | 
| 
      
 57 
     | 
    
         
            +
                          [
         
     | 
| 
      
 58 
     | 
    
         
            +
                            "ariadne:flex",
         
     | 
| 
      
 59 
     | 
    
         
            +
                            "ariadne:flex-col",
         
     | 
| 
      
 60 
     | 
    
         
            +
                            "ariadne:gap-0.5",
         
     | 
| 
      
 61 
     | 
    
         
            +
                          ]
         
     | 
| 
      
 62 
     | 
    
         
            +
                        end
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
      
 64 
     | 
    
         
            +
                        variants do
         
     | 
| 
      
 65 
     | 
    
         
            +
                          collapsible do
         
     | 
| 
      
 66 
     | 
    
         
            +
                            no do
         
     | 
| 
      
 67 
     | 
    
         
            +
                              []
         
     | 
| 
      
 68 
     | 
    
         
            +
                            end
         
     | 
| 
      
 69 
     | 
    
         
            +
             
     | 
| 
      
 70 
     | 
    
         
            +
                            yes do
         
     | 
| 
      
 71 
     | 
    
         
            +
                              [
         
     | 
| 
      
 72 
     | 
    
         
            +
                                "ariadne:transition-all",
         
     | 
| 
      
 73 
     | 
    
         
            +
                                "ariadne:duration-300",
         
     | 
| 
      
 74 
     | 
    
         
            +
                                "ariadne:ease-in-out",
         
     | 
| 
      
 75 
     | 
    
         
            +
                              ]
         
     | 
| 
      
 76 
     | 
    
         
            +
                            end
         
     | 
| 
      
 77 
     | 
    
         
            +
                          end
         
     | 
| 
      
 78 
     | 
    
         
            +
                        end
         
     | 
| 
      
 79 
     | 
    
         
            +
                      end
         
     | 
| 
      
 80 
     | 
    
         
            +
                    end
         
     | 
| 
      
 81 
     | 
    
         
            +
                  end
         
     | 
| 
      
 82 
     | 
    
         
            +
                end
         
     | 
| 
      
 83 
     | 
    
         
            +
              end
         
     | 
| 
      
 84 
     | 
    
         
            +
            end 
         
     | 
| 
         @@ -0,0 +1,72 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            import { controllerFactory } from '@utils/createController'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            export default class SidebarGroupController extends controllerFactory()({
         
     | 
| 
      
 4 
     | 
    
         
            +
              targets: {
         
     | 
| 
      
 5 
     | 
    
         
            +
                content: HTMLElement,
         
     | 
| 
      
 6 
     | 
    
         
            +
                chevron: HTMLElement
         
     | 
| 
      
 7 
     | 
    
         
            +
              },
         
     | 
| 
      
 8 
     | 
    
         
            +
              values: {
         
     | 
| 
      
 9 
     | 
    
         
            +
                open: { type: Boolean, default: false }
         
     | 
| 
      
 10 
     | 
    
         
            +
              }
         
     | 
| 
      
 11 
     | 
    
         
            +
            }) {
         
     | 
| 
      
 12 
     | 
    
         
            +
              static classes = ['open', 'closed']
         
     | 
| 
      
 13 
     | 
    
         
            +
              
         
     | 
| 
      
 14 
     | 
    
         
            +
              connect() {
         
     | 
| 
      
 15 
     | 
    
         
            +
                this.applyState(this.openValue)
         
     | 
| 
      
 16 
     | 
    
         
            +
              }
         
     | 
| 
      
 17 
     | 
    
         
            +
              
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
              toggle(event: Event) {
         
     | 
| 
      
 20 
     | 
    
         
            +
                if (event) {
         
     | 
| 
      
 21 
     | 
    
         
            +
                  event.stopPropagation()
         
     | 
| 
      
 22 
     | 
    
         
            +
                }
         
     | 
| 
      
 23 
     | 
    
         
            +
                
         
     | 
| 
      
 24 
     | 
    
         
            +
                this.openValue = !this.openValue
         
     | 
| 
      
 25 
     | 
    
         
            +
              }
         
     | 
| 
      
 26 
     | 
    
         
            +
              
         
     | 
| 
      
 27 
     | 
    
         
            +
              openValueChanged(isOpen: boolean) {
         
     | 
| 
      
 28 
     | 
    
         
            +
                this.applyState(isOpen)
         
     | 
| 
      
 29 
     | 
    
         
            +
              }
         
     | 
| 
      
 30 
     | 
    
         
            +
              
         
     | 
| 
      
 31 
     | 
    
         
            +
              applyState(isOpen: boolean) {
         
     | 
| 
      
 32 
     | 
    
         
            +
                const content = this.contentTarget
         
     | 
| 
      
 33 
     | 
    
         
            +
                const chevron = this.hasChevronTarget ? this.chevronTarget : null
         
     | 
| 
      
 34 
     | 
    
         
            +
                
         
     | 
| 
      
 35 
     | 
    
         
            +
                const contentHeight = content.scrollHeight
         
     | 
| 
      
 36 
     | 
    
         
            +
                
         
     | 
| 
      
 37 
     | 
    
         
            +
                if (isOpen) {
         
     | 
| 
      
 38 
     | 
    
         
            +
                  content.classList.add('ariadne:animate-accordion-down')
         
     | 
| 
      
 39 
     | 
    
         
            +
                  content.classList.remove('ariadne:animate-accordion-up')
         
     | 
| 
      
 40 
     | 
    
         
            +
                  content.style.height = `${contentHeight}px`
         
     | 
| 
      
 41 
     | 
    
         
            +
                  
         
     | 
| 
      
 42 
     | 
    
         
            +
                  this.element.classList.add('ariadne-sidebar-group-open')
         
     | 
| 
      
 43 
     | 
    
         
            +
                  this.element.classList.remove('ariadne-sidebar-group-closed')
         
     | 
| 
      
 44 
     | 
    
         
            +
                  
         
     | 
| 
      
 45 
     | 
    
         
            +
                  if (chevron) {
         
     | 
| 
      
 46 
     | 
    
         
            +
                    chevron.classList.add('ariadne:rotate-90')
         
     | 
| 
      
 47 
     | 
    
         
            +
                  }
         
     | 
| 
      
 48 
     | 
    
         
            +
                  
         
     | 
| 
      
 49 
     | 
    
         
            +
                  setTimeout(() => {
         
     | 
| 
      
 50 
     | 
    
         
            +
                    if (this.openValue) {
         
     | 
| 
      
 51 
     | 
    
         
            +
                      content.style.height = 'auto'
         
     | 
| 
      
 52 
     | 
    
         
            +
                    }
         
     | 
| 
      
 53 
     | 
    
         
            +
                  }, 200)
         
     | 
| 
      
 54 
     | 
    
         
            +
                } else {
         
     | 
| 
      
 55 
     | 
    
         
            +
                  content.classList.add('ariadne:animate-accordion-up')
         
     | 
| 
      
 56 
     | 
    
         
            +
                  content.classList.remove('ariadne:animate-accordion-down')
         
     | 
| 
      
 57 
     | 
    
         
            +
                  
         
     | 
| 
      
 58 
     | 
    
         
            +
                  content.style.height = `${contentHeight}px`
         
     | 
| 
      
 59 
     | 
    
         
            +
                  
         
     | 
| 
      
 60 
     | 
    
         
            +
                  content.offsetHeight
         
     | 
| 
      
 61 
     | 
    
         
            +
                  
         
     | 
| 
      
 62 
     | 
    
         
            +
                  content.style.height = '0px'
         
     | 
| 
      
 63 
     | 
    
         
            +
                  
         
     | 
| 
      
 64 
     | 
    
         
            +
                  this.element.classList.add('ariadne-sidebar-group-closed')
         
     | 
| 
      
 65 
     | 
    
         
            +
                  this.element.classList.remove('ariadne-sidebar-group-open')
         
     | 
| 
      
 66 
     | 
    
         
            +
                  
         
     | 
| 
      
 67 
     | 
    
         
            +
                  if (chevron) {
         
     | 
| 
      
 68 
     | 
    
         
            +
                    chevron.classList.remove('ariadne:rotate-90')
         
     | 
| 
      
 69 
     | 
    
         
            +
                  }
         
     | 
| 
      
 70 
     | 
    
         
            +
                }
         
     | 
| 
      
 71 
     | 
    
         
            +
              }
         
     | 
| 
      
 72 
     | 
    
         
            +
            }
         
     | 
| 
         @@ -0,0 +1,13 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            <div class="<%= style %>">
         
     | 
| 
      
 2 
     | 
    
         
            +
              <% if primary %>
         
     | 
| 
      
 3 
     | 
    
         
            +
                <div class="ariadne:flex ariadne:items-center ariadne:gap-2">
         
     | 
| 
      
 4 
     | 
    
         
            +
                  <%= primary %>
         
     | 
| 
      
 5 
     | 
    
         
            +
                </div>
         
     | 
| 
      
 6 
     | 
    
         
            +
              <% end %>
         
     | 
| 
      
 7 
     | 
    
         
            +
              <% if secondary %>
         
     | 
| 
      
 8 
     | 
    
         
            +
                <div class="ariadne:flex ariadne:items-center ariadne:gap-2">
         
     | 
| 
      
 9 
     | 
    
         
            +
                  <%= secondary %>
         
     | 
| 
      
 10 
     | 
    
         
            +
                </div>
         
     | 
| 
      
 11 
     | 
    
         
            +
              <% end %>
         
     | 
| 
      
 12 
     | 
    
         
            +
            </div>
         
     | 
| 
      
 13 
     | 
    
         
            +
             
         
     | 
| 
         @@ -0,0 +1,54 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # typed: false
         
     | 
| 
      
 2 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            module Ariadne
         
     | 
| 
      
 5 
     | 
    
         
            +
              module UI
         
     | 
| 
      
 6 
     | 
    
         
            +
                module Sidebar
         
     | 
| 
      
 7 
     | 
    
         
            +
                  module Header
         
     | 
| 
      
 8 
     | 
    
         
            +
                    # Header component for the sidebar.
         
     | 
| 
      
 9 
     | 
    
         
            +
                    # Typically contains branding, logo, and/or application name.
         
     | 
| 
      
 10 
     | 
    
         
            +
                    class Component < Ariadne::BaseComponent
         
     | 
| 
      
 11 
     | 
    
         
            +
                      # @param [Boolean] sticky (true) Whether the header sticks to the top of the sidebar.
         
     | 
| 
      
 12 
     | 
    
         
            +
                      option :sticky, default: -> { true }
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                      # Primary content for the header
         
     | 
| 
      
 15 
     | 
    
         
            +
                      renders_one :primary
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                      # Secondary content for the header, often used for actions
         
     | 
| 
      
 18 
     | 
    
         
            +
                      renders_one :secondary
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                      style do
         
     | 
| 
      
 21 
     | 
    
         
            +
                        base do
         
     | 
| 
      
 22 
     | 
    
         
            +
                          [
         
     | 
| 
      
 23 
     | 
    
         
            +
                            "ariadne:flex",
         
     | 
| 
      
 24 
     | 
    
         
            +
                            "ariadne:items-center",
         
     | 
| 
      
 25 
     | 
    
         
            +
                            "ariadne:justify-between",
         
     | 
| 
      
 26 
     | 
    
         
            +
                            "ariadne:p-4",
         
     | 
| 
      
 27 
     | 
    
         
            +
                            "ariadne:border-b",
         
     | 
| 
      
 28 
     | 
    
         
            +
                            "ariadne:border-zinc-100",
         
     | 
| 
      
 29 
     | 
    
         
            +
                            "ariadne:dark:border-zinc-800",
         
     | 
| 
      
 30 
     | 
    
         
            +
                            "ariadne:bg-white", # Match Figma
         
     | 
| 
      
 31 
     | 
    
         
            +
                          ]
         
     | 
| 
      
 32 
     | 
    
         
            +
                        end
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
                        variants do
         
     | 
| 
      
 35 
     | 
    
         
            +
                          sticky do
         
     | 
| 
      
 36 
     | 
    
         
            +
                            no do
         
     | 
| 
      
 37 
     | 
    
         
            +
                              []
         
     | 
| 
      
 38 
     | 
    
         
            +
                            end
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
                            yes do
         
     | 
| 
      
 41 
     | 
    
         
            +
                              [
         
     | 
| 
      
 42 
     | 
    
         
            +
                                "ariadne:sticky",
         
     | 
| 
      
 43 
     | 
    
         
            +
                                "ariadne:top-0",
         
     | 
| 
      
 44 
     | 
    
         
            +
                                "ariadne:z-10",
         
     | 
| 
      
 45 
     | 
    
         
            +
                              ]
         
     | 
| 
      
 46 
     | 
    
         
            +
                            end
         
     | 
| 
      
 47 
     | 
    
         
            +
                          end
         
     | 
| 
      
 48 
     | 
    
         
            +
                        end
         
     | 
| 
      
 49 
     | 
    
         
            +
                      end
         
     | 
| 
      
 50 
     | 
    
         
            +
                    end
         
     | 
| 
      
 51 
     | 
    
         
            +
                  end
         
     | 
| 
      
 52 
     | 
    
         
            +
                end
         
     | 
| 
      
 53 
     | 
    
         
            +
              end
         
     | 
| 
      
 54 
     | 
    
         
            +
            end 
         
     | 
| 
         @@ -0,0 +1,24 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            <% tag_name = href.present? ? "a" : "div" %>
         
     | 
| 
      
 2 
     | 
    
         
            +
            <% tag_attributes = { class: style(current: current), data: { collapsed: false } } %>
         
     | 
| 
      
 3 
     | 
    
         
            +
            <% tag_attributes[:href] = href if href.present? %>
         
     | 
| 
      
 4 
     | 
    
         
            +
            <%= content_tag(tag_name, **tag_attributes) do %>
         
     | 
| 
      
 5 
     | 
    
         
            +
              <% if icon %>
         
     | 
| 
      
 6 
     | 
    
         
            +
                <span class="ariadne:flex ariadne:items-center ariadne:justify-center ariadne:w-5 ariadne:h-5 ariadne:flex-shrink-0">
         
     | 
| 
      
 7 
     | 
    
         
            +
                  <%= icon %>
         
     | 
| 
      
 8 
     | 
    
         
            +
                </span>
         
     | 
| 
      
 9 
     | 
    
         
            +
              <% elsif icon_slot %>
         
     | 
| 
      
 10 
     | 
    
         
            +
                <span class="ariadne:flex ariadne:items-center ariadne:justify-center ariadne:w-5 ariadne:h-5 ariadne:flex-shrink-0">
         
     | 
| 
      
 11 
     | 
    
         
            +
                  <%= icon_slot %>
         
     | 
| 
      
 12 
     | 
    
         
            +
                </span>
         
     | 
| 
      
 13 
     | 
    
         
            +
              <% end %>
         
     | 
| 
      
 14 
     | 
    
         
            +
              <% if label.present? %>
         
     | 
| 
      
 15 
     | 
    
         
            +
                <span class="ariadne:truncate ariadne:data-[sidebar-collapsed=true]:hidden"><%= label %></span>
         
     | 
| 
      
 16 
     | 
    
         
            +
              <% elsif custom_content %>
         
     | 
| 
      
 17 
     | 
    
         
            +
                <span class="ariadne:flex-1 ariadne:data-[sidebar-collapsed=true]:hidden"><%= custom_content %></span>
         
     | 
| 
      
 18 
     | 
    
         
            +
              <% end %>
         
     | 
| 
      
 19 
     | 
    
         
            +
              <% if badge %>
         
     | 
| 
      
 20 
     | 
    
         
            +
                <div class="ariadne:ml-auto ariadne:data-[sidebar-collapsed=true]:hidden">
         
     | 
| 
      
 21 
     | 
    
         
            +
                  <%= badge %>
         
     | 
| 
      
 22 
     | 
    
         
            +
                </div>
         
     | 
| 
      
 23 
     | 
    
         
            +
              <% end %>
         
     | 
| 
      
 24 
     | 
    
         
            +
            <% end %> 
         
     | 
| 
         @@ -0,0 +1,78 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # typed: false
         
     | 
| 
      
 2 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            module Ariadne
         
     | 
| 
      
 5 
     | 
    
         
            +
              module UI
         
     | 
| 
      
 6 
     | 
    
         
            +
                module Sidebar
         
     | 
| 
      
 7 
     | 
    
         
            +
                  module Item
         
     | 
| 
      
 8 
     | 
    
         
            +
                    # Item component for the sidebar.
         
     | 
| 
      
 9 
     | 
    
         
            +
                    # Used for navigation links or actions.
         
     | 
| 
      
 10 
     | 
    
         
            +
                    class Component < Ariadne::BaseComponent
         
     | 
| 
      
 11 
     | 
    
         
            +
                      # @param [String] href The URL the item links to
         
     | 
| 
      
 12 
     | 
    
         
            +
                      option :href, default: -> { nil }
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                      # @param [Boolean] current Whether this item represents the current page
         
     | 
| 
      
 15 
     | 
    
         
            +
                      option :current, default: -> { false }
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                      # @param [String] label Text label for the item
         
     | 
| 
      
 18 
     | 
    
         
            +
                      option :label, default: -> { nil }
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                      # Icon for the item
         
     | 
| 
      
 21 
     | 
    
         
            +
                      renders_one :icon, Ariadne::UI::Heroicon::Component
         
     | 
| 
      
 22 
     | 
    
         
            +
                      
         
     | 
| 
      
 23 
     | 
    
         
            +
                      # Generic icon slot for custom icons
         
     | 
| 
      
 24 
     | 
    
         
            +
                      renders_one :icon_slot, BaseComponent::ACCEPT_ANYTHING
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                      # Badge for the item (e.g., notification count)
         
     | 
| 
      
 27 
     | 
    
         
            +
                      renders_one :badge, Ariadne::UI::Badge::Component
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
                      # Content for the item if not using label
         
     | 
| 
      
 30 
     | 
    
         
            +
                      renders_one :custom_content, BaseComponent::ACCEPT_ANYTHING
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
                      style do
         
     | 
| 
      
 33 
     | 
    
         
            +
                        base do
         
     | 
| 
      
 34 
     | 
    
         
            +
                          [
         
     | 
| 
      
 35 
     | 
    
         
            +
                            "ariadne:flex",
         
     | 
| 
      
 36 
     | 
    
         
            +
                            "ariadne:items-center",
         
     | 
| 
      
 37 
     | 
    
         
            +
                            "ariadne:gap-3",
         
     | 
| 
      
 38 
     | 
    
         
            +
                            "ariadne:p-2",
         
     | 
| 
      
 39 
     | 
    
         
            +
                            "ariadne:rounded-md",
         
     | 
| 
      
 40 
     | 
    
         
            +
                            "ariadne:text-sm",
         
     | 
| 
      
 41 
     | 
    
         
            +
                            "ariadne:font-medium",
         
     | 
| 
      
 42 
     | 
    
         
            +
                            "ariadne:transition-colors",
         
     | 
| 
      
 43 
     | 
    
         
            +
                            "ariadne:duration-200",
         
     | 
| 
      
 44 
     | 
    
         
            +
                            "ariadne:outline-none",
         
     | 
| 
      
 45 
     | 
    
         
            +
                            "ariadne:focus-visible:ring-2",
         
     | 
| 
      
 46 
     | 
    
         
            +
                            "ariadne:focus-visible:ring-offset-2",
         
     | 
| 
      
 47 
     | 
    
         
            +
                          ]
         
     | 
| 
      
 48 
     | 
    
         
            +
                        end
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
                        variants do
         
     | 
| 
      
 51 
     | 
    
         
            +
                          current do
         
     | 
| 
      
 52 
     | 
    
         
            +
                            no do
         
     | 
| 
      
 53 
     | 
    
         
            +
                              [
         
     | 
| 
      
 54 
     | 
    
         
            +
                                "ariadne:text-zinc-700",
         
     | 
| 
      
 55 
     | 
    
         
            +
                                "ariadne:dark:text-zinc-300",
         
     | 
| 
      
 56 
     | 
    
         
            +
                                "ariadne:hover:bg-violet-50", # Purple hover state based on Figma
         
     | 
| 
      
 57 
     | 
    
         
            +
                                "ariadne:hover:text-violet-700", # Text color on hover
         
     | 
| 
      
 58 
     | 
    
         
            +
                                "ariadne:dark:hover:bg-violet-900",
         
     | 
| 
      
 59 
     | 
    
         
            +
                                "ariadne:dark:hover:text-violet-300",
         
     | 
| 
      
 60 
     | 
    
         
            +
                              ]
         
     | 
| 
      
 61 
     | 
    
         
            +
                            end
         
     | 
| 
      
 62 
     | 
    
         
            +
             
     | 
| 
      
 63 
     | 
    
         
            +
                            yes do
         
     | 
| 
      
 64 
     | 
    
         
            +
                              [
         
     | 
| 
      
 65 
     | 
    
         
            +
                                "ariadne:text-violet-700", # Purple active text based on Figma
         
     | 
| 
      
 66 
     | 
    
         
            +
                                "ariadne:bg-violet-50", # Light purple background
         
     | 
| 
      
 67 
     | 
    
         
            +
                                "ariadne:dark:text-violet-300",
         
     | 
| 
      
 68 
     | 
    
         
            +
                                "ariadne:dark:bg-violet-900",
         
     | 
| 
      
 69 
     | 
    
         
            +
                              ]
         
     | 
| 
      
 70 
     | 
    
         
            +
                            end
         
     | 
| 
      
 71 
     | 
    
         
            +
                          end
         
     | 
| 
      
 72 
     | 
    
         
            +
                        end
         
     | 
| 
      
 73 
     | 
    
         
            +
                      end
         
     | 
| 
      
 74 
     | 
    
         
            +
                    end
         
     | 
| 
      
 75 
     | 
    
         
            +
                  end
         
     | 
| 
      
 76 
     | 
    
         
            +
                end
         
     | 
| 
      
 77 
     | 
    
         
            +
              end
         
     | 
| 
      
 78 
     | 
    
         
            +
            end 
         
     | 
| 
         @@ -1,13 +1,20 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            @import 'tailwindcss' prefix(ariadne);
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
      
 2 
     | 
    
         
            +
            @import 'tw-animate-css';
         
     | 
| 
       3 
3 
     | 
    
         
             
            @import '@evilmartians/harmony/tailwind.css';
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
            @import './theme.css' layer(base);
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
      
 7 
     | 
    
         
            +
            @plugin '@tailwindcss/forms';
         
     | 
| 
       7 
8 
     | 
    
         
             
            @plugin "@tailwindcss/typography";
         
     | 
| 
       8 
9 
     | 
    
         | 
| 
       9 
10 
     | 
    
         
             
            @custom-variant dark (&:where([data-ariadne-color-mode="dark"], [data-ariadne-color-mode="dark"] *));
         
     | 
| 
       10 
11 
     | 
    
         | 
| 
      
 12 
     | 
    
         
            +
            @custom-variant or {
         
     | 
| 
      
 13 
     | 
    
         
            +
              @layer components {
         
     | 
| 
      
 14 
     | 
    
         
            +
                @slot;
         
     | 
| 
      
 15 
     | 
    
         
            +
              }
         
     | 
| 
      
 16 
     | 
    
         
            +
            }
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
       11 
18 
     | 
    
         
             
            /* Fix summary element usage in Safari only */
         
     | 
| 
       12 
19 
     | 
    
         
             
            summary::-webkit-details-marker {
         
     | 
| 
       13 
20 
     | 
    
         
             
              display: none;
         
     | 
| 
         @@ -5,7 +5,10 @@ module Ariadne 
     | 
|
| 
       5 
5 
     | 
    
         
             
              # :nodoc:
         
     | 
| 
       6 
6 
     | 
    
         
             
              module FormHelper
         
     | 
| 
       7 
7 
     | 
    
         
             
                def ariadne_form_with(**kwargs, &block)
         
     | 
| 
       8 
     | 
    
         
            -
                  kwargs[:id]  
     | 
| 
      
 8 
     | 
    
         
            +
                  kwargs[:id] = Ariadne::BaseComponent.generate_id(base_name: "form")
         
     | 
| 
      
 9 
     | 
    
         
            +
                  kwargs[:data] ||= {}
         
     | 
| 
      
 10 
     | 
    
         
            +
                  kwargs[:data]["ariadne-form-validity-target"] = "form"
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
       9 
12 
     | 
    
         
             
                  form_with(**kwargs, skip_default_ids: false, builder: Ariadne::Forms::Builder, &block)
         
     | 
| 
       10 
13 
     | 
    
         
             
                end
         
     | 
| 
       11 
14 
     | 
    
         | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: ariadne_view_components
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.0.96
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Garen J. Torikian
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire:
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2025-03- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2025-03-24 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: tailwind_merge
         
     | 
| 
         @@ -141,6 +141,7 @@ files: 
     | 
|
| 
       141 
141 
     | 
    
         
             
            - app/components/ariadne/form/group/component.rb
         
     | 
| 
       142 
142 
     | 
    
         
             
            - app/components/ariadne/form/hidden_field/component.html.erb
         
     | 
| 
       143 
143 
     | 
    
         
             
            - app/components/ariadne/form/hidden_field/component.rb
         
     | 
| 
      
 144 
     | 
    
         
            +
            - app/components/ariadne/form/label_helper.rb
         
     | 
| 
       144 
145 
     | 
    
         
             
            - app/components/ariadne/form/radio/component.html.erb
         
     | 
| 
       145 
146 
     | 
    
         
             
            - app/components/ariadne/form/radio/component.rb
         
     | 
| 
       146 
147 
     | 
    
         
             
            - app/components/ariadne/form/radio_button/component.html.erb
         
     | 
| 
         @@ -177,6 +178,8 @@ files: 
     | 
|
| 
       177 
178 
     | 
    
         
             
            - app/components/ariadne/layout/section_block/component.rb
         
     | 
| 
       178 
179 
     | 
    
         
             
            - app/components/ariadne/layout/section_block/header/component.html.erb
         
     | 
| 
       179 
180 
     | 
    
         
             
            - app/components/ariadne/layout/section_block/header/component.rb
         
     | 
| 
      
 181 
     | 
    
         
            +
            - app/components/ariadne/layout/sidebar/component.html.erb
         
     | 
| 
      
 182 
     | 
    
         
            +
            - app/components/ariadne/layout/sidebar/component.rb
         
     | 
| 
       180 
183 
     | 
    
         
             
            - app/components/ariadne/layout/two_panel/component.html.erb
         
     | 
| 
       181 
184 
     | 
    
         
             
            - app/components/ariadne/layout/two_panel/component.rb
         
     | 
| 
       182 
185 
     | 
    
         
             
            - app/components/ariadne/layout/wide/component.html.erb
         
     | 
| 
         @@ -213,8 +216,6 @@ files: 
     | 
|
| 
       213 
216 
     | 
    
         
             
            - app/components/ariadne/ui/combobox/component.html.erb
         
     | 
| 
       214 
217 
     | 
    
         
             
            - app/components/ariadne/ui/combobox/component.rb
         
     | 
| 
       215 
218 
     | 
    
         
             
            - app/components/ariadne/ui/combobox/component.ts
         
     | 
| 
       216 
     | 
    
         
            -
            - app/components/ariadne/ui/dialog/body/component.html.erb
         
     | 
| 
       217 
     | 
    
         
            -
            - app/components/ariadne/ui/dialog/body/component.rb
         
     | 
| 
       218 
219 
     | 
    
         
             
            - app/components/ariadne/ui/dialog/component.html.erb
         
     | 
| 
       219 
220 
     | 
    
         
             
            - app/components/ariadne/ui/dialog/component.rb
         
     | 
| 
       220 
221 
     | 
    
         
             
            - app/components/ariadne/ui/dialog/component.ts
         
     | 
| 
         @@ -242,6 +243,19 @@ files: 
     | 
|
| 
       242 
243 
     | 
    
         
             
            - app/components/ariadne/ui/shortcut/component.html.erb
         
     | 
| 
       243 
244 
     | 
    
         
             
            - app/components/ariadne/ui/shortcut/component.rb
         
     | 
| 
       244 
245 
     | 
    
         
             
            - app/components/ariadne/ui/shortcut/component.ts
         
     | 
| 
      
 246 
     | 
    
         
            +
            - app/components/ariadne/ui/sidebar/component.html.erb
         
     | 
| 
      
 247 
     | 
    
         
            +
            - app/components/ariadne/ui/sidebar/component.rb
         
     | 
| 
      
 248 
     | 
    
         
            +
            - app/components/ariadne/ui/sidebar/content/component.html.erb
         
     | 
| 
      
 249 
     | 
    
         
            +
            - app/components/ariadne/ui/sidebar/content/component.rb
         
     | 
| 
      
 250 
     | 
    
         
            +
            - app/components/ariadne/ui/sidebar/footer/component.html.erb
         
     | 
| 
      
 251 
     | 
    
         
            +
            - app/components/ariadne/ui/sidebar/footer/component.rb
         
     | 
| 
      
 252 
     | 
    
         
            +
            - app/components/ariadne/ui/sidebar/group/component.html.erb
         
     | 
| 
      
 253 
     | 
    
         
            +
            - app/components/ariadne/ui/sidebar/group/component.rb
         
     | 
| 
      
 254 
     | 
    
         
            +
            - app/components/ariadne/ui/sidebar/group/component.ts
         
     | 
| 
      
 255 
     | 
    
         
            +
            - app/components/ariadne/ui/sidebar/header/component.html.erb
         
     | 
| 
      
 256 
     | 
    
         
            +
            - app/components/ariadne/ui/sidebar/header/component.rb
         
     | 
| 
      
 257 
     | 
    
         
            +
            - app/components/ariadne/ui/sidebar/item/component.html.erb
         
     | 
| 
      
 258 
     | 
    
         
            +
            - app/components/ariadne/ui/sidebar/item/component.rb
         
     | 
| 
       245 
259 
     | 
    
         
             
            - app/components/ariadne/ui/skeleton/component.html.erb
         
     | 
| 
       246 
260 
     | 
    
         
             
            - app/components/ariadne/ui/skeleton/component.rb
         
     | 
| 
       247 
261 
     | 
    
         
             
            - app/components/ariadne/ui/stats_panel/component.html.erb
         
     | 
| 
         @@ -1,28 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # typed: false
         
     | 
| 
       2 
     | 
    
         
            -
            # frozen_string_literal: true
         
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
            module Ariadne
         
     | 
| 
       5 
     | 
    
         
            -
              module UI
         
     | 
| 
       6 
     | 
    
         
            -
                module Dialog
         
     | 
| 
       7 
     | 
    
         
            -
                  module Body
         
     | 
| 
       8 
     | 
    
         
            -
                    # A `Dialog::Body` is a compositional component, used to render the
         
     | 
| 
       9 
     | 
    
         
            -
                    # innards of a dialog. See <%= link_to_component(Ariadne::UI::Dialog::Component) %>.
         
     | 
| 
       10 
     | 
    
         
            -
                    class Component < Ariadne::BaseComponent
         
     | 
| 
       11 
     | 
    
         
            -
                      attr_accessor :context
         
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
                      accepts_html_attributes do |html_attrs|
         
     | 
| 
       14 
     | 
    
         
            -
                        html_attrs[:class] = merge_tailwind_classes([style, html_attrs[:class]].join(" "))
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
                        html_attrs
         
     | 
| 
       17 
     | 
    
         
            -
                      end
         
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
                      style do
         
     | 
| 
       20 
     | 
    
         
            -
                        base do
         
     | 
| 
       21 
     | 
    
         
            -
                          []
         
     | 
| 
       22 
     | 
    
         
            -
                        end
         
     | 
| 
       23 
     | 
    
         
            -
                      end
         
     | 
| 
       24 
     | 
    
         
            -
                    end
         
     | 
| 
       25 
     | 
    
         
            -
                  end
         
     | 
| 
       26 
     | 
    
         
            -
                end
         
     | 
| 
       27 
     | 
    
         
            -
              end
         
     | 
| 
       28 
     | 
    
         
            -
            end
         
     |