@progress/kendo-react-inputs 9.4.0-develop.24 → 9.4.0-develop.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE.txt +51 -40
- package/checkbox/Checkbox.js +1 -1
- package/checkbox/Checkbox.mjs +1 -0
- package/colors/ColorContrastLabels.js +1 -1
- package/colors/ColorContrastLabels.mjs +3 -2
- package/colors/ColorContrastSvg.js +1 -1
- package/colors/ColorContrastSvg.mjs +12 -11
- package/colors/ColorGradient.js +1 -1
- package/colors/ColorGradient.mjs +75 -85
- package/colors/ColorInput.js +1 -1
- package/colors/ColorInput.mjs +45 -55
- package/colors/ColorPalette.js +1 -1
- package/colors/ColorPalette.mjs +47 -55
- package/colors/ColorPicker.js +1 -1
- package/colors/ColorPicker.mjs +184 -327
- package/colors/FlatColorPicker.js +1 -1
- package/colors/FlatColorPicker.mjs +157 -246
- package/colors/HexInput.js +1 -1
- package/colors/HexInput.mjs +9 -10
- package/colors/Picker.js +1 -1
- package/colors/Picker.mjs +21 -20
- package/colors/models/palette-presets.js +1 -1
- package/colors/models/palette-presets.mjs +2 -1
- package/colors/utils/color-cache.js +1 -1
- package/colors/utils/color-cache.mjs +13 -12
- package/colors/utils/color-palette.service.js +1 -1
- package/colors/utils/color-palette.service.mjs +1 -0
- package/colors/utils/color-parser.js +1 -1
- package/colors/utils/color-parser.mjs +6 -5
- package/colors/utils/misc.js +1 -1
- package/colors/utils/misc.mjs +1 -0
- package/colors/utils/svg-calc.js +1 -1
- package/colors/utils/svg-calc.mjs +10 -9
- package/dist/cdn/js/kendo-react-inputs.js +1 -8
- package/index.d.mts +10 -126
- package/index.d.ts +10 -126
- package/index.js +1 -2
- package/index.mjs +4 -4
- package/input/Input.js +1 -1
- package/input/Input.mjs +9 -8
- package/input/InputClearValue.js +1 -1
- package/input/InputClearValue.mjs +4 -3
- package/input/InputPrefix.js +1 -1
- package/input/InputPrefix.mjs +5 -4
- package/input/InputSeparator.js +1 -1
- package/input/InputSeparator.mjs +9 -8
- package/input/InputSuffix.js +1 -1
- package/input/InputSuffix.mjs +5 -4
- package/input/InputValidationIcon.js +1 -1
- package/input/InputValidationIcon.mjs +4 -3
- package/maskedtextbox/MaskedTextBox.js +1 -1
- package/maskedtextbox/MaskedTextBox.mjs +1 -0
- package/maskedtextbox/masking.service.js +1 -1
- package/maskedtextbox/masking.service.mjs +1 -0
- package/maskedtextbox/parsing/combinators.js +1 -1
- package/maskedtextbox/parsing/combinators.mjs +9 -8
- package/maskedtextbox/parsing/parsers.js +1 -1
- package/maskedtextbox/parsing/parsers.mjs +1 -0
- package/maskedtextbox/parsing/result.js +1 -1
- package/maskedtextbox/parsing/result.mjs +8 -7
- package/maskedtextbox/parsing/stream.js +1 -1
- package/maskedtextbox/parsing/stream.mjs +1 -0
- package/maskedtextbox/utils.js +1 -1
- package/maskedtextbox/utils.mjs +12 -11
- package/messages/index.js +1 -1
- package/messages/index.mjs +38 -39
- package/numerictextbox/NumericTextBox.js +1 -1
- package/numerictextbox/NumericTextBox.mjs +1 -0
- package/numerictextbox/utils/index.js +1 -1
- package/numerictextbox/utils/index.mjs +1 -0
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +3 -2
- package/package.json +10 -10
- package/radiobutton/RadioButton.js +1 -1
- package/radiobutton/RadioButton.mjs +1 -0
- package/radiobutton/RadioGroup.js +1 -1
- package/radiobutton/RadioGroup.mjs +1 -0
- package/range-slider/RangeSlider.js +1 -1
- package/range-slider/RangeSlider.mjs +1 -0
- package/range-slider/range-raducer.js +1 -1
- package/range-slider/range-raducer.mjs +3 -2
- package/rating/Rating.js +1 -1
- package/rating/Rating.mjs +1 -0
- package/rating/RatingItem.js +1 -1
- package/rating/RatingItem.mjs +1 -0
- package/rating/rating-reducer.js +1 -1
- package/rating/rating-reducer.mjs +1 -0
- package/rating/utils/index.js +1 -1
- package/rating/utils/index.mjs +1 -0
- package/signature/Signature.js +1 -1
- package/signature/Signature.mjs +1 -0
- package/signature/utils/index.js +1 -1
- package/signature/utils/index.mjs +4 -3
- package/slider/Slider.js +1 -1
- package/slider/Slider.mjs +1 -0
- package/slider/SliderLabel.js +1 -1
- package/slider/SliderLabel.mjs +4 -3
- package/switch/Switch.js +1 -1
- package/switch/Switch.mjs +1 -0
- package/textarea/TextArea.js +1 -1
- package/textarea/TextArea.mjs +1 -0
- package/textbox/Textbox.js +1 -1
- package/textbox/Textbox.mjs +8 -7
- package/common/AdaptiveMode.js +0 -8
- package/common/AdaptiveMode.mjs +0 -73
package/colors/ColorPicker.mjs
CHANGED
|
@@ -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
|
-
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import { Button as
|
|
17
|
-
import { caretAltDownIcon as
|
|
18
|
-
import {
|
|
19
|
-
import { useLocalization as
|
|
20
|
-
|
|
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
|
-
},
|
|
25
|
-
palette:
|
|
26
|
-
tileSize:
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
-
|
|
58
|
-
|
|
49
|
+
e.useImperativeHandle(
|
|
50
|
+
G,
|
|
59
51
|
() => ({
|
|
60
52
|
// we agreed that each element will have focus method exposed
|
|
61
|
-
element:
|
|
62
|
-
actionElement:
|
|
63
|
-
value:
|
|
64
|
-
focus:
|
|
53
|
+
element: r.current,
|
|
54
|
+
actionElement: X.current,
|
|
55
|
+
value: l,
|
|
56
|
+
focus: B
|
|
65
57
|
}),
|
|
66
|
-
[
|
|
58
|
+
[l, B]
|
|
67
59
|
);
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
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
|
-
[
|
|
80
|
-
),
|
|
81
|
-
root:
|
|
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: (
|
|
87
|
-
|
|
71
|
+
Escape: (t, i, n) => {
|
|
72
|
+
u(!1);
|
|
88
73
|
},
|
|
89
|
-
Enter: (
|
|
90
|
-
!
|
|
74
|
+
Enter: (t, i, n) => {
|
|
75
|
+
!c && t === r.current && (n.preventDefault(), n.stopPropagation(), u(!0));
|
|
91
76
|
},
|
|
92
|
-
ArrowDown: (
|
|
93
|
-
n.altKey && (n.preventDefault(), n.stopPropagation(),
|
|
77
|
+
ArrowDown: (t, i, n) => {
|
|
78
|
+
n.altKey && (n.preventDefault(), n.stopPropagation(), u(!0));
|
|
94
79
|
},
|
|
95
|
-
ArrowUp: (
|
|
96
|
-
n.altKey && (n.preventDefault(), n.stopPropagation(),
|
|
80
|
+
ArrowUp: (t, i, n) => {
|
|
81
|
+
n.altKey && (n.preventDefault(), n.stopPropagation(), u(!1));
|
|
97
82
|
},
|
|
98
|
-
Tab: (
|
|
99
|
-
var
|
|
100
|
-
if (
|
|
101
|
-
const
|
|
102
|
-
|
|
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
|
-
}), [
|
|
108
|
-
|
|
109
|
-
}, [
|
|
110
|
-
(
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
syntheticEvent:
|
|
115
|
-
|
|
116
|
-
|
|
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
|
-
[
|
|
134
|
-
),
|
|
135
|
-
(
|
|
136
|
-
|
|
137
|
-
nativeEvent:
|
|
138
|
-
syntheticEvent:
|
|
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
|
-
[
|
|
142
|
-
),
|
|
143
|
-
|
|
144
|
-
}, []),
|
|
145
|
-
(
|
|
146
|
-
clearTimeout(
|
|
147
|
-
nativeEvent:
|
|
148
|
-
syntheticEvent:
|
|
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
|
-
[
|
|
152
|
-
),
|
|
153
|
-
(
|
|
154
|
-
|
|
155
|
-
|
|
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:
|
|
159
|
-
syntheticEvent:
|
|
160
|
-
|
|
161
|
-
element: s.current,
|
|
162
|
-
value: n
|
|
163
|
-
}
|
|
164
|
-
}), l(!1);
|
|
128
|
+
nativeEvent: t.nativeEvent,
|
|
129
|
+
syntheticEvent: t.syntheticEvent
|
|
130
|
+
});
|
|
165
131
|
},
|
|
166
|
-
[
|
|
167
|
-
),
|
|
168
|
-
(
|
|
169
|
-
[
|
|
170
|
-
),
|
|
171
|
-
|
|
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:
|
|
140
|
+
id: a.id,
|
|
294
141
|
role: "combobox",
|
|
295
|
-
"aria-label":
|
|
296
|
-
"aria-labelledby":
|
|
297
|
-
"aria-describedby":
|
|
142
|
+
"aria-label": a.ariaLabel,
|
|
143
|
+
"aria-labelledby": a.ariaLabelledBy,
|
|
144
|
+
"aria-describedby": a.ariaDescribedBy,
|
|
298
145
|
"aria-haspopup": "dialog",
|
|
299
|
-
"aria-expanded":
|
|
300
|
-
"aria-
|
|
301
|
-
"
|
|
302
|
-
|
|
303
|
-
[`k-picker-${
|
|
304
|
-
[`k-
|
|
305
|
-
|
|
306
|
-
"k-
|
|
307
|
-
"k-
|
|
308
|
-
|
|
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:
|
|
312
|
-
tabIndex:
|
|
313
|
-
title:
|
|
314
|
-
onKeyDown:
|
|
315
|
-
onFocus:
|
|
316
|
-
onBlur:
|
|
317
|
-
dir:
|
|
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__ */
|
|
320
|
-
|
|
165
|
+
/* @__PURE__ */ e.createElement(
|
|
166
|
+
Se,
|
|
321
167
|
{
|
|
322
|
-
dir:
|
|
323
|
-
open:
|
|
324
|
-
onOpen:
|
|
325
|
-
popupAnchor:
|
|
326
|
-
popupSettings: {
|
|
327
|
-
input: /* @__PURE__ */
|
|
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:
|
|
331
|
-
"k-no-color": !
|
|
332
|
-
"k-icon-color-preview":
|
|
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
|
-
|
|
336
|
-
!
|
|
337
|
-
/* @__PURE__ */
|
|
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__ */
|
|
340
|
-
|
|
185
|
+
button: /* @__PURE__ */ e.createElement(
|
|
186
|
+
Ne,
|
|
341
187
|
{
|
|
342
188
|
tabIndex: -1,
|
|
343
189
|
type: "button",
|
|
344
|
-
onClick:
|
|
190
|
+
onClick: le,
|
|
345
191
|
className: "k-input-button",
|
|
346
192
|
rounded: null,
|
|
347
193
|
icon: "caret-alt-down",
|
|
348
|
-
svgIcon:
|
|
349
|
-
"aria-label":
|
|
350
|
-
|
|
351
|
-
|
|
194
|
+
svgIcon: he,
|
|
195
|
+
"aria-label": $.toLanguageString(
|
|
196
|
+
K,
|
|
197
|
+
Ae[K]
|
|
352
198
|
)
|
|
353
199
|
}
|
|
354
200
|
),
|
|
355
|
-
content:
|
|
356
|
-
|
|
357
|
-
|
|
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
|
-
|
|
363
|
-
value:
|
|
364
|
-
defaultValue:
|
|
365
|
-
disabled:
|
|
366
|
-
view:
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
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
|
|
239
|
+
const d = {
|
|
382
240
|
size: "medium",
|
|
383
241
|
rounded: "medium",
|
|
384
242
|
fillMode: "solid",
|
|
385
243
|
view: "palette",
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
paletteSettings: ct
|
|
244
|
+
gradientSettings: Le,
|
|
245
|
+
paletteSettings: xe
|
|
389
246
|
};
|
|
390
|
-
|
|
247
|
+
U.displayName = "KendoColorPicker";
|
|
391
248
|
export {
|
|
392
|
-
|
|
393
|
-
|
|
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
|
|
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;
|