openproject-primer_view_components 0.13.0 → 0.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +22 -0
  3. data/app/assets/javascripts/app/components/primer/primer.d.ts +0 -1
  4. data/app/assets/javascripts/primer_view_components.js +1 -1
  5. data/app/assets/javascripts/primer_view_components.js.map +1 -1
  6. data/app/assets/styles/primer_view_components.css +1 -1
  7. data/app/assets/styles/primer_view_components.css.map +1 -1
  8. data/app/components/primer/alpha/action_bar_element.js +2 -0
  9. data/app/components/primer/alpha/action_bar_element.ts +2 -0
  10. data/app/components/primer/alpha/action_menu/action_menu_element.js +20 -3
  11. data/app/components/primer/alpha/action_menu/action_menu_element.ts +27 -1
  12. data/app/components/primer/alpha/overlay.css +1 -1
  13. data/app/components/primer/alpha/overlay.css.json +0 -1
  14. data/app/components/primer/alpha/overlay.css.map +1 -1
  15. data/app/components/primer/alpha/overlay.pcss +0 -12
  16. data/app/components/primer/alpha/tool_tip.js +76 -3
  17. data/app/components/primer/alpha/tool_tip.ts +76 -3
  18. data/app/components/primer/open_project/page_header.css +1 -1
  19. data/app/components/primer/open_project/page_header.css.json +4 -1
  20. data/app/components/primer/open_project/page_header.css.map +1 -1
  21. data/app/components/primer/open_project/page_header.html.erb +6 -2
  22. data/app/components/primer/open_project/page_header.pcss +19 -6
  23. data/app/components/primer/open_project/page_header.rb +70 -0
  24. data/app/components/primer/primer.d.ts +0 -1
  25. data/app/components/primer/primer.js +0 -1
  26. data/app/components/primer/primer.pcss +0 -2
  27. data/app/components/primer/primer.ts +0 -1
  28. data/lib/primer/accessibility.rb +1 -3
  29. data/lib/primer/static/generate_info_arch.rb +6 -1
  30. data/lib/primer/view_components/version.rb +1 -1
  31. data/previews/primer/alpha/check_box_preview.rb +0 -3
  32. data/previews/primer/alpha/dialog_preview/with_text_input.html.erb +2 -1
  33. data/previews/primer/alpha/radio_button_preview.rb +0 -3
  34. data/previews/primer/open_project/page_header_preview.rb +39 -1
  35. data/static/classes.json +9 -0
  36. data/static/constants.json +12 -0
  37. data/static/info_arch.json +243 -8
  38. data/static/previews.json +198 -0
  39. metadata +2 -2
@@ -7,7 +7,6 @@ module Primer
7
7
  # @label Playground
8
8
  #
9
9
  # @param name text
10
- # @param id text
11
10
  # @param value text
12
11
  # @param label text
13
12
  # @param caption text
@@ -15,7 +14,6 @@ module Primer
15
14
  # @param disabled toggle
16
15
  def playground(
17
16
  name: "my-check-box",
18
- id: nil,
19
17
  value: "picard",
20
18
  label: "Jean-Luc Picard",
21
19
  caption: "Make it so",
@@ -24,7 +22,6 @@ module Primer
24
22
  )
25
23
  system_arguments = {
26
24
  name: name,
27
- id: id,
28
25
  value: value,
29
26
  label: label,
30
27
  caption: caption,
@@ -4,7 +4,8 @@
4
4
  <p>Dialog One!</p>
5
5
 
6
6
  <form>
7
- <input type="text" value="Some text goes in here">
7
+ <label for="dialog-text-input-example">Example input</label>
8
+ <input id="dialog-text-input-example" type="text" value="Some text goes in here">
8
9
  </form>
9
10
  <% end %>
10
11
  <% end %>
@@ -7,7 +7,6 @@ module Primer
7
7
  # @label Playground
8
8
  #
9
9
  # @param name text
10
- # @param id text
11
10
  # @param value text
12
11
  # @param label text
13
12
  # @param caption text
@@ -15,7 +14,6 @@ module Primer
15
14
  # @param disabled toggle
16
15
  def playground(
17
16
  name: "my-radio-button",
18
- id: nil,
19
17
  value: "bsg",
20
18
  label: "Battlestar Galactica",
21
19
  caption: "A pretty good show",
@@ -24,7 +22,6 @@ module Primer
24
22
  )
25
23
  system_arguments = {
26
24
  name: name,
27
- id: id,
28
25
  value: value,
29
26
  label: label,
30
27
  caption: caption,
@@ -18,10 +18,24 @@ module Primer
18
18
  # @param variant [Symbol] select [medium, large]
19
19
  # @param title [String] text
20
20
  # @param description [String] text
21
- def playground(variant: :medium, title: "Hello", description: "Last updated 5 minutes ago by XYZ.")
21
+ # @param with_back_button [Boolean]
22
+ # @param back_button_size [Symbol] select [small, medium, large]
23
+ # @param with_breadcrumbs [Boolean]
24
+ def playground(
25
+ variant: :medium,
26
+ title: "Hello",
27
+ description: "Last updated 5 minutes ago by XYZ.",
28
+ with_back_button: false,
29
+ back_button_size: :medium,
30
+ with_breadcrumbs: false
31
+ )
32
+ breadcrumb_items = [{ href: "/foo", text: "Foo" }, { href: "/bar", text: "Bar" }, "Baz"]
33
+
22
34
  render(Primer::OpenProject::PageHeader.new) do |header|
23
35
  header.with_title(variant: variant) { title }
24
36
  header.with_description { description }
37
+ header.with_back_button(href: "#", size: back_button_size, 'aria-label': "Back") if with_back_button
38
+ header.with_breadcrumbs(breadcrumb_items) if with_breadcrumbs
25
39
  end
26
40
  end
27
41
 
@@ -37,6 +51,30 @@ module Primer
37
51
  def actions
38
52
  render_with_template(locals: {})
39
53
  end
54
+
55
+ # @label With back button
56
+ # @param href [String] text
57
+ # @param size [Symbol] select [small, medium, large]
58
+ # @param icon [String] select ["arrow-left", "chevron-left", "triangle-left"]
59
+ def back_button(href: "#", size: :medium, icon: "arrow-left")
60
+ render(Primer::OpenProject::PageHeader.new) do |header|
61
+ header.with_title { "Hello" }
62
+ header.with_back_button(href: href, size: size, icon: icon, 'aria-label': "Back")
63
+ end
64
+ end
65
+
66
+ # @label With breadcrumbs
67
+ def breadcrumbs
68
+ breadcrumb_items = [
69
+ { href: "/foo", text: "Foo" },
70
+ "\u003ca href=\"/foo/bar\"\u003eBar\u003c/a\u003e",
71
+ "Baz"
72
+ ]
73
+ render(Primer::OpenProject::PageHeader.new) do |header|
74
+ header.with_title { "A title" }
75
+ header.with_breadcrumbs(breadcrumb_items)
76
+ end
77
+ end
40
78
  end
41
79
  end
42
80
  end
data/static/classes.json CHANGED
@@ -435,6 +435,12 @@
435
435
  "PageHeader-actions": [
436
436
  "Primer::OpenProject::PageHeader"
437
437
  ],
438
+ "PageHeader-backButton": [
439
+ "Primer::OpenProject::PageHeader"
440
+ ],
441
+ "PageHeader-breadcrumbs": [
442
+ "Primer::OpenProject::PageHeader"
443
+ ],
438
444
  "PageHeader-description": [
439
445
  "Primer::OpenProject::PageHeader"
440
446
  ],
@@ -444,6 +450,9 @@
444
450
  "PageHeader-title--large": [
445
451
  "Primer::OpenProject::PageHeader"
446
452
  ],
453
+ "PageHeader-titleBar": [
454
+ "Primer::OpenProject::PageHeader"
455
+ ],
447
456
  "Popover": [
448
457
  "Primer::Beta::Popover"
449
458
  ],
@@ -1360,6 +1360,18 @@
1360
1360
  ]
1361
1361
  },
1362
1362
  "Primer::OpenProject::PageHeader": {
1363
+ "BACK_BUTTON_ICON_OPTIONS": [
1364
+ "arrow-left",
1365
+ "chevron-left",
1366
+ "triangle-left"
1367
+ ],
1368
+ "BACK_BUTTON_SIZE_OPTIONS": [
1369
+ "small",
1370
+ "medium",
1371
+ "large"
1372
+ ],
1373
+ "DEFAULT_BACK_BUTTON_ICON": "arrow-left",
1374
+ "DEFAULT_BACK_BUTTON_SIZE": "medium",
1363
1375
  "DEFAULT_HEADER_VARIANT": "medium",
1364
1376
  "HEADER_VARIANT_OPTIONS": [
1365
1377
  "large",
@@ -2589,7 +2589,84 @@
2589
2589
 
2590
2590
  ],
2591
2591
  "previews": [
2592
-
2592
+ {
2593
+ "preview_path": "primer/alpha/check_box/playground",
2594
+ "name": "playground",
2595
+ "snapshot": "false",
2596
+ "skip_rules": {
2597
+ "wont_fix": [
2598
+ "region"
2599
+ ],
2600
+ "will_fix": [
2601
+ "color-contrast"
2602
+ ]
2603
+ }
2604
+ },
2605
+ {
2606
+ "preview_path": "primer/alpha/check_box/default",
2607
+ "name": "default",
2608
+ "snapshot": "false",
2609
+ "skip_rules": {
2610
+ "wont_fix": [
2611
+ "region"
2612
+ ],
2613
+ "will_fix": [
2614
+ "color-contrast"
2615
+ ]
2616
+ }
2617
+ },
2618
+ {
2619
+ "preview_path": "primer/alpha/check_box/with_caption",
2620
+ "name": "with_caption",
2621
+ "snapshot": "true",
2622
+ "skip_rules": {
2623
+ "wont_fix": [
2624
+ "region"
2625
+ ],
2626
+ "will_fix": [
2627
+ "color-contrast"
2628
+ ]
2629
+ }
2630
+ },
2631
+ {
2632
+ "preview_path": "primer/alpha/check_box/checked",
2633
+ "name": "checked",
2634
+ "snapshot": "false",
2635
+ "skip_rules": {
2636
+ "wont_fix": [
2637
+ "region"
2638
+ ],
2639
+ "will_fix": [
2640
+ "color-contrast"
2641
+ ]
2642
+ }
2643
+ },
2644
+ {
2645
+ "preview_path": "primer/alpha/check_box/visually_hide_label",
2646
+ "name": "visually_hide_label",
2647
+ "snapshot": "false",
2648
+ "skip_rules": {
2649
+ "wont_fix": [
2650
+ "region"
2651
+ ],
2652
+ "will_fix": [
2653
+ "color-contrast"
2654
+ ]
2655
+ }
2656
+ },
2657
+ {
2658
+ "preview_path": "primer/alpha/check_box/disabled",
2659
+ "name": "disabled",
2660
+ "snapshot": "false",
2661
+ "skip_rules": {
2662
+ "wont_fix": [
2663
+ "region"
2664
+ ],
2665
+ "will_fix": [
2666
+ "color-contrast"
2667
+ ]
2668
+ }
2669
+ }
2593
2670
  ],
2594
2671
  "subcomponents": [
2595
2672
 
@@ -5937,7 +6014,84 @@
5937
6014
 
5938
6015
  ],
5939
6016
  "previews": [
5940
-
6017
+ {
6018
+ "preview_path": "primer/alpha/radio_button/playground",
6019
+ "name": "playground",
6020
+ "snapshot": "false",
6021
+ "skip_rules": {
6022
+ "wont_fix": [
6023
+ "region"
6024
+ ],
6025
+ "will_fix": [
6026
+ "color-contrast"
6027
+ ]
6028
+ }
6029
+ },
6030
+ {
6031
+ "preview_path": "primer/alpha/radio_button/default",
6032
+ "name": "default",
6033
+ "snapshot": "true",
6034
+ "skip_rules": {
6035
+ "wont_fix": [
6036
+ "region"
6037
+ ],
6038
+ "will_fix": [
6039
+ "color-contrast"
6040
+ ]
6041
+ }
6042
+ },
6043
+ {
6044
+ "preview_path": "primer/alpha/radio_button/with_caption",
6045
+ "name": "with_caption",
6046
+ "snapshot": "true",
6047
+ "skip_rules": {
6048
+ "wont_fix": [
6049
+ "region"
6050
+ ],
6051
+ "will_fix": [
6052
+ "color-contrast"
6053
+ ]
6054
+ }
6055
+ },
6056
+ {
6057
+ "preview_path": "primer/alpha/radio_button/checked",
6058
+ "name": "checked",
6059
+ "snapshot": "true",
6060
+ "skip_rules": {
6061
+ "wont_fix": [
6062
+ "region"
6063
+ ],
6064
+ "will_fix": [
6065
+ "color-contrast"
6066
+ ]
6067
+ }
6068
+ },
6069
+ {
6070
+ "preview_path": "primer/alpha/radio_button/visually_hide_label",
6071
+ "name": "visually_hide_label",
6072
+ "snapshot": "true",
6073
+ "skip_rules": {
6074
+ "wont_fix": [
6075
+ "region"
6076
+ ],
6077
+ "will_fix": [
6078
+ "color-contrast"
6079
+ ]
6080
+ }
6081
+ },
6082
+ {
6083
+ "preview_path": "primer/alpha/radio_button/disabled",
6084
+ "name": "disabled",
6085
+ "snapshot": "true",
6086
+ "skip_rules": {
6087
+ "wont_fix": [
6088
+ "region"
6089
+ ],
6090
+ "will_fix": [
6091
+ "color-contrast"
6092
+ ]
6093
+ }
6094
+ }
5941
6095
  ],
5942
6096
  "subcomponents": [
5943
6097
 
@@ -6908,7 +7062,7 @@
6908
7062
  {
6909
7063
  "fully_qualified_name": "Primer::Alpha::TabNav",
6910
7064
  "description": "Use `TabNav` to style navigation with a tab-based selected state, typically used for navigation placed at the top of the page.\nFor panel navigation, use {{#link_to_component}}Primer::Alpha::TabPanels{{/link_to_component}} instead.",
6911
- "accessibility_docs": "- By default, `TabNav` renders links within a `<nav>` element. `<nav>` has an\n implicit landmark role of `navigation` which should be reserved for main links.\n For all other set of links, set tag to `:div`.\n- See <%= link_to_component(Primer::Alpha::Navigation::Tab) %> for additional\n accessibility considerations.",
7065
+ "accessibility_docs": "- By default, `TabNav` renders links within a `<nav>` element. `<nav>` has an\n implicit landmark role of `navigation` which should be reserved for main links.\n For all other set of links, set tag to `:div`.\n- See {{#link_to_component}}Primer::Alpha::Navigation::Tab{{/link_to_component}} for additional\n accessibility considerations.",
6912
7066
  "is_form_component": false,
6913
7067
  "is_published": true,
6914
7068
  "requires_js": false,
@@ -8307,7 +8461,7 @@
8307
8461
  {
8308
8462
  "fully_qualified_name": "Primer::Alpha::UnderlineNav",
8309
8463
  "description": "Use `UnderlineNav` to style navigation links with a minimal\nunderlined selected state, typically placed at the top\nof the page.\n\nFor panel navigation, use {{#link_to_component}}Primer::Alpha::UnderlinePanels{{/link_to_component}} instead.",
8310
- "accessibility_docs": "- By default, `UnderlineNav` renders links within a `<nav>` element. `<nav>` has an\n implicit landmark role of `navigation` which should be reserved for main links.\n For all other set of links, set tag to `:div`.\n- See <%= link_to_component(Primer::Alpha::Navigation::Tab) %> for additional\n accessibility considerations.",
8464
+ "accessibility_docs": "- By default, `UnderlineNav` renders links within a `<nav>` element. `<nav>` has an\n implicit landmark role of `navigation` which should be reserved for main links.\n For all other set of links, set tag to `:div`.\n- See {{#link_to_component}}Primer::Alpha::Navigation::Tab{{/link_to_component}} for additional\n accessibility considerations.",
8311
8465
  "is_form_component": false,
8312
8466
  "is_published": true,
8313
8467
  "requires_js": false,
@@ -10035,7 +10189,7 @@
10035
10189
  {
10036
10190
  "fully_qualified_name": "Primer::Beta::BorderBox::Header",
10037
10191
  "description": "`BorderBox::Header` is used inside `BorderBox` to render its header slot.",
10038
- "accessibility_docs": "When using `header.with_title`, set `tag` to one of `h1`, `h2`, `h3`, etc. based on what is appropriate for the page context. <%= link_to_heading_practices %>",
10192
+ "accessibility_docs": "When using `header.with_title`, set `tag` to one of `h1`, `h2`, `h3`, etc. based on what is appropriate for the page context. [Learn more about best heading practices (WAI Headings)](https://www.w3.org/WAI/tutorials/page-structure/headings/)",
10039
10193
  "is_form_component": false,
10040
10194
  "is_published": true,
10041
10195
  "requires_js": false,
@@ -11435,7 +11589,7 @@
11435
11589
  {
11436
11590
  "fully_qualified_name": "Primer::Beta::Heading",
11437
11591
  "description": "`Heading` should be used to communicate page organization and hierarchy.\n\n- Set tag to one of `:h1`, `:h2`, `:h3`, `:h4`, `:h5`, `:h6` based on what is appropriate for the page context.\n- Use `Heading` as the title of a section or sub section.\n- Do not use `Heading` for styling alone. For simply styling text, consider using {{#link_to_component}}Primer::Beta::Text{{/link_to_component}} with relevant {{link_to_typography_docs}}\n such as `font_size` and `font_weight`.\n- Do not jump heading levels. For instance, do not follow a `<h1>` with an `<h3>`. Heading levels should increase by one in ascending order.",
11438
- "accessibility_docs": "While sighted users rely on visual cues such as font size changes to determine what the heading is, assistive technology users rely on programatic cues that can be read out.\nWhen text on a page is visually implied to be a heading, ensure that it is coded as a heading. Additionally, visually implied heading level and coded heading level should be\nconsistent. [See WCAG success criteria: 1.3.1: Info and Relationships](https://www.w3.org/WAI/WCAG21/Understanding/info-and-relationships.html)\n\nHeadings allow assistive technology users to quickly navigate around a page. Navigation to text that is not meant to be a heading can be a confusing experience.\n<%= link_to_heading_practices %>",
11592
+ "accessibility_docs": "While sighted users rely on visual cues such as font size changes to determine what the heading is, assistive technology users rely on programatic cues that can be read out.\nWhen text on a page is visually implied to be a heading, ensure that it is coded as a heading. Additionally, visually implied heading level and coded heading level should be\nconsistent. [See WCAG success criteria: 1.3.1: Info and Relationships](https://www.w3.org/WAI/WCAG21/Understanding/info-and-relationships.html)\n\nHeadings allow assistive technology users to quickly navigate around a page. Navigation to text that is not meant to be a heading can be a confusing experience.\n[Learn more about best heading practices (WAI Headings)](https://www.w3.org/WAI/tutorials/page-structure/headings/)",
11439
11593
  "is_form_component": false,
11440
11594
  "is_published": true,
11441
11595
  "requires_js": false,
@@ -13597,7 +13751,7 @@
13597
13751
  {
13598
13752
  "fully_qualified_name": "Primer::Beta::Subhead",
13599
13753
  "description": "Use `Subhead` as the start of a section. The `:heading` slot will render an `<h2>` font-sized text.\n\n- Optionally set the `:description` slot to render a short description and the `:actions` slot for a related action.\n- Use a succinct, one-line description for the `:description` slot. For longer descriptions, omit the description slot and render a paragraph below the `Subhead`.\n- Use the actions slot to render a related action to the right of the heading. Use {{#link_to_component}}Primer::ButtonComponent{{/link_to_component}} or {{#link_to_component}}Primer::Beta::Link{{/link_to_component}}.",
13600
- "accessibility_docs": "The `:heading` slot defaults to rendering a `<div>`. Update the tag to a heading element with the appropriate level to improve page navigation for assistive technologies.\n<%= link_to_heading_practices %>",
13754
+ "accessibility_docs": "The `:heading` slot defaults to rendering a `<div>`. Update the tag to a heading element with the appropriate level to improve page navigation for assistive technologies.\n[Learn more about best heading practices (WAI Headings)](https://www.w3.org/WAI/tutorials/page-structure/headings/)",
13601
13755
  "is_form_component": false,
13602
13756
  "is_published": true,
13603
13757
  "requires_js": false,
@@ -14134,7 +14288,7 @@
14134
14288
  {
14135
14289
  "fully_qualified_name": "Primer::BlankslateComponent",
14136
14290
  "description": "Use `Blankslate` when there is a lack of content within a page or section. Use as placeholder to tell users why something isn't there.",
14137
- "accessibility_docs": "`Blankslate` renders an `<h3>` element for the title by default. Update the heading level based on what is appropriate for your page hierarchy by setting `title_tag`.\n<%= link_to_heading_practices %>",
14291
+ "accessibility_docs": "`Blankslate` renders an `<h3>` element for the title by default. Update the heading level based on what is appropriate for your page hierarchy by setting `title_tag`.\n[Learn more about best heading practices (WAI Headings)](https://www.w3.org/WAI/tutorials/page-structure/headings/)",
14138
14292
  "is_form_component": false,
14139
14293
  "is_published": true,
14140
14294
  "requires_js": false,
@@ -15318,10 +15472,65 @@
15318
15472
  "description": "{{link_to_system_arguments_docs}}"
15319
15473
  }
15320
15474
  ]
15475
+ },
15476
+ {
15477
+ "name": "back_button",
15478
+ "description": "Optional back button prepend the title",
15479
+ "parameters": [
15480
+ {
15481
+ "name": "size",
15482
+ "type": "Symbol",
15483
+ "default": "N/A",
15484
+ "description": "One of `:large`, `:medium`, or `:small`."
15485
+ },
15486
+ {
15487
+ "name": "icon",
15488
+ "type": "String",
15489
+ "default": "N/A",
15490
+ "description": "One of `arrow-left`, `chevron-left`, or `triangle-left`."
15491
+ },
15492
+ {
15493
+ "name": "system_arguments",
15494
+ "type": "Hash",
15495
+ "default": "N/A",
15496
+ "description": "{{link_to_system_arguments_docs}}"
15497
+ }
15498
+ ]
15499
+ },
15500
+ {
15501
+ "name": "breadcrumbs",
15502
+ "description": "Optional breadcrumbs above the title row",
15503
+ "parameters": [
15504
+ {
15505
+ "name": "items",
15506
+ "type": "Array<String, Hash>",
15507
+ "default": "N/A",
15508
+ "description": "Items is an array of strings, hash {href, text} or an anchor tag string"
15509
+ },
15510
+ {
15511
+ "name": "system_arguments",
15512
+ "type": "Hash",
15513
+ "default": "N/A",
15514
+ "description": "{{link_to_system_arguments_docs}}"
15515
+ }
15516
+ ]
15321
15517
  }
15322
15518
  ],
15323
15519
  "methods": [
15520
+ {
15521
+ "name": "anchor_string_to_object",
15522
+ "description": "transform anchor tag strings to {href, text} objects\ne.g \"\\u003ca href=\\\"/admin\\\"\\u003eAdministration\\u003c/a\\u003e\"",
15523
+ "parameters": [
15524
+
15525
+ ]
15526
+ },
15527
+ {
15528
+ "name": "anchor_tag_string?",
15529
+ "description": "Check if the item is an anchor tag string e.g \"\\u003ca href=\\\"/admin\\\"\\u003eAdministration\\u003c/a\\u003e\"",
15530
+ "parameters": [
15324
15531
 
15532
+ ]
15533
+ }
15325
15534
  ],
15326
15535
  "previews": [
15327
15536
  {
@@ -15375,6 +15584,32 @@
15375
15584
  "color-contrast"
15376
15585
  ]
15377
15586
  }
15587
+ },
15588
+ {
15589
+ "preview_path": "primer/open_project/page_header/back_button",
15590
+ "name": "back_button",
15591
+ "snapshot": "false",
15592
+ "skip_rules": {
15593
+ "wont_fix": [
15594
+ "region"
15595
+ ],
15596
+ "will_fix": [
15597
+ "color-contrast"
15598
+ ]
15599
+ }
15600
+ },
15601
+ {
15602
+ "preview_path": "primer/open_project/page_header/breadcrumbs",
15603
+ "name": "breadcrumbs",
15604
+ "snapshot": "false",
15605
+ "skip_rules": {
15606
+ "wont_fix": [
15607
+ "region"
15608
+ ],
15609
+ "will_fix": [
15610
+ "color-contrast"
15611
+ ]
15612
+ }
15378
15613
  }
15379
15614
  ],
15380
15615
  "subcomponents": [