@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.
@@ -7,26 +7,26 @@
7
7
  */
8
8
  import * as t from "react";
9
9
  import o from "prop-types";
10
- import { validatePackage as Ge, getLicenseMessage as Ze, usePropsContext as je, useAdaptiveModeContext as qe, useWebMcpRegister as Je, canUseDOM as Qe, Navigation as Xe, getActiveElement as Ye, keepFocusInContainer as D, focusFirstFocusableChild as ve, WatermarkOverlay as et, useDir as tt, getTabIndex as nt, classNames as q, kendoThemeMaps as ge, IconWrap as at, createPropsContext as ot, svgIconPropType as rt } from "@progress/kendo-react-common";
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 it } from "./Picker.mjs";
13
- import { ColorGradient as lt } from "./ColorGradient.mjs";
14
- import { DEFAULT_TILE_SIZE as ct, DEFAULT_PRESET as st, ColorPalette as ut } from "./ColorPalette.mjs";
15
- import { FlatColorPicker as x } from "./FlatColorPicker.mjs";
16
- import { Button as dt } from "@progress/kendo-react-buttons";
17
- import { chevronDownIcon as pt } from "@progress/kendo-svg-icons";
18
- import { colorPickerAdaptiveTitle as Ee, messages as T, flatColorPickerApplyBtn as be, flatColorPickerCancelBtn as Ce, colorPickerAriaLabel as we, colorPickerDropdownButtonAriaLabel as Se } from "../messages/index.mjs";
19
- import { useLocalization as ft } from "@progress/kendo-react-intl";
20
- import { AdaptiveMode as mt } from "../common/AdaptiveMode.mjs";
21
- import { ActionSheetContent as vt } from "@progress/kendo-react-layout";
22
- const gt = {
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
- }, kt = {
24
+ }, gt = {
25
25
  palette: st,
26
- tileSize: ct
27
- }, J = (N) => N !== void 0, Et = ot(), he = t.forwardRef((N, ye) => {
28
- var se, ue;
29
- const _e = !Ge(ke, { component: "ColorPicker" }), Pe = Ze(ke), r = je(Et, N), b = ft(), Q = qe(), {
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: s = p ? void 0 : E.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: Re,
42
+ tabIndex: Pe,
43
43
  icon: V,
44
44
  svgIcon: H,
45
- iconClassName: R,
45
+ iconClassName: P,
46
46
  onChange: W,
47
47
  onFocus: M,
48
48
  onBlur: U,
49
49
  onActiveColorClick: K,
50
- className: Ae,
51
- adaptive: Ie,
52
- adaptiveTitle: Y = b.toLanguageString(Ee, T[Ee]),
50
+ className: Re,
51
+ adaptive: Ae,
52
+ adaptiveTitle: Y = S.toLanguageString(Ee, x[Ee]),
53
53
  adaptiveSubtitle: ee,
54
- showButtons: w = !0
55
- } = r, l = t.useRef(null), _ = t.useRef(null), A = t.useRef(null), m = t.useRef(null), S = t.useRef(void 0), te = t.useRef(null), [Le, ne] = t.useState(!1), [Be, ze] = t.useState(r.defaultValue || void 0), [De, xe] = t.useState(!1), [I, Ne] = t.useState(), $ = J(r.value), k = J(r.open), i = $ ? r.value : Be, d = k ? r.open : De, ae = t.useRef(i), L = t.useCallback(() => {
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
- ye,
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: L
65
+ focus: I
66
66
  }),
67
- [i, L]
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: L
76
+ focus: I
77
77
  }),
78
- [i, L]
79
- ), Je("colorpicker", oe, r, r.webMcp);
80
- const G = !!(I && Q && I <= Q.medium && Ie);
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 = Qe && window.ResizeObserver && new window.ResizeObserver(Ke.bind(void 0));
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, c) => {
89
- k || (!e && !c && l && l.current && l.current.focus(), xe(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 Xe({
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, c, n) => {
98
+ Escape: (e, s, n) => {
99
99
  a(!1);
100
100
  },
101
- Enter: (e, c, n) => {
101
+ Enter: (e, s, n) => {
102
102
  !k && e === l.current && (n.preventDefault(), n.stopPropagation(), a(!0));
103
103
  },
104
- ArrowDown: (e, c, n) => {
104
+ ArrowDown: (e, s, n) => {
105
105
  n.altKey && (n.preventDefault(), n.stopPropagation(), a(!0));
106
106
  },
107
- ArrowUp: (e, c, n) => {
107
+ ArrowUp: (e, s, n) => {
108
108
  n.altKey && (n.preventDefault(), n.stopPropagation(), a(!1));
109
109
  },
110
- Tab: (e, c, n) => {
111
- var P, de, pe;
112
- if (Ye(document) !== l.current) {
113
- const fe = (P = A.current) == null ? void 0 : P.wrapperRef.current, z = (de = _.current) == null ? void 0 : de.wrapperRef.current, me = (pe = m.current) == null ? void 0 : pe.element;
114
- p === "palette" && fe ? D(n, fe) : p === "gradient" && z ? D(n, z) : p === "combo" && z ? D(n, z.parentElement) : s && me && D(n, me);
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]), Oe = t.useCallback(re.triggerKeyboardEvent.bind(re), []), Fe = t.useCallback(() => {
120
- k || (_.current && _.current.wrapperRef.current ? ve(_.current.wrapperRef.current) : A.current ? A.current.focus() : m.current && m.current.element && ve(m.current.element));
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 c = {
123
+ const s = {
124
124
  value: ae.current,
125
125
  nativeEvent: e.nativeEvent,
126
126
  syntheticEvent: e
127
127
  };
128
- f(c), a(!d, !0);
128
+ f(s), a(!d, !0);
129
129
  },
130
130
  [d]
131
131
  ), Z = t.useCallback(() => {
132
132
  a(!1, !0);
133
- }, [a]), Ve = t.useCallback(
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
- ), He = t.useCallback(
146
+ ), Ve = t.useCallback(
147
147
  (e) => {
148
- S.current ? (clearTimeout(S.current), S.current = void 0) : (ne(!0), G && !d && a(!0)), M && M.call(void 0, {
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
- ), We = t.useCallback(() => {
155
- a(!1, !0), ne(!1), S.current = void 0;
156
- }, []), Me = t.useCallback(
154
+ ), He = t.useCallback(() => {
155
+ a(!1, !0), ne(!1), w.current = void 0;
156
+ }, []), We = t.useCallback(
157
157
  (e) => {
158
- clearTimeout(S.current), S.current = window.setTimeout(We), U && U.call(void 0, {
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, c) => {
166
- var P;
167
- const n = c ? e.rgbaValue || "" : (P = e.value) != null ? P : "";
168
- $ || ze(n), W && W.call(void 0, {
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
- lt,
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
- ut,
197
+ ct,
198
198
  {
199
199
  ...h,
200
- ref: A,
200
+ ref: R,
201
201
  size: e ? "large" : u,
202
202
  value: i,
203
203
  onChange: le
204
204
  }
205
- ), s && s[0] === "gradient" && s[1] === "palette" && /* @__PURE__ */ t.createElement(
206
- x,
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 : w,
217
+ showButtons: e ? !1 : b,
218
218
  value: i,
219
219
  onChange: f,
220
220
  setAdaptiveModeValue: B
221
221
  }
222
- ), s && s[0] === "palette" && s[1] === "gradient" && /* @__PURE__ */ t.createElement(
223
- x,
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 : w,
233
+ showButtons: e ? !1 : b,
234
234
  value: i,
235
235
  onChange: f,
236
236
  setAdaptiveModeValue: B
237
237
  }
238
- ), s && s.includes("gradient") && !s.includes("palette") && /* @__PURE__ */ t.createElement(
239
- x,
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 : w,
247
+ showButtons: e ? !1 : b,
248
248
  setOpen: a,
249
249
  value: i,
250
250
  onChange: f,
251
251
  setAdaptiveModeValue: B
252
252
  }
253
- ), s && s.includes("palette") && !s.includes("gradient") && /* @__PURE__ */ t.createElement(
254
- x,
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 : w,
263
+ showButtons: e ? !1 : b,
264
264
  setOpen: a,
265
265
  value: i,
266
266
  onChange: f,
267
267
  setAdaptiveModeValue: B
268
268
  }
269
- ), _e && /* @__PURE__ */ t.createElement(et, { message: Pe })),
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
- s
282
+ c
283
283
  ]
284
- ), Ue = t.useCallback(() => {
285
- var c;
284
+ ), Me = t.useCallback(() => {
285
+ var s;
286
286
  const e = {
287
- animation: !!((c = g == null ? void 0 : g.animate) == null || c),
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: I,
293
- footer: w ? {
294
- cancelText: b.toLanguageString(
295
- Ce,
296
- T[Ce]
292
+ windowWidth: A,
293
+ footer: b ? {
294
+ cancelText: S.toLanguageString(
295
+ be,
296
+ x[be]
297
297
  ),
298
298
  onCancel: Z,
299
- applyText: b.toLanguageString(be, T[be]),
299
+ applyText: S.toLanguageString(Ce, x[Ce]),
300
300
  onApply: ie
301
301
  } : void 0
302
302
  };
303
- return /* @__PURE__ */ t.createElement(mt, { ...e }, /* @__PURE__ */ t.createElement(vt, null, j(!0)));
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
- I,
311
- w,
310
+ A,
312
311
  b,
312
+ S,
313
313
  ie,
314
314
  j
315
- ]), Ke = t.useCallback((e) => {
316
- for (const c of e)
317
- Ne(c.target.clientWidth);
318
- }, []), ce = tt(l, r.dir), $e = Te !== !1;
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 || b.toLanguageString(we, T[we]),
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-${(se = r.id) != null ? se : 0}` : void 0,
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": !$e,
335
+ "k-invalid": !Ke,
336
336
  "k-disabled": F,
337
- "k-focus": Le,
338
- className: Ae
337
+ "k-focus": Ie,
338
+ className: Re
339
339
  }),
340
340
  ref: l,
341
- tabIndex: nt(Re, F),
341
+ tabIndex: tt(Pe, F),
342
342
  title: r.title,
343
- onKeyDown: Oe,
344
- onFocus: He,
345
- onBlur: Me,
346
- dir: ce
343
+ onKeyDown: Ne,
344
+ onFocus: Ve,
345
+ onBlur: We,
346
+ dir: se
347
347
  },
348
348
  /* @__PURE__ */ t.createElement(
349
- it,
349
+ rt,
350
350
  {
351
- dir: ce,
351
+ dir: se,
352
352
  open: d,
353
- onOpen: Fe,
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: Ve, className: "k-input-inner" }, /* @__PURE__ */ t.createElement(
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 || R
361
+ "k-icon-color-preview": V || H || P
362
362
  })
363
363
  },
364
- R && /* @__PURE__ */ t.createElement("span", { className: q("k-color-preview-icon", R) }),
365
- !R && (V || H) && /* @__PURE__ */ t.createElement(at, { name: V, icon: H }),
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
- dt,
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: pt,
376
+ svgIcon: dt,
377
377
  size: u,
378
- "aria-label": b.toLanguageString(
379
- Se,
380
- T[Se]
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: Ue()
386
+ _actionSheet: Me()
387
387
  }
388
388
  )
389
389
  );
390
390
  });
391
- he.propTypes = {
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: rt,
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: gt,
418
- paletteSettings: kt
417
+ gradientSettings: vt,
418
+ paletteSettings: gt
419
419
  };
420
- he.displayName = "KendoColorPicker";
420
+ Se.displayName = "KendoColorPicker";
421
421
  export {
422
- he as ColorPicker,
423
- Et as ColorPickerPropsContext
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),_=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:i=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),L=e.value!==void 0?e.value:void 0;t.useEffect(()=>{y(e.value)},[e.value]);const g=p.useLocalization(),A=t.useCallback(()=>{h.current&&h.current.focus()},[h]);t.useImperativeHandle(h,()=>({element:w.current,focus:A,props:e,value:L}),[L,A,e]),t.useImperativeHandle(b,()=>h.current);const R=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 r=P||void 0;if(y(r),M(r),(u=e._gradientSettings)!=null&&u._adaptive&&e.setAdaptiveModeValue&&e.setAdaptiveModeValue(r),e.onPreviewChange){const G={value:r,nativeEvent:a.nativeEvent,syntheticEvent:a};e.onPreviewChange.call(void 0,G)}},[P,e.onPreviewChange]),q=t.useCallback(a=>{var r;if(y(a.value),e.onPreviewChange){const u={value:a.value,nativeEvent:a.nativeEvent,syntheticEvent:a.syntheticEvent};e.onPreviewChange.call(void 0,u)}(r=e._gradientSettings)!=null&&r._adaptive&&e.setAdaptiveModeValue&&e.setAdaptiveModeValue(a.value)},[e.onPreviewChange]),H=t.useCallback(a=>{if(c!==void 0&&M(c),e.onChange){const r={value:c,nativeEvent:a.nativeEvent,syntheticEvent:a};e.onChange.call(void 0,r)}},[c,e.onChange]),W=t.useCallback(()=>{y(k),e.setOpen&&e.setOpen(!1)},[k]),$=t.useCallback(a=>{if(y(k),e.onPreviewChange){const r={value:k,nativeEvent:a.nativeEvent,syntheticEvent:a};e.onPreviewChange.call(void 0,r)}},[k,e.onPreviewChange]),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,r,u)=>{n.getActiveElement(document)===a?n.disableNavigatableContainer(a):n.keepFocusInContainer(u,a)},Enter:(a,r,u)=>{n.getActiveElement(document)===a&&(n.focusFirstFocusableChild(a),n.enableNavigatableContainer(a))},Escape:(a,r,u)=>{n.getActiveElement(document)!==a&&(a.focus(),n.disableNavigatableContainer(a))}}}}),[]),Q=t.useCallback(O.triggerKeyboardEvent.bind(O),[]);return t.createElement("div",{id:e.id,role:"textbox","aria-label":e.ariaLabel||g.toLanguageString(l.flatColorPickerAriaLabel,l.messages[l.flatColorPickerAriaLabel]),"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[i]||i}`]:i,"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:i,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:i,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:i,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:i,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:i,className:C?"k-selected":void 0,onClick:()=>R("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:i,className:C?void 0:"k-selected",onClick:()=>R("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:i,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":L===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:q,opacity:e.opacity,format:e.format,size:i,rounded:j,_adaptive:e._gradientSettings?e._gradientSettings._adaptive:void 0,...e._gradientSettings}),(E&&!C||d&&!v)&&t.createElement(Y.ColorPalette,{value:c,onChange:q,size:i,...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"])};_.displayName="KendoFlatColorPicker";_.propTypes=te;exports.FlatColorPicker=_;
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;