diff --git a/packages/core/src/components.d.ts b/packages/core/src/components.d.ts index 9cd5451510..8b135c6519 100644 --- a/packages/core/src/components.d.ts +++ b/packages/core/src/components.d.ts @@ -101,6 +101,7 @@ declare global { subTitle?: string, buttons?: ActionSheetButton[], enableBackdropDismiss?: boolean, + translucent?: boolean, enterAnimation?: AnimationBuilder, exitAnimation?: AnimationBuilder, actionSheetId?: string @@ -171,6 +172,7 @@ declare global { buttons?: AlertButton[], inputs?: AlertInput[], enableBackdropDismiss?: boolean, + translucent?: boolean, enterAnimation?: AnimationBuilder, exitAnimation?: AnimationBuilder, alertId?: string @@ -465,7 +467,8 @@ declare global { export interface IonCardHeaderAttributes extends HTMLAttributes { color?: string, - mode?: 'ios' | 'md' + mode?: 'ios' | 'md', + translucent?: boolean } } } @@ -842,6 +845,7 @@ declare global { color?: string, mode?: 'ios' | 'md', href?: string, + translucent?: boolean, activated?: boolean, toggleActive?: Function, show?: boolean, @@ -876,6 +880,7 @@ declare global { namespace JSXElements { export interface IonFooterAttributes extends HTMLAttributes { + translucent?: boolean } } } @@ -1074,6 +1079,7 @@ declare global { namespace JSXElements { export interface IonHeaderAttributes extends HTMLAttributes { + translucent?: boolean } } } @@ -1592,6 +1598,7 @@ declare global { content?: string, dismissOnPageChange?: boolean, duration?: number, + translucent?: boolean, enterAnimation?: AnimationBuilder, exitAnimation?: AnimationBuilder, loadingId?: string, @@ -2152,7 +2159,8 @@ declare global { exitAnimation?: AnimationBuilder, ev?: Event, popoverId?: string, - showBackdrop?: boolean + showBackdrop?: boolean, + translucent?: boolean } } } @@ -2886,71 +2894,6 @@ declare global { } -import { - PageTab as PageTab -} from './components/tabs/page-tab'; - -declare global { - interface HTMLPageTabElement extends PageTab, HTMLElement { - } - var HTMLPageTabElement: { - prototype: HTMLPageTabElement; - new (): HTMLPageTabElement; - }; - interface HTMLElementTagNameMap { - "page-tab": HTMLPageTabElement; - } - interface ElementTagNameMap { - "page-tab": HTMLPageTabElement; - } - namespace JSX { - interface IntrinsicElements { - "page-tab": JSXElements.PageTabAttributes; - } - } - namespace JSXElements { - export interface PageTabAttributes extends HTMLAttributes { - - } - } -} - - -import { - TabBar as IonTabbar -} from './components/tabs/tab-bar'; - -declare global { - interface HTMLIonTabbarElement extends IonTabbar, HTMLElement { - } - var HTMLIonTabbarElement: { - prototype: HTMLIonTabbarElement; - new (): HTMLIonTabbarElement; - }; - interface HTMLElementTagNameMap { - "ion-tabbar": HTMLIonTabbarElement; - } - interface ElementTagNameMap { - "ion-tabbar": HTMLIonTabbarElement; - } - namespace JSX { - interface IntrinsicElements { - "ion-tabbar": JSXElements.IonTabbarAttributes; - } - } - namespace JSXElements { - export interface IonTabbarAttributes extends HTMLAttributes { - - placement?: string, - tabs?: HTMLIonTabElement[], - selectedTab?: HTMLIonTabElement, - layout?: string, - highlight?: boolean - } - } -} - - import { TabbarButton as IonTabButton } from './components/tabs/tab-button'; @@ -3054,6 +2997,42 @@ declare global { } +import { + Tabbar as IonTabbar +} from './components/tabs/tabbar'; + +declare global { + interface HTMLIonTabbarElement extends IonTabbar, HTMLElement { + } + var HTMLIonTabbarElement: { + prototype: HTMLIonTabbarElement; + new (): HTMLIonTabbarElement; + }; + interface HTMLElementTagNameMap { + "ion-tabbar": HTMLIonTabbarElement; + } + interface ElementTagNameMap { + "ion-tabbar": HTMLIonTabbarElement; + } + namespace JSX { + interface IntrinsicElements { + "ion-tabbar": JSXElements.IonTabbarAttributes; + } + } + namespace JSXElements { + export interface IonTabbarAttributes extends HTMLAttributes { + + placement?: string, + tabs?: HTMLIonTabElement[], + selectedTab?: HTMLIonTabElement, + layout?: string, + highlight?: boolean, + translucent?: boolean + } + } +} + + import { Tabs as IonTabs } from './components/tabs/tabs'; @@ -3083,7 +3062,68 @@ declare global { tabbarHidden?: boolean, tabbarLayout?: string, tabbarPlacement?: string, - tabbarHighlight?: boolean + tabbarHighlight?: boolean, + translucent?: boolean + } + } +} + + +import { + PageTab as PageTab +} from './components/tabs/test/basic/page-tab'; + +declare global { + interface HTMLPageTabElement extends PageTab, HTMLElement { + } + var HTMLPageTabElement: { + prototype: HTMLPageTabElement; + new (): HTMLPageTabElement; + }; + interface HTMLElementTagNameMap { + "page-tab": HTMLPageTabElement; + } + interface ElementTagNameMap { + "page-tab": HTMLPageTabElement; + } + namespace JSX { + interface IntrinsicElements { + "page-tab": JSXElements.PageTabAttributes; + } + } + namespace JSXElements { + export interface PageTabAttributes extends HTMLAttributes { + + } + } +} + + +import { + TranslucentPageTab as TranslucentPageTab +} from './components/tabs/test/translucent/translucent-page-tab'; + +declare global { + interface HTMLTranslucentPageTabElement extends TranslucentPageTab, HTMLElement { + } + var HTMLTranslucentPageTabElement: { + prototype: HTMLTranslucentPageTabElement; + new (): HTMLTranslucentPageTabElement; + }; + interface HTMLElementTagNameMap { + "translucent-page-tab": HTMLTranslucentPageTabElement; + } + interface ElementTagNameMap { + "translucent-page-tab": HTMLTranslucentPageTabElement; + } + namespace JSX { + interface IntrinsicElements { + "translucent-page-tab": JSXElements.TranslucentPageTabAttributes; + } + } + namespace JSXElements { + export interface TranslucentPageTabAttributes extends HTMLAttributes { + } } } @@ -3211,6 +3251,7 @@ declare global { closeButtonText?: string, dismissOnPageChange?: boolean, position?: string, + translucent?: boolean, enterAnimation?: AnimationBuilder, exitAnimation?: AnimationBuilder, toastId?: string @@ -3315,7 +3356,8 @@ declare global { export interface IonToolbarAttributes extends HTMLAttributes { color?: string, - mode?: 'ios' | 'md' + mode?: 'ios' | 'md', + translucent?: boolean } } } diff --git a/packages/core/src/components/action-sheet/action-sheet.ios.scss b/packages/core/src/components/action-sheet/action-sheet.ios.scss index d815c16abe..204f69e774 100644 --- a/packages/core/src/components/action-sheet/action-sheet.ios.scss +++ b/packages/core/src/components/action-sheet/action-sheet.ios.scss @@ -29,7 +29,7 @@ $action-sheet-ios-group-margin-bottom: 10px !default; $action-sheet-ios-background: #f9f9f9 !default; /// @prop - Border color of the action sheet -$action-sheet-ios-border-color: #d6d6da !default; +$action-sheet-ios-border-color: rgba(0, 0, 0, .1) !default; /// @prop - Border radius of the action sheet $action-sheet-ios-border-radius: 13px !default; @@ -89,7 +89,7 @@ $action-sheet-ios-button-border-color: #d1d3d6 !default; $action-sheet-ios-button-background: transparent !default; /// @prop - Background color of the activated action sheet button -$action-sheet-ios-button-background-activated: #ebebeb !default; +$action-sheet-ios-button-background-activated: rgba(115, 115, 115, .1) !default; /// @prop - Destructive text color of the action sheet button $action-sheet-ios-button-destructive-text-color: #f53d3d !default; @@ -103,6 +103,12 @@ $action-sheet-ios-button-cancel-background: #fff !default; /// @prop - Font weight of the action sheet cancel button $action-sheet-ios-button-cancel-font-weight: 600 !default; +/// @prop - Filter of the translucent action-sheet +$action-sheet-ios-translucent-filter: saturate(180%) blur(20px) !default; + +/// @prop - Opacity of the translucent action-sheet +$action-sheet-ios-translucent-opacity: .88 !default; + .action-sheet-ios { @include text-align($action-sheet-ios-text-align); @@ -113,20 +119,23 @@ $action-sheet-ios-button-cancel-font-weight: 600 !default; @include margin(env(safe-area-inset-top), auto, env(safe-area-inset-bottom), auto); } + +// iOS Action Sheet Container +// ----------------------------------------- + .action-sheet-ios .action-sheet-container { @include padding($action-sheet-ios-padding-top, $action-sheet-ios-padding-end, $action-sheet-ios-padding-bottom, $action-sheet-ios-padding-start); } + +// iOS Action Sheet Group +// ----------------------------------------- + .action-sheet-ios .action-sheet-group { @include border-radius($action-sheet-ios-border-radius); @include margin(null, null, $action-sheet-ios-group-margin-bottom - 2, null); background: $action-sheet-ios-background; - - // scss-lint:disable VendorPrefix - -webkit-overflow-scrolling: touch; - // Prevents borders from going outside of the container - -webkit-mask-image: -webkit-radial-gradient(circle, #fff, #000); } .action-sheet-ios .action-sheet-group:first-child { @@ -137,6 +146,21 @@ $action-sheet-ios-button-cancel-font-weight: 600 !default; @include margin(null, null, $action-sheet-ios-group-margin-bottom, null); } + +// iOS Translucent Action Sheet +// ----------------------------------------- + +.action-sheet-translucent-ios .action-sheet-group { + background: rgba($action-sheet-ios-background, $action-sheet-ios-translucent-opacity); + + backdrop-filter: $action-sheet-ios-translucent-filter; + -webkit-backdrop-filter: $action-sheet-ios-translucent-filter; +} + + +// iOS Action Sheet Title +// ----------------------------------------- + .action-sheet-ios .action-sheet-title { @include border-radius($action-sheet-ios-title-border-radius); @@ -151,6 +175,10 @@ $action-sheet-ios-button-cancel-font-weight: 600 !default; color: $action-sheet-ios-title-color; } + +// iOS Action Sheet Buttons +// ----------------------------------------- + .action-sheet-ios .action-sheet-button { @include margin(0); diff --git a/packages/core/src/components/action-sheet/action-sheet.md.scss b/packages/core/src/components/action-sheet/action-sheet.md.scss index 89e5a99719..a9ff1875b2 100644 --- a/packages/core/src/components/action-sheet/action-sheet.md.scss +++ b/packages/core/src/components/action-sheet/action-sheet.md.scss @@ -86,6 +86,10 @@ $action-sheet-md-icon-margin-bottom: 0 !default; $action-sheet-md-icon-margin-start: 0 !default; + +// Material Design Action Sheet Title +// ----------------------------------------- + .action-sheet-md .action-sheet-title, .action-sheet-md .action-sheet-sub-title { @include padding($action-sheet-md-title-padding-top, $action-sheet-md-title-padding-end, $action-sheet-md-title-padding-bottom, $action-sheet-md-title-padding-start); @@ -96,6 +100,26 @@ $action-sheet-md-icon-margin-start: 0 !default; color: $action-sheet-md-title-color; } + +// Material Design Action Sheet Group +// ----------------------------------------- + +.action-sheet-md .action-sheet-group { + background: $action-sheet-md-background; +} + +.action-sheet-md .action-sheet-group:first-child { + @include padding($action-sheet-md-padding-top, null, null, null); +} + +.action-sheet-md .action-sheet-group:last-child { + @include padding(null, null, $action-sheet-md-padding-bottom, null); +} + + +// Material Design Action Sheet Buttons +// ----------------------------------------- + .action-sheet-md .action-sheet-button { @include padding($action-sheet-md-button-padding-top, $action-sheet-md-button-padding-end, $action-sheet-md-button-padding-bottom, $action-sheet-md-button-padding-start); @@ -128,18 +152,6 @@ $action-sheet-md-icon-margin-start: 0 !default; vertical-align: $action-sheet-md-icon-vertical-align; } -.action-sheet-md .action-sheet-group { - background: $action-sheet-md-background; -} - -.action-sheet-md .action-sheet-group:first-child { - @include padding($action-sheet-md-padding-top, null, null, null); -} - -.action-sheet-md .action-sheet-group:last-child { - @include padding(null, null, $action-sheet-md-padding-bottom, null); -} - .action-sheet-md .action-sheet-group .button-inner { justify-content: flex-start; } diff --git a/packages/core/src/components/action-sheet/action-sheet.tsx b/packages/core/src/components/action-sheet/action-sheet.tsx index edf17736de..46e271f6ee 100644 --- a/packages/core/src/components/action-sheet/action-sheet.tsx +++ b/packages/core/src/components/action-sheet/action-sheet.tsx @@ -1,6 +1,8 @@ import { Component, CssClassMap, Element, Event, EventEmitter, Listen, Prop } from '@stencil/core'; import { Animation, AnimationBuilder, AnimationController, Config } from '../../index'; +import { createThemedClasses } from '../../utils/theme'; + import iOSEnterAnimation from './animations/ios.enter'; import iOSLeaveAnimation from './animations/ios.leave'; @@ -15,6 +17,9 @@ import iOSLeaveAnimation from './animations/ios.leave'; } }) export class ActionSheet { + mode: string; + color: string; + private animation: Animation; @Element() private el: HTMLElement; @@ -57,6 +62,7 @@ export class ActionSheet { @Prop() subTitle: string; @Prop() buttons: ActionSheetButton[]; @Prop() enableBackdropDismiss: boolean = true; + @Prop() translucent: boolean = false; @Prop() enterAnimation: AnimationBuilder; @Prop() exitAnimation: AnimationBuilder; @@ -160,6 +166,16 @@ export class ActionSheet { } } + buttonClass(button: ActionSheetButton): CssClassMap { + let buttonClass: string[] = !button.role + ? ['action-sheet-button'] + : [`action-sheet-button`, `action-sheet-${button.role}`]; + return buttonClass.reduce((prevValue: any, cssClass: any) => { + prevValue[cssClass] = true; + return prevValue; + }, {}); + } + protected buttonClick(button: ActionSheetButton) { let shouldDismiss = true; if (button.handler) { @@ -172,6 +188,18 @@ export class ActionSheet { } } + hostData() { + const themedClasses = this.translucent ? createThemedClasses(this.mode, this.color, 'action-sheet-translucent') : {}; + + const hostClasses = { + ...themedClasses + }; + + return { + class: hostClasses + }; + } + render() { let userCssClass = 'action-sheet-content'; if (this.cssClass) { @@ -241,16 +269,6 @@ export class ActionSheet { ]; } - - buttonClass(button: ActionSheetButton): CssClassMap { - let buttonClass: string[] = !button.role - ? ['action-sheet-button'] - : [`action-sheet-button`, `action-sheet-${button.role}`]; - return buttonClass.reduce((prevValue: any, cssClass: any) => { - prevValue[cssClass] = true; - return prevValue; - }, {}); - } } export interface ActionSheetOptions { @@ -259,6 +277,7 @@ export interface ActionSheetOptions { cssClass?: string; buttons?: (ActionSheetButton | string)[]; enableBackdropDismiss?: boolean; + translucent?: boolean; } export interface ActionSheetButton { diff --git a/packages/core/src/components/action-sheet/test/translucent/index.html b/packages/core/src/components/action-sheet/test/translucent/index.html new file mode 100644 index 0000000000..0efaec75b7 --- /dev/null +++ b/packages/core/src/components/action-sheet/test/translucent/index.html @@ -0,0 +1,368 @@ + + + +
+ +