@progress/kendo-react-inputs 8.1.0-develop.8 → 8.1.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 +87 -90
- package/colors/ColorPicker.js +1 -1
- package/colors/ColorPicker.mjs +53 -54
- package/dist/cdn/js/kendo-react-inputs.js +1 -1
- package/index.d.mts +2 -2
- package/index.d.ts +2 -2
- package/numerictextbox/NumericTextBox.js +1 -1
- package/numerictextbox/NumericTextBox.mjs +208 -206
- package/package-metadata.mjs +1 -1
- package/package.json +8 -8
- package/radiobutton/RadioButton.js +1 -1
- package/radiobutton/RadioButton.mjs +21 -22
- package/radiobutton/RadioGroup.js +1 -1
- package/radiobutton/RadioGroup.mjs +54 -55
- package/range-slider/RangeSlider.js +7 -7
- package/range-slider/RangeSlider.mjs +161 -156
- package/rating/Rating.js +3 -3
- package/rating/Rating.mjs +145 -134
- package/rating/RatingItem.js +1 -1
- package/rating/RatingItem.mjs +40 -41
- package/signature/Signature.js +1 -1
- package/signature/Signature.mjs +151 -133
- package/textarea/TextArea.js +1 -1
- package/textarea/TextArea.mjs +64 -65
- package/textbox/Textbox.js +1 -1
- package/textbox/Textbox.mjs +33 -34
package/checkbox/Checkbox.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 ve=require("react"),t=require("prop-types"),o=require("@progress/kendo-react-common"),Ce=require("../package-metadata.js"),ye=require("@progress/kendo-react-intl"),I=require("../messages/index.js");function xe(s){const u=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const r in s)if(r!=="default"){const m=Object.getOwnPropertyDescriptor(s,r);Object.defineProperty(u,r,m.get?m:{enumerable:!0,get:()=>s[r]})}}return u.default=s,Object.freeze(u)}const e=xe(ve),W=o.createPropsContext(),O=e.forwardRef((s,u)=>{o.validatePackage(Ce.packageMetadata);const r=o.usePropsContext(W,s),{ariaDescribedBy:m,ariaLabelledBy:G,checked:B,className:J,labelClassName:Q,children:X,defaultChecked:Y,disabled:n,defaultValue:Z,id:q,size:h=A.size,rounded:g=A.rounded,label:z,labelPlacement:D,name:ee,labelOptional:te,onChange:v,onFocus:C,onBlur:y,tabIndex:ae,value:i,required:x,valid:T,validationMessage:F,validityStyles:K,visited:Pe,touched:Ee,modified:Ve,...ne}=r,l=e.useRef(null),R=e.useCallback(()=>{l.current&&l.current.focus()},[]),d=e.useCallback(()=>({element:l.current,focus:R,get name(){return l.current&&l.current.name}}),[R]);e.useImperativeHandle(u,d);const[oe,le]=e.useState(Y),[ce,se]=e.useState(Z),w=typeof i=="boolean"||i===null,P=B!==void 0,b=w,E=b?i:ce,k=P?B:b?void 0:oe,j=k===void 0&&E,V=j?E:k,p=j||b?i===null?i:void 0:i||E,L=V===null||p===null,_=o.useId(),re=ye.useLocalization(),H=a=>re.toLanguageString(a,I.messages[a]),U=H(I.checkboxValidation),ie=H(I.checkboxOptionalText),M=T!==void 0?T:x?!!k:!0;e.useEffect(()=>{l.current&&l.current.setCustomValidity&&l.current.setCustomValidity(M?"":F||U)},[M,F,U]);const f=e.useCallback((a,c)=>{!b&&!n&&(se(c),!P&&!n&&le(c)),v&&!n&&o.dispatchEvent(v,a,{...d(),value:c},{value:c})},[P,n,v,b,d]),de=e.useCallback(a=>{const c=a.target.checked;f(a,c)},[f,i]),ue=e.useCallback(a=>{if(n)return;const{keyCode:c}=a,ge=a.currentTarget.checked;c===o.Keys.space&&(a.preventDefault(),a.stopPropagation(),f(a,!ge))},[n,f]),be=e.useCallback(a=>{if(n)return;const{keyCode:c}=a;c===o.Keys.space&&a.preventDefault()},[n]),me=e.useCallback(a=>{C&&!n&&o.dispatchEvent(C,a,d(),void 0)},[C,n,d]),ke=e.useCallback(a=>{y&&!n&&o.dispatchEvent(y,a,d(),void 0)},[y,n,d]),pe=o.useDir(l,r.dir),fe=o.classNames("k-checkbox-wrap",J),$={type:"checkbox",className:o.classNames("k-checkbox",{[`k-checkbox-${o.kendoThemeMaps.sizeMap[h]||h}`]:h,[`k-rounded-${o.kendoThemeMaps.roundedMap[g]||g}`]:g,"k-indeterminate":L,"k-disabled":n,"k-invalid k-invalid":!(M||K!==void 0||K===!0)}),ref:l,name:ee,id:q||_,"aria-labelledby":G,"aria-describedby":m,checked:!!V,disabled:n,tabIndex:o.getTabIndex(ae,n),role:"checkbox",required:x!==void 0?x:!1,"aria-checked":k||V?!0:L?"mixed":!1,"aria-disabled":n||void 0,...ne,onChange:de,onKeyDown:ue,onKeyUp:be,onFocus:me,onBlur:ke},he=p===void 0?e.createElement("input",{...$}):e.createElement("input",{...$,value:w?void 0:p===null?"":p}),N=z!==void 0?e.createElement("label",{className:o.classNames("k-checkbox-label",Q),htmlFor:q||_,style:{userSelect:"none"}},e.createElement(e.Fragment,null,z),te&&e.createElement("span",{className:"k-label-optional"},ie)):null,S=e.createElement("span",{className:fe},he,X);return e.createElement(e.Fragment,null,D==="before"?e.createElement("div",{dir:"rtl"},S,N):D==="after"?e.createElement("div",{dir:"ltr"},S,N):e.createElement("div",{dir:pe},S,N))});O.propTypes={checked:t.bool,className:t.string,defaultChecked:t.bool,defaultValue:t.any,dir:t.string,disabled:t.bool,id:t.string,size:t.oneOf([null,"small","medium","large"]),rounded:t.oneOf([null,"small","medium","large"]),ariaLabelledBy:t.string,ariaDescribedBy:t.string,label:t.any,labelPlacement:t.string,labelOptional:t.bool,name:t.string,tabIndex:t.number,value:t.any,validationMessage:t.string,required:t.bool,validate:t.bool,valid:t.bool,onChange:t.func,onFocus:t.func,onBlur:t.func};const A={size:"medium",rounded:"medium"};O.displayName="KendoCheckbox";exports.Checkbox=O;exports.CheckboxPropsContext=W;
|
package/checkbox/Checkbox.mjs
CHANGED
|
@@ -8,175 +8,173 @@
|
|
|
8
8
|
"use client";
|
|
9
9
|
import * as e from "react";
|
|
10
10
|
import a from "prop-types";
|
|
11
|
-
import { createPropsContext as ge, validatePackage as
|
|
12
|
-
import { packageMetadata as
|
|
13
|
-
import { useLocalization as
|
|
14
|
-
import { messages as
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
ariaDescribedBy:
|
|
19
|
-
ariaLabelledBy:
|
|
20
|
-
checked:
|
|
21
|
-
className:
|
|
22
|
-
labelClassName:
|
|
23
|
-
children:
|
|
24
|
-
defaultChecked:
|
|
11
|
+
import { createPropsContext as ge, validatePackage as ye, usePropsContext as xe, useId as Ve, dispatchEvent as E, Keys as U, useDir as Ee, classNames as P, kendoThemeMaps as $, getTabIndex as Pe } from "@progress/kendo-react-common";
|
|
12
|
+
import { packageMetadata as Be } from "../package-metadata.mjs";
|
|
13
|
+
import { useLocalization as Ie } from "@progress/kendo-react-intl";
|
|
14
|
+
import { messages as Me, checkboxValidation as Ne, checkboxOptionalText as ze } from "../messages/index.mjs";
|
|
15
|
+
const Se = ge(), W = e.forwardRef((j, G) => {
|
|
16
|
+
ye(Be);
|
|
17
|
+
const B = xe(Se, j), {
|
|
18
|
+
ariaDescribedBy: J,
|
|
19
|
+
ariaLabelledBy: Q,
|
|
20
|
+
checked: I,
|
|
21
|
+
className: X,
|
|
22
|
+
labelClassName: Y,
|
|
23
|
+
children: Z,
|
|
24
|
+
defaultChecked: _,
|
|
25
25
|
disabled: l,
|
|
26
|
-
defaultValue:
|
|
27
|
-
id:
|
|
28
|
-
size: m,
|
|
29
|
-
rounded: b,
|
|
30
|
-
label:
|
|
31
|
-
labelPlacement:
|
|
32
|
-
name:
|
|
33
|
-
labelOptional:
|
|
26
|
+
defaultValue: ee,
|
|
27
|
+
id: M,
|
|
28
|
+
size: m = A.size,
|
|
29
|
+
rounded: b = A.rounded,
|
|
30
|
+
label: N,
|
|
31
|
+
labelPlacement: z,
|
|
32
|
+
name: ae,
|
|
33
|
+
labelOptional: te,
|
|
34
34
|
onChange: p,
|
|
35
35
|
onFocus: k,
|
|
36
36
|
onBlur: f,
|
|
37
|
-
tabIndex:
|
|
38
|
-
value:
|
|
37
|
+
tabIndex: le,
|
|
38
|
+
value: s,
|
|
39
39
|
required: h,
|
|
40
|
-
valid:
|
|
40
|
+
valid: S,
|
|
41
41
|
validationMessage: D,
|
|
42
|
-
validityStyles:
|
|
42
|
+
validityStyles: F,
|
|
43
43
|
// Removed to support direct use in Form Field component
|
|
44
|
-
visited:
|
|
45
|
-
touched:
|
|
44
|
+
visited: De,
|
|
45
|
+
touched: Fe,
|
|
46
46
|
modified: Ke,
|
|
47
|
-
...
|
|
48
|
-
} =
|
|
47
|
+
...ne
|
|
48
|
+
} = B, n = e.useRef(null), K = e.useCallback(
|
|
49
49
|
() => {
|
|
50
50
|
n.current && n.current.focus();
|
|
51
51
|
},
|
|
52
52
|
[]
|
|
53
|
-
),
|
|
53
|
+
), c = e.useCallback(
|
|
54
54
|
() => ({
|
|
55
55
|
element: n.current,
|
|
56
|
-
focus:
|
|
56
|
+
focus: K,
|
|
57
57
|
get name() {
|
|
58
58
|
return n.current && n.current.name;
|
|
59
59
|
}
|
|
60
60
|
}),
|
|
61
|
-
[
|
|
61
|
+
[K]
|
|
62
62
|
);
|
|
63
|
-
e.useImperativeHandle(
|
|
64
|
-
const [
|
|
63
|
+
e.useImperativeHandle(G, c);
|
|
64
|
+
const [oe, se] = e.useState(_), [ce, re] = e.useState(ee), T = typeof s == "boolean" || s === null, v = I !== void 0, r = T, C = r ? s : ce, i = v ? I : r ? void 0 : oe, w = i === void 0 && C, g = w ? C : i, d = w || r ? s === null ? s : void 0 : s || C, L = g === null || d === null, O = Ve(), ie = Ie(), R = (t) => ie.toLanguageString(t, Me[t]), q = R(Ne), de = R(ze), y = S !== void 0 ? S : h ? !!i : !0;
|
|
65
65
|
e.useEffect(
|
|
66
66
|
() => {
|
|
67
67
|
n.current && n.current.setCustomValidity && n.current.setCustomValidity(
|
|
68
|
-
y ? "" : D ||
|
|
68
|
+
y ? "" : D || q
|
|
69
69
|
);
|
|
70
70
|
},
|
|
71
|
-
[y, D,
|
|
71
|
+
[y, D, q]
|
|
72
72
|
);
|
|
73
73
|
const u = e.useCallback(
|
|
74
74
|
(t, o) => {
|
|
75
|
-
!r && !l && (
|
|
75
|
+
!r && !l && (re(o), !v && !l && se(o)), p && !l && E(
|
|
76
76
|
p,
|
|
77
77
|
t,
|
|
78
78
|
{
|
|
79
|
-
...
|
|
79
|
+
...c(),
|
|
80
80
|
value: o
|
|
81
81
|
},
|
|
82
82
|
{ value: o }
|
|
83
83
|
);
|
|
84
84
|
},
|
|
85
|
-
[v, l, p, r,
|
|
86
|
-
),
|
|
85
|
+
[v, l, p, r, c]
|
|
86
|
+
), ue = e.useCallback(
|
|
87
87
|
(t) => {
|
|
88
88
|
const o = t.target.checked;
|
|
89
89
|
u(t, o);
|
|
90
90
|
},
|
|
91
|
-
[u,
|
|
92
|
-
),
|
|
91
|
+
[u, s]
|
|
92
|
+
), me = e.useCallback(
|
|
93
93
|
(t) => {
|
|
94
94
|
if (l)
|
|
95
95
|
return;
|
|
96
|
-
const { keyCode: o } = t,
|
|
97
|
-
o ===
|
|
96
|
+
const { keyCode: o } = t, Ce = t.currentTarget.checked;
|
|
97
|
+
o === U.space && (t.preventDefault(), t.stopPropagation(), u(t, !Ce));
|
|
98
98
|
},
|
|
99
99
|
[l, u]
|
|
100
|
-
),
|
|
100
|
+
), be = e.useCallback(
|
|
101
101
|
(t) => {
|
|
102
102
|
if (l)
|
|
103
103
|
return;
|
|
104
104
|
const { keyCode: o } = t;
|
|
105
|
-
o ===
|
|
105
|
+
o === U.space && t.preventDefault();
|
|
106
106
|
},
|
|
107
107
|
[l]
|
|
108
|
-
),
|
|
108
|
+
), pe = e.useCallback(
|
|
109
109
|
(t) => {
|
|
110
110
|
k && !l && E(
|
|
111
111
|
k,
|
|
112
112
|
t,
|
|
113
|
-
|
|
113
|
+
c(),
|
|
114
114
|
void 0
|
|
115
115
|
);
|
|
116
116
|
},
|
|
117
|
-
[k, l,
|
|
118
|
-
),
|
|
117
|
+
[k, l, c]
|
|
118
|
+
), ke = e.useCallback(
|
|
119
119
|
(t) => {
|
|
120
120
|
f && !l && E(
|
|
121
121
|
f,
|
|
122
122
|
t,
|
|
123
|
-
|
|
123
|
+
c(),
|
|
124
124
|
void 0
|
|
125
125
|
);
|
|
126
126
|
},
|
|
127
|
-
[f, l,
|
|
128
|
-
),
|
|
127
|
+
[f, l, c]
|
|
128
|
+
), fe = Ee(n, B.dir), he = P(
|
|
129
129
|
"k-checkbox-wrap",
|
|
130
|
-
|
|
131
|
-
),
|
|
130
|
+
X
|
|
131
|
+
), H = {
|
|
132
132
|
type: "checkbox",
|
|
133
133
|
className: P(
|
|
134
134
|
"k-checkbox",
|
|
135
135
|
{
|
|
136
|
-
[`k-checkbox-${
|
|
137
|
-
[`k-rounded-${
|
|
138
|
-
"k-indeterminate":
|
|
136
|
+
[`k-checkbox-${$.sizeMap[m] || m}`]: m,
|
|
137
|
+
[`k-rounded-${$.roundedMap[b] || b}`]: b,
|
|
138
|
+
"k-indeterminate": L,
|
|
139
139
|
"k-disabled": l,
|
|
140
|
-
"k-invalid k-invalid": !(y ||
|
|
140
|
+
"k-invalid k-invalid": !(y || F !== void 0 || F === !0)
|
|
141
141
|
}
|
|
142
142
|
),
|
|
143
143
|
ref: n,
|
|
144
|
-
name:
|
|
145
|
-
id:
|
|
146
|
-
"aria-labelledby":
|
|
147
|
-
"aria-describedby":
|
|
148
|
-
checked: !!
|
|
144
|
+
name: ae,
|
|
145
|
+
id: M || O,
|
|
146
|
+
"aria-labelledby": Q,
|
|
147
|
+
"aria-describedby": J,
|
|
148
|
+
checked: !!g,
|
|
149
149
|
disabled: l,
|
|
150
|
-
tabIndex:
|
|
150
|
+
tabIndex: Pe(le, l),
|
|
151
151
|
role: "checkbox",
|
|
152
152
|
required: h !== void 0 ? h : !1,
|
|
153
|
-
"aria-checked": i ||
|
|
153
|
+
"aria-checked": i || g ? !0 : L ? "mixed" : !1,
|
|
154
154
|
"aria-disabled": l || void 0,
|
|
155
|
-
...
|
|
156
|
-
onChange:
|
|
157
|
-
onKeyDown:
|
|
158
|
-
onKeyUp:
|
|
159
|
-
onFocus:
|
|
160
|
-
onBlur:
|
|
161
|
-
},
|
|
162
|
-
e.Fragment,
|
|
163
|
-
null,
|
|
155
|
+
...ne,
|
|
156
|
+
onChange: ue,
|
|
157
|
+
onKeyDown: me,
|
|
158
|
+
onKeyUp: be,
|
|
159
|
+
onFocus: pe,
|
|
160
|
+
onBlur: ke
|
|
161
|
+
}, ve = (
|
|
164
162
|
// removing value prop is required due to bug in react where
|
|
165
163
|
// value set to undefined override default submit value
|
|
166
|
-
d === void 0 ? /* @__PURE__ */ e.createElement("input", { ...
|
|
167
|
-
), x =
|
|
164
|
+
d === void 0 ? /* @__PURE__ */ e.createElement("input", { ...H }) : /* @__PURE__ */ e.createElement("input", { ...H, value: T ? void 0 : d === null ? "" : d })
|
|
165
|
+
), x = N !== void 0 ? /* @__PURE__ */ e.createElement(
|
|
168
166
|
"label",
|
|
169
167
|
{
|
|
170
|
-
className: P("k-checkbox-label",
|
|
171
|
-
htmlFor:
|
|
168
|
+
className: P("k-checkbox-label", Y),
|
|
169
|
+
htmlFor: M || O,
|
|
172
170
|
style: { userSelect: "none" }
|
|
173
171
|
},
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
) : null
|
|
177
|
-
return /* @__PURE__ */ e.createElement(e.Fragment, null,
|
|
172
|
+
/* @__PURE__ */ e.createElement(e.Fragment, null, N),
|
|
173
|
+
te && /* @__PURE__ */ e.createElement("span", { className: "k-label-optional" }, de)
|
|
174
|
+
) : null, V = /* @__PURE__ */ e.createElement("span", { className: he }, ve, Z);
|
|
175
|
+
return /* @__PURE__ */ e.createElement(e.Fragment, null, z === "before" ? /* @__PURE__ */ e.createElement("div", { dir: "rtl" }, V, x) : z === "after" ? /* @__PURE__ */ e.createElement("div", { dir: "ltr" }, V, x) : /* @__PURE__ */ e.createElement("div", { dir: fe }, V, x));
|
|
178
176
|
});
|
|
179
|
-
|
|
177
|
+
W.propTypes = {
|
|
180
178
|
checked: a.bool,
|
|
181
179
|
className: a.string,
|
|
182
180
|
defaultChecked: a.bool,
|
|
@@ -202,13 +200,12 @@ B.propTypes = {
|
|
|
202
200
|
onFocus: a.func,
|
|
203
201
|
onBlur: a.func
|
|
204
202
|
};
|
|
205
|
-
const
|
|
203
|
+
const A = {
|
|
206
204
|
size: "medium",
|
|
207
205
|
rounded: "medium"
|
|
208
206
|
};
|
|
209
|
-
|
|
210
|
-
B.displayName = "KendoCheckbox";
|
|
207
|
+
W.displayName = "KendoCheckbox";
|
|
211
208
|
export {
|
|
212
|
-
|
|
213
|
-
|
|
209
|
+
W as Checkbox,
|
|
210
|
+
Se as CheckboxPropsContext
|
|
214
211
|
};
|
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 ce=require("react"),a=require("prop-types"),n=require("@progress/kendo-react-common"),ie=require("../package-metadata.js"),ue=require("./Picker.js"),de=require("./ColorGradient.js"),
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ce=require("react"),a=require("prop-types"),n=require("@progress/kendo-react-common"),ie=require("../package-metadata.js"),ue=require("./Picker.js"),de=require("./ColorGradient.js"),B=require("./ColorPalette.js"),pe=require("@progress/kendo-react-buttons"),fe=require("@progress/kendo-svg-icons"),L=require("../messages/index.js"),me=require("@progress/kendo-react-intl");function ke(l){const k=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const o in l)if(o!=="default"){const b=Object.getOwnPropertyDescriptor(l,o);Object.defineProperty(k,o,b.get?b:{enumerable:!0,get:()=>l[o]})}}return k.default=l,Object.freeze(k)}const e=ke(ce),be={opacity:!0},ge={palette:B.DEFAULT_PRESET,tileSize:B.DEFAULT_TILE_SIZE},A=l=>l!==void 0,z=n.createPropsContext(),M=e.forwardRef((l,k)=>{n.validatePackage(ie.packageMetadata);const o=n.usePropsContext(z,l),b=me.useLocalization(),{size:C=m.size,rounded:E=m.rounded,fillMode:q=m.fillMode,gradientSettings:F=m.gradientSettings,paletteSettings:H=m.paletteSettings,view:g=m.view,popupSettings:V,valid:j,disabled:y,tabIndex:G,icon:P,svgIcon:S,iconClassName:v,onChange:T,onFocus:w,onBlur:I,onActiveColorClick:R,className:U}=o,r=e.useRef(null),D=e.useRef(null),N=e.useRef(null),d=e.useRef(),$=e.useRef(null),[W,x]=e.useState(!1),[Z,J]=e.useState(o.defaultValue),[Q,X]=e.useState(!1),O=A(o.value),i=A(o.open),c=O?o.value:Z,p=i?o.open:Q,K=e.useCallback(()=>{r.current&&r.current.focus()},[]);e.useImperativeHandle(k,()=>({element:r.current,actionElement:$.current,value:c,focus:K}),[c,K]);const u=e.useCallback((t,f)=>{i||(!t&&!f&&r&&r.current&&r.current.focus(),X(t))},[i]),Y=e.useCallback(t=>{const{altKey:f,keyCode:s}=t;if(s===n.Keys.esc){u(!1);return}if(s===n.Keys.enter&&!i){t.preventDefault(),t.stopPropagation(),u(!p);return}f&&(s===n.Keys.up||s===n.Keys.down)&&(t.preventDefault(),t.stopPropagation(),s===n.Keys.up&&r&&r.current&&(r.current.focus(),u(!1)),s===n.Keys.down&&u(!0))},[p,i]),ee=e.useCallback(()=>{i||(D.current?D.current.focus():N.current&&N.current.focus())},[i]),te=e.useCallback(()=>{u(!p,!0)},[p]),ne=e.useCallback(t=>{R&&R.call(void 0,{syntheticEvent:t,nativeEvent:t.nativeEvent,value:c})},[R,c]),oe=e.useCallback(t=>{d.current?(clearTimeout(d.current),d.current=void 0):x(!0),w&&w.call(void 0,{nativeEvent:t.nativeEvent,syntheticEvent:t})},[w]),ae=e.useCallback(()=>{u(!1,!0),x(!1),d.current=void 0},[]),re=e.useCallback(t=>{clearTimeout(d.current),d.current=window.setTimeout(ae),I&&I.call(void 0,{nativeEvent:t.nativeEvent,syntheticEvent:t})},[I]),h=e.useCallback((t,f)=>{const s=f?t.rgbaValue:t.value;O||J(s),f&&u(!1),T&&T.call(void 0,{value:s,nativeEvent:t.nativeEvent,syntheticEvent:t.syntheticEvent})},[O,T]),le=e.useCallback(t=>h(t,!0),[A,h]),_=n.useDir(r,o.dir),se=j!==!1;return e.createElement("span",{id:o.id,role:"combobox","aria-label":o.ariaLabel,"aria-labelledby":o.ariaLabelledBy,"aria-describedby":o.ariaDescribedBy,"aria-haspopup":"dialog","aria-expanded":p,"aria-disabled":y?"true":void 0,className:n.classNames("k-colorpicker","k-picker","k-icon-picker",{[`k-picker-${n.kendoThemeMaps.sizeMap[C]||C}`]:C,[`k-picker-${q}`]:q,[`k-rounded-${n.kendoThemeMaps.roundedMap[E]||E}`]:E,"k-invalid":!se,"k-disabled":y,"k-focus":W,className:U}),ref:r,tabIndex:n.getTabIndex(G,y),title:o.title,onKeyDown:Y,onFocus:oe,onBlur:re,dir:_},e.createElement(ue.Picker,{dir:_,open:p,onOpen:ee,popupAnchor:r.current||void 0,popupSettings:{...V},input:e.createElement("span",{onClick:ne,className:"k-input-inner"},e.createElement("span",{className:n.classNames("k-value-icon","k-color-preview",{"k-no-color":!c,"k-icon-color-preview":P||S||v})},v&&e.createElement("span",{className:n.classNames("k-color-preview-icon",v)}),!v&&(P||S)&&e.createElement(n.IconWrap,{name:P,icon:S}),e.createElement("span",{className:"k-color-preview-mask",style:{backgroundColor:c}}))),button:e.createElement(pe.Button,{tabIndex:-1,type:"button",onClick:te,className:"k-input-button",rounded:null,icon:"caret-alt-down",svgIcon:fe.caretAltDownIcon,"aria-label":b.toLanguageString(L.colorPickerDropdownButtonAriaLabel,L.messages[L.colorPickerDropdownButtonAriaLabel])}),content:e.createElement(e.Fragment,null,(g==="combo"||g==="gradient")&&e.createElement(de.ColorGradient,{...F,tabIndex:0,ref:D,value:c,onChange:h}),(g==="combo"||g==="palette")&&e.createElement(B.ColorPalette,{...H,ref:N,value:c,onChange:le}))}))});M.propTypes={value:a.string,defaultValue:a.string,disabled:a.bool,view:a.oneOf(["gradient","palette","combo"]),dir:a.string,id:a.string,icon:a.string,svgIcon:n.svgIconPropType,ariaLabelledBy:a.string,ariaDescribedBy:a.string,size:a.oneOf([null,"small","medium","large"]),rounded:a.oneOf([null,"small","medium","large","full"]),fillMode:a.oneOf([null,"solid","flat","outline"]),className:a.string};const m={size:"medium",rounded:"medium",fillMode:"solid",view:"palette",gradientSettings:be,paletteSettings:ge};M.displayName="KendoColorPicker";exports.ColorPicker=M;exports.ColorPickerPropsContext=z;
|
package/colors/ColorPicker.mjs
CHANGED
|
@@ -8,42 +8,42 @@
|
|
|
8
8
|
"use client";
|
|
9
9
|
import * as e from "react";
|
|
10
10
|
import n from "prop-types";
|
|
11
|
-
import { createPropsContext as se, validatePackage as ce, usePropsContext as ue, Keys as p, useDir as de, classNames as h, kendoThemeMaps as
|
|
11
|
+
import { createPropsContext as se, validatePackage as ce, usePropsContext as ue, Keys as p, useDir as de, classNames as h, kendoThemeMaps as H, getTabIndex as pe, IconWrap as fe, svgIconPropType as me } from "@progress/kendo-react-common";
|
|
12
12
|
import { packageMetadata as ke } from "../package-metadata.mjs";
|
|
13
|
-
import { Picker as
|
|
14
|
-
import { ColorGradient as
|
|
13
|
+
import { Picker as ve } from "./Picker.mjs";
|
|
14
|
+
import { ColorGradient as be } from "./ColorGradient.mjs";
|
|
15
15
|
import { ColorPalette as ge, DEFAULT_PRESET as Ee, DEFAULT_TILE_SIZE as Ce } from "./ColorPalette.mjs";
|
|
16
16
|
import { Button as ye } from "@progress/kendo-react-buttons";
|
|
17
17
|
import { caretAltDownIcon as Te } from "@progress/kendo-svg-icons";
|
|
18
|
-
import { colorPickerDropdownButtonAriaLabel as
|
|
19
|
-
import { useLocalization as
|
|
20
|
-
const
|
|
18
|
+
import { colorPickerDropdownButtonAriaLabel as O, messages as Se } from "../messages/index.mjs";
|
|
19
|
+
import { useLocalization as we } from "@progress/kendo-react-intl";
|
|
20
|
+
const Ie = {
|
|
21
21
|
opacity: !0
|
|
22
|
-
},
|
|
22
|
+
}, Pe = {
|
|
23
23
|
palette: Ee,
|
|
24
24
|
tileSize: Ce
|
|
25
|
-
}, L = (
|
|
25
|
+
}, L = (v) => v !== void 0, De = se(), z = e.forwardRef((v, M) => {
|
|
26
26
|
ce(ke);
|
|
27
|
-
const o = ue(De,
|
|
28
|
-
size:
|
|
29
|
-
rounded: g =
|
|
30
|
-
fillMode:
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
const o = ue(De, v), V = we(), {
|
|
28
|
+
size: b = f.size,
|
|
29
|
+
rounded: g = f.rounded,
|
|
30
|
+
fillMode: A = f.fillMode,
|
|
31
|
+
gradientSettings: _ = f.gradientSettings,
|
|
32
|
+
paletteSettings: K = f.paletteSettings,
|
|
33
|
+
view: m = f.view,
|
|
34
|
+
popupSettings: G,
|
|
34
35
|
valid: U,
|
|
35
36
|
disabled: E,
|
|
36
37
|
tabIndex: $,
|
|
37
|
-
view: f,
|
|
38
38
|
icon: C,
|
|
39
39
|
svgIcon: y,
|
|
40
|
-
iconClassName:
|
|
40
|
+
iconClassName: k,
|
|
41
41
|
onChange: T,
|
|
42
42
|
onFocus: S,
|
|
43
|
-
onBlur:
|
|
44
|
-
onActiveColorClick:
|
|
43
|
+
onBlur: w,
|
|
44
|
+
onActiveColorClick: I,
|
|
45
45
|
className: W
|
|
46
|
-
} = o, a = e.useRef(null),
|
|
46
|
+
} = o, a = e.useRef(null), P = e.useRef(null), D = e.useRef(null), c = e.useRef(), Z = e.useRef(null), [j, x] = e.useState(!1), [q, J] = e.useState(o.defaultValue), [Q, X] = e.useState(!1), N = L(o.value), i = L(o.open), l = N ? o.value : q, u = i ? o.open : Q, B = e.useCallback(
|
|
47
47
|
() => {
|
|
48
48
|
a.current && a.current.focus();
|
|
49
49
|
},
|
|
@@ -54,8 +54,8 @@ const we = {
|
|
|
54
54
|
element: a.current,
|
|
55
55
|
actionElement: Z.current,
|
|
56
56
|
value: l,
|
|
57
|
-
focus:
|
|
58
|
-
}), [l,
|
|
57
|
+
focus: B
|
|
58
|
+
}), [l, B]);
|
|
59
59
|
const s = e.useCallback(
|
|
60
60
|
(t, d) => {
|
|
61
61
|
i || (!t && !d && a && a.current && a.current.focus(), X(t));
|
|
@@ -77,7 +77,7 @@ const we = {
|
|
|
77
77
|
[u, i]
|
|
78
78
|
), ee = e.useCallback(
|
|
79
79
|
() => {
|
|
80
|
-
i || (
|
|
80
|
+
i || (P.current ? P.current.focus() : D.current && D.current.focus());
|
|
81
81
|
},
|
|
82
82
|
[i]
|
|
83
83
|
), te = e.useCallback(
|
|
@@ -87,16 +87,16 @@ const we = {
|
|
|
87
87
|
[u]
|
|
88
88
|
), ne = e.useCallback(
|
|
89
89
|
(t) => {
|
|
90
|
-
|
|
90
|
+
I && I.call(void 0, {
|
|
91
91
|
syntheticEvent: t,
|
|
92
92
|
nativeEvent: t.nativeEvent,
|
|
93
93
|
value: l
|
|
94
94
|
});
|
|
95
95
|
},
|
|
96
|
-
[
|
|
96
|
+
[I, l]
|
|
97
97
|
), oe = e.useCallback(
|
|
98
98
|
(t) => {
|
|
99
|
-
c.current ? (clearTimeout(c.current), c.current = void 0) :
|
|
99
|
+
c.current ? (clearTimeout(c.current), c.current = void 0) : x(!0), S && S.call(void 0, {
|
|
100
100
|
nativeEvent: t.nativeEvent,
|
|
101
101
|
syntheticEvent: t
|
|
102
102
|
});
|
|
@@ -104,17 +104,17 @@ const we = {
|
|
|
104
104
|
[S]
|
|
105
105
|
), ae = e.useCallback(
|
|
106
106
|
() => {
|
|
107
|
-
s(!1, !0),
|
|
107
|
+
s(!1, !0), x(!1), c.current = void 0;
|
|
108
108
|
},
|
|
109
109
|
[]
|
|
110
110
|
), re = e.useCallback(
|
|
111
111
|
(t) => {
|
|
112
|
-
clearTimeout(c.current), c.current = window.setTimeout(ae),
|
|
112
|
+
clearTimeout(c.current), c.current = window.setTimeout(ae), w && w.call(void 0, {
|
|
113
113
|
nativeEvent: t.nativeEvent,
|
|
114
114
|
syntheticEvent: t
|
|
115
115
|
});
|
|
116
116
|
},
|
|
117
|
-
[
|
|
117
|
+
[w]
|
|
118
118
|
), R = e.useCallback(
|
|
119
119
|
(t, d) => {
|
|
120
120
|
const r = d ? t.rgbaValue : t.value;
|
|
@@ -128,7 +128,7 @@ const we = {
|
|
|
128
128
|
), le = e.useCallback(
|
|
129
129
|
(t) => R(t, !0),
|
|
130
130
|
[L, R]
|
|
131
|
-
),
|
|
131
|
+
), F = de(a, o.dir), ie = U !== !1;
|
|
132
132
|
return /* @__PURE__ */ e.createElement(
|
|
133
133
|
"span",
|
|
134
134
|
{
|
|
@@ -145,9 +145,9 @@ const we = {
|
|
|
145
145
|
"k-picker",
|
|
146
146
|
"k-icon-picker",
|
|
147
147
|
{
|
|
148
|
-
[`k-picker-${
|
|
149
|
-
[`k-picker-${
|
|
150
|
-
[`k-rounded-${
|
|
148
|
+
[`k-picker-${H.sizeMap[b] || b}`]: b,
|
|
149
|
+
[`k-picker-${A}`]: A,
|
|
150
|
+
[`k-rounded-${H.roundedMap[g] || g}`]: g,
|
|
151
151
|
"k-invalid": !ie,
|
|
152
152
|
"k-disabled": E,
|
|
153
153
|
"k-focus": j,
|
|
@@ -160,16 +160,16 @@ const we = {
|
|
|
160
160
|
onKeyDown: Y,
|
|
161
161
|
onFocus: oe,
|
|
162
162
|
onBlur: re,
|
|
163
|
-
dir:
|
|
163
|
+
dir: F
|
|
164
164
|
},
|
|
165
165
|
/* @__PURE__ */ e.createElement(
|
|
166
|
-
|
|
166
|
+
ve,
|
|
167
167
|
{
|
|
168
|
-
dir:
|
|
168
|
+
dir: F,
|
|
169
169
|
open: u,
|
|
170
170
|
onOpen: ee,
|
|
171
171
|
popupAnchor: a.current || void 0,
|
|
172
|
-
popupSettings: { ...
|
|
172
|
+
popupSettings: { ...G },
|
|
173
173
|
input: /* @__PURE__ */ e.createElement("span", { onClick: ne, className: "k-input-inner" }, /* @__PURE__ */ e.createElement(
|
|
174
174
|
"span",
|
|
175
175
|
{
|
|
@@ -178,12 +178,12 @@ const we = {
|
|
|
178
178
|
"k-color-preview",
|
|
179
179
|
{
|
|
180
180
|
"k-no-color": !l,
|
|
181
|
-
"k-icon-color-preview": C || y ||
|
|
181
|
+
"k-icon-color-preview": C || y || k
|
|
182
182
|
}
|
|
183
183
|
)
|
|
184
184
|
},
|
|
185
|
-
|
|
186
|
-
!
|
|
185
|
+
k && /* @__PURE__ */ e.createElement("span", { className: h("k-color-preview-icon", k) }),
|
|
186
|
+
!k && (C || y) && /* @__PURE__ */ e.createElement(fe, { name: C, icon: y }),
|
|
187
187
|
/* @__PURE__ */ e.createElement("span", { className: "k-color-preview-mask", style: { backgroundColor: l } })
|
|
188
188
|
)),
|
|
189
189
|
button: /* @__PURE__ */ e.createElement(
|
|
@@ -196,22 +196,22 @@ const we = {
|
|
|
196
196
|
rounded: null,
|
|
197
197
|
icon: "caret-alt-down",
|
|
198
198
|
svgIcon: Te,
|
|
199
|
-
"aria-label": V.toLanguageString(
|
|
199
|
+
"aria-label": V.toLanguageString(O, Se[O])
|
|
200
200
|
}
|
|
201
201
|
),
|
|
202
|
-
content: /* @__PURE__ */ e.createElement(e.Fragment, null, (
|
|
203
|
-
|
|
202
|
+
content: /* @__PURE__ */ e.createElement(e.Fragment, null, (m === "combo" || m === "gradient") && /* @__PURE__ */ e.createElement(
|
|
203
|
+
be,
|
|
204
204
|
{
|
|
205
|
-
...
|
|
205
|
+
..._,
|
|
206
206
|
tabIndex: 0,
|
|
207
|
-
ref:
|
|
207
|
+
ref: P,
|
|
208
208
|
value: l,
|
|
209
209
|
onChange: R
|
|
210
210
|
}
|
|
211
|
-
), (
|
|
211
|
+
), (m === "combo" || m === "palette") && /* @__PURE__ */ e.createElement(
|
|
212
212
|
ge,
|
|
213
213
|
{
|
|
214
|
-
...
|
|
214
|
+
...K,
|
|
215
215
|
ref: D,
|
|
216
216
|
value: l,
|
|
217
217
|
onChange: le
|
|
@@ -221,7 +221,7 @@ const we = {
|
|
|
221
221
|
)
|
|
222
222
|
);
|
|
223
223
|
});
|
|
224
|
-
|
|
224
|
+
z.propTypes = {
|
|
225
225
|
value: n.string,
|
|
226
226
|
defaultValue: n.string,
|
|
227
227
|
disabled: n.bool,
|
|
@@ -237,17 +237,16 @@ A.propTypes = {
|
|
|
237
237
|
fillMode: n.oneOf([null, "solid", "flat", "outline"]),
|
|
238
238
|
className: n.string
|
|
239
239
|
};
|
|
240
|
-
const
|
|
240
|
+
const f = {
|
|
241
241
|
size: "medium",
|
|
242
242
|
rounded: "medium",
|
|
243
243
|
fillMode: "solid",
|
|
244
244
|
view: "palette",
|
|
245
|
-
gradientSettings:
|
|
246
|
-
paletteSettings:
|
|
245
|
+
gradientSettings: Ie,
|
|
246
|
+
paletteSettings: Pe
|
|
247
247
|
};
|
|
248
|
-
|
|
249
|
-
A.displayName = "KendoColorPicker";
|
|
248
|
+
z.displayName = "KendoColorPicker";
|
|
250
249
|
export {
|
|
251
|
-
|
|
250
|
+
z as ColorPicker,
|
|
252
251
|
De as ColorPickerPropsContext
|
|
253
252
|
};
|