Skip to content

Commit

Permalink
feat(design)!: shard menu component (#2698)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: `DaffMenuModule` has moved to its own package. Update imports to `@daffodil/design/menu`
  • Loading branch information
xelaint committed Dec 29, 2023
1 parent 584bd9a commit ab2836b
Show file tree
Hide file tree
Showing 28 changed files with 30 additions and 23 deletions.
2 changes: 1 addition & 1 deletion apps/design-land/src/app/menu/menu.module.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';

import { DaffMenuModule } from '@daffodil/design';
import { DaffArticleModule } from '@daffodil/design/article';
import { DaffButtonModule } from '@daffodil/design/button';
import { DaffMenuModule } from '@daffodil/design/menu';

import { DesignLandMenuRoutingModule } from './menu-routing-module';
import { DesignLandMenuComponent } from './menu.component';
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { NgModule } from '@angular/core';
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';

import { DaffMenuModule } from '@daffodil/design';
import { DaffButtonModule } from '@daffodil/design/button';
import { DaffMenuModule } from '@daffodil/design/menu';

import { BasicMenuComponent } from './basic-menu.component';
import { MenuContentComponent } from './menu-content/menu-content.component';
Expand Down
9 changes: 9 additions & 0 deletions libs/design/menu/ng-package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"$schema": "../../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/design/menu",
"deleteDestPath": false,
"lib": {
"entryFile": "src/index.ts",
"styleIncludePaths": ["../src/scss"]
}
}
File renamed without changes.
1 change: 1 addition & 0 deletions libs/design/menu/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './public_api';
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { BehaviorSubject } from 'rxjs';

import { DaffMenuActivatorDirective } from './menu-activator.component';
import { DaffMenuModule } from '../menu.module';
import { DaffMenuService } from '../service/menu.service';
import { DaffMenuService } from '../services/menu.service';
import { provideTestMenuService } from '../testing/dummy-service';

@Component({ template: `
Expand All @@ -24,7 +24,6 @@ describe('DaffMenuActivatorDirective', () => {
let fixture: ComponentFixture<WrapperComponent>;
let de: DebugElement;
let component: DaffMenuActivatorDirective;
let menuActivatorButton: DebugElement;

beforeEach(() => {
TestBed.configureTestingModule({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@ import {
takeUntil,
} from 'rxjs';

import { DaffMenuService } from '../service/menu.service';
import { DaffMenuService } from '../services/menu.service';

@Directive({
selector: '[daffMenuActivator]',
})
export class DaffMenuActivatorDirective implements OnDestroy {

@Input() daffMenuActivator: Type<unknown> | TemplateRef<unknown>;

private _destroyed$ = new Subject<boolean>();
private _open: boolean;
Expand All @@ -30,6 +29,8 @@ export class DaffMenuActivatorDirective implements OnDestroy {
return this._open;
}

@Input() daffMenuActivator: Type<unknown> | TemplateRef<unknown>;

constructor(
private service: DaffMenuService,
private viewContainerRef: ViewContainerRef,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@use 'interactions';
@use '../../../scss/interactions';

:host {
@include interactions.clickable();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,9 @@ import {
ChangeDetectionStrategy,
HostBinding,
ContentChild,
ElementRef,
} from '@angular/core';

import {
DaffPrefixDirective,
DaffSuffixDirective,
} from '../../../core/prefix-suffix/public_api';
import { DaffPrefixDirective } from '@daffodil/design';

@Component({
selector:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@use '../../../scss/core';
@use '../../../scss/theming';
@use '../../scss/core';
@use '../../scss/theming';

@mixin daff-menu-theme($theme) {
$white: core.daff-map-deep-get($theme, 'core.white');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { NgModule } from '@angular/core';
import { DaffMenuComponent } from './menu/menu.component';
import { DaffMenuActivatorDirective } from './menu-activator/menu-activator.component';
import { DaffMenuItemComponent } from './menu-item/menu-item.component';
import { DaffMenuService } from './service/menu.service';
import { DaffMenuService } from './services/menu.service';

@NgModule({
imports: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { BehaviorSubject } from 'rxjs';

import { DaffMenuComponent } from './menu.component';
import { DaffMenuModule } from '../menu.module';
import { DaffMenuService } from '../service/menu.service';
import { DaffMenuService } from '../services/menu.service';
import { provideTestMenuService } from '../testing/dummy-service';

@Component({ template: `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ import {
fromEvent,
} from 'rxjs';

import { daffFocusableElementsSelector } from '../../../core/focus/public_api';
import { DaffMenuService } from '../service/menu.service';
import { daffFocusableElementsSelector } from '@daffodil/design';

import { DaffMenuService } from '../services/menu.service';

@Component({
selector: 'daff-menu',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export * from './helpers/public_api';

export { DaffMenuService } from './service/menu.service';
export { DaffMenuService } from './services/menu.service';
export { DaffMenuActivatorDirective } from './menu-activator/menu-activator.component';
export { DaffMenuModule } from './menu.module';
export { DaffMenuComponent } from './menu/menu.component';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ import {
Observable,
} from 'rxjs';

import { DaffLazyComponent } from '../../../core/lazy/public_api';
import { DaffLazyComponent } from '@daffodil/design';

import { daffMenuCreateOverlay } from '../helpers/public_api';

export interface DaffActivatedMenu {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Provider } from '@angular/core';
import { BehaviorSubject } from 'rxjs';

import { DaffMenuService } from '../service/menu.service';
import { DaffMenuService } from '../services/menu.service';

type PublicPart<T> = {[K in keyof T]: T[K]};

Expand Down
2 changes: 1 addition & 1 deletion libs/design/scss/theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
@use '../hero/src/hero-theme' as hero;
@use '../list/src/list-theme' as list;
@use '../media-gallery/src/media-gallery-theme' as media-gallery;
@use '../src/molecules/menu/menu-theme' as menu;
@use '../menu/src/menu-theme' as menu;
@use '../src/molecules/modal/modal-theme' as modal;
@use '../src/molecules/navbar/navbar-theme' as navbar;
@use '../notification/src/notification-theme' as notification;
Expand Down
1 change: 0 additions & 1 deletion libs/design/src/public_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export * from './molecules/backdrop/public_api';
export * from './molecules/button-set/public_api';
export * from './molecules/image-gallery/public_api';
export * from './molecules/image-list/public_api';
export * from './molecules/menu/public_api';
export * from './molecules/modal/public_api';
export * from './molecules/navbar/public_api';
export * from './molecules/paginator/public_api';
Expand Down

0 comments on commit ab2836b

Please sign in to comment.