import * as React from 'react'; import {Logo} from "../logo"; import {DynaPickerContainer} from "dyna-ui-picker-container"; import {DynaFieldWrapper, EColor, EMode, ESize, EStyle, IDynaFieldWrapperProps, TContent} from "../../src"; import {faIcon, IShowcase} from "dyna-showcase"; require('./showcase.less'); export default { logo: , views: [ { slug: 'intro', faIconName: 'circle-o-notch', title: 'Introduction', center: true, component: (

DynaInput

plain react input

nothing more

), }, { slug: 'colours', faIconName: 'flask', title: 'rounded', center: true, component: (() => { interface IMyAppProps { style?: EStyle; isLoading?: TContent, validationMessage?: TContent, } class MyApp extends React.Component { private renderColor(color: EColor, index: number): JSX.Element { const {style, isLoading, validationMessage} = this.props; return (

color: {color}

edit mode

{faIcon('user')} User name} inputElementSelector=".input-control" onFocus={() => console.log('on focus')} > console.log('changed', e.target.value)}/>

view mode

{faIcon('user')} User name} inputElementSelector=".input-control" onFocus={() => console.log('on focus')} > console.log('changed', e.target.value)}/>
) } public render(): JSX.Element[] { return Object.keys(EColor).map((color: EColor, index: number) => this.renderColor(color, index)); } } return })(), wrapperStyle: { width: "100%", padding: "20px", overflowY: "auto", }, props: [ { slug: 'simple-field-line-rounded', title: 'Simple field demo', description: 'style: inline rounded', props: { label: {faIcon('plane')} Destination, style: EStyle.INLINE_ROUNDED, } as IDynaFieldWrapperProps }, { slug: 'field-validation-is-loading-line-rounded', title: 'Field with validation, is required and is loading', description: 'style: inline rounded', props: { label: {faIcon('plane')} Destination, style: EStyle.INLINE_ROUNDED, isLoading: faIcon('spinner fa-spin fa-3x fa-fw'), required: {faIcon('info-circle')} required, validationMessage: {faIcon('exclamation-circle')} user name is required, } as IDynaFieldWrapperProps }, { slug: 'simple-field-small-title-rounded', title: 'Simple field demo', description: 'style: small title rounded', props: { label: {faIcon('plane')} Destination, style: EStyle.SMALL_LABEL_ROUNDED, } as IDynaFieldWrapperProps }, { slug: 'field-validation-is-loading-small-title-rounded', title: 'Field with validation, is required and is loading', description: 'style: small title rounded', props: { label: {faIcon('plane')} Destination, style: EStyle.SMALL_LABEL_ROUNDED, isLoading: faIcon('spinner fa-spin fa-3x fa-fw'), required: {faIcon('info-circle')} required, validationMessage: {faIcon('exclamation-circle')} user name is required, } as IDynaFieldWrapperProps }, { slug: 'simple-field-wide-title-rounded', title: 'Simple field demo', description: 'style: wide title rounded', props: { label: {faIcon('plane')} Destination, style: EStyle.WIDE_LABEL_ROUNDED, } as IDynaFieldWrapperProps }, { slug: 'field-validation-is-loading-wide-title-rounded', title: 'Field with validation, is required and is loading', description: 'style: wide title rounded', props: { label: {faIcon('plane')} Destination, style: EStyle.WIDE_LABEL_ROUNDED, isLoading: faIcon('spinner fa-spin fa-3x fa-fw'), required: {faIcon('info-circle')} required, validationMessage: {faIcon('exclamation-circle')} user name is required, } as IDynaFieldWrapperProps }, ] }, { slug: 'sizes', title: 'sizes', center: true, component: ( {faIcon('user')} User name} inputElementSelector=".input-control" > console.log('changed', e.target.value)}/> ), props: [ ...Object.keys(ESize).map((size: ESize) => { return ({ slug: `size-${size}-INLINE_ROUNDED`, title: `${size} - Orange/White and validation message and is loading`, description: 'style: inline rounded', props: { style: EStyle.INLINE_ROUNDED, color: EColor.ORANGE_WHITE, size, isLoading: faIcon('spinner fa-spin fa-3x fa-fw'), required: {faIcon('info-circle')} required, validationMessage: {faIcon('exclamation-circle')} user name is required, } as IDynaFieldWrapperProps }) }), ...Object.keys(ESize).map((size: ESize) => { return ({ slug: `size-${size}-SMALL_LABEL_ROUNDED`, title: `${size} - Orange/White and validation message and is loading`, description: 'style: small title rounded', props: { style: EStyle.SMALL_LABEL_ROUNDED, color: EColor.ORANGE_WHITE, size, isLoading: faIcon('spinner fa-spin fa-3x fa-fw'), required: {faIcon('info-circle')} required, validationMessage: {faIcon('exclamation-circle')} user name is required, } as IDynaFieldWrapperProps }) }) ], }, { slug: 'sizes-with-app-notifications', title: 'sizes with validation, required and is loading', center: true, component: ( {faIcon('user')} User name} inputElementSelector=".input-control" > console.log('changed', e.target.value)}/> ), props: Object.keys(ESize).map((size: ESize) => { return ({ slug: `size-${size}`, title: `${size} - Orange/White and validation message and is loading`, props: { style: EStyle.INLINE_ROUNDED, color: EColor.ORANGE_WHITE, size, isLoading: faIcon('spinner fa-spin fa-3x fa-fw'), required: {faIcon('info-circle')} required, validationMessage: {faIcon('exclamation-circle')} user name is required, } as IDynaFieldWrapperProps }) }), }, { slug: 'picker-container-and-events', title: 'Dyna ui picker container', description: 'Demonstrate how the events are working with pickers', center: true, component: (() => { interface IMyAppProps { } interface IMyAppState { pop: boolean; text: string; } class MyApp extends React.Component { constructor(props: IMyAppProps) { super(props); this.state = { pop: false, text: '', } } // vanilla events private handleValueChange(event: any): void { this.setState({text: event.target.value}); } private handleTodayClick(event: Event): void { this.setState({text: (new Date).toDateString()}); console.log('today click'); } private handleClosePicker(): void { this.setState({pop: false}) } // handle the click bdsm events private handleFieldWrapperClick(): void { console.log('general inside click'); this.setState({pop: !this.state.pop}); } private handleFieldWrapperOutsideClick(): void { console.log('general outside click'); this.setState({pop: false}); } private handlePickerContainerClick(event: Event): void { // block the events otherwise the handleFieldWrapperClick will close it event.preventDefault(); event.stopPropagation(); } public render(): JSX.Element { const {} = this.props; const {pop, text} = this.state; return (

it's me

the picker container

This picker closes only with the close button

or clicking outside of the control.

} >
); } } return ; })() }, { slug: 'the-end', title: 'the end', description: 'Thank you', center: true, component: ( ), }, ] }as IShowcase;