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

Mock status - Complete migration #321

Merged
merged 1 commit into from
May 27, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</div>
{{else}}
<LinkTo
class="hds-breadcrumb__link {{if @hover 'is-hover'}} {{if @active 'is-active'}} {{if @focus 'is-focus'}}"
class="hds-breadcrumb__link"
@models={{hds-link-to-models @model @models}}
@query={{hds-link-to-query @query}}
@route={{@route}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
<:toggle as |t|>
<button
type="button"
class="hds-breadcrumb__truncation-toggle
{{if @hover 'is-hover'}}
{{if @active 'is-active'}}
{{if @focus 'is-focus'}}"
class="hds-breadcrumb__truncation-toggle"
aria-expanded={{if t.isOpen "true" "false"}}
{{on "click" t.onClickToggle}}
>
Expand Down
7 changes: 2 additions & 5 deletions packages/components/app/styles/components/alert.scss
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@
color: var(--token-color-foreground-action);

&:focus,
&.is-focus,
&:focus-visible {
outline: 2px solid var(--token-color-focus-action-internal);
outline-offset: 1px;
Expand Down Expand Up @@ -132,8 +131,7 @@
margin-top: 1px;
}

&:hover,
&.is-hover {
&:hover {
&::before { // we re-use the pseudo-element created by the "focus-ring" mixin
background-color: rgba(#dedfe3, 0.4);
}
Expand All @@ -142,8 +140,7 @@
// notice: this is used not only for the focus, but also to increase the clickable area
@include hds-focus-ring-with-pseudo-element($top: -4px, $right: -4px, $bottom: -4px, $left: -4px);

&:active,
&.is-active {
&:active {
color: var(--token-color-foreground-secondary);
&::before {
background-color: rgba(#dedfe3, 0.4);
Expand Down
10 changes: 5 additions & 5 deletions packages/components/app/styles/components/breadcrumb.scss
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ $hds-breadcrumb-item-visual-horizontal-padding: 4px;
text-decoration-color: transparent;

&:hover,
&.is-hover {
&.mock-hover {
color: var(--token-color-palette-neutral-600);

> .hds-breadcrumb__text {
Expand All @@ -89,7 +89,7 @@ $hds-breadcrumb-item-visual-horizontal-padding: 4px;
@include hds-focus-ring-basic();

&:active,
&.is-active {
&.mock-active {
color: var(--token-color-foreground-secondary);

> .hds-breadcrumb__text {
Expand Down Expand Up @@ -155,7 +155,7 @@ $hds-breadcrumb-item-visual-horizontal-padding: 4px;
width: $hds-breadcrumb-item-height;

&:hover,
&.is-hover {
&.mock-hover {
border-color: var(--token-color-border-strong);
color: var(--token-color-foreground-faint);
}
Expand All @@ -164,13 +164,13 @@ $hds-breadcrumb-item-visual-horizontal-padding: 4px;
@include hds-focus-ring-basic();

&:focus,
&.is-focus {
&.mock-focus {
background-color: transparent;
border: none; // important: we need to completely remove the border, of the inner box-shadow of the focus ring will be drawn inside the border
}

&:active,
&.is-active {
&.mock-active {
background-color: var(--token-color-surface-interactive-active);
border-color: var(--token-color-border-strong);
color: var(--token-color-foreground-primary);
Expand Down
2 changes: 1 addition & 1 deletion packages/components/app/styles/components/dropdown.scss
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ $hds-dropdown-toggle-border-radius: 5px;
background-color: var(--token-color-surface-interactive-active);
}

&.mock-success {
&.is-success {
background-color: var(--token-color-surface-success);
border-color: var(--token-color-border-success);

Expand Down
8 changes: 2 additions & 6 deletions packages/components/app/styles/mixins/_focus-ring.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

// default focus for browsers that still rely on ":focus"
&:focus,
&.is-focus,
&.mock-focus {
box-shadow: var(--token-focus-ring-#{$color}-box-shadow);
}
Expand All @@ -22,8 +21,7 @@
}
// remove the focus ring on "active + focused" state (by design)
&:focus:active,
&.is-focus.is-active,
&.mock-focus.is-active {
&.mock-focus.mock-active {
box-shadow: none;
}
}
Expand All @@ -47,7 +45,6 @@

// default focus for browsers that still rely on ":focus"
&:focus,
&.is-focus,
&.mock-focus {
&::before {
box-shadow: var(--token-focus-ring-#{$color}-box-shadow);
Expand All @@ -67,8 +64,7 @@
}
// remove the focus ring on "active + focused" state (by design)
&:focus:active,
&.is-focus.is-active,
&.mock-focus.is-active {
&.mock-focus.mock-active {
&::before {
box-shadow: none;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,47 +308,47 @@

<p class="dummy-paragraph">hover</p>
<Hds::Breadcrumb>
<Hds::Breadcrumb::Item @text="Level one" @icon="org" @hover={{true}} />
<Hds::Breadcrumb::Item @text="Level two" @icon="folder" @hover={{true}} />
<Hds::Breadcrumb::Truncation @hover={{true}}>
<Hds::Breadcrumb::Item @text="Level one" @icon="org" mock-state-value="hover" mock-state-selector="a" />
<Hds::Breadcrumb::Item @text="Level two" @icon="folder" mock-state-value="hover" mock-state-selector="a" />
<Hds::Breadcrumb::Truncation mock-state-value="hover" mock-state-selector="button">
<Hds::Breadcrumb::Item @text="Sub-level one" />
<Hds::Breadcrumb::Item @text="Sub-level two with a very long string that we may want to trim somehow" />
<Hds::Breadcrumb::Item @text="Sub-level with icon" @icon="org" />
<Hds::Breadcrumb::Item @text="Another sub-level with icon" @icon="folder" />
</Hds::Breadcrumb::Truncation>
<Hds::Breadcrumb::Item @text="Level four" @hover={{true}} />
<Hds::Breadcrumb::Item @text="Level five" @hover={{true}} />
<Hds::Breadcrumb::Item @text="Current" @current={{true}} @hover={{true}} />
<Hds::Breadcrumb::Item @text="Level four" mock-state-value="hover" mock-state-selector="a" />
<Hds::Breadcrumb::Item @text="Level five" mock-state-value="hover" mock-state-selector="a" />
<Hds::Breadcrumb::Item @text="Current" @current={{true}} mock-state-value="hover" mock-state-selector="a" />
</Hds::Breadcrumb>

<p class="dummy-paragraph">active</p>
<Hds::Breadcrumb>
<Hds::Breadcrumb::Item @text="Level one" @icon="org" @active={{true}} />
<Hds::Breadcrumb::Item @text="Level two" @icon="folder" @active={{true}} />
<Hds::Breadcrumb::Truncation @active={{true}}>
<Hds::Breadcrumb::Item @text="Level one" @icon="org" mock-state-value="active" mock-state-selector="a" />
<Hds::Breadcrumb::Item @text="Level two" @icon="folder" mock-state-value="active" mock-state-selector="a" />
<Hds::Breadcrumb::Truncation mock-state-value="active" mock-state-selector="button">
<Hds::Breadcrumb::Item @text="Sub-level one" />
<Hds::Breadcrumb::Item @text="Sub-level two with a very long string that we may want to trim somehow" />
<Hds::Breadcrumb::Item @text="Sub-level with icon" @icon="org" />
<Hds::Breadcrumb::Item @text="Another sub-level with icon" @icon="folder" />
</Hds::Breadcrumb::Truncation>
<Hds::Breadcrumb::Item @text="Level four" @active={{true}} />
<Hds::Breadcrumb::Item @text="Level five" @active={{true}} />
<Hds::Breadcrumb::Item @text="Current" @current={{true}} @active={{true}} />
<Hds::Breadcrumb::Item @text="Level four" mock-state-value="active" mock-state-selector="a" />
<Hds::Breadcrumb::Item @text="Level five" mock-state-value="active" mock-state-selector="a" />
<Hds::Breadcrumb::Item @text="Current" @current={{true}} mock-state-value="active" mock-state-selector="a" />
</Hds::Breadcrumb>

<p class="dummy-paragraph">focus</p>
<Hds::Breadcrumb>
<Hds::Breadcrumb::Item @text="Level one" @icon="org" @focus={{true}} />
<Hds::Breadcrumb::Item @text="Level two" @icon="folder" @focus={{true}} />
<Hds::Breadcrumb::Truncation @focus={{true}}>
<Hds::Breadcrumb::Item @text="Level one" @icon="org" mock-state-value="focus" mock-state-selector="a" />
<Hds::Breadcrumb::Item @text="Level two" @icon="folder" mock-state-value="focus" mock-state-selector="a" />
<Hds::Breadcrumb::Truncation mock-state-value="focus" mock-state-selector="button">
<Hds::Breadcrumb::Item @text="Sub-level one" />
<Hds::Breadcrumb::Item @text="Sub-level two with a very long string that we may want to trim somehow" />
<Hds::Breadcrumb::Item @text="Sub-level with icon" @icon="org" />
<Hds::Breadcrumb::Item @text="Another sub-level with icon" @icon="folder" />
</Hds::Breadcrumb::Truncation>
<Hds::Breadcrumb::Item @text="Level four" @focus={{true}} />
<Hds::Breadcrumb::Item @text="Level five" @focus={{true}} />
<Hds::Breadcrumb::Item @text="Current" @current={{true}} @focus={{true}} />
<Hds::Breadcrumb::Item @text="Level four" mock-state-value="focus" mock-state-selector="a" />
<Hds::Breadcrumb::Item @text="Level five" mock-state-value="focus" mock-state-selector="a" />
<Hds::Breadcrumb::Item @text="Current" @current={{true}} mock-state-value="focus" mock-state-selector="a" />
</Hds::Breadcrumb>

<h4 class="dummy-h4">Truncation options</h4>
Expand Down