@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,335 @@
|
|
|
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 { SignaturePad as ze } from "@progress/kendo-inputs-common";
|
|
10
|
+
import { Button as D } from "@progress/kendo-react-buttons";
|
|
11
|
+
import { createPropsContext as Ee, validatePackage as Se, usePropsContext as Oe, useIsomorphicLayoutEffect as xe, dispatchEvent as C, classNames as we, kendoThemeMaps as Q, getTabIndex as Le, noop as f, Keys as Ie } from "@progress/kendo-react-common";
|
|
12
|
+
import { Dialog as Me } from "@progress/kendo-react-dialogs";
|
|
13
|
+
import { useLocalization as Pe } from "@progress/kendo-react-intl";
|
|
14
|
+
import a from "prop-types";
|
|
15
|
+
import * as o from "react";
|
|
16
|
+
import { signatureMaximize as Y, messages as T, signatureMinimize as Z, signatureClear as ee } from "../messages/index.mjs";
|
|
17
|
+
import { packageMetadata as De } from "../package-metadata.mjs";
|
|
18
|
+
import { hasParent as Te } from "./utils/index.mjs";
|
|
19
|
+
import { hyperlinkOpenIcon as te, xIcon as Re } from "@progress/kendo-svg-icons";
|
|
20
|
+
const Be = 250, _e = 84, ne = 3, ae = 2, Fe = "#000000", Ne = "#ffffff", oe = (c) => c !== void 0, Ge = Ee(), h = o.forwardRef((c, re) => {
|
|
21
|
+
Se(De);
|
|
22
|
+
const e = Oe(Ge, c), z = Pe(), s = o.useRef(null), p = o.useRef(null), R = o.useRef(null), B = o.useRef(null), _ = o.useRef(null), [r, ie] = o.useState(), [g, F] = o.useState(!1), [E, N] = o.useState(!1), [b, G] = o.useState(), [se, le] = o.useState(), q = oe(e.value) ? e.value : b, [ce, ue] = o.useState(!1), m = oe(e.open), d = m ? e.open : ce, de = !(e.maximized || E || !e.maximizable || e.disabled), me = e.maximized && !E, fe = !(!(e.value || b) || E || e.readOnly || e.disabled), A = z.toLanguageString(Y, T[Y]), V = z.toLanguageString(Z, T[Z]), j = z.toLanguageString(ee, T[ee]), S = e.popupScale || ne, O = e.exportScale || ae, x = (t) => {
|
|
23
|
+
G(t), e.onChange && e.onChange({ value: t });
|
|
24
|
+
}, pe = (t) => {
|
|
25
|
+
r == null || r.loadImage(t.value), x(t.value);
|
|
26
|
+
};
|
|
27
|
+
o.useEffect(() => {
|
|
28
|
+
e.value !== b && (G(e.value), r == null || r.loadImage(e.value));
|
|
29
|
+
}, [e.value]);
|
|
30
|
+
const ge = () => {
|
|
31
|
+
r == null || r.clear(), x();
|
|
32
|
+
}, k = o.useCallback(
|
|
33
|
+
(t) => {
|
|
34
|
+
m || ue(t);
|
|
35
|
+
},
|
|
36
|
+
[m]
|
|
37
|
+
), be = (t) => {
|
|
38
|
+
var n, i;
|
|
39
|
+
$(t), (i = ((n = _.current) == null ? void 0 : n.element) || p.current) == null || i.focus();
|
|
40
|
+
}, w = o.useCallback(() => {
|
|
41
|
+
let t = Fe;
|
|
42
|
+
return !e.color && typeof document != "undefined" && s.current && (t = getComputedStyle(s.current).color), e.color || t;
|
|
43
|
+
}, [e.color]), L = o.useCallback(() => {
|
|
44
|
+
let t = Ne;
|
|
45
|
+
return !e.backgroundColor && typeof document != "undefined" && s.current && (t = getComputedStyle(s.current).backgroundColor), e.backgroundColor || t;
|
|
46
|
+
}, [e.backgroundColor]), U = () => ({
|
|
47
|
+
scale: e.maximized ? e.popupScale : 1,
|
|
48
|
+
color: w(),
|
|
49
|
+
backgroundColor: L(),
|
|
50
|
+
strokeWidth: e.strokeWidth,
|
|
51
|
+
smooth: e.smooth,
|
|
52
|
+
readonly: e.readOnly
|
|
53
|
+
}), W = async (t) => {
|
|
54
|
+
const { width: n, height: i } = t;
|
|
55
|
+
return await (r == null ? void 0 : r.exportImage({
|
|
56
|
+
width: n * O,
|
|
57
|
+
height: i * O
|
|
58
|
+
}));
|
|
59
|
+
};
|
|
60
|
+
o.useEffect(() => {
|
|
61
|
+
const t = p.current, n = new ze(t, U());
|
|
62
|
+
return q && n.loadImage(q), ie(n), () => n.destroy();
|
|
63
|
+
}, []), o.useEffect(() => {
|
|
64
|
+
r == null || r.setOptions({
|
|
65
|
+
onChange: async () => x(await W(X())),
|
|
66
|
+
onDraw: () => N(!0),
|
|
67
|
+
onDrawEnd: () => N(!1)
|
|
68
|
+
});
|
|
69
|
+
}, [r]), xe(
|
|
70
|
+
() => r == null ? void 0 : r.setOptions(U()),
|
|
71
|
+
[e.readOnly, e.color, e.backgroundColor, e.strokeWidth, e.smooth]
|
|
72
|
+
), o.useEffect(() => {
|
|
73
|
+
var i, u;
|
|
74
|
+
const t = (u = (i = R.current) == null ? void 0 : i.element) == null ? void 0 : u.querySelector(".k-overlay");
|
|
75
|
+
if (!t)
|
|
76
|
+
return;
|
|
77
|
+
const n = () => k(!1);
|
|
78
|
+
return t.addEventListener("click", n), () => t.removeEventListener("click", n);
|
|
79
|
+
}, [d]), o.useEffect(() => {
|
|
80
|
+
if (!d || typeof document == "undefined")
|
|
81
|
+
return;
|
|
82
|
+
const t = (n) => {
|
|
83
|
+
n.keyCode === Ie.esc && k(!1);
|
|
84
|
+
};
|
|
85
|
+
return document.addEventListener("keydown", t), () => document.removeEventListener("keydown", t);
|
|
86
|
+
}, [d]), o.useEffect(() => {
|
|
87
|
+
var t, n;
|
|
88
|
+
e.maximized && ((n = (t = B.current) == null ? void 0 : t.element) == null || n.focus());
|
|
89
|
+
}, []);
|
|
90
|
+
const I = o.useCallback(
|
|
91
|
+
() => {
|
|
92
|
+
var t;
|
|
93
|
+
return (t = p.current) == null ? void 0 : t.focus();
|
|
94
|
+
},
|
|
95
|
+
[]
|
|
96
|
+
), v = o.useCallback(
|
|
97
|
+
() => e.value,
|
|
98
|
+
[e.value]
|
|
99
|
+
), H = o.useCallback(
|
|
100
|
+
() => e.name,
|
|
101
|
+
[e.name]
|
|
102
|
+
), y = o.useCallback(
|
|
103
|
+
() => e.required,
|
|
104
|
+
[e.required]
|
|
105
|
+
), M = o.useCallback(
|
|
106
|
+
() => {
|
|
107
|
+
const t = e.validationMessage !== void 0, i = !v(), u = e.valid !== void 0 ? e.valid : !y() || !i;
|
|
108
|
+
return {
|
|
109
|
+
customError: t,
|
|
110
|
+
valid: u,
|
|
111
|
+
valueMissing: i
|
|
112
|
+
};
|
|
113
|
+
},
|
|
114
|
+
[e.validationMessage, e.valid, v, y]
|
|
115
|
+
), P = o.useCallback(
|
|
116
|
+
() => e.validityStyles,
|
|
117
|
+
[e.validityStyles]
|
|
118
|
+
), K = o.useCallback(
|
|
119
|
+
() => e,
|
|
120
|
+
[e]
|
|
121
|
+
), l = o.useCallback(
|
|
122
|
+
() => {
|
|
123
|
+
const t = {
|
|
124
|
+
element: s.current,
|
|
125
|
+
focus: I
|
|
126
|
+
};
|
|
127
|
+
return Object.defineProperty(t, "name", { get: H }), Object.defineProperty(t, "value", { get: v }), Object.defineProperty(t, "validity", { get: M }), Object.defineProperty(t, "validityStyles", { get: P }), Object.defineProperty(t, "required", { get: y }), Object.defineProperty(t, "props", { get: K }), Object.defineProperty(t, "color", { get: w }), Object.defineProperty(t, "backgroundColor", { get: L }), t;
|
|
128
|
+
},
|
|
129
|
+
[H, v, M, P, y, I, K, w, L]
|
|
130
|
+
);
|
|
131
|
+
o.useImperativeHandle(re, l);
|
|
132
|
+
const ke = o.useCallback(
|
|
133
|
+
(t) => {
|
|
134
|
+
g || e.maximized || (F(!0), C(
|
|
135
|
+
e.onFocus,
|
|
136
|
+
t,
|
|
137
|
+
l(),
|
|
138
|
+
{}
|
|
139
|
+
));
|
|
140
|
+
},
|
|
141
|
+
[g, e.onFocus, l]
|
|
142
|
+
), ve = o.useCallback(
|
|
143
|
+
(t) => {
|
|
144
|
+
Te(t.relatedTarget, s.current) || (F(!1), C(
|
|
145
|
+
e.onBlur,
|
|
146
|
+
t,
|
|
147
|
+
l(),
|
|
148
|
+
{}
|
|
149
|
+
));
|
|
150
|
+
},
|
|
151
|
+
[g, e.onBlur, l]
|
|
152
|
+
), ye = o.useCallback(
|
|
153
|
+
async (t) => {
|
|
154
|
+
le(await W(J())), k(!0), C(
|
|
155
|
+
e.onOpen,
|
|
156
|
+
t,
|
|
157
|
+
l(),
|
|
158
|
+
{}
|
|
159
|
+
);
|
|
160
|
+
},
|
|
161
|
+
[d, m, e.onOpen, e.value, b, l]
|
|
162
|
+
), $ = o.useCallback(
|
|
163
|
+
(t) => {
|
|
164
|
+
k(!1), C(
|
|
165
|
+
e.onClose,
|
|
166
|
+
t,
|
|
167
|
+
l(),
|
|
168
|
+
{}
|
|
169
|
+
);
|
|
170
|
+
},
|
|
171
|
+
[d, m, e.onClose, l]
|
|
172
|
+
), Ce = () => {
|
|
173
|
+
ge(), I();
|
|
174
|
+
}, X = () => {
|
|
175
|
+
var i, u;
|
|
176
|
+
const t = e.width || ((i = s.current) == null ? void 0 : i.offsetWidth) || Be, n = e.height || ((u = s.current) == null ? void 0 : u.offsetHeight) || _e;
|
|
177
|
+
return {
|
|
178
|
+
width: t,
|
|
179
|
+
height: n
|
|
180
|
+
};
|
|
181
|
+
}, J = () => {
|
|
182
|
+
const { width: t, height: n } = X();
|
|
183
|
+
return {
|
|
184
|
+
width: t * S,
|
|
185
|
+
height: n * S
|
|
186
|
+
};
|
|
187
|
+
}, he = !P() || M().valid;
|
|
188
|
+
return /* @__PURE__ */ o.createElement(
|
|
189
|
+
"div",
|
|
190
|
+
{
|
|
191
|
+
ref: s,
|
|
192
|
+
dir: e.dir,
|
|
193
|
+
style: { width: e.width, height: e.height, ...e.style },
|
|
194
|
+
className: we(
|
|
195
|
+
"k-input",
|
|
196
|
+
"k-signature",
|
|
197
|
+
{
|
|
198
|
+
"k-signature-maximized": e.maximized,
|
|
199
|
+
[`k-signature-${Q.sizeMap[e.size] || e.size}`]: e.size,
|
|
200
|
+
[`k-input-${e.fillMode}`]: e.fillMode,
|
|
201
|
+
[`k-rounded-${Q.roundedMap[e.rounded] || e.rounded}`]: e.rounded,
|
|
202
|
+
"k-invalid": !he,
|
|
203
|
+
"k-required": e.required,
|
|
204
|
+
"k-disabled": e.disabled,
|
|
205
|
+
"k-focus": g
|
|
206
|
+
},
|
|
207
|
+
e.className
|
|
208
|
+
),
|
|
209
|
+
onFocus: ke,
|
|
210
|
+
onBlur: ve
|
|
211
|
+
},
|
|
212
|
+
/* @__PURE__ */ o.createElement(
|
|
213
|
+
"div",
|
|
214
|
+
{
|
|
215
|
+
className: "k-signature-canvas",
|
|
216
|
+
ref: p,
|
|
217
|
+
tabIndex: Le(e.tabIndex, e.disabled),
|
|
218
|
+
role: "img",
|
|
219
|
+
id: e.id,
|
|
220
|
+
"aria-label": e.ariaLabel,
|
|
221
|
+
"aria-labelledby": e.ariaLabelledBy,
|
|
222
|
+
"aria-describedby": e.ariaDescribedBy,
|
|
223
|
+
"aria-disabled": e.disabled ? "true" : void 0
|
|
224
|
+
}
|
|
225
|
+
),
|
|
226
|
+
/* @__PURE__ */ o.createElement("div", { className: "k-signature-actions k-signature-actions-top" }, de && /* @__PURE__ */ o.createElement(
|
|
227
|
+
D,
|
|
228
|
+
{
|
|
229
|
+
type: "button",
|
|
230
|
+
className: "k-signature-action k-signature-maximize",
|
|
231
|
+
ref: _,
|
|
232
|
+
icon: "hyperlink-open",
|
|
233
|
+
svgIcon: te,
|
|
234
|
+
fillMode: "flat",
|
|
235
|
+
size: e.size,
|
|
236
|
+
onClick: ye,
|
|
237
|
+
"aria-label": A,
|
|
238
|
+
title: A
|
|
239
|
+
}
|
|
240
|
+
), me && /* @__PURE__ */ o.createElement(
|
|
241
|
+
D,
|
|
242
|
+
{
|
|
243
|
+
type: "button",
|
|
244
|
+
className: "k-signature-action k-signature-minimize k-rotate-180",
|
|
245
|
+
ref: B,
|
|
246
|
+
icon: "hyperlink-open",
|
|
247
|
+
svgIcon: te,
|
|
248
|
+
fillMode: "flat",
|
|
249
|
+
size: e.size,
|
|
250
|
+
onClick: $,
|
|
251
|
+
"aria-label": V,
|
|
252
|
+
title: V
|
|
253
|
+
}
|
|
254
|
+
)),
|
|
255
|
+
!e.hideLine && /* @__PURE__ */ o.createElement(
|
|
256
|
+
"div",
|
|
257
|
+
{
|
|
258
|
+
className: "k-signature-line",
|
|
259
|
+
style: { zIndex: 2, pointerEvents: "none" }
|
|
260
|
+
}
|
|
261
|
+
),
|
|
262
|
+
/* @__PURE__ */ o.createElement("div", { className: "k-signature-actions k-signature-actions-bottom" }, fe && /* @__PURE__ */ o.createElement(
|
|
263
|
+
D,
|
|
264
|
+
{
|
|
265
|
+
type: "button",
|
|
266
|
+
className: "k-signature-action k-signature-clear",
|
|
267
|
+
icon: "x",
|
|
268
|
+
svgIcon: Re,
|
|
269
|
+
fillMode: "flat",
|
|
270
|
+
size: e.size,
|
|
271
|
+
onClick: Ce,
|
|
272
|
+
"aria-label": j,
|
|
273
|
+
title: j
|
|
274
|
+
}
|
|
275
|
+
)),
|
|
276
|
+
d && /* @__PURE__ */ o.createElement(Me, { ref: R }, /* @__PURE__ */ o.createElement(
|
|
277
|
+
h,
|
|
278
|
+
{
|
|
279
|
+
...e,
|
|
280
|
+
...J(),
|
|
281
|
+
value: se,
|
|
282
|
+
maximized: !0,
|
|
283
|
+
exportScale: 1 / S * O,
|
|
284
|
+
open: !1,
|
|
285
|
+
onChange: pe,
|
|
286
|
+
onClose: be
|
|
287
|
+
}
|
|
288
|
+
))
|
|
289
|
+
);
|
|
290
|
+
});
|
|
291
|
+
h.propTypes = {
|
|
292
|
+
value: a.string,
|
|
293
|
+
width: a.number,
|
|
294
|
+
height: a.number,
|
|
295
|
+
tabIndex: a.number,
|
|
296
|
+
dir: a.string,
|
|
297
|
+
ariaDescribedBy: a.string,
|
|
298
|
+
ariaLabelledBy: a.string,
|
|
299
|
+
ariaLabel: a.string,
|
|
300
|
+
readOnly: a.bool,
|
|
301
|
+
disabled: a.bool,
|
|
302
|
+
validationMessage: a.string,
|
|
303
|
+
required: a.bool,
|
|
304
|
+
onChange: a.func,
|
|
305
|
+
onFocus: a.func,
|
|
306
|
+
onBlur: a.func,
|
|
307
|
+
onOpen: a.func,
|
|
308
|
+
onClose: a.func,
|
|
309
|
+
size: a.oneOf([null, "small", "medium", "large"]),
|
|
310
|
+
rounded: a.oneOf([null, "small", "medium", "large"]),
|
|
311
|
+
fillMode: a.oneOf([null, "solid", "flat", "outline"])
|
|
312
|
+
};
|
|
313
|
+
h.displayName = "KendoSignature";
|
|
314
|
+
h.defaultProps = {
|
|
315
|
+
strokeWidth: 1,
|
|
316
|
+
smooth: !1,
|
|
317
|
+
popupScale: ne,
|
|
318
|
+
exportScale: ae,
|
|
319
|
+
maximizable: !0,
|
|
320
|
+
disabled: !1,
|
|
321
|
+
required: !1,
|
|
322
|
+
validityStyles: !0,
|
|
323
|
+
onChange: (c) => f,
|
|
324
|
+
onFocus: (c) => f,
|
|
325
|
+
onBlur: (c) => f,
|
|
326
|
+
onOpen: (c) => f,
|
|
327
|
+
onClose: (c) => f,
|
|
328
|
+
size: "medium",
|
|
329
|
+
rounded: "medium",
|
|
330
|
+
fillMode: "solid"
|
|
331
|
+
};
|
|
332
|
+
export {
|
|
333
|
+
h as Signature,
|
|
334
|
+
Ge as SignaturePropsContext
|
|
335
|
+
};
|
|
@@ -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"});function n(t,r){let e=t;for(;e&&e!==r;)e=e.parentNode;return!!e}exports.hasParent=n;
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
function n(t, r) {
|
|
10
|
+
let e = t;
|
|
11
|
+
for (; e && e !== r; )
|
|
12
|
+
e = e.parentNode;
|
|
13
|
+
return !!e;
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
n as hasParent
|
|
17
|
+
};
|
package/slider/Slider.js
ADDED
|
@@ -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 b=require("react"),l=require("prop-types"),a=require("@progress/kendo-react-common"),g=require("@progress/kendo-react-intl"),n=require("../messages/index.js"),y=require("./SliderLabel.js"),k=require("../package-metadata.js"),m=require("@progress/kendo-react-buttons"),o=require("@progress/kendo-svg-icons");function S(d){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(d){for(const e in d)if(e!=="default"){const t=Object.getOwnPropertyDescriptor(d,e);Object.defineProperty(i,e,t.get?t:{enumerable:!0,get:()=>d[e]})}}return i.default=d,Object.freeze(i)}const s=S(b),p=class p extends s.Component{constructor(i){super(i),this.state={value:this.props.defaultValue===void 0?this.props.min:this.props.defaultValue,focused:!1,dir:this.props.dir},this._sliderTrack=null,this._element=null,this.buttons=e=>{if(!e.enabled)return e.children;const t=this.state.dir==="rtl"?this.props.vertical?o.caretAltUpIcon:o.caretAltLeftIcon:this.props.vertical?o.caretAltUpIcon:o.caretAltRightIcon,c=this.state.dir==="rtl"?this.props.vertical?o.caretAltDownIcon:o.caretAltRightIcon:this.props.vertical?o.caretAltDownIcon:o.caretAltLeftIcon,r=this.state.dir==="rtl"?this.props.vertical?"caret-alt-up":"caret-alt-left":this.props.vertical?"caret-alt-up":"caret-alt-right",u=this.state.dir==="rtl"?this.props.vertical?"caret-alt-down":"caret-alt-right":this.props.vertical?"caret-alt-down":"caret-alt-left";return s.createElement(s.Fragment,null,s.createElement(m.Button,{className:"k-button-decrease",rounded:"full",icon:u,svgIcon:c,title:e.decrementTitle,onClick:e.decrement}),e.children,s.createElement(m.Button,{className:"k-button-increase",rounded:"full",icon:r,svgIcon:t,title:e.incrementTitle,onClick:e.increment}))},this.focus=()=>{this._element&&this._element.focus()},this.isLabel=e=>{let t=e;for(;t;){if(t.getAttribute(y.SLIDER_LABEL_ATTRIBUTE))return!0;t=t.parentElement}return!1},this.onFocus=()=>{this.setState({focused:!0})},this.onBlur=()=>{this.setState({focused:!1})},this.onKeyDown=e=>{let t;e.keyCode===a.Keys.left||e.keyCode===a.Keys.down?t=this.state.value-(this.props.step||0):e.keyCode===a.Keys.right||e.keyCode===a.Keys.up?t=this.state.value+(this.props.step||0):e.keyCode===a.Keys.home?t=this.props.min:e.keyCode===a.Keys.end&&(t=this.props.max),t!==void 0&&(e.preventDefault(),this.change(e,t))},this.decrement=e=>{e.preventDefault(),this.change(e,this.state.value-(this.props.step||0))},this.increment=e=>{e.preventDefault(),this.change(e,this.state.value+(this.props.step||0))},this.dragStart=e=>{this.isLabel(e.event.originalEvent.target)||(e.event.isTouch&&e.event.originalEvent.preventDefault(),this.drag(e))},this.dragOver=e=>{e.event.originalEvent.preventDefault(),this.drag(e)},this.drag=e=>{const t=e.element.getBoundingClientRect(),c=this.props.vertical?t.bottom-e.event.clientY:this.state.dir==="rtl"?t.right-e.event.clientX:e.event.clientX-t.left,r=this.props.vertical?t.height:t.width,u=c/r;this.change(e,this.props.min+u*(this.props.max-this.props.min))},a.validatePackage(k.packageMetadata)}static getDerivedStateFromProps(i,e){const t=i.value!==void 0?i.value:e.value,{min:c,max:r}=i;return t===void 0?null:{value:Math.min(Math.max(t,c),r)}}componentDidMount(){if(!this.state.dir&&window&&this._element){const i=window.getComputedStyle(this._element).direction;i&&this.setState({dir:i})}}render(){const i=g.provideLocalizationService(this),e=(this.state.value-this.props.min)/(this.props.max-this.props.min)*100,t=this.props.vertical?{marginTop:"0.5rem",marginBottom:"0.5rem"}:{marginLeft:"0.5rem",marginRight:"0.5rem"},c=this.props.vertical?{paddingTop:0,height:"100%"}:{};return s.createElement("div",{ref:r=>this._element=r,dir:this.state.dir,id:this.props.id,style:{gap:0,...this.props.style},onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,className:a.classNames("k-slider",{"k-focus":this.state.focused,"k-disabled":this.props.disabled,"k-slider-horizontal":!this.props.vertical,"k-slider-vertical":this.props.vertical},this.props.className)},s.createElement(this.buttons,{enabled:this.props.buttons,decrement:this.decrement,increment:this.increment,incrementTitle:i.toLanguageString(n.sliderIncreaseValue,n.messages[n.sliderIncreaseValue]),decrementTitle:i.toLanguageString(n.sliderDecreaseValue,n.messages[n.sliderDecreaseValue])},s.createElement(a.Draggable,{onDrag:this.dragOver,onPress:this.dragStart},s.createElement("div",{className:"k-slider-track-wrap",style:{flexGrow:1,position:"relative",touchAction:"none",...t}},this.props.children&&s.createElement("ul",{className:"k-reset k-slider-items",style:{margin:0,...c}},s.Children.map(this.props.children,r=>r&&s.cloneElement(r,{position:100*(r.props.position-this.props.min)/(this.props.max-this.props.min),vertical:this.props.vertical},r.props.children))),s.createElement("div",{className:"k-slider-track",style:this.props.vertical?{bottom:0,height:"100%"}:{[this.state.dir==="rtl"?"right":"left"]:0,width:"100%"},ref:r=>this._sliderTrack=r},s.createElement("div",{className:"k-slider-selection",style:this.props.vertical?{height:e+"%"}:{width:e+"%"}}),s.createElement("span",{role:"slider","aria-valuemin":this.props.min,"aria-valuemax":this.props.max,"aria-valuenow":this.state.value,"aria-valuetext":String(this.state.value),"aria-orientation":this.props.vertical?"vertical":void 0,"aria-disabled":this.props.disabled?"true":void 0,"aria-labelledby":this.props.ariaLabelledBy,"aria-describedby":this.props.ariaDescribedBy,"aria-label":this.props.ariaLabel,tabIndex:a.getTabIndex(this.props.tabIndex,this.props.disabled,void 0),className:"k-draghandle",title:i.toLanguageString(n.sliderDragTitle,n.messages[n.sliderDragTitle]),style:this.props.vertical?{bottom:"calc("+e+"%)",zIndex:1}:this.state.dir==="rtl"?{right:"calc("+e+"% - 13px)",zIndex:1}:{left:"calc("+e+"%)",zIndex:1}}))))))}get sliderTrack(){return this._sliderTrack}change(i,e){e=Math.min(Math.max(e,this.props.min),this.props.max),this.setState({value:e}),a.dispatchEvent(this.props.onChange,i,this,{value:e})}};p.displayName="Slider",p.propTypes={min:l.number.isRequired,max:l.number.isRequired,value:l.number,vertical:l.bool,id:l.string,ariaLabelledBy:l.string,ariaDescribedBy:l.string,ariaLabel:l.string};let h=p;const v=a.createPropsContext(),f=a.withPropsContext(v,h);f.displayName="KendoReactSlider";g.registerForLocalization(h);exports.Slider=f;exports.SliderPropsContext=v;exports.SliderWithoutContext=h;
|
|
@@ -0,0 +1,223 @@
|
|
|
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 i from "react";
|
|
10
|
+
import a from "prop-types";
|
|
11
|
+
import { Keys as l, validatePackage as y, classNames as w, Draggable as x, getTabIndex as E, dispatchEvent as S, createPropsContext as T, withPropsContext as D } from "@progress/kendo-react-common";
|
|
12
|
+
import { provideLocalizationService as I, registerForLocalization as L } from "@progress/kendo-react-intl";
|
|
13
|
+
import { sliderIncreaseValue as d, messages as h, sliderDecreaseValue as m, sliderDragTitle as u } from "../messages/index.mjs";
|
|
14
|
+
import { SLIDER_LABEL_ATTRIBUTE as B } from "./SliderLabel.mjs";
|
|
15
|
+
import { packageMetadata as C } from "../package-metadata.mjs";
|
|
16
|
+
import { Button as v } from "@progress/kendo-react-buttons";
|
|
17
|
+
import { caretAltUpIcon as g, caretAltLeftIcon as f, caretAltRightIcon as b, caretAltDownIcon as k } from "@progress/kendo-svg-icons";
|
|
18
|
+
const c = class c extends i.Component {
|
|
19
|
+
constructor(s) {
|
|
20
|
+
super(s), this.state = {
|
|
21
|
+
value: this.props.defaultValue === void 0 ? this.props.min : this.props.defaultValue,
|
|
22
|
+
focused: !1,
|
|
23
|
+
dir: this.props.dir
|
|
24
|
+
}, this._sliderTrack = null, this._element = null, this.buttons = (t) => {
|
|
25
|
+
if (!t.enabled)
|
|
26
|
+
return t.children;
|
|
27
|
+
const e = this.state.dir === "rtl" ? this.props.vertical ? g : f : this.props.vertical ? g : b, n = this.state.dir === "rtl" ? this.props.vertical ? k : b : this.props.vertical ? k : f, r = this.state.dir === "rtl" ? this.props.vertical ? "caret-alt-up" : "caret-alt-left" : this.props.vertical ? "caret-alt-up" : "caret-alt-right", p = this.state.dir === "rtl" ? this.props.vertical ? "caret-alt-down" : "caret-alt-right" : this.props.vertical ? "caret-alt-down" : "caret-alt-left";
|
|
28
|
+
return /* @__PURE__ */ i.createElement(i.Fragment, null, /* @__PURE__ */ i.createElement(
|
|
29
|
+
v,
|
|
30
|
+
{
|
|
31
|
+
className: "k-button-decrease",
|
|
32
|
+
rounded: "full",
|
|
33
|
+
icon: p,
|
|
34
|
+
svgIcon: n,
|
|
35
|
+
title: t.decrementTitle,
|
|
36
|
+
onClick: t.decrement
|
|
37
|
+
}
|
|
38
|
+
), t.children, /* @__PURE__ */ i.createElement(
|
|
39
|
+
v,
|
|
40
|
+
{
|
|
41
|
+
className: "k-button-increase",
|
|
42
|
+
rounded: "full",
|
|
43
|
+
icon: r,
|
|
44
|
+
svgIcon: e,
|
|
45
|
+
title: t.incrementTitle,
|
|
46
|
+
onClick: t.increment
|
|
47
|
+
}
|
|
48
|
+
));
|
|
49
|
+
}, this.focus = () => {
|
|
50
|
+
this._element && this._element.focus();
|
|
51
|
+
}, this.isLabel = (t) => {
|
|
52
|
+
let e = t;
|
|
53
|
+
for (; e; ) {
|
|
54
|
+
if (e.getAttribute(B))
|
|
55
|
+
return !0;
|
|
56
|
+
e = e.parentElement;
|
|
57
|
+
}
|
|
58
|
+
return !1;
|
|
59
|
+
}, this.onFocus = () => {
|
|
60
|
+
this.setState({ focused: !0 });
|
|
61
|
+
}, this.onBlur = () => {
|
|
62
|
+
this.setState({ focused: !1 });
|
|
63
|
+
}, this.onKeyDown = (t) => {
|
|
64
|
+
let e;
|
|
65
|
+
t.keyCode === l.left || t.keyCode === l.down ? e = this.state.value - (this.props.step || 0) : t.keyCode === l.right || t.keyCode === l.up ? e = this.state.value + (this.props.step || 0) : t.keyCode === l.home ? e = this.props.min : t.keyCode === l.end && (e = this.props.max), e !== void 0 && (t.preventDefault(), this.change(t, e));
|
|
66
|
+
}, this.decrement = (t) => {
|
|
67
|
+
t.preventDefault(), this.change(t, this.state.value - (this.props.step || 0));
|
|
68
|
+
}, this.increment = (t) => {
|
|
69
|
+
t.preventDefault(), this.change(t, this.state.value + (this.props.step || 0));
|
|
70
|
+
}, this.dragStart = (t) => {
|
|
71
|
+
this.isLabel(t.event.originalEvent.target) || (t.event.isTouch && t.event.originalEvent.preventDefault(), this.drag(t));
|
|
72
|
+
}, this.dragOver = (t) => {
|
|
73
|
+
t.event.originalEvent.preventDefault(), this.drag(t);
|
|
74
|
+
}, this.drag = (t) => {
|
|
75
|
+
const e = t.element.getBoundingClientRect(), n = this.props.vertical ? e.bottom - t.event.clientY : this.state.dir === "rtl" ? e.right - t.event.clientX : t.event.clientX - e.left, r = this.props.vertical ? e.height : e.width, p = n / r;
|
|
76
|
+
this.change(t, this.props.min + p * (this.props.max - this.props.min));
|
|
77
|
+
}, y(C);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* @hidden
|
|
81
|
+
*/
|
|
82
|
+
static getDerivedStateFromProps(s, t) {
|
|
83
|
+
const e = s.value !== void 0 ? s.value : t.value, { min: n, max: r } = s;
|
|
84
|
+
return e === void 0 ? null : { value: Math.min(Math.max(e, n), r) };
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* @hidden
|
|
88
|
+
*/
|
|
89
|
+
componentDidMount() {
|
|
90
|
+
if (!this.state.dir && window && this._element) {
|
|
91
|
+
const s = window.getComputedStyle(this._element).direction;
|
|
92
|
+
s && this.setState({ dir: s });
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* @hidden
|
|
97
|
+
*/
|
|
98
|
+
render() {
|
|
99
|
+
const s = I(this), t = (this.state.value - this.props.min) / (this.props.max - this.props.min) * 100, e = this.props.vertical ? { marginTop: "0.5rem", marginBottom: "0.5rem" } : { marginLeft: "0.5rem", marginRight: "0.5rem" }, n = this.props.vertical ? { paddingTop: 0, height: "100%" } : {};
|
|
100
|
+
return /* @__PURE__ */ i.createElement(
|
|
101
|
+
"div",
|
|
102
|
+
{
|
|
103
|
+
ref: (r) => this._element = r,
|
|
104
|
+
dir: this.state.dir,
|
|
105
|
+
id: this.props.id,
|
|
106
|
+
style: { gap: 0, ...this.props.style },
|
|
107
|
+
onFocus: this.onFocus,
|
|
108
|
+
onBlur: this.onBlur,
|
|
109
|
+
onKeyDown: this.onKeyDown,
|
|
110
|
+
className: w(
|
|
111
|
+
"k-slider",
|
|
112
|
+
{
|
|
113
|
+
"k-focus": this.state.focused,
|
|
114
|
+
"k-disabled": this.props.disabled,
|
|
115
|
+
"k-slider-horizontal": !this.props.vertical,
|
|
116
|
+
"k-slider-vertical": this.props.vertical
|
|
117
|
+
},
|
|
118
|
+
this.props.className
|
|
119
|
+
)
|
|
120
|
+
},
|
|
121
|
+
/* @__PURE__ */ i.createElement(
|
|
122
|
+
this.buttons,
|
|
123
|
+
{
|
|
124
|
+
enabled: this.props.buttons,
|
|
125
|
+
decrement: this.decrement,
|
|
126
|
+
increment: this.increment,
|
|
127
|
+
incrementTitle: s.toLanguageString(d, h[d]),
|
|
128
|
+
decrementTitle: s.toLanguageString(m, h[m])
|
|
129
|
+
},
|
|
130
|
+
/* @__PURE__ */ i.createElement(x, { onDrag: this.dragOver, onPress: this.dragStart }, /* @__PURE__ */ i.createElement(
|
|
131
|
+
"div",
|
|
132
|
+
{
|
|
133
|
+
className: "k-slider-track-wrap",
|
|
134
|
+
style: {
|
|
135
|
+
flexGrow: 1,
|
|
136
|
+
position: "relative",
|
|
137
|
+
touchAction: "none",
|
|
138
|
+
...e
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
this.props.children && /* @__PURE__ */ i.createElement(
|
|
142
|
+
"ul",
|
|
143
|
+
{
|
|
144
|
+
className: "k-reset k-slider-items",
|
|
145
|
+
style: { margin: 0, ...n }
|
|
146
|
+
},
|
|
147
|
+
i.Children.map(this.props.children, (r) => r && i.cloneElement(
|
|
148
|
+
r,
|
|
149
|
+
{
|
|
150
|
+
position: 100 * (r.props.position - this.props.min) / (this.props.max - this.props.min),
|
|
151
|
+
vertical: this.props.vertical
|
|
152
|
+
},
|
|
153
|
+
r.props.children
|
|
154
|
+
))
|
|
155
|
+
),
|
|
156
|
+
/* @__PURE__ */ i.createElement(
|
|
157
|
+
"div",
|
|
158
|
+
{
|
|
159
|
+
className: "k-slider-track",
|
|
160
|
+
style: this.props.vertical ? { bottom: 0, height: "100%" } : { [this.state.dir === "rtl" ? "right" : "left"]: 0, width: "100%" },
|
|
161
|
+
ref: (r) => this._sliderTrack = r
|
|
162
|
+
},
|
|
163
|
+
/* @__PURE__ */ i.createElement(
|
|
164
|
+
"div",
|
|
165
|
+
{
|
|
166
|
+
className: "k-slider-selection",
|
|
167
|
+
style: this.props.vertical ? { height: t + "%" } : { width: t + "%" }
|
|
168
|
+
}
|
|
169
|
+
),
|
|
170
|
+
/* @__PURE__ */ i.createElement(
|
|
171
|
+
"span",
|
|
172
|
+
{
|
|
173
|
+
role: "slider",
|
|
174
|
+
"aria-valuemin": this.props.min,
|
|
175
|
+
"aria-valuemax": this.props.max,
|
|
176
|
+
"aria-valuenow": this.state.value,
|
|
177
|
+
"aria-valuetext": String(this.state.value),
|
|
178
|
+
"aria-orientation": this.props.vertical ? "vertical" : void 0,
|
|
179
|
+
"aria-disabled": this.props.disabled ? "true" : void 0,
|
|
180
|
+
"aria-labelledby": this.props.ariaLabelledBy,
|
|
181
|
+
"aria-describedby": this.props.ariaDescribedBy,
|
|
182
|
+
"aria-label": this.props.ariaLabel,
|
|
183
|
+
tabIndex: E(this.props.tabIndex, this.props.disabled, void 0),
|
|
184
|
+
className: "k-draghandle",
|
|
185
|
+
title: s.toLanguageString(u, h[u]),
|
|
186
|
+
style: this.props.vertical ? { bottom: "calc(" + t + "%)", zIndex: 1 } : this.state.dir === "rtl" ? { right: "calc(" + t + "% - 13px)", zIndex: 1 } : { left: "calc(" + t + "%)", zIndex: 1 }
|
|
187
|
+
}
|
|
188
|
+
)
|
|
189
|
+
)
|
|
190
|
+
))
|
|
191
|
+
)
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* @hidden
|
|
196
|
+
*/
|
|
197
|
+
get sliderTrack() {
|
|
198
|
+
return this._sliderTrack;
|
|
199
|
+
}
|
|
200
|
+
change(s, t) {
|
|
201
|
+
t = Math.min(Math.max(t, this.props.min), this.props.max), this.setState({ value: t }), S(this.props.onChange, s, this, { value: t });
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
c.displayName = "Slider", c.propTypes = {
|
|
205
|
+
min: a.number.isRequired,
|
|
206
|
+
max: a.number.isRequired,
|
|
207
|
+
value: a.number,
|
|
208
|
+
vertical: a.bool,
|
|
209
|
+
id: a.string,
|
|
210
|
+
ariaLabelledBy: a.string,
|
|
211
|
+
ariaDescribedBy: a.string,
|
|
212
|
+
ariaLabel: a.string
|
|
213
|
+
// TODO: validation when buttons is set to true, but no step is provided
|
|
214
|
+
};
|
|
215
|
+
let o = c;
|
|
216
|
+
const A = T(), N = D(A, o);
|
|
217
|
+
N.displayName = "KendoReactSlider";
|
|
218
|
+
L(o);
|
|
219
|
+
export {
|
|
220
|
+
N as Slider,
|
|
221
|
+
A as SliderPropsContext,
|
|
222
|
+
o as SliderWithoutContext
|
|
223
|
+
};
|
|
@@ -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 a=require("react"),o=require("@progress/kendo-react-common");function s(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const l in e)if(l!=="default"){const c=Object.getOwnPropertyDescriptor(e,l);Object.defineProperty(t,l,c.get?c:{enumerable:!0,get:()=>e[l]})}}return t.default=e,Object.freeze(t)}const i=s(a),n="data-slider-label",u=e=>{const t=i.useRef(null),l=o.useDir(t),c=e.vertical?{bottom:`${e.position}%`}:{[l==="rtl"?"right":"left"]:`${e.position}%`},r=e.vertical?"k-tick-vertical":"k-tick-horizontal";return i.createElement("li",{ref:t,className:`k-tick k-tick-large ${r}`,title:e.title,style:{zIndex:1,position:"absolute",...c}},e.children&&i.createElement("span",{[n]:!0,className:"k-label",onClick:e.onClick},e.children))};exports.SLIDER_LABEL_ATTRIBUTE=n;exports.SliderLabel=u;
|
|
@@ -0,0 +1,39 @@
|
|
|
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 e from "react";
|
|
10
|
+
import { useDir as n } from "@progress/kendo-react-common";
|
|
11
|
+
const r = "data-slider-label", s = (t) => {
|
|
12
|
+
const l = e.useRef(null), i = n(l), c = t.vertical ? { bottom: `${t.position}%` } : { [i === "rtl" ? "right" : "left"]: `${t.position}%` }, a = t.vertical ? "k-tick-vertical" : "k-tick-horizontal";
|
|
13
|
+
return /* @__PURE__ */ e.createElement(
|
|
14
|
+
"li",
|
|
15
|
+
{
|
|
16
|
+
ref: l,
|
|
17
|
+
className: `k-tick k-tick-large ${a}`,
|
|
18
|
+
title: t.title,
|
|
19
|
+
style: {
|
|
20
|
+
zIndex: 1,
|
|
21
|
+
position: "absolute",
|
|
22
|
+
...c
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
t.children && /* @__PURE__ */ e.createElement(
|
|
26
|
+
"span",
|
|
27
|
+
{
|
|
28
|
+
[r]: !0,
|
|
29
|
+
className: "k-label",
|
|
30
|
+
onClick: t.onClick
|
|
31
|
+
},
|
|
32
|
+
t.children
|
|
33
|
+
)
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
export {
|
|
37
|
+
r as SLIDER_LABEL_ATTRIBUTE,
|
|
38
|
+
s as SliderLabel
|
|
39
|
+
};
|
package/switch/Switch.js
ADDED
|
@@ -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 C=require("react"),s=require("prop-types"),i=require("@progress/kendo-react-common"),S=require("@progress/kendo-react-intl"),p=require("../messages/index.js"),M=require("../package-metadata.js");function N(d){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(d){for(const e in d)if(e!=="default"){const t=Object.getOwnPropertyDescriptor(d,e);Object.defineProperty(a,e,t.get?t:{enumerable:!0,get:()=>d[e]})}}return a.default=d,Object.freeze(a)}const n=N(C),l=class l extends n.Component{constructor(a){super(a),this.setValidity=()=>{this._input&&this._input.setCustomValidity&&this._input.setCustomValidity(this.validity.valid?"":this.props.validationMessage||this.defaultValidationMessage.toLanguageString(p.switchValidation,p.messages[p.switchValidation]))},this.limit=(e,t,r)=>{const h=r.offsetWidth,o=t.offsetWidth;return e<0?0:e>h-o?h-o:e},this.toggle=(e,t)=>{this.setState({checked:e}),this.valueDuringOnChange=e,i.dispatchEvent(this.props.onChange,t,this,{value:e}),this.valueDuringOnChange=void 0},this._element=null,this._wrapper=null,this._input=null,this._id=this.props.id,this.defaultValidationMessage=S.provideLocalizationService(this),this.focus=()=>{this.actionElement&&this.actionElement.focus()},this.dummyInput=e=>n.createElement("input",{type:"checkbox",checked:this.props.checked,ref:t=>{this._input=t},tabIndex:-1,"aria-hidden":!0,value:e,style:{opacity:0,width:1,border:0,zIndex:-1,position:"absolute",left:"50%"},onChange:i.noop,name:this.name||void 0}),this.handleClick=e=>{this.eventTimeStamp!==e.timeStamp&&(this.eventTimeStamp=e.timeStamp,this.toggle(!this.value,e))},this.handleKeyDown=e=>{if(this.props.disabled)return;const{keyCode:t}=e;(t===i.Keys.space||t===i.Keys.enter)&&(this.toggle(!this.value,e),e.preventDefault())},this.handleWrapperFocus=e=>{if(this.props.disabled)return;this.setState({focused:!0});const{onFocus:t}=this.props;t&&t.call(void 0,e)},this.handleWrapperBlur=e=>{if(this.props.disabled)return;this.setState({focused:!1});const{onBlur:t}=this.props;t&&t.call(void 0,e)},i.validatePackage(M.packageMetadata),this.state={checked:a.defaultChecked||l.defaultProps.defaultChecked,focused:!1}}get value(){return this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.checked!==void 0?this.props.checked:this.state.checked}get element(){return this._element}get actionElement(){return this._wrapper}get name(){return this.props.name}get validity(){const a=this.props.validationMessage!==void 0,e=this.props.valid!==void 0?this.props.valid:this.props.required?!!this.value:!0,t=this.props.valid!==void 0?this.props.valid:e;return{customError:a,valid:t,valueMissing:this.value===null}}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:l.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:l.defaultProps.required}componentDidMount(){this.setValidity(),this.forceUpdate()}componentDidUpdate(){this.setValidity()}render(){const{focused:a}=this.state,{dir:e,disabled:t,trackRounded:r,thumbRounded:h,size:o,offLabel:g,onLabel:b,tabIndex:v}=this.props;this.dir=e||this.element&&getComputedStyle(this.element).direction||void 0;const y=!this.validityStyles||this.validity.valid,k=i.classNames("k-switch",{[`k-switch-${i.kendoThemeMaps.sizeMap[o]||o}`]:o,[`k-rounded-${i.kendoThemeMaps.roundedMap[r]||r}`]:r,"k-switch-on":this.value,"k-switch-off":!this.value,"k-focus":a,"k-disabled":t,"k-invalid":!y},this.props.className),w={"aria-checked":this.value,"aria-disabled":t||void 0,"aria-labelledby":this.props.ariaLabelledBy,"aria-describedby":this.props.ariaDescribedBy,"aria-label":this.props.ariaLabel};return n.createElement("span",{ref:u=>{this._wrapper=u},role:"switch",...w,className:k,dir:this.dir,onKeyDown:this.handleKeyDown,onClick:this.handleClick,onBlur:this.handleWrapperBlur,onFocus:this.handleWrapperFocus,tabIndex:i.getTabIndex(v,t,void 0),accessKey:this.props.accessKey,id:this.props.id||this._id},n.createElement("span",{className:i.classNames("k-switch-track",{[`k-rounded-${i.kendoThemeMaps.roundedMap[r]||r}`]:r}),ref:u=>{this._element=u}},this.dummyInput(this.value),n.createElement("span",{className:"k-switch-label-on"},b),n.createElement("span",{className:"k-switch-label-off"},g)),n.createElement("span",{className:"k-switch-thumb-wrap"},n.createElement("span",{className:i.classNames("k-switch-thumb",{[`k-rounded-${h}`]:h})})))}};l.displayName="Switch",l.propTypes={accessKey:s.string,checked:s.bool,className:s.string,disabled:s.bool,defaultChecked:s.bool,size:s.oneOf([null,"small","medium","large"]),trackRounded:s.oneOf([null,"small","medium","large","full"]),thumbRounded:s.oneOf([null,"small","medium","large","full"]),dir:s.string,id:s.string,ariaLabelledBy:s.string,ariaDescribedBy:s.string,offLabel:s.string,required:s.bool,tabIndex:s.number,valid:s.bool,validate:s.bool,validationMessage:s.string,onBlur:s.any,onChange:s.any,onFocus:s.any,onLabel:s.string},l.defaultProps={disabled:!1,defaultChecked:!1,size:"medium",trackRounded:"full",thumbRounded:"full",offLabel:"OFF",onBlur:i.noop,onFocus:i.noop,onLabel:"ON",required:!1,validityStyles:!0};let c=l;const m=i.createPropsContext(),f=i.withIdHOC(i.withPropsContext(m,c));f.displayName="KendoReactSwitch";exports.Switch=f;exports.SwitchPropsContext=m;exports.SwitchWithoutContext=c;
|