@progress/kendo-react-inputs 5.4.0-dev.202205271059 → 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.
Files changed (99) hide show
  1. package/dist/cdn/js/kendo-react-inputs.js +1 -1
  2. package/dist/es/checkbox/Checkbox.d.ts +1 -1
  3. package/dist/es/checkbox/Checkbox.js +2 -2
  4. package/dist/es/colors/ColorContrastLabels.js +3 -3
  5. package/dist/es/colors/ColorGradient.d.ts +1 -1
  6. package/dist/es/colors/ColorGradient.js +7 -3
  7. package/dist/es/colors/ColorPalette.d.ts +4 -1
  8. package/dist/es/colors/ColorPalette.js +10 -3
  9. package/dist/es/colors/ColorPicker.d.ts +1 -1
  10. package/dist/es/colors/ColorPicker.js +4 -4
  11. package/dist/es/colors/FlatColorPicker.d.ts +1 -1
  12. package/dist/es/colors/FlatColorPicker.js +25 -24
  13. package/dist/es/colors/HexInput.d.ts +1 -1
  14. package/dist/es/colors/utils/color-parser.js +2 -2
  15. package/dist/es/colors/utils/svg-calc.js +4 -4
  16. package/dist/es/common/SliderTooltip.js +3 -3
  17. package/dist/es/common/SwitchController.js +5 -1
  18. package/dist/es/common/SwitchModel.d.ts +1 -1
  19. package/dist/es/input/Input.js +1 -0
  20. package/dist/es/maskedtextbox/MaskedTextBox.d.ts +7 -7
  21. package/dist/es/maskedtextbox/MaskedTextBox.js +7 -6
  22. package/dist/es/maskedtextbox/parsing/result.js +1 -1
  23. package/dist/es/numerictextbox/NumericTextBox.d.ts +1 -1
  24. package/dist/es/numerictextbox/NumericTextBox.js +3 -3
  25. package/dist/es/numerictextbox/utils/index.js +4 -4
  26. package/dist/es/package-metadata.js +1 -1
  27. package/dist/es/radiobutton/RadioButton.d.ts +1 -1
  28. package/dist/es/radiobutton/RadioButton.js +1 -1
  29. package/dist/es/radiobutton/RadioGroup.d.ts +1 -1
  30. package/dist/es/range-slider/RangeSlider.d.ts +1 -1
  31. package/dist/es/range-slider/RangeSlider.js +7 -7
  32. package/dist/es/rating/Rating.d.ts +1 -1
  33. package/dist/es/rating/Rating.js +15 -12
  34. package/dist/es/rating/RatingItem.d.ts +1 -1
  35. package/dist/es/rating/models/index.d.ts +4 -0
  36. package/dist/es/slider/Slider.d.ts +2 -2
  37. package/dist/es/slider/Slider.js +2 -0
  38. package/dist/es/slider/SliderLabel.js +2 -2
  39. package/dist/es/switch/Switch.d.ts +6 -6
  40. package/dist/es/switch/Switch.js +7 -4
  41. package/dist/es/textarea/TextArea.d.ts +1 -1
  42. package/dist/es/textarea/TextArea.js +4 -4
  43. package/dist/es/utils.js +9 -5
  44. package/dist/npm/checkbox/Checkbox.d.ts +1 -1
  45. package/dist/npm/checkbox/Checkbox.js +14 -14
  46. package/dist/npm/colors/ColorContrastLabels.js +6 -6
  47. package/dist/npm/colors/ColorContrastSvg.js +6 -6
  48. package/dist/npm/colors/ColorGradient.d.ts +1 -1
  49. package/dist/npm/colors/ColorGradient.js +37 -33
  50. package/dist/npm/colors/ColorInput.js +3 -3
  51. package/dist/npm/colors/ColorPalette.d.ts +4 -1
  52. package/dist/npm/colors/ColorPalette.js +19 -12
  53. package/dist/npm/colors/ColorPicker.d.ts +1 -1
  54. package/dist/npm/colors/ColorPicker.js +13 -13
  55. package/dist/npm/colors/FlatColorPicker.d.ts +1 -1
  56. package/dist/npm/colors/FlatColorPicker.js +27 -26
  57. package/dist/npm/colors/HexInput.d.ts +1 -1
  58. package/dist/npm/colors/HexInput.js +3 -3
  59. package/dist/npm/colors/Picker.js +1 -1
  60. package/dist/npm/colors/utils/color-palette.service.js +6 -6
  61. package/dist/npm/colors/utils/color-parser.js +26 -26
  62. package/dist/npm/colors/utils/misc.js +1 -1
  63. package/dist/npm/colors/utils/svg-calc.js +4 -4
  64. package/dist/npm/common/SliderTooltip.js +4 -4
  65. package/dist/npm/common/SwitchController.js +5 -1
  66. package/dist/npm/common/SwitchModel.d.ts +1 -1
  67. package/dist/npm/input/Input.js +6 -5
  68. package/dist/npm/main.js +5 -1
  69. package/dist/npm/maskedtextbox/MaskedTextBox.d.ts +7 -7
  70. package/dist/npm/maskedtextbox/MaskedTextBox.js +13 -12
  71. package/dist/npm/maskedtextbox/masking.service.js +19 -19
  72. package/dist/npm/maskedtextbox/parsing/result.js +1 -1
  73. package/dist/npm/numerictextbox/NumericTextBox.d.ts +1 -1
  74. package/dist/npm/numerictextbox/NumericTextBox.js +31 -31
  75. package/dist/npm/numerictextbox/utils/index.js +60 -60
  76. package/dist/npm/package-metadata.js +1 -1
  77. package/dist/npm/radiobutton/RadioButton.d.ts +1 -1
  78. package/dist/npm/radiobutton/RadioButton.js +10 -10
  79. package/dist/npm/radiobutton/RadioGroup.d.ts +1 -1
  80. package/dist/npm/radiobutton/RadioGroup.js +10 -10
  81. package/dist/npm/range-slider/RangeSlider.d.ts +1 -1
  82. package/dist/npm/range-slider/RangeSlider.js +17 -17
  83. package/dist/npm/rating/Rating.d.ts +1 -1
  84. package/dist/npm/rating/Rating.js +36 -33
  85. package/dist/npm/rating/RatingItem.d.ts +1 -1
  86. package/dist/npm/rating/RatingItem.js +2 -2
  87. package/dist/npm/rating/models/index.d.ts +4 -0
  88. package/dist/npm/rating/rating-reducer.js +4 -4
  89. package/dist/npm/rating/utils/index.js +5 -5
  90. package/dist/npm/slider/Slider.d.ts +2 -2
  91. package/dist/npm/slider/Slider.js +9 -7
  92. package/dist/npm/slider/SliderLabel.js +3 -3
  93. package/dist/npm/switch/Switch.d.ts +6 -6
  94. package/dist/npm/switch/Switch.js +17 -14
  95. package/dist/npm/textarea/TextArea.d.ts +1 -1
  96. package/dist/npm/textarea/TextArea.js +13 -13
  97. package/dist/npm/utils.js +9 -5
  98. package/dist/systemjs/kendo-react-inputs.js +1 -1
  99. package/package.json +15 -15
@@ -24,7 +24,7 @@ var utils_1 = require("./utils");
24
24
  var useRating = function (defaultValue, args, callback) {
25
25
  var _a = React.useState(defaultValue), state = _a[0], setState = _a[1];
26
26
  var handleDispatchAction = function (action) {
27
- var newState = rating_reducer_1.ratingReducer(args.state || state, __assign(__assign({}, action), args));
27
+ var newState = (0, rating_reducer_1.ratingReducer)(args.state || state, __assign(__assign({}, action), args));
28
28
  if (callback) {
29
29
  callback(newState, action.event);
30
30
  }
@@ -38,7 +38,7 @@ var useRating = function (defaultValue, args, callback) {
38
38
  *
39
39
  * For more information, refer to the [Inputs Props Context]({% slug props-context_inputs %}) article.
40
40
  */
41
- exports.RatingPropsContext = kendo_react_common_1.createPropsContext();
41
+ exports.RatingPropsContext = (0, kendo_react_common_1.createPropsContext)();
42
42
  /**
43
43
  * Represents the [KendoReact Rating component]({% slug overview_rating %}).
44
44
  *
@@ -47,10 +47,10 @@ exports.RatingPropsContext = kendo_react_common_1.createPropsContext();
47
47
  */
48
48
  exports.Rating = React.forwardRef(function (directProps, ref) {
49
49
  var _a, _b, _c, _d;
50
- var props = kendo_react_common_1.usePropsContext(exports.RatingPropsContext, directProps);
50
+ var props = (0, kendo_react_common_1.usePropsContext)(exports.RatingPropsContext, directProps);
51
51
  var target = React.useRef(null);
52
52
  var ratingRef = React.useRef(null);
53
- var dir = kendo_react_common_1.useDir(ratingRef, props.dir);
53
+ var dir = (0, kendo_react_common_1.useDir)(ratingRef, props.dir);
54
54
  React.useImperativeHandle(target, function () { return ({
55
55
  element: ratingRef.current,
56
56
  props: props
@@ -95,19 +95,20 @@ exports.Rating = React.forwardRef(function (directProps, ref) {
95
95
  }
96
96
  if (precision === 'half') {
97
97
  var rect = event.target.element.getBoundingClientRect();
98
- var isFirstHalf = utils_1.calcIsFirstHalf(dir ? dir : 'ltr', rect, event.syntheticEvent.clientX);
99
- 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;
100
100
  dispatchStateValue({ type: rating_reducer_1.RATING_ACTION.select, payload: payload, event: event.syntheticEvent });
101
101
  }
102
102
  else {
103
103
  dispatchStateValue({ type: rating_reducer_1.RATING_ACTION.select, payload: event.target.value, event: event.syntheticEvent });
104
104
  }
105
105
  if (props.onClick) {
106
- props.onClick.call(undefined, {
106
+ var ev = {
107
107
  value: value,
108
108
  target: target.current,
109
109
  syntheticEvent: event.syntheticEvent
110
- });
110
+ };
111
+ props.onClick.call(undefined, ev);
111
112
  }
112
113
  }, [props.onClick, dispatchStateValue, value]);
113
114
  var handleKeyDown = React.useCallback(function (syntheticEvent) {
@@ -158,18 +159,20 @@ exports.Rating = React.forwardRef(function (directProps, ref) {
158
159
  }, [props.onKeyDown, dispatchStateValue, value]);
159
160
  var handleFocus = React.useCallback(function (syntheticEvent) {
160
161
  if (props.onFocus) {
161
- props.onFocus.call(undefined, {
162
+ var ev = {
162
163
  target: target.current,
163
164
  syntheticEvent: syntheticEvent
164
- });
165
+ };
166
+ props.onFocus.call(undefined, ev);
165
167
  }
166
168
  }, [props.onFocus]);
167
169
  var handleBlur = React.useCallback(function (syntheticEvent) {
168
170
  if (props.onBlur) {
169
- props.onBlur.call(undefined, {
171
+ var ev = {
170
172
  target: target.current,
171
173
  syntheticEvent: syntheticEvent
172
- });
174
+ };
175
+ props.onBlur.call(undefined, ev);
173
176
  }
174
177
  }, [props.onBlur]);
175
178
  var handleItemMouseMove = React.useCallback(function (event) {
@@ -178,7 +181,7 @@ exports.Rating = React.forwardRef(function (directProps, ref) {
178
181
  }
179
182
  if (precision === 'half') {
180
183
  var rect = event.target.element.getBoundingClientRect();
181
- 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);
182
185
  var payload = isFirstHalf ? event.target.value - (step / 2) : event.target.value;
183
186
  dispatchStateHover({ type: rating_reducer_1.RATING_ACTION.select, payload: payload, event: event.syntheticEvent });
184
187
  }
@@ -190,38 +193,38 @@ exports.Rating = React.forwardRef(function (directProps, ref) {
190
193
  dispatchStateHover({ type: rating_reducer_1.RATING_ACTION.reset, event: event.syntheticEvent });
191
194
  }, []);
192
195
  var items = [];
193
- var remainder = utils_1.getRemainder(utils_1.toRound(max - min, base), step);
194
- for (var i = min; i <= max; i = utils_1.toRound(i + step, base)) {
195
- 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);
196
199
  var half = precision === 'half'
197
- ? 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)
198
201
  : false;
199
- var selectedValue = utils_1.isSelected(itemValue, value, step, selection);
200
- var selected = utils_1.isSelected(itemValue, hoveredValue !== null ? hoveredValue : value, step, selection);
201
- var hovered = utils_1.isSelected(itemValue, hoveredValue, step, selection);
202
- 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 },
203
206
  half && (React.createElement("span", { className: 'k-rating-precision-complement', style: (_a = { width: '12px' }, _a[dir === 'rtl' ? 'right' : 'left'] = '50%', _a) },
204
- 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 = {
205
208
  'k-i-star-outline': !props.icon
206
209
  },
207
- _b[props.icon + "-outline"] = props.icon,
210
+ _b["".concat(props.icon, "-outline")] = props.icon,
208
211
  _b)) }))),
209
212
  half && (React.createElement("span", { className: 'k-rating-precision-part', style: { width: '12px' } },
210
- 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 = {
211
214
  'k-i-star': !props.icon
212
215
  },
213
- _c["" + props.icon] = props.icon,
216
+ _c["".concat(props.icon)] = props.icon,
214
217
  _c)) }))),
215
218
  half && (React.createElement("span", { style: { width: '24px', height: '24px', display: 'block' } })),
216
- !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 = {
217
220
  'k-i-star': !props.icon && (hovered || (selected && !hovered)),
218
221
  'k-i-star-outline': !props.icon && (!hovered)
219
222
  },
220
- _d["" + props.icon] = props.icon && (hovered || (selected && !hovered)),
221
- _d[props.icon + "-outline"] = props.icon && (!hovered),
223
+ _d["".concat(props.icon)] = props.icon && (hovered || (selected && !hovered)),
224
+ _d["".concat(props.icon, "-outline")] = props.icon && (!hovered),
222
225
  _d)) }))));
223
226
  }
224
- 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', {
225
228
  'k-rtl': dir === 'rtl',
226
229
  'k-state-readonly': readonly,
227
230
  'k-disabled': disabled
@@ -239,10 +242,10 @@ var propTypes = {
239
242
  value: function (props, propName, componentName) {
240
243
  if (props.value && props.min && props.max && props.step) {
241
244
  var correctValue = props.precision === 'half'
242
- ? utils_1.isCorrectValue(props.min, props.max, props.step / 2, props.value)
243
- : 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);
244
247
  if (!correctValue && props.precision === 'half') {
245
- return new Error("Invalid prop + " + propName + " supplied to " + componentName + ".\n The value of the { value } property is not correct, please check your values.\n ");
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 "));
246
249
  }
247
250
  }
248
251
  return null;
@@ -252,7 +255,7 @@ var propTypes = {
252
255
  max: PropTypes.number,
253
256
  step: function (props, propName, componentName) {
254
257
  if (props.step !== undefined && props.step <= 0) {
255
- return new Error("Invalid prop + " + propName + " supplied to " + componentName + ".\n The value of the { step } property is cannot be equal or less than \"0\", please check your values.\n ");
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 "));
256
259
  }
257
260
  return null;
258
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>>;
@@ -10,7 +10,7 @@ var kendo_react_common_1 = require("@progress/kendo-react-common");
10
10
  exports.RatingItem = React.forwardRef(function (props, ref) {
11
11
  var target = React.useRef(null);
12
12
  var element = React.useRef(null);
13
- var dir = kendo_react_common_1.useDir(element, props.dir);
13
+ var dir = (0, kendo_react_common_1.useDir)(element, props.dir);
14
14
  React.useImperativeHandle(target, function () { return ({
15
15
  element: element.current,
16
16
  props: props,
@@ -74,7 +74,7 @@ exports.RatingItem = React.forwardRef(function (props, ref) {
74
74
  });
75
75
  }
76
76
  }, [props.onMouseLeave]);
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: 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', {
78
78
  'k-rtl': dir === 'rtl',
79
79
  'k-selected': props.selected,
80
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.
@@ -29,7 +29,7 @@ var ratingReducer = function (state, action) {
29
29
  }
30
30
  return action.payload >= action.min
31
31
  ? action.payload < action.max
32
- ? utils_1.toRound(action.payload, action.step)
32
+ ? (0, utils_1.toRound)(action.payload, action.step)
33
33
  : action.max
34
34
  : action.min;
35
35
  case RATING_ACTION.deselect:
@@ -42,14 +42,14 @@ var ratingReducer = function (state, action) {
42
42
  return action.min;
43
43
  }
44
44
  return state + action.step < action.max
45
- ? utils_1.toRound(state + action.step, action.step)
45
+ ? (0, utils_1.toRound)(state + action.step, action.step)
46
46
  : action.max;
47
47
  case RATING_ACTION.decrease:
48
48
  if (action.step === undefined) {
49
49
  return state;
50
50
  }
51
- return utils_1.toRound(state - action.step, action.step) >= action.min
52
- ? 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)
53
53
  : action.min;
54
54
  case RATING_ACTION.min:
55
55
  if (action.step === undefined) {
@@ -27,7 +27,7 @@ exports.getRemainder = getRemainder;
27
27
  * @hidden
28
28
  */
29
29
  var isHalf = function (index, value, step) {
30
- return (exports.toRound(index - step, step) < value) && (value < index);
30
+ return ((0, exports.toRound)(index - step, step) < value) && (value < index);
31
31
  };
32
32
  exports.isHalf = isHalf;
33
33
  /**
@@ -38,13 +38,13 @@ var isSelected = function (index, value, step, selection) {
38
38
  return false;
39
39
  }
40
40
  if (selection === 'continues') {
41
- return exports.isHalf(index, value, step)
42
- ? exports.toRound(index - step / 2, step / 2) <= value
41
+ return (0, exports.isHalf)(index, value, step)
42
+ ? (0, exports.toRound)(index - step / 2, step / 2) <= value
43
43
  : index <= value;
44
44
  }
45
45
  if (selection === 'single') {
46
- return exports.isHalf(index, value, step)
47
- ? exports.toRound(index - step / 2, step / 2) === value
46
+ return (0, exports.isHalf)(index, value, step)
47
+ ? (0, exports.toRound)(index - step / 2, step / 2) === value
48
48
  : index === value;
49
49
  }
50
50
  return false;
@@ -121,14 +121,14 @@ export declare class SliderWithoutContext extends React.Component<SliderProps, S
121
121
  */
122
122
  static getDerivedStateFromProps(props: SliderProps, state: SliderState): {
123
123
  value: number;
124
- };
124
+ } | null;
125
125
  /**
126
126
  * @hidden
127
127
  */
128
128
  state: {
129
129
  value: number;
130
130
  focused: boolean;
131
- dir: Direction;
131
+ dir: Direction | undefined;
132
132
  };
133
133
  private _sliderTrack;
134
134
  private _element;
@@ -49,6 +49,8 @@ var SliderWithoutContext = /** @class */ (function (_super) {
49
49
  focused: false,
50
50
  dir: _this.props.dir
51
51
  };
52
+ _this._sliderTrack = null;
53
+ _this._element = null;
52
54
  /**
53
55
  * @hidden
54
56
  */
@@ -139,7 +141,7 @@ var SliderWithoutContext = /** @class */ (function (_super) {
139
141
  var percentage = (distance / size);
140
142
  _this.change(e, _this.props.min + percentage * (_this.props.max - _this.props.min));
141
143
  };
142
- kendo_react_common_2.validatePackage(package_metadata_1.packageMetadata);
144
+ (0, kendo_react_common_2.validatePackage)(package_metadata_1.packageMetadata);
143
145
  return _this;
144
146
  }
145
147
  /**
@@ -169,7 +171,7 @@ var SliderWithoutContext = /** @class */ (function (_super) {
169
171
  SliderWithoutContext.prototype.render = function () {
170
172
  var _a;
171
173
  var _this = this;
172
- var lS = kendo_react_intl_1.provideLocalizationService(this);
174
+ var lS = (0, kendo_react_intl_1.provideLocalizationService)(this);
173
175
  var percentValue = ((this.state.value - this.props.min) / (this.props.max - this.props.min)) * 100;
174
176
  var trackStyles = this.props.vertical
175
177
  ? { marginTop: '0.5rem', marginBottom: '0.5rem' }
@@ -177,7 +179,7 @@ var SliderWithoutContext = /** @class */ (function (_super) {
177
179
  var sliderItemsStyle = this.props.vertical
178
180
  ? { paddingTop: 0, height: '100%' }
179
181
  : {};
180
- return (React.createElement("div", { ref: function (el) { return _this._element = el; }, "aria-valuemin": this.props.min, "aria-valuemax": this.props.max, "aria-valuenow": this.state.value, "aria-disabled": this.props.disabled ? 'true' : undefined, "aria-labelledby": this.props.ariaLabelledBy, "aria-describedby": this.props.ariaDescribedBy, dir: this.state.dir, role: "slider", id: this.props.id, style: __assign({ gap: 0 }, this.props.style), tabIndex: kendo_react_common_1.getTabIndex(this.props.tabIndex, this.props.disabled, undefined), onFocus: this.onFocus, onBlur: this.onBlur, onKeyDown: this.onKeyDown, className: kendo_react_common_1.classNames('k-slider k-widget', {
182
+ return (React.createElement("div", { ref: function (el) { return _this._element = el; }, "aria-valuemin": this.props.min, "aria-valuemax": this.props.max, "aria-valuenow": this.state.value, "aria-disabled": this.props.disabled ? 'true' : undefined, "aria-labelledby": this.props.ariaLabelledBy, "aria-describedby": this.props.ariaDescribedBy, dir: this.state.dir, role: "slider", id: this.props.id, style: __assign({ gap: 0 }, this.props.style), tabIndex: (0, kendo_react_common_1.getTabIndex)(this.props.tabIndex, this.props.disabled, undefined), onFocus: this.onFocus, onBlur: this.onBlur, onKeyDown: this.onKeyDown, className: (0, kendo_react_common_1.classNames)('k-slider k-widget', {
181
183
  'k-focus': this.state.focused,
182
184
  'k-disabled': this.props.disabled,
183
185
  'k-slider-horizontal': !this.props.vertical,
@@ -217,7 +219,7 @@ var SliderWithoutContext = /** @class */ (function (_super) {
217
219
  SliderWithoutContext.prototype.change = function (e, value) {
218
220
  value = Math.min(Math.max(value, this.props.min), this.props.max);
219
221
  this.setState({ value: value });
220
- kendo_react_common_1.dispatchEvent(this.props.onChange, e, this, { value: value });
222
+ (0, kendo_react_common_1.dispatchEvent)(this.props.onChange, e, this, { value: value });
221
223
  };
222
224
  SliderWithoutContext.displayName = 'Slider';
223
225
  /**
@@ -242,7 +244,7 @@ exports.SliderWithoutContext = SliderWithoutContext;
242
244
  *
243
245
  * For more information, refer to the [Inputs Props Context]({% slug props-context_inputs %}) article.
244
246
  */
245
- exports.SliderPropsContext = kendo_react_common_1.createPropsContext();
247
+ exports.SliderPropsContext = (0, kendo_react_common_1.createPropsContext)();
246
248
  /* eslint-disable @typescript-eslint/no-redeclare -- intentionally naming the component the same as the type */
247
249
  /**
248
250
  * Represents the [KendoReact Slider component]({% slug overview_slider %}).
@@ -250,6 +252,6 @@ exports.SliderPropsContext = kendo_react_common_1.createPropsContext();
250
252
  * Accepts properties of type [SliderProps]({% slug api_inputs_sliderprops %}).
251
253
  * Obtaining the `ref` returns an object of type [SliderHandle]({% slug api_inputs_sliderhandle %}).
252
254
  */
253
- exports.Slider = kendo_react_common_1.withPropsContext(exports.SliderPropsContext, SliderWithoutContext);
255
+ exports.Slider = (0, kendo_react_common_1.withPropsContext)(exports.SliderPropsContext, SliderWithoutContext);
254
256
  exports.Slider.displayName = 'KendoReactSlider';
255
- kendo_react_intl_1.registerForLocalization(SliderWithoutContext);
257
+ (0, kendo_react_intl_1.registerForLocalization)(SliderWithoutContext);
@@ -24,10 +24,10 @@ exports.SLIDER_LABEL_ATTRIBUTE = 'data-slider-label';
24
24
  var SliderLabel = function (props) {
25
25
  var _a, _b;
26
26
  var sliderLabelRef = React.useRef(null);
27
- var dir = kendo_react_common_1.useDir(sliderLabelRef);
27
+ var dir = (0, kendo_react_common_1.useDir)(sliderLabelRef);
28
28
  var style = props.vertical
29
- ? { bottom: props.position + "%", height: '1px', width: '100%' }
30
- : (_a = {}, _a[dir === 'rtl' ? 'right' : 'left'] = props.position + "%", _a.width = '1px', _a.height = '-webkit-fill-available', _a);
29
+ ? { bottom: "".concat(props.position, "%"), height: '1px', width: '100%' }
30
+ : (_a = {}, _a[dir === 'rtl' ? 'right' : 'left'] = "".concat(props.position, "%"), _a.width = '1px', _a.height = '-webkit-fill-available', _a);
31
31
  return (React.createElement("li", { ref: sliderLabelRef, role: "presentation", className: "k-tick k-tick-large", title: props.title, style: __assign({ zIndex: 1, position: 'absolute' }, style) },
32
32
  React.createElement("span", __assign({}, (_b = {}, _b[exports.SLIDER_LABEL_ATTRIBUTE] = true, _b), { className: "k-label", onClick: props.onClick }), props.children)));
33
33
  };
@@ -174,9 +174,9 @@ export declare class SwitchWithoutContext extends React.Component<SwitchProps, S
174
174
  className: PropTypes.Requireable<string>;
175
175
  disabled: PropTypes.Requireable<boolean>;
176
176
  defaultChecked: PropTypes.Requireable<boolean>;
177
- size: PropTypes.Requireable<"small" | "medium" | "large">;
178
- trackRounded: PropTypes.Requireable<"small" | "medium" | "full" | "large">;
179
- thumbRounded: PropTypes.Requireable<"small" | "medium" | "full" | "large">;
177
+ size: PropTypes.Requireable<"small" | "medium" | "large" | null | undefined>;
178
+ trackRounded: PropTypes.Requireable<"small" | "medium" | "full" | "large" | null | undefined>;
179
+ thumbRounded: PropTypes.Requireable<"small" | "medium" | "full" | "large" | null | undefined>;
180
180
  dir: PropTypes.Requireable<string>;
181
181
  id: PropTypes.Requireable<string>;
182
182
  ariaLabelledBy: PropTypes.Requireable<string>;
@@ -198,9 +198,9 @@ export declare class SwitchWithoutContext extends React.Component<SwitchProps, S
198
198
  static defaultProps: {
199
199
  disabled: boolean;
200
200
  defaultChecked: boolean;
201
- size: "small" | "medium" | "large";
202
- trackRounded: "small" | "medium" | "full" | "large";
203
- thumbRounded: "small" | "medium" | "full" | "large";
201
+ size: "small" | "medium" | "large" | null | undefined;
202
+ trackRounded: "small" | "medium" | "full" | "large" | null | undefined;
203
+ thumbRounded: "small" | "medium" | "full" | "large" | null | undefined;
204
204
  offLabel: string;
205
205
  onBlur: () => void;
206
206
  onFocus: () => void;
@@ -67,11 +67,14 @@ var SwitchWithoutContext = /** @class */ (function (_super) {
67
67
  _this.toggle = function (value, event) {
68
68
  _this.setState({ checked: value });
69
69
  _this.valueDuringOnChange = value;
70
- kendo_react_common_1.dispatchEvent(_this.props.onChange, event, _this, { value: value });
70
+ (0, kendo_react_common_1.dispatchEvent)(_this.props.onChange, event, _this, { value: value });
71
71
  _this.valueDuringOnChange = undefined;
72
72
  };
73
- _this._id = kendo_react_common_1.guid();
74
- _this.defaultValidationMessage = kendo_react_intl_1.provideLocalizationService(_this);
73
+ _this._element = null;
74
+ _this._wrapper = null;
75
+ _this._input = null;
76
+ _this._id = (0, kendo_react_common_1.guid)();
77
+ _this.defaultValidationMessage = (0, kendo_react_intl_1.provideLocalizationService)(_this);
75
78
  /**
76
79
  * @hidden
77
80
  */
@@ -123,7 +126,7 @@ var SwitchWithoutContext = /** @class */ (function (_super) {
123
126
  onBlur.call(undefined, event);
124
127
  }
125
128
  };
126
- kendo_react_common_2.validatePackage(package_metadata_1.packageMetadata);
129
+ (0, kendo_react_common_2.validatePackage)(package_metadata_1.packageMetadata);
127
130
  _this.state = {
128
131
  checked: props.defaultChecked || SwitchWithoutContext.defaultProps.defaultChecked,
129
132
  focused: false
@@ -240,9 +243,9 @@ var SwitchWithoutContext = /** @class */ (function (_super) {
240
243
  var _d = this.props, dir = _d.dir, disabled = _d.disabled, trackRounded = _d.trackRounded, thumbRounded = _d.thumbRounded, size = _d.size, id = _d.id, offLabel = _d.offLabel, onLabel = _d.onLabel, tabIndex = _d.tabIndex;
241
244
  this.dir = dir || (this._wrapper && getComputedStyle(this._wrapper).direction) || undefined;
242
245
  var isValid = !this.validityStyles || this.validity.valid;
243
- var switchClassName = kendo_react_common_1.classNames('k-switch', (_a = {},
244
- _a["k-switch-" + (kendo_react_common_1.kendoThemeMaps.sizeMap[size] || size)] = size,
245
- _a["k-rounded-" + (kendo_react_common_1.kendoThemeMaps.roundedMap[trackRounded] || trackRounded)] = trackRounded,
246
+ var switchClassName = (0, kendo_react_common_1.classNames)('k-switch', (_a = {},
247
+ _a["k-switch-".concat(kendo_react_common_1.kendoThemeMaps.sizeMap[size] || size)] = size,
248
+ _a["k-rounded-".concat(kendo_react_common_1.kendoThemeMaps.roundedMap[trackRounded] || trackRounded)] = trackRounded,
246
249
  _a['k-switch-on'] = this.value,
247
250
  _a['k-switch-off'] = !this.value,
248
251
  _a['k-focus'] = focused,
@@ -256,17 +259,17 @@ var SwitchWithoutContext = /** @class */ (function (_super) {
256
259
  return (React.createElement("span", { ref: function (span) {
257
260
  _this._wrapper = span;
258
261
  }, className: switchClassName, dir: this.dir, onKeyDown: this.handleKeyDown, onClick: this.handleClick, onBlur: this.handleWrapperBlur, onFocus: this.handleWrapperFocus },
259
- React.createElement("span", __assign({ className: kendo_react_common_1.classNames('k-switch-track', (_b = {},
260
- _b["k-rounded-" + (kendo_react_common_1.kendoThemeMaps.roundedMap[trackRounded] || trackRounded)] = trackRounded,
262
+ React.createElement("span", __assign({ className: (0, kendo_react_common_1.classNames)('k-switch-track', (_b = {},
263
+ _b["k-rounded-".concat(kendo_react_common_1.kendoThemeMaps.roundedMap[trackRounded] || trackRounded)] = trackRounded,
261
264
  _b)), id: id || this._id, role: 'switch' }, ariaAttributes, { "aria-labelledby": this.props.ariaLabelledBy, "aria-describedby": this.props.ariaDescribedBy, ref: function (span) {
262
265
  _this._element = span;
263
- }, tabIndex: kendo_react_common_1.getTabIndex(tabIndex, disabled, undefined), accessKey: this.props.accessKey }),
266
+ }, tabIndex: (0, kendo_react_common_1.getTabIndex)(tabIndex, disabled, undefined), accessKey: this.props.accessKey }),
264
267
  this.dummyInput(this.value),
265
268
  React.createElement("span", { className: 'k-switch-label-on' }, onLabel),
266
269
  React.createElement("span", { className: 'k-switch-label-off' }, offLabel),
267
270
  React.createElement("span", { className: 'k-switch-thumb-wrap' },
268
- React.createElement("span", { className: kendo_react_common_1.classNames('k-switch-thumb', (_c = {},
269
- _c["k-rounded-" + thumbRounded] = thumbRounded,
271
+ React.createElement("span", { className: (0, kendo_react_common_1.classNames)('k-switch-thumb', (_c = {},
272
+ _c["k-rounded-".concat(thumbRounded)] = thumbRounded,
270
273
  _c)) })))));
271
274
  };
272
275
  SwitchWithoutContext.displayName = 'Switch';
@@ -322,7 +325,7 @@ exports.SwitchWithoutContext = SwitchWithoutContext;
322
325
  *
323
326
  * For more information, refer to the [Inputs Props Context]({% slug props-context_inputs %}) article.
324
327
  */
325
- exports.SwitchPropsContext = kendo_react_common_1.createPropsContext();
328
+ exports.SwitchPropsContext = (0, kendo_react_common_1.createPropsContext)();
326
329
  /* eslint-disable @typescript-eslint/no-redeclare -- intentionally naming the component the same as the type */
327
330
  /**
328
331
  * Represents the [KendoReact Switch component]({% slug overview_switch %}).
@@ -330,5 +333,5 @@ exports.SwitchPropsContext = kendo_react_common_1.createPropsContext();
330
333
  * Accepts properties of type [SwitchProps]({% slug api_inputs_switchprops %}).
331
334
  * Obtaining the `ref` returns an object of type [SwitchHandle]({% slug api_inputs_switchhandle %}).
332
335
  */
333
- exports.Switch = kendo_react_common_1.withPropsContext(exports.SwitchPropsContext, SwitchWithoutContext);
336
+ exports.Switch = (0, kendo_react_common_1.withPropsContext)(exports.SwitchPropsContext, SwitchWithoutContext);
334
337
  exports.Switch.displayName = 'KendoReactSwitch';
@@ -32,4 +32,4 @@ export declare const TextAreaPropsContext: React.Context<(p: TextAreaProps) => T
32
32
  * ReactDOM.render(<App />, document.querySelector('my-app'));
33
33
  * ```
34
34
  */
35
- export declare const TextArea: React.ForwardRefExoticComponent<TextAreaProps & React.RefAttributes<TextAreaHandle>>;
35
+ export declare const TextArea: React.ForwardRefExoticComponent<TextAreaProps & React.RefAttributes<TextAreaHandle | null>>;
@@ -32,7 +32,7 @@ var kendo_react_common_1 = require("@progress/kendo-react-common");
32
32
  *
33
33
  * For more information, refer to the [Inputs Props Context]({% slug props-context_inputs %}) article.
34
34
  */
35
- exports.TextAreaPropsContext = kendo_react_common_1.createPropsContext();
35
+ exports.TextAreaPropsContext = (0, kendo_react_common_1.createPropsContext)();
36
36
  /**
37
37
  * Represents the [KendoReact TextArea component]({% slug overview_textarea %}).
38
38
  *
@@ -52,7 +52,7 @@ exports.TextAreaPropsContext = kendo_react_common_1.createPropsContext();
52
52
  */
53
53
  exports.TextArea = React.forwardRef(function (directProps, target) {
54
54
  var _a;
55
- var props = kendo_react_common_1.usePropsContext(exports.TextAreaPropsContext, directProps);
55
+ var props = (0, kendo_react_common_1.usePropsContext)(exports.TextAreaPropsContext, directProps);
56
56
  var _b = props, size = _b.size, rounded = _b.rounded, fillMode = _b.fillMode, ariaDescribedBy = _b.ariaDescribedBy, ariaLabelledBy = _b.ariaLabelledBy, autoSize = _b.autoSize, className = _b.className, defaultValue = _b.defaultValue, disabled = _b.disabled, readOnly = _b.readOnly, required = _b.required, rows = _b.rows, id = _b.id, name = _b.name, placeholder = _b.placeholder, style = _b.style, tabIndex = _b.tabIndex, value = _b.value, valid = _b.valid, validationMessage = _b.validationMessage, validityStyles = _b.validityStyles, onChange = _b.onChange, onFocus = _b.onFocus, onBlur = _b.onBlur,
57
57
  // Removed to support direct use in Form Field component
58
58
  visited = _b.visited, touched = _b.touched, modified = _b.modified, others = __rest(_b, ["size", "rounded", "fillMode", "ariaDescribedBy", "ariaLabelledBy", "autoSize", "className", "defaultValue", "disabled", "readOnly", "required", "rows", "id", "name", "placeholder", "style", "tabIndex", "value", "valid", "validationMessage", "validityStyles", "onChange", "onFocus", "onBlur", "visited", "touched", "modified"]);
@@ -72,8 +72,8 @@ exports.TextArea = React.forwardRef(function (directProps, target) {
72
72
  React.useImperativeHandle(target, getImperativeHandle);
73
73
  var _c = React.useState(defaultValue), stateValue = _c[0], setStateValue = _c[1];
74
74
  var _d = React.useState('auto'), textAreaHeight = _d[0], setTextAreaHeight = _d[1];
75
- var calculatedId = React.useMemo(function () { return kendo_react_common_1.guid(); }, []);
76
- var dir = kendo_react_common_1.useDir(elementRef, props.dir);
75
+ var calculatedId = React.useMemo(function () { return (0, kendo_react_common_1.guid)(); }, []);
76
+ var dir = (0, kendo_react_common_1.useDir)(elementRef, props.dir);
77
77
  var isControlled = value !== undefined;
78
78
  var currentValue = isControlled ? value : stateValue;
79
79
  var isValid = valid !== undefined ?
@@ -90,7 +90,7 @@ exports.TextArea = React.forwardRef(function (directProps, target) {
90
90
  }, [isValid, validationMessage]);
91
91
  React.useLayoutEffect(function () {
92
92
  if (elementRef.current) {
93
- setTextAreaHeight(elementRef.current.scrollHeight + "px");
93
+ setTextAreaHeight("".concat(elementRef.current.scrollHeight, "px"));
94
94
  }
95
95
  }, [currentValue]);
96
96
  var handleChange = React.useCallback(function (event) {
@@ -100,24 +100,24 @@ exports.TextArea = React.forwardRef(function (directProps, target) {
100
100
  setStateValue(newValue);
101
101
  }
102
102
  if (onChange && !disabled) {
103
- kendo_react_common_1.dispatchEvent(onChange, event, getImperativeHandle(), { value: newValue });
103
+ (0, kendo_react_common_1.dispatchEvent)(onChange, event, getImperativeHandle(), { value: newValue });
104
104
  }
105
105
  }, [setStateValue, onChange, disabled, isControlled]);
106
106
  var handleFocus = React.useCallback(function (event) {
107
107
  if (onFocus && !disabled) {
108
- kendo_react_common_1.dispatchEvent(onFocus, event, getImperativeHandle(), undefined);
108
+ (0, kendo_react_common_1.dispatchEvent)(onFocus, event, getImperativeHandle(), undefined);
109
109
  }
110
110
  }, [onFocus, disabled]);
111
111
  var handleBlur = React.useCallback(function (event) {
112
112
  if (onBlur && !disabled) {
113
- kendo_react_common_1.dispatchEvent(onBlur, event, getImperativeHandle(), undefined);
113
+ (0, kendo_react_common_1.dispatchEvent)(onBlur, event, getImperativeHandle(), undefined);
114
114
  }
115
115
  }, [onBlur, disabled]);
116
- var textAreaProps = __assign(__assign({ id: id || calculatedId, name: name, className: 'k-input-inner !k-overflow-auto', ref: elementRef, disabled: disabled, rows: rows, placeholder: placeholder, readOnly: readOnly, required: required, tabIndex: kendo_react_common_1.getTabIndex(tabIndex, disabled), style: autoSize ? { resize: 'none', overflow: 'hidden', height: textAreaHeight } : {}, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, 'aria-multiline': true, 'aria-disabled': disabled || undefined, value: isControlled ? value : stateValue }, others), { onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur });
117
- return (React.createElement("span", { className: kendo_react_common_1.classNames('k-input', 'k-textarea', (_a = {},
118
- _a["k-input-" + (kendo_react_common_1.kendoThemeMaps.sizeMap[size] || size)] = size,
119
- _a["k-input-" + fillMode] = fillMode,
120
- _a["k-rounded-" + (kendo_react_common_1.kendoThemeMaps.roundedMap[rounded] || rounded)] = rounded,
116
+ var textAreaProps = __assign(__assign({ id: id || calculatedId, name: name, className: 'k-input-inner !k-overflow-auto', ref: elementRef, disabled: disabled, rows: rows, placeholder: placeholder, readOnly: readOnly, required: required, tabIndex: (0, kendo_react_common_1.getTabIndex)(tabIndex, disabled), style: autoSize ? { resize: 'none', overflow: 'hidden', height: textAreaHeight } : {}, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, 'aria-multiline': true, 'aria-disabled': disabled || undefined, value: isControlled ? value : stateValue }, others), { onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur });
117
+ return (React.createElement("span", { className: (0, kendo_react_common_1.classNames)('k-input', 'k-textarea', (_a = {},
118
+ _a["k-input-".concat(kendo_react_common_1.kendoThemeMaps.sizeMap[size] || size)] = size,
119
+ _a["k-input-".concat(fillMode)] = fillMode,
120
+ _a["k-rounded-".concat(kendo_react_common_1.kendoThemeMaps.roundedMap[rounded] || rounded)] = rounded,
121
121
  _a['k-invalid'] = !(isValid || validityStyles !== undefined || validityStyles === true),
122
122
  _a['k-required'] = required,
123
123
  _a['k-disabled'] = disabled,
package/dist/npm/utils.js CHANGED
@@ -1,8 +1,12 @@
1
1
  "use strict";
2
- var __spreadArray = (this && this.__spreadArray) || function (to, from) {
3
- for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
4
- to[j] = from[i];
5
- return to;
2
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4
+ if (ar || !(i in from)) {
5
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
6
+ ar[i] = from[i];
7
+ }
8
+ }
9
+ return to.concat(ar || Array.prototype.slice.call(from));
6
10
  };
7
11
  Object.defineProperty(exports, "__esModule", { value: true });
8
12
  exports.nullable = void 0;
@@ -20,7 +24,7 @@ function nullable(subRequirement) {
20
24
  return null;
21
25
  }
22
26
  var sub = required ? subRequirement.isRequired : subRequirement;
23
- return sub.apply(void 0, __spreadArray([props, key], rest));
27
+ return sub.apply(void 0, __spreadArray([props, key], rest, false));
24
28
  };
25
29
  var fn = check.bind(null, false);
26
30
  fn.isRequired = check.bind(null, true);