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

Add Combo theming #561

Merged
merged 3 commits into from
Nov 28, 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
2 changes: 1 addition & 1 deletion src/components/combo/combo-item.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { html, LitElement } from 'lit';
import { themes } from '../../theming/theming-decorator.js';
import { styles } from './themes/light/item/combo-item.base.css';
import { styles } from './themes/light/item/combo-item.base.css.js';
import { styles as bootstrap } from '../dropdown/themes/light/dropdown-item.bootstrap.css';
import { styles as fluent } from '../dropdown/themes/light/dropdown-item.fluent.css';
import { styles as indigo } from '../dropdown/themes/light/dropdown-item.indigo.css';
Expand Down
8 changes: 5 additions & 3 deletions src/components/combo/combo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,14 +316,14 @@ export default class IgcComboComponent<T extends object>
return html`
<igc-input
part="target"
exportparts="container: input, input: native-input, label, prefix, suffix"
@click=${this.toggle}
.value=${ifDefined(this.value)}
readonly
>
<span
slot="suffix"
part="clear-icon"
style="display: flex"
@click=${this.handleClearIconClick}
?hidden=${this.selected.size === 0}
>
Expand All @@ -335,7 +335,7 @@ export default class IgcComboComponent<T extends object>
></igc-icon>
</slot>
</span>
<span slot="suffix" part="toggle-icon" style="display: flex">
<span slot="suffix" part="toggle-icon">
<slot name="toggle-icon">
<igc-icon
name=${this.open ? 'keyboard_arrow_up' : 'keyboard_arrow_down'}
Expand All @@ -352,7 +352,9 @@ export default class IgcComboComponent<T extends object>
${this.toggleController.toggleDirective}
>
<div part="filter-input">
<igc-input></igc-input>
<igc-input
exportparts="container: input, input: native-input, label, prefix, suffix"
></igc-input>
</div>
<slot name="header"></slot>
<igc-combo-list
Expand Down
5 changes: 5 additions & 0 deletions src/components/combo/themes/dark/combo.bootstrap.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@mixin theme() {
igc-combo::part(input) {
--input-background: transparent;
}
}
5 changes: 5 additions & 0 deletions src/components/combo/themes/dark/combo.fluent.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@mixin theme() {
igc-combo::part(input) {
--container-background: transparent;
}
}
7 changes: 7 additions & 0 deletions src/components/combo/themes/dark/combo.indigo.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@use '../../../../styles/utilities' as utils;

@mixin theme() {
igc-combo::part(label) {
--label-focus-color: #{utils.color(gray, 800)};
}
}
7 changes: 7 additions & 0 deletions src/components/combo/themes/dark/combo.material.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@use '../../../../styles/utilities' as utils;

@mixin theme() {
igc-combo::part(input) {
--focus-background: #{utils.color(gray, 100)};
}
}
53 changes: 51 additions & 2 deletions src/components/combo/themes/light/combo.base.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,59 @@
@use '../../../../styles/common/component';
@use '../../../../styles/utilities' as *;

:host {
font-family: var(--ig-font-family);
}

igc-input {
cursor: pointer;
}

igc-input::part(input) {
cursor: pointer;

&::selection {
background: transparent;
}
}

:host([disabled]) {
::slotted([slot='helper-text']) {
color: color(gray, 400);
}
}

[part='clear-icon'],
[part='toggle-icon'] {
display: flex;
cursor: pointer;
}

[part='list-wrapper'] {
height: fit-content;
@include border-radius(rem(4px));

background: color(surface);
color: color(gray, 700);
padding: rem(8px) 0;
box-shadow: elevation(8);

igc-input {
--ig-size: var(--ig-size-small);
}
}

[part='filter-input'] {
padding: rem(8px) rem(16px);
z-index: 26;
}

[part='list'] {
min-height: 300px !important;
$min-width: rem(150px);

min-width: $min-width;
min-height: calc($min-width * 3);

> * {
width: 100%;
}
}
1 change: 1 addition & 0 deletions src/components/combo/themes/light/combo.bootstrap.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@use '../../../../styles/utilities' as *;
@use '../../../select/themes/light/select.bootstrap' as *;

[part='clear-icon'] {
border-inline-end: 1px solid color(gray, 400);
Expand Down
1 change: 1 addition & 0 deletions src/components/combo/themes/light/combo.fluent.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@use '../../../select/themes/light/select.fluent' as *;
1 change: 1 addition & 0 deletions src/components/combo/themes/light/combo.indigo.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@use '../../../select/themes/light/select.indigo' as *;
1 change: 1 addition & 0 deletions src/components/combo/themes/light/combo.material.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@use '../../../select/themes/light/select.material' as *;
2 changes: 2 additions & 0 deletions src/styles/themes/dark/bootstrap.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
@use '../../../components/tree/themes/dark/tree-item.bootstrap' as tree-item;
@use '../../../components/select/themes/dark/select.bootstrap' as select;
@use '../../../components/nav-drawer/themes/dark/nav-drawer-item.bootstrap' as nav-drawer-item;
@use '../../../components/combo/themes/dark/combo.bootstrap' as combo;
@include base.root-styles($dark-bootstrap-palette);
@include dropdown.theme();
@include input.theme();
Expand All @@ -20,3 +21,4 @@
@include nav-drawer-item.theme();
@include select.theme();
@include grid.theme();
@include combo.theme();
2 changes: 2 additions & 0 deletions src/styles/themes/dark/fluent.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
@use '../../../components/tabs/themes/dark/tab.dark.base' as tab;
@use '../../../components/tree/themes/dark/tree-item.fluent' as tree-item;
@use '../../../components/nav-drawer/themes/dark/nav-drawer-item.fluent' as nav-drawer-item;
@use '../../../components/combo/themes/dark/combo.fluent' as combo;
@include base.root-styles($dark-fluent-palette);
@include button.theme();
@include icon-button.theme();
Expand All @@ -30,3 +31,4 @@
@include tree-item.theme();
@include nav-drawer-item.theme();
@include grid.theme();
@include combo.theme();
2 changes: 2 additions & 0 deletions src/styles/themes/dark/indigo.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
@use '../../../components/nav-drawer/themes/dark/nav-drawer-item.indigo' as nav-drawer-item;
@use '../../../components/select/themes/dark/select.indigo' as select;
@use '../../../components/snackbar/themes/dark/snackbar.indigo' as snackbar;
@use '../../../components/combo/themes/dark/combo.indigo' as combo;
@include base.root-styles($dark-indigo-palette);
@include checkbox.theme();
@include switch.theme();
Expand All @@ -28,3 +29,4 @@
@include select.theme();
@include snackbar.theme();
@include grid.theme();
@include combo.theme();
2 changes: 2 additions & 0 deletions src/styles/themes/dark/material.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
@use '../../../components/select/themes/dark/select.material' as select;
@use '../../../components/tabs/themes/dark/tab.dark.base' as tab;
@use '../../../components/nav-drawer/themes/dark/nav-drawer-item.base.scss' as nav-drawer-item;
@use '../../../components/combo/themes/dark/combo.material' as combo;
@include base.root-styles($dark-material-palette);
@include input.theme();
@include select.theme();
@include tab.theme();
@include nav-drawer-item.theme();
@include grid.theme();
@include combo.theme();
9 changes: 7 additions & 2 deletions stories/combo.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,20 @@ const Template: Story<ArgTypes, Context> = (
{ globals: { direction } }: Context
) => html`
<igc-combo
style="max-width: 500px;"
name=${ifDefined(name)}
dir=${ifDefined(direction)}
value-key="id"
display-key="name"
group-key="country"
.data=${cities}
>
<div slot="header">This is a custom header</div>
<div slot="footer">This is a custom footer</div>
<header style="text-align:center; padding:4px 0 8px" slot="header">
This is a custom header
</header>
<footer style="text-align:center; padding:8px 0 4px" slot="footer">
This is a custom footer
</footer>
</igc-combo>
`;

Expand Down