@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,337 @@
|
|
|
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 D from "prop-types";
|
|
11
|
+
import { createPropsContext as W, validatePackage as Y, usePropsContext as _, useDir as j, Keys as v, useDraggable as F, classNames as J, getTabIndex as z } from "@progress/kendo-react-common";
|
|
12
|
+
import { sliderDragTitle as R, messages as P } from "../messages/index.mjs";
|
|
13
|
+
import { useLocalization as Q } from "@progress/kendo-react-intl";
|
|
14
|
+
import { RANGE_ACTION as n, rangeReducer as U } from "./range-raducer.mjs";
|
|
15
|
+
import { packageMetadata as Z } from "../package-metadata.mjs";
|
|
16
|
+
const ee = (r, l, e) => {
|
|
17
|
+
const [s, i] = a.useState(r), d = a.useCallback(
|
|
18
|
+
(u) => {
|
|
19
|
+
const x = U(l.state || s, { ...u, ...l });
|
|
20
|
+
e && e(x, u.event), i(x);
|
|
21
|
+
},
|
|
22
|
+
[l, e]
|
|
23
|
+
);
|
|
24
|
+
return [s, d];
|
|
25
|
+
}, te = W(), T = a.forwardRef((r, l) => {
|
|
26
|
+
Y(Z);
|
|
27
|
+
const e = _(te, r), s = a.useRef(null), i = a.useRef(null), d = a.useRef(null), u = a.useRef(null), x = a.useRef(null), V = a.useCallback(
|
|
28
|
+
() => {
|
|
29
|
+
u.current && u.current.focus();
|
|
30
|
+
},
|
|
31
|
+
[u]
|
|
32
|
+
);
|
|
33
|
+
a.useImperativeHandle(s, () => ({
|
|
34
|
+
element: i.current,
|
|
35
|
+
focus: V,
|
|
36
|
+
props: e
|
|
37
|
+
})), a.useImperativeHandle(l, () => s.current);
|
|
38
|
+
const f = a.useMemo(
|
|
39
|
+
() => e.min,
|
|
40
|
+
[e.min]
|
|
41
|
+
), k = a.useMemo(
|
|
42
|
+
() => e.max,
|
|
43
|
+
[e.max]
|
|
44
|
+
), K = a.useMemo(
|
|
45
|
+
() => e.step !== void 0 ? e.step : $.step,
|
|
46
|
+
[e.step, $.step]
|
|
47
|
+
), p = j(i, e.dir), A = (t, m) => {
|
|
48
|
+
e.onChange && s.current && e.onChange.call(void 0, {
|
|
49
|
+
value: t,
|
|
50
|
+
target: s.current,
|
|
51
|
+
syntheticEvent: m
|
|
52
|
+
});
|
|
53
|
+
}, [E, S] = a.useState(""), [b, c] = ee(
|
|
54
|
+
e.defaultValue || $.defaultValue,
|
|
55
|
+
{
|
|
56
|
+
min: f,
|
|
57
|
+
max: k,
|
|
58
|
+
step: K,
|
|
59
|
+
state: e.value
|
|
60
|
+
},
|
|
61
|
+
A
|
|
62
|
+
), o = a.useMemo(
|
|
63
|
+
() => e.value || b,
|
|
64
|
+
[e.value, b]
|
|
65
|
+
), H = a.useRef(null), w = a.useRef(null), y = a.useMemo(
|
|
66
|
+
() => (o.start - f) / (k - f) * 100,
|
|
67
|
+
[o.start, f, k]
|
|
68
|
+
), g = a.useMemo(
|
|
69
|
+
() => (o.end - f) / (k - f) * 100,
|
|
70
|
+
[o.end, f, k]
|
|
71
|
+
), L = a.useMemo(
|
|
72
|
+
() => e.vertical ? { paddingTop: 0, height: "100%" } : {},
|
|
73
|
+
[e.vertical]
|
|
74
|
+
), N = a.useMemo(
|
|
75
|
+
() => e.vertical ? { marginTop: "0.5rem", marginBottom: "0.5rem" } : { marginLeft: "0.5rem", marginRight: "0.5rem" },
|
|
76
|
+
[e.vertical]
|
|
77
|
+
), M = Q(), I = a.useCallback(
|
|
78
|
+
(t) => {
|
|
79
|
+
if (!w.current)
|
|
80
|
+
return;
|
|
81
|
+
const m = w.current.getBoundingClientRect(), h = e.vertical ? m.bottom - t.clientY : p === "rtl" ? m.right - t.clientX : t.clientX - m.left, C = e.vertical ? m.height : m.width, X = h / C;
|
|
82
|
+
return f + X * (k - f);
|
|
83
|
+
},
|
|
84
|
+
[
|
|
85
|
+
w,
|
|
86
|
+
e.vertical,
|
|
87
|
+
p,
|
|
88
|
+
f,
|
|
89
|
+
k,
|
|
90
|
+
b.start,
|
|
91
|
+
b.end,
|
|
92
|
+
e.value && e.value.start,
|
|
93
|
+
e.value && e.value.end
|
|
94
|
+
]
|
|
95
|
+
), q = a.useCallback(
|
|
96
|
+
(t) => t <= o.start ? "start" : t >= o.end ? "end" : 2 * t < o.end + o.start ? "start" : "end",
|
|
97
|
+
[
|
|
98
|
+
b.start,
|
|
99
|
+
b.end,
|
|
100
|
+
e.value && e.value.start,
|
|
101
|
+
e.value && e.value.end
|
|
102
|
+
]
|
|
103
|
+
), B = a.useCallback(
|
|
104
|
+
(t) => {
|
|
105
|
+
switch (t.keyCode) {
|
|
106
|
+
case v.right:
|
|
107
|
+
t.preventDefault(), c({ type: p === "rtl" ? n.decrease : n.increase, key: "start", event: t });
|
|
108
|
+
break;
|
|
109
|
+
case v.up:
|
|
110
|
+
t.preventDefault(), c({ type: n.increase, key: "start", event: t });
|
|
111
|
+
break;
|
|
112
|
+
case v.left:
|
|
113
|
+
t.preventDefault(), c({ type: p === "rtl" ? n.increase : n.decrease, key: "start", event: t });
|
|
114
|
+
break;
|
|
115
|
+
case v.down:
|
|
116
|
+
t.preventDefault(), c({ type: n.decrease, key: "start", event: t });
|
|
117
|
+
break;
|
|
118
|
+
case v.home:
|
|
119
|
+
t.preventDefault(), c({ type: n.min, key: "start", event: t });
|
|
120
|
+
break;
|
|
121
|
+
case v.end:
|
|
122
|
+
t.preventDefault(), c({ type: n.max, key: "start", event: t });
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
[c]
|
|
127
|
+
), G = a.useCallback(
|
|
128
|
+
(t) => {
|
|
129
|
+
switch (t.keyCode) {
|
|
130
|
+
case v.right:
|
|
131
|
+
t.preventDefault(), c({ type: p === "rtl" ? n.decrease : n.increase, key: "end", event: t });
|
|
132
|
+
break;
|
|
133
|
+
case v.up:
|
|
134
|
+
t.preventDefault(), c({ type: n.increase, key: "end", event: t });
|
|
135
|
+
break;
|
|
136
|
+
case v.left:
|
|
137
|
+
t.preventDefault(), c({ type: p === "rtl" ? n.increase : n.decrease, key: "end", event: t });
|
|
138
|
+
break;
|
|
139
|
+
case v.down:
|
|
140
|
+
t.preventDefault(), c({ type: n.decrease, key: "end", event: t });
|
|
141
|
+
break;
|
|
142
|
+
case v.home:
|
|
143
|
+
t.preventDefault(), c({ type: n.min, key: "end", event: t });
|
|
144
|
+
break;
|
|
145
|
+
case v.end:
|
|
146
|
+
t.preventDefault(), c({ type: n.max, key: "end", event: t });
|
|
147
|
+
break;
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
[c, p]
|
|
151
|
+
), O = a.useCallback(
|
|
152
|
+
(t) => {
|
|
153
|
+
const m = I(t), h = q(m);
|
|
154
|
+
S(h), h === "end" ? x.current.focus() : u.current.focus();
|
|
155
|
+
const C = h === "end" ? n.end : n.start;
|
|
156
|
+
c({ type: C, payload: m, event: t });
|
|
157
|
+
},
|
|
158
|
+
[e.vertical, f, k, c]
|
|
159
|
+
);
|
|
160
|
+
return F(w, { onPress: O, onDrag: (t) => {
|
|
161
|
+
const m = I(t), h = E === "end" ? n.end : n.start;
|
|
162
|
+
c({ type: h, payload: m, event: t });
|
|
163
|
+
}, onRelease: (t) => {
|
|
164
|
+
const m = I(t), h = E === "end" ? n.end : n.start;
|
|
165
|
+
c({ type: h, payload: m, event: t }), S("");
|
|
166
|
+
} }), /* @__PURE__ */ a.createElement(
|
|
167
|
+
"div",
|
|
168
|
+
{
|
|
169
|
+
id: e.id,
|
|
170
|
+
style: e.style,
|
|
171
|
+
ref: i,
|
|
172
|
+
dir: p,
|
|
173
|
+
className: J(
|
|
174
|
+
"k-slider",
|
|
175
|
+
{
|
|
176
|
+
"k-rtl": p === "rtl",
|
|
177
|
+
"k-disabled": e.disabled,
|
|
178
|
+
"k-slider-vertical": e.vertical,
|
|
179
|
+
"k-slider-horizontal": !e.vertical
|
|
180
|
+
},
|
|
181
|
+
e.className
|
|
182
|
+
)
|
|
183
|
+
},
|
|
184
|
+
/* @__PURE__ */ a.createElement(
|
|
185
|
+
"div",
|
|
186
|
+
{
|
|
187
|
+
ref: w,
|
|
188
|
+
className: "k-slider-track-wrap",
|
|
189
|
+
style: {
|
|
190
|
+
flexGrow: 1,
|
|
191
|
+
position: "relative",
|
|
192
|
+
touchAction: "none",
|
|
193
|
+
...N
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
e.children && /* @__PURE__ */ a.createElement(
|
|
197
|
+
"ul",
|
|
198
|
+
{
|
|
199
|
+
className: "k-reset k-slider-items",
|
|
200
|
+
style: { ...L }
|
|
201
|
+
},
|
|
202
|
+
a.Children.map(e.children, (t) => t && a.cloneElement(
|
|
203
|
+
t,
|
|
204
|
+
{
|
|
205
|
+
position: 100 * (t.props.position - e.min) / (e.max - e.min),
|
|
206
|
+
vertical: e.vertical
|
|
207
|
+
},
|
|
208
|
+
t.props.children
|
|
209
|
+
))
|
|
210
|
+
),
|
|
211
|
+
/* @__PURE__ */ a.createElement(
|
|
212
|
+
"div",
|
|
213
|
+
{
|
|
214
|
+
ref: H,
|
|
215
|
+
className: "k-slider-track",
|
|
216
|
+
style: e.vertical ? { bottom: 0, height: "100%" } : { [p === "rtl" ? "right" : "left"]: 0, width: "100%" }
|
|
217
|
+
},
|
|
218
|
+
y !== null && g !== null && /* @__PURE__ */ a.createElement(
|
|
219
|
+
"div",
|
|
220
|
+
{
|
|
221
|
+
"data-selection": !0,
|
|
222
|
+
ref: d,
|
|
223
|
+
title: `${o.start} - ${o.end}`,
|
|
224
|
+
className: "k-slider-selection",
|
|
225
|
+
style: e.vertical ? { height: g - y + "%", bottom: y + "%" } : {
|
|
226
|
+
[p === "rtl" ? "right" : "left"]: y + "%",
|
|
227
|
+
width: g - y + "%"
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
),
|
|
231
|
+
/* @__PURE__ */ a.createElement(
|
|
232
|
+
"span",
|
|
233
|
+
{
|
|
234
|
+
ref: u,
|
|
235
|
+
role: "slider",
|
|
236
|
+
tabIndex: z(e.startTabIndex, e.disabled, void 0),
|
|
237
|
+
"aria-valuemin": f,
|
|
238
|
+
"aria-valuemax": Math.max(k, o.end),
|
|
239
|
+
"aria-valuenow": o.start,
|
|
240
|
+
"aria-disabled": e.disabled ? "true" : void 0,
|
|
241
|
+
"aria-valuetext": `${o.start} - ${o.end}`,
|
|
242
|
+
className: "k-draghandle",
|
|
243
|
+
title: M.toLanguageString(R, P[R]),
|
|
244
|
+
style: e.vertical ? { bottom: "calc(" + y + "%)", zIndex: 1 } : p === "rtl" ? { right: "calc(" + y + "% - 13px)", zIndex: 1 } : { left: "calc(" + y + "%)", zIndex: 1 },
|
|
245
|
+
onKeyDown: B
|
|
246
|
+
}
|
|
247
|
+
),
|
|
248
|
+
/* @__PURE__ */ a.createElement(
|
|
249
|
+
"span",
|
|
250
|
+
{
|
|
251
|
+
ref: x,
|
|
252
|
+
role: "slider",
|
|
253
|
+
tabIndex: z(e.endTabIndex, e.disabled, void 0),
|
|
254
|
+
"aria-valuemin": Math.min(f, o.start),
|
|
255
|
+
"aria-valuemax": k,
|
|
256
|
+
"aria-valuenow": o.end,
|
|
257
|
+
"aria-disabled": e.disabled ? "true" : void 0,
|
|
258
|
+
"aria-valuetext": `${o.start} - ${o.end}`,
|
|
259
|
+
className: "k-draghandle",
|
|
260
|
+
title: M.toLanguageString(R, P[R]),
|
|
261
|
+
style: e.vertical ? { bottom: "calc(" + g + "%)", zIndex: 1 } : p === "rtl" ? { right: "calc(" + g + "% - 13px)", zIndex: 1 } : { left: "calc(" + g + "%)", zIndex: 1 },
|
|
262
|
+
onKeyDown: G
|
|
263
|
+
}
|
|
264
|
+
)
|
|
265
|
+
)
|
|
266
|
+
)
|
|
267
|
+
);
|
|
268
|
+
}), ae = {
|
|
269
|
+
value: (r, l, e) => {
|
|
270
|
+
if (r.value) {
|
|
271
|
+
const s = r.value.start, i = r.value.end, d = r.min, u = r.max;
|
|
272
|
+
if (s > i || s > u || s < d || i > u || i < d || i < s)
|
|
273
|
+
return new Error(
|
|
274
|
+
`Invalid prop + ${l} supplied to ${e}.
|
|
275
|
+
The { start, end } value must be between the min & max value and { start, end } must be start < end.
|
|
276
|
+
`
|
|
277
|
+
);
|
|
278
|
+
}
|
|
279
|
+
return null;
|
|
280
|
+
},
|
|
281
|
+
defaultValue: (r, l, e) => {
|
|
282
|
+
if (r.defaultValue) {
|
|
283
|
+
const s = r.defaultValue.start, i = r.defaultValue.end, d = r.min, u = r.max;
|
|
284
|
+
if (s > i || s > u || s < d || i > u || i < d || i < s)
|
|
285
|
+
return new Error(
|
|
286
|
+
`Invalid prop + ${l} supplied to ${e}.
|
|
287
|
+
The { start, end } value must be between the min & max value and { start, end } must be start < end.
|
|
288
|
+
`
|
|
289
|
+
);
|
|
290
|
+
}
|
|
291
|
+
return null;
|
|
292
|
+
},
|
|
293
|
+
onChange: D.func,
|
|
294
|
+
step: D.number,
|
|
295
|
+
min: (r, l, e) => {
|
|
296
|
+
const s = r[l], i = r.min, d = r.max;
|
|
297
|
+
return i === void 0 ? new Error(
|
|
298
|
+
`Invalid prop + ${l} supplied to ${e}.
|
|
299
|
+
${l} value can not be undefined.
|
|
300
|
+
`
|
|
301
|
+
) : s && i >= d ? new Error(
|
|
302
|
+
`Invalid prop + ${l} supplied to ${e}.
|
|
303
|
+
${l} value can not be equal to or bigger than the max value.
|
|
304
|
+
`
|
|
305
|
+
) : null;
|
|
306
|
+
},
|
|
307
|
+
max: (r, l, e) => {
|
|
308
|
+
const s = r[l], i = r.min, d = r.max;
|
|
309
|
+
return d === void 0 ? new Error(
|
|
310
|
+
`Invalid prop + ${l} supplied to ${e}.
|
|
311
|
+
${l} value can not be undefined.
|
|
312
|
+
`
|
|
313
|
+
) : s && d <= i ? new Error(
|
|
314
|
+
`Invalid prop + ${l} supplied to ${e}.
|
|
315
|
+
${l} value can not be equal to or smaller than the min value.
|
|
316
|
+
`
|
|
317
|
+
) : null;
|
|
318
|
+
},
|
|
319
|
+
vertical: D.bool,
|
|
320
|
+
disabled: D.bool,
|
|
321
|
+
dir: D.oneOf(["ltr", "rtl"])
|
|
322
|
+
}, $ = {
|
|
323
|
+
step: 1,
|
|
324
|
+
defaultValue: {
|
|
325
|
+
start: 0,
|
|
326
|
+
end: 0
|
|
327
|
+
},
|
|
328
|
+
vertical: !1,
|
|
329
|
+
disabled: !1
|
|
330
|
+
};
|
|
331
|
+
T.displayName = "KendoReactRangeSlider";
|
|
332
|
+
T.propTypes = ae;
|
|
333
|
+
T.defaultProps = $;
|
|
334
|
+
export {
|
|
335
|
+
T as RangeSlider,
|
|
336
|
+
te as RangeSliderPropsContext
|
|
337
|
+
};
|
|
@@ -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"});var l=(e=>(e.start="start",e.end="end",e.min="min",e.max="max",e.increase="increase",e.decrease="decrease",e))(l||{});const a=(e,r)=>{let d,m;switch(r.type){case"start":if(r.payload===void 0)return e;d={start:r.payload>e.end?e.end:Math.max(r.payload,r.min),end:e.end};break;case"end":if(r.payload===void 0)return e;d={start:e.start,end:r.payload<e.start?e.start:Math.min(r.payload,r.max)};break;case"min":r.key==="start"?d={...e,start:r.min}:d={...e,end:Math.max(r.min,e.start)};break;case"max":r.key==="start"?d={...e,start:Math.min(r.max,e.end)}:d={...e,end:r.max};break;case"increase":if(r.step===void 0||r.key===void 0)return e;m=e[r.key]+r.step,r.key==="start"?m<r.min?d={...e,start:r.min}:d={...e,start:Math.min(m,e.end)}:m>r.max?d={...e,end:r.max}:d={...e,end:Math.max(m,e.start)};break;case"decrease":if(r.step===void 0||r.key===void 0)return e;m=e[r.key]-r.step,r.key==="start"?m<r.min?d={...e,start:r.min}:d={...e,start:Math.min(m,e.end)}:m>r.max?d={...e,end:r.max}:d={...e,end:Math.max(m,e.start)};break;default:d=e;break}return d};exports.RANGE_ACTION=l;exports.rangeReducer=a;
|
|
@@ -0,0 +1,90 @@
|
|
|
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
|
+
var l = /* @__PURE__ */ ((e) => (e.start = "start", e.end = "end", e.min = "min", e.max = "max", e.increase = "increase", e.decrease = "decrease", e))(l || {});
|
|
10
|
+
const s = (e, r) => {
|
|
11
|
+
let d, m;
|
|
12
|
+
switch (r.type) {
|
|
13
|
+
case "start":
|
|
14
|
+
if (r.payload === void 0)
|
|
15
|
+
return e;
|
|
16
|
+
d = {
|
|
17
|
+
start: r.payload > e.end ? e.end : Math.max(r.payload, r.min),
|
|
18
|
+
end: e.end
|
|
19
|
+
};
|
|
20
|
+
break;
|
|
21
|
+
case "end":
|
|
22
|
+
if (r.payload === void 0)
|
|
23
|
+
return e;
|
|
24
|
+
d = {
|
|
25
|
+
start: e.start,
|
|
26
|
+
end: r.payload < e.start ? e.start : Math.min(r.payload, r.max)
|
|
27
|
+
};
|
|
28
|
+
break;
|
|
29
|
+
case "min":
|
|
30
|
+
r.key === "start" ? d = {
|
|
31
|
+
...e,
|
|
32
|
+
start: r.min
|
|
33
|
+
} : d = {
|
|
34
|
+
...e,
|
|
35
|
+
end: Math.max(r.min, e.start)
|
|
36
|
+
};
|
|
37
|
+
break;
|
|
38
|
+
case "max":
|
|
39
|
+
r.key === "start" ? d = {
|
|
40
|
+
...e,
|
|
41
|
+
start: Math.min(r.max, e.end)
|
|
42
|
+
} : d = {
|
|
43
|
+
...e,
|
|
44
|
+
end: r.max
|
|
45
|
+
};
|
|
46
|
+
break;
|
|
47
|
+
case "increase":
|
|
48
|
+
if (r.step === void 0 || r.key === void 0)
|
|
49
|
+
return e;
|
|
50
|
+
m = e[r.key] + r.step, r.key === "start" ? m < r.min ? d = {
|
|
51
|
+
...e,
|
|
52
|
+
start: r.min
|
|
53
|
+
} : d = {
|
|
54
|
+
...e,
|
|
55
|
+
start: Math.min(m, e.end)
|
|
56
|
+
} : m > r.max ? d = {
|
|
57
|
+
...e,
|
|
58
|
+
end: r.max
|
|
59
|
+
} : d = {
|
|
60
|
+
...e,
|
|
61
|
+
end: Math.max(m, e.start)
|
|
62
|
+
};
|
|
63
|
+
break;
|
|
64
|
+
case "decrease":
|
|
65
|
+
if (r.step === void 0 || r.key === void 0)
|
|
66
|
+
return e;
|
|
67
|
+
m = e[r.key] - r.step, r.key === "start" ? m < r.min ? d = {
|
|
68
|
+
...e,
|
|
69
|
+
start: r.min
|
|
70
|
+
} : d = {
|
|
71
|
+
...e,
|
|
72
|
+
start: Math.min(m, e.end)
|
|
73
|
+
} : m > r.max ? d = {
|
|
74
|
+
...e,
|
|
75
|
+
end: r.max
|
|
76
|
+
} : d = {
|
|
77
|
+
...e,
|
|
78
|
+
end: Math.max(m, e.start)
|
|
79
|
+
};
|
|
80
|
+
break;
|
|
81
|
+
default:
|
|
82
|
+
d = e;
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
return d;
|
|
86
|
+
};
|
|
87
|
+
export {
|
|
88
|
+
l as RANGE_ACTION,
|
|
89
|
+
s as rangeReducer
|
|
90
|
+
};
|
package/rating/Rating.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
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 X=require("react"),i=require("prop-types"),l=require("@progress/kendo-react-common"),D=require("@progress/kendo-svg-icons"),J=require("./RatingItem.js"),c=require("./rating-reducer.js"),u=require("./utils/index.js"),G=require("../messages/index.js"),Q=require("@progress/kendo-react-intl");function U(a){const d=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const e in a)if(e!=="default"){const f=Object.getOwnPropertyDescriptor(a,e);Object.defineProperty(d,e,f.get?f:{enumerable:!0,get:()=>a[e]})}}return d.default=a,Object.freeze(d)}const n=U(X),z=(a,d,e)=>{const[f,m]=n.useState(a);return[f,s=>{const A=c.ratingReducer(d.state||f,{...s,...d});e&&e(A,s.event),m(A)}]},F=l.createPropsContext(),E=n.forwardRef((a,d)=>{const e=l.usePropsContext(F,a),f=Q.useLocalization(),m=n.useRef(null),x=n.useRef(null),s=l.useDir(x,e.dir);n.useImperativeHandle(m,()=>({element:x.current,props:e})),n.useImperativeHandle(d,()=>m.current);const A=n.useCallback((t,o)=>{e.onChange&&m.current&&e.onChange.call(void 0,{value:t,target:m.current,syntheticEvent:o})},[e.onChange]),h=n.useMemo(()=>e.min!==void 0?e.min:p.min,[e.min]),N=n.useMemo(()=>e.max!==void 0?e.max:p.max,[e.max]),I=n.useMemo(()=>e.precision||p.precision,[e.precision]),r=n.useMemo(()=>e.step!==void 0?e.step:p.step,[e.step]),O=n.useMemo(()=>e.readonly||p.readonly,[e.readonly]),R=n.useMemo(()=>e.disabled||p.disabled,[e.disabled]),H=n.useMemo(()=>e.item||p.item,[e.item]),[P,v]=z(e.defaultValue!==void 0?e.defaultValue:p.defaultValue,{state:e.value,min:h,max:N,step:I==="half"?r/2:r},A),[V,_]=z(null,{state:e.value,min:h,max:N,step:I==="half"?r/2:r,precision:I}),g=n.useMemo(()=>e.value!==void 0?e.value:P,[e.value,P]),C=n.useMemo(()=>V,[V]),S=n.useMemo(()=>e.selection||p.selection,[e.selection]),T=n.useMemo(()=>r/(I==="half"?2:1),[r,I]),K=n.useCallback(t=>{if(!(!t.target||!t.target.element||O||R)){if(I==="half"){const o=t.target.element.getBoundingClientRect(),k=u.calcIsFirstHalf(s||"ltr",o,t.syntheticEvent.clientX)?u.toRound(t.target.value-r/2,T):t.target.value;v({type:c.RATING_ACTION.select,payload:k,event:t.syntheticEvent})}else v({type:c.RATING_ACTION.select,payload:t.target.value,event:t.syntheticEvent});if(e.onClick){const o={value:g,target:m.current,syntheticEvent:t.syntheticEvent};e.onClick.call(void 0,o)}}},[e.onClick,v,g]),q=n.useCallback(t=>{if(!(O||R)){switch(t.keyCode){case l.Keys.right:t.preventDefault(),v({type:s==="rtl"?c.RATING_ACTION.decrease:c.RATING_ACTION.increase,event:t});break;case l.Keys.left:t.preventDefault(),v({type:s==="rtl"?c.RATING_ACTION.increase:c.RATING_ACTION.decrease,event:t});break;case l.Keys.home:t.preventDefault(),v({type:s==="rtl"?c.RATING_ACTION.min:c.RATING_ACTION.max,event:t});break;case l.Keys.end:t.preventDefault(),v({type:s==="rtl"?c.RATING_ACTION.max:c.RATING_ACTION.min,event:t});break;case l.Keys.esc:t.preventDefault(),v({type:c.RATING_ACTION.deselect,event:t});break}e.onKeyDown&&e.onKeyDown.call(void 0,{value:g,target:m.current,syntheticEvent:t})}},[e.onKeyDown,v,g]),B=n.useCallback(t=>{if(e.onFocus){const o={target:m.current,syntheticEvent:t};e.onFocus.call(void 0,o)}},[e.onFocus]),$=n.useCallback(t=>{if(e.onBlur){const o={target:m.current,syntheticEvent:t};e.onBlur.call(void 0,o)}},[e.onBlur]),W=n.useCallback(t=>{if(!(!t.target||!t.target.element))if(I==="half"){const o=t.target.element.getBoundingClientRect(),k=u.calcIsFirstHalf(s||"ltr",o,t.syntheticEvent.clientX)?t.target.value-r/2:t.target.value;_({type:c.RATING_ACTION.select,payload:k,event:t.syntheticEvent})}else _({type:c.RATING_ACTION.select,payload:t.target.value,event:t.syntheticEvent})},[I,r,s]),L=n.useCallback(t=>{_({type:c.RATING_ACTION.reset,event:t.syntheticEvent})},[]),w=[],j=u.getRemainder(u.toRound(N-h,T),r);for(let t=h;t<=N;t=u.toRound(t+r,T)){const o=u.toRound(t+j,T),y=I==="half"?u.isHalf(o,C!==null?C:g!==null?g:0,r):!1,k=u.isSelected(o,g,r,S),M=u.isSelected(o,C!==null?C:g,r,S),b=u.isSelected(o,C,r,S);w.push(n.createElement(H,{key:o,value:o,dir:s,title:String(y?u.toRound(o-r/2,T):o),icon:e.icon,svgIcon:e.svgIcon,half:y,selected:k||M,hovered:b,onClick:K,onMouseMove:W,onMouseLeave:L},y&&n.createElement("span",{className:"k-rating-precision-complement"},!(e.icon||e.svgIconOutline)&&n.createElement(l.IconWrap,{name:"star-outline",icon:D.starOutlineIcon,style:{clipPath:`${s==="rtl"?"inset(0 50% 0 0)":"inset(0 0 0 50%)"}`},size:"xlarge"}),(e.icon||e.svgIconOutline)&&n.createElement(l.IconWrap,{name:l.toIconName(`${e.icon}-outline`),icon:e.svgIconOutline,size:"xlarge"})),y&&n.createElement("span",{className:"k-rating-precision-part"},!(e.icon||e.svgIcon)&&n.createElement(l.IconWrap,{name:"star",icon:D.starIcon,style:{clipPath:`${s==="rtl"?"inset(0 0 0 50%)":"inset(0 50% 0 0)"}`},size:"xlarge"}),(e.icon||e.svgIcon)&&n.createElement(l.IconWrap,{name:e.icon?l.toIconName(e.icon):void 0,icon:e.svgIcon,size:"xlarge"})),y&&n.createElement("span",{style:{width:"24px",height:"24px",display:"block"}}),!y&&!(e.icon||e.svgIcon)&&(b||M&&!b)&&n.createElement(l.IconWrap,{name:"star",icon:D.starIcon,size:"xlarge"})||!(e.icon||e.svgIcon)&&!b&&!M&&n.createElement(l.IconWrap,{name:"star-outline",icon:D.starOutlineIcon,size:"xlarge"})||(e.icon||e.svgIcon)&&(b||M&&!b)&&n.createElement(l.IconWrap,{name:e.icon,icon:e.svgIcon,size:"xlarge"})||(e.icon||e.svgIcon)&&!b&&n.createElement(l.IconWrap,{name:l.toIconName(`${e.icon}-outline`),icon:e.svgIconOutline,size:"xlarge"})))}return n.createElement("span",{id:e.id,style:e.style,ref:x,role:"slider",dir:s,tabIndex:l.getTabIndex(e.tabIndex,e.disabled,void 0),className:l.classNames("k-rating",{"k-rtl":s==="rtl","k-readonly":O,"k-disabled":R},e.className),onKeyDown:q,onFocus:B,onBlur:$,"aria-valuemin":h,"aria-valuemax":N,"aria-valuenow":g!==null?g:void 0,"aria-disabled":R?"true":void 0,"aria-label":f.toLanguageString(G.ratingAriaLabel,G.messages[G.ratingAriaLabel]),"aria-labelledby":e.ariaLabelledBy,"aria-describedby":e.ariaDescribedBy},n.createElement("input",{id:"rating",className:"k-hidden",readOnly:O,disabled:R}),n.createElement("span",{className:"k-rating-container"},w),e.label&&n.createElement("span",{className:"k-rating-label"},e.label))}),Y={id:i.string,dir:i.oneOf(["ltr","rtl"]),selection:i.oneOf(["continues","single"]),precision:i.oneOf(["item","half"]),value:(a,d,e)=>a.value&&a.min&&a.max&&a.step&&!(a.precision==="half"?u.isCorrectValue(a.min,a.max,a.step/2,a.value):u.isCorrectValue(a.min,a.max,a.step,a.value))&&a.precision==="half"?new Error(`Invalid prop + ${d} supplied to ${e}.
|
|
9
|
+
The value of the { value } property is not correct, please check your values.
|
|
10
|
+
`):null,defaultValue:i.number,min:i.number,max:i.number,step:(a,d,e)=>a.step!==void 0&&a.step<=0?new Error(`Invalid prop + ${d} supplied to ${e}.
|
|
11
|
+
The value of the { step } property is cannot be equal or less than "0", please check your values.
|
|
12
|
+
`):null,hovered:i.number,label:i.string,readonly:i.bool,disabled:i.bool,half:i.bool,icon:i.string,svgIcon:l.svgIconPropType,svgIconOutline:l.svgIconPropType,ariaDescribedBy:i.string},p={dir:"ltr",min:1,max:5,step:1,item:J.RatingItem,defaultValue:null,readonly:!1,disabled:!1,selection:"continues",precision:"item"};E.displayName="KendoReactRating";E.propTypes=Y;E.defaultProps=p;exports.Rating=E;exports.RatingPropsContext=F;
|