@aurodesignsystem-dev/auro-popover 0.0.0-pr136.0 → 0.0.0-pr141.0
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.
- package/README.md +26 -27
- package/demo/api.html +1 -0
- package/demo/api.md +203 -78
- package/demo/api.min.js +141 -62
- package/demo/index.md +9 -9
- package/demo/index.min.js +141 -62
- package/demo/readme.md +26 -27
- package/dist/auro-popover-DTAnB1se.js +19 -0
- package/dist/index.d.ts +109 -54
- package/dist/index.js +1 -1
- package/dist/registered.js +1 -1
- package/package.json +7 -7
- package/dist/auro-popover-Bu7mQ0Hu.js +0 -19
package/README.md
CHANGED
|
@@ -12,23 +12,23 @@ The following sections are editable by making changes to the following files:
|
|
|
12
12
|
| SECTION | DESCRIPTION | FILE LOCATION |
|
|
13
13
|
|------------------------|---------------------------------------------------|-------------------------------------|
|
|
14
14
|
| Description | Description of the component | `./docs/partials/description.md` |
|
|
15
|
-
| Use
|
|
16
|
-
| Additional
|
|
17
|
-
| Component
|
|
15
|
+
| Use cases | Examples for when to use this component | `./docs/partials/useCases.md` |
|
|
16
|
+
| Additional information | For use to add any component specific information | `./docs/partials/readmeAddlInfo.md` |
|
|
17
|
+
| Component example code | HTML sample code of the components use | `./apiExamples/basic.html` |
|
|
18
18
|
-->
|
|
19
19
|
|
|
20
20
|
# Popover
|
|
21
21
|
|
|
22
22
|
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./docs/partials/description.md) -->
|
|
23
23
|
<!-- The below content is automatically added from ./docs/partials/description.md -->
|
|
24
|
-
|
|
24
|
+
Shows short supporting content next to a trigger when someone hovers over, focuses, or taps it. It uses the [Popper.js](https://popper.js.org/) library to position itself relative to the trigger and supports placements such as `top` and `bottom`.
|
|
25
25
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
26
26
|
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./docs/partials/readmeAddlInfo.md) -->
|
|
27
27
|
<!-- The below content is automatically added from ./docs/partials/readmeAddlInfo.md -->
|
|
28
28
|
<!-- AURO-GENERATED-CONTENT This file is to be used for any additional content that should be included in the README.md which is specific to this component. -->
|
|
29
29
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
30
30
|
|
|
31
|
-
## Use
|
|
31
|
+
## Use cases
|
|
32
32
|
|
|
33
33
|
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./docs/partials/useCases.md) -->
|
|
34
34
|
<!-- The below content is automatically added from ./docs/partials/useCases.md -->
|
|
@@ -51,10 +51,10 @@ The `auro-popover` element should be used in situations where users may:
|
|
|
51
51
|
|
|
52
52
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
53
53
|
|
|
54
|
-
### Define
|
|
54
|
+
### Define dependency in project
|
|
55
55
|
|
|
56
56
|
<!-- AURO-GENERATED-CONTENT:START (REMOTE:url=https://raw.githubusercontent.com/AlaskaAirlines/auro-templates/main/templates/default/partials/usage/componentImportDescription.md) -->
|
|
57
|
-
|
|
57
|
+
Import the component in each project that uses `<auro-popover>`.
|
|
58
58
|
|
|
59
59
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
60
60
|
<!-- AURO-GENERATED-CONTENT:START (REMOTE:url=https://raw.githubusercontent.com/AlaskaAirlines/auro-templates/main/templates/default/partials/usage/componentImport.md) -->
|
|
@@ -66,44 +66,43 @@ Defining the dependency within each project that is using the `<auro-popover>` c
|
|
|
66
66
|
### Use CDN
|
|
67
67
|
|
|
68
68
|
<!-- AURO-GENERATED-CONTENT:START (REMOTE:url=https://raw.githubusercontent.com/AlaskaAirlines/auro-templates/main/templates/default/partials/usage/bundleInstallDescription.md) -->
|
|
69
|
-
|
|
69
|
+
If your project can't process JS assets, use the pre-processed assets. Legacy browsers, such as IE11, aren't supported.
|
|
70
70
|
|
|
71
|
-
<pre class="language-html"><code class="language-html"><script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-popover@latest/+esm"></script></code></pre>
|
|
71
|
+
<pre class="language-html"><code class="language-html"><script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-popover@latest/+esm"></script></code></pre>
|
|
72
72
|
|
|
73
73
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
74
74
|
|
|
75
|
-
## Basic
|
|
75
|
+
## Basic example
|
|
76
76
|
|
|
77
77
|
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./apiExamples/basic.html) -->
|
|
78
78
|
<!-- The below code snippet is automatically added from ./apiExamples/basic.html -->
|
|
79
79
|
|
|
80
80
|
<pre class="language-html"><code class="language-html"><auro-popover>
|
|
81
81
|
Top popover content!
|
|
82
|
-
<auro-button slot="trigger">Popover
|
|
83
|
-
</auro-popover></code></pre>
|
|
82
|
+
<auro-button slot="trigger">Popover test</auro-button>
|
|
83
|
+
</auro-popover></code></pre>
|
|
84
84
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
85
85
|
|
|
86
|
-
## Custom
|
|
86
|
+
## Custom component registration for version management
|
|
87
87
|
|
|
88
|
-
|
|
88
|
+
Every Auro component has two key parts: the <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes">class</a> and the custom element definition.
|
|
89
89
|
The class defines the component’s behavior, while the custom element registers it under a specific name so it can be used in HTML.
|
|
90
90
|
|
|
91
|
-
|
|
91
|
+
Installing the component as described in the Install section imports the class and registers the component globally for you.
|
|
92
92
|
|
|
93
|
-
However, if you need to load multiple versions of the same component on a single page (for example, when two projects depend on different versions),
|
|
93
|
+
However, if you need to load multiple versions of the same component on a single page (for example, when two projects depend on different versions), register the class manually under a custom element name to avoid conflicts.
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
To do this, import only the component class and call the `register(name)` method with a unique name:
|
|
96
96
|
|
|
97
97
|
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./docs/partials/customRegistration.md) -->
|
|
98
98
|
<!-- The below content is automatically added from ./docs/partials/customRegistration.md -->
|
|
99
99
|
|
|
100
100
|
<pre class="language-js"><code class="language-js">// Import the class only
|
|
101
101
|
import { AuroPopover } from '@aurodesignsystem/auro-popover/class';
|
|
102
|
-
|
|
103
|
-
// Register with a custom name if desired
|
|
102
|
+
// Register with a custom name if desired
|
|
104
103
|
AuroPopover.register('custom-popover');</code></pre>
|
|
105
104
|
|
|
106
|
-
This
|
|
105
|
+
This registers a new custom element, `<custom-popover>`, that behaves like `<auro-popover>`. Both can exist on the same page without interfering with each other.
|
|
107
106
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
108
107
|
<div class="exampleWrapper exampleWrapper--flex">
|
|
109
108
|
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./apiExamples/custom.html) -->
|
|
@@ -111,12 +110,12 @@ This will create a new custom element `<custom-popover>` that behaves exactly li
|
|
|
111
110
|
<!-- The slot=trigger attribute is bound directly to the auro-button element -->
|
|
112
111
|
<custom-popover>
|
|
113
112
|
Top popover content!
|
|
114
|
-
<auro-button slot="trigger">Popover
|
|
113
|
+
<auro-button slot="trigger">Popover test</auro-button>
|
|
115
114
|
</custom-popover>
|
|
116
115
|
<!-- Using the placement=bottom attribute -->
|
|
117
116
|
<custom-popover placement="bottom">
|
|
118
117
|
Popover content!
|
|
119
|
-
<auro-button slot="trigger">Popover
|
|
118
|
+
<auro-button slot="trigger">Popover test</auro-button>
|
|
120
119
|
</custom-popover>
|
|
121
120
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
122
121
|
</div>
|
|
@@ -128,12 +127,12 @@ This will create a new custom element `<custom-popover>` that behaves exactly li
|
|
|
128
127
|
<pre class="language-html"><code class="language-html"><!-- The slot=trigger attribute is bound directly to the auro-button element -->
|
|
129
128
|
<custom-popover>
|
|
130
129
|
Top popover content!
|
|
131
|
-
<auro-button slot="trigger">Popover
|
|
132
|
-
</custom-popover>
|
|
133
|
-
|
|
130
|
+
<auro-button slot="trigger">Popover test</auro-button>
|
|
131
|
+
</custom-popover>
|
|
132
|
+
<!-- Using the placement=bottom attribute -->
|
|
134
133
|
<custom-popover placement="bottom">
|
|
135
134
|
Popover content!
|
|
136
|
-
<auro-button slot="trigger">Popover
|
|
137
|
-
</custom-popover></code></pre>
|
|
135
|
+
<auro-button slot="trigger">Popover test</auro-button>
|
|
136
|
+
</custom-popover></code></pre>
|
|
138
137
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
139
138
|
</auro-accordion>
|
package/demo/api.html
CHANGED
package/demo/api.md
CHANGED
|
@@ -3,32 +3,54 @@
|
|
|
3
3
|
|
|
4
4
|
# auro-popover
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
Shows short supporting content next to a trigger when someone hovers over, focuses, or taps it.
|
|
7
|
+
|
|
8
|
+
**Key capabilities**
|
|
9
|
+
|
|
10
|
+
- **Keyboard and screen reader support**: A trigger that can't take focus is made reachable with the keyboard, and screen readers announce the popover text as the trigger's description.
|
|
11
|
+
- **Placement**: The popover appears above the trigger by default, or below it with `placement="bottom"`.
|
|
12
|
+
- **Turn off**: The `disabled` attribute stops the popover from showing.
|
|
13
|
+
- **Restyling**: The `popover`, `arrow`, and `trigger` CSS parts let you restyle the bubble, its arrow, and the trigger wrapper.
|
|
7
14
|
|
|
8
|
-
### Properties
|
|
9
|
-
|
|
10
|
-
| Properties | Attributes | Modifiers | Type | Default | Description
|
|
11
|
-
| ----------- | ----------- | --------- | ---------------- | ------- |
|
|
12
|
-
| addSpace |
|
|
13
|
-
| boundary | boundary | | string \| object | |
|
|
14
|
-
| disabled | disabled | | boolean | |
|
|
15
|
-
| for | for | | string | |
|
|
16
|
-
| placement | placement | | string | `top` |
|
|
17
|
-
| removeSpace |
|
|
18
|
-
| | data-show | | boolean | `false` | Whether the popover is currently visible. Reflected as the `data-show`<br>attribute so host-level CSS selectors (e.g. `:host([data-show])`) work.<br>Also drives `aria-hidden` on the popover div in the template. |
|
|
15
|
+
### Properties and attributes
|
|
16
|
+
|
|
17
|
+
| Properties | Attributes | Modifiers | Type | Default | Description |
|
|
18
|
+
| ----------- | ----------- | --------- | ---------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
19
|
+
| addSpace | addspace | | boolean | | Adds more space between the popover and its trigger. When `removeSpace` is also set, `addSpace` takes effect. |
|
|
20
|
+
| boundary | boundary | | string \| object | | Sets the element that keeps the popover from overflowing, such as a selector string or an HTML element. |
|
|
21
|
+
| disabled | disabled | | boolean | | Turns the popover off. A disabled popover doesn't show on hover, focus, touch, or keyboard activation. |
|
|
22
|
+
| for | for | | string | | Sets the ID of the trigger element, for when the trigger can't use the `trigger` slot. In most cases, set `slot="trigger"` on the element instead. |
|
|
23
|
+
| placement | placement | | string | `top` | Sets where the popover appears in relation to its trigger. Use `top` (the default) or `bottom`. The popover flips to the opposite side when there isn't room. Changing this after the first render does not currently move the popover. |
|
|
24
|
+
| removeSpace | removespace | | boolean | | Reduces the space between the popover and its trigger, so the popover sits closer to it. Has no effect when `addSpace` is also set. |
|
|
19
25
|
|
|
20
26
|
### Methods
|
|
21
27
|
|
|
22
|
-
| Name | Parameters
|
|
23
|
-
| -------- |
|
|
24
|
-
| register | `name` (string) - The name
|
|
28
|
+
| Name | Parameters | Return | Description |
|
|
29
|
+
| -------- | ------------------------------------------------------------- | ------ | -------------------------------------------------------- |
|
|
30
|
+
| register | `name` (string) - The tag name to register the element under. | | Registers the element with the browser under a tag name. |
|
|
25
31
|
|
|
26
32
|
### Slots
|
|
27
33
|
|
|
28
|
-
| Name | Description
|
|
29
|
-
| --------- |
|
|
30
|
-
| (default) |
|
|
31
|
-
| trigger | The element in this slot triggers hiding and showing the popover.
|
|
34
|
+
| Name | Description |
|
|
35
|
+
| --------- | ------------------------------------------------------------------------------------------------------------------- |
|
|
36
|
+
| (default) | The content shown in the popover. Screen readers announce its text as the trigger's description, so use plain text. |
|
|
37
|
+
| trigger | The element in this slot triggers hiding and showing the popover. |
|
|
38
|
+
|
|
39
|
+
### CSS shadow parts
|
|
40
|
+
|
|
41
|
+
| Name | Description |
|
|
42
|
+
| ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
43
|
+
| arrow | The positioning anchor for the popover's arrow. The visible arrow shape is its `::before` pseudo-element, so target `::part(arrow)::before` to change color, shadow, or size. Popper sets the arrow's position, so don't override it through this part. |
|
|
44
|
+
| popover | The popover bubble that holds the content. |
|
|
45
|
+
| trigger | The wrapper around the `trigger` slot, useful for correcting alignment between the trigger and the popover. Empty when the `for` attribute is used, because the trigger then lives outside the component. |
|
|
46
|
+
|
|
47
|
+
### CSS custom properties
|
|
48
|
+
|
|
49
|
+
| Name | Description |
|
|
50
|
+
| --------------------------------- | --------------------------------------- |
|
|
51
|
+
| --ds-auro-popover-boxshadow-color | Color of the shadow around the popover. |
|
|
52
|
+
| --ds-auro-popover-container-color | Background color of the popover. |
|
|
53
|
+
| --ds-auro-popover-text-color | Color of the popover text. |
|
|
32
54
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
33
55
|
|
|
34
56
|
## Basic
|
|
@@ -38,7 +60,7 @@ The `auro-popover` element attaches to another element and displays on hover.
|
|
|
38
60
|
<!-- The below content is automatically added from ./../apiExamples/basic.html -->
|
|
39
61
|
<auro-popover>
|
|
40
62
|
Top popover content!
|
|
41
|
-
<auro-button slot="trigger">Popover
|
|
63
|
+
<auro-button slot="trigger">Popover test</auro-button>
|
|
42
64
|
</auro-popover>
|
|
43
65
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
44
66
|
</div>
|
|
@@ -49,18 +71,18 @@ The `auro-popover` element attaches to another element and displays on hover.
|
|
|
49
71
|
|
|
50
72
|
<pre class="language-html"><code class="language-html"><auro-popover>
|
|
51
73
|
Top popover content!
|
|
52
|
-
<auro-button slot="trigger">Popover
|
|
53
|
-
</auro-popover></code></pre>
|
|
74
|
+
<auro-button slot="trigger">Popover test</auro-button>
|
|
75
|
+
</auro-popover></code></pre>
|
|
54
76
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
55
77
|
</auro-accordion>
|
|
56
78
|
|
|
57
79
|
## Apply popover to any type of content
|
|
58
80
|
|
|
59
|
-
The trigger can be any element, not just buttons or links. The component automatically makes any non-focusable trigger keyboard accessible
|
|
81
|
+
The trigger can be any element, not just buttons or links. The component automatically makes any non-focusable trigger keyboard accessible, including custom elements like `auro-icon` that have no internal focusable element. For icon-based triggers without visible text, `aria-label` is still required to provide an accessible name.
|
|
60
82
|
|
|
61
|
-
> **Accessibility note:** `auro-popover` manages `aria-description` on the focusable
|
|
83
|
+
> **Accessibility note:** `auro-popover` manages `aria-description` on the focusable elements within the trigger slot as part of its accessibility contract. The popover content becomes the trigger's accessible description, so screen readers announce it on focus. When the trigger is a non-focusable wrapper around focusable content, such as `<div><a href="#">link</a></div>`, the description is applied to each focusable descendant rather than the wrapper itself. The component replaces any existing `aria-description` on affected elements when it first renders and removes it when it disconnects.
|
|
62
84
|
>
|
|
63
|
-
> **Keyboard behavior:** Non-interactive triggers
|
|
85
|
+
> **Keyboard behavior:** Non-interactive triggers, such as `<abbr>` and `<auro-icon>`, are automatically made keyboard accessible with `tabindex="0"`. `Space` and `Enter` toggle the popover open and closed, so keyboard-only users get the same access as mouse and hover users. Without activation semantics, a keyboard-only user has no way to interact with a non-interactive trigger.
|
|
64
86
|
|
|
65
87
|
<div class="exampleWrapper">
|
|
66
88
|
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/non-interactive-triggers.html) -->
|
|
@@ -69,13 +91,13 @@ The trigger can be any element, not just buttons or links. The component automat
|
|
|
69
91
|
adds tabindex. aria-label is still required to provide an accessible name. -->
|
|
70
92
|
<auro-popover>
|
|
71
93
|
This flight offers priority boarding.
|
|
72
|
-
<auro-icon slot="trigger" category="interface" name="
|
|
94
|
+
<auro-icon slot="trigger" category="interface" name="information-stroke" aria-label="More information"></auro-icon>
|
|
73
95
|
</auro-popover>
|
|
74
96
|
<br><br>
|
|
75
97
|
<!-- Native elements like <abbr> are automatically made keyboard accessible by the component -->
|
|
76
98
|
<p>Congratulations, you just achieved
|
|
77
99
|
<auro-popover>
|
|
78
|
-
Most Valuable Passenger
|
|
100
|
+
Most Valuable Passenger: Alaska Airlines' mid-tier elite status level.
|
|
79
101
|
<abbr slot="trigger" style="color: orangered">MVP</abbr>
|
|
80
102
|
</auro-popover> status!
|
|
81
103
|
</p>
|
|
@@ -90,31 +112,31 @@ The trigger can be any element, not just buttons or links. The component automat
|
|
|
90
112
|
adds tabindex. aria-label is still required to provide an accessible name. -->
|
|
91
113
|
<auro-popover>
|
|
92
114
|
This flight offers priority boarding.
|
|
93
|
-
<auro-icon slot="trigger" category="interface" name="
|
|
94
|
-
</auro-popover>
|
|
95
|
-
|
|
96
|
-
|
|
115
|
+
<auro-icon slot="trigger" category="interface" name="information-stroke" aria-label="More information"></auro-icon>
|
|
116
|
+
</auro-popover>
|
|
117
|
+
<br><br>
|
|
118
|
+
<!-- Native elements like <abbr> are automatically made keyboard accessible by the component -->
|
|
97
119
|
<p>Congratulations, you just achieved
|
|
98
120
|
<auro-popover>
|
|
99
|
-
Most Valuable Passenger
|
|
121
|
+
Most Valuable Passenger: Alaska Airlines' mid-tier elite status level.
|
|
100
122
|
<abbr slot="trigger" style="color: orangered">MVP</abbr>
|
|
101
123
|
</auro-popover> status!
|
|
102
|
-
</p></code></pre>
|
|
124
|
+
</p></code></pre>
|
|
103
125
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
104
126
|
</auro-accordion>
|
|
105
127
|
|
|
106
|
-
## Property
|
|
128
|
+
## Property and attribute examples
|
|
107
129
|
|
|
108
|
-
### Add
|
|
130
|
+
### Add space around popover
|
|
109
131
|
|
|
110
|
-
Use the `
|
|
132
|
+
Use the `addspace` attribute to add more space between the popover and its trigger.
|
|
111
133
|
|
|
112
134
|
<div class="exampleWrapper">
|
|
113
135
|
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/add-space.html) -->
|
|
114
136
|
<!-- The below content is automatically added from ../apiExamples/add-space.html -->
|
|
115
|
-
<auro-popover
|
|
137
|
+
<auro-popover addspace>
|
|
116
138
|
Notice this popover is a little<br>further away from the trigger.
|
|
117
|
-
<auro-button slot="trigger">Popover
|
|
139
|
+
<auro-button slot="trigger">Popover with additional space above</auro-button>
|
|
118
140
|
</auro-popover>
|
|
119
141
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
120
142
|
</div>
|
|
@@ -123,16 +145,16 @@ Use the `addSpace` attribute to add more space between the popover and it's trig
|
|
|
123
145
|
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/add-space.html) -->
|
|
124
146
|
<!-- The below code snippet is automatically added from ../apiExamples/add-space.html -->
|
|
125
147
|
|
|
126
|
-
<pre class="language-html"><code class="language-html"><auro-popover
|
|
148
|
+
<pre class="language-html"><code class="language-html"><auro-popover addspace>
|
|
127
149
|
Notice this popover is a little<br>further away from the trigger.
|
|
128
|
-
<auro-button slot="trigger">Popover
|
|
129
|
-
</auro-popover></code></pre>
|
|
150
|
+
<auro-button slot="trigger">Popover with additional space above</auro-button>
|
|
151
|
+
</auro-popover></code></pre>
|
|
130
152
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
131
153
|
</auro-accordion>
|
|
132
154
|
|
|
133
155
|
### Boundary
|
|
134
156
|
|
|
135
|
-
Use the `boundary` property to
|
|
157
|
+
Use the `boundary` property to keep the popover inside a container, shifting it horizontally when it would overflow. This example shows a popover in a container without a `boundary` and one in a container with a `boundary`. Set `boundary` to a selector string in HTML or JavaScript. To use an HTML element, set the property in JavaScript.
|
|
136
158
|
|
|
137
159
|
<div class="exampleWrapper">
|
|
138
160
|
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/boundary.html) -->
|
|
@@ -164,14 +186,14 @@ Use the `boundary` property to set the overflow boundary for the `auro-popover`,
|
|
|
164
186
|
Popover content!
|
|
165
187
|
<auro-button slot="trigger">Popover Test</auro-button>
|
|
166
188
|
</auro-popover>
|
|
167
|
-
</div>
|
|
168
|
-
|
|
189
|
+
</div>
|
|
190
|
+
<strong>Example with boundary set</strong>
|
|
169
191
|
<div id="popoverBoundary" style="height: 150px; width: 200px; background-color: #fcfcfc; border: 1px solid darkgray;">
|
|
170
192
|
<auro-popover class="boundaryExample" placement="bottom">
|
|
171
193
|
Popover content!
|
|
172
194
|
<auro-button slot="trigger">Popover Test</auro-button>
|
|
173
195
|
</auro-popover>
|
|
174
|
-
</div></code></pre>
|
|
196
|
+
</div></code></pre>
|
|
175
197
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
176
198
|
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/boundary.js) -->
|
|
177
199
|
<!-- The below code snippet is automatically added from ../apiExamples/boundary.js -->
|
|
@@ -179,22 +201,21 @@ Use the `boundary` property to set the overflow boundary for the `auro-popover`,
|
|
|
179
201
|
<pre class="language-js"><code class="language-js">export function boundaryExample() {
|
|
180
202
|
const boundaryExample = document.querySelector(".boundaryExample");
|
|
181
203
|
const popoverBoundary = document.querySelector("#popoverBoundary");
|
|
182
|
-
|
|
183
|
-
boundaryExample.boundary = popoverBoundary;
|
|
204
|
+
boundaryExample.boundary = popoverBoundary;
|
|
184
205
|
}</code></pre>
|
|
185
206
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
186
207
|
</auro-accordion>
|
|
187
208
|
|
|
188
209
|
### Disabled
|
|
189
210
|
|
|
190
|
-
When the `disabled` attribute is present, the popover
|
|
211
|
+
When the `disabled` attribute is present, the popover doesn't appear on hover, focus, touch, or keyboard activation.
|
|
191
212
|
|
|
192
213
|
<div class="exampleWrapper">
|
|
193
214
|
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/disabled.html) -->
|
|
194
215
|
<!-- The below content is automatically added from ../apiExamples/disabled.html -->
|
|
195
216
|
<auro-popover disabled>
|
|
196
217
|
Top popover content!
|
|
197
|
-
<auro-button disabled slot="trigger">Popover
|
|
218
|
+
<auro-button disabled slot="trigger">Popover test</auro-button>
|
|
198
219
|
</auro-popover>
|
|
199
220
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
200
221
|
</div>
|
|
@@ -205,21 +226,21 @@ When the `disabled` attribute is present, the popover will not appear on hover o
|
|
|
205
226
|
|
|
206
227
|
<pre class="language-html"><code class="language-html"><auro-popover disabled>
|
|
207
228
|
Top popover content!
|
|
208
|
-
<auro-button disabled slot="trigger">Popover
|
|
209
|
-
</auro-popover></code></pre>
|
|
229
|
+
<auro-button disabled slot="trigger">Popover test</auro-button>
|
|
230
|
+
</auro-popover></code></pre>
|
|
210
231
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
211
232
|
</auro-accordion>
|
|
212
233
|
|
|
213
234
|
### Placement
|
|
214
235
|
|
|
215
|
-
Use the `placement` attribute to set the position of the popover in relation to the trigger element. Options are `top` and `bottom`.
|
|
236
|
+
Use the `placement` attribute to set the position of the popover in relation to the trigger element. Options are `top` and `bottom`. The popover flips to the opposite side when there isn't room.
|
|
216
237
|
|
|
217
238
|
<div class="exampleWrapper">
|
|
218
239
|
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/placement.html) -->
|
|
219
240
|
<!-- The below content is automatically added from ../apiExamples/placement.html -->
|
|
220
241
|
<auro-popover placement="bottom">
|
|
221
242
|
Bottom popover content!
|
|
222
|
-
<auro-button slot="trigger">Popover
|
|
243
|
+
<auro-button slot="trigger">Popover test</auro-button>
|
|
223
244
|
</auro-popover>
|
|
224
245
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
225
246
|
</div>
|
|
@@ -230,25 +251,25 @@ Use the `placement` attribute to set the position of the popover in relation to
|
|
|
230
251
|
|
|
231
252
|
<pre class="language-html"><code class="language-html"><auro-popover placement="bottom">
|
|
232
253
|
Bottom popover content!
|
|
233
|
-
<auro-button slot="trigger">Popover
|
|
234
|
-
</auro-popover></code></pre>
|
|
254
|
+
<auro-button slot="trigger">Popover test</auro-button>
|
|
255
|
+
</auro-popover></code></pre>
|
|
235
256
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
236
257
|
</auro-accordion>
|
|
237
258
|
|
|
238
|
-
### Remove
|
|
259
|
+
### Remove space around popover
|
|
239
260
|
|
|
240
|
-
Use the `
|
|
261
|
+
Use the `removespace` attribute to lessen the space between the popover and its trigger.
|
|
241
262
|
|
|
242
263
|
<div class="exampleWrapper">
|
|
243
264
|
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/remove-space.html) -->
|
|
244
265
|
<!-- The below content is automatically added from ../apiExamples/remove-space.html -->
|
|
245
|
-
<auro-popover
|
|
266
|
+
<auro-popover removespace>
|
|
246
267
|
Notice this popover is a little<br>closer to the trigger.
|
|
247
|
-
<auro-button slot="trigger">Popover
|
|
268
|
+
<auro-button slot="trigger">Popover with less space above</auro-button>
|
|
248
269
|
</auro-popover>
|
|
249
|
-
<auro-popover placement="bottom"
|
|
270
|
+
<auro-popover placement="bottom" removespace>
|
|
250
271
|
Notice this popover is a little<br>closer to the trigger.
|
|
251
|
-
<auro-button slot="trigger">Popover
|
|
272
|
+
<auro-button slot="trigger">Popover with less space below</auro-button>
|
|
252
273
|
</auro-popover>
|
|
253
274
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
254
275
|
</div>
|
|
@@ -257,26 +278,131 @@ Use the `removeSpace` attribute to lessen the space between the popover and it's
|
|
|
257
278
|
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/remove-space.html) -->
|
|
258
279
|
<!-- The below code snippet is automatically added from ../apiExamples/remove-space.html -->
|
|
259
280
|
|
|
260
|
-
<pre class="language-html"><code class="language-html"><auro-popover
|
|
281
|
+
<pre class="language-html"><code class="language-html"><auro-popover removespace>
|
|
261
282
|
Notice this popover is a little<br>closer to the trigger.
|
|
262
|
-
<auro-button slot="trigger">Popover
|
|
263
|
-
</auro-popover>
|
|
264
|
-
|
|
283
|
+
<auro-button slot="trigger">Popover with less space above</auro-button>
|
|
284
|
+
</auro-popover>
|
|
285
|
+
<auro-popover placement="bottom" removespace>
|
|
265
286
|
Notice this popover is a little<br>closer to the trigger.
|
|
266
|
-
<auro-button slot="trigger">Popover
|
|
267
|
-
</auro-popover></code></pre>
|
|
287
|
+
<auro-button slot="trigger">Popover with less space below</auro-button>
|
|
288
|
+
</auro-popover></code></pre>
|
|
289
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
290
|
+
</auro-accordion>
|
|
291
|
+
|
|
292
|
+
## CSS shadow part examples
|
|
293
|
+
|
|
294
|
+
The component exposes the `popover` bubble, the `arrow`, and the `trigger` wrapper as CSS shadow parts, so they can be styled from outside the shadow DOM.
|
|
295
|
+
|
|
296
|
+
Three things to know before reaching for these:
|
|
297
|
+
|
|
298
|
+
**The arrow's visible shape is a pseudo-element.** `::part(arrow)` selects an invisible positioning anchor; the diamond you see is its `::before`. Target `::part(arrow)::before` to change color, shadow, or size. Because the arrow and the bubble are painted separately, recolor both together or the seam between them shows.
|
|
299
|
+
|
|
300
|
+
**The arrow's position belongs to the component.** Placement is set by Popper as inline styles that are recalculated every time the popover opens, so `transform`, `top`, `left`, and `position` cannot be overridden through `::part(arrow)`. Use the `placement` attribute to choose which side the popover appears on. Resizing the arrow via `::part(arrow)::before` also shifts where it meets the bubble, so verify both `placement="top"` and `placement="bottom"` if you change its dimensions.
|
|
301
|
+
|
|
302
|
+
**The `trigger` part is empty when you use `for`.** It wraps the trigger slot, so it only has something to style when the trigger is slotted into the component. If you point at an external element with `for`, that element is not inside the wrapper and `::part(trigger)` silently does nothing. Style the external trigger directly instead.
|
|
303
|
+
|
|
304
|
+
To adjust spacing between the popover and its trigger, prefer the `addspace` and `removespace` attributes over part overrides.
|
|
305
|
+
|
|
306
|
+
<div class="exampleWrapper">
|
|
307
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/cssParts.html) -->
|
|
308
|
+
<!-- The below content is automatically added from ../apiExamples/cssParts.html -->
|
|
309
|
+
<!-- Scoped to .cssPartsExample. Keep every line in this <style> block at
|
|
310
|
+
column zero with no blank lines: the docs generator indents it, and a
|
|
311
|
+
4-space indent turns it into a code block. -->
|
|
312
|
+
<style>
|
|
313
|
+
/* Bubble container. */
|
|
314
|
+
.cssPartsExample auro-popover::part(popover) {
|
|
315
|
+
color: #fff;
|
|
316
|
+
border-radius: 0;
|
|
317
|
+
background-color: #01426a;
|
|
318
|
+
}
|
|
319
|
+
/* `color` above only reaches bare text; element content is matched by
|
|
320
|
+
::slotted(*), which beats inheritance. Set the token or markup loses contrast. */
|
|
321
|
+
.cssPartsExample auro-popover {
|
|
322
|
+
--ds-auro-popover-text-color: #fff;
|
|
323
|
+
}
|
|
324
|
+
/* The visible arrow is the part's ::before, not ::part(arrow) itself.
|
|
325
|
+
Match the bubble background or a seam shows. */
|
|
326
|
+
.cssPartsExample auro-popover::part(arrow)::before {
|
|
327
|
+
background-color: #01426a;
|
|
328
|
+
}
|
|
329
|
+
/* Trigger wrapper — aligns an icon trigger with adjacent text. */
|
|
330
|
+
.cssPartsExample .iconTrigger auro-popover::part(trigger) {
|
|
331
|
+
display: inline-flex;
|
|
332
|
+
align-items: center;
|
|
333
|
+
}
|
|
334
|
+
</style>
|
|
335
|
+
<div class="cssPartsExample">
|
|
336
|
+
<auro-popover>
|
|
337
|
+
This bubble and its arrow are restyled from outside the shadow DOM.
|
|
338
|
+
<auro-button slot="trigger">Popover test</auro-button>
|
|
339
|
+
</auro-popover>
|
|
340
|
+
<p class="iconTrigger">
|
|
341
|
+
Checked baggage fees apply
|
|
342
|
+
<auro-popover placement="bottom">
|
|
343
|
+
Fees vary by route and fare class.
|
|
344
|
+
<auro-icon slot="trigger" category="interface" name="information-stroke" aria-label="More information"></auro-icon>
|
|
345
|
+
</auro-popover>
|
|
346
|
+
</p>
|
|
347
|
+
</div>
|
|
348
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
349
|
+
</div>
|
|
350
|
+
<auro-accordion alignRight>
|
|
351
|
+
<span slot="trigger">See code</span>
|
|
352
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/cssParts.html) -->
|
|
353
|
+
<!-- The below code snippet is automatically added from ../apiExamples/cssParts.html -->
|
|
354
|
+
|
|
355
|
+
<pre class="language-html"><code class="language-html"><!-- Scoped to .cssPartsExample. Keep every line in this <style> block at
|
|
356
|
+
column zero with no blank lines: the docs generator indents it, and a
|
|
357
|
+
4-space indent turns it into a code block. -->
|
|
358
|
+
<style>
|
|
359
|
+
/* Bubble container. */
|
|
360
|
+
.cssPartsExample auro-popover::part(popover) {
|
|
361
|
+
color: #fff;
|
|
362
|
+
border-radius: 0;
|
|
363
|
+
background-color: #01426a;
|
|
364
|
+
}
|
|
365
|
+
/* `color` above only reaches bare text; element content is matched by
|
|
366
|
+
::slotted(*), which beats inheritance. Set the token or markup loses contrast. */
|
|
367
|
+
.cssPartsExample auro-popover {
|
|
368
|
+
--ds-auro-popover-text-color: #fff;
|
|
369
|
+
}
|
|
370
|
+
/* The visible arrow is the part's ::before, not ::part(arrow) itself.
|
|
371
|
+
Match the bubble background or a seam shows. */
|
|
372
|
+
.cssPartsExample auro-popover::part(arrow)::before {
|
|
373
|
+
background-color: #01426a;
|
|
374
|
+
}
|
|
375
|
+
/* Trigger wrapper — aligns an icon trigger with adjacent text. */
|
|
376
|
+
.cssPartsExample .iconTrigger auro-popover::part(trigger) {
|
|
377
|
+
display: inline-flex;
|
|
378
|
+
align-items: center;
|
|
379
|
+
}
|
|
380
|
+
</style>
|
|
381
|
+
<div class="cssPartsExample">
|
|
382
|
+
<auro-popover>
|
|
383
|
+
This bubble and its arrow are restyled from outside the shadow DOM.
|
|
384
|
+
<auro-button slot="trigger">Popover test</auro-button>
|
|
385
|
+
</auro-popover>
|
|
386
|
+
<p class="iconTrigger">
|
|
387
|
+
Checked baggage fees apply
|
|
388
|
+
<auro-popover placement="bottom">
|
|
389
|
+
Fees vary by route and fare class.
|
|
390
|
+
<auro-icon slot="trigger" category="interface" name="information-stroke" aria-label="More information"></auro-icon>
|
|
391
|
+
</auro-popover>
|
|
392
|
+
</p>
|
|
393
|
+
</div></code></pre>
|
|
268
394
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
269
395
|
</auro-accordion>
|
|
270
396
|
|
|
271
|
-
## Common
|
|
397
|
+
## Common usage patterns
|
|
272
398
|
|
|
273
399
|
### Guidelines
|
|
274
400
|
|
|
275
|
-
|
|
401
|
+
Use `auro-popover` only when the interaction and its content are passive. Don't use a popover when people must shift focus and acknowledge the content. For those cases, see the [auro-dialog](https://auro.alaskaair.com/components/auro/dialog) element.
|
|
276
402
|
|
|
277
|
-
|
|
403
|
+
Don't use a hyperlink as the trigger. On mobile devices, a tap opens the popover and also follows the hyperlink, which defeats the popover.
|
|
278
404
|
|
|
279
|
-
|
|
405
|
+
Using a hyperlink to run an action in the UI is semantically incorrect and confuses screen reader users.
|
|
280
406
|
|
|
281
407
|
<div class="exampleWrapper">
|
|
282
408
|
<auro-alert type="error" noIcon>
|
|
@@ -297,10 +423,10 @@ The use of a hyperlink to trigger an event in the UI is semantically incorrect a
|
|
|
297
423
|
<pre class="language-html"><code class="language-html"><auro-popover>
|
|
298
424
|
This works, but not recommended
|
|
299
425
|
<auro-hyperlink href="#" relative nav slot="trigger">hyperlink popover trigger</auro-hyperlink>
|
|
300
|
-
</auro-popover></code></pre>
|
|
426
|
+
</auro-popover></code></pre>
|
|
301
427
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
302
428
|
</auro-accordion>
|
|
303
|
-
|
|
429
|
+
If you need the look of a hyperlink, add `role="button"` to it so screen readers announce a button.
|
|
304
430
|
|
|
305
431
|
<div class="exampleWrapper">
|
|
306
432
|
<auro-alert type="success" noIcon>
|
|
@@ -321,21 +447,20 @@ In the event that a hyperlink UI is desired, it is recommended to use the `role=
|
|
|
321
447
|
<pre class="language-html"><code class="language-html"><auro-popover>
|
|
322
448
|
Role button is recommended
|
|
323
449
|
<auro-hyperlink role="button" slot="trigger">hyperlink, role button</auro-hyperlink>
|
|
324
|
-
</auro-popover></code></pre>
|
|
450
|
+
</auro-popover></code></pre>
|
|
325
451
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
326
452
|
</auro-accordion>
|
|
327
453
|
|
|
328
|
-
## Restyle
|
|
454
|
+
## Restyle with CSS custom properties
|
|
329
455
|
|
|
330
|
-
|
|
456
|
+
Restyle the component by changing the values of the following tokens.
|
|
331
457
|
|
|
332
458
|
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../src/styles/tokens.scss) -->
|
|
333
459
|
<!-- The below code snippet is automatically added from ./../src/styles/tokens.scss -->
|
|
334
460
|
|
|
335
461
|
<pre class="language-scss"><code class="language-scss">@use "@aurodesignsystem/design-tokens/dist/legacy/auro-classic/SCSSVariables" as vac;
|
|
336
462
|
@use "@aurodesignsystem/design-tokens/dist/themes/alaska/SCSSVariables--alaska" as v;
|
|
337
|
-
|
|
338
|
-
:host {
|
|
463
|
+
:host {
|
|
339
464
|
--ds-auro-popover-boxshadow-color: var(--ds-elevation-200, #{vac.$ds-elevation-200});
|
|
340
465
|
--ds-auro-popover-container-color: var(--ds-basic-color-surface-default, #{v.$ds-basic-color-surface-default});
|
|
341
466
|
--ds-auro-popover-text-color: var(--ds-basic-color-texticon-default, #{v.$ds-basic-color-texticon-default});
|