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