openproject-primer_view_components 0.38.0 → 0.39.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -250,10 +250,22 @@ module Primer
250
250
  # )
251
251
  # ```
252
252
  class SelectPanel < Primer::Component
253
- status :alpha
254
-
255
253
  # The component that should be used to render the list of items in the body of a SelectPanel.
256
- ItemList = Primer::Alpha::ActionList
254
+ class ItemList < Primer::Alpha::ActionList
255
+ # @param system_arguments [Hash] The arguments accepted by <%= link_to_component(Primer::Alpha::ActionList) %>.
256
+ def initialize(**system_arguments)
257
+ select_variant = system_arguments[:select_variant] || Primer::Alpha::ActionList::DEFAULT_SELECT_VARIANT
258
+
259
+ super(
260
+ p: 2,
261
+ role: "listbox",
262
+ aria_selection_variant: select_variant == :single ? :selected : :checked,
263
+ **system_arguments
264
+ )
265
+ end
266
+ end
267
+
268
+ status :alpha
257
269
 
258
270
  DEFAULT_PRELOAD = false
259
271
 
@@ -328,6 +340,7 @@ module Primer
328
340
  # @param open_on_load [Boolean] Open the panel when the page loads.
329
341
  # @param anchor_align [Symbol] The anchor alignment of the Overlay. <%= one_of(Primer::Alpha::Overlay::ANCHOR_ALIGN_OPTIONS) %>
330
342
  # @param anchor_side [Symbol] The side to anchor the Overlay to. <%= one_of(Primer::Alpha::Overlay::ANCHOR_SIDE_OPTIONS) %>
343
+ # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
331
344
  def initialize(
332
345
  src: nil,
333
346
  title: "Menu",
@@ -184,6 +184,9 @@ let SelectPanelElement = class SelectPanelElement extends HTMLElement {
184
184
  const elem = entry.target;
185
185
  if (entry.isIntersecting && elem === this.dialog) {
186
186
  this.updateAnchorPosition();
187
+ if (__classPrivateFieldGet(this, _SelectPanelElement_instances, "a", _SelectPanelElement_fetchStrategy_get) === FetchStrategy.LOCAL) {
188
+ __classPrivateFieldGet(this, _SelectPanelElement_instances, "m", _SelectPanelElement_updateItemVisibility).call(this);
189
+ }
187
190
  }
188
191
  }
189
192
  }), "f");
@@ -216,6 +216,10 @@ export class SelectPanelElement extends HTMLElement {
216
216
  const elem = entry.target
217
217
  if (entry.isIntersecting && elem === this.dialog) {
218
218
  this.updateAnchorPosition()
219
+
220
+ if (this.#fetchStrategy === FetchStrategy.LOCAL) {
221
+ this.#updateItemVisibility()
222
+ }
219
223
  }
220
224
  }
221
225
  })
@@ -5,8 +5,8 @@ module Primer
5
5
  module ViewComponents
6
6
  module VERSION
7
7
  MAJOR = 0
8
- MINOR = 38
9
- PATCH = 0
8
+ MINOR = 39
9
+ PATCH = 1
10
10
 
11
11
  STRING = [MAJOR, MINOR, PATCH].join(".")
12
12
  end
@@ -5,7 +5,11 @@
5
5
 
6
6
  <%= render(Primer::Alpha::SelectPanel.new(
7
7
  data: { interaction_subject: subject_id },
8
- src: select_panel_items_path(show_results: !simulate_no_results, fail: simulate_failure),
8
+ src: select_panel_items_path(
9
+ select_variant: :single,
10
+ show_results: !simulate_no_results,
11
+ fail: simulate_failure
12
+ ),
9
13
  select_variant: :single,
10
14
  fetch_strategy: :remote,
11
15
  **system_arguments
@@ -0,0 +1,21 @@
1
+ <%=
2
+ render(Primer::OpenProject::PageHeader.new) do |component|
3
+ component.with_title { "Users" }
4
+ component.with_breadcrumbs([{ href: "/foo", text: "Foo" }, { href: "/bar", text: "Bar" }, "Baz"])
5
+ end
6
+ %>
7
+
8
+ <%=
9
+ render(Primer::OpenProject::SubHeader.new) do |component|
10
+ component.with_filter_input(name: "filter", label: "Filter")
11
+ component.with_filter_button do |button|
12
+ button.with_trailing_visual_counter(count: "15")
13
+ "Filter"
14
+ end
15
+
16
+ component.with_action_button(scheme: :primary) do |button|
17
+ button.with_leading_visual_icon(icon: :plus)
18
+ "User"
19
+ end
20
+ end
21
+ %>
@@ -111,28 +111,34 @@ module Primer
111
111
  # The missing label will be resolved automatically when included into the core
112
112
  def zen_mode_button_actions
113
113
  render(Primer::OpenProject::PageHeader.new) do |component|
114
- component.with_title { "Great news" }
114
+ component.with_title { "Great user" }
115
115
  component.with_breadcrumbs([{ href: "/foo", text: "Foo" }, { href: "/bar", text: "Bar" }, "Baz"])
116
116
 
117
117
  # The missing label will be resolved automatically when included into the core
118
118
  component.with_action_zen_mode_button
119
- component.with_action_button(mobile_icon: "plus", mobile_label: "Meeting", scheme: :primary) do |button|
120
- button.with_leading_visual_icon(icon: "plus")
121
- "Meeting"
119
+ component.with_action_button(mobile_icon: "person", mobile_label: "Profile") do |button|
120
+ button.with_leading_visual_icon(icon: "person")
121
+ "Profile"
122
122
  end
123
123
  end
124
124
  end
125
125
 
126
+ # @label With a create action
127
+ # Create action usually belong into the Primer::OpenProject::SubHeader
128
+ def create_action
129
+ render_with_template(locals: {})
130
+ end
131
+
126
132
  # @label With a single action
127
133
  # The single action will not be transformed into a menu on mobile, but remains in a smaller variant
128
134
  def single_action
129
135
  render(Primer::OpenProject::PageHeader.new) do |component|
130
- component.with_title { "Great news" }
136
+ component.with_title { "Great user" }
131
137
  component.with_breadcrumbs([{ href: "/foo", text: "Foo" }, { href: "/bar", text: "Bar" }, "Baz"])
132
138
 
133
- component.with_action_button(mobile_icon: "plus", mobile_label: "Meeting", scheme: :primary) do |button|
134
- button.with_leading_visual_icon(icon: "plus")
135
- "Meeting"
139
+ component.with_action_button(mobile_icon: "person", mobile_label: "Profile") do |button|
140
+ button.with_leading_visual_icon(icon: "person")
141
+ "Profile"
136
142
  end
137
143
  end
138
144
  end
@@ -2467,6 +2467,28 @@
2467
2467
  "type": "Symbol",
2468
2468
  "default": "`:outside_bottom`",
2469
2469
  "description": "The side to anchor the Overlay to. One of `:inside_bottom`, `:inside_center`, `:inside_left`, `:inside_right`, `:inside_top`, `:outside_bottom`, `:outside_left`, `:outside_right`, or `:outside_top`."
2470
+ },
2471
+ {
2472
+ "name": "system_arguments",
2473
+ "type": "Hash",
2474
+ "default": "N/A",
2475
+ "description": "[System arguments](/system-arguments)"
2476
+ }
2477
+ ]
2478
+ },
2479
+ {
2480
+ "component": "SelectPanel::ItemList",
2481
+ "status": "alpha",
2482
+ "a11y_reviewed": true,
2483
+ "short_name": "SelectPanelItemList",
2484
+ "source": "https://github.com/primer/view_components/tree/main/app/components/primer/alpha/select_panel/item_list.rb",
2485
+ "lookbook": "https://primer.style/view-components/lookbook/inspect/primer/alpha/select_panel/item_list/default/",
2486
+ "parameters": [
2487
+ {
2488
+ "name": "system_arguments",
2489
+ "type": "Hash",
2490
+ "default": "N/A",
2491
+ "description": "The arguments accepted by [ActionList](/components/alpha/actionlist)."
2470
2492
  }
2471
2493
  ]
2472
2494
  },
@@ -53,6 +53,7 @@
53
53
  "Primer::Alpha::SegmentedControl::Item": "2023-02-01",
54
54
  "Primer::Alpha::Select": "",
55
55
  "Primer::Alpha::SelectPanel": "",
56
+ "Primer::Alpha::SelectPanel::ItemList": "2023-07-10",
56
57
  "Primer::Alpha::SubmitButton": "",
57
58
  "Primer::Alpha::TabContainer": "",
58
59
  "Primer::Alpha::TabNav": "",
@@ -606,13 +606,15 @@
606
606
  "eventually_local",
607
607
  "local"
608
608
  ],
609
- "ItemList": "Primer::Alpha::ActionList",
609
+ "ItemList": "Primer::Alpha::SelectPanel::ItemList",
610
610
  "SELECT_VARIANT_OPTIONS": [
611
611
  "single",
612
612
  "multiple",
613
613
  "none"
614
614
  ]
615
615
  },
616
+ "Primer::Alpha::SelectPanel::ItemList": {
617
+ },
616
618
  "Primer::Alpha::SubmitButton": {
617
619
  },
618
620
  "Primer::Alpha::TabContainer": {
@@ -7630,6 +7630,12 @@
7630
7630
  "type": "Symbol",
7631
7631
  "default": "`:outside_bottom`",
7632
7632
  "description": "The side to anchor the Overlay to. One of `:inside_bottom`, `:inside_center`, `:inside_left`, `:inside_right`, `:inside_top`, `:outside_bottom`, `:outside_left`, `:outside_right`, or `:outside_top`."
7633
+ },
7634
+ {
7635
+ "name": "system_arguments",
7636
+ "type": "Hash",
7637
+ "default": "N/A",
7638
+ "description": "{{link_to_system_arguments_docs}}"
7633
7639
  }
7634
7640
  ],
7635
7641
  "slots": [
@@ -8080,7 +8086,64 @@
8080
8086
  }
8081
8087
  ],
8082
8088
  "subcomponents": [
8089
+ {
8090
+ "fully_qualified_name": "Primer::Alpha::SelectPanel::ItemList",
8091
+ "description": "The component that should be used to render the list of items in the body of a SelectPanel.",
8092
+ "accessibility_docs": null,
8093
+ "is_form_component": false,
8094
+ "is_published": true,
8095
+ "requires_js": true,
8096
+ "component": "SelectPanel::ItemList",
8097
+ "status": "alpha",
8098
+ "a11y_reviewed": true,
8099
+ "short_name": "SelectPanelItemList",
8100
+ "source": "https://github.com/primer/view_components/tree/main/app/components/primer/alpha/select_panel/item_list.rb",
8101
+ "lookbook": "https://primer.style/view-components/lookbook/inspect/primer/alpha/select_panel/item_list/default/",
8102
+ "parameters": [
8103
+ {
8104
+ "name": "system_arguments",
8105
+ "type": "Hash",
8106
+ "default": "N/A",
8107
+ "description": "The arguments accepted by {{#link_to_component}}Primer::Alpha::ActionList{{/link_to_component}}."
8108
+ }
8109
+ ],
8110
+ "slots": [
8111
+ {
8112
+ "name": "heading",
8113
+ "description": "Heading text rendered above the list of items.",
8114
+ "parameters": [
8115
+ {
8116
+ "name": "component_klass",
8117
+ "type": "Class",
8118
+ "default": "N/A",
8119
+ "description": "The class to use instead of the default {{#link_to_component}}Primer::Alpha::ActionList::Heading{{/link_to_component}}."
8120
+ },
8121
+ {
8122
+ "name": "system_arguments",
8123
+ "type": "Hash",
8124
+ "default": "N/A",
8125
+ "description": "The arguments accepted by `component_klass`."
8126
+ }
8127
+ ]
8128
+ },
8129
+ {
8130
+ "name": "items",
8131
+ "description": "Items. Items can be individual items, avatar items, or dividers. See the documentation for `#with_item`, `#with_divider`, and `#with_avatar_item` respectively for more information.",
8132
+ "parameters": [
8133
+
8134
+ ]
8135
+ }
8136
+ ],
8137
+ "methods": [
8138
+
8139
+ ],
8140
+ "previews": [
8083
8141
 
8142
+ ],
8143
+ "subcomponents": [
8144
+
8145
+ ]
8146
+ }
8084
8147
  ]
8085
8148
  },
8086
8149
  {
@@ -17765,6 +17828,19 @@
17765
17828
  ]
17766
17829
  }
17767
17830
  },
17831
+ {
17832
+ "preview_path": "primer/open_project/page_header/create_action",
17833
+ "name": "create_action",
17834
+ "snapshot": "false",
17835
+ "skip_rules": {
17836
+ "wont_fix": [
17837
+ "region"
17838
+ ],
17839
+ "will_fix": [
17840
+ "color-contrast"
17841
+ ]
17842
+ }
17843
+ },
17768
17844
  {
17769
17845
  "preview_path": "primer/open_project/page_header/single_action",
17770
17846
  "name": "single_action",
data/static/previews.json CHANGED
@@ -5443,6 +5443,19 @@
5443
5443
  ]
5444
5444
  }
5445
5445
  },
5446
+ {
5447
+ "preview_path": "primer/open_project/page_header/create_action",
5448
+ "name": "create_action",
5449
+ "snapshot": "false",
5450
+ "skip_rules": {
5451
+ "wont_fix": [
5452
+ "region"
5453
+ ],
5454
+ "will_fix": [
5455
+ "color-contrast"
5456
+ ]
5457
+ }
5458
+ },
5446
5459
  {
5447
5460
  "preview_path": "primer/open_project/page_header/single_action",
5448
5461
  "name": "single_action",
data/static/statuses.json CHANGED
@@ -53,6 +53,7 @@
53
53
  "Primer::Alpha::SegmentedControl::Item": "alpha",
54
54
  "Primer::Alpha::Select": "alpha",
55
55
  "Primer::Alpha::SelectPanel": "alpha",
56
+ "Primer::Alpha::SelectPanel::ItemList": "alpha",
56
57
  "Primer::Alpha::SubmitButton": "alpha",
57
58
  "Primer::Alpha::TabContainer": "alpha",
58
59
  "Primer::Alpha::TabNav": "alpha",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openproject-primer_view_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.38.0
4
+ version: 0.39.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitHub Open Source
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-07-24 00:00:00.000000000 Z
12
+ date: 2024-07-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionview
@@ -987,6 +987,7 @@ files:
987
987
  - previews/primer/open_project/input_group_preview.rb
988
988
  - previews/primer/open_project/page_header_preview.rb
989
989
  - previews/primer/open_project/page_header_preview/actions.html.erb
990
+ - previews/primer/open_project/page_header_preview/create_action.html.erb
990
991
  - previews/primer/open_project/page_header_preview/playground.html.erb
991
992
  - previews/primer/open_project/side_panel_preview.rb
992
993
  - previews/primer/open_project/side_panel_preview/default.html.erb