@progress/kendo-react-inputs 15.1.1-develop.3 → 15.2.0-develop.2
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.
- package/checkbox/Checkbox.js +1 -1
- package/checkbox/Checkbox.mjs +72 -70
- package/colors/ColorContrastLabels.js +1 -1
- package/colors/ColorContrastLabels.mjs +2 -2
- package/colors/ColorGradient.js +1 -1
- package/colors/ColorGradient.mjs +51 -52
- package/colors/ColorPalette.js +1 -1
- package/colors/ColorPalette.mjs +71 -72
- package/colors/ColorPicker.js +1 -1
- package/colors/ColorPicker.mjs +203 -195
- package/colors/FlatColorPicker.d.ts +4 -4
- package/colors/FlatColorPicker.js +1 -1
- package/colors/FlatColorPicker.mjs +30 -26
- package/colors/interfaces/ColorPaletteProps.d.ts +7 -0
- package/colors/interfaces/ColorPickerPaletteSettings.d.ts +5 -0
- package/dist/cdn/js/kendo-react-inputs.js +1 -1
- package/maskedtextbox/MaskedTextBox.d.ts +1 -0
- package/maskedtextbox/MaskedTextBox.js +1 -1
- package/maskedtextbox/MaskedTextBox.mjs +26 -23
- package/maskedtextbox/MaskedTextBoxProps.d.ts +7 -0
- package/numerictextbox/NumericTextBox.js +1 -1
- package/numerictextbox/NumericTextBox.mjs +2 -2
- package/otpinput/OTPInput.js +1 -1
- package/otpinput/OTPInput.mjs +141 -143
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +10 -10
- package/radiobutton/RadioButton.js +1 -1
- package/radiobutton/RadioButton.mjs +32 -30
- package/range-slider/RangeSlider.js +11 -11
- package/range-slider/RangeSlider.mjs +54 -54
- package/rating/Rating.d.ts +12 -0
- package/rating/Rating.js +2 -2
- package/rating/Rating.mjs +91 -92
- package/slider/Slider.d.ts +12 -0
- package/slider/Slider.js +1 -1
- package/slider/Slider.mjs +69 -64
- package/switch/Switch.d.ts +15 -0
- package/switch/Switch.js +1 -1
- package/switch/Switch.mjs +87 -82
- package/textarea/TextArea.js +1 -1
- package/textarea/TextArea.mjs +11 -12
package/colors/ColorPalette.js
CHANGED
|
@@ -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("react"),s=require("prop-types"),
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react"),s=require("prop-types"),le=require("./utils/color-palette.service.js"),w=require("@progress/kendo-react-common"),se=require("./models/palette-presets.js"),q=require("./utils/color-parser.js");function ne(c){const p=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const h in c)if(h!=="default"){const E=Object.getOwnPropertyDescriptor(c,h);Object.defineProperty(p,h,E.get?E:{enumerable:!0,get:()=>c[h]})}}return p.default=c,Object.freeze(p)}const k=ne(n),z=24,B=10,j="office",L={palette:j,columns:B,tileSize:z},V=w.createPropsContext(),ae=c=>{if(Array.isArray(c))return c;if(typeof c=="string"){const p=se.PALETTEPRESETS[c];if(p)return p.colors}return[]},D=k.forwardRef((c,p)=>{const h=w.usePropsContext(V,c),{palette:E=L.palette,columns:F=L.columns,tileSize:u=L.tileSize,value:x,defaultValue:$,disabled:d=!1,tabIndex:K,onChange:P,onFocus:I,className:W,size:N,id:Z,ariaLabelledBy:G,ariaDescribedBy:J,ariaLabel:Q}=h,S=n.useRef(null),X=n.useRef({focus:()=>{var o;(o=S.current)==null||o.focus()},wrapperRef:S}),_=F!=null?F:L.columns,b=n.useMemo(()=>ae(E),[E]),t=n.useMemo(()=>{const o=new le.ColorPaletteService;return o.setColorMatrix(b,_),o},[b,_]),[g,O]=n.useState(()=>x!==void 0?x:$||""),[T,R]=n.useState(""),y=x!==void 0;n.useEffect(()=>{y&&O(x)},[x,y]);const Y=n.useCallback(o=>{if(d||b.length===0)return;const f=g||b[0];R(f),I&&I(o)},[d,b,g,I]),ee=n.useCallback(()=>{R("")},[]),oe=n.useCallback(o=>{if(d)return;const{key:f}=o,r=()=>T||g||b[0],m=(l,e)=>l<0?e:l>e?0:l;switch(f){case"ArrowRight":o.preventDefault();{const l=r(),e=t.getCellCoordsFor(l);if(e&&t.colorRows[e.row]){const C=t.colorRows[e.row].length-1,a=m(e.col+1,C),i=t.colorRows[e.row][a];i&&R(i)}}break;case"ArrowLeft":o.preventDefault();{const l=r(),e=t.getCellCoordsFor(l);if(e&&t.colorRows[e.row]){const C=t.colorRows[e.row].length-1,a=m(e.col-1,C),i=t.colorRows[e.row][a];i&&R(i)}}break;case"ArrowDown":o.preventDefault();{const l=r(),e=t.getCellCoordsFor(l);if(e){const C=t.colorRows.length-1,a=m(e.row+1,C),i=Math.min(e.col,t.colorRows[a].length-1),v=t.colorRows[a][i];v&&R(v)}}break;case"ArrowUp":o.preventDefault();{const l=r(),e=t.getCellCoordsFor(l);if(e){const C=t.colorRows.length-1,a=m(e.row-1,C),i=Math.min(e.col,t.colorRows[a].length-1),v=t.colorRows[a][i];v&&R(v)}}break;case"Enter":o.preventDefault();{const l=r();if(l&&(y||O(l),P)){const e=q.parseColor(l,"rgba");w.dispatchEvent(P,o,null,{value:l,rgbaValue:e||""})}}break}},[d,T,g,b,t,y,P]),A=n.useCallback((o,f)=>{if(d)return;const r=o;if(y||O(r),P){const m=q.parseColor(r,"rgba");w.dispatchEvent(P,f,null,{value:r,rgbaValue:m||""})}},[d,P,y]),U=n.useCallback((o,f)=>o.map((r,m)=>{const l=g&&r.toLowerCase()===g.toLowerCase(),e=T&&r.toLowerCase()===T.toLowerCase(),C=w.classNames("k-colorpalette-tile",{"k-selected":l,"k-focus":e}),a={backgroundColor:r};return typeof u=="number"?(a.width=`${u}px`,a.height=`${u}px`):u&&typeof u=="object"&&("width"in u&&(a.width=`${u.width}px`),"height"in u&&(a.height=`${u.height}px`)),k.createElement("td",{key:r,role:"gridcell",className:C,style:a,"aria-label":r,"aria-selected":l?"true":void 0,onClick:i=>A(r,i)})}),[g,T,u,A]),te=n.useCallback(()=>t.colorRows.map((f,r)=>k.createElement("tr",{key:f[0]||r,role:"row"},U(f,r))),[t,U]),M=n.useCallback(()=>({focus:()=>{var o;(o=S.current)==null||o.focus()},wrapperRef:S}),[]);n.useImperativeHandle(X,M),n.useImperativeHandle(p,M);const re=w.classNames("k-colorpalette",W,{"k-disabled":d,"k-colorpalette-sm":N==="small","k-colorpalette-md":N==="medium","k-colorpalette-lg":N==="large"});return k.createElement("div",{ref:S,role:"grid",className:re,tabIndex:w.getTabIndex(K,d),id:Z,"aria-label":Q,"aria-labelledby":G,"aria-describedby":J,"aria-disabled":d?"true":void 0,onFocus:Y,onBlur:ee,onKeyDown:oe},k.createElement("table",{className:"k-colorpalette-table",role:"none"},k.createElement("tbody",null,te())))});D.displayName="ColorPalette";D.propTypes={palette:s.oneOfType([s.arrayOf(s.string.isRequired),s.string]),columns:s.number,tileSize:s.any,defaultValue:s.string,value:s.string,disabled:s.bool,tabIndex:s.number,onChange:s.func,onFocus:s.func,id:s.string,ariaLabelledBy:s.string,ariaDescribedBy:s.string,className:s.string,size:s.oneOf(["small","medium","large"])};const H=w.withIdHOC(D);H.displayName="KendoReactColorPalette";const ce=D;exports.ColorPalette=H;exports.ColorPalettePropsContext=V;exports.ColorPaletteWithoutContext=ce;exports.DEFAULT_COLUMNS_COUNT=B;exports.DEFAULT_PRESET=j;exports.DEFAULT_TILE_SIZE=z;exports.defaultColorPaletteProps=L;
|
package/colors/ColorPalette.mjs
CHANGED
|
@@ -6,78 +6,77 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
import * as R from "react";
|
|
9
|
-
import { useRef as O, useMemo as U, useState as V, useEffect as
|
|
9
|
+
import { useRef as O, useMemo as U, useState as V, useEffect as se, useCallback as p, useImperativeHandle as M } from "react";
|
|
10
10
|
import l from "prop-types";
|
|
11
|
-
import { ColorPaletteService as
|
|
12
|
-
import { withIdHOC as
|
|
13
|
-
import { PALETTEPRESETS as
|
|
11
|
+
import { ColorPaletteService as le } from "./utils/color-palette.service.mjs";
|
|
12
|
+
import { withIdHOC as ne, createPropsContext as ae, usePropsContext as ce, dispatchEvent as _, classNames as H, getTabIndex as ie } from "@progress/kendo-react-common";
|
|
13
|
+
import { PALETTEPRESETS as ue } from "./models/palette-presets.mjs";
|
|
14
14
|
import { parseColor as $ } from "./utils/color-parser.mjs";
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
if (
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if (E)
|
|
27
|
-
return E.colors;
|
|
15
|
+
const de = 24, fe = 10, Ce = "office", v = {
|
|
16
|
+
palette: Ce,
|
|
17
|
+
columns: fe,
|
|
18
|
+
tileSize: de
|
|
19
|
+
}, we = ae(), pe = (m) => {
|
|
20
|
+
if (Array.isArray(m))
|
|
21
|
+
return m;
|
|
22
|
+
if (typeof m == "string") {
|
|
23
|
+
const P = ue[m];
|
|
24
|
+
if (P)
|
|
25
|
+
return P.colors;
|
|
28
26
|
}
|
|
29
27
|
return [];
|
|
30
|
-
},
|
|
31
|
-
const
|
|
32
|
-
palette:
|
|
33
|
-
columns:
|
|
34
|
-
tileSize: c =
|
|
28
|
+
}, F = R.forwardRef((m, P) => {
|
|
29
|
+
const K = ce(we, m), {
|
|
30
|
+
palette: I = v.palette,
|
|
31
|
+
columns: L = v.columns,
|
|
32
|
+
tileSize: c = v.tileSize,
|
|
35
33
|
value: y,
|
|
36
|
-
defaultValue:
|
|
34
|
+
defaultValue: j,
|
|
37
35
|
disabled: i = !1,
|
|
38
|
-
tabIndex:
|
|
36
|
+
tabIndex: q,
|
|
39
37
|
onChange: g,
|
|
40
38
|
onFocus: S,
|
|
41
|
-
className:
|
|
39
|
+
className: W,
|
|
42
40
|
size: D,
|
|
43
|
-
id:
|
|
44
|
-
ariaLabelledBy:
|
|
45
|
-
ariaDescribedBy:
|
|
46
|
-
|
|
41
|
+
id: Z,
|
|
42
|
+
ariaLabelledBy: G,
|
|
43
|
+
ariaDescribedBy: J,
|
|
44
|
+
ariaLabel: Q
|
|
45
|
+
} = K, k = O(null), X = O({
|
|
47
46
|
focus: () => {
|
|
48
47
|
var o;
|
|
49
48
|
(o = k.current) == null || o.focus();
|
|
50
49
|
},
|
|
51
50
|
wrapperRef: k
|
|
52
|
-
}),
|
|
53
|
-
const o = new
|
|
54
|
-
return o.setColorMatrix(f,
|
|
55
|
-
}, [f,
|
|
56
|
-
|
|
51
|
+
}), A = L != null ? L : v.columns, f = U(() => pe(I), [I]), t = U(() => {
|
|
52
|
+
const o = new le();
|
|
53
|
+
return o.setColorMatrix(f, A), o;
|
|
54
|
+
}, [f, A]), [C, T] = V(() => y !== void 0 ? y : j || ""), [x, b] = V(""), h = y !== void 0;
|
|
55
|
+
se(() => {
|
|
57
56
|
h && T(y);
|
|
58
57
|
}, [y, h]);
|
|
59
58
|
const Y = p(
|
|
60
59
|
(o) => {
|
|
61
60
|
if (i || f.length === 0)
|
|
62
61
|
return;
|
|
63
|
-
const u =
|
|
62
|
+
const u = C || f[0];
|
|
64
63
|
b(u), S && S(o);
|
|
65
64
|
},
|
|
66
|
-
[i, f,
|
|
65
|
+
[i, f, C, S]
|
|
67
66
|
), ee = p(() => {
|
|
68
67
|
b("");
|
|
69
68
|
}, []), oe = p(
|
|
70
69
|
(o) => {
|
|
71
70
|
if (i)
|
|
72
71
|
return;
|
|
73
|
-
const { key: u } = o, r = () => x ||
|
|
72
|
+
const { key: u } = o, r = () => x || C || f[0], w = (s, e) => s < 0 ? e : s > e ? 0 : s;
|
|
74
73
|
switch (u) {
|
|
75
74
|
case "ArrowRight":
|
|
76
75
|
o.preventDefault();
|
|
77
76
|
{
|
|
78
77
|
const s = r(), e = t.getCellCoordsFor(s);
|
|
79
78
|
if (e && t.colorRows[e.row]) {
|
|
80
|
-
const d = t.colorRows[e.row].length - 1, n =
|
|
79
|
+
const d = t.colorRows[e.row].length - 1, n = w(e.col + 1, d), a = t.colorRows[e.row][n];
|
|
81
80
|
a && b(a);
|
|
82
81
|
}
|
|
83
82
|
}
|
|
@@ -87,7 +86,7 @@ const Ce = 24, pe = 10, we = "office", L = {
|
|
|
87
86
|
{
|
|
88
87
|
const s = r(), e = t.getCellCoordsFor(s);
|
|
89
88
|
if (e && t.colorRows[e.row]) {
|
|
90
|
-
const d = t.colorRows[e.row].length - 1, n =
|
|
89
|
+
const d = t.colorRows[e.row].length - 1, n = w(e.col - 1, d), a = t.colorRows[e.row][n];
|
|
91
90
|
a && b(a);
|
|
92
91
|
}
|
|
93
92
|
}
|
|
@@ -97,8 +96,8 @@ const Ce = 24, pe = 10, we = "office", L = {
|
|
|
97
96
|
{
|
|
98
97
|
const s = r(), e = t.getCellCoordsFor(s);
|
|
99
98
|
if (e) {
|
|
100
|
-
const d = t.colorRows.length - 1, n =
|
|
101
|
-
|
|
99
|
+
const d = t.colorRows.length - 1, n = w(e.row + 1, d), a = Math.min(e.col, t.colorRows[n].length - 1), E = t.colorRows[n][a];
|
|
100
|
+
E && b(E);
|
|
102
101
|
}
|
|
103
102
|
}
|
|
104
103
|
break;
|
|
@@ -107,8 +106,8 @@ const Ce = 24, pe = 10, we = "office", L = {
|
|
|
107
106
|
{
|
|
108
107
|
const s = r(), e = t.getCellCoordsFor(s);
|
|
109
108
|
if (e) {
|
|
110
|
-
const d = t.colorRows.length - 1, n =
|
|
111
|
-
|
|
109
|
+
const d = t.colorRows.length - 1, n = w(e.row - 1, d), a = Math.min(e.col, t.colorRows[n].length - 1), E = t.colorRows[n][a];
|
|
110
|
+
E && b(E);
|
|
112
111
|
}
|
|
113
112
|
}
|
|
114
113
|
break;
|
|
@@ -127,24 +126,24 @@ const Ce = 24, pe = 10, we = "office", L = {
|
|
|
127
126
|
break;
|
|
128
127
|
}
|
|
129
128
|
},
|
|
130
|
-
[i, x,
|
|
129
|
+
[i, x, C, f, t, h, g]
|
|
131
130
|
), N = p(
|
|
132
131
|
(o, u) => {
|
|
133
132
|
if (i)
|
|
134
133
|
return;
|
|
135
134
|
const r = o;
|
|
136
135
|
if (h || T(r), g) {
|
|
137
|
-
const
|
|
136
|
+
const w = $(r, "rgba");
|
|
138
137
|
_(g, u, null, {
|
|
139
138
|
value: r,
|
|
140
|
-
rgbaValue:
|
|
139
|
+
rgbaValue: w || ""
|
|
141
140
|
});
|
|
142
141
|
}
|
|
143
142
|
},
|
|
144
143
|
[i, g, h]
|
|
145
|
-
),
|
|
146
|
-
(o, u) => o.map((r,
|
|
147
|
-
const s =
|
|
144
|
+
), B = p(
|
|
145
|
+
(o, u) => o.map((r, w) => {
|
|
146
|
+
const s = C && r.toLowerCase() === C.toLowerCase(), e = x && r.toLowerCase() === x.toLowerCase(), d = H("k-colorpalette-tile", {
|
|
148
147
|
"k-selected": s,
|
|
149
148
|
"k-focus": e
|
|
150
149
|
}), n = {
|
|
@@ -163,8 +162,8 @@ const Ce = 24, pe = 10, we = "office", L = {
|
|
|
163
162
|
}
|
|
164
163
|
);
|
|
165
164
|
}),
|
|
166
|
-
[
|
|
167
|
-
), te = p(() => t.colorRows.map((u, r) => /* @__PURE__ */ R.createElement("tr", { key: u[0] || r, role: "row" },
|
|
165
|
+
[C, x, c, N]
|
|
166
|
+
), te = p(() => t.colorRows.map((u, r) => /* @__PURE__ */ R.createElement("tr", { key: u[0] || r, role: "row" }, B(u, r))), [t, B]), z = p(
|
|
168
167
|
() => ({
|
|
169
168
|
focus: () => {
|
|
170
169
|
var o;
|
|
@@ -174,24 +173,24 @@ const Ce = 24, pe = 10, we = "office", L = {
|
|
|
174
173
|
}),
|
|
175
174
|
[]
|
|
176
175
|
);
|
|
177
|
-
M(X,
|
|
178
|
-
const re = H("k-colorpalette",
|
|
176
|
+
M(X, z), M(P, z);
|
|
177
|
+
const re = H("k-colorpalette", W, {
|
|
179
178
|
"k-disabled": i,
|
|
180
179
|
"k-colorpalette-sm": D === "small",
|
|
181
180
|
"k-colorpalette-md": D === "medium",
|
|
182
181
|
"k-colorpalette-lg": D === "large"
|
|
183
|
-
})
|
|
182
|
+
});
|
|
184
183
|
return /* @__PURE__ */ R.createElement(
|
|
185
184
|
"div",
|
|
186
185
|
{
|
|
187
186
|
ref: k,
|
|
188
187
|
role: "grid",
|
|
189
188
|
className: re,
|
|
190
|
-
tabIndex:
|
|
191
|
-
id:
|
|
192
|
-
"aria-label":
|
|
193
|
-
"aria-labelledby":
|
|
194
|
-
"aria-describedby":
|
|
189
|
+
tabIndex: ie(q, i),
|
|
190
|
+
id: Z,
|
|
191
|
+
"aria-label": Q,
|
|
192
|
+
"aria-labelledby": G,
|
|
193
|
+
"aria-describedby": J,
|
|
195
194
|
"aria-disabled": i ? "true" : void 0,
|
|
196
195
|
onFocus: Y,
|
|
197
196
|
onBlur: ee,
|
|
@@ -200,8 +199,8 @@ const Ce = 24, pe = 10, we = "office", L = {
|
|
|
200
199
|
/* @__PURE__ */ R.createElement("table", { className: "k-colorpalette-table", role: "none" }, /* @__PURE__ */ R.createElement("tbody", null, te()))
|
|
201
200
|
);
|
|
202
201
|
});
|
|
203
|
-
|
|
204
|
-
|
|
202
|
+
F.displayName = "ColorPalette";
|
|
203
|
+
F.propTypes = {
|
|
205
204
|
palette: l.oneOfType([l.arrayOf(l.string.isRequired), l.string]),
|
|
206
205
|
columns: l.number,
|
|
207
206
|
tileSize: l.any,
|
|
@@ -217,17 +216,17 @@ v.propTypes = {
|
|
|
217
216
|
className: l.string,
|
|
218
217
|
size: l.oneOf(["small", "medium", "large"])
|
|
219
218
|
};
|
|
220
|
-
const
|
|
221
|
-
|
|
219
|
+
const me = ne(
|
|
220
|
+
F
|
|
222
221
|
);
|
|
223
|
-
|
|
224
|
-
const
|
|
222
|
+
me.displayName = "KendoReactColorPalette";
|
|
223
|
+
const xe = F;
|
|
225
224
|
export {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
225
|
+
me as ColorPalette,
|
|
226
|
+
we as ColorPalettePropsContext,
|
|
227
|
+
xe as ColorPaletteWithoutContext,
|
|
228
|
+
fe as DEFAULT_COLUMNS_COUNT,
|
|
229
|
+
Ce as DEFAULT_PRESET,
|
|
230
|
+
de as DEFAULT_TILE_SIZE,
|
|
231
|
+
v as defaultColorPaletteProps
|
|
233
232
|
};
|
package/colors/ColorPicker.js
CHANGED
|
@@ -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 Me=require("react"),
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Me=require("react"),l=require("prop-types"),a=require("@progress/kendo-react-common"),be=require("../package-metadata.js"),Ve=require("./Picker.js"),He=require("./ColorGradient.js"),Y=require("./ColorPalette.js"),M=require("./FlatColorPicker.js"),We=require("@progress/kendo-react-buttons"),Ue=require("@progress/kendo-svg-icons"),n=require("../messages/index.js"),je=require("@progress/kendo-react-intl"),Ge=require("../common/AdaptiveMode.js"),Ke=require("@progress/kendo-react-layout");function $e(g){const T=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(g){for(const y in g)if(y!=="default"){const B=Object.getOwnPropertyDescriptor(g,y);Object.defineProperty(T,y,B.get?B:{enumerable:!0,get:()=>g[y]})}}return T.default=g,Object.freeze(T)}const t=$e(Me),Ze={opacity:!0},Je={palette:Y.DEFAULT_PRESET,tileSize:Y.DEFAULT_TILE_SIZE},X=g=>g!==void 0,Ee=a.createPropsContext(),ee=t.forwardRef((g,T)=>{var fe,ge;const y=!a.validatePackage(be.packageMetadata,{component:"ColorPicker"}),B=a.getLicenseMessage(be.packageMetadata),i=a.usePropsContext(Ee,g),v=je.useLocalization(),te=a.useAdaptiveModeContext(),{size:p=w.size,rounded:b=w.rounded,fillMode:V=w.fillMode,gradientSettings:S=w.gradientSettings,paletteSettings:A=w.paletteSettings,flatColorPickerSettings:R,view:k=i.views?void 0:w.view,views:d=k?void 0:w.views,activeView:ae,popupSettings:E,valid:Pe,disabled:F,tabIndex:we,icon:H,svgIcon:W,iconClassName:O,onChange:U,onFocus:j,onBlur:G,onActiveColorClick:K,className:ye,adaptive:Se,adaptiveTitle:ne=v.toLanguageString(n.colorPickerAdaptiveTitle,n.messages[n.colorPickerAdaptiveTitle]),adaptiveSubtitle:re,showButtons:h=!0}=i,s=t.useRef(null),_=t.useRef(null),D=t.useRef(null),C=t.useRef(null),L=t.useRef(void 0),oe=t.useRef(null),[he,le]=t.useState(!1),[Le,Te]=t.useState(i.defaultValue||void 0),[Ae,Re]=t.useState(!1),[z,_e]=t.useState(),$=X(i.value),P=X(i.open),c=$?i.value:Le,f=P?i.open:Ae,ie=t.useRef(c),N=t.useCallback(()=>{s.current&&s.current.focus()},[]);t.useImperativeHandle(T,()=>({element:s.current,actionElement:oe.current,value:c,focus:N}),[c,N]);const ce=t.useRef(null);t.useImperativeHandle(ce,()=>({element:s.current,actionElement:oe.current,value:c,focus:N}),[c,N]),a.useWebMcpRegister("colorpicker",ce,i,i.webMcp);const Z=!!(z&&te&&z<=te.medium&&Se);t.useEffect(()=>{const e=a.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(xe.bind(void 0));return document!=null&&document.body&&e&&e.observe(document.body),()=>{document!=null&&document.body&&e&&e.disconnect()}},[]);const o=t.useCallback((e,u)=>{P||(!e&&!u&&s&&s.current&&s.current.focus(),Re(e))},[P]),se=t.useMemo(()=>new a.Navigation({root:s,selectors:[".k-colorpicker",".k-color-picker-popup"],tabIndex:0,keyboardEvents:{keydown:{Escape:(e,u,r)=>{o(!1)},Enter:(e,u,r)=>{!P&&e===s.current&&(r.preventDefault(),r.stopPropagation(),o(!0))},ArrowDown:(e,u,r)=>{r.altKey&&(r.preventDefault(),r.stopPropagation(),o(!0))},ArrowUp:(e,u,r)=>{r.altKey&&(r.preventDefault(),r.stopPropagation(),o(!1))},Tab:(e,u,r)=>{var I,ve,ke;if(a.getActiveElement(document)!==s.current){const me=(I=D.current)==null?void 0:I.wrapperRef.current,q=(ve=_.current)==null?void 0:ve.wrapperRef.current,Ce=(ke=C.current)==null?void 0:ke.element;k==="palette"&&me?a.keepFocusInContainer(r,me):k==="gradient"&&q?a.keepFocusInContainer(r,q):k==="combo"&&q?a.keepFocusInContainer(r,q.parentElement):d&&Ce&&a.keepFocusInContainer(r,Ce)}}}}}),[o,P]),Ie=t.useCallback(se.triggerKeyboardEvent.bind(se),[]),Be=t.useCallback(()=>{P||(_.current&&_.current.wrapperRef.current?a.focusFirstFocusableChild(_.current.wrapperRef.current):D.current?D.current.focus():C.current&&C.current.element&&a.focusFirstFocusableChild(C.current.element))},[P]),x=e=>ie.current=e,ue=t.useCallback(e=>{const u={value:ie.current,nativeEvent:e.nativeEvent,syntheticEvent:e};m(u),o(!f,!0)},[f]),J=t.useCallback(()=>{o(!1,!0)},[o]),Fe=t.useCallback(e=>{K&&K.call(void 0,{syntheticEvent:e,nativeEvent:e.nativeEvent,value:c,target:{element:s.current,value:c}})},[K,c]),Oe=t.useCallback(e=>{L.current?(clearTimeout(L.current),L.current=void 0):(le(!0),Z&&!f&&o(!0)),j&&j.call(void 0,{nativeEvent:e.nativeEvent,syntheticEvent:e})},[Z,j,f,o]),De=t.useCallback(()=>{o(!1,!0),le(!1),L.current=void 0},[]),ze=t.useCallback(e=>{clearTimeout(L.current),L.current=window.setTimeout(De),G&&G.call(void 0,{nativeEvent:e.nativeEvent,syntheticEvent:e})},[G]),m=t.useCallback((e,u)=>{var I;const r=u?e.rgbaValue||"":(I=e.value)!=null?I:"";$||Te(r),U&&U.call(void 0,{value:r,nativeEvent:e.nativeEvent,syntheticEvent:e.syntheticEvent,target:{element:s.current,value:r}}),o(!1)},[$,U]),de=t.useCallback(e=>m(e,!0),[X,m]),Q=t.useCallback(e=>t.createElement(t.Fragment,null,(k==="combo"||k==="gradient")&&t.createElement(He.ColorGradient,{...S,_adaptive:e,ref:_,isInsidePopup:!0,role:"none",ariaLabel:void 0,size:e?"large":p,value:c,onChange:m}),(k==="combo"||k==="palette")&&t.createElement(Y.ColorPalette,{...A,ref:D,size:e?"large":p,value:c,onChange:de}),d&&d[0]==="gradient"&&d[1]==="palette"&&t.createElement(M.FlatColorPicker,{ariaLabel:v.toLanguageString(n.flatColorPickerAriaLabel,n.messages[n.flatColorPickerAriaLabel]),...R,paletteSettings:A,gradientSettings:{_adaptive:e,...S},ref:C,size:e?"large":p,rounded:b,views:["gradient","palette"],activeView:ae,setOpen:o,showButtons:e?!1:h,value:c,onChange:m,setAdaptiveModeValue:x}),d&&d[0]==="palette"&&d[1]==="gradient"&&t.createElement(M.FlatColorPicker,{ariaLabel:v.toLanguageString(n.flatColorPickerAriaLabel,n.messages[n.flatColorPickerAriaLabel]),...R,paletteSettings:A,gradientSettings:{_adaptive:e,...S},ref:C,size:e?"large":p,rounded:b,views:["palette","gradient"],setOpen:o,showButtons:e?!1:h,value:c,onChange:m,setAdaptiveModeValue:x}),d&&d.includes("gradient")&&!d.includes("palette")&&t.createElement(M.FlatColorPicker,{ariaLabel:v.toLanguageString(n.flatColorPickerAriaLabel,n.messages[n.flatColorPickerAriaLabel]),...R,gradientSettings:{_adaptive:e,...S},ref:C,size:e?"large":p,rounded:b,views:["gradient"],showButtons:e?!1:h,setOpen:o,value:c,onChange:m,setAdaptiveModeValue:x}),d&&d.includes("palette")&&!d.includes("gradient")&&t.createElement(M.FlatColorPicker,{ariaLabel:v.toLanguageString(n.flatColorPickerAriaLabel,n.messages[n.flatColorPickerAriaLabel]),...R,paletteSettings:A,gradientSettings:{_adaptive:e,...S},ref:C,size:e?"large":p,rounded:b,views:["palette"],showButtons:e?!1:h,setOpen:o,value:c,onChange:m,setAdaptiveModeValue:x}),y&&t.createElement(a.WatermarkOverlay,{message:B})),[ae,V,R,S,m,de,A,o,p,c,k,d]),Ne=t.useCallback(()=>{var u;const e={animation:!!((u=E==null?void 0:E.animate)==null||u),title:ne,subTitle:re,expand:f,onClose:J,windowWidth:z,footer:h?{cancelText:v.toLanguageString(n.flatColorPickerCancelBtn,n.messages[n.flatColorPickerCancelBtn]),onCancel:J,applyText:v.toLanguageString(n.flatColorPickerApplyBtn,n.messages[n.flatColorPickerApplyBtn]),onApply:ue}:void 0};return t.createElement(Ge.AdaptiveMode,{...e},t.createElement(Ke.ActionSheetContent,null,Q(!0)))},[E==null?void 0:E.animate,ne,re,f,J,z,h,v,ue,Q]),xe=t.useCallback(e=>{for(const u of e)_e(u.target.clientWidth)},[]),pe=a.useDir(s,i.dir),qe=Pe!==!1;return t.createElement("span",{id:i.id,role:"combobox","aria-label":i.ariaLabel,"aria-labelledby":i.ariaLabelledBy,"aria-describedby":i.ariaDescribedBy,"aria-haspopup":"dialog","aria-expanded":f,"aria-controls":f?`k-colorpicker-popup-${(fe=i.id)!=null?fe:0}`:void 0,"aria-disabled":F?"true":void 0,className:a.classNames("k-colorpicker","k-picker","k-icon-picker",{[`k-picker-${a.kendoThemeMaps.sizeMap[p]||p}`]:p,[`k-picker-${V}`]:V,[`k-rounded-${a.kendoThemeMaps.roundedMap[b]||b}`]:b,"k-invalid":!qe,"k-disabled":F,"k-focus":he,className:ye}),ref:s,tabIndex:a.getTabIndex(we,F),title:i.title,onKeyDown:Ie,onFocus:Oe,onBlur:ze,dir:pe},t.createElement(Ve.Picker,{dir:pe,open:f,onOpen:Be,popupAnchor:s.current||void 0,popupSettings:{id:`k-colorpicker-popup-${(ge=i.id)!=null?ge:0}`,...E},input:t.createElement("span",{onClick:Fe,className:"k-input-inner"},t.createElement("span",{className:a.classNames("k-value-icon","k-color-preview",{"k-no-color":!c,"k-icon-color-preview":H||W||O})},O&&t.createElement("span",{className:a.classNames("k-color-preview-icon",O)}),!O&&(H||W)&&t.createElement(a.IconWrap,{name:H,icon:W}),t.createElement("span",{className:"k-color-preview-mask",style:{backgroundColor:c}}))),button:t.createElement(We.Button,{tabIndex:-1,type:"button",onClick:()=>o(!f),className:"k-input-button",disabled:F,icon:"chevron-down",svgIcon:Ue.chevronDownIcon,size:p,"aria-label":v.toLanguageString(n.colorPickerDropdownButtonAriaLabel,n.messages[n.colorPickerDropdownButtonAriaLabel])}),content:Q(!1),_mobileMode:Z,_actionSheet:Ne()}))});ee.propTypes={value:l.string,defaultValue:l.string,disabled:l.bool,view:l.oneOf(["gradient","palette","combo"]),views:l.arrayOf(l.oneOf(["gradient","palette"])),dir:l.string,id:l.string,icon:l.string,svgIcon:a.svgIconPropType,ariaLabelledBy:l.string,ariaDescribedBy:l.string,size:l.oneOf(["small","medium","large"]),rounded:l.oneOf(["small","medium","large","full","none"]),fillMode:l.oneOf(["solid","flat","outline"]),className:l.string,adaptive:l.bool,adaptiveTitle:l.string,adaptiveSubtitle:l.string};const w={size:void 0,rounded:void 0,fillMode:void 0,view:"palette",views:["gradient","palette"],gradientSettings:Ze,paletteSettings:Je};ee.displayName="KendoColorPicker";exports.ColorPicker=ee;exports.ColorPickerPropsContext=Ee;
|