@progress/kendo-react-inputs 7.2.4-develop.3 → 7.3.0-develop.1
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 +8 -0
- package/checkbox/Checkbox.mjs +214 -0
- package/colors/ColorContrastLabels.js +8 -0
- package/colors/ColorContrastLabels.mjs +24 -0
- package/colors/ColorContrastSvg.js +8 -0
- package/colors/ColorContrastSvg.mjs +52 -0
- package/colors/ColorGradient.js +8 -0
- package/colors/ColorGradient.mjs +293 -0
- package/colors/ColorInput.js +8 -0
- package/colors/ColorInput.mjs +122 -0
- package/colors/ColorPalette.js +8 -0
- package/colors/ColorPalette.mjs +191 -0
- package/colors/ColorPicker.js +8 -0
- package/colors/ColorPicker.mjs +253 -0
- package/colors/FlatColorPicker.js +8 -0
- package/colors/FlatColorPicker.mjs +216 -0
- package/colors/HexInput.js +8 -0
- package/colors/HexInput.mjs +39 -0
- package/colors/Picker.js +8 -0
- package/colors/Picker.mjs +42 -0
- package/colors/models/palette-presets.js +8 -0
- package/colors/models/palette-presets.mjs +61 -0
- package/colors/utils/color-cache.js +8 -0
- package/colors/utils/color-cache.mjs +51 -0
- package/colors/utils/color-palette.service.js +8 -0
- package/colors/utils/color-palette.service.mjs +50 -0
- package/colors/utils/color-parser.js +8 -0
- package/colors/utils/color-parser.mjs +61 -0
- package/colors/utils/misc.js +8 -0
- package/colors/utils/misc.mjs +13 -0
- package/colors/utils/svg-calc.js +8 -0
- package/colors/utils/svg-calc.mjs +36 -0
- package/dist/cdn/js/kendo-react-inputs.js +8 -21
- package/index.d.mts +4275 -5
- package/index.d.ts +4275 -75
- package/index.js +8 -21
- package/index.mjs +97 -5042
- package/input/Input.js +8 -0
- package/input/Input.mjs +185 -0
- package/input/InputClearValue.js +8 -0
- package/input/InputClearValue.mjs +24 -0
- package/input/InputPrefix.js +8 -0
- package/input/InputPrefix.mjs +24 -0
- package/input/InputSeparator.js +8 -0
- package/input/InputSeparator.mjs +24 -0
- package/input/InputSuffix.js +8 -0
- package/input/InputSuffix.mjs +24 -0
- package/input/InputValidationIcon.js +8 -0
- package/input/InputValidationIcon.mjs +15 -0
- package/maskedtextbox/MaskedTextBox.js +8 -0
- package/maskedtextbox/MaskedTextBox.mjs +322 -0
- package/maskedtextbox/masking.service.js +8 -0
- package/maskedtextbox/masking.service.mjs +121 -0
- package/maskedtextbox/parsing/combinators.js +8 -0
- package/maskedtextbox/parsing/combinators.mjs +20 -0
- package/maskedtextbox/parsing/parsers.js +8 -0
- package/maskedtextbox/parsing/parsers.mjs +80 -0
- package/maskedtextbox/parsing/result.js +8 -0
- package/maskedtextbox/parsing/result.mjs +35 -0
- package/maskedtextbox/parsing/stream.js +8 -0
- package/maskedtextbox/parsing/stream.mjs +41 -0
- package/maskedtextbox/utils.js +8 -0
- package/maskedtextbox/utils.mjs +43 -0
- package/messages/index.js +8 -0
- package/messages/index.mjs +77 -0
- package/numerictextbox/NumericTextBox.js +8 -0
- package/numerictextbox/NumericTextBox.mjs +415 -0
- package/numerictextbox/utils/index.js +8 -0
- package/numerictextbox/utils/index.mjs +218 -0
- package/package-metadata.js +8 -0
- package/package-metadata.mjs +19 -0
- package/package.json +8 -8
- package/radiobutton/RadioButton.js +8 -0
- package/radiobutton/RadioButton.mjs +138 -0
- package/radiobutton/RadioGroup.js +8 -0
- package/radiobutton/RadioGroup.mjs +135 -0
- package/range-slider/RangeSlider.js +20 -0
- package/range-slider/RangeSlider.mjs +337 -0
- package/range-slider/range-raducer.js +8 -0
- package/range-slider/range-raducer.mjs +90 -0
- package/rating/Rating.js +12 -0
- package/rating/Rating.mjs +323 -0
- package/rating/RatingItem.js +8 -0
- package/rating/RatingItem.mjs +144 -0
- package/rating/rating-reducer.js +8 -0
- package/rating/rating-reducer.mjs +34 -0
- package/rating/utils/index.js +8 -0
- package/rating/utils/index.mjs +28 -0
- package/signature/Signature.js +8 -0
- package/signature/Signature.mjs +335 -0
- package/signature/utils/index.js +8 -0
- package/signature/utils/index.mjs +17 -0
- package/slider/Slider.js +8 -0
- package/slider/Slider.mjs +223 -0
- package/slider/SliderLabel.js +8 -0
- package/slider/SliderLabel.mjs +39 -0
- package/switch/Switch.js +8 -0
- package/switch/Switch.mjs +228 -0
- package/textarea/TextArea.js +8 -0
- package/textarea/TextArea.mjs +196 -0
- package/textbox/Textbox.js +8 -0
- package/textbox/Textbox.mjs +125 -0
- package/checkbox/Checkbox.d.ts +0 -36
- package/checkbox/interfaces/CheckboxBlurEvent.d.ts +0 -11
- package/checkbox/interfaces/CheckboxChangeEvent.d.ts +0 -15
- package/checkbox/interfaces/CheckboxFocusEvent.d.ts +0 -11
- package/checkbox/interfaces/CheckboxProps.d.ts +0 -126
- package/colors/ColorContrastLabels.d.ts +0 -19
- package/colors/ColorContrastSvg.d.ts +0 -22
- package/colors/ColorGradient.d.ts +0 -191
- package/colors/ColorInput.d.ts +0 -34
- package/colors/ColorPalette.d.ts +0 -127
- package/colors/ColorPicker.d.ts +0 -34
- package/colors/FlatColorPicker.d.ts +0 -139
- package/colors/HexInput.d.ts +0 -33
- package/colors/Picker.d.ts +0 -10
- package/colors/interfaces/ColorGradientChangeEvent.d.ts +0 -15
- package/colors/interfaces/ColorGradientProps.d.ts +0 -101
- package/colors/interfaces/ColorPaletteChangeEvent.d.ts +0 -19
- package/colors/interfaces/ColorPaletteProps.d.ts +0 -87
- package/colors/interfaces/ColorPickerActiveColorClick.d.ts +0 -21
- package/colors/interfaces/ColorPickerBlurEvent.d.ts +0 -17
- package/colors/interfaces/ColorPickerChangeEvent.d.ts +0 -21
- package/colors/interfaces/ColorPickerFocusEvent.d.ts +0 -17
- package/colors/interfaces/ColorPickerGradientSettings.d.ts +0 -22
- package/colors/interfaces/ColorPickerPaletteSettings.d.ts +0 -36
- package/colors/interfaces/ColorPickerPopupSettings.d.ts +0 -18
- package/colors/interfaces/ColorPickerProps.d.ts +0 -165
- package/colors/interfaces/ColorPickerView.d.ts +0 -14
- package/colors/interfaces/PickerPopupSettings.d.ts +0 -22
- package/colors/interfaces/PickerProps.d.ts +0 -46
- package/colors/models/hsva.d.ts +0 -13
- package/colors/models/output-format.d.ts +0 -8
- package/colors/models/palette-presets.d.ts +0 -57
- package/colors/models/rgb.d.ts +0 -12
- package/colors/models/rgba.d.ts +0 -13
- package/colors/models/table-cell.d.ts +0 -11
- package/colors/models/tile-size.d.ts +0 -15
- package/colors/utils/color-cache.d.ts +0 -34
- package/colors/utils/color-palette.service.d.ts +0 -16
- package/colors/utils/color-parser.d.ts +0 -69
- package/colors/utils/misc.d.ts +0 -19
- package/colors/utils/svg-calc.d.ts +0 -66
- package/input/Input.d.ts +0 -171
- package/input/InputClearValue.d.ts +0 -19
- package/input/InputPrefix.d.ts +0 -29
- package/input/InputSeparator.d.ts +0 -29
- package/input/InputSuffix.d.ts +0 -29
- package/input/InputValidationIcon.d.ts +0 -18
- package/input/interfaces/InputChangeEvent.d.ts +0 -15
- package/interfaces/Direction.d.ts +0 -5
- package/interfaces/ToggleBaseProps.d.ts +0 -12
- package/maskedtextbox/MaskedTextBox.d.ts +0 -238
- package/maskedtextbox/MaskedTextBoxProps.d.ts +0 -200
- package/maskedtextbox/masking.service.d.ts +0 -45
- package/maskedtextbox/parsing/combinators.d.ts +0 -13
- package/maskedtextbox/parsing/parsers.d.ts +0 -51
- package/maskedtextbox/parsing/result.d.ts +0 -27
- package/maskedtextbox/parsing/stream.d.ts +0 -26
- package/maskedtextbox/utils.d.ts +0 -20
- package/messages/index.d.ts +0 -169
- package/numerictextbox/NumericTextBox.d.ts +0 -18
- package/numerictextbox/interfaces/NumericTextBoxBlurEvent.d.ts +0 -11
- package/numerictextbox/interfaces/NumericTextBoxChangeEvent.d.ts +0 -15
- package/numerictextbox/interfaces/NumericTextBoxFocusEvent.d.ts +0 -11
- package/numerictextbox/interfaces/NumericTextBoxHandle.d.ts +0 -43
- package/numerictextbox/interfaces/NumericTextBoxProps.d.ts +0 -188
- package/numerictextbox/interfaces/NumericTextBoxState.d.ts +0 -19
- package/numerictextbox/utils/index.d.ts +0 -123
- package/package-metadata.d.ts +0 -9
- package/radiobutton/RadioButton.d.ts +0 -27
- package/radiobutton/RadioGroup.d.ts +0 -27
- package/radiobutton/interfaces/RadioButtonBlurEvent.d.ts +0 -11
- package/radiobutton/interfaces/RadioButtonChangeEvent.d.ts +0 -15
- package/radiobutton/interfaces/RadioButtonFocusEvent.d.ts +0 -11
- package/radiobutton/interfaces/RadioButtonProps.d.ts +0 -101
- package/radiobutton/interfaces/RadioGroupChangeEvent.d.ts +0 -15
- package/radiobutton/interfaces/RadioGroupFocusEvent.d.ts +0 -11
- package/radiobutton/interfaces/RadioGroupProps.d.ts +0 -90
- package/range-slider/RangeSlider.d.ts +0 -142
- package/range-slider/range-raducer.d.ts +0 -40
- package/rating/Rating.d.ts +0 -170
- package/rating/RatingItem.d.ts +0 -108
- package/rating/models/index.d.ts +0 -88
- package/rating/rating-reducer.d.ts +0 -36
- package/rating/utils/index.d.ts +0 -28
- package/signature/Signature.d.ts +0 -18
- package/signature/interfaces/SignatureBlurEvent.d.ts +0 -11
- package/signature/interfaces/SignatureChangeEvent.d.ts +0 -15
- package/signature/interfaces/SignatureCloseEvent.d.ts +0 -11
- package/signature/interfaces/SignatureFocusEvent.d.ts +0 -11
- package/signature/interfaces/SignatureHandle.d.ts +0 -46
- package/signature/interfaces/SignatureOpenEvent.d.ts +0 -11
- package/signature/interfaces/SignatureProps.d.ts +0 -198
- package/signature/interfaces/index.d.ts +0 -11
- package/signature/utils/index.d.ts +0 -8
- package/slider/Slider.d.ts +0 -197
- package/slider/SliderLabel.d.ts +0 -38
- package/switch/Switch.d.ts +0 -294
- package/textarea/TextArea.d.ts +0 -40
- package/textarea/interfaces/TextAreaBlurEvent.d.ts +0 -11
- package/textarea/interfaces/TextAreaChangeEvent.d.ts +0 -15
- package/textarea/interfaces/TextAreaFocusEvent.d.ts +0 -11
- package/textarea/interfaces/TextAreaProps.d.ts +0 -140
- package/textbox/Textbox.d.ts +0 -80
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";
|
|
9
|
+
import * as a from "react";
|
|
10
|
+
import i from "prop-types";
|
|
11
|
+
import { createPropsContext as ee, usePropsContext as te, useDir as ae, Keys as M, IconWrap as f, toIconName as B, getTabIndex as ne, classNames as le, svgIconPropType as $ } from "@progress/kendo-react-common";
|
|
12
|
+
import { starOutlineIcon as K, starIcon as L } from "@progress/kendo-svg-icons";
|
|
13
|
+
import { RatingItem as oe } from "./RatingItem.mjs";
|
|
14
|
+
import { RATING_ACTION as r, ratingReducer as se } from "./rating-reducer.mjs";
|
|
15
|
+
import { calcIsFirstHalf as A, toRound as R, getRemainder as ie, isHalf as re, isSelected as F, isCorrectValue as X } from "./utils/index.mjs";
|
|
16
|
+
import { ratingAriaLabel as q, messages as ce } from "../messages/index.mjs";
|
|
17
|
+
import { useLocalization as ue } from "@progress/kendo-react-intl";
|
|
18
|
+
const G = (n, g, e) => {
|
|
19
|
+
const [h, c] = a.useState(n);
|
|
20
|
+
return [h, (o) => {
|
|
21
|
+
const V = se(g.state || h, { ...o, ...g });
|
|
22
|
+
e && e(V, o.event), c(V);
|
|
23
|
+
}];
|
|
24
|
+
}, me = ee(), H = a.forwardRef((n, g) => {
|
|
25
|
+
const e = te(me, n), h = ue(), c = a.useRef(null), D = a.useRef(null), o = ae(D, e.dir);
|
|
26
|
+
a.useImperativeHandle(c, () => ({
|
|
27
|
+
element: D.current,
|
|
28
|
+
props: e
|
|
29
|
+
})), a.useImperativeHandle(g, () => c.current);
|
|
30
|
+
const V = a.useCallback(
|
|
31
|
+
(t, l) => {
|
|
32
|
+
e.onChange && c.current && e.onChange.call(void 0, {
|
|
33
|
+
value: t,
|
|
34
|
+
target: c.current,
|
|
35
|
+
syntheticEvent: l
|
|
36
|
+
});
|
|
37
|
+
},
|
|
38
|
+
[e.onChange]
|
|
39
|
+
), b = a.useMemo(
|
|
40
|
+
() => e.min !== void 0 ? e.min : m.min,
|
|
41
|
+
[e.min]
|
|
42
|
+
), I = a.useMemo(
|
|
43
|
+
() => e.max !== void 0 ? e.max : m.max,
|
|
44
|
+
[e.max]
|
|
45
|
+
), d = a.useMemo(
|
|
46
|
+
() => e.precision || m.precision,
|
|
47
|
+
[e.precision]
|
|
48
|
+
), s = a.useMemo(
|
|
49
|
+
() => e.step !== void 0 ? e.step : m.step,
|
|
50
|
+
[e.step]
|
|
51
|
+
), w = a.useMemo(
|
|
52
|
+
() => e.readonly || m.readonly,
|
|
53
|
+
[e.readonly]
|
|
54
|
+
), k = a.useMemo(
|
|
55
|
+
() => e.disabled || m.disabled,
|
|
56
|
+
[e.disabled]
|
|
57
|
+
), W = a.useMemo(
|
|
58
|
+
() => e.item || m.item,
|
|
59
|
+
[e.item]
|
|
60
|
+
), [P, p] = G(
|
|
61
|
+
e.defaultValue !== void 0 ? e.defaultValue : m.defaultValue,
|
|
62
|
+
{
|
|
63
|
+
state: e.value,
|
|
64
|
+
min: b,
|
|
65
|
+
max: I,
|
|
66
|
+
step: d === "half" ? s / 2 : s
|
|
67
|
+
},
|
|
68
|
+
V
|
|
69
|
+
), [T, O] = G(
|
|
70
|
+
null,
|
|
71
|
+
{
|
|
72
|
+
state: e.value,
|
|
73
|
+
min: b,
|
|
74
|
+
max: I,
|
|
75
|
+
step: d === "half" ? s / 2 : s,
|
|
76
|
+
precision: d
|
|
77
|
+
}
|
|
78
|
+
), u = a.useMemo(
|
|
79
|
+
() => e.value !== void 0 ? e.value : P,
|
|
80
|
+
[e.value, P]
|
|
81
|
+
), x = a.useMemo(
|
|
82
|
+
() => T,
|
|
83
|
+
[T]
|
|
84
|
+
), z = a.useMemo(
|
|
85
|
+
() => e.selection || m.selection,
|
|
86
|
+
[e.selection]
|
|
87
|
+
), C = a.useMemo(
|
|
88
|
+
() => s / (d === "half" ? 2 : 1),
|
|
89
|
+
[s, d]
|
|
90
|
+
), _ = a.useCallback(
|
|
91
|
+
(t) => {
|
|
92
|
+
if (!(!t.target || !t.target.element || w || k)) {
|
|
93
|
+
if (d === "half") {
|
|
94
|
+
const l = t.target.element.getBoundingClientRect(), E = A(o || "ltr", l, t.syntheticEvent.clientX) ? R(t.target.value - s / 2, C) : t.target.value;
|
|
95
|
+
p({ type: r.select, payload: E, event: t.syntheticEvent });
|
|
96
|
+
} else
|
|
97
|
+
p({ type: r.select, payload: t.target.value, event: t.syntheticEvent });
|
|
98
|
+
if (e.onClick) {
|
|
99
|
+
const l = {
|
|
100
|
+
value: u,
|
|
101
|
+
target: c.current,
|
|
102
|
+
syntheticEvent: t.syntheticEvent
|
|
103
|
+
};
|
|
104
|
+
e.onClick.call(void 0, l);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
[e.onClick, p, u]
|
|
109
|
+
), j = a.useCallback(
|
|
110
|
+
(t) => {
|
|
111
|
+
if (!(w || k)) {
|
|
112
|
+
switch (t.keyCode) {
|
|
113
|
+
case M.right:
|
|
114
|
+
t.preventDefault(), p({
|
|
115
|
+
type: o === "rtl" ? r.decrease : r.increase,
|
|
116
|
+
event: t
|
|
117
|
+
});
|
|
118
|
+
break;
|
|
119
|
+
case M.left:
|
|
120
|
+
t.preventDefault(), p({
|
|
121
|
+
type: o === "rtl" ? r.increase : r.decrease,
|
|
122
|
+
event: t
|
|
123
|
+
});
|
|
124
|
+
break;
|
|
125
|
+
case M.home:
|
|
126
|
+
t.preventDefault(), p({
|
|
127
|
+
type: o === "rtl" ? r.min : r.max,
|
|
128
|
+
event: t
|
|
129
|
+
});
|
|
130
|
+
break;
|
|
131
|
+
case M.end:
|
|
132
|
+
t.preventDefault(), p({
|
|
133
|
+
type: o === "rtl" ? r.max : r.min,
|
|
134
|
+
event: t
|
|
135
|
+
});
|
|
136
|
+
break;
|
|
137
|
+
case M.esc:
|
|
138
|
+
t.preventDefault(), p({
|
|
139
|
+
type: r.deselect,
|
|
140
|
+
event: t
|
|
141
|
+
});
|
|
142
|
+
break;
|
|
143
|
+
}
|
|
144
|
+
e.onKeyDown && e.onKeyDown.call(
|
|
145
|
+
void 0,
|
|
146
|
+
{
|
|
147
|
+
value: u,
|
|
148
|
+
target: c.current,
|
|
149
|
+
syntheticEvent: t
|
|
150
|
+
}
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
[e.onKeyDown, p, u]
|
|
155
|
+
), J = a.useCallback(
|
|
156
|
+
(t) => {
|
|
157
|
+
if (e.onFocus) {
|
|
158
|
+
const l = {
|
|
159
|
+
target: c.current,
|
|
160
|
+
syntheticEvent: t
|
|
161
|
+
};
|
|
162
|
+
e.onFocus.call(
|
|
163
|
+
void 0,
|
|
164
|
+
l
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
[e.onFocus]
|
|
169
|
+
), Q = a.useCallback(
|
|
170
|
+
(t) => {
|
|
171
|
+
if (e.onBlur) {
|
|
172
|
+
const l = {
|
|
173
|
+
target: c.current,
|
|
174
|
+
syntheticEvent: t
|
|
175
|
+
};
|
|
176
|
+
e.onBlur.call(
|
|
177
|
+
void 0,
|
|
178
|
+
l
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
[e.onBlur]
|
|
183
|
+
), U = a.useCallback(
|
|
184
|
+
(t) => {
|
|
185
|
+
if (!(!t.target || !t.target.element))
|
|
186
|
+
if (d === "half") {
|
|
187
|
+
const l = t.target.element.getBoundingClientRect(), E = A(o || "ltr", l, t.syntheticEvent.clientX) ? t.target.value - s / 2 : t.target.value;
|
|
188
|
+
O({ type: r.select, payload: E, event: t.syntheticEvent });
|
|
189
|
+
} else
|
|
190
|
+
O({ type: r.select, payload: t.target.value, event: t.syntheticEvent });
|
|
191
|
+
},
|
|
192
|
+
[d, s, o]
|
|
193
|
+
), Y = a.useCallback(
|
|
194
|
+
(t) => {
|
|
195
|
+
O({ type: r.reset, event: t.syntheticEvent });
|
|
196
|
+
},
|
|
197
|
+
[]
|
|
198
|
+
), S = [], Z = ie(R(I - b, C), s);
|
|
199
|
+
for (let t = b; t <= I; t = R(t + s, C)) {
|
|
200
|
+
const l = R(t + Z, C), v = d === "half" ? re(l, x !== null ? x : u !== null ? u : 0, s) : !1, E = F(l, u, s, z), N = F(l, x !== null ? x : u, s, z), y = F(l, x, s, z);
|
|
201
|
+
S.push(
|
|
202
|
+
/* @__PURE__ */ a.createElement(
|
|
203
|
+
W,
|
|
204
|
+
{
|
|
205
|
+
key: l,
|
|
206
|
+
value: l,
|
|
207
|
+
dir: o,
|
|
208
|
+
title: String(v ? R(l - s / 2, C) : l),
|
|
209
|
+
icon: e.icon,
|
|
210
|
+
svgIcon: e.svgIcon,
|
|
211
|
+
half: v,
|
|
212
|
+
selected: E || N,
|
|
213
|
+
hovered: y,
|
|
214
|
+
onClick: _,
|
|
215
|
+
onMouseMove: U,
|
|
216
|
+
onMouseLeave: Y
|
|
217
|
+
},
|
|
218
|
+
v && /* @__PURE__ */ a.createElement("span", { className: "k-rating-precision-complement" }, !(e.icon || e.svgIconOutline) && /* @__PURE__ */ a.createElement(f, { name: "star-outline", icon: K, style: { clipPath: `${o === "rtl" ? "inset(0 50% 0 0)" : "inset(0 0 0 50%)"}` }, size: "xlarge" }), (e.icon || e.svgIconOutline) && /* @__PURE__ */ a.createElement(f, { name: B(`${e.icon}-outline`), icon: e.svgIconOutline, size: "xlarge" })),
|
|
219
|
+
v && /* @__PURE__ */ a.createElement("span", { className: "k-rating-precision-part" }, !(e.icon || e.svgIcon) && /* @__PURE__ */ a.createElement(f, { name: "star", icon: L, style: { clipPath: `${o === "rtl" ? "inset(0 0 0 50%)" : "inset(0 50% 0 0)"}` }, size: "xlarge" }), (e.icon || e.svgIcon) && /* @__PURE__ */ a.createElement(f, { name: e.icon ? B(e.icon) : void 0, icon: e.svgIcon, size: "xlarge" })),
|
|
220
|
+
v && /* @__PURE__ */ a.createElement("span", { style: { width: "24px", height: "24px", display: "block" } }),
|
|
221
|
+
!v && !(e.icon || e.svgIcon) && (y || N && !y) && /* @__PURE__ */ a.createElement(f, { name: "star", icon: L, size: "xlarge" }) || !(e.icon || e.svgIcon) && !y && !N && /* @__PURE__ */ a.createElement(f, { name: "star-outline", icon: K, size: "xlarge" }) || (e.icon || e.svgIcon) && (y || N && !y) && /* @__PURE__ */ a.createElement(f, { name: e.icon, icon: e.svgIcon, size: "xlarge" }) || (e.icon || e.svgIcon) && !y && /* @__PURE__ */ a.createElement(f, { name: B(`${e.icon}-outline`), icon: e.svgIconOutline, size: "xlarge" })
|
|
222
|
+
)
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
return /* @__PURE__ */ a.createElement(
|
|
226
|
+
"span",
|
|
227
|
+
{
|
|
228
|
+
id: e.id,
|
|
229
|
+
style: e.style,
|
|
230
|
+
ref: D,
|
|
231
|
+
role: "slider",
|
|
232
|
+
dir: o,
|
|
233
|
+
tabIndex: ne(e.tabIndex, e.disabled, void 0),
|
|
234
|
+
className: le(
|
|
235
|
+
"k-rating",
|
|
236
|
+
{
|
|
237
|
+
"k-rtl": o === "rtl",
|
|
238
|
+
"k-readonly": w,
|
|
239
|
+
"k-disabled": k
|
|
240
|
+
},
|
|
241
|
+
e.className
|
|
242
|
+
),
|
|
243
|
+
onKeyDown: j,
|
|
244
|
+
onFocus: J,
|
|
245
|
+
onBlur: Q,
|
|
246
|
+
"aria-valuemin": b,
|
|
247
|
+
"aria-valuemax": I,
|
|
248
|
+
"aria-valuenow": u !== null ? u : void 0,
|
|
249
|
+
"aria-disabled": k ? "true" : void 0,
|
|
250
|
+
"aria-label": h.toLanguageString(q, ce[q]),
|
|
251
|
+
"aria-labelledby": e.ariaLabelledBy,
|
|
252
|
+
"aria-describedby": e.ariaDescribedBy
|
|
253
|
+
},
|
|
254
|
+
/* @__PURE__ */ a.createElement(
|
|
255
|
+
"input",
|
|
256
|
+
{
|
|
257
|
+
id: "rating",
|
|
258
|
+
className: "k-hidden",
|
|
259
|
+
readOnly: w,
|
|
260
|
+
disabled: k
|
|
261
|
+
}
|
|
262
|
+
),
|
|
263
|
+
/* @__PURE__ */ a.createElement(
|
|
264
|
+
"span",
|
|
265
|
+
{
|
|
266
|
+
className: "k-rating-container"
|
|
267
|
+
},
|
|
268
|
+
S
|
|
269
|
+
),
|
|
270
|
+
e.label && /* @__PURE__ */ a.createElement(
|
|
271
|
+
"span",
|
|
272
|
+
{
|
|
273
|
+
className: "k-rating-label"
|
|
274
|
+
},
|
|
275
|
+
e.label
|
|
276
|
+
)
|
|
277
|
+
);
|
|
278
|
+
}), de = {
|
|
279
|
+
id: i.string,
|
|
280
|
+
dir: i.oneOf(["ltr", "rtl"]),
|
|
281
|
+
selection: i.oneOf(["continues", "single"]),
|
|
282
|
+
precision: i.oneOf(["item", "half"]),
|
|
283
|
+
value: (n, g, e) => n.value && n.min && n.max && n.step && !(n.precision === "half" ? X(n.min, n.max, n.step / 2, n.value) : X(n.min, n.max, n.step, n.value)) && n.precision === "half" ? new Error(
|
|
284
|
+
`Invalid prop + ${g} supplied to ${e}.
|
|
285
|
+
The value of the { value } property is not correct, please check your values.
|
|
286
|
+
`
|
|
287
|
+
) : null,
|
|
288
|
+
defaultValue: i.number,
|
|
289
|
+
min: i.number,
|
|
290
|
+
max: i.number,
|
|
291
|
+
step: (n, g, e) => n.step !== void 0 && n.step <= 0 ? new Error(
|
|
292
|
+
`Invalid prop + ${g} supplied to ${e}.
|
|
293
|
+
The value of the { step } property is cannot be equal or less than "0", please check your values.
|
|
294
|
+
`
|
|
295
|
+
) : null,
|
|
296
|
+
hovered: i.number,
|
|
297
|
+
label: i.string,
|
|
298
|
+
readonly: i.bool,
|
|
299
|
+
disabled: i.bool,
|
|
300
|
+
half: i.bool,
|
|
301
|
+
icon: i.string,
|
|
302
|
+
svgIcon: $,
|
|
303
|
+
svgIconOutline: $,
|
|
304
|
+
ariaDescribedBy: i.string
|
|
305
|
+
}, m = {
|
|
306
|
+
dir: "ltr",
|
|
307
|
+
min: 1,
|
|
308
|
+
max: 5,
|
|
309
|
+
step: 1,
|
|
310
|
+
item: oe,
|
|
311
|
+
defaultValue: null,
|
|
312
|
+
readonly: !1,
|
|
313
|
+
disabled: !1,
|
|
314
|
+
selection: "continues",
|
|
315
|
+
precision: "item"
|
|
316
|
+
};
|
|
317
|
+
H.displayName = "KendoReactRating";
|
|
318
|
+
H.propTypes = de;
|
|
319
|
+
H.defaultProps = m;
|
|
320
|
+
export {
|
|
321
|
+
H as Rating,
|
|
322
|
+
me as RatingPropsContext
|
|
323
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("react"),a=require("prop-types"),r=require("@progress/kendo-react-common");function h(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const c=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(o,t,c.get?c:{enumerable:!0,get:()=>e[t]})}}return o.default=e,Object.freeze(o)}const l=h(g),u=l.forwardRef((e,o)=>{const t=l.useRef(null),c=l.useRef(null),i=r.useDir(c,e.dir);l.useImperativeHandle(t,()=>({element:c.current,props:e,value:e.value})),l.useImperativeHandle(o,()=>t.current);const s=l.useCallback(n=>{e.onClick&&e.onClick.call(void 0,{value:e.value,target:t.current,syntheticEvent:n})},[e.onClick,e.value]),d=l.useCallback(n=>{e.onKeyDown&&e.onKeyDown.call(void 0,{target:t.current,syntheticEvent:n})},[e.onKeyDown]),v=l.useCallback(n=>{e.onFocus&&e.onFocus.call(void 0,{target:t.current,syntheticEvent:n})},[e.onFocus]),f=l.useCallback(n=>{e.onBlur&&e.onBlur.call(void 0,{target:t.current,syntheticEvent:n})},[e.onBlur]),y=l.useCallback(n=>{e.onMouseMove&&e.onMouseMove.call(void 0,{target:t.current,syntheticEvent:n})},[e.onMouseMove]),M=l.useCallback(n=>{e.onMouseEnter&&e.onMouseEnter.call(void 0,{target:t.current,syntheticEvent:n})},[e.onMouseEnter]),b=l.useCallback(n=>{e.onMouseLeave&&e.onMouseLeave.call(void 0,{target:t.current,syntheticEvent:n})},[e.onMouseLeave]);return l.createElement("span",{id:e.id,ref:c,dir:i,"data-half":e.half,tabIndex:e.tabIndex,title:e.title,style:e.style,className:r.classNames("k-rating-item",{"k-rtl":i==="rtl","k-selected":e.selected,"k-hover":e.hovered},e.className),onClick:s,onKeyDown:d,onFocus:v,onBlur:f,onMouseEnter:M,onMouseLeave:b,onMouseMove:y},e.children)}),m={id:a.string,icon:a.any,dir:a.oneOf(["ltr","rtl"]),title:a.string,value:a.number,half:a.bool,selected:a.bool,hovered:a.bool},k={dir:"ltr"};u.displayName="KendoReactRatingItem";u.propTypes=m;u.defaultProps=k;exports.RatingItem=u;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";
|
|
9
|
+
import * as n from "react";
|
|
10
|
+
import a from "prop-types";
|
|
11
|
+
import { useDir as m, classNames as y } from "@progress/kendo-react-common";
|
|
12
|
+
const c = n.forwardRef((e, i) => {
|
|
13
|
+
const l = n.useRef(null), o = n.useRef(null), u = m(o, e.dir);
|
|
14
|
+
n.useImperativeHandle(l, () => ({
|
|
15
|
+
element: o.current,
|
|
16
|
+
props: e,
|
|
17
|
+
value: e.value
|
|
18
|
+
})), n.useImperativeHandle(i, () => l.current);
|
|
19
|
+
const s = n.useCallback(
|
|
20
|
+
(t) => {
|
|
21
|
+
e.onClick && e.onClick.call(
|
|
22
|
+
void 0,
|
|
23
|
+
{
|
|
24
|
+
value: e.value,
|
|
25
|
+
target: l.current,
|
|
26
|
+
syntheticEvent: t
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
},
|
|
30
|
+
[e.onClick, e.value]
|
|
31
|
+
), r = n.useCallback(
|
|
32
|
+
(t) => {
|
|
33
|
+
e.onKeyDown && e.onKeyDown.call(
|
|
34
|
+
void 0,
|
|
35
|
+
{
|
|
36
|
+
target: l.current,
|
|
37
|
+
syntheticEvent: t
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
},
|
|
41
|
+
[e.onKeyDown]
|
|
42
|
+
), d = n.useCallback(
|
|
43
|
+
(t) => {
|
|
44
|
+
e.onFocus && e.onFocus.call(
|
|
45
|
+
void 0,
|
|
46
|
+
{
|
|
47
|
+
target: l.current,
|
|
48
|
+
syntheticEvent: t
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
},
|
|
52
|
+
[e.onFocus]
|
|
53
|
+
), v = n.useCallback(
|
|
54
|
+
(t) => {
|
|
55
|
+
e.onBlur && e.onBlur.call(
|
|
56
|
+
void 0,
|
|
57
|
+
{
|
|
58
|
+
target: l.current,
|
|
59
|
+
syntheticEvent: t
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
},
|
|
63
|
+
[e.onBlur]
|
|
64
|
+
), f = n.useCallback(
|
|
65
|
+
(t) => {
|
|
66
|
+
e.onMouseMove && e.onMouseMove.call(
|
|
67
|
+
void 0,
|
|
68
|
+
{
|
|
69
|
+
target: l.current,
|
|
70
|
+
syntheticEvent: t
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
},
|
|
74
|
+
[e.onMouseMove]
|
|
75
|
+
), h = n.useCallback(
|
|
76
|
+
(t) => {
|
|
77
|
+
e.onMouseEnter && e.onMouseEnter.call(
|
|
78
|
+
void 0,
|
|
79
|
+
{
|
|
80
|
+
target: l.current,
|
|
81
|
+
syntheticEvent: t
|
|
82
|
+
}
|
|
83
|
+
);
|
|
84
|
+
},
|
|
85
|
+
[e.onMouseEnter]
|
|
86
|
+
), M = n.useCallback(
|
|
87
|
+
(t) => {
|
|
88
|
+
e.onMouseLeave && e.onMouseLeave.call(
|
|
89
|
+
void 0,
|
|
90
|
+
{
|
|
91
|
+
target: l.current,
|
|
92
|
+
syntheticEvent: t
|
|
93
|
+
}
|
|
94
|
+
);
|
|
95
|
+
},
|
|
96
|
+
[e.onMouseLeave]
|
|
97
|
+
);
|
|
98
|
+
return /* @__PURE__ */ n.createElement(
|
|
99
|
+
"span",
|
|
100
|
+
{
|
|
101
|
+
id: e.id,
|
|
102
|
+
ref: o,
|
|
103
|
+
dir: u,
|
|
104
|
+
"data-half": e.half,
|
|
105
|
+
tabIndex: e.tabIndex,
|
|
106
|
+
title: e.title,
|
|
107
|
+
style: e.style,
|
|
108
|
+
className: y(
|
|
109
|
+
"k-rating-item",
|
|
110
|
+
{
|
|
111
|
+
"k-rtl": u === "rtl",
|
|
112
|
+
"k-selected": e.selected,
|
|
113
|
+
"k-hover": e.hovered
|
|
114
|
+
},
|
|
115
|
+
e.className
|
|
116
|
+
),
|
|
117
|
+
onClick: s,
|
|
118
|
+
onKeyDown: r,
|
|
119
|
+
onFocus: d,
|
|
120
|
+
onBlur: v,
|
|
121
|
+
onMouseEnter: h,
|
|
122
|
+
onMouseLeave: M,
|
|
123
|
+
onMouseMove: f
|
|
124
|
+
},
|
|
125
|
+
e.children
|
|
126
|
+
);
|
|
127
|
+
}), k = {
|
|
128
|
+
id: a.string,
|
|
129
|
+
icon: a.any,
|
|
130
|
+
dir: a.oneOf(["ltr", "rtl"]),
|
|
131
|
+
title: a.string,
|
|
132
|
+
value: a.number,
|
|
133
|
+
half: a.bool,
|
|
134
|
+
selected: a.bool,
|
|
135
|
+
hovered: a.bool
|
|
136
|
+
}, b = {
|
|
137
|
+
dir: "ltr"
|
|
138
|
+
};
|
|
139
|
+
c.displayName = "KendoReactRatingItem";
|
|
140
|
+
c.propTypes = k;
|
|
141
|
+
c.defaultProps = b;
|
|
142
|
+
export {
|
|
143
|
+
c as RatingItem
|
|
144
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./utils/index.js");var u=(r=>(r.select="select",r.deselect="deselect",r.increase="increase",r.decrease="decrease",r.min="min",r.max="max",r.reset="reset",r))(u||{});const d=(r,e)=>{switch(e.type){case"select":return e.payload===void 0||e.step===void 0?r:e.payload===r?null:e.payload>=e.min?e.payload<e.max?s.toRound(e.payload,e.step):e.max:e.min;case"deselect":return null;case"increase":return e.step===void 0?r:r<e.min?e.min:r+e.step<e.max?s.toRound(r+e.step,e.step):e.max;case"decrease":return e.step===void 0?r:s.toRound(r-e.step,e.step)>=e.min?s.toRound(r-e.step,e.step):e.min;case"min":return e.step===void 0?r:e.min;case"max":return e.max;case"reset":return null;default:return r}};exports.RATING_ACTION=u;exports.ratingReducer=d;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";
|
|
9
|
+
import { toRound as s } from "./utils/index.mjs";
|
|
10
|
+
var u = /* @__PURE__ */ ((r) => (r.select = "select", r.deselect = "deselect", r.increase = "increase", r.decrease = "decrease", r.min = "min", r.max = "max", r.reset = "reset", r))(u || {});
|
|
11
|
+
const p = (r, e) => {
|
|
12
|
+
switch (e.type) {
|
|
13
|
+
case "select":
|
|
14
|
+
return e.payload === void 0 || e.step === void 0 ? r : e.payload === r ? null : e.payload >= e.min ? e.payload < e.max ? s(e.payload, e.step) : e.max : e.min;
|
|
15
|
+
case "deselect":
|
|
16
|
+
return null;
|
|
17
|
+
case "increase":
|
|
18
|
+
return e.step === void 0 ? r : r < e.min ? e.min : r + e.step < e.max ? s(r + e.step, e.step) : e.max;
|
|
19
|
+
case "decrease":
|
|
20
|
+
return e.step === void 0 ? r : s(r - e.step, e.step) >= e.min ? s(r - e.step, e.step) : e.min;
|
|
21
|
+
case "min":
|
|
22
|
+
return e.step === void 0 ? r : e.min;
|
|
23
|
+
case "max":
|
|
24
|
+
return e.max;
|
|
25
|
+
case "reset":
|
|
26
|
+
return null;
|
|
27
|
+
default:
|
|
28
|
+
return r;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
export {
|
|
32
|
+
u as RATING_ACTION,
|
|
33
|
+
p as ratingReducer
|
|
34
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=(r,t)=>{if(r%1){const o=Math.pow(10,(t.toString().split(".")[1]||t.toString().split(".")[0]).length);return Math.round(r*o)/o}return r},l=(r,t)=>r-t*Math.floor(r/t),s=(r,t,o)=>i(r-o,o)<t&&t<r,c=(r,t,o,n)=>t===null?!1:n==="continues"?s(r,t,o)?i(r-o/2,o/2)<=t:r<=t:n==="single"?s(r,t,o)?i(r-o/2,o/2)===t:r===t:!1,f=(r,t,o)=>r==="ltr"?o<t.x+t.width/2:o>t.x+t.width/2,u=(r,t,o,n)=>{for(let e=r;e<=t;e+=o)if(n===e)return!0;return!1};exports.calcIsFirstHalf=f;exports.getRemainder=l;exports.isCorrectValue=u;exports.isHalf=s;exports.isSelected=c;exports.toRound=i;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";
|
|
9
|
+
const i = (t, r) => {
|
|
10
|
+
if (t % 1) {
|
|
11
|
+
const n = Math.pow(10, (r.toString().split(".")[1] || r.toString().split(".")[0]).length);
|
|
12
|
+
return Math.round(t * n) / n;
|
|
13
|
+
}
|
|
14
|
+
return t;
|
|
15
|
+
}, c = (t, r) => t - r * Math.floor(t / r), s = (t, r, n) => i(t - n, n) < r && r < t, l = (t, r, n, o) => r === null ? !1 : o === "continues" ? s(t, r, n) ? i(t - n / 2, n / 2) <= r : t <= r : o === "single" ? s(t, r, n) ? i(t - n / 2, n / 2) === r : t === r : !1, u = (t, r, n) => t === "ltr" ? n < r.x + r.width / 2 : n > r.x + r.width / 2, h = (t, r, n, o) => {
|
|
16
|
+
for (let f = t; f <= r; f += n)
|
|
17
|
+
if (o === f)
|
|
18
|
+
return !0;
|
|
19
|
+
return !1;
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
u as calcIsFirstHalf,
|
|
23
|
+
c as getRemainder,
|
|
24
|
+
h as isCorrectValue,
|
|
25
|
+
s as isHalf,
|
|
26
|
+
l as isSelected,
|
|
27
|
+
i as toRound
|
|
28
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ve=require("@progress/kendo-inputs-common"),R=require("@progress/kendo-react-buttons"),s=require("@progress/kendo-react-common"),ye=require("@progress/kendo-react-dialogs"),Ce=require("@progress/kendo-react-intl"),a=require("prop-types"),he=require("react"),d=require("../messages/index.js"),Se=require("../package-metadata.js"),ze=require("./utils/index.js"),q=require("@progress/kendo-svg-icons");function Oe(i){const f=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const e in i)if(e!=="default"){const p=Object.getOwnPropertyDescriptor(i,e);Object.defineProperty(f,e,p.get?p:{enumerable:!0,get:()=>i[e]})}}return f.default=i,Object.freeze(f)}const n=Oe(he),Ee=250,xe=84,Z=3,ee=2,Me="#000000",Ie="#ffffff",Y=i=>i!==void 0,te=s.createPropsContext(),b=n.forwardRef((i,f)=>{s.validatePackage(Se.packageMetadata);const e=s.usePropsContext(te,i),p=Ce.useLocalization(),c=n.useRef(null),v=n.useRef(null),T=n.useRef(null),B=n.useRef(null),_=n.useRef(null),[r,ne]=n.useState(),[y,j]=n.useState(!1),[O,N]=n.useState(!1),[C,F]=n.useState(),[oe,ae]=n.useState(),G=Y(e.value)?e.value:C,[re,se]=n.useState(!1),k=Y(e.open),g=k?e.open:re,ie=!(e.maximized||O||!e.maximizable||e.disabled),le=e.maximized&&!O,ce=!(!(e.value||C)||O||e.readOnly||e.disabled),A=p.toLanguageString(d.signatureMaximize,d.messages[d.signatureMaximize]),V=p.toLanguageString(d.signatureMinimize,d.messages[d.signatureMinimize]),U=p.toLanguageString(d.signatureClear,d.messages[d.signatureClear]),E=e.popupScale||Z,x=e.exportScale||ee,M=t=>{F(t),e.onChange&&e.onChange({value:t})},ue=t=>{r==null||r.loadImage(t.value),M(t.value)};n.useEffect(()=>{e.value!==C&&(F(e.value),r==null||r.loadImage(e.value))},[e.value]);const de=()=>{r==null||r.clear(),M()},h=n.useCallback(t=>{k||se(t)},[k]),me=t=>{var o,l;X(t),(l=((o=_.current)==null?void 0:o.element)||v.current)==null||l.focus()},I=n.useCallback(()=>{let t=Me;return!e.color&&typeof document!="undefined"&&c.current&&(t=getComputedStyle(c.current).color),e.color||t},[e.color]),w=n.useCallback(()=>{let t=Ie;return!e.backgroundColor&&typeof document!="undefined"&&c.current&&(t=getComputedStyle(c.current).backgroundColor),e.backgroundColor||t},[e.backgroundColor]),W=()=>({scale:e.maximized?e.popupScale:1,color:I(),backgroundColor:w(),strokeWidth:e.strokeWidth,smooth:e.smooth,readonly:e.readOnly}),H=async t=>{const{width:o,height:l}=t;return await(r==null?void 0:r.exportImage({width:o*x,height:l*x}))};n.useEffect(()=>{const t=v.current,o=new ve.SignaturePad(t,W());return G&&o.loadImage(G),ne(o),()=>o.destroy()},[]),n.useEffect(()=>{r==null||r.setOptions({onChange:async()=>M(await H(J())),onDraw:()=>N(!0),onDrawEnd:()=>N(!1)})},[r]),s.useIsomorphicLayoutEffect(()=>r==null?void 0:r.setOptions(W()),[e.readOnly,e.color,e.backgroundColor,e.strokeWidth,e.smooth]),n.useEffect(()=>{var l,m;const t=(m=(l=T.current)==null?void 0:l.element)==null?void 0:m.querySelector(".k-overlay");if(!t)return;const o=()=>h(!1);return t.addEventListener("click",o),()=>t.removeEventListener("click",o)},[g]),n.useEffect(()=>{if(!g||typeof document=="undefined")return;const t=o=>{o.keyCode===s.Keys.esc&&h(!1)};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[g]),n.useEffect(()=>{var t,o;e.maximized&&((o=(t=B.current)==null?void 0:t.element)==null||o.focus())},[]);const P=n.useCallback(()=>{var t;return(t=v.current)==null?void 0:t.focus()},[]),S=n.useCallback(()=>e.value,[e.value]),K=n.useCallback(()=>e.name,[e.name]),z=n.useCallback(()=>e.required,[e.required]),L=n.useCallback(()=>{const t=e.validationMessage!==void 0,l=!S(),m=e.valid!==void 0?e.valid:!z()||!l;return{customError:t,valid:m,valueMissing:l}},[e.validationMessage,e.valid,S,z]),D=n.useCallback(()=>e.validityStyles,[e.validityStyles]),$=n.useCallback(()=>e,[e]),u=n.useCallback(()=>{const t={element:c.current,focus:P};return Object.defineProperty(t,"name",{get:K}),Object.defineProperty(t,"value",{get:S}),Object.defineProperty(t,"validity",{get:L}),Object.defineProperty(t,"validityStyles",{get:D}),Object.defineProperty(t,"required",{get:z}),Object.defineProperty(t,"props",{get:$}),Object.defineProperty(t,"color",{get:I}),Object.defineProperty(t,"backgroundColor",{get:w}),t},[K,S,L,D,z,P,$,I,w]);n.useImperativeHandle(f,u);const pe=n.useCallback(t=>{y||e.maximized||(j(!0),s.dispatchEvent(e.onFocus,t,u(),{}))},[y,e.onFocus,u]),ge=n.useCallback(t=>{ze.hasParent(t.relatedTarget,c.current)||(j(!1),s.dispatchEvent(e.onBlur,t,u(),{}))},[y,e.onBlur,u]),fe=n.useCallback(async t=>{ae(await H(Q())),h(!0),s.dispatchEvent(e.onOpen,t,u(),{})},[g,k,e.onOpen,e.value,C,u]),X=n.useCallback(t=>{h(!1),s.dispatchEvent(e.onClose,t,u(),{})},[g,k,e.onClose,u]),ke=()=>{de(),P()},J=()=>{var l,m;const t=e.width||((l=c.current)==null?void 0:l.offsetWidth)||Ee,o=e.height||((m=c.current)==null?void 0:m.offsetHeight)||xe;return{width:t,height:o}},Q=()=>{const{width:t,height:o}=J();return{width:t*E,height:o*E}},be=!D()||L().valid;return n.createElement("div",{ref:c,dir:e.dir,style:{width:e.width,height:e.height,...e.style},className:s.classNames("k-input","k-signature",{"k-signature-maximized":e.maximized,[`k-signature-${s.kendoThemeMaps.sizeMap[e.size]||e.size}`]:e.size,[`k-input-${e.fillMode}`]:e.fillMode,[`k-rounded-${s.kendoThemeMaps.roundedMap[e.rounded]||e.rounded}`]:e.rounded,"k-invalid":!be,"k-required":e.required,"k-disabled":e.disabled,"k-focus":y},e.className),onFocus:pe,onBlur:ge},n.createElement("div",{className:"k-signature-canvas",ref:v,tabIndex:s.getTabIndex(e.tabIndex,e.disabled),role:"img",id:e.id,"aria-label":e.ariaLabel,"aria-labelledby":e.ariaLabelledBy,"aria-describedby":e.ariaDescribedBy,"aria-disabled":e.disabled?"true":void 0}),n.createElement("div",{className:"k-signature-actions k-signature-actions-top"},ie&&n.createElement(R.Button,{type:"button",className:"k-signature-action k-signature-maximize",ref:_,icon:"hyperlink-open",svgIcon:q.hyperlinkOpenIcon,fillMode:"flat",size:e.size,onClick:fe,"aria-label":A,title:A}),le&&n.createElement(R.Button,{type:"button",className:"k-signature-action k-signature-minimize k-rotate-180",ref:B,icon:"hyperlink-open",svgIcon:q.hyperlinkOpenIcon,fillMode:"flat",size:e.size,onClick:X,"aria-label":V,title:V})),!e.hideLine&&n.createElement("div",{className:"k-signature-line",style:{zIndex:2,pointerEvents:"none"}}),n.createElement("div",{className:"k-signature-actions k-signature-actions-bottom"},ce&&n.createElement(R.Button,{type:"button",className:"k-signature-action k-signature-clear",icon:"x",svgIcon:q.xIcon,fillMode:"flat",size:e.size,onClick:ke,"aria-label":U,title:U})),g&&n.createElement(ye.Dialog,{ref:T},n.createElement(b,{...e,...Q(),value:oe,maximized:!0,exportScale:1/E*x,open:!1,onChange:ue,onClose:me})))});b.propTypes={value:a.string,width:a.number,height:a.number,tabIndex:a.number,dir:a.string,ariaDescribedBy:a.string,ariaLabelledBy:a.string,ariaLabel:a.string,readOnly:a.bool,disabled:a.bool,validationMessage:a.string,required:a.bool,onChange:a.func,onFocus:a.func,onBlur:a.func,onOpen:a.func,onClose:a.func,size:a.oneOf([null,"small","medium","large"]),rounded:a.oneOf([null,"small","medium","large"]),fillMode:a.oneOf([null,"solid","flat","outline"])};b.displayName="KendoSignature";b.defaultProps={strokeWidth:1,smooth:!1,popupScale:Z,exportScale:ee,maximizable:!0,disabled:!1,required:!1,validityStyles:!0,onChange:i=>s.noop,onFocus:i=>s.noop,onBlur:i=>s.noop,onOpen:i=>s.noop,onClose:i=>s.noop,size:"medium",rounded:"medium",fillMode:"solid"};exports.Signature=b;exports.SignaturePropsContext=te;
|