UNPKG

@dialpad/dialtone

Version:

Dialpad's Dialtone design system monorepo

2 lines 29.5 kB
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}}),require(`../../chunk-Bmb41Sf3.cjs`);const e=require(`../../common/utils/index.cjs`),t=require(`../../_plugin-vue_export-helper-D8jCH6HB.cjs`),n=require(`../../localization/index.cjs`),r=require(`../button/button.cjs`),i=require(`../list-item/list-item.cjs`),a=require(`../../combobox-DhjZxfUw.cjs`),o=require(`../stack/stack.cjs`),s=require(`../tooltip/tooltip.cjs`),c=require(`../popover/popover.cjs`),l=require(`../dropdown/dropdown-separator.cjs`),u=require(`../input/input.cjs`),d=require(`../list-item-group/list-item-group.cjs`),f=require(`../../rich_text_editor-FduHYl-G.cjs`),p=require(`../rich-text-editor/rich-text-editor-constants.cjs`),m=require(`./editor-constants.cjs`),h=require(`./EditorToolbarButton.cjs`),g=require(`./EditorToolbarDropdownButton.cjs`),_=require(`./EditorToolbarPopoverButton.cjs`);let v=require(`vue`),y=require(`@dialpad/dialtone-icons/vue3`);var b={compatConfig:{MODE:3},name:`DtRecipeEditor`,components:{DtListItemGroup:d.default,DtDropdownSeparator:l.default,DtListItem:i.default,DtRichTextEditor:f.t,DtButton:r.default,DtPopover:c.default,DtStack:o.default,DtInput:u.default,DtTooltip:s.default,DtCombobox:a.t,EditorToolbarButton:h.default,EditorToolbarDropdownButton:g.default,EditorToolbarPopoverButton:_.default,DtIconQuickReply:y.DtIconQuickReply,DtIconBold:y.DtIconBold,DtIconItalic:y.DtIconItalic,DtIconUnderline:y.DtIconUnderline,DtIconStrikethrough:y.DtIconStrikethrough,DtIconListBullet:y.DtIconListBullet,DtIconListOrdered:y.DtIconListOrdered,DtIconAlignLeft:y.DtIconAlignLeft,DtIconAlignCenter:y.DtIconAlignCenter,DtIconAlignRight:y.DtIconAlignRight,DtIconAlignJustify:y.DtIconAlignJustify,DtIconQuote:y.DtIconQuote,DtIconCodeBlock:y.DtIconCodeBlock,DtIconLink2:y.DtIconLink2,DtIconImage:y.DtIconImage,DtIconSearch:y.DtIconSearch,DtIconType:y.DtIconType,DtIconBraces:y.DtIconBraces,DtIconChevronDown:y.DtIconChevronDown,DtIconFontSize:y.DtIconFontSize,DtIconStopFilled:y.DtIconStopFilled},mixins:[],inheritAttrs:!1,props:{modelValue:{type:[Object,String],default:``},editable:{type:Boolean,default:!0},inputAriaLabel:{type:String,required:!0,default:``},inputClass:{type:String,default:``},autoFocus:{type:[Boolean,String,Number],default:!1,validator(e){return typeof e==`string`?p.RICH_TEXT_EDITOR_AUTOFOCUS_TYPES.includes(e):!0}},placeholder:{type:String,default:``},maxHeight:{type:String,default:`unset`},setLinkPlaceholder:{type:String,default:``},showBoldButton:{type:Boolean,default:!0},showItalicsButton:{type:Boolean,default:!0},showUnderlineButton:{type:Boolean,default:!0},showStrikeButton:{type:Boolean,default:!0},showListItemsButton:{type:Boolean,default:!0},showOrderedListButton:{type:Boolean,default:!0},showAlignLeftButton:{type:Boolean,default:!0},showAlignCenterButton:{type:Boolean,default:!0},showAlignRightButton:{type:Boolean,default:!0},showAlignJustifyButton:{type:Boolean,default:!0},showQuoteButton:{type:Boolean,default:!0},showCodeBlockButton:{type:Boolean,default:!0},showQuickRepliesButton:{type:Boolean,default:!0},showInlineImageButton:{type:Boolean,default:!1},showVariableButton:{type:Boolean,default:!1},variableCategories:{type:Array,default:()=>[]},showAddLink:{type:Object,default:()=>({showAddLinkButton:!0})},showFontStyleButton:{type:Boolean,default:!1},showFontSizeButton:{type:Boolean,default:!1},showFontColorButton:{type:Boolean,default:!1},fontStyles:{type:Array,default:()=>[{name:`Arial`,value:null},{name:`Georgia`,value:`Georgia`},{name:`Helvetica`,value:`Helvetica`},{name:`Verdana`,value:`Verdana`},{name:`Times New Roman`,value:`Times New Roman`}]},fontSizes:{type:Array,default:()=>[{name:`Small`,value:`12px`},{name:`Normal`,value:`15px`},{name:`Large`,value:`24px`},{name:`Huge`,value:`36px`}]},allowBackgroundColor:{type:Boolean,default:!1},allowLineHeight:{type:Boolean,default:!1},preserveWhitespace:{type:[Boolean,String],default:`full`},useDivTags:{type:Boolean,default:!1},allowTables:{type:Boolean,default:!1},allowImageResize:{type:Boolean,default:!1}},emits:[`focus`,`blur`,`input`,`update:modelValue`,`quick-replies-click`,`inline-image-click`,`text-input`],data(){return{internalInputValue:this.modelValue,hasFocus:!1,linkOptions:{class:`d-recipe-editor__link`},currentFontColor:void 0,showLinkInput:!1,fontStyleSearch:``,linkInput:``,currentButtonRefIndex:0,variableSearchValue:``,i18n:new n.DialtoneLocalization}},computed:{inputLength(){return this.internalInputValue.length},htmlOutputFormat(){return p.RICH_TEXT_EDITOR_OUTPUT_FORMATS[2]},flattenedVariableItems(){return this.variableCategories?this.variableCategories.reduce((e,t)=>e.concat(t.items||[]),[]):[]},showingTextFormatButtons(){return this.showBoldButton||this.showItalicsButton||this.showStrikeButton||this.showUnderlineButton},showingAlignmentButtons(){return this.showAlignLeftButton||this.showAlignCenterButton||this.showAlignRightButton||this.showAlignJustifyButton},showingListButtons(){return this.showListItemsButton||this.showOrderedListButton},orderedRefs(){let e=this.buttonGroups.reduce(function(e,t){return t.buttonGroup.forEach(n=>{e.push(this.getButtonRef(t.key,n.selector))},this),e}.bind(this),[]);return e.push(this.getButtonRef(`custom`,`link`)),e},buttonGroups(){let e=this.individualButtons.map(e=>({key:e.selector,buttonGroup:[e]}));return[{key:`new`,buttonGroup:this.newButtons},{key:`format`,buttonGroup:this.textFormatButtons},{key:`alignment`,buttonGroup:this.alignmentButtons},{key:`list`,buttonGroup:this.listButtons},...e].filter(e=>e.buttonGroup.length>0)},newButtons(){return[{showBtn:this.showQuickRepliesButton,buttonType:`button`,label:this.i18n.$t(`DIALTONE_EDITOR_QUICK_REPLY_BUTTON_LABEL`),selector:`quickReplies`,icon:y.DtIconQuickReply,dataQA:`dt-recipe-editor-quick-replies-btn`,tooltipMessage:this.i18n.$t(`DIALTONE_EDITOR_QUICK_REPLY_BUTTON_LABEL`),onClick:this.onQuickRepliesClick}].filter(e=>e.showBtn)},textFormatButtons(){return[{showBtn:this.showFontStyleButton,buttonType:`popover`,selector:`fontStyle`,icon:y.DtIconType,dataQA:`dt-recipe-editor-font-style-btn`,tooltipMessage:this.i18n.$t(`DIALTONE_EDITOR_FONT_STYLE_BUTTON_LABEL`)},{showBtn:this.showFontSizeButton,buttonType:`popover`,selector:`fontSize`,icon:y.DtIconFontSize,dataQA:`dt-recipe-editor-font-size-btn`,tooltipMessage:this.i18n.$t(`DIALTONE_EDITOR_FONT_SIZE_BUTTON_LABEL`)},{showBtn:this.showFontColorButton,buttonType:`custom`,selector:`fontColor`,icon:y.DtIconStopFilled,dataQA:`dt-recipe-editor-font-color-btn`,tooltipMessage:this.i18n.$t(`DIALTONE_EDITOR_FONT_COLOR_BUTTON_LABEL`),onClick:this.onColorPickerButtonClick},{showBtn:this.showBoldButton,buttonType:`button`,selector:`bold`,icon:y.DtIconBold,dataQA:`dt-recipe-editor-bold-btn`,tooltipMessage:this.i18n.$t(`DIALTONE_EDITOR_BOLD_BUTTON_LABEL`),onClick:this.onBoldTextToggle},{showBtn:this.showItalicsButton,buttonType:`button`,selector:`italic`,icon:y.DtIconItalic,dataQA:`dt-recipe-editor-italics-btn`,tooltipMessage:this.i18n.$t(`DIALTONE_EDITOR_ITALICS_BUTTON_LABEL`),onClick:this.onItalicTextToggle},{showBtn:this.showUnderlineButton,buttonType:`button`,selector:`underline`,icon:y.DtIconUnderline,dataQA:`dt-recipe-editor-underline-btn`,tooltipMessage:this.i18n.$t(`DIALTONE_EDITOR_UNDERLINE_BUTTON_LABEL`),onClick:this.onUnderlineTextToggle},{showBtn:this.showStrikeButton,buttonType:`button`,selector:`strike`,icon:y.DtIconStrikethrough,dataQA:`dt-recipe-editor-strike-btn`,tooltipMessage:this.i18n.$t(`DIALTONE_EDITOR_STRIKE_BUTTON_LABEL`),onClick:this.onStrikethroughTextToggle}].filter(e=>e.showBtn)},alignmentButtons(){return[{showBtn:this.showAlignLeftButton,buttonType:`button`,selector:{textAlign:`left`},icon:y.DtIconAlignLeft,dataQA:`dt-recipe-editor-align-left-btn`,tooltipMessage:this.i18n.$t(`DIALTONE_EDITOR_ALIGN_LEFT_BUTTON_LABEL`),onClick:()=>this.onTextAlign(`left`)},{showBtn:this.showAlignCenterButton,buttonType:`button`,selector:{textAlign:`center`},icon:y.DtIconAlignCenter,dataQA:`dt-recipe-editor-align-center-btn`,tooltipMessage:this.i18n.$t(`DIALTONE_EDITOR_ALIGN_CENTER_BUTTON_LABEL`),onClick:()=>this.onTextAlign(`center`)},{showBtn:this.showAlignRightButton,buttonType:`button`,selector:{textAlign:`right`},icon:y.DtIconAlignRight,dataQA:`dt-recipe-editor-align-right-btn`,tooltipMessage:this.i18n.$t(`DIALTONE_EDITOR_ALIGN_RIGHT_BUTTON_LABEL`),onClick:()=>this.onTextAlign(`right`)},{showBtn:this.showAlignJustifyButton,buttonType:`button`,selector:{textAlign:`justify`},icon:y.DtIconAlignJustify,dataQA:`dt-recipe-editor-align-justify-btn`,tooltipMessage:this.i18n.$t(`DIALTONE_EDITOR_ALIGN_JUSTIFY_BUTTON_LABEL`),onClick:()=>this.onTextAlign(`justify`)}].filter(e=>e.showBtn)},listButtons(){return[{showBtn:this.showListItemsButton,buttonType:`button`,selector:`bulletList`,icon:y.DtIconListBullet,dataQA:`dt-recipe-editor-list-items-btn`,tooltipMessage:this.i18n.$t(`DIALTONE_EDITOR_BULLET_LIST_BUTTON_LABEL`),onClick:this.onBulletListToggle},{showBtn:this.showOrderedListButton,buttonType:`button`,selector:`orderedList`,icon:y.DtIconListOrdered,dataQA:`dt-recipe-editor-ordered-list-items-btn`,tooltipMessage:this.i18n.$t(`DIALTONE_EDITOR_ORDERED_LIST_BUTTON_LABEL`),onClick:this.onOrderedListToggle}].filter(e=>e.showBtn)},individualButtons(){return[{showBtn:this.showQuoteButton,buttonType:`button`,selector:`blockquote`,icon:y.DtIconQuote,dataQA:`dt-recipe-editor-blockquote-btn`,tooltipMessage:this.i18n.$t(`DIALTONE_EDITOR_QUOTE_BUTTON_LABEL`),onClick:this.onBlockquoteToggle},{showBtn:this.showCodeBlockButton,buttonType:`button`,selector:`codeBlock`,icon:y.DtIconCodeBlock,dataQA:`dt-recipe-editor-code-block-btn`,tooltipMessage:this.i18n.$t(`DIALTONE_EDITOR_CODE_BUTTON_LABEL`),onClick:this.onCodeBlockToggle},{showBtn:this.showInlineImageButton,buttonType:`button`,selector:`image`,icon:y.DtIconImage,dataQA:`dt-recipe-editor-inline-image-btn`,tooltipMessage:this.i18n.$t(`DIALTONE_EDITOR_IMAGE_BUTTON_LABEL`),onClick:this.onInsertInlineImageClick},{showBtn:this.showVariableButton,buttonType:`popover`,selector:`variable`,icon:y.DtIconBraces,dataQA:`dt-recipe-editor-variable-btn`,tooltipMessage:this.i18n.$t(`DIALTONE_EDITOR_VARIABLE_BUTTON_LABEL`)}].filter(e=>e.showBtn)},linkButton(){return{showBtn:this.showAddLink.showAddLinkButton,buttonType:`custom`,selector:`link`,icon:y.DtIconLink2,dataQA:`dt-recipe-editor-add-link-btn`,tooltipMessage:this.i18n.$t(`DIALTONE_EDITOR_LINK_BUTTON_LABEL`),onClick:this.openLinkInput}},confirmSetLinkButtonLabels(){return this.i18n.$ta(`DIALTONE_EDITOR_CONFIRM_SET_LINK_BUTTON`)},cancelSetLinkButtonLabels(){return this.i18n.$ta(`DIALTONE_EDITOR_CANCEL_SET_LINK_BUTTON`)},removeLinkButtonLabels(){return this.i18n.$ta(`DIALTONE_EDITOR_REMOVE_LINK_BUTTON`)},showAddLinkButtonLabels(){return this.i18n.$ta(`DIALTONE_EDITOR_ADD_LINK_BUTTON`)},filteredFontStyles(){let e=this.fontStyleSearch.toLowerCase();return this.fontStyles.filter(t=>t.name.toLowerCase().includes(e))},filteredCategories(){return this.variableCategories.filter(e=>this.getFilteredItemsForCategory(e).length)},colorPickerInput(){return this.$refs.editorRoot?.querySelector(`.colorPickerInput`)},isDefaultFontColor(){return this.currentFontColor===m.EDITOR_DEFAULT_FONT_COLOR},actionBarBtn(){let e=this.$refs[this.orderedRefs[this.currentButtonRefIndex]][0]?.$refs?.buttonRef||this.$refs[this.orderedRefs[this.currentButtonRefIndex]];return Array.isArray(e)?e[0]:e}},watch:{modelValue(e){this.internalInputValue=e}},methods:{removeClassStyleAttrs:e.removeClassStyleAttrs,addClassStyleAttrs:e.addClassStyleAttrs,focusEditor(){this.$refs.richTextEditor?.editor?.commands.focus()},onInputFocus(e){e?.stopPropagation()},removeLink(){this.$refs.richTextEditor?.editor?.chain()?.focus()?.unsetLink()?.run(),this.closeLinkInput()},setLink(e){let t=this.$refs.richTextEditor?.editor;if(e?.preventDefault(),e?.stopPropagation(),!this.linkInput){this.removeLink();return}m.EDITOR_SUPPORTED_LINK_PROTOCOLS.find(e=>e.test(this.linkInput))||(this.linkInput=`${m.EDITOR_DEFAULT_LINK_PREFIX}${this.linkInput}`);let n=t?.view?.state?.selection;n.anchor===n.head?t.chain().focus().insertContentAt(n.anchor,`<a class="${this.linkOptions.class}" href=${this.linkInput}>${this.linkInput}</a>`).run():t.chain().focus().extendMarkRange(`link`).setLink({href:this.linkInput,class:this.linkOptions.class}).run(),this.closeLinkInput()},openLinkInput(){this.showLinkInput=!0},updateInput(e){if(!e)return this.closeLinkInput();this.linkInput=this.$refs.richTextEditor?.editor?.getAttributes(`link`)?.href},closeLinkInput(){this.showLinkInput=!1,this.linkInput=``,this.$refs.richTextEditor.editor?.chain().focus()},onBoldTextToggle(){this.$refs.richTextEditor?.editor?.chain().focus().toggleBold().run()},onItalicTextToggle(){this.$refs.richTextEditor?.editor.chain().focus().toggleItalic().run()},onUnderlineTextToggle(){this.$refs.richTextEditor?.editor.chain().focus().toggleUnderline().run()},onStrikethroughTextToggle(){this.$refs.richTextEditor?.editor.chain().focus().toggleStrike().run()},onTextAlign(e){if(this.$refs.richTextEditor?.editor?.isActive({textAlign:e}))return this.$refs.richTextEditor?.editor.chain().focus().unsetTextAlign().run();this.$refs.richTextEditor?.editor.chain().focus().setTextAlign(e).run()},onBulletListToggle(){this.$refs.richTextEditor?.editor.chain().focus().toggleBulletList().run()},onOrderedListToggle(){this.$refs.richTextEditor?.editor.chain().focus().toggleOrderedList().run()},onCodeBlockToggle(){this.$refs.richTextEditor?.editor.chain().focus().toggleCodeBlock().run()},onQuickRepliesClick(){this.$emit(`quick-replies-click`)},onInsertInlineImageClick(){this.$emit(`inline-image-click`)},insertVariable(e,t){this.$refs.richTextEditor?.editor.chain().focus().insertVariable({id:t.id,placeholder:t.placeholder||``,altText:``,enableAltText:t.enableAltText}).run()},insertInlineImage(e){this.$refs.richTextEditor?.editor.chain().focus().setImage({src:e}).run()},insertInMessageBody(e){this.$refs.richTextEditor?.editor.chain().focus().insertContent(e).run()},setCursorPosition(e=null){this.$refs.richTextEditor?.editor.chain().focus(e).run()},onBlockquoteToggle(){this.$refs.richTextEditor?.editor.chain().focus().toggleBlockquote().run()},onTextInput(e){this.$emit(`text-input`,e)},onFocus(e){this.hasFocus=!0,this.$emit(`focus`,e)},onBlur(e){this.hasFocus=!1,this.$emit(`blur`,e)},onInput(e){this.$emit(`input`,e),this.$emit(`update:modelValue`,e)},onSelected(){this.updateFontColorInput()},getButtonKey(e,t){return`${e}-${JSON.stringify(t)}`},getButtonRef(e,t){return`${this.getButtonKey(e,t)}-ref`},canFocus(e){return e===this.orderedRefs[this.currentButtonRefIndex]},shiftActionBarFocusRight(){this.shiftButtonRefIndex(1)},shiftActionBarFocusLeft(){this.shiftButtonRefIndex(-1)},shiftButtonRefIndex(e){let t=this.actionBarBtn,n=(this.currentButtonRefIndex+e)%this.orderedRefs.length;this.currentButtonRefIndex=n>=0?n:this.orderedRefs.length+n;let r=this.actionBarBtn;t.$el.blur(),r.$el.focus()},onFontStyleSelect(e){e?this.$refs.richTextEditor?.editor?.chain().focus().setFontFamily(e).run():this.$refs.richTextEditor?.editor?.chain().focus().unsetFontFamily().run(),this.$refs.richTextEditor?.editor?.commands.focus()},isCurrentFontFamily(e){return e?this.$refs.richTextEditor?.editor?.isActive(`textStyle`,{fontFamily:e}):!this.$refs.richTextEditor?.editor?.getAttributes(`textStyle`)?.fontFamily},onFontSizeSelect(e){this.$refs.richTextEditor?.editor?.chain().focus().setFontSize(e).run(),this.$refs.richTextEditor?.editor?.commands.focus()},isCurrentFontSize(e){return e?this.$refs.richTextEditor?.editor?.isActive(`textStyle`,{fontSize:e}):!this.$refs.richTextEditor?.editor?.getAttributes(`textStyle`)?.fontSize},getFilteredItemsForCategory(e){let t=this.variableSearchValue.toLowerCase();return e.name.toLowerCase().includes(t)?e.items:e.items.filter(e=>e.name.toLowerCase().includes(t))},updateFontColorInput(){this.currentFontColor=this.$refs.richTextEditor?.editor?.getAttributes(`textStyle`)?.color||`#000000`},onColorPickerButtonClick(){this.colorPickerInput?.click()},onColorPickerInput(e){this.$refs.richTextEditor?.editor?.chain().focus().setColor(e).run(),this.$refs.richTextEditor?.editor?.commands.focus(),this.updateFontColorInput()}}},x={class:`d-recipe-editor__popover-content`};function S(e,t,n,r,i,a){let o=(0,v.resolveComponent)(`dt-icon-search`),s=(0,v.resolveComponent)(`dt-input`),c=(0,v.resolveComponent)(`dt-list-item`),l=(0,v.resolveComponent)(`dt-combobox`),u=(0,v.resolveComponent)(`editor-toolbar-popover-button`),d=(0,v.resolveComponent)(`editor-toolbar-dropdown-button`),f=(0,v.resolveComponent)(`dt-button`),p=(0,v.resolveComponent)(`dt-dropdown-separator`),m=(0,v.resolveComponent)(`dt-list-item-group`),h=(0,v.resolveComponent)(`editor-toolbar-button`),g=(0,v.resolveComponent)(`dt-stack`),_=(0,v.resolveComponent)(`dt-tooltip`),y=(0,v.resolveComponent)(`dt-popover`),b=(0,v.resolveComponent)(`dt-rich-text-editor`),S=(0,v.resolveDirective)(`dt-tooltip`);return(0,v.openBlock)(),(0,v.createElementBlock)(`div`,(0,v.mergeProps)({ref:`editorRoot`,class:`d-recipe-editor`},a.addClassStyleAttrs(e.$attrs),{"data-qa":`dt-recipe-editor`,role:`presentation`,onClick:t[7]||(t[7]=t=>e.$refs.richTextEditor.focusEditor())}),[(0,v.createVNode)(g,{class:`d-recipe-editor__top-bar`,direction:`row`,gap:`450`},{default:(0,v.withCtx)(()=>[((0,v.openBlock)(!0),(0,v.createElementBlock)(v.Fragment,null,(0,v.renderList)(a.buttonGroups,r=>((0,v.openBlock)(),(0,v.createBlock)(g,{key:r.key,direction:`row`,gap:`300`},{default:(0,v.withCtx)(()=>[((0,v.openBlock)(!0),(0,v.createElementBlock)(v.Fragment,null,(0,v.renderList)(r.buttonGroup,g=>((0,v.openBlock)(),(0,v.createElementBlock)(v.Fragment,null,[g.buttonType===`popover`&&g.selector===`fontStyle`?((0,v.openBlock)(),(0,v.createBlock)(u,{key:a.getButtonKey(r.key,g.selector),ref_for:!0,ref:a.getButtonRef(r.key,g.selector),"is-active":e.$refs.richTextEditor?.editor?.isActive(g.selector),"tooltip-message":g.tooltipMessage,"data-qa":g.dataQA,"popover-data-qa":`dt-recipe-editor-font-style-input-popover`,tabindex:a.canFocus(a.getButtonRef(r.key,g.selector))?0:-1,icon:g.icon,onShiftFocusRight:a.shiftActionBarFocusRight,onShiftFocusLeft:a.shiftActionBarFocusLeft},{content:(0,v.withCtx)(({close:e})=>[(0,v.createVNode)(l,{label:``,"label-visible":!1,"show-list":!0,"click-on-select":!0,onEscape:t=>e()},{input:(0,v.withCtx)(({inputProps:e})=>[(0,v.createVNode)(s,(0,v.mergeProps)({ref_for:!0},e,{modelValue:i.fontStyleSearch,"onUpdate:modelValue":t[0]||(t[0]=e=>i.fontStyleSearch=e),"root-class":`d-p8 d-pb4 d-w216`,type:`search`,placeholder:i.i18n.$t(`DIALTONE_EDITOR_FONT_STYLE_SEARCH_PLACEHOLDER`),size:`sm`,role:`menuitem`}),{leftIcon:(0,v.withCtx)(({iconSize:e})=>[(0,v.createVNode)(o,{size:e},null,8,[`size`])]),_:1},16,[`modelValue`,`placeholder`])]),list:(0,v.withCtx)(({listProps:t})=>[(0,v.createElementVNode)(`ul`,(0,v.mergeProps)({ref_for:!0},t),[((0,v.openBlock)(!0),(0,v.createElementBlock)(v.Fragment,null,(0,v.renderList)(a.filteredFontStyles,t=>((0,v.openBlock)(),(0,v.createBlock)(c,{key:t.name,selected:a.isCurrentFontFamily(t.value),style:(0,v.normalizeStyle)({fontFamily:t.value||`inherit`}),role:`option`,"navigation-type":`arrow-keys`,onClick:n=>{e(a.focusEditor),a.onFontStyleSelect(t.value)}},{default:(0,v.withCtx)(()=>[(0,v.createTextVNode)((0,v.toDisplayString)(t.name),1)]),_:2},1032,[`selected`,`style`,`onClick`]))),128))],16)]),_:2},1032,[`onEscape`])]),_:1},8,[`is-active`,`tooltip-message`,`data-qa`,`tabindex`,`icon`,`onShiftFocusRight`,`onShiftFocusLeft`])):g.buttonType===`popover`&&g.selector===`fontSize`?((0,v.openBlock)(),(0,v.createBlock)(d,{key:a.getButtonKey(r.key,g.selector),ref_for:!0,ref:a.getButtonRef(r.key,g.selector),"is-active":e.$refs.richTextEditor?.editor?.isActive(g.selector),"tooltip-message":g.tooltipMessage,"data-qa":g.dataQA,"dropdown-data-qa":`dt-recipe-editor-font-size-input-popover`,tabindex:a.canFocus(a.getButtonRef(r.key,g.selector))?0:-1,icon:g.icon,onShiftFocusRight:a.shiftActionBarFocusRight,onShiftFocusLeft:a.shiftActionBarFocusLeft},{list:(0,v.withCtx)(({close:e})=>[((0,v.openBlock)(!0),(0,v.createElementBlock)(v.Fragment,null,(0,v.renderList)(n.fontSizes,t=>((0,v.openBlock)(),(0,v.createBlock)(c,{key:t.name,selected:a.isCurrentFontSize(t.value),role:`menuitem`,"navigation-type":`arrow-keys`,onClick:n=>{e(a.focusEditor),a.onFontSizeSelect(t.value,n)}},{default:(0,v.withCtx)(()=>[(0,v.createElementVNode)(`span`,{style:(0,v.normalizeStyle)({fontSize:t.value})},(0,v.toDisplayString)(t.name),5)]),_:2},1032,[`selected`,`onClick`]))),128))]),_:1},8,[`is-active`,`tooltip-message`,`data-qa`,`tabindex`,`icon`,`onShiftFocusRight`,`onShiftFocusLeft`])):g.buttonType===`custom`&&g.selector===`fontColor`?(0,v.withDirectives)(((0,v.openBlock)(),(0,v.createBlock)(f,{key:a.getButtonKey(r.key,g.selector),ref_for:!0,ref:a.getButtonRef(r.key,g.selector),kind:`muted`,importance:`clear`,size:`xs`,active:e.$refs.richTextEditor?.editor?.isActive(g.selector),tabindex:a.canFocus(a.getButtonRef(r.key,g.selector))?0:-1,"aria-label":g.tooltipMessage,"data-qa":g.dataQA,onKeydown:[(0,v.withKeys)((0,v.withModifiers)(a.shiftActionBarFocusRight,[`stop`]),[`right`]),(0,v.withKeys)((0,v.withModifiers)(a.shiftActionBarFocusLeft,[`stop`]),[`left`])],onClick:e=>g.onClick()},{icon:(0,v.withCtx)(()=>[((0,v.openBlock)(),(0,v.createBlock)((0,v.resolveDynamicComponent)(g.icon),{size:`200`,style:(0,v.normalizeStyle)(a.isDefaultFontColor?{}:{color:i.currentFontColor})},null,8,[`style`])),(0,v.createVNode)(s,{value:i.currentFontColor,"root-class":`d-w0 d-h0 d-of-hidden`,"input-class":`colorPickerInput d-w0 d-h0 d-p0 d-bar0`,"input-wrapper-class":`d-w0 d-h0 d-ba-none`,size:`sm`,type:`color`,onInput:a.onColorPickerInput,onClick:t[1]||(t[1]=(0,v.withModifiers)(()=>{},[`stop`]))},null,8,[`value`,`onInput`])]),_:2},1032,[`active`,`tabindex`,`aria-label`,`data-qa`,`onKeydown`,`onClick`])),[[S,{message:g.tooltipMessage,placement:`top`,externalAnchorElement:e.$refs[a.getButtonRef(r.key,g.selector)]?.$el}]]):g.buttonType===`popover`&&g.selector===`variable`?((0,v.openBlock)(),(0,v.createBlock)(u,{key:a.getButtonKey(r.key,g.selector),ref_for:!0,ref:a.getButtonRef(r.key,g.selector),"is-active":!1,"tooltip-message":g.tooltipMessage,"data-qa":g.dataQA,"popover-data-qa":`dt-recipe-editor-variable-popover`,tabindex:a.canFocus(a.getButtonRef(r.key,g.selector))?0:-1,icon:g.icon,onShiftFocusRight:a.shiftActionBarFocusRight,onShiftFocusLeft:a.shiftActionBarFocusLeft},{content:(0,v.withCtx)(({close:e})=>[(0,v.createVNode)(l,{label:``,"label-visible":!1,"show-list":!0,"click-on-select":!0,onEscape:t=>e()},{input:(0,v.withCtx)(({inputProps:e})=>[(0,v.createVNode)(s,(0,v.mergeProps)({ref_for:!0},e,{modelValue:i.variableSearchValue,"onUpdate:modelValue":t[2]||(t[2]=e=>i.variableSearchValue=e),"root-class":`d-p8 d-pb4 d-w264`,type:`search`,placeholder:i.i18n.$t(`DIALTONE_EDITOR_VARIABLE_POPOVER_SEARCH_PLACEHOLDER`),size:`md`,role:`menuitem`}),{leftIcon:(0,v.withCtx)(({iconSize:e})=>[(0,v.createVNode)(o,{size:e},null,8,[`size`])]),_:1},16,[`modelValue`,`placeholder`])]),list:(0,v.withCtx)(({listProps:t})=>[(0,v.createElementVNode)(`div`,(0,v.mergeProps)({ref_for:!0},t),[((0,v.openBlock)(!0),(0,v.createElementBlock)(v.Fragment,null,(0,v.renderList)(a.filteredCategories,(t,n)=>((0,v.openBlock)(),(0,v.createBlock)(m,{key:t.name,heading:t.name,"heading-class":`d-headline--sm-compact d-p8`},{default:(0,v.withCtx)(()=>[((0,v.openBlock)(!0),(0,v.createElementBlock)(v.Fragment,null,(0,v.renderList)(a.getFilteredItemsForCategory(t),n=>((0,v.openBlock)(),(0,v.createBlock)(c,{key:t.name+n.name,role:`option`,"navigation-type":`arrow-keys`,onClick:r=>{a.insertVariable(t.name,n),e(a.focusEditor)}},{default:(0,v.withCtx)(()=>[(0,v.createTextVNode)((0,v.toDisplayString)(n.name),1)]),_:2},1032,[`onClick`]))),128)),n<a.filteredCategories.length-1?((0,v.openBlock)(),(0,v.createBlock)(p,{key:0})):(0,v.createCommentVNode)(``,!0)]),_:2},1032,[`heading`]))),128))],16)]),_:2},1032,[`onEscape`])]),_:1},8,[`tooltip-message`,`data-qa`,`tabindex`,`icon`,`onShiftFocusRight`,`onShiftFocusLeft`])):g.buttonType===`button`?((0,v.openBlock)(),(0,v.createBlock)(h,{key:a.getButtonKey(r.key,g.selector),ref_for:!0,ref:a.getButtonRef(r.key,g.selector),"is-active":e.$refs.richTextEditor?.editor?.isActive(g.selector),"tooltip-message":g.tooltipMessage,"data-qa":g.dataQA,tabindex:a.canFocus(a.getButtonRef(r.key,g.selector))?0:-1,icon:g.icon,label:g.label,"on-click":g.onClick,onShiftFocusRight:a.shiftActionBarFocusRight,onShiftFocusLeft:a.shiftActionBarFocusLeft},null,8,[`is-active`,`tooltip-message`,`data-qa`,`tabindex`,`icon`,`label`,`on-click`,`onShiftFocusRight`,`onShiftFocusLeft`])):(0,v.createCommentVNode)(``,!0)],64))),256)),t[8]||(t[8]=(0,v.createElementVNode)(`div`,{class:`d-recipe-editor__button-group-divider`},null,-1))]),_:2},1024))),128)),a.linkButton.showBtn?((0,v.openBlock)(),(0,v.createBlock)(g,{key:0,direction:`row`,gap:`300`},{default:(0,v.withCtx)(()=>[(0,v.createVNode)(y,{open:i.showLinkInput,"show-close-button":!1,"data-qa":`dt-recipe-editor-link-input-popover`,padding:`none`,placement:`bottom-start`,onClick:[a.onInputFocus,(0,v.withModifiers)(a.onInputFocus,[`stop`])],onOpened:a.updateInput},{anchor:(0,v.withCtx)(()=>[((0,v.openBlock)(),(0,v.createBlock)(_,{key:a.linkButton.key,message:a.linkButton.tooltipMessage,placement:`top`},{anchor:(0,v.withCtx)(()=>[(0,v.createVNode)(f,{ref:a.getButtonRef(`custom`,`link`),active:e.$refs.richTextEditor?.editor?.isActive(a.linkButton.selector),"aria-label":a.linkButton.tooltipMessage,"data-qa":a.linkButton.dataQA,tabindex:a.canFocus(a.getButtonRef(`custom`,`link`))?0:-1,importance:`clear`,kind:`muted`,size:`xs`,onClick:t[3]||(t[3]=e=>a.linkButton.onClick()),onKeydown:[(0,v.withKeys)((0,v.withModifiers)(a.shiftActionBarFocusRight,[`stop`]),[`right`]),(0,v.withKeys)((0,v.withModifiers)(a.shiftActionBarFocusLeft,[`stop`]),[`left`])]},{icon:(0,v.withCtx)(()=>[((0,v.openBlock)(),(0,v.createBlock)((0,v.resolveDynamicComponent)(a.linkButton.icon),{size:`200`}))]),_:1},8,[`active`,`aria-label`,`data-qa`,`tabindex`,`onKeydown`])]),_:1},8,[`message`]))]),content:(0,v.withCtx)(()=>[(0,v.createElementVNode)(`div`,x,[(0,v.createElementVNode)(`span`,null,(0,v.toDisplayString)(a.showAddLinkButtonLabels.title),1),(0,v.createVNode)(s,{modelValue:i.linkInput,"onUpdate:modelValue":t[4]||(t[4]=e=>i.linkInput=e),"input-aria-label":a.showAddLinkButtonLabels[`aria-label`],placeholder:n.setLinkPlaceholder,"data-qa":`dt-recipe-editor-link-input`,"input-wrapper-class":`d-recipe-editor-link__input-wrapper`,onClick:[a.onInputFocus,(0,v.withModifiers)(a.onInputFocus,[`stop`])],onFocus:a.onInputFocus,onKeydown:(0,v.withKeys)(a.setLink,[`enter`])},null,8,[`modelValue`,`input-aria-label`,`placeholder`,`onClick`,`onFocus`,`onKeydown`])])]),footerContent:(0,v.withCtx)(()=>[(0,v.createVNode)(g,{direction:`row`,gap:`300`,class:`d-recipe-editor__popover-footer`},{default:(0,v.withCtx)(()=>[(0,v.createVNode)(f,(0,v.mergeProps)({"data-qa":`dt-recipe-editor-remove-link-btn`,importance:`clear`,kind:`muted`,size:`sm`},a.removeLinkButtonLabels,{onClick:a.removeLink}),{default:(0,v.withCtx)(()=>[(0,v.createTextVNode)((0,v.toDisplayString)(a.removeLinkButtonLabels.title),1)]),_:1},16,[`onClick`]),(0,v.createVNode)(f,(0,v.mergeProps)({"data-qa":`dt-recipe-editor-set-link-cancel-btn`,importance:`clear`,kind:`muted`,size:`sm`},a.cancelSetLinkButtonLabels,{onClick:a.closeLinkInput}),{default:(0,v.withCtx)(()=>[(0,v.createTextVNode)((0,v.toDisplayString)(a.cancelSetLinkButtonLabels.title),1)]),_:1},16,[`onClick`]),(0,v.createVNode)(f,(0,v.mergeProps)({"data-qa":`dt-recipe-editor-set-link-confirm-btn`,size:`sm`},a.confirmSetLinkButtonLabels,{onClick:a.setLink}),{default:(0,v.withCtx)(()=>[(0,v.createTextVNode)((0,v.toDisplayString)(a.confirmSetLinkButtonLabels.title),1)]),_:1},16,[`onClick`])]),_:1})]),_:1},8,[`open`,`onClick`,`onOpened`])]),_:1})):(0,v.createCommentVNode)(``,!0)]),_:1}),(0,v.createElementVNode)(`div`,{style:(0,v.normalizeStyle)({"max-height":n.maxHeight}),class:(0,v.normalizeClass)([`d-recipe-editor__content`,{"d-recipe-editor__content-image-resize":n.allowImageResize}])},[(0,v.createVNode)(b,(0,v.mergeProps)({ref:`richTextEditor`,modelValue:i.internalInputValue,"onUpdate:modelValue":t[5]||(t[5]=e=>i.internalInputValue=e),"allow-font-color":!0,"allow-font-family":!0,"allow-inline-images":!0,"allow-line-breaks":!0,"allow-variable":!0,"allow-font-size":n.showFontSizeButton,"allow-background-color":n.allowBackgroundColor,"allow-line-height":n.allowLineHeight,"variable-items":a.flattenedVariableItems,"hide-link-bubble-menu":!0,"auto-focus":n.autoFocus,editable:n.editable,"input-aria-label":n.inputAriaLabel,"input-class":`d-recipe-editor__content-input ${n.inputClass}`,link:!0,"output-format":a.htmlOutputFormat,placeholder:n.placeholder,"preserve-whitespace":n.preserveWhitespace,"use-div-tags":n.useDivTags,"allow-tables":n.allowTables,"allow-image-resize":n.allowImageResize,"data-qa":`dt-rich-text-editor`},a.removeClassStyleAttrs(e.$attrs),{onTextInput:a.onTextInput,onBlur:a.onBlur,onFocus:a.onFocus,onInput:t[6]||(t[6]=e=>a.onInput(e)),onSelected:a.onSelected}),null,16,[`modelValue`,`allow-font-size`,`allow-background-color`,`allow-line-height`,`variable-items`,`auto-focus`,`editable`,`input-aria-label`,`input-class`,`output-format`,`placeholder`,`preserve-whitespace`,`use-div-tags`,`allow-tables`,`allow-image-resize`,`onTextInput`,`onBlur`,`onFocus`,`onSelected`])],6)],16)}var C=t.t(b,[[`render`,S]]);exports.default=C; //# sourceMappingURL=editor.cjs.map