@progress/kendo-react-inputs 9.4.0-develop.24 → 9.4.0-develop.4

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