primevue
Version:
PrimeVue is a premium UI library for Vue featuring a rich set of 90+ components, a theme designer, various theme alternatives such as Material, Bootstrap, Tailwind, premium templates and professional support. In addition, it integrates with PrimeBlock, wh
83 lines (77 loc) • 2.6 kB
JavaScript
import { cn } from '@primeuix/utils';
import { mergeProps, openBlock, createBlock, resolveDynamicComponent, renderSlot, normalizeClass } from 'vue';
import BaseComponent from '@primevue/core/basecomponent';
import InputColorAreaHandleStyle from 'primevue/inputcolorareahandle/style';
var script$1 = {
name: 'BaseInputColorAreaHandle',
"extends": BaseComponent,
props: {
as: {
type: [String, Object, Function],
"default": 'DIV'
},
asChild: {
type: Boolean,
"default": false
}
},
style: InputColorAreaHandleStyle,
provide: function provide() {
return {
$pcInputColorAreaHandle: this,
$parentInstance: this
};
}
};
var script = {
name: 'InputColorAreaHandle',
"extends": script$1,
inheritAttrs: false,
inject: ['$pcInputColor'],
computed: {
attrs: function attrs() {
return mergeProps(this.a11yAttrs, this.ptmi('root'));
},
a11yAttrs: function a11yAttrs() {
var _this$$pcInputColor$a = this.$pcInputColor.areaAxes,
xChannel = _this$$pcInputColor$a.xChannel,
yChannel = _this$$pcInputColor$a.yChannel;
var areaColor = this.$pcInputColor.areaColor;
var xValue = areaColor.getChannelValue(xChannel);
var yValue = areaColor.getChannelValue(yChannel);
var xRange = areaColor.getChannelRange(xChannel);
return {
role: 'slider',
tabindex: this.$pcInputColor.disabled ? -1 : 0,
'aria-disabled': this.$pcInputColor.disabled || undefined,
'aria-roledescription': '2d slider',
'aria-label': "".concat(xChannel, " and ").concat(yChannel),
'aria-valuemin': xRange.min,
'aria-valuemax': xRange.max,
'aria-valuenow': xValue,
'aria-valuetext': "".concat(xChannel, " ").concat(xValue, ", ").concat(yChannel, " ").concat(yValue),
'data-p': this.dataP,
onKeydown: this.$pcInputColor.onAreaKeyDown,
onBlur: this.$pcInputColor.onAreaBlur
};
},
dataP: function dataP() {
return cn({
disabled: this.$pcInputColor.disabled,
dragging: this.$pcInputColor.isAreaDragging
});
}
}
};
function render(_ctx, _cache, $props, $setup, $data, $options) {
return !_ctx.asChild ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.as), mergeProps({
key: 0,
"class": _ctx.cx('root')
}, $options.attrs), null, 16, ["class"])) : renderSlot(_ctx.$slots, "default", {
key: 1,
a11yAttrs: $options.a11yAttrs,
"class": normalizeClass(_ctx.cx('root'))
});
}
script.render = render;
export { script as default };