aboutsummaryrefslogtreecommitdiffstats
path: root/resources/lib/codex/modules/CdxChipInput.cjs
diff options
context:
space:
mode:
authorEric Gardner <gardner.ec@gmail.com>2024-09-04 11:10:27 -0700
committerEric Gardner <gardner.ec@gmail.com>2024-09-04 11:11:34 -0700
commite429c4ac2d8a4ee3ed21b0c8f7fa045db0c1fc62 (patch)
treec7c3b4e9a73eaf9e84f45e3dcbe7530ba3e38dfd /resources/lib/codex/modules/CdxChipInput.cjs
parenta1dc207daac9314e81e894922e30dc430c66b91d (diff)
downloadmediawikicore-e429c4ac2d8a4ee3ed21b0c8f7fa045db0c1fc62.tar.gz
mediawikicore-e429c4ac2d8a4ee3ed21b0c8f7fa045db0c1fc62.zip
Update Codex from v1.11.1 to v1.12.0
Bug: T362651 Bug: T363515 Bug: T364441 Bug: T366831 Bug: T367032 Bug: T368022 Bug: T370504 Bug: T370997 Bug: T372419 Bug: T372420 Bug: T372614 Bug: T372811 Change-Id: I76a81086e4451383d3df839f8640f09744c8172c
Diffstat (limited to 'resources/lib/codex/modules/CdxChipInput.cjs')
-rw-r--r--resources/lib/codex/modules/CdxChipInput.cjs2
1 files changed, 1 insertions, 1 deletions
diff --git a/resources/lib/codex/modules/CdxChipInput.cjs b/resources/lib/codex/modules/CdxChipInput.cjs
index bcb362f73e6a..a4f3527fb057 100644
--- a/resources/lib/codex/modules/CdxChipInput.cjs
+++ b/resources/lib/codex/modules/CdxChipInput.cjs
@@ -1 +1 @@
-"use strict";var w=(e,o,p)=>new Promise((v,d)=>{var c=u=>{try{n(p.next(u))}catch(a){d(a)}},i=u=>{try{n(p.throw(u))}catch(a){d(a)}},n=u=>u.done?v(u.value):Promise.resolve(u.value).then(c,i);n((p=p.apply(e,o)).next())});const t=require("vue"),T=require("./CdxButton.cjs"),g=require("./Icon.js"),z=require("./useI18n.cjs"),I=require("./_plugin-vue_export-helper.js"),y=require("./constants.js"),L=require("./useSplitAttributes.cjs"),O=require("./useFieldData.cjs"),M=require("./useComputedDirection.cjs"),U=t.defineComponent({name:"CdxInputChip",components:{CdxButton:T,CdxIcon:g.CdxIcon},props:{icon:{type:[String,Object],default:null},disabled:{type:Boolean,default:!1}},expose:["focus"],emits:["remove-chip","click-chip","arrow-left","arrow-right"],setup(e,{emit:o}){const p=t.ref(),v=t.computed(()=>({"cdx-input-chip--disabled":e.disabled})),d=z("cdx-input-chip-aria-description","Press Enter to edit or Delete to remove");function c(i){var n;switch(i.key){case"Enter":o("click-chip"),i.preventDefault(),i.stopPropagation();break;case"Escape":(n=p.value)==null||n.blur(),i.preventDefault(),i.stopPropagation();break;case"Backspace":case"Delete":o("remove-chip",i.key),i.preventDefault(),i.stopPropagation();break;case"ArrowLeft":o("arrow-left"),i.preventDefault(),i.stopPropagation();break;case"ArrowRight":o("arrow-right"),i.preventDefault(),i.stopPropagation();break}}return{rootElement:p,rootClasses:v,ariaDescription:d,onKeydown:c,cdxIconClose:g.X3}},methods:{focus(){this.$refs.rootElement.focus()}}}),j=["aria-description"],H={class:"cdx-input-chip__text"};function X(e,o,p,v,d,c){const i=t.resolveComponent("cdx-icon"),n=t.resolveComponent("cdx-button");return t.openBlock(),t.createElementBlock("div",{ref:"rootElement",class:t.normalizeClass(["cdx-input-chip",e.rootClasses]),tabindex:"0",role:"option","aria-description":e.ariaDescription,onKeydown:o[1]||(o[1]=(...u)=>e.onKeydown&&e.onKeydown(...u)),onClick:o[2]||(o[2]=u=>e.$emit("click-chip"))},[e.icon?(t.openBlock(),t.createBlock(i,{key:0,icon:e.icon,size:"small"},null,8,["icon"])):t.createCommentVNode("v-if",!0),t.createElementVNode("span",H,[t.renderSlot(e.$slots,"default")]),t.createVNode(n,{class:"cdx-input-chip__button",weight:"quiet",tabindex:"-1","aria-hidden":"true",disabled:e.disabled,onClick:o[0]||(o[0]=t.withModifiers(u=>e.$emit("remove-chip","button"),["stop"]))},{default:t.withCtx(()=>[t.createVNode(i,{icon:e.cdxIconClose,size:"x-small"},null,8,["icon"])]),_:1},8,["disabled"])],42,j)}const G=I._export_sfc(U,[["render",X]]),J=y.makeStringTypeValidator(y.ValidationStatusTypes),Q=t.defineComponent({name:"CdxChipInput",components:{CdxInputChip:G},inheritAttrs:!1,props:{inputChips:{type:Array,required:!0},separateInput:{type:Boolean,default:!1},status:{type:String,default:"default",validator:J},disabled:{type:Boolean,default:!1}},emits:["update:input-chips"],setup(e,{emit:o,attrs:p}){const v=t.ref(),d=M(v),c=t.ref(),i=t.ref(""),n=t.ref("default"),u=t.computed(()=>n.value==="error"||e.status==="error"?"error":"default"),{computedDisabled:a,computedStatus:B}=O(t.toRef(e,"disabled"),u),C=t.ref(!1),D=t.computed(()=>({"cdx-chip-input--has-separate-input":e.separateInput,["cdx-chip-input--status-".concat(B.value)]:!0,"cdx-chip-input--focused":C.value,"cdx-chip-input--disabled":a.value})),{rootClasses:$,rootStyle:V,otherAttrs:E}=L(p,D),m=[];function F(s,r){s!==null&&(m[r]=s)}const h=()=>{c.value.focus()};function k(){e.inputChips.find(s=>s.value===i.value)?n.value="error":i.value.length>0&&(o("update:input-chips",e.inputChips.concat({value:i.value})),i.value="")}function b(s){o("update:input-chips",e.inputChips.filter(r=>r.value!==s.value))}function A(s,r){const f=d.value==="ltr"&&s==="left"||d.value==="rtl"&&s==="right"?-1:1,l=r+f;if(!(l<0)){if(l>=e.inputChips.length){h();return}m[l].focus()}}function S(s){return w(this,null,function*(){k(),yield t.nextTick(),b(s),i.value=s.value,h()})}function R(s,r,f){if(f==="button")h();else if(f==="Backspace"){const l=r===0?1:r-1;l<e.inputChips.length?m[l].focus():h()}else if(f==="Delete"){const l=r+1;l<e.inputChips.length?m[l].focus():h()}b(s)}function q(s){var f,l;const r=d.value==="rtl"?"ArrowRight":"ArrowLeft";switch(s.key){case"Enter":if(i.value.length>0){k(),s.preventDefault(),s.stopPropagation();return}break;case"Escape":(f=c.value)==null||f.blur(),s.preventDefault(),s.stopPropagation();return;case"Backspace":case r:if(((l=c.value)==null?void 0:l.selectionStart)===0&&c.value.selectionEnd===0&&e.inputChips.length>0){m[e.inputChips.length-1].focus(),s.preventDefault(),s.stopPropagation();return}break}}function K(){C.value=!0}function P(){C.value=!1}function N(s){var r;(r=v.value)!=null&&r.contains(s.relatedTarget)||k()}return t.watch(t.toRef(e,"inputChips"),s=>{const r=s.find(f=>f.value===i.value);n.value=r?"error":"default"}),t.watch(i,()=>{n.value==="error"&&(n.value="default")}),{rootElement:v,input:c,inputValue:i,rootClasses:$,rootStyle:V,otherAttrs:E,assignChipTemplateRef:F,handleChipClick:S,handleChipRemove:R,moveChipFocus:A,onInputKeydown:q,focusInput:h,onInputFocus:K,onInputBlur:P,onFocusOut:N,computedDisabled:a}}}),W={class:"cdx-chip-input__chips",role:"listbox","aria-orientation":"horizontal"},Y=["disabled"],Z={key:0,class:"cdx-chip-input__separate-input"},x=["disabled"];function _(e,o,p,v,d,c){const i=t.resolveComponent("cdx-input-chip");return t.openBlock(),t.createElementBlock("div",{ref:"rootElement",class:t.normalizeClass(["cdx-chip-input",e.rootClasses]),style:t.normalizeStyle(e.rootStyle),onClick:o[8]||(o[8]=(...n)=>e.focusInput&&e.focusInput(...n)),onFocusout:o[9]||(o[9]=(...n)=>e.onFocusOut&&e.onFocusOut(...n))},[t.createElementVNode("div",W,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.inputChips,(n,u)=>(t.openBlock(),t.createBlock(i,{key:n.value,ref_for:!0,ref:a=>e.assignChipTemplateRef(a,u),class:"cdx-chip-input__item",icon:n.icon,disabled:e.computedDisabled,onClickChip:a=>e.handleChipClick(n),onRemoveChip:a=>e.handleChipRemove(n,u,a),onArrowLeft:a=>e.moveChipFocus("left",u),onArrowRight:a=>e.moveChipFocus("right",u)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(n.value),1)]),_:2},1032,["icon","disabled","onClickChip","onRemoveChip","onArrowLeft","onArrowRight"]))),128)),e.separateInput?t.createCommentVNode("v-if",!0):t.withDirectives((t.openBlock(),t.createElementBlock("input",t.mergeProps({key:0,ref:"input","onUpdate:modelValue":o[0]||(o[0]=n=>e.inputValue=n),class:"cdx-chip-input__input",disabled:e.computedDisabled},e.otherAttrs,{onBlur:o[1]||(o[1]=(...n)=>e.onInputBlur&&e.onInputBlur(...n)),onFocus:o[2]||(o[2]=(...n)=>e.onInputFocus&&e.onInputFocus(...n)),onKeydown:o[3]||(o[3]=(...n)=>e.onInputKeydown&&e.onInputKeydown(...n))}),null,16,Y)),[[t.vModelDynamic,e.inputValue]])]),e.separateInput?(t.openBlock(),t.createElementBlock("div",Z,[t.withDirectives(t.createElementVNode("input",t.mergeProps({ref:"input","onUpdate:modelValue":o[4]||(o[4]=n=>e.inputValue=n),class:"cdx-chip-input__input",disabled:e.computedDisabled},e.otherAttrs,{onBlur:o[5]||(o[5]=(...n)=>e.onInputBlur&&e.onInputBlur(...n)),onFocus:o[6]||(o[6]=(...n)=>e.onInputFocus&&e.onInputFocus(...n)),onKeydown:o[7]||(o[7]=(...n)=>e.onInputKeydown&&e.onInputKeydown(...n))}),null,16,x),[[t.vModelDynamic,e.inputValue]])])):t.createCommentVNode("v-if",!0)],38)}const ee=I._export_sfc(Q,[["render",_]]);module.exports=ee;
+"use strict";var y=(e,n,p)=>new Promise((f,c)=>{var v=u=>{try{o(p.next(u))}catch(a){c(a)}},s=u=>{try{o(p.throw(u))}catch(a){c(a)}},o=u=>u.done?f(u.value):Promise.resolve(u.value).then(v,s);o((p=p.apply(e,n)).next())});const t=require("vue"),j=require("./CdxButton.cjs"),B=require("./Icon.js"),I=require("./useI18n.cjs"),V=require("./_plugin-vue_export-helper.js"),D=require("./constants.js"),H=require("./useSplitAttributes.cjs"),X=require("./useFieldData.cjs"),x=require("./useComputedDirection.cjs"),G=require("./useOptionalModelWrapper.js"),J=t.defineComponent({name:"CdxInputChip",components:{CdxButton:j,CdxIcon:B.CdxIcon},props:{icon:{type:[String,Object],default:null},disabled:{type:Boolean,default:!1}},expose:["focus"],emits:["remove-chip","click-chip","arrow-left","arrow-right"],setup(e,{emit:n}){const p=t.ref(),f=t.computed(()=>({"cdx-input-chip--disabled":e.disabled})),c=I("cdx-input-chip-aria-description","Press Enter to edit or Delete to remove");function v(s){var o;switch(s.key){case"Enter":n("click-chip"),s.preventDefault(),s.stopPropagation();break;case"Escape":(o=p.value)==null||o.blur(),s.preventDefault(),s.stopPropagation();break;case"Backspace":case"Delete":n("remove-chip",s.key),s.preventDefault(),s.stopPropagation();break;case"ArrowLeft":n("arrow-left"),s.preventDefault(),s.stopPropagation();break;case"ArrowRight":n("arrow-right"),s.preventDefault(),s.stopPropagation();break}}return{rootElement:p,rootClasses:f,ariaDescription:c,onKeydown:v,cdxIconClose:B.X3}},methods:{focus(){this.$refs.rootElement.focus()}}}),Q=["aria-description"],Y={class:"cdx-input-chip__text"};function Z(e,n,p,f,c,v){const s=t.resolveComponent("cdx-icon"),o=t.resolveComponent("cdx-button");return t.openBlock(),t.createElementBlock("div",{ref:"rootElement",class:t.normalizeClass(["cdx-input-chip",e.rootClasses]),tabindex:"0",role:"option","aria-description":e.ariaDescription,onKeydown:n[1]||(n[1]=(...u)=>e.onKeydown&&e.onKeydown(...u)),onClick:n[2]||(n[2]=u=>e.$emit("click-chip"))},[e.icon?(t.openBlock(),t.createBlock(s,{key:0,icon:e.icon,size:"small"},null,8,["icon"])):t.createCommentVNode("v-if",!0),t.createElementVNode("span",Y,[t.renderSlot(e.$slots,"default")]),t.createVNode(o,{class:"cdx-input-chip__button",weight:"quiet",tabindex:"-1","aria-hidden":"true",disabled:e.disabled,onClick:n[0]||(n[0]=t.withModifiers(u=>e.$emit("remove-chip","button"),["stop"]))},{default:t.withCtx(()=>[t.createVNode(s,{icon:e.cdxIconClose,size:"x-small"},null,8,["icon"])]),_:1},8,["disabled"])],42,Q)}const _=V._export_sfc(J,[["render",Z]]),ee=D.makeStringTypeValidator(D.ValidationStatusTypes),te=t.defineComponent({name:"CdxChipInput",components:{CdxInputChip:_},inheritAttrs:!1,props:{inputChips:{type:Array,required:!0},inputValue:{type:String,default:null},separateInput:{type:Boolean,default:!1},status:{type:String,default:"default",validator:ee},chipValidator:{type:Function,default:e=>!0},disabled:{type:Boolean,default:!1}},emits:["update:input-chips","update:input-value"],setup(e,{emit:n,attrs:p}){const f=t.ref(),c=t.ref(""),v=x(f),s=t.ref(),o=t.ref(""),u=G.useOptionalModelWrapper(o,t.toRef(e,"inputValue"),n,"update:input-value"),a=t.ref("default"),$=t.computed(()=>a.value==="error"||e.status==="error"?"error":"default"),{computedDisabled:w,computedStatus:E}=X(t.toRef(e,"disabled"),$),C=t.ref(!1),F=t.computed(()=>({"cdx-chip-input--has-separate-input":e.separateInput,["cdx-chip-input--status-".concat(E.value)]:!0,"cdx-chip-input--focused":C.value,"cdx-chip-input--disabled":w.value})),{rootClasses:A,rootStyle:R,otherAttrs:S}=H(p,F),m=[],g=t.ref(null),q=t.computed(()=>g.value?g.value.value:""),K=I("cdx-chip-input-chip-added",i=>"Chip ".concat(i," was added."),[u]),P=I("cdx-chip-input-chip-removed",i=>"Chip ".concat(i," was removed."),[q]);function N(i,r){i!==null&&(m[r]=i)}const h=()=>{s.value.focus()};function k(){e.inputChips.find(i=>i.value===u.value)||!e.chipValidator(u.value)?a.value="error":u.value.length>0&&(c.value=K.value,n("update:input-chips",e.inputChips.concat({value:u.value})),u.value="")}function b(i){n("update:input-chips",e.inputChips.filter(r=>r.value!==i.value))}function M(i,r){const d=v.value==="ltr"&&i==="left"||v.value==="rtl"&&i==="right"?-1:1,l=r+d;if(!(l<0)){if(l>=e.inputChips.length){h();return}m[l].focus()}}function T(i){return y(this,null,function*(){k(),yield t.nextTick(),b(i),u.value=i.value,h()})}function z(i,r,d){if(g.value=i,c.value=P.value,d==="button")h();else if(d==="Backspace"){const l=r===0?1:r-1;l<e.inputChips.length?m[l].focus():h()}else if(d==="Delete"){const l=r+1;l<e.inputChips.length?m[l].focus():h()}b(i)}function O(i){var d,l;const r=v.value==="rtl"?"ArrowRight":"ArrowLeft";switch(i.key){case"Enter":if(u.value.length>0){k(),i.preventDefault(),i.stopPropagation();return}break;case"Escape":(d=s.value)==null||d.blur(),i.preventDefault(),i.stopPropagation();return;case"Backspace":case r:if(((l=s.value)==null?void 0:l.selectionStart)===0&&s.value.selectionEnd===0&&e.inputChips.length>0){m[e.inputChips.length-1].focus(),i.preventDefault(),i.stopPropagation();return}break}}function L(){C.value=!0}function U(){C.value=!1}function W(i){var r;(r=f.value)!=null&&r.contains(i.relatedTarget)||k()}return t.watch(t.toRef(e,"inputChips"),i=>{const r=i.find(d=>d.value===u.value);a.value=r?"error":"default"}),t.watch(u,()=>{a.value==="error"&&(a.value="default")}),{rootElement:f,input:s,computedInputValue:u,rootClasses:A,rootStyle:R,otherAttrs:S,assignChipTemplateRef:N,handleChipClick:T,handleChipRemove:z,moveChipFocus:M,onInputKeydown:O,focusInput:h,onInputFocus:L,onInputBlur:U,onFocusOut:W,computedDisabled:w,statusMessageContent:c}}}),ne={class:"cdx-chip-input__chips",role:"listbox","aria-orientation":"horizontal"},oe=["disabled"],ie={key:0,class:"cdx-chip-input__separate-input"},ue=["disabled"],se={class:"cdx-chip-input__aria-status",role:"status","aria-live":"polite"};function ae(e,n,p,f,c,v){const s=t.resolveComponent("cdx-input-chip");return t.openBlock(),t.createElementBlock("div",{ref:"rootElement",class:t.normalizeClass(["cdx-chip-input",e.rootClasses]),style:t.normalizeStyle(e.rootStyle),onClick:n[8]||(n[8]=(...o)=>e.focusInput&&e.focusInput(...o)),onFocusout:n[9]||(n[9]=(...o)=>e.onFocusOut&&e.onFocusOut(...o))},[t.createElementVNode("div",ne,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.inputChips,(o,u)=>(t.openBlock(),t.createBlock(s,{key:o.value,ref_for:!0,ref:a=>e.assignChipTemplateRef(a,u),class:"cdx-chip-input__item",icon:o.icon,disabled:e.computedDisabled,onClickChip:a=>e.handleChipClick(o),onRemoveChip:a=>e.handleChipRemove(o,u,a),onArrowLeft:a=>e.moveChipFocus("left",u),onArrowRight:a=>e.moveChipFocus("right",u)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.value),1)]),_:2},1032,["icon","disabled","onClickChip","onRemoveChip","onArrowLeft","onArrowRight"]))),128)),e.separateInput?t.createCommentVNode("v-if",!0):t.withDirectives((t.openBlock(),t.createElementBlock("input",t.mergeProps({key:0,ref:"input","onUpdate:modelValue":n[0]||(n[0]=o=>e.computedInputValue=o),class:"cdx-chip-input__input",disabled:e.computedDisabled},e.otherAttrs,{onBlur:n[1]||(n[1]=(...o)=>e.onInputBlur&&e.onInputBlur(...o)),onFocus:n[2]||(n[2]=(...o)=>e.onInputFocus&&e.onInputFocus(...o)),onKeydown:n[3]||(n[3]=(...o)=>e.onInputKeydown&&e.onInputKeydown(...o))}),null,16,oe)),[[t.vModelDynamic,e.computedInputValue]])]),e.separateInput?(t.openBlock(),t.createElementBlock("div",ie,[t.withDirectives(t.createElementVNode("input",t.mergeProps({ref:"input","onUpdate:modelValue":n[4]||(n[4]=o=>e.computedInputValue=o),class:"cdx-chip-input__input",disabled:e.computedDisabled},e.otherAttrs,{onBlur:n[5]||(n[5]=(...o)=>e.onInputBlur&&e.onInputBlur(...o)),onFocus:n[6]||(n[6]=(...o)=>e.onInputFocus&&e.onInputFocus(...o)),onKeydown:n[7]||(n[7]=(...o)=>e.onInputKeydown&&e.onInputKeydown(...o))}),null,16,ue),[[t.vModelDynamic,e.computedInputValue]])])):t.createCommentVNode("v-if",!0),t.createElementVNode("div",se,t.toDisplayString(e.statusMessageContent),1)],38)}const re=V._export_sfc(te,[["render",ae]]);module.exports=re;