openproject-primer_view_components 0.49.2 → 0.50.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +18 -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_bar.rb +2 -2
  8. data/app/components/primer/alpha/action_bar_element.js +0 -7
  9. data/app/components/primer/alpha/action_bar_element.ts +0 -8
  10. data/app/components/primer/base_component.rb +4 -1
  11. data/app/components/primer/beta/auto_complete.rb +1 -0
  12. data/app/components/primer/beta/button.rb +0 -11
  13. data/app/components/primer/beta/link.css +1 -1
  14. data/app/components/primer/beta/link.css.json +2 -1
  15. data/app/components/primer/beta/link.css.map +1 -1
  16. data/app/components/primer/beta/link.html.erb +18 -0
  17. data/app/components/primer/beta/link.pcss +9 -0
  18. data/app/components/primer/beta/link.rb +26 -14
  19. data/app/components/primer/button_component.rb +0 -11
  20. data/app/components/primer/component.rb +7 -0
  21. data/app/components/primer/conditional_wrapper.rb +5 -2
  22. data/app/forms/horizontal_form.rb +2 -0
  23. data/app/lib/primer/forms/auto_complete.rb +2 -1
  24. data/app/lib/primer/forms/dsl/hidden_input.rb +4 -0
  25. data/app/lib/primer/forms/group.rb +4 -1
  26. data/lib/primer/classify/utilities.yml +63 -0
  27. data/lib/primer/classify.rb +1 -26
  28. data/lib/primer/forms/primer_multi_input.d.ts +10 -0
  29. data/lib/primer/forms/primer_multi_input.js +44 -0
  30. data/lib/primer/forms/primer_text_field.d.ts +28 -0
  31. data/lib/primer/forms/primer_text_field.js +119 -0
  32. data/lib/primer/forms/toggle_switch_input.d.ts +5 -0
  33. data/lib/primer/forms/toggle_switch_input.js +34 -0
  34. data/lib/primer/static/generate_form_previews.rb +44 -0
  35. data/lib/primer/static.rb +8 -0
  36. data/lib/primer/view_components/version.rb +2 -2
  37. data/lib/tasks/custom_utilities.yml +63 -0
  38. data/previews/primer/beta/link_preview.rb +24 -2
  39. data/previews/primer/forms_preview.rb +21 -0
  40. data/static/classes.json +3 -0
  41. data/static/form_previews.json +113 -0
  42. metadata +11 -2
@@ -0,0 +1,34 @@
1
+ /* eslint-disable custom-elements/expose-class-on-global */
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ import { controller, target } from '@github/catalyst';
9
+ let ToggleSwitchInputElement = class ToggleSwitchInputElement extends HTMLElement {
10
+ connectedCallback() {
11
+ this.addEventListener('toggleSwitchError', (event) => {
12
+ this.validationMessageElement.textContent = event.detail;
13
+ this.validationElement.removeAttribute('hidden');
14
+ });
15
+ this.addEventListener('toggleSwitchSuccess', () => {
16
+ this.validationMessageElement.textContent = '';
17
+ this.validationElement.setAttribute('hidden', 'hidden');
18
+ });
19
+ this.addEventListener('toggleSwitchLoading', () => {
20
+ this.validationMessageElement.textContent = '';
21
+ this.validationElement.setAttribute('hidden', 'hidden');
22
+ });
23
+ }
24
+ };
25
+ __decorate([
26
+ target
27
+ ], ToggleSwitchInputElement.prototype, "validationElement", void 0);
28
+ __decorate([
29
+ target
30
+ ], ToggleSwitchInputElement.prototype, "validationMessageElement", void 0);
31
+ ToggleSwitchInputElement = __decorate([
32
+ controller
33
+ ], ToggleSwitchInputElement);
34
+ export { ToggleSwitchInputElement };
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ # :nocov:
4
+
5
+ require "json"
6
+
7
+ module Primer
8
+ module Static
9
+ # :nodoc:
10
+ module GenerateFormPreviews
11
+ class << self
12
+ def call
13
+ Lookbook.previews.filter_map do |preview|
14
+ next unless preview.preview_class == Primer::FormsPreview
15
+
16
+ {
17
+ name: preview.name,
18
+ lookup_path: preview.lookup_path,
19
+ examples: preview.scenarios.flat_map do |parent_scenario|
20
+ scenarios = parent_scenario.type == :scenario_group ? parent_scenario.scenarios : [parent_scenario]
21
+
22
+ scenarios.map do |scenario|
23
+ snapshot_tag = scenario.tags.find { |tag| tag.tag_name == "snapshot" }
24
+ snapshot = if snapshot_tag.nil?
25
+ "false"
26
+ elsif snapshot_tag.text.blank?
27
+ "true"
28
+ else
29
+ snapshot_tag.text
30
+ end
31
+ {
32
+ preview_path: scenario.lookup_path,
33
+ name: scenario.name,
34
+ snapshot: snapshot
35
+ }
36
+ end
37
+ end
38
+ }
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
data/lib/primer/static.rb CHANGED
@@ -15,6 +15,7 @@ module Primer
15
15
  audited_at: "audited_at.json",
16
16
  arguments: "arguments.json",
17
17
  previews: "previews.json",
18
+ form_previews: "form_previews.json",
18
19
  info_arch: "info_arch.json"
19
20
  }.freeze
20
21
 
@@ -50,6 +51,13 @@ module Primer
50
51
  Static::GeneratePreviews.call
51
52
  end
52
53
 
54
+ # Returns an array of hashes, one per example form, that contains some metadata and
55
+ # an array of all the form's previews. The preview data contains the Lookbook URL
56
+ # to each preview and its name.
57
+ def self.generate_form_previews
58
+ Static::GenerateFormPreviews.call
59
+ end
60
+
53
61
  # Returns an array of hashes, one per Primer component, that contains all the data needed
54
62
  # for the new primer.style docsite.
55
63
  def self.generate_info_arch
@@ -5,8 +5,8 @@ module Primer
5
5
  module ViewComponents
6
6
  module VERSION
7
7
  MAJOR = 0
8
- MINOR = 49
9
- PATCH = 2
8
+ MINOR = 50
9
+ PATCH = 0
10
10
 
11
11
  STRING = [MAJOR, MINOR, PATCH].join(".")
12
12
  end
@@ -370,3 +370,66 @@
370
370
  - flex-md-shrink-0
371
371
  - flex-lg-shrink-0
372
372
  - flex-xl-shrink-0
373
+ :overflow:
374
+ :auto:
375
+ - overflow-auto
376
+ - overflow-sm-auto
377
+ - overflow-lg-auto
378
+ - overflow-xl-auto
379
+ :hidden:
380
+ - overflow-hidden
381
+ - overflow-sm-hidden
382
+ - overflow-lg-hidden
383
+ - overflow-xl-hidden
384
+ :scroll:
385
+ - overflow-scroll
386
+ - overflow-sm-scroll
387
+ - overflow-lg-scroll
388
+ - overflow-xl-scroll
389
+ :visible:
390
+ - overflow-visible
391
+ - overflow-sm-visible
392
+ - overflow-lg-visible
393
+ - overflow-xl-visible
394
+ :overflow_x:
395
+ :auto:
396
+ - overflow-x-auto
397
+ - overflow-sm-x-auto
398
+ - overflow-lg-x-auto
399
+ - overflow-xl-x-auto
400
+ :hidden:
401
+ - overflow-x-hidden
402
+ - overflow-sm-x-hidden
403
+ - overflow-lg-x-hidden
404
+ - overflow-xl-x-hidden
405
+ :scroll:
406
+ - overflow-x-scroll
407
+ - overflow-sm-x-scroll
408
+ - overflow-lg-x-scroll
409
+ - overflow-xl-x-scroll
410
+ :visible:
411
+ - overflow-x-visible
412
+ - overflow-sm-x-visible
413
+ - overflow-lg-x-visible
414
+ - overflow-xl-x-visible
415
+ :overflow_y:
416
+ :auto:
417
+ - overflow-y-auto
418
+ - overflow-sm-y-auto
419
+ - overflow-lg-y-auto
420
+ - overflow-xl-y-auto
421
+ :hidden:
422
+ - overflow-y-hidden
423
+ - overflow-sm-y-hidden
424
+ - overflow-lg-y-hidden
425
+ - overflow-xl-y-hidden
426
+ :scroll:
427
+ - overflow-y-scroll
428
+ - overflow-sm-y-scroll
429
+ - overflow-lg-y-scroll
430
+ - overflow-xl-y-scroll
431
+ :visible:
432
+ - overflow-y-visible
433
+ - overflow-sm-y-visible
434
+ - overflow-lg-y-visible
435
+ - overflow-xl-y-visible
@@ -9,8 +9,14 @@ module Primer
9
9
  # @param underline [Boolean]
10
10
  # @param muted [Boolean]
11
11
  # @param scheme [Symbol] select [default, primary, secondary]
12
- def playground(scheme: :default, muted: false, underline: true)
13
- render(Primer::Beta::Link.new(href: "#", scheme: scheme, muted: muted, underline: underline)) { "This is a link!" }
12
+ # @param leading_visual_icon [Symbol] octicon
13
+ # @param trailing_visual_icon [Symbol] octicon
14
+ def playground(scheme: :default, muted: false, underline: true, leading_visual_icon: nil, trailing_visual_icon: nil)
15
+ render(Primer::Beta::Link.new(href: "#", scheme: scheme, muted: muted, underline: underline)) do |link|
16
+ link.with_leading_visual_icon(icon: leading_visual_icon) if leading_visual_icon && leading_visual_icon != :none
17
+ link.with_trailing_visual_icon(icon: trailing_visual_icon) if trailing_visual_icon && trailing_visual_icon != :none
18
+ "This is a link!"
19
+ end
14
20
  end
15
21
 
16
22
  # @label Default Options
@@ -66,6 +72,22 @@ module Primer
66
72
  render(Primer::Beta::Link.new(href: "#", scheme: :secondary, muted: true)) { "This is a muted secondary link color." }
67
73
  end
68
74
  # @!endgroup
75
+
76
+ # @label With leading icon
77
+ def with_leading_icon
78
+ render(Primer::Beta::Link.new(href: "#")) do |component|
79
+ component.with_leading_visual_icon(icon: :"mark-github")
80
+ "Link with leading icon"
81
+ end
82
+ end
83
+
84
+ # @label With trailing icon
85
+ def with_trailing_icon
86
+ render(Primer::Beta::Link.new(href: "#")) do |component|
87
+ component.with_trailing_visual_icon(icon: :"link-external")
88
+ "Link with trailing icon"
89
+ end
90
+ end
69
91
  end
70
92
  end
71
93
  end
@@ -3,50 +3,71 @@
3
3
  module Primer
4
4
  # :nodoc:
5
5
  class FormsPreview < ViewComponent::Preview
6
+ # @snapshot
6
7
  def single_text_field_form; end
7
8
 
9
+ # @snapshot
8
10
  def multi_text_field_form; end
9
11
 
10
12
  def custom_width_fields_form; end
11
13
 
14
+ # @snapshot
12
15
  def text_field_and_checkbox_form; end
13
16
 
17
+ # @snapshot
14
18
  def horizontal_form; end
15
19
 
20
+ # @snapshot
16
21
  def composed_form; end
17
22
 
23
+ # @snapshot
18
24
  def submit_button_form; end
19
25
 
26
+ # @snapshot
20
27
  def radio_button_group_form; end
21
28
 
29
+ # @snapshot
22
30
  def check_box_group_form; end
23
31
 
32
+ # @snapshot
24
33
  def array_check_box_group_form; end
25
34
 
35
+ # @snapshot
26
36
  def select_form; end
27
37
 
38
+ # @snapshot
28
39
  def action_menu_form(route_format: :html)
29
40
  render_with_template(locals: { route_format: route_format })
30
41
  end
31
42
 
43
+ # @snapshot
32
44
  def radio_button_with_nested_form; end
33
45
 
46
+ # @snapshot
34
47
  def check_box_with_nested_form; end
35
48
 
49
+ # @snapshot
36
50
  def caption_template_form; end
37
51
 
52
+ # @snapshot
38
53
  def after_content_form; end
39
54
 
55
+ # @snapshot
40
56
  def invalid_form; end
41
57
 
58
+ # @snapshot
42
59
  def multi_input_form; end
43
60
 
61
+ # @snapshot
44
62
  def name_with_question_mark_form; end
45
63
 
64
+ # @snapshot
46
65
  def immediate_validation_form; end
47
66
 
67
+ # @snapshot
48
68
  def example_toggle_switch_form; end
49
69
 
70
+ # @snapshot
50
71
  def auto_complete_form; end
51
72
  end
52
73
  end
data/static/classes.json CHANGED
@@ -422,6 +422,9 @@
422
422
  "Link--underline": [
423
423
  "Primer::Beta::Link"
424
424
  ],
425
+ "Link-content": [
426
+ "Primer::Beta::Link"
427
+ ],
425
428
  "Overlay": [
426
429
  "Primer::Alpha::Dialog",
427
430
  "Primer::Alpha::Overlay"
@@ -0,0 +1,113 @@
1
+ [
2
+ {
3
+ "name": "forms",
4
+ "lookup_path": "primer/forms",
5
+ "examples": [
6
+ {
7
+ "preview_path": "primer/forms/single_text_field_form",
8
+ "name": "single_text_field_form",
9
+ "snapshot": "true"
10
+ },
11
+ {
12
+ "preview_path": "primer/forms/multi_text_field_form",
13
+ "name": "multi_text_field_form",
14
+ "snapshot": "true"
15
+ },
16
+ {
17
+ "preview_path": "primer/forms/text_field_and_checkbox_form",
18
+ "name": "text_field_and_checkbox_form",
19
+ "snapshot": "true"
20
+ },
21
+ {
22
+ "preview_path": "primer/forms/horizontal_form",
23
+ "name": "horizontal_form",
24
+ "snapshot": "true"
25
+ },
26
+ {
27
+ "preview_path": "primer/forms/composed_form",
28
+ "name": "composed_form",
29
+ "snapshot": "true"
30
+ },
31
+ {
32
+ "preview_path": "primer/forms/submit_button_form",
33
+ "name": "submit_button_form",
34
+ "snapshot": "true"
35
+ },
36
+ {
37
+ "preview_path": "primer/forms/radio_button_group_form",
38
+ "name": "radio_button_group_form",
39
+ "snapshot": "true"
40
+ },
41
+ {
42
+ "preview_path": "primer/forms/check_box_group_form",
43
+ "name": "check_box_group_form",
44
+ "snapshot": "true"
45
+ },
46
+ {
47
+ "preview_path": "primer/forms/array_check_box_group_form",
48
+ "name": "array_check_box_group_form",
49
+ "snapshot": "true"
50
+ },
51
+ {
52
+ "preview_path": "primer/forms/select_form",
53
+ "name": "select_form",
54
+ "snapshot": "true"
55
+ },
56
+ {
57
+ "preview_path": "primer/forms/action_menu_form",
58
+ "name": "action_menu_form",
59
+ "snapshot": "true"
60
+ },
61
+ {
62
+ "preview_path": "primer/forms/radio_button_with_nested_form",
63
+ "name": "radio_button_with_nested_form",
64
+ "snapshot": "true"
65
+ },
66
+ {
67
+ "preview_path": "primer/forms/check_box_with_nested_form",
68
+ "name": "check_box_with_nested_form",
69
+ "snapshot": "true"
70
+ },
71
+ {
72
+ "preview_path": "primer/forms/caption_template_form",
73
+ "name": "caption_template_form",
74
+ "snapshot": "true"
75
+ },
76
+ {
77
+ "preview_path": "primer/forms/after_content_form",
78
+ "name": "after_content_form",
79
+ "snapshot": "true"
80
+ },
81
+ {
82
+ "preview_path": "primer/forms/invalid_form",
83
+ "name": "invalid_form",
84
+ "snapshot": "true"
85
+ },
86
+ {
87
+ "preview_path": "primer/forms/multi_input_form",
88
+ "name": "multi_input_form",
89
+ "snapshot": "true"
90
+ },
91
+ {
92
+ "preview_path": "primer/forms/name_with_question_mark_form",
93
+ "name": "name_with_question_mark_form",
94
+ "snapshot": "true"
95
+ },
96
+ {
97
+ "preview_path": "primer/forms/immediate_validation_form",
98
+ "name": "immediate_validation_form",
99
+ "snapshot": "true"
100
+ },
101
+ {
102
+ "preview_path": "primer/forms/example_toggle_switch_form",
103
+ "name": "example_toggle_switch_form",
104
+ "snapshot": "true"
105
+ },
106
+ {
107
+ "preview_path": "primer/forms/auto_complete_form",
108
+ "name": "auto_complete_form",
109
+ "snapshot": "true"
110
+ }
111
+ ]
112
+ }
113
+ ]
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.49.2
4
+ version: 0.50.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-11-25 00:00:00.000000000 Z
12
+ date: 2024-12-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionview
@@ -402,6 +402,7 @@ files:
402
402
  - app/components/primer/beta/link.css
403
403
  - app/components/primer/beta/link.css.json
404
404
  - app/components/primer/beta/link.css.map
405
+ - app/components/primer/beta/link.html.erb
405
406
  - app/components/primer/beta/link.pcss
406
407
  - app/components/primer/beta/link.rb
407
408
  - app/components/primer/beta/markdown.rb
@@ -718,10 +719,17 @@ files:
718
719
  - lib/primer/deprecations.yml
719
720
  - lib/primer/example_image.rb
720
721
  - lib/primer/form_components.rb
722
+ - lib/primer/forms/primer_multi_input.d.ts
723
+ - lib/primer/forms/primer_multi_input.js
724
+ - lib/primer/forms/primer_text_field.d.ts
725
+ - lib/primer/forms/primer_text_field.js
726
+ - lib/primer/forms/toggle_switch_input.d.ts
727
+ - lib/primer/forms/toggle_switch_input.js
721
728
  - lib/primer/static.rb
722
729
  - lib/primer/static/generate_arguments.rb
723
730
  - lib/primer/static/generate_audited_at.rb
724
731
  - lib/primer/static/generate_constants.rb
732
+ - lib/primer/static/generate_form_previews.rb
725
733
  - lib/primer/static/generate_info_arch.rb
726
734
  - lib/primer/static/generate_previews.rb
727
735
  - lib/primer/static/generate_statuses.rb
@@ -1037,6 +1045,7 @@ files:
1037
1045
  - static/audited_at.json
1038
1046
  - static/classes.json
1039
1047
  - static/constants.json
1048
+ - static/form_previews.json
1040
1049
  - static/info_arch.json
1041
1050
  - static/previews.json
1042
1051
  - static/statuses.json