Skip to content
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 @@ -105,3 +105,79 @@ export const darkThemeRTL_TestOnly = (): string => html`
`;

darkThemeRTL_TestOnly.parameters = { themes: modesDarkDefault };

export const interactivityStates = (): string => html`
<div>
<h2>appearance="solid" & kind="neutral"</h2>
<calcite-chip-group selection-mode="single">
<calcite-chip appearance="solid" kind="neutral" value="forest">Forest</calcite-chip>
<calcite-chip appearance="solid" kind="neutral" value="tundra">Tundra</calcite-chip>
<calcite-chip appearance="solid" kind="neutral" value="shore">Seashore</calcite-chip>
<calcite-chip appearance="solid" kind="neutral" value="estuary">Estuary</calcite-chip>
</calcite-chip-group>

<h2>appearance="solid" & kind="inverse"</h2>
<calcite-chip-group selection-mode="single">
<calcite-chip appearance="solid" kind="inverse" value="forest">Forest</calcite-chip>
<calcite-chip appearance="solid" kind="inverse" value="tundra">Tundra</calcite-chip>
<calcite-chip appearance="solid" kind="inverse" value="shore">Seashore</calcite-chip>
<calcite-chip appearance="solid" kind="inverse" value="estuary">Estuary</calcite-chip>
</calcite-chip-group>

<h2>appearance="solid" & kind="brand"</h2>
<calcite-chip-group selection-mode="single">
<calcite-chip appearance="solid" kind="brand" value="forest">Forest</calcite-chip>
<calcite-chip appearance="solid" kind="brand" value="tundra">Tundra</calcite-chip>
<calcite-chip appearance="solid" kind="brand" value="shore">Seashore</calcite-chip>
<calcite-chip appearance="solid" kind="brand" value="estuary">Estuary</calcite-chip>
</calcite-chip-group>

<h2>appearance="outline-fill" & kind="neutral"</h2>
<calcite-chip-group selection-mode="single">
<calcite-chip appearance="outline-fill" kind="neutral" value="forest">Forest</calcite-chip>
<calcite-chip appearance="outline-fill" kind="neutral" value="tundra">Tundra</calcite-chip>
<calcite-chip appearance="outline-fill" kind="neutral" value="shore">Seashore</calcite-chip>
<calcite-chip appearance="outline-fill" kind="neutral" value="estuary">Estuary</calcite-chip>
</calcite-chip-group>

<h2>appearance="outline-fill" & kind="inverse"</h2>
<calcite-chip-group selection-mode="single">
<calcite-chip appearance="outline-fill" kind="inverse" value="forest">Forest</calcite-chip>
<calcite-chip appearance="outline-fill" kind="inverse" value="tundra">Tundra</calcite-chip>
<calcite-chip appearance="outline-fill" kind="inverse" value="shore">Seashore</calcite-chip>
<calcite-chip appearance="outline-fill" kind="inverse" value="estuary">Estuary</calcite-chip>
</calcite-chip-group>

<h2>appearance="outline-fill" & kind="brand"</h2>
<calcite-chip-group selection-mode="single">
<calcite-chip appearance="outline-fill" kind="brand" value="forest">Forest</calcite-chip>
<calcite-chip appearance="outline-fill" kind="brand" value="tundra">Tundra</calcite-chip>
<calcite-chip appearance="outline-fill" kind="brand" value="shore">Seashore</calcite-chip>
<calcite-chip appearance="outline-fill" kind="brand" value="estuary">Estuary</calcite-chip>
</calcite-chip-group>

<h2>appearance="outline" & kind="neutral"</h2>
<calcite-chip-group selection-mode="single">
<calcite-chip appearance="outline" kind="neutral" value="forest">Forest</calcite-chip>
<calcite-chip appearance="outline" kind="neutral" value="tundra">Tundra</calcite-chip>
<calcite-chip appearance="outline" kind="neutral" value="shore">Seashore</calcite-chip>
<calcite-chip appearance="outline" kind="neutral" value="estuary">Estuary</calcite-chip>
</calcite-chip-group>

<h2>appearance="outline" & kind="inverse"</h2>
<calcite-chip-group selection-mode="single">
<calcite-chip appearance="outline" kind="inverse" value="forest">Forest</calcite-chip>
<calcite-chip appearance="outline" kind="inverse" value="tundra">Tundra</calcite-chip>
<calcite-chip appearance="outline" kind="inverse" value="shore">Seashore</calcite-chip>
<calcite-chip appearance="outline" kind="inverse" value="estuary">Estuary</calcite-chip>
</calcite-chip-group>

<h2>appearance="outline" & kind="brand"</h2>
<calcite-chip-group selection-mode="single">
<calcite-chip appearance="outline" kind="brand" value="forest">Forest</calcite-chip>
<calcite-chip appearance="outline" kind="brand" value="tundra">Tundra</calcite-chip>
<calcite-chip appearance="outline" kind="brand" value="shore">Seashore</calcite-chip>
<calcite-chip appearance="outline" kind="brand" value="estuary">Estuary</calcite-chip>
</calcite-chip-group>
</div>
`;
89 changes: 89 additions & 0 deletions packages/calcite-components/src/components/chip/chip.scss
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,95 @@
opacity: 1;
}

:host([appearance="solid"]) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would internal CSS props help simplify this?

.container {
  &.selectable {
    &:active {
      background-color: var(--calcite-internal-chip-selectable-active-background-color);
      border-color: var(--calcite-internal-chip-selectable-active-border-color);
    }
    &:hover {
      background-color: var(--calcite-internal-chip-selectable-hover-background-color);
      border-color: var(--calcite-internal-chip-selectable-hover-border-color);
    }
}

:host([appearance="solid"]) {
  &:host([kind="neutral"]) {
    // using illustrative names
    --calcite-internal-chip-selectable-active-background-color: var(--calcite-color-a);
    --calcite-internal-chip-selectable-active-border-color: transparent;
    --calcite-internal-chip-selectable-hover-background-color: var(--calcite-color-c);
    --calcite-internal-chip-selectable-hover-border-color: transparent;    
  }
}

// ...

This can be done in a follow-up if feasible.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can take a look at this and create a follow-up issue if it's feasible.

&:host([kind="neutral"]) .container {
&.selectable {
&:hover {
background-color: var(--calcite-color-foreground-3);
}
&:active {
background-color: var(--calcite-color-border-3);
}
}
}

&:host([kind="inverse"]) .container {
&.selectable {
&:hover {
background-color: var(--calcite-color-inverse-hover);
}
&:active {
background-color: var(--calcite-color-inverse-press);
}
}
}

&:host([kind="brand"]) .container {
&.selectable {
&:hover {
background-color: var(--calcite-color-brand-hover);
}
&:active {
background-color: var(--calcite-color-brand-press);
}
}
}
}

:host([appearance="outline-fill"]) {
&:host([kind="neutral"]) .container {
&.selectable {
&:hover {
background-color: var(--calcite-color-foreground-2);
border-color: var(--calcite-color-border-input);
}
&:active {
background-color: var(--calcite-color-foreground-3);
border-color: var(--calcite-color-text-3);
}
}
}

&:host([kind="inverse"]) .container,
&:host([kind="brand"]) .container {
&.selectable {
&:hover {
background-color: var(--calcite-color-foreground-2);
}
&:active {
background-color: var(--calcite-color-foreground-3);
}
}
}
}

:host([appearance="outline"]) {
&:host([kind="neutral"]) .container {
&.selectable {
&:hover {
background-color: var(--calcite-color-transparent-hover);
border-color: var(--calcite-color-border-input);
}
&:active {
background-color: var(--calcite-color-transparent-press);
border-color: var(--calcite-color-text-3);
}
}
}

&:host([kind="inverse"]) .container,
&:host([kind="brand"]) .container {
&.selectable {
&:hover {
background-color: var(--calcite-color-transparent-hover);
}
&:active {
background-color: var(--calcite-color-transparent-press);
}
}
}
}

:host([scale="s"]) {
.container {
--calcite-internal-chip-block-size: var(--calcite-size-sm, 1.5rem) /* 24px */;
Expand Down