openproject-primer_view_components 0.33.1 → 0.34.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- .breadcrumb-item{display:inline-block;list-style:none;margin-left:-.35em;white-space:nowrap}.breadcrumb-item:after{border-right:.1em solid var(--borderColor-neutral-emphasis);content:"";display:inline-block;height:.8em;margin:0 .5em;transform:rotate(15deg) translateY(.0625em)}.breadcrumb-item:first-child{margin-left:0}.breadcrumb-item-selected:after,.breadcrumb-item[aria-current]:not([aria-current=false]):after{content:none}.breadcrumb-item-selected a{color:var(--fgColor-default);cursor:default!important;-webkit-text-decoration:none!important;text-decoration:none!important}
1
+ .breadcrumb-item{display:inline-block;list-style:none;margin-left:-.35em}.breadcrumb-item:after{border-right:.1em solid var(--borderColor-neutral-emphasis);content:"";display:inline-block;height:.8em;margin:0 .5em;transform:rotate(15deg) translateY(.0625em)}.breadcrumb-item:first-child{margin-left:0}.breadcrumb-item-selected:after,.breadcrumb-item[aria-current]:not([aria-current=false]):after{content:none}.breadcrumb-item-selected a{color:var(--fgColor-default);cursor:default!important;-webkit-text-decoration:none!important;text-decoration:none!important}
@@ -1 +1 @@
1
- {"version":3,"sources":["breadcrumbs.pcss"],"names":[],"mappings":"AAAA,iBACE,oBAAqB,CAGrB,eAAgB,CAFhB,kBAAoB,CACpB,kBAeF,CAZE,uBAKE,2DAA6D,CAD7D,UAAW,CAHX,oBAAqB,CACrB,WAAa,CACb,aAAe,CAGf,2CACF,CAEA,6BACE,aACF,CAKA,+FACE,YACF,CAGF,4BACE,4BAA6B,CAC7B,wBAA0B,CAC1B,sCAAgC,CAAhC,8BACF","file":"breadcrumbs.css","sourcesContent":[".breadcrumb-item {\n display: inline-block;\n margin-left: -0.35em;\n white-space: nowrap;\n list-style: none;\n\n &::after {\n display: inline-block;\n height: 0.8em;\n margin: 0 0.5em;\n content: '';\n border-right: 0.1em solid var(--borderColor-neutral-emphasis);\n transform: rotate(15deg) translateY(0.0625em);\n }\n\n &:first-child {\n margin-left: 0;\n }\n}\n\n.breadcrumb-item-selected,\n.breadcrumb-item[aria-current]:not([aria-current='false']) {\n &::after {\n content: none;\n }\n}\n\n.breadcrumb-item-selected a {\n color: var(--fgColor-default);\n cursor: default !important;\n text-decoration: none !important;\n}\n"]}
1
+ {"version":3,"sources":["breadcrumbs.pcss"],"names":[],"mappings":"AAAA,iBACE,oBAAqB,CAErB,eAAgB,CADhB,kBAeF,CAZE,uBAKE,2DAA6D,CAD7D,UAAW,CAHX,oBAAqB,CACrB,WAAa,CACb,aAAe,CAGf,2CACF,CAEA,6BACE,aACF,CAKA,+FACE,YACF,CAGF,4BACE,4BAA6B,CAC7B,wBAA0B,CAC1B,sCAAgC,CAAhC,8BACF","file":"breadcrumbs.css","sourcesContent":[".breadcrumb-item {\n display: inline-block;\n margin-left: -0.35em;\n list-style: none;\n\n &::after {\n display: inline-block;\n height: 0.8em;\n margin: 0 0.5em;\n content: '';\n border-right: 0.1em solid var(--borderColor-neutral-emphasis);\n transform: rotate(15deg) translateY(0.0625em);\n }\n\n &:first-child {\n margin-left: 0;\n }\n}\n\n.breadcrumb-item-selected,\n.breadcrumb-item[aria-current]:not([aria-current='false']) {\n &::after {\n content: none;\n }\n}\n\n.breadcrumb-item-selected a {\n color: var(--fgColor-default);\n cursor: default !important;\n text-decoration: none !important;\n}\n"]}
@@ -1,7 +1,6 @@
1
1
  .breadcrumb-item {
2
2
  display: inline-block;
3
3
  margin-left: -0.35em;
4
- white-space: nowrap;
5
4
  list-style: none;
6
5
 
7
6
  &::after {
@@ -3,6 +3,9 @@
3
3
  <div class="PageHeader-contextBar">
4
4
  <%= @parent_link %>
5
5
  <%= breadcrumbs %>
6
+ <% if @mobile_segmented_control %>
7
+ <%= render(@mobile_segmented_control, &@mobile_segmented_control_block) %>
8
+ <% end %>
6
9
  <% if render_mobile_menu? %>
7
10
  <%= render(@mobile_action_menu) do |menu| %>
8
11
  <% menu.with_show_button(icon: :"kebab-horizontal", size: :small, "aria-label": @mobile_menu_label) %>
@@ -141,6 +141,21 @@ module Primer
141
141
  component.new(**system_arguments)
142
142
  },
143
143
  },
144
+ segmented_control: {
145
+ renders: lambda { |**system_arguments, &block|
146
+ deny_tag_argument(**system_arguments)
147
+
148
+ system_arguments = set_action_arguments(system_arguments, scheme: DEFAULT_ACTION_SCHEME)
149
+ mobile_args = system_arguments.delete(:mobile_system_arguments) || {}
150
+ @mobile_segmented_control = Primer::Alpha::SegmentedControl.new(**system_arguments,
151
+ **mobile_args,
152
+ mr: 2,
153
+ display: %i[flex none])
154
+ @mobile_segmented_control_block = block
155
+
156
+ Primer::Alpha::SegmentedControl.new(**system_arguments)
157
+ },
158
+ },
144
159
  }
145
160
 
146
161
  # Optional leading action prepend the title
@@ -252,7 +267,7 @@ module Primer
252
267
 
253
268
  def set_action_arguments(system_arguments, scheme: nil)
254
269
  system_arguments[:ml] ||= 2
255
- system_arguments[:display] = [:none, :flex]
270
+ system_arguments[:display] = %i[none flex]
256
271
  system_arguments[:size] = :medium
257
272
  system_arguments[:scheme] = scheme unless scheme.nil?
258
273
  system_arguments[:classes] = class_names(
@@ -5,8 +5,8 @@ module Primer
5
5
  module ViewComponents
6
6
  module VERSION
7
7
  MAJOR = 0
8
- MINOR = 33
9
- PATCH = 1
8
+ MINOR = 34
9
+ PATCH = 0
10
10
 
11
11
  STRING = [MAJOR, MINOR, PATCH].join(".")
12
12
  end
@@ -55,7 +55,7 @@ module Primer
55
55
  # @label Dismissable
56
56
  # @snapshot
57
57
  def dismissible
58
- render(Primer::Alpha::Banner.new(dismiss_scheme: :hide, reappear: true)) { "This is a dismissable banner." }
58
+ render(Primer::Alpha::Banner.new(dismiss_scheme: :hide)) { "This is a dismissable banner." }
59
59
  end
60
60
 
61
61
  # @!group Full Width
@@ -0,0 +1,15 @@
1
+ <% texts = [
2
+ "Breadcrumb Item 1",
3
+ "Breadcrumb Item 2 with a really long, long, long name",
4
+ "Breadcrumb Item 3 with an extremely long, long, long name"
5
+ ] %>
6
+
7
+ <%= render(Primer::Beta::Breadcrumbs.new) do |breadcrumbs| %>
8
+ <% texts.each_with_index do |text, i| %>
9
+ <% breadcrumbs.with_item(href: "##{i}") do %>
10
+ <%= render(Primer::Beta::Truncate.new) do |truncate| %>
11
+ <% truncate.with_item(max_width: 135) { text } %>
12
+ <% end %>
13
+ <% end %>
14
+ <% end %>
15
+ <% end %>
@@ -0,0 +1,14 @@
1
+ <%# erblint:counter DeprecatedComponentsCounter 1 %>
2
+ <% texts = [
3
+ "Breadcrumb Item 1",
4
+ "Breadcrumb Item 2 with a really long, long, long name",
5
+ "Breadcrumb Item 3 with an extremely long, long, long name"
6
+ ] %>
7
+
8
+ <%= render(Primer::Beta::Breadcrumbs.new) do |breadcrumbs| %>
9
+ <% texts.each_with_index do |text, i| %>
10
+ <% breadcrumbs.with_item(href: "##{i}") do %>
11
+ <%= render(Primer::Truncate.new(inline: true, max_width: 135)) { text } %>
12
+ <% end %>
13
+ <% end %>
14
+ <% end %>
@@ -26,6 +26,18 @@ module Primer
26
26
  end
27
27
  end
28
28
  end
29
+
30
+ # @label WithBetaTruncate
31
+ # @snapshot
32
+ def with_beta_truncate
33
+ render_with_template
34
+ end
35
+
36
+ # @label WithDeprecatedTruncate
37
+ # @snapshot
38
+ def with_deprecated_truncate
39
+ render_with_template
40
+ end
29
41
  end
30
42
  end
31
43
  end
@@ -40,7 +40,7 @@ module Primer
40
40
  with_leading_action: with_leading_action,
41
41
  with_actions: with_actions,
42
42
  breadcrumb_items: breadcrumb_items,
43
- with_tab_nav: with_tab_nav})
43
+ with_tab_nav: with_tab_nav })
44
44
  end
45
45
 
46
46
  # @label Large title
@@ -71,8 +71,8 @@ module Primer
71
71
  component.with_breadcrumbs([{ href: "/foo", text: "Foo" }, { href: "/bar", text: "Bar" }, "Baz"])
72
72
 
73
73
  component.with_action_button(mobile_icon: "star", mobile_label: "Star") do |button|
74
- button.with_leading_visual_icon(icon: "star")
75
- "Star"
74
+ button.with_leading_visual_icon(icon: "star")
75
+ "Star"
76
76
  end
77
77
  component.with_action_menu(menu_arguments: { anchor_align: :end },
78
78
  button_arguments: { button_block: callback }) do |menu|
@@ -123,7 +123,6 @@ module Primer
123
123
  end
124
124
  end
125
125
 
126
-
127
126
  # @label With a single action
128
127
  # The single action will not be transformed into a menu on mobile, but remains in a smaller variant
129
128
  def single_action
@@ -180,13 +179,62 @@ module Primer
180
179
  header.with_description { "Last updated 5 minutes ago by XYZ." }
181
180
  header.with_tab_nav(label: "label") do |nav|
182
181
  Array.new(3) do |i|
183
- nav.with_tab(selected: i.zero? , href: "#") do |tab|
182
+ nav.with_tab(selected: i.zero?, href: "#") do |tab|
184
183
  tab.with_text { "Tab #{i + 1}" }
185
184
  end
186
185
  end
187
186
  end
188
187
  end
189
188
  end
189
+
190
+ # @label With a SegmentedControl
191
+ def segmented_control
192
+ render(Primer::OpenProject::PageHeader.new) do |component|
193
+ component.with_title { "Here's a segmented control" }
194
+ component.with_breadcrumbs(["Baz"])
195
+
196
+ component.with_action_segmented_control("aria-label": "Segmented control") do |control|
197
+ control.with_item(label: "Preview", icon: :eye, selected: true)
198
+ control.with_item(label: "Raw", icon: :"file-code")
199
+ end
200
+
201
+ component.with_action_button(mobile_icon: "star", mobile_label: "Star") do |button|
202
+ button.with_leading_visual_icon(icon: "star")
203
+ "Star"
204
+ end
205
+
206
+ callback = lambda do |button|
207
+ button.with_leading_visual_icon(icon: :gear)
208
+ "Settings"
209
+ end
210
+
211
+ component.with_action_menu(menu_arguments: { anchor_align: :end },
212
+ button_arguments: { button_block: callback }) do |menu|
213
+ menu.with_item(label: "Subitem 1") do |item|
214
+ item.with_leading_visual_icon(icon: :paste)
215
+ end
216
+ menu.with_item(label: "Subitem 2") do |item|
217
+ item.with_leading_visual_icon(icon: :log)
218
+ end
219
+ end
220
+ end
221
+ end
222
+
223
+ # @label With mobile icons-only SegmentedControl
224
+ def segmented_control_mobile_icons
225
+ render(Primer::OpenProject::PageHeader.new) do |component|
226
+ component.with_title { "Here's a segmented control" }
227
+ component.with_breadcrumbs(["Baz"])
228
+
229
+ component.with_action_segmented_control(
230
+ "aria-label": "Segmented control",
231
+ mobile_system_arguments: { hide_labels: true }
232
+ ) do |control|
233
+ control.with_item(label: "Preview", icon: :eye, selected: true)
234
+ control.with_item(label: "Raw", icon: :"file-code")
235
+ end
236
+ end
237
+ end
190
238
  end
191
239
  end
192
240
  end
@@ -10921,6 +10921,32 @@
10921
10921
  "color-contrast"
10922
10922
  ]
10923
10923
  }
10924
+ },
10925
+ {
10926
+ "preview_path": "primer/beta/breadcrumbs/with_beta_truncate",
10927
+ "name": "with_beta_truncate",
10928
+ "snapshot": "true",
10929
+ "skip_rules": {
10930
+ "wont_fix": [
10931
+ "region"
10932
+ ],
10933
+ "will_fix": [
10934
+ "color-contrast"
10935
+ ]
10936
+ }
10937
+ },
10938
+ {
10939
+ "preview_path": "primer/beta/breadcrumbs/with_deprecated_truncate",
10940
+ "name": "with_deprecated_truncate",
10941
+ "snapshot": "true",
10942
+ "skip_rules": {
10943
+ "wont_fix": [
10944
+ "region"
10945
+ ],
10946
+ "will_fix": [
10947
+ "color-contrast"
10948
+ ]
10949
+ }
10924
10950
  }
10925
10951
  ],
10926
10952
  "subcomponents": [
@@ -16865,6 +16891,32 @@
16865
16891
  "color-contrast"
16866
16892
  ]
16867
16893
  }
16894
+ },
16895
+ {
16896
+ "preview_path": "primer/open_project/page_header/segmented_control",
16897
+ "name": "segmented_control",
16898
+ "snapshot": "false",
16899
+ "skip_rules": {
16900
+ "wont_fix": [
16901
+ "region"
16902
+ ],
16903
+ "will_fix": [
16904
+ "color-contrast"
16905
+ ]
16906
+ }
16907
+ },
16908
+ {
16909
+ "preview_path": "primer/open_project/page_header/segmented_control_mobile_icons",
16910
+ "name": "segmented_control_mobile_icons",
16911
+ "snapshot": "false",
16912
+ "skip_rules": {
16913
+ "wont_fix": [
16914
+ "region"
16915
+ ],
16916
+ "will_fix": [
16917
+ "color-contrast"
16918
+ ]
16919
+ }
16868
16920
  }
16869
16921
  ],
16870
16922
  "subcomponents": [
data/static/previews.json CHANGED
@@ -2058,6 +2058,32 @@
2058
2058
  "color-contrast"
2059
2059
  ]
2060
2060
  }
2061
+ },
2062
+ {
2063
+ "preview_path": "primer/beta/breadcrumbs/with_beta_truncate",
2064
+ "name": "with_beta_truncate",
2065
+ "snapshot": "true",
2066
+ "skip_rules": {
2067
+ "wont_fix": [
2068
+ "region"
2069
+ ],
2070
+ "will_fix": [
2071
+ "color-contrast"
2072
+ ]
2073
+ }
2074
+ },
2075
+ {
2076
+ "preview_path": "primer/beta/breadcrumbs/with_deprecated_truncate",
2077
+ "name": "with_deprecated_truncate",
2078
+ "snapshot": "true",
2079
+ "skip_rules": {
2080
+ "wont_fix": [
2081
+ "region"
2082
+ ],
2083
+ "will_fix": [
2084
+ "color-contrast"
2085
+ ]
2086
+ }
2061
2087
  }
2062
2088
  ]
2063
2089
  },
@@ -5403,6 +5429,32 @@
5403
5429
  "color-contrast"
5404
5430
  ]
5405
5431
  }
5432
+ },
5433
+ {
5434
+ "preview_path": "primer/open_project/page_header/segmented_control",
5435
+ "name": "segmented_control",
5436
+ "snapshot": "false",
5437
+ "skip_rules": {
5438
+ "wont_fix": [
5439
+ "region"
5440
+ ],
5441
+ "will_fix": [
5442
+ "color-contrast"
5443
+ ]
5444
+ }
5445
+ },
5446
+ {
5447
+ "preview_path": "primer/open_project/page_header/segmented_control_mobile_icons",
5448
+ "name": "segmented_control_mobile_icons",
5449
+ "snapshot": "false",
5450
+ "skip_rules": {
5451
+ "wont_fix": [
5452
+ "region"
5453
+ ],
5454
+ "will_fix": [
5455
+ "color-contrast"
5456
+ ]
5457
+ }
5406
5458
  }
5407
5459
  ]
5408
5460
  },
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.33.1
4
+ version: 0.34.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-06-05 00:00:00.000000000 Z
12
+ date: 2024-06-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionview
@@ -867,6 +867,8 @@ files:
867
867
  - previews/primer/beta/blankslate_preview/inside_flex_container.html.erb
868
868
  - previews/primer/beta/border_box_preview.rb
869
869
  - previews/primer/beta/breadcrumbs_preview.rb
870
+ - previews/primer/beta/breadcrumbs_preview/with_beta_truncate.html.erb
871
+ - previews/primer/beta/breadcrumbs_preview/with_deprecated_truncate.html.erb
870
872
  - previews/primer/beta/button_group_preview.rb
871
873
  - previews/primer/beta/button_group_preview/with_menu_button.html.erb
872
874
  - previews/primer/beta/button_preview.rb