@progress/kendo-react-inputs 9.4.0-develop.18 → 9.4.0-develop.2

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