Skip to content

Commit 809ad9a

Browse files
committed
fix: change outline prop to variants
1 parent d75ee35 commit 809ad9a

File tree

8 files changed

+51
-44
lines changed

8 files changed

+51
-44
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ In cases where the project is not able to process JS assets, there are pre-proce
104104
<auro-tail tail="AS"></auro-tail>
105105
<auro-tail tail="HA"></auro-tail>
106106
</auro-tail-group>
107-
<auro-tail tail="PR" size="xl" outline style="--ds-auro-tail-border-width: 3px; --ds-auro-tail-border-color: red"></auro-tail>
107+
<auro-tail tail="PR" size="xl" variant="outline" style="--ds-auro-tail-border-width: 3px; --ds-auro-tail-border-color: red"></auro-tail>
108108
```
109109
<!-- AURO-GENERATED-CONTENT:END -->
110110

apiExamples/basic.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
<auro-tail tail="HA"></auro-tail>
1313
</auro-tail-group>
1414

15-
<auro-tail tail="PR" size="xl" outline style="--ds-auro-tail-border-width: 3px; --ds-auro-tail-border-color: red"></auro-tail>
15+
<auro-tail tail="PR" size="xl" variant="outline" style="--ds-auro-tail-border-width: 3px; --ds-auro-tail-border-color: red"></auro-tail>

apiExamples/outline.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1-
<auro-tail tail="S7" outline></auro-tail>
2-
<auro-tail tail="KE" outline></auro-tail>
1+
<auro-tail tail="S7" variant="outline"></auro-tail>
2+
<auro-tail tail="KE" variant="outline"></auro-tail>
3+
<auro-tail tail="AS" variant="outline"></auro-tail>
4+
<auro-tail tail="HA" variant="outline"></auro-tail>

docs/api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ The auro-tail element displays Alaska, Hawaiian, and partner airline tail graphi
88
| ---------- | ---------- | --------- | ------------------- | --------- | ----------------------------------------------------------------------------------------- |
99
| badge | badge | | string \| undefined | undefined | Sets the badge type to display (e.g., `oneworld`). |
1010
| href | href | | string \| undefined | undefined | Sets the href for the tail. |
11-
| outline | outline | | boolean | false | Renders the tail with an outline style. |
1211
| size | size | | string | 'lg' | Sets the size of the tail. Valid values: `xs`, `sm`, `md`, `lg`, `xl`, `2xl` |
1312
| tail | tail | | string | 'AS' | Sets the airline tail based on the tail codes used in auro-icon (e.g., `AS`, `HA`, `PR`). |
13+
| variant | variant | | string \| undefined | undefined | Sets the visual variant of the tail. Valid values: `outline` |
1414

1515
### Methods
1616

docs/partials/api.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,15 @@ Example:
9999
<!-- AURO-GENERATED-CONTENT:END -->
100100
</auro-accordion>
101101

102-
## Outline
102+
## Variant
103103

104-
Set the `outline` boolean prop to add an outline around the tail graphic.
104+
Set the `variant` attribute to change the visual style of the tail.
105105

106-
- Outlines apply only to partner (OA) tails
107-
- AAG tails (AS & HA) never feature outlines
108-
- Width & color are predefined and not customizable
106+
### Available variants:
107+
- `outline` - Adds an outline around the tail graphic
108+
- Outlines apply only to partner (OA) tails
109+
- AAG tails (AS & HA) never feature outlines
110+
- Width & color are predefined and not customizable
109111

110112
<div class="exampleWrapper">
111113
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/outline.html) -->

src/auro-tail.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export class AuroTail extends LitElement {
5454
tail: { type: String },
5555
badge: { type: String },
5656
size: { type: String, reflect: true },
57-
outline: { type: Boolean, reflect: true },
57+
variant: { type: String, reflect: true },
5858
href: { type: String, attribute: 'href' }
5959
};
6060
}
@@ -89,23 +89,23 @@ export class AuroTail extends LitElement {
8989
*/
9090
this.size = 'lg';
9191
/**
92-
* Renders the tail with an outline style.
93-
* @type {boolean}
92+
* Sets the visual variant of the tail. Valid values: `outline`
93+
* @type {string | undefined}
9494
*/
95-
this.outline = false;
95+
this.variant = undefined;
9696
/**
9797
* Sets the href for the tail.
9898
* @type {string | undefined}
9999
*/
100100
this.href = undefined;
101101

102102
/**
103-
* Determines the carrier variant based on tail code. Valid values: `aag`, `oa`
103+
* Determines the carrier type based on tail code. Valid values: `aag`, `oa`
104104
* Used internally for styling.
105105
* @private
106106
* @type {string}
107107
*/
108-
this._variant = 'oa';
108+
this._carrierType = 'oa';
109109

110110
/**
111111
* Optional internal callback invoked on hyperlink click before the custom
@@ -165,11 +165,11 @@ export class AuroTail extends LitElement {
165165
}
166166

167167
/**
168-
* Gets the carrier variant based on the current tail code. Returns `aag` or `oa`
168+
* Gets the carrier type based on the current tail code. Returns `aag` or `oa`
169169
* @private
170-
* @returns {string} The carrier variant
170+
* @returns {string} The carrier type
171171
*/
172-
get variant() {
172+
get carrierType() {
173173
// Carrier mappings
174174
const carriers = {
175175
'aag': ['as', 'ha'],
@@ -284,11 +284,11 @@ export class AuroTail extends LitElement {
284284
* @param {Map<string, any>} changedProperties - Changed properties
285285
*/
286286
updated(changedProperties) {
287-
// Update internal variant when tail changes
287+
// Update internal carrier type when tail changes
288288
if (changedProperties.has('tail')) {
289-
this._variant = this.variant;
290-
// Set variant as data attribute for CSS targeting.
291-
this.dataset.variant = this.variant;
289+
this._carrierType = this.carrierType;
290+
// Set carrier type as data attribute for CSS targeting.
291+
this.dataset.carrierType = this.carrierType;
292292
}
293293
super.updated(changedProperties);
294294
}

src/styles/auro-tail.scss

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,16 @@
9191
}
9292

9393
/* drop-shadow: apply to AAG carriers */
94-
:host([data-variant="aag"]) [auro-icon] {
94+
:host([data-carrier-type="aag"]) [auro-icon] {
9595
filter: var(--ds-auro-tail-tail-drop-shadow);
9696
}
9797

98-
/* outline: apply to OA carriers only when outline prop is present */
98+
/* outline: apply to OA carriers only when variant="outline" prop is present */
9999
/* Use multiple sharp drop-shadows to create crisp outline & trace SVG curves */
100-
:host([data-variant="oa"][outline]) [auro-icon] {
100+
/* Margin offset accounts for stacked drop-shadows (1px per drop-shadow line) to shift layout within container */
101+
:host([data-carrier-type="oa"][variant="outline"]) [auro-icon] {
102+
margin-left: calc(-1 * var(--ds-auro-tail-tail-outline-width) * 2);
103+
margin-top: calc(var(--ds-auro-tail-tail-outline-width) * 2);
101104
filter:
102105
drop-shadow(var(--ds-auro-tail-tail-outline-width) 0 0 var(--ds-auro-tail-tail-outline-color))
103106
drop-shadow(calc(-1 * var(--ds-auro-tail-tail-outline-width)) 0 0 var(--ds-auro-tail-tail-outline-color))

test/auro-tail.test.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,19 @@ describe("auro-tail", () => {
2020
const el = /** @type {AuroTail} */ (await fixture(html`<auro-tail></auro-tail>`));
2121
expect(el.tail).to.equal("AS");
2222
expect(el.size).to.equal("lg");
23-
expect(el.outline).to.be.false;
23+
expect(el.variant).to.equal(undefined);
2424
expect(el.href).to.equal(undefined);
2525
});
2626

27-
it("sets data-variant based on tail code and updates when tail changes", async () => {
27+
it("sets data-carrier-type based on tail code and updates when tail changes", async () => {
2828
const el = /** @type {AuroTail} */ (await fixture(html`<auro-tail tail="AS"></auro-tail>`));
29-
expect(el.dataset.variant).to.equal("aag");
29+
expect(el.dataset.carrierType).to.equal("aag");
3030
el.tail = "OA";
3131
await el.updateComplete;
32-
expect(el.dataset.variant).to.equal("oa");
32+
expect(el.dataset.carrierType).to.equal("oa");
3333
el.tail = "PR";
3434
await el.updateComplete;
35-
expect(el.dataset.variant).to.equal("oa");
35+
expect(el.dataset.carrierType).to.equal("oa");
3636
});
3737

3838
it("computes labelTypeClass per size map", async () => {
@@ -166,12 +166,12 @@ describe("auro-tail", () => {
166166
expect(calls).to.equal(1);
167167
});
168168

169-
it("updates variant after tail change inside same instance", async () => {
169+
it("updates carrierType after tail change inside same instance", async () => {
170170
const el = /** @type {AuroTail} */ (await fixture(html`<auro-tail tail="HA"></auro-tail>`));
171-
expect(el.dataset.variant).to.equal("aag");
171+
expect(el.dataset.carrierType).to.equal("aag");
172172
el.tail = "OA";
173173
await el.updateComplete;
174-
expect(el.dataset.variant).to.equal("oa");
174+
expect(el.dataset.carrierType).to.equal("oa");
175175
});
176176

177177
it("shouldShowLink false when size not in LINKS_SIZES", async () => {
@@ -199,27 +199,27 @@ describe("auro-tail", () => {
199199
expect(el.shadowRoot.querySelector(".badge")).to.be.null;
200200
});
201201

202-
it("applies outline attribute", async () => {
203-
const el = /** @type {AuroTail} */ (await fixture(html`<auro-tail outline></auro-tail>`));
204-
expect(el.outline).to.be.true;
205-
expect(el.hasAttribute("outline")).to.be.true;
202+
it("applies variant attribute", async () => {
203+
const el = /** @type {AuroTail} */ (await fixture(html`<auro-tail variant="outline"></auro-tail>`));
204+
expect(el.variant).to.equal("outline");
205+
expect(el.getAttribute("variant")).to.equal("outline");
206206
});
207207

208208
it("returns default labelTypeClass for unmapped size", async () => {
209209
const el = /** @type {AuroTail} */ (await fixture(html`<auro-tail size="xs"></auro-tail>`));
210210
expect(el.labelTypeClass).to.equal("body-sm");
211211
});
212212

213-
it("maps Hawaiian (HA) to aag variant", async () => {
213+
it("maps Hawaiian (HA) to aag carrierType", async () => {
214214
const el = /** @type {AuroTail} */ (await fixture(html`<auro-tail tail="HA"></auro-tail>`));
215-
expect(el.variant).to.equal("aag");
216-
expect(el.dataset.variant).to.equal("aag");
215+
expect(el.carrierType).to.equal("aag");
216+
expect(el.dataset.carrierType).to.equal("aag");
217217
});
218218

219-
it("maps unknown carrier codes to oa variant", async () => {
219+
it("maps unknown carrier codes to oa carrierType", async () => {
220220
const el = /** @type {AuroTail} */ (await fixture(html`<auro-tail tail="XX"></auro-tail>`));
221-
expect(el.variant).to.equal("oa");
222-
expect(el.dataset.variant).to.equal("oa");
221+
expect(el.carrierType).to.equal("oa");
222+
expect(el.dataset.carrierType).to.equal("oa");
223223
});
224224

225225
it("renders slot content as label in hyperlink", async () => {

0 commit comments

Comments
 (0)