openproject-primer_view_components 0.25.0 → 0.26.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +24 -0
  3. data/app/assets/javascripts/primer_view_components.js +1 -1
  4. data/app/assets/javascripts/primer_view_components.js.map +1 -1
  5. data/app/assets/styles/primer_view_components.css +1 -1
  6. data/app/assets/styles/primer_view_components.css.map +1 -1
  7. data/app/components/primer/alpha/action_list/item.rb +1 -1
  8. data/app/components/primer/alpha/action_list.js +15 -12
  9. data/app/components/primer/alpha/action_list.ts +12 -9
  10. data/app/components/primer/alpha/dialog.css +1 -1
  11. data/app/components/primer/alpha/dialog.css.json +1 -0
  12. data/app/components/primer/alpha/dialog.css.map +1 -1
  13. data/app/components/primer/alpha/dialog.pcss +4 -0
  14. data/app/components/primer/alpha/overlay/header.html.erb +1 -0
  15. data/app/components/primer/alpha/overlay/header.rb +12 -0
  16. data/app/components/primer/alpha/tool_tip.js +1 -1
  17. data/app/components/primer/alpha/tool_tip.ts +1 -1
  18. data/app/components/primer/beta/button.css +1 -1
  19. data/app/components/primer/beta/button.css.json +2 -0
  20. data/app/components/primer/beta/button.css.map +1 -1
  21. data/app/components/primer/beta/button.pcss +8 -0
  22. data/app/components/primer/beta/button_group.rb +4 -2
  23. data/app/components/primer/beta/icon_button.rb +2 -0
  24. data/app/components/primer/dialog_helper.js +16 -3
  25. data/app/components/primer/dialog_helper.ts +14 -1
  26. data/lib/primer/view_components/version.rb +1 -1
  27. data/previews/primer/alpha/action_list_preview.rb +19 -1
  28. data/previews/primer/alpha/dialog_preview.rb +24 -0
  29. data/previews/primer/alpha/overlay_preview/overlay_with_header_filter.html.erb +16 -0
  30. data/previews/primer/alpha/overlay_preview.rb +4 -0
  31. data/previews/primer/alpha/tab_nav_preview.rb +1 -1
  32. data/previews/primer/alpha/tab_panels_preview.rb +2 -2
  33. data/previews/primer/alpha/underline_nav_preview.rb +3 -3
  34. data/previews/primer/alpha/underline_panels_preview.rb +38 -0
  35. data/previews/primer/beta/avatar_stack_preview.rb +1 -1
  36. data/previews/primer/beta/breadcrumbs_preview.rb +2 -2
  37. data/previews/primer/beta/button_group_preview/with_menu_button.html.erb +1 -1
  38. data/previews/primer/beta/button_group_preview.rb +7 -1
  39. data/previews/primer/beta/icon_button_preview.rb +25 -0
  40. data/previews/primer/beta/nav_list_preview.rb +9 -3
  41. data/static/arguments.json +1 -1
  42. data/static/classes.json +3 -0
  43. data/static/constants.json +4 -0
  44. data/static/info_arch.json +79 -3
  45. data/static/previews.json +66 -1
  46. metadata +5 -4
@@ -11,7 +11,7 @@ module Primer
11
11
  # @param with_counters [Boolean] toggle
12
12
  def playground(number_of_tabs: 3, with_icons: false, with_counters: false)
13
13
  render(Primer::Alpha::TabNav.new(label: "label")) do |component|
14
- Array.new(number_of_tabs || 3) do |i|
14
+ Array.new(number_of_tabs&.to_i || 3) do |i|
15
15
  component.with_tab(selected: i.zero?, href: "##{i + 1}") do |tab|
16
16
  tab.with_icon(icon: :star) if with_icons
17
17
  tab.with_text { "Tab #{i + 1}" }
@@ -10,7 +10,7 @@ module Primer
10
10
  # @param align [Symbol] select [left, right]
11
11
  def playground(number_of_panels: 3, align: :left)
12
12
  render(Primer::Alpha::TabPanels.new(label: "label", align: align)) do |component|
13
- Array.new(number_of_panels || 3) do |i|
13
+ Array.new(number_of_panels&.to_i || 3) do |i|
14
14
  component.with_tab(selected: i.zero?, id: "tab-#{i + 1}") do |tab|
15
15
  tab.with_panel { "Panel #{i + 1}" }
16
16
  tab.with_text { "Tab #{i + 1}" }
@@ -26,7 +26,7 @@ module Primer
26
26
  # @snapshot
27
27
  def default(number_of_panels: 3, align: :left)
28
28
  render(Primer::Alpha::TabPanels.new(label: "label", align: align)) do |component|
29
- Array.new(number_of_panels || 3) do |i|
29
+ Array.new(number_of_panels&.to_i || 3) do |i|
30
30
  component.with_tab(selected: i.zero?, id: "tab-#{i + 1}") do |tab|
31
31
  tab.with_panel { "Panel #{i + 1}" }
32
32
  tab.with_text { "Tab #{i + 1}" }
@@ -15,7 +15,7 @@ module Primer
15
15
  label: label,
16
16
  tag: tag,
17
17
  align: align,
18
- number_of_panels: number_of_panels
18
+ number_of_panels: number_of_panels.to_i,
19
19
  })
20
20
  end
21
21
 
@@ -31,7 +31,7 @@ module Primer
31
31
  label: label,
32
32
  tag: tag,
33
33
  align: align,
34
- number_of_panels: number_of_panels
34
+ number_of_panels: number_of_panels.to_i,
35
35
  })
36
36
  end
37
37
 
@@ -44,7 +44,7 @@ module Primer
44
44
  # @param number_of_panels [Integer] number
45
45
  def with_icons_and_counters(label: "With icons and counters", number_of_panels: 3, align: :left, tag: :nav)
46
46
  render(Primer::Alpha::UnderlineNav.new(label: label, tag: tag, align: align)) do |component|
47
- Array.new(number_of_panels || 3) do |i|
47
+ Array.new(number_of_panels.to_i || 3) do |i|
48
48
  component.with_tab(href: "#", selected: i.zero?) do |tab|
49
49
  tab.with_icon(icon: :star)
50
50
  tab.with_text { "Item #{i + 1}" }
@@ -21,9 +21,44 @@ module Primer
21
21
 
22
22
  # @label Default options
23
23
  #
24
+ # @snapshot
24
25
  # @param number_of_panels [Integer] number
25
26
  # @param align [Symbol] select [left, right]
26
27
  def default(number_of_panels: 3, align: :left)
28
+ render(Primer::Alpha::UnderlinePanels.new(label: "Test navigation", align: align)) do |component|
29
+ Array.new(number_of_panels&.to_i || 3) do |i|
30
+ component.with_tab(selected: i.zero?, id: "tab-#{i + 1}") do |tab|
31
+ tab.with_panel { "Panel #{i + 1}" }
32
+ tab.with_text { "Tab #{i + 1}" }
33
+ end
34
+ end
35
+ end
36
+ end
37
+
38
+ # @label With Icons and Counters
39
+ #
40
+ # @snapshot
41
+ # @param number_of_panels [Integer] number
42
+ # @param align [Symbol] select [left, right]
43
+ def with_icons_and_counters(number_of_panels: 3, align: :left)
44
+ render(Primer::Alpha::UnderlinePanels.new(label: "Test navigation", align: align)) do |component|
45
+ Array.new(number_of_panels || 3) do |i|
46
+ component.with_tab(selected: i.zero?, id: "tab-#{i + 1}") do |tab|
47
+ tab.with_panel { "Panel #{i + 1}" }
48
+ tab.with_text { "Tab #{i + 1}" }
49
+ tab.with_icon(icon: :star)
50
+ tab.with_counter(count: (i + 1) * 5)
51
+ end
52
+ end
53
+ end
54
+ end
55
+
56
+ # @label With Actions
57
+ #
58
+ # @snapshot
59
+ # @param number_of_panels [Integer] number
60
+ # @param align [Symbol] select [left, right]
61
+ def with_actions(number_of_panels: 3, align: :right)
27
62
  render(Primer::Alpha::UnderlinePanels.new(label: "Test navigation", align: align)) do |component|
28
63
  Array.new(number_of_panels || 3) do |i|
29
64
  component.with_tab(selected: i.zero?, id: "tab-#{i + 1}") do |tab|
@@ -31,6 +66,9 @@ module Primer
31
66
  tab.with_text { "Tab #{i + 1}" }
32
67
  end
33
68
  end
69
+ component.with_actions do
70
+ "Actions Content"
71
+ end
34
72
  end
35
73
  end
36
74
  end
@@ -13,7 +13,7 @@ module Primer
13
13
  # @param tooltip_label text
14
14
  def playground(number_of_avatars: 1, tag: :div, align: :left, tooltipped: false, tooltip_label: "This is a tooltip!")
15
15
  render(Primer::Beta::AvatarStack.new(tag: tag, align: align, tooltipped: tooltipped, body_arguments: { label: tooltip_label })) do |component|
16
- Array.new(number_of_avatars || 1) do
16
+ Array.new(number_of_avatars&.to_i || 1) do
17
17
  component.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser")
18
18
  end
19
19
  end
@@ -9,7 +9,7 @@ module Primer
9
9
  # @param number_of_links [Integer] number
10
10
  def playground(number_of_links: 2)
11
11
  render(Primer::Beta::Breadcrumbs.new) do |component|
12
- Array.new(number_of_links || 3) do |i|
12
+ Array.new(number_of_links&.to_i || 3) do |i|
13
13
  component.with_item(href: "##{i}") { "Breadcrumb Item #{i + 1}" }
14
14
  end
15
15
  end
@@ -21,7 +21,7 @@ module Primer
21
21
  # @snapshot
22
22
  def default(number_of_links: 2)
23
23
  render(Primer::Beta::Breadcrumbs.new) do |component|
24
- Array.new(number_of_links || 3) do |i|
24
+ Array.new(number_of_links&.to_i || 3) do |i|
25
25
  component.with_item(href: "##{i}") { "Breadcrumb Item #{i + 1}" }
26
26
  end
27
27
  end
@@ -1,4 +1,4 @@
1
- <%= render(Primer::Beta::ButtonGroup.new) do |component| %>
1
+ <%= render(Primer::Beta::ButtonGroup.new(scheme: scheme, size: size)) do |component| %>
2
2
  <% component.with_button { "Main menu" } %>
3
3
  <% component.with_menu_button(button_arguments: { "aria-label": "secondary menu" }, menu_arguments: { anchor_align: :end }) do |menu, button| %>
4
4
  <% menu.with_item(label: "Item 1", item_id: :item1) %>
@@ -41,8 +41,14 @@ module Primer
41
41
 
42
42
  # @label With menu button
43
43
  #
44
+ # @param scheme [Symbol] select [default, primary, secondary, danger, invisible]
45
+ # @param size [Symbol] select [medium, small]
44
46
  # @snapshot
45
- def with_menu_button
47
+ def with_menu_button(scheme: :default, size: :medium)
48
+ render_with_template(locals: {
49
+ scheme: scheme,
50
+ size: size
51
+ })
46
52
  end
47
53
 
48
54
  # @label Icon buttons
@@ -87,6 +87,31 @@ module Primer
87
87
  ))
88
88
  end
89
89
 
90
+ # @label Primary
91
+ # @param size select [small, medium, large]
92
+ # @param aria_label text
93
+ # @param disabled toggle
94
+ # @param tag select [a, summary, button]
95
+ # @snapshot
96
+ def primary(
97
+ size: :medium,
98
+ id: "button-preview",
99
+ tag: :button,
100
+ disabled: false,
101
+ icon: :x,
102
+ aria_label: "Button"
103
+ )
104
+ render(Primer::Beta::IconButton.new(
105
+ scheme: :primary,
106
+ size: size,
107
+ id: id,
108
+ tag: tag,
109
+ disabled: disabled,
110
+ icon: icon,
111
+ "aria-label": aria_label
112
+ ))
113
+ end
114
+
90
115
  # @label Danger
91
116
  # @param size select [small, medium, large]
92
117
  # @param aria_label text
@@ -139,9 +139,15 @@ module Primer
139
139
  component.with_item(
140
140
  label: "Really really long label that may wrap, truncate, or appear as a tooltip",
141
141
  truncate_label: truncate_label
142
- ) do |item|
143
- item.with_trailing_visual_icon(icon: :plus)
144
- end
142
+ )
143
+ component.with_item(
144
+ label: "Really really long label that may wrap, truncate, or appear as a tooltip",
145
+ truncate_label: truncate_label
146
+ )
147
+ component.with_item(
148
+ label: "Really really long label that may wrap, truncate, or appear as a tooltip",
149
+ truncate_label: truncate_label
150
+ )
145
151
  end
146
152
  end
147
153
 
@@ -3760,7 +3760,7 @@
3760
3760
  "name": "scheme",
3761
3761
  "type": "Symbol",
3762
3762
  "default": "`:default`",
3763
- "description": "One of `:danger`, `:default`, or `:invisible`."
3763
+ "description": "One of `:danger`, `:default`, `:invisible`, `:primary`, or `:secondary`."
3764
3764
  },
3765
3765
  {
3766
3766
  "name": "size",
data/static/classes.json CHANGED
@@ -420,6 +420,9 @@
420
420
  "Overlay-header": [
421
421
  "Primer::Alpha::Dialog"
422
422
  ],
423
+ "Overlay-headerFilter": [
424
+ "Primer::Alpha::Dialog"
425
+ ],
423
426
  "PageHeader": [
424
427
  "Primer::OpenProject::PageHeader"
425
428
  ],
@@ -938,11 +938,15 @@
938
938
  "DEFAULT_SCHEME": "default",
939
939
  "SCHEME_MAPPINGS": {
940
940
  "default": "Button--secondary",
941
+ "primary": "Button--primary",
942
+ "secondary": "Button--secondary",
941
943
  "danger": "Button--danger",
942
944
  "invisible": "Button--invisible"
943
945
  },
944
946
  "SCHEME_OPTIONS": [
945
947
  "default",
948
+ "primary",
949
+ "secondary",
946
950
  "danger",
947
951
  "invisible"
948
952
  ]
@@ -3440,6 +3440,19 @@
3440
3440
  "color-contrast"
3441
3441
  ]
3442
3442
  }
3443
+ },
3444
+ {
3445
+ "preview_path": "primer/alpha/dialog/initally_open",
3446
+ "name": "initally_open",
3447
+ "snapshot": "interactive",
3448
+ "skip_rules": {
3449
+ "wont_fix": [
3450
+ "region"
3451
+ ],
3452
+ "will_fix": [
3453
+ "color-contrast"
3454
+ ]
3455
+ }
3443
3456
  }
3444
3457
  ],
3445
3458
  "subcomponents": [
@@ -6068,6 +6081,19 @@
6068
6081
  "color-contrast"
6069
6082
  ]
6070
6083
  }
6084
+ },
6085
+ {
6086
+ "preview_path": "primer/alpha/overlay/overlay_with_header_filter",
6087
+ "name": "overlay_with_header_filter",
6088
+ "snapshot": "false",
6089
+ "skip_rules": {
6090
+ "wont_fix": [
6091
+ "region"
6092
+ ],
6093
+ "will_fix": [
6094
+ "color-contrast"
6095
+ ]
6096
+ }
6071
6097
  }
6072
6098
  ],
6073
6099
  "subcomponents": [
@@ -6129,7 +6155,18 @@
6129
6155
  }
6130
6156
  ],
6131
6157
  "slots": [
6132
-
6158
+ {
6159
+ "name": "filter",
6160
+ "description": "Optional filter slot for adding a filter input to the header.",
6161
+ "parameters": [
6162
+ {
6163
+ "name": "system_arguments",
6164
+ "type": "Hash",
6165
+ "default": "N/A",
6166
+ "description": "{{link_to_system_arguments_docs}}"
6167
+ }
6168
+ ]
6169
+ }
6133
6170
  ],
6134
6171
  "methods": [
6135
6172
 
@@ -9128,7 +9165,33 @@
9128
9165
  {
9129
9166
  "preview_path": "primer/alpha/underline_panels/default",
9130
9167
  "name": "default",
9131
- "snapshot": "false",
9168
+ "snapshot": "true",
9169
+ "skip_rules": {
9170
+ "wont_fix": [
9171
+ "region"
9172
+ ],
9173
+ "will_fix": [
9174
+ "color-contrast"
9175
+ ]
9176
+ }
9177
+ },
9178
+ {
9179
+ "preview_path": "primer/alpha/underline_panels/with_icons_and_counters",
9180
+ "name": "with_icons_and_counters",
9181
+ "snapshot": "true",
9182
+ "skip_rules": {
9183
+ "wont_fix": [
9184
+ "region"
9185
+ ],
9186
+ "will_fix": [
9187
+ "color-contrast"
9188
+ ]
9189
+ }
9190
+ },
9191
+ {
9192
+ "preview_path": "primer/alpha/underline_panels/with_actions",
9193
+ "name": "with_actions",
9194
+ "snapshot": "true",
9132
9195
  "skip_rules": {
9133
9196
  "wont_fix": [
9134
9197
  "region"
@@ -12433,7 +12496,7 @@
12433
12496
  "name": "scheme",
12434
12497
  "type": "Symbol",
12435
12498
  "default": "`:default`",
12436
- "description": "One of `:danger`, `:default`, or `:invisible`."
12499
+ "description": "One of `:danger`, `:default`, `:invisible`, `:primary`, or `:secondary`."
12437
12500
  },
12438
12501
  {
12439
12502
  "name": "size",
@@ -12530,6 +12593,19 @@
12530
12593
  ]
12531
12594
  }
12532
12595
  },
12596
+ {
12597
+ "preview_path": "primer/beta/icon_button/primary",
12598
+ "name": "primary",
12599
+ "snapshot": "true",
12600
+ "skip_rules": {
12601
+ "wont_fix": [
12602
+ "region"
12603
+ ],
12604
+ "will_fix": [
12605
+ "color-contrast"
12606
+ ]
12607
+ }
12608
+ },
12533
12609
  {
12534
12610
  "preview_path": "primer/beta/icon_button/danger",
12535
12611
  "name": "danger",
data/static/previews.json CHANGED
@@ -3264,6 +3264,19 @@
3264
3264
  "color-contrast"
3265
3265
  ]
3266
3266
  }
3267
+ },
3268
+ {
3269
+ "preview_path": "primer/alpha/dialog/initally_open",
3270
+ "name": "initally_open",
3271
+ "snapshot": "interactive",
3272
+ "skip_rules": {
3273
+ "wont_fix": [
3274
+ "region"
3275
+ ],
3276
+ "will_fix": [
3277
+ "color-contrast"
3278
+ ]
3279
+ }
3267
3280
  }
3268
3281
  ]
3269
3282
  },
@@ -3969,6 +3982,19 @@
3969
3982
  ]
3970
3983
  }
3971
3984
  },
3985
+ {
3986
+ "preview_path": "primer/beta/icon_button/primary",
3987
+ "name": "primary",
3988
+ "snapshot": "true",
3989
+ "skip_rules": {
3990
+ "wont_fix": [
3991
+ "region"
3992
+ ],
3993
+ "will_fix": [
3994
+ "color-contrast"
3995
+ ]
3996
+ }
3997
+ },
3972
3998
  {
3973
3999
  "preview_path": "primer/beta/icon_button/danger",
3974
4000
  "name": "danger",
@@ -5096,6 +5122,19 @@
5096
5122
  "color-contrast"
5097
5123
  ]
5098
5124
  }
5125
+ },
5126
+ {
5127
+ "preview_path": "primer/alpha/overlay/overlay_with_header_filter",
5128
+ "name": "overlay_with_header_filter",
5129
+ "snapshot": "false",
5130
+ "skip_rules": {
5131
+ "wont_fix": [
5132
+ "region"
5133
+ ],
5134
+ "will_fix": [
5135
+ "color-contrast"
5136
+ ]
5137
+ }
5099
5138
  }
5100
5139
  ]
5101
5140
  },
@@ -7380,7 +7419,33 @@
7380
7419
  {
7381
7420
  "preview_path": "primer/alpha/underline_panels/default",
7382
7421
  "name": "default",
7383
- "snapshot": "false",
7422
+ "snapshot": "true",
7423
+ "skip_rules": {
7424
+ "wont_fix": [
7425
+ "region"
7426
+ ],
7427
+ "will_fix": [
7428
+ "color-contrast"
7429
+ ]
7430
+ }
7431
+ },
7432
+ {
7433
+ "preview_path": "primer/alpha/underline_panels/with_icons_and_counters",
7434
+ "name": "with_icons_and_counters",
7435
+ "snapshot": "true",
7436
+ "skip_rules": {
7437
+ "wont_fix": [
7438
+ "region"
7439
+ ],
7440
+ "will_fix": [
7441
+ "color-contrast"
7442
+ ]
7443
+ }
7444
+ },
7445
+ {
7446
+ "preview_path": "primer/alpha/underline_panels/with_actions",
7447
+ "name": "with_actions",
7448
+ "snapshot": "true",
7384
7449
  "skip_rules": {
7385
7450
  "wont_fix": [
7386
7451
  "region"
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.25.0
4
+ version: 0.26.0
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-03-26 00:00:00.000000000 Z
12
+ date: 2024-04-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionview
@@ -45,14 +45,14 @@ dependencies:
45
45
  requirements:
46
46
  - - ">="
47
47
  - !ruby/object:Gem::Version
48
- version: 19.8.0
48
+ version: 19.9.0
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - ">="
54
54
  - !ruby/object:Gem::Version
55
- version: 19.8.0
55
+ version: 19.9.0
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: view_component
58
58
  requirement: !ruby/object:Gem::Requirement
@@ -800,6 +800,7 @@ files:
800
800
  - previews/primer/alpha/overlay_preview/in_an_action_menu.html.erb
801
801
  - previews/primer/alpha/overlay_preview/middle_of_page.html.erb
802
802
  - previews/primer/alpha/overlay_preview/middle_of_page_with_relative_container.html.erb
803
+ - previews/primer/alpha/overlay_preview/overlay_with_header_filter.html.erb
803
804
  - previews/primer/alpha/radio_button_group_preview.rb
804
805
  - previews/primer/alpha/radio_button_preview.rb
805
806
  - previews/primer/alpha/segmented_control_preview.rb