primer_view_components 0.0.73 → 0.0.74

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 360520e82ed3b675176993d07d7cd293fc7ac094580c8409391aa640a3dc2659
4
- data.tar.gz: 5443e46dc1ee9e900ec891b202a65e9fd6542e9eb3e190fb5b71ac29359f650b
3
+ metadata.gz: 99efb2e6dc8f3d4a87a4b2f2ef15f3c03297fc5e055fd9c2f4633990206dd788
4
+ data.tar.gz: 6d3ee3c23ccc62b9185c4723846a14351a6ed2739da99b6063b471e38041342c
5
5
  SHA512:
6
- metadata.gz: 34fe9c8220f17ae7f8e9f5816c3ac0f88d7edcf255d08fc838ebd206cba9f1986c2da8a6d6ab1b251ae47edd1477b308ed4d0595ea3e397edc4042a5d50fd7f7
7
- data.tar.gz: 6897b304a345d5e4c05b321a786f251ffabba4dd6d5578f3e8604a72d0b3ab81817de5d8bf77416853cd1b718833024e53da5c4d4b53fa178fb30d1b061c3d55
6
+ metadata.gz: 6831cfbc1bc45bfc116d08e9062a571333c6fe0a762ba6d69314fef1e3307036c70bcae48d7586b48adb4d25c5ac60a748c2b205f326181f8506d612aa851f8f
7
+ data.tar.gz: a5a530e666be4b7f88bf07227e1f2354e1f14c4f12c8ce29d59f01b9b5c9920bfdeb8887815aa8cad1db22d4aa1d7a6a3d3c13e50a8ce8ac64969eb79915be64
data/CHANGELOG.md CHANGED
@@ -1,34 +1,14 @@
1
1
  # CHANGELOG
2
2
 
3
- <!--
4
- Authoring changelog entries
3
+ ## 0.0.74
5
4
 
6
- This file holds all the changes made in previous versions of Primer View Components and the ones coming to the next version.
7
- To add yours, you need to find in which category to write it under the `main` section. `Main` is the first section on top of the document.
8
- There are six categories currently in use, `New`, `Updates`, `Bug fixes`, `Breaking changes`, `Deprecations` and `Misc`.
5
+ ### Patch Changes
9
6
 
10
- - New
11
- Category for new components, system behaviours, options and arguments changes
7
+ - [#1150](https://github.com/primer/view_components/pull/1150) [`36702a8e`](https://github.com/primer/view_components/commit/36702a8e621766772fe09d80de74c4debe8950fd) Thanks [@jonrohan](https://github.com/jonrohan)! - Adding changesets workflow to the repository for managing releases.
12
8
 
13
- - Updates
14
- Every non-breaking change to the source code go there.
9
+ * [#1153](https://github.com/primer/view_components/pull/1153) [`8b21a680`](https://github.com/primer/view_components/commit/8b21a6808f5a9b18bd8b436b07b5b8b84b5a7397) Thanks [@camertron](https://github.com/camertron)! - Add a linter for calls to super in templates
15
10
 
16
- - Bug Fixes
17
- Non-breaking bug fixes to existing code.
18
-
19
- - Breaking Changes
20
- The category for changes creating incompatibilities to code written with previous versions.
21
- It includes any changes to components name, signature and behaviour. Also, include removing tags options or changing file location.
22
- If you are not sure you made breaking changes, ask us in your pull request.
23
-
24
- - Deprecations
25
- For changes that explicitly deprecate part of the code base.
26
-
27
- - Misc
28
- The category for changes related to documentation, testing and tooling. Also, for pull requests that can't fit in other sections.
29
- -->
30
-
31
- ## main
11
+ - [#1141](https://github.com/primer/view_components/pull/1141) [`300f79a7`](https://github.com/primer/view_components/commit/300f79a762c71397de90f8d1cada529b9e9d63b6) Thanks [@maxbeizer](https://github.com/maxbeizer)! - AutoComplete component does not apply stacked label class if the label is not visible
32
12
 
33
13
  ## 0.0.73
34
14
 
@@ -36,7 +16,7 @@ The category for changes related to documentation, testing and tooling. Also, fo
36
16
 
37
17
  - Add conditional check for shadow root to avoid errors.
38
18
 
39
- _Kate Higa_
19
+ _Kate Higa_
40
20
 
41
21
  ## 0.0.72
42
22
 
@@ -45,25 +25,25 @@ The category for changes related to documentation, testing and tooling. Also, fo
45
25
  - Fix tooltip arrow being off-centered for `s` and `n`.
46
26
  - Revert tooltip arrow offset for `sw`, `se`, `nw`, and `ne`.
47
27
 
48
- _Kate Higa_
28
+ _Kate Higa_
49
29
 
50
30
  ### Misc
51
31
 
52
32
  - Adding [lookbook](https://github.com/allmarkedup/lookbook) dev server to the project.
53
33
 
54
- _Jon Rohan_
34
+ _Jon Rohan_
55
35
 
56
36
  - Bump @primer/behaviors and remove dead code.
57
37
 
58
- _Kate Higa_
38
+ _Kate Higa_
59
39
 
60
40
  - Enable `eslint-plugin-custom-elements` linting rulesets.
61
41
 
62
- _Kate Higa_, _Kristján Oddsson_
42
+ _Kate Higa_, _Kristján Oddsson_
63
43
 
64
44
  - Introduce `DeprecatedComponents` rubocop rule.
65
45
 
66
- _Kate Higa_
46
+ _Kate Higa_
67
47
 
68
48
  - Fix alphabetization of components in docs.
69
49
 
@@ -96,7 +76,7 @@ The category for changes related to documentation, testing and tooling. Also, fo
96
76
 
97
77
  - Add responsive values for `text_align` system argument
98
78
 
99
- _Lukas Spieß_
79
+ _Lukas Spieß_
100
80
 
101
81
  ## 0.0.70
102
82
 
@@ -104,25 +84,25 @@ The category for changes related to documentation, testing and tooling. Also, fo
104
84
 
105
85
  - Add `Tooltip` support to `Button`.
106
86
 
107
- _Hector Garcia_
87
+ _Hector Garcia_
108
88
 
109
89
  - Add `Tooltip` support to `Link`.
110
90
 
111
- _Hector Garcia_
91
+ _Hector Garcia_
112
92
 
113
93
  ### Updates
114
94
 
115
95
  - Bumps @primer/css to 19.7.1
116
- _Kate Higa_
96
+ _Kate Higa_
117
97
 
118
98
  - Bumps auto-complete package to 3.1.0
119
99
  - Updates AutoComplete API with optional clear button, restricted icon, and other argument restrictions
120
100
 
121
- _Lindsey Wild_, _Kate Higa_, _Owen Niblock_
101
+ _Lindsey Wild_, _Kate Higa_, _Owen Niblock_
122
102
 
123
103
  - Check for the `gh` CLI tool in release scripts.
124
104
 
125
- _Cameron Dutro_
105
+ _Cameron Dutro_
126
106
 
127
107
  ### Bug Fixes
128
108
 
@@ -140,27 +120,27 @@ The category for changes related to documentation, testing and tooling. Also, fo
140
120
 
141
121
  - Add ability to attach custom CSS classes to items added to `Truncate` components.
142
122
 
143
- _Cameron Dutro_
123
+ _Cameron Dutro_
144
124
 
145
125
  - Add `Primer::Alpha::Tooltip` component
146
126
 
147
- _Kate Higa_, _Kristján Oddsson_
127
+ _Kate Higa_, _Kristján Oddsson_
148
128
 
149
129
  ### Breaking Changes
150
130
 
151
131
  - Module for [script/update-statuses-project.rb](script/update-statuses-project.rb) changed to `GitHub`
152
132
 
153
- _Josh Soref_
133
+ _Josh Soref_
154
134
 
155
135
  ### Misc
156
136
 
157
137
  - Spelling fixes
158
138
 
159
- _Josh Soref_
139
+ _Josh Soref_
160
140
 
161
141
  - Bump view_component in Gemfile.lock files
162
142
 
163
- _Cameron Dutro_
143
+ _Cameron Dutro_
164
144
 
165
145
  - Remove markdown file mistakenly checked in.
166
146
 
@@ -174,7 +154,7 @@ The category for changes related to documentation, testing and tooling. Also, fo
174
154
 
175
155
  - Fix missing @primer/components dependency.
176
156
 
177
- _Hector Garcia_
157
+ _Hector Garcia_
178
158
 
179
159
  ## 0.0.68
180
160
 
@@ -182,34 +162,34 @@ The category for changes related to documentation, testing and tooling. Also, fo
182
162
 
183
163
  - Add accessible labels to Search AutoComplete when provided with an icon.
184
164
 
185
- _Andri Alexandrou_
165
+ _Andri Alexandrou_
186
166
 
187
167
  - Restricts children for AutoComplete API to prevent accessibility violations and misuse
188
168
 
189
- _Lindsey Wild_
169
+ _Lindsey Wild_
190
170
 
191
171
  - Migrate from Heroku to Azure for the Rails storybook server.
192
172
  - Build storybook static assets into Docker image.
193
173
 
194
- _Cameron Dutro_
174
+ _Cameron Dutro_
195
175
 
196
176
  - Remove CSS utilities from Blankslate
197
177
 
198
- _Hector Garcia_
178
+ _Hector Garcia_
199
179
 
200
180
  - Improve last example on the PopoverComponent docs
201
181
 
202
- _Hector Garcia_
182
+ _Hector Garcia_
203
183
 
204
184
  ### Bug Fixes
205
185
 
206
186
  - Fix live reloading during local docs development.
207
187
 
208
- _Cameron Dutro_
188
+ _Cameron Dutro_
209
189
 
210
190
  - Fix sequence of content in Subhead.
211
191
 
212
- _Hector Garcia_
192
+ _Hector Garcia_
213
193
 
214
194
  ### Deprecations
215
195
 
@@ -235,7 +215,7 @@ The category for changes related to documentation, testing and tooling. Also, fo
235
215
 
236
216
  - Updating octicons to `> 16`
237
217
 
238
- _Jon Rohan_
218
+ _Jon Rohan_
239
219
 
240
220
  ## 0.0.66
241
221
 
@@ -255,7 +235,7 @@ The category for changes related to documentation, testing and tooling. Also, fo
255
235
 
256
236
  - Optimize logic for converting class names into args
257
237
 
258
- *Josh Klina*
238
+ _Josh Klina_
259
239
 
260
240
  ### Deprecations
261
241
 
@@ -56,7 +56,7 @@ class ToolTipElement extends HTMLElement {
56
56
  white-space: normal;
57
57
  width: max-content;
58
58
  }
59
-
59
+
60
60
  :host:before{
61
61
  position: absolute;
62
62
  z-index: 1000001;
@@ -65,7 +65,7 @@ class ToolTipElement extends HTMLElement {
65
65
  border: 6px solid transparent;
66
66
  opacity: 0
67
67
  }
68
-
68
+
69
69
  @keyframes tooltip-appear {
70
70
  from {
71
71
  opacity: 0
@@ -74,7 +74,7 @@ class ToolTipElement extends HTMLElement {
74
74
  opacity: 1
75
75
  }
76
76
  }
77
-
77
+
78
78
  :host:after{
79
79
  position: absolute;
80
80
  display: block;
@@ -83,7 +83,7 @@ class ToolTipElement extends HTMLElement {
83
83
  height: 12px;
84
84
  content: ""
85
85
  }
86
-
86
+
87
87
  :host(.${TOOLTIP_OPEN_CLASS}),
88
88
  :host(.${TOOLTIP_OPEN_CLASS}):before {
89
89
  animation-name: tooltip-appear;
@@ -92,7 +92,7 @@ class ToolTipElement extends HTMLElement {
92
92
  animation-timing-function: ease-in;
93
93
  animation-delay: .4s
94
94
  }
95
-
95
+
96
96
  :host(.tooltip-s):before,
97
97
  :host(.tooltip-n):before {
98
98
  right: 50%;
@@ -105,38 +105,38 @@ class ToolTipElement extends HTMLElement {
105
105
  bottom: 100%;
106
106
  border-bottom-color: var(--color-neutral-emphasis-plus)
107
107
  }
108
-
108
+
109
109
  :host(.tooltip-s):after,
110
110
  :host(.tooltip-se):after,
111
111
  :host(.tooltip-sw):after {
112
112
  bottom: 100%
113
113
  }
114
-
114
+
115
115
  :host(.tooltip-n):before,
116
116
  :host(.tooltip-ne):before,
117
117
  :host(.tooltip-nw):before {
118
118
  top: 100%;
119
119
  border-top-color: var(--color-neutral-emphasis-plus)
120
120
  }
121
-
121
+
122
122
  :host(.tooltip-n):after,
123
123
  :host(.tooltip-ne):after,
124
124
  :host(.tooltip-nw):after {
125
125
  top: 100%
126
126
  }
127
-
127
+
128
128
  :host(.tooltip-se):before,
129
129
  :host(.tooltip-ne):before {
130
130
  left: 0;
131
131
  margin-left: ${TOOLTIP_ARROW_EDGE_OFFSET}px;
132
132
  }
133
-
133
+
134
134
  :host(.tooltip-sw):before,
135
135
  :host(.tooltip-nw):before {
136
136
  right: 0;
137
137
  margin-right: ${TOOLTIP_ARROW_EDGE_OFFSET}px;
138
138
  }
139
-
139
+
140
140
  :host(.tooltip-w):before {
141
141
  top: 50%;
142
142
  bottom: 50%;
@@ -144,7 +144,7 @@ class ToolTipElement extends HTMLElement {
144
144
  margin-top: -6px;
145
145
  border-left-color: var(--color-neutral-emphasis-plus)
146
146
  }
147
-
147
+
148
148
  :host(.tooltip-e):before {
149
149
  top: 50%;
150
150
  right: 100%;
@@ -1,3 +1,4 @@
1
+ // eslint-disable-next-line prettier/prettier
1
2
  import type {AnchorAlignment, AnchorSide} from '@primer/behaviors'
2
3
  import {getAnchoredPosition} from '@primer/behaviors'
3
4
 
@@ -42,7 +43,7 @@ class ToolTipElement extends HTMLElement {
42
43
  white-space: normal;
43
44
  width: max-content;
44
45
  }
45
-
46
+
46
47
  :host:before{
47
48
  position: absolute;
48
49
  z-index: 1000001;
@@ -51,7 +52,7 @@ class ToolTipElement extends HTMLElement {
51
52
  border: 6px solid transparent;
52
53
  opacity: 0
53
54
  }
54
-
55
+
55
56
  @keyframes tooltip-appear {
56
57
  from {
57
58
  opacity: 0
@@ -60,7 +61,7 @@ class ToolTipElement extends HTMLElement {
60
61
  opacity: 1
61
62
  }
62
63
  }
63
-
64
+
64
65
  :host:after{
65
66
  position: absolute;
66
67
  display: block;
@@ -69,7 +70,7 @@ class ToolTipElement extends HTMLElement {
69
70
  height: 12px;
70
71
  content: ""
71
72
  }
72
-
73
+
73
74
  :host(.${TOOLTIP_OPEN_CLASS}),
74
75
  :host(.${TOOLTIP_OPEN_CLASS}):before {
75
76
  animation-name: tooltip-appear;
@@ -78,7 +79,7 @@ class ToolTipElement extends HTMLElement {
78
79
  animation-timing-function: ease-in;
79
80
  animation-delay: .4s
80
81
  }
81
-
82
+
82
83
  :host(.tooltip-s):before,
83
84
  :host(.tooltip-n):before {
84
85
  right: 50%;
@@ -91,38 +92,38 @@ class ToolTipElement extends HTMLElement {
91
92
  bottom: 100%;
92
93
  border-bottom-color: var(--color-neutral-emphasis-plus)
93
94
  }
94
-
95
+
95
96
  :host(.tooltip-s):after,
96
97
  :host(.tooltip-se):after,
97
98
  :host(.tooltip-sw):after {
98
99
  bottom: 100%
99
100
  }
100
-
101
+
101
102
  :host(.tooltip-n):before,
102
103
  :host(.tooltip-ne):before,
103
104
  :host(.tooltip-nw):before {
104
105
  top: 100%;
105
106
  border-top-color: var(--color-neutral-emphasis-plus)
106
107
  }
107
-
108
+
108
109
  :host(.tooltip-n):after,
109
110
  :host(.tooltip-ne):after,
110
111
  :host(.tooltip-nw):after {
111
112
  top: 100%
112
113
  }
113
-
114
+
114
115
  :host(.tooltip-se):before,
115
116
  :host(.tooltip-ne):before {
116
117
  left: 0;
117
118
  margin-left: ${TOOLTIP_ARROW_EDGE_OFFSET}px;
118
119
  }
119
-
120
+
120
121
  :host(.tooltip-sw):before,
121
122
  :host(.tooltip-nw):before {
122
123
  right: 0;
123
124
  margin-right: ${TOOLTIP_ARROW_EDGE_OFFSET}px;
124
125
  }
125
-
126
+
126
127
  :host(.tooltip-w):before {
127
128
  top: 50%;
128
129
  bottom: 50%;
@@ -130,7 +131,7 @@ class ToolTipElement extends HTMLElement {
130
131
  margin-top: -6px;
131
132
  border-left-color: var(--color-neutral-emphasis-plus)
132
133
  }
133
-
134
+
134
135
  :host(.tooltip-e):before {
135
136
  top: 50%;
136
137
  right: 100%;
@@ -131,7 +131,7 @@ module Primer
131
131
  @with_icon = with_icon
132
132
  @is_clearable = is_clearable
133
133
 
134
- @label_classes = is_label_inline ? "autocomplete-label-inline" : "autocomplete-label-stacked"
134
+ @label_classes = label_classes(is_label_visible: is_label_visible, is_label_inline: is_label_inline)
135
135
  @system_arguments = deny_tag_argument(**system_arguments)
136
136
  @system_arguments[:tag] = "auto-complete"
137
137
  @system_arguments[:src] = src
@@ -143,6 +143,20 @@ module Primer
143
143
  results(classes: "") unless results
144
144
  input(classes: "") unless input
145
145
  end
146
+
147
+ private
148
+
149
+ # Private: determines the label classes based on component configration.
150
+ #
151
+ # If the label is not visible, return an empty string.
152
+ #
153
+ # @param args [Hash] The component configuration.
154
+ # @return [String] The label classes.
155
+ def label_classes(**args)
156
+ return "" if args[:is_label_visible] == false
157
+
158
+ args[:is_label_inline] ? "autocomplete-label-inline" : "autocomplete-label-stacked"
159
+ end
146
160
  end
147
161
  end
148
162
  end
@@ -32,7 +32,7 @@ function showCheck(button: HTMLElement) {
32
32
 
33
33
  const clipboardCopyElementTimers = new WeakMap<HTMLElement, number>()
34
34
 
35
- document.addEventListener('clipboard-copy', function ({target}) {
35
+ document.addEventListener('clipboard-copy', function({target}) {
36
36
  if (!(target instanceof HTMLElement)) return
37
37
  if (!target.hasAttribute('data-view-component')) return
38
38
 
@@ -0,0 +1,65 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "helpers/rubocop_helpers"
4
+
5
+ module ERBLint
6
+ module Linters
7
+ # Replaces calls to `super` with calls to `render_parent`.
8
+ class SuperInComponentTemplates < Linter
9
+ include ERBLint::LinterRegistry
10
+ include Helpers::RubocopHelpers
11
+
12
+ def run(processed_source)
13
+ processed_source.ast.descendants(:erb).each do |erb_node|
14
+ indicator_node, _, code_node = *erb_node
15
+ code = code_node.children.first
16
+ ast = erb_ast(code)
17
+ next unless ast
18
+
19
+ super_call_nodes = find_super_call_nodes(ast)
20
+ next if super_call_nodes.empty?
21
+
22
+ indicator, = *indicator_node
23
+ indicator ||= ""
24
+
25
+ # +2 to account for the leading "<%" characters
26
+ code_start_pos = erb_node.location.begin_pos + indicator.size + 2
27
+
28
+ super_call_nodes.each do |super_call_node|
29
+ orig_loc = code_node.location
30
+ super_call_loc = super_call_node.location.expression
31
+
32
+ new_loc = orig_loc.with(
33
+ begin_pos: super_call_loc.begin_pos + code_start_pos,
34
+ end_pos: super_call_loc.end_pos + code_start_pos
35
+ )
36
+
37
+ add_offense(
38
+ new_loc,
39
+ "Avoid calling `super` in component templates. Call `render_parent` instead",
40
+ "render_parent"
41
+ )
42
+ end
43
+ end
44
+ end
45
+
46
+ def autocorrect(_, offense)
47
+ return unless offense.context
48
+
49
+ lambda do |corrector|
50
+ corrector.replace(offense.source_range, offense.context)
51
+ end
52
+ end
53
+
54
+ private
55
+
56
+ def find_super_call_nodes(ast)
57
+ return [ast] if ast.type == :zsuper
58
+
59
+ ast.each_child_node.flat_map do |child_ast|
60
+ find_super_call_nodes(child_ast)
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end
@@ -5,7 +5,7 @@ module Primer
5
5
  module VERSION
6
6
  MAJOR = 0
7
7
  MINOR = 0
8
- PATCH = 73
8
+ PATCH = 74
9
9
 
10
10
  STRING = [MAJOR, MINOR, PATCH].join(".")
11
11
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: primer_view_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.73
4
+ version: 0.0.74
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitHub Open Source
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-10 00:00:00.000000000 Z
11
+ date: 2022-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionview
@@ -366,7 +366,7 @@ dependencies:
366
366
  - - "~>"
367
367
  - !ruby/object:Gem::Version
368
368
  version: 0.9.25
369
- description:
369
+ description:
370
370
  email:
371
371
  - opensource+primer_view_components@github.com
372
372
  executables: []
@@ -541,6 +541,7 @@ files:
541
541
  - lib/primer/view_components/linters/helpers/rubocop_helpers.rb
542
542
  - lib/primer/view_components/linters/label_component_migration_counter.rb
543
543
  - lib/primer/view_components/linters/subhead_component_migration_counter.rb
544
+ - lib/primer/view_components/linters/super_in_component_templates.rb
544
545
  - lib/primer/view_components/linters/tag_tree_helpers.rb
545
546
  - lib/primer/view_components/linters/two_column_layout_migration_counter.rb
546
547
  - lib/primer/view_components/statuses.rb
@@ -579,7 +580,7 @@ licenses:
579
580
  - MIT
580
581
  metadata:
581
582
  allowed_push_host: https://rubygems.org
582
- post_install_message:
583
+ post_install_message:
583
584
  rdoc_options: []
584
585
  require_paths:
585
586
  - lib
@@ -594,8 +595,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
594
595
  - !ruby/object:Gem::Version
595
596
  version: '0'
596
597
  requirements: []
597
- rubygems_version: 3.1.6
598
- signing_key:
598
+ rubygems_version: 3.2.22
599
+ signing_key:
599
600
  specification_version: 4
600
601
  summary: ViewComponents for the Primer Design System
601
602
  test_files: []