@progress/kendo-vue-inputs 6.1.0-develop.4 → 6.1.0-develop.6

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.
@@ -5,19 +5,19 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import { defineComponent as R, createVNode as a, isVNode as S } from "vue";
9
- import { HexInput as G } from "./HexInput.mjs";
10
- import { Button as B } from "@progress/kendo-vue-buttons";
11
- import { Label as s } from "@progress/kendo-vue-labels";
12
- import { provideLocalizationService as T } from "@progress/kendo-vue-intl";
13
- import { colorGradientHex as p, messages as t, colorGradientInputColorButton as b, colorGradientR as u, colorGradientG as f, colorGradientB as m, colorGradientA as x, colorGradientRLabel as k, colorGradientGLabel as C, colorGradientBLabel as I, colorGradientALabel as L } from "../messages/main.mjs";
14
- import { guid as j, Keys as A } from "@progress/kendo-vue-common";
15
- import { caretAltExpandIcon as H } from "@progress/kendo-svg-icons";
8
+ import { defineComponent as R, createVNode as t, isVNode as S } from "vue";
9
+ import { HexInput as z } from "./HexInput.mjs";
10
+ import { Button as G } from "@progress/kendo-vue-buttons";
11
+ import { Label as o } from "@progress/kendo-vue-labels";
12
+ import { provideLocalizationService as B } from "@progress/kendo-vue-intl";
13
+ import { colorGradientHex as c, messages as a, colorGradientInputColorButton as b, colorGradientR as u, colorGradientG as f, colorGradientB as m, colorGradientA as x, colorGradientRLabel as $, colorGradientGLabel as k, colorGradientBLabel as C, colorGradientALabel as I } from "../messages/main.mjs";
14
+ import { guid as T, Keys as j } from "@progress/kendo-vue-common";
15
+ import { caretAltExpandIcon as A } from "@progress/kendo-svg-icons";
16
16
  import { NumericTextBox as l } from "../numerictextbox/NumericTextBox.mjs";
17
17
  function r(e) {
18
18
  return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !S(e);
19
19
  }
20
- const o = ["rgba", "rgb", "hex"], q = /* @__PURE__ */ R({
20
+ const s = ["rgba", "rgb", "hex"], q = /* @__PURE__ */ R({
21
21
  name: "KendoColorInput",
22
22
  emits: {
23
23
  hexchange: null,
@@ -33,7 +33,8 @@ const o = ["rgba", "rgb", "hex"], q = /* @__PURE__ */ R({
33
33
  },
34
34
  hex: String,
35
35
  opacity: Boolean,
36
- disabled: Boolean
36
+ disabled: Boolean,
37
+ size: String
37
38
  },
38
39
  inject: {
39
40
  kendoLocalizationService: {
@@ -41,11 +42,11 @@ const o = ["rgba", "rgb", "hex"], q = /* @__PURE__ */ R({
41
42
  }
42
43
  },
43
44
  created() {
44
- this.hexInputId = j();
45
+ this.hexInputId = T();
45
46
  },
46
47
  data() {
47
48
  return {
48
- inputMode: o[1]
49
+ inputMode: s[1]
49
50
  };
50
51
  },
51
52
  mounted() {
@@ -55,40 +56,42 @@ const o = ["rgba", "rgb", "hex"], q = /* @__PURE__ */ R({
55
56
  this.lastFocusable = this.$refs.hexinput || this.$refs.numerica || this.$refs.numericb;
56
57
  },
57
58
  render() {
58
- const e = T(this), n = e.toLanguageString(p, t[p]), i = e.toLanguageString(b, t[b]), d = e.toLanguageString(u, t[u]), g = e.toLanguageString(f, t[f]), h = e.toLanguageString(m, t[m]), c = e.toLanguageString(x, t[x]), v = e.toLanguageString(k, t[k]), M = e.toLanguageString(C, t[C]), $ = e.toLanguageString(I, t[I]), y = e.toLanguageString(L, t[L]);
59
- return a("div", {
59
+ const e = B(this), i = e.toLanguageString(c, a[c]), n = e.toLanguageString(b, a[b]), g = e.toLanguageString(u, a[u]), d = e.toLanguageString(f, a[f]), p = e.toLanguageString(m, a[m]), h = e.toLanguageString(x, a[x]), L = e.toLanguageString($, a[$]), v = e.toLanguageString(k, a[k]), M = e.toLanguageString(C, a[C]), y = e.toLanguageString(I, a[I]);
60
+ return t("div", {
60
61
  class: "k-colorgradient-inputs k-hstack"
61
- }, [a("div", {
62
+ }, [t("div", {
62
63
  class: "k-vstack"
63
- }, [a(B, {
64
- ariaLabel: i,
64
+ }, [t(G, {
65
+ ariaLabel: n,
65
66
  tabIndex: this.tabIndex,
66
67
  type: "button",
67
68
  fillMode: "flat",
68
69
  icon: "caret-alt-expand",
69
- svgIcon: H,
70
+ svgIcon: A,
70
71
  class: "k-colorgradient-toggle-mode k-icon-button",
71
72
  onClick: this.onToggleModeChange,
72
- onKeydown: this.onKeyDown
73
- }, null)]), this.inputMode === "hex" && a("div", {
73
+ onKeydown: this.onKeyDown,
74
+ size: this.$props.size
75
+ }, null)]), this.inputMode === "hex" && t("div", {
74
76
  class: "k-vstack k-flex-1"
75
- }, [a("span", {
77
+ }, [t("span", {
76
78
  class: "k-hex-value"
77
- }, [a(G, {
79
+ }, [t(z, {
78
80
  id: this.hexInputId,
79
81
  tabIndex: this.tabIndex,
80
82
  hex: this.$props.hex,
81
83
  onHexchange: this.onHexChange,
82
84
  disabled: this.$props.disabled,
83
- ref: "hexinput"
84
- }, null)]), a(s, {
85
+ ref: "hexinput",
86
+ size: this.$props.size
87
+ }, null)]), t(o, {
85
88
  class: "k-colorgradient-input-label",
86
89
  editorId: this.hexInputId
87
- }, r(n) ? n : {
88
- default: () => [n]
89
- })]), (this.inputMode === "rgb" || this.inputMode === "rgba") && [a("div", {
90
+ }, r(i) ? i : {
91
+ default: () => [i]
92
+ })]), (this.inputMode === "rgb" || this.inputMode === "rgba") && [t("div", {
90
93
  class: "k-vstack"
91
- }, [a(l, {
94
+ }, [t(l, {
92
95
  inputType: "number",
93
96
  tabIndex: this.tabIndex,
94
97
  value: this.$props.rgba.r,
@@ -96,16 +99,17 @@ const o = ["rgba", "rgb", "hex"], q = /* @__PURE__ */ R({
96
99
  max: 255,
97
100
  spinners: !1,
98
101
  format: "n",
99
- ariaLabel: v,
102
+ ariaLabel: L,
100
103
  onChange: this.onRgbaRChange,
101
- disabled: this.$props.disabled
102
- }, null), a(s, {
104
+ disabled: this.$props.disabled,
105
+ size: this.$props.size
106
+ }, null), t(o, {
103
107
  class: "k-colorgradient-input-label"
104
- }, r(d) ? d : {
105
- default: () => [d]
106
- })]), a("div", {
108
+ }, r(g) ? g : {
109
+ default: () => [g]
110
+ })]), t("div", {
107
111
  class: "k-vstack"
108
- }, [a(l, {
112
+ }, [t(l, {
109
113
  inputType: "number",
110
114
  tabIndex: this.tabIndex,
111
115
  value: this.$props.rgba.g,
@@ -113,16 +117,17 @@ const o = ["rgba", "rgb", "hex"], q = /* @__PURE__ */ R({
113
117
  max: 255,
114
118
  spinners: !1,
115
119
  format: "n",
116
- ariaLabel: M,
120
+ ariaLabel: v,
117
121
  onChange: this.onRgbaGChange,
118
- disabled: this.$props.disabled
119
- }, null), a(s, {
122
+ disabled: this.$props.disabled,
123
+ size: this.$props.size
124
+ }, null), t(o, {
120
125
  class: "k-colorgradient-input-label"
121
- }, r(g) ? g : {
122
- default: () => [g]
123
- })]), a("div", {
126
+ }, r(d) ? d : {
127
+ default: () => [d]
128
+ })]), t("div", {
124
129
  class: "k-vstack"
125
- }, [a(l, {
130
+ }, [t(l, {
126
131
  inputType: "number",
127
132
  tabIndex: this.tabIndex,
128
133
  value: this.$props.rgba.b,
@@ -130,17 +135,18 @@ const o = ["rgba", "rgb", "hex"], q = /* @__PURE__ */ R({
130
135
  max: 255,
131
136
  spinners: !1,
132
137
  format: "n",
133
- ariaLabel: $,
138
+ ariaLabel: M,
134
139
  onChange: this.onRgbaBChange,
135
140
  disabled: this.$props.disabled,
136
- ref: "numericb"
137
- }, null), a(s, {
141
+ ref: "numericb",
142
+ size: this.$props.size
143
+ }, null), t(o, {
138
144
  class: "k-colorgradient-input-label"
139
- }, r(h) ? h : {
140
- default: () => [h]
141
- })])], this.inputMode === "rgba" && a("div", {
145
+ }, r(p) ? p : {
146
+ default: () => [p]
147
+ })])], this.inputMode === "rgba" && t("div", {
142
148
  class: "k-vstack"
143
- }, [this.$props.opacity && a(l, {
149
+ }, [this.$props.opacity && t(l, {
144
150
  inputType: "number",
145
151
  tabIndex: this.tabIndex,
146
152
  value: this.$props.rgba.a,
@@ -152,11 +158,12 @@ const o = ["rgba", "rgb", "hex"], q = /* @__PURE__ */ R({
152
158
  ariaLabel: y,
153
159
  onChange: this.onRgbaAChange,
154
160
  disabled: this.$props.disabled,
155
- ref: "numerica"
156
- }, null), this.$props.opacity && a(s, {
161
+ ref: "numerica",
162
+ size: this.$props.size
163
+ }, null), this.$props.opacity && t(o, {
157
164
  class: "k-colorgradient-input-label"
158
- }, r(c) ? c : {
159
- default: () => [c]
165
+ }, r(h) ? h : {
166
+ default: () => [h]
160
167
  })])]);
161
168
  },
162
169
  methods: {
@@ -183,23 +190,23 @@ const o = ["rgba", "rgb", "hex"], q = /* @__PURE__ */ R({
183
190
  a: e.value
184
191
  }, e);
185
192
  },
186
- dispatchRgbaChange(e, n) {
187
- let i = {
193
+ dispatchRgbaChange(e, i) {
194
+ let n = {
188
195
  ...this.$props.rgba
189
196
  };
190
- e.r !== void 0 && (i.r = e.r), e.g !== void 0 && (i.g = e.g), e.b !== void 0 && (i.b = e.b), e.a !== void 0 && (i.a = e.a), this.$emit("rgbachange", i, n);
197
+ e.r !== void 0 && (n.r = e.r), e.g !== void 0 && (n.g = e.g), e.b !== void 0 && (n.b = e.b), e.a !== void 0 && (n.a = e.a), this.$emit("rgbachange", n, i);
191
198
  },
192
199
  onToggleModeChange() {
193
- const e = o.length - 1 === o.indexOf(this.inputMode) ? 0 : o.indexOf(this.inputMode) + 1;
200
+ const e = s.length - 1 === s.indexOf(this.inputMode) ? 0 : s.indexOf(this.inputMode) + 1;
194
201
  if (this.$props.opacity)
195
- this.inputMode = o[e];
202
+ this.inputMode = s[e];
196
203
  else {
197
- const n = o[e] === "rgba" ? e + 1 : e;
198
- this.inputMode = o[n];
204
+ const i = s[e] === "rgba" ? e + 1 : e;
205
+ this.inputMode = s[i];
199
206
  }
200
207
  },
201
208
  onKeyDown(e) {
202
- e.keyCode === A.enter && e.stopPropagation();
209
+ e.keyCode === j.enter && e.stopPropagation();
203
210
  }
204
211
  }
205
212
  });
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("vue"),T=require("./utils/color-palette.service.js"),t=require("@progress/kendo-vue-common"),P=require("../package-metadata.js"),R=require("./models/palette-presets.js"),I=require("./utils/misc.js"),L=require("./utils/color-parser.js"),C=24,p=10,b="office",U=l.defineComponent({name:"KendoColorPalette",model:{event:"changemodel"},emits:{keydown:null,focus:null,blur:null,changemodel:null,"update:modelValue":null,"update:modelRgbaValue":null,change:null},props:{palette:{type:[String,Array],default:b},columns:Number,tileSize:{type:[Number,Object],default:C},modelValue:String,modelRgbaValue:String,defaultValue:String,value:String,disabled:Boolean,tabIndex:Number,id:String,ariaLabelledBy:String,ariaDescribedBy:String},created(){t.validatePackage(P.packageMetadata),this.guid=t.guid()},mounted(){this.wrapper=t.getRef(this,"wrapper")},updated(){this.wrapper=t.getRef(this,"wrapper")},computed:{focusedColorCooridanates(){return this.focusedColor?this.paletteService.getCellCoordsFor(this.focusedColor):void 0},isUncontrolled(){return this.$props.value===void 0},selectedColor(){return this.$props.value!==void 0?this.$props.value:this.modelValue!==void 0?this.modelValue:this.modelRgbaValue!==void 0?this.modelRgbaValue:this.currentValue!==void 0?this.currentValue:this.$props.defaultValue}},data(){return{focusedColor:this.$props.value,currentValue:void 0}},render(){const e=this.getPaletteInfo(),s=this.paletteService=new T.ColorPaletteService;s.setColorMatrix(e.colors,e.columns);const o=s.getCellCoordsFor(this.selectedColor),a=s.getCellCoordsFor(this.focusedColor),$=t.classNames("k-colorpalette",{"k-disabled":this.$props.disabled}),S=function(u,n,r,i){const d=r!==void 0&&r.row===n,y=r&&r.col,k=i!==void 0&&i.row===n,V=i&&i.col,f=typeof this.$props.tileSize!="number"?this.$props.tileSize:{width:this.$props.tileSize,height:this.$props.tileSize},g=f.width+"px",E=f.height+"px";return u.map(function(h,c){const m=d&&y===c,N=t.classNames("k-colorpalette-tile",{"k-selected":m,"k-focus":k&&V===c});return l.createVNode("td",{class:N,"aria-label":h,"aria-selected":m?!0:this.$props.disabled?void 0:!1,style:{backgroundColor:h,width:g,height:E,minWidth:g},onClick:v=>this.onColorClick(h,v),id:this.createCellId({row:n,col:c}),key:c,role:"gridcell"},null)},this)},w=function(u,n,r){return u.map(function(i,d){return l.createVNode("tr",{role:"row",key:d},[S.call(this,i,d,n,r)])},this)};return e.colors.length?l.createVNode("div",{id:this.$props.id,class:$,onFocusin:this.onFocus,onFocusout:this.onBlur,onKeydown:this.onKeyDown,"aria-disabled":this.$props.disabled?"true":void 0,"aria-activedescendant":a&&this.createCellId(a),"aria-labelledby":this.$props.ariaLabelledBy,"aria-describedby":this.$props.ariaDescribedBy,role:"grid",tabindex:t.getTabIndex(this.$props.tabIndex,this.$props.disabled),ref:t.setRef(this,"wrapper")},[l.createVNode("table",{class:"k-colorpalette-table k-palette",role:"presentation"},[l.createVNode("tbody",null,[w.call(this,s.colorRows,o,a)])])]):""},methods:{focus(){this.wrapper&&this.wrapper.focus()},onKeyDown(e){switch(e.keyCode){case t.Keys.down:this.handleCellNavigation(e,0,1);break;case t.Keys.up:this.handleCellNavigation(e,0,-1);break;case t.Keys.right:this.handleCellNavigation(e,1,0);break;case t.Keys.left:this.handleCellNavigation(e,-1,0);break;case t.Keys.enter:this.handleEnter(e);break;default:this.$emit("keydown",e);return}this.$emit("keydown",e)},onColorClick(e,s){this.isUncontrolled?(this.currentValue=e,this.focusedColor=e):this.focusedColor=e,this.dispatchChangeEvent(e,s)},onFocus(e){this.focusedColor=this.selectedColor||this.paletteService.colorRows[0][0],this.$emit("focus",{event:e,target:this})},onBlur(e){this.focusedColor=void 0,this.$emit("blur",{event:e,target:this})},handleCellNavigation(e,s,o){if(e.preventDefault(),this.focusedColorCooridanates){const a=this.paletteService.getNextCell(this.focusedColorCooridanates,s,o);this.focusedColor=this.paletteService.getColorAt(a)}else this.focusedColor=this.paletteService.colorRows[0][0]},handleEnter(e){this.isUncontrolled&&(this.currentValue=this.focusedColor),this.dispatchChangeEvent(this.focusedColor,e)},dispatchChangeEvent(e,s){const o=L.parseColor(e,"rgba");this.$emit("changemodel",e),this.$emit("update:modelValue",e),this.$emit("update:modelRgbaValue",o),this.$emit("change",{event:s,component:this,value:e,rgbaValue:o})},getPaletteInfo(){if(typeof this.$props.palette=="string"){const e=R.PALETTEPRESETS[this.$props.palette];return I.isPresent(e)?{colors:e.colors,columns:this.$props.columns||e.columns||p}:{colors:[],columns:0}}else return{colors:this.$props.palette||[],columns:this.$props.columns||p}},createCellId(e){return`${this.guid}_${e.row}_${e.col}`}}});exports.ColorPalette=U;exports.DEFAULT_COLUMNS_COUNT=p;exports.DEFAULT_PRESET=b;exports.DEFAULT_TILE_SIZE=C;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("vue"),U=require("./utils/color-palette.service.js"),t=require("@progress/kendo-vue-common"),D=require("../package-metadata.js"),F=require("./models/palette-presets.js"),I=require("./utils/misc.js"),K=require("./utils/color-parser.js"),C=10,$="office",L=a.defineComponent({name:"KendoColorPalette",model:{event:"changemodel"},emits:{keydown:null,focus:null,blur:null,changemodel:null,"update:modelValue":null,"update:modelRgbaValue":null,change:null},props:{palette:{type:[String,Array],default:$},columns:Number,tileSize:{type:[Number,Object]},modelValue:String,modelRgbaValue:String,defaultValue:String,value:String,disabled:Boolean,tabIndex:Number,id:String,class:String,ariaLabelledBy:String,ariaDescribedBy:String,size:{type:[String,null],default:"medium"}},created(){t.validatePackage(D.packageMetadata),this.guid=t.guid()},mounted(){this.wrapper=t.getRef(this,"wrapper")},updated(){this.wrapper=t.getRef(this,"wrapper")},computed:{focusedColorCooridanates(){return this.focusedColor?this.paletteService.getCellCoordsFor(this.focusedColor):void 0},isUncontrolled(){return this.$props.value===void 0},selectedColor(){return this.$props.value!==void 0?this.$props.value:this.modelValue!==void 0?this.modelValue:this.modelRgbaValue!==void 0?this.modelRgbaValue:this.currentValue!==void 0?this.currentValue:this.$props.defaultValue}},data(){return{focusedColor:this.$props.value,currentValue:void 0}},render(){const{size:e,disabled:s,class:o,tileSize:l}=this.$props,p=this.getPaletteInfo(),d=this.paletteService=new U.ColorPaletteService;d.setColorMatrix(p.colors,p.columns);const w=d.getCellCoordsFor(this.selectedColor),f=d.getCellCoordsFor(this.focusedColor),k=t.classNames("k-colorpalette",{[`k-colorpalette-${t.kendoThemeMaps.sizeMap[e]||e}`]:e,"k-disabled":s},o),S=function(g,n,r,i){const c=r!==void 0&&r.row===n,N=r&&r.col,v=i!==void 0&&i.row===n,E=i&&i.col,u=typeof l!="number"?l:{width:l,height:l},b=u?u.width+"px":void 0,P=u?u.height+"px":void 0;return g.map(function(m,h){const y=c&&N===h,R=t.classNames("k-colorpalette-tile",{"k-selected":y,"k-focus":v&&E===h});return a.createVNode("td",{class:R,"aria-label":m,"aria-selected":y?!0:this.$props.disabled?void 0:!1,style:{backgroundColor:m,width:b,height:P,minWidth:b},onClick:T=>this.onColorClick(m,T),id:this.createCellId({row:n,col:h}),key:h,role:"gridcell"},null)},this)},V=function(g,n,r){return g.map(function(i,c){return a.createVNode("tr",{role:"row",key:c},[S.call(this,i,c,n,r)])},this)};return p.colors.length?a.createVNode("div",{id:this.$props.id,class:k,onFocusin:this.onFocus,onFocusout:this.onBlur,onKeydown:this.onKeyDown,"aria-disabled":this.$props.disabled?"true":void 0,"aria-activedescendant":f&&this.createCellId(f),"aria-labelledby":this.$props.ariaLabelledBy,"aria-describedby":this.$props.ariaDescribedBy,role:"grid",tabindex:t.getTabIndex(this.$props.tabIndex,this.$props.disabled),ref:t.setRef(this,"wrapper")},[a.createVNode("table",{class:"k-colorpalette-table k-palette",role:"presentation"},[a.createVNode("tbody",null,[V.call(this,d.colorRows,w,f)])])]):""},methods:{focus(){this.wrapper&&this.wrapper.focus()},onKeyDown(e){switch(e.keyCode){case t.Keys.down:this.handleCellNavigation(e,0,1);break;case t.Keys.up:this.handleCellNavigation(e,0,-1);break;case t.Keys.right:this.handleCellNavigation(e,1,0);break;case t.Keys.left:this.handleCellNavigation(e,-1,0);break;case t.Keys.enter:this.handleEnter(e);break;default:this.$emit("keydown",e);return}this.$emit("keydown",e)},onColorClick(e,s){this.isUncontrolled?(this.currentValue=e,this.focusedColor=e):this.focusedColor=e,this.dispatchChangeEvent(e,s)},onFocus(e){this.focusedColor=this.selectedColor||this.paletteService.colorRows[0][0],this.$emit("focus",{event:e,target:this})},onBlur(e){this.focusedColor=void 0,this.$emit("blur",{event:e,target:this})},handleCellNavigation(e,s,o){if(e.preventDefault(),this.focusedColorCooridanates){const l=this.paletteService.getNextCell(this.focusedColorCooridanates,s,o);this.focusedColor=this.paletteService.getColorAt(l)}else this.focusedColor=this.paletteService.colorRows[0][0]},handleEnter(e){this.isUncontrolled&&(this.currentValue=this.focusedColor),this.dispatchChangeEvent(this.focusedColor,e)},dispatchChangeEvent(e,s){const o=K.parseColor(e,"rgba");this.$emit("changemodel",e),this.$emit("update:modelValue",e),this.$emit("update:modelRgbaValue",o),this.$emit("change",{event:s,component:this,value:e,rgbaValue:o})},getPaletteInfo(){if(typeof this.$props.palette=="string"){const e=F.PALETTEPRESETS[this.$props.palette];return I.isPresent(e)?{colors:e.colors,columns:this.$props.columns||e.columns||C}:{colors:[],columns:0}}else return{colors:this.$props.palette||[],columns:this.$props.columns||C}},createCellId(e){return`${this.guid}_${e.row}_${e.col}`}}});exports.ColorPalette=L;exports.DEFAULT_COLUMNS_COUNT=C;exports.DEFAULT_PRESET=$;
@@ -5,14 +5,14 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import { defineComponent as R, createVNode as a } from "vue";
9
- import { ColorPaletteService as I } from "./utils/color-palette.service.mjs";
10
- import { validatePackage as P, guid as T, getRef as g, classNames as C, getTabIndex as D, setRef as F, Keys as n } from "@progress/kendo-vue-common";
11
- import { packageMetadata as L } from "../package-metadata.mjs";
12
- import { PALETTEPRESETS as U } from "./models/palette-presets.mjs";
13
- import { isPresent as x } from "./utils/misc.mjs";
14
- import { parseColor as B } from "./utils/color-parser.mjs";
15
- const _ = 24, b = 10, z = "office", q = /* @__PURE__ */ R({
8
+ import { defineComponent as x, createVNode as a } from "vue";
9
+ import { ColorPaletteService as B } from "./utils/color-palette.service.mjs";
10
+ import { validatePackage as D, guid as F, getRef as $, classNames as w, kendoThemeMaps as U, getTabIndex as z, setRef as L, Keys as n } from "@progress/kendo-vue-common";
11
+ import { packageMetadata as A } from "../package-metadata.mjs";
12
+ import { PALETTEPRESETS as K } from "./models/palette-presets.mjs";
13
+ import { isPresent as M } from "./utils/misc.mjs";
14
+ import { parseColor as _ } from "./utils/color-parser.mjs";
15
+ const k = 10, O = "office", X = /* @__PURE__ */ x({
16
16
  name: "KendoColorPalette",
17
17
  model: {
18
18
  event: "changemodel"
@@ -29,12 +29,11 @@ const _ = 24, b = 10, z = "office", q = /* @__PURE__ */ R({
29
29
  props: {
30
30
  palette: {
31
31
  type: [String, Array],
32
- default: z
32
+ default: O
33
33
  },
34
34
  columns: Number,
35
35
  tileSize: {
36
- type: [Number, Object],
37
- default: _
36
+ type: [Number, Object]
38
37
  },
39
38
  modelValue: String,
40
39
  modelRgbaValue: String,
@@ -43,17 +42,22 @@ const _ = 24, b = 10, z = "office", q = /* @__PURE__ */ R({
43
42
  disabled: Boolean,
44
43
  tabIndex: Number,
45
44
  id: String,
45
+ class: String,
46
46
  ariaLabelledBy: String,
47
- ariaDescribedBy: String
47
+ ariaDescribedBy: String,
48
+ size: {
49
+ type: [String, null],
50
+ default: "medium"
51
+ }
48
52
  },
49
53
  created() {
50
- P(L), this.guid = T();
54
+ D(A), this.guid = F();
51
55
  },
52
56
  mounted() {
53
- this.wrapper = g(this, "wrapper");
57
+ this.wrapper = $(this, "wrapper");
54
58
  },
55
59
  updated() {
56
- this.wrapper = g(this, "wrapper");
60
+ this.wrapper = $(this, "wrapper");
57
61
  },
58
62
  computed: {
59
63
  focusedColorCooridanates() {
@@ -73,64 +77,70 @@ const _ = 24, b = 10, z = "office", q = /* @__PURE__ */ R({
73
77
  };
74
78
  },
75
79
  render() {
76
- const e = this.getPaletteInfo(), t = this.paletteService = new I();
77
- t.setColorMatrix(e.colors, e.columns);
78
- const o = t.getCellCoordsFor(this.selectedColor), l = t.getCellCoordsFor(this.focusedColor), $ = C("k-colorpalette", {
79
- "k-disabled": this.$props.disabled
80
- }), w = function(c, r, s, i) {
81
- const d = s !== void 0 && s.row === r, k = s && s.col, y = i !== void 0 && i.row === r, V = i && i.col, p = typeof this.$props.tileSize != "number" ? this.$props.tileSize : {
82
- width: this.$props.tileSize,
83
- height: this.$props.tileSize
84
- }, f = p.width + "px", v = p.height + "px";
85
- return c.map(function(h, u) {
86
- const m = d && k === u, E = C("k-colorpalette-tile", {
87
- "k-selected": m,
88
- "k-focus": y && V === u
80
+ const {
81
+ size: e,
82
+ disabled: t,
83
+ class: o,
84
+ tileSize: s
85
+ } = this.$props, p = this.getPaletteInfo(), d = this.paletteService = new B();
86
+ d.setColorMatrix(p.colors, p.columns);
87
+ const y = d.getCellCoordsFor(this.selectedColor), f = d.getCellCoordsFor(this.focusedColor), S = w("k-colorpalette", {
88
+ [`k-colorpalette-${U.sizeMap[e] || e}`]: e,
89
+ "k-disabled": t
90
+ }, o), V = function(m, r, i, l) {
91
+ const u = i !== void 0 && i.row === r, N = i && i.col, E = l !== void 0 && l.row === r, R = l && l.col, c = typeof s != "number" ? s : {
92
+ width: s,
93
+ height: s
94
+ }, C = c ? c.width + "px" : void 0, P = c ? c.height + "px" : void 0;
95
+ return m.map(function(g, h) {
96
+ const b = u && N === h, I = w("k-colorpalette-tile", {
97
+ "k-selected": b,
98
+ "k-focus": E && R === h
89
99
  });
90
100
  return a("td", {
91
- class: E,
92
- "aria-label": h,
93
- "aria-selected": m ? !0 : this.$props.disabled ? void 0 : !1,
101
+ class: I,
102
+ "aria-label": g,
103
+ "aria-selected": b ? !0 : this.$props.disabled ? void 0 : !1,
94
104
  style: {
95
- backgroundColor: h,
96
- width: f,
97
- height: v,
98
- minWidth: f
105
+ backgroundColor: g,
106
+ width: C,
107
+ height: P,
108
+ minWidth: C
99
109
  },
100
- onClick: (N) => this.onColorClick(h, N),
110
+ onClick: (T) => this.onColorClick(g, T),
101
111
  id: this.createCellId({
102
112
  row: r,
103
- col: u
113
+ col: h
104
114
  }),
105
- key: u,
115
+ key: h,
106
116
  role: "gridcell"
107
117
  }, null);
108
118
  }, this);
109
- }, S = function(c, r, s) {
110
- return c.map(function(i, d) {
119
+ }, v = function(m, r, i) {
120
+ return m.map(function(l, u) {
111
121
  return a("tr", {
112
122
  role: "row",
113
- key: d
114
- }, [w.call(this, i, d, r, s)]);
123
+ key: u
124
+ }, [V.call(this, l, u, r, i)]);
115
125
  }, this);
116
126
  };
117
- return e.colors.length ? a("div", {
127
+ return p.colors.length ? a("div", {
118
128
  id: this.$props.id,
119
- class: $,
129
+ class: S,
120
130
  onFocusin: this.onFocus,
121
131
  onFocusout: this.onBlur,
122
132
  onKeydown: this.onKeyDown,
123
133
  "aria-disabled": this.$props.disabled ? "true" : void 0,
124
- "aria-activedescendant": l && this.createCellId(l),
134
+ "aria-activedescendant": f && this.createCellId(f),
125
135
  "aria-labelledby": this.$props.ariaLabelledBy,
126
136
  "aria-describedby": this.$props.ariaDescribedBy,
127
137
  role: "grid",
128
- tabindex: D(this.$props.tabIndex, this.$props.disabled),
129
- ref: F(this, "wrapper")
138
+ tabindex: z(this.$props.tabIndex, this.$props.disabled),
139
+ ref: L(this, "wrapper")
130
140
  }, [a("table", {
131
141
  class: "k-colorpalette-table k-palette",
132
142
  role: "presentation"
133
- }, [a("tbody", null, [S.call(this, t.colorRows, o, l)])])]) : "";
143
+ }, [a("tbody", null, [v.call(this, d.colorRows, y, f)])])]) : "";
134
144
  },
135
145
  methods: {
136
146
  focus() {
@@ -176,8 +186,8 @@ const _ = 24, b = 10, z = "office", q = /* @__PURE__ */ R({
176
186
  },
177
187
  handleCellNavigation(e, t, o) {
178
188
  if (e.preventDefault(), this.focusedColorCooridanates) {
179
- const l = this.paletteService.getNextCell(this.focusedColorCooridanates, t, o);
180
- this.focusedColor = this.paletteService.getColorAt(l);
189
+ const s = this.paletteService.getNextCell(this.focusedColorCooridanates, t, o);
190
+ this.focusedColor = this.paletteService.getColorAt(s);
181
191
  } else
182
192
  this.focusedColor = this.paletteService.colorRows[0][0];
183
193
  },
@@ -185,7 +195,7 @@ const _ = 24, b = 10, z = "office", q = /* @__PURE__ */ R({
185
195
  this.isUncontrolled && (this.currentValue = this.focusedColor), this.dispatchChangeEvent(this.focusedColor, e);
186
196
  },
187
197
  dispatchChangeEvent(e, t) {
188
- const o = B(e, "rgba");
198
+ const o = _(e, "rgba");
189
199
  this.$emit("changemodel", e), this.$emit("update:modelValue", e), this.$emit("update:modelRgbaValue", o), this.$emit("change", {
190
200
  event: t,
191
201
  component: this,
@@ -195,10 +205,10 @@ const _ = 24, b = 10, z = "office", q = /* @__PURE__ */ R({
195
205
  },
196
206
  getPaletteInfo() {
197
207
  if (typeof this.$props.palette == "string") {
198
- const e = U[this.$props.palette];
199
- return x(e) ? {
208
+ const e = K[this.$props.palette];
209
+ return M(e) ? {
200
210
  colors: e.colors,
201
- columns: this.$props.columns || e.columns || b
211
+ columns: this.$props.columns || e.columns || k
202
212
  } : {
203
213
  colors: [],
204
214
  columns: 0
@@ -206,7 +216,7 @@ const _ = 24, b = 10, z = "office", q = /* @__PURE__ */ R({
206
216
  } else
207
217
  return {
208
218
  colors: this.$props.palette || [],
209
- columns: this.$props.columns || b
219
+ columns: this.$props.columns || k
210
220
  };
211
221
  },
212
222
  createCellId(e) {
@@ -215,8 +225,7 @@ const _ = 24, b = 10, z = "office", q = /* @__PURE__ */ R({
215
225
  }
216
226
  });
217
227
  export {
218
- q as ColorPalette,
219
- b as DEFAULT_COLUMNS_COUNT,
220
- z as DEFAULT_PRESET,
221
- _ as DEFAULT_TILE_SIZE
228
+ X as ColorPalette,
229
+ k as DEFAULT_COLUMNS_COUNT,
230
+ O as DEFAULT_PRESET
222
231
  };
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("vue"),k=require("@progress/kendo-vue-buttons"),t=require("@progress/kendo-vue-common"),V=require("../package-metadata.js"),y=require("./Picker.js"),C=require("./FlatColorPicker.js"),r=require("./utils/color-cache.js"),S=require("@progress/kendo-vue-intl"),l=require("../messages/main.js"),v=require("@progress/kendo-svg-icons");function w(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!n.isVNode(e)}const $=n.defineComponent({name:"KendoColorPicker",model:{event:"changemodel"},emits:{open:null,close:null,changemodel:null,"update:modelValue":null,"update:modelRgbaValue":null,activecolorclick:null,focus:null,blur:null,change:null,viewchange:null},props:{modelValue:String,modelRgbaValue:String,value:{type:String,default:void 0},defaultValue:String,disabled:Boolean,dir:String,id:String,ariaLabelledBy:String,ariaDescribedBy:String,showClearButton:{type:Boolean,default:!0},showPreview:{type:Boolean,default:!0},showButtons:{type:Boolean,default:!0},paletteSettings:{type:Object,default:function(){return r.DEFAULT_PALETTE_SETTINGS}},valid:{type:Boolean,default:!0},tabIndex:{type:Number,default:0},title:String,icon:String,svgIcon:Object,iconClassName:String,popupSettings:{type:Object,default:function(){return{}}},gradientSettings:{type:Object,default:function(){return r.DEFAULT_GRADIENT_SETTINGS}},flatColorPickerSettings:{type:Object,default:function(){return{}}},open:{type:Boolean,default:void 0},size:{type:String,default:"medium",validator:function(e){return[null,"small","medium","large"].includes(e)}},rounded:{type:String,default:"medium",validator:function(e){return[null,"small","medium","large","full"].includes(e)}},fillMode:{type:String,default:"solid",validator:function(e){return[null,"solid","flat","outline"].includes(e)}},view:{type:String,default:"combo",validator:function(e){return["gradient","palette","combo"].includes(e)}},selectedView:{type:Number,default:void 0}},inject:{kendoLocalizationService:{default:null}},data(){return{focused:!1,currentValue:this.$props.defaultValue,currentOpen:!1}},computed:{isValueControlled(){return this.$props.value!==void 0},isOpenControlled(){return this.$props.open!==void 0},computedValue(){return this.isValueControlled?this.$props.value:this.$props.modelValue!==void 0?this.$props.modelValue:this.$props.modelRgbaValue!==void 0?this.$props.modelRgbaValue:this.currentValue!==void 0?this.currentValue:this.defaultValue},computedOpen(){return this.isOpenControlled?this.$props.open:this.currentOpen},wrapperClassName(){const{size:e,fillMode:i,rounded:o}=this.$props;return{"k-picker":!0,"k-colorpicker":!0,"k-icon-picker":!0,[`k-picker-${t.kendoThemeMaps.sizeMap[e]||e}`]:e,[`k-picker-${i}`]:i,[`k-rounded-${t.kendoThemeMaps.roundedMap[o]||o}`]:o,"k-invalid":!this.valid,"k-disabled":this.disabled,"k-focus":this.focused}}},created(){t.validatePackage(V.packageMetadata),this._popupId="popup"+t.guid(),this.focusableElementGuid=t.guid()},mounted(){this.button=t.getRef(this,"button")},render(){let e;const o=S.provideLocalizationService(this).toLanguageString(l.colorPickerDropdownButtonAriaLabel,l.messages[l.colorPickerDropdownButtonAriaLabel]),{disabled:a,tabIndex:u,dir:s,view:c,selectedView:d,showClearButton:p,showPreview:h,showButtons:f,popupSettings:m}=this.$props,g=function(){return n.h(C.FlatColorPicker,{onKeydown:this.onKeyDownHandler,ref:t.setRef(this,"flatcolorpicker"),view:c,selectedView:d,showClearButton:p,showPreview:h,showButtons:f,value:this.computedValue||void 0,onChange:this.onFlatChangeHandler,onFocusout:this.onBlurHandler,onViewchange:this.onViewChange,paletteSettings:this.paletteSettings,gradientSettings:this.gradientSettings,...this.flatColorPickerSettings})};return n.createVNode("span",{class:this.wrapperClassName,role:"combobox",dir:s,id:this.$props.id,"aria-labelledby":this.$props.ariaLabelledBy,"aria-describedby":this.$props.ariaDescribedBy,"aria-disabled":this.$props.disabled,"aria-haspopup":"dialog","aria-expanded":this.computedOpen,ref:this.focusableElementGuid,tabindex:t.getTabIndex(u,a),title:this.$props.title,onKeydown:this.onButtonKeyDown,onFocusin:this.onFocusHandler,onFocusout:this.onButtonBlur},[n.createVNode("span",{onClick:this.onActiveColorClickHandler,class:"k-input-inner"},[n.createVNode("span",{class:t.classNames("k-value-icon","k-color-preview",{"k-no-color":!this.computedValue,"k-icon-color-preview":this.icon||this.iconClassName})},[(this.iconClassName||this.icon||this.svgIcon)&&n.createVNode(t.Icon,{class:t.classNames("k-color-preview-icon",this.iconClassName),name:t.getIconName(this.icon),icon:this.svgIcon},null),n.createVNode("span",{class:"k-color-preview-mask",style:{backgroundColor:this.computedValue}},null)])]),n.createVNode(k.Button,{type:"button",tabIndex:-1,ref:b=>{this.buttonRef=b},onClick:this.onClickHandler,rounded:null,class:"k-input-button",icon:"caret-alt-down",svgIcon:v.caretAltDownIcon,"aria-label":o},null),n.createVNode(y.Picker,{dir:s,id:this._popupId,open:this.computedOpen,onOpen:this.onOpenHandler,popupAnchor:this.focusableElementGuid,popupSettings:{...m}},w(e=g.call(this))?e:{default:()=>[e]})])},methods:{focusElement(){this.$el&&this.$el.focus()},setOpen(e,i){!e&&!i&&this.$el&&this.$el.focus(),this.currentOpen=e,this.$emit(e?"open":"close")},onButtonKeyDown(e){const{altKey:i,keyCode:o}=e;if(o===t.Keys.esc){e.preventDefault(),e.stopPropagation(),this.setOpen(!1);return}if(o===t.Keys.enter){e.preventDefault(),e.stopPropagation(),this.setOpen(!this.computedOpen);return}i&&o===t.Keys.down&&(e.preventDefault(),e.stopPropagation(),this.setOpen(!0))},onKeyDownHandler(e){const{altKey:i,keyCode:o}=e;if(o===t.Keys.esc){e.preventDefault(),e.stopPropagation(),this.setOpen(!1);return}if(o===t.Keys.enter){e.preventDefault(),e.stopPropagation(),this.focusElement();return}i&&o===t.Keys.up&&(e.preventDefault(),e.stopPropagation(),this.setOpen(!1),this.focusElement())},onOpenHandler(){const e=t.getRef(this,"flatcolorpicker");e&&e.focus()},onClickHandler(){this.setOpen(!this.computedOpen,!0)},onActiveColorClickHandler(e){this.$emit("activecolorclick",{event:e,value:this.computedValue})},isViewFocused(){return!!(document.activeElement&&document.activeElement.closest(`#${this._popupId}`))},onButtonBlur(e){this.focused=this.isViewFocused(),this.$emit("blur",{event:e})},onFocusHandler(e){this.blurTimeoutRef?(clearTimeout(this.blurTimeoutRef),this.blurTimeoutRef=void 0,e.target===this.$el&&this.setOpen(!1)):this.focused=!0,this.$emit("focus",{event:e})},onBlurTimeout(){const e=this.isViewFocused();e||this.setOpen(!1,!0),this.focused=e,this.blurTimeoutRef=void 0},onBlurHandler(){clearTimeout(this.blurTimeoutRef),this.palette=t.getRef(this,"palette"),this.gradient=t.getRef(this,"gradient"),this.blurTimeoutRef=setTimeout(this.onBlurTimeout,200)},onViewChange(e){this.$emit("viewchange",e)},onChangeHandler(e,i){const o=e.value;this.isValueControlled||(this.currentValue=o),i&&this.setOpen(!1),this.$emit("changemodel",o),this.$emit("update:modelRgbaValue",e.rgbaValue),this.$emit("update:modelValue",o),this.$emit("change",{value:o,rgbaValue:e.rgbaValue,event:e})},onFlatChangeHandler(e){this.onChangeHandler(e,!0)}}});exports.ColorPicker=$;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("vue"),w=require("@progress/kendo-vue-buttons"),t=require("@progress/kendo-vue-common"),S=require("../package-metadata.js"),V=require("./Picker.js"),B=require("./FlatColorPicker.js"),P=require("./utils/color-cache.js"),O=require("@progress/kendo-vue-intl"),n=require("../messages/main.js"),$=require("@progress/kendo-svg-icons"),T=require("./ColorPalette.js"),A=require("./common/ColorsAdaptiveMode.js");function R(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!a.isVNode(e)}const N=a.defineComponent({name:"KendoColorPicker",model:{event:"changemodel"},emits:{open:null,close:null,changemodel:null,"update:modelValue":null,"update:modelRgbaValue":null,activecolorclick:null,focus:null,blur:null,change:null,viewchange:null},props:{modelValue:String,modelRgbaValue:String,value:{type:String,default:void 0},defaultValue:String,disabled:Boolean,dir:String,id:String,ariaLabelledBy:String,ariaDescribedBy:String,showClearButton:{type:Boolean,default:!0},showPreview:{type:Boolean,default:!0},showButtons:{type:Boolean,default:!0},paletteSettings:{type:Object,default:function(){return{palette:T.DEFAULT_PRESET}}},valid:{type:Boolean,default:!0},tabIndex:{type:Number,default:0},title:String,icon:String,svgIcon:Object,iconClassName:String,popupSettings:{type:Object,default:function(){return{}}},gradientSettings:{type:Object,default:function(){return P.DEFAULT_GRADIENT_SETTINGS}},flatColorPickerSettings:{type:Object,default:function(){return{}}},open:{type:Boolean,default:void 0},size:{type:String,default:"medium",validator:function(e){return[null,"small","medium","large"].includes(e)}},rounded:{type:String,default:"medium",validator:function(e){return[null,"small","medium","large","full"].includes(e)}},fillMode:{type:String,default:"solid",validator:function(e){return[null,"solid","flat","outline"].includes(e)}},view:{type:String,default:"combo",validator:function(e){return["gradient","palette","combo"].includes(e)}},selectedView:{type:Number,default:void 0},adaptive:{type:Boolean,default:!1},adaptiveTitle:{type:String}},inject:{kendoLocalizationService:{default:null},adaptiveModeBreakpoints:{default:{small:t.ADAPTIVE_SMALL_BREAKPOINT,medium:t.ADAPTIVE_MEDIUM_BREAKPOINT}}},data(){return{focused:!1,currentValue:this.$props.defaultValue,currentOpen:!1,flatcolorpickerRef:null,windowWidth:0,observer:null}},computed:{isValueControlled(){return this.$props.value!==void 0},isOpenControlled(){return this.$props.open!==void 0},computedValue(){return this.isValueControlled?this.$props.value:this.$props.modelValue!==void 0?this.$props.modelValue:this.$props.modelRgbaValue!==void 0?this.$props.modelRgbaValue:this.currentValue!==void 0?this.currentValue:this.defaultValue},computedOpen(){return this.isOpenControlled?this.$props.open:this.currentOpen},wrapperClassName(){const{size:e,fillMode:o,rounded:i}=this.$props;return{"k-picker":!0,"k-colorpicker":!0,"k-icon-picker":!0,[`k-picker-${t.kendoThemeMaps.sizeMap[e]||e}`]:e,[`k-picker-${o}`]:o,[`k-rounded-${t.kendoThemeMaps.roundedMap[i]||i}`]:i,"k-invalid":!this.valid,"k-disabled":this.disabled,"k-focus":this.focused}},animationStyles(){return this.windowWidth<=this.adaptiveModeBreakpoints.small?{top:0,width:"100%",height:"100%"}:void 0},classNameAdaptive(){return this.windowWidth<=this.adaptiveModeBreakpoints.small?"k-adaptive-actionsheet k-actionsheet-fullscreen":"k-adaptive-actionsheet k-actionsheet-bottom"},adaptiveState(){return!!(this.$props.adaptive&&this.windowWidth&&this.windowWidth<=this.adaptiveModeBreakpoints.medium)}},created(){t.validatePackage(S.packageMetadata),this._popupId="popup"+t.guid(),this.focusableElementGuid=t.guid()},mounted(){this.observer=t.canUseDOM&&window.ResizeObserver&&new ResizeObserver(this.calculateMedia),document!=null&&document.body&&this.observer&&this.observer.observe(document.body),this.flatcolorpickerRef=t.getRef(this,"flatcolorpicker"),this.button=t.getRef(this,"button")},unmounted(){var e;(e=this.document)!=null&&e.body&&this.observer&&this.observer.disconnect()},render(){let e;const{disabled:o,tabIndex:i,dir:r,view:d,selectedView:c,showClearButton:p,showPreview:h,showButtons:f,popupSettings:m,size:g,adaptiveTitle:k}=this.$props,s=O.provideLocalizationService(this),b=s.toLanguageString(n.colorPickerDropdownButtonAriaLabel,n.messages[n.colorPickerDropdownButtonAriaLabel]),v=k||s.toLanguageString(n.colorPickerAdaptiveTitle,n.messages[n.colorPickerAdaptiveTitle]),C=s.toLanguageString(n.flatColorPickerApplyBtn,n.messages[n.flatColorPickerApplyBtn]),y=s.toLanguageString(n.flatColorPickerCancelBtn,n.messages[n.flatColorPickerCancelBtn]),u=function(){return a.h(B.FlatColorPicker,{onKeydown:this.onKeyDownHandler,ref:t.setRef(this,"flatcolorpicker"),view:d,selectedView:c,showClearButton:p,showPreview:h,showButtons:this.adaptiveState?!1:f,size:this.adaptiveState?"large":g,value:this.computedValue||void 0,onChange:this.onFlatChangeHandler,onFocusout:this.onBlurHandler,onViewchange:this.onViewChange,paletteSettings:this.paletteSettings,gradientSettings:this.gradientSettings,adaptive:this.adaptiveState,...this.flatColorPickerSettings})};return a.createVNode("span",{class:this.wrapperClassName,role:"combobox",dir:r,id:this.$props.id,"aria-labelledby":this.$props.ariaLabelledBy,"aria-describedby":this.$props.ariaDescribedBy,"aria-disabled":this.$props.disabled,"aria-haspopup":"dialog","aria-expanded":this.computedOpen,ref:this.focusableElementGuid,tabindex:t.getTabIndex(i,o),title:this.$props.title,onKeydown:this.onButtonKeyDown,onFocusin:this.onFocusHandler,onFocusout:this.onButtonBlur},[a.createVNode("span",{onClick:this.onActiveColorClickHandler,class:"k-input-inner"},[a.createVNode("span",{class:t.classNames("k-value-icon","k-color-preview",{"k-no-color":!this.computedValue,"k-icon-color-preview":this.icon||this.iconClassName})},[(this.iconClassName||this.icon||this.svgIcon)&&a.createVNode(t.Icon,{class:t.classNames("k-color-preview-icon",this.iconClassName),name:t.getIconName(this.icon),icon:this.svgIcon},null),a.createVNode("span",{class:"k-color-preview-mask",style:{backgroundColor:this.computedValue}},null)])]),a.createVNode(w.Button,{type:"button",tabIndex:-1,ref:l=>{this.buttonRef=l},onClick:this.onClickHandler,rounded:null,class:"k-input-button",icon:"caret-alt-down",svgIcon:$.caretAltDownIcon,"aria-label":b},null),!this.adaptiveState&&a.createVNode(V.Picker,{dir:r,id:this._popupId,open:this.computedOpen,onOpen:this.onOpenHandler,popupAnchor:this.focusableElementGuid,popupSettings:{...m}},R(e=u.call(this))?e:{default:()=>[e]}),this.adaptiveState&&a.createVNode(A.ColorsAdaptiveMode,{expand:this.computedOpen,animationStyles:this.animationStyles,classNameAdaptive:this.classNameAdaptive,title:v,applyText:C,cancelText:y,componentToRender:u.call(this),onActionSheetClose:()=>this.setOpen(!this.computedOpen),onCancelBtnClick:()=>this.flatcolorpickerRef.handleCancelBtnClick(),onApplyBtnClick:l=>this.flatcolorpickerRef.triggerChange(l)},null)])},methods:{calculateMedia(e){for(let o of e)this.windowWidth=o.target.clientWidth},focusElement(){this.$el&&this.$el.focus()},setOpen(e,o){!e&&!o&&this.$el&&this.$el.focus(),this.currentOpen=e,this.$emit(e?"open":"close")},onButtonKeyDown(e){const{altKey:o,keyCode:i}=e;if(i===t.Keys.esc){e.preventDefault(),e.stopPropagation(),this.setOpen(!1);return}if(i===t.Keys.enter){e.preventDefault(),e.stopPropagation(),this.setOpen(!this.computedOpen);return}o&&i===t.Keys.down&&(e.preventDefault(),e.stopPropagation(),this.setOpen(!0))},onKeyDownHandler(e){const{altKey:o,keyCode:i}=e;if(i===t.Keys.esc){e.preventDefault(),e.stopPropagation(),this.setOpen(!1);return}if(i===t.Keys.enter){e.preventDefault(),e.stopPropagation(),this.focusElement();return}o&&i===t.Keys.up&&(e.preventDefault(),e.stopPropagation(),this.setOpen(!1),this.focusElement())},onOpenHandler(){const e=t.getRef(this,"flatcolorpicker");e&&e.focus()},onClickHandler(){this.setOpen(!this.computedOpen,!0)},onActiveColorClickHandler(e){this.$emit("activecolorclick",{event:e,value:this.computedValue})},isViewFocused(){return!!(document.activeElement&&document.activeElement.closest(`#${this._popupId}`))},onButtonBlur(e){this.focused=this.isViewFocused(),this.$emit("blur",{event:e})},onFocusHandler(e){this.blurTimeoutRef?(clearTimeout(this.blurTimeoutRef),this.blurTimeoutRef=void 0,e.target===this.$el&&this.setOpen(!1)):this.focused=!0,this.$emit("focus",{event:e})},onBlurTimeout(){const e=this.isViewFocused();e||this.setOpen(!1,!0),this.focused=e,this.blurTimeoutRef=void 0},onBlurHandler(){clearTimeout(this.blurTimeoutRef),this.palette=t.getRef(this,"palette"),this.gradient=t.getRef(this,"gradient"),this.blurTimeoutRef=setTimeout(this.onBlurTimeout,200)},onViewChange(e){this.$emit("viewchange",e)},onChangeHandler(e,o){const i=e.value;this.isValueControlled||(this.currentValue=i),o&&this.setOpen(!1),this.$emit("changemodel",i),this.$emit("update:modelRgbaValue",e.rgbaValue),this.$emit("update:modelValue",i),this.$emit("change",{value:i,rgbaValue:e.rgbaValue,event:e})},onFlatChangeHandler(e){this.onChangeHandler(e,!0)}}});exports.ColorPicker=N;