diff --git a/.storybook/preview-head.html b/.storybook/preview-head.html index 6c633649c..03d5c43f8 100644 --- a/.storybook/preview-head.html +++ b/.storybook/preview-head.html @@ -1,5 +1,5 @@ - + diff --git a/.storybook/preview.js b/.storybook/preview.js index ea80bc17e..176e56aed 100644 --- a/.storybook/preview.js +++ b/.storybook/preview.js @@ -14,7 +14,7 @@ const preview = { } }, stackblitzAdditionalDependency: { - "@ironsource/fusion-ui": '5.6.3' + "@ironsource/fusion-ui": '5.7.15' }, viewMode: 'story', docs: {inlineStories: true}, diff --git a/projects/fusion-ui/components/layout/v4/layout.component.ts b/projects/fusion-ui/components/layout/v4/layout.component.ts index d210a14b1..71769fb9c 100644 --- a/projects/fusion-ui/components/layout/v4/layout.component.ts +++ b/projects/fusion-ui/components/layout/v4/layout.component.ts @@ -129,6 +129,8 @@ export class LayoutComponent implements OnInit, OnDestroy { if (itemFound) { this.navigationMenu.setActiveMenu(primaryItemFound, itemFound); this.menuItemSelectedByRoute.emit(itemFound); + } else { + this.navigationMenu.setActiveMenu(null, null); } return !!itemFound; } diff --git a/projects/fusion-ui/components/navigation-menu/v4/navigation-menu.component.ts b/projects/fusion-ui/components/navigation-menu/v4/navigation-menu.component.ts index 2e1669fbd..e590d31ce 100644 --- a/projects/fusion-ui/components/navigation-menu/v4/navigation-menu.component.ts +++ b/projects/fusion-ui/components/navigation-menu/v4/navigation-menu.component.ts @@ -171,12 +171,18 @@ export class NavigationMenuComponent implements OnInit { } setActiveMenu(primary: PrimaryMenuItem, secondary: MenuItem) { - this.selectedPrimaryMenuItem = primary; - this.preSelectedPrimaryMenuItem = primary; - this.selectedSecondaryMenuItem = secondary; - this.setSecondaryMenu(primary); - this.primaryMenu.setSelectedPrimaryMenuItem(primary); - this.primaryMenu.setColorTheme(primary?.cssTheme ?? null); + if (isNullOrUndefined(primary) || isNullOrUndefined(secondary)) { + this.secondaryMenu.setSelected(null); + } else { + this.selectedPrimaryMenuItem = primary; + this.preSelectedPrimaryMenuItem = primary; + this.selectedSecondaryMenuItem = secondary; + this.setSecondaryMenu(primary); + this.primaryMenu.setSelectedPrimaryMenuItem(primary); + setTimeout(() => { + this.primaryMenu.setColorTheme(primary?.cssTheme ?? null); + }); + } } private setSecondaryMenu(selectedNetwork: PrimaryMenuItem) { diff --git a/projects/fusion-ui/components/navigation-menu/v4/navigation-pop-menu/navigation-pop-menu.component.html b/projects/fusion-ui/components/navigation-menu/v4/navigation-pop-menu/navigation-pop-menu.component.html index 5eae9c474..802a490c3 100644 --- a/projects/fusion-ui/components/navigation-menu/v4/navigation-pop-menu/navigation-pop-menu.component.html +++ b/projects/fusion-ui/components/navigation-menu/v4/navigation-pop-menu/navigation-pop-menu.component.html @@ -6,8 +6,8 @@
-
{{layoutUser.name}}
-
{{layoutUser.email}}
+
{{layoutUser.name}}
+
{{layoutUser.email}}
@@ -15,10 +15,14 @@
-
+
{{menuItem.name}}
-
+
diff --git a/projects/fusion-ui/components/navigation-menu/v4/navigation-pop-menu/navigation-pop-menu.component.scss b/projects/fusion-ui/components/navigation-menu/v4/navigation-pop-menu/navigation-pop-menu.component.scss index 00e06104a..62a71dbd9 100644 --- a/projects/fusion-ui/components/navigation-menu/v4/navigation-pop-menu/navigation-pop-menu.component.scss +++ b/projects/fusion-ui/components/navigation-menu/v4/navigation-pop-menu/navigation-pop-menu.component.scss @@ -24,6 +24,10 @@ $menuItemHoverColor: #F5F5F5; box-shadow: $boxShadowLG; border-radius: $borderRadius; + .truncate{ + @extend %truncate; + } + .fu-pop-menu-header{ display: flex; flex-direction: row; @@ -52,17 +56,23 @@ $menuItemHoverColor: #F5F5F5; flex-direction: column; align-items: flex-start; gap: 4px; + width: calc(#{$menuWidth} - 88px); // 88px = 8px +8px + 32px + 16px + 16px + 8px .fu-user-name{ + cursor: default; @extend %font-v4-heading-4; color: $fu-nav-text-primary; } .fu-user-email{ + cursor: default; @extend %font-v4-caption; color: $fu-nav-text-secondary; } } } + a { + text-decoration: none; + } .fu-pop-menu-items{ display: flex; flex-direction: column; diff --git a/projects/fusion-ui/components/navigation-menu/v4/navigation-pop-menu/navigation-pop-menu.component.ts b/projects/fusion-ui/components/navigation-menu/v4/navigation-pop-menu/navigation-pop-menu.component.ts index e1e6ff419..6b85d5aa5 100644 --- a/projects/fusion-ui/components/navigation-menu/v4/navigation-pop-menu/navigation-pop-menu.component.ts +++ b/projects/fusion-ui/components/navigation-menu/v4/navigation-pop-menu/navigation-pop-menu.component.ts @@ -3,11 +3,12 @@ import {CommonModule} from '@angular/common'; import {IconData, IconModule} from '@ironsource/fusion-ui/components/icon/v1'; import {LayoutUser} from '@ironsource/fusion-ui/entities'; import {MenuItem} from '@ironsource/fusion-ui/components/menu/common/base'; +import {TooltipModule} from '@ironsource/fusion-ui/components/tooltip'; @Component({ selector: 'fusion-navigation-pop-menu', standalone: true, - imports: [CommonModule, IconModule], + imports: [CommonModule, IconModule, TooltipModule], templateUrl: './navigation-pop-menu.component.html', styleUrls: ['./navigation-pop-menu.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush @@ -31,4 +32,15 @@ export class NavigationPopMenuComponent implements OnInit, AfterViewInit { this.element.nativeElement.style.height = `${popupHeight}px`; } } + + onMenuItemClicked($event: MouseEvent, menuItem: MenuItem) { + if ($event && $event.metaKey) { + return; + } + if ($event && !menuItem.target) { + $event.preventDefault(); + $event.stopPropagation(); + this.menuItemClicked.emit(menuItem); + } + } } diff --git a/projects/fusion-ui/components/navigation-menu/v4/navigation-primary-menu/navigation-primary-menu.component.html b/projects/fusion-ui/components/navigation-menu/v4/navigation-primary-menu/navigation-primary-menu.component.html index 958aafaf4..a97ab3712 100644 --- a/projects/fusion-ui/components/navigation-menu/v4/navigation-primary-menu/navigation-primary-menu.component.html +++ b/projects/fusion-ui/components/navigation-menu/v4/navigation-primary-menu/navigation-primary-menu.component.html @@ -34,6 +34,7 @@ [menuItems]="bottomItem.menuItems" [fusionReposition]="'#fu-bottom-nav-item-btn_'+bottomItemIndex" [fusionRepositionPlacement]="popMenuPosition" + [fusionRepositionOffset]="popMenuOffset$ | async" (menuItemClicked)="onPopMenuItemClicked($event)" (fusionClickOutside)="onPopMenuOutsideClick($event)"> @@ -54,6 +55,7 @@
diff --git a/projects/fusion-ui/components/navigation-menu/v4/navigation-primary-menu/navigation-primary-menu.component.ts b/projects/fusion-ui/components/navigation-menu/v4/navigation-primary-menu/navigation-primary-menu.component.ts index 74dc6fb7c..e73a03254 100644 --- a/projects/fusion-ui/components/navigation-menu/v4/navigation-primary-menu/navigation-primary-menu.component.ts +++ b/projects/fusion-ui/components/navigation-menu/v4/navigation-primary-menu/navigation-primary-menu.component.ts @@ -1,6 +1,6 @@ import {ChangeDetectionStrategy, Component, ElementRef, EventEmitter, Input, OnInit, Output} from '@angular/core'; import {CommonModule} from '@angular/common'; -import {BehaviorSubject} from 'rxjs'; +import {BehaviorSubject, Observable} from 'rxjs'; import {isNullOrUndefined} from '@ironsource/fusion-ui/utils'; import {SvgModule} from '@ironsource/fusion-ui/components/svg'; import {IconModule} from '@ironsource/fusion-ui/components/icon/v1'; @@ -8,10 +8,11 @@ import {TooltipModule} from '@ironsource/fusion-ui/components/tooltip'; import {ClickOutsideModule} from '@ironsource/fusion-ui/directives/click-outside'; import {LayoutUser} from '@ironsource/fusion-ui/entities'; import {TooltipPosition} from '@ironsource/fusion-ui/components/tooltip/common/base'; -import {RepositionDirective} from '@ironsource/fusion-ui/directives/reposition'; +import {RepositionDirective, RepositionOffset} from '@ironsource/fusion-ui/directives/reposition'; import {MenuItem} from '@ironsource/fusion-ui/components/menu/common/base'; import {NavigationBarItemType, PrimaryMenuItem} from '../navigation-menu.entities'; import {NavigationPopMenuComponent} from '../navigation-pop-menu/navigation-pop-menu.component'; +import {map} from 'rxjs/operators'; @Component({ selector: 'fusion-navigation-primary-menu', @@ -43,6 +44,7 @@ export class NavigationPrimaryMenuComponent implements OnInit { get nativeElement(): HTMLElement { return this.elementRef.nativeElement; } + get bottomItemsTopPosition(): number { return (this.nativeElement.querySelector('.fu-navigation-bar-bottom-items > div:first-child') as HTMLElement)?.offsetTop ?? 0; } @@ -60,6 +62,12 @@ export class NavigationPrimaryMenuComponent implements OnInit { menuExpandedIcon = {iconName: 'arrowLineRight', iconVersion: 'v4'}; popMenuPosition = TooltipPosition.BottomLeft; + popMenuOffset$: Observable = this.selectedBarItem$.asObservable().pipe( + map((selectedBarItem: PrimaryMenuItem) => { + return selectedBarItem?.type === NavigationBarItemType.Main ? {x: 64, y: 48} : {x: 64}; + }) + ); + private primaryMenuOpenedItem: PrimaryMenuItem; defaultCssTheme: {[key: string]: string}; @@ -113,7 +121,6 @@ export class NavigationPrimaryMenuComponent implements OnInit { } menuToggleButtonClicked(event: MouseEvent) { - event.stopPropagation(); this.menuToggleCollapsed = !this.menuToggleCollapsed; this.toggleMenu.emit(); } diff --git a/projects/fusion-ui/components/navigation-menu/v4/stories/navigation-menu.mock.ts b/projects/fusion-ui/components/navigation-menu/v4/stories/navigation-menu.mock.ts index e2621370c..3a67b5cc5 100644 --- a/projects/fusion-ui/components/navigation-menu/v4/stories/navigation-menu.mock.ts +++ b/projects/fusion-ui/components/navigation-menu/v4/stories/navigation-menu.mock.ts @@ -24,7 +24,8 @@ export const USER_PROFILE_MENU_ITEMS: MenuItem[] = [ withTopDelimiter: true, icon: {iconName: 'mail_outline', iconVersion: 'v4'}, name: 'Contact us', - route: '/' + redirect: 'https://ironsrc.formtitan.com/contact-us', + target: '_contactUs' }, { name: 'Logout', @@ -341,7 +342,7 @@ export const IS_MENU_ITEMS: MenuItem[] = [ children: [ { name: 'MMP', - route: '/MMP' + route: '/docs/components/checkbox' }, { name: 'SKAdNetwork', diff --git a/projects/fusion-ui/components/shadows-v4.mdx b/projects/fusion-ui/components/shadows-v4.mdx new file mode 100644 index 000000000..eefb587bc --- /dev/null +++ b/projects/fusion-ui/components/shadows-v4.mdx @@ -0,0 +1,65 @@ +import {Meta} from '@storybook/addon-docs'; + + + +# Shadows + +CSS **box-shadow** is a style property used to add a shadow effect to an element's box (such as a div or an image) on a web page. The property allows you to create a visually appealing 3D-like effect, making the element appear elevated or floating. + +To use our shadows scss variables add in your *.scss +```css + @import '~@ironsource/fusion-ui/style/v4/vars/shadows'; +``` +Or Import css file for *.css with shadow classes +```css + @import '~@ironsource/fusion-ui/style/v4/shadows.css'; +``` + +## Shadows: +
+
+
+
x small
+
$boxShadowXS
+
.fu-shadow-xs
+
+
+
small
+
$boxShadowSM
+
.fu-shadow-sm
+
+
+
medium
+
$boxShadowMD
+
.fu-shadow-md
+
+
+
large
+
$boxShadowLG
+
.fu-shadow-lg
+
+
+
+
x large
+
$boxShadowXL
+
.fu-shadow-xl
+
+
+
xx large
+
$boxShadowXXL
+
.fu-shadow-xxl
+
+
+
xxx large
+
$boxShadowXXXL
+
.fu-shadow-xxxl
+
+
+
super large
+
$boxShadowSLG
+
.fu-shadow-slg
+
+
+
+ + diff --git a/projects/fusion-ui/components/typography-v4.mdx b/projects/fusion-ui/components/typography-v4.mdx index 0e074bdcb..8375eb67f 100644 --- a/projects/fusion-ui/components/typography-v4.mdx +++ b/projects/fusion-ui/components/typography-v4.mdx @@ -1,4 +1,4 @@ -import {Meta} from '@storybook/addon-docs'; +import {Meta, Source} from '@storybook/addon-docs'; @@ -37,6 +37,8 @@ Or Import css file for *.css
Name
+
CSS class name
+
SCSS name
Weight
Size
Line height
@@ -45,6 +47,8 @@ Or Import css file for *.css
title
+
.font-v4-title
+
%font-v4-title
Semibold (600)
40px
48px
@@ -53,6 +57,8 @@ Or Import css file for *.css
h1
+
.font-v4-heading-1
+
%font-v4-heading-1
Semibold (600)
24px
28px
@@ -60,6 +66,8 @@ Or Import css file for *.css
h2
+
.font-v4-heading-2
+
%font-v4-heading-2
Semibold (600)
18px
28px
@@ -67,6 +75,8 @@ Or Import css file for *.css
h3
+
.font-v4-heading-3
+
%font-v4-heading-3
Semibold (600)
16px
24px
@@ -74,6 +84,8 @@ Or Import css file for *.css
h4
+
.font-v4-heading-4
+
%font-v4-heading-4
Semibold (600)
14px
20px
@@ -81,6 +93,8 @@ Or Import css file for *.css
h5
+
.font-v4-heading-5
+
%font-v4-heading-5
Semibold (600)
13px
16px
@@ -88,6 +102,8 @@ Or Import css file for *.css
h6
+
.font-v4-heading-6
+
%font-v4-heading-6
Semibold (600)
12px
12px
@@ -96,6 +112,8 @@ Or Import css file for *.css
body1
+
.font-v4-body-1
+
%font-v4-body-1
Regular (400)
14px
20px
@@ -103,6 +121,8 @@ Or Import css file for *.css
body2
+
.font-v4-body-2
+
%font-v4-body-2
Regular (400)
13px
20px
@@ -111,6 +131,8 @@ Or Import css file for *.css
subtitle1
+
.font-v4-subtitle-1
+
%font-v4-subtitle-1
Medium (500)
14px
20px
@@ -118,6 +140,8 @@ Or Import css file for *.css
subtitle2
+
.font-v4-subtitle-2
+
%font-v4-subtitle-2
Medium (500)
13px
20px
@@ -126,6 +150,8 @@ Or Import css file for *.css
button
+
.font-v4-button
+
%font-v4-button
Semibold (600)
14px
20px
@@ -134,6 +160,8 @@ Or Import css file for *.css
overline
+
.font-v4-overline)
+
%font-v4-overline
Medium (500)
12px
16px
@@ -142,6 +170,8 @@ Or Import css file for *.css
caption
+
.font-v4-caption
+
%font-v4-caption
Regular (400)
12px
16px
@@ -150,6 +180,8 @@ Or Import css file for *.css
table header
+
.font-v4-table-header
+
%font-v4-table-header
Semibold (600)
13px
20px
@@ -158,6 +190,8 @@ Or Import css file for *.css
chip label
+
.font-v4-chip-label
+
%font-v4-chip-label
Semibold (600)
12px
16px
@@ -166,6 +200,8 @@ Or Import css file for *.css
chart1
+
.font-v4-chart-1
+
%font-v4-chart-1
Bold (700)
24px
24px
@@ -173,6 +209,8 @@ Or Import css file for *.css
chart2
+
.font-v4-chart-2
+
%font-v4-chart-2
Bold (700)
20px
20px
@@ -180,4 +218,58 @@ Or Import css file for *.css
+

+ +## Code example for CSS classes. +Title
+
Heading 1
+
Heading 2
+
Heading 3
+
Heading 4
+
Heading 5
+
Heading 6
+
Body 1
+
Body 2
+
Subtitle 1
+
Subtitle 2
+
Button
+
Overline
+
Caption
+
Table header
+
chip label
+
Chart 1
+
chart 2
+`} /> + +## Code example for SCSS. + + diff --git a/projects/fusion-ui/src/style/scss/v4/shadows.scss b/projects/fusion-ui/src/style/scss/v4/shadows.scss new file mode 100644 index 000000000..d18b06e1d --- /dev/null +++ b/projects/fusion-ui/src/style/scss/v4/shadows.scss @@ -0,0 +1,27 @@ +@import './vars/shadows'; + +.fu-shadow-xs { + @extend %shadow-v4-xs; +} +.fu-shadow-sm { + @extend %shadow-v4-sm; +} +.fu-shadow-md { + @extend %shadow-v4-md; +} +.fu-shadow-lg { + @extend %shadow-v4-lg; +} +.fu-shadow-xl { + @extend %shadow-v4-xl; +} +.fu-shadow-xxl { + @extend %shadow-v4-xxl; +} +.fu-shadow-xxxl { + @extend %shadow-v4-xxxl; +} +.fu-shadow-slg { + @extend %shadow-v4-slg; +} + diff --git a/projects/fusion-ui/src/style/scss/v4/vars/_borders.scss b/projects/fusion-ui/src/style/scss/v4/vars/_borders.scss index 7ea9170d5..abbb48f43 100644 --- a/projects/fusion-ui/src/style/scss/v4/vars/_borders.scss +++ b/projects/fusion-ui/src/style/scss/v4/vars/_borders.scss @@ -3,15 +3,6 @@ $borderRadius: var(--fu-border-radius, 8px); $borderLine: 1px solid $fu-divider; -$boxShadowXS: 0px 1px 2px 0px rgba(16, 24, 40, 0.05); -$boxShadowSM: 0px 1px 3px 0px rgba(16, 24, 40, 0.10), 0px 1px 2px 0px rgba(16, 24, 40, 0.06); -$boxShadowMD: 0px 4px 8px -2px rgba(16, 24, 40, 0.10), 0px 2px 4px -2px rgba(16, 24, 40, 0.06); -$boxShadowLG: 0px 12px 16px -4px rgba(16, 24, 40, 0.08), 0px 4px 6px -2px rgba(16, 24, 40, 0.03); -$boxShadowXL: 0px 20px 24px -6px rgba(16, 24, 40, 0.08), 0px 8px 8px -4px rgba(16, 24, 40, 0.03); -$boxShadowXXL: 0px 24px 48px -12px rgba(16, 24, 40, 0.18); -$boxShadowXXXL: 0px 19px 32px 2px rgba(44, 45, 45, 0.14); -$boxShadowSLG: 0px 27px 27px 2px rgba(44, 45, 45, 0.14); - %noBorderRadiusTR{ border-top-right-radius: 0 !important; } diff --git a/projects/fusion-ui/src/style/scss/v4/vars/_shadows.scss b/projects/fusion-ui/src/style/scss/v4/vars/_shadows.scss new file mode 100644 index 000000000..347e215ff --- /dev/null +++ b/projects/fusion-ui/src/style/scss/v4/vars/_shadows.scss @@ -0,0 +1,33 @@ +$boxShadowXS: 0px 1px 2px 0px rgba(16, 24, 40, 0.05); +$boxShadowSM: 0px 1px 3px 0px rgba(16, 24, 40, 0.10), 0px 1px 2px 0px rgba(16, 24, 40, 0.06); +$boxShadowMD: 0px 4px 8px -2px rgba(16, 24, 40, 0.10), 0px 2px 4px -2px rgba(16, 24, 40, 0.06); +$boxShadowLG: 0px 12px 16px -4px rgba(16, 24, 40, 0.08), 0px 4px 6px -2px rgba(16, 24, 40, 0.03); +$boxShadowXL: 0px 20px 24px -6px rgba(16, 24, 40, 0.08), 0px 8px 8px -4px rgba(16, 24, 40, 0.03); +$boxShadowXXL: 0px 24px 48px -12px rgba(16, 24, 40, 0.18); +$boxShadowXXXL: 0px 19px 32px 2px rgba(44, 45, 45, 0.14); +$boxShadowSLG: 0px 27px 27px 2px rgba(44, 45, 45, 0.14); + +%shadow-v4-xs{ + box-shadow: $boxShadowXS; +} +%shadow-v4-sm{ + box-shadow: $boxShadowSM; +} +%shadow-v4-md{ + box-shadow: $boxShadowMD; +} +%shadow-v4-lg{ + box-shadow: $boxShadowLG; +} +%shadow-v4-xl{ + box-shadow: $boxShadowXL; +} +%shadow-v4-xxl{ + box-shadow: $boxShadowXXL; +} +%shadow-v4-xxxl{ + box-shadow: $boxShadowXXXL; +} +%shadow-v4-slg{ + box-shadow: $boxShadowSLG; +} diff --git a/projects/fusion-ui/src/style/scss/v4/vars/_vars.scss b/projects/fusion-ui/src/style/scss/v4/vars/_vars.scss index e24ac0dfe..80f7b305f 100644 --- a/projects/fusion-ui/src/style/scss/v4/vars/_vars.scss +++ b/projects/fusion-ui/src/style/scss/v4/vars/_vars.scss @@ -1,6 +1,7 @@ @import 'fonts'; @import 'colors'; @import 'screen'; +@import "shadows"; %border-box-normalize { * {box-sizing: border-box;}