@progress/kendo-react-inputs 9.4.0-develop.27 → 9.4.0-develop.29

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 De=require("react"),o=require("prop-types"),n=require("@progress/kendo-react-common"),ze=require("../package-metadata.js"),Ne=require("./Picker.js"),Le=require("./ColorGradient.js"),K=require("./ColorPalette.js"),O=require("./FlatColorPicker.js"),xe=require("@progress/kendo-react-buttons"),qe=require("@progress/kendo-svg-icons"),d=require("../messages/index.js"),Ve=require("@progress/kendo-react-intl"),He=require("../common/AdaptiveMode.js"),Me=require("@progress/kendo-react-layout");function Ue(f){const y=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(f){for(const a in f)if(a!=="default"){const k=Object.getOwnPropertyDescriptor(f,a);Object.defineProperty(y,a,k.get?k:{enumerable:!0,get:()=>f[a]})}}return y.default=f,Object.freeze(y)}const t=Ue(De),je={opacity:!0},Ge={palette:K.DEFAULT_PRESET,tileSize:K.DEFAULT_TILE_SIZE},G=f=>f!==void 0,pe=n.createPropsContext(),W=t.forwardRef((f,y)=>{var le,ce;n.validatePackage(ze.packageMetadata);const a=n.usePropsContext(pe,f),k=Ve.useLocalization(),$=n.useAdaptiveModeContext(),{size:p=w.size,rounded:D=w.rounded,fillMode:_=w.fillMode,gradientSettings:Z=w.gradientSettings,paletteSettings:J=w.paletteSettings,flatColorPickerSettings:S,view:g=a.views?void 0:w.view,views:s=g?void 0:w.views,activeView:Q,popupSettings:C,valid:fe,disabled:z,tabIndex:ge,icon:N,svgIcon:L,iconClassName:R,onChange:x,onFocus:q,onBlur:V,onActiveColorClick:H,className:ve,adaptive:ke,adaptiveTitle:X=k.toLanguageString(d.colorPickerAdaptiveTitle,d.messages[d.colorPickerAdaptiveTitle])}=a,u=t.useRef(null),T=t.useRef(null),A=t.useRef(null),m=t.useRef(null),P=t.useRef(),me=t.useRef(null),[Ce,Y]=t.useState(!1),[be,Ee]=t.useState(a.defaultValue),[we,Pe]=t.useState(!1),[I,ye]=t.useState(),M=G(a.value),b=G(a.open),l=M?a.value:be,E=b?a.open:we,ee=t.useRef(l),te=t.useCallback(()=>{u.current&&u.current.focus()},[]);t.useImperativeHandle(y,()=>({element:u.current,actionElement:me.current,value:l,focus:te}),[l,te]);const Se=!!(I&&$&&I<=$.medium&&ke);t.useEffect(()=>{const e=n.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(Be.bind(void 0));return document!=null&&document.body&&e&&e.observe(document.body),()=>{document!=null&&document.body&&e&&e.disconnect()}},[]);const c=t.useCallback((e,i)=>{b||(!e&&!i&&u&&u.current&&u.current.focus(),Pe(e))},[b]),ne=t.useMemo(()=>new n.Navigation({root:u,selectors:[".k-colorpicker",".k-color-picker-popup"],tabIndex:0,keyboardEvents:{keydown:{Escape:(e,i,r)=>{c(!1)},Enter:(e,i,r)=>{!b&&e===u.current&&(r.preventDefault(),r.stopPropagation(),c(!0))},ArrowDown:(e,i,r)=>{r.altKey&&(r.preventDefault(),r.stopPropagation(),c(!0))},ArrowUp:(e,i,r)=>{r.altKey&&(r.preventDefault(),r.stopPropagation(),c(!1))},Tab:(e,i,r)=>{var h,ie,se;if(n.getActiveElement(document)!==u.current){const ue=(h=A.current)==null?void 0:h.wrapperRef.current,B=(ie=T.current)==null?void 0:ie.wrapperRef.current,de=(se=m.current)==null?void 0:se.element;g==="palette"&&ue?n.keepFocusInContainer(r,ue):g==="gradient"&&B?n.keepFocusInContainer(r,B):g==="combo"&&B?n.keepFocusInContainer(r,B.parentElement):s&&de&&n.keepFocusInContainer(r,de)}}}}}),[c,b]),Te=t.useCallback(ne.triggerKeyboardEvent.bind(ne),[]),he=t.useCallback(()=>{b||(T.current&&T.current.wrapperRef.current?n.focusFirstFocusableChild(T.current.wrapperRef.current):A.current?A.current.focus():m.current&&m.current.element&&n.focusFirstFocusableChild(m.current.element))},[b]),F=e=>ee.current=e,ae=t.useCallback(e=>{const i={value:ee.current,nativeEvent:e.nativeEvent,syntheticEvent:e};v(i),c(!E,!0)},[E]),U=t.useCallback(()=>{c(!1,!0)},[c]),_e=t.useCallback(e=>{H&&H.call(void 0,{syntheticEvent:e,nativeEvent:e.nativeEvent,value:l,target:{element:u.current,value:l}})},[H,l]),Re=t.useCallback(e=>{P.current?(clearTimeout(P.current),P.current=void 0):Y(!0),q&&q.call(void 0,{nativeEvent:e.nativeEvent,syntheticEvent:e})},[q]),Ae=t.useCallback(()=>{c(!1,!0),Y(!1),P.current=void 0},[]),Ie=t.useCallback(e=>{clearTimeout(P.current),P.current=window.setTimeout(Ae),V&&V.call(void 0,{nativeEvent:e.nativeEvent,syntheticEvent:e})},[V]),v=t.useCallback((e,i)=>{var h;const r=i?e.rgbaValue||"":(h=e.value)!=null?h:"";M||Ee(r),x&&x.call(void 0,{value:r,nativeEvent:e.nativeEvent,syntheticEvent:e.syntheticEvent,target:{element:u.current,value:r}}),c(!1)},[M,x]),re=t.useCallback(e=>v(e,!0),[G,v]),j=t.useCallback(e=>t.createElement(t.Fragment,null,(g==="combo"||g==="gradient")&&t.createElement(Le.ColorGradient,{...Z,_adaptive:e,ref:T,isInsidePopup:!0,size:e?"large":p,fillMode:_,value:l,onChange:v}),(g==="combo"||g==="palette")&&t.createElement(K.ColorPalette,{...J,ref:A,size:e?"large":p,value:l,onChange:re}),s&&s[0]==="gradient"&&s[1]==="palette"&&t.createElement(O.FlatColorPicker,{...S,_gradientSettings:{_adaptive:e},ref:m,size:e?"large":p,views:["gradient","palette"],activeView:Q,setOpen:c,showButtons:!e,value:l,onChange:v,setAdaptiveModeValue:F}),s&&s[0]==="palette"&&s[1]==="gradient"&&t.createElement(O.FlatColorPicker,{...S,_gradientSettings:{_adaptive:e},ref:m,size:e?"large":p,views:["palette","gradient"],setOpen:c,showButtons:!e,value:l,onChange:v,setAdaptiveModeValue:F}),s&&s.includes("gradient")&&!s.includes("palette")&&t.createElement(O.FlatColorPicker,{...S,_gradientSettings:{_adaptive:e},ref:m,size:e?"large":p,views:["gradient"],showButtons:!e,setOpen:c,value:l,onChange:v,setAdaptiveModeValue:F}),s&&s.includes("palette")&&!s.includes("gradient")&&t.createElement(O.FlatColorPicker,{...S,_gradientSettings:{_adaptive:e},ref:m,size:e?"large":p,views:["palette"],showButtons:!e,setOpen:c,value:l,onChange:v,setAdaptiveModeValue:F})),[Q,_,S,Z,v,re,J,p,l,g,s]),Fe=t.useCallback(()=>{var i;const e={animation:!!((i=C==null?void 0:C.animate)==null||i),title:X,expand:E,onClose:U,windowWidth:I,footer:{cancelText:k.toLanguageString(d.flatColorPickerCancelBtn,d.messages[d.flatColorPickerCancelBtn]),onCancel:U,applyText:k.toLanguageString(d.flatColorPickerApplyBtn,d.messages[d.flatColorPickerApplyBtn]),onApply:ae}};return t.createElement(He.AdaptiveMode,{...e},t.createElement(Me.ActionSheetContent,{overflowHidden:!0},j(!0)))},[C==null?void 0:C.animate,X,E,U,I,k,ae,j]),Be=t.useCallback(e=>{for(const i of e)ye(i.target.clientWidth)},[]),oe=n.useDir(u,a.dir),Oe=fe!==!1;return t.createElement("span",{id:a.id,role:"combobox","aria-label":a.ariaLabel,"aria-labelledby":a.ariaLabelledBy,"aria-describedby":a.ariaDescribedBy,"aria-haspopup":"dialog","aria-expanded":E,"aria-controls":`k-colorpicker-popup-${(le=a.id)!=null?le:0}`,"aria-disabled":z?"true":void 0,className:n.classNames("k-colorpicker","k-picker","k-icon-picker",{[`k-picker-${n.kendoThemeMaps.sizeMap[p]||p}`]:p,[`k-picker-${_}`]:_,[`k-rounded-${n.kendoThemeMaps.roundedMap[D]||D}`]:D,"k-invalid":!Oe,"k-disabled":z,"k-focus":Ce,className:ve}),ref:u,tabIndex:n.getTabIndex(ge,z),title:a.title,onKeyDown:Te,onFocus:Re,onBlur:Ie,dir:oe},t.createElement(Ne.Picker,{dir:oe,open:E,onOpen:he,popupAnchor:u.current||void 0,popupSettings:{id:`k-colorpicker-popup-${(ce=a.id)!=null?ce:0}`,...C},input:t.createElement("span",{onClick:_e,className:"k-input-inner"},t.createElement("span",{className:n.classNames("k-value-icon","k-color-preview",{"k-no-color":!l,"k-icon-color-preview":N||L||R})},R&&t.createElement("span",{className:n.classNames("k-color-preview-icon",R)}),!R&&(N||L)&&t.createElement(n.IconWrap,{name:N,icon:L}),t.createElement("span",{className:"k-color-preview-mask",style:{backgroundColor:l}}))),button:t.createElement(xe.Button,{tabIndex:-1,type:"button",onClick:()=>c(!E),className:"k-input-button",rounded:null,icon:"caret-alt-down",svgIcon:qe.caretAltDownIcon,"aria-label":k.toLanguageString(d.colorPickerDropdownButtonAriaLabel,d.messages[d.colorPickerDropdownButtonAriaLabel])}),content:j(!1),_mobileMode:Se,_actionSheet:Fe()}))});W.propTypes={value:o.string,defaultValue:o.string,disabled:o.bool,view:o.oneOf(["gradient","palette","combo"]),views:o.arrayOf(o.oneOf(["gradient","palette"])),dir:o.string,id:o.string,icon:o.string,svgIcon:n.svgIconPropType,ariaLabelledBy:o.string,ariaDescribedBy:o.string,size:o.oneOf([null,"small","medium","large"]),rounded:o.oneOf([null,"small","medium","large","full"]),fillMode:o.oneOf([null,"solid","flat","outline"]),className:o.string,adaptive:o.bool,adaptiveTitle:o.string};const w={size:"medium",rounded:"medium",fillMode:"solid",view:"palette",views:["gradient","palette"],gradientSettings:je,paletteSettings:Ge};W.displayName="KendoColorPicker";exports.ColorPicker=W;exports.ColorPickerPropsContext=pe;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const De=require("react"),o=require("prop-types"),n=require("@progress/kendo-react-common"),ze=require("../package-metadata.js"),Ne=require("./Picker.js"),Le=require("./ColorGradient.js"),W=require("./ColorPalette.js"),D=require("./FlatColorPicker.js"),xe=require("@progress/kendo-react-buttons"),qe=require("@progress/kendo-svg-icons"),d=require("../messages/index.js"),Ve=require("@progress/kendo-react-intl"),He=require("../common/AdaptiveMode.js"),Me=require("@progress/kendo-react-layout");function Ue(f){const S=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(f){for(const a in f)if(a!=="default"){const k=Object.getOwnPropertyDescriptor(f,a);Object.defineProperty(S,a,k.get?k:{enumerable:!0,get:()=>f[a]})}}return S.default=f,Object.freeze(S)}const t=Ue(De),je={opacity:!0},Ge={palette:W.DEFAULT_PRESET,tileSize:W.DEFAULT_TILE_SIZE},K=f=>f!==void 0,pe=n.createPropsContext(),$=t.forwardRef((f,S)=>{var le,ce;n.validatePackage(ze.packageMetadata);const a=n.usePropsContext(pe,f),k=Ve.useLocalization(),Z=n.useAdaptiveModeContext(),{size:p=w.size,rounded:z=w.rounded,fillMode:R=w.fillMode,gradientSettings:P=w.gradientSettings,paletteSettings:J=w.paletteSettings,flatColorPickerSettings:T,view:g=a.views?void 0:w.view,views:s=g?void 0:w.views,activeView:Q,popupSettings:C,valid:fe,disabled:N,tabIndex:ge,icon:L,svgIcon:x,iconClassName:A,onChange:q,onFocus:V,onBlur:H,onActiveColorClick:M,className:ve,adaptive:ke,adaptiveTitle:X=k.toLanguageString(d.colorPickerAdaptiveTitle,d.messages[d.colorPickerAdaptiveTitle])}=a,u=t.useRef(null),h=t.useRef(null),I=t.useRef(null),m=t.useRef(null),y=t.useRef(),me=t.useRef(null),[Ce,Y]=t.useState(!1),[be,Ee]=t.useState(a.defaultValue),[we,Pe]=t.useState(!1),[F,ye]=t.useState(),U=K(a.value),b=K(a.open),c=U?a.value:be,E=b?a.open:we,ee=t.useRef(c),te=t.useCallback(()=>{u.current&&u.current.focus()},[]);t.useImperativeHandle(S,()=>({element:u.current,actionElement:me.current,value:c,focus:te}),[c,te]);const Se=!!(F&&Z&&F<=Z.medium&&ke);t.useEffect(()=>{const e=n.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(Be.bind(void 0));return document!=null&&document.body&&e&&e.observe(document.body),()=>{document!=null&&document.body&&e&&e.disconnect()}},[]);const l=t.useCallback((e,i)=>{b||(!e&&!i&&u&&u.current&&u.current.focus(),Pe(e))},[b]),ne=t.useMemo(()=>new n.Navigation({root:u,selectors:[".k-colorpicker",".k-color-picker-popup"],tabIndex:0,keyboardEvents:{keydown:{Escape:(e,i,r)=>{l(!1)},Enter:(e,i,r)=>{!b&&e===u.current&&(r.preventDefault(),r.stopPropagation(),l(!0))},ArrowDown:(e,i,r)=>{r.altKey&&(r.preventDefault(),r.stopPropagation(),l(!0))},ArrowUp:(e,i,r)=>{r.altKey&&(r.preventDefault(),r.stopPropagation(),l(!1))},Tab:(e,i,r)=>{var _,ie,se;if(n.getActiveElement(document)!==u.current){const ue=(_=I.current)==null?void 0:_.wrapperRef.current,O=(ie=h.current)==null?void 0:ie.wrapperRef.current,de=(se=m.current)==null?void 0:se.element;g==="palette"&&ue?n.keepFocusInContainer(r,ue):g==="gradient"&&O?n.keepFocusInContainer(r,O):g==="combo"&&O?n.keepFocusInContainer(r,O.parentElement):s&&de&&n.keepFocusInContainer(r,de)}}}}}),[l,b]),Te=t.useCallback(ne.triggerKeyboardEvent.bind(ne),[]),he=t.useCallback(()=>{b||(h.current&&h.current.wrapperRef.current?n.focusFirstFocusableChild(h.current.wrapperRef.current):I.current?I.current.focus():m.current&&m.current.element&&n.focusFirstFocusableChild(m.current.element))},[b]),B=e=>ee.current=e,ae=t.useCallback(e=>{const i={value:ee.current,nativeEvent:e.nativeEvent,syntheticEvent:e};v(i),l(!E,!0)},[E]),j=t.useCallback(()=>{l(!1,!0)},[l]),_e=t.useCallback(e=>{M&&M.call(void 0,{syntheticEvent:e,nativeEvent:e.nativeEvent,value:c,target:{element:u.current,value:c}})},[M,c]),Re=t.useCallback(e=>{y.current?(clearTimeout(y.current),y.current=void 0):Y(!0),V&&V.call(void 0,{nativeEvent:e.nativeEvent,syntheticEvent:e})},[V]),Ae=t.useCallback(()=>{l(!1,!0),Y(!1),y.current=void 0},[]),Ie=t.useCallback(e=>{clearTimeout(y.current),y.current=window.setTimeout(Ae),H&&H.call(void 0,{nativeEvent:e.nativeEvent,syntheticEvent:e})},[H]),v=t.useCallback((e,i)=>{var _;const r=i?e.rgbaValue||"":(_=e.value)!=null?_:"";U||Ee(r),q&&q.call(void 0,{value:r,nativeEvent:e.nativeEvent,syntheticEvent:e.syntheticEvent,target:{element:u.current,value:r}}),l(!1)},[U,q]),re=t.useCallback(e=>v(e,!0),[K,v]),G=t.useCallback(e=>t.createElement(t.Fragment,null,(g==="combo"||g==="gradient")&&t.createElement(Le.ColorGradient,{...P,_adaptive:e,ref:h,isInsidePopup:!0,size:e?"large":p,fillMode:R,value:c,onChange:v}),(g==="combo"||g==="palette")&&t.createElement(W.ColorPalette,{...J,ref:I,size:e?"large":p,value:c,onChange:re}),s&&s[0]==="gradient"&&s[1]==="palette"&&t.createElement(D.FlatColorPicker,{...T,_gradientSettings:{_adaptive:e,...P},ref:m,size:e?"large":p,views:["gradient","palette"],activeView:Q,setOpen:l,showButtons:!e,value:c,onChange:v,setAdaptiveModeValue:B}),s&&s[0]==="palette"&&s[1]==="gradient"&&t.createElement(D.FlatColorPicker,{...T,_gradientSettings:{_adaptive:e,...P},ref:m,size:e?"large":p,views:["palette","gradient"],setOpen:l,showButtons:!e,value:c,onChange:v,setAdaptiveModeValue:B}),s&&s.includes("gradient")&&!s.includes("palette")&&t.createElement(D.FlatColorPicker,{...T,_gradientSettings:{_adaptive:e,...P},ref:m,size:e?"large":p,views:["gradient"],showButtons:!e,setOpen:l,value:c,onChange:v,setAdaptiveModeValue:B}),s&&s.includes("palette")&&!s.includes("gradient")&&t.createElement(D.FlatColorPicker,{...T,_gradientSettings:{_adaptive:e,...P},ref:m,size:e?"large":p,views:["palette"],showButtons:!e,setOpen:l,value:c,onChange:v,setAdaptiveModeValue:B})),[Q,R,T,P,v,re,J,l,p,c,g,s]),Fe=t.useCallback(()=>{var i;const e={animation:!!((i=C==null?void 0:C.animate)==null||i),title:X,expand:E,onClose:j,windowWidth:F,footer:{cancelText:k.toLanguageString(d.flatColorPickerCancelBtn,d.messages[d.flatColorPickerCancelBtn]),onCancel:j,applyText:k.toLanguageString(d.flatColorPickerApplyBtn,d.messages[d.flatColorPickerApplyBtn]),onApply:ae}};return t.createElement(He.AdaptiveMode,{...e},t.createElement(Me.ActionSheetContent,{overflowHidden:!0},G(!0)))},[C==null?void 0:C.animate,X,E,j,F,k,ae,G]),Be=t.useCallback(e=>{for(const i of e)ye(i.target.clientWidth)},[]),oe=n.useDir(u,a.dir),Oe=fe!==!1;return t.createElement("span",{id:a.id,role:"combobox","aria-label":a.ariaLabel,"aria-labelledby":a.ariaLabelledBy,"aria-describedby":a.ariaDescribedBy,"aria-haspopup":"dialog","aria-expanded":E,"aria-controls":`k-colorpicker-popup-${(le=a.id)!=null?le:0}`,"aria-disabled":N?"true":void 0,className:n.classNames("k-colorpicker","k-picker","k-icon-picker",{[`k-picker-${n.kendoThemeMaps.sizeMap[p]||p}`]:p,[`k-picker-${R}`]:R,[`k-rounded-${n.kendoThemeMaps.roundedMap[z]||z}`]:z,"k-invalid":!Oe,"k-disabled":N,"k-focus":Ce,className:ve}),ref:u,tabIndex:n.getTabIndex(ge,N),title:a.title,onKeyDown:Te,onFocus:Re,onBlur:Ie,dir:oe},t.createElement(Ne.Picker,{dir:oe,open:E,onOpen:he,popupAnchor:u.current||void 0,popupSettings:{id:`k-colorpicker-popup-${(ce=a.id)!=null?ce:0}`,...C},input:t.createElement("span",{onClick:_e,className:"k-input-inner"},t.createElement("span",{className:n.classNames("k-value-icon","k-color-preview",{"k-no-color":!c,"k-icon-color-preview":L||x||A})},A&&t.createElement("span",{className:n.classNames("k-color-preview-icon",A)}),!A&&(L||x)&&t.createElement(n.IconWrap,{name:L,icon:x}),t.createElement("span",{className:"k-color-preview-mask",style:{backgroundColor:c}}))),button:t.createElement(xe.Button,{tabIndex:-1,type:"button",onClick:()=>l(!E),className:"k-input-button",rounded:null,icon:"caret-alt-down",svgIcon:qe.caretAltDownIcon,"aria-label":k.toLanguageString(d.colorPickerDropdownButtonAriaLabel,d.messages[d.colorPickerDropdownButtonAriaLabel])}),content:G(!1),_mobileMode:Se,_actionSheet:Fe()}))});$.propTypes={value:o.string,defaultValue:o.string,disabled:o.bool,view:o.oneOf(["gradient","palette","combo"]),views:o.arrayOf(o.oneOf(["gradient","palette"])),dir:o.string,id:o.string,icon:o.string,svgIcon:n.svgIconPropType,ariaLabelledBy:o.string,ariaDescribedBy:o.string,size:o.oneOf([null,"small","medium","large"]),rounded:o.oneOf([null,"small","medium","large","full"]),fillMode:o.oneOf([null,"solid","flat","outline"]),className:o.string,adaptive:o.bool,adaptiveTitle:o.string};const w={size:"medium",rounded:"medium",fillMode:"solid",view:"palette",views:["gradient","palette"],gradientSettings:je,paletteSettings:Ge};$.displayName="KendoColorPicker";exports.ColorPicker=$;exports.ColorPickerPropsContext=pe;
@@ -7,15 +7,15 @@
7
7
  */
8
8
  import * as t from "react";
9
9
  import a from "prop-types";
10
- import { createPropsContext as Ve, validatePackage as He, usePropsContext as Ue, useAdaptiveModeContext as Ke, canUseDOM as We, Navigation as $e, getActiveElement as Ge, keepFocusInContainer as A, focusFirstFocusableChild as ue, useDir as Me, classNames as $, kendoThemeMaps as de, getTabIndex as Ze, IconWrap as je, svgIconPropType as qe } from "@progress/kendo-react-common";
10
+ import { createPropsContext as Ve, validatePackage as He, usePropsContext as Ue, useAdaptiveModeContext as Ke, canUseDOM as We, Navigation as $e, getActiveElement as Ge, keepFocusInContainer as I, focusFirstFocusableChild as ue, useDir as Me, classNames as G, kendoThemeMaps as de, getTabIndex as Ze, IconWrap as je, svgIconPropType as qe } from "@progress/kendo-react-common";
11
11
  import { packageMetadata as Je } from "../package-metadata.mjs";
12
12
  import { Picker as Qe } from "./Picker.mjs";
13
13
  import { ColorGradient as Xe } from "./ColorGradient.mjs";
14
14
  import { ColorPalette as Ye, DEFAULT_PRESET as et, DEFAULT_TILE_SIZE as tt } from "./ColorPalette.mjs";
15
- import { FlatColorPicker as I } from "./FlatColorPicker.mjs";
15
+ import { FlatColorPicker as z } from "./FlatColorPicker.mjs";
16
16
  import { Button as nt } from "@progress/kendo-react-buttons";
17
17
  import { caretAltDownIcon as at } from "@progress/kendo-svg-icons";
18
- import { colorPickerAdaptiveTitle as pe, messages as z, flatColorPickerCancelBtn as fe, flatColorPickerApplyBtn as me, colorPickerDropdownButtonAriaLabel as ve } from "../messages/index.mjs";
18
+ import { colorPickerAdaptiveTitle as pe, messages as B, flatColorPickerCancelBtn as fe, flatColorPickerApplyBtn as me, colorPickerDropdownButtonAriaLabel as ve } from "../messages/index.mjs";
19
19
  import { useLocalization as rt } from "@progress/kendo-react-intl";
20
20
  import { AdaptiveMode as ot } from "../common/AdaptiveMode.mjs";
21
21
  import { ActionSheetContent as lt } from "@progress/kendo-react-layout";
@@ -24,34 +24,34 @@ const it = {
24
24
  }, ct = {
25
25
  palette: et,
26
26
  tileSize: tt
27
- }, G = (B) => B !== void 0, st = Ve(), ge = t.forwardRef((B, ke) => {
27
+ }, M = (D) => D !== void 0, st = Ve(), ge = t.forwardRef((D, ke) => {
28
28
  var re, oe;
29
29
  He(Je);
30
- const r = Ue(st, B), E = rt(), M = Ke(), {
30
+ const o = Ue(st, D), b = rt(), Z = Ke(), {
31
31
  size: u = k.size,
32
- rounded: D = k.rounded,
33
- fillMode: h = k.fillMode,
34
- gradientSettings: Z = k.gradientSettings,
32
+ rounded: x = k.rounded,
33
+ fillMode: S = k.fillMode,
34
+ gradientSettings: C = k.gradientSettings,
35
35
  paletteSettings: j = k.paletteSettings,
36
- flatColorPickerSettings: b,
37
- view: d = r.views ? void 0 : k.view,
36
+ flatColorPickerSettings: w,
37
+ view: d = o.views ? void 0 : k.view,
38
38
  views: c = d ? void 0 : k.views,
39
39
  activeView: q,
40
40
  popupSettings: m,
41
41
  valid: Ce,
42
- disabled: x,
42
+ disabled: L,
43
43
  tabIndex: Ee,
44
- icon: L,
45
- svgIcon: N,
46
- iconClassName: S,
47
- onChange: O,
48
- onFocus: F,
49
- onBlur: V,
50
- onActiveColorClick: H,
44
+ icon: N,
45
+ svgIcon: O,
46
+ iconClassName: T,
47
+ onChange: F,
48
+ onFocus: V,
49
+ onBlur: H,
50
+ onActiveColorClick: U,
51
51
  className: be,
52
52
  adaptive: we,
53
- adaptiveTitle: J = E.toLanguageString(pe, z[pe])
54
- } = r, s = t.useRef(null), w = t.useRef(null), T = t.useRef(null), f = t.useRef(null), C = t.useRef(), ye = t.useRef(null), [he, Q] = t.useState(!1), [Se, Te] = t.useState(r.defaultValue), [Pe, _e] = t.useState(!1), [P, Re] = t.useState(), U = G(r.value), v = G(r.open), o = U ? r.value : Se, g = v ? r.open : Pe, X = t.useRef(o), Y = t.useCallback(() => {
53
+ adaptiveTitle: J = b.toLanguageString(pe, B[pe])
54
+ } = o, s = t.useRef(null), y = t.useRef(null), P = t.useRef(null), f = t.useRef(null), E = t.useRef(), ye = t.useRef(null), [he, Q] = t.useState(!1), [Se, Te] = t.useState(o.defaultValue), [Pe, _e] = t.useState(!1), [_, Re] = t.useState(), K = M(o.value), v = M(o.open), l = K ? o.value : Se, g = v ? o.open : Pe, X = t.useRef(l), Y = t.useCallback(() => {
55
55
  s.current && s.current.focus();
56
56
  }, []);
57
57
  t.useImperativeHandle(
@@ -60,19 +60,19 @@ const it = {
60
60
  // we agreed that each element will have focus method exposed
61
61
  element: s.current,
62
62
  actionElement: ye.current,
63
- value: o,
63
+ value: l,
64
64
  focus: Y
65
65
  }),
66
- [o, Y]
66
+ [l, Y]
67
67
  );
68
- const Ae = !!(P && M && P <= M.medium && we);
68
+ const Ae = !!(_ && Z && _ <= Z.medium && we);
69
69
  t.useEffect(() => {
70
70
  const e = We && window.ResizeObserver && new window.ResizeObserver(Oe.bind(void 0));
71
71
  return document != null && document.body && e && e.observe(document.body), () => {
72
72
  document != null && document.body && e && e.disconnect();
73
73
  };
74
74
  }, []);
75
- const l = t.useCallback(
75
+ const r = t.useCallback(
76
76
  (e, i) => {
77
77
  v || (!e && !i && s && s.current && s.current.focus(), _e(e));
78
78
  },
@@ -84,76 +84,76 @@ const it = {
84
84
  keyboardEvents: {
85
85
  keydown: {
86
86
  Escape: (e, i, n) => {
87
- l(!1);
87
+ r(!1);
88
88
  },
89
89
  Enter: (e, i, n) => {
90
- !v && e === s.current && (n.preventDefault(), n.stopPropagation(), l(!0));
90
+ !v && e === s.current && (n.preventDefault(), n.stopPropagation(), r(!0));
91
91
  },
92
92
  ArrowDown: (e, i, n) => {
93
- n.altKey && (n.preventDefault(), n.stopPropagation(), l(!0));
93
+ n.altKey && (n.preventDefault(), n.stopPropagation(), r(!0));
94
94
  },
95
95
  ArrowUp: (e, i, n) => {
96
- n.altKey && (n.preventDefault(), n.stopPropagation(), l(!1));
96
+ n.altKey && (n.preventDefault(), n.stopPropagation(), r(!1));
97
97
  },
98
98
  Tab: (e, i, n) => {
99
- var y, le, ie;
99
+ var h, le, ie;
100
100
  if (Ge(document) !== s.current) {
101
- const ce = (y = T.current) == null ? void 0 : y.wrapperRef.current, R = (le = w.current) == null ? void 0 : le.wrapperRef.current, se = (ie = f.current) == null ? void 0 : ie.element;
102
- d === "palette" && ce ? A(n, ce) : d === "gradient" && R ? A(n, R) : d === "combo" && R ? A(n, R.parentElement) : c && se && A(n, se);
101
+ const ce = (h = P.current) == null ? void 0 : h.wrapperRef.current, A = (le = y.current) == null ? void 0 : le.wrapperRef.current, se = (ie = f.current) == null ? void 0 : ie.element;
102
+ d === "palette" && ce ? I(n, ce) : d === "gradient" && A ? I(n, A) : d === "combo" && A ? I(n, A.parentElement) : c && se && I(n, se);
103
103
  }
104
104
  }
105
105
  }
106
106
  }
107
- }), [l, v]), Ie = t.useCallback(ee.triggerKeyboardEvent.bind(ee), []), ze = t.useCallback(() => {
108
- v || (w.current && w.current.wrapperRef.current ? ue(w.current.wrapperRef.current) : T.current ? T.current.focus() : f.current && f.current.element && ue(f.current.element));
109
- }, [v]), _ = (e) => X.current = e, te = t.useCallback(
107
+ }), [r, v]), Ie = t.useCallback(ee.triggerKeyboardEvent.bind(ee), []), ze = t.useCallback(() => {
108
+ v || (y.current && y.current.wrapperRef.current ? ue(y.current.wrapperRef.current) : P.current ? P.current.focus() : f.current && f.current.element && ue(f.current.element));
109
+ }, [v]), R = (e) => X.current = e, te = t.useCallback(
110
110
  (e) => {
111
111
  const i = {
112
112
  value: X.current,
113
113
  nativeEvent: e.nativeEvent,
114
114
  syntheticEvent: e
115
115
  };
116
- p(i), l(!g, !0);
116
+ p(i), r(!g, !0);
117
117
  },
118
118
  [g]
119
- ), K = t.useCallback(() => {
120
- l(!1, !0);
121
- }, [l]), Be = t.useCallback(
119
+ ), W = t.useCallback(() => {
120
+ r(!1, !0);
121
+ }, [r]), Be = t.useCallback(
122
122
  (e) => {
123
- H && H.call(void 0, {
123
+ U && U.call(void 0, {
124
124
  syntheticEvent: e,
125
125
  nativeEvent: e.nativeEvent,
126
- value: o,
126
+ value: l,
127
127
  target: {
128
128
  element: s.current,
129
- value: o
129
+ value: l
130
130
  }
131
131
  });
132
132
  },
133
- [H, o]
133
+ [U, l]
134
134
  ), De = t.useCallback(
135
135
  (e) => {
136
- C.current ? (clearTimeout(C.current), C.current = void 0) : Q(!0), F && F.call(void 0, {
136
+ E.current ? (clearTimeout(E.current), E.current = void 0) : Q(!0), V && V.call(void 0, {
137
137
  nativeEvent: e.nativeEvent,
138
138
  syntheticEvent: e
139
139
  });
140
140
  },
141
- [F]
141
+ [V]
142
142
  ), xe = t.useCallback(() => {
143
- l(!1, !0), Q(!1), C.current = void 0;
143
+ r(!1, !0), Q(!1), E.current = void 0;
144
144
  }, []), Le = t.useCallback(
145
145
  (e) => {
146
- clearTimeout(C.current), C.current = window.setTimeout(xe), V && V.call(void 0, {
146
+ clearTimeout(E.current), E.current = window.setTimeout(xe), H && H.call(void 0, {
147
147
  nativeEvent: e.nativeEvent,
148
148
  syntheticEvent: e
149
149
  });
150
150
  },
151
- [V]
151
+ [H]
152
152
  ), p = t.useCallback(
153
153
  (e, i) => {
154
- var y;
155
- const n = i ? e.rgbaValue || "" : (y = e.value) != null ? y : "";
156
- U || Te(n), O && O.call(void 0, {
154
+ var h;
155
+ const n = i ? e.rgbaValue || "" : (h = e.value) != null ? h : "";
156
+ K || Te(n), F && F.call(void 0, {
157
157
  value: n,
158
158
  nativeEvent: e.nativeEvent,
159
159
  syntheticEvent: e.syntheticEvent,
@@ -161,102 +161,103 @@ const it = {
161
161
  element: s.current,
162
162
  value: n
163
163
  }
164
- }), l(!1);
164
+ }), r(!1);
165
165
  },
166
- [U, O]
166
+ [K, F]
167
167
  ), ne = t.useCallback(
168
168
  (e) => p(e, !0),
169
- [G, p]
170
- ), W = t.useCallback(
169
+ [M, p]
170
+ ), $ = t.useCallback(
171
171
  (e) => /* @__PURE__ */ t.createElement(t.Fragment, null, (d === "combo" || d === "gradient") && /* @__PURE__ */ t.createElement(
172
172
  Xe,
173
173
  {
174
- ...Z,
174
+ ...C,
175
175
  _adaptive: e,
176
- ref: w,
176
+ ref: y,
177
177
  isInsidePopup: !0,
178
178
  size: e ? "large" : u,
179
- fillMode: h,
180
- value: o,
179
+ fillMode: S,
180
+ value: l,
181
181
  onChange: p
182
182
  }
183
183
  ), (d === "combo" || d === "palette") && /* @__PURE__ */ t.createElement(
184
184
  Ye,
185
185
  {
186
186
  ...j,
187
- ref: T,
187
+ ref: P,
188
188
  size: e ? "large" : u,
189
- value: o,
189
+ value: l,
190
190
  onChange: ne
191
191
  }
192
192
  ), c && c[0] === "gradient" && c[1] === "palette" && /* @__PURE__ */ t.createElement(
193
- I,
193
+ z,
194
194
  {
195
- ...b,
196
- _gradientSettings: { _adaptive: e },
195
+ ...w,
196
+ _gradientSettings: { _adaptive: e, ...C },
197
197
  ref: f,
198
198
  size: e ? "large" : u,
199
199
  views: ["gradient", "palette"],
200
200
  activeView: q,
201
- setOpen: l,
201
+ setOpen: r,
202
202
  showButtons: !e,
203
- value: o,
203
+ value: l,
204
204
  onChange: p,
205
- setAdaptiveModeValue: _
205
+ setAdaptiveModeValue: R
206
206
  }
207
207
  ), c && c[0] === "palette" && c[1] === "gradient" && /* @__PURE__ */ t.createElement(
208
- I,
208
+ z,
209
209
  {
210
- ...b,
211
- _gradientSettings: { _adaptive: e },
210
+ ...w,
211
+ _gradientSettings: { _adaptive: e, ...C },
212
212
  ref: f,
213
213
  size: e ? "large" : u,
214
214
  views: ["palette", "gradient"],
215
- setOpen: l,
215
+ setOpen: r,
216
216
  showButtons: !e,
217
- value: o,
217
+ value: l,
218
218
  onChange: p,
219
- setAdaptiveModeValue: _
219
+ setAdaptiveModeValue: R
220
220
  }
221
221
  ), c && c.includes("gradient") && !c.includes("palette") && /* @__PURE__ */ t.createElement(
222
- I,
222
+ z,
223
223
  {
224
- ...b,
225
- _gradientSettings: { _adaptive: e },
224
+ ...w,
225
+ _gradientSettings: { _adaptive: e, ...C },
226
226
  ref: f,
227
227
  size: e ? "large" : u,
228
228
  views: ["gradient"],
229
229
  showButtons: !e,
230
- setOpen: l,
231
- value: o,
230
+ setOpen: r,
231
+ value: l,
232
232
  onChange: p,
233
- setAdaptiveModeValue: _
233
+ setAdaptiveModeValue: R
234
234
  }
235
235
  ), c && c.includes("palette") && !c.includes("gradient") && /* @__PURE__ */ t.createElement(
236
- I,
236
+ z,
237
237
  {
238
- ...b,
239
- _gradientSettings: { _adaptive: e },
238
+ ...w,
239
+ _gradientSettings: { _adaptive: e, ...C },
240
240
  ref: f,
241
241
  size: e ? "large" : u,
242
242
  views: ["palette"],
243
243
  showButtons: !e,
244
- setOpen: l,
245
- value: o,
244
+ setOpen: r,
245
+ value: l,
246
246
  onChange: p,
247
- setAdaptiveModeValue: _
247
+ setAdaptiveModeValue: R
248
248
  }
249
249
  )),
250
250
  [
251
251
  q,
252
- h,
253
- b,
254
- Z,
252
+ S,
253
+ w,
254
+ C,
255
255
  p,
256
256
  ne,
257
257
  j,
258
+ r,
258
259
  u,
259
- o,
260
+ l,
260
261
  d,
261
262
  c
262
263
  ]
@@ -266,53 +267,53 @@ const it = {
266
267
  animation: !!((i = m == null ? void 0 : m.animate) == null || i),
267
268
  title: J,
268
269
  expand: g,
269
- onClose: K,
270
- windowWidth: P,
270
+ onClose: W,
271
+ windowWidth: _,
271
272
  footer: {
272
- cancelText: E.toLanguageString(fe, z[fe]),
273
- onCancel: K,
274
- applyText: E.toLanguageString(me, z[me]),
273
+ cancelText: b.toLanguageString(fe, B[fe]),
274
+ onCancel: W,
275
+ applyText: b.toLanguageString(me, B[me]),
275
276
  onApply: te
276
277
  }
277
278
  };
278
- return /* @__PURE__ */ t.createElement(ot, { ...e }, /* @__PURE__ */ t.createElement(lt, { overflowHidden: !0 }, W(!0)));
279
+ return /* @__PURE__ */ t.createElement(ot, { ...e }, /* @__PURE__ */ t.createElement(lt, { overflowHidden: !0 }, $(!0)));
279
280
  }, [
280
281
  m == null ? void 0 : m.animate,
281
282
  J,
282
283
  g,
283
- K,
284
- P,
285
- E,
284
+ W,
285
+ _,
286
+ b,
286
287
  te,
287
- W
288
+ $
288
289
  ]), Oe = t.useCallback((e) => {
289
290
  for (const i of e)
290
291
  Re(i.target.clientWidth);
291
- }, []), ae = Me(s, r.dir), Fe = Ce !== !1;
292
+ }, []), ae = Me(s, o.dir), Fe = Ce !== !1;
292
293
  return /* @__PURE__ */ t.createElement(
293
294
  "span",
294
295
  {
295
- id: r.id,
296
+ id: o.id,
296
297
  role: "combobox",
297
- "aria-label": r.ariaLabel,
298
- "aria-labelledby": r.ariaLabelledBy,
299
- "aria-describedby": r.ariaDescribedBy,
298
+ "aria-label": o.ariaLabel,
299
+ "aria-labelledby": o.ariaLabelledBy,
300
+ "aria-describedby": o.ariaDescribedBy,
300
301
  "aria-haspopup": "dialog",
301
302
  "aria-expanded": g,
302
- "aria-controls": `k-colorpicker-popup-${(re = r.id) != null ? re : 0}`,
303
- "aria-disabled": x ? "true" : void 0,
304
- className: $("k-colorpicker", "k-picker", "k-icon-picker", {
303
+ "aria-controls": `k-colorpicker-popup-${(re = o.id) != null ? re : 0}`,
304
+ "aria-disabled": L ? "true" : void 0,
305
+ className: G("k-colorpicker", "k-picker", "k-icon-picker", {
305
306
  [`k-picker-${de.sizeMap[u] || u}`]: u,
306
- [`k-picker-${h}`]: h,
307
- [`k-rounded-${de.roundedMap[D] || D}`]: D,
307
+ [`k-picker-${S}`]: S,
308
+ [`k-rounded-${de.roundedMap[x] || x}`]: x,
308
309
  "k-invalid": !Fe,
309
- "k-disabled": x,
310
+ "k-disabled": L,
310
311
  "k-focus": he,
311
312
  className: be
312
313
  }),
313
314
  ref: s,
314
- tabIndex: Ze(Ee, x),
315
- title: r.title,
315
+ tabIndex: Ze(Ee, L),
316
+ title: o.title,
316
317
  onKeyDown: Ie,
317
318
  onFocus: De,
318
319
  onBlur: Le,
@@ -325,36 +326,36 @@ const it = {
325
326
  open: g,
326
327
  onOpen: ze,
327
328
  popupAnchor: s.current || void 0,
328
- popupSettings: { id: `k-colorpicker-popup-${(oe = r.id) != null ? oe : 0}`, ...m },
329
+ popupSettings: { id: `k-colorpicker-popup-${(oe = o.id) != null ? oe : 0}`, ...m },
329
330
  input: /* @__PURE__ */ t.createElement("span", { onClick: Be, className: "k-input-inner" }, /* @__PURE__ */ t.createElement(
330
331
  "span",
331
332
  {
332
- className: $("k-value-icon", "k-color-preview", {
333
- "k-no-color": !o,
334
- "k-icon-color-preview": L || N || S
333
+ className: G("k-value-icon", "k-color-preview", {
334
+ "k-no-color": !l,
335
+ "k-icon-color-preview": N || O || T
335
336
  })
336
337
  },
337
- S && /* @__PURE__ */ t.createElement("span", { className: $("k-color-preview-icon", S) }),
338
- !S && (L || N) && /* @__PURE__ */ t.createElement(je, { name: L, icon: N }),
339
- /* @__PURE__ */ t.createElement("span", { className: "k-color-preview-mask", style: { backgroundColor: o } })
338
+ T && /* @__PURE__ */ t.createElement("span", { className: G("k-color-preview-icon", T) }),
339
+ !T && (N || O) && /* @__PURE__ */ t.createElement(je, { name: N, icon: O }),
340
+ /* @__PURE__ */ t.createElement("span", { className: "k-color-preview-mask", style: { backgroundColor: l } })
340
341
  )),
341
342
  button: /* @__PURE__ */ t.createElement(
342
343
  nt,
343
344
  {
344
345
  tabIndex: -1,
345
346
  type: "button",
346
- onClick: () => l(!g),
347
+ onClick: () => r(!g),
347
348
  className: "k-input-button",
348
349
  rounded: null,
349
350
  icon: "caret-alt-down",
350
351
  svgIcon: at,
351
- "aria-label": E.toLanguageString(
352
+ "aria-label": b.toLanguageString(
352
353
  ve,
353
- z[ve]
354
+ B[ve]
354
355
  )
355
356
  }
356
357
  ),
357
- content: W(!1),
358
+ content: $(!1),
358
359
  _mobileMode: Ae,
359
360
  _actionSheet: Ne()
360
361
  }
@@ -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 J=require("react"),o=require("prop-types"),r=require("@progress/kendo-react-common"),s=require("@progress/kendo-react-buttons"),b=require("@progress/kendo-svg-icons"),Q=require("./ColorPalette.js"),U=require("./ColorGradient.js"),W=require("../package-metadata.js"),X=require("@progress/kendo-react-intl"),l=require("../messages/index.js");function Y(e){const h=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const v in e)if(v!=="default"){const f=Object.getOwnPropertyDescriptor(e,v);Object.defineProperty(h,v,f.get?f:{enumerable:!0,get:()=>e[v]})}}return h.default=e,Object.freeze(h)}const t=Y(J),_=t.forwardRef((e,h)=>{r.validatePackage(W.packageMetadata);const v=t.useRef(null),f=t.useRef(null),A=t.useRef(null),{defaultValue:E,showButtons:B=!0,showPreview:O=!0,showClearButton:x=!0,view:P=e.views?void 0:"ColorGradient",views:d=P?void 0:["gradient","palette"],activeView:w="gradient",size:i="medium"}=e,[C,z]=t.useState((P||"ColorGradient")==="ColorGradient"),[g,M]=t.useState((d!=null?d:[])[0]==="gradient"&&w==="gradient"),[c,y]=t.useState(e.value||E||void 0),[k,I]=t.useState(e.value||E||void 0),G=e.value!==void 0?e.value:void 0;t.useEffect(()=>{y(e.value)},[e.value]);const m=X.useLocalization(),V=t.useCallback(()=>{v.current&&v.current.focus()},[v]);t.useImperativeHandle(v,()=>({element:f.current,focus:V,props:e,value:G}),[G,V,e]),t.useImperativeHandle(h,()=>v.current);const L=t.useCallback(a=>{(a==="ColorGradient"&&!C||a==="ColorPalette"&&C)&&z(!C)},[C]),N=t.useCallback(a=>{a==="gradient"&&!g||a==="palette"&&g||a==="palette"&&w==="gradient"?M(!g):a==="gradient"&&w==="palette"&&M(!0)},[w,g]),F=t.useCallback(a=>{var u;const n=E||void 0;if(y(n),I(n),(u=e._gradientSettings)!=null&&u._adaptive&&e.setAdaptiveModeValue&&e.setAdaptiveModeValue(n),e.onPreviewChange){const S={value:n,nativeEvent:a.nativeEvent,syntheticEvent:a};e.onPreviewChange.call(void 0,S)}},[E,e.onPreviewChange]),R=t.useCallback(a=>{var n;if(y(a.value),e.onPreviewChange){const u={value:a.value,nativeEvent:a.nativeEvent,syntheticEvent:a.syntheticEvent};e.onPreviewChange.call(void 0,u)}(n=e._gradientSettings)!=null&&n._adaptive&&e.setAdaptiveModeValue&&e.setAdaptiveModeValue(a.value)},[e.onPreviewChange]),T=t.useCallback(a=>{if(c!==void 0&&I(c),e.onChange){const n={value:c,nativeEvent:a.nativeEvent,syntheticEvent:a};e.onChange.call(void 0,n)}},[c,e.onChange]),j=t.useCallback(()=>{y(k),e.setOpen&&e.setOpen(!1)},[k]),D=t.useCallback(a=>{if(y(k),e.onPreviewChange){const n={value:k,nativeEvent:a.nativeEvent,syntheticEvent:a};e.onPreviewChange.call(void 0,n)}},[k,e.onPreviewChange]),K=t.useCallback(a=>{var u,S;if((!a.relatedTarget||!((u=f.current)!=null&&u.contains(a.relatedTarget)))&&!((S=e._gradientSettings)!=null&&S._adaptive)&&(!B&&c!==void 0&&I(c),!B&&e.onChange)){const $={value:c,nativeEvent:a.nativeEvent,syntheticEvent:a};e.onChange.call(void 0,$)}},[c,B,e.onChange]),q=t.useMemo(()=>new r.Navigation({root:f,selectors:[".k-coloreditor"],tabIndex:0,keyboardEvents:{keydown:{Tab:(a,n,u)=>{r.getActiveElement(document)===a?r.disableNavigatableContainer(a):r.keepFocusInContainer(u,a)},Enter:(a,n,u)=>{r.getActiveElement(document)===a&&(r.focusFirstFocusableChild(a),r.enableNavigatableContainer(a))},Escape:(a,n,u)=>{r.getActiveElement(document)!==a&&(a.focus(),r.disableNavigatableContainer(a))}}}}),[]),H=t.useCallback(q.triggerKeyboardEvent.bind(q),[]);return t.createElement("div",{id:e.id,role:"textbox","aria-label":e.ariaLabel,"aria-labelledby":e.ariaLabelledBy,"aria-disabled":e.disabled?"true":void 0,style:e.style,ref:f,tabIndex:r.getTabIndex(e.tabIndex,e.disabled),className:r.classNames("k-flatcolorpicker k-coloreditor",{[`k-coloreditor-${r.kendoThemeMaps.sizeMap[i]||i}`]:i,"k-disabled":e.disabled},e.className),onBlur:K,onKeyDown:H},e.header||t.createElement("div",{className:"k-coloreditor-header k-hstack"},t.createElement("div",{className:"k-coloreditor-header-actions k-hstack"},d&&d[0]==="gradient"&&d[1]==="palette"&&t.createElement(s.ButtonGroup,{className:"k-button-group-flat"},t.createElement(s.Button,{type:"button","aria-label":m.toLanguageString(l.flatColorPickerColorGradientBtn,l.messages[l.flatColorPickerColorGradientBtn]),togglable:!0,fillMode:"flat",size:i,svgIcon:b.dropletSliderIcon,selected:g,onClick:()=>N("gradient")}),t.createElement(s.Button,{type:"button","aria-label":m.toLanguageString(l.flatColorPickerColorPaletteBtn,l.messages[l.flatColorPickerColorPaletteBtn]),togglable:!0,fillMode:"flat",size:i,svgIcon:b.paletteIcon,selected:!g,onClick:()=>N("palette")})),d&&d[0]==="palette"&&d[1]==="gradient"&&t.createElement(s.ButtonGroup,{className:"k-button-group-flat"},t.createElement(s.Button,{type:"button","aria-label":m.toLanguageString(l.flatColorPickerColorPaletteBtn,l.messages[l.flatColorPickerColorPaletteBtn]),togglable:!0,fillMode:"flat",size:i,svgIcon:b.paletteIcon,selected:!g,onClick:()=>N("palette")}),t.createElement(s.Button,{type:"button","aria-label":m.toLanguageString(l.flatColorPickerColorGradientBtn,l.messages[l.flatColorPickerColorGradientBtn]),togglable:!0,fillMode:"flat",size:i,svgIcon:b.dropletSliderIcon,selected:g,onClick:()=>N("gradient")})),P&&t.createElement(s.ButtonGroup,{className:"k-button-group-flat"},t.createElement(s.Button,{type:"button","aria-label":m.toLanguageString(l.flatColorPickerColorGradientBtn,l.messages[l.flatColorPickerColorGradientBtn]),togglable:!0,fillMode:"flat",size:i,selected:C,onClick:()=>L("ColorGradient"),icon:"droplet-slider",svgIcon:b.dropletSliderIcon}),t.createElement(s.Button,{type:"button","aria-label":m.toLanguageString(l.flatColorPickerColorPaletteBtn,l.messages[l.flatColorPickerColorPaletteBtn]),togglable:!0,fillMode:"flat",size:i,selected:!C,onClick:()=>L("ColorPalette"),icon:"palette",svgIcon:b.paletteIcon}))),t.createElement("div",{className:"k-spacer"}),t.createElement("div",{className:"k-coloreditor-header-actions k-hstack"},x&&t.createElement(s.Button,{type:"button",fillMode:"flat",size:i,onClick:F,"aria-label":m.toLanguageString(l.flatColorPickerClearBtn,l.messages[l.flatColorPickerClearBtn]),icon:"droplet-slash",svgIcon:b.dropletSlashIcon}),O&&t.createElement("div",{className:"k-coloreditor-preview k-vstack"},t.createElement("span",{className:r.classNames("k-coloreditor-preview-color","k-color-preview",{"k-no-color":G===void 0})},t.createElement("span",{className:"k-color-preview-mask",style:{background:c||void 0}})),t.createElement("span",{className:r.classNames("k-coloreditor-current-color","k-color-preview",{"k-no-color":k===void 0}),onClick:D},t.createElement("span",{className:"k-color-preview-mask",style:{background:k||void 0}}))))),t.createElement("div",{className:"k-coloreditor-views k-vstack"},(P&&C||d&&g)&&t.createElement(U.ColorGradient,{ref:A,role:"none",ariaLabel:void 0,value:c,onChange:R,opacity:e.opacity,format:e.format,size:i,_adaptive:e._gradientSettings?e._gradientSettings._adaptive:void 0}),(P&&!C||d&&!g)&&t.createElement(Q.ColorPalette,{ariaDisabled:!0,ariaLabelledBy:"required_label",value:c,onChange:R,size:i})),B&&t.createElement("div",{className:"k-coloreditor-footer k-actions k-actions-end k-actions-horizontal"},t.createElement(s.Button,{type:"button",className:"k-coloreditor-cancel",size:i,onClick:j},l.messages[l.flatColorPickerCancelBtn]),t.createElement(s.Button,{type:"button",themeColor:"primary",className:"k-coloreditor-apply",size:i,onClick:T},l.messages[l.flatColorPickerApplyBtn])))}),Z={id:o.string,style:o.any,className:o.string,value:o.string,defaultValue:o.string,onPreviewChange:o.func,onChange:o.func,opacity:o.bool,format:o.any,tabIndex:o.number,ariaLabel:o.string,ariaLabelledBy:o.string,disabled:o.bool,view:o.any,header:o.any,showClearButton:o.bool,showPreview:o.bool,showButtons:o.bool,views:o.array,size:o.oneOf([null,"small","medium","large"])};_.displayName="KendoFlatColorPicker";_.propTypes=Z;exports.FlatColorPicker=_;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const J=require("react"),o=require("prop-types"),r=require("@progress/kendo-react-common"),s=require("@progress/kendo-react-buttons"),b=require("@progress/kendo-svg-icons"),Q=require("./ColorPalette.js"),U=require("./ColorGradient.js"),W=require("../package-metadata.js"),X=require("@progress/kendo-react-intl"),l=require("../messages/index.js");function Y(e){const h=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const g in e)if(g!=="default"){const f=Object.getOwnPropertyDescriptor(e,g);Object.defineProperty(h,g,f.get?f:{enumerable:!0,get:()=>e[g]})}}return h.default=e,Object.freeze(h)}const t=Y(J),_=t.forwardRef((e,h)=>{r.validatePackage(W.packageMetadata);const g=t.useRef(null),f=t.useRef(null),A=t.useRef(null),{defaultValue:E,showButtons:B=!0,showPreview:O=!0,showClearButton:x=!0,view:P=e.views?void 0:"ColorGradient",views:d=P?void 0:["gradient","palette"],activeView:w="gradient",size:i="medium"}=e,[C,z]=t.useState((P||"ColorGradient")==="ColorGradient"),[v,M]=t.useState((d!=null?d:[])[0]==="gradient"&&w==="gradient"),[c,y]=t.useState(e.value||E||void 0),[k,I]=t.useState(e.value||E||void 0),G=e.value!==void 0?e.value:void 0;t.useEffect(()=>{y(e.value)},[e.value]);const m=X.useLocalization(),V=t.useCallback(()=>{g.current&&g.current.focus()},[g]);t.useImperativeHandle(g,()=>({element:f.current,focus:V,props:e,value:G}),[G,V,e]),t.useImperativeHandle(h,()=>g.current);const L=t.useCallback(a=>{(a==="ColorGradient"&&!C||a==="ColorPalette"&&C)&&z(!C)},[C]),N=t.useCallback(a=>{a==="gradient"&&!v||a==="palette"&&v||a==="palette"&&w==="gradient"?M(!v):a==="gradient"&&w==="palette"&&M(!0)},[w,v]),F=t.useCallback(a=>{var u;const n=E||void 0;if(y(n),I(n),(u=e._gradientSettings)!=null&&u._adaptive&&e.setAdaptiveModeValue&&e.setAdaptiveModeValue(n),e.onPreviewChange){const S={value:n,nativeEvent:a.nativeEvent,syntheticEvent:a};e.onPreviewChange.call(void 0,S)}},[E,e.onPreviewChange]),R=t.useCallback(a=>{var n;if(y(a.value),e.onPreviewChange){const u={value:a.value,nativeEvent:a.nativeEvent,syntheticEvent:a.syntheticEvent};e.onPreviewChange.call(void 0,u)}(n=e._gradientSettings)!=null&&n._adaptive&&e.setAdaptiveModeValue&&e.setAdaptiveModeValue(a.value)},[e.onPreviewChange]),T=t.useCallback(a=>{if(c!==void 0&&I(c),e.onChange){const n={value:c,nativeEvent:a.nativeEvent,syntheticEvent:a};e.onChange.call(void 0,n)}},[c,e.onChange]),j=t.useCallback(()=>{y(k),e.setOpen&&e.setOpen(!1)},[k]),D=t.useCallback(a=>{if(y(k),e.onPreviewChange){const n={value:k,nativeEvent:a.nativeEvent,syntheticEvent:a};e.onPreviewChange.call(void 0,n)}},[k,e.onPreviewChange]),K=t.useCallback(a=>{var u,S;if((!a.relatedTarget||!((u=f.current)!=null&&u.contains(a.relatedTarget)))&&!((S=e._gradientSettings)!=null&&S._adaptive)&&(!B&&c!==void 0&&I(c),!B&&e.onChange)){const $={value:c,nativeEvent:a.nativeEvent,syntheticEvent:a};e.onChange.call(void 0,$)}},[c,B,e.onChange]),q=t.useMemo(()=>new r.Navigation({root:f,selectors:[".k-coloreditor"],tabIndex:0,keyboardEvents:{keydown:{Tab:(a,n,u)=>{r.getActiveElement(document)===a?r.disableNavigatableContainer(a):r.keepFocusInContainer(u,a)},Enter:(a,n,u)=>{r.getActiveElement(document)===a&&(r.focusFirstFocusableChild(a),r.enableNavigatableContainer(a))},Escape:(a,n,u)=>{r.getActiveElement(document)!==a&&(a.focus(),r.disableNavigatableContainer(a))}}}}),[]),H=t.useCallback(q.triggerKeyboardEvent.bind(q),[]);return t.createElement("div",{id:e.id,role:"textbox","aria-label":e.ariaLabel,"aria-labelledby":e.ariaLabelledBy,"aria-disabled":e.disabled?"true":void 0,style:e.style,ref:f,tabIndex:r.getTabIndex(e.tabIndex,e.disabled),className:r.classNames("k-flatcolorpicker k-coloreditor",{[`k-coloreditor-${r.kendoThemeMaps.sizeMap[i]||i}`]:i,"k-disabled":e.disabled},e.className),onBlur:K,onKeyDown:H},e.header||t.createElement("div",{className:"k-coloreditor-header k-hstack"},t.createElement("div",{className:"k-coloreditor-header-actions k-hstack"},d&&d[0]==="gradient"&&d[1]==="palette"&&t.createElement(s.ButtonGroup,{className:"k-button-group-flat"},t.createElement(s.Button,{type:"button","aria-label":m.toLanguageString(l.flatColorPickerColorGradientBtn,l.messages[l.flatColorPickerColorGradientBtn]),togglable:!0,fillMode:"flat",size:i,svgIcon:b.dropletSliderIcon,selected:v,onClick:()=>N("gradient")}),t.createElement(s.Button,{type:"button","aria-label":m.toLanguageString(l.flatColorPickerColorPaletteBtn,l.messages[l.flatColorPickerColorPaletteBtn]),togglable:!0,fillMode:"flat",size:i,svgIcon:b.paletteIcon,selected:!v,onClick:()=>N("palette")})),d&&d[0]==="palette"&&d[1]==="gradient"&&t.createElement(s.ButtonGroup,{className:"k-button-group-flat"},t.createElement(s.Button,{type:"button","aria-label":m.toLanguageString(l.flatColorPickerColorPaletteBtn,l.messages[l.flatColorPickerColorPaletteBtn]),togglable:!0,fillMode:"flat",size:i,svgIcon:b.paletteIcon,selected:!v,onClick:()=>N("palette")}),t.createElement(s.Button,{type:"button","aria-label":m.toLanguageString(l.flatColorPickerColorGradientBtn,l.messages[l.flatColorPickerColorGradientBtn]),togglable:!0,fillMode:"flat",size:i,svgIcon:b.dropletSliderIcon,selected:v,onClick:()=>N("gradient")})),P&&t.createElement(s.ButtonGroup,{className:"k-button-group-flat"},t.createElement(s.Button,{type:"button","aria-label":m.toLanguageString(l.flatColorPickerColorGradientBtn,l.messages[l.flatColorPickerColorGradientBtn]),togglable:!0,fillMode:"flat",size:i,selected:C,onClick:()=>L("ColorGradient"),icon:"droplet-slider",svgIcon:b.dropletSliderIcon}),t.createElement(s.Button,{type:"button","aria-label":m.toLanguageString(l.flatColorPickerColorPaletteBtn,l.messages[l.flatColorPickerColorPaletteBtn]),togglable:!0,fillMode:"flat",size:i,selected:!C,onClick:()=>L("ColorPalette"),icon:"palette",svgIcon:b.paletteIcon}))),t.createElement("div",{className:"k-spacer"}),t.createElement("div",{className:"k-coloreditor-header-actions k-hstack"},x&&t.createElement(s.Button,{type:"button",fillMode:"flat",size:i,onClick:F,"aria-label":m.toLanguageString(l.flatColorPickerClearBtn,l.messages[l.flatColorPickerClearBtn]),icon:"droplet-slash",svgIcon:b.dropletSlashIcon}),O&&t.createElement("div",{className:"k-coloreditor-preview k-vstack"},t.createElement("span",{className:r.classNames("k-coloreditor-preview-color","k-color-preview",{"k-no-color":G===void 0})},t.createElement("span",{className:"k-color-preview-mask",style:{background:c||void 0}})),t.createElement("span",{className:r.classNames("k-coloreditor-current-color","k-color-preview",{"k-no-color":k===void 0}),onClick:D},t.createElement("span",{className:"k-color-preview-mask",style:{background:k||void 0}}))))),t.createElement("div",{className:"k-coloreditor-views k-vstack"},(P&&C||d&&v)&&t.createElement(U.ColorGradient,{ref:A,role:"none",ariaLabel:void 0,value:c,onChange:R,opacity:e.opacity,format:e.format,size:i,_adaptive:e._gradientSettings?e._gradientSettings._adaptive:void 0,...e._gradientSettings}),(P&&!C||d&&!v)&&t.createElement(Q.ColorPalette,{ariaDisabled:!0,ariaLabelledBy:"required_label",value:c,onChange:R,size:i})),B&&t.createElement("div",{className:"k-coloreditor-footer k-actions k-actions-end k-actions-horizontal"},t.createElement(s.Button,{type:"button",className:"k-coloreditor-cancel",size:i,onClick:j},l.messages[l.flatColorPickerCancelBtn]),t.createElement(s.Button,{type:"button",themeColor:"primary",className:"k-coloreditor-apply",size:i,onClick:T},l.messages[l.flatColorPickerApplyBtn])))}),Z={id:o.string,style:o.any,className:o.string,value:o.string,defaultValue:o.string,onPreviewChange:o.func,onChange:o.func,opacity:o.bool,format:o.any,tabIndex:o.number,ariaLabel:o.string,ariaLabelledBy:o.string,disabled:o.bool,view:o.any,header:o.any,showClearButton:o.bool,showPreview:o.bool,showButtons:o.bool,views:o.array,size:o.oneOf([null,"small","medium","large"])};_.displayName="KendoFlatColorPicker";_.propTypes=Z;exports.FlatColorPicker=_;