primer_view_components 0.43.4 → 0.43.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,7 +9,7 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
9
9
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
10
10
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
11
11
  };
12
- var _ToolTipElement_instances, _ToolTipElement_abortController, _ToolTipElement_align, _ToolTipElement_side, _ToolTipElement_allowUpdatePosition, _ToolTipElement_showReason, _ToolTipElement_update, _ToolTipElement_updateControlReference, _ToolTipElement_updateDirection, _ToolTipElement_updatePosition;
12
+ var _ToolTipElement_instances, _ToolTipElement_abortController, _ToolTipElement_align, _ToolTipElement_side, _ToolTipElement_allowUpdatePosition, _ToolTipElement_showReason, _ToolTipElement_update, _ToolTipElement_updateControl, _ToolTipElement_updateControlReference, _ToolTipElement_updateDirection, _ToolTipElement_updatePosition;
13
13
  import '@oddbird/popover-polyfill';
14
14
  import { getAnchoredPosition } from '@primer/behaviors';
15
15
  const isPopoverOpen = (() => {
@@ -233,26 +233,7 @@ class ToolTipElement extends HTMLElement {
233
233
  }
234
234
  __classPrivateFieldGet(this, _ToolTipElement_instances, "m", _ToolTipElement_update).call(this, false);
235
235
  __classPrivateFieldSet(this, _ToolTipElement_allowUpdatePosition, true, "f");
236
- if (!this.control)
237
- return;
238
- this.setAttribute('role', 'tooltip');
239
- __classPrivateFieldGet(this, _ToolTipElement_abortController, "f")?.abort();
240
- __classPrivateFieldSet(this, _ToolTipElement_abortController, new AbortController(), "f");
241
- const { signal } = __classPrivateFieldGet(this, _ToolTipElement_abortController, "f");
242
- this.addEventListener('mouseleave', this, { signal });
243
- this.addEventListener('toggle', this, { signal });
244
- this.control.addEventListener('mouseenter', this, { signal });
245
- this.control.addEventListener('mouseleave', this, { signal });
246
- this.control.addEventListener('focus', this, { signal });
247
- this.control.addEventListener('mousedown', this, { signal });
248
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
249
- // @ts-ignore popoverTargetElement is not in the type definition
250
- this.control.popoverTargetElement?.addEventListener('beforetoggle', this, {
251
- signal,
252
- });
253
- this.ownerDocument.addEventListener('focusout', focusOutListener);
254
- this.ownerDocument.addEventListener('focusin', focusInListener);
255
- this.ownerDocument.addEventListener('keydown', this, { signal, capture: true });
236
+ __classPrivateFieldGet(this, _ToolTipElement_instances, "m", _ToolTipElement_updateControl).call(this);
256
237
  }
257
238
  disconnectedCallback() {
258
239
  tooltips.delete(this);
@@ -296,7 +277,10 @@ class ToolTipElement extends HTMLElement {
296
277
  attributeChangedCallback(name) {
297
278
  if (!this.isConnected)
298
279
  return;
299
- if (name === 'id' || name === 'data-type') {
280
+ if (name === 'for') {
281
+ __classPrivateFieldGet(this, _ToolTipElement_instances, "m", _ToolTipElement_updateControl).call(this);
282
+ }
283
+ else if (name === 'id' || name === 'data-type') {
300
284
  __classPrivateFieldGet(this, _ToolTipElement_instances, "m", _ToolTipElement_updateControlReference).call(this);
301
285
  }
302
286
  else if (name === 'data-direction') {
@@ -316,6 +300,27 @@ _ToolTipElement_abortController = new WeakMap(), _ToolTipElement_align = new Wea
316
300
  this.classList.remove(...DIRECTION_CLASSES);
317
301
  this.classList.add(TOOLTIP_SR_ONLY_CLASS);
318
302
  }
303
+ }, _ToolTipElement_updateControl = function _ToolTipElement_updateControl() {
304
+ if (!this.control)
305
+ return;
306
+ this.setAttribute('role', 'tooltip');
307
+ __classPrivateFieldGet(this, _ToolTipElement_abortController, "f")?.abort();
308
+ __classPrivateFieldSet(this, _ToolTipElement_abortController, new AbortController(), "f");
309
+ const { signal } = __classPrivateFieldGet(this, _ToolTipElement_abortController, "f");
310
+ this.addEventListener('mouseleave', this, { signal });
311
+ this.addEventListener('toggle', this, { signal });
312
+ this.control.addEventListener('mouseenter', this, { signal });
313
+ this.control.addEventListener('mouseleave', this, { signal });
314
+ this.control.addEventListener('focus', this, { signal });
315
+ this.control.addEventListener('mousedown', this, { signal });
316
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
317
+ // @ts-ignore popoverTargetElement is not in the type definition
318
+ this.control.popoverTargetElement?.addEventListener('beforetoggle', this, {
319
+ signal,
320
+ });
321
+ this.ownerDocument.addEventListener('focusout', focusOutListener);
322
+ this.ownerDocument.addEventListener('focusin', focusInListener);
323
+ this.ownerDocument.addEventListener('keydown', this, { signal, capture: true });
319
324
  }, _ToolTipElement_updateControlReference = function _ToolTipElement_updateControlReference() {
320
325
  if (!this.id || !this.control)
321
326
  return;
@@ -431,7 +436,7 @@ _ToolTipElement_abortController = new WeakMap(), _ToolTipElement_align = new Wea
431
436
  }
432
437
  this.classList.add(`tooltip-${direction}`);
433
438
  };
434
- ToolTipElement.observedAttributes = ['data-type', 'data-direction', 'id'];
439
+ ToolTipElement.observedAttributes = ['data-type', 'data-direction', 'id', 'for'];
435
440
  if (!window.customElements.get('tool-tip')) {
436
441
  window.ToolTipElement = ToolTipElement;
437
442
  window.customElements.define('tool-tip', ToolTipElement);
@@ -234,28 +234,7 @@ class ToolTipElement extends HTMLElement {
234
234
  this.#update(false)
235
235
  this.#allowUpdatePosition = true
236
236
 
237
- if (!this.control) return
238
-
239
- this.setAttribute('role', 'tooltip')
240
-
241
- this.#abortController?.abort()
242
- this.#abortController = new AbortController()
243
- const {signal} = this.#abortController
244
-
245
- this.addEventListener('mouseleave', this, {signal})
246
- this.addEventListener('toggle', this, {signal})
247
- this.control.addEventListener('mouseenter', this, {signal})
248
- this.control.addEventListener('mouseleave', this, {signal})
249
- this.control.addEventListener('focus', this, {signal})
250
- this.control.addEventListener('mousedown', this, {signal})
251
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
252
- // @ts-ignore popoverTargetElement is not in the type definition
253
- this.control.popoverTargetElement?.addEventListener('beforetoggle', this, {
254
- signal,
255
- })
256
- this.ownerDocument.addEventListener('focusout', focusOutListener)
257
- this.ownerDocument.addEventListener('focusin', focusInListener)
258
- this.ownerDocument.addEventListener('keydown', this, {signal, capture: true})
237
+ this.#updateControl()
259
238
  }
260
239
 
261
240
  disconnectedCallback() {
@@ -303,7 +282,7 @@ class ToolTipElement extends HTMLElement {
303
282
  }
304
283
  }
305
284
 
306
- static observedAttributes = ['data-type', 'data-direction', 'id']
285
+ static observedAttributes = ['data-type', 'data-direction', 'id', 'for']
307
286
 
308
287
  #update(isOpen: boolean) {
309
288
  if (isOpen) {
@@ -321,13 +300,40 @@ class ToolTipElement extends HTMLElement {
321
300
  attributeChangedCallback(name: string) {
322
301
  if (!this.isConnected) return
323
302
 
324
- if (name === 'id' || name === 'data-type') {
303
+ if (name === 'for') {
304
+ this.#updateControl()
305
+ } else if (name === 'id' || name === 'data-type') {
325
306
  this.#updateControlReference()
326
307
  } else if (name === 'data-direction') {
327
308
  this.#updateDirection()
328
309
  }
329
310
  }
330
311
 
312
+ #updateControl() {
313
+ if (!this.control) return
314
+
315
+ this.setAttribute('role', 'tooltip')
316
+
317
+ this.#abortController?.abort()
318
+ this.#abortController = new AbortController()
319
+ const {signal} = this.#abortController
320
+
321
+ this.addEventListener('mouseleave', this, {signal})
322
+ this.addEventListener('toggle', this, {signal})
323
+ this.control.addEventListener('mouseenter', this, {signal})
324
+ this.control.addEventListener('mouseleave', this, {signal})
325
+ this.control.addEventListener('focus', this, {signal})
326
+ this.control.addEventListener('mousedown', this, {signal})
327
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
328
+ // @ts-ignore popoverTargetElement is not in the type definition
329
+ this.control.popoverTargetElement?.addEventListener('beforetoggle', this, {
330
+ signal,
331
+ })
332
+ this.ownerDocument.addEventListener('focusout', focusOutListener)
333
+ this.ownerDocument.addEventListener('focusin', focusInListener)
334
+ this.ownerDocument.addEventListener('keydown', this, {signal, capture: true})
335
+ }
336
+
331
337
  #updateControlReference() {
332
338
  if (!this.id || !this.control) return
333
339
  if (this.type === 'label') {
@@ -102,6 +102,7 @@ module Primer
102
102
  # @param lang [String] The language to use.
103
103
  # @param title [String] Provide a custom title to the element.
104
104
  # @param no_title [Boolean] Removes the `title` attribute provided on the element by default.
105
+ # @param aria_hidden [Boolean] Set if the element is hidden or not.
105
106
  # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
106
107
  def initialize(
107
108
  datetime:,
@@ -122,6 +123,7 @@ module Primer
122
123
  lang: nil,
123
124
  title: nil,
124
125
  no_title: false,
126
+ aria_hidden: nil,
125
127
  **system_arguments
126
128
  )
127
129
  @system_arguments = deny_tag_argument(**system_arguments)
@@ -143,6 +145,7 @@ module Primer
143
145
  @system_arguments[:lang] = lang if lang.present?
144
146
  @system_arguments[:format] = fetch_or_fallback(FORMAT_OPTIONS, format, FORMAT_DEFAULT) if format.present?
145
147
  @system_arguments[:"format-style"] = format_style if format_style.present?
148
+ @system_arguments[:"aria-hidden"] = aria_hidden if aria_hidden.present?
146
149
  if datetime.present? && datetime.respond_to?(:iso8601)
147
150
  @datetime = datetime
148
151
  @system_arguments[:datetime] = datetime.iso8601
@@ -13,7 +13,7 @@ module Primer
13
13
  slot_def = registered_slots[slot_name]
14
14
  raise "Unknown slot '#{slot_name}'" unless slot_def
15
15
 
16
- poly_def = define_slot(
16
+ poly_def = __vc_define_slot(
17
17
  type,
18
18
  collection: slot_def[:collection],
19
19
  callable: callable
@@ -22,7 +22,7 @@ module Primer
22
22
  registered_slots[slot_name][:renderable_hash][type] = poly_def
23
23
 
24
24
  define_method(:"with_#{type}") do |**system_arguments, &block|
25
- set_slot(slot_name, poly_def, **system_arguments, &block)
25
+ __vc_set_slot(slot_name, poly_def, **system_arguments, &block)
26
26
  end
27
27
  end
28
28
  end
@@ -6,7 +6,7 @@ module Primer
6
6
  module VERSION
7
7
  MAJOR = 0
8
8
  MINOR = 43
9
- PATCH = 4
9
+ PATCH = 6
10
10
 
11
11
  STRING = [MAJOR, MINOR, PATCH].join(".")
12
12
  end
@@ -4571,6 +4571,12 @@
4571
4571
  "default": "`false`",
4572
4572
  "description": "Removes the `title` attribute provided on the element by default."
4573
4573
  },
4574
+ {
4575
+ "name": "aria_hidden",
4576
+ "type": "Boolean",
4577
+ "default": "`nil`",
4578
+ "description": "Set if the element is hidden or not."
4579
+ },
4574
4580
  {
4575
4581
  "name": "system_arguments",
4576
4582
  "type": "Hash",
@@ -15256,6 +15256,12 @@
15256
15256
  "default": "`false`",
15257
15257
  "description": "Removes the `title` attribute provided on the element by default."
15258
15258
  },
15259
+ {
15260
+ "name": "aria_hidden",
15261
+ "type": "Boolean",
15262
+ "default": "`nil`",
15263
+ "description": "Set if the element is hidden or not."
15264
+ },
15259
15265
  {
15260
15266
  "name": "system_arguments",
15261
15267
  "type": "Hash",
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.43.4
4
+ version: 0.43.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitHub Open Source
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-06-18 00:00:00.000000000 Z
11
+ date: 2025-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionview
@@ -61,7 +61,7 @@ dependencies:
61
61
  version: '3.1'
62
62
  - - "<"
63
63
  - !ruby/object:Gem::Version
64
- version: '4.0'
64
+ version: '5.0'
65
65
  type: :runtime
66
66
  prerelease: false
67
67
  version_requirements: !ruby/object:Gem::Requirement
@@ -71,7 +71,7 @@ dependencies:
71
71
  version: '3.1'
72
72
  - - "<"
73
73
  - !ruby/object:Gem::Version
74
- version: '4.0'
74
+ version: '5.0'
75
75
  description:
76
76
  email:
77
77
  - opensource+primer_view_components@github.com