@progress/kendo-react-inputs 9.5.0 → 10.0.0-develop.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/checkbox/Checkbox.js +1 -1
- package/checkbox/Checkbox.mjs +21 -23
- package/colors/ColorGradient.js +1 -1
- package/colors/ColorGradient.mjs +61 -60
- package/colors/ColorPalette.js +1 -1
- package/colors/ColorPalette.mjs +25 -26
- package/colors/ColorPicker.js +1 -1
- package/colors/ColorPicker.mjs +78 -79
- package/colors/FlatColorPicker.js +1 -1
- package/colors/FlatColorPicker.mjs +61 -62
- package/dist/cdn/js/kendo-react-inputs.js +1 -1
- package/index.d.mts +1 -1
- package/index.d.ts +1 -1
- package/input/Input.js +1 -1
- package/input/Input.mjs +36 -39
- package/maskedtextbox/MaskedTextBox.js +1 -1
- package/maskedtextbox/MaskedTextBox.mjs +79 -80
- package/numerictextbox/NumericTextBox.js +1 -1
- package/numerictextbox/NumericTextBox.mjs +18 -20
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +9 -9
- package/radiobutton/RadioButton.js +1 -1
- package/radiobutton/RadioButton.mjs +37 -39
- package/radiobutton/RadioGroup.js +1 -1
- package/radiobutton/RadioGroup.mjs +19 -21
- package/range-slider/RangeSlider.js +7 -7
- package/range-slider/RangeSlider.mjs +100 -101
- package/signature/Signature.js +1 -1
- package/signature/Signature.mjs +58 -58
- package/slider/Slider.js +1 -1
- package/slider/Slider.mjs +15 -16
- package/switch/Switch.js +1 -1
- package/switch/Switch.mjs +15 -16
- package/textbox/Textbox.js +1 -1
- package/textbox/Textbox.mjs +43 -45
package/colors/ColorPicker.js
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
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;
|
package/colors/ColorPicker.mjs
CHANGED
|
@@ -7,29 +7,28 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import * as t from "react";
|
|
9
9
|
import a from "prop-types";
|
|
10
|
-
import { createPropsContext as
|
|
11
|
-
import { packageMetadata as
|
|
12
|
-
import { Picker as
|
|
13
|
-
import { ColorGradient as
|
|
14
|
-
import { ColorPalette as
|
|
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
|
|
17
|
-
import { caretAltDownIcon as
|
|
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
|
|
20
|
-
import { AdaptiveMode as
|
|
21
|
-
import { ActionSheetContent as
|
|
22
|
-
const
|
|
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
|
-
},
|
|
25
|
-
palette:
|
|
26
|
-
tileSize:
|
|
27
|
-
}, M = (D) => D !== void 0,
|
|
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
|
-
|
|
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:
|
|
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:
|
|
42
|
-
disabled:
|
|
43
|
-
tabIndex:
|
|
40
|
+
valid: Ee,
|
|
41
|
+
disabled: x,
|
|
42
|
+
tabIndex: be,
|
|
44
43
|
icon: N,
|
|
45
44
|
svgIcon: O,
|
|
46
|
-
iconClassName:
|
|
45
|
+
iconClassName: P,
|
|
47
46
|
onChange: F,
|
|
48
47
|
onFocus: V,
|
|
49
48
|
onBlur: H,
|
|
50
|
-
onActiveColorClick:
|
|
51
|
-
className:
|
|
52
|
-
adaptive:
|
|
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),
|
|
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:
|
|
61
|
+
actionElement: he.current,
|
|
63
62
|
value: l,
|
|
64
63
|
focus: Y
|
|
65
64
|
}),
|
|
66
65
|
[l, Y]
|
|
67
66
|
);
|
|
68
|
-
const
|
|
67
|
+
const Ie = !!(_ && Z && _ <= Z.medium && ye);
|
|
69
68
|
t.useEffect(() => {
|
|
70
|
-
const e =
|
|
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(),
|
|
76
|
+
v || (!e && !i && s && s.current && s.current.focus(), Re(e));
|
|
78
77
|
},
|
|
79
78
|
[v]
|
|
80
|
-
), ee = t.useMemo(() => new
|
|
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 (
|
|
101
|
-
const ce = (h =
|
|
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]),
|
|
108
|
-
v || (y.current && y.current.wrapperRef.current ? ue(y.current.wrapperRef.current) :
|
|
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
|
-
),
|
|
118
|
+
), K = t.useCallback(() => {
|
|
120
119
|
r(!1, !0);
|
|
121
|
-
}, [r]),
|
|
120
|
+
}, [r]), De = t.useCallback(
|
|
122
121
|
(e) => {
|
|
123
|
-
|
|
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
|
-
[
|
|
134
|
-
),
|
|
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
|
-
}, []),
|
|
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
|
-
|
|
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
|
-
[
|
|
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
|
-
|
|
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
|
-
|
|
183
|
+
tt,
|
|
185
184
|
{
|
|
186
185
|
...j,
|
|
187
|
-
ref:
|
|
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
|
-
),
|
|
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:
|
|
269
|
+
onClose: K,
|
|
271
270
|
windowWidth: _,
|
|
272
271
|
footer: {
|
|
273
272
|
cancelText: b.toLanguageString(fe, B[fe]),
|
|
274
|
-
onCancel:
|
|
273
|
+
onCancel: K,
|
|
275
274
|
applyText: b.toLanguageString(me, B[me]),
|
|
276
275
|
onApply: te
|
|
277
276
|
}
|
|
278
277
|
};
|
|
279
|
-
return /* @__PURE__ */ t.createElement(
|
|
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
|
-
|
|
283
|
+
K,
|
|
285
284
|
_,
|
|
286
285
|
b,
|
|
287
286
|
te,
|
|
288
287
|
$
|
|
289
|
-
]),
|
|
288
|
+
]), Fe = t.useCallback((e) => {
|
|
290
289
|
for (const i of e)
|
|
291
|
-
|
|
292
|
-
}, []), ae =
|
|
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":
|
|
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[
|
|
309
|
-
"k-invalid": !
|
|
310
|
-
"k-disabled":
|
|
311
|
-
"k-focus":
|
|
312
|
-
className:
|
|
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:
|
|
314
|
+
tabIndex: qe(be, x),
|
|
316
315
|
title: o.title,
|
|
317
|
-
onKeyDown:
|
|
318
|
-
onFocus:
|
|
319
|
-
onBlur:
|
|
316
|
+
onKeyDown: ze,
|
|
317
|
+
onFocus: Le,
|
|
318
|
+
onBlur: Ne,
|
|
320
319
|
dir: ae
|
|
321
320
|
},
|
|
322
321
|
/* @__PURE__ */ t.createElement(
|
|
323
|
-
|
|
322
|
+
Ye,
|
|
324
323
|
{
|
|
325
324
|
dir: ae,
|
|
326
325
|
open: g,
|
|
327
|
-
onOpen:
|
|
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:
|
|
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 ||
|
|
334
|
+
"k-icon-color-preview": N || O || P
|
|
336
335
|
})
|
|
337
336
|
},
|
|
338
|
-
|
|
339
|
-
!
|
|
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
|
-
|
|
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:
|
|
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:
|
|
360
|
-
_actionSheet:
|
|
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:
|
|
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:
|
|
391
|
-
paletteSettings:
|
|
389
|
+
gradientSettings: st,
|
|
390
|
+
paletteSettings: ut
|
|
392
391
|
};
|
|
393
392
|
ge.displayName = "KendoColorPicker";
|
|
394
393
|
export {
|
|
395
394
|
ge as ColorPicker,
|
|
396
|
-
|
|
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"),
|
|
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;
|