@progress/kendo-react-inputs 8.2.0-develop.9 → 8.2.0
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 +74 -70
- package/colors/ColorGradient.js +1 -1
- package/colors/ColorGradient.mjs +181 -121
- package/colors/ColorPalette.js +1 -1
- package/colors/ColorPalette.mjs +29 -29
- package/colors/ColorPicker.js +1 -1
- package/colors/ColorPicker.mjs +168 -152
- package/colors/FlatColorPicker.js +1 -1
- package/colors/FlatColorPicker.mjs +120 -104
- package/dist/cdn/js/kendo-react-inputs.js +1 -1
- package/index.d.mts +120 -45
- package/index.d.ts +120 -45
- package/input/Input.js +1 -1
- package/input/Input.mjs +47 -43
- package/maskedtextbox/MaskedTextBox.js +1 -1
- package/maskedtextbox/MaskedTextBox.mjs +61 -57
- package/numerictextbox/NumericTextBox.js +1 -1
- package/numerictextbox/NumericTextBox.mjs +89 -86
- package/package-metadata.mjs +1 -1
- package/package.json +8 -8
- package/range-slider/RangeSlider.js +11 -11
- package/range-slider/RangeSlider.mjs +176 -154
- package/range-slider/range-raducer.js +1 -1
- package/range-slider/range-raducer.mjs +35 -1
- package/signature/Signature.js +1 -1
- package/signature/Signature.mjs +112 -111
- package/slider/Slider.js +1 -1
- package/slider/Slider.mjs +29 -29
- package/textarea/TextArea.js +1 -1
- package/textarea/TextArea.mjs +96 -92
- package/textbox/Textbox.js +1 -1
- package/textbox/Textbox.mjs +54 -50
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 client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const fe=require("react"),r=require("prop-types"),o=require("@progress/kendo-react-common"),ke=require("../package-metadata.js"),me=require("./Picker.js"),ge=require("./ColorGradient.js"),M=require("./ColorPalette.js"),be=require("@progress/kendo-react-buttons"),ve=require("@progress/kendo-svg-icons"),F=require("../messages/index.js"),Ee=require("@progress/kendo-react-intl");function Ce(c){const m=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const a in c)if(a!=="default"){const b=Object.getOwnPropertyDescriptor(c,a);Object.defineProperty(m,a,b.get?b:{enumerable:!0,get:()=>c[a]})}}return m.default=c,Object.freeze(m)}const e=Ce(fe),ye={opacity:!0},Pe={palette:M.DEFAULT_PRESET,tileSize:M.DEFAULT_TILE_SIZE},L=c=>c!==void 0,K=o.createPropsContext(),B=e.forwardRef((c,m)=>{o.validatePackage(ke.packageMetadata);const a=o.usePropsContext(K,c),b=Ee.useLocalization(),{size:P=k.size,rounded:T=k.rounded,fillMode:q=k.fillMode,gradientSettings:U=k.gradientSettings,paletteSettings:$=k.paletteSettings,view:u=k.view,popupSettings:W,valid:Z,disabled:w,tabIndex:J,icon:S,svgIcon:I,iconClassName:v,onChange:R,onFocus:D,onBlur:N,onActiveColorClick:h,className:Q}=a,l=e.useRef(null),g=e.useRef(null),E=e.useRef(null),f=e.useRef(),X=e.useRef(null),[Y,x]=e.useState(!1),[ee,te]=e.useState(a.defaultValue),[ne,oe]=e.useState(!1),A=L(a.value),d=L(a.open),i=A?a.value:ee,C=d?a.open:ne,_=e.useCallback(()=>{l.current&&l.current.focus()},[]);e.useImperativeHandle(m,()=>({element:l.current,actionElement:X.current,value:i,focus:_}),[i,_]);const p=e.useCallback((t,s)=>{d||(!t&&!s&&l&&l.current&&l.current.focus(),oe(t))},[d]),z=e.useMemo(()=>new o.Navigation({root:l,selectors:[".k-colorpicker",".k-color-picker-popup"],tabIndex:0,keyboardEvents:{keydown:{Escape:(t,s,n)=>{p(!1)},Enter:(t,s,n)=>{!d&&t===l.current&&(n.preventDefault(),n.stopPropagation(),p(!0))},ArrowDown:(t,s,n)=>{n.altKey&&(n.preventDefault(),n.stopPropagation(),p(!0))},ArrowUp:(t,s,n)=>{n.altKey&&(n.preventDefault(),n.stopPropagation(),p(!1))},Tab:(t,s,n)=>{var V,j;if(o.getActiveElement(document)!==l.current){const G=(V=E.current)==null?void 0:V.wrapperRef.current,y=(j=g.current)==null?void 0:j.wrapperRef.current;u==="palette"&&G?o.keepFocusInContainer(n,G):u==="gradient"&&y?o.keepFocusInContainer(n,y):u==="combo"&&y&&o.keepFocusInContainer(n,y.parentElement)}}}}}),[p,d]),ae=e.useCallback(z.triggerKeyboardEvent.bind(z),[]),re=e.useCallback(()=>{d||(g.current&&g.current.wrapperRef.current?o.focusFirstFocusableChild(g.current.wrapperRef.current):E.current&&E.current.focus())},[d]),le=e.useCallback(()=>{p(!C,!0)},[C]),ce=e.useCallback(t=>{h&&h.call(void 0,{syntheticEvent:t,nativeEvent:t.nativeEvent,value:i})},[h,i]),ie=e.useCallback(t=>{f.current?(clearTimeout(f.current),f.current=void 0):x(!0),D&&D.call(void 0,{nativeEvent:t.nativeEvent,syntheticEvent:t})},[D]),se=e.useCallback(()=>{p(!1,!0),x(!1),f.current=void 0},[]),ue=e.useCallback(t=>{clearTimeout(f.current),f.current=window.setTimeout(se),N&&N.call(void 0,{nativeEvent:t.nativeEvent,syntheticEvent:t})},[N]),O=e.useCallback((t,s)=>{const n=s?t.rgbaValue:t.value;A||te(n),R&&R.call(void 0,{value:n,nativeEvent:t.nativeEvent,syntheticEvent:t.syntheticEvent})},[A,R]),de=e.useCallback(t=>O(t,!0),[L,O]),H=o.useDir(l,a.dir),pe=Z!==!1;return e.createElement("span",{id:a.id,role:"combobox","aria-label":a.ariaLabel,"aria-labelledby":a.ariaLabelledBy,"aria-describedby":a.ariaDescribedBy,"aria-haspopup":"dialog","aria-expanded":C,"aria-disabled":w?"true":void 0,className:o.classNames("k-colorpicker","k-picker","k-icon-picker",{[`k-picker-${o.kendoThemeMaps.sizeMap[P]||P}`]:P,[`k-picker-${q}`]:q,[`k-rounded-${o.kendoThemeMaps.roundedMap[T]||T}`]:T,"k-invalid":!pe,"k-disabled":w,"k-focus":Y,className:Q}),ref:l,tabIndex:o.getTabIndex(J,w),title:a.title,onKeyDown:ae,onFocus:ie,onBlur:ue,dir:H},e.createElement(me.Picker,{dir:H,open:C,onOpen:re,popupAnchor:l.current||void 0,popupSettings:{...W},input:e.createElement("span",{onClick:ce,className:"k-input-inner"},e.createElement("span",{className:o.classNames("k-value-icon","k-color-preview",{"k-no-color":!i,"k-icon-color-preview":S||I||v})},v&&e.createElement("span",{className:o.classNames("k-color-preview-icon",v)}),!v&&(S||I)&&e.createElement(o.IconWrap,{name:S,icon:I}),e.createElement("span",{className:"k-color-preview-mask",style:{backgroundColor:i}}))),button:e.createElement(be.Button,{tabIndex:-1,type:"button",onClick:le,className:"k-input-button",rounded:null,icon:"caret-alt-down",svgIcon:ve.caretAltDownIcon,"aria-label":b.toLanguageString(F.colorPickerDropdownButtonAriaLabel,F.messages[F.colorPickerDropdownButtonAriaLabel])}),content:e.createElement(e.Fragment,null,(u==="combo"||u==="gradient")&&e.createElement(ge.ColorGradient,{...U,ref:g,isInsidePopup:!0,value:i,onChange:O}),(u==="combo"||u==="palette")&&e.createElement(M.ColorPalette,{...$,ref:E,value:i,onChange:de}))}))});B.propTypes={value:r.string,defaultValue:r.string,disabled:r.bool,view:r.oneOf(["gradient","palette","combo"]),dir:r.string,id:r.string,icon:r.string,svgIcon:o.svgIconPropType,ariaLabelledBy:r.string,ariaDescribedBy:r.string,size:r.oneOf([null,"small","medium","large"]),rounded:r.oneOf([null,"small","medium","large","full"]),fillMode:r.oneOf([null,"solid","flat","outline"]),className:r.string};const k={size:"medium",rounded:"medium",fillMode:"solid",view:"palette",gradientSettings:ye,paletteSettings:Pe};B.displayName="KendoColorPicker";exports.ColorPicker=B;exports.ColorPickerPropsContext=K;
|
package/colors/ColorPicker.mjs
CHANGED
|
@@ -7,246 +7,262 @@
|
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
9
|
import * as e from "react";
|
|
10
|
-
import
|
|
11
|
-
import { createPropsContext as
|
|
12
|
-
import { packageMetadata as
|
|
13
|
-
import { Picker as
|
|
14
|
-
import { ColorGradient as
|
|
15
|
-
import { ColorPalette as
|
|
16
|
-
import { Button as
|
|
17
|
-
import { caretAltDownIcon as
|
|
18
|
-
import { colorPickerDropdownButtonAriaLabel as
|
|
19
|
-
import { useLocalization as
|
|
20
|
-
const
|
|
10
|
+
import o from "prop-types";
|
|
11
|
+
import { createPropsContext as fe, validatePackage as me, usePropsContext as ve, Navigation as ke, getActiveElement as ge, keepFocusInContainer as h, focusFirstFocusableChild as be, useDir as Ee, classNames as A, kendoThemeMaps as _, getTabIndex as Ce, IconWrap as we, svgIconPropType as ye } from "@progress/kendo-react-common";
|
|
12
|
+
import { packageMetadata as Te } from "../package-metadata.mjs";
|
|
13
|
+
import { Picker as Se } from "./Picker.mjs";
|
|
14
|
+
import { ColorGradient as Pe } from "./ColorGradient.mjs";
|
|
15
|
+
import { ColorPalette as Ie, DEFAULT_PRESET as Re, DEFAULT_TILE_SIZE as De } from "./ColorPalette.mjs";
|
|
16
|
+
import { Button as Ne } from "@progress/kendo-react-buttons";
|
|
17
|
+
import { caretAltDownIcon as he } from "@progress/kendo-svg-icons";
|
|
18
|
+
import { colorPickerDropdownButtonAriaLabel as K, messages as Ae } from "../messages/index.mjs";
|
|
19
|
+
import { useLocalization as Fe } from "@progress/kendo-react-intl";
|
|
20
|
+
const Le = {
|
|
21
21
|
opacity: !0
|
|
22
|
-
},
|
|
23
|
-
palette:
|
|
24
|
-
tileSize:
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
size:
|
|
29
|
-
rounded:
|
|
30
|
-
fillMode:
|
|
31
|
-
gradientSettings:
|
|
32
|
-
paletteSettings:
|
|
33
|
-
view:
|
|
34
|
-
popupSettings:
|
|
35
|
-
valid:
|
|
36
|
-
disabled:
|
|
37
|
-
tabIndex:
|
|
38
|
-
icon:
|
|
39
|
-
svgIcon:
|
|
40
|
-
iconClassName:
|
|
41
|
-
onChange:
|
|
42
|
-
onFocus:
|
|
43
|
-
onBlur:
|
|
44
|
-
onActiveColorClick:
|
|
45
|
-
className:
|
|
46
|
-
} =
|
|
22
|
+
}, xe = {
|
|
23
|
+
palette: Re,
|
|
24
|
+
tileSize: De
|
|
25
|
+
}, F = (b) => b !== void 0, Be = fe(), U = e.forwardRef((b, G) => {
|
|
26
|
+
me(Te);
|
|
27
|
+
const a = ve(Be, b), $ = Fe(), {
|
|
28
|
+
size: E = d.size,
|
|
29
|
+
rounded: C = d.rounded,
|
|
30
|
+
fillMode: L = d.fillMode,
|
|
31
|
+
gradientSettings: W = d.gradientSettings,
|
|
32
|
+
paletteSettings: Z = d.paletteSettings,
|
|
33
|
+
view: s = d.view,
|
|
34
|
+
popupSettings: j,
|
|
35
|
+
valid: q,
|
|
36
|
+
disabled: w,
|
|
37
|
+
tabIndex: J,
|
|
38
|
+
icon: y,
|
|
39
|
+
svgIcon: T,
|
|
40
|
+
iconClassName: m,
|
|
41
|
+
onChange: S,
|
|
42
|
+
onFocus: P,
|
|
43
|
+
onBlur: I,
|
|
44
|
+
onActiveColorClick: R,
|
|
45
|
+
className: Q
|
|
46
|
+
} = a, r = e.useRef(null), f = e.useRef(null), v = e.useRef(null), p = e.useRef(), X = e.useRef(null), [Y, x] = e.useState(!1), [ee, te] = e.useState(a.defaultValue), [ne, oe] = e.useState(!1), D = F(a.value), c = F(a.open), l = D ? a.value : ee, k = c ? a.open : ne, B = e.useCallback(
|
|
47
47
|
() => {
|
|
48
|
-
|
|
48
|
+
r.current && r.current.focus();
|
|
49
49
|
},
|
|
50
50
|
[]
|
|
51
51
|
);
|
|
52
|
-
e.useImperativeHandle(
|
|
52
|
+
e.useImperativeHandle(G, () => ({
|
|
53
53
|
// we agreed that each element will have focus method exposed
|
|
54
|
-
element:
|
|
55
|
-
actionElement:
|
|
54
|
+
element: r.current,
|
|
55
|
+
actionElement: X.current,
|
|
56
56
|
value: l,
|
|
57
57
|
focus: B
|
|
58
58
|
}), [l, B]);
|
|
59
|
-
const
|
|
60
|
-
(t,
|
|
61
|
-
|
|
59
|
+
const u = e.useCallback(
|
|
60
|
+
(t, i) => {
|
|
61
|
+
c || (!t && !i && r && r.current && r.current.focus(), oe(t));
|
|
62
62
|
},
|
|
63
|
-
[
|
|
64
|
-
),
|
|
65
|
-
(
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
63
|
+
[c]
|
|
64
|
+
), M = e.useMemo(
|
|
65
|
+
() => new ke({
|
|
66
|
+
root: r,
|
|
67
|
+
selectors: [".k-colorpicker", ".k-color-picker-popup"],
|
|
68
|
+
tabIndex: 0,
|
|
69
|
+
keyboardEvents: {
|
|
70
|
+
keydown: {
|
|
71
|
+
Escape: (t, i, n) => {
|
|
72
|
+
u(!1);
|
|
73
|
+
},
|
|
74
|
+
Enter: (t, i, n) => {
|
|
75
|
+
!c && t === r.current && (n.preventDefault(), n.stopPropagation(), u(!0));
|
|
76
|
+
},
|
|
77
|
+
ArrowDown: (t, i, n) => {
|
|
78
|
+
n.altKey && (n.preventDefault(), n.stopPropagation(), u(!0));
|
|
79
|
+
},
|
|
80
|
+
ArrowUp: (t, i, n) => {
|
|
81
|
+
n.altKey && (n.preventDefault(), n.stopPropagation(), u(!1));
|
|
82
|
+
},
|
|
83
|
+
Tab: (t, i, n) => {
|
|
84
|
+
var z, H;
|
|
85
|
+
if (ge(document) !== r.current) {
|
|
86
|
+
const V = (z = v.current) == null ? void 0 : z.wrapperRef.current, g = (H = f.current) == null ? void 0 : H.wrapperRef.current;
|
|
87
|
+
s === "palette" && V ? h(n, V) : s === "gradient" && g ? h(n, g) : s === "combo" && g && h(n, g.parentElement);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
74
91
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
), ee = e.useCallback(
|
|
92
|
+
}),
|
|
93
|
+
[u, c]
|
|
94
|
+
), ae = e.useCallback(M.triggerKeyboardEvent.bind(M), []), re = e.useCallback(
|
|
79
95
|
() => {
|
|
80
|
-
|
|
96
|
+
c || (f.current && f.current.wrapperRef.current ? be(f.current.wrapperRef.current) : v.current && v.current.focus());
|
|
81
97
|
},
|
|
82
|
-
[
|
|
83
|
-
),
|
|
98
|
+
[c]
|
|
99
|
+
), le = e.useCallback(
|
|
84
100
|
() => {
|
|
85
|
-
|
|
101
|
+
u(!k, !0);
|
|
86
102
|
},
|
|
87
|
-
[
|
|
88
|
-
),
|
|
103
|
+
[k]
|
|
104
|
+
), ie = e.useCallback(
|
|
89
105
|
(t) => {
|
|
90
|
-
|
|
106
|
+
R && R.call(void 0, {
|
|
91
107
|
syntheticEvent: t,
|
|
92
108
|
nativeEvent: t.nativeEvent,
|
|
93
109
|
value: l
|
|
94
110
|
});
|
|
95
111
|
},
|
|
96
|
-
[
|
|
97
|
-
),
|
|
112
|
+
[R, l]
|
|
113
|
+
), se = e.useCallback(
|
|
98
114
|
(t) => {
|
|
99
|
-
|
|
115
|
+
p.current ? (clearTimeout(p.current), p.current = void 0) : x(!0), P && P.call(void 0, {
|
|
100
116
|
nativeEvent: t.nativeEvent,
|
|
101
117
|
syntheticEvent: t
|
|
102
118
|
});
|
|
103
119
|
},
|
|
104
|
-
[
|
|
105
|
-
),
|
|
120
|
+
[P]
|
|
121
|
+
), ce = e.useCallback(
|
|
106
122
|
() => {
|
|
107
|
-
|
|
123
|
+
u(!1, !0), x(!1), p.current = void 0;
|
|
108
124
|
},
|
|
109
125
|
[]
|
|
110
|
-
),
|
|
126
|
+
), ue = e.useCallback(
|
|
111
127
|
(t) => {
|
|
112
|
-
clearTimeout(
|
|
128
|
+
clearTimeout(p.current), p.current = window.setTimeout(ce), I && I.call(void 0, {
|
|
113
129
|
nativeEvent: t.nativeEvent,
|
|
114
130
|
syntheticEvent: t
|
|
115
131
|
});
|
|
116
132
|
},
|
|
117
|
-
[
|
|
118
|
-
),
|
|
119
|
-
(t,
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
value:
|
|
133
|
+
[I]
|
|
134
|
+
), N = e.useCallback(
|
|
135
|
+
(t, i) => {
|
|
136
|
+
const n = i ? t.rgbaValue : t.value;
|
|
137
|
+
D || te(n), S && S.call(void 0, {
|
|
138
|
+
value: n,
|
|
123
139
|
nativeEvent: t.nativeEvent,
|
|
124
140
|
syntheticEvent: t.syntheticEvent
|
|
125
141
|
});
|
|
126
142
|
},
|
|
127
|
-
[
|
|
128
|
-
),
|
|
129
|
-
(t) =>
|
|
130
|
-
[
|
|
131
|
-
),
|
|
143
|
+
[D, S]
|
|
144
|
+
), pe = e.useCallback(
|
|
145
|
+
(t) => N(t, !0),
|
|
146
|
+
[F, N]
|
|
147
|
+
), O = Ee(r, a.dir), de = q !== !1;
|
|
132
148
|
return /* @__PURE__ */ e.createElement(
|
|
133
149
|
"span",
|
|
134
150
|
{
|
|
135
|
-
id:
|
|
151
|
+
id: a.id,
|
|
136
152
|
role: "combobox",
|
|
137
|
-
"aria-label":
|
|
138
|
-
"aria-labelledby":
|
|
139
|
-
"aria-describedby":
|
|
153
|
+
"aria-label": a.ariaLabel,
|
|
154
|
+
"aria-labelledby": a.ariaLabelledBy,
|
|
155
|
+
"aria-describedby": a.ariaDescribedBy,
|
|
140
156
|
"aria-haspopup": "dialog",
|
|
141
|
-
"aria-expanded":
|
|
142
|
-
"aria-disabled":
|
|
143
|
-
className:
|
|
157
|
+
"aria-expanded": k,
|
|
158
|
+
"aria-disabled": w ? "true" : void 0,
|
|
159
|
+
className: A(
|
|
144
160
|
"k-colorpicker",
|
|
145
161
|
"k-picker",
|
|
146
162
|
"k-icon-picker",
|
|
147
163
|
{
|
|
148
|
-
[`k-picker-${
|
|
149
|
-
[`k-picker-${
|
|
150
|
-
[`k-rounded-${
|
|
151
|
-
"k-invalid": !
|
|
152
|
-
"k-disabled":
|
|
153
|
-
"k-focus":
|
|
154
|
-
className:
|
|
164
|
+
[`k-picker-${_.sizeMap[E] || E}`]: E,
|
|
165
|
+
[`k-picker-${L}`]: L,
|
|
166
|
+
[`k-rounded-${_.roundedMap[C] || C}`]: C,
|
|
167
|
+
"k-invalid": !de,
|
|
168
|
+
"k-disabled": w,
|
|
169
|
+
"k-focus": Y,
|
|
170
|
+
className: Q
|
|
155
171
|
}
|
|
156
172
|
),
|
|
157
|
-
ref:
|
|
158
|
-
tabIndex:
|
|
159
|
-
title:
|
|
160
|
-
onKeyDown:
|
|
161
|
-
onFocus:
|
|
162
|
-
onBlur:
|
|
163
|
-
dir:
|
|
173
|
+
ref: r,
|
|
174
|
+
tabIndex: Ce(J, w),
|
|
175
|
+
title: a.title,
|
|
176
|
+
onKeyDown: ae,
|
|
177
|
+
onFocus: se,
|
|
178
|
+
onBlur: ue,
|
|
179
|
+
dir: O
|
|
164
180
|
},
|
|
165
181
|
/* @__PURE__ */ e.createElement(
|
|
166
|
-
|
|
182
|
+
Se,
|
|
167
183
|
{
|
|
168
|
-
dir:
|
|
169
|
-
open:
|
|
170
|
-
onOpen:
|
|
171
|
-
popupAnchor:
|
|
172
|
-
popupSettings: { ...
|
|
173
|
-
input: /* @__PURE__ */ e.createElement("span", { onClick:
|
|
184
|
+
dir: O,
|
|
185
|
+
open: k,
|
|
186
|
+
onOpen: re,
|
|
187
|
+
popupAnchor: r.current || void 0,
|
|
188
|
+
popupSettings: { ...j },
|
|
189
|
+
input: /* @__PURE__ */ e.createElement("span", { onClick: ie, className: "k-input-inner" }, /* @__PURE__ */ e.createElement(
|
|
174
190
|
"span",
|
|
175
191
|
{
|
|
176
|
-
className:
|
|
192
|
+
className: A(
|
|
177
193
|
"k-value-icon",
|
|
178
194
|
"k-color-preview",
|
|
179
195
|
{
|
|
180
196
|
"k-no-color": !l,
|
|
181
|
-
"k-icon-color-preview":
|
|
197
|
+
"k-icon-color-preview": y || T || m
|
|
182
198
|
}
|
|
183
199
|
)
|
|
184
200
|
},
|
|
185
|
-
|
|
186
|
-
!
|
|
201
|
+
m && /* @__PURE__ */ e.createElement("span", { className: A("k-color-preview-icon", m) }),
|
|
202
|
+
!m && (y || T) && /* @__PURE__ */ e.createElement(we, { name: y, icon: T }),
|
|
187
203
|
/* @__PURE__ */ e.createElement("span", { className: "k-color-preview-mask", style: { backgroundColor: l } })
|
|
188
204
|
)),
|
|
189
205
|
button: /* @__PURE__ */ e.createElement(
|
|
190
|
-
|
|
206
|
+
Ne,
|
|
191
207
|
{
|
|
192
208
|
tabIndex: -1,
|
|
193
209
|
type: "button",
|
|
194
|
-
onClick:
|
|
210
|
+
onClick: le,
|
|
195
211
|
className: "k-input-button",
|
|
196
212
|
rounded: null,
|
|
197
213
|
icon: "caret-alt-down",
|
|
198
|
-
svgIcon:
|
|
199
|
-
"aria-label":
|
|
214
|
+
svgIcon: he,
|
|
215
|
+
"aria-label": $.toLanguageString(K, Ae[K])
|
|
200
216
|
}
|
|
201
217
|
),
|
|
202
|
-
content: /* @__PURE__ */ e.createElement(e.Fragment, null, (
|
|
203
|
-
|
|
218
|
+
content: /* @__PURE__ */ e.createElement(e.Fragment, null, (s === "combo" || s === "gradient") && /* @__PURE__ */ e.createElement(
|
|
219
|
+
Pe,
|
|
204
220
|
{
|
|
205
|
-
...
|
|
206
|
-
|
|
207
|
-
|
|
221
|
+
...W,
|
|
222
|
+
ref: f,
|
|
223
|
+
isInsidePopup: !0,
|
|
208
224
|
value: l,
|
|
209
|
-
onChange:
|
|
225
|
+
onChange: N
|
|
210
226
|
}
|
|
211
|
-
), (
|
|
212
|
-
|
|
227
|
+
), (s === "combo" || s === "palette") && /* @__PURE__ */ e.createElement(
|
|
228
|
+
Ie,
|
|
213
229
|
{
|
|
214
|
-
...
|
|
215
|
-
ref:
|
|
230
|
+
...Z,
|
|
231
|
+
ref: v,
|
|
216
232
|
value: l,
|
|
217
|
-
onChange:
|
|
233
|
+
onChange: pe
|
|
218
234
|
}
|
|
219
235
|
))
|
|
220
236
|
}
|
|
221
237
|
)
|
|
222
238
|
);
|
|
223
239
|
});
|
|
224
|
-
|
|
225
|
-
value:
|
|
226
|
-
defaultValue:
|
|
227
|
-
disabled:
|
|
228
|
-
view:
|
|
229
|
-
dir:
|
|
230
|
-
id:
|
|
231
|
-
icon:
|
|
232
|
-
svgIcon:
|
|
233
|
-
ariaLabelledBy:
|
|
234
|
-
ariaDescribedBy:
|
|
235
|
-
size:
|
|
236
|
-
rounded:
|
|
237
|
-
fillMode:
|
|
238
|
-
className:
|
|
240
|
+
U.propTypes = {
|
|
241
|
+
value: o.string,
|
|
242
|
+
defaultValue: o.string,
|
|
243
|
+
disabled: o.bool,
|
|
244
|
+
view: o.oneOf(["gradient", "palette", "combo"]),
|
|
245
|
+
dir: o.string,
|
|
246
|
+
id: o.string,
|
|
247
|
+
icon: o.string,
|
|
248
|
+
svgIcon: ye,
|
|
249
|
+
ariaLabelledBy: o.string,
|
|
250
|
+
ariaDescribedBy: o.string,
|
|
251
|
+
size: o.oneOf([null, "small", "medium", "large"]),
|
|
252
|
+
rounded: o.oneOf([null, "small", "medium", "large", "full"]),
|
|
253
|
+
fillMode: o.oneOf([null, "solid", "flat", "outline"]),
|
|
254
|
+
className: o.string
|
|
239
255
|
};
|
|
240
|
-
const
|
|
256
|
+
const d = {
|
|
241
257
|
size: "medium",
|
|
242
258
|
rounded: "medium",
|
|
243
259
|
fillMode: "solid",
|
|
244
260
|
view: "palette",
|
|
245
|
-
gradientSettings:
|
|
246
|
-
paletteSettings:
|
|
261
|
+
gradientSettings: Le,
|
|
262
|
+
paletteSettings: xe
|
|
247
263
|
};
|
|
248
|
-
|
|
264
|
+
U.displayName = "KendoColorPicker";
|
|
249
265
|
export {
|
|
250
|
-
|
|
251
|
-
|
|
266
|
+
U as ColorPicker,
|
|
267
|
+
Be as ColorPickerPropsContext
|
|
252
268
|
};
|
|
@@ -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 client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("react"),
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("react"),o=require("prop-types"),l=require("@progress/kendo-react-common"),g=require("@progress/kendo-react-buttons"),E=require("@progress/kendo-svg-icons"),j=require("./ColorPalette.js"),A=require("./ColorGradient.js"),D=require("../package-metadata.js"),z=require("@progress/kendo-react-intl"),n=require("../messages/index.js");function K(e){const b=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const c in e)if(c!=="default"){const u=Object.getOwnPropertyDescriptor(e,c);Object.defineProperty(b,c,u.get?u:{enumerable:!0,get:()=>e[c]})}}return b.default=e,Object.freeze(b)}const a=K(O),P=a.forwardRef((e,b)=>{l.validatePackage(D.packageMetadata);const c=a.useRef(null),u=a.useRef(null),S=a.useRef(null),{defaultValue:s,showButtons:m=!0,showPreview:G=!0,showClearButton:R=!0}=e,[v,q]=a.useState((e.view||"ColorGradient")==="ColorGradient"),[r,C]=a.useState(e.value||s||void 0),[d,f]=a.useState(e.value||s||void 0),h=e.value!==void 0?e.value:void 0;a.useEffect(()=>{C(e.value)},[e.value]);const y=z.useLocalization(),w=a.useCallback(()=>{c.current&&c.current.focus()},[c]);a.useImperativeHandle(c,()=>({element:u.current,focus:w,props:e,value:h}),[h,w,e]),a.useImperativeHandle(b,()=>c.current);const B=a.useCallback(t=>{(t==="ColorGradient"&&!v||t==="ColorPalette"&&v)&&q(!v)},[v]),L=a.useCallback(t=>{if(s?(C(s),f(s)):(C(void 0),f(void 0)),e.onPreviewChange){const i={value:s||void 0,nativeEvent:t.nativeEvent,syntheticEvent:t};e.onPreviewChange.call(void 0,i)}},[s,e.onPreviewChange]),N=a.useCallback(t=>{if(C(t.value),e.onPreviewChange){const i={value:t.value,nativeEvent:t.nativeEvent,syntheticEvent:t.syntheticEvent};e.onPreviewChange.call(void 0,i)}},[e.onPreviewChange]),_=a.useCallback(t=>{if(r!==void 0&&f(r),e.onChange){const i={value:r,nativeEvent:t.nativeEvent,syntheticEvent:t};e.onChange.call(void 0,i)}},[r,e.onChange]),x=a.useCallback(()=>{C(d)},[d]),M=a.useCallback(t=>{if(C(d),e.onPreviewChange){const i={value:d,nativeEvent:t.nativeEvent,syntheticEvent:t};e.onPreviewChange.call(void 0,i)}},[d,e.onPreviewChange]),T=a.useCallback(t=>{var k;if((!t.relatedTarget||!((k=u.current)!=null&&k.contains(t.relatedTarget)))&&(!m&&r!==void 0&&f(r),!m&&e.onChange)){const V={value:r,nativeEvent:t.nativeEvent,syntheticEvent:t};e.onChange.call(void 0,V)}},[r,m,e.onChange]),I=a.useMemo(()=>new l.Navigation({root:u,selectors:[".k-coloreditor"],tabIndex:0,keyboardEvents:{keydown:{Tab:(t,i,k)=>{l.getActiveElement(document)===t?l.disableNavigatableContainer(t):l.keepFocusInContainer(k,t)},Enter:(t,i,k)=>{l.getActiveElement(document)===t&&(l.focusFirstFocusableChild(t),l.enableNavigatableContainer(t))},Escape:(t,i,k)=>{l.getActiveElement(document)!==t&&(t.focus(),l.disableNavigatableContainer(t))}}}}),[]),F=a.useCallback(I.triggerKeyboardEvent.bind(I),[]);return a.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:u,tabIndex:l.getTabIndex(e.tabIndex,e.disabled),className:l.classNames("k-flatcolorpicker k-coloreditor",{"k-disabled":e.disabled},e.className),onBlur:T,onKeyDown:F},e.header||a.createElement("div",{className:"k-coloreditor-header k-hstack"},a.createElement("div",{className:"k-coloreditor-header-actions k-hstack"},a.createElement(g.ButtonGroup,{className:"k-button-group-flat"},a.createElement(g.Button,{type:"button","aria-label":y.toLanguageString(n.flatColorPickerColorGradientBtn,n.messages[n.flatColorPickerColorGradientBtn]),togglable:!0,fillMode:"flat",selected:v,onClick:()=>B("ColorGradient"),icon:"droplet-slider",svgIcon:E.dropletSliderIcon}),a.createElement(g.Button,{type:"button","aria-label":y.toLanguageString(n.flatColorPickerColorPaletteBtn,n.messages[n.flatColorPickerColorPaletteBtn]),togglable:!0,fillMode:"flat",selected:!v,onClick:()=>B("ColorPalette"),icon:"palette",svgIcon:E.paletteIcon}))),a.createElement("div",{className:"k-spacer"}),a.createElement("div",{className:"k-coloreditor-header-actions k-hstack"},R&&a.createElement(g.Button,{type:"button",fillMode:"flat",onClick:L,"aria-label":y.toLanguageString(n.flatColorPickerClearBtn,n.messages[n.flatColorPickerClearBtn]),icon:"droplet-slash",svgIcon:E.dropletSlashIcon}),G&&a.createElement("div",{className:"k-coloreditor-preview k-vstack"},a.createElement("span",{className:l.classNames("k-coloreditor-preview-color","k-color-preview",{"k-no-color":h===void 0})},a.createElement("span",{className:"k-color-preview-mask",style:{background:r||void 0}})),a.createElement("span",{className:l.classNames("k-coloreditor-current-color","k-color-preview",{"k-no-color":d===void 0}),onClick:M},a.createElement("span",{className:"k-color-preview-mask",style:{background:d||void 0}}))))),a.createElement("div",{className:"k-coloreditor-views k-vstack"},v?a.createElement(A.ColorGradient,{ref:S,role:"none",ariaLabel:void 0,value:r,onChange:N,opacity:e.opacity,format:e.format}):a.createElement(j.ColorPalette,{ariaDisabled:!0,ariaLabelledBy:"required_label",value:r,onChange:N})),m&&a.createElement("div",{className:"k-coloreditor-footer k-actions k-actions-end k-actions-horizontal"},a.createElement(g.Button,{type:"button",className:"k-coloreditor-cancel",onClick:x},n.messages[n.flatColorPickerCancelBtn]),a.createElement(g.Button,{type:"button",themeColor:"primary",className:"k-coloreditor-apply",onClick:_},n.messages[n.flatColorPickerApplyBtn])))}),H={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};P.displayName="KendoFlatColorPicker";P.propTypes=H;exports.FlatColorPicker=P;
|