@progress/kendo-react-inputs 9.4.0-develop.2 → 9.4.0-develop.20
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 +40 -51
- package/checkbox/Checkbox.js +1 -1
- package/checkbox/Checkbox.mjs +0 -1
- package/colors/ColorContrastLabels.js +1 -1
- package/colors/ColorContrastLabels.mjs +2 -3
- package/colors/ColorContrastSvg.js +1 -1
- package/colors/ColorContrastSvg.mjs +11 -12
- package/colors/ColorGradient.js +1 -1
- package/colors/ColorGradient.mjs +85 -75
- package/colors/ColorInput.js +1 -1
- package/colors/ColorInput.mjs +55 -45
- package/colors/ColorPalette.js +1 -1
- package/colors/ColorPalette.mjs +55 -47
- package/colors/ColorPicker.js +1 -1
- package/colors/ColorPicker.mjs +312 -183
- package/colors/FlatColorPicker.js +1 -1
- package/colors/FlatColorPicker.mjs +224 -139
- package/colors/HexInput.js +1 -1
- package/colors/HexInput.mjs +10 -9
- package/colors/Picker.js +1 -1
- package/colors/Picker.mjs +22 -23
- package/colors/models/palette-presets.js +1 -1
- package/colors/models/palette-presets.mjs +1 -2
- package/colors/utils/color-cache.js +1 -1
- package/colors/utils/color-cache.mjs +12 -13
- package/colors/utils/color-palette.service.js +1 -1
- package/colors/utils/color-palette.service.mjs +0 -1
- package/colors/utils/color-parser.js +1 -1
- package/colors/utils/color-parser.mjs +5 -6
- package/colors/utils/misc.js +1 -1
- package/colors/utils/misc.mjs +0 -1
- package/colors/utils/svg-calc.js +1 -1
- package/colors/utils/svg-calc.mjs +9 -10
- package/common/AdaptiveMode.js +8 -0
- package/common/AdaptiveMode.mjs +73 -0
- package/dist/cdn/js/kendo-react-inputs.js +8 -1
- package/index.d.mts +118 -10
- package/index.d.ts +118 -10
- package/index.js +2 -1
- package/index.mjs +4 -4
- package/input/Input.js +1 -1
- package/input/Input.mjs +8 -9
- package/input/InputClearValue.js +1 -1
- package/input/InputClearValue.mjs +3 -4
- package/input/InputPrefix.js +1 -1
- package/input/InputPrefix.mjs +4 -5
- package/input/InputSeparator.js +1 -1
- package/input/InputSeparator.mjs +8 -9
- package/input/InputSuffix.js +1 -1
- package/input/InputSuffix.mjs +4 -5
- package/input/InputValidationIcon.js +1 -1
- package/input/InputValidationIcon.mjs +3 -4
- package/maskedtextbox/MaskedTextBox.js +1 -1
- package/maskedtextbox/MaskedTextBox.mjs +0 -1
- package/maskedtextbox/masking.service.js +1 -1
- package/maskedtextbox/masking.service.mjs +0 -1
- package/maskedtextbox/parsing/combinators.js +1 -1
- package/maskedtextbox/parsing/combinators.mjs +8 -9
- package/maskedtextbox/parsing/parsers.js +1 -1
- package/maskedtextbox/parsing/parsers.mjs +0 -1
- package/maskedtextbox/parsing/result.js +1 -1
- package/maskedtextbox/parsing/result.mjs +7 -8
- package/maskedtextbox/parsing/stream.js +1 -1
- package/maskedtextbox/parsing/stream.mjs +0 -1
- package/maskedtextbox/utils.js +1 -1
- package/maskedtextbox/utils.mjs +11 -12
- package/messages/index.js +1 -1
- package/messages/index.mjs +39 -38
- package/numerictextbox/NumericTextBox.js +1 -1
- package/numerictextbox/NumericTextBox.mjs +0 -1
- package/numerictextbox/utils/index.js +1 -1
- package/numerictextbox/utils/index.mjs +0 -1
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -3
- package/package.json +9 -9
- package/radiobutton/RadioButton.js +1 -1
- package/radiobutton/RadioButton.mjs +0 -1
- package/radiobutton/RadioGroup.js +1 -1
- package/radiobutton/RadioGroup.mjs +0 -1
- package/range-slider/RangeSlider.js +1 -1
- package/range-slider/RangeSlider.mjs +0 -1
- package/range-slider/range-raducer.js +1 -1
- package/range-slider/range-raducer.mjs +2 -3
- package/rating/Rating.js +1 -1
- package/rating/Rating.mjs +0 -1
- package/rating/RatingItem.js +1 -1
- package/rating/RatingItem.mjs +0 -1
- package/rating/rating-reducer.js +1 -1
- package/rating/rating-reducer.mjs +0 -1
- package/rating/utils/index.js +1 -1
- package/rating/utils/index.mjs +0 -1
- package/signature/Signature.js +1 -1
- package/signature/Signature.mjs +0 -1
- package/signature/utils/index.js +1 -1
- package/signature/utils/index.mjs +3 -4
- package/slider/Slider.js +1 -1
- package/slider/Slider.mjs +0 -1
- package/slider/SliderLabel.js +1 -1
- package/slider/SliderLabel.mjs +3 -4
- package/switch/Switch.js +1 -1
- package/switch/Switch.mjs +0 -1
- package/textarea/TextArea.js +1 -1
- package/textarea/TextArea.mjs +0 -1
- package/textbox/Textbox.js +1 -1
- package/textbox/Textbox.mjs +7 -8
package/colors/ColorPicker.mjs
CHANGED
|
@@ -5,247 +5,376 @@
|
|
|
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
|
-
|
|
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 = {
|
|
21
23
|
opacity: !0
|
|
22
|
-
},
|
|
23
|
-
palette:
|
|
24
|
-
tileSize:
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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();
|
|
48
56
|
}, []);
|
|
49
|
-
|
|
50
|
-
|
|
57
|
+
t.useImperativeHandle(
|
|
58
|
+
ge,
|
|
51
59
|
() => ({
|
|
52
60
|
// we agreed that each element will have focus method exposed
|
|
53
|
-
element:
|
|
54
|
-
actionElement:
|
|
55
|
-
value:
|
|
56
|
-
focus:
|
|
61
|
+
element: l.current,
|
|
62
|
+
actionElement: be.current,
|
|
63
|
+
value: i,
|
|
64
|
+
focus: X
|
|
57
65
|
}),
|
|
58
|
-
[
|
|
66
|
+
[i, X]
|
|
59
67
|
);
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
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));
|
|
63
78
|
},
|
|
64
|
-
[
|
|
65
|
-
),
|
|
66
|
-
root:
|
|
79
|
+
[g]
|
|
80
|
+
), Y = t.useMemo(() => new Ke({
|
|
81
|
+
root: l,
|
|
67
82
|
selectors: [".k-colorpicker", ".k-color-picker-popup"],
|
|
68
83
|
tabIndex: 0,
|
|
69
84
|
keyboardEvents: {
|
|
70
85
|
keydown: {
|
|
71
|
-
Escape: (
|
|
72
|
-
|
|
86
|
+
Escape: (e, c, n) => {
|
|
87
|
+
d(!1);
|
|
73
88
|
},
|
|
74
|
-
Enter: (
|
|
75
|
-
!
|
|
89
|
+
Enter: (e, c, n) => {
|
|
90
|
+
!g && e === l.current && (n.preventDefault(), n.stopPropagation(), d(!0));
|
|
76
91
|
},
|
|
77
|
-
ArrowDown: (
|
|
78
|
-
n.altKey && (n.preventDefault(), n.stopPropagation(),
|
|
92
|
+
ArrowDown: (e, c, n) => {
|
|
93
|
+
n.altKey && (n.preventDefault(), n.stopPropagation(), d(!0));
|
|
79
94
|
},
|
|
80
|
-
ArrowUp: (
|
|
81
|
-
n.altKey && (n.preventDefault(), n.stopPropagation(),
|
|
95
|
+
ArrowUp: (e, c, n) => {
|
|
96
|
+
n.altKey && (n.preventDefault(), n.stopPropagation(), d(!1));
|
|
82
97
|
},
|
|
83
|
-
Tab: (
|
|
84
|
-
var
|
|
85
|
-
if (
|
|
86
|
-
const
|
|
87
|
-
|
|
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);
|
|
88
103
|
}
|
|
89
104
|
}
|
|
90
105
|
}
|
|
91
106
|
}
|
|
92
|
-
}), [
|
|
93
|
-
|
|
94
|
-
}, [
|
|
95
|
-
|
|
96
|
-
}, [
|
|
97
|
-
(
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
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
|
+
}
|
|
102
123
|
});
|
|
103
124
|
},
|
|
104
|
-
[
|
|
105
|
-
),
|
|
106
|
-
(
|
|
107
|
-
|
|
108
|
-
nativeEvent:
|
|
109
|
-
syntheticEvent:
|
|
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
|
|
110
131
|
});
|
|
111
132
|
},
|
|
112
|
-
[
|
|
113
|
-
),
|
|
114
|
-
|
|
115
|
-
}, []),
|
|
116
|
-
(
|
|
117
|
-
clearTimeout(
|
|
118
|
-
nativeEvent:
|
|
119
|
-
syntheticEvent:
|
|
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
|
|
120
141
|
});
|
|
121
142
|
},
|
|
122
|
-
[
|
|
123
|
-
),
|
|
124
|
-
(
|
|
125
|
-
|
|
126
|
-
|
|
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, {
|
|
127
149
|
value: n,
|
|
128
|
-
nativeEvent:
|
|
129
|
-
syntheticEvent:
|
|
150
|
+
nativeEvent: e.nativeEvent,
|
|
151
|
+
syntheticEvent: e.syntheticEvent,
|
|
152
|
+
target: {
|
|
153
|
+
element: l.current,
|
|
154
|
+
value: n
|
|
155
|
+
}
|
|
130
156
|
});
|
|
131
157
|
},
|
|
132
|
-
[
|
|
133
|
-
),
|
|
134
|
-
(
|
|
135
|
-
[
|
|
136
|
-
),
|
|
137
|
-
|
|
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(
|
|
138
277
|
"span",
|
|
139
278
|
{
|
|
140
|
-
id:
|
|
279
|
+
id: r.id,
|
|
141
280
|
role: "combobox",
|
|
142
|
-
"aria-label":
|
|
143
|
-
"aria-labelledby":
|
|
144
|
-
"aria-describedby":
|
|
281
|
+
"aria-label": r.ariaLabel,
|
|
282
|
+
"aria-labelledby": r.ariaLabelledBy,
|
|
283
|
+
"aria-describedby": r.ariaDescribedBy,
|
|
145
284
|
"aria-haspopup": "dialog",
|
|
146
|
-
"aria-expanded":
|
|
147
|
-
"aria-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
[`k-picker-${
|
|
151
|
-
[`k-
|
|
152
|
-
|
|
153
|
-
"k-
|
|
154
|
-
"k-
|
|
155
|
-
|
|
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
|
|
156
296
|
}),
|
|
157
|
-
ref:
|
|
158
|
-
tabIndex:
|
|
159
|
-
title:
|
|
160
|
-
onKeyDown:
|
|
161
|
-
onFocus:
|
|
162
|
-
onBlur:
|
|
163
|
-
dir:
|
|
297
|
+
ref: l,
|
|
298
|
+
tabIndex: Ge(ke, D),
|
|
299
|
+
title: r.title,
|
|
300
|
+
onKeyDown: Re,
|
|
301
|
+
onFocus: ze,
|
|
302
|
+
onBlur: De,
|
|
303
|
+
dir: te
|
|
164
304
|
},
|
|
165
|
-
/* @__PURE__ */
|
|
166
|
-
|
|
305
|
+
/* @__PURE__ */ t.createElement(
|
|
306
|
+
qe,
|
|
167
307
|
{
|
|
168
|
-
dir:
|
|
169
|
-
open:
|
|
170
|
-
onOpen:
|
|
171
|
-
popupAnchor:
|
|
172
|
-
popupSettings: { ...
|
|
173
|
-
input: /* @__PURE__ */
|
|
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(
|
|
174
314
|
"span",
|
|
175
315
|
{
|
|
176
|
-
className:
|
|
177
|
-
"k-no-color": !
|
|
178
|
-
"k-icon-color-preview":
|
|
316
|
+
className: $("k-value-icon", "k-color-preview", {
|
|
317
|
+
"k-no-color": !i,
|
|
318
|
+
"k-icon-color-preview": x || L || h
|
|
179
319
|
})
|
|
180
320
|
},
|
|
181
|
-
|
|
182
|
-
!
|
|
183
|
-
/* @__PURE__ */
|
|
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 } })
|
|
184
324
|
)),
|
|
185
|
-
button: /* @__PURE__ */
|
|
186
|
-
|
|
325
|
+
button: /* @__PURE__ */ t.createElement(
|
|
326
|
+
et,
|
|
187
327
|
{
|
|
188
328
|
tabIndex: -1,
|
|
189
329
|
type: "button",
|
|
190
|
-
onClick:
|
|
330
|
+
onClick: U,
|
|
191
331
|
className: "k-input-button",
|
|
192
332
|
rounded: null,
|
|
193
333
|
icon: "caret-alt-down",
|
|
194
|
-
svgIcon:
|
|
195
|
-
"aria-label":
|
|
196
|
-
|
|
197
|
-
|
|
334
|
+
svgIcon: tt,
|
|
335
|
+
"aria-label": E.toLanguageString(
|
|
336
|
+
fe,
|
|
337
|
+
I[fe]
|
|
198
338
|
)
|
|
199
339
|
}
|
|
200
340
|
),
|
|
201
|
-
content:
|
|
202
|
-
|
|
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
|
-
))
|
|
341
|
+
content: W(!1),
|
|
342
|
+
_mobileMode: _e,
|
|
343
|
+
_actionSheet: xe()
|
|
219
344
|
}
|
|
220
345
|
)
|
|
221
346
|
);
|
|
222
347
|
});
|
|
223
|
-
|
|
224
|
-
value:
|
|
225
|
-
defaultValue:
|
|
226
|
-
disabled:
|
|
227
|
-
view:
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
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
|
|
238
366
|
};
|
|
239
|
-
const
|
|
367
|
+
const v = {
|
|
240
368
|
size: "medium",
|
|
241
369
|
rounded: "medium",
|
|
242
370
|
fillMode: "solid",
|
|
243
371
|
view: "palette",
|
|
244
|
-
|
|
245
|
-
|
|
372
|
+
views: ["gradient", "palette"],
|
|
373
|
+
gradientSettings: ot,
|
|
374
|
+
paletteSettings: lt
|
|
246
375
|
};
|
|
247
|
-
|
|
376
|
+
me.displayName = "KendoColorPicker";
|
|
248
377
|
export {
|
|
249
|
-
|
|
250
|
-
|
|
378
|
+
me as ColorPicker,
|
|
379
|
+
it as ColorPickerPropsContext
|
|
251
380
|
};
|
|
@@ -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
|
|
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;
|