openproject-primer_view_components 0.8.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1 @@
1
+ .PageHeader{border-bottom:var(--borderWidth-thin,max(1px,.0625rem)) solid var(--borderColor-muted,var(--color-border-muted));display:flex;flex-flow:row wrap;justify-content:flex-end;margin-bottom:var(--stack-gap-normal,1rem);padding-bottom:var(--stack-padding-condensed,.5rem)}.PageHeader-title{flex:1 1 auto;font-size:24px;font-weight:var(--base-text-weight-normal,400);order:0}.PageHeader-title--large{font-size:var(--text-title-size-large,2rem)}.PageHeader-description{color:var(--fgColor-muted,var(--color-fg-muted));flex:1 100%;font-size:var(--text-body-size-medium,.875rem);order:2}.PageHeader-actions{align-self:center;justify-content:flex-end;margin:var(--base-size-4,.25rem) 0 var(--base-size-4,.25rem) var(--base-size-4,.25rem);order:1}.PageHeader-actions+.PageHeader-description{margin-top:var(--base-size-4,.25rem)}
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "open_project/page_header",
3
+ "selectors": [
4
+ ".PageHeader",
5
+ ".PageHeader-title",
6
+ ".PageHeader-title--large",
7
+ ".PageHeader-description",
8
+ ".PageHeader-actions",
9
+ ".PageHeader-actions+.PageHeader-description"
10
+ ]
11
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["page_header.pcss"],"names":[],"mappings":"AAEA,YAIE,gHAAqE,CAHrE,YAAa,CAIb,kBAAmB,CACnB,wBAAyB,CAHzB,0CAAsC,CADtC,mDAKF,CAEA,kBAGE,aAAc,CAFd,cAAe,CACf,8CAA2C,CAE3C,OACF,CAEA,yBACE,2CACF,CAGA,wBAEE,gDAA2B,CAC3B,WAAY,CAFZ,8CAAuC,CAGvC,OACF,CAGA,oBAEE,iBAAkB,CAClB,wBAAyB,CAFzB,sFAAkE,CAGlE,OAKF,CAHE,4CACE,oCACF","file":"page_header.css","sourcesContent":["/* OP PageHeader */\n\n.PageHeader {\n display: flex;\n padding-bottom: var(--stack-padding-condensed);\n margin-bottom: var(--stack-gap-normal);\n border-bottom: var(--borderWidth-thin) solid var(--borderColor-muted);\n flex-flow: row wrap;\n justify-content: flex-end; /* Keep actions right aligned. */\n}\n\n.PageHeader-title {\n font-size: 24px;\n font-weight: var(--base-text-weight-normal);\n flex: 1 1 auto;\n order: 0;\n}\n\n.PageHeader-title--large {\n font-size: var(--text-title-size-large);\n}\n\n/* One-liner of supporting text */\n.PageHeader-description {\n font-size: var(--text-body-size-medium);\n color: var(--fgColor-muted);\n flex: 1 100%;\n order: 2;\n}\n\n/* Add 1 or 2 buttons to the right of the heading */\n.PageHeader-actions {\n margin: var(--base-size-4) 0 var(--base-size-4) var(--base-size-4);\n align-self: center;\n justify-content: flex-end;\n order: 1;\n\n & + .PageHeader-description {\n margin-top: var(--base-size-4);\n }\n}\n"]}
@@ -0,0 +1,5 @@
1
+ <%= render Primer::BaseComponent.new(**@system_arguments) do %>
2
+ <%= title %>
3
+ <%= description %>
4
+ <%= actions %>
5
+ <% end %>
@@ -0,0 +1,41 @@
1
+ /* OP PageHeader */
2
+
3
+ .PageHeader {
4
+ display: flex;
5
+ padding-bottom: var(--stack-padding-condensed);
6
+ margin-bottom: var(--stack-gap-normal);
7
+ border-bottom: var(--borderWidth-thin) solid var(--borderColor-muted);
8
+ flex-flow: row wrap;
9
+ justify-content: flex-end; /* Keep actions right aligned. */
10
+ }
11
+
12
+ .PageHeader-title {
13
+ font-size: 24px;
14
+ font-weight: var(--base-text-weight-normal);
15
+ flex: 1 1 auto;
16
+ order: 0;
17
+ }
18
+
19
+ .PageHeader-title--large {
20
+ font-size: var(--text-title-size-large);
21
+ }
22
+
23
+ /* One-liner of supporting text */
24
+ .PageHeader-description {
25
+ font-size: var(--text-body-size-medium);
26
+ color: var(--fgColor-muted);
27
+ flex: 1 100%;
28
+ order: 2;
29
+ }
30
+
31
+ /* Add 1 or 2 buttons to the right of the heading */
32
+ .PageHeader-actions {
33
+ margin: var(--base-size-4) 0 var(--base-size-4) var(--base-size-4);
34
+ align-self: center;
35
+ justify-content: flex-end;
36
+ order: 1;
37
+
38
+ & + .PageHeader-description {
39
+ margin-top: var(--base-size-4);
40
+ }
41
+ }
@@ -0,0 +1,69 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Primer
4
+ module OpenProject
5
+ # A ViewComponent PageHeader inspired by the primer react variant
6
+ class PageHeader < Primer::Component
7
+ HEADING_TAG_OPTIONS = [:h1, :h2, :h3, :h4, :h5, :h6].freeze
8
+ HEADING_TAG_FALLBACK = :h2
9
+
10
+ DEFAULT_HEADER_VARIANT = :medium
11
+ HEADER_VARIANT_OPTIONS = [
12
+ :large,
13
+ DEFAULT_HEADER_VARIANT
14
+ ].freeze
15
+
16
+ status :open_project
17
+
18
+ # The title of the page header
19
+ #
20
+ # @param tag [Symbol] <%= one_of(Primer::Beta::Heading::TAG_OPTIONS) %>
21
+ # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
22
+ renders_one :title, lambda { |tag: HEADING_TAG_FALLBACK, variant: DEFAULT_HEADER_VARIANT, **system_arguments|
23
+ system_arguments[:tag] = fetch_or_fallback(HEADING_TAG_OPTIONS, tag, HEADING_TAG_FALLBACK)
24
+ system_arguments[:classes] = class_names(
25
+ system_arguments[:classes],
26
+ "PageHeader-title",
27
+ "PageHeader-title--#{variant}"
28
+ )
29
+
30
+ Primer::BaseComponent.new(**system_arguments)
31
+ }
32
+
33
+ # Optional description below the title row
34
+ renders_one :description, lambda { |**system_arguments|
35
+ deny_tag_argument(**system_arguments)
36
+ system_arguments[:tag] = :div
37
+ system_arguments[:classes] = class_names(system_arguments[:classes], "PageHeader-description")
38
+
39
+ Primer::BaseComponent.new(**system_arguments)
40
+ }
41
+
42
+ # Actions
43
+ #
44
+ # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
45
+ renders_one :actions, lambda { |**system_arguments|
46
+ deny_tag_argument(**system_arguments)
47
+ system_arguments[:tag] = :div
48
+ system_arguments[:classes] = class_names(system_arguments[:classes], "PageHeader-actions")
49
+
50
+ Primer::BaseComponent.new(**system_arguments)
51
+ }
52
+
53
+ def initialize(**system_arguments)
54
+ @system_arguments = deny_tag_argument(**system_arguments)
55
+
56
+ @system_arguments[:tag] = :header
57
+ @system_arguments[:classes] =
58
+ class_names(
59
+ @system_arguments[:classes],
60
+ "PageHeader"
61
+ )
62
+ end
63
+
64
+ def render?
65
+ title?
66
+ end
67
+ end
68
+ end
69
+ end
@@ -40,3 +40,6 @@
40
40
  @import "./beta/timeline_item.pcss";
41
41
  @import "./truncate.pcss";
42
42
  @import "./alpha/action_bar.pcss";
43
+
44
+ /* OP specifics */
45
+ @import "./open_project/page_header.pcss";
@@ -21,7 +21,8 @@ module Primer
21
21
  beta: :beta,
22
22
  stable: :stable,
23
23
  deprecated: :deprecated,
24
- experimental: :experimental
24
+ experimental: :experimental,
25
+ open_project: :open_project
25
26
  }.freeze
26
27
 
27
28
  class UnknownStatusError < StandardError; end
@@ -5,8 +5,8 @@ module Primer
5
5
  module ViewComponents
6
6
  module VERSION
7
7
  MAJOR = 0
8
- MINOR = 8
9
- PATCH = 0
8
+ MINOR = 9
9
+ PATCH = 1
10
10
 
11
11
  STRING = [MAJOR, MINOR, PATCH].join(".")
12
12
  end
@@ -0,0 +1,22 @@
1
+ <%= render(Primer::OpenProject::PageHeader.new) do |component| %>
2
+ <% component.with_title(tag: :h1) do %>
3
+ A title
4
+ <% end %>
5
+ <% component.with_description do %>
6
+ A description with actions
7
+ <% end %>
8
+ <% component.with_actions do %>
9
+ <%= render(Primer::Alpha::ActionMenu.new) do |component| %>
10
+ <% component.with_show_button { "Menu" } %>
11
+ <% component.with_item(label: "Item", tag: :button, value: "") %>
12
+ <% component.with_item(
13
+ label: "Show dialog",
14
+ tag: :button,
15
+ content_arguments: { "data-show-dialog-id": "my-dialog" },
16
+ value: "",
17
+ scheme: :danger
18
+ ) %>
19
+ <% end %>
20
+ <% end %>
21
+ <% end %>
22
+
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Primer
4
+ module OpenProject
5
+ # @component Primer::OpenProject::PageHeader
6
+ # @label Page Header
7
+ class PageHeaderPreview < ViewComponent::Preview
8
+ # @label Default
9
+ # @snapshot
10
+ def default
11
+ render(Primer::OpenProject::PageHeader.new) do |header|
12
+ header.with_title { "Hello" }
13
+ header.with_description { "Last updated 5 minutes ago by XYZ." }
14
+ end
15
+ end
16
+
17
+ # @label Playground
18
+ # @param variant [Symbol] select [medium, large]
19
+ # @param title [String] text
20
+ # @param description [String] text
21
+ def playground(variant: :medium, title: "Hello", description: "Last updated 5 minutes ago by XYZ.")
22
+ render(Primer::OpenProject::PageHeader.new) do |header|
23
+ header.with_title(variant: variant) { title }
24
+ header.with_description { description }
25
+ end
26
+ end
27
+
28
+ # @label Large
29
+ def large_title
30
+ render(Primer::OpenProject::PageHeader.new) do |header|
31
+ header.with_title(variant: :large) { "Hello" }
32
+ header.with_description { "Last updated 5 minutes ago by XYZ." }
33
+ end
34
+ end
35
+
36
+ # @label With actions
37
+ def actions
38
+ render_with_template(locals: {})
39
+ end
40
+ end
41
+ end
42
+ end
@@ -4423,6 +4423,17 @@
4423
4423
  }
4424
4424
  ]
4425
4425
  },
4426
+ {
4427
+ "component": "OpenProject::PageHeader",
4428
+ "status": "open_project",
4429
+ "a11y_reviewed": false,
4430
+ "short_name": "OpenProjectPageHeader",
4431
+ "source": "https://github.com/primer/view_components/tree/main/app/components/primer/open_project/page_header.rb",
4432
+ "lookbook": "https://primer.style/view-components/lookbook/inspect/primer/open_project/page_header/default/",
4433
+ "parameters": [
4434
+
4435
+ ]
4436
+ },
4426
4437
  {
4427
4438
  "component": "Tooltip",
4428
4439
  "status": "deprecated",
@@ -102,6 +102,7 @@
102
102
  "Primer::IconButton": "",
103
103
  "Primer::LayoutComponent": "",
104
104
  "Primer::Navigation::TabComponent": "",
105
+ "Primer::OpenProject::PageHeader": "",
105
106
  "Primer::Tooltip": "",
106
107
  "Primer::Truncate": ""
107
108
  }
data/static/classes.json CHANGED
@@ -411,6 +411,21 @@
411
411
  "Overlay-header": [
412
412
  "Primer::Alpha::Dialog"
413
413
  ],
414
+ "PageHeader": [
415
+ "Primer::OpenProject::PageHeader"
416
+ ],
417
+ "PageHeader-actions": [
418
+ "Primer::OpenProject::PageHeader"
419
+ ],
420
+ "PageHeader-description": [
421
+ "Primer::OpenProject::PageHeader"
422
+ ],
423
+ "PageHeader-title": [
424
+ "Primer::OpenProject::PageHeader"
425
+ ],
426
+ "PageHeader-title--large": [
427
+ "Primer::OpenProject::PageHeader"
428
+ ],
414
429
  "Popover": [
415
430
  "Primer::Beta::Popover"
416
431
  ],
@@ -1300,6 +1300,22 @@
1300
1300
  },
1301
1301
  "Primer::Navigation::TabComponent": {
1302
1302
  },
1303
+ "Primer::OpenProject::PageHeader": {
1304
+ "DEFAULT_HEADER_VARIANT": "medium",
1305
+ "HEADER_VARIANT_OPTIONS": [
1306
+ "large",
1307
+ "medium"
1308
+ ],
1309
+ "HEADING_TAG_FALLBACK": "h2",
1310
+ "HEADING_TAG_OPTIONS": [
1311
+ "h1",
1312
+ "h2",
1313
+ "h3",
1314
+ "h4",
1315
+ "h5",
1316
+ "h6"
1317
+ ]
1318
+ },
1303
1319
  "Primer::Tooltip": {
1304
1320
  "ALIGN_DEFAULT": "default",
1305
1321
  "ALIGN_MAPPING": {
@@ -14364,6 +14364,122 @@
14364
14364
 
14365
14365
  ]
14366
14366
  },
14367
+ {
14368
+ "fully_qualified_name": "Primer::OpenProject::PageHeader",
14369
+ "description": "A ViewComponent PageHeader inspired by the primer react variant",
14370
+ "accessibility_docs": null,
14371
+ "is_form_component": false,
14372
+ "is_published": true,
14373
+ "requires_js": false,
14374
+ "component": "OpenProject::PageHeader",
14375
+ "status": "open_project",
14376
+ "a11y_reviewed": false,
14377
+ "short_name": "OpenProjectPageHeader",
14378
+ "source": "https://github.com/primer/view_components/tree/main/app/components/primer/open_project/page_header.rb",
14379
+ "lookbook": "https://primer.style/view-components/lookbook/inspect/primer/open_project/page_header/default/",
14380
+ "parameters": [
14381
+
14382
+ ],
14383
+ "slots": [
14384
+ {
14385
+ "name": "title",
14386
+ "description": "The title of the page header",
14387
+ "parameters": [
14388
+ {
14389
+ "name": "tag",
14390
+ "type": "Symbol",
14391
+ "default": "N/A",
14392
+ "description": "One of `:h1`, `:h2`, `:h3`, `:h4`, `:h5`, or `:h6`."
14393
+ },
14394
+ {
14395
+ "name": "system_arguments",
14396
+ "type": "Hash",
14397
+ "default": "N/A",
14398
+ "description": "{{link_to_system_arguments_docs}}"
14399
+ }
14400
+ ]
14401
+ },
14402
+ {
14403
+ "name": "description",
14404
+ "description": "Optional description below the title row",
14405
+ "parameters": [
14406
+
14407
+ ]
14408
+ },
14409
+ {
14410
+ "name": "actions",
14411
+ "description": "Actions",
14412
+ "parameters": [
14413
+ {
14414
+ "name": "system_arguments",
14415
+ "type": "Hash",
14416
+ "default": "N/A",
14417
+ "description": "{{link_to_system_arguments_docs}}"
14418
+ }
14419
+ ]
14420
+ }
14421
+ ],
14422
+ "methods": [
14423
+
14424
+ ],
14425
+ "previews": [
14426
+ {
14427
+ "preview_path": "primer/open_project/page_header/default",
14428
+ "name": "default",
14429
+ "snapshot": "true",
14430
+ "skip_rules": {
14431
+ "wont_fix": [
14432
+ "region"
14433
+ ],
14434
+ "will_fix": [
14435
+ "color-contrast"
14436
+ ]
14437
+ }
14438
+ },
14439
+ {
14440
+ "preview_path": "primer/open_project/page_header/playground",
14441
+ "name": "playground",
14442
+ "snapshot": "false",
14443
+ "skip_rules": {
14444
+ "wont_fix": [
14445
+ "region"
14446
+ ],
14447
+ "will_fix": [
14448
+ "color-contrast"
14449
+ ]
14450
+ }
14451
+ },
14452
+ {
14453
+ "preview_path": "primer/open_project/page_header/large_title",
14454
+ "name": "large_title",
14455
+ "snapshot": "false",
14456
+ "skip_rules": {
14457
+ "wont_fix": [
14458
+ "region"
14459
+ ],
14460
+ "will_fix": [
14461
+ "color-contrast"
14462
+ ]
14463
+ }
14464
+ },
14465
+ {
14466
+ "preview_path": "primer/open_project/page_header/actions",
14467
+ "name": "actions",
14468
+ "snapshot": "false",
14469
+ "skip_rules": {
14470
+ "wont_fix": [
14471
+ "region"
14472
+ ],
14473
+ "will_fix": [
14474
+ "color-contrast"
14475
+ ]
14476
+ }
14477
+ }
14478
+ ],
14479
+ "subcomponents": [
14480
+
14481
+ ]
14482
+ },
14367
14483
  {
14368
14484
  "fully_qualified_name": "Primer::Tooltip",
14369
14485
  "description": "`Tooltip` is a wrapper component that will apply a tooltip to the provided content.",
data/static/previews.json CHANGED
@@ -4432,6 +4432,66 @@
4432
4432
  }
4433
4433
  ]
4434
4434
  },
4435
+ {
4436
+ "name": "page_header",
4437
+ "component": "OpenProject::PageHeader",
4438
+ "status": "open_project",
4439
+ "lookup_path": "primer/open_project/page_header",
4440
+ "examples": [
4441
+ {
4442
+ "preview_path": "primer/open_project/page_header/default",
4443
+ "name": "default",
4444
+ "snapshot": "true",
4445
+ "skip_rules": {
4446
+ "wont_fix": [
4447
+ "region"
4448
+ ],
4449
+ "will_fix": [
4450
+ "color-contrast"
4451
+ ]
4452
+ }
4453
+ },
4454
+ {
4455
+ "preview_path": "primer/open_project/page_header/playground",
4456
+ "name": "playground",
4457
+ "snapshot": "false",
4458
+ "skip_rules": {
4459
+ "wont_fix": [
4460
+ "region"
4461
+ ],
4462
+ "will_fix": [
4463
+ "color-contrast"
4464
+ ]
4465
+ }
4466
+ },
4467
+ {
4468
+ "preview_path": "primer/open_project/page_header/large_title",
4469
+ "name": "large_title",
4470
+ "snapshot": "false",
4471
+ "skip_rules": {
4472
+ "wont_fix": [
4473
+ "region"
4474
+ ],
4475
+ "will_fix": [
4476
+ "color-contrast"
4477
+ ]
4478
+ }
4479
+ },
4480
+ {
4481
+ "preview_path": "primer/open_project/page_header/actions",
4482
+ "name": "actions",
4483
+ "snapshot": "false",
4484
+ "skip_rules": {
4485
+ "wont_fix": [
4486
+ "region"
4487
+ ],
4488
+ "will_fix": [
4489
+ "color-contrast"
4490
+ ]
4491
+ }
4492
+ }
4493
+ ]
4494
+ },
4435
4495
  {
4436
4496
  "name": "popover",
4437
4497
  "component": "Popover",
data/static/statuses.json CHANGED
@@ -102,6 +102,7 @@
102
102
  "Primer::IconButton": "deprecated",
103
103
  "Primer::LayoutComponent": "deprecated",
104
104
  "Primer::Navigation::TabComponent": "deprecated",
105
+ "Primer::OpenProject::PageHeader": "open_project",
105
106
  "Primer::Tooltip": "deprecated",
106
107
  "Primer::Truncate": "deprecated"
107
108
  }
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.8.0
4
+ version: 0.9.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: 2023-09-04 00:00:00.000000000 Z
12
+ date: 2023-09-08 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.6.7
48
+ version: 19.7.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.6.7
55
+ version: 19.7.0
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: view_component
58
58
  requirement: !ruby/object:Gem::Requirement
@@ -746,6 +746,12 @@ files:
746
746
  - app/components/primer/layout_component.html.erb
747
747
  - app/components/primer/layout_component.rb
748
748
  - app/components/primer/navigation/tab_component.rb
749
+ - app/components/primer/open_project/page_header.css
750
+ - app/components/primer/open_project/page_header.css.json
751
+ - app/components/primer/open_project/page_header.css.map
752
+ - app/components/primer/open_project/page_header.html.erb
753
+ - app/components/primer/open_project/page_header.pcss
754
+ - app/components/primer/open_project/page_header.rb
749
755
  - app/components/primer/primer.d.ts
750
756
  - app/components/primer/primer.js
751
757
  - app/components/primer/primer.pcss
@@ -1110,6 +1116,8 @@ files:
1110
1116
  - previews/primer/forms_preview/single_text_field_form.html.erb
1111
1117
  - previews/primer/forms_preview/submit_button_form.html.erb
1112
1118
  - previews/primer/forms_preview/text_field_and_checkbox_form.html.erb
1119
+ - previews/primer/open_project/page_header_preview.rb
1120
+ - previews/primer/open_project/page_header_preview/actions.html.erb
1113
1121
  - previews/primer/url_helpers.rb
1114
1122
  - static/arguments.json
1115
1123
  - static/assets/view-components.svg