primer_view_components 0.0.88 → 0.0.91

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.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +44 -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 +0 -0
  6. data/app/assets/styles/primer_view_components.css.map +1 -0
  7. data/app/components/primer/alpha/auto_complete.rb +2 -2
  8. data/app/components/primer/alpha/hidden_text_expander.rb +57 -0
  9. data/app/components/primer/alpha/layout.rb +34 -32
  10. data/app/components/primer/alpha/segmented-control-element.js +5 -4
  11. data/app/components/primer/alpha/tab_nav.rb +20 -20
  12. data/app/components/primer/alpha/tab_panels.rb +2 -2
  13. data/app/components/primer/alpha/tool-tip-element.d.ts +1 -3
  14. data/app/components/primer/alpha/tool-tip-element.js +13 -19
  15. data/app/components/primer/alpha/tool-tip-element.ts +14 -22
  16. data/app/components/primer/alpha/tooltip.rb +72 -53
  17. data/app/components/primer/alpha/underline_nav.rb +16 -16
  18. data/app/components/primer/alpha/underline_panels.rb +3 -3
  19. data/app/components/primer/base_component.rb +1 -1
  20. data/app/components/primer/beta/auto_complete/item.rb +2 -2
  21. data/app/components/primer/beta/auto_complete.rb +2 -2
  22. data/app/components/primer/beta/avatar_stack.rb +9 -9
  23. data/app/components/primer/beta/blankslate.rb +2 -2
  24. data/app/components/primer/beta/border_box/header.rb +4 -2
  25. data/app/components/primer/beta/border_box.rb +13 -13
  26. data/app/components/primer/beta/breadcrumbs.rb +3 -3
  27. data/app/components/primer/beta/button_group.rb +9 -9
  28. data/app/components/primer/beta/close_button.rb +41 -0
  29. data/app/components/primer/beta/counter.rb +113 -0
  30. data/app/components/primer/{details_component.html.erb → beta/details.html.erb} +0 -0
  31. data/app/components/primer/beta/details.rb +70 -0
  32. data/app/components/primer/beta/flash.rb +1 -1
  33. data/app/components/primer/beta/heading.rb +46 -0
  34. data/app/components/primer/beta/truncate.rb +17 -17
  35. data/app/components/primer/blankslate_component.rb +1 -1
  36. data/app/components/primer/button_component.rb +8 -8
  37. data/app/components/primer/close_button.rb +2 -34
  38. data/app/components/primer/counter_component.rb +2 -106
  39. data/app/components/primer/details_component.rb +2 -63
  40. data/app/components/primer/dropdown.html.erb +1 -1
  41. data/app/components/primer/dropdown.rb +15 -15
  42. data/app/components/primer/dropdown_menu_component.rb +1 -1
  43. data/app/components/primer/heading_component.rb +2 -39
  44. data/app/components/primer/hidden_text_expander.rb +2 -48
  45. data/app/components/primer/icon_button.html.erb +8 -2
  46. data/app/components/primer/icon_button.rb +7 -0
  47. data/app/components/primer/image_crop.rb +1 -1
  48. data/app/components/primer/label_component.rb +2 -1
  49. data/app/components/primer/layout_component.rb +4 -4
  50. data/app/components/primer/link_component.rb +1 -1
  51. data/app/components/primer/menu_component.rb +5 -5
  52. data/app/components/primer/navigation/tab_component.rb +12 -12
  53. data/app/components/primer/popover_component.rb +10 -10
  54. data/app/components/primer/primer.pcss +1 -0
  55. data/app/components/primer/subhead_component.rb +10 -10
  56. data/app/components/primer/timeline_item_component.rb +3 -3
  57. data/app/lib/primer/join_style_arguments_helper.rb +1 -1
  58. data/app/lib/primer/view_helper.rb +1 -1
  59. data/lib/primer/view_components/linters/argument_mappers/close_button.rb +2 -2
  60. data/lib/primer/view_components/linters/close_button_component_migration_counter.rb +2 -2
  61. data/lib/primer/view_components/linters/flash_migration_counter.rb +1 -1
  62. data/lib/primer/view_components/linters/helpers/deprecated_components_helpers.rb +5 -0
  63. data/lib/primer/view_components/version.rb +1 -1
  64. data/lib/rubocop/cop/primer/component_name_migration.rb +5 -0
  65. data/lib/tasks/docs.rake +5 -5
  66. data/static/arguments.yml +87 -87
  67. data/static/audited_at.json +5 -0
  68. data/static/constants.json +54 -44
  69. data/static/statuses.json +11 -6
  70. metadata +11 -3
File without changes
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"primer_view_components.css"}
@@ -94,12 +94,12 @@ module Primer
94
94
  #
95
95
  # @example With custom classes for the input
96
96
  # <%= render(Primer::Alpha::AutoComplete.new(label_text: "Fruits", src: "/auto_complete", input_id: "fruits-input--custom-input", list_id: "fruits-popup--custom-input")) do |c| %>
97
- # <% c.input(classes: "custom-class") %>
97
+ # <% c.with_input(classes: "custom-class") %>
98
98
  # <% end %>
99
99
  #
100
100
  # @example With custom classes for the results
101
101
  # <%= render(Primer::Alpha::AutoComplete.new(label_text: "Fruits", src: "/auto_complete", input_id: "fruits-input--custom-results", list_id: "fruits-popup--custom-results")) do |c| %>
102
- # <% c.results(classes: "custom-class") do %>
102
+ # <% c.with_results(classes: "custom-class") do %>
103
103
  # <%= render(Primer::Alpha::AutoComplete::Item.new(selected: true, value: "apple")) do |c| %>
104
104
  # Apple
105
105
  # <% end %>
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Primer
4
+ module Alpha
5
+ # Use `HiddenTextExpander` to indicate and toggle hidden text.
6
+ #
7
+ # @accessibility
8
+ # `HiddenTextExpander` requires an `aria-label`, which will provide assistive technologies with an accessible label.
9
+ # The `aria-label` should describe the action to be invoked by the `HiddenTextExpander`. For instance,
10
+ # if your `HiddenTextExpander` expands a list of 5 comments, the `aria-label` should be
11
+ # `"Expand 5 more comments"` instead of `"More"`.
12
+ class HiddenTextExpander < Primer::Component
13
+ status :alpha
14
+
15
+ # @example Default
16
+ # <%= render(Primer::Alpha::HiddenTextExpander.new("aria-label": "No effect")) %>
17
+ #
18
+ # @example Inline
19
+ # <%= render(Primer::Alpha::HiddenTextExpander.new(inline: true, "aria-label": "No effect")) %>
20
+ #
21
+ # @example Styling the button
22
+ # <%= render(Primer::Alpha::HiddenTextExpander.new("aria-label": "No effect", button_arguments: { p: 1, classes: "custom-class" })) %>
23
+ #
24
+ # @param inline [Boolean] Whether or not the expander is inline.
25
+ # @param button_arguments [Hash] <%= link_to_system_arguments_docs %> for the button element.
26
+ # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
27
+ def initialize(inline: false, button_arguments: {}, **system_arguments)
28
+ @system_arguments = deny_tag_argument(**system_arguments)
29
+ @button_arguments = button_arguments
30
+
31
+ @system_arguments[:tag] = :span
32
+ @system_arguments[:classes] = class_names(
33
+ "hidden-text-expander",
34
+ @system_arguments[:classes],
35
+ "inline" => inline
36
+ )
37
+
38
+ aria_label = system_arguments[:"aria-label"] || system_arguments.dig(:aria, :label) || @aria_label
39
+ if aria_label.present?
40
+ @button_arguments[:"aria-label"] = aria_label
41
+ @system_arguments[:aria]&.delete(:label)
42
+ end
43
+
44
+ @button_arguments[:classes] = class_names(
45
+ "ellipsis-expander",
46
+ button_arguments[:classes]
47
+ )
48
+ end
49
+
50
+ def call
51
+ render(Primer::BaseComponent.new(**@system_arguments)) do
52
+ render(Primer::HellipButton.new(**@button_arguments))
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
@@ -14,6 +14,8 @@ module Primer
14
14
  # Keyboard navigation follows the markup order. Decide carefully how the focus order should be be by deciding whether
15
15
  # `main` or `sidebar` comes first in code. The code order won’t affect the visual position.
16
16
  class Layout < Primer::Component
17
+ status :alpha
18
+
17
19
  FIRST_IN_SOURCE_DEFAULT = :sidebar
18
20
  FIRST_IN_SOURCE_OPTIONS = [FIRST_IN_SOURCE_DEFAULT, :main].freeze
19
21
 
@@ -80,8 +82,8 @@ module Primer
80
82
  # @example Default
81
83
  #
82
84
  # <%= render(Primer::Alpha::Layout.new) do |c| %>
83
- # <% c.main(border: true) { "Main" } %>
84
- # <% c.sidebar(border: true) { "Sidebar" } %>
85
+ # <% c.with_main(border: true) { "Main" } %>
86
+ # <% c.with_sidebar(border: true) { "Sidebar" } %>
85
87
  # <% end %>
86
88
  #
87
89
  # @example Main widths
@@ -96,20 +98,20 @@ module Primer
96
98
  #
97
99
  # @code
98
100
  # <%= render(Primer::Alpha::Layout.new) do |c| %>
99
- # <% c.main(width: :full, border: true) { "Main" } %>
100
- # <% c.sidebar(border: true) { "Sidebar" } %>
101
+ # <% c.with_main(width: :full, border: true) { "Main" } %>
102
+ # <% c.with_sidebar(border: true) { "Sidebar" } %>
101
103
  # <% end %>
102
104
  # <%= render(Primer::Alpha::Layout.new(mt: 5)) do |c| %>
103
- # <% c.main(width: :md, border: true) { "Main" } %>
104
- # <% c.sidebar(border: true) { "Sidebar" } %>
105
+ # <% c.with_main(width: :md, border: true) { "Main" } %>
106
+ # <% c.with_sidebar(border: true) { "Sidebar" } %>
105
107
  # <% end %>
106
108
  # <%= render(Primer::Alpha::Layout.new(mt: 5)) do |c| %>
107
- # <% c.main(width: :lg, border: true) { "Main" } %>
108
- # <% c.sidebar(border: true) { "Sidebar" } %>
109
+ # <% c.with_main(width: :lg, border: true) { "Main" } %>
110
+ # <% c.with_sidebar(border: true) { "Sidebar" } %>
109
111
  # <% end %>
110
112
  # <%= render(Primer::Alpha::Layout.new(mt: 5)) do |c| %>
111
- # <% c.main(width: :xl, border: true) { "Main" } %>
112
- # <% c.sidebar(border: true) { "Sidebar" } %>
113
+ # <% c.with_main(width: :xl, border: true) { "Main" } %>
114
+ # <% c.with_sidebar(border: true) { "Sidebar" } %>
113
115
  # <% end %>
114
116
  #
115
117
  # @example Sidebar widths
@@ -125,16 +127,16 @@ module Primer
125
127
  #
126
128
  # @code
127
129
  # <%= render(Primer::Alpha::Layout.new) do |c| %>
128
- # <% c.main(border: true) { "Main" } %>
129
- # <% c.sidebar(width: :default, border: true) { "Sidebar" } %>
130
+ # <% c.with_main(border: true) { "Main" } %>
131
+ # <% c.with_sidebar(width: :default, border: true) { "Sidebar" } %>
130
132
  # <% end %>
131
133
  # <%= render(Primer::Alpha::Layout.new(mt: 5)) do |c| %>
132
- # <% c.main(border: true) { "Main" } %>
133
- # <% c.sidebar(width: :narrow, border: true) { "Sidebar" } %>
134
+ # <% c.with_main(border: true) { "Main" } %>
135
+ # <% c.with_sidebar(width: :narrow, border: true) { "Sidebar" } %>
134
136
  # <% end %>
135
137
  # <%= render(Primer::Alpha::Layout.new(mt: 5)) do |c| %>
136
- # <% c.main(border: true) { "Main" } %>
137
- # <% c.sidebar(width: :wide, border: true) { "Sidebar" } %>
138
+ # <% c.with_main(border: true) { "Main" } %>
139
+ # <% c.with_sidebar(width: :wide, border: true) { "Sidebar" } %>
138
140
  # <% end %>
139
141
  #
140
142
  # @example Sidebar placement
@@ -144,12 +146,12 @@ module Primer
144
146
  #
145
147
  # @code
146
148
  # <%= render(Primer::Alpha::Layout.new) do |c| %>
147
- # <% c.main(border: true) { "Main" } %>
148
- # <% c.sidebar(col_placement: :start, border: true) { "Sidebar" } %>
149
+ # <% c.with_main(border: true) { "Main" } %>
150
+ # <% c.with_sidebar(col_placement: :start, border: true) { "Sidebar" } %>
149
151
  # <% end %>
150
152
  # <%= render(Primer::Alpha::Layout.new( mt: 5)) do |c| %>
151
- # <% c.main(border: true) { "Main" } %>
152
- # <% c.sidebar(col_placement: :end, border: true) { "Sidebar" } %>
153
+ # <% c.with_main(border: true) { "Main" } %>
154
+ # <% c.with_sidebar(col_placement: :end, border: true) { "Sidebar" } %>
153
155
  # <% end %>
154
156
  #
155
157
  # @example Sidebar placement as row
@@ -163,16 +165,16 @@ module Primer
163
165
  #
164
166
  # @code
165
167
  # <%= render(Primer::Alpha::Layout.new) do |c| %>
166
- # <% c.main(border: true) { "Main" } %>
167
- # <% c.sidebar(row_placement: :start, border: true) { "Sidebar" } %>
168
+ # <% c.with_main(border: true) { "Main" } %>
169
+ # <% c.with_sidebar(row_placement: :start, border: true) { "Sidebar" } %>
168
170
  # <% end %>
169
171
  # <%= render(Primer::Alpha::Layout.new(mt: 5)) do |c| %>
170
- # <% c.main(border: true) { "Main" } %>
171
- # <% c.sidebar(row_placement: :end, border: true) { "Sidebar" } %>
172
+ # <% c.with_main(border: true) { "Main" } %>
173
+ # <% c.with_sidebar(row_placement: :end, border: true) { "Sidebar" } %>
172
174
  # <% end %>
173
175
  # <%= render(Primer::Alpha::Layout.new(mt: 5)) do |c| %>
174
- # <% c.main(border: true) { "Main" } %>
175
- # <% c.sidebar(row_placement: :none, border: true) { "Sidebar" } %>
176
+ # <% c.with_main(border: true) { "Main" } %>
177
+ # <% c.with_sidebar(row_placement: :none, border: true) { "Sidebar" } %>
176
178
  # <% end %>
177
179
  #
178
180
  # @example Changing when to render `Layout` as columns
@@ -183,16 +185,16 @@ module Primer
183
185
  #
184
186
  # @code
185
187
  # <%= render(Primer::Alpha::Layout.new(stacking_breakpoint: :sm)) do |c| %>
186
- # <% c.main(border: true) { "Main" } %>
187
- # <% c.sidebar(border: true) { "Sidebar" } %>
188
+ # <% c.with_main(border: true) { "Main" } %>
189
+ # <% c.with_sidebar(border: true) { "Sidebar" } %>
188
190
  # <% end %>
189
191
  # <%= render(Primer::Alpha::Layout.new(stacking_breakpoint: :md, mt: 5)) do |c| %>
190
- # <% c.main(border: true) { "Main" } %>
191
- # <% c.sidebar(border: true) { "Sidebar" } %>
192
+ # <% c.with_main(border: true) { "Main" } %>
193
+ # <% c.with_sidebar(border: true) { "Sidebar" } %>
192
194
  # <% end %>
193
195
  # <%= render(Primer::Alpha::Layout.new(stacking_breakpoint: :lg, mt: 5)) do |c| %>
194
- # <% c.main(border: true) { "Main" } %>
195
- # <% c.sidebar(border: true) { "Sidebar" } %>
196
+ # <% c.with_main(border: true) { "Main" } %>
197
+ # <% c.with_sidebar(border: true) { "Sidebar" } %>
196
198
  # <% end %>
197
199
  #
198
200
  # @param stacking_breakpoint [Symbol] When the `Layout` should change from rows into columns. <%= one_of(Primer::Alpha::Layout::STACKING_BREAKPOINT_OPTIONS) %>
@@ -3,19 +3,20 @@ export default class SegmentedControlElement extends HTMLElement {
3
3
  constructor() {
4
4
  super();
5
5
  this.addEventListener('click', (event) => {
6
- const controls = Array.from(this.querySelectorAll('[role="toolbar"] button')).filter(tab => tab instanceof HTMLElement && tab.closest(this.tagName) === this);
6
+ var _a, _b;
7
+ const controls = Array.from(this.querySelectorAll('ul button')).filter(tab => tab instanceof HTMLElement && tab.closest(this.tagName) === this);
7
8
  if (!(event.target instanceof Element))
8
9
  return;
9
10
  if (event.target.closest(this.tagName) !== this)
10
11
  return;
11
12
  const selectedControl = event.target.closest('button');
12
- if (!(selectedControl instanceof HTMLElement) || !selectedControl.closest('[role="toolbar"]'))
13
+ if (!(selectedControl instanceof HTMLElement) || !selectedControl.closest('ul'))
13
14
  return;
14
15
  for (const control of controls) {
15
- control.classList.remove('SegmentedControl-button--selected');
16
+ (_a = control.closest('li')) === null || _a === void 0 ? void 0 : _a.classList.remove('SegmentedControl-item--selected');
16
17
  control.setAttribute('aria-current', 'false');
17
18
  }
18
- selectedControl.classList.add('SegmentedControl-button--selected');
19
+ (_b = selectedControl.closest('li')) === null || _b === void 0 ? void 0 : _b.classList.add('SegmentedControl-item--selected');
19
20
  selectedControl.setAttribute('aria-current', 'true');
20
21
  selectedControl.focus();
21
22
  });
@@ -49,30 +49,30 @@ module Primer
49
49
  # `<nav>` is a landmark and should be reserved for main navigation links. See <%= link_to_accessibility %>.
50
50
  # @code
51
51
  # <%= render(Primer::Alpha::TabNav.new(label: "Default")) do |c| %>
52
- # <% c.tab(selected: true, href: "#") { "Tab 1" } %>
53
- # <% c.tab(href: "#") { "Tab 2" } %>
54
- # <% c.tab(href: "#") { "Tab 3" } %>
52
+ # <% c.with_tab(selected: true, href: "#") { "Tab 1" } %>
53
+ # <% c.with_tab(href: "#") { "Tab 2" } %>
54
+ # <% c.with_tab(href: "#") { "Tab 3" } %>
55
55
  # <% end %>
56
56
  #
57
57
  # @example Default with `<div>`
58
58
  # <%= render(Primer::Alpha::TabNav.new(label: "Default")) do |c| %>
59
- # <% c.tab(selected: true, href: "#") { "Tab 1" } %>
60
- # <% c.tab(href: "#") { "Tab 2" } %>
61
- # <% c.tab(href: "#") { "Tab 3" } %>
59
+ # <% c.with_tab(selected: true, href: "#") { "Tab 1" } %>
60
+ # <% c.with_tab(href: "#") { "Tab 2" } %>
61
+ # <% c.with_tab(href: "#") { "Tab 3" } %>
62
62
  # <% end %>
63
63
  #
64
64
  # @example With icons and counters
65
65
  # <%= render(Primer::Alpha::TabNav.new(label: "With icons and counters")) do |component| %>
66
- # <% component.tab(href: "#", selected: true) do |t| %>
66
+ # <% component.with_tab(href: "#", selected: true) do |t| %>
67
67
  # <% t.icon(icon: :star) %>
68
68
  # <% t.text { "Item 1" } %>
69
69
  # <% end %>
70
- # <% component.tab(href: "#") do |t| %>
70
+ # <% component.with_tab(href: "#") do |t| %>
71
71
  # <% t.icon(icon: :star) %>
72
72
  # <% t.text { "Item 2" } %>
73
73
  # <% t.counter(count: 10) %>
74
74
  # <% end %>
75
- # <% component.tab(href: "#") do |t| %>
75
+ # <% component.with_tab(href: "#") do |t| %>
76
76
  # <% t.text { "Item 3" } %>
77
77
  # <% t.counter(count: 10) %>
78
78
  # <% end %>
@@ -80,20 +80,20 @@ module Primer
80
80
  #
81
81
  # @example With extra content
82
82
  # <%= render(Primer::Alpha::TabNav.new(label: "With extra content")) do |c| %>
83
- # <% c.tab(selected: true, href: "#") { "Tab 1" }%>
84
- # <% c.tab(href: "#") { "Tab 2" } %>
85
- # <% c.tab(href: "#") { "Tab 3" } %>
86
- # <% c.extra do %>
83
+ # <% c.with_tab(selected: true, href: "#") { "Tab 1" }%>
84
+ # <% c.with_tab(href: "#") { "Tab 2" } %>
85
+ # <% c.with_tab(href: "#") { "Tab 3" } %>
86
+ # <% c.with_extra do %>
87
87
  # <%= render(Primer::ButtonComponent.new(float: :right)) { "Button" } %>
88
88
  # <% end %>
89
89
  # <% end %>
90
90
  #
91
91
  # @example Adding extra content after the tabs
92
92
  # <%= render(Primer::Alpha::TabNav.new(label: "Adding extra content after the tabs", display: :flex, body_arguments: { flex: 1 })) do |c| %>
93
- # <% c.tab(selected: true, href: "#") { "Tab 1" }%>
94
- # <% c.tab(href: "#") { "Tab 2" } %>
95
- # <% c.tab(href: "#") { "Tab 3" } %>
96
- # <% c.extra(align: :right) do %>
93
+ # <% c.with_tab(selected: true, href: "#") { "Tab 1" }%>
94
+ # <% c.with_tab(href: "#") { "Tab 2" } %>
95
+ # <% c.with_tab(href: "#") { "Tab 3" } %>
96
+ # <% c.with_extra(align: :right) do %>
97
97
  # <div>
98
98
  # <%= render(Primer::ButtonComponent.new) { "Button" } %>
99
99
  # </div>
@@ -102,9 +102,9 @@ module Primer
102
102
  #
103
103
  # @example Customizing the body
104
104
  # <%= render(Primer::Alpha::TabNav.new(label: "Default", body_arguments: { classes: "custom-class", border: true, border_color: :accent_emphasis })) do |c| %>
105
- # <% c.tab(selected: true, href: "#") { "Tab 1" }%>
106
- # <% c.tab(href: "#") { "Tab 2" } %>
107
- # <% c.tab(href: "#") { "Tab 3" } %>
105
+ # <% c.with_tab(selected: true, href: "#") { "Tab 1" }%>
106
+ # <% c.with_tab(href: "#") { "Tab 2" } %>
107
+ # <% c.with_tab(href: "#") { "Tab 3" } %>
108
108
  # <% end %>
109
109
  #
110
110
  # @param tag [Symbol] <%= one_of(Primer::Alpha::TabNav::TAG_OPTIONS) %>
@@ -43,13 +43,13 @@ module Primer
43
43
 
44
44
  # @example Default
45
45
  # <%= render(Primer::Alpha::TabPanels.new(label: "With panels")) do |component| %>
46
- # <% component.tab(id: "tab-1", selected: true) do |t| %>
46
+ # <% component.with_tab(id: "tab-1", selected: true) do |t| %>
47
47
  # <% t.text { "Tab 1" } %>
48
48
  # <% t.panel do %>
49
49
  # Panel 1
50
50
  # <% end %>
51
51
  # <% end %>
52
- # <% component.tab(id: "tab-2") do |t| %>
52
+ # <% component.with_tab(id: "tab-2") do |t| %>
53
53
  # <% t.text { "Tab 2" } %>
54
54
  # <% t.panel do %>
55
55
  # Panel 2
@@ -9,13 +9,11 @@ declare class ToolTipElement extends HTMLElement {
9
9
  get direction(): Direction;
10
10
  set direction(value: Direction);
11
11
  get control(): HTMLElement | null;
12
- set visibilityHidden(value: true | false);
13
- get visibilityHidden(): true | false;
14
12
  connectedCallback(): void;
15
13
  disconnectedCallback(): void;
16
14
  handleEvent(event: Event): void;
17
15
  static observedAttributes: string[];
18
- attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
16
+ attributeChangedCallback(name: string): void;
19
17
  }
20
18
  declare global {
21
19
  interface Window {
@@ -176,12 +176,6 @@ class ToolTipElement extends HTMLElement {
176
176
  get control() {
177
177
  return this.ownerDocument.getElementById(this.htmlFor);
178
178
  }
179
- set visibilityHidden(value) {
180
- this.style.visibility = value ? 'hidden' : '';
181
- }
182
- get visibilityHidden() {
183
- return this.style.visibility === 'hidden';
184
- }
185
179
  connectedCallback() {
186
180
  var _a;
187
181
  if (!this.shadowRoot) {
@@ -194,7 +188,7 @@ class ToolTipElement extends HTMLElement {
194
188
  <slot></slot>
195
189
  `;
196
190
  }
197
- this.visibilityHidden = true;
191
+ this.hidden = true;
198
192
  __classPrivateFieldSet(this, _ToolTipElement_allowUpdatePosition, true, "f");
199
193
  if (!this.id) {
200
194
  this.id = `tooltip-${Date.now()}-${(Math.random() * 10000).toFixed(0)}`;
@@ -222,22 +216,22 @@ class ToolTipElement extends HTMLElement {
222
216
  return;
223
217
  // Ensures that tooltip stays open when hovering between tooltip and element
224
218
  // WCAG Success Criterion 1.4.13 Hoverable
225
- if ((event.type === 'mouseenter' || event.type === 'focus') && this.visibilityHidden) {
226
- this.visibilityHidden = false;
219
+ if ((event.type === 'mouseenter' || event.type === 'focus') && this.hidden) {
220
+ this.hidden = false;
227
221
  }
228
222
  else if (event.type === 'blur') {
229
- this.visibilityHidden = true;
223
+ this.hidden = true;
230
224
  }
231
225
  else if (event.type === 'mouseleave' &&
232
226
  event.relatedTarget !== this.control &&
233
227
  event.relatedTarget !== this) {
234
- this.visibilityHidden = true;
228
+ this.hidden = true;
235
229
  }
236
- else if (event.type === 'keydown' && event.key === 'Escape' && !this.visibilityHidden) {
237
- this.visibilityHidden = true;
230
+ else if (event.type === 'keydown' && event.key === 'Escape' && !this.hidden) {
231
+ this.hidden = true;
238
232
  }
239
233
  }
240
- attributeChangedCallback(name, oldValue, newValue) {
234
+ attributeChangedCallback(name) {
241
235
  if (name === 'id' || name === 'data-type') {
242
236
  if (!this.id || !this.control)
243
237
  return;
@@ -251,7 +245,7 @@ class ToolTipElement extends HTMLElement {
251
245
  this.control.setAttribute('aria-describedby', describedBy);
252
246
  }
253
247
  }
254
- else if (this.isConnected && name === 'style' && (oldValue && oldValue.includes('visibility')) || (newValue && newValue.includes('visibility'))) {
248
+ else if (this.isConnected && name === 'hidden') {
255
249
  __classPrivateFieldGet(this, _ToolTipElement_instances, "m", _ToolTipElement_update).call(this);
256
250
  }
257
251
  else if (name === 'data-direction') {
@@ -293,21 +287,21 @@ class ToolTipElement extends HTMLElement {
293
287
  }
294
288
  }
295
289
  _ToolTipElement_abortController = new WeakMap(), _ToolTipElement_align = new WeakMap(), _ToolTipElement_side = new WeakMap(), _ToolTipElement_allowUpdatePosition = new WeakMap(), _ToolTipElement_instances = new WeakSet(), _ToolTipElement_update = function _ToolTipElement_update() {
296
- if (this.visibilityHidden) {
290
+ if (this.hidden) {
297
291
  this.classList.remove(TOOLTIP_OPEN_CLASS, ...DIRECTION_CLASSES);
298
292
  }
299
293
  else {
300
294
  this.classList.add(TOOLTIP_OPEN_CLASS);
301
295
  for (const tooltip of this.ownerDocument.querySelectorAll(this.tagName)) {
302
296
  if (tooltip !== this)
303
- tooltip.visibilityHidden = true;
297
+ tooltip.hidden = true;
304
298
  }
305
299
  __classPrivateFieldGet(this, _ToolTipElement_instances, "m", _ToolTipElement_updatePosition).call(this);
306
300
  }
307
301
  }, _ToolTipElement_updatePosition = function _ToolTipElement_updatePosition() {
308
302
  if (!this.control)
309
303
  return;
310
- if (!__classPrivateFieldGet(this, _ToolTipElement_allowUpdatePosition, "f") || this.visibilityHidden)
304
+ if (!__classPrivateFieldGet(this, _ToolTipElement_allowUpdatePosition, "f") || this.hidden)
311
305
  return;
312
306
  const TOOLTIP_OFFSET = 10;
313
307
  this.style.left = `0px`; // Ensures we have reliable tooltip width in `getAnchoredPosition`
@@ -351,7 +345,7 @@ _ToolTipElement_abortController = new WeakMap(), _ToolTipElement_align = new Wea
351
345
  }
352
346
  this.classList.add(`tooltip-${direction}`);
353
347
  };
354
- ToolTipElement.observedAttributes = ['data-type', 'data-direction', 'id', 'style'];
348
+ ToolTipElement.observedAttributes = ['data-type', 'data-direction', 'id', 'hidden'];
355
349
  if (!window.customElements.get('tool-tip')) {
356
350
  window.ToolTipElement = ToolTipElement;
357
351
  window.customElements.define('tool-tip', ToolTipElement);
@@ -176,14 +176,6 @@ class ToolTipElement extends HTMLElement {
176
176
  return this.ownerDocument.getElementById(this.htmlFor)
177
177
  }
178
178
 
179
- set visibilityHidden(value: true | false) {
180
- this.style.visibility = value ? 'hidden' : ''
181
- }
182
-
183
- get visibilityHidden() {
184
- return this.style.visibility === 'hidden'
185
- }
186
-
187
179
  connectedCallback() {
188
180
  if (!this.shadowRoot) {
189
181
  const shadow = this.attachShadow({mode: 'open'})
@@ -195,7 +187,7 @@ class ToolTipElement extends HTMLElement {
195
187
  <slot></slot>
196
188
  `
197
189
  }
198
- this.visibilityHidden = true
190
+ this.hidden = true
199
191
  this.#allowUpdatePosition = true
200
192
 
201
193
  if (!this.id) {
@@ -228,36 +220,36 @@ class ToolTipElement extends HTMLElement {
228
220
 
229
221
  // Ensures that tooltip stays open when hovering between tooltip and element
230
222
  // WCAG Success Criterion 1.4.13 Hoverable
231
- if ((event.type === 'mouseenter' || event.type === 'focus') && this.visibilityHidden) {
232
- this.visibilityHidden = false
223
+ if ((event.type === 'mouseenter' || event.type === 'focus') && this.hidden) {
224
+ this.hidden = false
233
225
  } else if (event.type === 'blur') {
234
- this.visibilityHidden = true
226
+ this.hidden = true
235
227
  } else if (
236
228
  event.type === 'mouseleave' &&
237
229
  (event as MouseEvent).relatedTarget !== this.control &&
238
230
  (event as MouseEvent).relatedTarget !== this
239
231
  ) {
240
- this.visibilityHidden = true
241
- } else if (event.type === 'keydown' && (event as KeyboardEvent).key === 'Escape' && !this.visibilityHidden) {
242
- this.visibilityHidden = true
232
+ this.hidden = true
233
+ } else if (event.type === 'keydown' && (event as KeyboardEvent).key === 'Escape' && !this.hidden) {
234
+ this.hidden = true
243
235
  }
244
236
  }
245
237
 
246
- static observedAttributes = ['data-type', 'data-direction', 'id', 'style']
238
+ static observedAttributes = ['data-type', 'data-direction', 'id', 'hidden']
247
239
 
248
240
  #update() {
249
- if (this.visibilityHidden) {
241
+ if (this.hidden) {
250
242
  this.classList.remove(TOOLTIP_OPEN_CLASS, ...DIRECTION_CLASSES)
251
243
  } else {
252
244
  this.classList.add(TOOLTIP_OPEN_CLASS)
253
- for (const tooltip of this.ownerDocument.querySelectorAll<ToolTipElement>(this.tagName)) {
254
- if (tooltip !== this) tooltip.visibilityHidden = true
245
+ for (const tooltip of this.ownerDocument.querySelectorAll<HTMLElement>(this.tagName)) {
246
+ if (tooltip !== this) tooltip.hidden = true
255
247
  }
256
248
  this.#updatePosition()
257
249
  }
258
250
  }
259
251
 
260
- attributeChangedCallback(name: string, oldValue: string, newValue: string) {
252
+ attributeChangedCallback(name: string) {
261
253
  if (name === 'id' || name === 'data-type') {
262
254
  if (!this.id || !this.control) return
263
255
  if (this.type === 'label') {
@@ -268,7 +260,7 @@ class ToolTipElement extends HTMLElement {
268
260
  describedBy ? (describedBy = `${describedBy} ${this.id}`) : (describedBy = this.id)
269
261
  this.control.setAttribute('aria-describedby', describedBy)
270
262
  }
271
- } else if (this.isConnected && name === 'style' && (oldValue && oldValue.includes('visibility')) || (newValue && newValue.includes('visibility'))) {
263
+ } else if (this.isConnected && name === 'hidden') {
272
264
  this.#update()
273
265
  } else if (name === 'data-direction') {
274
266
  this.classList.remove(...DIRECTION_CLASSES)
@@ -303,7 +295,7 @@ class ToolTipElement extends HTMLElement {
303
295
 
304
296
  #updatePosition() {
305
297
  if (!this.control) return
306
- if (!this.#allowUpdatePosition || this.visibilityHidden) return
298
+ if (!this.#allowUpdatePosition || this.hidden) return
307
299
 
308
300
  const TOOLTIP_OFFSET = 10
309
301