UNPKG

accessibleprimevue

Version:

Note: This is the forked version of the Primefaces/PrimeVue repository. Since V3 has reached its EOL this is use to fix identified accessibility bugs in the v3 version of primevue. PrimeVue is an open source UI library for Vue featuring a rich set of 80+

2 lines (1 loc) 3.67 kB
import t from"primevue/button";import e from"primevue/focustrap";import o from"primevue/icons/times";import n from"primevue/basecomponent";import r from"primevue/inplace/style";import{resolveComponent as i,resolveDirective as c,openBlock as l,createElementBlock as s,mergeProps as a,withKeys as u,renderSlot as p,withDirectives as f,createBlock as m,withCtx as d,resolveDynamicComponent as y,createCommentVNode as b}from"vue";var v={name:"Inplace",extends:{name:"BaseInplace",extends:n,props:{closable:{type:Boolean,default:!1},active:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},closeIcon:{type:String,default:void 0},displayProps:{type:null,default:null},closeButtonProps:{type:null,default:null}},style:r,provide:function(){return{$parentInstance:this}}},inheritAttrs:!1,emits:["open","close","update:active"],data:function(){return{d_active:this.active}},watch:{active:function(t){this.d_active=t}},methods:{open:function(t){this.disabled||(this.$emit("open",t),this.d_active=!0,this.$emit("update:active",!0))},close:function(t){var e=this;this.$emit("close",t),this.d_active=!1,this.$emit("update:active",!1),setTimeout((function(){e.$refs.display.focus()}),0)}},computed:{closeAriaLabel:function(){return this.$primevue.config.locale.aria?this.$primevue.config.locale.aria.close:void 0}},components:{IPButton:t,TimesIcon:o},directives:{focustrap:e}};function h(t){return h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},h(t)}function O(t,e){var o=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),o.push.apply(o,n)}return o}function P(t){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{};e%2?O(Object(o),!0).forEach((function(e){g(t,e,o[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):O(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}))}return t}function g(t,e,o){var n;return(e="symbol"==h(n=j(e,"string"))?n:String(n))in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}function j(t,e){if("object"!=h(t)||!t)return t;var o=t[Symbol.toPrimitive];if(void 0!==o){var n=o.call(t,e||"default");if("object"!=h(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}var $=["tabindex"];v.render=function(t,e,o,n,r,v){var h=i("IPButton"),O=c("focustrap");return l(),s("div",a({class:t.cx("root"),"aria-live":"polite"},t.ptmi("root")),[r.d_active?f((l(),s("div",a({key:1,class:t.cx("content")},t.ptm("content")),[p(t.$slots,"content"),t.closable?(l(),m(h,a({key:0,"aria-label":v.closeAriaLabel,onClick:v.close,unstyled:t.unstyled,pt:t.ptm("closeButton")},t.closeButtonProps),{icon:d((function(){return[p(t.$slots,"closeicon",{},(function(){return[(l(),m(y(t.closeIcon?"span":"TimesIcon"),a({class:t.closeIcon},t.ptm("closeButton").icon,{"data-pc-section":"closebuttonicon"}),null,16,["class"]))]}))]})),_:3},16,["aria-label","onClick","unstyled","pt"])):b("",!0)],16)),[[O]]):(l(),s("div",a({key:0,ref:"display",class:t.cx("display"),tabindex:t.$attrs.tabindex||"0",role:"button",onClick:e[0]||(e[0]=function(){return v.open&&v.open.apply(v,arguments)}),onKeydown:e[1]||(e[1]=u((function(){return v.open&&v.open.apply(v,arguments)}),["enter"]))},P(P({},t.displayProps),t.ptm("display"))),[p(t.$slots,"display")],16,$))],16)};export{v as default};