chore: fix combobox extension demos

This commit is contained in:
Thijs Louisse 2023-05-30 19:13:30 +02:00
parent b66662931f
commit 8293059fea
9 changed files with 272 additions and 264 deletions

View file

@ -46,7 +46,14 @@ export const Github = () => html`
## Whatsapp ## Whatsapp
```js preview-story ```js preview-story
export const Whatsapp = () => html` export const Whatsapp = () => {
const obamaImgUrl = new URL('../src/wa-combobox/assets/obama.jpeg', import.meta.url).href;
const trumpImgUrl = new URL('../src/wa-combobox/assets/trump.jpeg', import.meta.url).href;
const bidenImgUrl = new URL('../src/wa-combobox/assets/biden.jpeg', import.meta.url).href;
const bushImgUrl = new URL('../src/wa-combobox/assets/bush.jpeg', import.meta.url).href;
const clintonImgUrl = new URL('../src/wa-combobox/assets/clinton.jpeg', import.meta.url).href;
return html`
<wa-combobox name="combo" label="Filter chats"> <wa-combobox name="combo" label="Filter chats">
<wa-option <wa-option
title="Barack Obama" title="Barack Obama"
@ -54,7 +61,7 @@ export const Whatsapp = () => html`
time="15:02" time="15:02"
is-user-text is-user-text
is-user-text-read is-user-text-read
image="https://pbs.twimg.com/profile_images/822547732376207360/5g0FC8XX_400x400.jpg" image="${obamaImgUrl}"
.choiceValue=${'Barack Obama'} .choiceValue=${'Barack Obama'}
></wa-option> ></wa-option>
<wa-option <wa-option
@ -62,32 +69,33 @@ export const Whatsapp = () => html`
text="Take care!" text="Take care!"
time="14:59" time="14:59"
is-user-text is-user-text
image="https://pbs.twimg.com/profile_images/874276197357596672/kUuht00m_400x400.jpg" image="${trumpImgUrl}"
.choiceValue=${'Donald Trump'} .choiceValue=${'Donald Trump'}
></wa-option> ></wa-option>
<wa-option <wa-option
title="Joe Biden" title="Joe Biden"
text="Hehe😅. You too, man, you too..." text="Hehe😅. You too, man, you too..."
time="yesterday" time="yesterday"
image="https://pbs.twimg.com/profile_images/1308769664240160770/AfgzWVE7_400x400.jpg" image="${bidenImgUrl}"
.choiceValue=${'Joe Biden'} .choiceValue=${'Joe Biden'}
></wa-option> ></wa-option>
<wa-option <wa-option
title="George W. Bush" title="George W. Bush"
time="friday" time="friday"
text="You bet I will. Let's catch up soon!" text="You bet I will. Let's catch up soon!"
image="https://pbs.twimg.com/profile_images/828483922266877954/ljYUWUCu_400x400.jpg" image="${bushImgUrl}"
.choiceValue=${'George W. Bush'} .choiceValue=${'George W. Bush'}
></wa-option> ></wa-option>
<wa-option <wa-option
title="Bill Clinton" title="Bill Clinton"
time="thursday" time="thursday"
text="Dude...😂 😂 😂" text="Dude...😂 😂 😂"
image="https://pbs.twimg.com/profile_images/1239440892664086529/iY0Z83Dr_400x400.jpg" image="${clintonImgUrl}"
.choiceValue=${'Bill Clinton'} .choiceValue=${'Bill Clinton'}
></wa-option> ></wa-option>
</wa-combobox> </wa-combobox>
`; `;
};
``` ```
**Whatsapp example shows:** **Whatsapp example shows:**

View file

@ -397,7 +397,10 @@ export class GoogleCombobox extends LionCombobox {
get slots() { get slots() {
return { return {
...super.slots, ...super.slots,
label: () => renderLitAsNode(html` <img alt="Google Search" src="${googleSearchLogoUrl}" />`), label: () =>
renderLitAsNode(
html` <img alt="Google Search" src="${googleSearchLogoUrl}" style="width:auto; " />`,
),
prefix: () => renderLitAsNode(html` <span>${googleSearchIcon}</span> `), prefix: () => renderLitAsNode(html` <span>${googleSearchIcon}</span> `),
suffix: () => suffix: () =>
renderLitAsNode( renderLitAsNode(

View file

@ -7,8 +7,7 @@ import './style/load-roboto.js';
// TODO: insert ink wc here // TODO: insert ink wc here
export class MdOption extends LionOption { export class MdOption extends LionOption {
static get styles() { static styles = [
return [
...super.styles, ...super.styles,
css` css`
:host { :host {
@ -31,7 +30,6 @@ export class MdOption extends LionOption {
} }
`, `,
]; ];
}
/** /**
* @override * @override
@ -67,8 +65,7 @@ export class MdOption extends LionOption {
customElements.define('md-option', MdOption); customElements.define('md-option', MdOption);
export class MdCombobox extends MdFieldMixin(LionCombobox) { export class MdCombobox extends MdFieldMixin(LionCombobox) {
static get styles() { static styles = [
return [
...super.styles, ...super.styles,
css` css`
.input-group__container { .input-group__container {
@ -84,6 +81,11 @@ export class MdCombobox extends MdFieldMixin(LionCombobox) {
} }
`, `,
]; ];
constructor() {
super();
this.showAllOnEmpty = true;
} }
} }
customElements.define('md-combobox', MdCombobox); customElements.define('md-combobox', MdCombobox);

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

View file

@ -15,8 +15,7 @@ class WaOption extends LionOption {
}; };
} }
static get styles() { static styles = [
return [
...super.styles, ...super.styles,
css` css`
:host { :host {
@ -172,7 +171,6 @@ class WaOption extends LionOption {
} */ } */
`, `,
]; ];
}
render() { render() {
return html`<div class="wa-option"> return html`<div class="wa-option">
@ -285,14 +283,12 @@ class WaOption extends LionOption {
customElements.define('wa-option', WaOption); customElements.define('wa-option', WaOption);
class WaCombobox extends LionCombobox { class WaCombobox extends LionCombobox {
static get styles() { static styles = [
return [
...super.styles, ...super.styles,
css` css`
:host { :host {
font-family: SF Pro Text, SF Pro Icons, system, -apple-system, system-ui, font-family: SF Pro Text, SF Pro Icons, system, -apple-system, system-ui, BlinkMacSystemFont,
BlinkMacSystemFont, Helvetica Neue, Helvetica, Lucida Grande, Kohinoor Devanagari, Helvetica Neue, Helvetica, Lucida Grande, Kohinoor Devanagari, sans-serif;
sans-serif;
} }
.input-group__container { .input-group__container {
@ -337,7 +333,6 @@ class WaCombobox extends LionCombobox {
} }
`, `,
]; ];
}
get slots() { get slots() {
return { return {
@ -360,7 +355,7 @@ class WaCombobox extends LionCombobox {
/** @configure OverlayMixin */ /** @configure OverlayMixin */
this.opened = true; this.opened = true;
/** @configure LionCombobox */ /** @configure LionCombobox */
this.showAllOnEmpty = true; this.showAllOnEmpty = false;
/** @configure LionCombobox */ /** @configure LionCombobox */
this.rotateKeyboardNavigation = false; this.rotateKeyboardNavigation = false;
} }