guestbell-forms 2.0.280 → 2.0.284
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/tags/Tags.d.ts +4 -4
- package/build/components/tags/Tags.js.map +1 -1
- package/build/components/tags/subComponents/TagsSuggestions.d.ts +1 -0
- package/build/components/tags/subComponents/TagsSuggestions.js +19 -16
- package/build/components/tags/subComponents/TagsSuggestions.js.map +1 -1
- package/build/components/textArea/TextArea.d.ts +1 -0
- package/build/components/textArea/TextArea.js +2 -1
- package/build/components/textArea/TextArea.js.map +1 -1
- package/build/dist/report.html +1 -1
- package/package.json +1 -1
@@ -83,9 +83,9 @@ export declare class TagsRaw<T extends Tag = Tag> extends BaseInput<TagsProps<T>
|
|
83
83
|
private tagClick;
|
84
84
|
private tagRemoveClick;
|
85
85
|
}
|
86
|
-
interface TagsFinal
|
87
|
-
(item: TagsProps<T>): React.ReactElement;
|
88
|
-
defaultProps
|
86
|
+
interface TagsFinal {
|
87
|
+
<T extends Tag = Tag>(item: TagsProps<T>): React.ReactElement;
|
88
|
+
defaultProps?: Partial<TagsProps>;
|
89
89
|
}
|
90
|
-
export declare const Tags: TagsFinal
|
90
|
+
export declare const Tags: TagsFinal;
|
91
91
|
export default Tags;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/components/tags/Tags.tsx"],"names":["PlusIcon","LeftArrowIcon","defaultTagsTranslations","defaultBaseTranslations","addNew","TagButtonComponent","p","className","id","onClick","children","TagsRaw","props","textErrors","setState","handleErrors","e","onFocus","state","suggestionsVisible","onSuggestionsOpened","textIsFocused","touched","fetchExistingTags","value","showMobileVersion","mobileVersionEnabled","isMobile","setTimeout","textRef","current","focus","suggestions","key","preselectedSuggestion","undefined","length","preventDefault","stopPropagation","existingTag","existingTags","find","et","name","onTagsChanged","tags","concat","allowNew","addNewTag","onNewTagAdded","newTag","tag","lastSelected","newTags","isMax","maxTags","finalValue","onBlur","isValid","target","textIsValid","errors","getErrors","setInvalid","setValid","onTagClick","filter","sv","fetchingExistingTags","fetchedExistingTags","React","createRef","suggestionsRef","handleClickOutside","bind","handleLeaveMobileClick","require","oldProps","validators","customValidators","required","containerRef","querySelector","contains","onSuggestionsClosed","addNewOnBlur","getSuggestions","existing","s","onSuggestionSelected","document","addEventListener","removeEventListener","translations","getTranslations","textProps","LeaveMobileButton","showInput","Boolean","readOnly","body","title","tooltip","getValidationClass","placeholder","map","item","index","renderTag","readonlyEmptyPlaceholder","onKeyDown","onTextErrorsChanged","onTextChanged","showSuggestions","tagsSuggestionsClassName","isLoading","suggestionsLoadingComponent","suggestionsEmptyComponent","waitingForMoreInputComponent","minLettersToFetch","SuggestionTag","popperProps","renderDefaultValidation","label","renderLabel","valueNotAddedError","maxTagsSurpassedError","i","startsWith","timer","loadingDelayMs","then","clearTimeout","filteredTags","filterExistingTags","toLowerCase","allowSameTagMultipleTimes","some","t","slice","maxSuggestions","toString","tagRemoveClick","showChips","tagClick","BaseInput","defaultProps","disabled","newTagName","Promise","resolve","Date","getTime","text","Tags"],"mappings":";;;;;;;;;AACA;;AACA;;AACA;;AAGA;;AAOA;;AACA;;AAGA;;AACA;;AACA;;AAEA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAlBYA,Q,YAAAA,Q;;;;;;AAAAA,Q;;;;;;;IACAC,a,YAAAA,a;;;;;;AAAAA,a;;;;;;;AAyBL,IAAMC,uBAAuB,mCAC/BC,mCAD+B;AAElCC,EAAAA,MAAM,EAAE;AAF0B,EAA7B;;;;AAqDP,IAAMC,kBAAkD,GAAG,SAArDA,kBAAqD,CAAAC,CAAC;AAAA,sBAC1D;AAAG,IAAA,SAAS,EAAEA,CAAC,CAACC,SAAhB;AAA2B,IAAA,EAAE,EAAED,CAAC,CAACE,EAAjC;AAAqC,IAAA,OAAO,EAAEF,CAAC,CAACG;AAAhD,KACGH,CAAC,CAACI,QADL,CAD0D;AAAA,CAA5D;;IAMaC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AAC;AAA1B,I;AAEFC,EAAAA,yBAAyB,EAAE,qB;AAC3Ba,EAAAA,cAAc,EAAE,G;AAChBI,EAAAA,kBAAkB,EAAE,4BAACmB,IAAD,EAAO5G,IAAP;AAAA,WAClBA,IAAI,CAACqB,MAAL,CAAY,UAAAf,GAAG;AAAA,aAAIA,GAAG,CAACR,IAAJ,IAAYQ,GAAG,CAACR,IAAJ,CAAS4F,WAAT,GAAuBP,UAAvB,CAAkCyB,IAAlC,CAAhB;AAAA,KAAf,CADkB;AAAA,G;AAEpBb,EAAAA,cAAc,EAAE,C;AAChBvD,EAAAA,YAAY,EAAE,K;AACdQ,EAAAA,YAAY,EAAE3F,uB;AACdqH,EAAAA,iBAAiB,EAAE,C;AACnB7F,EAAAA,oBAAoB,EAAE;;;AAkjBnB,IAAMgI,IAAI,GAAI,yCACnB;AACA,sCAA2B/I,OAA3B,CAFmB,EAGnB,MAHmB,CAAd;;eAMQ+I,I","sourcesContent":["// Libs\r\nimport * as React from 'react';\r\nimport { InputGroup } from '../inputGroup/InputGroup';\r\nimport { Text, TextProps, TextRaw } from '../text/Text';\r\nimport * as PlusIcon from 'material-design-icons/content/svg/production/ic_add_circle_outline_24px.svg';\r\nimport * as LeftArrowIcon from 'material-design-icons/navigation/svg/production/ic_arrow_back_24px.svg';\r\nimport {\r\n BaseInputProps,\r\n BaseInputState,\r\n BaseInput,\r\n ValidationError,\r\n defaultBaseTranslations,\r\n} from '../base/input/BaseInput';\r\nimport { Button, ButtonComponentProps } from '../button/Button';\r\nimport TagsSuggestions, {\r\n RenderSuggestionTagProps,\r\n} from './subComponents/TagsSuggestions';\r\nimport { withFormContext } from '../form/withFormContext';\r\nimport classNames from 'classnames';\r\nimport { withThemeContext } from '../themeProvider/withThemeContext';\r\nimport { PopperProps } from '@material-ui/core/Popper/Popper';\r\nimport LinearProgress from '@material-ui/core/LinearProgress';\r\nimport Portal from '@material-ui/core/Portal';\r\n\r\n// Misc\r\nexport type Tag = {\r\n id: number | string;\r\n name: string;\r\n};\r\n\r\nexport const defaultTagsTranslations = {\r\n ...defaultBaseTranslations,\r\n addNew: 'Add new',\r\n};\r\n\r\nexport type TagsTranslations = Partial<typeof defaultTagsTranslations>;\r\n\r\nexport type TagsProps<T extends Tag = Tag> = {\r\n className?: string;\r\n tagsSuggestionsClassName?: string;\r\n disabled?: boolean;\r\n tags: T[];\r\n existingTags?: T[];\r\n fetchExistingTags?: (text: string) => Promise<T[]>;\r\n onTagsChanged: (newTags: T[]) => void;\r\n onNewTagAdded?: (newTagName: string) => Promise<T>;\r\n onTagClick?: (tag: T) => void;\r\n showChips?: boolean;\r\n allowNew?: boolean;\r\n addNewOnBlur?: boolean;\r\n textProps?: TextProps;\r\n readOnly?: boolean;\r\n readonlyEmptyPlaceholder?: string;\r\n maxTags?: number;\r\n valueNotAddedError?: string | JSX.Element;\r\n maxTagsSurpassedError?: string | JSX.Element;\r\n showSuggestions?: boolean;\r\n suggestionsLoadingComponent?: string | JSX.Element;\r\n suggestionsEmptyComponent?: string | JSX.Element;\r\n waitingForMoreInputComponent?: string | JSX.Element;\r\n loadingDelayMs?: number;\r\n filterExistingTags?: (text: string, existingTags: T[]) => T[];\r\n allowSameTagMultipleTimes?: boolean;\r\n maxSuggestions?: number;\r\n popperProps?: Partial<PopperProps>;\r\n minLettersToFetch?: number;\r\n mobileVersionEnabled?: boolean;\r\n isLoading?: boolean;\r\n SuggestionTag?: React.ComponentType<RenderSuggestionTagProps<T>>;\r\n} & BaseInputProps<HTMLInputElement, TagsTranslations>;\r\n\r\nexport interface TagsState<T extends Tag = Tag> extends BaseInputState {\r\n textIsFocused: boolean;\r\n textErrors: ValidationError[];\r\n textIsValid: boolean;\r\n suggestionsVisible: boolean;\r\n fetchedExistingTags: T[];\r\n fetchingExistingTags: boolean;\r\n preselectedSuggestion?: number;\r\n}\r\n\r\ntype InjectedProps = {};\r\n\r\nconst TagButtonComponent: React.FC<ButtonComponentProps> = p => (\r\n <a className={p.className} id={p.id} onClick={p.onClick}>\r\n {p.children}\r\n </a>\r\n);\r\n\r\nexport class TagsRaw<T extends Tag = Tag> extends BaseInput<\r\n TagsProps<T> & InjectedProps,\r\n TagsState<T>,\r\n HTMLInputElement,\r\n TagsTranslations\r\n> {\r\n public static defaultProps: TagsProps = {\r\n ...BaseInput.defaultProps,\r\n disabled: false,\r\n className: '',\r\n tags: [],\r\n existingTags: [],\r\n maxTags: 1000,\r\n onTagsChanged: () => undefined,\r\n onNewTagAdded: newTagName =>\r\n Promise.resolve({ name: newTagName, id: new Date().getTime() }),\r\n valueNotAddedError: <span>You forgot to add tag</span>,\r\n maxTagsSurpassedError: <span>Maximum number of tags surpassed</span>,\r\n waitingForMoreInputComponent: <span>Waiting for more input...</span>,\r\n showSuggestions: true,\r\n suggestionsLoadingComponent: (\r\n <LinearProgress className=\"tags-input__suggestions__defaultLoading\" />\r\n ),\r\n suggestionsEmptyComponent: 'No existing tags...',\r\n loadingDelayMs: 500,\r\n filterExistingTags: (text, tags) =>\r\n tags.filter(tag => tag.name && tag.name.toLowerCase().startsWith(text)),\r\n maxSuggestions: 5,\r\n addNewOnBlur: false,\r\n translations: defaultTagsTranslations,\r\n minLettersToFetch: 0,\r\n mobileVersionEnabled: true,\r\n };\r\n\r\n private textRef: React.RefObject<TextRaw>;\r\n private suggestionsRef: React.RefObject<HTMLDivElement>;\r\n private isMobile: boolean = false;\r\n\r\n constructor(props: TagsProps<T> & InjectedProps) {\r\n super(props);\r\n this.state = {\r\n ...this.state,\r\n textErrors: [],\r\n textIsFocused: false,\r\n suggestionsVisible: false,\r\n fetchingExistingTags: false,\r\n textIsValid: false,\r\n fetchedExistingTags: [],\r\n };\r\n this.textRef = React.createRef();\r\n this.suggestionsRef = React.createRef();\r\n this.handleClickOutside = this.handleClickOutside.bind(this);\r\n this.handleLeaveMobileClick = this.handleLeaveMobileClick.bind(this);\r\n if (props.mobileVersionEnabled) {\r\n this.isMobile = require('react-device-detect')?.isMobile;\r\n }\r\n }\r\n\r\n public focus() {\r\n if (this.textRef.current) {\r\n this.textRef.current.focus();\r\n }\r\n }\r\n\r\n public componentDidUpdate(oldProps: TagsProps & InjectedProps) {\r\n if (\r\n oldProps.tags !== this.props.tags ||\r\n oldProps.validators !== this.props.validators ||\r\n oldProps.customValidators !== this.props.customValidators ||\r\n oldProps.required !== this.props.required\r\n ) {\r\n this.handleErrors(this.props.tags);\r\n }\r\n }\r\n\r\n public handleLeaveMobileClick() {\r\n this.setState({\r\n textIsFocused: false,\r\n suggestionsVisible: false,\r\n preselectedSuggestion: undefined,\r\n });\r\n }\r\n\r\n public handleClickOutside(e: MouseEvent) {\r\n if (\r\n !this.containerRef.current ||\r\n this.containerRef.current\r\n .querySelector('.tags-input__tag__wrapper')\r\n ?.contains(e.target as HTMLDivElement) ||\r\n this.containerRef.current\r\n .querySelector('.tags-input__text-input')\r\n ?.contains(e.target as HTMLDivElement) ||\r\n !this.suggestionsRef.current ||\r\n this.suggestionsRef.current.contains(e.target as HTMLDivElement)\r\n ) {\r\n return;\r\n }\r\n if (this.state.suggestionsVisible) {\r\n this.props.onSuggestionsClosed?.();\r\n }\r\n this.setState({\r\n suggestionsVisible: false,\r\n preselectedSuggestion: undefined,\r\n });\r\n if (this.props.addNewOnBlur && this.state.value) {\r\n const suggestions = this.getSuggestions();\r\n const existing = suggestions.find(s => s.name === this.state.value);\r\n if (existing) {\r\n this.onSuggestionSelected(existing, suggestions.length === 1);\r\n } else if (this.props.allowNew) {\r\n this.addNewTag();\r\n }\r\n } /* else if (this.state.value) {\r\n this.setState({ value: '' });\r\n }*/\r\n }\r\n\r\n public componentDidMount() {\r\n document.addEventListener('mousedown', this.handleClickOutside);\r\n document.addEventListener('touchstart', this.handleClickOutside);\r\n }\r\n\r\n public componentWillUnmount() {\r\n document.removeEventListener('mousedown', this.handleClickOutside);\r\n document.removeEventListener('touchstart', this.handleClickOutside);\r\n }\r\n\r\n public render() {\r\n const translations = this.getTranslations(defaultTagsTranslations);\r\n const textProps = this.props.textProps ? this.props.textProps : {};\r\n const suggestions = this.getSuggestions();\r\n const showMobileVersion =\r\n this.props.mobileVersionEnabled &&\r\n this.isMobile &&\r\n (this.state.textIsFocused || this.state.suggestionsVisible);\r\n const LeaveMobileButton = showMobileVersion ? (\r\n <Button\r\n className=\"tags-input__leaveMobileTagsButton line-height--0\"\r\n onClick={this.handleLeaveMobileClick}\r\n noShadow={true}\r\n unobtrusive={true}\r\n >\r\n <LeftArrowIcon />\r\n </Button>\r\n ) : (\r\n undefined\r\n );\r\n const showInput = Boolean(\r\n (!this.props.maxTags ||\r\n this.props.maxTags > (this.props.tags && this.props.tags.length)) &&\r\n !this.props.readOnly\r\n );\r\n return (\r\n <Portal container={document.body} disablePortal={!showMobileVersion}>\r\n <InputGroup title={this.props.title} tooltip={this.props.tooltip}>\r\n <div\r\n {...(this.props.id && {\r\n id: this.props.id,\r\n })}\r\n className={classNames(\r\n 'input__base tags-input',\r\n this.getValidationClass(),\r\n this.props.className,\r\n {\r\n 'tags-input--readOnly': this.props.readOnly,\r\n 'tags-input--hasPlaceholder':\r\n this.props.textProps && this.props.textProps.placeholder,\r\n 'tags-input--mobile': showMobileVersion,\r\n }\r\n )}\r\n ref={this.containerRef}\r\n >\r\n {showMobileVersion && (\r\n <div className=\"tags-input__mobileBackdrop\" />\r\n )}\r\n <div className=\"tags-input__tags__wrapper\">\r\n {!showInput && showMobileVersion && LeaveMobileButton}\r\n {this.props.tags && this.props.tags.length > 0 ? (\r\n <div className=\"tags-input__tag__wrapper\">\r\n {this.props.tags.map((item, index) =>\r\n this.renderTag(item, index)\r\n )}\r\n </div>\r\n ) : (\r\n this.props.readOnly && (\r\n <div className=\"tags-input__tag__wrapper\">\r\n <div className=\"tags-input__tag\">\r\n {this.props.readonlyEmptyPlaceholder}\r\n </div>\r\n </div>\r\n )\r\n )}\r\n </div>\r\n {showInput && (\r\n <div\r\n className={\r\n 'tags-input__tags__wrapper ' +\r\n (this.props.readOnly ? 'filled ' : '')\r\n }\r\n >\r\n <Text\r\n showClearButton={true}\r\n {...textProps}\r\n {...(this.props.id && {\r\n id: this.props.id + '-text-input',\r\n })}\r\n ref={this.textRef}\r\n required={\r\n this.props.tags.length > 0 ? false : this.props.required\r\n }\r\n className={\r\n 'tags-input__text-input ' +\r\n (textProps.className ? textProps.className : '')\r\n }\r\n onKeyDown={this.onKeyDown(suggestions)}\r\n onErrorsChanged={this.onTextErrorsChanged}\r\n onChange={this.onTextChanged}\r\n onFocus={this.onFocus}\r\n onBlur={this.onBlur}\r\n value={this.state.value}\r\n readOnly={this.props.readOnly}\r\n showValidation={false}\r\n ignoreContext={true}\r\n validators={this.props.validators}\r\n customValidators={this.props.customValidators}\r\n before={LeaveMobileButton}\r\n />\r\n {this.state.suggestionsVisible && this.props.showSuggestions && (\r\n <TagsSuggestions<T>\r\n {...(this.props.id && {\r\n id: this.props.id + '-text-input',\r\n })}\r\n className={classNames(this.props.tagsSuggestionsClassName)}\r\n innerRef={this.suggestionsRef}\r\n anchorEl={this.containerRef.current}\r\n allowNew={this.props.allowNew}\r\n preselectedSuggestion={this.state.preselectedSuggestion}\r\n loading={\r\n this.state.fetchingExistingTags || this.props.isLoading\r\n }\r\n LoadingComponent={this.props.suggestionsLoadingComponent}\r\n isVisible={this.state.suggestionsVisible}\r\n EmptyComponent={this.props.suggestionsEmptyComponent}\r\n WaitingForMoreInputComponent={\r\n this.props.waitingForMoreInputComponent\r\n }\r\n isWaitingForMoreInput={\r\n this.state.value.length < this.props.minLettersToFetch\r\n }\r\n tags={suggestions}\r\n onSelected={this.onSuggestionSelected}\r\n value={this.state.value}\r\n AddNewTagComponent={\r\n this.props.allowNew &&\r\n this.state.value !== '' &&\r\n (!this.props.existingTags ||\r\n !this.props.existingTags.find(\r\n e => e.name === this.state.value\r\n )) &&\r\n (!this.state.fetchedExistingTags ||\r\n !this.state.fetchedExistingTags.find(\r\n e => e.name === this.state.value\r\n )) &&\r\n this.state.textIsValid && (\r\n <Button\r\n {...(this.props.id && {\r\n id: this.props.id + '-add-new-button',\r\n })}\r\n className=\"tags-input__suggestion tags-input__add-new\"\r\n dropdown={true}\r\n onClick={this.addNewTag}\r\n >\r\n {translations.addNew} \"{this.state.value}\"\r\n </Button>\r\n )\r\n }\r\n SuggestionTag={this.props.SuggestionTag}\r\n popperProps={this.props.popperProps}\r\n />\r\n )}\r\n </div>\r\n )}\r\n {this.renderDefaultValidation()}\r\n {this.props.label && (\r\n <label\r\n className={\r\n this.state.value !== '' ||\r\n this.state.textIsFocused ||\r\n this.props.readOnly ||\r\n this.props.tags.length >= this.props.maxTags ||\r\n showMobileVersion\r\n ? 'label--focused'\r\n : ''\r\n }\r\n >\r\n {this.renderLabel()}\r\n </label>\r\n )}\r\n </div>\r\n </InputGroup>\r\n </Portal>\r\n );\r\n }\r\n\r\n private onTextErrorsChanged = (textErrors: ValidationError[]) =>\r\n this.setState(\r\n () => ({ textErrors }),\r\n () => this.handleErrors()\r\n );\r\n\r\n private onFocus = (e: React.SyntheticEvent<{}>) => {\r\n this.props.onFocus?.(e);\r\n if (!this.state.suggestionsVisible) {\r\n this.props.onSuggestionsOpened?.();\r\n }\r\n this.setState(\r\n () => ({ textIsFocused: true, suggestionsVisible: true, touched: true }),\r\n () => this.handleErrors()\r\n );\r\n this.fetchExistingTags(this.state.value);\r\n const showMobileVersion =\r\n this.props.mobileVersionEnabled &&\r\n this.isMobile &&\r\n (this.state.textIsFocused || this.state.suggestionsVisible);\r\n if (\r\n !showMobileVersion &&\r\n this.props.mobileVersionEnabled &&\r\n this.isMobile\r\n ) {\r\n setTimeout(() => this.textRef.current?.focus(), 100);\r\n }\r\n };\r\n\r\n private onKeyDown = (suggestions: T[]) => async (e: React.KeyboardEvent) => {\r\n if (e.key === 'Tab') {\r\n this.setState({\r\n suggestionsVisible: false,\r\n preselectedSuggestion: undefined,\r\n });\r\n }\r\n if (\r\n e.key === 'Enter' &&\r\n (this.state.value !== '' ||\r\n this.state.preselectedSuggestion !== undefined) &&\r\n this.state.textErrors.length === 0\r\n ) {\r\n e.preventDefault();\r\n e.stopPropagation();\r\n const existingTag =\r\n this.props.existingTags &&\r\n this.props.existingTags.find(et => et.name === this.state.value);\r\n if (this.state.preselectedSuggestion !== undefined) {\r\n this.props.onTagsChanged(\r\n this.props.tags.concat(suggestions[this.state.preselectedSuggestion])\r\n );\r\n this.setState({ value: '', preselectedSuggestion: undefined }, () => {\r\n this.fetchExistingTags();\r\n this.handleErrors();\r\n });\r\n } else if (existingTag) {\r\n this.props.onTagsChanged(this.props.tags.concat(existingTag));\r\n this.setState({ value: '' }, () => {\r\n this.fetchExistingTags();\r\n this.handleErrors();\r\n });\r\n } else if (this.props.allowNew) {\r\n await this.addNewTag();\r\n this.handleErrors();\r\n }\r\n }\r\n if (suggestions.length > 0 && this.state.suggestionsVisible) {\r\n if (e.key === 'ArrowUp') {\r\n const preselectedSuggestion =\r\n this.state.preselectedSuggestion === undefined\r\n ? suggestions.length - 1\r\n : this.state.preselectedSuggestion === 0\r\n ? suggestions.length - 1\r\n : this.state.preselectedSuggestion - 1;\r\n this.setState({ preselectedSuggestion });\r\n } else if (e.key === 'ArrowDown') {\r\n const preselectedSuggestion =\r\n this.state.preselectedSuggestion === undefined\r\n ? 0\r\n : this.state.preselectedSuggestion === suggestions.length - 1\r\n ? 0\r\n : this.state.preselectedSuggestion + 1;\r\n this.setState({ preselectedSuggestion });\r\n } else {\r\n this.setState({ preselectedSuggestion: undefined });\r\n }\r\n }\r\n };\r\n\r\n private addNewTag = async () => {\r\n const newTag = await this.props.onNewTagAdded(this.state.value);\r\n if (newTag) {\r\n this.props.onTagsChanged(\r\n this.props.tags ? this.props.tags.concat(newTag) : [newTag]\r\n );\r\n }\r\n this.setState({ value: '', textErrors: [] }, () => {\r\n this.fetchExistingTags();\r\n this.handleErrors();\r\n });\r\n };\r\n\r\n private onSuggestionSelected = (tag: T, lastSelected: boolean) => {\r\n const newTags = this.props.tags.concat(tag);\r\n this.props.onTagsChanged(newTags);\r\n const isMax = newTags.length === this.props.maxTags;\r\n const finalValue =\r\n !this.props.allowNew && !isMax && !lastSelected ? this.state.value : '';\r\n this.setState(\r\n {\r\n value: finalValue,\r\n suggestionsVisible: isMax ? false : this.state.suggestionsVisible,\r\n preselectedSuggestion: undefined,\r\n textErrors: [],\r\n },\r\n () => {\r\n if (\r\n !this.props.maxTags ||\r\n this.props.tags.length + 1 < this.props.maxTags\r\n ) {\r\n this.fetchExistingTags(finalValue);\r\n }\r\n this.handleErrors();\r\n }\r\n );\r\n };\r\n\r\n private onBlur = () => {\r\n this.props.onBlur?.();\r\n this.setState(\r\n {\r\n textIsFocused: false,\r\n preselectedSuggestion: undefined,\r\n },\r\n () => this.handleErrors()\r\n );\r\n };\r\n\r\n private onTextChanged = (\r\n e: React.ChangeEvent<HTMLInputElement>,\r\n isValid: boolean\r\n ) => {\r\n const value = e.target.value;\r\n this.setState(\r\n () => ({\r\n value,\r\n isValid: isValid,\r\n textIsValid: isValid,\r\n suggestionsVisible: true,\r\n }),\r\n () => this.handleErrors()\r\n );\r\n this.fetchExistingTags(e.target.value);\r\n };\r\n\r\n private handleErrors = (tags: T[] = this.props.tags) => {\r\n let errors = this.getErrors(tags);\r\n if (errors.length > 0) {\r\n this.setInvalid(errors);\r\n } else {\r\n this.setValid();\r\n }\r\n };\r\n\r\n private getErrors(tags: T[]) {\r\n let errors = [];\r\n if (tags.length < this.props.maxTags) {\r\n errors = errors.concat(this.state.textErrors);\r\n }\r\n if (this.state.value !== '' && tags.length === 0 && this.props.required) {\r\n errors = errors.concat(\r\n this.getTranslations(this.props.translations).required\r\n );\r\n }\r\n if (this.state.value && this.props.allowNew && !this.state.textIsFocused) {\r\n errors = errors.concat(this.props.valueNotAddedError);\r\n }\r\n if (this.props.maxTags < (this.props.tags && this.props.tags.length)) {\r\n errors = errors.concat(this.props.maxTagsSurpassedError);\r\n }\r\n return errors.filter(i => i);\r\n }\r\n\r\n private fetchExistingTags(startsWith: string = '') {\r\n if (\r\n this.props.fetchExistingTags &&\r\n startsWith.length >= this.props.minLettersToFetch\r\n ) {\r\n const timer = setTimeout(\r\n () => this.setState(() => ({ fetchingExistingTags: true })),\r\n this.props.loadingDelayMs\r\n );\r\n this.props.fetchExistingTags(startsWith).then(fetchedExistingTags => {\r\n clearTimeout(timer);\r\n this.setState(() => ({\r\n fetchedExistingTags,\r\n fetchingExistingTags: false,\r\n }));\r\n });\r\n }\r\n }\r\n\r\n private getSuggestions() {\r\n const existingTags: T[] = []\r\n .concat(this.props.existingTags ? this.props.existingTags : [])\r\n .concat(\r\n this.state.fetchedExistingTags ? this.state.fetchedExistingTags : []\r\n );\r\n const filteredTags = this.props.filterExistingTags(\r\n this.state.value ? this.state.value.toLowerCase() : '',\r\n existingTags\r\n );\r\n let suggestions = filteredTags\r\n .filter(\r\n tag =>\r\n this.props.allowSameTagMultipleTimes ||\r\n !this.props.tags.some(t => t.id === tag.id)\r\n )\r\n .slice(0, this.props.maxSuggestions);\r\n return suggestions;\r\n }\r\n\r\n private renderTag(tag: T, index: number) {\r\n const body = (\r\n <>\r\n {tag.name}\r\n {!this.props.readOnly && (\r\n <Button\r\n {...(this.props.id && {\r\n id: this.props.id + '-tag-' + index.toString(),\r\n })}\r\n circular={true}\r\n blank={true}\r\n onClick={this.tagRemoveClick(tag)}\r\n className=\"ml-1 transform-rotate--45 line-height--0 p-0\"\r\n Component={TagButtonComponent}\r\n preventsDefault={false}\r\n >\r\n <PlusIcon />\r\n </Button>\r\n )}\r\n </>\r\n );\r\n const className = classNames('tags-input__tag', {\r\n 'tags-input__tag-chip': this.props.showChips,\r\n });\r\n if (this.props.onTagClick) {\r\n return (\r\n <Button\r\n onClick={this.tagClick(tag)}\r\n small={true}\r\n className={className}\r\n key={index}\r\n >\r\n {body}\r\n </Button>\r\n );\r\n }\r\n return (\r\n <div onClick={this.tagClick(tag)} className={className} key={index}>\r\n {body}\r\n </div>\r\n );\r\n }\r\n\r\n private tagClick = (tag: T) => () => {\r\n this.props.onTagClick && this.props.onTagClick(tag);\r\n };\r\n\r\n private tagRemoveClick = (tag: T) => (e: React.MouseEvent<HTMLElement>) => {\r\n e.stopPropagation();\r\n const newTags = this.props.tags.filter(sv => sv.id !== tag.id);\r\n /*if (newTags.length === 0) {\r\n setTimeout(() => this.focus(), 50);\r\n }\r\n this.setState({\r\n suggestionsVisible: false,\r\n });*/\r\n this.props.onTagsChanged && this.props.onTagsChanged(newTags);\r\n this.handleErrors(newTags);\r\n // this.fetchExistingTags();\r\n };\r\n}\r\n\r\ninterface TagsFinal<T extends Tag = Tag> {\r\n (item: TagsProps<T>): React.ReactElement,\r\n defaultProps: TagsProps<T>\r\n}\r\n\r\nexport const Tags = (withThemeContext<TagsProps, InstanceType<typeof TagsRaw>>(\r\n // tslint:disable-next-line: no-any\r\n withFormContext<TagsProps>(TagsRaw),\r\n 'tags'\r\n) as unknown) as TagsFinal;\r\n\r\nexport default Tags;\r\n"],"file":"Tags.js"}
|
1
|
+
{"version":3,"sources":["../../../src/lib/components/tags/Tags.tsx"],"names":["PlusIcon","LeftArrowIcon","defaultTagsTranslations","defaultBaseTranslations","addNew","TagButtonComponent","p","className","id","onClick","children","TagsRaw","props","textErrors","setState","handleErrors","e","onFocus","state","suggestionsVisible","onSuggestionsOpened","textIsFocused","touched","fetchExistingTags","value","showMobileVersion","mobileVersionEnabled","isMobile","setTimeout","textRef","current","focus","suggestions","key","preselectedSuggestion","undefined","length","preventDefault","stopPropagation","existingTag","existingTags","find","et","name","onTagsChanged","tags","concat","allowNew","addNewTag","onNewTagAdded","newTag","tag","lastSelected","newTags","isMax","maxTags","finalValue","onBlur","isValid","target","textIsValid","errors","getErrors","setInvalid","setValid","onTagClick","filter","sv","fetchingExistingTags","fetchedExistingTags","React","createRef","suggestionsRef","handleClickOutside","bind","handleLeaveMobileClick","require","oldProps","validators","customValidators","required","containerRef","querySelector","contains","onSuggestionsClosed","addNewOnBlur","getSuggestions","existing","s","onSuggestionSelected","document","addEventListener","removeEventListener","translations","getTranslations","textProps","LeaveMobileButton","showInput","Boolean","readOnly","body","title","tooltip","getValidationClass","placeholder","map","item","index","renderTag","readonlyEmptyPlaceholder","onKeyDown","onTextErrorsChanged","onTextChanged","showSuggestions","tagsSuggestionsClassName","isLoading","suggestionsLoadingComponent","suggestionsEmptyComponent","waitingForMoreInputComponent","minLettersToFetch","SuggestionTag","popperProps","renderDefaultValidation","label","renderLabel","valueNotAddedError","maxTagsSurpassedError","i","startsWith","timer","loadingDelayMs","then","clearTimeout","filteredTags","filterExistingTags","toLowerCase","allowSameTagMultipleTimes","some","t","slice","maxSuggestions","toString","tagRemoveClick","showChips","tagClick","BaseInput","defaultProps","disabled","newTagName","Promise","resolve","Date","getTime","text","Tags"],"mappings":";;;;;;;;;AACA;;AACA;;AACA;;AAGA;;AAOA;;AACA;;AAGA;;AACA;;AACA;;AAEA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAlBYA,Q,YAAAA,Q;;;;;;AAAAA,Q;;;;;;;IACAC,a,YAAAA,a;;;;;;AAAAA,a;;;;;;;AAyBL,IAAMC,uBAAuB,mCAC/BC,mCAD+B;AAElCC,EAAAA,MAAM,EAAE;AAF0B,EAA7B;;;;AAqDP,IAAMC,kBAAkD,GAAG,SAArDA,kBAAqD,CAAAC,CAAC;AAAA,sBAC1D;AAAG,IAAA,SAAS,EAAEA,CAAC,CAACC,SAAhB;AAA2B,IAAA,EAAE,EAAED,CAAC,CAACE,EAAjC;AAAqC,IAAA,OAAO,EAAEF,CAAC,CAACG;AAAhD,KACGH,CAAC,CAACI,QADL,CAD0D;AAAA,CAA5D;;IAMaC,O;;;;;AAsCX,mBAAYC,KAAZ,EAAiD;AAAA;;AAAA;;AAC/C,8BAAMA,KAAN;;AAD+C;;AAAA;;AAAA,+DAFrB,KAEqB;;AAAA,0EA0QnB,UAACC,UAAD;AAAA,aAC5B,MAAKC,QAAL,CACE;AAAA,eAAO;AAAED,UAAAA,UAAU,EAAVA;AAAF,SAAP;AAAA,OADF,EAEE;AAAA,eAAM,MAAKE,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T,GAAuBP,UAAvB,CAAkCyB,IAAlC,CAAhB;AAAA,KAAf,CADkB;AAAA,G;AAEpBb,EAAAA,cAAc,EAAE,C;AAChBvD,EAAAA,YAAY,EAAE,K;AACdQ,EAAAA,YAAY,EAAE3F,uB;AACdqH,EAAAA,iBAAiB,EAAE,C;AACnB7F,EAAAA,oBAAoB,EAAE;;;AAkjBnB,IAAMgI,IAAI,GAAI,yCACnB;AACA,sCAA2B/I,OAA3B,CAFmB,EAGnB,MAHmB,CAAd;;eAMQ+I,I","sourcesContent":["// Libs\r\nimport * as React from 'react';\r\nimport { InputGroup } from '../inputGroup/InputGroup';\r\nimport { Text, TextProps, TextRaw } from '../text/Text';\r\nimport * as PlusIcon from 'material-design-icons/content/svg/production/ic_add_circle_outline_24px.svg';\r\nimport * as LeftArrowIcon from 'material-design-icons/navigation/svg/production/ic_arrow_back_24px.svg';\r\nimport {\r\n BaseInputProps,\r\n BaseInputState,\r\n BaseInput,\r\n ValidationError,\r\n defaultBaseTranslations,\r\n} from '../base/input/BaseInput';\r\nimport { Button, ButtonComponentProps } from '../button/Button';\r\nimport TagsSuggestions, {\r\n RenderSuggestionTagProps,\r\n} from './subComponents/TagsSuggestions';\r\nimport { withFormContext } from '../form/withFormContext';\r\nimport classNames from 'classnames';\r\nimport { withThemeContext } from '../themeProvider/withThemeContext';\r\nimport { PopperProps } from '@material-ui/core/Popper/Popper';\r\nimport LinearProgress from '@material-ui/core/LinearProgress';\r\nimport Portal from '@material-ui/core/Portal';\r\n\r\n// Misc\r\nexport type Tag = {\r\n id: number | string;\r\n name: string;\r\n};\r\n\r\nexport const defaultTagsTranslations = {\r\n ...defaultBaseTranslations,\r\n addNew: 'Add new',\r\n};\r\n\r\nexport type TagsTranslations = Partial<typeof defaultTagsTranslations>;\r\n\r\nexport type TagsProps<T extends Tag = Tag> = {\r\n className?: string;\r\n tagsSuggestionsClassName?: string;\r\n disabled?: boolean;\r\n tags: T[];\r\n existingTags?: T[];\r\n fetchExistingTags?: (text: string) => Promise<T[]>;\r\n onTagsChanged: (newTags: T[]) => void;\r\n onNewTagAdded?: (newTagName: string) => Promise<T>;\r\n onTagClick?: (tag: T) => void;\r\n showChips?: boolean;\r\n allowNew?: boolean;\r\n addNewOnBlur?: boolean;\r\n textProps?: TextProps;\r\n readOnly?: boolean;\r\n readonlyEmptyPlaceholder?: string;\r\n maxTags?: number;\r\n valueNotAddedError?: string | JSX.Element;\r\n maxTagsSurpassedError?: string | JSX.Element;\r\n showSuggestions?: boolean;\r\n suggestionsLoadingComponent?: string | JSX.Element;\r\n suggestionsEmptyComponent?: string | JSX.Element;\r\n waitingForMoreInputComponent?: string | JSX.Element;\r\n loadingDelayMs?: number;\r\n filterExistingTags?: (text: string, existingTags: T[]) => T[];\r\n allowSameTagMultipleTimes?: boolean;\r\n maxSuggestions?: number;\r\n popperProps?: Partial<PopperProps>;\r\n minLettersToFetch?: number;\r\n mobileVersionEnabled?: boolean;\r\n isLoading?: boolean;\r\n SuggestionTag?: React.ComponentType<RenderSuggestionTagProps<T>>;\r\n} & BaseInputProps<HTMLInputElement, TagsTranslations>;\r\n\r\nexport interface TagsState<T extends Tag = Tag> extends BaseInputState {\r\n textIsFocused: boolean;\r\n textErrors: ValidationError[];\r\n textIsValid: boolean;\r\n suggestionsVisible: boolean;\r\n fetchedExistingTags: T[];\r\n fetchingExistingTags: boolean;\r\n preselectedSuggestion?: number;\r\n}\r\n\r\ntype InjectedProps = {};\r\n\r\nconst TagButtonComponent: React.FC<ButtonComponentProps> = p => (\r\n <a className={p.className} id={p.id} onClick={p.onClick}>\r\n {p.children}\r\n </a>\r\n);\r\n\r\nexport class TagsRaw<T extends Tag = Tag> extends BaseInput<\r\n TagsProps<T> & InjectedProps,\r\n TagsState<T>,\r\n HTMLInputElement,\r\n TagsTranslations\r\n> {\r\n public static defaultProps: TagsProps = {\r\n ...BaseInput.defaultProps,\r\n disabled: false,\r\n className: '',\r\n tags: [],\r\n existingTags: [],\r\n maxTags: 1000,\r\n onTagsChanged: () => undefined,\r\n onNewTagAdded: newTagName =>\r\n Promise.resolve({ name: newTagName, id: new Date().getTime() }),\r\n valueNotAddedError: <span>You forgot to add tag</span>,\r\n maxTagsSurpassedError: <span>Maximum number of tags surpassed</span>,\r\n waitingForMoreInputComponent: <span>Waiting for more input...</span>,\r\n showSuggestions: true,\r\n suggestionsLoadingComponent: (\r\n <LinearProgress className=\"tags-input__suggestions__defaultLoading\" />\r\n ),\r\n suggestionsEmptyComponent: 'No existing tags...',\r\n loadingDelayMs: 500,\r\n filterExistingTags: (text, tags) =>\r\n tags.filter(tag => tag.name && tag.name.toLowerCase().startsWith(text)),\r\n maxSuggestions: 5,\r\n addNewOnBlur: false,\r\n translations: defaultTagsTranslations,\r\n minLettersToFetch: 0,\r\n mobileVersionEnabled: true,\r\n };\r\n\r\n private textRef: React.RefObject<TextRaw>;\r\n private suggestionsRef: React.RefObject<HTMLDivElement>;\r\n private isMobile: boolean = false;\r\n\r\n constructor(props: TagsProps<T> & InjectedProps) {\r\n super(props);\r\n this.state = {\r\n ...this.state,\r\n textErrors: [],\r\n textIsFocused: false,\r\n suggestionsVisible: false,\r\n fetchingExistingTags: false,\r\n textIsValid: false,\r\n fetchedExistingTags: [],\r\n };\r\n this.textRef = React.createRef();\r\n this.suggestionsRef = React.createRef();\r\n this.handleClickOutside = this.handleClickOutside.bind(this);\r\n this.handleLeaveMobileClick = this.handleLeaveMobileClick.bind(this);\r\n if (props.mobileVersionEnabled) {\r\n this.isMobile = require('react-device-detect')?.isMobile;\r\n }\r\n }\r\n\r\n public focus() {\r\n if (this.textRef.current) {\r\n this.textRef.current.focus();\r\n }\r\n }\r\n\r\n public componentDidUpdate(oldProps: TagsProps & InjectedProps) {\r\n if (\r\n oldProps.tags !== this.props.tags ||\r\n oldProps.validators !== this.props.validators ||\r\n oldProps.customValidators !== this.props.customValidators ||\r\n oldProps.required !== this.props.required\r\n ) {\r\n this.handleErrors(this.props.tags);\r\n }\r\n }\r\n\r\n public handleLeaveMobileClick() {\r\n this.setState({\r\n textIsFocused: false,\r\n suggestionsVisible: false,\r\n preselectedSuggestion: undefined,\r\n });\r\n }\r\n\r\n public handleClickOutside(e: MouseEvent) {\r\n if (\r\n !this.containerRef.current ||\r\n this.containerRef.current\r\n .querySelector('.tags-input__tag__wrapper')\r\n ?.contains(e.target as HTMLDivElement) ||\r\n this.containerRef.current\r\n .querySelector('.tags-input__text-input')\r\n ?.contains(e.target as HTMLDivElement) ||\r\n !this.suggestionsRef.current ||\r\n this.suggestionsRef.current.contains(e.target as HTMLDivElement)\r\n ) {\r\n return;\r\n }\r\n if (this.state.suggestionsVisible) {\r\n this.props.onSuggestionsClosed?.();\r\n }\r\n this.setState({\r\n suggestionsVisible: false,\r\n preselectedSuggestion: undefined,\r\n });\r\n if (this.props.addNewOnBlur && this.state.value) {\r\n const suggestions = this.getSuggestions();\r\n const existing = suggestions.find(s => s.name === this.state.value);\r\n if (existing) {\r\n this.onSuggestionSelected(existing, suggestions.length === 1);\r\n } else if (this.props.allowNew) {\r\n this.addNewTag();\r\n }\r\n } /* else if (this.state.value) {\r\n this.setState({ value: '' });\r\n }*/\r\n }\r\n\r\n public componentDidMount() {\r\n document.addEventListener('mousedown', this.handleClickOutside);\r\n document.addEventListener('touchstart', this.handleClickOutside);\r\n }\r\n\r\n public componentWillUnmount() {\r\n document.removeEventListener('mousedown', this.handleClickOutside);\r\n document.removeEventListener('touchstart', this.handleClickOutside);\r\n }\r\n\r\n public render() {\r\n const translations = this.getTranslations(defaultTagsTranslations);\r\n const textProps = this.props.textProps ? this.props.textProps : {};\r\n const suggestions = this.getSuggestions();\r\n const showMobileVersion =\r\n this.props.mobileVersionEnabled &&\r\n this.isMobile &&\r\n (this.state.textIsFocused || this.state.suggestionsVisible);\r\n const LeaveMobileButton = showMobileVersion ? (\r\n <Button\r\n className=\"tags-input__leaveMobileTagsButton line-height--0\"\r\n onClick={this.handleLeaveMobileClick}\r\n noShadow={true}\r\n unobtrusive={true}\r\n >\r\n <LeftArrowIcon />\r\n </Button>\r\n ) : (\r\n undefined\r\n );\r\n const showInput = Boolean(\r\n (!this.props.maxTags ||\r\n this.props.maxTags > (this.props.tags && this.props.tags.length)) &&\r\n !this.props.readOnly\r\n );\r\n return (\r\n <Portal container={document.body} disablePortal={!showMobileVersion}>\r\n <InputGroup title={this.props.title} tooltip={this.props.tooltip}>\r\n <div\r\n {...(this.props.id && {\r\n id: this.props.id,\r\n })}\r\n className={classNames(\r\n 'input__base tags-input',\r\n this.getValidationClass(),\r\n this.props.className,\r\n {\r\n 'tags-input--readOnly': this.props.readOnly,\r\n 'tags-input--hasPlaceholder':\r\n this.props.textProps && this.props.textProps.placeholder,\r\n 'tags-input--mobile': showMobileVersion,\r\n }\r\n )}\r\n ref={this.containerRef}\r\n >\r\n {showMobileVersion && (\r\n <div className=\"tags-input__mobileBackdrop\" />\r\n )}\r\n <div className=\"tags-input__tags__wrapper\">\r\n {!showInput && showMobileVersion && LeaveMobileButton}\r\n {this.props.tags && this.props.tags.length > 0 ? (\r\n <div className=\"tags-input__tag__wrapper\">\r\n {this.props.tags.map((item, index) =>\r\n this.renderTag(item, index)\r\n )}\r\n </div>\r\n ) : (\r\n this.props.readOnly && (\r\n <div className=\"tags-input__tag__wrapper\">\r\n <div className=\"tags-input__tag\">\r\n {this.props.readonlyEmptyPlaceholder}\r\n </div>\r\n </div>\r\n )\r\n )}\r\n </div>\r\n {showInput && (\r\n <div\r\n className={\r\n 'tags-input__tags__wrapper ' +\r\n (this.props.readOnly ? 'filled ' : '')\r\n }\r\n >\r\n <Text\r\n showClearButton={true}\r\n {...textProps}\r\n {...(this.props.id && {\r\n id: this.props.id + '-text-input',\r\n })}\r\n ref={this.textRef}\r\n required={\r\n this.props.tags.length > 0 ? false : this.props.required\r\n }\r\n className={\r\n 'tags-input__text-input ' +\r\n (textProps.className ? textProps.className : '')\r\n }\r\n onKeyDown={this.onKeyDown(suggestions)}\r\n onErrorsChanged={this.onTextErrorsChanged}\r\n onChange={this.onTextChanged}\r\n onFocus={this.onFocus}\r\n onBlur={this.onBlur}\r\n value={this.state.value}\r\n readOnly={this.props.readOnly}\r\n showValidation={false}\r\n ignoreContext={true}\r\n validators={this.props.validators}\r\n customValidators={this.props.customValidators}\r\n before={LeaveMobileButton}\r\n />\r\n {this.state.suggestionsVisible && this.props.showSuggestions && (\r\n <TagsSuggestions<T>\r\n {...(this.props.id && {\r\n id: this.props.id + '-text-input',\r\n })}\r\n className={classNames(this.props.tagsSuggestionsClassName)}\r\n innerRef={this.suggestionsRef}\r\n anchorEl={this.containerRef.current}\r\n allowNew={this.props.allowNew}\r\n preselectedSuggestion={this.state.preselectedSuggestion}\r\n loading={\r\n this.state.fetchingExistingTags || this.props.isLoading\r\n }\r\n LoadingComponent={this.props.suggestionsLoadingComponent}\r\n isVisible={this.state.suggestionsVisible}\r\n EmptyComponent={this.props.suggestionsEmptyComponent}\r\n WaitingForMoreInputComponent={\r\n this.props.waitingForMoreInputComponent\r\n }\r\n isWaitingForMoreInput={\r\n this.state.value.length < this.props.minLettersToFetch\r\n }\r\n tags={suggestions}\r\n onSelected={this.onSuggestionSelected}\r\n value={this.state.value}\r\n AddNewTagComponent={\r\n this.props.allowNew &&\r\n this.state.value !== '' &&\r\n (!this.props.existingTags ||\r\n !this.props.existingTags.find(\r\n e => e.name === this.state.value\r\n )) &&\r\n (!this.state.fetchedExistingTags ||\r\n !this.state.fetchedExistingTags.find(\r\n e => e.name === this.state.value\r\n )) &&\r\n this.state.textIsValid && (\r\n <Button\r\n {...(this.props.id && {\r\n id: this.props.id + '-add-new-button',\r\n })}\r\n className=\"tags-input__suggestion tags-input__add-new\"\r\n dropdown={true}\r\n onClick={this.addNewTag}\r\n >\r\n {translations.addNew} \"{this.state.value}\"\r\n </Button>\r\n )\r\n }\r\n SuggestionTag={this.props.SuggestionTag}\r\n popperProps={this.props.popperProps}\r\n />\r\n )}\r\n </div>\r\n )}\r\n {this.renderDefaultValidation()}\r\n {this.props.label && (\r\n <label\r\n className={\r\n this.state.value !== '' ||\r\n this.state.textIsFocused ||\r\n this.props.readOnly ||\r\n this.props.tags.length >= this.props.maxTags ||\r\n showMobileVersion\r\n ? 'label--focused'\r\n : ''\r\n }\r\n >\r\n {this.renderLabel()}\r\n </label>\r\n )}\r\n </div>\r\n </InputGroup>\r\n </Portal>\r\n );\r\n }\r\n\r\n private onTextErrorsChanged = (textErrors: ValidationError[]) =>\r\n this.setState(\r\n () => ({ textErrors }),\r\n () => this.handleErrors()\r\n );\r\n\r\n private onFocus = (e: React.SyntheticEvent<{}>) => {\r\n this.props.onFocus?.(e);\r\n if (!this.state.suggestionsVisible) {\r\n this.props.onSuggestionsOpened?.();\r\n }\r\n this.setState(\r\n () => ({ textIsFocused: true, suggestionsVisible: true, touched: true }),\r\n () => this.handleErrors()\r\n );\r\n this.fetchExistingTags(this.state.value);\r\n const showMobileVersion =\r\n this.props.mobileVersionEnabled &&\r\n this.isMobile &&\r\n (this.state.textIsFocused || this.state.suggestionsVisible);\r\n if (\r\n !showMobileVersion &&\r\n this.props.mobileVersionEnabled &&\r\n this.isMobile\r\n ) {\r\n setTimeout(() => this.textRef.current?.focus(), 100);\r\n }\r\n };\r\n\r\n private onKeyDown = (suggestions: T[]) => async (e: React.KeyboardEvent) => {\r\n if (e.key === 'Tab') {\r\n this.setState({\r\n suggestionsVisible: false,\r\n preselectedSuggestion: undefined,\r\n });\r\n }\r\n if (\r\n e.key === 'Enter' &&\r\n (this.state.value !== '' ||\r\n this.state.preselectedSuggestion !== undefined) &&\r\n this.state.textErrors.length === 0\r\n ) {\r\n e.preventDefault();\r\n e.stopPropagation();\r\n const existingTag =\r\n this.props.existingTags &&\r\n this.props.existingTags.find(et => et.name === this.state.value);\r\n if (this.state.preselectedSuggestion !== undefined) {\r\n this.props.onTagsChanged(\r\n this.props.tags.concat(suggestions[this.state.preselectedSuggestion])\r\n );\r\n this.setState({ value: '', preselectedSuggestion: undefined }, () => {\r\n this.fetchExistingTags();\r\n this.handleErrors();\r\n });\r\n } else if (existingTag) {\r\n this.props.onTagsChanged(this.props.tags.concat(existingTag));\r\n this.setState({ value: '' }, () => {\r\n this.fetchExistingTags();\r\n this.handleErrors();\r\n });\r\n } else if (this.props.allowNew) {\r\n await this.addNewTag();\r\n this.handleErrors();\r\n }\r\n }\r\n if (suggestions.length > 0 && this.state.suggestionsVisible) {\r\n if (e.key === 'ArrowUp') {\r\n const preselectedSuggestion =\r\n this.state.preselectedSuggestion === undefined\r\n ? suggestions.length - 1\r\n : this.state.preselectedSuggestion === 0\r\n ? suggestions.length - 1\r\n : this.state.preselectedSuggestion - 1;\r\n this.setState({ preselectedSuggestion });\r\n } else if (e.key === 'ArrowDown') {\r\n const preselectedSuggestion =\r\n this.state.preselectedSuggestion === undefined\r\n ? 0\r\n : this.state.preselectedSuggestion === suggestions.length - 1\r\n ? 0\r\n : this.state.preselectedSuggestion + 1;\r\n this.setState({ preselectedSuggestion });\r\n } else {\r\n this.setState({ preselectedSuggestion: undefined });\r\n }\r\n }\r\n };\r\n\r\n private addNewTag = async () => {\r\n const newTag = await this.props.onNewTagAdded(this.state.value);\r\n if (newTag) {\r\n this.props.onTagsChanged(\r\n this.props.tags ? this.props.tags.concat(newTag) : [newTag]\r\n );\r\n }\r\n this.setState({ value: '', textErrors: [] }, () => {\r\n this.fetchExistingTags();\r\n this.handleErrors();\r\n });\r\n };\r\n\r\n private onSuggestionSelected = (tag: T, lastSelected: boolean) => {\r\n const newTags = this.props.tags.concat(tag);\r\n this.props.onTagsChanged(newTags);\r\n const isMax = newTags.length === this.props.maxTags;\r\n const finalValue =\r\n !this.props.allowNew && !isMax && !lastSelected ? this.state.value : '';\r\n this.setState(\r\n {\r\n value: finalValue,\r\n suggestionsVisible: isMax ? false : this.state.suggestionsVisible,\r\n preselectedSuggestion: undefined,\r\n textErrors: [],\r\n },\r\n () => {\r\n if (\r\n !this.props.maxTags ||\r\n this.props.tags.length + 1 < this.props.maxTags\r\n ) {\r\n this.fetchExistingTags(finalValue);\r\n }\r\n this.handleErrors();\r\n }\r\n );\r\n };\r\n\r\n private onBlur = () => {\r\n this.props.onBlur?.();\r\n this.setState(\r\n {\r\n textIsFocused: false,\r\n preselectedSuggestion: undefined,\r\n },\r\n () => this.handleErrors()\r\n );\r\n };\r\n\r\n private onTextChanged = (\r\n e: React.ChangeEvent<HTMLInputElement>,\r\n isValid: boolean\r\n ) => {\r\n const value = e.target.value;\r\n this.setState(\r\n () => ({\r\n value,\r\n isValid: isValid,\r\n textIsValid: isValid,\r\n suggestionsVisible: true,\r\n }),\r\n () => this.handleErrors()\r\n );\r\n this.fetchExistingTags(e.target.value);\r\n };\r\n\r\n private handleErrors = (tags: T[] = this.props.tags) => {\r\n let errors = this.getErrors(tags);\r\n if (errors.length > 0) {\r\n this.setInvalid(errors);\r\n } else {\r\n this.setValid();\r\n }\r\n };\r\n\r\n private getErrors(tags: T[]) {\r\n let errors = [];\r\n if (tags.length < this.props.maxTags) {\r\n errors = errors.concat(this.state.textErrors);\r\n }\r\n if (this.state.value !== '' && tags.length === 0 && this.props.required) {\r\n errors = errors.concat(\r\n this.getTranslations(this.props.translations).required\r\n );\r\n }\r\n if (this.state.value && this.props.allowNew && !this.state.textIsFocused) {\r\n errors = errors.concat(this.props.valueNotAddedError);\r\n }\r\n if (this.props.maxTags < (this.props.tags && this.props.tags.length)) {\r\n errors = errors.concat(this.props.maxTagsSurpassedError);\r\n }\r\n return errors.filter(i => i);\r\n }\r\n\r\n private fetchExistingTags(startsWith: string = '') {\r\n if (\r\n this.props.fetchExistingTags &&\r\n startsWith.length >= this.props.minLettersToFetch\r\n ) {\r\n const timer = setTimeout(\r\n () => this.setState(() => ({ fetchingExistingTags: true })),\r\n this.props.loadingDelayMs\r\n );\r\n this.props.fetchExistingTags(startsWith).then(fetchedExistingTags => {\r\n clearTimeout(timer);\r\n this.setState(() => ({\r\n fetchedExistingTags,\r\n fetchingExistingTags: false,\r\n }));\r\n });\r\n }\r\n }\r\n\r\n private getSuggestions() {\r\n const existingTags: T[] = []\r\n .concat(this.props.existingTags ? this.props.existingTags : [])\r\n .concat(\r\n this.state.fetchedExistingTags ? this.state.fetchedExistingTags : []\r\n );\r\n const filteredTags = this.props.filterExistingTags(\r\n this.state.value ? this.state.value.toLowerCase() : '',\r\n existingTags\r\n );\r\n let suggestions = filteredTags\r\n .filter(\r\n tag =>\r\n this.props.allowSameTagMultipleTimes ||\r\n !this.props.tags.some(t => t.id === tag.id)\r\n )\r\n .slice(0, this.props.maxSuggestions);\r\n return suggestions;\r\n }\r\n\r\n private renderTag(tag: T, index: number) {\r\n const body = (\r\n <>\r\n {tag.name}\r\n {!this.props.readOnly && (\r\n <Button\r\n {...(this.props.id && {\r\n id: this.props.id + '-tag-' + index.toString(),\r\n })}\r\n circular={true}\r\n blank={true}\r\n onClick={this.tagRemoveClick(tag)}\r\n className=\"ml-1 transform-rotate--45 line-height--0 p-0\"\r\n Component={TagButtonComponent}\r\n preventsDefault={false}\r\n >\r\n <PlusIcon />\r\n </Button>\r\n )}\r\n </>\r\n );\r\n const className = classNames('tags-input__tag', {\r\n 'tags-input__tag-chip': this.props.showChips,\r\n });\r\n if (this.props.onTagClick) {\r\n return (\r\n <Button\r\n onClick={this.tagClick(tag)}\r\n small={true}\r\n className={className}\r\n key={index}\r\n >\r\n {body}\r\n </Button>\r\n );\r\n }\r\n return (\r\n <div onClick={this.tagClick(tag)} className={className} key={index}>\r\n {body}\r\n </div>\r\n );\r\n }\r\n\r\n private tagClick = (tag: T) => () => {\r\n this.props.onTagClick && this.props.onTagClick(tag);\r\n };\r\n\r\n private tagRemoveClick = (tag: T) => (e: React.MouseEvent<HTMLElement>) => {\r\n e.stopPropagation();\r\n const newTags = this.props.tags.filter(sv => sv.id !== tag.id);\r\n /*if (newTags.length === 0) {\r\n setTimeout(() => this.focus(), 50);\r\n }\r\n this.setState({\r\n suggestionsVisible: false,\r\n });*/\r\n this.props.onTagsChanged && this.props.onTagsChanged(newTags);\r\n this.handleErrors(newTags);\r\n // this.fetchExistingTags();\r\n };\r\n}\r\n\r\ninterface TagsFinal {\r\n <T extends Tag = Tag>(item: TagsProps<T>): React.ReactElement;\r\n defaultProps?: Partial<TagsProps>;\r\n}\r\n\r\nexport const Tags = (withThemeContext<TagsProps, InstanceType<typeof TagsRaw>>(\r\n // tslint:disable-next-line: no-any\r\n withFormContext<TagsProps>(TagsRaw),\r\n 'tags'\r\n) as unknown) as TagsFinal;\r\n\r\nexport default Tags;\r\n"],"file":"Tags.js"}
|
@@ -6,6 +6,7 @@ export declare type RenderSuggestionTagProps<T extends Tag = Tag> = {
|
|
6
6
|
index: number;
|
7
7
|
id?: string;
|
8
8
|
onClick: (e: React.MouseEvent<HTMLElement>) => void;
|
9
|
+
isPreselected: boolean;
|
9
10
|
};
|
10
11
|
export declare type SuggestionsProps<T extends Tag = Tag> = {
|
11
12
|
className?: string;
|
@@ -29,6 +29,23 @@ var popperModifiers = {
|
|
29
29
|
}
|
30
30
|
};
|
31
31
|
|
32
|
+
function DefaultSuggestionTag(_ref) {
|
33
|
+
var index = _ref.index,
|
34
|
+
tag = _ref.tag,
|
35
|
+
id = _ref.id,
|
36
|
+
onClick = _ref.onClick,
|
37
|
+
isPreselected = _ref.isPreselected;
|
38
|
+
return /*#__PURE__*/React.createElement("li", {
|
39
|
+
key: index
|
40
|
+
}, /*#__PURE__*/React.createElement(_.Button, _extends({}, id && {
|
41
|
+
id: id + '-suggestion-' + index.toString()
|
42
|
+
}, {
|
43
|
+
className: 'w-100 tags-input__suggestion ' + (isPreselected ? 'tags-input__suggestion--preselected' : ''),
|
44
|
+
onClick: onClick,
|
45
|
+
dropdown: true
|
46
|
+
}), tag.name));
|
47
|
+
}
|
48
|
+
|
32
49
|
function Suggestions(props) {
|
33
50
|
var _props$anchorEl2;
|
34
51
|
|
@@ -46,21 +63,6 @@ function Suggestions(props) {
|
|
46
63
|
zIndex: 10000
|
47
64
|
};
|
48
65
|
}, [(_props$anchorEl2 = props.anchorEl) === null || _props$anchorEl2 === void 0 ? void 0 : _props$anchorEl2.scrollWidth]);
|
49
|
-
var DefaultSuggestionTag = React.useCallback(function (_ref) {
|
50
|
-
var index = _ref.index,
|
51
|
-
tag = _ref.tag,
|
52
|
-
id = _ref.id,
|
53
|
-
onClick = _ref.onClick;
|
54
|
-
return /*#__PURE__*/React.createElement("li", {
|
55
|
-
key: index
|
56
|
-
}, /*#__PURE__*/React.createElement(_.Button, _extends({}, id && {
|
57
|
-
id: id + '-suggestion-' + index.toString()
|
58
|
-
}, {
|
59
|
-
className: 'w-100 tags-input__suggestion ' + (props.preselectedSuggestion !== undefined && props.preselectedSuggestion === index ? 'tags-input__suggestion--preselected' : ''),
|
60
|
-
onClick: onClick,
|
61
|
-
dropdown: true
|
62
|
-
}), tag.name));
|
63
|
-
}, []);
|
64
66
|
var _props$SuggestionTag = props.SuggestionTag,
|
65
67
|
SuggestionTag = _props$SuggestionTag === void 0 ? DefaultSuggestionTag : _props$SuggestionTag;
|
66
68
|
return props.anchorEl && /*#__PURE__*/React.createElement(_Popper.default, _extends({
|
@@ -84,7 +86,8 @@ function Suggestions(props) {
|
|
84
86
|
index: index,
|
85
87
|
tag: tag,
|
86
88
|
onClick: onSelectedFactory(tag, props.tags.length === 1),
|
87
|
-
id: props.id
|
89
|
+
id: props.id,
|
90
|
+
isPreselected: props.preselectedSuggestion !== undefined && props.preselectedSuggestion === index
|
88
91
|
});
|
89
92
|
}), props.EmptyComponent && props.tags.length === 0 && !props.allowNew && !props.isWaitingForMoreInput && /*#__PURE__*/React.createElement("li", {
|
90
93
|
className: "w-100 text-center p-2"
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/components/tags/subComponents/TagsSuggestions.tsx"],"names":["popperModifiers","flip","enabled","
|
1
|
+
{"version":3,"sources":["../../../../src/lib/components/tags/subComponents/TagsSuggestions.tsx"],"names":["popperModifiers","flip","enabled","DefaultSuggestionTag","index","tag","id","onClick","isPreselected","toString","name","Suggestions","props","onSelected","onSelectedFactory","React","useCallback","lastSelected","e","popperStyle","useMemo","width","anchorEl","scrollWidth","zIndex","SuggestionTag","isVisible","popperProps","className","loading","innerRef","AddNewTagComponent","LoadingComponent","isWaitingForMoreInput","WaitingForMoreInputComponent","tags","map","length","preselectedSuggestion","undefined","EmptyComponent","allowNew","SuggestionsWrapped"],"mappings":";;;;;;;;;AAAA;;AAEA;;AACA;;AACA;;;;;;;;;;AAiCA,IAAMA,eAAe,GAAG;AAAEC,EAAAA,IAAI,EAAE;AAAEC,IAAAA,OAAO,EAAE;AAAX;AAAR,CAAxB;;AAEA,SAASC,oBAAT,OAMgC;AAAA,MAL9BC,KAK8B,QAL9BA,KAK8B;AAAA,MAJ9BC,GAI8B,QAJ9BA,GAI8B;AAAA,MAH9BC,EAG8B,QAH9BA,EAG8B;AAAA,MAF9BC,OAE8B,QAF9BA,OAE8B;AAAA,MAD9BC,aAC8B,QAD9BA,aAC8B;AAC9B,sBACE;AAAI,IAAA,GAAG,EAAEJ;AAAT,kBACE,oBAAC,QAAD,eACOE,EAAE,IAAI;AACTA,IAAAA,EAAE,EAAEA,EAAE,GAAG,cAAL,GAAsBF,KAAK,CAACK,QAAN;AADjB,GADb;AAIE,IAAA,SAAS,EACP,mCACCD,aAAa,GAAG,qCAAH,GAA2C,EADzD,CALJ;AAQE,IAAA,OAAO,EAAED,OARX;AASE,IAAA,QAAQ,EAAE;AATZ,MAWGF,GAAG,CAACK,IAXP,CADF,CADF;AAiBD;;AAED,SAASC,WAAT,CACEC,KADF,EAEE;AAAA;;AACA,MAAQC,UAAR,GAAuBD,KAAvB,CAAQC,UAAR;AACA,MAAMC,iBAAiB,GAAGC,KAAK,CAACC,WAAN,CACxB,UAACX,GAAD,EAASY,YAAT;AAAA,WAAmC,UAACC,CAAD,EAAyB;AAC1DL,MAAAA,UAAU,CAACR,GAAD,EAAMY,YAAN,CAAV;AACD,KAFD;AAAA,GADwB,EAIxB,CAACJ,UAAD,CAJwB,CAA1B;AAMA,MAAMM,WAAW,GAAGJ,KA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AFT;AAGE,MAAA,GAAG,EAAEC,GAHP;AAIE,MAAA,OAAO,EAAES,iBAAiB,CAACT,GAAD,EAAMO,KAAK,CAACuB,IAAN,CAAWE,MAAX,KAAsB,CAA5B,CAJ5B;AAKE,MAAA,EAAE,EAAEzB,KAAK,CAACN,EALZ;AAME,MAAA,aAAa,EACXM,KAAK,CAAC0B,qBAAN,KAAgCC,SAAhC,IACA3B,KAAK,CAAC0B,qBAAN,KAAgClC;AARpC,MADa;AAAA,GAAf,CAVJ,EAuBGQ,KAAK,CAAC4B,cAAN,IACC5B,KAAK,CAACuB,IAAN,CAAWE,MAAX,KAAsB,CADvB,IAEC,CAACzB,KAAK,CAAC6B,QAFR,IAGC,CAAC7B,KAAK,CAACqB,qBAHR,iBAIG;AAAI,IAAA,SAAS,EAAC;AAAd,KACGrB,KAAK,CAAC4B,cADT,CA3BN,CATF,CARF,CAFJ;AAuDD;;AAED,IAAME,kBAAkB,GAAG/B,WAA3B;eAEe+B,kB","sourcesContent":["import * as React from 'react';\r\nimport { Tag } from '..';\r\nimport { Button } from '../../..';\r\nimport Popper, { PopperProps } from '@material-ui/core/Popper';\r\nimport classNames from 'classnames';\r\n\r\nexport type RenderSuggestionTagProps<T extends Tag = Tag> = {\r\n tag: T;\r\n index: number;\r\n id?: string;\r\n onClick: (e: React.MouseEvent<HTMLElement>) => void;\r\n isPreselected: boolean;\r\n};\r\n\r\nexport type SuggestionsProps<T extends Tag = Tag> = {\r\n className?: string;\r\n innerRef: React.RefObject<HTMLDivElement>;\r\n anchorEl: HTMLElement;\r\n id?: string;\r\n preselectedSuggestion?: number;\r\n isVisible: boolean;\r\n isWaitingForMoreInput: boolean;\r\n tags: T[];\r\n onSelected: (tag: T, lastSelected: boolean) => void;\r\n value: string;\r\n loading: boolean;\r\n LoadingComponent?: string | JSX.Element;\r\n EmptyComponent?: string | JSX.Element;\r\n AddNewTagComponent?: JSX.Element;\r\n WaitingForMoreInputComponent?: string | JSX.Element;\r\n allowNew: boolean;\r\n popperProps?: Partial<PopperProps>;\r\n SuggestionTag?: React.ComponentType<RenderSuggestionTagProps<T>>;\r\n};\r\n\r\ntype InjectedProps = {};\r\n\r\nconst popperModifiers = { flip: { enabled: false } };\r\n\r\nfunction DefaultSuggestionTag<T extends Tag = Tag>({\r\n index,\r\n tag,\r\n id,\r\n onClick,\r\n isPreselected,\r\n}: RenderSuggestionTagProps<T>) {\r\n return (\r\n <li key={index}>\r\n <Button\r\n {...(id && {\r\n id: id + '-suggestion-' + index.toString(),\r\n })}\r\n className={\r\n 'w-100 tags-input__suggestion ' +\r\n (isPreselected ? 'tags-input__suggestion--preselected' : '')\r\n }\r\n onClick={onClick}\r\n dropdown={true}\r\n >\r\n {tag.name}\r\n </Button>\r\n </li>\r\n );\r\n}\r\n\r\nfunction Suggestions<T extends Tag = Tag>(\r\n props: SuggestionsProps<T> & InjectedProps\r\n) {\r\n const { onSelected } = props;\r\n const onSelectedFactory = React.useCallback(\r\n (tag: T, lastSelected: boolean) => (e: React.MouseEvent) => {\r\n onSelected(tag, lastSelected);\r\n },\r\n [onSelected]\r\n );\r\n const popperStyle = React.useMemo(\r\n () => ({ width: props.anchorEl?.scrollWidth, zIndex: 10000 }),\r\n [props.anchorEl?.scrollWidth]\r\n );\r\n\r\n const { SuggestionTag = DefaultSuggestionTag } = props;\r\n return (\r\n props.anchorEl && (\r\n <Popper\r\n open={props.isVisible}\r\n anchorEl={props.anchorEl}\r\n style={popperStyle}\r\n placement=\"bottom-start\"\r\n modifiers={popperModifiers}\r\n {...props.popperProps}\r\n >\r\n <div\r\n {...(props.id && {\r\n id: props.id,\r\n })}\r\n className={classNames('tags-input__suggestions', props.className, {\r\n 'tags-input__suggestions--loading': props.loading,\r\n })}\r\n ref={props.innerRef}\r\n >\r\n <ul>\r\n {props.AddNewTagComponent}\r\n {props.loading && props.LoadingComponent}\r\n {props.isWaitingForMoreInput &&\r\n props.WaitingForMoreInputComponent && (\r\n <li className=\"w-100 text-center p-2\">\r\n {props.WaitingForMoreInputComponent}\r\n </li>\r\n )}\r\n {!props.isWaitingForMoreInput &&\r\n props.tags.map((tag, index) => (\r\n <SuggestionTag\r\n key={tag.id}\r\n index={index}\r\n tag={tag}\r\n onClick={onSelectedFactory(tag, props.tags.length === 1)}\r\n id={props.id}\r\n isPreselected={\r\n props.preselectedSuggestion !== undefined &&\r\n props.preselectedSuggestion === index\r\n }\r\n />\r\n ))}\r\n {props.EmptyComponent &&\r\n props.tags.length === 0 &&\r\n !props.allowNew &&\r\n !props.isWaitingForMoreInput && (\r\n <li className=\"w-100 text-center p-2\">\r\n {props.EmptyComponent}\r\n </li>\r\n )}\r\n </ul>\r\n </div>\r\n </Popper>\r\n )\r\n );\r\n}\r\n\r\nconst SuggestionsWrapped = Suggestions;\r\n\r\nexport default SuggestionsWrapped;\r\n"],"file":"TagsSuggestions.js"}
|
@@ -103,7 +103,8 @@ var TextAreaRaw = /*#__PURE__*/function (_BaseInput) {
|
|
103
103
|
readOnly: this.props.readOnly,
|
104
104
|
onKeyDown: this.onKeyDown,
|
105
105
|
rows: this.props.minRows,
|
106
|
-
rowsMax: this.props.maxRows
|
106
|
+
rowsMax: this.props.maxRows,
|
107
|
+
maxLength: this.props.maxLength
|
107
108
|
})), /*#__PURE__*/React.createElement("span", {
|
108
109
|
className: "highlight"
|
109
110
|
}), /*#__PURE__*/React.createElement("span", {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/components/textArea/TextArea.tsx"],"names":["TextAreaRaw","props","e","onKeyDown","elem","inputRef","stopClickPropagation","stopPropagation","title","getValidationClass","readOnly","className","onContainerClick","containerRef","id","elemRef","placeholder","getDisabled","required","state","value","handleChange","handleBlur","handleFocus","minRows","maxRows","renderDefaultValidation","label","renderLabel","focus","BaseInput","Object","assign","defaultProps","type","TextArea"],"mappings":";;;;;;;;;AACA;;AAGA;;AACA;;AAKA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
1
|
+
{"version":3,"sources":["../../../src/lib/components/textArea/TextArea.tsx"],"names":["TextAreaRaw","props","e","onKeyDown","elem","inputRef","stopClickPropagation","stopPropagation","title","getValidationClass","readOnly","className","onContainerClick","containerRef","id","elemRef","placeholder","getDisabled","required","state","value","handleChange","handleBlur","handleFocus","minRows","maxRows","maxLength","renderDefaultValidation","label","renderLabel","focus","BaseInput","Object","assign","defaultProps","type","TextArea"],"mappings":";;;;;;;;;AACA;;AAGA;;AACA;;AAKA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAiBaA,W;;;;;AAaX,uBAAYC,KAAZ,EAAkC;AAAA;;AAAA;;AAChC,8BAAMA,KAAN;;AADgC;;AAAA,gEA8Cd,UAAAC,CAAC;AAAA,aAAI,MAAKD,KAAL,CAAWE,SAAX,IAAwB,MAAKF,KAAL,CAAWE,SAAX,CAAqBD,CAArB,CAA5B;AAAA,KA9Ca;;AAAA,8DAgDhB,UAACE,IAAD,EAA+B;AAC/C,YAAKA,IAAL,GAAYA,IAAZ;AACA,YAAKH,KAAL,CAAWI,QAAX,IAAuB,MAAKJ,KAAL,CAAWI,QAAX,CAAoBD,IAApB,CAAvB;AACD,KAnDiC;;AAAA,uEAqDP,UAAAF,CAAC;AAAA,aAC1B,MAAKD,KAAL,CAAWK,oBAAX,IAAmCJ,CAAC,CAACK,eAAF,EADT;AAAA,KArDM;;AAAA;AAEjC;;;;WAED,kBAAgB;AACd,0BACE,oBAAC,mBAAD;AAAY,QAAA,KAAK,EAAE,KAAKN,KAAL,CAAWO;AAA9B,sBACE;AACE,QAAA,SAAS,uCAAgC,KAAKC,kBAAL,EAAhC,oCACG,KAAKR,KAAL,CAAWS,QAAX,GAAsB,0BAAtB,GAAmD,EADtD,oCAEG,KAAKT,KAAL,CAAWU,SAAX,GAAuB,KAAKV,KAAL,CAAWU,SAAlC,GAA8C,EAFjD,CADX;AAIE,QAAA,OAAO,EAAE,KAAKC,gBAJhB;AAKE,QAAA,GAAG,EAAE,KAAKC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EAAAA,IAAI,EAAE,MADgE;AAEtEnB,EAAAA,WAAW,EAAE,EAFyD;AAGtEV,EAAAA,oBAAoB,EAAE,IAHgD;AAItEI,EAAAA,QAAQ,EAAE;AAJ4D,CAA1C,C;;AAiEzB,IAAM0B,QAAQ,GAAG,wCAGtB,sCAA+BpC,WAA/B,CAHsB,EAGuB,UAHvB,CAAjB;;eAKQoC,Q","sourcesContent":["// Libs\r\nimport * as React from 'react';\r\n\r\n// Misc\r\nimport InputGroup from '../inputGroup/InputGroup';\r\nimport {\r\n BaseInputProps,\r\n BaseInputState,\r\n BaseInput,\r\n} from '../base/input/BaseInput';\r\nimport { withFormContext } from '../form/withFormContext';\r\nimport TextareaAutosize from '@material-ui/core/TextareaAutosize';\r\nimport { withThemeContext } from '../themeProvider/withThemeContext';\r\n\r\nexport interface TextAreaProps extends BaseInputProps<HTMLTextAreaElement> {\r\n mask?: string;\r\n reverse?: boolean;\r\n placeholder?: string;\r\n stopClickPropagation?: boolean;\r\n inputRef?: (input: HTMLTextAreaElement) => void;\r\n readOnly?: boolean;\r\n type?: 'number' | 'text';\r\n minRows?: number;\r\n maxRows?: number;\r\n maxLength?: number;\r\n}\r\n\r\nexport interface TextAreaState extends BaseInputState {}\r\n\r\nexport class TextAreaRaw extends BaseInput<\r\n TextAreaProps,\r\n TextAreaState,\r\n HTMLTextAreaElement\r\n> {\r\n public static defaultProps = (Object.assign({}, BaseInput.defaultProps, {\r\n type: 'text',\r\n placeholder: '',\r\n stopClickPropagation: true,\r\n readOnly: false,\r\n }) as unknown) as TextAreaProps;\r\n private elem: HTMLTextAreaElement;\r\n\r\n constructor(props: TextAreaProps) {\r\n super(props);\r\n }\r\n\r\n public render() {\r\n return (\r\n <InputGroup title={this.props.title}>\r\n <div\r\n className={`input__base textArea-input ${this.getValidationClass()} \r\n ${this.props.readOnly ? 'textArea-input--readOnly' : ''} \r\n ${this.props.className ? this.props.className : ''}`}\r\n onClick={this.onContainerClick}\r\n ref={this.containerRef}\r\n >\r\n <TextareaAutosize\r\n {...(this.props.id && {\r\n id: this.props.id,\r\n })}\r\n ref={this.elemRef}\r\n placeholder={this.props.placeholder}\r\n disabled={this.getDisabled()}\r\n required={this.props.required}\r\n className={this.state.value ? 'filled' : ''}\r\n onChange={this.handleChange}\r\n value={this.state.value}\r\n onBlur={this.handleBlur}\r\n onFocus={this.handleFocus}\r\n readOnly={this.props.readOnly}\r\n onKeyDown={this.onKeyDown}\r\n rows={this.props.minRows}\r\n rowsMax={this.props.maxRows}\r\n maxLength={this.props.maxLength}\r\n />\r\n <span className=\"highlight\" />\r\n <span className=\"bar\" />\r\n {this.renderDefaultValidation()}\r\n {this.props.label && <label>{this.renderLabel()}</label>}\r\n </div>\r\n </InputGroup>\r\n );\r\n }\r\n\r\n public focus() {\r\n this.elem && this.elem.focus();\r\n }\r\n\r\n private onKeyDown = e => this.props.onKeyDown && this.props.onKeyDown(e);\r\n\r\n private elemRef = (elem: HTMLTextAreaElement) => {\r\n this.elem = elem;\r\n this.props.inputRef && this.props.inputRef(elem);\r\n };\r\n\r\n private onContainerClick = e =>\r\n this.props.stopClickPropagation && e.stopPropagation();\r\n}\r\n\r\nexport const TextArea = withThemeContext<\r\n TextAreaProps,\r\n InstanceType<typeof TextAreaRaw>\r\n>(withFormContext<TextAreaProps>(TextAreaRaw), 'textArea');\r\n\r\nexport default TextArea;\r\n"],"file":"TextArea.js"}
|
package/build/dist/report.html
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
<head>
|
4
4
|
<meta charset="UTF-8"/>
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
6
|
-
<title>guestbell-forms [6 Jan 2022 at
|
6
|
+
<title>guestbell-forms [6 Jan 2022 at 21:18]</title>
|
7
7
|
<link rel="shortcut icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAABrVBMVEUAAAD///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////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