@progress/kendo-react-inputs 5.4.0-dev.202205200719 → 5.4.0-dev.202206061009
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/dist/cdn/js/kendo-react-inputs.js +1 -1
- package/dist/es/checkbox/Checkbox.d.ts +1 -1
- package/dist/es/checkbox/Checkbox.js +9 -7
- package/dist/es/checkbox/interfaces/CheckboxBlurEvent.js +1 -0
- package/dist/es/checkbox/interfaces/CheckboxChangeEvent.js +1 -0
- package/dist/es/checkbox/interfaces/CheckboxFocusEvent.js +1 -0
- package/dist/es/checkbox/interfaces/CheckboxProps.js +1 -0
- package/dist/es/colors/ColorContrastLabels.js +6 -4
- package/dist/es/colors/ColorContrastSvg.js +3 -1
- package/dist/es/colors/ColorGradient.d.ts +3 -3
- package/dist/es/colors/ColorGradient.js +11 -5
- package/dist/es/colors/ColorInput.js +3 -1
- package/dist/es/colors/ColorPalette.d.ts +6 -3
- package/dist/es/colors/ColorPalette.js +15 -6
- package/dist/es/colors/ColorPicker.d.ts +1 -1
- package/dist/es/colors/ColorPicker.js +4 -4
- package/dist/es/colors/FlatColorPicker.d.ts +1 -1
- package/dist/es/colors/FlatColorPicker.js +25 -24
- package/dist/es/colors/HexInput.d.ts +1 -1
- package/dist/es/colors/HexInput.js +3 -1
- package/dist/es/colors/Picker.js +1 -1
- package/dist/es/colors/interfaces/ColorGradientChangeEvent.js +1 -0
- package/dist/es/colors/interfaces/ColorGradientProps.js +1 -0
- package/dist/es/colors/interfaces/ColorPaletteChangeEvent.js +1 -0
- package/dist/es/colors/interfaces/ColorPaletteProps.js +1 -0
- package/dist/es/colors/interfaces/ColorPickerActiveColorClick.js +1 -0
- package/dist/es/colors/interfaces/ColorPickerBlurEvent.js +1 -0
- package/dist/es/colors/interfaces/ColorPickerChangeEvent.js +1 -0
- package/dist/es/colors/interfaces/ColorPickerFocusEvent.js +1 -0
- package/dist/es/colors/interfaces/ColorPickerGradientSettings.js +1 -0
- package/dist/es/colors/interfaces/ColorPickerPaletteSettings.js +1 -0
- package/dist/es/colors/interfaces/ColorPickerPopupSettings.js +1 -0
- package/dist/es/colors/interfaces/ColorPickerProps.js +1 -0
- package/dist/es/colors/interfaces/ColorPickerView.js +1 -0
- package/dist/es/colors/interfaces/PickerPopupSettings.js +1 -0
- package/dist/es/colors/interfaces/PickerProps.js +1 -0
- package/dist/es/colors/models/hsva.js +1 -0
- package/dist/es/colors/models/output-format.js +1 -0
- package/dist/es/colors/models/rgb.js +1 -0
- package/dist/es/colors/models/rgba.js +1 -0
- package/dist/es/colors/models/table-cell.js +1 -0
- package/dist/es/colors/models/tile-size.js +1 -0
- package/dist/es/colors/utils/color-parser.d.ts +1 -1
- package/dist/es/colors/utils/color-parser.js +2 -2
- package/dist/es/colors/utils/misc.d.ts +1 -1
- package/dist/es/colors/utils/svg-calc.js +4 -4
- package/dist/es/common/SliderTooltip.js +3 -3
- package/dist/es/common/SwitchController.d.ts +3 -3
- package/dist/es/common/SwitchController.js +7 -3
- package/dist/es/common/SwitchModel.d.ts +1 -1
- package/dist/es/input/Input.d.ts +5 -5
- package/dist/es/input/Input.js +14 -9
- package/dist/es/input/interfaces/InputChangeEvent.js +1 -0
- package/dist/es/interfaces/Direction.js +1 -0
- package/dist/es/interfaces/ToggleBaseProps.js +1 -0
- package/dist/es/main.js +31 -0
- package/dist/es/maskedtextbox/MaskedTextBox.d.ts +15 -15
- package/dist/es/maskedtextbox/MaskedTextBox.js +19 -16
- package/dist/es/maskedtextbox/MaskedTextBoxProps.js +1 -0
- package/dist/es/maskedtextbox/masking.service.d.ts +4 -4
- package/dist/es/maskedtextbox/masking.service.js +4 -4
- package/dist/es/maskedtextbox/parsing/result.js +1 -1
- package/dist/es/messages/index.d.ts +22 -22
- package/dist/es/numerictextbox/NumericTextBox.d.ts +1 -1
- package/dist/es/numerictextbox/NumericTextBox.js +3 -3
- package/dist/es/numerictextbox/interfaces/NumericTextBoxBlurEvent.js +1 -0
- package/dist/es/numerictextbox/interfaces/NumericTextBoxChangeEvent.js +1 -0
- package/dist/es/numerictextbox/interfaces/NumericTextBoxFocusEvent.js +1 -0
- package/dist/es/numerictextbox/interfaces/NumericTextBoxHandle.js +1 -0
- package/dist/es/numerictextbox/interfaces/NumericTextBoxProps.js +1 -0
- package/dist/es/numerictextbox/interfaces/NumericTextBoxState.js +1 -0
- package/dist/es/numerictextbox/utils/index.d.ts +7 -7
- package/dist/es/numerictextbox/utils/index.js +4 -4
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/radiobutton/RadioButton.d.ts +1 -1
- package/dist/es/radiobutton/RadioButton.js +5 -3
- package/dist/es/radiobutton/RadioGroup.d.ts +1 -1
- package/dist/es/radiobutton/RadioGroup.js +1 -1
- package/dist/es/radiobutton/interfaces/RadioButtonBlurEvent.js +1 -0
- package/dist/es/radiobutton/interfaces/RadioButtonChangeEvent.js +1 -0
- package/dist/es/radiobutton/interfaces/RadioButtonFocusEvent.js +1 -0
- package/dist/es/radiobutton/interfaces/RadioButtonProps.js +1 -0
- package/dist/es/radiobutton/interfaces/RadioGroupChangeEvent.js +1 -0
- package/dist/es/radiobutton/interfaces/RadioGroupFocusEvent.js +1 -0
- package/dist/es/radiobutton/interfaces/RadioGroupProps.js +1 -0
- package/dist/es/range-slider/RangeSlider.d.ts +1 -1
- package/dist/es/range-slider/RangeSlider.js +8 -8
- package/dist/es/range-slider/range-raducer.js +12 -12
- package/dist/es/rating/Rating.d.ts +1 -1
- package/dist/es/rating/Rating.js +16 -13
- package/dist/es/rating/RatingItem.d.ts +1 -1
- package/dist/es/rating/models/index.d.ts +4 -0
- package/dist/es/rating/models/index.js +1 -0
- package/dist/es/rating/utils/index.d.ts +1 -1
- package/dist/es/slider/Slider.d.ts +3 -3
- package/dist/es/slider/Slider.js +7 -3
- package/dist/es/slider/SliderLabel.js +2 -2
- package/dist/es/switch/Switch.d.ts +13 -13
- package/dist/es/switch/Switch.js +18 -13
- package/dist/es/textarea/TextArea.d.ts +1 -1
- package/dist/es/textarea/TextArea.js +9 -7
- package/dist/es/textarea/interfaces/TextAreaBlurEvent.js +1 -0
- package/dist/es/textarea/interfaces/TextAreaChangeEvent.js +1 -0
- package/dist/es/textarea/interfaces/TextAreaFocusEvent.js +1 -0
- package/dist/es/textarea/interfaces/TextAreaProps.js +1 -0
- package/dist/es/utils.js +10 -1
- package/dist/npm/checkbox/Checkbox.d.ts +1 -1
- package/dist/npm/checkbox/Checkbox.js +20 -17
- package/dist/npm/colors/ColorContrastLabels.js +10 -7
- package/dist/npm/colors/ColorContrastSvg.js +10 -7
- package/dist/npm/colors/ColorGradient.d.ts +3 -3
- package/dist/npm/colors/ColorGradient.js +42 -35
- package/dist/npm/colors/ColorInput.js +6 -4
- package/dist/npm/colors/ColorPalette.d.ts +6 -3
- package/dist/npm/colors/ColorPalette.js +25 -15
- package/dist/npm/colors/ColorPicker.d.ts +1 -1
- package/dist/npm/colors/ColorPicker.js +14 -13
- package/dist/npm/colors/FlatColorPicker.d.ts +1 -1
- package/dist/npm/colors/FlatColorPicker.js +28 -26
- package/dist/npm/colors/HexInput.d.ts +1 -1
- package/dist/npm/colors/HexInput.js +6 -4
- package/dist/npm/colors/Picker.js +4 -2
- package/dist/npm/colors/models/palette-presets.js +1 -0
- package/dist/npm/colors/utils/color-cache.js +1 -0
- package/dist/npm/colors/utils/color-palette.service.js +7 -6
- package/dist/npm/colors/utils/color-parser.d.ts +1 -1
- package/dist/npm/colors/utils/color-parser.js +47 -36
- package/dist/npm/colors/utils/misc.d.ts +1 -1
- package/dist/npm/colors/utils/misc.js +6 -3
- package/dist/npm/colors/utils/svg-calc.js +13 -8
- package/dist/npm/common/SliderTooltip.js +7 -5
- package/dist/npm/common/SwitchController.d.ts +3 -3
- package/dist/npm/common/SwitchController.js +7 -3
- package/dist/npm/common/SwitchModel.d.ts +1 -1
- package/dist/npm/input/Input.d.ts +5 -5
- package/dist/npm/input/Input.js +20 -14
- package/dist/npm/main.js +69 -26
- package/dist/npm/maskedtextbox/MaskedTextBox.d.ts +15 -15
- package/dist/npm/maskedtextbox/MaskedTextBox.js +26 -22
- package/dist/npm/maskedtextbox/masking.service.d.ts +4 -4
- package/dist/npm/maskedtextbox/masking.service.js +24 -23
- package/dist/npm/maskedtextbox/parsing/combinators.js +5 -2
- package/dist/npm/maskedtextbox/parsing/parsers.js +15 -7
- package/dist/npm/maskedtextbox/parsing/result.js +2 -1
- package/dist/npm/maskedtextbox/parsing/stream.js +1 -0
- package/dist/npm/maskedtextbox/utils.js +1 -0
- package/dist/npm/messages/index.d.ts +22 -22
- package/dist/npm/messages/index.js +2 -1
- package/dist/npm/numerictextbox/NumericTextBox.d.ts +1 -1
- package/dist/npm/numerictextbox/NumericTextBox.js +32 -31
- package/dist/npm/numerictextbox/utils/index.d.ts +7 -7
- package/dist/npm/numerictextbox/utils/index.js +117 -88
- package/dist/npm/package-metadata.js +2 -1
- package/dist/npm/radiobutton/RadioButton.d.ts +1 -1
- package/dist/npm/radiobutton/RadioButton.js +15 -12
- package/dist/npm/radiobutton/RadioGroup.d.ts +1 -1
- package/dist/npm/radiobutton/RadioGroup.js +12 -11
- package/dist/npm/range-slider/RangeSlider.d.ts +1 -1
- package/dist/npm/range-slider/RangeSlider.js +18 -17
- package/dist/npm/range-slider/range-raducer.js +15 -13
- package/dist/npm/rating/Rating.d.ts +1 -1
- package/dist/npm/rating/Rating.js +37 -33
- package/dist/npm/rating/RatingItem.d.ts +1 -1
- package/dist/npm/rating/RatingItem.js +3 -2
- package/dist/npm/rating/models/index.d.ts +4 -0
- package/dist/npm/rating/rating-reducer.js +7 -5
- package/dist/npm/rating/utils/index.d.ts +1 -1
- package/dist/npm/rating/utils/index.js +18 -11
- package/dist/npm/slider/Slider.d.ts +3 -3
- package/dist/npm/slider/Slider.js +15 -10
- package/dist/npm/slider/SliderLabel.js +6 -4
- package/dist/npm/switch/Switch.d.ts +13 -13
- package/dist/npm/switch/Switch.js +29 -23
- package/dist/npm/textarea/TextArea.d.ts +1 -1
- package/dist/npm/textarea/TextArea.js +18 -15
- package/dist/npm/utils.js +11 -1
- package/dist/systemjs/kendo-react-inputs.js +1 -1
- package/package.json +15 -15
- package/dist/es/switch/util.d.ts +0 -8
- package/dist/es/switch/util.js +0 -46
- package/dist/npm/switch/util.d.ts +0 -8
- package/dist/npm/switch/util.js +0 -48
|
@@ -11,6 +11,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.RadioGroup = exports.RadioGroupPropsContext = void 0;
|
|
14
15
|
var React = require("react");
|
|
15
16
|
var PropTypes = require("prop-types");
|
|
16
17
|
var RadioButton_1 = require("./RadioButton");
|
|
@@ -23,7 +24,7 @@ var package_metadata_1 = require("../package-metadata");
|
|
|
23
24
|
*
|
|
24
25
|
* For more information, refer to the [Inputs Props Context]({% slug props-context_inputs %}) article.
|
|
25
26
|
*/
|
|
26
|
-
exports.RadioGroupPropsContext = kendo_react_common_1.createPropsContext();
|
|
27
|
+
exports.RadioGroupPropsContext = (0, kendo_react_common_1.createPropsContext)();
|
|
27
28
|
/**
|
|
28
29
|
* Represents the [KendoReact RadioGroup component]({% slug overview_radiogroup %}).
|
|
29
30
|
*
|
|
@@ -31,13 +32,13 @@ exports.RadioGroupPropsContext = kendo_react_common_1.createPropsContext();
|
|
|
31
32
|
* Obtaining the `ref` returns an object of type [RadioGroupHandle]({% slug api_inputs_radiogrouphandle %}).
|
|
32
33
|
*/
|
|
33
34
|
exports.RadioGroup = React.forwardRef(function (directProps, target) {
|
|
34
|
-
kendo_react_common_2.validatePackage(package_metadata_1.packageMetadata);
|
|
35
|
-
var props = kendo_react_common_1.usePropsContext(exports.RadioGroupPropsContext, directProps);
|
|
35
|
+
(0, kendo_react_common_2.validatePackage)(package_metadata_1.packageMetadata);
|
|
36
|
+
var props = (0, kendo_react_common_1.usePropsContext)(exports.RadioGroupPropsContext, directProps);
|
|
36
37
|
var ariaLabelledBy = props.ariaLabelledBy, ariaDescribedBy = props.ariaDescribedBy, className = props.className, data = props.data, defaultValue = props.defaultValue, disabled = props.disabled, name = props.name, labelPlacement = props.labelPlacement, layout = props.layout, style = props.style, value = props.value, valid = props.valid, _a = props.item, Item = _a === void 0 ? defaultProps.item : _a, onChange = props.onChange, onFocus = props.onFocus;
|
|
37
38
|
var elementRef = React.useRef(null);
|
|
38
39
|
var focusElement = React.useCallback(function () {
|
|
39
40
|
if (elementRef.current) {
|
|
40
|
-
kendo_react_common_1.focusFirstFocusableChild(elementRef.current);
|
|
41
|
+
(0, kendo_react_common_1.focusFirstFocusableChild)(elementRef.current);
|
|
41
42
|
}
|
|
42
43
|
}, []);
|
|
43
44
|
var getImperativeHandle = React.useCallback(function () { return ({
|
|
@@ -54,29 +55,29 @@ exports.RadioGroup = React.forwardRef(function (directProps, target) {
|
|
|
54
55
|
setStateChecked(currentValue);
|
|
55
56
|
}
|
|
56
57
|
if (onChange && !disabled) {
|
|
57
|
-
kendo_react_common_1.dispatchEvent(onChange, event.syntheticEvent, getImperativeHandle(), { value: currentValue });
|
|
58
|
+
(0, kendo_react_common_1.dispatchEvent)(onChange, event.syntheticEvent, getImperativeHandle(), { value: currentValue });
|
|
58
59
|
}
|
|
59
60
|
}, [setStateChecked, onChange, disabled]);
|
|
60
61
|
var handleFocus = React.useCallback(function (event) {
|
|
61
62
|
if (onFocus && !disabled) {
|
|
62
|
-
kendo_react_common_1.dispatchEvent(onFocus, event.syntheticEvent, getImperativeHandle(), undefined);
|
|
63
|
+
(0, kendo_react_common_1.dispatchEvent)(onFocus, event.syntheticEvent, getImperativeHandle(), undefined);
|
|
63
64
|
}
|
|
64
65
|
}, [onFocus, disabled]);
|
|
65
|
-
var radioGroupName = React.useMemo(function () { return kendo_react_common_1.guid(); }, []);
|
|
66
|
-
var radioGroupClasses = kendo_react_common_1.classNames('k-radio-list', {
|
|
66
|
+
var radioGroupName = React.useMemo(function () { return (0, kendo_react_common_1.guid)(); }, []);
|
|
67
|
+
var radioGroupClasses = (0, kendo_react_common_1.classNames)('k-radio-list', {
|
|
67
68
|
'k-list-horizontal': layout === 'horizontal',
|
|
68
69
|
'k-list-vertical': layout === 'vertical' || layout === undefined
|
|
69
70
|
}, className);
|
|
70
|
-
var dir = kendo_react_common_1.useRtl(elementRef, props.dir);
|
|
71
|
+
var dir = (0, kendo_react_common_1.useRtl)(elementRef, props.dir);
|
|
71
72
|
var radioOptions = (data && data.map(function (option, index) {
|
|
72
73
|
var isCurrentlyChecked = checkedRadioValue === option.value;
|
|
73
74
|
var noOptionChecked = checkedRadioValue === null || checkedRadioValue === undefined;
|
|
74
|
-
var radioButtonProps = __assign({}, option, { valid: valid, checked: isCurrentlyChecked, disabled: (option.disabled || disabled) ? true : false, labelPlacement: option.labelPlacement ? option.labelPlacement : labelPlacement, tabIndex: option.tabIndex
|
|
75
|
+
var radioButtonProps = __assign(__assign({}, option), { valid: valid, checked: isCurrentlyChecked, disabled: (option.disabled || disabled) ? true : false, labelPlacement: option.labelPlacement ? option.labelPlacement : labelPlacement, tabIndex: option.tabIndex
|
|
75
76
|
? option.tabIndex
|
|
76
77
|
: (noOptionChecked && index === 0) || isCurrentlyChecked
|
|
77
78
|
? 0
|
|
78
79
|
: -1, index: index, name: name || radioGroupName, onChange: handleChange, onFocus: handleFocus });
|
|
79
|
-
return (React.createElement(Item, { className: kendo_react_common_1.classNames('k-radio-item', { 'k-disabled': radioButtonProps.disabled || disabled }), key: index, role: 'radio' },
|
|
80
|
+
return (React.createElement(Item, { className: (0, kendo_react_common_1.classNames)('k-radio-item', { 'k-disabled': radioButtonProps.disabled || disabled }), key: index, role: 'radio' },
|
|
80
81
|
React.createElement(RadioButton_1.RadioButton, __assign({}, radioButtonProps))));
|
|
81
82
|
}));
|
|
82
83
|
return (React.createElement("ul", { role: "radiogroup", className: radioGroupClasses, ref: elementRef, dir: dir, style: style, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy }, radioOptions));
|
|
@@ -135,4 +135,4 @@ export declare const RangeSliderPropsContext: React.Context<(p: RangeSliderProps
|
|
|
135
135
|
* Accepts properties of type [RangeSliderProps]({% slug api_inputs_rangesliderprops %}).
|
|
136
136
|
* Obtaining the `ref` returns an object of type [RangeSliderHandle]({% slug api_inputs_rangesliderhandle %}).
|
|
137
137
|
*/
|
|
138
|
-
export declare const RangeSlider: React.ForwardRefExoticComponent<RangeSliderProps & React.RefAttributes<RangeSliderHandle>>;
|
|
138
|
+
export declare const RangeSlider: React.ForwardRefExoticComponent<RangeSliderProps & React.RefAttributes<RangeSliderHandle | null>>;
|
|
@@ -11,6 +11,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.RangeSlider = exports.RangeSliderPropsContext = void 0;
|
|
14
15
|
var React = require("react");
|
|
15
16
|
var PropTypes = require("prop-types");
|
|
16
17
|
var kendo_react_common_1 = require("@progress/kendo-react-common");
|
|
@@ -25,7 +26,7 @@ var package_metadata_1 = require("../package-metadata");
|
|
|
25
26
|
var useRange = function (defaultValue, args, callback) {
|
|
26
27
|
var _a = React.useState(defaultValue), state = _a[0], setState = _a[1];
|
|
27
28
|
var handleDispatchAction = React.useCallback(function (action) {
|
|
28
|
-
var newState = range_raducer_1.rangeReducer(args.state || state, __assign({}, action, args));
|
|
29
|
+
var newState = (0, range_raducer_1.rangeReducer)(args.state || state, __assign(__assign({}, action), args));
|
|
29
30
|
if (callback) {
|
|
30
31
|
callback(newState, action.event);
|
|
31
32
|
}
|
|
@@ -39,7 +40,7 @@ var useRange = function (defaultValue, args, callback) {
|
|
|
39
40
|
*
|
|
40
41
|
* For more information, refer to the [Inputs Props Context]({% slug props-context_inputs %}) article.
|
|
41
42
|
*/
|
|
42
|
-
exports.RangeSliderPropsContext = kendo_react_common_1.createPropsContext();
|
|
43
|
+
exports.RangeSliderPropsContext = (0, kendo_react_common_1.createPropsContext)();
|
|
43
44
|
/**
|
|
44
45
|
* Represents the [KendoReact RangeSlider component]({% slug overview_rangeslider %}).
|
|
45
46
|
*
|
|
@@ -48,8 +49,8 @@ exports.RangeSliderPropsContext = kendo_react_common_1.createPropsContext();
|
|
|
48
49
|
*/
|
|
49
50
|
exports.RangeSlider = React.forwardRef(function (directProps, ref) {
|
|
50
51
|
var _a, _b;
|
|
51
|
-
kendo_react_common_2.validatePackage(package_metadata_1.packageMetadata);
|
|
52
|
-
var props = kendo_react_common_1.usePropsContext(exports.RangeSliderPropsContext, directProps);
|
|
52
|
+
(0, kendo_react_common_2.validatePackage)(package_metadata_1.packageMetadata);
|
|
53
|
+
var props = (0, kendo_react_common_1.usePropsContext)(exports.RangeSliderPropsContext, directProps);
|
|
53
54
|
var target = React.useRef(null);
|
|
54
55
|
var sliderRef = React.useRef(null);
|
|
55
56
|
var sliderSelectionRef = React.useRef(null);
|
|
@@ -69,7 +70,7 @@ exports.RangeSlider = React.forwardRef(function (directProps, ref) {
|
|
|
69
70
|
var min = React.useMemo(function () { return props.min; }, [props.min]);
|
|
70
71
|
var max = React.useMemo(function () { return props.max; }, [props.max]);
|
|
71
72
|
var step = React.useMemo(function () { return props.step !== undefined ? props.step : defaultProps.step; }, [props.step, defaultProps.step]);
|
|
72
|
-
var dir = kendo_react_common_1.useDir(sliderRef, props.dir);
|
|
73
|
+
var dir = (0, kendo_react_common_1.useDir)(sliderRef, props.dir);
|
|
73
74
|
var handleChange = function (newValue, event) {
|
|
74
75
|
if (props.onChange && target.current) {
|
|
75
76
|
props.onChange.call(undefined, {
|
|
@@ -95,7 +96,7 @@ exports.RangeSlider = React.forwardRef(function (directProps, ref) {
|
|
|
95
96
|
var trackStyles = React.useMemo(function () { return props.vertical
|
|
96
97
|
? { marginTop: '0.5rem', marginBottom: '0.5rem' }
|
|
97
98
|
: { marginLeft: '0.5rem', marginRight: '0.5rem' }; }, [props.vertical]);
|
|
98
|
-
var localization = kendo_react_intl_1.useLocalization();
|
|
99
|
+
var localization = (0, kendo_react_intl_1.useLocalization)();
|
|
99
100
|
var calcNewDistance = React.useCallback(function (event) {
|
|
100
101
|
if (!sliderTrackWrapRef.current) {
|
|
101
102
|
return;
|
|
@@ -213,8 +214,8 @@ exports.RangeSlider = React.forwardRef(function (directProps, ref) {
|
|
|
213
214
|
dispatchStateValue({ type: action, payload: payload, event: event });
|
|
214
215
|
setCurrentDrag('');
|
|
215
216
|
};
|
|
216
|
-
kendo_react_common_1.useDraggable(sliderTrackWrapRef, { onPress: handleTrackPress, onDrag: handleTrackDrag, onRelease: handleTrackRelease });
|
|
217
|
-
return (React.createElement("div", { role: "slider", id: props.id, style: props.style, ref: sliderRef, dir: dir, className: kendo_react_common_1.classNames('k-widget k-slider', {
|
|
217
|
+
(0, kendo_react_common_1.useDraggable)(sliderTrackWrapRef, { onPress: handleTrackPress, onDrag: handleTrackDrag, onRelease: handleTrackRelease });
|
|
218
|
+
return (React.createElement("div", { role: "slider", id: props.id, style: props.style, ref: sliderRef, dir: dir, className: (0, kendo_react_common_1.classNames)('k-widget k-slider', {
|
|
218
219
|
'k-rtl': dir === 'rtl',
|
|
219
220
|
'k-disabled': props.disabled,
|
|
220
221
|
'k-slider-vertical': props.vertical,
|
|
@@ -231,17 +232,17 @@ exports.RangeSlider = React.forwardRef(function (directProps, ref) {
|
|
|
231
232
|
React.createElement("div", { ref: sliderTrackRef, className: "k-slider-track", style: props.vertical
|
|
232
233
|
? { bottom: 0, height: '100%' }
|
|
233
234
|
: (_a = {}, _a[dir === 'rtl' ? 'right' : 'left'] = 0, _a.width = '100%', _a) },
|
|
234
|
-
(percentStart !== null && percentEnd !== null) && React.createElement("div", { "data-selection": true, ref: sliderSelectionRef, title: value.start
|
|
235
|
+
(percentStart !== null && percentEnd !== null) && React.createElement("div", { "data-selection": true, ref: sliderSelectionRef, title: "".concat(value.start, " - ").concat(value.end), className: "k-slider-selection", style: props.vertical
|
|
235
236
|
? { height: (percentEnd - percentStart) + '%', bottom: percentStart + '%' }
|
|
236
237
|
: (_b = {},
|
|
237
238
|
_b[dir === 'rtl' ? 'right' : 'left'] = percentStart + '%',
|
|
238
239
|
_b.width = (percentEnd - percentStart) + '%',
|
|
239
240
|
_b) }),
|
|
240
|
-
React.createElement("a", { ref: startHandle, role: "slider", tabIndex: kendo_react_common_1.getTabIndex(props.startTabIndex, props.disabled, undefined), "aria-valuemin": min, "aria-valuemax": Math.max(max, value.end), "aria-valuenow": value.start, "aria-disabled": props.disabled ? 'true' : undefined, className: "k-draghandle", title: localization.toLanguageString(messages_1.sliderDragTitle, messages_1.messages[messages_1.sliderDragTitle]), style: props.vertical
|
|
241
|
+
React.createElement("a", { ref: startHandle, role: "slider", tabIndex: (0, kendo_react_common_1.getTabIndex)(props.startTabIndex, props.disabled, undefined), "aria-valuemin": min, "aria-valuemax": Math.max(max, value.end), "aria-valuenow": value.start, "aria-disabled": props.disabled ? 'true' : undefined, className: "k-draghandle", title: localization.toLanguageString(messages_1.sliderDragTitle, messages_1.messages[messages_1.sliderDragTitle]), style: props.vertical
|
|
241
242
|
? { bottom: 'calc(' + percentStart + '%)', zIndex: 1 }
|
|
242
243
|
: dir === 'rtl' ? { right: 'calc(' + percentStart + '% - 13px)', zIndex: 1 }
|
|
243
244
|
: { left: 'calc(' + percentStart + '%)', zIndex: 1 }, onKeyDown: handleStartKeyDown }),
|
|
244
|
-
React.createElement("a", { ref: endHandle, role: "slider", tabIndex: kendo_react_common_1.getTabIndex(props.endTabIndex, props.disabled, undefined), "aria-valuemin": Math.min(min, value.start), "aria-valuemax": max, "aria-valuenow": value.end, "aria-disabled": props.disabled ? 'true' : undefined, className: "k-draghandle", title: localization.toLanguageString(messages_1.sliderDragTitle, messages_1.messages[messages_1.sliderDragTitle]), style: props.vertical
|
|
245
|
+
React.createElement("a", { ref: endHandle, role: "slider", tabIndex: (0, kendo_react_common_1.getTabIndex)(props.endTabIndex, props.disabled, undefined), "aria-valuemin": Math.min(min, value.start), "aria-valuemax": max, "aria-valuenow": value.end, "aria-disabled": props.disabled ? 'true' : undefined, className: "k-draghandle", title: localization.toLanguageString(messages_1.sliderDragTitle, messages_1.messages[messages_1.sliderDragTitle]), style: props.vertical
|
|
245
246
|
? { bottom: 'calc(' + percentEnd + '%)', zIndex: 1 }
|
|
246
247
|
: dir === 'rtl' ? { right: 'calc(' + percentEnd + '% - 13px)', zIndex: 1 }
|
|
247
248
|
: { left: 'calc(' + percentEnd + '%)', zIndex: 1 }, onKeyDown: handleEndKeyDown })))));
|
|
@@ -254,7 +255,7 @@ var propTypes = {
|
|
|
254
255
|
var min = props.min;
|
|
255
256
|
var max = props.max;
|
|
256
257
|
if (start > end || start > max || start < min || end > max || end < min || end < start) {
|
|
257
|
-
return new Error("Invalid prop + "
|
|
258
|
+
return new Error("Invalid prop + ".concat(propName, " supplied to ").concat(componentName, ".\n The { start, end } value must be between the min & max value and { start, end } must be start < end.\n "));
|
|
258
259
|
}
|
|
259
260
|
}
|
|
260
261
|
return null;
|
|
@@ -266,7 +267,7 @@ var propTypes = {
|
|
|
266
267
|
var min = props.min;
|
|
267
268
|
var max = props.max;
|
|
268
269
|
if (start > end || start > max || start < min || end > max || end < min || end < start) {
|
|
269
|
-
return new Error("Invalid prop + "
|
|
270
|
+
return new Error("Invalid prop + ".concat(propName, " supplied to ").concat(componentName, ".\n The { start, end } value must be between the min & max value and { start, end } must be start < end.\n "));
|
|
270
271
|
}
|
|
271
272
|
}
|
|
272
273
|
return null;
|
|
@@ -278,10 +279,10 @@ var propTypes = {
|
|
|
278
279
|
var min = props.min;
|
|
279
280
|
var max = props.max;
|
|
280
281
|
if (min === undefined) {
|
|
281
|
-
return new Error("Invalid prop + "
|
|
282
|
+
return new Error("Invalid prop + ".concat(propName, " supplied to ").concat(componentName, ".\n ").concat(propName, " value can not be undefined.\n "));
|
|
282
283
|
}
|
|
283
284
|
if (prop && min >= max) {
|
|
284
|
-
return new Error("Invalid prop + "
|
|
285
|
+
return new Error("Invalid prop + ".concat(propName, " supplied to ").concat(componentName, ".\n ").concat(propName, " value can not be equal to or bigger than the max value.\n "));
|
|
285
286
|
}
|
|
286
287
|
return null;
|
|
287
288
|
},
|
|
@@ -290,10 +291,10 @@ var propTypes = {
|
|
|
290
291
|
var min = props.min;
|
|
291
292
|
var max = props.max;
|
|
292
293
|
if (max === undefined) {
|
|
293
|
-
return new Error("Invalid prop + "
|
|
294
|
+
return new Error("Invalid prop + ".concat(propName, " supplied to ").concat(componentName, ".\n ").concat(propName, " value can not be undefined.\n "));
|
|
294
295
|
}
|
|
295
296
|
if (prop && max <= min) {
|
|
296
|
-
return new Error("Invalid prop + "
|
|
297
|
+
return new Error("Invalid prop + ".concat(propName, " supplied to ").concat(componentName, ".\n ").concat(propName, " value can not be equal to or smaller than the min value.\n "));
|
|
297
298
|
}
|
|
298
299
|
return null;
|
|
299
300
|
},
|
|
@@ -11,6 +11,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.rangeReducer = exports.RANGE_ACTION = void 0;
|
|
14
15
|
/**
|
|
15
16
|
* @hidden
|
|
16
17
|
*/
|
|
@@ -26,7 +27,7 @@ var RANGE_ACTION;
|
|
|
26
27
|
/**
|
|
27
28
|
* @hidden
|
|
28
29
|
*/
|
|
29
|
-
|
|
30
|
+
var rangeReducer = function (state, action) {
|
|
30
31
|
var newState;
|
|
31
32
|
var newValue;
|
|
32
33
|
switch (action.type) {
|
|
@@ -50,18 +51,18 @@ exports.rangeReducer = function (state, action) {
|
|
|
50
51
|
break;
|
|
51
52
|
case RANGE_ACTION.min:
|
|
52
53
|
if (action.key === 'start') {
|
|
53
|
-
newState = __assign({}, state, { start: action.min });
|
|
54
|
+
newState = __assign(__assign({}, state), { start: action.min });
|
|
54
55
|
}
|
|
55
56
|
else {
|
|
56
|
-
newState = __assign({}, state, { end: Math.max(action.min, state.start) });
|
|
57
|
+
newState = __assign(__assign({}, state), { end: Math.max(action.min, state.start) });
|
|
57
58
|
}
|
|
58
59
|
break;
|
|
59
60
|
case RANGE_ACTION.max:
|
|
60
61
|
if (action.key === 'start') {
|
|
61
|
-
newState = __assign({}, state, { start: Math.min(action.max, state.end) });
|
|
62
|
+
newState = __assign(__assign({}, state), { start: Math.min(action.max, state.end) });
|
|
62
63
|
}
|
|
63
64
|
else {
|
|
64
|
-
newState = __assign({}, state, { end: action.max });
|
|
65
|
+
newState = __assign(__assign({}, state), { end: action.max });
|
|
65
66
|
}
|
|
66
67
|
break;
|
|
67
68
|
case RANGE_ACTION.increase:
|
|
@@ -71,18 +72,18 @@ exports.rangeReducer = function (state, action) {
|
|
|
71
72
|
newValue = state[action.key] + action.step;
|
|
72
73
|
if (action.key === 'start') {
|
|
73
74
|
if (newValue < action.min) {
|
|
74
|
-
newState = __assign({}, state, { start: action.min });
|
|
75
|
+
newState = __assign(__assign({}, state), { start: action.min });
|
|
75
76
|
}
|
|
76
77
|
else {
|
|
77
|
-
newState = __assign({}, state, { start: Math.min(newValue, state.end) });
|
|
78
|
+
newState = __assign(__assign({}, state), { start: Math.min(newValue, state.end) });
|
|
78
79
|
}
|
|
79
80
|
}
|
|
80
81
|
else {
|
|
81
82
|
if (newValue > action.max) {
|
|
82
|
-
newState = __assign({}, state, { end: action.max });
|
|
83
|
+
newState = __assign(__assign({}, state), { end: action.max });
|
|
83
84
|
}
|
|
84
85
|
else {
|
|
85
|
-
newState = __assign({}, state, { end: Math.max(newValue, state.start) });
|
|
86
|
+
newState = __assign(__assign({}, state), { end: Math.max(newValue, state.start) });
|
|
86
87
|
}
|
|
87
88
|
}
|
|
88
89
|
break;
|
|
@@ -93,18 +94,18 @@ exports.rangeReducer = function (state, action) {
|
|
|
93
94
|
newValue = state[action.key] - action.step;
|
|
94
95
|
if (action.key === 'start') {
|
|
95
96
|
if (newValue < action.min) {
|
|
96
|
-
newState = __assign({}, state, { start: action.min });
|
|
97
|
+
newState = __assign(__assign({}, state), { start: action.min });
|
|
97
98
|
}
|
|
98
99
|
else {
|
|
99
|
-
newState = __assign({}, state, { start: Math.min(newValue, state.end) });
|
|
100
|
+
newState = __assign(__assign({}, state), { start: Math.min(newValue, state.end) });
|
|
100
101
|
}
|
|
101
102
|
}
|
|
102
103
|
else {
|
|
103
104
|
if (newValue > action.max) {
|
|
104
|
-
newState = __assign({}, state, { end: action.max });
|
|
105
|
+
newState = __assign(__assign({}, state), { end: action.max });
|
|
105
106
|
}
|
|
106
107
|
else {
|
|
107
|
-
newState = __assign({}, state, { end: Math.max(newValue, state.start) });
|
|
108
|
+
newState = __assign(__assign({}, state), { end: Math.max(newValue, state.start) });
|
|
108
109
|
}
|
|
109
110
|
}
|
|
110
111
|
break;
|
|
@@ -114,3 +115,4 @@ exports.rangeReducer = function (state, action) {
|
|
|
114
115
|
}
|
|
115
116
|
return newState;
|
|
116
117
|
};
|
|
118
|
+
exports.rangeReducer = rangeReducer;
|
|
@@ -155,4 +155,4 @@ export declare const RatingPropsContext: React.Context<(p: RatingProps) => Ratin
|
|
|
155
155
|
* Accepts properties of type [RatingProps]({% slug api_inputs_ratingprops %}).
|
|
156
156
|
* Obtaining the `ref` returns an object of type [RatingHandle]({% slug api_inputs_ratinghandle %}).
|
|
157
157
|
*/
|
|
158
|
-
export declare const Rating: React.ForwardRefExoticComponent<RatingProps & React.RefAttributes<RatingHandle>>;
|
|
158
|
+
export declare const Rating: React.ForwardRefExoticComponent<RatingProps & React.RefAttributes<RatingHandle | null>>;
|
|
@@ -11,6 +11,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.Rating = exports.RatingPropsContext = void 0;
|
|
14
15
|
var React = require("react");
|
|
15
16
|
var PropTypes = require("prop-types");
|
|
16
17
|
var kendo_react_common_1 = require("@progress/kendo-react-common");
|
|
@@ -23,7 +24,7 @@ var utils_1 = require("./utils");
|
|
|
23
24
|
var useRating = function (defaultValue, args, callback) {
|
|
24
25
|
var _a = React.useState(defaultValue), state = _a[0], setState = _a[1];
|
|
25
26
|
var handleDispatchAction = function (action) {
|
|
26
|
-
var newState = rating_reducer_1.ratingReducer(args.state || state, __assign({}, action, args));
|
|
27
|
+
var newState = (0, rating_reducer_1.ratingReducer)(args.state || state, __assign(__assign({}, action), args));
|
|
27
28
|
if (callback) {
|
|
28
29
|
callback(newState, action.event);
|
|
29
30
|
}
|
|
@@ -37,7 +38,7 @@ var useRating = function (defaultValue, args, callback) {
|
|
|
37
38
|
*
|
|
38
39
|
* For more information, refer to the [Inputs Props Context]({% slug props-context_inputs %}) article.
|
|
39
40
|
*/
|
|
40
|
-
exports.RatingPropsContext = kendo_react_common_1.createPropsContext();
|
|
41
|
+
exports.RatingPropsContext = (0, kendo_react_common_1.createPropsContext)();
|
|
41
42
|
/**
|
|
42
43
|
* Represents the [KendoReact Rating component]({% slug overview_rating %}).
|
|
43
44
|
*
|
|
@@ -46,10 +47,10 @@ exports.RatingPropsContext = kendo_react_common_1.createPropsContext();
|
|
|
46
47
|
*/
|
|
47
48
|
exports.Rating = React.forwardRef(function (directProps, ref) {
|
|
48
49
|
var _a, _b, _c, _d;
|
|
49
|
-
var props = kendo_react_common_1.usePropsContext(exports.RatingPropsContext, directProps);
|
|
50
|
+
var props = (0, kendo_react_common_1.usePropsContext)(exports.RatingPropsContext, directProps);
|
|
50
51
|
var target = React.useRef(null);
|
|
51
52
|
var ratingRef = React.useRef(null);
|
|
52
|
-
var dir = kendo_react_common_1.useDir(ratingRef, props.dir);
|
|
53
|
+
var dir = (0, kendo_react_common_1.useDir)(ratingRef, props.dir);
|
|
53
54
|
React.useImperativeHandle(target, function () { return ({
|
|
54
55
|
element: ratingRef.current,
|
|
55
56
|
props: props
|
|
@@ -94,19 +95,20 @@ exports.Rating = React.forwardRef(function (directProps, ref) {
|
|
|
94
95
|
}
|
|
95
96
|
if (precision === 'half') {
|
|
96
97
|
var rect = event.target.element.getBoundingClientRect();
|
|
97
|
-
var isFirstHalf = utils_1.calcIsFirstHalf(dir ? dir : 'ltr', rect, event.syntheticEvent.clientX);
|
|
98
|
-
var payload = isFirstHalf ? utils_1.toRound(event.target.value - (step / 2), base) : event.target.value;
|
|
98
|
+
var isFirstHalf = (0, utils_1.calcIsFirstHalf)(dir ? dir : 'ltr', rect, event.syntheticEvent.clientX);
|
|
99
|
+
var payload = isFirstHalf ? (0, utils_1.toRound)(event.target.value - (step / 2), base) : event.target.value;
|
|
99
100
|
dispatchStateValue({ type: rating_reducer_1.RATING_ACTION.select, payload: payload, event: event.syntheticEvent });
|
|
100
101
|
}
|
|
101
102
|
else {
|
|
102
103
|
dispatchStateValue({ type: rating_reducer_1.RATING_ACTION.select, payload: event.target.value, event: event.syntheticEvent });
|
|
103
104
|
}
|
|
104
105
|
if (props.onClick) {
|
|
105
|
-
|
|
106
|
+
var ev = {
|
|
106
107
|
value: value,
|
|
107
108
|
target: target.current,
|
|
108
109
|
syntheticEvent: event.syntheticEvent
|
|
109
|
-
}
|
|
110
|
+
};
|
|
111
|
+
props.onClick.call(undefined, ev);
|
|
110
112
|
}
|
|
111
113
|
}, [props.onClick, dispatchStateValue, value]);
|
|
112
114
|
var handleKeyDown = React.useCallback(function (syntheticEvent) {
|
|
@@ -157,18 +159,20 @@ exports.Rating = React.forwardRef(function (directProps, ref) {
|
|
|
157
159
|
}, [props.onKeyDown, dispatchStateValue, value]);
|
|
158
160
|
var handleFocus = React.useCallback(function (syntheticEvent) {
|
|
159
161
|
if (props.onFocus) {
|
|
160
|
-
|
|
162
|
+
var ev = {
|
|
161
163
|
target: target.current,
|
|
162
164
|
syntheticEvent: syntheticEvent
|
|
163
|
-
}
|
|
165
|
+
};
|
|
166
|
+
props.onFocus.call(undefined, ev);
|
|
164
167
|
}
|
|
165
168
|
}, [props.onFocus]);
|
|
166
169
|
var handleBlur = React.useCallback(function (syntheticEvent) {
|
|
167
170
|
if (props.onBlur) {
|
|
168
|
-
|
|
171
|
+
var ev = {
|
|
169
172
|
target: target.current,
|
|
170
173
|
syntheticEvent: syntheticEvent
|
|
171
|
-
}
|
|
174
|
+
};
|
|
175
|
+
props.onBlur.call(undefined, ev);
|
|
172
176
|
}
|
|
173
177
|
}, [props.onBlur]);
|
|
174
178
|
var handleItemMouseMove = React.useCallback(function (event) {
|
|
@@ -177,7 +181,7 @@ exports.Rating = React.forwardRef(function (directProps, ref) {
|
|
|
177
181
|
}
|
|
178
182
|
if (precision === 'half') {
|
|
179
183
|
var rect = event.target.element.getBoundingClientRect();
|
|
180
|
-
var isFirstHalf = utils_1.calcIsFirstHalf(dir ? dir : 'ltr', rect, event.syntheticEvent.clientX);
|
|
184
|
+
var isFirstHalf = (0, utils_1.calcIsFirstHalf)(dir ? dir : 'ltr', rect, event.syntheticEvent.clientX);
|
|
181
185
|
var payload = isFirstHalf ? event.target.value - (step / 2) : event.target.value;
|
|
182
186
|
dispatchStateHover({ type: rating_reducer_1.RATING_ACTION.select, payload: payload, event: event.syntheticEvent });
|
|
183
187
|
}
|
|
@@ -189,38 +193,38 @@ exports.Rating = React.forwardRef(function (directProps, ref) {
|
|
|
189
193
|
dispatchStateHover({ type: rating_reducer_1.RATING_ACTION.reset, event: event.syntheticEvent });
|
|
190
194
|
}, []);
|
|
191
195
|
var items = [];
|
|
192
|
-
var remainder = utils_1.getRemainder(utils_1.toRound(max - min, base), step);
|
|
193
|
-
for (var i = min; i <= max; i = utils_1.toRound(i + step, base)) {
|
|
194
|
-
var itemValue = utils_1.toRound(i + remainder, base);
|
|
196
|
+
var remainder = (0, utils_1.getRemainder)((0, utils_1.toRound)(max - min, base), step);
|
|
197
|
+
for (var i = min; i <= max; i = (0, utils_1.toRound)(i + step, base)) {
|
|
198
|
+
var itemValue = (0, utils_1.toRound)(i + remainder, base);
|
|
195
199
|
var half = precision === 'half'
|
|
196
|
-
? utils_1.isHalf(itemValue, hoveredValue !== null ? hoveredValue : (value !== null ? value : 0), step)
|
|
200
|
+
? (0, utils_1.isHalf)(itemValue, hoveredValue !== null ? hoveredValue : (value !== null ? value : 0), step)
|
|
197
201
|
: false;
|
|
198
|
-
var selectedValue = utils_1.isSelected(itemValue, value, step, selection);
|
|
199
|
-
var selected = utils_1.isSelected(itemValue, hoveredValue !== null ? hoveredValue : value, step, selection);
|
|
200
|
-
var hovered = utils_1.isSelected(itemValue, hoveredValue, step, selection);
|
|
201
|
-
items.push(React.createElement(Item, { key: itemValue, value: itemValue, dir: dir, title: String(half ? utils_1.toRound(itemValue - (step / 2), base) : itemValue), icon: props.icon, half: half, selected: selectedValue || selected, hovered: hovered, onClick: handleItemClick, onMouseMove: handleItemMouseMove, onMouseLeave: handleMouseLeave },
|
|
202
|
+
var selectedValue = (0, utils_1.isSelected)(itemValue, value, step, selection);
|
|
203
|
+
var selected = (0, utils_1.isSelected)(itemValue, hoveredValue !== null ? hoveredValue : value, step, selection);
|
|
204
|
+
var hovered = (0, utils_1.isSelected)(itemValue, hoveredValue, step, selection);
|
|
205
|
+
items.push(React.createElement(Item, { key: itemValue, value: itemValue, dir: dir, title: String(half ? (0, utils_1.toRound)(itemValue - (step / 2), base) : itemValue), icon: props.icon, half: half, selected: selectedValue || selected, hovered: hovered, onClick: handleItemClick, onMouseMove: handleItemMouseMove, onMouseLeave: handleMouseLeave },
|
|
202
206
|
half && (React.createElement("span", { className: 'k-rating-precision-complement', style: (_a = { width: '12px' }, _a[dir === 'rtl' ? 'right' : 'left'] = '50%', _a) },
|
|
203
|
-
React.createElement("span", { className: kendo_react_common_1.classNames('k-icon', (_b = {
|
|
207
|
+
React.createElement("span", { className: (0, kendo_react_common_1.classNames)('k-icon', (_b = {
|
|
204
208
|
'k-i-star-outline': !props.icon
|
|
205
209
|
},
|
|
206
|
-
_b[props.icon
|
|
210
|
+
_b["".concat(props.icon, "-outline")] = props.icon,
|
|
207
211
|
_b)) }))),
|
|
208
212
|
half && (React.createElement("span", { className: 'k-rating-precision-part', style: { width: '12px' } },
|
|
209
|
-
React.createElement("span", { className: kendo_react_common_1.classNames('k-icon', (_c = {
|
|
213
|
+
React.createElement("span", { className: (0, kendo_react_common_1.classNames)('k-icon', (_c = {
|
|
210
214
|
'k-i-star': !props.icon
|
|
211
215
|
},
|
|
212
|
-
_c[""
|
|
216
|
+
_c["".concat(props.icon)] = props.icon,
|
|
213
217
|
_c)) }))),
|
|
214
218
|
half && (React.createElement("span", { style: { width: '24px', height: '24px', display: 'block' } })),
|
|
215
|
-
!half && (React.createElement("span", { className: kendo_react_common_1.classNames('k-icon', (_d = {
|
|
219
|
+
!half && (React.createElement("span", { className: (0, kendo_react_common_1.classNames)('k-icon', (_d = {
|
|
216
220
|
'k-i-star': !props.icon && (hovered || (selected && !hovered)),
|
|
217
221
|
'k-i-star-outline': !props.icon && (!hovered)
|
|
218
222
|
},
|
|
219
|
-
_d[""
|
|
220
|
-
_d[props.icon
|
|
223
|
+
_d["".concat(props.icon)] = props.icon && (hovered || (selected && !hovered)),
|
|
224
|
+
_d["".concat(props.icon, "-outline")] = props.icon && (!hovered),
|
|
221
225
|
_d)) }))));
|
|
222
226
|
}
|
|
223
|
-
return (React.createElement("span", { id: props.id, style: props.style, ref: ratingRef, role: "slider", dir: dir, tabIndex: kendo_react_common_1.getTabIndex(props.tabIndex, props.disabled, undefined), className: kendo_react_common_1.classNames('k-rating k-widget', {
|
|
227
|
+
return (React.createElement("span", { id: props.id, style: props.style, ref: ratingRef, role: "slider", dir: dir, tabIndex: (0, kendo_react_common_1.getTabIndex)(props.tabIndex, props.disabled, undefined), className: (0, kendo_react_common_1.classNames)('k-rating k-widget', {
|
|
224
228
|
'k-rtl': dir === 'rtl',
|
|
225
229
|
'k-state-readonly': readonly,
|
|
226
230
|
'k-disabled': disabled
|
|
@@ -238,10 +242,10 @@ var propTypes = {
|
|
|
238
242
|
value: function (props, propName, componentName) {
|
|
239
243
|
if (props.value && props.min && props.max && props.step) {
|
|
240
244
|
var correctValue = props.precision === 'half'
|
|
241
|
-
? utils_1.isCorrectValue(props.min, props.max, props.step / 2, props.value)
|
|
242
|
-
: utils_1.isCorrectValue(props.min, props.max, props.step, props.value);
|
|
245
|
+
? (0, utils_1.isCorrectValue)(props.min, props.max, props.step / 2, props.value)
|
|
246
|
+
: (0, utils_1.isCorrectValue)(props.min, props.max, props.step, props.value);
|
|
243
247
|
if (!correctValue && props.precision === 'half') {
|
|
244
|
-
return new Error("Invalid prop + "
|
|
248
|
+
return new Error("Invalid prop + ".concat(propName, " supplied to ").concat(componentName, ".\n The value of the { value } property is not correct, please check your values.\n "));
|
|
245
249
|
}
|
|
246
250
|
}
|
|
247
251
|
return null;
|
|
@@ -251,7 +255,7 @@ var propTypes = {
|
|
|
251
255
|
max: PropTypes.number,
|
|
252
256
|
step: function (props, propName, componentName) {
|
|
253
257
|
if (props.step !== undefined && props.step <= 0) {
|
|
254
|
-
return new Error("Invalid prop + "
|
|
258
|
+
return new Error("Invalid prop + ".concat(propName, " supplied to ").concat(componentName, ".\n The value of the { step } property is cannot be equal or less than \"0\", please check your values.\n "));
|
|
255
259
|
}
|
|
256
260
|
return null;
|
|
257
261
|
},
|
|
@@ -101,4 +101,4 @@ export interface RatingItemHandle {
|
|
|
101
101
|
/**
|
|
102
102
|
* Represents the RatingItem component.
|
|
103
103
|
*/
|
|
104
|
-
export declare const RatingItem: React.ForwardRefExoticComponent<RatingItemProps & React.RefAttributes<RatingItemHandle>>;
|
|
104
|
+
export declare const RatingItem: React.ForwardRefExoticComponent<RatingItemProps & React.RefAttributes<RatingItemHandle | null>>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RatingItem = void 0;
|
|
3
4
|
var React = require("react");
|
|
4
5
|
var PropTypes = require("prop-types");
|
|
5
6
|
var kendo_react_common_1 = require("@progress/kendo-react-common");
|
|
@@ -9,7 +10,7 @@ var kendo_react_common_1 = require("@progress/kendo-react-common");
|
|
|
9
10
|
exports.RatingItem = React.forwardRef(function (props, ref) {
|
|
10
11
|
var target = React.useRef(null);
|
|
11
12
|
var element = React.useRef(null);
|
|
12
|
-
var dir = kendo_react_common_1.useDir(element, props.dir);
|
|
13
|
+
var dir = (0, kendo_react_common_1.useDir)(element, props.dir);
|
|
13
14
|
React.useImperativeHandle(target, function () { return ({
|
|
14
15
|
element: element.current,
|
|
15
16
|
props: props,
|
|
@@ -73,7 +74,7 @@ exports.RatingItem = React.forwardRef(function (props, ref) {
|
|
|
73
74
|
});
|
|
74
75
|
}
|
|
75
76
|
}, [props.onMouseLeave]);
|
|
76
|
-
return (React.createElement("span", { id: props.id, ref: element, dir: dir, "data-half": props.half, tabIndex: props.tabIndex, title: props.title, style: props.style, className: kendo_react_common_1.classNames('k-rating-item', {
|
|
77
|
+
return (React.createElement("span", { id: props.id, ref: element, dir: dir, "data-half": props.half, tabIndex: props.tabIndex, title: props.title, style: props.style, className: (0, kendo_react_common_1.classNames)('k-rating-item', {
|
|
77
78
|
'k-rtl': dir === 'rtl',
|
|
78
79
|
'k-selected': props.selected,
|
|
79
80
|
'k-hover': props.hovered
|
|
@@ -13,6 +13,10 @@ export interface RatingItemMouseEvent {
|
|
|
13
13
|
* The event of the RatingItemMouseEvent.
|
|
14
14
|
*/
|
|
15
15
|
syntheticEvent: React.MouseEvent<any>;
|
|
16
|
+
/**
|
|
17
|
+
* @hidden
|
|
18
|
+
*/
|
|
19
|
+
value?: number | null;
|
|
16
20
|
}
|
|
17
21
|
/**
|
|
18
22
|
* Represents the return type of the RatingItemKeyboardEvent.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ratingReducer = exports.RATING_ACTION = void 0;
|
|
3
4
|
var utils_1 = require("./utils");
|
|
4
5
|
/**
|
|
5
6
|
* @hidden
|
|
@@ -17,7 +18,7 @@ var RATING_ACTION;
|
|
|
17
18
|
/**
|
|
18
19
|
* @hidden
|
|
19
20
|
*/
|
|
20
|
-
|
|
21
|
+
var ratingReducer = function (state, action) {
|
|
21
22
|
switch (action.type) {
|
|
22
23
|
case RATING_ACTION.select:
|
|
23
24
|
if (action.payload === undefined || action.step === undefined) {
|
|
@@ -28,7 +29,7 @@ exports.ratingReducer = function (state, action) {
|
|
|
28
29
|
}
|
|
29
30
|
return action.payload >= action.min
|
|
30
31
|
? action.payload < action.max
|
|
31
|
-
? utils_1.toRound(action.payload, action.step)
|
|
32
|
+
? (0, utils_1.toRound)(action.payload, action.step)
|
|
32
33
|
: action.max
|
|
33
34
|
: action.min;
|
|
34
35
|
case RATING_ACTION.deselect:
|
|
@@ -41,14 +42,14 @@ exports.ratingReducer = function (state, action) {
|
|
|
41
42
|
return action.min;
|
|
42
43
|
}
|
|
43
44
|
return state + action.step < action.max
|
|
44
|
-
? utils_1.toRound(state + action.step, action.step)
|
|
45
|
+
? (0, utils_1.toRound)(state + action.step, action.step)
|
|
45
46
|
: action.max;
|
|
46
47
|
case RATING_ACTION.decrease:
|
|
47
48
|
if (action.step === undefined) {
|
|
48
49
|
return state;
|
|
49
50
|
}
|
|
50
|
-
return utils_1.toRound(state - action.step, action.step) >= action.min
|
|
51
|
-
? utils_1.toRound(state - action.step, action.step)
|
|
51
|
+
return (0, utils_1.toRound)(state - action.step, action.step) >= action.min
|
|
52
|
+
? (0, utils_1.toRound)(state - action.step, action.step)
|
|
52
53
|
: action.min;
|
|
53
54
|
case RATING_ACTION.min:
|
|
54
55
|
if (action.step === undefined) {
|
|
@@ -63,3 +64,4 @@ exports.ratingReducer = function (state, action) {
|
|
|
63
64
|
return state;
|
|
64
65
|
}
|
|
65
66
|
};
|
|
67
|
+
exports.ratingReducer = ratingReducer;
|
|
@@ -13,7 +13,7 @@ export declare const isHalf: (index: number, value: number, step: number) => boo
|
|
|
13
13
|
/**
|
|
14
14
|
* @hidden
|
|
15
15
|
*/
|
|
16
|
-
export declare const isSelected: (index: number, value: number, step: number, selection:
|
|
16
|
+
export declare const isSelected: (index: number, value: number | null, step: number, selection: 'single' | 'continues') => boolean;
|
|
17
17
|
/**
|
|
18
18
|
* @hidden
|
|
19
19
|
*/
|