polaris_view_components 0.9.1 → 0.10.0
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/app/assets/javascripts/polaris_view_components/text_field_controller.js +5 -0
- data/app/assets/javascripts/polaris_view_components.js +7 -0
- data/app/assets/stylesheets/polaris_view_components/custom.css +33 -0
- data/app/assets/stylesheets/polaris_view_components.css +27 -0
- data/app/components/polaris/action_list/item_component.rb +2 -1
- data/app/components/polaris/button_component.html.erb +2 -2
- data/app/components/polaris/dropzone_component.html.erb +8 -5
- data/app/components/polaris/filters_component.rb +3 -1
- data/app/components/polaris/headless_button.html.erb +2 -2
- data/app/components/polaris/headless_button.rb +3 -1
- data/app/components/polaris/page_component.html.erb +81 -10
- data/app/components/polaris/page_component.rb +85 -28
- data/app/components/polaris/resource_item_component.rb +4 -1
- data/app/components/polaris/text_field_component.html.erb +1 -1
- data/app/components/polaris/text_field_component.rb +1 -1
- data/app/components/polaris/visually_hidden_component.rb +0 -3
- data/lib/polaris/view_components/version.rb +1 -1
- metadata +87 -3
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: '08aa4ac3025799e63c02f893d3fa9397ae3ea2940b672ed3670e36fae0c09b93'
         | 
| 4 | 
            +
              data.tar.gz: 58ad189ac881ae6b147d3e319c1d8fb490fad89a5a8cb289f382c480806e4782
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 54244ec2572f296b21d4e786b21cda3d2bf826866bf684452b67410668ed05f08a9908bfba955fbc65fbf2ef2e45530c4e6f19bafcfa4ff2ddc8bad2315b6357
         | 
| 7 | 
            +
              data.tar.gz: d0dfce86c9d6ba9f534f64782a0ea534f16f15274f98124e7d5ae74974869ee75f83e1c37f61f92a0199b3053e9f0b0cdbb19167d886829a39e58f89b9a31720
         | 
| @@ -545,6 +545,7 @@ class Dropzone extends Controller { | |
| 545 545 | 
             
                  this.toggleFileUpload(false);
         | 
| 546 546 | 
             
                  this.toggleErrorOverlay(true);
         | 
| 547 547 | 
             
                  const dropRejectedEvent = new CustomEvent("polaris-dropzone:drop-rejected", {
         | 
| 548 | 
            +
                    bubbles: true,
         | 
| 548 549 | 
             
                    detail: {
         | 
| 549 550 | 
             
                      rejectedFiles: this.rejectedFiles
         | 
| 550 551 | 
             
                    }
         | 
| @@ -557,6 +558,7 @@ class Dropzone extends Controller { | |
| 557 558 | 
             
                  }
         | 
| 558 559 | 
             
                  this.toggleErrorOverlay(false);
         | 
| 559 560 | 
             
                  const dropAcceptedEvent = new CustomEvent("polaris-dropzone:drop-accepted", {
         | 
| 561 | 
            +
                    bubbles: true,
         | 
| 560 562 | 
             
                    detail: {
         | 
| 561 563 | 
             
                      acceptedFiles: this.acceptedFiles
         | 
| 562 564 | 
             
                    }
         | 
| @@ -564,6 +566,7 @@ class Dropzone extends Controller { | |
| 564 566 | 
             
                  this.element.dispatchEvent(dropAcceptedEvent);
         | 
| 565 567 | 
             
                }
         | 
| 566 568 | 
             
                const dropEvent = new CustomEvent("polaris-dropzone:drop", {
         | 
| 569 | 
            +
                  bubbles: true,
         | 
| 567 570 | 
             
                  detail: {
         | 
| 568 571 | 
             
                    files: this.files,
         | 
| 569 572 | 
             
                    acceptedFiles: this.acceptedFiles,
         | 
| @@ -2399,7 +2402,11 @@ class TextField extends Controller { | |
| 2399 2402 | 
             
                this.valueValue = this.inputTarget.value;
         | 
| 2400 2403 | 
             
              }
         | 
| 2401 2404 | 
             
              clear() {
         | 
| 2405 | 
            +
                const oldValue = this.value;
         | 
| 2402 2406 | 
             
                this.value = null;
         | 
| 2407 | 
            +
                if (this.value != oldValue) {
         | 
| 2408 | 
            +
                  this.inputTarget.dispatchEvent(new Event("change"));
         | 
| 2409 | 
            +
                }
         | 
| 2403 2410 | 
             
              }
         | 
| 2404 2411 | 
             
              increase() {
         | 
| 2405 2412 | 
             
                this.changeNumber(1);
         | 
| @@ -116,6 +116,15 @@ a.Polaris-Tag__Button { | |
| 116 116 | 
             
                  justify-content: center;
         | 
| 117 117 | 
             
                }
         | 
| 118 118 |  | 
| 119 | 
            +
                &--sizeMedium {
         | 
| 120 | 
            +
                  justify-content: center;
         | 
| 121 | 
            +
                  text-align: center;
         | 
| 122 | 
            +
             | 
| 123 | 
            +
                  .Polaris-Stack.Polaris-Stack--alignmentCenter {
         | 
| 124 | 
            +
                    justify-content: center;
         | 
| 125 | 
            +
                  }
         | 
| 126 | 
            +
                }
         | 
| 127 | 
            +
             | 
| 119 128 | 
             
                &--sizeSmall {
         | 
| 120 129 | 
             
                  padding: 0;
         | 
| 121 130 | 
             
                  justify-content: center;
         | 
| @@ -143,3 +152,27 @@ a.Polaris-Tag__Button { | |
| 143 152 | 
             
                }
         | 
| 144 153 | 
             
              }
         | 
| 145 154 | 
             
            }
         | 
| 155 | 
            +
             | 
| 156 | 
            +
            /* ActionMenu */
         | 
| 157 | 
            +
            .Polaris-ActionMenu {
         | 
| 158 | 
            +
              &--mobile {
         | 
| 159 | 
            +
                @media (min-width: 768px){
         | 
| 160 | 
            +
                  display: none;
         | 
| 161 | 
            +
                }
         | 
| 162 | 
            +
              }
         | 
| 163 | 
            +
             | 
| 164 | 
            +
              &--desktop {
         | 
| 165 | 
            +
                display: none;
         | 
| 166 | 
            +
             | 
| 167 | 
            +
                @media (min-width: 768px){
         | 
| 168 | 
            +
                  display: block;
         | 
| 169 | 
            +
                }
         | 
| 170 | 
            +
              }
         | 
| 171 | 
            +
            }
         | 
| 172 | 
            +
             | 
| 173 | 
            +
            /* Page Pagination */
         | 
| 174 | 
            +
            @media (max-width: 768px){
         | 
| 175 | 
            +
              .Polaris-Page-Header__PaginationWrapper {
         | 
| 176 | 
            +
                display: none;
         | 
| 177 | 
            +
              }
         | 
| 178 | 
            +
            }
         | 
| @@ -2325,6 +2325,13 @@ a.Polaris-Tag__Button { | |
| 2325 2325 | 
             
                  text-align: center;
         | 
| 2326 2326 | 
             
                  justify-content: center;
         | 
| 2327 2327 | 
             
                }
         | 
| 2328 | 
            +
            .Polaris-DropZone__Preview--sizeMedium {
         | 
| 2329 | 
            +
                  justify-content: center;
         | 
| 2330 | 
            +
                  text-align: center;
         | 
| 2331 | 
            +
                }
         | 
| 2332 | 
            +
            .Polaris-DropZone__Preview--sizeMedium .Polaris-Stack.Polaris-Stack--alignmentCenter {
         | 
| 2333 | 
            +
                    justify-content: center;
         | 
| 2334 | 
            +
                  }
         | 
| 2328 2335 | 
             
            .Polaris-DropZone__Preview--sizeSmall {
         | 
| 2329 2336 | 
             
                  padding: 0;
         | 
| 2330 2337 | 
             
                  justify-content: center;
         | 
| @@ -2346,3 +2353,23 @@ a.Polaris-Tag__Button { | |
| 2346 2353 | 
             
            .Polaris-DropZone__Loader .Polaris-Spinner--sizeSmall {
         | 
| 2347 2354 | 
             
                  height: 20px;
         | 
| 2348 2355 | 
             
                }
         | 
| 2356 | 
            +
            /* ActionMenu */
         | 
| 2357 | 
            +
            @media (min-width: 768px){
         | 
| 2358 | 
            +
            .Polaris-ActionMenu--mobile {
         | 
| 2359 | 
            +
                  display: none
         | 
| 2360 | 
            +
              }
         | 
| 2361 | 
            +
                }
         | 
| 2362 | 
            +
            .Polaris-ActionMenu--desktop {
         | 
| 2363 | 
            +
                display: none;
         | 
| 2364 | 
            +
              }
         | 
| 2365 | 
            +
            @media (min-width: 768px){
         | 
| 2366 | 
            +
            .Polaris-ActionMenu--desktop {
         | 
| 2367 | 
            +
                  display: block
         | 
| 2368 | 
            +
              }
         | 
| 2369 | 
            +
                }
         | 
| 2370 | 
            +
            /* Page Pagination */
         | 
| 2371 | 
            +
            @media (max-width: 768px){
         | 
| 2372 | 
            +
              .Polaris-Page-Header__PaginationWrapper {
         | 
| 2373 | 
            +
                display: none;
         | 
| 2374 | 
            +
              }
         | 
| 2375 | 
            +
            }
         | 
| @@ -5,6 +5,7 @@ class Polaris::ActionList::ItemComponent < Polaris::Component | |
| 5 5 | 
             
              def initialize(
         | 
| 6 6 | 
             
                url: nil,
         | 
| 7 7 | 
             
                icon: nil,
         | 
| 8 | 
            +
                icon_name: nil,
         | 
| 8 9 | 
             
                help_text: nil,
         | 
| 9 10 | 
             
                active: false,
         | 
| 10 11 | 
             
                destructive: false,
         | 
| @@ -12,7 +13,7 @@ class Polaris::ActionList::ItemComponent < Polaris::Component | |
| 12 13 | 
             
                **system_arguments
         | 
| 13 14 | 
             
              )
         | 
| 14 15 | 
             
                @url = url
         | 
| 15 | 
            -
                @icon = icon
         | 
| 16 | 
            +
                @icon = icon || icon_name
         | 
| 16 17 | 
             
                @help_text = help_text
         | 
| 17 18 | 
             
                @active = active
         | 
| 18 19 | 
             
                @destructive = destructive
         | 
| @@ -4,10 +4,12 @@ | |
| 4 4 | 
             
                  class="Polaris-DropZone__Overlay Polaris-VisuallyHidden"
         | 
| 5 5 | 
             
                  data-polaris-dropzone-target="overlay"
         | 
| 6 6 | 
             
                >
         | 
| 7 | 
            -
                   | 
| 8 | 
            -
                     | 
| 9 | 
            -
                       | 
| 10 | 
            -
                        <%=  | 
| 7 | 
            +
                  <% unless @size == :small %>
         | 
| 8 | 
            +
                    <%= render Polaris::StackComponent.new(vertical: true, spacing: :tight) do |stack| %>
         | 
| 9 | 
            +
                      <% stack.item do %>
         | 
| 10 | 
            +
                        <%= render Polaris::DisplayTextComponent.new(size: :small) do %>
         | 
| 11 | 
            +
                          <%= @overlay_text %>
         | 
| 12 | 
            +
                        <% end %>
         | 
| 11 13 | 
             
                      <% end %>
         | 
| 12 14 | 
             
                    <% end %>
         | 
| 13 15 | 
             
                  <% end %>
         | 
| @@ -86,7 +88,8 @@ | |
| 86 88 | 
             
                    class: [
         | 
| 87 89 | 
             
                      "Polaris-DropZone__Preview",
         | 
| 88 90 | 
             
                      "Polaris-DropZone__Preview--singleFile": !@multiple,
         | 
| 89 | 
            -
                      "Polaris-DropZone__Preview-- | 
| 91 | 
            +
                      "Polaris-DropZone__Preview--sizeMedium": @size == :medium,
         | 
| 92 | 
            +
                      "Polaris-DropZone__Preview--sizeSmall": @size == :small,
         | 
| 90 93 | 
             
                    ]
         | 
| 91 94 | 
             
                  ) do %>
         | 
| 92 95 | 
             
                    <% if @size.in?(%i[small]) %>
         | 
| @@ -42,6 +42,7 @@ module Polaris | |
| 42 42 | 
             
                  remove_underline: false,
         | 
| 43 43 | 
             
                  size: SIZE_DEFAULT,
         | 
| 44 44 | 
             
                  text_align: TEXT_ALIGN_DEFAULT,
         | 
| 45 | 
            +
                  icon_name: nil,
         | 
| 45 46 | 
             
                  **system_arguments
         | 
| 46 47 | 
             
                )
         | 
| 47 48 | 
             
                  @tag = url.present? ? "a" : "button"
         | 
| @@ -52,6 +53,7 @@ module Polaris | |
| 52 53 | 
             
                  @loading = loading
         | 
| 53 54 | 
             
                  @disclosure = fetch_or_fallback(DISCLOSURE_OPTIONS, disclosure, DISCLOSURE_DEFAULT)
         | 
| 54 55 | 
             
                  @disclosure = :down if @disclosure === true
         | 
| 56 | 
            +
                  @icon_name = icon_name
         | 
| 55 57 |  | 
| 56 58 | 
             
                  @system_arguments = system_arguments
         | 
| 57 59 | 
             
                  @system_arguments[:type] = submit ? "submit" : "button"
         | 
| @@ -92,7 +94,7 @@ module Polaris | |
| 92 94 | 
             
                def system_arguments
         | 
| 93 95 | 
             
                  @system_arguments[:classes] = class_names(
         | 
| 94 96 | 
             
                    @system_arguments[:classes],
         | 
| 95 | 
            -
                    "Polaris-Button--iconOnly": icon.present? && content.blank?
         | 
| 97 | 
            +
                    "Polaris-Button--iconOnly": (icon.present? || @icon_name.present?) && content.blank?
         | 
| 96 98 | 
             
                  )
         | 
| 97 99 | 
             
                  @system_arguments
         | 
| 98 100 | 
             
                end
         | 
| @@ -1,6 +1,6 @@ | |
| 1 | 
            -
            <%= render Polaris::BaseComponent.new( | 
| 1 | 
            +
            <%= render Polaris::BaseComponent.new(**system_arguments) do %>
         | 
| 2 2 | 
             
              <% if render_header? %>
         | 
| 3 | 
            -
                <%= render Polaris::BaseComponent.new( | 
| 3 | 
            +
                <%= render Polaris::BaseComponent.new(**header_arguments) do %>
         | 
| 4 4 | 
             
                  <div class="Polaris-Page-Header__Row">
         | 
| 5 5 | 
             
                    <% if @back_url.present? %>
         | 
| 6 6 | 
             
                      <div class="Polaris-Page-Header__BreadcrumbWrapper">
         | 
| @@ -17,7 +17,7 @@ | |
| 17 17 | 
             
                    <% end %>
         | 
| 18 18 |  | 
| 19 19 | 
             
                    <div class="Polaris-Page-Header__TitleWrapper">
         | 
| 20 | 
            -
                       | 
| 20 | 
            +
                      <%= tag.div(class: ["Polaris-Header-Title--hasThumbnail": thumbnail.present?]) do %>
         | 
| 21 21 | 
             
                        <% if thumbnail.present? %>
         | 
| 22 22 | 
             
                          <div>
         | 
| 23 23 | 
             
                            <%= thumbnail %>
         | 
| @@ -38,18 +38,89 @@ | |
| 38 38 | 
             
                          <% end %>
         | 
| 39 39 |  | 
| 40 40 | 
             
                          <% if @subtitle.present? %>
         | 
| 41 | 
            -
                             | 
| 41 | 
            +
                            <%= render Polaris::BaseComponent.new(**subtitle_arguments) do %>
         | 
| 42 42 | 
             
                              <p><%= @subtitle %></p>
         | 
| 43 | 
            -
                             | 
| 43 | 
            +
                            <% end %>
         | 
| 44 44 | 
             
                          <% end %>
         | 
| 45 45 | 
             
                        </div>
         | 
| 46 | 
            -
                       | 
| 46 | 
            +
                      <% end %>
         | 
| 47 47 | 
             
                    </div>
         | 
| 48 48 |  | 
| 49 | 
            -
                    <% if primary_action.present? %>
         | 
| 49 | 
            +
                    <% if @secondary_actions.any? || action_group.present? || primary_action.present? || has_pagination? %>
         | 
| 50 50 | 
             
                      <div class="Polaris-Page-Header__RightAlign">
         | 
| 51 | 
            -
                        <div class="Polaris-Page- | 
| 52 | 
            -
                           | 
| 51 | 
            +
                        <div class="Polaris-Page-Header__Actions">
         | 
| 52 | 
            +
                          <% if @secondary_actions.any? || action_group.present? %>
         | 
| 53 | 
            +
                            <div class="Polaris-ActionMenu Polaris-ActionMenu--mobile">
         | 
| 54 | 
            +
                              <div class="Polaris-ActionMenu-RollupActions__RollupActivator">
         | 
| 55 | 
            +
                                <%= polaris_popover do |popover| %>
         | 
| 56 | 
            +
                                  <% popover.button do |button| %>
         | 
| 57 | 
            +
                                    <% button.icon(name: "HorizontalDotsMinor") %>
         | 
| 58 | 
            +
                                  <% end %>
         | 
| 59 | 
            +
                                  <%= polaris_action_list(style: "text-align: left;") do |action_list| %>
         | 
| 60 | 
            +
                                    <% if @secondary_actions.any? %>
         | 
| 61 | 
            +
                                      <% action_list.section do |section| %>
         | 
| 62 | 
            +
                                        <% @secondary_actions.each do |action| %>
         | 
| 63 | 
            +
                                          <% section.item(**action) { action[:content] } %>
         | 
| 64 | 
            +
                                        <% end %>
         | 
| 65 | 
            +
                                      <% end %>
         | 
| 66 | 
            +
                                    <% end %>
         | 
| 67 | 
            +
             | 
| 68 | 
            +
                                    <% if action_group.present? %>
         | 
| 69 | 
            +
                                      <% action_list.section(title: action_group.title) do |section| %>
         | 
| 70 | 
            +
                                        <% action_group.actions.each do |action| %>
         | 
| 71 | 
            +
                                          <% section.item(**action) { action[:content] } %>
         | 
| 72 | 
            +
                                        <% end %>
         | 
| 73 | 
            +
                                      <% end %>
         | 
| 74 | 
            +
                                    <% end %>
         | 
| 75 | 
            +
                                  <% end %>
         | 
| 76 | 
            +
                                <% end %>
         | 
| 77 | 
            +
                              </div>
         | 
| 78 | 
            +
                            </div>
         | 
| 79 | 
            +
                            <div class="Polaris-ActionMenu Polaris-ActionMenu--desktop">
         | 
| 80 | 
            +
                              <div class="Polaris-ActionMenu-Actions__ActionsLayout">
         | 
| 81 | 
            +
                                <%= polaris_button_group(spacing: :extra_tight) do |group| %>
         | 
| 82 | 
            +
                                  <% @secondary_actions.each do |action| %>
         | 
| 83 | 
            +
                                    <% group.item do %>
         | 
| 84 | 
            +
                                      <% destructive = action.delete(:destructive) %>
         | 
| 85 | 
            +
                                      <% tag.span(class: ["Polaris-ActionMenu-SecondaryAction", "Polaris-ActionMenu-SecondaryAction--destructive": destructive]) do %>
         | 
| 86 | 
            +
                                        <%= polaris_button(**action) { action[:content] } %>
         | 
| 87 | 
            +
                                      <% end %>
         | 
| 88 | 
            +
                                    <% end %>
         | 
| 89 | 
            +
                                  <% end %>
         | 
| 90 | 
            +
                                  <% if action_group.present? %>
         | 
| 91 | 
            +
                                    <% group.item do %>
         | 
| 92 | 
            +
                                      <span class="Polaris-ActionMenu-SecondaryAction">
         | 
| 93 | 
            +
                                        <%= action_group %>
         | 
| 94 | 
            +
                                      </span>
         | 
| 95 | 
            +
                                    <% end %>
         | 
| 96 | 
            +
                                  <% end %>
         | 
| 97 | 
            +
                                <% end %>
         | 
| 98 | 
            +
                              </div>
         | 
| 99 | 
            +
                            </div>
         | 
| 100 | 
            +
                          <% end %>
         | 
| 101 | 
            +
                          <% if primary_action.present? %>
         | 
| 102 | 
            +
                            <div class="Polaris-Page-Header__PrimaryActionWrapper">
         | 
| 103 | 
            +
                              <%= primary_action %>
         | 
| 104 | 
            +
                            </div>
         | 
| 105 | 
            +
                          <% end %>
         | 
| 106 | 
            +
                          <% if has_pagination? %>
         | 
| 107 | 
            +
                            <div class="Polaris-Page-Header__PaginationWrapper">
         | 
| 108 | 
            +
                              <nav aria-label="Pagination">
         | 
| 109 | 
            +
                                <%= polaris_button_group(segmented: true) do |group| %>
         | 
| 110 | 
            +
                                  <% group.item do %>
         | 
| 111 | 
            +
                                    <%= polaris_button(url: @prev_url, outline: true, disabled: @prev_url.blank?) do |button| %>
         | 
| 112 | 
            +
                                      <% button.icon(name: "ChevronLeftMinor") %>
         | 
| 113 | 
            +
                                    <% end %>
         | 
| 114 | 
            +
                                  <% end %>
         | 
| 115 | 
            +
                                  <% group.item do %>
         | 
| 116 | 
            +
                                    <%= polaris_button(url: @next_url, outline: true, disabled: @next_url.blank?) do |button| %>
         | 
| 117 | 
            +
                                      <% button.icon(name: "ChevronRightMinor") %>
         | 
| 118 | 
            +
                                    <% end %>
         | 
| 119 | 
            +
                                  <% end %>
         | 
| 120 | 
            +
                                <% end %>
         | 
| 121 | 
            +
                              </nav>
         | 
| 122 | 
            +
                            </div>
         | 
| 123 | 
            +
                          <% end %>
         | 
| 53 124 | 
             
                        </div>
         | 
| 54 125 | 
             
                      </div>
         | 
| 55 126 | 
             
                    <% end %>
         | 
| @@ -57,7 +128,7 @@ | |
| 57 128 | 
             
                <% end %>
         | 
| 58 129 | 
             
              <% end %>
         | 
| 59 130 |  | 
| 60 | 
            -
              <%= render Polaris::BaseComponent.new( | 
| 131 | 
            +
              <%= render Polaris::BaseComponent.new(**content_arguments) do %>
         | 
| 61 132 | 
             
                <%= content %>
         | 
| 62 133 | 
             
              <% end %>
         | 
| 63 134 | 
             
            <% end %>
         | 
| @@ -2,55 +2,112 @@ | |
| 2 2 |  | 
| 3 3 | 
             
            module Polaris
         | 
| 4 4 | 
             
              class PageComponent < Polaris::Component
         | 
| 5 | 
            +
                renders_one :title_metadata
         | 
| 6 | 
            +
                renders_one :thumbnail, Polaris::ThumbnailComponent
         | 
| 5 7 | 
             
                renders_one :primary_action, ->(primary: true, **system_arguments) do
         | 
| 6 8 | 
             
                  Polaris::ButtonComponent.new(primary: primary, **system_arguments)
         | 
| 7 9 | 
             
                end
         | 
| 8 | 
            -
                 | 
| 9 | 
            -
                renders_one :title_metadata
         | 
| 10 | 
            -
                renders_one :thumbnail, Polaris::ThumbnailComponent
         | 
| 10 | 
            +
                renders_one :action_group, "ActionGroupComponent"
         | 
| 11 11 |  | 
| 12 12 | 
             
                def initialize(
         | 
| 13 13 | 
             
                  title: nil,
         | 
| 14 14 | 
             
                  subtitle: nil,
         | 
| 15 | 
            +
                  compact_title: false,
         | 
| 15 16 | 
             
                  back_url: nil,
         | 
| 17 | 
            +
                  prev_url: nil,
         | 
| 18 | 
            +
                  next_url: nil,
         | 
| 16 19 | 
             
                  narrow_width: false,
         | 
| 17 20 | 
             
                  full_width: false,
         | 
| 18 21 | 
             
                  divider: false,
         | 
| 22 | 
            +
                  secondary_actions: [],
         | 
| 19 23 | 
             
                  **system_arguments
         | 
| 20 24 | 
             
                )
         | 
| 21 25 | 
             
                  @title = title
         | 
| 22 26 | 
             
                  @subtitle = subtitle
         | 
| 27 | 
            +
                  @compact_title = compact_title
         | 
| 23 28 | 
             
                  @back_url = back_url
         | 
| 24 | 
            -
             | 
| 29 | 
            +
                  @prev_url = prev_url
         | 
| 30 | 
            +
                  @next_url = next_url
         | 
| 31 | 
            +
                  @narrow_width = narrow_width
         | 
| 32 | 
            +
                  @full_width = full_width
         | 
| 33 | 
            +
                  @divider = divider
         | 
| 34 | 
            +
                  @secondary_actions = secondary_actions
         | 
| 25 35 | 
             
                  @system_arguments = system_arguments
         | 
| 26 | 
            -
             | 
| 27 | 
            -
             | 
| 28 | 
            -
             | 
| 29 | 
            -
             | 
| 30 | 
            -
                    " | 
| 31 | 
            -
                     | 
| 32 | 
            -
             | 
| 33 | 
            -
             | 
| 34 | 
            -
             | 
| 35 | 
            -
             | 
| 36 | 
            -
             | 
| 37 | 
            -
                     | 
| 38 | 
            -
             | 
| 39 | 
            -
             | 
| 40 | 
            -
             | 
| 41 | 
            -
             | 
| 42 | 
            -
                   | 
| 43 | 
            -
             | 
| 44 | 
            -
             | 
| 45 | 
            -
             | 
| 46 | 
            -
             | 
| 47 | 
            -
                     | 
| 48 | 
            -
             | 
| 49 | 
            -
             | 
| 36 | 
            +
                end
         | 
| 37 | 
            +
             | 
| 38 | 
            +
                def header_arguments
         | 
| 39 | 
            +
                  {
         | 
| 40 | 
            +
                    tag: "div",
         | 
| 41 | 
            +
                    classes: class_names(
         | 
| 42 | 
            +
                      "Polaris-Page-Header",
         | 
| 43 | 
            +
                      "Polaris-Page-Header--mobileView",
         | 
| 44 | 
            +
                      "Polaris-Page-Header--mediumTitle",
         | 
| 45 | 
            +
                      "Polaris-Page-Header--hasNavigation": @back_url.present?,
         | 
| 46 | 
            +
                      "Polaris-Page-Header--noBreadcrumbs": @back_url.blank?
         | 
| 47 | 
            +
                    )
         | 
| 48 | 
            +
                  }
         | 
| 49 | 
            +
                end
         | 
| 50 | 
            +
             | 
| 51 | 
            +
                def subtitle_arguments
         | 
| 52 | 
            +
                  {
         | 
| 53 | 
            +
                    tag: "div",
         | 
| 54 | 
            +
                    classes: class_names(
         | 
| 55 | 
            +
                      "Polaris-Header-Title__SubTitle",
         | 
| 56 | 
            +
                      "Polaris-Header-Title__SubtitleCompact": @compact_title
         | 
| 57 | 
            +
                    )
         | 
| 58 | 
            +
                  }
         | 
| 59 | 
            +
                end
         | 
| 60 | 
            +
             | 
| 61 | 
            +
                def content_arguments
         | 
| 62 | 
            +
                  {
         | 
| 63 | 
            +
                    tag: "div",
         | 
| 64 | 
            +
                    classes: class_names(
         | 
| 65 | 
            +
                      "Polaris-Page__Content",
         | 
| 66 | 
            +
                      "Polaris-Page--divider": @divider
         | 
| 67 | 
            +
                    )
         | 
| 68 | 
            +
                  }
         | 
| 69 | 
            +
                end
         | 
| 70 | 
            +
             | 
| 71 | 
            +
                def system_arguments
         | 
| 72 | 
            +
                  @system_arguments.tap do |opts|
         | 
| 73 | 
            +
                    opts[:tag] = "div"
         | 
| 74 | 
            +
                    opts[:classes] = class_names(
         | 
| 75 | 
            +
                      opts[:classes],
         | 
| 76 | 
            +
                      "Polaris-Page",
         | 
| 77 | 
            +
                      "Polaris-Page--narrowWidth": @narrow_width,
         | 
| 78 | 
            +
                      "Polaris-Page--fullWidth": @full_width
         | 
| 79 | 
            +
                    )
         | 
| 80 | 
            +
                  end
         | 
| 50 81 | 
             
                end
         | 
| 51 82 |  | 
| 52 83 | 
             
                def render_header?
         | 
| 53 84 | 
             
                  @title.present? || @subtitle.present? || @back_url.present? || primary_action.present?
         | 
| 54 85 | 
             
                end
         | 
| 86 | 
            +
             | 
| 87 | 
            +
                def has_pagination?
         | 
| 88 | 
            +
                  @next_url.present? || @prev_url.present?
         | 
| 89 | 
            +
                end
         | 
| 90 | 
            +
             | 
| 91 | 
            +
                class ActionGroupComponent < Polaris::Component
         | 
| 92 | 
            +
                  attr_reader :title
         | 
| 93 | 
            +
                  attr_reader :actions
         | 
| 94 | 
            +
             | 
| 95 | 
            +
                  def initialize(title:, actions: [])
         | 
| 96 | 
            +
                    @title = title
         | 
| 97 | 
            +
                    @actions = actions
         | 
| 98 | 
            +
                  end
         | 
| 99 | 
            +
             | 
| 100 | 
            +
                  def call
         | 
| 101 | 
            +
                    render(Polaris::PopoverComponent.new) do |popover|
         | 
| 102 | 
            +
                      popover.button(disclosure: true) { @title }
         | 
| 103 | 
            +
             | 
| 104 | 
            +
                      polaris_action_list do |list|
         | 
| 105 | 
            +
                        @actions.each do |action|
         | 
| 106 | 
            +
                          list.item(**action) { action[:content] }
         | 
| 107 | 
            +
                        end
         | 
| 108 | 
            +
                      end
         | 
| 109 | 
            +
                    end
         | 
| 110 | 
            +
                  end
         | 
| 111 | 
            +
                end
         | 
| 55 112 | 
             
              end
         | 
| 56 113 | 
             
            end
         | 
| @@ -31,6 +31,7 @@ module Polaris | |
| 31 31 | 
             
                  vertical_alignment: ALIGNMENT_DEFAULT,
         | 
| 32 32 | 
             
                  cursor: CURSOR_DEFAULT,
         | 
| 33 33 | 
             
                  selectable: false,
         | 
| 34 | 
            +
                  selected: false,
         | 
| 34 35 | 
             
                  offset: false,
         | 
| 35 36 | 
             
                  wrapper_arguments: {},
         | 
| 36 37 | 
             
                  container_arguments: {},
         | 
| @@ -40,6 +41,7 @@ module Polaris | |
| 40 41 | 
             
                  @vertical_alignment = vertical_alignment
         | 
| 41 42 | 
             
                  @cursor = fetch_or_fallback(CURSOR_OPTIONS, cursor, CURSOR_DEFAULT)
         | 
| 42 43 | 
             
                  @selectable = selectable
         | 
| 44 | 
            +
                  @selected = selected
         | 
| 43 45 | 
             
                  @offset = offset
         | 
| 44 46 | 
             
                  @wrapper_arguments = wrapper_arguments
         | 
| 45 47 | 
             
                  @container_arguments = container_arguments
         | 
| @@ -79,7 +81,8 @@ module Polaris | |
| 79 81 | 
             
                    args[:classes] = class_names(
         | 
| 80 82 | 
             
                      args[:classes],
         | 
| 81 83 | 
             
                      "Polaris-ResourceItem",
         | 
| 82 | 
            -
                      "Polaris-ResourceItem--selectable": @selectable
         | 
| 84 | 
            +
                      "Polaris-ResourceItem--selectable": @selectable,
         | 
| 85 | 
            +
                      "Polaris-ResourceItem--selected": @selected
         | 
| 83 86 | 
             
                    )
         | 
| 84 87 | 
             
                    prepend_option(args, :style, "cursor: #{@cursor};")
         | 
| 85 88 | 
             
                    prepend_option(args[:data], :action, "click->polaris-resource-item#open")
         | 
| @@ -105,7 +105,7 @@ module Polaris | |
| 105 105 | 
             
                    tag: "div",
         | 
| 106 106 | 
             
                    data: {
         | 
| 107 107 | 
             
                      polaris_text_field_has_value_class: "Polaris-TextField--hasValue",
         | 
| 108 | 
            -
                      polaris_text_field_clear_button_hidden_class: "Polaris- | 
| 108 | 
            +
                      polaris_text_field_clear_button_hidden_class: "Polaris-TextField__Hidden"
         | 
| 109 109 | 
             
                    }
         | 
| 110 110 | 
             
                  }.deep_merge(@system_arguments).tap do |opts|
         | 
| 111 111 | 
             
                    opts[:classes] = class_names(
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: polaris_view_components
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.10.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Dan Gamble
         | 
| @@ -9,7 +9,7 @@ authors: | |
| 9 9 | 
             
            autorequire:
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date: 2022- | 
| 12 | 
            +
            date: 2022-05-08 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: rails
         | 
| @@ -39,6 +39,90 @@ dependencies: | |
| 39 39 | 
             
                - - ">="
         | 
| 40 40 | 
             
                  - !ruby/object:Gem::Version
         | 
| 41 41 | 
             
                    version: 2.0.0
         | 
| 42 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 43 | 
            +
              name: capybara
         | 
| 44 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 45 | 
            +
                requirements:
         | 
| 46 | 
            +
                - - "~>"
         | 
| 47 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 48 | 
            +
                    version: '3'
         | 
| 49 | 
            +
              type: :development
         | 
| 50 | 
            +
              prerelease: false
         | 
| 51 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 52 | 
            +
                requirements:
         | 
| 53 | 
            +
                - - "~>"
         | 
| 54 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 55 | 
            +
                    version: '3'
         | 
| 56 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 57 | 
            +
              name: webdrivers
         | 
| 58 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 59 | 
            +
                requirements:
         | 
| 60 | 
            +
                - - "~>"
         | 
| 61 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 62 | 
            +
                    version: '5.0'
         | 
| 63 | 
            +
              type: :development
         | 
| 64 | 
            +
              prerelease: false
         | 
| 65 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 66 | 
            +
                requirements:
         | 
| 67 | 
            +
                - - "~>"
         | 
| 68 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 69 | 
            +
                    version: '5.0'
         | 
| 70 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 71 | 
            +
              name: selenium-webdriver
         | 
| 72 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 73 | 
            +
                requirements:
         | 
| 74 | 
            +
                - - "~>"
         | 
| 75 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 76 | 
            +
                    version: '4.1'
         | 
| 77 | 
            +
              type: :development
         | 
| 78 | 
            +
              prerelease: false
         | 
| 79 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 80 | 
            +
                requirements:
         | 
| 81 | 
            +
                - - "~>"
         | 
| 82 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 83 | 
            +
                    version: '4.1'
         | 
| 84 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 85 | 
            +
              name: minitest
         | 
| 86 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 87 | 
            +
                requirements:
         | 
| 88 | 
            +
                - - "~>"
         | 
| 89 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 90 | 
            +
                    version: '5.0'
         | 
| 91 | 
            +
              type: :development
         | 
| 92 | 
            +
              prerelease: false
         | 
| 93 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 94 | 
            +
                requirements:
         | 
| 95 | 
            +
                - - "~>"
         | 
| 96 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 97 | 
            +
                    version: '5.0'
         | 
| 98 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 99 | 
            +
              name: pry
         | 
| 100 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 101 | 
            +
                requirements:
         | 
| 102 | 
            +
                - - ">="
         | 
| 103 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 104 | 
            +
                    version: '0'
         | 
| 105 | 
            +
              type: :development
         | 
| 106 | 
            +
              prerelease: false
         | 
| 107 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 108 | 
            +
                requirements:
         | 
| 109 | 
            +
                - - ">="
         | 
| 110 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 111 | 
            +
                    version: '0'
         | 
| 112 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 113 | 
            +
              name: sprockets-rails
         | 
| 114 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 115 | 
            +
                requirements:
         | 
| 116 | 
            +
                - - ">="
         | 
| 117 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 118 | 
            +
                    version: '0'
         | 
| 119 | 
            +
              type: :development
         | 
| 120 | 
            +
              prerelease: false
         | 
| 121 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 122 | 
            +
                requirements:
         | 
| 123 | 
            +
                - - ">="
         | 
| 124 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 125 | 
            +
                    version: '0'
         | 
| 42 126 | 
             
            description:
         | 
| 43 127 | 
             
            email:
         | 
| 44 128 | 
             
            - dan@dangamble.co.uk
         | 
| @@ -685,7 +769,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 685 769 | 
             
                - !ruby/object:Gem::Version
         | 
| 686 770 | 
             
                  version: '0'
         | 
| 687 771 | 
             
            requirements: []
         | 
| 688 | 
            -
            rubygems_version: 3. | 
| 772 | 
            +
            rubygems_version: 3.3.7
         | 
| 689 773 | 
             
            signing_key:
         | 
| 690 774 | 
             
            specification_version: 4
         | 
| 691 775 | 
             
            summary: ViewComponents for Polaris Design System
         |