@progress/kendo-react-inputs 15.2.0-develop.1 → 15.2.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/checkbox/Checkbox.js +1 -1
- package/checkbox/Checkbox.mjs +79 -77
- package/colors/ColorContrastLabels.js +1 -1
- package/colors/ColorContrastLabels.mjs +2 -2
- package/colors/ColorGradient.js +1 -1
- package/colors/ColorGradient.mjs +51 -52
- package/colors/ColorPalette.js +1 -1
- package/colors/ColorPalette.mjs +71 -72
- package/colors/ColorPicker.js +1 -1
- package/colors/ColorPicker.mjs +247 -239
- package/colors/FlatColorPicker.d.ts +4 -4
- package/colors/FlatColorPicker.js +1 -1
- package/colors/FlatColorPicker.mjs +104 -100
- package/colors/interfaces/ColorPaletteProps.d.ts +7 -0
- package/colors/interfaces/ColorPickerPaletteSettings.d.ts +5 -0
- package/dist/cdn/js/kendo-react-inputs.js +1 -1
- package/maskedtextbox/MaskedTextBox.d.ts +1 -0
- package/maskedtextbox/MaskedTextBox.js +1 -1
- package/maskedtextbox/MaskedTextBox.mjs +26 -23
- package/maskedtextbox/MaskedTextBoxProps.d.ts +7 -0
- package/messages/index.d.ts +5 -0
- package/messages/index.js +1 -1
- package/messages/index.mjs +46 -44
- package/numerictextbox/NumericTextBox.js +1 -1
- package/numerictextbox/NumericTextBox.mjs +2 -2
- package/otpinput/OTPInput.js +1 -1
- package/otpinput/OTPInput.mjs +141 -143
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +10 -10
- package/radiobutton/RadioButton.js +1 -1
- package/radiobutton/RadioButton.mjs +32 -30
- package/range-slider/RangeSlider.js +11 -11
- package/range-slider/RangeSlider.mjs +54 -54
- package/rating/Rating.d.ts +12 -0
- package/rating/Rating.js +2 -2
- package/rating/Rating.mjs +91 -92
- package/signature/Signature.js +1 -1
- package/signature/Signature.mjs +113 -110
- package/slider/Slider.d.ts +12 -0
- package/slider/Slider.js +1 -1
- package/slider/Slider.mjs +61 -56
- package/switch/Switch.d.ts +15 -0
- package/switch/Switch.js +1 -1
- package/switch/Switch.mjs +82 -79
- package/textarea/TextArea.js +1 -1
- package/textarea/TextArea.mjs +11 -12
package/colors/ColorGradient.mjs
CHANGED
|
@@ -7,35 +7,35 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import * as r from "react";
|
|
9
9
|
import o from "prop-types";
|
|
10
|
-
import { withIdHOC as
|
|
10
|
+
import { withIdHOC as G, withPropsContext as A, createPropsContext as N, validatePackage as _, getLicenseMessage as I, canUseDOM as T, Navigation as C, getActiveElement as u, disableNavigatableContainer as k, focusFirstFocusableChild as O, enableNavigatableContainer as z, keepFocusInContainer as V, TABBABLE_ELEMENTS as B, getTabIndex as S, classNames as P, kendoThemeMaps as K, Draggable as U, WatermarkOverlay as W } from "@progress/kendo-react-common";
|
|
11
11
|
import { packageMetadata as R } from "../package-metadata.mjs";
|
|
12
12
|
import { Slider as y } from "../slider/Slider.mjs";
|
|
13
13
|
import { isPresent as E, fitIntoBounds as w } from "./utils/misc.mjs";
|
|
14
|
-
import { getHSV as
|
|
15
|
-
import { cacheHex as
|
|
16
|
-
import
|
|
17
|
-
import { ColorContrastLabels as
|
|
18
|
-
import { ColorContrastSvg as
|
|
19
|
-
import { provideLocalizationService as
|
|
20
|
-
import { colorGradientHSVAreaAriaLabel as
|
|
21
|
-
const
|
|
14
|
+
import { getHSV as b, getRGBA as p, getColorFromHue as c, getColorFromRGBA as $, parseColor as d, getColorFromHSV as X } from "./utils/color-parser.mjs";
|
|
15
|
+
import { cacheHex as Y, cacheRgba as j, removeCachedColor as q, cacheHsva as J, getCachedHsva as Q, getCachedRgba as Z, getCachedHex as ee } from "./utils/color-cache.mjs";
|
|
16
|
+
import te from "./ColorInput.mjs";
|
|
17
|
+
import { ColorContrastLabels as se } from "./ColorContrastLabels.mjs";
|
|
18
|
+
import { ColorContrastSvg as ae } from "./ColorContrastSvg.mjs";
|
|
19
|
+
import { provideLocalizationService as x } from "@progress/kendo-react-intl";
|
|
20
|
+
import { colorGradientHSVAreaAriaLabel as H, messages as m, colorGradientHueSliderLabel as L, colorGradientAlphaSliderLabel as D } from "../messages/index.mjs";
|
|
21
|
+
const ie = "rgba", M = "rgba(255, 255, 255, 1)", g = 2, v = 5, h = class h extends r.Component {
|
|
22
22
|
constructor(t) {
|
|
23
23
|
super(t), this.wrapperRef = r.createRef(), this.hsvGradientRef = r.createRef(), this.showLicenseWatermark = !1, this.focus = () => {
|
|
24
24
|
this.wrapperRef && this.wrapperRef.current && this.wrapperRef.current.focus();
|
|
25
25
|
}, this.onHexChange = (e, s, i) => {
|
|
26
26
|
if (this.isUncontrolled) {
|
|
27
|
-
const n =
|
|
27
|
+
const n = b(s);
|
|
28
28
|
this.setState({ hsva: n, backgroundColor: c(n.h), rgba: p(s), hex: e });
|
|
29
29
|
} else
|
|
30
|
-
|
|
30
|
+
Y(this.state.guid, s, e);
|
|
31
31
|
this.dispatchChangeEvent(s, i, i.nativeEvent);
|
|
32
32
|
}, this.onRgbaChange = (e, s) => {
|
|
33
|
-
const i =
|
|
33
|
+
const i = $(e);
|
|
34
34
|
if (this.isUncontrolled) {
|
|
35
|
-
const n =
|
|
35
|
+
const n = b(i), l = d(i, "hex");
|
|
36
36
|
this.setState({ hsva: n, backgroundColor: c(n.h), rgba: e, hex: l });
|
|
37
37
|
} else
|
|
38
|
-
|
|
38
|
+
j(this.state.guid, i, e);
|
|
39
39
|
this.dispatchChangeEvent(i, s.syntheticEvent, s.nativeEvent);
|
|
40
40
|
}, this.onAlphaSliderChange = (e) => {
|
|
41
41
|
this.handleHsvaChange(
|
|
@@ -69,8 +69,8 @@ const re = "rgba", M = "rgba(255, 255, 255, 1)", v = 2, u = 5, h = class h exten
|
|
|
69
69
|
}, this.onKeyDown = (e) => {
|
|
70
70
|
var s;
|
|
71
71
|
(s = this.navigation) == null || s.triggerKeyboardEvent(e);
|
|
72
|
-
}, this.showLicenseWatermark = !
|
|
73
|
-
const a = t.value || t.defaultValue || d(M,
|
|
72
|
+
}, this.showLicenseWatermark = !_(R, { component: "ColorGradient" }), this.licenseMessage = I(R);
|
|
73
|
+
const a = t.value || t.defaultValue || d(M, ie);
|
|
74
74
|
this.state = Object.assign({}, h.getStateFromValue(a), {
|
|
75
75
|
isFirstRender: !0,
|
|
76
76
|
guid: this.props.id
|
|
@@ -86,7 +86,7 @@ const re = "rgba", M = "rgba(255, 255, 255, 1)", v = 2, u = 5, h = class h exten
|
|
|
86
86
|
* @hidden
|
|
87
87
|
*/
|
|
88
88
|
componentDidMount() {
|
|
89
|
-
if (this.setAlphaSliderBackground(this.state.backgroundColor), this.state.isFirstRender && this.setState({ isFirstRender: !1 }), this.gradientWrapper && (this.resizeObserver =
|
|
89
|
+
if (this.setAlphaSliderBackground(this.state.backgroundColor), this.state.isFirstRender && this.setState({ isFirstRender: !1 }), this.gradientWrapper && (this.resizeObserver = T && window.ResizeObserver && new window.ResizeObserver(() => {
|
|
90
90
|
this.forceUpdate();
|
|
91
91
|
}), this.resizeObserver && this.resizeObserver.observe(this.gradientWrapper)), this.wrapperRef && this.hsvGradientRef) {
|
|
92
92
|
let t = 0, a = 0;
|
|
@@ -97,16 +97,16 @@ const re = "rgba", M = "rgba(255, 255, 255, 1)", v = 2, u = 5, h = class h exten
|
|
|
97
97
|
keyboardEvents: {
|
|
98
98
|
keydown: {
|
|
99
99
|
ArrowDown: (e, s, i) => {
|
|
100
|
-
a = i.shiftKey ? this.props.gradientSliderSmallStep ||
|
|
100
|
+
a = i.shiftKey ? this.props.gradientSliderSmallStep || g : this.props.gradientSliderStep || v, this.onHsvGradientValueChange(e, 0, a);
|
|
101
101
|
},
|
|
102
102
|
ArrowUp: (e, s, i) => {
|
|
103
|
-
a = i.shiftKey ? -(this.props.gradientSliderSmallStep ||
|
|
103
|
+
a = i.shiftKey ? -(this.props.gradientSliderSmallStep || g) : -(this.props.gradientSliderStep || v), this.onHsvGradientValueChange(e, 0, a);
|
|
104
104
|
},
|
|
105
105
|
ArrowLeft: (e, s, i) => {
|
|
106
|
-
t = i.shiftKey ? -(this.props.gradientSliderSmallStep ||
|
|
106
|
+
t = i.shiftKey ? -(this.props.gradientSliderSmallStep || g) : -(this.props.gradientSliderStep || v), this.onHsvGradientValueChange(e, t, 0);
|
|
107
107
|
},
|
|
108
108
|
ArrowRight: (e, s, i) => {
|
|
109
|
-
t = i.shiftKey ? this.props.gradientSliderSmallStep ||
|
|
109
|
+
t = i.shiftKey ? this.props.gradientSliderSmallStep || g : this.props.gradientSliderStep || v, this.onHsvGradientValueChange(e, t, 0);
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
}
|
|
@@ -119,13 +119,13 @@ const re = "rgba", M = "rgba(255, 255, 255, 1)", v = 2, u = 5, h = class h exten
|
|
|
119
119
|
keyboardEvents: {
|
|
120
120
|
keydown: {
|
|
121
121
|
Tab: (t, a, e) => {
|
|
122
|
-
|
|
122
|
+
u(document) === t ? k(t) : V(e, t, B);
|
|
123
123
|
},
|
|
124
124
|
Enter: (t, a, e) => {
|
|
125
|
-
|
|
125
|
+
u(document) === t && (O(t), z(t));
|
|
126
126
|
},
|
|
127
127
|
Escape: (t, a, e) => {
|
|
128
|
-
|
|
128
|
+
u(document) !== t && (t.focus(), k(t));
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
}
|
|
@@ -135,7 +135,7 @@ const re = "rgba", M = "rgba(255, 255, 255, 1)", v = 2, u = 5, h = class h exten
|
|
|
135
135
|
* @hidden
|
|
136
136
|
*/
|
|
137
137
|
componentWillUnmount() {
|
|
138
|
-
|
|
138
|
+
q(this.state.guid), this.resizeObserver && this.resizeObserver.disconnect();
|
|
139
139
|
}
|
|
140
140
|
/**
|
|
141
141
|
* @hidden
|
|
@@ -147,7 +147,7 @@ const re = "rgba", M = "rgba(255, 255, 255, 1)", v = 2, u = 5, h = class h exten
|
|
|
147
147
|
* @hidden
|
|
148
148
|
*/
|
|
149
149
|
renderRectangleDragHandle() {
|
|
150
|
-
const t =
|
|
150
|
+
const t = x(this), a = {};
|
|
151
151
|
if (!this.state.isFirstRender) {
|
|
152
152
|
const e = this.getGradientRectMetrics(), s = (1 - this.state.hsva.v) * e.height, i = this.state.hsva.s * e.width;
|
|
153
153
|
a.top = `${s}px`, a.left = `${i}px`;
|
|
@@ -162,9 +162,8 @@ const re = "rgba", M = "rgba(255, 255, 255, 1)", v = 2, u = 5, h = class h exten
|
|
|
162
162
|
"aria-valuenow": Math.round((1 - this.state.hsva.v) * 100),
|
|
163
163
|
"aria-valuemin": 0,
|
|
164
164
|
"aria-valuemax": 100,
|
|
165
|
-
"aria-label": this.props.ariaLabelHSV || t.toLanguageString(
|
|
165
|
+
"aria-label": this.props.ariaLabelHSV || t.toLanguageString(H, m[H]),
|
|
166
166
|
"aria-orientation": "undefined",
|
|
167
|
-
"aria-disabled": this.props.disabled ? "true" : void 0,
|
|
168
167
|
className: "k-hsv-draghandle k-draghandle",
|
|
169
168
|
style: a,
|
|
170
169
|
onKeyDown: this.onHsvGradientKeyDown
|
|
@@ -175,18 +174,18 @@ const re = "rgba", M = "rgba(255, 255, 255, 1)", v = 2, u = 5, h = class h exten
|
|
|
175
174
|
* @hidden
|
|
176
175
|
*/
|
|
177
176
|
moveDragHandle(t, a) {
|
|
178
|
-
const e = this.getGradientRectMetrics(), s = e.width, i = e.height, n = w(a, 0, i), l = w(t, 0, s),
|
|
177
|
+
const e = this.getGradientRectMetrics(), s = e.width, i = e.height, n = w(a, 0, i), l = w(t, 0, s), F = Object.assign({}, this.state.hsva, {
|
|
179
178
|
s: l / s,
|
|
180
179
|
v: 1 - n / i
|
|
181
180
|
});
|
|
182
|
-
this.handleHsvaChange(
|
|
181
|
+
this.handleHsvaChange(F, {}, {});
|
|
183
182
|
}
|
|
184
183
|
/**
|
|
185
184
|
* @hidden
|
|
186
185
|
*/
|
|
187
186
|
handleHsvaChange(t, a, e) {
|
|
188
|
-
const s =
|
|
189
|
-
this.isUncontrolled ||
|
|
187
|
+
const s = X(t), i = d(s, "hex");
|
|
188
|
+
this.isUncontrolled || J(this.state.guid, s, t), this.setState({ hsva: t, backgroundColor: c(t.h), rgba: p(s), hex: i }), this.dispatchChangeEvent(s, a, e);
|
|
190
189
|
}
|
|
191
190
|
/**
|
|
192
191
|
* @hidden
|
|
@@ -204,7 +203,7 @@ const re = "rgba", M = "rgba(255, 255, 255, 1)", v = 2, u = 5, h = class h exten
|
|
|
204
203
|
*/
|
|
205
204
|
static getStateFromValue(t, a) {
|
|
206
205
|
E(d(t, "hex")) || (t = M);
|
|
207
|
-
const e =
|
|
206
|
+
const e = Q(a, t) || b(t), s = Z(a, t) || p(t), i = ee(a, t) || d(t, "hex"), n = c(e.h);
|
|
208
207
|
return { hsva: e, backgroundColor: n, rgba: s, hex: i };
|
|
209
208
|
}
|
|
210
209
|
/**
|
|
@@ -229,16 +228,16 @@ const re = "rgba", M = "rgba(255, 255, 255, 1)", v = 2, u = 5, h = class h exten
|
|
|
229
228
|
* @hidden
|
|
230
229
|
*/
|
|
231
230
|
render() {
|
|
232
|
-
const t =
|
|
231
|
+
const t = x(this);
|
|
233
232
|
return /* @__PURE__ */ r.createElement(
|
|
234
233
|
"div",
|
|
235
234
|
{
|
|
236
235
|
id: this.props.id,
|
|
237
236
|
role: this.props.role || "textbox",
|
|
238
|
-
className:
|
|
237
|
+
className: P(
|
|
239
238
|
"k-colorgradient",
|
|
240
239
|
{
|
|
241
|
-
[`k-colorgradient-${
|
|
240
|
+
[`k-colorgradient-${K.sizeMap[this.props.size] || this.props.size}`]: this.props.size,
|
|
242
241
|
"k-disabled": this.props.disabled
|
|
243
242
|
},
|
|
244
243
|
this.props.className
|
|
@@ -247,14 +246,14 @@ const re = "rgba", M = "rgba(255, 255, 255, 1)", v = 2, u = 5, h = class h exten
|
|
|
247
246
|
style: { position: "relative", ...this.props.style },
|
|
248
247
|
ref: this.wrapperRef,
|
|
249
248
|
tabIndex: S(this.props.tabIndex, this.props.disabled),
|
|
250
|
-
"aria-label": this.props.role === "none" ? void 0 : this.props.ariaLabel
|
|
249
|
+
"aria-label": this.props.role === "none" ? void 0 : this.props.ariaLabel,
|
|
251
250
|
"aria-labelledby": this.props.ariaLabelledBy,
|
|
252
251
|
"aria-describedby": this.props.ariaDescribedBy,
|
|
253
252
|
onFocus: this.onFocus,
|
|
254
253
|
onKeyDown: this.onKeyDown
|
|
255
254
|
},
|
|
256
255
|
/* @__PURE__ */ r.createElement("div", { className: `k-colorgradient-canvas ${this.props._adaptive ? "k-vstack" : "k-hstack"}` }, /* @__PURE__ */ r.createElement("div", { className: "k-hsv-rectangle", style: { background: this.state.backgroundColor } }, /* @__PURE__ */ r.createElement(
|
|
257
|
-
|
|
256
|
+
U,
|
|
258
257
|
{
|
|
259
258
|
onDrag: this.onDrag,
|
|
260
259
|
onRelease: this.onRelease,
|
|
@@ -272,7 +271,7 @@ const re = "rgba", M = "rgba(255, 255, 255, 1)", v = 2, u = 5, h = class h exten
|
|
|
272
271
|
this.renderRectangleDragHandle()
|
|
273
272
|
)
|
|
274
273
|
), this.props.backgroundColor && !this.state.isFirstRender && /* @__PURE__ */ r.createElement(
|
|
275
|
-
|
|
274
|
+
ae,
|
|
276
275
|
{
|
|
277
276
|
metrics: this.gradientWrapper ? this.getGradientRectMetrics() : void 0,
|
|
278
277
|
hsva: this.state.hsva,
|
|
@@ -291,8 +290,8 @@ const re = "rgba", M = "rgba(255, 255, 255, 1)", v = 2, u = 5, h = class h exten
|
|
|
291
290
|
className: "k-hue-slider k-colorgradient-slider",
|
|
292
291
|
disabled: this.props.disabled,
|
|
293
292
|
ariaLabel: t.toLanguageString(
|
|
294
|
-
|
|
295
|
-
|
|
293
|
+
L,
|
|
294
|
+
m[L]
|
|
296
295
|
)
|
|
297
296
|
}
|
|
298
297
|
), this.props.opacity && /* @__PURE__ */ r.createElement(
|
|
@@ -305,8 +304,8 @@ const re = "rgba", M = "rgba(255, 255, 255, 1)", v = 2, u = 5, h = class h exten
|
|
|
305
304
|
max: 100,
|
|
306
305
|
step: 1,
|
|
307
306
|
ariaLabel: t.toLanguageString(
|
|
308
|
-
|
|
309
|
-
|
|
307
|
+
D,
|
|
308
|
+
m[D]
|
|
310
309
|
),
|
|
311
310
|
onChange: this.onAlphaSliderChange,
|
|
312
311
|
className: "k-alpha-slider k-colorgradient-slider",
|
|
@@ -317,7 +316,7 @@ const re = "rgba", M = "rgba(255, 255, 255, 1)", v = 2, u = 5, h = class h exten
|
|
|
317
316
|
}
|
|
318
317
|
))),
|
|
319
318
|
/* @__PURE__ */ r.createElement(
|
|
320
|
-
|
|
319
|
+
te,
|
|
321
320
|
{
|
|
322
321
|
rgba: this.state.rgba,
|
|
323
322
|
onRgbaChange: this.onRgbaChange,
|
|
@@ -331,8 +330,8 @@ const re = "rgba", M = "rgba(255, 255, 255, 1)", v = 2, u = 5, h = class h exten
|
|
|
331
330
|
rounded: this.props.rounded
|
|
332
331
|
}
|
|
333
332
|
),
|
|
334
|
-
this.props.backgroundColor && /* @__PURE__ */ r.createElement(
|
|
335
|
-
this.showLicenseWatermark && /* @__PURE__ */ r.createElement(
|
|
333
|
+
this.props.backgroundColor && /* @__PURE__ */ r.createElement(se, { bgColor: p(this.props.backgroundColor), rgba: this.state.rgba }),
|
|
334
|
+
this.showLicenseWatermark && /* @__PURE__ */ r.createElement(W, { message: this.licenseMessage })
|
|
336
335
|
);
|
|
337
336
|
}
|
|
338
337
|
};
|
|
@@ -360,15 +359,15 @@ h.displayName = "ColorGradient", h.propTypes = {
|
|
|
360
359
|
size: void 0
|
|
361
360
|
};
|
|
362
361
|
let f = h;
|
|
363
|
-
const
|
|
364
|
-
|
|
365
|
-
|
|
362
|
+
const re = N(), oe = G(
|
|
363
|
+
A(
|
|
364
|
+
re,
|
|
366
365
|
f
|
|
367
366
|
)
|
|
368
367
|
);
|
|
369
|
-
|
|
368
|
+
oe.displayName = "KendoReactColorGradient";
|
|
370
369
|
export {
|
|
371
|
-
|
|
372
|
-
|
|
370
|
+
oe as ColorGradient,
|
|
371
|
+
re as ColorGradientPropsContext,
|
|
373
372
|
f as ColorGradientWithoutContext
|
|
374
373
|
};
|
package/colors/ColorPalette.js
CHANGED
|
@@ -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 n=require("react"),s=require("prop-types"),
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react"),s=require("prop-types"),le=require("./utils/color-palette.service.js"),w=require("@progress/kendo-react-common"),se=require("./models/palette-presets.js"),q=require("./utils/color-parser.js");function ne(c){const p=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const h in c)if(h!=="default"){const E=Object.getOwnPropertyDescriptor(c,h);Object.defineProperty(p,h,E.get?E:{enumerable:!0,get:()=>c[h]})}}return p.default=c,Object.freeze(p)}const k=ne(n),z=24,B=10,j="office",L={palette:j,columns:B,tileSize:z},V=w.createPropsContext(),ae=c=>{if(Array.isArray(c))return c;if(typeof c=="string"){const p=se.PALETTEPRESETS[c];if(p)return p.colors}return[]},D=k.forwardRef((c,p)=>{const h=w.usePropsContext(V,c),{palette:E=L.palette,columns:F=L.columns,tileSize:u=L.tileSize,value:x,defaultValue:$,disabled:d=!1,tabIndex:K,onChange:P,onFocus:I,className:W,size:N,id:Z,ariaLabelledBy:G,ariaDescribedBy:J,ariaLabel:Q}=h,S=n.useRef(null),X=n.useRef({focus:()=>{var o;(o=S.current)==null||o.focus()},wrapperRef:S}),_=F!=null?F:L.columns,b=n.useMemo(()=>ae(E),[E]),t=n.useMemo(()=>{const o=new le.ColorPaletteService;return o.setColorMatrix(b,_),o},[b,_]),[g,O]=n.useState(()=>x!==void 0?x:$||""),[T,R]=n.useState(""),y=x!==void 0;n.useEffect(()=>{y&&O(x)},[x,y]);const Y=n.useCallback(o=>{if(d||b.length===0)return;const f=g||b[0];R(f),I&&I(o)},[d,b,g,I]),ee=n.useCallback(()=>{R("")},[]),oe=n.useCallback(o=>{if(d)return;const{key:f}=o,r=()=>T||g||b[0],m=(l,e)=>l<0?e:l>e?0:l;switch(f){case"ArrowRight":o.preventDefault();{const l=r(),e=t.getCellCoordsFor(l);if(e&&t.colorRows[e.row]){const C=t.colorRows[e.row].length-1,a=m(e.col+1,C),i=t.colorRows[e.row][a];i&&R(i)}}break;case"ArrowLeft":o.preventDefault();{const l=r(),e=t.getCellCoordsFor(l);if(e&&t.colorRows[e.row]){const C=t.colorRows[e.row].length-1,a=m(e.col-1,C),i=t.colorRows[e.row][a];i&&R(i)}}break;case"ArrowDown":o.preventDefault();{const l=r(),e=t.getCellCoordsFor(l);if(e){const C=t.colorRows.length-1,a=m(e.row+1,C),i=Math.min(e.col,t.colorRows[a].length-1),v=t.colorRows[a][i];v&&R(v)}}break;case"ArrowUp":o.preventDefault();{const l=r(),e=t.getCellCoordsFor(l);if(e){const C=t.colorRows.length-1,a=m(e.row-1,C),i=Math.min(e.col,t.colorRows[a].length-1),v=t.colorRows[a][i];v&&R(v)}}break;case"Enter":o.preventDefault();{const l=r();if(l&&(y||O(l),P)){const e=q.parseColor(l,"rgba");w.dispatchEvent(P,o,null,{value:l,rgbaValue:e||""})}}break}},[d,T,g,b,t,y,P]),A=n.useCallback((o,f)=>{if(d)return;const r=o;if(y||O(r),P){const m=q.parseColor(r,"rgba");w.dispatchEvent(P,f,null,{value:r,rgbaValue:m||""})}},[d,P,y]),U=n.useCallback((o,f)=>o.map((r,m)=>{const l=g&&r.toLowerCase()===g.toLowerCase(),e=T&&r.toLowerCase()===T.toLowerCase(),C=w.classNames("k-colorpalette-tile",{"k-selected":l,"k-focus":e}),a={backgroundColor:r};return typeof u=="number"?(a.width=`${u}px`,a.height=`${u}px`):u&&typeof u=="object"&&("width"in u&&(a.width=`${u.width}px`),"height"in u&&(a.height=`${u.height}px`)),k.createElement("td",{key:r,role:"gridcell",className:C,style:a,"aria-label":r,"aria-selected":l?"true":void 0,onClick:i=>A(r,i)})}),[g,T,u,A]),te=n.useCallback(()=>t.colorRows.map((f,r)=>k.createElement("tr",{key:f[0]||r,role:"row"},U(f,r))),[t,U]),M=n.useCallback(()=>({focus:()=>{var o;(o=S.current)==null||o.focus()},wrapperRef:S}),[]);n.useImperativeHandle(X,M),n.useImperativeHandle(p,M);const re=w.classNames("k-colorpalette",W,{"k-disabled":d,"k-colorpalette-sm":N==="small","k-colorpalette-md":N==="medium","k-colorpalette-lg":N==="large"});return k.createElement("div",{ref:S,role:"grid",className:re,tabIndex:w.getTabIndex(K,d),id:Z,"aria-label":Q,"aria-labelledby":G,"aria-describedby":J,"aria-disabled":d?"true":void 0,onFocus:Y,onBlur:ee,onKeyDown:oe},k.createElement("table",{className:"k-colorpalette-table",role:"none"},k.createElement("tbody",null,te())))});D.displayName="ColorPalette";D.propTypes={palette:s.oneOfType([s.arrayOf(s.string.isRequired),s.string]),columns:s.number,tileSize:s.any,defaultValue:s.string,value:s.string,disabled:s.bool,tabIndex:s.number,onChange:s.func,onFocus:s.func,id:s.string,ariaLabelledBy:s.string,ariaDescribedBy:s.string,className:s.string,size:s.oneOf(["small","medium","large"])};const H=w.withIdHOC(D);H.displayName="KendoReactColorPalette";const ce=D;exports.ColorPalette=H;exports.ColorPalettePropsContext=V;exports.ColorPaletteWithoutContext=ce;exports.DEFAULT_COLUMNS_COUNT=B;exports.DEFAULT_PRESET=j;exports.DEFAULT_TILE_SIZE=z;exports.defaultColorPaletteProps=L;
|
package/colors/ColorPalette.mjs
CHANGED
|
@@ -6,78 +6,77 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
import * as R from "react";
|
|
9
|
-
import { useRef as O, useMemo as U, useState as V, useEffect as
|
|
9
|
+
import { useRef as O, useMemo as U, useState as V, useEffect as se, useCallback as p, useImperativeHandle as M } from "react";
|
|
10
10
|
import l from "prop-types";
|
|
11
|
-
import { ColorPaletteService as
|
|
12
|
-
import { withIdHOC as
|
|
13
|
-
import { PALETTEPRESETS as
|
|
11
|
+
import { ColorPaletteService as le } from "./utils/color-palette.service.mjs";
|
|
12
|
+
import { withIdHOC as ne, createPropsContext as ae, usePropsContext as ce, dispatchEvent as _, classNames as H, getTabIndex as ie } from "@progress/kendo-react-common";
|
|
13
|
+
import { PALETTEPRESETS as ue } from "./models/palette-presets.mjs";
|
|
14
14
|
import { parseColor as $ } from "./utils/color-parser.mjs";
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
if (
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if (E)
|
|
27
|
-
return E.colors;
|
|
15
|
+
const de = 24, fe = 10, Ce = "office", v = {
|
|
16
|
+
palette: Ce,
|
|
17
|
+
columns: fe,
|
|
18
|
+
tileSize: de
|
|
19
|
+
}, we = ae(), pe = (m) => {
|
|
20
|
+
if (Array.isArray(m))
|
|
21
|
+
return m;
|
|
22
|
+
if (typeof m == "string") {
|
|
23
|
+
const P = ue[m];
|
|
24
|
+
if (P)
|
|
25
|
+
return P.colors;
|
|
28
26
|
}
|
|
29
27
|
return [];
|
|
30
|
-
},
|
|
31
|
-
const
|
|
32
|
-
palette:
|
|
33
|
-
columns:
|
|
34
|
-
tileSize: c =
|
|
28
|
+
}, F = R.forwardRef((m, P) => {
|
|
29
|
+
const K = ce(we, m), {
|
|
30
|
+
palette: I = v.palette,
|
|
31
|
+
columns: L = v.columns,
|
|
32
|
+
tileSize: c = v.tileSize,
|
|
35
33
|
value: y,
|
|
36
|
-
defaultValue:
|
|
34
|
+
defaultValue: j,
|
|
37
35
|
disabled: i = !1,
|
|
38
|
-
tabIndex:
|
|
36
|
+
tabIndex: q,
|
|
39
37
|
onChange: g,
|
|
40
38
|
onFocus: S,
|
|
41
|
-
className:
|
|
39
|
+
className: W,
|
|
42
40
|
size: D,
|
|
43
|
-
id:
|
|
44
|
-
ariaLabelledBy:
|
|
45
|
-
ariaDescribedBy:
|
|
46
|
-
|
|
41
|
+
id: Z,
|
|
42
|
+
ariaLabelledBy: G,
|
|
43
|
+
ariaDescribedBy: J,
|
|
44
|
+
ariaLabel: Q
|
|
45
|
+
} = K, k = O(null), X = O({
|
|
47
46
|
focus: () => {
|
|
48
47
|
var o;
|
|
49
48
|
(o = k.current) == null || o.focus();
|
|
50
49
|
},
|
|
51
50
|
wrapperRef: k
|
|
52
|
-
}),
|
|
53
|
-
const o = new
|
|
54
|
-
return o.setColorMatrix(f,
|
|
55
|
-
}, [f,
|
|
56
|
-
|
|
51
|
+
}), A = L != null ? L : v.columns, f = U(() => pe(I), [I]), t = U(() => {
|
|
52
|
+
const o = new le();
|
|
53
|
+
return o.setColorMatrix(f, A), o;
|
|
54
|
+
}, [f, A]), [C, T] = V(() => y !== void 0 ? y : j || ""), [x, b] = V(""), h = y !== void 0;
|
|
55
|
+
se(() => {
|
|
57
56
|
h && T(y);
|
|
58
57
|
}, [y, h]);
|
|
59
58
|
const Y = p(
|
|
60
59
|
(o) => {
|
|
61
60
|
if (i || f.length === 0)
|
|
62
61
|
return;
|
|
63
|
-
const u =
|
|
62
|
+
const u = C || f[0];
|
|
64
63
|
b(u), S && S(o);
|
|
65
64
|
},
|
|
66
|
-
[i, f,
|
|
65
|
+
[i, f, C, S]
|
|
67
66
|
), ee = p(() => {
|
|
68
67
|
b("");
|
|
69
68
|
}, []), oe = p(
|
|
70
69
|
(o) => {
|
|
71
70
|
if (i)
|
|
72
71
|
return;
|
|
73
|
-
const { key: u } = o, r = () => x ||
|
|
72
|
+
const { key: u } = o, r = () => x || C || f[0], w = (s, e) => s < 0 ? e : s > e ? 0 : s;
|
|
74
73
|
switch (u) {
|
|
75
74
|
case "ArrowRight":
|
|
76
75
|
o.preventDefault();
|
|
77
76
|
{
|
|
78
77
|
const s = r(), e = t.getCellCoordsFor(s);
|
|
79
78
|
if (e && t.colorRows[e.row]) {
|
|
80
|
-
const d = t.colorRows[e.row].length - 1, n =
|
|
79
|
+
const d = t.colorRows[e.row].length - 1, n = w(e.col + 1, d), a = t.colorRows[e.row][n];
|
|
81
80
|
a && b(a);
|
|
82
81
|
}
|
|
83
82
|
}
|
|
@@ -87,7 +86,7 @@ const Ce = 24, pe = 10, we = "office", L = {
|
|
|
87
86
|
{
|
|
88
87
|
const s = r(), e = t.getCellCoordsFor(s);
|
|
89
88
|
if (e && t.colorRows[e.row]) {
|
|
90
|
-
const d = t.colorRows[e.row].length - 1, n =
|
|
89
|
+
const d = t.colorRows[e.row].length - 1, n = w(e.col - 1, d), a = t.colorRows[e.row][n];
|
|
91
90
|
a && b(a);
|
|
92
91
|
}
|
|
93
92
|
}
|
|
@@ -97,8 +96,8 @@ const Ce = 24, pe = 10, we = "office", L = {
|
|
|
97
96
|
{
|
|
98
97
|
const s = r(), e = t.getCellCoordsFor(s);
|
|
99
98
|
if (e) {
|
|
100
|
-
const d = t.colorRows.length - 1, n =
|
|
101
|
-
|
|
99
|
+
const d = t.colorRows.length - 1, n = w(e.row + 1, d), a = Math.min(e.col, t.colorRows[n].length - 1), E = t.colorRows[n][a];
|
|
100
|
+
E && b(E);
|
|
102
101
|
}
|
|
103
102
|
}
|
|
104
103
|
break;
|
|
@@ -107,8 +106,8 @@ const Ce = 24, pe = 10, we = "office", L = {
|
|
|
107
106
|
{
|
|
108
107
|
const s = r(), e = t.getCellCoordsFor(s);
|
|
109
108
|
if (e) {
|
|
110
|
-
const d = t.colorRows.length - 1, n =
|
|
111
|
-
|
|
109
|
+
const d = t.colorRows.length - 1, n = w(e.row - 1, d), a = Math.min(e.col, t.colorRows[n].length - 1), E = t.colorRows[n][a];
|
|
110
|
+
E && b(E);
|
|
112
111
|
}
|
|
113
112
|
}
|
|
114
113
|
break;
|
|
@@ -127,24 +126,24 @@ const Ce = 24, pe = 10, we = "office", L = {
|
|
|
127
126
|
break;
|
|
128
127
|
}
|
|
129
128
|
},
|
|
130
|
-
[i, x,
|
|
129
|
+
[i, x, C, f, t, h, g]
|
|
131
130
|
), N = p(
|
|
132
131
|
(o, u) => {
|
|
133
132
|
if (i)
|
|
134
133
|
return;
|
|
135
134
|
const r = o;
|
|
136
135
|
if (h || T(r), g) {
|
|
137
|
-
const
|
|
136
|
+
const w = $(r, "rgba");
|
|
138
137
|
_(g, u, null, {
|
|
139
138
|
value: r,
|
|
140
|
-
rgbaValue:
|
|
139
|
+
rgbaValue: w || ""
|
|
141
140
|
});
|
|
142
141
|
}
|
|
143
142
|
},
|
|
144
143
|
[i, g, h]
|
|
145
|
-
),
|
|
146
|
-
(o, u) => o.map((r,
|
|
147
|
-
const s =
|
|
144
|
+
), B = p(
|
|
145
|
+
(o, u) => o.map((r, w) => {
|
|
146
|
+
const s = C && r.toLowerCase() === C.toLowerCase(), e = x && r.toLowerCase() === x.toLowerCase(), d = H("k-colorpalette-tile", {
|
|
148
147
|
"k-selected": s,
|
|
149
148
|
"k-focus": e
|
|
150
149
|
}), n = {
|
|
@@ -163,8 +162,8 @@ const Ce = 24, pe = 10, we = "office", L = {
|
|
|
163
162
|
}
|
|
164
163
|
);
|
|
165
164
|
}),
|
|
166
|
-
[
|
|
167
|
-
), te = p(() => t.colorRows.map((u, r) => /* @__PURE__ */ R.createElement("tr", { key: u[0] || r, role: "row" },
|
|
165
|
+
[C, x, c, N]
|
|
166
|
+
), te = p(() => t.colorRows.map((u, r) => /* @__PURE__ */ R.createElement("tr", { key: u[0] || r, role: "row" }, B(u, r))), [t, B]), z = p(
|
|
168
167
|
() => ({
|
|
169
168
|
focus: () => {
|
|
170
169
|
var o;
|
|
@@ -174,24 +173,24 @@ const Ce = 24, pe = 10, we = "office", L = {
|
|
|
174
173
|
}),
|
|
175
174
|
[]
|
|
176
175
|
);
|
|
177
|
-
M(X,
|
|
178
|
-
const re = H("k-colorpalette",
|
|
176
|
+
M(X, z), M(P, z);
|
|
177
|
+
const re = H("k-colorpalette", W, {
|
|
179
178
|
"k-disabled": i,
|
|
180
179
|
"k-colorpalette-sm": D === "small",
|
|
181
180
|
"k-colorpalette-md": D === "medium",
|
|
182
181
|
"k-colorpalette-lg": D === "large"
|
|
183
|
-
})
|
|
182
|
+
});
|
|
184
183
|
return /* @__PURE__ */ R.createElement(
|
|
185
184
|
"div",
|
|
186
185
|
{
|
|
187
186
|
ref: k,
|
|
188
187
|
role: "grid",
|
|
189
188
|
className: re,
|
|
190
|
-
tabIndex:
|
|
191
|
-
id:
|
|
192
|
-
"aria-label":
|
|
193
|
-
"aria-labelledby":
|
|
194
|
-
"aria-describedby":
|
|
189
|
+
tabIndex: ie(q, i),
|
|
190
|
+
id: Z,
|
|
191
|
+
"aria-label": Q,
|
|
192
|
+
"aria-labelledby": G,
|
|
193
|
+
"aria-describedby": J,
|
|
195
194
|
"aria-disabled": i ? "true" : void 0,
|
|
196
195
|
onFocus: Y,
|
|
197
196
|
onBlur: ee,
|
|
@@ -200,8 +199,8 @@ const Ce = 24, pe = 10, we = "office", L = {
|
|
|
200
199
|
/* @__PURE__ */ R.createElement("table", { className: "k-colorpalette-table", role: "none" }, /* @__PURE__ */ R.createElement("tbody", null, te()))
|
|
201
200
|
);
|
|
202
201
|
});
|
|
203
|
-
|
|
204
|
-
|
|
202
|
+
F.displayName = "ColorPalette";
|
|
203
|
+
F.propTypes = {
|
|
205
204
|
palette: l.oneOfType([l.arrayOf(l.string.isRequired), l.string]),
|
|
206
205
|
columns: l.number,
|
|
207
206
|
tileSize: l.any,
|
|
@@ -217,17 +216,17 @@ v.propTypes = {
|
|
|
217
216
|
className: l.string,
|
|
218
217
|
size: l.oneOf(["small", "medium", "large"])
|
|
219
218
|
};
|
|
220
|
-
const
|
|
221
|
-
|
|
219
|
+
const me = ne(
|
|
220
|
+
F
|
|
222
221
|
);
|
|
223
|
-
|
|
224
|
-
const
|
|
222
|
+
me.displayName = "KendoReactColorPalette";
|
|
223
|
+
const xe = F;
|
|
225
224
|
export {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
225
|
+
me as ColorPalette,
|
|
226
|
+
we as ColorPalettePropsContext,
|
|
227
|
+
xe as ColorPaletteWithoutContext,
|
|
228
|
+
fe as DEFAULT_COLUMNS_COUNT,
|
|
229
|
+
Ce as DEFAULT_PRESET,
|
|
230
|
+
de as DEFAULT_TILE_SIZE,
|
|
231
|
+
v as defaultColorPaletteProps
|
|
233
232
|
};
|
package/colors/ColorPicker.js
CHANGED
|
@@ -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 Me=require("react"),
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Me=require("react"),l=require("prop-types"),a=require("@progress/kendo-react-common"),be=require("../package-metadata.js"),Ve=require("./Picker.js"),He=require("./ColorGradient.js"),Y=require("./ColorPalette.js"),M=require("./FlatColorPicker.js"),We=require("@progress/kendo-react-buttons"),Ue=require("@progress/kendo-svg-icons"),n=require("../messages/index.js"),je=require("@progress/kendo-react-intl"),Ge=require("../common/AdaptiveMode.js"),Ke=require("@progress/kendo-react-layout");function $e(g){const T=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(g){for(const y in g)if(y!=="default"){const B=Object.getOwnPropertyDescriptor(g,y);Object.defineProperty(T,y,B.get?B:{enumerable:!0,get:()=>g[y]})}}return T.default=g,Object.freeze(T)}const t=$e(Me),Ze={opacity:!0},Je={palette:Y.DEFAULT_PRESET,tileSize:Y.DEFAULT_TILE_SIZE},X=g=>g!==void 0,Ee=a.createPropsContext(),ee=t.forwardRef((g,T)=>{var fe,ge;const y=!a.validatePackage(be.packageMetadata,{component:"ColorPicker"}),B=a.getLicenseMessage(be.packageMetadata),i=a.usePropsContext(Ee,g),v=je.useLocalization(),te=a.useAdaptiveModeContext(),{size:p=w.size,rounded:b=w.rounded,fillMode:V=w.fillMode,gradientSettings:S=w.gradientSettings,paletteSettings:A=w.paletteSettings,flatColorPickerSettings:R,view:k=i.views?void 0:w.view,views:d=k?void 0:w.views,activeView:ae,popupSettings:E,valid:Pe,disabled:F,tabIndex:we,icon:H,svgIcon:W,iconClassName:O,onChange:U,onFocus:j,onBlur:G,onActiveColorClick:K,className:ye,adaptive:Se,adaptiveTitle:ne=v.toLanguageString(n.colorPickerAdaptiveTitle,n.messages[n.colorPickerAdaptiveTitle]),adaptiveSubtitle:re,showButtons:h=!0}=i,s=t.useRef(null),_=t.useRef(null),D=t.useRef(null),C=t.useRef(null),L=t.useRef(void 0),oe=t.useRef(null),[he,le]=t.useState(!1),[Le,Te]=t.useState(i.defaultValue||void 0),[Ae,Re]=t.useState(!1),[z,_e]=t.useState(),$=X(i.value),P=X(i.open),c=$?i.value:Le,f=P?i.open:Ae,ie=t.useRef(c),N=t.useCallback(()=>{s.current&&s.current.focus()},[]);t.useImperativeHandle(T,()=>({element:s.current,actionElement:oe.current,value:c,focus:N}),[c,N]);const ce=t.useRef(null);t.useImperativeHandle(ce,()=>({element:s.current,actionElement:oe.current,value:c,focus:N}),[c,N]),a.useWebMcpRegister("colorpicker",ce,i,i.webMcp);const Z=!!(z&&te&&z<=te.medium&&Se);t.useEffect(()=>{const e=a.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(xe.bind(void 0));return document!=null&&document.body&&e&&e.observe(document.body),()=>{document!=null&&document.body&&e&&e.disconnect()}},[]);const o=t.useCallback((e,u)=>{P||(!e&&!u&&s&&s.current&&s.current.focus(),Re(e))},[P]),se=t.useMemo(()=>new a.Navigation({root:s,selectors:[".k-colorpicker",".k-color-picker-popup"],tabIndex:0,keyboardEvents:{keydown:{Escape:(e,u,r)=>{o(!1)},Enter:(e,u,r)=>{!P&&e===s.current&&(r.preventDefault(),r.stopPropagation(),o(!0))},ArrowDown:(e,u,r)=>{r.altKey&&(r.preventDefault(),r.stopPropagation(),o(!0))},ArrowUp:(e,u,r)=>{r.altKey&&(r.preventDefault(),r.stopPropagation(),o(!1))},Tab:(e,u,r)=>{var I,ve,ke;if(a.getActiveElement(document)!==s.current){const me=(I=D.current)==null?void 0:I.wrapperRef.current,q=(ve=_.current)==null?void 0:ve.wrapperRef.current,Ce=(ke=C.current)==null?void 0:ke.element;k==="palette"&&me?a.keepFocusInContainer(r,me):k==="gradient"&&q?a.keepFocusInContainer(r,q):k==="combo"&&q?a.keepFocusInContainer(r,q.parentElement):d&&Ce&&a.keepFocusInContainer(r,Ce)}}}}}),[o,P]),Ie=t.useCallback(se.triggerKeyboardEvent.bind(se),[]),Be=t.useCallback(()=>{P||(_.current&&_.current.wrapperRef.current?a.focusFirstFocusableChild(_.current.wrapperRef.current):D.current?D.current.focus():C.current&&C.current.element&&a.focusFirstFocusableChild(C.current.element))},[P]),x=e=>ie.current=e,ue=t.useCallback(e=>{const u={value:ie.current,nativeEvent:e.nativeEvent,syntheticEvent:e};m(u),o(!f,!0)},[f]),J=t.useCallback(()=>{o(!1,!0)},[o]),Fe=t.useCallback(e=>{K&&K.call(void 0,{syntheticEvent:e,nativeEvent:e.nativeEvent,value:c,target:{element:s.current,value:c}})},[K,c]),Oe=t.useCallback(e=>{L.current?(clearTimeout(L.current),L.current=void 0):(le(!0),Z&&!f&&o(!0)),j&&j.call(void 0,{nativeEvent:e.nativeEvent,syntheticEvent:e})},[Z,j,f,o]),De=t.useCallback(()=>{o(!1,!0),le(!1),L.current=void 0},[]),ze=t.useCallback(e=>{clearTimeout(L.current),L.current=window.setTimeout(De),G&&G.call(void 0,{nativeEvent:e.nativeEvent,syntheticEvent:e})},[G]),m=t.useCallback((e,u)=>{var I;const r=u?e.rgbaValue||"":(I=e.value)!=null?I:"";$||Te(r),U&&U.call(void 0,{value:r,nativeEvent:e.nativeEvent,syntheticEvent:e.syntheticEvent,target:{element:s.current,value:r}}),o(!1)},[$,U]),de=t.useCallback(e=>m(e,!0),[X,m]),Q=t.useCallback(e=>t.createElement(t.Fragment,null,(k==="combo"||k==="gradient")&&t.createElement(He.ColorGradient,{...S,_adaptive:e,ref:_,isInsidePopup:!0,role:"none",ariaLabel:void 0,size:e?"large":p,value:c,onChange:m}),(k==="combo"||k==="palette")&&t.createElement(Y.ColorPalette,{...A,ref:D,size:e?"large":p,value:c,onChange:de}),d&&d[0]==="gradient"&&d[1]==="palette"&&t.createElement(M.FlatColorPicker,{ariaLabel:v.toLanguageString(n.flatColorPickerAriaLabel,n.messages[n.flatColorPickerAriaLabel]),...R,paletteSettings:A,gradientSettings:{_adaptive:e,...S},ref:C,size:e?"large":p,rounded:b,views:["gradient","palette"],activeView:ae,setOpen:o,showButtons:e?!1:h,value:c,onChange:m,setAdaptiveModeValue:x}),d&&d[0]==="palette"&&d[1]==="gradient"&&t.createElement(M.FlatColorPicker,{ariaLabel:v.toLanguageString(n.flatColorPickerAriaLabel,n.messages[n.flatColorPickerAriaLabel]),...R,paletteSettings:A,gradientSettings:{_adaptive:e,...S},ref:C,size:e?"large":p,rounded:b,views:["palette","gradient"],setOpen:o,showButtons:e?!1:h,value:c,onChange:m,setAdaptiveModeValue:x}),d&&d.includes("gradient")&&!d.includes("palette")&&t.createElement(M.FlatColorPicker,{ariaLabel:v.toLanguageString(n.flatColorPickerAriaLabel,n.messages[n.flatColorPickerAriaLabel]),...R,gradientSettings:{_adaptive:e,...S},ref:C,size:e?"large":p,rounded:b,views:["gradient"],showButtons:e?!1:h,setOpen:o,value:c,onChange:m,setAdaptiveModeValue:x}),d&&d.includes("palette")&&!d.includes("gradient")&&t.createElement(M.FlatColorPicker,{ariaLabel:v.toLanguageString(n.flatColorPickerAriaLabel,n.messages[n.flatColorPickerAriaLabel]),...R,paletteSettings:A,gradientSettings:{_adaptive:e,...S},ref:C,size:e?"large":p,rounded:b,views:["palette"],showButtons:e?!1:h,setOpen:o,value:c,onChange:m,setAdaptiveModeValue:x}),y&&t.createElement(a.WatermarkOverlay,{message:B})),[ae,V,R,S,m,de,A,o,p,c,k,d]),Ne=t.useCallback(()=>{var u;const e={animation:!!((u=E==null?void 0:E.animate)==null||u),title:ne,subTitle:re,expand:f,onClose:J,windowWidth:z,footer:h?{cancelText:v.toLanguageString(n.flatColorPickerCancelBtn,n.messages[n.flatColorPickerCancelBtn]),onCancel:J,applyText:v.toLanguageString(n.flatColorPickerApplyBtn,n.messages[n.flatColorPickerApplyBtn]),onApply:ue}:void 0};return t.createElement(Ge.AdaptiveMode,{...e},t.createElement(Ke.ActionSheetContent,null,Q(!0)))},[E==null?void 0:E.animate,ne,re,f,J,z,h,v,ue,Q]),xe=t.useCallback(e=>{for(const u of e)_e(u.target.clientWidth)},[]),pe=a.useDir(s,i.dir),qe=Pe!==!1;return t.createElement("span",{id:i.id,role:"combobox","aria-label":i.ariaLabel,"aria-labelledby":i.ariaLabelledBy,"aria-describedby":i.ariaDescribedBy,"aria-haspopup":"dialog","aria-expanded":f,"aria-controls":f?`k-colorpicker-popup-${(fe=i.id)!=null?fe:0}`:void 0,"aria-disabled":F?"true":void 0,className:a.classNames("k-colorpicker","k-picker","k-icon-picker",{[`k-picker-${a.kendoThemeMaps.sizeMap[p]||p}`]:p,[`k-picker-${V}`]:V,[`k-rounded-${a.kendoThemeMaps.roundedMap[b]||b}`]:b,"k-invalid":!qe,"k-disabled":F,"k-focus":he,className:ye}),ref:s,tabIndex:a.getTabIndex(we,F),title:i.title,onKeyDown:Ie,onFocus:Oe,onBlur:ze,dir:pe},t.createElement(Ve.Picker,{dir:pe,open:f,onOpen:Be,popupAnchor:s.current||void 0,popupSettings:{id:`k-colorpicker-popup-${(ge=i.id)!=null?ge:0}`,...E},input:t.createElement("span",{onClick:Fe,className:"k-input-inner"},t.createElement("span",{className:a.classNames("k-value-icon","k-color-preview",{"k-no-color":!c,"k-icon-color-preview":H||W||O})},O&&t.createElement("span",{className:a.classNames("k-color-preview-icon",O)}),!O&&(H||W)&&t.createElement(a.IconWrap,{name:H,icon:W}),t.createElement("span",{className:"k-color-preview-mask",style:{backgroundColor:c}}))),button:t.createElement(We.Button,{tabIndex:-1,type:"button",onClick:()=>o(!f),className:"k-input-button",disabled:F,icon:"chevron-down",svgIcon:Ue.chevronDownIcon,size:p,"aria-label":v.toLanguageString(n.colorPickerDropdownButtonAriaLabel,n.messages[n.colorPickerDropdownButtonAriaLabel])}),content:Q(!1),_mobileMode:Z,_actionSheet:Ne()}))});ee.propTypes={value:l.string,defaultValue:l.string,disabled:l.bool,view:l.oneOf(["gradient","palette","combo"]),views:l.arrayOf(l.oneOf(["gradient","palette"])),dir:l.string,id:l.string,icon:l.string,svgIcon:a.svgIconPropType,ariaLabelledBy:l.string,ariaDescribedBy:l.string,size:l.oneOf(["small","medium","large"]),rounded:l.oneOf(["small","medium","large","full","none"]),fillMode:l.oneOf(["solid","flat","outline"]),className:l.string,adaptive:l.bool,adaptiveTitle:l.string,adaptiveSubtitle:l.string};const w={size:void 0,rounded:void 0,fillMode:void 0,view:"palette",views:["gradient","palette"],gradientSettings:Ze,paletteSettings:Je};ee.displayName="KendoColorPicker";exports.ColorPicker=ee;exports.ColorPickerPropsContext=Ee;
|