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

[CL-237] Update menu styles for extension refresh #9525

Merged
merged 3 commits into from
Jun 7, 2024
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 libs/components/src/menu/menu-divider.component.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div
class="tw-my-2 tw-border-0 tw-border-t tw-border-solid tw-border-t-secondary-600"
class="tw-my-2 tw-border-0 tw-border-t tw-border-solid tw-border-t-secondary-500"
role="separator"
aria-hidden="true"
></div>
25 changes: 17 additions & 8 deletions libs/components/src/menu/menu-item.directive.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { FocusableOption } from "@angular/cdk/a11y";
import { Component, ElementRef, HostBinding } from "@angular/core";
import { coerceBooleanProperty } from "@angular/cdk/coercion";
import { Component, ElementRef, HostBinding, Input } from "@angular/core";

@Component({
selector: "[bitMenuItem]",
Expand All @@ -9,29 +10,37 @@ export class MenuItemDirective implements FocusableOption {
@HostBinding("class") classList = [
"tw-block",
"tw-w-full",
"tw-py-1",
"tw-px-4",
"tw-py-1.5",
"tw-px-3",
"!tw-text-main",
"!tw-no-underline",
"tw-cursor-pointer",
"tw-border-none",
"tw-bg-background",
"tw-text-left",
"hover:tw-bg-secondary-100",
"focus-visible:tw-bg-secondary-100",
"hover:tw-bg-primary-100",
"hover:!tw-underline",
"focus-visible:tw-z-50",
"focus-visible:tw-outline-none",
"focus-visible:tw-ring",
"focus-visible:tw-ring-offset-2",
"focus-visible:tw-ring-primary-700",
"focus-visible:tw-ring-2",
"focus-visible:tw-rounded-lg",
"focus-visible:tw-ring-inset",
"focus-visible:tw-ring-primary-500",
"active:!tw-ring-0",
"active:!tw-ring-offset-0",
"disabled:!tw-text-muted",
"disabled:hover:tw-bg-background",
"disabled:hover:!tw-no-underline",
"disabled:tw-cursor-not-allowed",
];
@HostBinding("attr.role") role = "menuitem";
@HostBinding("tabIndex") tabIndex = "-1";
@HostBinding("attr.disabled")
get disabledAttr() {
return this.disabled || null; // native disabled attr must be null when false
}

@Input({ transform: coerceBooleanProperty }) disabled?: boolean = false;

constructor(private elementRef: ElementRef) {}

Expand Down
2 changes: 1 addition & 1 deletion libs/components/src/menu/menu.component.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<ng-template>
<div
(click)="closed.emit()"
class="tw-flex tw-shrink-0 tw-flex-col tw-rounded tw-border tw-border-solid tw-border-secondary-600 tw-bg-background tw-bg-clip-padding tw-py-2 tw-overflow-y-auto"
class="tw-flex tw-shrink-0 tw-flex-col tw-rounded-lg tw-border tw-border-solid tw-border-secondary-500 tw-bg-background tw-bg-clip-padding tw-py-1 tw-overflow-y-auto"
[attr.role]="ariaRole"
[attr.aria-label]="ariaLabel"
cdkTrapFocus
Expand Down
4 changes: 3 additions & 1 deletion libs/components/src/menu/menu.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ export class MenuComponent implements AfterContentInit {

ngAfterContentInit() {
if (this.ariaRole === "menu") {
this.keyManager = new FocusKeyManager(this.menuItems).withWrap();
this.keyManager = new FocusKeyManager(this.menuItems)
.withWrap()
.skipPredicate((item) => item.disabled);
}
}
}
Loading