From 1ebac212512b1df90c1204cb2a4e98848cf7a321 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Popovics=20Andr=C3=A1s?= Date: Thu, 20 Jul 2023 16:13:09 +0200 Subject: [PATCH] [HXCS-1479] Breadcrumbs as secondary entry point (#8750) * Move breadcrumb outside of the core * Fix styling * Fix storybook --- angular.json | 4 ++- lib/core/breadcrumbs/README.md | 3 ++ lib/core/breadcrumbs/ng-package.json | 5 +++ lib/core/breadcrumbs/public-api.ts | 18 ++++++++++ .../src}/_stories/breadcrumb.stories.ts | 2 +- .../_stories/demo-breadcrumb.component.ts | 0 .../breadcrumb-item.component.ts | 0 .../breadcrumb/breadcrumb-chevron.svg | 0 .../breadcrumb/breadcrumb.component.html | 0 .../breadcrumb/breadcrumb.component.scss | 0 .../breadcrumb/breadcrumb.component.ts | 0 .../directives/breadcrumb-focus.directive.ts | 0 .../src/index.ts} | 0 .../src/styles/_breadcrumb.theme.scss | 33 +++++++++++++++++++ lib/core/ng-package.json | 5 +++ lib/core/package.json | 3 ++ .../src/lib/breadcrumb/_breadcrumb.theme.scss | 22 ------------- lib/core/src/lib/styles/_index.scss | 2 -- tsconfig.json | 5 +-- 19 files changed, 74 insertions(+), 28 deletions(-) create mode 100644 lib/core/breadcrumbs/README.md create mode 100644 lib/core/breadcrumbs/ng-package.json create mode 100644 lib/core/breadcrumbs/public-api.ts rename lib/core/{src/lib/breadcrumb => breadcrumbs/src}/_stories/breadcrumb.stories.ts (96%) rename lib/core/{src/lib/breadcrumb => breadcrumbs/src}/_stories/demo-breadcrumb.component.ts (100%) rename lib/core/{src/lib/breadcrumb => breadcrumbs/src}/components/breadcrumb-item/breadcrumb-item.component.ts (100%) rename lib/core/{src/lib/breadcrumb => breadcrumbs/src}/components/breadcrumb/breadcrumb-chevron.svg (100%) rename lib/core/{src/lib/breadcrumb => breadcrumbs/src}/components/breadcrumb/breadcrumb.component.html (100%) rename lib/core/{src/lib/breadcrumb => breadcrumbs/src}/components/breadcrumb/breadcrumb.component.scss (100%) rename lib/core/{src/lib/breadcrumb => breadcrumbs/src}/components/breadcrumb/breadcrumb.component.ts (100%) rename lib/core/{src/lib/breadcrumb => breadcrumbs/src}/directives/breadcrumb-focus.directive.ts (100%) rename lib/core/{src/lib/breadcrumb/public-api.ts => breadcrumbs/src/index.ts} (100%) create mode 100644 lib/core/breadcrumbs/src/styles/_breadcrumb.theme.scss delete mode 100644 lib/core/src/lib/breadcrumb/_breadcrumb.theme.scss diff --git a/angular.json b/angular.json index 7488b1c2fc..6f8433c873 100644 --- a/angular.json +++ b/angular.json @@ -348,7 +348,9 @@ "lib/core/auth/**/*.ts", "lib/core/auth/**/*.html", "lib/core/shell/**/*.ts", - "lib/core/shell/**/*.html" + "lib/core/shell/**/*.html", + "lib/core/breadcrumbs/**/*.ts", + "lib/core/breadcrumbs/**/*.html" ] } }, diff --git a/lib/core/breadcrumbs/README.md b/lib/core/breadcrumbs/README.md new file mode 100644 index 0000000000..22ed3f7afe --- /dev/null +++ b/lib/core/breadcrumbs/README.md @@ -0,0 +1,3 @@ +# @alfresco/adf-core/breadcrumbs + +Secondary entry point of `@alfresco/adf-core`. It can be used by importing from `@alfresco/adf-core/breadcrumbs`. diff --git a/lib/core/breadcrumbs/ng-package.json b/lib/core/breadcrumbs/ng-package.json new file mode 100644 index 0000000000..c781f0df46 --- /dev/null +++ b/lib/core/breadcrumbs/ng-package.json @@ -0,0 +1,5 @@ +{ + "lib": { + "entryFile": "src/index.ts" + } +} diff --git a/lib/core/breadcrumbs/public-api.ts b/lib/core/breadcrumbs/public-api.ts new file mode 100644 index 0000000000..cbede4f3ae --- /dev/null +++ b/lib/core/breadcrumbs/public-api.ts @@ -0,0 +1,18 @@ +/*! + * @license + * Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export * from './src/index'; diff --git a/lib/core/src/lib/breadcrumb/_stories/breadcrumb.stories.ts b/lib/core/breadcrumbs/src/_stories/breadcrumb.stories.ts similarity index 96% rename from lib/core/src/lib/breadcrumb/_stories/breadcrumb.stories.ts rename to lib/core/breadcrumbs/src/_stories/breadcrumb.stories.ts index 17d11e1f62..c985cd98ca 100644 --- a/lib/core/src/lib/breadcrumb/_stories/breadcrumb.stories.ts +++ b/lib/core/breadcrumbs/src/_stories/breadcrumb.stories.ts @@ -22,7 +22,7 @@ import { MatIconModule } from '@angular/material/icon'; import { BreadcrumbComponent } from '../components/breadcrumb/breadcrumb.component'; import { BreadcrumbItemComponent } from '../components/breadcrumb-item/breadcrumb-item.component'; import { DemoBreadcrumbComponent } from './demo-breadcrumb.component'; -import { CoreStoryModule } from '../../testing/core.story.module'; +import { CoreStoryModule } from '../../../src/lib/testing/core.story.module'; // https://stackoverflow.com/a/58210459/8820824 type NonFunctionPropertyNames = {[K in keyof T]: T[K] extends () => any ? never : K}[keyof T]; diff --git a/lib/core/src/lib/breadcrumb/_stories/demo-breadcrumb.component.ts b/lib/core/breadcrumbs/src/_stories/demo-breadcrumb.component.ts similarity index 100% rename from lib/core/src/lib/breadcrumb/_stories/demo-breadcrumb.component.ts rename to lib/core/breadcrumbs/src/_stories/demo-breadcrumb.component.ts diff --git a/lib/core/src/lib/breadcrumb/components/breadcrumb-item/breadcrumb-item.component.ts b/lib/core/breadcrumbs/src/components/breadcrumb-item/breadcrumb-item.component.ts similarity index 100% rename from lib/core/src/lib/breadcrumb/components/breadcrumb-item/breadcrumb-item.component.ts rename to lib/core/breadcrumbs/src/components/breadcrumb-item/breadcrumb-item.component.ts diff --git a/lib/core/src/lib/breadcrumb/components/breadcrumb/breadcrumb-chevron.svg b/lib/core/breadcrumbs/src/components/breadcrumb/breadcrumb-chevron.svg similarity index 100% rename from lib/core/src/lib/breadcrumb/components/breadcrumb/breadcrumb-chevron.svg rename to lib/core/breadcrumbs/src/components/breadcrumb/breadcrumb-chevron.svg diff --git a/lib/core/src/lib/breadcrumb/components/breadcrumb/breadcrumb.component.html b/lib/core/breadcrumbs/src/components/breadcrumb/breadcrumb.component.html similarity index 100% rename from lib/core/src/lib/breadcrumb/components/breadcrumb/breadcrumb.component.html rename to lib/core/breadcrumbs/src/components/breadcrumb/breadcrumb.component.html diff --git a/lib/core/src/lib/breadcrumb/components/breadcrumb/breadcrumb.component.scss b/lib/core/breadcrumbs/src/components/breadcrumb/breadcrumb.component.scss similarity index 100% rename from lib/core/src/lib/breadcrumb/components/breadcrumb/breadcrumb.component.scss rename to lib/core/breadcrumbs/src/components/breadcrumb/breadcrumb.component.scss diff --git a/lib/core/src/lib/breadcrumb/components/breadcrumb/breadcrumb.component.ts b/lib/core/breadcrumbs/src/components/breadcrumb/breadcrumb.component.ts similarity index 100% rename from lib/core/src/lib/breadcrumb/components/breadcrumb/breadcrumb.component.ts rename to lib/core/breadcrumbs/src/components/breadcrumb/breadcrumb.component.ts diff --git a/lib/core/src/lib/breadcrumb/directives/breadcrumb-focus.directive.ts b/lib/core/breadcrumbs/src/directives/breadcrumb-focus.directive.ts similarity index 100% rename from lib/core/src/lib/breadcrumb/directives/breadcrumb-focus.directive.ts rename to lib/core/breadcrumbs/src/directives/breadcrumb-focus.directive.ts diff --git a/lib/core/src/lib/breadcrumb/public-api.ts b/lib/core/breadcrumbs/src/index.ts similarity index 100% rename from lib/core/src/lib/breadcrumb/public-api.ts rename to lib/core/breadcrumbs/src/index.ts diff --git a/lib/core/breadcrumbs/src/styles/_breadcrumb.theme.scss b/lib/core/breadcrumbs/src/styles/_breadcrumb.theme.scss new file mode 100644 index 0000000000..da449a226d --- /dev/null +++ b/lib/core/breadcrumbs/src/styles/_breadcrumb.theme.scss @@ -0,0 +1,33 @@ +@use 'sass:map'; +@use '@angular/material' as mat; + +@mixin adf-breadcrumb-theme($theme) { + $config: mat.get-color-config($theme); + $foreground-palette: map.get($config, foreground); + $primary-palette: map.get($config, primary); + $text-color: mat.get-color-from-palette($foreground-palette, text); + $primary: mat.get-color-from-palette($primary-palette, text); + + adf-breadcrumb { + .adf-breadcrumb__show-all-button-icon--rotate { + color: mat.get-color-from-palette($primary-palette, 500); + } + + .adf-breadcrumb__item-wrapper { + a, + a:active, + a:visited { + color: $primary; + } + + &:last-child a { + text-decoration: none; + color: $text-color; + } + + &:last-child a:hover { + text-decoration: none; + } + } + } +} diff --git a/lib/core/ng-package.json b/lib/core/ng-package.json index d780c5adce..45cd8ac6fd 100644 --- a/lib/core/ng-package.json +++ b/lib/core/ng-package.json @@ -2,6 +2,11 @@ "$schema": "../../node_modules/ng-packagr/ng-package.schema.json", "dest": "../../dist/libs/core", "assets": [ + { + "glob": "**/*.scss", + "input": "./breadcrumbs/src/styles", + "output": "./breadcrumbs/styles" + }, { "glob": "custom-theme/**/*", "input": "./", diff --git a/lib/core/package.json b/lib/core/package.json index ebb178facc..8177075dbc 100644 --- a/lib/core/package.json +++ b/lib/core/package.json @@ -14,6 +14,9 @@ "exports": { "./theming": { "sass": "./lib/theming/_index.scss" + }, + "./breadcrumbs": { + "sass": "./breadcrumbs/styles/_breadcrumb.theme.scss" } }, "dependencies": { diff --git a/lib/core/src/lib/breadcrumb/_breadcrumb.theme.scss b/lib/core/src/lib/breadcrumb/_breadcrumb.theme.scss deleted file mode 100644 index 4a24cc87f5..0000000000 --- a/lib/core/src/lib/breadcrumb/_breadcrumb.theme.scss +++ /dev/null @@ -1,22 +0,0 @@ -@use 'sass:map'; -@use '@angular/material' as mat; - -@mixin adf-breadcrumb-theme($theme) { - $config: mat.get-color-config($theme); - $foreground-palette: map.get($config, foreground); - $primary-palette: map.get($config, primary); - $text-color: mat.get-color-from-palette($foreground-palette, text); - - .adf-breadcrumb__show-all-button-icon--rotate { - color: mat.get-color-from-palette($primary-palette, 500); - } - - .adf-breadcrumb .adf-breadcrumb__item-wrapper:last-child a { - text-decoration: none; - color: $text-color; - } - - .adf-breadcrumb .adf-breadcrumb__item-wrapper:last-child a:hover { - text-decoration: none; - } -} diff --git a/lib/core/src/lib/styles/_index.scss b/lib/core/src/lib/styles/_index.scss index ade51a2f33..63e23e3fa0 100644 --- a/lib/core/src/lib/styles/_index.scss +++ b/lib/core/src/lib/styles/_index.scss @@ -8,7 +8,6 @@ @import '../styles/mixins'; @import '../form/components/widgets/form.theme'; @import '../clipboard/clipboard.theme'; -@import '../breadcrumb/breadcrumb.theme'; @import './snackbar.theme'; @import './material.theme'; @import './components-variables'; @@ -112,7 +111,6 @@ } @include mat-datetimepicker-theme($theme); - @include adf-breadcrumb-theme($theme); @include adf-snackbar-theme; @include adf-material-theme; @include adf-components-variables; diff --git a/tsconfig.json b/tsconfig.json index 39abee0075..b812ec851d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -25,9 +25,10 @@ "@alfresco/adf-content-services": ["lib/content-services"], "@alfresco/adf-core": ["lib/core"], "@alfresco/adf-core/*": ["lib/core/*/public-api.ts"], - "@alfresco/adf-core/auth": ["lib/core/auth/src/index.ts"], - "@alfresco/adf-core/shell": ["lib/core/shell/src/index.ts"], "@alfresco/adf-core/api": ["lib/core/api/src/index.ts"], + "@alfresco/adf-core/auth": ["lib/core/auth/src/index.ts"], + "@alfresco/adf-core/breadcrumbs": ["lib/core/breadcrumbs/src/index.ts"], + "@alfresco/adf-core/shell": ["lib/core/shell/src/index.ts"], "@alfresco/adf-extensions": ["lib/extensions"], "@alfresco/adf-insights": ["lib/insights"], "@alfresco/adf-process-services": ["lib/process-services"],