primer_view_components 0.0.112 → 0.0.113

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +38 -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 +3 -1
  6. data/app/assets/styles/primer_view_components.css.map +1 -1
  7. data/app/components/primer/alpha/action_list.css +1 -1
  8. data/app/components/primer/alpha/action_list.css.json +1 -1
  9. data/app/components/primer/alpha/action_list.css.map +1 -1
  10. data/app/components/primer/alpha/action_list.pcss +0 -15
  11. data/app/components/primer/alpha/auto_complete.css +1 -1
  12. data/app/components/primer/alpha/auto_complete.css.map +1 -1
  13. data/app/components/primer/alpha/auto_complete.pcss +1 -1
  14. data/app/components/primer/alpha/banner.css +1 -1
  15. data/app/components/primer/alpha/banner.css.map +1 -1
  16. data/app/components/primer/alpha/banner.pcss +2 -2
  17. data/app/components/primer/alpha/dialog/body.rb +3 -0
  18. data/app/components/primer/alpha/dialog/footer.rb +3 -0
  19. data/app/components/primer/alpha/dialog/header.rb +3 -0
  20. data/app/components/primer/alpha/dialog.css +1 -0
  21. data/app/components/primer/alpha/dialog.css.json +1 -0
  22. data/app/components/primer/alpha/dialog.css.map +1 -0
  23. data/app/components/primer/alpha/dialog.pcss +484 -0
  24. data/app/components/primer/alpha/dialog.rb +3 -0
  25. data/app/components/primer/alpha/segmented_control.css +1 -1
  26. data/app/components/primer/alpha/segmented_control.css.map +1 -1
  27. data/app/components/primer/alpha/text_field.css +3 -0
  28. data/app/components/primer/alpha/text_field.css.json +1 -0
  29. data/app/components/primer/alpha/text_field.css.map +1 -0
  30. data/app/components/primer/alpha/text_field.pcss +683 -0
  31. data/app/components/primer/alpha/toggle_switch.d.ts +1 -1
  32. data/app/components/primer/alpha/toggle_switch.js +7 -4
  33. data/app/components/primer/alpha/toggle_switch.ts +7 -3
  34. data/app/components/primer/beta/button_group.css +1 -0
  35. data/app/components/primer/beta/button_group.css.json +1 -0
  36. data/app/components/primer/beta/button_group.css.map +1 -0
  37. data/app/components/primer/beta/button_group.pcss +92 -0
  38. data/app/components/primer/{clipboard_copy.d.ts → beta/clipboard_copy.d.ts} +0 -0
  39. data/app/components/primer/{clipboard_copy.html.erb → beta/clipboard_copy.html.erb} +0 -0
  40. data/app/components/primer/{clipboard_copy.js → beta/clipboard_copy.js} +0 -0
  41. data/app/components/primer/beta/clipboard_copy.rb +50 -0
  42. data/app/components/primer/{clipboard_copy.ts → beta/clipboard_copy.ts} +0 -0
  43. data/app/components/primer/beta/popover.css.map +1 -1
  44. data/app/components/primer/beta/popover.pcss +5 -5
  45. data/app/components/primer/beta/relative_time.rb +160 -0
  46. data/app/components/primer/button_component.css +1 -0
  47. data/app/components/primer/button_component.css.json +1 -0
  48. data/app/components/primer/button_component.css.map +1 -0
  49. data/app/components/primer/button_component.pcss +557 -0
  50. data/app/components/primer/button_component.rb +1 -1
  51. data/app/components/primer/clipboard_copy.rb +2 -43
  52. data/app/components/primer/component.rb +4 -0
  53. data/app/components/primer/local_time.d.ts +1 -1
  54. data/app/components/primer/local_time.js +1 -1
  55. data/app/components/primer/local_time.rb +3 -1
  56. data/app/components/primer/local_time.ts +1 -1
  57. data/app/components/primer/primer.d.ts +1 -1
  58. data/app/components/primer/primer.js +1 -1
  59. data/app/components/primer/primer.pcss +10 -0
  60. data/app/components/primer/primer.ts +1 -1
  61. data/app/components/primer/time_ago_component.d.ts +1 -1
  62. data/app/components/primer/time_ago_component.js +1 -1
  63. data/app/components/primer/time_ago_component.rb +2 -1
  64. data/app/components/primer/time_ago_component.ts +1 -1
  65. data/app/forms/submit_button_form.rb +8 -2
  66. data/app/helpers/primer/form_helper.rb +12 -0
  67. data/lib/postcss_mixins/clearfix.pcss +12 -0
  68. data/lib/primer/deprecations.rb +96 -26
  69. data/lib/primer/deprecations.yml +68 -0
  70. data/lib/primer/forms/base.rb +7 -20
  71. data/lib/primer/forms/base_component.rb +15 -1
  72. data/lib/primer/forms/button.html.erb +4 -0
  73. data/lib/primer/forms/button.rb +68 -0
  74. data/lib/primer/forms/check_box.html.erb +2 -2
  75. data/lib/primer/forms/check_box.rb +1 -1
  76. data/lib/primer/forms/check_box_group.html.erb +2 -2
  77. data/lib/primer/forms/dsl/button_input.rb +29 -0
  78. data/lib/primer/forms/dsl/input_methods.rb +7 -2
  79. data/lib/primer/forms/dsl/submit_button_input.rb +1 -0
  80. data/lib/primer/forms/dsl/text_field_input.rb +0 -7
  81. data/lib/primer/forms/radio_button.html.erb +2 -2
  82. data/lib/primer/forms/radio_button.rb +1 -1
  83. data/lib/primer/forms/radio_button_group.html.erb +2 -2
  84. data/lib/primer/forms/select_list.html.erb +1 -1
  85. data/lib/primer/forms/select_list.rb +4 -1
  86. data/lib/primer/forms/submit_button.html.erb +1 -4
  87. data/lib/primer/forms/submit_button.rb +1 -37
  88. data/lib/primer/forms/text_area.html.erb +1 -1
  89. data/lib/primer/forms/text_area.rb +5 -1
  90. data/lib/primer/forms/text_field.html.erb +1 -1
  91. data/lib/primer/forms/text_field.rb +11 -0
  92. data/lib/primer/forms/utils.rb +28 -0
  93. data/lib/primer/view_components/audited.rb +14 -0
  94. data/lib/primer/view_components/engine.rb +1 -0
  95. data/lib/primer/view_components/linters/clipboard_copy_component_migration_counter.rb +2 -2
  96. data/lib/primer/view_components/linters/helpers/deprecated_components_helpers.rb +3 -18
  97. data/lib/primer/view_components/version.rb +1 -1
  98. data/lib/rubocop/cop/primer/component_name_migration.rb +2 -2
  99. data/lib/tasks/docs.rake +3 -2
  100. data/previews/primer/alpha/auto_complete_preview.rb +12 -0
  101. data/previews/primer/alpha/segmented_control_preview.rb +9 -6
  102. data/previews/primer/alpha/text_field_preview.rb +77 -52
  103. data/previews/primer/beta/clipboard_copy_preview/element.html.erb +2 -0
  104. data/previews/primer/beta/clipboard_copy_preview.rb +39 -0
  105. data/previews/primer/beta/relative_time_preview.rb +271 -0
  106. data/previews/primer/forms/forms_preview.rb +1 -0
  107. data/static/arguments.json +143 -33
  108. data/static/audited_at.json +6 -4
  109. data/static/constants.json +124 -0
  110. data/static/statuses.json +4 -2
  111. metadata +34 -8
  112. data/previews/primer/clipboard_copy_preview/element.html.erb +0 -2
  113. data/previews/primer/clipboard_copy_preview.rb +0 -37
@@ -27,9 +27,12 @@ let ToggleSwitchElement = class ToggleSwitchElement extends HTMLElement {
27
27
  return this.src != null;
28
28
  }
29
29
  toggle() {
30
+ if (this.isDisabled()) {
31
+ return;
32
+ }
30
33
  if (this.isRemote()) {
31
34
  this.setLoadingState();
32
- this.check();
35
+ this.submitForm();
33
36
  }
34
37
  else {
35
38
  this.performToggle();
@@ -90,12 +93,12 @@ let ToggleSwitchElement = class ToggleSwitchElement extends HTMLElement {
90
93
  this.loadingSpinner.setAttribute('hidden', 'hidden');
91
94
  this.enable();
92
95
  }
93
- async check() {
96
+ async submitForm() {
94
97
  const body = new FormData();
95
98
  if (this.csrf) {
96
99
  body.append(this.csrfField, this.csrf);
97
100
  }
98
- body.append('value', this.isOn() ? '1' : '0');
101
+ body.append('value', this.isOn() ? '0' : '1');
99
102
  try {
100
103
  if (!this.src)
101
104
  throw new Error('invalid src');
@@ -131,7 +134,7 @@ __decorate([
131
134
  ], ToggleSwitchElement.prototype, "errorIcon", void 0);
132
135
  __decorate([
133
136
  debounce(300)
134
- ], ToggleSwitchElement.prototype, "check", null);
137
+ ], ToggleSwitchElement.prototype, "submitForm", null);
135
138
  ToggleSwitchElement = __decorate([
136
139
  controller
137
140
  ], ToggleSwitchElement);
@@ -32,9 +32,13 @@ class ToggleSwitchElement extends HTMLElement {
32
32
  }
33
33
 
34
34
  toggle() {
35
+ if (this.isDisabled()) {
36
+ return
37
+ }
38
+
35
39
  if (this.isRemote()) {
36
40
  this.setLoadingState()
37
- this.check()
41
+ this.submitForm()
38
42
  } else {
39
43
  this.performToggle()
40
44
  }
@@ -110,14 +114,14 @@ class ToggleSwitchElement extends HTMLElement {
110
114
  }
111
115
 
112
116
  @debounce(300)
113
- private async check() {
117
+ private async submitForm() {
114
118
  const body = new FormData()
115
119
 
116
120
  if (this.csrf) {
117
121
  body.append(this.csrfField, this.csrf)
118
122
  }
119
123
 
120
- body.append('value', this.isOn() ? '1' : '0')
124
+ body.append('value', this.isOn() ? '0' : '1')
121
125
 
122
126
  try {
123
127
  if (!this.src) throw new Error('invalid src')
@@ -0,0 +1 @@
1
+ .BtnGroup{display:inline-block;vertical-align:middle}.BtnGroup:after,.BtnGroup:before{content:"";display:table}.BtnGroup:after{clear:both}.BtnGroup+.BtnGroup,.BtnGroup+.btn{margin-left:var(--primer-control-small-gap,4px)}.BtnGroup-item.btn{border-radius:0;border-right-width:0;float:left;position:relative}.BtnGroup-item.btn:first-child{border-bottom-left-radius:var(--primer-borderRadius-medium,6px);border-top-left-radius:var(--primer-borderRadius-medium,6px)}.BtnGroup-item.btn:last-child{border-bottom-right-radius:var(--primer-borderRadius-medium,6px);border-right-width:var(--primer-borderWidth-thin,1px);border-top-right-radius:var(--primer-borderRadius-medium,6px)}.BtnGroup-item.btn.selected,.BtnGroup-item.btn:active,.BtnGroup-item.btn:focus,.BtnGroup-item.btn:hover,.BtnGroup-item.btn[aria-selected=true]{border-right-width:var(--primer-borderWidth-thin,1px)}.BtnGroup-item.btn.selected+.BtnGroup-item,.BtnGroup-item.btn.selected+.BtnGroup-parent .BtnGroup-item,.BtnGroup-item.btn:active+.BtnGroup-item,.BtnGroup-item.btn:active+.BtnGroup-parent .BtnGroup-item,.BtnGroup-item.btn:focus+.BtnGroup-item,.BtnGroup-item.btn:focus+.BtnGroup-parent .BtnGroup-item,.BtnGroup-item.btn:hover+.BtnGroup-item,.BtnGroup-item.btn:hover+.BtnGroup-parent .BtnGroup-item,.BtnGroup-item.btn[aria-selected=true]+.BtnGroup-item,.BtnGroup-item.btn[aria-selected=true]+.BtnGroup-parent .BtnGroup-item{border-left-width:0}.BtnGroup-parent{float:left}.BtnGroup-parent:first-child .BtnGroup-item{border-bottom-left-radius:var(--primer-borderRadius-medium,6px);border-top-left-radius:var(--primer-borderRadius-medium,6px)}.BtnGroup-parent:last-child .BtnGroup-item{border-bottom-right-radius:var(--primer-borderRadius-medium,6px);border-right-width:var(--primer-borderWidth-thin,1px);border-top-right-radius:var(--primer-borderRadius-medium,6px)}.BtnGroup-parent .BtnGroup-item{border-radius:0;border-right-width:0}.BtnGroup-parent.selected .BtnGroup-item,.BtnGroup-parent:active .BtnGroup-item,.BtnGroup-parent:focus .BtnGroup-item,.BtnGroup-parent:hover .BtnGroup-item,.BtnGroup-parent[aria-selected=true] .BtnGroup-item{border-right-width:var(--primer-borderWidth-thin,1px)}.BtnGroup-parent.selected+.BtnGroup-item,.BtnGroup-parent.selected+.BtnGroup-parent .BtnGroup-item,.BtnGroup-parent:active+.BtnGroup-item,.BtnGroup-parent:active+.BtnGroup-parent .BtnGroup-item,.BtnGroup-parent:focus+.BtnGroup-item,.BtnGroup-parent:focus+.BtnGroup-parent .BtnGroup-item,.BtnGroup-parent:hover+.BtnGroup-item,.BtnGroup-parent:hover+.BtnGroup-parent .BtnGroup-item,.BtnGroup-parent[aria-selected=true]+.BtnGroup-item,.BtnGroup-parent[aria-selected=true]+.BtnGroup-parent .BtnGroup-item{border-left-width:0}.BtnGroup-item:active,.BtnGroup-item:focus,.BtnGroup-parent:active,.BtnGroup-parent:focus{z-index:1}
@@ -0,0 +1 @@
1
+ {"name":"beta/button_group","selectors":[".BtnGroup",".BtnGroup:after",".BtnGroup:before",".BtnGroup+.BtnGroup",".BtnGroup+.btn",".BtnGroup-item.btn",".BtnGroup-item.btn:first-child",".BtnGroup-item.btn:last-child",".BtnGroup-item.btn.selected",".BtnGroup-item.btn:active",".BtnGroup-item.btn:focus",".BtnGroup-item.btn:hover",".BtnGroup-item.btn[aria-selected=true]",".BtnGroup-item.btn.selected+.BtnGroup-item",".BtnGroup-item.btn.selected+.BtnGroup-parent .BtnGroup-item",".BtnGroup-item.btn:active+.BtnGroup-item",".BtnGroup-item.btn:active+.BtnGroup-parent .BtnGroup-item",".BtnGroup-item.btn:focus+.BtnGroup-item",".BtnGroup-item.btn:focus+.BtnGroup-parent .BtnGroup-item",".BtnGroup-item.btn:hover+.BtnGroup-item",".BtnGroup-item.btn:hover+.BtnGroup-parent .BtnGroup-item",".BtnGroup-item.btn[aria-selected=true]+.BtnGroup-item",".BtnGroup-item.btn[aria-selected=true]+.BtnGroup-parent .BtnGroup-item",".BtnGroup-parent",".BtnGroup-parent:first-child .BtnGroup-item",".BtnGroup-parent:last-child .BtnGroup-item",".BtnGroup-parent .BtnGroup-item",".BtnGroup-parent.selected .BtnGroup-item",".BtnGroup-parent:active .BtnGroup-item",".BtnGroup-parent:focus .BtnGroup-item",".BtnGroup-parent:hover .BtnGroup-item",".BtnGroup-parent[aria-selected=true] .BtnGroup-item",".BtnGroup-parent.selected+.BtnGroup-item",".BtnGroup-parent.selected+.BtnGroup-parent .BtnGroup-item",".BtnGroup-parent:active+.BtnGroup-item",".BtnGroup-parent:active+.BtnGroup-parent .BtnGroup-item",".BtnGroup-parent:focus+.BtnGroup-item",".BtnGroup-parent:focus+.BtnGroup-parent .BtnGroup-item",".BtnGroup-parent:hover+.BtnGroup-item",".BtnGroup-parent:hover+.BtnGroup-parent .BtnGroup-item",".BtnGroup-parent[aria-selected=true]+.BtnGroup-item",".BtnGroup-parent[aria-selected=true]+.BtnGroup-parent .BtnGroup-item",".BtnGroup-item:active",".BtnGroup-item:focus",".BtnGroup-parent:active",".BtnGroup-parent:focus"]}
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["button_group.pcss","../../../../lib/postcss_mixins/clearfix.pcss"],"names":[],"mappings":"AAKA,UACE,oBAAqB,CACrB,qBASF,CCVE,iCAHE,UAAW,CADX,aAQF,CAJA,gBAEE,UAEF,CDEA,mCAEE,+CACF,CAGF,mBAIE,eAAgB,CADhB,oBAAqB,CADrB,UAAW,CADX,iBA4BF,CAvBE,+BAEE,+DAAiE,CADjE,4DAEF,CAEA,8BAGE,gEAAkE,CAFlE,qDAAuD,CACvD,6DAEF,CAEA,+IAKE,qDAMF,CAJE,ygBAEE,mBACF,CAIJ,iBACE,UAgCF,CA9BE,4CAEE,+DAAiE,CADjE,4DAEF,CAEA,2CAGE,gEAAkE,CAFlE,qDAAuD,CACvD,6DAEF,CAEA,gCAEE,eAAgB,CADhB,oBAEF,CAOE,gNACE,qDACF,CAEA,qfAEE,mBACF,CAOF,0FAEE,SACF","file":"button_group.css","sourcesContent":["/* BtnGroup */\n\n/* A button group is a series of buttons laid out next to each other, all part\n** of one visual button, but separated by rules to be separate. */\n\n.BtnGroup {\n display: inline-block;\n vertical-align: middle;\n\n @mixin clearfix;\n\n /* Proper spacing for multiple button groups (a la, gollum editor) */\n & + .BtnGroup,\n & + .btn {\n margin-left: var(--primer-control-small-gap, 4px);\n }\n}\n\n.BtnGroup-item.btn {\n position: relative;\n float: left;\n border-right-width: 0;\n border-radius: 0;\n\n &:first-child {\n border-top-left-radius: var(--primer-borderRadius-medium, 6px);\n border-bottom-left-radius: var(--primer-borderRadius-medium, 6px);\n }\n\n &:last-child {\n border-right-width: var(--primer-borderWidth-thin, 1px);\n border-top-right-radius: var(--primer-borderRadius-medium, 6px);\n border-bottom-right-radius: var(--primer-borderRadius-medium, 6px);\n }\n\n &.selected,\n &[aria-selected='true'],\n &:focus,\n &:active,\n &:hover {\n border-right-width: var(--primer-borderWidth-thin, 1px);\n\n & + .BtnGroup-item,\n & + .BtnGroup-parent .BtnGroup-item {\n border-left-width: 0;\n }\n }\n}\n\n.BtnGroup-parent {\n float: left;\n\n &:first-child .BtnGroup-item {\n border-top-left-radius: var(--primer-borderRadius-medium, 6px);\n border-bottom-left-radius: var(--primer-borderRadius-medium, 6px);\n }\n\n &:last-child .BtnGroup-item {\n border-right-width: var(--primer-borderWidth-thin, 1px);\n border-top-right-radius: var(--primer-borderRadius-medium, 6px);\n border-bottom-right-radius: var(--primer-borderRadius-medium, 6px);\n }\n\n & .BtnGroup-item {\n border-right-width: 0;\n border-radius: 0;\n }\n\n &.selected,\n &[aria-selected='true'],\n &:focus,\n &:active,\n &:hover {\n & .BtnGroup-item {\n border-right-width: var(--primer-borderWidth-thin, 1px);\n }\n\n & + .BtnGroup-item,\n & + .BtnGroup-parent .BtnGroup-item {\n border-left-width: 0;\n }\n }\n}\n\n/* ensure that the focus ring sits above the adjacent buttons */\n.BtnGroup-item,\n.BtnGroup-parent {\n &:focus,\n &:active {\n z-index: 1;\n }\n}\n","@define-mixin clearfix {\n &::before {\n display: table;\n content: '';\n }\n\n &::after {\n display: table;\n clear: both;\n content: '';\n }\n}\n"]}
@@ -0,0 +1,92 @@
1
+ /* BtnGroup */
2
+
3
+ /* A button group is a series of buttons laid out next to each other, all part
4
+ ** of one visual button, but separated by rules to be separate. */
5
+
6
+ .BtnGroup {
7
+ display: inline-block;
8
+ vertical-align: middle;
9
+
10
+ @mixin clearfix;
11
+
12
+ /* Proper spacing for multiple button groups (a la, gollum editor) */
13
+ & + .BtnGroup,
14
+ & + .btn {
15
+ margin-left: var(--primer-control-small-gap, 4px);
16
+ }
17
+ }
18
+
19
+ .BtnGroup-item.btn {
20
+ position: relative;
21
+ float: left;
22
+ border-right-width: 0;
23
+ border-radius: 0;
24
+
25
+ &:first-child {
26
+ border-top-left-radius: var(--primer-borderRadius-medium, 6px);
27
+ border-bottom-left-radius: var(--primer-borderRadius-medium, 6px);
28
+ }
29
+
30
+ &:last-child {
31
+ border-right-width: var(--primer-borderWidth-thin, 1px);
32
+ border-top-right-radius: var(--primer-borderRadius-medium, 6px);
33
+ border-bottom-right-radius: var(--primer-borderRadius-medium, 6px);
34
+ }
35
+
36
+ &.selected,
37
+ &[aria-selected='true'],
38
+ &:focus,
39
+ &:active,
40
+ &:hover {
41
+ border-right-width: var(--primer-borderWidth-thin, 1px);
42
+
43
+ & + .BtnGroup-item,
44
+ & + .BtnGroup-parent .BtnGroup-item {
45
+ border-left-width: 0;
46
+ }
47
+ }
48
+ }
49
+
50
+ .BtnGroup-parent {
51
+ float: left;
52
+
53
+ &:first-child .BtnGroup-item {
54
+ border-top-left-radius: var(--primer-borderRadius-medium, 6px);
55
+ border-bottom-left-radius: var(--primer-borderRadius-medium, 6px);
56
+ }
57
+
58
+ &:last-child .BtnGroup-item {
59
+ border-right-width: var(--primer-borderWidth-thin, 1px);
60
+ border-top-right-radius: var(--primer-borderRadius-medium, 6px);
61
+ border-bottom-right-radius: var(--primer-borderRadius-medium, 6px);
62
+ }
63
+
64
+ & .BtnGroup-item {
65
+ border-right-width: 0;
66
+ border-radius: 0;
67
+ }
68
+
69
+ &.selected,
70
+ &[aria-selected='true'],
71
+ &:focus,
72
+ &:active,
73
+ &:hover {
74
+ & .BtnGroup-item {
75
+ border-right-width: var(--primer-borderWidth-thin, 1px);
76
+ }
77
+
78
+ & + .BtnGroup-item,
79
+ & + .BtnGroup-parent .BtnGroup-item {
80
+ border-left-width: 0;
81
+ }
82
+ }
83
+ }
84
+
85
+ /* ensure that the focus ring sits above the adjacent buttons */
86
+ .BtnGroup-item,
87
+ .BtnGroup-parent {
88
+ &:focus,
89
+ &:active {
90
+ z-index: 1;
91
+ }
92
+ }
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Primer
4
+ module Beta
5
+ # Use `ClipboardCopy` to copy element text content or input values to the clipboard.
6
+ #
7
+ # @accessibility
8
+ # Always set an accessible label to help the user interact with the component.
9
+ class ClipboardCopy < Primer::Component
10
+ status :beta
11
+
12
+ # @example Default
13
+ # <%= render(Primer::Beta::ClipboardCopy.new(value: "Text to copy", "aria-label": "Copy text to the system clipboard")) %>
14
+ #
15
+ # @example With text instead of icons
16
+ # <%= render(Primer::Beta::ClipboardCopy.new(value: "Text to copy")) do %>
17
+ # Click to copy!
18
+ # <% end %>
19
+ #
20
+ # @example Copying from an element
21
+ # <%= render(Primer::Beta::ClipboardCopy.new(for: "blob-path", "aria-label": "Copy text to the system clipboard")) %>
22
+ # <div id="blob-path">src/index.js</div>
23
+ #
24
+ # @param aria-label [String] String that will be read to screenreaders when the component is focused
25
+ # @param value [String] Text to copy into the users clipboard when they click the component.
26
+ # @param for [String] Element id from where to get the copied value.
27
+ # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
28
+ def initialize(value: nil, **system_arguments)
29
+ @system_arguments = deny_tag_argument(**system_arguments)
30
+ @value = value
31
+
32
+ validate!
33
+
34
+ @system_arguments[:tag] = "clipboard-copy"
35
+ @system_arguments[:value] = value if value.present?
36
+ end
37
+
38
+ # :nodoc:
39
+ def before_render
40
+ validate_aria_label if content.blank?
41
+ end
42
+
43
+ private
44
+
45
+ def validate!
46
+ raise ArgumentError, "Must provide either `value` or `for`" if @value.nil? && @system_arguments[:for].nil?
47
+ end
48
+ end
49
+ end
50
+ end
@@ -1 +1 @@
1
- {"version":3,"sources":["popover.pcss"],"names":[],"mappings":"AAEA,SACE,iBAAkB,CAClB,WACF,CAEA,iBAKE,4CAA6C,CAC7C,2EAA6E,CAC7E,mDAAqD,CAHrD,gBAAiB,CADjB,iBAAkB,CAFlB,iBAAkB,CAClB,WA6BF,CArBE,+CAKE,UAAW,CADX,oBAAqB,CADrB,QAAS,CADT,iBAIF,CAEA,wBAIE,sBAAgD,CAAhD,mDAAgD,CAFhD,gBAAiB,CADjB,SAIF,CAEA,uBAIE,sBAAgD,CAAhD,mDAAgD,CAFhD,gBAAiB,CADjB,SAIF,CAKA,mEAEE,YACF,CAOA,mNAGE,yBAAgC,CADhC,QAEF,CAEA,2GAEE,4CAA6C,CAD7C,YAEF,CAEA,wGAEE,4CAA6C,CAD7C,YAEF,CAIF,2DAGE,cAAe,CADf,UAgBF,CAbE,gJAEE,SAAU,CACV,aACF,CAEA,yEACE,UACF,CAEA,uEACE,UACF,CAIF,yDAEE,SAAU,CACV,aAWF,CATE,4IAEE,SAAU,CACV,aACF,CAEA,qEACE,SACF,CAUA,oZAKE,yBAAgC,CAFhC,SAAU,CACV,aAAc,CAFd,OAIF,CAEA,6MACE,eACF,CAEA,uMACE,eACF,CAOA,wGAEE,6CAA8C,CAD9C,WAEF,CAEA,qGAEE,6CAA8C,CAD9C,WAEF,CAOA,qGAEE,8CAA+C,CAD/C,UAEF,CAEA,kGAEE,8CAA+C,CAD/C,UAEF,CAMA,wIAEE,QACF,CAMA,oJAEE,QACF,CAEA,2EACE,WACF,CAEA,yEACE,WACF,CAGF,yBACE,wBACE,eACF,CACF,CAKA,4BACE,SAIE,kBAAoB,CACpB,gBAAkB,CAJlB,cAAe,CAEf,iBAAmB,CADnB,kBAIF,CAEA,iBAGE,WAAY,CACZ,SAAU,CAEV,4CAA8C,CAJ9C,UAAW,CADX,QAAS,CAIT,oBAEF,CAGA,8BACE,wEACF,CAGA,+CAEE,YACF,CACF","file":"popover.css","sourcesContent":["/* Popover */\n\n.Popover {\n position: absolute;\n z-index: 100;\n}\n\n.Popover-message {\n position: relative;\n width: 232px;\n margin-right: auto;\n margin-left: auto;\n background-color: var(--color-canvas-overlay);\n border: var(--primer-borderWidth-thin, 1px) solid var(--color-border-default);\n border-radius: var(--primer-borderRadius-medium, 6px);\n\n /* Carets */\n &::before,\n &::after {\n position: absolute;\n left: 50%;\n display: inline-block;\n content: '';\n }\n\n &::before {\n top: -16px;\n margin-left: -9px;\n border: 8px solid transparent;\n border-bottom-color: var(--color-border-default);\n }\n\n &::after {\n top: -14px;\n margin-left: -8px;\n border: 7px solid transparent;\n border-bottom-color: var(--color-canvas-overlay);\n }\n}\n\n/* No caret */\n.Popover-message--no-caret {\n &::before,\n &::after {\n display: none;\n }\n}\n\n/* Bottom-oriented carets */\n.Popover-message--bottom,\n.Popover-message--bottom-right,\n.Popover-message--bottom-left {\n &::before,\n &::after {\n top: auto;\n border-bottom-color: transparent;\n }\n\n &::before {\n bottom: -16px;\n border-top-color: var(--color-border-default);\n }\n\n &::after {\n bottom: -14px;\n border-top-color: var(--color-canvas-overlay);\n }\n}\n\n/* Top & Bottom: Right-oriented carets */\n.Popover-message--top-right,\n.Popover-message--bottom-right {\n right: -9px;\n margin-right: 0;\n\n &::before,\n &::after {\n left: auto;\n margin-left: 0;\n }\n\n &::before {\n right: 20px;\n }\n\n &::after {\n right: 21px;\n }\n}\n\n/* Top & Bottom: Left-oriented carets */\n.Popover-message--top-left,\n.Popover-message--bottom-left {\n left: -9px;\n margin-left: 0;\n\n &::before,\n &::after {\n left: 24px;\n margin-left: 0;\n }\n\n &::after {\n left: 25px;\n }\n}\n\n/* Right- & Left-oriented carets */\n.Popover-message--right,\n.Popover-message--right-top,\n.Popover-message--right-bottom,\n.Popover-message--left,\n.Popover-message--left-top,\n.Popover-message--left-bottom {\n &::before,\n &::after {\n top: 50%;\n left: auto;\n margin-left: 0;\n border-bottom-color: transparent;\n }\n\n &::before {\n margin-top: -9px;\n }\n\n &::after {\n margin-top: -8px;\n }\n}\n\n/* Right-oriented carets */\n.Popover-message--right,\n.Popover-message--right-top,\n.Popover-message--right-bottom {\n &::before {\n right: -16px;\n border-left-color: var(--color-border-default);\n }\n\n &::after {\n right: -14px;\n border-left-color: var(--color-canvas-overlay);\n }\n}\n\n/* Left-oriented carets */\n.Popover-message--left,\n.Popover-message--left-top,\n.Popover-message--left-bottom {\n &::before {\n left: -16px;\n border-right-color: var(--color-border-default);\n }\n\n &::after {\n left: -14px;\n border-right-color: var(--color-canvas-overlay);\n }\n}\n\n/* Right & Left: Top-oriented carets */\n.Popover-message--right-top,\n.Popover-message--left-top {\n &::before,\n &::after {\n top: 24px;\n }\n}\n\n/* Right & Left: Bottom-oriented carets */\n.Popover-message--right-bottom,\n.Popover-message--left-bottom {\n &::before,\n &::after {\n top: auto;\n }\n\n &::before {\n bottom: 16px;\n }\n\n &::after {\n bottom: 17px;\n }\n}\n\n@media (min-width: 544px) {\n .Popover-message--large {\n min-width: 320px;\n }\n}\n\n/* Responsive Popover\n** For < md it will show full-width anchored to the bottom */\n\n@media (max-width: 767.98px) {\n .Popover {\n position: fixed;\n top: auto !important;\n right: 0 !important;\n bottom: 0 !important;\n left: 0 !important;\n }\n\n .Popover-message {\n top: auto;\n right: auto;\n bottom: auto;\n left: auto;\n width: auto !important;\n margin: var(--primer-stack-gap-condensed, 8px);\n }\n\n /* Increase tap area for touch input */\n .Popover-message > .btn-octicon {\n padding: var(--primer-control-medium-paddingInline-normal, 12px) !important;\n }\n\n /* Remove caret */\n .Popover-message::after,\n .Popover-message::before {\n display: none;\n }\n}\n"]}
1
+ {"version":3,"sources":["popover.pcss"],"names":[],"mappings":"AAEA,SACE,iBAAkB,CAClB,WACF,CAEA,iBAKE,4CAA6C,CAC7C,2EAA6E,CAC7E,mDAAqD,CAHrD,gBAAiB,CADjB,iBAAkB,CAFlB,iBAAkB,CAClB,WA6BF,CArBE,+CAKE,UAAW,CADX,oBAAqB,CADrB,QAAS,CADT,iBAIF,CAEA,wBAIE,sBAAgD,CAAhD,mDAAgD,CAFhD,gBAAiB,CADjB,SAIF,CAEA,uBAIE,sBAAgD,CAAhD,mDAAgD,CAFhD,gBAAiB,CADjB,SAIF,CAKA,mEAEE,YACF,CAOA,mNAGE,yBAAgC,CADhC,QAEF,CAEA,2GAEE,4CAA6C,CAD7C,YAEF,CAEA,wGAEE,4CAA6C,CAD7C,YAEF,CAIF,2DAGE,cAAe,CADf,UAgBF,CAbE,gJAEE,SAAU,CACV,aACF,CAEA,yEACE,UACF,CAEA,uEACE,UACF,CAIF,yDAEE,SAAU,CACV,aAWF,CATE,4IAEE,SAAU,CACV,aACF,CAEA,qEACE,SACF,CAUA,oZAKE,yBAAgC,CAFhC,SAAU,CACV,aAAc,CAFd,OAIF,CAEA,6MACE,eACF,CAEA,uMACE,eACF,CAOA,wGAEE,6CAA8C,CAD9C,WAEF,CAEA,qGAEE,6CAA8C,CAD9C,WAEF,CAOA,qGAEE,8CAA+C,CAD/C,UAEF,CAEA,kGAEE,8CAA+C,CAD/C,UAEF,CAMA,wIAEE,QACF,CAMA,oJAEE,QACF,CAEA,2EACE,WACF,CAEA,yEACE,WACF,CAGF,yBACE,wBACE,eACF,CACF,CAKA,4BACE,SAIE,kBAAoB,CACpB,gBAAkB,CAJlB,cAAe,CAEf,iBAAmB,CADnB,kBAIF,CAEA,iBAGE,WAAY,CACZ,SAAU,CAEV,4CAA8C,CAJ9C,UAAW,CADX,QAAS,CAIT,oBAEF,CAGA,8BACE,wEACF,CAGA,+CAEE,YACF,CACF","file":"popover.css","sourcesContent":["/* Popover */\n\n.Popover {\n position: absolute;\n z-index: 100;\n}\n\n.Popover-message {\n position: relative;\n width: 232px;\n margin-right: auto;\n margin-left: auto;\n background-color: var(--color-canvas-overlay);\n border: var(--primer-borderWidth-thin, 1px) solid var(--color-border-default);\n border-radius: var(--primer-borderRadius-medium, 6px);\n\n /* Carets */\n &::before,\n &::after {\n position: absolute;\n left: 50%;\n display: inline-block;\n content: '';\n }\n\n &::before {\n top: -16px;\n margin-left: -9px;\n border: 8px solid transparent;\n border-bottom-color: var(--color-border-default);\n }\n\n &::after {\n top: -14px;\n margin-left: -8px;\n border: 7px solid transparent;\n border-bottom-color: var(--color-canvas-overlay);\n }\n}\n\n/* No caret */\n.Popover-message--no-caret {\n &::before,\n &::after {\n display: none;\n }\n}\n\n/* Bottom-oriented carets */\n.Popover-message--bottom,\n.Popover-message--bottom-right,\n.Popover-message--bottom-left {\n &::before,\n &::after {\n top: auto;\n border-bottom-color: transparent;\n }\n\n &::before {\n bottom: -16px;\n border-top-color: var(--color-border-default);\n }\n\n &::after {\n bottom: -14px;\n border-top-color: var(--color-canvas-overlay);\n }\n}\n\n/* Top and Bottom: Right-oriented carets */\n.Popover-message--top-right,\n.Popover-message--bottom-right {\n right: -9px;\n margin-right: 0;\n\n &::before,\n &::after {\n left: auto;\n margin-left: 0;\n }\n\n &::before {\n right: 20px;\n }\n\n &::after {\n right: 21px;\n }\n}\n\n/* Top and Bottom: Left-oriented carets */\n.Popover-message--top-left,\n.Popover-message--bottom-left {\n left: -9px;\n margin-left: 0;\n\n &::before,\n &::after {\n left: 24px;\n margin-left: 0;\n }\n\n &::after {\n left: 25px;\n }\n}\n\n/* Right- and Left-oriented carets */\n.Popover-message--right,\n.Popover-message--right-top,\n.Popover-message--right-bottom,\n.Popover-message--left,\n.Popover-message--left-top,\n.Popover-message--left-bottom {\n &::before,\n &::after {\n top: 50%;\n left: auto;\n margin-left: 0;\n border-bottom-color: transparent;\n }\n\n &::before {\n margin-top: -9px;\n }\n\n &::after {\n margin-top: -8px;\n }\n}\n\n/* Right-oriented carets */\n.Popover-message--right,\n.Popover-message--right-top,\n.Popover-message--right-bottom {\n &::before {\n right: -16px;\n border-left-color: var(--color-border-default);\n }\n\n &::after {\n right: -14px;\n border-left-color: var(--color-canvas-overlay);\n }\n}\n\n/* Left-oriented carets */\n.Popover-message--left,\n.Popover-message--left-top,\n.Popover-message--left-bottom {\n &::before {\n left: -16px;\n border-right-color: var(--color-border-default);\n }\n\n &::after {\n left: -14px;\n border-right-color: var(--color-canvas-overlay);\n }\n}\n\n/* Right and Left: Top-oriented carets */\n.Popover-message--right-top,\n.Popover-message--left-top {\n &::before,\n &::after {\n top: 24px;\n }\n}\n\n/* Right and Left: Bottom-oriented carets */\n.Popover-message--right-bottom,\n.Popover-message--left-bottom {\n &::before,\n &::after {\n top: auto;\n }\n\n &::before {\n bottom: 16px;\n }\n\n &::after {\n bottom: 17px;\n }\n}\n\n@media (min-width: 544px) {\n .Popover-message--large {\n min-width: 320px;\n }\n}\n\n/* Responsive Popover\n** For < md it will show full-width anchored to the bottom */\n\n@media (max-width: 767.98px) {\n .Popover {\n position: fixed;\n top: auto !important;\n right: 0 !important;\n bottom: 0 !important;\n left: 0 !important;\n }\n\n .Popover-message {\n top: auto;\n right: auto;\n bottom: auto;\n left: auto;\n width: auto !important;\n margin: var(--primer-stack-gap-condensed, 8px);\n }\n\n /* Increase tap area for touch input */\n .Popover-message > .btn-octicon {\n padding: var(--primer-control-medium-paddingInline-normal, 12px) !important;\n }\n\n /* Remove caret */\n .Popover-message::after,\n .Popover-message::before {\n display: none;\n }\n}\n"]}
@@ -67,7 +67,7 @@
67
67
  }
68
68
  }
69
69
 
70
- /* Top & Bottom: Right-oriented carets */
70
+ /* Top and Bottom: Right-oriented carets */
71
71
  .Popover-message--top-right,
72
72
  .Popover-message--bottom-right {
73
73
  right: -9px;
@@ -88,7 +88,7 @@
88
88
  }
89
89
  }
90
90
 
91
- /* Top & Bottom: Left-oriented carets */
91
+ /* Top and Bottom: Left-oriented carets */
92
92
  .Popover-message--top-left,
93
93
  .Popover-message--bottom-left {
94
94
  left: -9px;
@@ -105,7 +105,7 @@
105
105
  }
106
106
  }
107
107
 
108
- /* Right- & Left-oriented carets */
108
+ /* Right- and Left-oriented carets */
109
109
  .Popover-message--right,
110
110
  .Popover-message--right-top,
111
111
  .Popover-message--right-bottom,
@@ -159,7 +159,7 @@
159
159
  }
160
160
  }
161
161
 
162
- /* Right & Left: Top-oriented carets */
162
+ /* Right and Left: Top-oriented carets */
163
163
  .Popover-message--right-top,
164
164
  .Popover-message--left-top {
165
165
  &::before,
@@ -168,7 +168,7 @@
168
168
  }
169
169
  }
170
170
 
171
- /* Right & Left: Bottom-oriented carets */
171
+ /* Right and Left: Bottom-oriented carets */
172
172
  .Popover-message--right-bottom,
173
173
  .Popover-message--left-bottom {
174
174
  &::before,
@@ -0,0 +1,160 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Primer
4
+ module Beta
5
+ # Formats a timestamp as a localized string or as relative text that auto-updates in the user's browser.
6
+ class RelativeTime < Primer::Component
7
+ status :beta
8
+
9
+ TENSE_DEFAULT = :auto
10
+ TENSE_OPTIONS = [TENSE_DEFAULT, :past, :future].freeze
11
+
12
+ FORMAT_DEFAULT = :auto
13
+ FORMAT_OPTIONS = [FORMAT_DEFAULT, :micro, :elapsed].freeze
14
+
15
+ SECOND_DEFAULT = nil
16
+ SECOND_MAPPINGS = {
17
+ SECOND_DEFAULT => nil,
18
+ :numeric => "numeric",
19
+ :two_digit => "2-digit"
20
+ }.freeze
21
+ SECOND_OPTIONS = SECOND_MAPPINGS.keys
22
+
23
+ MINUTE_DEFAULT = nil
24
+ MINUTE_MAPPINGS = {
25
+ MINUTE_DEFAULT => nil,
26
+ :numeric => "numeric",
27
+ :two_digit => "2-digit"
28
+ }.freeze
29
+ MINUTE_OPTIONS = MINUTE_MAPPINGS.keys
30
+
31
+ HOUR_DEFAULT = nil
32
+ HOUR_MAPPINGS = {
33
+ HOUR_DEFAULT => nil,
34
+ :numeric => "numeric",
35
+ :two_digit => "2-digit"
36
+ }.freeze
37
+ HOUR_OPTIONS = HOUR_MAPPINGS.keys
38
+
39
+ WEEKDAY_DEFAULT = nil
40
+ WEEKDAY_OPTIONS = [WEEKDAY_DEFAULT, :long, :short, :narrow].freeze
41
+
42
+ DAY_DEFAULT = nil
43
+ DAY_MAPPINGS = {
44
+ DAY_DEFAULT => nil,
45
+ :numeric => "numeric",
46
+ :two_digit => "2-digit"
47
+ }.freeze
48
+ DAY_OPTIONS = DAY_MAPPINGS.keys
49
+
50
+ MONTH_DEFAULT = nil
51
+ MONTH_MAPPINGS = {
52
+ DAY_DEFAULT => nil,
53
+ :numeric => "numeric",
54
+ :two_digit => "2-digit",
55
+ :short => "short",
56
+ :long => "long",
57
+ :narrow => "narrow"
58
+ }.freeze
59
+ MONTH_OPTIONS = MONTH_MAPPINGS.keys
60
+
61
+ YEAR_DEFAULT = nil
62
+ YEAR_MAPPINGS = {
63
+ DAY_DEFAULT => nil,
64
+ :numeric => "numeric",
65
+ :two_digit => "2-digit"
66
+ }.freeze
67
+ YEAR_OPTIONS = YEAR_MAPPINGS.keys
68
+
69
+ TIMEZONENAME_DEFAULT = nil
70
+ TIMEZONE_MAPPINGS = {
71
+ DAY_DEFAULT => nil,
72
+ :long => "long",
73
+ :short => "short",
74
+ :short_offset => "shortOffset",
75
+ :long_offset => "longOffset",
76
+ :short_generic => "shortGeneric",
77
+ :long_generic => "longGeneric"
78
+ }.freeze
79
+ TIMEZONENAME_OPTIONS = TIMEZONE_MAPPINGS.keys
80
+
81
+ PRECISION_DEFAULT = nil
82
+ PRECISION_OPTIONS = [PRECISION_DEFAULT, :second, :minute, :hour, :day, :month, :year].freeze
83
+
84
+ # @example Default
85
+ # <%= render(Primer::Beta::RelativeTime.new(datetime: Time.at(628232400))) %>
86
+ #
87
+ # @example Past Time
88
+ # <%= render(Primer::Beta::RelativeTime.new(datetime: Time.at(628232400), tense: :past)) %>
89
+ #
90
+ # @example Elapsed Time
91
+ # <%= render(Primer::Beta::RelativeTime.new(datetime: Time.at(628232400), format: :elapsed)) %>
92
+ #
93
+ # @param datetime [Time] The time to be formatted.
94
+ # @param tense [Symbol] Which tense to use. <%= one_of(Primer::Beta::RelativeTime::TENSE_OPTIONS) %>
95
+ # @param prefix [sring] What to prefix the relative ime display with.
96
+ # @param second [Symbol] What format seconds should take. <%= one_of(Primer::Beta::RelativeTime::SECOND_OPTIONS) %>
97
+ # @param minute [Symbol] What format minues should take. <%= one_of(Primer::Beta::RelativeTime::MINUTE_OPTIONS) %>
98
+ # @param hour [Symbol] What format hours should take. <%= one_of(Primer::Beta::RelativeTime::HOUR_OPTIONS) %>
99
+ # @param weekday [Symbol] What format weekdays should take. <%= one_of(Primer::Beta::RelativeTime::WEEKDAY_OPTIONS) %>
100
+ # @param day [Symbol] What format days should take. <%= one_of(Primer::Beta::RelativeTime::DAY_OPTIONS) %>
101
+ # @param month [Symbol] What format months should take. <%= one_of(Primer::Beta::RelativeTime::MONTH_OPTIONS) %>
102
+ # @param year [Symbol] What format years should take. <%= one_of(Primer::Beta::RelativeTime::YEAR_OPTIONS) %>
103
+ # @param time_zone_name [Symbol] What format the time zone should take. <%= one_of(Primer::Beta::RelativeTime::TIMEZONENAME_OPTIONS) %>
104
+ # @param threshold [string] The threshold at which relative time displays become absolute.
105
+ # @param precision [Symbol] The precision elapsed time should display. <%= one_of(Primer::Beta::RelativeTime::PRECISION_OPTIONS) %>
106
+ # @param format [Symbol] The format the display should take. <%= one_of(Primer::Beta::RelativeTime::FORMAT_OPTIONS) %>
107
+ # @param lang [string] The language to use.
108
+ # @param title [string] Provide a custom title to the element.
109
+ # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
110
+ def initialize(
111
+ datetime:,
112
+ tense: TENSE_DEFAULT,
113
+ prefix: nil,
114
+ second: SECOND_DEFAULT,
115
+ minute: MINUTE_DEFAULT,
116
+ hour: HOUR_DEFAULT,
117
+ weekday: WEEKDAY_DEFAULT,
118
+ day: DAY_DEFAULT,
119
+ month: MONTH_DEFAULT,
120
+ year: YEAR_DEFAULT,
121
+ time_zone_name: TIMEZONENAME_DEFAULT,
122
+ threshold: nil,
123
+ precision: PRECISION_DEFAULT,
124
+ format: nil,
125
+ lang: nil,
126
+ title: nil,
127
+ **system_arguments
128
+ )
129
+ @system_arguments = deny_tag_argument(**system_arguments)
130
+ @system_arguments[:tag] = "relative-time"
131
+ @system_arguments[:tense] = tense if tense.present?
132
+ @system_arguments[:prefix] = prefix if prefix.present?
133
+ @system_arguments[:second] = fetch_or_fallback(SECOND_OPTIONS, second, SECOND_DEFAULT) if second.present?
134
+ @system_arguments[:minute] = fetch_or_fallback(MINUTE_OPTIONS, minute, MINUTE_DEFAULT) if minute.present?
135
+ @system_arguments[:hour] = fetch_or_fallback(HOUR_OPTIONS, hour, HOUR_DEFAULT) if hour.present?
136
+ @system_arguments[:weekday] = fetch_or_fallback(WEEKDAY_OPTIONS, weekday, WEEKDAY_DEFAULT) if weekday.present?
137
+ @system_arguments[:day] = fetch_or_fallback(DAY_OPTIONS, day, DAY_DEFAULT) if day.present?
138
+ @system_arguments[:month] = fetch_or_fallback(MONTH_DEFAULT, month, MONTH_DEFAULT) if month.present?
139
+ @system_arguments[:year] = fetch_or_fallback(YEAR_OPTIONS, year, YEAR_DEFAULT) if year.present?
140
+ @system_arguments[:"time-zone-name"] = fetch_or_fallback(TIMEZONENAME_OPTIONS, time_zone_name, TIMEZONENAME_DEFAULT) if time_zone_name.present?
141
+ @system_arguments[:threshold] = threshold if threshold.present?
142
+ @system_arguments[:precision] = precision if precision.present?
143
+ @system_arguments[:title] = title if title.present?
144
+ @system_arguments[:lang] = lang if lang.present?
145
+ @system_arguments[:format] = fetch_or_fallback(FORMAT_OPTIONS, format, FORMAT_DEFAULT) if format.present?
146
+ if datetime.present? && datetime.respond_to?(:iso8601)
147
+ @datetime = datetime
148
+ @system_arguments[:datetime] = datetime.iso8601
149
+ elsif datetime.present?
150
+ @datetime = Time.iso8601 datetime
151
+ @system_arguments[:datetime] = @datetime
152
+ end
153
+ end
154
+
155
+ def call
156
+ render(Primer::BaseComponent.new(**@system_arguments).with_content(@datetime.strftime("%B %-d, %Y %H:%M")))
157
+ end
158
+ end
159
+ end
160
+ end
@@ -0,0 +1 @@
1
+ .btn{-webkit-appearance:none;appearance:none;border:var(--primer-borderWidth-thin,1px) solid;border-radius:var(--primer-borderRadius-medium,6px);cursor:pointer;display:inline-block;font-size:var(--primer-text-body-size-medium,14px);font-weight:var(--base-text-weight-medium,500);line-height:20px;padding:5px var(--primer-control-medium-paddingInline-spacious,16px);position:relative;-webkit-user-select:none;user-select:none;vertical-align:middle;white-space:nowrap}.btn:hover{text-decoration:none}.btn.disabled,.btn:disabled,.btn[aria-disabled=true]{cursor:default}.btn i{font-style:normal;font-weight:var(--base-text-weight-medium,500);opacity:.75}.btn .octicon{color:var(--color-fg-muted);margin-right:var(--primer-control-small-gap,4px);vertical-align:text-bottom}.btn .octicon:only-child{margin-right:0}.btn .Counter{background-color:var(--color-btn-counter-bg);color:inherit;margin-left:2px;text-shadow:none;vertical-align:top}.btn .dropdown-caret{margin-left:var(--primer-control-small-gap,4px);opacity:.8}.btn{background-color:var(--color-btn-bg);border-color:var(--color-btn-border);box-shadow:var(--color-btn-shadow),var(--color-btn-inset-shadow);color:var(--color-btn-text);transition:80ms cubic-bezier(.33,1,.68,1);transition-property:color,background-color,box-shadow,border-color}.btn [open]>.btn,.btn.hover,.btn:hover{background-color:var(--color-btn-hover-bg);border-color:var(--color-btn-hover-border);transition-duration:.1s}.btn:active{background-color:var(--color-btn-active-bg);border-color:var(--color-btn-active-border);transition:none}.btn.selected,.btn[aria-selected=true]{background-color:var(--color-btn-selected-bg);box-shadow:var(--color-primer-shadow-inset)}.btn.disabled,.btn[aria-disabled=true]{background-color:var(--color-btn-bg);border-color:var(--color-btn-border);color:var(--color-primer-fg-disabled)}.btn.disabled .octicon,.btn[aria-disabled=true] .octicon{color:var(--color-primer-fg-disabled)}.btn-primary{background-color:var(--color-btn-primary-bg);border-color:var(--color-btn-primary-border);box-shadow:var(--color-btn-primary-shadow),var(--color-btn-primary-inset-shadow);color:var(--color-btn-primary-text)}.btn-primary [open]>.btn-primary,.btn-primary.hover,.btn-primary:hover{background-color:var(--color-btn-primary-hover-bg);border-color:var(--color-btn-primary-hover-border)}.btn-primary:focus{box-shadow:inset 0 0 0 3px var(--color-fg-on-emphasis);outline:2px solid var(--color-accent-fg);outline-offset:-2px}.btn-primary:focus:not(:focus-visible){box-shadow:none;outline:1px solid #0000}.btn-primary:focus-visible{box-shadow:inset 0 0 0 3px var(--color-fg-on-emphasis);outline:2px solid var(--color-accent-fg);outline-offset:-2px}.btn-primary.selected,.btn-primary:active,.btn-primary[aria-selected=true]{background-color:var(--color-btn-primary-selected-bg);box-shadow:var(--color-btn-primary-selected-shadow)}.btn-primary.disabled,.btn-primary:disabled,.btn-primary[aria-disabled=true]{background-color:var(--color-btn-primary-disabled-bg);border-color:var(--color-btn-primary-disabled-border);color:var(--color-btn-primary-disabled-text)}.btn-primary.disabled .octicon,.btn-primary:disabled .octicon,.btn-primary[aria-disabled=true] .octicon{color:var(--color-btn-primary-disabled-text)}.btn-primary .Counter{background-color:var(--color-btn-primary-counter-bg);color:inherit}.btn-primary .octicon{color:var(--color-btn-primary-icon)}a.btn-primary:focus{box-shadow:inset 0 0 0 3px var(--color-fg-on-emphasis);outline:2px solid var(--color-accent-fg);outline-offset:-2px}a.btn-primary:focus:not(:focus-visible){box-shadow:none;outline:1px solid #0000}a.btn-primary:focus-visible{box-shadow:inset 0 0 0 3px var(--color-fg-on-emphasis);outline:2px solid var(--color-accent-fg);outline-offset:-2px}.btn-outline{color:var(--color-btn-outline-text)}.btn-outline [open]>.btn-outline,.btn-outline:hover{background-color:var(--color-btn-outline-hover-bg);border-color:var(--color-btn-outline-hover-border);box-shadow:var(--color-btn-outline-hover-shadow),var(--color-btn-outline-hover-inset-shadow);color:var(--color-btn-outline-hover-text)}:is(.btn-outline:hover,.btn-outline [open]>.btn-outline) .Counter{background-color:var(--color-btn-outline-hover-counter-bg)}:is(.btn-outline:hover,.btn-outline [open]>.btn-outline) .octicon{color:inherit}.btn-outline.selected,.btn-outline:active,.btn-outline[aria-selected=true]{background-color:var(--color-btn-outline-selected-bg);border-color:var(--color-btn-outline-selected-border);box-shadow:var(--color-btn-outline-selected-shadow);color:var(--color-btn-outline-selected-text)}.btn-outline.selected:focus,.btn-outline:active:focus,.btn-outline[aria-selected=true]:focus{box-shadow:inset 0 0 0 3px var(--color-fg-on-emphasis);outline:2px solid var(--color-accent-fg);outline-offset:-2px}.btn-outline.selected:focus:not(:focus-visible),.btn-outline:active:focus:not(:focus-visible),.btn-outline[aria-selected=true]:focus:not(:focus-visible){box-shadow:none;outline:1px solid #0000}.btn-outline.selected:focus-visible,.btn-outline:active:focus-visible,.btn-outline[aria-selected=true]:focus-visible{box-shadow:inset 0 0 0 3px var(--color-fg-on-emphasis);outline:2px solid var(--color-accent-fg);outline-offset:-2px}.btn-outline.disabled,.btn-outline:disabled,.btn-outline[aria-disabled=true]{background-color:var(--color-btn-outline-disabled-bg);border-color:var(--color-btn-border);box-shadow:none;color:var(--color-btn-outline-disabled-text)}.btn-outline.disabled .Counter,.btn-outline:disabled .Counter,.btn-outline[aria-disabled=true] .Counter{background-color:var(--color-btn-outline-disabled-counter-bg)}.btn-outline .Counter{background-color:var(--color-btn-outline-counter-bg);color:inherit}.btn-danger{color:var(--color-btn-danger-text)}.btn-danger .octicon{color:var(--color-btn-danger-icon)}.btn-danger [open]>.btn-danger,.btn-danger:hover{background-color:var(--color-btn-danger-hover-bg);border-color:var(--color-btn-danger-hover-border);box-shadow:var(--color-btn-danger-hover-shadow),var(--color-btn-danger-hover-inset-shadow);color:var(--color-btn-danger-hover-text)}:is(.btn-danger:hover,.btn-danger [open]>.btn-danger) .Counter{background-color:var(--color-btn-danger-hover-counter-bg)}:is(.btn-danger:hover,.btn-danger [open]>.btn-danger) .octicon{color:var(--color-btn-danger-hover-icon)}.btn-danger.selected,.btn-danger:active,.btn-danger[aria-selected=true]{background-color:var(--color-btn-danger-selected-bg);border-color:var(--color-btn-danger-selected-border);box-shadow:var(--color-btn-danger-selected-shadow);color:var(--color-btn-danger-selected-text)}.btn-danger.disabled,.btn-danger:disabled,.btn-danger[aria-disabled=true]{background-color:var(--color-btn-danger-disabled-bg);border-color:var(--color-btn-border);box-shadow:none;color:var(--color-btn-danger-disabled-text)}.btn-danger.disabled .Counter,.btn-danger:disabled .Counter,.btn-danger[aria-disabled=true] .Counter{background-color:var(--color-btn-danger-disabled-counter-bg)}.btn-danger.disabled .octicon,.btn-danger:disabled .octicon,.btn-danger[aria-disabled=true] .octicon{color:var(--color-btn-danger-disabled-text)}.btn-danger .Counter{background-color:var(--color-btn-danger-counter-bg);color:inherit}.btn-sm{font-size:var(--primer-text-body-size-small,12px);line-height:20px;padding:3px 12px}.btn-sm .octicon{vertical-align:text-top}.btn-large{border-radius:.5em;font-size:inherit;line-height:1.5;padding:.75em 1.5em}.btn-block{display:block;text-align:center;width:100%}.btn-link{-webkit-appearance:none;appearance:none;background-color:initial;border:0;color:var(--color-accent-fg);cursor:pointer;display:inline-block;font-size:inherit;padding:0;text-decoration:none;-webkit-user-select:none;user-select:none;white-space:nowrap}.btn-link:hover{text-decoration:underline}.btn-link:disabled,.btn-link:disabled:hover,.btn-link[aria-disabled=true],.btn-link[aria-disabled=true]:hover{color:var(--color-primer-fg-disabled);cursor:default}.btn-link:not(.dropdown-item):focus,.btn-link:not(.dropdown-item):focus-visible{border-radius:var(--primer-borderRadius-medium,6px);outline-offset:0}.btn-invisible{background-color:initial;border:0;border-radius:var(--primer-borderRadius-medium,6px);box-shadow:none;color:var(--color-accent-fg)}.btn-invisible.zeroclipboard-is-hover,.btn-invisible:hover{background-color:var(--color-btn-hover-bg);box-shadow:none;color:var(--color-accent-fg);outline:none}.btn-invisible.selected,.btn-invisible.zeroclipboard-is-active,.btn-invisible:active,.btn-invisible[aria-selected=true]{background:none;border-color:var(--color-btn-active-border);box-shadow:none;color:var(--color-accent-fg);outline:2px solid var(--color-accent-fg);outline-offset:-2px}.btn-invisible:active .btn-invisible.zeroclipboard-is-active{background-color:var(--color-btn-selected-bg)}.btn-invisible.disabled,.btn-invisible:disabled,.btn-invisible[aria-disabled=true]{background-color:initial;color:var(--color-primer-fg-disabled)}.btn-octicon{background:#0000;border:0;box-shadow:none;color:var(--color-fg-muted);display:inline-block;line-height:1;margin-left:5px;padding:5px;vertical-align:middle}.btn-octicon:hover{color:var(--color-accent-fg)}.btn-octicon:focus,.btn-octicon:focus-visible{border-radius:var(--primer-borderRadius-medium,6px)}.btn-octicon.disabled,.btn-octicon[aria-disabled=true]{color:var(--color-primer-fg-disabled);cursor:default}.btn-octicon.disabled:hover,.btn-octicon[aria-disabled=true]:hover{color:var(--color-primer-fg-disabled)}.btn-octicon-danger:hover{color:var(--color-danger-fg)}.close-button{background:#0000;border:0;color:var(--color-fg-muted);padding:0}.close-button:hover{color:var(--color-fg-default)}.close-button:active{box-shadow:none;outline:2px solid var(--color-accent-fg);outline-offset:-2px}.hidden-text-expander{display:block}.hidden-text-expander.inline{display:inline-block;line-height:0;margin-left:5px;position:relative;top:-1px}.ellipsis-expander,.hidden-text-expander a{background:var(--color-neutral-muted);border:0;border-radius:1px;color:var(--color-fg-default);display:inline-block;font-size:var(--primer-text-body-size-small,12px);font-weight:var(--base-text-weight-semibold,600);height:12px;line-height:6px;padding:0 5px 5px;text-decoration:none;vertical-align:middle}:is(.hidden-text-expander a,.ellipsis-expander):hover{background-color:var(--color-accent-muted);text-decoration:none}:is(.hidden-text-expander a,.ellipsis-expander):active{background-color:var(--color-accent-emphasis);color:var(--color-fg-on-emphasis)}.btn-with-count{border-bottom-right-radius:0;border-top-right-radius:0;float:left}.btn-with-count:focus{z-index:1}.social-count{background-color:var(--color-canvas-default);border:var(--primer-borderWidth-thin,1px) solid var(--color-btn-border);border-bottom-right-radius:var(--primer-borderRadius-medium,6px);border-left:0;border-top-right-radius:var(--primer-borderRadius-medium,6px);box-shadow:var(--color-shadow-small),var(--color-primer-shadow-highlight);color:var(--color-fg-default);float:left;font-size:var(--primer-text-body-size-small,12px);font-weight:var(--base-text-weight-semibold,600);line-height:20px;padding:3px 12px;position:relative;vertical-align:middle}.social-count:active,.social-count:hover{text-decoration:none}.social-count:hover{color:var(--color-accent-fg);cursor:pointer}
@@ -0,0 +1 @@
1
+ {"name":"button_component","selectors":[".btn",".btn:hover",".btn.disabled",".btn:disabled",".btn[aria-disabled=true]",".btn i",".btn .octicon",".btn .octicon:only-child",".btn .Counter",".btn .dropdown-caret",".btn [open]>.btn",".btn.hover",".btn:active",".btn.selected",".btn[aria-selected=true]",".btn.disabled .octicon",".btn[aria-disabled=true] .octicon",".btn-primary",".btn-primary [open]>.btn-primary",".btn-primary.hover",".btn-primary:hover",".btn-primary:focus",".btn-primary:focus:not(:focus-visible)",".btn-primary:focus-visible",".btn-primary.selected",".btn-primary:active",".btn-primary[aria-selected=true]",".btn-primary.disabled",".btn-primary:disabled",".btn-primary[aria-disabled=true]",".btn-primary.disabled .octicon",".btn-primary:disabled .octicon",".btn-primary[aria-disabled=true] .octicon",".btn-primary .Counter",".btn-primary .octicon","a.btn-primary:focus","a.btn-primary:focus:not(:focus-visible)","a.btn-primary:focus-visible",".btn-outline",".btn-outline [open]>.btn-outline",".btn-outline:hover",":is(.btn-outline:hover",".btn-outline [open]>.btn-outline) .Counter",".btn-outline [open]>.btn-outline) .octicon",".btn-outline.selected",".btn-outline:active",".btn-outline[aria-selected=true]",".btn-outline.selected:focus",".btn-outline:active:focus",".btn-outline[aria-selected=true]:focus",".btn-outline.selected:focus:not(:focus-visible)",".btn-outline:active:focus:not(:focus-visible)",".btn-outline[aria-selected=true]:focus:not(:focus-visible)",".btn-outline.selected:focus-visible",".btn-outline:active:focus-visible",".btn-outline[aria-selected=true]:focus-visible",".btn-outline.disabled",".btn-outline:disabled",".btn-outline[aria-disabled=true]",".btn-outline.disabled .Counter",".btn-outline:disabled .Counter",".btn-outline[aria-disabled=true] .Counter",".btn-outline .Counter",".btn-danger",".btn-danger .octicon",".btn-danger [open]>.btn-danger",".btn-danger:hover",":is(.btn-danger:hover",".btn-danger [open]>.btn-danger) .Counter",".btn-danger [open]>.btn-danger) .octicon",".btn-danger.selected",".btn-danger:active",".btn-danger[aria-selected=true]",".btn-danger.disabled",".btn-danger:disabled",".btn-danger[aria-disabled=true]",".btn-danger.disabled .Counter",".btn-danger:disabled .Counter",".btn-danger[aria-disabled=true] .Counter",".btn-danger.disabled .octicon",".btn-danger:disabled .octicon",".btn-danger[aria-disabled=true] .octicon",".btn-danger .Counter",".btn-sm",".btn-sm .octicon",".btn-large",".btn-block",".btn-link",".btn-link:hover",".btn-link:disabled",".btn-link:disabled:hover",".btn-link[aria-disabled=true]",".btn-link[aria-disabled=true]:hover",".btn-link:not(.dropdown-item):focus",".btn-link:not(.dropdown-item):focus-visible",".btn-invisible",".btn-invisible.zeroclipboard-is-hover",".btn-invisible:hover",".btn-invisible.selected",".btn-invisible.zeroclipboard-is-active",".btn-invisible:active",".btn-invisible[aria-selected=true]",".btn-invisible:active .btn-invisible.zeroclipboard-is-active",".btn-invisible.disabled",".btn-invisible:disabled",".btn-invisible[aria-disabled=true]",".btn-octicon",".btn-octicon:hover",".btn-octicon:focus",".btn-octicon:focus-visible",".btn-octicon.disabled",".btn-octicon[aria-disabled=true]",".btn-octicon.disabled:hover",".btn-octicon[aria-disabled=true]:hover",".btn-octicon-danger:hover",".close-button",".close-button:hover",".close-button:active",".hidden-text-expander",".hidden-text-expander.inline",".ellipsis-expander",".hidden-text-expander a",":is(.hidden-text-expander a",".ellipsis-expander):hover",".ellipsis-expander):active",".btn-with-count",".btn-with-count:focus",".social-count",".social-count:active",".social-count:hover"]}
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["button_component.pcss","../../../lib/postcss_mixins/focusOutlineOnEmphasis.pcss","../../../lib/postcss_mixins/focusOutline.pcss"],"names":[],"mappings":"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","file":"button_component.css","sourcesContent":["/* btn */\n\n/* Base button styles */\n.btn {\n position: relative;\n display: inline-block;\n padding: 5px var(--primer-control-medium-paddingInline-spacious, 16px);\n font-size: var(--primer-text-body-size-medium, 14px);\n font-weight: var(--base-text-weight-medium, 500);\n line-height: 20px; /* Specifically not inherit our `<body>` default */\n white-space: nowrap;\n vertical-align: middle;\n cursor: pointer;\n user-select: none;\n border: var(--primer-borderWidth-thin, 1px) solid;\n border-radius: var(--primer-borderRadius-medium, 6px);\n appearance: none; /* Corrects inability to style clickable `input` types in iOS. */\n\n &:hover {\n text-decoration: none;\n }\n\n &:disabled,\n &.disabled,\n &[aria-disabled='true'] {\n cursor: default;\n }\n\n & i {\n font-style: normal;\n font-weight: var(--base-text-weight-medium, 500);\n opacity: 0.75;\n }\n\n & .octicon {\n margin-right: var(--primer-control-small-gap, 4px);\n color: var(--color-fg-muted);\n vertical-align: text-bottom;\n\n &:only-child {\n margin-right: 0;\n }\n }\n\n & .Counter {\n margin-left: 2px;\n color: inherit;\n text-shadow: none;\n vertical-align: top;\n background-color: var(--color-btn-counter-bg);\n }\n\n & .dropdown-caret {\n margin-left: var(--primer-control-small-gap, 4px);\n opacity: 0.8;\n }\n\n /* Default button */\n\n color: var(--color-btn-text);\n background-color: var(--color-btn-bg);\n border-color: var(--color-btn-border);\n box-shadow: var(--color-btn-shadow), var(--color-btn-inset-shadow);\n transition: 80ms cubic-bezier(0.33, 1, 0.68, 1);\n transition-property: color, background-color, box-shadow, border-color;\n\n &:hover,\n &.hover,\n & [open] > & {\n background-color: var(--color-btn-hover-bg);\n border-color: var(--color-btn-hover-border);\n transition-duration: 0.1s;\n }\n\n &:active {\n background-color: var(--color-btn-active-bg);\n border-color: var(--color-btn-active-border);\n transition: none;\n }\n\n &.selected,\n &[aria-selected='true'] {\n background-color: var(--color-btn-selected-bg);\n box-shadow: var(--color-primer-shadow-inset);\n }\n\n &.disabled,\n &[aria-disabled='true'] {\n color: var(--color-primer-fg-disabled);\n background-color: var(--color-btn-bg);\n border-color: var(--color-btn-border);\n\n & .octicon {\n color: var(--color-primer-fg-disabled);\n }\n }\n}\n\n/* Primary button */\n\n.btn-primary {\n color: var(--color-btn-primary-text);\n background-color: var(--color-btn-primary-bg);\n border-color: var(--color-btn-primary-border);\n box-shadow: var(--color-btn-primary-shadow), var(--color-btn-primary-inset-shadow);\n\n &:hover,\n &.hover,\n & [open] > & {\n background-color: var(--color-btn-primary-hover-bg);\n border-color: var(--color-btn-primary-hover-border);\n }\n\n /* fallback :focus state */\n &:focus {\n @mixin focusOutlineOnEmphasis;\n\n /* remove fallback :focus if :focus-visible is supported */\n &:not(:focus-visible) {\n outline: solid 1px transparent;\n box-shadow: none;\n }\n }\n\n /* default focus state */\n &:focus-visible {\n @mixin focusOutlineOnEmphasis;\n }\n\n &:active,\n &.selected,\n &[aria-selected='true'] {\n background-color: var(--color-btn-primary-selected-bg);\n box-shadow: var(--color-btn-primary-selected-shadow);\n }\n\n &:disabled,\n &.disabled,\n &[aria-disabled='true'] {\n color: var(--color-btn-primary-disabled-text);\n background-color: var(--color-btn-primary-disabled-bg);\n border-color: var(--color-btn-primary-disabled-border);\n\n & .octicon {\n color: var(--color-btn-primary-disabled-text);\n }\n }\n\n & .Counter {\n color: inherit;\n background-color: var(--color-btn-primary-counter-bg);\n }\n\n & .octicon {\n color: var(--color-btn-primary-icon);\n }\n}\n\n/* ensure links styled as button primary gets proper focus style */\na.btn-primary {\n /* fallback :focus state */\n &:focus {\n @mixin focusOutlineOnEmphasis;\n\n /* remove fallback :focus if :focus-visible is supported */\n &:not(:focus-visible) {\n outline: solid 1px transparent;\n box-shadow: none;\n }\n }\n\n /* default focus state */\n &:focus-visible {\n @mixin focusOutlineOnEmphasis;\n }\n}\n\n/* Outline button */\n\n.btn-outline {\n color: var(--color-btn-outline-text);\n\n &:hover,\n & [open] > & {\n color: var(--color-btn-outline-hover-text);\n background-color: var(--color-btn-outline-hover-bg);\n border-color: var(--color-btn-outline-hover-border);\n box-shadow: var(--color-btn-outline-hover-shadow), var(--color-btn-outline-hover-inset-shadow);\n\n & .Counter {\n background-color: var(--color-btn-outline-hover-counter-bg);\n }\n\n & .octicon {\n color: inherit;\n }\n }\n\n &:active,\n &.selected,\n &[aria-selected='true'] {\n color: var(--color-btn-outline-selected-text);\n background-color: var(--color-btn-outline-selected-bg);\n border-color: var(--color-btn-outline-selected-border);\n box-shadow: var(--color-btn-outline-selected-shadow);\n\n /* fallback :focus state */\n &:focus {\n @mixin focusOutlineOnEmphasis;\n\n /* remove fallback :focus if :focus-visible is supported */\n &:not(:focus-visible) {\n outline: solid 1px transparent;\n box-shadow: none;\n }\n }\n\n /* default focus state */\n &:focus-visible {\n @mixin focusOutlineOnEmphasis;\n }\n }\n\n &:disabled,\n &.disabled,\n &[aria-disabled='true'] {\n color: var(--color-btn-outline-disabled-text);\n background-color: var(--color-btn-outline-disabled-bg);\n border-color: var(--color-btn-border);\n box-shadow: none;\n\n & .Counter {\n background-color: var(--color-btn-outline-disabled-counter-bg);\n }\n }\n\n & .Counter {\n color: inherit;\n background-color: var(--color-btn-outline-counter-bg);\n }\n}\n\n/* Danger button */\n\n.btn-danger {\n color: var(--color-btn-danger-text);\n\n & .octicon {\n color: var(--color-btn-danger-icon);\n }\n\n &:hover,\n & [open] > & {\n color: var(--color-btn-danger-hover-text);\n background-color: var(--color-btn-danger-hover-bg);\n border-color: var(--color-btn-danger-hover-border);\n box-shadow: var(--color-btn-danger-hover-shadow), var(--color-btn-danger-hover-inset-shadow);\n\n & .Counter {\n background-color: var(--color-btn-danger-hover-counter-bg);\n }\n\n & .octicon {\n color: var(--color-btn-danger-hover-icon);\n }\n }\n\n &:active,\n &.selected,\n &[aria-selected='true'] {\n color: var(--color-btn-danger-selected-text);\n background-color: var(--color-btn-danger-selected-bg);\n border-color: var(--color-btn-danger-selected-border);\n box-shadow: var(--color-btn-danger-selected-shadow);\n }\n\n &:disabled,\n &.disabled,\n &[aria-disabled='true'] {\n color: var(--color-btn-danger-disabled-text);\n background-color: var(--color-btn-danger-disabled-bg);\n border-color: var(--color-btn-border);\n box-shadow: none;\n\n & .Counter {\n background-color: var(--color-btn-danger-disabled-counter-bg);\n }\n\n & .octicon {\n color: var(--color-btn-danger-disabled-text);\n }\n }\n\n & .Counter {\n color: inherit;\n background-color: var(--color-btn-danger-counter-bg);\n }\n}\n\n/* Sizes\n**\n** Tweak `line-height` to make them smaller. */\n.btn-sm {\n padding: 3px 12px;\n font-size: var(--primer-text-body-size-small, 12px);\n line-height: 20px;\n\n & .octicon {\n vertical-align: text-top;\n }\n}\n\n/* Large button adds more padding around text. Use font-size utils to increase font-size..\n** e.g, <p class=\"text-gamma\"><button class=\"btn btn-large btn-primary\" type=\"button\">Big green button</button></p> */\n.btn-large {\n padding: 0.75em 1.5em;\n font-size: inherit;\n line-height: 1.5;\n border-radius: 0.5em;\n}\n\n/* Full-width button\n**\n** These buttons expand to the full width of their parent container */\n.btn-block {\n display: block;\n width: 100%;\n text-align: center;\n}\n\n\n/* Link-like buttons\n**\n** This class is for styling <button> and <input> elements to look like links */\n\n.btn-link {\n display: inline-block;\n padding: 0;\n font-size: inherit;\n color: var(--color-accent-fg);\n text-decoration: none;\n white-space: nowrap;\n cursor: pointer;\n user-select: none;\n background-color: transparent;\n border: 0;\n appearance: none; /* Corrects inability to style clickable `input` types in iOS. */\n\n &:hover {\n text-decoration: underline;\n }\n\n &:disabled,\n &[aria-disabled='true'] {\n &,\n &:hover {\n color: var(--color-primer-fg-disabled);\n cursor: default;\n }\n }\n\n &:not(.dropdown-item) {\n &:focus,\n &:focus-visible {\n border-radius: var(--primer-borderRadius-medium, 6px);\n outline-offset: 0;\n }\n }\n}\n\n/* Invisible button\n**\n** Typically used as a \"cancel\" button next to a .btn */\n\n.btn-invisible {\n color: var(--color-accent-fg);\n background-color: transparent; /* Reset default gradient backgrounds and colors */\n border: 0;\n border-radius: var(--primer-borderRadius-medium, 6px);\n box-shadow: none;\n\n &:hover,\n &.zeroclipboard-is-hover {\n color: var(--color-accent-fg);\n background-color: var(--color-btn-hover-bg);\n outline: none;\n box-shadow: none;\n }\n\n &:active,\n &.selected,\n &[aria-selected='true'],\n &.zeroclipboard-is-active {\n color: var(--color-accent-fg);\n background: none;\n border-color: var(--color-btn-active-border);\n\n @mixin focusOutline;\n }\n\n &:active &.zeroclipboard-is-active {\n background-color: var(--color-btn-selected-bg);\n }\n\n &:disabled,\n &.disabled,\n &[aria-disabled='true'] {\n color: var(--color-primer-fg-disabled);\n background-color: transparent;\n }\n}\n\n/* Octicon button\n**\n** Icon-only buttons */\n\n.btn-octicon {\n display: inline-block;\n padding: 5px;\n margin-left: 5px;\n line-height: 1;\n color: var(--color-fg-muted);\n vertical-align: middle;\n\n /* For `<button>` elements */\n background: transparent;\n border: 0;\n box-shadow: none;\n\n &:hover {\n color: var(--color-accent-fg);\n }\n\n &:focus,\n &:focus-visible {\n border-radius: var(--primer-borderRadius-medium, 6px);\n }\n\n &.disabled,\n &[aria-disabled='true'] {\n color: var(--color-primer-fg-disabled);\n cursor: default;\n\n &:hover {\n color: var(--color-primer-fg-disabled);\n }\n }\n}\n\n.btn-octicon-danger:hover {\n color: var(--color-danger-fg);\n}\n\n/* Close button\n**\n** Typically used with an octicon-x */\n\n.close-button {\n padding: 0;\n color: var(--color-fg-muted);\n background: transparent;\n border: 0;\n\n &:hover {\n color: var(--color-fg-default);\n }\n\n &:active {\n @mixin focusOutline;\n }\n}\n\n/* Hidden text button\n**\n** Use `.hidden-text-expander` to indicate and expand hidden text. */\n\n.hidden-text-expander {\n display: block;\n\n &.inline {\n position: relative;\n top: -1px;\n display: inline-block;\n margin-left: 5px;\n line-height: 0;\n }\n}\n\n.hidden-text-expander a,\n.ellipsis-expander {\n display: inline-block;\n height: 12px;\n padding: 0 5px 5px;\n font-size: var(--primer-text-body-size-small, 12px);\n font-weight: var(--base-text-weight-semibold, 600);\n line-height: 6px;\n color: var(--color-fg-default);\n text-decoration: none;\n vertical-align: middle;\n background: var(--color-neutral-muted);\n border: 0;\n border-radius: 1px;\n\n &:hover {\n text-decoration: none;\n background-color: var(--color-accent-muted);\n }\n\n &:active {\n color: var(--color-fg-on-emphasis);\n background-color: var(--color-accent-emphasis);\n }\n}\n\n/* Social button count\n** TODO: Deprecate? Use BtnGroup instead? */\n\n.btn-with-count {\n float: left;\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n\n &:focus {\n z-index: 1;\n }\n}\n\n/* Social count bubble\n**\n** A container that is used for social bubbles counts. */\n\n.social-count {\n position: relative;\n float: left;\n padding: 3px 12px;\n font-size: var(--primer-text-body-size-small, 12px);\n font-weight: var(--base-text-weight-semibold, 600);\n line-height: 20px;\n color: var(--color-fg-default);\n vertical-align: middle;\n background-color: var(--color-canvas-default);\n border: var(--primer-borderWidth-thin, 1px) solid var(--color-btn-border);\n border-left: 0;\n border-top-right-radius: var(--primer-borderRadius-medium, 6px);\n border-bottom-right-radius: var(--primer-borderRadius-medium, 6px);\n box-shadow: var(--color-shadow-small), var(--color-primer-shadow-highlight);\n\n &:hover,\n &:active {\n text-decoration: none;\n }\n\n &:hover {\n color: var(--color-accent-fg);\n cursor: pointer;\n }\n}\n","/* outline with fg box-shadow for buttons */\n@define-mixin focusOutlineOnEmphasis $outlineOffset: -2px, $outlineColor: var(--color-accent-fg) {\n outline: 2px solid $outlineColor;\n outline-offset: $outlineOffset;\n box-shadow: inset 0 0 0 3px var(--color-fg-on-emphasis);\n}\n","@define-mixin focusOutline $outlineOffset: -2px, $outlineColor: var(--color-accent-fg) {\n outline: 2px solid $outlineColor;\n outline-offset: $outlineOffset;\n box-shadow: none;\n}\n"]}