guestbell-forms 2.0.258 → 2.0.262

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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/components/tags/Tags.tsx"],"names":["PlusIcon","LeftArrowIcon","classNames","require","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","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","isLoading","suggestionsLoadingComponent","suggestionsEmptyComponent","waitingForMoreInputComponent","minLettersToFetch","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;;AAO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AO,EAAE,I;AACTX,EAAAA,aAAa,EAAE;AAAA,WAAMT,SAAN;AAAA,G;AACfc,EAAAA,aAAa,EAAE,uBAAAgG,UAAU;AAAA,WACvBC,OAAO,CAACC,OAAR,CAAgB;AAAExG,MAAAA,IAAI,EAAEsG,UAAR;AAAoBzI,MAAAA,EAAE,EAAE,IAAI4I,IAAJ,GAAWC,OAAX;AAAxB,KAAhB,CADuB;AAAA,G;AAEzB3B,EAAAA,kBAAkB,eAAE,0D;AACpBC,EAAAA,qBAAqB,eAAE,qE;AACvBP,EAAAA,4BAA4B,eAAE,8D;AAC9BJ,EAAAA,eAAe,EAAE,I;AACjBE,EAAAA,2BAA2B,eACzB,oBAAC,uBAAD;AAAgB,IAAA,SAAS,EAAC;AAA1B,I;AAEFC,EAAAA,yBAAyB,EAAE,qB;AAC3BY,EAAAA,cAAc,EAAE,G;AAChBI,EAAAA,kBAAkB,EAAE,4BAACmB,IAAD,EAAOzG,IAAP;AAAA,WAClBA,IAAI,CAACqB,MAAL,CAAY,UAAAf,GAAG;AAAA,aAAIA,GAAG,CAACR,IAAJ,IAAYQ,GAAG,CAACR,IAAJ,CAASyF,WAAT,GAAuBP,UAAvB,CAAkCyB,IAAlC,CAAhB;AAAA,KAAf,CADkB;AAAA,G;AAEpBb,EAAAA,cAAc,EAAE,C;AAChBrD,EAAAA,YAAY,EAAE,K;AACdQ,EAAAA,YAAY,EAAE1F,uB;AACdmH,EAAAA,iBAAiB,EAAE,C;AACnB3F,EAAAA,oBAAoB,EAAE;;;AA6iBnB,IAAM6H,IAAI,GAAG,yCAClB;AACA,sCAA2B5I,OAA3B,CAFkB,EAGlB,MAHkB,CAAb;;eAMQ4I,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 from './subComponents/TagsSuggestions';\r\nimport { withFormContext } from '../form/withFormContext';\r\nvar classNames = require('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 = {\r\n className?: string;\r\n disabled?: boolean;\r\n tags: Tag[];\r\n existingTags?: Tag[];\r\n fetchExistingTags?: (text: string) => Promise<Tag[]>;\r\n onTagsChanged: (newTags: Tag[]) => void;\r\n onNewTagAdded?: (newTagName: string) => Promise<Tag>;\r\n onTagClick?: (tag: Tag) => 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: Tag[]) => Tag[];\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} & BaseInputProps<HTMLInputElement, TagsTranslations>;\r\n\r\nexport interface TagsState extends BaseInputState {\r\n textIsFocused: boolean;\r\n textErrors: ValidationError[];\r\n textIsValid: boolean;\r\n suggestionsVisible: boolean;\r\n fetchedExistingTags: Tag[];\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 extends BaseInput<\r\n TagsProps & InjectedProps,\r\n TagsState,\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 & 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\r\n {...(this.props.id && {\r\n id: this.props.id + '-text-input',\r\n })}\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 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: Tag[]) => async (\r\n e: React.KeyboardEvent\r\n ) => {\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: Tag, 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: Tag[] = 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: Tag[]) {\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: Tag[] = []\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: Tag, 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: Tag) => () => {\r\n this.props.onTagClick && this.props.onTagClick(tag);\r\n };\r\n\r\n private tagRemoveClick = (tag: Tag) => (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\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);\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","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;;AACA;;AACA;;AACA;;AAEA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAhBYA,Q,YAAAA,Q;;;;;;AAAAA,Q;;;;;;;IACAC,a,YAAAA,a;;;;;;AAAAA,a;;;;;;;AAuBL,IAAMC,uBAAuB,mCAC/BC,mCAD+B;AAElCC,EAAAA,MAAM,EAAE;AAF0B,EAA7B;;;;AAoDP,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,EAA8C;AAAA;;AAAA;;AAC5C,8BAAMA,KAAN;;AAD4C;;AAAA;;AA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,IAAI,CAACqB,MAAL,CAAY,UAAAf,GAAG;AAAA,aAAIA,GAAG,CAACR,IAAJ,IAAYQ,GAAG,CAACR,IAAJ,CAAS2F,WAAT,GAAuBP,UAAvB,CAAkCyB,IAAlC,CAAhB;AAAA,KAAf,CADkB;AAAA,G;AAEpBb,EAAAA,cAAc,EAAE,C;AAChBtD,EAAAA,YAAY,EAAE,K;AACdQ,EAAAA,YAAY,EAAE3F,uB;AACdqH,EAAAA,iBAAiB,EAAE,C;AACnB7F,EAAAA,oBAAoB,EAAE;;;AA8iBnB,IAAM+H,IAAI,GAAG,yCAClB;AACA,sCAA2B9I,OAA3B,CAFkB,EAGlB,MAHkB,CAAb;;eAMQ8I,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 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 = {\r\n className?: string;\r\n tagsSuggestionsClassName?: string;\r\n disabled?: boolean;\r\n tags: Tag[];\r\n existingTags?: Tag[];\r\n fetchExistingTags?: (text: string) => Promise<Tag[]>;\r\n onTagsChanged: (newTags: Tag[]) => void;\r\n onNewTagAdded?: (newTagName: string) => Promise<Tag>;\r\n onTagClick?: (tag: Tag) => 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: Tag[]) => Tag[];\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} & BaseInputProps<HTMLInputElement, TagsTranslations>;\r\n\r\nexport interface TagsState extends BaseInputState {\r\n textIsFocused: boolean;\r\n textErrors: ValidationError[];\r\n textIsValid: boolean;\r\n suggestionsVisible: boolean;\r\n fetchedExistingTags: Tag[];\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 extends BaseInput<\r\n TagsProps & InjectedProps,\r\n TagsState,\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 & 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\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 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: Tag[]) => async (\r\n e: React.KeyboardEvent\r\n ) => {\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: Tag, 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: Tag[] = 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: Tag[]) {\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: Tag[] = []\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: Tag, 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: Tag) => () => {\r\n this.props.onTagClick && this.props.onTagClick(tag);\r\n };\r\n\r\n private tagRemoveClick = (tag: Tag) => (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\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);\r\n\r\nexport default Tags;\r\n"],"file":"Tags.js"}
@@ -2,6 +2,7 @@ import * as React from 'react';
2
2
  import { Tag } from '..';
3
3
  import { PopperProps } from '@material-ui/core/Popper';
4
4
  export declare type SuggestionsProps = {
5
+ className?: string;
5
6
  innerRef: React.RefObject<HTMLDivElement>;
6
7
  anchorEl: HTMLElement;
7
8
  id?: string;
@@ -55,7 +55,9 @@ var Suggestions = function Suggestions(props) {
55
55
  }, props.popperProps), /*#__PURE__*/React.createElement("div", _extends({}, props.id && {
56
56
  id: props.id
57
57
  }, {
58
- className: (0, _classnames.default)('tags-input__suggestions', 'tags-input__suggestions--loading'),
58
+ className: (0, _classnames.default)('tags-input__suggestions', props.className, {
59
+ 'tags-input__suggestions--loading': props.loading
60
+ }),
59
61
  ref: props.innerRef
60
62
  }), /*#__PURE__*/React.createElement("ul", null, props.AddNewTagComponent, props.loading && props.LoadingComponent, props.isWaitingForMoreInput && props.WaitingForMoreInputComponent && /*#__PURE__*/React.createElement("li", {
61
63
  className: "w-100 text-center p-2"
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/lib/components/tags/subComponents/TagsSuggestions.tsx"],"names":["popperModifiers","flip","enabled","Suggestions","props","onSelected","onSelectedFactory","React","useCallback","tag","lastSelected","e","popperStyle","useMemo","width","anchorEl","scrollWidth","zIndex","isVisible","popperProps","id","innerRef","AddNewTagComponent","loading","LoadingComponent","isWaitingForMoreInput","WaitingForMoreInputComponent","tags","map","index","toString","preselectedSuggestion","undefined","length","name","EmptyComponent","allowNew","SuggestionsWrapped"],"mappings":";;;;;;;;;AAAA;;AAEA;;AACA;;AACA;;;;;;;;;;AAuBA,IAAMA,eAAe,GAAG;AAAEC,EAAAA,IAAI,EAAE;AAAEC,IAAAA,OAA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AI,IAAA,SAAS,EAAC;AAAd,KACGtB,KAAK,CAACsB,4BADT,CALN,EASG,CAACtB,KAAK,CAACqB,qBAAP,IACCrB,KAAK,CAACuB,IAAN,CAAWC,GAAX,CAAe,UAACnB,GAAD,EAAMoB,KAAN;AAAA,wBACb;AAAI,MAAA,GAAG,EAAEA;AAAT,oBACE,oBAAC,QAAD,eACOzB,KAAK,CAACgB,EAAN,IAAY;AACfA,MAAAA,EAAE,EAAEhB,KAAK,CAACgB,EAAN,GAAW,cAAX,GAA4BS,KAAK,CAACC,QAAN;AADjB,KADnB;AAIE,MAAA,SAAS,EACP,mCACC1B,KAAK,CAAC2B,qBAAN,KAAgCC,SAAhC,IACD5B,KAAK,CAAC2B,qBAAN,KAAgCF,KAD/B,GAEG,qCAFH,GAGG,EAJJ,CALJ;AAWE,MAAA,OAAO,EAAEvB,iBAAiB,CAACG,GAAD,EAAML,KAAK,CAACuB,IAAN,CAAWM,MAAX,KAAsB,CAA5B,CAX5B;AAYE,MAAA,QAAQ,EAAE;AAZZ,QAcGxB,GAAG,CAACyB,IAdP,CADF,CADa;AAAA,GAAf,CAVJ,EA8BG9B,KAAK,CAAC+B,cAAN,IACC/B,KAAK,CAACuB,IAAN,CAAWM,MAAX,KAAsB,CADvB,IAEC,CAAC7B,KAAK,CAACgC,QAFR,IAGC,CAAChC,KAAK,CAACqB,qBAHR,iBAIG;AAAI,IAAA,SAAS,EAAC;AAAd,KACGrB,KAAK,CAAC+B,cADT,CAlCN,CAVF,CARF,CAFJ;AA+DD,CA3ED;;AA6EA,IAAME,kBAAkB,GAAGlC,WAA3B;eAEekC,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 SuggestionsProps = {\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: Tag[];\r\n onSelected: (tag: Tag, 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};\r\n\r\ntype InjectedProps = {};\r\n\r\nconst popperModifiers = { flip: { enabled: false } };\r\n\r\nconst Suggestions: React.FC<SuggestionsProps & InjectedProps> = props => {\r\n const { onSelected } = props;\r\n const onSelectedFactory = React.useCallback(\r\n (tag: Tag, 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 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(\r\n 'tags-input__suggestions',\r\n 'tags-input__suggestions--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 <li key={index}>\r\n <Button\r\n {...(props.id && {\r\n id: props.id + '-suggestion-' + index.toString(),\r\n })}\r\n className={\r\n 'w-100 tags-input__suggestion ' +\r\n (props.preselectedSuggestion !== undefined &&\r\n props.preselectedSuggestion === index\r\n ? 'tags-input__suggestion--preselected'\r\n : '')\r\n }\r\n onClick={onSelectedFactory(tag, props.tags.length === 1)}\r\n dropdown={true}\r\n >\r\n {tag.name}\r\n </Button>\r\n </li>\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"}
1
+ {"version":3,"sources":["../../../../src/lib/components/tags/subComponents/TagsSuggestions.tsx"],"names":["popperModifiers","flip","enabled","Suggestions","props","onSelected","onSelectedFactory","React","useCallback","tag","lastSelected","e","popperStyle","useMemo","width","anchorEl","scrollWidth","zIndex","isVisible","popperProps","id","className","loading","innerRef","AddNewTagComponent","LoadingComponent","isWaitingForMoreInput","WaitingForMoreInputComponent","tags","map","index","toString","preselectedSuggestion","undefined","length","name","EmptyComponent","allowNew","SuggestionsWrapped"],"mappings":";;;;;;;;;AAAA;;AAEA;;AACA;;AACA;;;;;;;;;;AAwBA,IAAMA,eAAe,GAAG;AAAEC,EAAAA,IAAI,EAAE;AAAEC,IAAAA,OAAO,EAAE;AAAX;AAAR,CAAxB;;AAEA,IAAMC,WAAuD,GAAG,SAA1DA,WAA0D,CAAAC,KAAK,EAAI;AAAA;;AACvE,MAAQC,UAAR,GAAuBD,KAAvB,CAAQC,UAAR;AACA,MAAMC,iBAAiB,GAAGC,KAAK,CAACC,WAAN,CACxB,UAACC,GAAD,EAAWC,YAAX;AAAA,WAAqC,UAACC,CAAD,EAAyB;AAC5DN,MAAAA,UAAU,CAACI,GAAD,EAAMC,YAAN,CAAV;AACD,KAFD;AAAA,GADwB,EAIxB,CAACL,UAAD,CAJwB,CAA1B;AAMA,MAAMO,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AW,cAAX,GAA4BU,KAAK,CAACC,QAAN;AADjB,KADnB;AAIE,MAAA,SAAS,EACP,mCACC3B,KAAK,CAAC4B,qBAAN,KAAgCC,SAAhC,IACD7B,KAAK,CAAC4B,qBAAN,KAAgCF,KAD/B,GAEG,qCAFH,GAGG,EAJJ,CALJ;AAWE,MAAA,OAAO,EAAExB,iBAAiB,CAACG,GAAD,EAAML,KAAK,CAACwB,IAAN,CAAWM,MAAX,KAAsB,CAA5B,CAX5B;AAYE,MAAA,QAAQ,EAAE;AAZZ,QAcGzB,GAAG,CAAC0B,IAdP,CADF,CADa;AAAA,GAAf,CAVJ,EA8BG/B,KAAK,CAACgC,cAAN,IACChC,KAAK,CAACwB,IAAN,CAAWM,MAAX,KAAsB,CADvB,IAEC,CAAC9B,KAAK,CAACiC,QAFR,IAGC,CAACjC,KAAK,CAACsB,qBAHR,iBAIG;AAAI,IAAA,SAAS,EAAC;AAAd,KACGtB,KAAK,CAACgC,cADT,CAlCN,CATF,CARF,CAFJ;AA8DD,CA1ED;;AA4EA,IAAME,kBAAkB,GAAGnC,WAA3B;eAEemC,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 SuggestionsProps = {\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: Tag[];\r\n onSelected: (tag: Tag, 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};\r\n\r\ntype InjectedProps = {};\r\n\r\nconst popperModifiers = { flip: { enabled: false } };\r\n\r\nconst Suggestions: React.FC<SuggestionsProps & InjectedProps> = props => {\r\n const { onSelected } = props;\r\n const onSelectedFactory = React.useCallback(\r\n (tag: Tag, 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 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 <li key={index}>\r\n <Button\r\n {...(props.id && {\r\n id: props.id + '-suggestion-' + index.toString(),\r\n })}\r\n className={\r\n 'w-100 tags-input__suggestion ' +\r\n (props.preselectedSuggestion !== undefined &&\r\n props.preselectedSuggestion === index\r\n ? 'tags-input__suggestion--preselected'\r\n : '')\r\n }\r\n onClick={onSelectedFactory(tag, props.tags.length === 1)}\r\n dropdown={true}\r\n >\r\n {tag.name}\r\n </Button>\r\n </li>\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"}
@@ -2559,32 +2559,16 @@ a.guestbell__dropdown-toggle {
2559
2559
  flex-direction: column; }
2560
2560
 
2561
2561
  .bookingCalendar__table {
2562
- height: 100%;
2563
- table-layout: auto; }
2564
- .bookingCalendar__table > tbody > tr > td,
2565
- .bookingCalendar__table > thead > tr > td {
2566
- padding: 0; }
2567
- .bookingCalendar__table > tbody > tr > td:first-child,
2568
- .bookingCalendar__table > thead > tr > td:first-child {
2569
- width: 1%; }
2570
- .bookingCalendar__table > tbody > tr:not(:last-of-type) > td:last-of-type,
2571
- .bookingCalendar__table > thead > tr:not(:last-of-type) > td:last-of-type {
2572
- border-left: 1px solid #eeeeee;
2573
- border-right: 1px solid #eeeeee; }
2574
- .bookingCalendar__table > tbody > tr:first-of-type > td:last-of-type,
2575
- .bookingCalendar__table > thead > tr:first-of-type > td:last-of-type {
2562
+ display: grid;
2563
+ grid-template-columns: auto 1fr;
2564
+ position: relative;
2565
+ height: 100%; }
2566
+ .bookingCalendar__table .bookingCalendar__laneTd {
2576
2567
  border-left: 1px solid #eeeeee;
2577
2568
  border-right: 1px solid #eeeeee; }
2578
- .bookingCalendar__table > tbody > tr.bookingCalendar__dataLaneTr > td {
2579
- padding-top: 1rem; }
2580
- .bookingCalendar__table .bookingCalendar__dataLaneTr--last > td {
2581
- padding-bottom: 1rem; }
2582
- .bookingCalendar__table .bookingCalendar__dataLaneTr--last .bookingCalendar__laneTd {
2569
+ .bookingCalendar__table .bookingCalendar__laneTd.bookingCalendar__laneTd--last {
2583
2570
  border-bottom: 1px solid #eeeeee; }
2584
2571
 
2585
- .bookingCalendar__laneTd {
2586
- position: relative; }
2587
-
2588
2572
  .bookingCalendar__lane {
2589
2573
  display: flex;
2590
2574
  flex-direction: row;
@@ -2629,11 +2613,13 @@ a.guestbell__dropdown-toggle {
2629
2613
 
2630
2614
  .bookingCalendar__grid {
2631
2615
  position: absolute;
2632
- top: 0;
2633
2616
  left: 0;
2634
2617
  right: 0;
2635
- bottom: 0;
2636
- pointer-events: none; }
2618
+ height: 100%;
2619
+ grid-area: main;
2620
+ pointer-events: none;
2621
+ grid-column: 2;
2622
+ grid-row-start: 2; }
2637
2623
 
2638
2624
  .bookingCalendar__grid__item {
2639
2625
  height: 100%;
@@ -2660,7 +2646,8 @@ a.guestbell__dropdown-toggle {
2660
2646
  height: 100%;
2661
2647
  width: 100%;
2662
2648
  text-align: end;
2663
- text-transform: none; }
2649
+ text-transform: none;
2650
+ border-left: 1px solid rgba(0, 0, 0, 0.2); }
2664
2651
  .bookingCalendar__lanesHeader .bookingCalendar__lanesHeader__renderItem__button__mutedText {
2665
2652
  opacity: 0.8; }
2666
2653
  .bookingCalendar__lanesHeader .bookingCalendar__lanesHeader__renderItem__button__mutedText--split {