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