@progress/kendo-react-inputs 15.1.1-develop.3 → 15.2.0-develop.1

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,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 xe=require("react"),e=require("prop-types"),o=require("@progress/kendo-react-common"),Pe=require("@progress/kendo-react-intl"),B=require("../messages/index.js");function Ve(i){const u=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const s in i)if(s!=="default"){const m=Object.getOwnPropertyDescriptor(i,s);Object.defineProperty(u,s,m.get?m:{enumerable:!0,get:()=>i[s]})}}return u.default=i,Object.freeze(u)}const a=Ve(xe),Q=o.createPropsContext(),O=a.forwardRef((i,u)=>{const s=o.usePropsContext(Q,i),{ariaDescribedBy:m,ariaLabelledBy:X,checked:R,className:Y,labelClassName:Z,children:ee,defaultChecked:ae,disabled:t,defaultValue:te,id:f,size:v=J.size,rounded:C=J.rounded,label:g,labelPlacement:q,name:w,labelOptional:ne,onChange:y,onFocus:x,onBlur:P,tabIndex:oe,value:d,required:p,valid:z,validationMessage:T,validityStyles:F,autoFocus:le,visited:Me,touched:Ee,modified:Ne,webMcp:Ie,...D}=s,l=a.useRef(null),K=a.useCallback(()=>{l.current&&l.current.focus()},[]),c=a.useCallback(()=>({element:l.current,focus:K,get name(){return l.current&&l.current.name}}),[K]);a.useImperativeHandle(u,c);const j=a.useRef(null);a.useImperativeHandle(j,c),o.useWebMcpRegister("checkbox",j,s,s.webMcp);const[se,ce]=a.useState(ae),[re,ie]=a.useState(te),L=typeof d=="boolean"||d===null,V=R!==void 0,b=L,M=b?d:re,E=V?R:b?void 0:se,_=w||f,H=E===void 0&&M,U=H?M:E,k=H||b?d===null?d:void 0:d||M,de=U===null||k===null,W=o.useId(),ue=Pe.useLocalization(),$=n=>ue.toLanguageString(n,B.messages[n]),A=$(B.checkboxValidation),be=$(B.checkboxOptionalText),N=z!==void 0?z:p?!!E:!0;a.useEffect(()=>{l.current&&l.current.setCustomValidity&&l.current.setCustomValidity(N?"":T||A)},[N,T,A]);const h=a.useCallback((n,r)=>{!b&&!t&&(ie(r),!V&&!t&&ce(r)),y&&!t&&o.dispatchEvent(y,n,{...c(),value:r},{value:r})},[V,t,y,b,c]),me=a.useCallback(n=>{const r={target:l.current,currentTarget:l.current};h(r,n)},[h]);o.useKendoPaste(l,{fieldName:_,onValueChange:me,enabled:!!_});const pe=a.useCallback(n=>{const r=n.target.checked;h(n,r)},[h]),ke=a.useCallback(n=>{},[t]),he=a.useCallback(n=>{},[t]),fe=a.useCallback(n=>{x&&!t&&o.dispatchEvent(x,n,c(),void 0)},[x,t,c]),ve=a.useCallback(n=>{P&&!t&&o.dispatchEvent(P,n,c(),void 0)},[P,t,c]),Ce=o.useDir(l,s.dir),ge=o.classNames("k-checkbox-wrap",Y),G={type:"checkbox",className:o.classNames("k-checkbox",{[`k-checkbox-${o.kendoThemeMaps.sizeMap[v]||v}`]:v,[`k-rounded-${o.kendoThemeMaps.roundedMap[C]||C}`]:C,"k-indeterminate":de,"k-disabled":t,"k-invalid k-invalid":!(N||F!==void 0||F===!0)}),ref:l,name:w,id:f||W,disabled:t,required:p!==void 0?p:!1,tabIndex:o.getTabIndex(oe,t),checked:!!U,"aria-describedby":m,"aria-labelledby":X,"aria-label":D["aria-label"]||(g===void 0?"Checkbox":void 0),"aria-disabled":t||void 0,"aria-required":p,autoFocus:le,...D,onChange:pe,onKeyDown:ke,onKeyUp:he,onFocus:fe,onBlur:ve},ye=k===void 0?a.createElement("input",{...G}):a.createElement("input",{...G,value:L?void 0:k===null?"":k}),I=g!==void 0?a.createElement("label",{className:o.classNames("k-checkbox-label",Z),htmlFor:f||W,style:{userSelect:"none"}},g,ne&&a.createElement("span",{className:"k-label-optional"},be)):null,S=a.createElement("span",{className:ge},ye,ee);return q==="before"?a.createElement("div",{dir:"rtl"},S,I):q==="after"?a.createElement("div",{dir:"ltr"},S,I):a.createElement("div",{dir:Ce},S,I)});O.propTypes={checked:e.bool,className:e.string,defaultChecked:e.bool,defaultValue:e.any,dir:e.string,disabled:e.bool,id:e.string,size:e.oneOf(["small","medium","large"]),rounded:e.oneOf(["small","medium","large","none"]),ariaLabelledBy:e.string,ariaDescribedBy:e.string,label:e.any,labelPlacement:e.string,labelOptional:e.bool,name:e.string,tabIndex:e.number,value:e.any,validationMessage:e.string,required:e.bool,validate:e.bool,valid:e.bool,autoFocus:e.bool,onChange:e.func,onFocus:e.func,onBlur:e.func};const J={size:void 0,rounded:void 0};O.displayName="KendoCheckbox";exports.Checkbox=O;exports.CheckboxPropsContext=Q;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const xe=require("react"),e=require("prop-types"),o=require("@progress/kendo-react-common"),Pe=require("@progress/kendo-react-intl"),S=require("../messages/index.js");function Ve(i){const u=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const s in i)if(s!=="default"){const m=Object.getOwnPropertyDescriptor(i,s);Object.defineProperty(u,s,m.get?m:{enumerable:!0,get:()=>i[s]})}}return u.default=i,Object.freeze(u)}const a=Ve(xe),Q=o.createPropsContext(),B=a.forwardRef((i,u)=>{const s=o.usePropsContext(Q,i),{ariaDescribedBy:m,ariaLabelledBy:X,checked:O,className:Y,labelClassName:Z,children:ee,defaultChecked:ae,disabled:t,defaultValue:te,id:f,size:v=J.size,rounded:g=J.rounded,label:R,labelPlacement:q,name:w,labelOptional:ne,onChange:C,onFocus:y,onBlur:x,tabIndex:oe,value:d,required:p,valid:z,validationMessage:T,validityStyles:F,autoFocus:le,visited:Me,touched:Ee,modified:Ne,webMcp:Ie,...D}=s,l=a.useRef(null),K=a.useCallback(()=>{l.current&&l.current.focus()},[]),c=a.useCallback(()=>({element:l.current,focus:K,get name(){return l.current&&l.current.name}}),[K]);a.useImperativeHandle(u,c);const j=a.useRef(null);a.useImperativeHandle(j,c),o.useWebMcpRegister("checkbox",j,s,s.webMcp);const[se,ce]=a.useState(ae),[re,ie]=a.useState(te),L=typeof d=="boolean"||d===null,P=O!==void 0,b=L,V=b?d:re,M=P?O:b?void 0:se,_=w||f,H=M===void 0&&V,U=H?V:M,k=H||b?d===null?d:void 0:d||V,de=U===null||k===null,W=o.useId(),ue=Pe.useLocalization(),$=n=>ue.toLanguageString(n,S.messages[n]),A=$(S.checkboxValidation),be=$(S.checkboxOptionalText),E=z!==void 0?z:p?!!M:!0;a.useEffect(()=>{l.current&&l.current.setCustomValidity&&l.current.setCustomValidity(E?"":T||A)},[E,T,A]);const h=a.useCallback((n,r)=>{!b&&!t&&(ie(r),!P&&!t&&ce(r)),C&&!t&&o.dispatchEvent(C,n,{...c(),value:r},{value:r})},[P,t,C,b,c]),me=a.useCallback(n=>{const r={target:l.current,currentTarget:l.current};h(r,n)},[h]);o.useKendoPaste(l,{fieldName:_,onValueChange:me,enabled:!!_});const pe=a.useCallback(n=>{const r=n.target.checked;h(n,r)},[h]),ke=a.useCallback(n=>{},[t]),he=a.useCallback(n=>{},[t]),fe=a.useCallback(n=>{y&&!t&&o.dispatchEvent(y,n,c(),void 0)},[y,t,c]),ve=a.useCallback(n=>{x&&!t&&o.dispatchEvent(x,n,c(),void 0)},[x,t,c]),ge=o.useDir(l,s.dir),Ce=o.classNames("k-checkbox-wrap",Y),G={type:"checkbox",className:o.classNames("k-checkbox",{[`k-checkbox-${o.kendoThemeMaps.sizeMap[v]||v}`]:v,[`k-rounded-${o.kendoThemeMaps.roundedMap[g]||g}`]:g,"k-indeterminate":de,"k-disabled":t,"k-invalid k-invalid":!(E||F!==void 0||F===!0)}),ref:l,name:w,id:f||W,disabled:t,required:p!==void 0?p:!1,tabIndex:o.getTabIndex(oe,t),checked:!!U,"aria-describedby":m,"aria-labelledby":X,"aria-label":D["aria-label"],"aria-disabled":t||void 0,"aria-required":p,autoFocus:le,...D,onChange:pe,onKeyDown:ke,onKeyUp:he,onFocus:fe,onBlur:ve},ye=k===void 0?a.createElement("input",{...G}):a.createElement("input",{...G,value:L?void 0:k===null?"":k}),N=R!==void 0?a.createElement("label",{className:o.classNames("k-checkbox-label",Z),htmlFor:f||W,style:{userSelect:"none"}},R,ne&&a.createElement("span",{className:"k-label-optional"},be)):null,I=a.createElement("span",{className:Ce},ye,ee);return q==="before"?a.createElement("div",{dir:"rtl"},I,N):q==="after"?a.createElement("div",{dir:"ltr"},I,N):a.createElement("div",{dir:ge},I,N)});B.propTypes={checked:e.bool,className:e.string,defaultChecked:e.bool,defaultValue:e.any,dir:e.string,disabled:e.bool,id:e.string,size:e.oneOf(["small","medium","large"]),rounded:e.oneOf(["small","medium","large","none"]),ariaLabelledBy:e.string,ariaDescribedBy:e.string,label:e.any,labelPlacement:e.string,labelOptional:e.bool,name:e.string,tabIndex:e.number,value:e.any,validationMessage:e.string,required:e.bool,validate:e.bool,valid:e.bool,autoFocus:e.bool,onChange:e.func,onFocus:e.func,onBlur:e.func};const J={size:void 0,rounded:void 0};B.displayName="KendoCheckbox";exports.Checkbox=B;exports.CheckboxPropsContext=Q;
@@ -7,14 +7,14 @@
7
7
  */
8
8
  import * as e from "react";
9
9
  import a from "prop-types";
10
- import { usePropsContext as ye, useWebMcpRegister as Ve, useId as Pe, dispatchEvent as M, useKendoPaste as Ee, useDir as Me, classNames as B, getTabIndex as Be, kendoThemeMaps as A, createPropsContext as Ie } from "@progress/kendo-react-common";
10
+ import { usePropsContext as ye, useWebMcpRegister as Ve, useId as Pe, dispatchEvent as E, useKendoPaste as Ee, useDir as Me, classNames as M, getTabIndex as Be, kendoThemeMaps as A, createPropsContext as Ie } from "@progress/kendo-react-common";
11
11
  import { useLocalization as Ne } from "@progress/kendo-react-intl";
12
12
  import { messages as we, checkboxValidation as ze, checkboxOptionalText as Fe } from "../messages/index.mjs";
13
13
  const Se = Ie(), j = e.forwardRef((G, J) => {
14
14
  const i = ye(Se, G), {
15
15
  ariaDescribedBy: Q,
16
16
  ariaLabelledBy: X,
17
- checked: I,
17
+ checked: B,
18
18
  className: Y,
19
19
  labelClassName: Z,
20
20
  children: ee,
@@ -24,13 +24,13 @@ const Se = Ie(), j = e.forwardRef((G, J) => {
24
24
  id: m,
25
25
  size: p = _.size,
26
26
  rounded: k = _.rounded,
27
- label: h,
27
+ label: I,
28
28
  labelPlacement: N,
29
29
  name: w,
30
30
  labelOptional: oe,
31
- onChange: f,
32
- onFocus: v,
33
- onBlur: C,
31
+ onChange: h,
32
+ onFocus: f,
33
+ onBlur: v,
34
34
  tabIndex: ne,
35
35
  value: c,
36
36
  required: d,
@@ -59,14 +59,14 @@ const Se = Ie(), j = e.forwardRef((G, J) => {
59
59
  e.useImperativeHandle(J, l);
60
60
  const T = e.useRef(null);
61
61
  e.useImperativeHandle(T, l), Ve("checkbox", T, i, i.webMcp);
62
- const [se, ce] = e.useState(ae), [re, ie] = e.useState(te), D = typeof c == "boolean" || c === null, g = I !== void 0, r = D, x = r ? c : re, y = g ? I : r ? void 0 : se, L = w || m, O = y === void 0 && x, q = O ? x : y, u = O || r ? c === null ? c : void 0 : c || x, de = q === null || u === null, H = Pe(), ue = Ne(), U = (o) => ue.toLanguageString(o, we[o]), W = U(ze), be = U(Fe), V = z !== void 0 ? z : d ? !!y : !0;
62
+ const [se, ce] = e.useState(ae), [re, ie] = e.useState(te), D = typeof c == "boolean" || c === null, C = B !== void 0, r = D, g = r ? c : re, x = C ? B : r ? void 0 : se, L = w || m, O = x === void 0 && g, q = O ? g : x, u = O || r ? c === null ? c : void 0 : c || g, de = q === null || u === null, H = Pe(), ue = Ne(), U = (o) => ue.toLanguageString(o, we[o]), W = U(ze), be = U(Fe), y = z !== void 0 ? z : d ? !!x : !0;
63
63
  e.useEffect(() => {
64
- n.current && n.current.setCustomValidity && n.current.setCustomValidity(V ? "" : F || W);
65
- }, [V, F, W]);
64
+ n.current && n.current.setCustomValidity && n.current.setCustomValidity(y ? "" : F || W);
65
+ }, [y, F, W]);
66
66
  const b = e.useCallback(
67
67
  (o, s) => {
68
- !r && !t && (ie(s), !g && !t && ce(s)), f && !t && M(
69
- f,
68
+ !r && !t && (ie(s), !C && !t && ce(s)), h && !t && E(
69
+ h,
70
70
  o,
71
71
  {
72
72
  ...l(),
@@ -75,7 +75,7 @@ const Se = Ie(), j = e.forwardRef((G, J) => {
75
75
  { value: s }
76
76
  );
77
77
  },
78
- [g, t, f, r, l]
78
+ [C, t, h, r, l]
79
79
  ), me = e.useCallback(
80
80
  (o) => {
81
81
  const s = {
@@ -107,22 +107,22 @@ const Se = Ie(), j = e.forwardRef((G, J) => {
107
107
  [t]
108
108
  ), fe = e.useCallback(
109
109
  (o) => {
110
- v && !t && M(v, o, l(), void 0);
110
+ f && !t && E(f, o, l(), void 0);
111
111
  },
112
- [v, t, l]
112
+ [f, t, l]
113
113
  ), ve = e.useCallback(
114
114
  (o) => {
115
- C && !t && M(C, o, l(), void 0);
115
+ v && !t && E(v, o, l(), void 0);
116
116
  },
117
- [C, t, l]
118
- ), Ce = Me(n, i.dir), ge = B("k-checkbox-wrap", Y), $ = {
117
+ [v, t, l]
118
+ ), Ce = Me(n, i.dir), ge = M("k-checkbox-wrap", Y), $ = {
119
119
  type: "checkbox",
120
- className: B("k-checkbox", {
120
+ className: M("k-checkbox", {
121
121
  [`k-checkbox-${A.sizeMap[p] || p}`]: p,
122
122
  [`k-rounded-${A.roundedMap[k] || k}`]: k,
123
123
  "k-indeterminate": de,
124
124
  "k-disabled": t,
125
- "k-invalid k-invalid": !(V || S !== void 0 || S === !0)
125
+ "k-invalid k-invalid": !(y || S !== void 0 || S === !0)
126
126
  }),
127
127
  ref: n,
128
128
  name: w,
@@ -133,7 +133,7 @@ const Se = Ie(), j = e.forwardRef((G, J) => {
133
133
  checked: !!q,
134
134
  "aria-describedby": Q,
135
135
  "aria-labelledby": X,
136
- "aria-label": K["aria-label"] || (h === void 0 ? "Checkbox" : void 0),
136
+ "aria-label": K["aria-label"],
137
137
  "aria-disabled": t || void 0,
138
138
  "aria-required": d,
139
139
  autoFocus: le,
@@ -147,17 +147,17 @@ const Se = Ie(), j = e.forwardRef((G, J) => {
147
147
  // removing value prop is required due to bug in react where
148
148
  // value set to undefined override default submit value
149
149
  u === void 0 ? /* @__PURE__ */ e.createElement("input", { ...$ }) : /* @__PURE__ */ e.createElement("input", { ...$, value: D ? void 0 : u === null ? "" : u })
150
- ), P = h !== void 0 ? /* @__PURE__ */ e.createElement(
150
+ ), V = I !== void 0 ? /* @__PURE__ */ e.createElement(
151
151
  "label",
152
152
  {
153
- className: B("k-checkbox-label", Z),
153
+ className: M("k-checkbox-label", Z),
154
154
  htmlFor: m || H,
155
155
  style: { userSelect: "none" }
156
156
  },
157
- h,
157
+ I,
158
158
  oe && /* @__PURE__ */ e.createElement("span", { className: "k-label-optional" }, be)
159
- ) : null, E = /* @__PURE__ */ e.createElement("span", { className: ge }, xe, ee);
160
- return N === "before" ? /* @__PURE__ */ e.createElement("div", { dir: "rtl" }, E, P) : N === "after" ? /* @__PURE__ */ e.createElement("div", { dir: "ltr" }, E, P) : /* @__PURE__ */ e.createElement("div", { dir: Ce }, E, P);
159
+ ) : null, P = /* @__PURE__ */ e.createElement("span", { className: ge }, xe, ee);
160
+ return N === "before" ? /* @__PURE__ */ e.createElement("div", { dir: "rtl" }, P, V) : N === "after" ? /* @__PURE__ */ e.createElement("div", { dir: "ltr" }, P, V) : /* @__PURE__ */ e.createElement("div", { dir: Ce }, P, V);
161
161
  });
162
162
  j.propTypes = {
163
163
  checked: a.bool,
@@ -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"),r=require("prop-types"),n=require("@progress/kendo-react-common"),be=require("../package-metadata.js"),Ve=require("./Picker.js"),He=require("./ColorGradient.js"),Y=require("./ColorPalette.js"),q=require("./FlatColorPicker.js"),We=require("@progress/kendo-react-buttons"),Ue=require("@progress/kendo-svg-icons"),u=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 _=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(g){for(const P in g)if(P!=="default"){const B=Object.getOwnPropertyDescriptor(g,P);Object.defineProperty(_,P,B.get?B:{enumerable:!0,get:()=>g[P]})}}return _.default=g,Object.freeze(_)}const t=$e(Me),Ze={opacity:!0},Je={palette:Y.DEFAULT_PRESET,tileSize:Y.DEFAULT_TILE_SIZE},X=g=>g!==void 0,Ee=n.createPropsContext(),ee=t.forwardRef((g,_)=>{var fe,ge;const P=!n.validatePackage(be.packageMetadata,{component:"ColorPicker"}),B=n.getLicenseMessage(be.packageMetadata),l=n.usePropsContext(Ee,g),y=je.useLocalization(),te=n.useAdaptiveModeContext(),{size:p=w.size,rounded:C=w.rounded,fillMode:M=w.fillMode,gradientSettings:S=w.gradientSettings,paletteSettings:R=w.paletteSettings,flatColorPickerSettings:A,view:v=l.views?void 0:w.view,views:d=v?void 0:w.views,activeView:ne,popupSettings:b,valid:we,disabled:V,tabIndex:Pe,icon:H,svgIcon:W,iconClassName:F,onChange:U,onFocus:j,onBlur:G,onActiveColorClick:K,className:ye,adaptive:Se,adaptiveTitle:ae=y.toLanguageString(u.colorPickerAdaptiveTitle,u.messages[u.colorPickerAdaptiveTitle]),adaptiveSubtitle:oe,showButtons:h=!0}=l,c=t.useRef(null),I=t.useRef(null),O=t.useRef(null),m=t.useRef(null),T=t.useRef(void 0),re=t.useRef(null),[he,le]=t.useState(!1),[Te,_e]=t.useState(l.defaultValue||void 0),[Re,Ae]=t.useState(!1),[D,Ie]=t.useState(),$=X(l.value),E=X(l.open),i=$?l.value:Te,f=E?l.open:Re,ie=t.useRef(i),z=t.useCallback(()=>{c.current&&c.current.focus()},[]);t.useImperativeHandle(_,()=>({element:c.current,actionElement:re.current,value:i,focus:z}),[i,z]);const ce=t.useRef(null);t.useImperativeHandle(ce,()=>({element:c.current,actionElement:re.current,value:i,focus:z}),[i,z]),n.useWebMcpRegister("colorpicker",ce,l,l.webMcp);const Z=!!(D&&te&&D<=te.medium&&Se);t.useEffect(()=>{const e=n.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,s)=>{E||(!e&&!s&&c&&c.current&&c.current.focus(),Ae(e))},[E]),se=t.useMemo(()=>new n.Navigation({root:c,selectors:[".k-colorpicker",".k-color-picker-popup"],tabIndex:0,keyboardEvents:{keydown:{Escape:(e,s,a)=>{o(!1)},Enter:(e,s,a)=>{!E&&e===c.current&&(a.preventDefault(),a.stopPropagation(),o(!0))},ArrowDown:(e,s,a)=>{a.altKey&&(a.preventDefault(),a.stopPropagation(),o(!0))},ArrowUp:(e,s,a)=>{a.altKey&&(a.preventDefault(),a.stopPropagation(),o(!1))},Tab:(e,s,a)=>{var L,ve,ke;if(n.getActiveElement(document)!==c.current){const me=(L=O.current)==null?void 0:L.wrapperRef.current,x=(ve=I.current)==null?void 0:ve.wrapperRef.current,Ce=(ke=m.current)==null?void 0:ke.element;v==="palette"&&me?n.keepFocusInContainer(a,me):v==="gradient"&&x?n.keepFocusInContainer(a,x):v==="combo"&&x?n.keepFocusInContainer(a,x.parentElement):d&&Ce&&n.keepFocusInContainer(a,Ce)}}}}}),[o,E]),Le=t.useCallback(se.triggerKeyboardEvent.bind(se),[]),Be=t.useCallback(()=>{E||(I.current&&I.current.wrapperRef.current?n.focusFirstFocusableChild(I.current.wrapperRef.current):O.current?O.current.focus():m.current&&m.current.element&&n.focusFirstFocusableChild(m.current.element))},[E]),N=e=>ie.current=e,ue=t.useCallback(e=>{const s={value:ie.current,nativeEvent:e.nativeEvent,syntheticEvent:e};k(s),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:i,target:{element:c.current,value:i}})},[K,i]),Oe=t.useCallback(e=>{T.current?(clearTimeout(T.current),T.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),T.current=void 0},[]),ze=t.useCallback(e=>{clearTimeout(T.current),T.current=window.setTimeout(De),G&&G.call(void 0,{nativeEvent:e.nativeEvent,syntheticEvent:e})},[G]),k=t.useCallback((e,s)=>{var L;const a=s?e.rgbaValue||"":(L=e.value)!=null?L:"";$||_e(a),U&&U.call(void 0,{value:a,nativeEvent:e.nativeEvent,syntheticEvent:e.syntheticEvent,target:{element:c.current,value:a}}),o(!1)},[$,U]),de=t.useCallback(e=>k(e,!0),[X,k]),Q=t.useCallback(e=>t.createElement(t.Fragment,null,(v==="combo"||v==="gradient")&&t.createElement(He.ColorGradient,{...S,_adaptive:e,ref:I,isInsidePopup:!0,role:"none",ariaLabel:void 0,size:e?"large":p,value:i,onChange:k}),(v==="combo"||v==="palette")&&t.createElement(Y.ColorPalette,{...R,ref:O,size:e?"large":p,value:i,onChange:de}),d&&d[0]==="gradient"&&d[1]==="palette"&&t.createElement(q.FlatColorPicker,{...A,_paletteSettings:R,_gradientSettings:{_adaptive:e,...S},ref:m,size:e?"large":p,rounded:C,views:["gradient","palette"],activeView:ne,setOpen:o,showButtons:e?!1:h,value:i,onChange:k,setAdaptiveModeValue:N}),d&&d[0]==="palette"&&d[1]==="gradient"&&t.createElement(q.FlatColorPicker,{...A,_paletteSettings:R,_gradientSettings:{_adaptive:e,...S},ref:m,size:e?"large":p,rounded:C,views:["palette","gradient"],setOpen:o,showButtons:e?!1:h,value:i,onChange:k,setAdaptiveModeValue:N}),d&&d.includes("gradient")&&!d.includes("palette")&&t.createElement(q.FlatColorPicker,{...A,_gradientSettings:{_adaptive:e,...S},ref:m,size:e?"large":p,rounded:C,views:["gradient"],showButtons:e?!1:h,setOpen:o,value:i,onChange:k,setAdaptiveModeValue:N}),d&&d.includes("palette")&&!d.includes("gradient")&&t.createElement(q.FlatColorPicker,{...A,_paletteSettings:R,_gradientSettings:{_adaptive:e,...S},ref:m,size:e?"large":p,rounded:C,views:["palette"],showButtons:e?!1:h,setOpen:o,value:i,onChange:k,setAdaptiveModeValue:N}),P&&t.createElement(n.WatermarkOverlay,{message:B})),[ne,M,A,S,k,de,R,o,p,i,v,d]),Ne=t.useCallback(()=>{var s;const e={animation:!!((s=b==null?void 0:b.animate)==null||s),title:ae,subTitle:oe,expand:f,onClose:J,windowWidth:D,footer:h?{cancelText:y.toLanguageString(u.flatColorPickerCancelBtn,u.messages[u.flatColorPickerCancelBtn]),onCancel:J,applyText:y.toLanguageString(u.flatColorPickerApplyBtn,u.messages[u.flatColorPickerApplyBtn]),onApply:ue}:void 0};return t.createElement(Ge.AdaptiveMode,{...e},t.createElement(Ke.ActionSheetContent,null,Q(!0)))},[b==null?void 0:b.animate,ae,oe,f,J,D,h,y,ue,Q]),xe=t.useCallback(e=>{for(const s of e)Ie(s.target.clientWidth)},[]),pe=n.useDir(c,l.dir),qe=we!==!1;return t.createElement("span",{id:l.id,role:"combobox","aria-label":l.ariaLabel||y.toLanguageString(u.colorPickerAriaLabel,u.messages[u.colorPickerAriaLabel]),"aria-labelledby":l.ariaLabelledBy,"aria-describedby":l.ariaDescribedBy,"aria-haspopup":"dialog","aria-expanded":f,"aria-controls":f?`k-colorpicker-popup-${(fe=l.id)!=null?fe:0}`:void 0,"aria-disabled":V?"true":void 0,className:n.classNames("k-colorpicker","k-picker","k-icon-picker",{[`k-picker-${n.kendoThemeMaps.sizeMap[p]||p}`]:p,[`k-picker-${M}`]:M,[`k-rounded-${n.kendoThemeMaps.roundedMap[C]||C}`]:C,"k-invalid":!qe,"k-disabled":V,"k-focus":he,className:ye}),ref:c,tabIndex:n.getTabIndex(Pe,V),title:l.title,onKeyDown:Le,onFocus:Oe,onBlur:ze,dir:pe},t.createElement(Ve.Picker,{dir:pe,open:f,onOpen:Be,popupAnchor:c.current||void 0,popupSettings:{id:`k-colorpicker-popup-${(ge=l.id)!=null?ge:0}`,...b},input:t.createElement("span",{onClick:Fe,className:"k-input-inner"},t.createElement("span",{className:n.classNames("k-value-icon","k-color-preview",{"k-no-color":!i,"k-icon-color-preview":H||W||F})},F&&t.createElement("span",{className:n.classNames("k-color-preview-icon",F)}),!F&&(H||W)&&t.createElement(n.IconWrap,{name:H,icon:W}),t.createElement("span",{className:"k-color-preview-mask",style:{backgroundColor:i}}))),button:t.createElement(We.Button,{tabIndex:-1,type:"button",onClick:()=>o(!f),className:"k-input-button",icon:"chevron-down",svgIcon:Ue.chevronDownIcon,size:p,"aria-label":y.toLanguageString(u.colorPickerDropdownButtonAriaLabel,u.messages[u.colorPickerDropdownButtonAriaLabel])}),content:Q(!1),_mobileMode:Z,_actionSheet:Ne()}))});ee.propTypes={value:r.string,defaultValue:r.string,disabled:r.bool,view:r.oneOf(["gradient","palette","combo"]),views:r.arrayOf(r.oneOf(["gradient","palette"])),dir:r.string,id:r.string,icon:r.string,svgIcon:n.svgIconPropType,ariaLabelledBy:r.string,ariaDescribedBy:r.string,size:r.oneOf(["small","medium","large"]),rounded:r.oneOf(["small","medium","large","full","none"]),fillMode:r.oneOf(["solid","flat","outline"]),className:r.string,adaptive:r.bool,adaptiveTitle:r.string,adaptiveSubtitle:r.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;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Me=require("react"),r=require("prop-types"),n=require("@progress/kendo-react-common"),be=require("../package-metadata.js"),Ve=require("./Picker.js"),He=require("./ColorGradient.js"),Y=require("./ColorPalette.js"),q=require("./FlatColorPicker.js"),We=require("@progress/kendo-react-buttons"),Ue=require("@progress/kendo-svg-icons"),d=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 P in g)if(P!=="default"){const F=Object.getOwnPropertyDescriptor(g,P);Object.defineProperty(T,P,F.get?F:{enumerable:!0,get:()=>g[P]})}}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=n.createPropsContext(),ee=t.forwardRef((g,T)=>{var fe,ge;const P=!n.validatePackage(be.packageMetadata,{component:"ColorPicker"}),F=n.getLicenseMessage(be.packageMetadata),l=n.usePropsContext(Ee,g),_=je.useLocalization(),te=n.useAdaptiveModeContext(),{size:p=w.size,rounded:C=w.rounded,fillMode:M=w.fillMode,gradientSettings:y=w.gradientSettings,paletteSettings:R=w.paletteSettings,flatColorPickerSettings:A,view:v=l.views?void 0:w.view,views:u=v?void 0:w.views,activeView:ne,popupSettings:b,valid:we,disabled:V,tabIndex:Pe,icon:H,svgIcon:W,iconClassName:O,onChange:U,onFocus:j,onBlur:G,onActiveColorClick:K,className:ye,adaptive:Se,adaptiveTitle:ae=_.toLanguageString(d.colorPickerAdaptiveTitle,d.messages[d.colorPickerAdaptiveTitle]),adaptiveSubtitle:oe,showButtons:S=!0}=l,c=t.useRef(null),I=t.useRef(null),L=t.useRef(null),m=t.useRef(null),h=t.useRef(void 0),re=t.useRef(null),[he,le]=t.useState(!1),[Te,_e]=t.useState(l.defaultValue||void 0),[Re,Ae]=t.useState(!1),[D,Ie]=t.useState(),$=X(l.value),E=X(l.open),i=$?l.value:Te,f=E?l.open:Re,ie=t.useRef(i),z=t.useCallback(()=>{c.current&&c.current.focus()},[]);t.useImperativeHandle(T,()=>({element:c.current,actionElement:re.current,value:i,focus:z}),[i,z]);const ce=t.useRef(null);t.useImperativeHandle(ce,()=>({element:c.current,actionElement:re.current,value:i,focus:z}),[i,z]),n.useWebMcpRegister("colorpicker",ce,l,l.webMcp);const Z=!!(D&&te&&D<=te.medium&&Se);t.useEffect(()=>{const e=n.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,s)=>{E||(!e&&!s&&c&&c.current&&c.current.focus(),Ae(e))},[E]),se=t.useMemo(()=>new n.Navigation({root:c,selectors:[".k-colorpicker",".k-color-picker-popup"],tabIndex:0,keyboardEvents:{keydown:{Escape:(e,s,a)=>{o(!1)},Enter:(e,s,a)=>{!E&&e===c.current&&(a.preventDefault(),a.stopPropagation(),o(!0))},ArrowDown:(e,s,a)=>{a.altKey&&(a.preventDefault(),a.stopPropagation(),o(!0))},ArrowUp:(e,s,a)=>{a.altKey&&(a.preventDefault(),a.stopPropagation(),o(!1))},Tab:(e,s,a)=>{var B,ve,ke;if(n.getActiveElement(document)!==c.current){const me=(B=L.current)==null?void 0:B.wrapperRef.current,x=(ve=I.current)==null?void 0:ve.wrapperRef.current,Ce=(ke=m.current)==null?void 0:ke.element;v==="palette"&&me?n.keepFocusInContainer(a,me):v==="gradient"&&x?n.keepFocusInContainer(a,x):v==="combo"&&x?n.keepFocusInContainer(a,x.parentElement):u&&Ce&&n.keepFocusInContainer(a,Ce)}}}}}),[o,E]),Be=t.useCallback(se.triggerKeyboardEvent.bind(se),[]),Fe=t.useCallback(()=>{E||(I.current&&I.current.wrapperRef.current?n.focusFirstFocusableChild(I.current.wrapperRef.current):L.current?L.current.focus():m.current&&m.current.element&&n.focusFirstFocusableChild(m.current.element))},[E]),N=e=>ie.current=e,ue=t.useCallback(e=>{const s={value:ie.current,nativeEvent:e.nativeEvent,syntheticEvent:e};k(s),o(!f,!0)},[f]),J=t.useCallback(()=>{o(!1,!0)},[o]),Oe=t.useCallback(e=>{K&&K.call(void 0,{syntheticEvent:e,nativeEvent:e.nativeEvent,value:i,target:{element:c.current,value:i}})},[K,i]),Le=t.useCallback(e=>{h.current?(clearTimeout(h.current),h.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),h.current=void 0},[]),ze=t.useCallback(e=>{clearTimeout(h.current),h.current=window.setTimeout(De),G&&G.call(void 0,{nativeEvent:e.nativeEvent,syntheticEvent:e})},[G]),k=t.useCallback((e,s)=>{var B;const a=s?e.rgbaValue||"":(B=e.value)!=null?B:"";$||_e(a),U&&U.call(void 0,{value:a,nativeEvent:e.nativeEvent,syntheticEvent:e.syntheticEvent,target:{element:c.current,value:a}}),o(!1)},[$,U]),de=t.useCallback(e=>k(e,!0),[X,k]),Q=t.useCallback(e=>t.createElement(t.Fragment,null,(v==="combo"||v==="gradient")&&t.createElement(He.ColorGradient,{...y,_adaptive:e,ref:I,isInsidePopup:!0,role:"none",ariaLabel:void 0,size:e?"large":p,value:i,onChange:k}),(v==="combo"||v==="palette")&&t.createElement(Y.ColorPalette,{...R,ref:L,size:e?"large":p,value:i,onChange:de}),u&&u[0]==="gradient"&&u[1]==="palette"&&t.createElement(q.FlatColorPicker,{...A,_paletteSettings:R,_gradientSettings:{_adaptive:e,...y},ref:m,size:e?"large":p,rounded:C,views:["gradient","palette"],activeView:ne,setOpen:o,showButtons:e?!1:S,value:i,onChange:k,setAdaptiveModeValue:N}),u&&u[0]==="palette"&&u[1]==="gradient"&&t.createElement(q.FlatColorPicker,{...A,_paletteSettings:R,_gradientSettings:{_adaptive:e,...y},ref:m,size:e?"large":p,rounded:C,views:["palette","gradient"],setOpen:o,showButtons:e?!1:S,value:i,onChange:k,setAdaptiveModeValue:N}),u&&u.includes("gradient")&&!u.includes("palette")&&t.createElement(q.FlatColorPicker,{...A,_gradientSettings:{_adaptive:e,...y},ref:m,size:e?"large":p,rounded:C,views:["gradient"],showButtons:e?!1:S,setOpen:o,value:i,onChange:k,setAdaptiveModeValue:N}),u&&u.includes("palette")&&!u.includes("gradient")&&t.createElement(q.FlatColorPicker,{...A,_paletteSettings:R,_gradientSettings:{_adaptive:e,...y},ref:m,size:e?"large":p,rounded:C,views:["palette"],showButtons:e?!1:S,setOpen:o,value:i,onChange:k,setAdaptiveModeValue:N}),P&&t.createElement(n.WatermarkOverlay,{message:F})),[ne,M,A,y,k,de,R,o,p,i,v,u]),Ne=t.useCallback(()=>{var s;const e={animation:!!((s=b==null?void 0:b.animate)==null||s),title:ae,subTitle:oe,expand:f,onClose:J,windowWidth:D,footer:S?{cancelText:_.toLanguageString(d.flatColorPickerCancelBtn,d.messages[d.flatColorPickerCancelBtn]),onCancel:J,applyText:_.toLanguageString(d.flatColorPickerApplyBtn,d.messages[d.flatColorPickerApplyBtn]),onApply:ue}:void 0};return t.createElement(Ge.AdaptiveMode,{...e},t.createElement(Ke.ActionSheetContent,null,Q(!0)))},[b==null?void 0:b.animate,ae,oe,f,J,D,S,_,ue,Q]),xe=t.useCallback(e=>{for(const s of e)Ie(s.target.clientWidth)},[]),pe=n.useDir(c,l.dir),qe=we!==!1;return t.createElement("span",{id:l.id,role:"combobox","aria-label":l.ariaLabel,"aria-labelledby":l.ariaLabelledBy,"aria-describedby":l.ariaDescribedBy,"aria-haspopup":"dialog","aria-expanded":f,"aria-controls":f?`k-colorpicker-popup-${(fe=l.id)!=null?fe:0}`:void 0,"aria-disabled":V?"true":void 0,className:n.classNames("k-colorpicker","k-picker","k-icon-picker",{[`k-picker-${n.kendoThemeMaps.sizeMap[p]||p}`]:p,[`k-picker-${M}`]:M,[`k-rounded-${n.kendoThemeMaps.roundedMap[C]||C}`]:C,"k-invalid":!qe,"k-disabled":V,"k-focus":he,className:ye}),ref:c,tabIndex:n.getTabIndex(Pe,V),title:l.title,onKeyDown:Be,onFocus:Le,onBlur:ze,dir:pe},t.createElement(Ve.Picker,{dir:pe,open:f,onOpen:Fe,popupAnchor:c.current||void 0,popupSettings:{id:`k-colorpicker-popup-${(ge=l.id)!=null?ge:0}`,...b},input:t.createElement("span",{onClick:Oe,className:"k-input-inner"},t.createElement("span",{className:n.classNames("k-value-icon","k-color-preview",{"k-no-color":!i,"k-icon-color-preview":H||W||O})},O&&t.createElement("span",{className:n.classNames("k-color-preview-icon",O)}),!O&&(H||W)&&t.createElement(n.IconWrap,{name:H,icon:W}),t.createElement("span",{className:"k-color-preview-mask",style:{backgroundColor:i}}))),button:t.createElement(We.Button,{tabIndex:-1,type:"button",onClick:()=>o(!f),className:"k-input-button",icon:"chevron-down",svgIcon:Ue.chevronDownIcon,size:p,"aria-label":_.toLanguageString(d.colorPickerDropdownButtonAriaLabel,d.messages[d.colorPickerDropdownButtonAriaLabel])}),content:Q(!1),_mobileMode:Z,_actionSheet:Ne()}))});ee.propTypes={value:r.string,defaultValue:r.string,disabled:r.bool,view:r.oneOf(["gradient","palette","combo"]),views:r.arrayOf(r.oneOf(["gradient","palette"])),dir:r.string,id:r.string,icon:r.string,svgIcon:n.svgIconPropType,ariaLabelledBy:r.string,ariaDescribedBy:r.string,size:r.oneOf(["small","medium","large"]),rounded:r.oneOf(["small","medium","large","full","none"]),fillMode:r.oneOf(["solid","flat","outline"]),className:r.string,adaptive:r.bool,adaptiveTitle:r.string,adaptiveSubtitle:r.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;