diff --git a/packages/core/src/components/blind/blind.scss b/packages/core/src/components/blind/blind.scss index 419550fb982..c03087e27bf 100644 --- a/packages/core/src/components/blind/blind.scss +++ b/packages/core/src/components/blind/blind.scss @@ -11,11 +11,14 @@ @import 'legacy/mixins/fonts'; @import 'mixins/hover'; @import 'mixins/text-truncation'; +@import 'mixins/shadow-dom/component'; @mixin blind($variant: 'insight') { :host(.blind-#{$variant}) { @if $variant == 'outline' { - border: solid var(--theme-blind--border-thickness) var(--theme-blind-base--border-color); + border: solid + var(--theme-blind--border-thickness) + var(--theme-blind-base--border-color); } .blind-header { @@ -26,20 +29,8 @@ } @if $variant == 'insight' or $variant == 'outline' { - .blind-header-title-label { - color: var(--theme-color-std-text); - } - .blind-header-title-sublabel { - color: var(--theme-color-soft-text); - } - @include ghost-hover-pressed; } @else { - .blind-header-title-label, - .blind-header-title-sublabel { - color: var(--theme-color-#{$variant}--contrast); - } - @include hover { background-color: var(--theme-color-#{$variant}--hover); } @@ -50,6 +41,20 @@ } } + @if $variant == 'insight' or $variant == 'outline' { + .blind-header-title-label { + color: var(--theme-color-std-text); + } + .blind-header-title-sublabel { + color: var(--theme-color-soft-text); + } + } @else { + .blind-header-title-label, + .blind-header-title-sublabel { + color: var(--theme-color-#{$variant}--contrast); + } + } + @if $variant == 'outline' { border-color: var(--theme-color-soft-bdr); } @else { @@ -59,81 +64,119 @@ } :host { + @include ix-component; display: flex; flex-direction: column; border-radius: var(--theme-blind--border-radius); overflow: hidden; + .blind-header-wrapper { + display: block; + position: relative; + width: 100%; + min-height: 3rem; + height: 3rem; + overflow: hidden; + } + + .blind-header-content { + display: flex; + position: relative; + align-items: center; + justify-content: flex-start; + + width: 100%; + height: 100%; + z-index: 1; + + pointer-events: none; + padding-left: 0.5rem; + } + + .blind-header-title { + display: flex; + position: relative; + align-items: center; + flex-grow: 1; + flex-shrink: 0; + margin-right: 1rem; + } + .blind-header { all: unset; @include ellipsis; - display: flex; - align-items: center; + display: block; + position: absolute; + + top: 0px; + left: 0px; + + pointer-events: all; + + padding-left: 2.5rem; min-height: 3rem; height: 3rem; + width: calc(100% - 2 * var(--theme-blind--border-thickness)); border: solid var(--theme-blind--border-thickness) transparent; border-radius: var(--theme-blind--border-radius) var(--theme-blind--border-radius) 0 0; - padding-right: $small-space; cursor: pointer; - z-index: 1; - - .collapse-icon { - padding: $tiny-space $small-space; - } - - .blind-header-title-col { - flex-grow: 1; - flex-basis: 0; - display: inline-flex; - align-items: center; - min-width: 0; + @include focus-visible { + border-color: var(--theme-color-focus-bdr); + outline: none; } + } - ix-typography { - flex-grow: 1; - @include ellipsis; - } + .blind-header-title-icon, + .collapse-icon { + margin-right: $small-space; + } - .blind-header-title-col:not(:first-of-type) { - justify-content: flex-end; - } + .blind-header-title-row { + display: flex; + flex-grow: 1; + } - .blind-header-title-label { - @include ellipsis; - padding-inline-end: 0.5rem; - } + .blind-header-title-col { + flex-grow: 1; + flex-basis: 0; + display: inline-flex; + align-items: center; + min-width: 0; + } - .blind-header-title-sublabel { - @include ellipsis; - padding-inline: 0.5rem; - } + .blind-header-title-col:not(:first-of-type) { + justify-content: flex-end; + } + ix-typography { + flex-grow: 1; + @include ellipsis; + } - .blind-header-title, - .blind-header-title-basic { - display: flex; - align-items: center; - flex-grow: 1; - height: 100%; - min-width: 0; - } + .blind-header-title-label { + @include ellipsis; + padding-inline-end: 0.5rem; + } - .blind-header-title-basic ix-icon { - margin-inline-end: $small-space; - } + .blind-header-title-sublabel { + @include ellipsis; + padding-inline: 0.5rem; + } - @include focus-visible { - border-color: var(--theme-color-focus-bdr); - outline: none; - } + .blind-header-title { + display: flex; + align-items: center; + flex-grow: 1; + height: 100%; + min-width: 0; + } - .blind-header-labels { - display: inline-flex; - flex-grow: 1; - min-width: 0; - } + .blind-header-labels { + display: inline-flex; + flex-grow: 1; + min-width: 0; } .blind-content { @@ -149,6 +192,10 @@ padding-bottom: 0px; } } + + .header-actions { + pointer-events: all; + } } $blind-variants: ( diff --git a/packages/core/src/components/blind/blind.tsx b/packages/core/src/components/blind/blind.tsx index df615794c74..021eb34a9bb 100644 --- a/packages/core/src/components/blind/blind.tsx +++ b/packages/core/src/components/blind/blind.tsx @@ -12,6 +12,7 @@ import { Element, Event, EventEmitter, + Fragment, h, Host, Prop, @@ -71,14 +72,7 @@ export class Blind { constructor() {} - private onHeaderClick(e: Event) { - if ((e.target as Element).closest('.header-actions')) { - return; - } - - e.preventDefault(); - e.stopImmediatePropagation(); - + private onHeaderClick() { this.collapsed = !this.collapsed; this.collapsedChange.emit(this.collapsed); } @@ -141,37 +135,27 @@ export class Blind { [`blind-${this.variant}`]: true, }} > - + + +
{ + await mount(`Some content`); + const blindElement = page.locator('ix-blind'); + await expect(blindElement).toHaveClass(/hydrated/); +}); diff --git a/packages/core/src/tests/blind/blind.e2e.ts b/packages/core/src/tests/blind/blind.e2e.ts index e3292191fde..633a7a72b0f 100644 --- a/packages/core/src/tests/blind/blind.e2e.ts +++ b/packages/core/src/tests/blind/blind.e2e.ts @@ -8,7 +8,7 @@ */ import { expect } from '@playwright/test'; -import { regressionTest } from '@utils/test'; +import { regressionTest, test } from '@utils/test'; regressionTest.describe('blind', () => { regressionTest('basic', async ({ page }) => { @@ -36,4 +36,25 @@ regressionTest.describe('blind', () => { await page.waitForSelector('ix-dropdown.show'); expect(await page.screenshot({ fullPage: true })).toMatchSnapshot(); }); + + test('should no hover on slot', async ({ mount, page }) => { + await mount(` + + + Some content + + `); + const blindElement = page.locator('ix-blind'); + await expect(blindElement).toHaveClass(/hydrated/); + + const slotElement = page.getByTestId('slot'); + await slotElement.hover(); + + await expect(blindElement).toHaveScreenshot(); + }); }); diff --git a/packages/core/src/tests/blind/blind.e2e.ts-snapshots/blind-basic-1-chromium---theme-classic-dark-linux.png b/packages/core/src/tests/blind/blind.e2e.ts-snapshots/blind-basic-1-chromium---theme-classic-dark-linux.png index 076d0828115..5f59f0fcf3e 100644 Binary files a/packages/core/src/tests/blind/blind.e2e.ts-snapshots/blind-basic-1-chromium---theme-classic-dark-linux.png and b/packages/core/src/tests/blind/blind.e2e.ts-snapshots/blind-basic-1-chromium---theme-classic-dark-linux.png differ diff --git a/packages/core/src/tests/blind/blind.e2e.ts-snapshots/blind-basic-1-chromium---theme-classic-light-linux.png b/packages/core/src/tests/blind/blind.e2e.ts-snapshots/blind-basic-1-chromium---theme-classic-light-linux.png index 95bea8f1555..99dcb619c58 100644 Binary files a/packages/core/src/tests/blind/blind.e2e.ts-snapshots/blind-basic-1-chromium---theme-classic-light-linux.png and b/packages/core/src/tests/blind/blind.e2e.ts-snapshots/blind-basic-1-chromium---theme-classic-light-linux.png differ diff --git a/packages/core/src/tests/blind/blind.e2e.ts-snapshots/blind-collapsed-1-chromium---theme-classic-dark-linux.png b/packages/core/src/tests/blind/blind.e2e.ts-snapshots/blind-collapsed-1-chromium---theme-classic-dark-linux.png index d097fe11d03..93a7e7fd4a0 100644 Binary files a/packages/core/src/tests/blind/blind.e2e.ts-snapshots/blind-collapsed-1-chromium---theme-classic-dark-linux.png and b/packages/core/src/tests/blind/blind.e2e.ts-snapshots/blind-collapsed-1-chromium---theme-classic-dark-linux.png differ diff --git a/packages/core/src/tests/blind/blind.e2e.ts-snapshots/blind-collapsed-1-chromium---theme-classic-light-linux.png b/packages/core/src/tests/blind/blind.e2e.ts-snapshots/blind-collapsed-1-chromium---theme-classic-light-linux.png index 346060a8e91..a4d86aaad8a 100644 Binary files a/packages/core/src/tests/blind/blind.e2e.ts-snapshots/blind-collapsed-1-chromium---theme-classic-light-linux.png and b/packages/core/src/tests/blind/blind.e2e.ts-snapshots/blind-collapsed-1-chromium---theme-classic-light-linux.png differ diff --git a/packages/core/src/tests/blind/blind.e2e.ts-snapshots/blind-header-actions-1-chromium---theme-classic-dark-linux.png b/packages/core/src/tests/blind/blind.e2e.ts-snapshots/blind-header-actions-1-chromium---theme-classic-dark-linux.png index 7249f3b3e67..268b4c898b4 100644 Binary files a/packages/core/src/tests/blind/blind.e2e.ts-snapshots/blind-header-actions-1-chromium---theme-classic-dark-linux.png and b/packages/core/src/tests/blind/blind.e2e.ts-snapshots/blind-header-actions-1-chromium---theme-classic-dark-linux.png differ diff --git a/packages/core/src/tests/blind/blind.e2e.ts-snapshots/blind-header-actions-1-chromium---theme-classic-light-linux.png b/packages/core/src/tests/blind/blind.e2e.ts-snapshots/blind-header-actions-1-chromium---theme-classic-light-linux.png index 34f81d80dd4..26d162743d2 100644 Binary files a/packages/core/src/tests/blind/blind.e2e.ts-snapshots/blind-header-actions-1-chromium---theme-classic-light-linux.png and b/packages/core/src/tests/blind/blind.e2e.ts-snapshots/blind-header-actions-1-chromium---theme-classic-light-linux.png differ diff --git a/packages/core/src/tests/blind/blind.e2e.ts-snapshots/blind-should-no-hover-on-slot-1-chromium---theme-classic-dark-linux.png b/packages/core/src/tests/blind/blind.e2e.ts-snapshots/blind-should-no-hover-on-slot-1-chromium---theme-classic-dark-linux.png new file mode 100644 index 00000000000..c41ce86693a Binary files /dev/null and b/packages/core/src/tests/blind/blind.e2e.ts-snapshots/blind-should-no-hover-on-slot-1-chromium---theme-classic-dark-linux.png differ diff --git a/packages/core/src/tests/blind/blind.e2e.ts-snapshots/blind-should-no-hover-on-slot-1-chromium---theme-classic-light-linux.png b/packages/core/src/tests/blind/blind.e2e.ts-snapshots/blind-should-no-hover-on-slot-1-chromium---theme-classic-light-linux.png new file mode 100644 index 00000000000..6facbb7e15c Binary files /dev/null and b/packages/core/src/tests/blind/blind.e2e.ts-snapshots/blind-should-no-hover-on-slot-1-chromium---theme-classic-light-linux.png differ diff --git a/packages/core/src/tests/select/select.e2e.ts-snapshots/select-overflow-1-chromium---theme-classic-dark-linux.png b/packages/core/src/tests/select/select.e2e.ts-snapshots/select-overflow-1-chromium---theme-classic-dark-linux.png index 9136ad64cd5..664f8f897c1 100644 Binary files a/packages/core/src/tests/select/select.e2e.ts-snapshots/select-overflow-1-chromium---theme-classic-dark-linux.png and b/packages/core/src/tests/select/select.e2e.ts-snapshots/select-overflow-1-chromium---theme-classic-dark-linux.png differ diff --git a/packages/core/src/tests/select/select.e2e.ts-snapshots/select-overflow-1-chromium---theme-classic-light-linux.png b/packages/core/src/tests/select/select.e2e.ts-snapshots/select-overflow-1-chromium---theme-classic-light-linux.png index c6fb330975a..94116a64896 100644 Binary files a/packages/core/src/tests/select/select.e2e.ts-snapshots/select-overflow-1-chromium---theme-classic-light-linux.png and b/packages/core/src/tests/select/select.e2e.ts-snapshots/select-overflow-1-chromium---theme-classic-light-linux.png differ