From 4f0781c0a1590bee47c0b2d31972d25be7440a86 Mon Sep 17 00:00:00 2001 From: Bjarne Fyrstenborg Date: Fri, 29 Sep 2023 10:42:09 +0200 Subject: [PATCH 1/3] Toggle color picker popover clicking preview button --- .../lib/uui-color-picker.element.ts | 49 +++++++++---------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/packages/uui-color-picker/lib/uui-color-picker.element.ts b/packages/uui-color-picker/lib/uui-color-picker.element.ts index 18e51e9c5..629b8157d 100644 --- a/packages/uui-color-picker/lib/uui-color-picker.element.ts +++ b/packages/uui-color-picker/lib/uui-color-picker.element.ts @@ -107,9 +107,6 @@ export class UUIColorPickerElement extends LabelMixin('label', LitElement) { margin-left: 0.75rem; border-radius: 50%; } - color-picker__trigger { - cursor: pointer; - } .color-picker__preview::before, .color-picker__trigger::before { content: ''; @@ -488,7 +485,7 @@ export class UUIColorPickerElement extends LabelMixin('label', LitElement) { event.stopImmediatePropagation(); const target = event.target as HTMLElement; - const popover = target.nextElementSibling as UUIPopoverElement; + const popover = target.parentElement as UUIPopoverElement; popover.open = !popover?.open; @@ -497,7 +494,7 @@ export class UUIColorPickerElement extends LabelMixin('label', LitElement) { closeColorPicker(event: Event) { const target = event.target as UUIPopoverElement; - const trigger = target.previousElementSibling; + const trigger = target.querySelector("button[part=trigger]"); if (trigger) { trigger.setAttribute('aria-expanded', 'false'); @@ -653,27 +650,29 @@ export class UUIColorPickerElement extends LabelMixin('label', LitElement) { } private _renderPreviewButton() { - return html` + return html` +
${this._renderColorPicker()}
`; } From 60f62f169e33c839b1d6c35da7c7581853741a36 Mon Sep 17 00:00:00 2001 From: Bjarne Fyrstenborg Date: Thu, 12 Oct 2023 10:52:09 +0200 Subject: [PATCH 2/3] Add disabled attribute after merge conflict --- packages/uui-color-picker/lib/uui-color-picker.element.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/uui-color-picker/lib/uui-color-picker.element.ts b/packages/uui-color-picker/lib/uui-color-picker.element.ts index 86d124261..3af2fb600 100644 --- a/packages/uui-color-picker/lib/uui-color-picker.element.ts +++ b/packages/uui-color-picker/lib/uui-color-picker.element.ts @@ -680,6 +680,7 @@ export class UUIColorPickerElement extends LabelMixin('label', LitElement) { this.lightness }%, ${this.alpha / 100})`, })} + ?disabled=${this.disabled} @click=${this.openColorPicker} aria-haspopup="true" aria-expanded="false"> From 6763230698effa5dfb9db42e5d233e3d39885640 Mon Sep 17 00:00:00 2001 From: Bjarne Fyrstenborg Date: Thu, 12 Oct 2023 13:01:04 +0200 Subject: [PATCH 3/3] Update packages/uui-color-picker/lib/uui-color-picker.element.ts Co-authored-by: Lone Iversen <108085781+loivsen@users.noreply.github.com> --- packages/uui-color-picker/lib/uui-color-picker.element.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/uui-color-picker/lib/uui-color-picker.element.ts b/packages/uui-color-picker/lib/uui-color-picker.element.ts index 3af2fb600..b07587bda 100644 --- a/packages/uui-color-picker/lib/uui-color-picker.element.ts +++ b/packages/uui-color-picker/lib/uui-color-picker.element.ts @@ -661,7 +661,7 @@ export class UUIColorPickerElement extends LabelMixin('label', LitElement) { } private _renderPreviewButton() { - + return html`