@progress/kendo-react-inputs 5.5.1-dev.202207252139 → 5.6.0-dev.202208090643

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.
@@ -18,6 +18,8 @@ var kendo_react_common_1 = require("@progress/kendo-react-common");
18
18
  var RatingItem_1 = require("./RatingItem");
19
19
  var rating_reducer_1 = require("./rating-reducer");
20
20
  var utils_1 = require("./utils");
21
+ var messages_1 = require("../messages");
22
+ var kendo_react_intl_1 = require("@progress/kendo-react-intl");
21
23
  /**
22
24
  * @hidden
23
25
  */
@@ -48,6 +50,7 @@ exports.RatingPropsContext = (0, kendo_react_common_1.createPropsContext)();
48
50
  exports.Rating = React.forwardRef(function (directProps, ref) {
49
51
  var _a, _b, _c, _d;
50
52
  var props = (0, kendo_react_common_1.usePropsContext)(exports.RatingPropsContext, directProps);
53
+ var localization = (0, kendo_react_intl_1.useLocalization)();
51
54
  var target = React.useRef(null);
52
55
  var ratingRef = React.useRef(null);
53
56
  var dir = (0, kendo_react_common_1.useDir)(ratingRef, props.dir);
@@ -228,7 +231,7 @@ exports.Rating = React.forwardRef(function (directProps, ref) {
228
231
  'k-rtl': dir === 'rtl',
229
232
  'k-state-readonly': readonly,
230
233
  'k-disabled': disabled
231
- }, props.className), onKeyDown: handleKeyDown, onFocus: handleFocus, onBlur: handleBlur, "aria-valuemin": min, "aria-valuemax": max, "aria-valuenow": value !== null ? value : undefined, "aria-disabled": disabled ? 'true' : undefined, "aria-labelledby": props.ariaLabelledBy, "aria-describedby": props.ariaDescribedBy },
234
+ }, props.className), onKeyDown: handleKeyDown, onFocus: handleFocus, onBlur: handleBlur, "aria-valuemin": min, "aria-valuemax": max, "aria-valuenow": value !== null ? value : undefined, "aria-disabled": disabled ? 'true' : undefined, "aria-label": localization.toLanguageString(messages_1.ratingAriaLabel, messages_1.messages[messages_1.ratingAriaLabel]), "aria-labelledby": props.ariaLabelledBy, "aria-describedby": props.ariaDescribedBy },
232
235
  React.createElement("input", { id: 'rating', className: 'k-hidden', readOnly: readonly, disabled: disabled }),
233
236
  React.createElement("span", { className: 'k-rating-container' }, items),
234
237
  props.label &&
@@ -91,6 +91,10 @@ export interface SliderProps extends FormComponentProps {
91
91
  * Identifies the element(s) which will label the component.
92
92
  */
93
93
  ariaLabelledBy?: string;
94
+ /**
95
+ * The accessible label of the component.
96
+ */
97
+ ariaLabel?: string;
94
98
  dir?: Direction;
95
99
  }
96
100
  /**
@@ -115,6 +119,7 @@ export declare class SliderWithoutContext extends React.Component<SliderProps, S
115
119
  id: PropTypes.Requireable<string>;
116
120
  ariaLabelledBy: PropTypes.Requireable<string>;
117
121
  ariaDescribedBy: PropTypes.Requireable<string>;
122
+ ariaLabel: PropTypes.Requireable<string>;
118
123
  };
119
124
  /**
120
125
  * @hidden
@@ -179,7 +179,7 @@ var SliderWithoutContext = /** @class */ (function (_super) {
179
179
  var sliderItemsStyle = this.props.vertical
180
180
  ? { paddingTop: 0, height: '100%' }
181
181
  : {};
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', {
182
+ return (React.createElement("div", { ref: function (el) { return _this._element = el; }, dir: this.state.dir, id: this.props.id, style: __assign({ gap: 0 }, this.props.style), onFocus: this.onFocus, onBlur: this.onBlur, onKeyDown: this.onKeyDown, className: (0, kendo_react_common_1.classNames)('k-slider k-widget', {
183
183
  'k-focus': this.state.focused,
184
184
  'k-disabled': this.props.disabled,
185
185
  'k-slider-horizontal': !this.props.vertical,
@@ -201,7 +201,7 @@ var SliderWithoutContext = /** @class */ (function (_super) {
201
201
  React.createElement("div", { className: "k-slider-selection", style: this.props.vertical
202
202
  ? { height: percentValue + '%' }
203
203
  : { width: percentValue + '%' } }),
204
- React.createElement("a", { className: "k-draghandle", title: lS.toLanguageString(messages_1.sliderDragTitle, messages_1.messages[messages_1.sliderDragTitle]), style: this.props.vertical
204
+ React.createElement("span", { role: "slider", "aria-valuemin": this.props.min, "aria-valuemax": this.props.max, "aria-valuenow": this.state.value, "aria-valuetext": String(this.state.value), "aria-orientation": this.props.vertical ? 'vertical' : undefined, "aria-disabled": this.props.disabled ? 'true' : undefined, "aria-labelledby": this.props.ariaLabelledBy, "aria-describedby": this.props.ariaDescribedBy, "aria-label": this.props.ariaLabel, tabIndex: (0, kendo_react_common_1.getTabIndex)(this.props.tabIndex, this.props.disabled, undefined), className: "k-draghandle", title: lS.toLanguageString(messages_1.sliderDragTitle, messages_1.messages[messages_1.sliderDragTitle]), style: this.props.vertical
205
205
  ? { bottom: 'calc(' + percentValue + '%)', zIndex: 1 }
206
206
  : this.state.dir === 'rtl' ? { right: 'calc(' + percentValue + '% - 13px)', zIndex: 1 }
207
207
  : { left: 'calc(' + percentValue + '%)', zIndex: 1 } })))))));
@@ -232,7 +232,8 @@ var SliderWithoutContext = /** @class */ (function (_super) {
232
232
  vertical: PropTypes.bool,
233
233
  id: PropTypes.string,
234
234
  ariaLabelledBy: PropTypes.string,
235
- ariaDescribedBy: PropTypes.string
235
+ ariaDescribedBy: PropTypes.string,
236
+ ariaLabel: PropTypes.string
236
237
  // TODO: validation when buttons is set to true, but no step is provided
237
238
  };
238
239
  return SliderWithoutContext;
@@ -29,7 +29,7 @@ var SliderLabel = function (props) {
29
29
  ? { bottom: "".concat(props.position, "%") }
30
30
  : (_a = {}, _a[dir === 'rtl' ? 'right' : 'left'] = "".concat(props.position, "%"), _a);
31
31
  var tickStyle = props.vertical ? 'k-tick-vertical' : 'k-tick-horizontal';
32
- return (React.createElement("li", { ref: sliderLabelRef, role: "presentation", className: "k-tick k-tick-large ".concat(tickStyle), title: props.title, style: __assign({ zIndex: 1, position: 'absolute' }, style) },
32
+ return (React.createElement("li", { ref: sliderLabelRef, className: "k-tick k-tick-large ".concat(tickStyle), title: props.title, style: __assign({ zIndex: 1, position: 'absolute' }, style) },
33
33
  React.createElement("span", __assign({}, (_b = {}, _b[exports.SLIDER_LABEL_ATTRIBUTE] = true, _b), { className: "k-label", onClick: props.onClick }), props.children)));
34
34
  };
35
35
  exports.SliderLabel = SliderLabel;
@@ -104,6 +104,7 @@ var SwitchWithoutContext = /** @class */ (function (_super) {
104
104
  var keyCode = event.keyCode;
105
105
  if (keyCode === kendo_react_common_1.Keys.space || keyCode === kendo_react_common_1.Keys.enter) {
106
106
  _this.toggle(!_this.value, event);
107
+ event.preventDefault();
107
108
  }
108
109
  };
109
110
  _this.handleWrapperFocus = function (event) {