3.0.9 • Published 5 years ago

@uxland/uxl-interaction v3.0.9

Weekly downloads
17
License
Apache-2.0
Repository
github
Last release
5 years ago

UXL Interaction npm version

Build StatusStatementsBranchesFunctionsLines
Build StatusStatementsBranchesFunctionsLines

Installation

npm i @uxland/uxl-interaction

Description

<uxl-interaction> is a component that provides a material design based interaction service for your application.

Usage

The component provides 2 methods that correspond to 2 modes of interaction with the user:

doConfirm(options, localizer) : provides a dialog that interrupts the flow of use of the application to ask for some type of confirmation, either through a message, form or customized information.

notify(options, localizer) : provides a snackbar to notify the user of some information related to the flow of the application

The component can be can customized through passing some properties to the methods what we have seen.

Mode doConfirm()

Options

containerId?: string;: id for the parent container

title?: string;: text that displays on dialog header

titleArgs?: Object;: arguments for the title

message?: string;: text that displays on dialog content

messageArgs?: Object; arguments for the message

showCloseButton?: boolean;: set to true if you want a close button on header

type?: ConfirmType;: the type of interaction, that provides color theming. You can choose for danger' | 'warning' | 'info' | 'success'

fullScreen?: boolean;: set to true if you want display the dialog on fullscreen

styles?: ConfirmStyles;: an object that provides some variables to customize parts from dialog like background color, button colors, etc

acceptLabel?: string;: the text that displays on accept button label

cancelLabel?: string;: the text that displays on cancel button label

modal?: boolean;: set to true if you want to display the dialog on modal mode. This option, disables outside dialog click and display a black foreground, to focus user on dialog

headerDismiss?: boolean;: set to true if you want to close dialog clicking on header region

withoutActions?: boolean;: set to true if you want to hide the actions from dialog. For example, if you want to use dialog to only show information

htmlTag?: string;: if you want to change the content template unless display a simple message, you can pass an htmltag and htmlUrl to display your custom template

htmlUrl?: string;: if you want to change the content template unless display a simple message, you can pass an htmltag and htmlUrl to display your custom template

model?: T;: if you want pass a custom model to display some information for your application, set these property with your custom data.

Styling

Stylable Shadow Parts

The following styleable part's of the element confirm-component are available for styling:

Shadow tree partDescriptionStyle outside of shadow tree
<paper-dialog part="dialog">...The confirm dialog parent elementconfirm-component::part(dialog) {...}
<div id="header" part="header">...The header of the confirm dialogconfirm-component::part(header) {...}
<h2 part="title">...The title of the confirm dialogconfirm-component::part(title) {...}
<div id="content" part="content">...The content of the confirm dialogconfirm-component::part(content) {...}
<div id="actions" part="actions">...The action footer of the confirm dialogconfirm-component::part(actions) {...}
Mixins

The following custom properties and mixins are available for styling:

Custom propertyDescriptionDefault
--uxl-interaction-text-colorText color of the dialogscript option styles: {textColor: string}
--uxl-interaction-background-colorThe background color of the dialogscript option styles: {backgroundColor: string}
--uxl-interaction-icon-colorFill color of the svg icon that close dialogscript option styles: {closeIconColor: string}
--uxl-interaction-accept-button-colorColor of the acept button of the dialogscript option styles: {acceptColor: string}
--uxl-interaction-header-background-colorThe header background color of the dialogscript option styles: {headerBackgroundColor: string}
--uxl-interaction-title-sizeThe font size of the titleno script option
--uxl-interaction-title-colorThe color of the titleno script option
--uxl-interaction-actions-background-colorThe action background color of the dialogscript option styles: {actionsBackgroundColor: string}
--uxl-interaction-dialog-widthThe width of the dialogscript option styles: {width: string}
--uxl-interaction-dialog-heightThe height of the dialogscript option styles: {height: string}
--uxl-interaction-content-heightThe content height of the dialogscript option styles: {height: string}
Variables from script option 'Styles'

The following custom properties and mixins are available for styling:

Custom VariableDescriptionDefault
textColorText color of the dialog--paper-dialog-color --primary-text-color
backgroundColorThe background color of the dialog--paper-dialog-background-color --primary-background-color
closeIconColorFill color of the svg icon that close dialog--iron-icon-fill-color currentcolor
acceptColorColor of the acept button of the dialogby script option type: 'danger', 'warning', 'info' or 'success'
headerBackgroundColorThe header background color of the dialogtransparent
actionsBackgroundColorThe action background color of the dialogtransparent
widthThe width of the dialog40vw
heightThe height or the content of the dialogauto

Mode notify()

Options

message?: string;: text that displays on snackbar content

messageArgs?: Object;: arguments for the message

htmlTag?: string;: if you want to change the content template unless display a simple message, you can pass an htmltag and htmlUrl to display your custom template

htmlUrl?: string;: if you want to change the content template unless display a simple message, you can pass an htmltag and htmlUrl to display your custom template

delay?: number;: the time that snackbar remains on screen after call

showCloseButton?: boolean;: set to true if you want a close button on snackbar

type?: NotifyType;: the type snackbar, that provides color theming. You can choose for danger' | 'warning' | 'info' | 'success'

position?: NotifyPosition;: the position of snackbar on the screen. You can choose for 'bottom' | 'center' | 'top'

styles?: NotifyStyles;: an object that provides some variables to customize parts from dialog like background color, button colors, etc

classifiers?: NofifyClassifiers[];: an array of classes to custom more the snackbar.

model?: T;: if you want pass a custom model to display some information for your application, set these property with your custom data.

Styling

Stylable Shadow Parts

The following styleable part's of the element notify-component are available for styling:

Shadow tree partDescriptionStyle outside of shadow tree
<paper-toast part="toast">...The notify parent elementnotify-component::part(toast) {...}
Mixins

The following custom properties and mixins are available for styling:

Custom propertyDescriptionDefault
--uxl-interaction-notify-icon-colorFill color of the svg icon that close toastscript option styles: {iconColor: string}
--uxl-interaction-notify-text-colorText color of the toastscript option styles: {textColor: string}
--uxl-interaction-notify-background-colorThe background color of the toastscript option styles: {backgroundColorr: string}
--uxl-interaction-notify-paddingThe background color of the toastscript option styles: {backgroundColorr: string}
Variables from script option 'Styles'

The following custom properties and mixins are available for styling:

Custom VariableDescriptionDefault
iconColorFill color of the svg icon that close toast--iron-icon-fill-color currentcolor
textColorText color of the toast--paper-toast-color #f1f1f1
backgroundColorThe background color of the toast--paper-toast-background-color #323232

Localizer

You can pass a custom localizer function to doConfirm() and notify() methods to localize the messages displayed on interaction components.

NotifyMixin and ConfirmMixin

This component, provides a Mixins to implement on your custom templates when you pass a custom component via htmlTag and htmlUrl. This Mixin, provides to your custom templates, the model property and some methods to overwrite accept() or canAccept() methods, if you want to do some validation before user confirm the interaction.

3.0.9

5 years ago

3.0.8

5 years ago

3.0.7

5 years ago

3.0.6

5 years ago

3.0.5

5 years ago

3.0.4

5 years ago

3.0.3

5 years ago

3.0.2

5 years ago

3.0.1

5 years ago

3.0.0

5 years ago

3.0.0-beta.2

5 years ago

3.0.0-beta.1

5 years ago

2.1.3

5 years ago

2.1.2

5 years ago

2.1.1

6 years ago

2.1.0

6 years ago

2.0.0

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago