@progress/kendo-react-inputs 15.1.1-develop.3 → 15.2.0-develop.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/checkbox/Checkbox.js +1 -1
- package/checkbox/Checkbox.mjs +25 -25
- package/colors/ColorPicker.js +1 -1
- package/colors/ColorPicker.mjs +123 -123
- package/colors/FlatColorPicker.js +1 -1
- package/colors/FlatColorPicker.mjs +86 -86
- package/dist/cdn/js/kendo-react-inputs.js +1 -1
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +10 -10
- package/slider/Slider.js +1 -1
- package/slider/Slider.mjs +103 -103
- package/switch/Switch.js +1 -1
- package/switch/Switch.mjs +56 -54
package/colors/ColorPicker.mjs
CHANGED
|
@@ -7,26 +7,26 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import * as t from "react";
|
|
9
9
|
import o from "prop-types";
|
|
10
|
-
import { validatePackage as
|
|
10
|
+
import { validatePackage as $e, getLicenseMessage as Ge, usePropsContext as Ze, useAdaptiveModeContext as je, useWebMcpRegister as qe, canUseDOM as Je, Navigation as Qe, getActiveElement as Xe, keepFocusInContainer as z, focusFirstFocusableChild as ve, WatermarkOverlay as Ye, useDir as et, getTabIndex as tt, classNames as q, kendoThemeMaps as ge, IconWrap as nt, createPropsContext as at, svgIconPropType as ot } from "@progress/kendo-react-common";
|
|
11
11
|
import { packageMetadata as ke } from "../package-metadata.mjs";
|
|
12
|
-
import { Picker as
|
|
13
|
-
import { ColorGradient as
|
|
14
|
-
import { DEFAULT_TILE_SIZE as
|
|
15
|
-
import { FlatColorPicker as
|
|
16
|
-
import { Button as
|
|
17
|
-
import { chevronDownIcon as
|
|
18
|
-
import { colorPickerAdaptiveTitle as Ee, messages as
|
|
19
|
-
import { useLocalization as
|
|
20
|
-
import { AdaptiveMode as
|
|
21
|
-
import { ActionSheetContent as
|
|
22
|
-
const
|
|
12
|
+
import { Picker as rt } from "./Picker.mjs";
|
|
13
|
+
import { ColorGradient as it } from "./ColorGradient.mjs";
|
|
14
|
+
import { DEFAULT_TILE_SIZE as lt, DEFAULT_PRESET as st, ColorPalette as ct } from "./ColorPalette.mjs";
|
|
15
|
+
import { FlatColorPicker as D } from "./FlatColorPicker.mjs";
|
|
16
|
+
import { Button as ut } from "@progress/kendo-react-buttons";
|
|
17
|
+
import { chevronDownIcon as dt } from "@progress/kendo-svg-icons";
|
|
18
|
+
import { colorPickerAdaptiveTitle as Ee, messages as x, flatColorPickerApplyBtn as Ce, flatColorPickerCancelBtn as be, colorPickerDropdownButtonAriaLabel as we } from "../messages/index.mjs";
|
|
19
|
+
import { useLocalization as pt } from "@progress/kendo-react-intl";
|
|
20
|
+
import { AdaptiveMode as ft } from "../common/AdaptiveMode.mjs";
|
|
21
|
+
import { ActionSheetContent as mt } from "@progress/kendo-react-layout";
|
|
22
|
+
const vt = {
|
|
23
23
|
opacity: !0
|
|
24
|
-
},
|
|
24
|
+
}, gt = {
|
|
25
25
|
palette: st,
|
|
26
|
-
tileSize:
|
|
27
|
-
}, J = (N) => N !== void 0,
|
|
28
|
-
var
|
|
29
|
-
const
|
|
26
|
+
tileSize: lt
|
|
27
|
+
}, J = (N) => N !== void 0, kt = at(), Se = t.forwardRef((N, he) => {
|
|
28
|
+
var ce, ue;
|
|
29
|
+
const ye = !$e(ke, { component: "ColorPicker" }), _e = Ge(ke), r = Ze(kt, N), S = pt(), Q = je(), {
|
|
30
30
|
size: u = E.size,
|
|
31
31
|
rounded: v = E.rounded,
|
|
32
32
|
fillMode: O = E.fillMode,
|
|
@@ -34,37 +34,37 @@ const gt = {
|
|
|
34
34
|
paletteSettings: h = E.paletteSettings,
|
|
35
35
|
flatColorPickerSettings: y,
|
|
36
36
|
view: p = r.views ? void 0 : E.view,
|
|
37
|
-
views:
|
|
37
|
+
views: c = p ? void 0 : E.views,
|
|
38
38
|
activeView: X,
|
|
39
39
|
popupSettings: g,
|
|
40
40
|
valid: Te,
|
|
41
41
|
disabled: F,
|
|
42
|
-
tabIndex:
|
|
42
|
+
tabIndex: Pe,
|
|
43
43
|
icon: V,
|
|
44
44
|
svgIcon: H,
|
|
45
|
-
iconClassName:
|
|
45
|
+
iconClassName: P,
|
|
46
46
|
onChange: W,
|
|
47
47
|
onFocus: M,
|
|
48
48
|
onBlur: U,
|
|
49
49
|
onActiveColorClick: K,
|
|
50
|
-
className:
|
|
51
|
-
adaptive:
|
|
52
|
-
adaptiveTitle: Y =
|
|
50
|
+
className: Re,
|
|
51
|
+
adaptive: Ae,
|
|
52
|
+
adaptiveTitle: Y = S.toLanguageString(Ee, x[Ee]),
|
|
53
53
|
adaptiveSubtitle: ee,
|
|
54
|
-
showButtons:
|
|
55
|
-
} = r, l = t.useRef(null), _ = t.useRef(null),
|
|
54
|
+
showButtons: b = !0
|
|
55
|
+
} = r, l = t.useRef(null), _ = t.useRef(null), R = t.useRef(null), m = t.useRef(null), w = t.useRef(void 0), te = t.useRef(null), [Ie, ne] = t.useState(!1), [Be, Le] = t.useState(r.defaultValue || void 0), [ze, De] = t.useState(!1), [A, xe] = t.useState(), $ = J(r.value), k = J(r.open), i = $ ? r.value : Be, d = k ? r.open : ze, ae = t.useRef(i), I = t.useCallback(() => {
|
|
56
56
|
l.current && l.current.focus();
|
|
57
57
|
}, []);
|
|
58
58
|
t.useImperativeHandle(
|
|
59
|
-
|
|
59
|
+
he,
|
|
60
60
|
() => ({
|
|
61
61
|
// we agreed that each element will have focus method exposed
|
|
62
62
|
element: l.current,
|
|
63
63
|
actionElement: te.current,
|
|
64
64
|
value: i,
|
|
65
|
-
focus:
|
|
65
|
+
focus: I
|
|
66
66
|
}),
|
|
67
|
-
[i,
|
|
67
|
+
[i, I]
|
|
68
68
|
);
|
|
69
69
|
const oe = t.useRef(null);
|
|
70
70
|
t.useImperativeHandle(
|
|
@@ -73,64 +73,64 @@ const gt = {
|
|
|
73
73
|
element: l.current,
|
|
74
74
|
actionElement: te.current,
|
|
75
75
|
value: i,
|
|
76
|
-
focus:
|
|
76
|
+
focus: I
|
|
77
77
|
}),
|
|
78
|
-
[i,
|
|
79
|
-
),
|
|
80
|
-
const G = !!(
|
|
78
|
+
[i, I]
|
|
79
|
+
), qe("colorpicker", oe, r, r.webMcp);
|
|
80
|
+
const G = !!(A && Q && A <= Q.medium && Ae);
|
|
81
81
|
t.useEffect(() => {
|
|
82
|
-
const e =
|
|
82
|
+
const e = Je && window.ResizeObserver && new window.ResizeObserver(Ue.bind(void 0));
|
|
83
83
|
return document != null && document.body && e && e.observe(document.body), () => {
|
|
84
84
|
document != null && document.body && e && e.disconnect();
|
|
85
85
|
};
|
|
86
86
|
}, []);
|
|
87
87
|
const a = t.useCallback(
|
|
88
|
-
(e,
|
|
89
|
-
k || (!e && !
|
|
88
|
+
(e, s) => {
|
|
89
|
+
k || (!e && !s && l && l.current && l.current.focus(), De(e));
|
|
90
90
|
},
|
|
91
91
|
[k]
|
|
92
|
-
), re = t.useMemo(() => new
|
|
92
|
+
), re = t.useMemo(() => new Qe({
|
|
93
93
|
root: l,
|
|
94
94
|
selectors: [".k-colorpicker", ".k-color-picker-popup"],
|
|
95
95
|
tabIndex: 0,
|
|
96
96
|
keyboardEvents: {
|
|
97
97
|
keydown: {
|
|
98
|
-
Escape: (e,
|
|
98
|
+
Escape: (e, s, n) => {
|
|
99
99
|
a(!1);
|
|
100
100
|
},
|
|
101
|
-
Enter: (e,
|
|
101
|
+
Enter: (e, s, n) => {
|
|
102
102
|
!k && e === l.current && (n.preventDefault(), n.stopPropagation(), a(!0));
|
|
103
103
|
},
|
|
104
|
-
ArrowDown: (e,
|
|
104
|
+
ArrowDown: (e, s, n) => {
|
|
105
105
|
n.altKey && (n.preventDefault(), n.stopPropagation(), a(!0));
|
|
106
106
|
},
|
|
107
|
-
ArrowUp: (e,
|
|
107
|
+
ArrowUp: (e, s, n) => {
|
|
108
108
|
n.altKey && (n.preventDefault(), n.stopPropagation(), a(!1));
|
|
109
109
|
},
|
|
110
|
-
Tab: (e,
|
|
111
|
-
var
|
|
112
|
-
if (
|
|
113
|
-
const fe = (
|
|
114
|
-
p === "palette" && fe ?
|
|
110
|
+
Tab: (e, s, n) => {
|
|
111
|
+
var T, de, pe;
|
|
112
|
+
if (Xe(document) !== l.current) {
|
|
113
|
+
const fe = (T = R.current) == null ? void 0 : T.wrapperRef.current, L = (de = _.current) == null ? void 0 : de.wrapperRef.current, me = (pe = m.current) == null ? void 0 : pe.element;
|
|
114
|
+
p === "palette" && fe ? z(n, fe) : p === "gradient" && L ? z(n, L) : p === "combo" && L ? z(n, L.parentElement) : c && me && z(n, me);
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
|
-
}), [a, k]),
|
|
120
|
-
k || (_.current && _.current.wrapperRef.current ? ve(_.current.wrapperRef.current) :
|
|
119
|
+
}), [a, k]), Ne = t.useCallback(re.triggerKeyboardEvent.bind(re), []), Oe = t.useCallback(() => {
|
|
120
|
+
k || (_.current && _.current.wrapperRef.current ? ve(_.current.wrapperRef.current) : R.current ? R.current.focus() : m.current && m.current.element && ve(m.current.element));
|
|
121
121
|
}, [k]), B = (e) => ae.current = e, ie = t.useCallback(
|
|
122
122
|
(e) => {
|
|
123
|
-
const
|
|
123
|
+
const s = {
|
|
124
124
|
value: ae.current,
|
|
125
125
|
nativeEvent: e.nativeEvent,
|
|
126
126
|
syntheticEvent: e
|
|
127
127
|
};
|
|
128
|
-
f(
|
|
128
|
+
f(s), a(!d, !0);
|
|
129
129
|
},
|
|
130
130
|
[d]
|
|
131
131
|
), Z = t.useCallback(() => {
|
|
132
132
|
a(!1, !0);
|
|
133
|
-
}, [a]),
|
|
133
|
+
}, [a]), Fe = t.useCallback(
|
|
134
134
|
(e) => {
|
|
135
135
|
K && K.call(void 0, {
|
|
136
136
|
syntheticEvent: e,
|
|
@@ -143,29 +143,29 @@ const gt = {
|
|
|
143
143
|
});
|
|
144
144
|
},
|
|
145
145
|
[K, i]
|
|
146
|
-
),
|
|
146
|
+
), Ve = t.useCallback(
|
|
147
147
|
(e) => {
|
|
148
|
-
|
|
148
|
+
w.current ? (clearTimeout(w.current), w.current = void 0) : (ne(!0), G && !d && a(!0)), M && M.call(void 0, {
|
|
149
149
|
nativeEvent: e.nativeEvent,
|
|
150
150
|
syntheticEvent: e
|
|
151
151
|
});
|
|
152
152
|
},
|
|
153
153
|
[G, M, d, a]
|
|
154
|
-
),
|
|
155
|
-
a(!1, !0), ne(!1),
|
|
156
|
-
}, []),
|
|
154
|
+
), He = t.useCallback(() => {
|
|
155
|
+
a(!1, !0), ne(!1), w.current = void 0;
|
|
156
|
+
}, []), We = t.useCallback(
|
|
157
157
|
(e) => {
|
|
158
|
-
clearTimeout(
|
|
158
|
+
clearTimeout(w.current), w.current = window.setTimeout(He), U && U.call(void 0, {
|
|
159
159
|
nativeEvent: e.nativeEvent,
|
|
160
160
|
syntheticEvent: e
|
|
161
161
|
});
|
|
162
162
|
},
|
|
163
163
|
[U]
|
|
164
164
|
), f = t.useCallback(
|
|
165
|
-
(e,
|
|
166
|
-
var
|
|
167
|
-
const n =
|
|
168
|
-
$ ||
|
|
165
|
+
(e, s) => {
|
|
166
|
+
var T;
|
|
167
|
+
const n = s ? e.rgbaValue || "" : (T = e.value) != null ? T : "";
|
|
168
|
+
$ || Le(n), W && W.call(void 0, {
|
|
169
169
|
value: n,
|
|
170
170
|
nativeEvent: e.nativeEvent,
|
|
171
171
|
syntheticEvent: e.syntheticEvent,
|
|
@@ -181,7 +181,7 @@ const gt = {
|
|
|
181
181
|
[J, f]
|
|
182
182
|
), j = t.useCallback(
|
|
183
183
|
(e) => /* @__PURE__ */ t.createElement(t.Fragment, null, (p === "combo" || p === "gradient") && /* @__PURE__ */ t.createElement(
|
|
184
|
-
|
|
184
|
+
it,
|
|
185
185
|
{
|
|
186
186
|
...C,
|
|
187
187
|
_adaptive: e,
|
|
@@ -194,16 +194,16 @@ const gt = {
|
|
|
194
194
|
onChange: f
|
|
195
195
|
}
|
|
196
196
|
), (p === "combo" || p === "palette") && /* @__PURE__ */ t.createElement(
|
|
197
|
-
|
|
197
|
+
ct,
|
|
198
198
|
{
|
|
199
199
|
...h,
|
|
200
|
-
ref:
|
|
200
|
+
ref: R,
|
|
201
201
|
size: e ? "large" : u,
|
|
202
202
|
value: i,
|
|
203
203
|
onChange: le
|
|
204
204
|
}
|
|
205
|
-
),
|
|
206
|
-
|
|
205
|
+
), c && c[0] === "gradient" && c[1] === "palette" && /* @__PURE__ */ t.createElement(
|
|
206
|
+
D,
|
|
207
207
|
{
|
|
208
208
|
...y,
|
|
209
209
|
_paletteSettings: h,
|
|
@@ -214,13 +214,13 @@ const gt = {
|
|
|
214
214
|
views: ["gradient", "palette"],
|
|
215
215
|
activeView: X,
|
|
216
216
|
setOpen: a,
|
|
217
|
-
showButtons: e ? !1 :
|
|
217
|
+
showButtons: e ? !1 : b,
|
|
218
218
|
value: i,
|
|
219
219
|
onChange: f,
|
|
220
220
|
setAdaptiveModeValue: B
|
|
221
221
|
}
|
|
222
|
-
),
|
|
223
|
-
|
|
222
|
+
), c && c[0] === "palette" && c[1] === "gradient" && /* @__PURE__ */ t.createElement(
|
|
223
|
+
D,
|
|
224
224
|
{
|
|
225
225
|
...y,
|
|
226
226
|
_paletteSettings: h,
|
|
@@ -230,13 +230,13 @@ const gt = {
|
|
|
230
230
|
rounded: v,
|
|
231
231
|
views: ["palette", "gradient"],
|
|
232
232
|
setOpen: a,
|
|
233
|
-
showButtons: e ? !1 :
|
|
233
|
+
showButtons: e ? !1 : b,
|
|
234
234
|
value: i,
|
|
235
235
|
onChange: f,
|
|
236
236
|
setAdaptiveModeValue: B
|
|
237
237
|
}
|
|
238
|
-
),
|
|
239
|
-
|
|
238
|
+
), c && c.includes("gradient") && !c.includes("palette") && /* @__PURE__ */ t.createElement(
|
|
239
|
+
D,
|
|
240
240
|
{
|
|
241
241
|
...y,
|
|
242
242
|
_gradientSettings: { _adaptive: e, ...C },
|
|
@@ -244,14 +244,14 @@ const gt = {
|
|
|
244
244
|
size: e ? "large" : u,
|
|
245
245
|
rounded: v,
|
|
246
246
|
views: ["gradient"],
|
|
247
|
-
showButtons: e ? !1 :
|
|
247
|
+
showButtons: e ? !1 : b,
|
|
248
248
|
setOpen: a,
|
|
249
249
|
value: i,
|
|
250
250
|
onChange: f,
|
|
251
251
|
setAdaptiveModeValue: B
|
|
252
252
|
}
|
|
253
|
-
),
|
|
254
|
-
|
|
253
|
+
), c && c.includes("palette") && !c.includes("gradient") && /* @__PURE__ */ t.createElement(
|
|
254
|
+
D,
|
|
255
255
|
{
|
|
256
256
|
...y,
|
|
257
257
|
_paletteSettings: h,
|
|
@@ -260,13 +260,13 @@ const gt = {
|
|
|
260
260
|
size: e ? "large" : u,
|
|
261
261
|
rounded: v,
|
|
262
262
|
views: ["palette"],
|
|
263
|
-
showButtons: e ? !1 :
|
|
263
|
+
showButtons: e ? !1 : b,
|
|
264
264
|
setOpen: a,
|
|
265
265
|
value: i,
|
|
266
266
|
onChange: f,
|
|
267
267
|
setAdaptiveModeValue: B
|
|
268
268
|
}
|
|
269
|
-
),
|
|
269
|
+
), ye && /* @__PURE__ */ t.createElement(Ye, { message: _e })),
|
|
270
270
|
[
|
|
271
271
|
X,
|
|
272
272
|
O,
|
|
@@ -279,116 +279,116 @@ const gt = {
|
|
|
279
279
|
u,
|
|
280
280
|
i,
|
|
281
281
|
p,
|
|
282
|
-
|
|
282
|
+
c
|
|
283
283
|
]
|
|
284
|
-
),
|
|
285
|
-
var
|
|
284
|
+
), Me = t.useCallback(() => {
|
|
285
|
+
var s;
|
|
286
286
|
const e = {
|
|
287
|
-
animation: !!((
|
|
287
|
+
animation: !!((s = g == null ? void 0 : g.animate) == null || s),
|
|
288
288
|
title: Y,
|
|
289
289
|
subTitle: ee,
|
|
290
290
|
expand: d,
|
|
291
291
|
onClose: Z,
|
|
292
|
-
windowWidth:
|
|
293
|
-
footer:
|
|
294
|
-
cancelText:
|
|
295
|
-
|
|
296
|
-
|
|
292
|
+
windowWidth: A,
|
|
293
|
+
footer: b ? {
|
|
294
|
+
cancelText: S.toLanguageString(
|
|
295
|
+
be,
|
|
296
|
+
x[be]
|
|
297
297
|
),
|
|
298
298
|
onCancel: Z,
|
|
299
|
-
applyText:
|
|
299
|
+
applyText: S.toLanguageString(Ce, x[Ce]),
|
|
300
300
|
onApply: ie
|
|
301
301
|
} : void 0
|
|
302
302
|
};
|
|
303
|
-
return /* @__PURE__ */ t.createElement(
|
|
303
|
+
return /* @__PURE__ */ t.createElement(ft, { ...e }, /* @__PURE__ */ t.createElement(mt, null, j(!0)));
|
|
304
304
|
}, [
|
|
305
305
|
g == null ? void 0 : g.animate,
|
|
306
306
|
Y,
|
|
307
307
|
ee,
|
|
308
308
|
d,
|
|
309
309
|
Z,
|
|
310
|
-
|
|
311
|
-
w,
|
|
310
|
+
A,
|
|
312
311
|
b,
|
|
312
|
+
S,
|
|
313
313
|
ie,
|
|
314
314
|
j
|
|
315
|
-
]),
|
|
316
|
-
for (const
|
|
317
|
-
|
|
318
|
-
}, []),
|
|
315
|
+
]), Ue = t.useCallback((e) => {
|
|
316
|
+
for (const s of e)
|
|
317
|
+
xe(s.target.clientWidth);
|
|
318
|
+
}, []), se = et(l, r.dir), Ke = Te !== !1;
|
|
319
319
|
return /* @__PURE__ */ t.createElement(
|
|
320
320
|
"span",
|
|
321
321
|
{
|
|
322
322
|
id: r.id,
|
|
323
323
|
role: "combobox",
|
|
324
|
-
"aria-label": r.ariaLabel
|
|
324
|
+
"aria-label": r.ariaLabel,
|
|
325
325
|
"aria-labelledby": r.ariaLabelledBy,
|
|
326
326
|
"aria-describedby": r.ariaDescribedBy,
|
|
327
327
|
"aria-haspopup": "dialog",
|
|
328
328
|
"aria-expanded": d,
|
|
329
|
-
"aria-controls": d ? `k-colorpicker-popup-${(
|
|
329
|
+
"aria-controls": d ? `k-colorpicker-popup-${(ce = r.id) != null ? ce : 0}` : void 0,
|
|
330
330
|
"aria-disabled": F ? "true" : void 0,
|
|
331
331
|
className: q("k-colorpicker", "k-picker", "k-icon-picker", {
|
|
332
332
|
[`k-picker-${ge.sizeMap[u] || u}`]: u,
|
|
333
333
|
[`k-picker-${O}`]: O,
|
|
334
334
|
[`k-rounded-${ge.roundedMap[v] || v}`]: v,
|
|
335
|
-
"k-invalid":
|
|
335
|
+
"k-invalid": !Ke,
|
|
336
336
|
"k-disabled": F,
|
|
337
|
-
"k-focus":
|
|
338
|
-
className:
|
|
337
|
+
"k-focus": Ie,
|
|
338
|
+
className: Re
|
|
339
339
|
}),
|
|
340
340
|
ref: l,
|
|
341
|
-
tabIndex:
|
|
341
|
+
tabIndex: tt(Pe, F),
|
|
342
342
|
title: r.title,
|
|
343
|
-
onKeyDown:
|
|
344
|
-
onFocus:
|
|
345
|
-
onBlur:
|
|
346
|
-
dir:
|
|
343
|
+
onKeyDown: Ne,
|
|
344
|
+
onFocus: Ve,
|
|
345
|
+
onBlur: We,
|
|
346
|
+
dir: se
|
|
347
347
|
},
|
|
348
348
|
/* @__PURE__ */ t.createElement(
|
|
349
|
-
|
|
349
|
+
rt,
|
|
350
350
|
{
|
|
351
|
-
dir:
|
|
351
|
+
dir: se,
|
|
352
352
|
open: d,
|
|
353
|
-
onOpen:
|
|
353
|
+
onOpen: Oe,
|
|
354
354
|
popupAnchor: l.current || void 0,
|
|
355
355
|
popupSettings: { id: `k-colorpicker-popup-${(ue = r.id) != null ? ue : 0}`, ...g },
|
|
356
|
-
input: /* @__PURE__ */ t.createElement("span", { onClick:
|
|
356
|
+
input: /* @__PURE__ */ t.createElement("span", { onClick: Fe, className: "k-input-inner" }, /* @__PURE__ */ t.createElement(
|
|
357
357
|
"span",
|
|
358
358
|
{
|
|
359
359
|
className: q("k-value-icon", "k-color-preview", {
|
|
360
360
|
"k-no-color": !i,
|
|
361
|
-
"k-icon-color-preview": V || H ||
|
|
361
|
+
"k-icon-color-preview": V || H || P
|
|
362
362
|
})
|
|
363
363
|
},
|
|
364
|
-
|
|
365
|
-
!
|
|
364
|
+
P && /* @__PURE__ */ t.createElement("span", { className: q("k-color-preview-icon", P) }),
|
|
365
|
+
!P && (V || H) && /* @__PURE__ */ t.createElement(nt, { name: V, icon: H }),
|
|
366
366
|
/* @__PURE__ */ t.createElement("span", { className: "k-color-preview-mask", style: { backgroundColor: i } })
|
|
367
367
|
)),
|
|
368
368
|
button: /* @__PURE__ */ t.createElement(
|
|
369
|
-
|
|
369
|
+
ut,
|
|
370
370
|
{
|
|
371
371
|
tabIndex: -1,
|
|
372
372
|
type: "button",
|
|
373
373
|
onClick: () => a(!d),
|
|
374
374
|
className: "k-input-button",
|
|
375
375
|
icon: "chevron-down",
|
|
376
|
-
svgIcon:
|
|
376
|
+
svgIcon: dt,
|
|
377
377
|
size: u,
|
|
378
|
-
"aria-label":
|
|
379
|
-
|
|
380
|
-
|
|
378
|
+
"aria-label": S.toLanguageString(
|
|
379
|
+
we,
|
|
380
|
+
x[we]
|
|
381
381
|
)
|
|
382
382
|
}
|
|
383
383
|
),
|
|
384
384
|
content: j(!1),
|
|
385
385
|
_mobileMode: G,
|
|
386
|
-
_actionSheet:
|
|
386
|
+
_actionSheet: Me()
|
|
387
387
|
}
|
|
388
388
|
)
|
|
389
389
|
);
|
|
390
390
|
});
|
|
391
|
-
|
|
391
|
+
Se.propTypes = {
|
|
392
392
|
value: o.string,
|
|
393
393
|
defaultValue: o.string,
|
|
394
394
|
disabled: o.bool,
|
|
@@ -397,7 +397,7 @@ he.propTypes = {
|
|
|
397
397
|
dir: o.string,
|
|
398
398
|
id: o.string,
|
|
399
399
|
icon: o.string,
|
|
400
|
-
svgIcon:
|
|
400
|
+
svgIcon: ot,
|
|
401
401
|
ariaLabelledBy: o.string,
|
|
402
402
|
ariaDescribedBy: o.string,
|
|
403
403
|
size: o.oneOf(["small", "medium", "large"]),
|
|
@@ -414,11 +414,11 @@ const E = {
|
|
|
414
414
|
fillMode: void 0,
|
|
415
415
|
view: "palette",
|
|
416
416
|
views: ["gradient", "palette"],
|
|
417
|
-
gradientSettings:
|
|
418
|
-
paletteSettings:
|
|
417
|
+
gradientSettings: vt,
|
|
418
|
+
paletteSettings: gt
|
|
419
419
|
};
|
|
420
|
-
|
|
420
|
+
Se.displayName = "KendoColorPicker";
|
|
421
421
|
export {
|
|
422
|
-
|
|
423
|
-
|
|
422
|
+
Se as ColorPicker,
|
|
423
|
+
kt as ColorPickerPropsContext
|
|
424
424
|
};
|
|
@@ -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 X=require("react"),o=require("prop-types"),n=require("@progress/kendo-react-common"),s=require("@progress/kendo-react-buttons"),m=require("@progress/kendo-svg-icons"),Y=require("./ColorPalette.js"),Z=require("./ColorGradient.js"),x=require("../package-metadata.js"),p=require("@progress/kendo-react-intl"),l=require("../messages/index.js");function ee(e){const b=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const f in e)if(f!=="default"){const B=Object.getOwnPropertyDescriptor(e,f);Object.defineProperty(b,f,B.get?B:{enumerable:!0,get:()=>e[f]})}}return b.default=e,Object.freeze(b)}const t=ee(X),
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const X=require("react"),o=require("prop-types"),n=require("@progress/kendo-react-common"),s=require("@progress/kendo-react-buttons"),m=require("@progress/kendo-svg-icons"),Y=require("./ColorPalette.js"),Z=require("./ColorGradient.js"),x=require("../package-metadata.js"),p=require("@progress/kendo-react-intl"),l=require("../messages/index.js");function ee(e){const b=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const f in e)if(f!=="default"){const B=Object.getOwnPropertyDescriptor(e,f);Object.defineProperty(b,f,B.get?B:{enumerable:!0,get:()=>e[f]})}}return b.default=e,Object.freeze(b)}const t=ee(X),L=t.forwardRef((e,b)=>{const f=!n.validatePackage(x.packageMetadata,{component:"FlatColorPicker"}),B=n.getLicenseMessage(x.packageMetadata),h=t.useRef(null),w=t.useRef(null),F=t.useRef(null),{defaultValue:P,showButtons:N=!0,showPreview:z=!0,showClearButton:T=!0,view:E=e.views?void 0:"ColorGradient",views:d=E?void 0:["gradient","palette"],activeView:S="gradient",size:r=void 0,rounded:j=void 0}=e,[C,D]=t.useState((E||"ColorGradient")==="ColorGradient"),[v,V]=t.useState((d!=null?d:[])[0]==="gradient"&&S==="gradient"),[c,y]=t.useState(e.value||P||void 0),[k,M]=t.useState(e.value||P||void 0),_=e.value!==void 0?e.value:void 0;t.useEffect(()=>{y(e.value)},[e.value]);const g=p.useLocalization(),R=t.useCallback(()=>{h.current&&h.current.focus()},[h]);t.useImperativeHandle(h,()=>({element:w.current,focus:R,props:e,value:_}),[_,R,e]),t.useImperativeHandle(b,()=>h.current);const q=t.useCallback(a=>{(a==="ColorGradient"&&!C||a==="ColorPalette"&&C)&&D(!C)},[C]),I=t.useCallback(a=>{a==="gradient"&&!v||a==="palette"&&v||a==="palette"&&S==="gradient"?V(!v):a==="gradient"&&S==="palette"&&V(!0)},[S,v]),K=t.useCallback(a=>{var u;const i=P||void 0;if(y(i),M(i),(u=e._gradientSettings)!=null&&u._adaptive&&e.setAdaptiveModeValue&&e.setAdaptiveModeValue(i),e.onPreviewChange){const G={value:i,nativeEvent:a.nativeEvent,syntheticEvent:a};e.onPreviewChange.call(void 0,G)}},[P,e.onPreviewChange]),A=t.useCallback(a=>{var i;if(y(a.value),e.onPreviewChange){const u={value:a.value,nativeEvent:a.nativeEvent,syntheticEvent:a.syntheticEvent};e.onPreviewChange.call(void 0,u)}(i=e._gradientSettings)!=null&&i._adaptive&&e.setAdaptiveModeValue&&e.setAdaptiveModeValue(a.value)},[e.onPreviewChange]),H=t.useCallback(a=>{if(c!==void 0&&M(c),e.onChange){const i={value:c,nativeEvent:a.nativeEvent,syntheticEvent:a};e.onChange.call(void 0,i)}},[c,e.onChange]),W=t.useCallback(()=>{y(k),e.setOpen&&e.setOpen(!1)},[k]),$=t.useCallback(a=>{if(y(k),e.onPreviewChange){const i={value:k,nativeEvent:a.nativeEvent,syntheticEvent:a};e.onPreviewChange.call(void 0,i)}},[k,e.onPreviewChange]),J=t.useCallback(a=>{var u,G;if((!a.relatedTarget||!((u=w.current)!=null&&u.contains(a.relatedTarget)))&&!((G=e._gradientSettings)!=null&&G._adaptive)&&(!N&&c!==void 0&&M(c),!N&&e.onChange)){const U={value:c,nativeEvent:a.nativeEvent,syntheticEvent:a};e.onChange.call(void 0,U)}},[c,N,e.onChange]),O=t.useMemo(()=>new n.Navigation({root:w,selectors:[".k-coloreditor"],tabIndex:0,keyboardEvents:{keydown:{Tab:(a,i,u)=>{n.getActiveElement(document)===a?n.disableNavigatableContainer(a):n.keepFocusInContainer(u,a)},Enter:(a,i,u)=>{n.getActiveElement(document)===a&&(n.focusFirstFocusableChild(a),n.enableNavigatableContainer(a))},Escape:(a,i,u)=>{n.getActiveElement(document)!==a&&(a.focus(),n.disableNavigatableContainer(a))}}}}),[]),Q=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:w,tabIndex:n.getTabIndex(e.tabIndex,e.disabled),className:n.classNames("k-flatcolorpicker k-coloreditor",{[`k-coloreditor-${n.kendoThemeMaps.sizeMap[r]||r}`]:r,"k-disabled":e.disabled},e.className),onBlur:J,onKeyDown:Q},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":g.toLanguageString(l.flatColorPickerColorGradientBtn,l.messages[l.flatColorPickerColorGradientBtn]),size:r,fillMode:"flat",svgIcon:m.dropletSliderIcon,className:v?"k-selected":void 0,onClick:()=>I("gradient")}),t.createElement(s.Button,{type:"button","aria-label":g.toLanguageString(l.flatColorPickerColorPaletteBtn,l.messages[l.flatColorPickerColorPaletteBtn]),size:r,fillMode:"flat",svgIcon:m.paletteIcon,className:v?void 0:"k-selected",onClick:()=>I("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":g.toLanguageString(l.flatColorPickerColorPaletteBtn,l.messages[l.flatColorPickerColorPaletteBtn]),fillMode:"flat",size:r,svgIcon:m.paletteIcon,className:v?void 0:"k-selected",onClick:()=>I("palette")}),t.createElement(s.Button,{type:"button","aria-label":g.toLanguageString(l.flatColorPickerColorGradientBtn,l.messages[l.flatColorPickerColorGradientBtn]),fillMode:"flat",size:r,svgIcon:m.dropletSliderIcon,className:v?"k-selected":void 0,onClick:()=>I("gradient")})),E&&t.createElement(s.ButtonGroup,{className:"k-button-group-flat"},t.createElement(s.Button,{type:"button","aria-label":g.toLanguageString(l.flatColorPickerColorGradientBtn,l.messages[l.flatColorPickerColorGradientBtn]),fillMode:"flat",size:r,className:C?"k-selected":void 0,onClick:()=>q("ColorGradient"),icon:"droplet-slider",svgIcon:m.dropletSliderIcon}),t.createElement(s.Button,{type:"button","aria-label":g.toLanguageString(l.flatColorPickerColorPaletteBtn,l.messages[l.flatColorPickerColorPaletteBtn]),fillMode:"flat",size:r,className:C?void 0:"k-selected",onClick:()=>q("ColorPalette"),icon:"palette",svgIcon:m.paletteIcon}))),t.createElement("div",{className:"k-spacer"}),t.createElement("div",{className:"k-coloreditor-header-actions k-hstack"},T&&t.createElement(s.Button,{type:"button",fillMode:"flat",size:r,onClick:K,"aria-label":g.toLanguageString(l.flatColorPickerClearBtn,l.messages[l.flatColorPickerClearBtn]),icon:"droplet-slash",svgIcon:m.dropletSlashIcon}),z&&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:$},t.createElement("span",{className:"k-color-preview-mask",style:{background:k||void 0}})))),f&&t.createElement(n.WatermarkOverlay,{message:B})),t.createElement("div",{className:"k-coloreditor-views k-vstack"},(E&&C||d&&v)&&t.createElement(Z.ColorGradient,{ref:F,role:"none",ariaLabel:void 0,value:c,onChange:A,opacity:e.opacity,format:e.format,size:r,rounded:j,_adaptive:e._gradientSettings?e._gradientSettings._adaptive:void 0,...e._gradientSettings}),(E&&!C||d&&!v)&&t.createElement(Y.ColorPalette,{value:c,onChange:A,size:r,...e._paletteSettings})),N&&t.createElement("div",{className:"k-coloreditor-footer k-actions k-actions-start k-actions-horizontal"},t.createElement(s.Button,{type:"button",themeColor:"primary",className:"k-coloreditor-apply",onClick:H},g.toLanguageString(l.flatColorPickerApplyBtn,l.messages[l.flatColorPickerApplyBtn])),t.createElement(s.Button,{type:"button",className:"k-coloreditor-cancel",onClick:W},g.toLanguageString(l.flatColorPickerCancelBtn,l.messages[l.flatColorPickerCancelBtn]))))}),te={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(["small","medium","large"])};L.displayName="KendoFlatColorPicker";L.propTypes=te;exports.FlatColorPicker=L;
|