Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update semantic color token names #38

Merged
merged 4 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion demo/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,4 +170,26 @@ export function showToast(toastID) {
};
```
<!-- AURO-GENERATED-CONTENT:END -->
</auro-accordion>
</auro-accordion>

### Theme Support

The component may be restyled using the following code sample and changing the values of the following token(s).

<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../../src/tokens.scss) -->
<!-- The below code snippet is automatically added from ./../../src/tokens.scss -->

```scss
@import "./../node_modules/@aurodesignsystem/design-tokens/dist/tokens/SCSSVariables";

:host {
--ds-auro-toast-background-color: var(--ds-color-brand-gray-400, #{$ds-color-brand-gray-400});
--ds-auro-toast-border-color: var(--ds-color-border-divider-default, #{$ds-color-border-divider-default});
--ds-auro-toast-close-button-icon-color: var(--ds-color-text-primary-inverse, #{$ds-color-text-primary-inverse});
--ds-auro-toast-close-button-background-color: transparent;
--ds-auro-toast-close-button-border-color: transparent;
--ds-auro-toast-icon-color: var(--ds-color-text-primary-inverse, #{$ds-color-text-primary-inverse});
--ds-auro-toast-text-color: var(--ds-color-text-primary-inverse, #{$ds-color-text-primary-inverse});
}
```
<!-- AURO-GENERATED-CONTENT:END -->
8 changes: 8 additions & 0 deletions docs/partials/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,11 @@ Using the `noIcon` attribute will set no icon to be visible in the notification.


</auro-accordion>


### Theme Support

The component may be restyled using the following code sample and changing the values of the following token(s).

<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../../src/tokens.scss) -->
<!-- AURO-GENERATED-CONTENT:END -->
9 changes: 8 additions & 1 deletion src/auro-toast.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ import { LitElement, html } from "lit";

// Import touch detection lib
import styleCss from "./style-css.js";
import colorCss from "./color-css.js";
import tokensCss from "./tokens-css.js";

import closeIcon from '@alaskaairux/icons/dist/icons/interface/x-lg.mjs';
import information from '@alaskaairux/icons/dist/icons/alert/information-stroke.mjs';
import error from '@alaskaairux/icons/dist/icons/alert/error.mjs';
Expand Down Expand Up @@ -68,7 +71,11 @@ export class AuroToast extends LitElement {
}

static get styles() {
return [styleCss];
return [
styleCss,
colorCss,
tokensCss
];
}

/**
Expand Down
43 changes: 43 additions & 0 deletions src/color.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Copyright (c) 2023 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
// See LICENSE in the project root for license information.

// ---------------------------------------------------------------------

// Import Auro tokens
@import './../node_modules/@aurodesignsystem/design-tokens/dist/tokens/SCSSVariables';

:host([visible]) {
background-color: var(--ds-auro-toast-background-color);
color: var(--ds-auro-toast-text-color);

.icon {
color: var(--ds-auro-toast-icon-color);
}

.closeButton {
border-width: 1px;
border-style: solid;
border-color: var(--ds-auro-toast-close-button-border-color);
background-color: var(--ds-auro-toast-close-button-background-color);
color: var(--ds-auro-toast-close-button-icon-color);

&:hover {
--ds-auro-toast-close-button-border-color: var(--ds-color-border-divider-default, #{$ds-color-border-divider-default});
--ds-auro-toast-close-button-background-color: var(--ds-color-container-ui-tertiary-active-default, #{$ds-color-container-ui-tertiary-active-default});
}
}
}

:host([variant='error']) {
--ds-auro-toast-background-color: var(--ds-color-container-error-default, #{$ds-color-container-error-default});
--ds-auro-toast-text-color: var(--ds-color-text-primary-default, #{$ds-color-text-primary-default});
--ds-auro-toast-icon-color: var(--ds-color-icon-error-default, #{$ds-color-icon-error-default});
--ds-auro-toast-close-button-icon-color: var(--ds-color-text-primary-default, #{$ds-color-text-primary-default});
}

:host([variant='success']) {
--ds-auro-toast-background-color: var(--ds-color-container-success-default, #{$ds-color-container-success-default});
--ds-auro-toast-text-color: var(--ds-color-text-primary-default, #{$ds-color-text-primary-default});
--ds-auro-toast-icon-color: var(--ds-color-icon-success-default, #{$ds-color-icon-success-default});
--ds-auro-toast-close-button-icon-color: var(--ds-color-text-primary-default, #{$ds-color-text-primary-default});
}
40 changes: 3 additions & 37 deletions src/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@
:host([visible]) {
display: inline-flex;
min-width: 100%;
min-height: 60px;
min-height: calc(var(--ds-size-700, $ds-size-700) + var(--ds-size-50, $ds-size-50));
padding: var(--ds-size-200, $ds-size-200) var(--ds-size-150, $ds-size-150);
border-radius: 8px;
background-color: var(--ds-color-brand-gray-400, $ds-color-brand-gray-400);
border-radius: var(--ds-size-100, $ds-size-100);
box-shadow: var(--ds-elevation-200, $ds-elevation-200);
color: var(--ds-color-text-primary-inverse, $ds-color-text-primary-inverse);
gap: var(--ds-size-200, $ds-size-200);
pointer-events: auto;

Expand All @@ -43,17 +41,12 @@
height: var(--ds-size-400, $ds-size-400);
padding-right: 0;
padding-left: 0;
border: 2px solid transparent;
border: var(--ds-size-25, $ds-size-25) solid transparent;
margin-left: auto;
background-color: transparent;
color: var(--ds-color-text-primary-inverse, $ds-color-text-primary-inverse);

&:hover {
border: 1px solid var(--ds-color-ui-bkg-hover-default, $ds-color-ui-bkg-hover-default);
border-radius: 50%;
background-color: var(--ds-color-ui-bkg-hover-default, $ds-color-ui-bkg-hover-default);
cursor: pointer;

}
}

Expand All @@ -74,30 +67,3 @@
align-self: center;
}
}

:host([variant='error']) {
background-color: var(--ds-color-alert-bkg-error-default, $ds-color-alert-bkg-error-default);
color: var(--ds-color-text-primary-default, $ds-color-text-primary-default);

.icon {
color: var(--ds-color-text-error-default, $ds-color-text-error-default);
}

}

:host([variant='success']) {
background-color: var(--ds-color-alert-bkg-success-default, $ds-color-alert-bkg-success-default);
color: var(--ds-color-text-primary-default, $ds-color-text-primary-default);

.icon {
color: var(--ds-color-alert-success-default, $ds-color-alert-success-default);
}

}

:host([visible][variant='error']),
:host([visible][variant='success']) {
.closeButton {
color: var(--ds-color-text-primary-default, $ds-color-text-primary-default);
}
}
11 changes: 11 additions & 0 deletions src/tokens.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@import "./../node_modules/@aurodesignsystem/design-tokens/dist/tokens/SCSSVariables";

:host {
--ds-auro-toast-background-color: var(--ds-color-brand-gray-400, #{$ds-color-brand-gray-400});
--ds-auro-toast-border-color: var(--ds-color-border-divider-default, #{$ds-color-border-divider-default});
--ds-auro-toast-close-button-icon-color: var(--ds-color-text-primary-inverse, #{$ds-color-text-primary-inverse});
--ds-auro-toast-close-button-background-color: transparent;
--ds-auro-toast-close-button-border-color: transparent;
--ds-auro-toast-icon-color: var(--ds-color-text-primary-inverse, #{$ds-color-text-primary-inverse});
--ds-auro-toast-text-color: var(--ds-color-text-primary-inverse, #{$ds-color-text-primary-inverse});
}