survey-react-ui 2.0.10 → 2.1.0

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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * surveyjs - Survey JavaScript library v2.0.10
2
+ * surveyjs - Survey JavaScript library v2.1.0
3
3
  * Copyright (c) 2015-2025 Devsoft Baltic OÜ - http://surveyjs.io/
4
4
  * License: MIT (http://www.opensource.org/licenses/mit-license.php)
5
5
  */
@@ -1925,7 +1925,7 @@ class PopupModal extends SurveyElementBase {
1925
1925
  PopupModal.modalDescriptors = [];
1926
1926
 
1927
1927
  /*!
1928
- * surveyjs - Survey JavaScript library v2.0.10
1928
+ * surveyjs - Survey JavaScript library v2.1.0
1929
1929
  * Copyright (c) 2015-2025 Devsoft Baltic OÜ - http://surveyjs.io/
1930
1930
  * License: MIT (http://www.opensource.org/licenses/mit-license.php)
1931
1931
  */
@@ -1995,7 +1995,7 @@ var iconsV1 = {
1995
1995
  };
1996
1996
 
1997
1997
  /*!
1998
- * surveyjs - Survey JavaScript library v2.0.10
1998
+ * surveyjs - Survey JavaScript library v2.1.0
1999
1999
  * Copyright (c) 2015-2025 Devsoft Baltic OÜ - http://surveyjs.io/
2000
2000
  * License: MIT (http://www.opensource.org/licenses/mit-license.php)
2001
2001
  */
@@ -2479,7 +2479,7 @@ class SurveyPanel extends SurveyPanelBase {
2479
2479
  }
2480
2480
  renderContent(style, rows, className) {
2481
2481
  const bottom = this.renderBottom();
2482
- return (React.createElement("div", { style: style, className: className, id: this.panel.contentId },
2482
+ return (React.createElement("div", { style: style, className: className, id: this.panel.contentId, role: this.panel.ariaRole, "aria-labelledby": this.panel.ariaLabelledBy, "aria-label": this.panel.ariaLabel },
2483
2483
  rows,
2484
2484
  bottom));
2485
2485
  }
@@ -2744,6 +2744,9 @@ class SurveyQuestionCheckboxItem extends ReactSurveyElement {
2744
2744
  get hideCaption() {
2745
2745
  return this.props.hideCaption === true;
2746
2746
  }
2747
+ get ariaLabel() {
2748
+ return this.props.ariaLabel || null;
2749
+ }
2747
2750
  componentDidUpdate(prevProps, prevState) {
2748
2751
  super.componentDidUpdate(prevProps, prevState);
2749
2752
  if (prevProps.item !== this.props.item && !this.question.isDesignMode) {
@@ -2780,7 +2783,7 @@ class SurveyQuestionCheckboxItem extends ReactSurveyElement {
2780
2783
  const itemLabel = !this.hideCaption ? React.createElement("span", { className: this.cssClasses.controlLabel }, this.renderLocString(this.item.locText, this.textStyle)) : null;
2781
2784
  return (React.createElement("div", { className: itemClass, role: "presentation", ref: this.rootRef },
2782
2785
  React.createElement("label", { className: labelClass },
2783
- React.createElement("input", { className: this.cssClasses.itemControl, type: "checkbox", name: this.question.name + this.item.id, value: this.item.value, id: id, style: this.inputStyle, disabled: !this.question.getItemEnabled(this.item), readOnly: this.question.isReadOnlyAttr, checked: isChecked, onChange: this.handleOnChange, required: this.question.hasRequiredError() }),
2786
+ React.createElement("input", { className: this.cssClasses.itemControl, type: "checkbox", name: this.question.name + this.item.id, value: this.item.value, id: id, style: this.inputStyle, disabled: !this.question.getItemEnabled(this.item), readOnly: this.question.isReadOnlyAttr, checked: isChecked, onChange: this.handleOnChange, required: this.question.hasRequiredError(), "aria-label": this.ariaLabel }),
2784
2787
  this.cssClasses.materialDecorator ?
2785
2788
  React.createElement("span", { className: this.cssClasses.materialDecorator }, this.question.itemSvgIcon ?
2786
2789
  React.createElement("svg", { className: this.cssClasses.itemDecorator },
@@ -3943,6 +3946,9 @@ class SurveyQuestionRadioItem extends ReactSurveyElement {
3943
3946
  get hideCaption() {
3944
3947
  return this.props.hideCaption === true;
3945
3948
  }
3949
+ get ariaLabel() {
3950
+ return this.props.ariaLabel || null;
3951
+ }
3946
3952
  shouldComponentUpdate(nextProps, nextState) {
3947
3953
  if (!super.shouldComponentUpdate(nextProps, nextState))
3948
3954
  return false;
@@ -3980,7 +3986,7 @@ class SurveyQuestionRadioItem extends ReactSurveyElement {
3980
3986
  const itemLabel = !this.hideCaption ? React.createElement("span", { className: controlLabelClass }, this.renderLocString(this.item.locText, this.textStyle)) : null;
3981
3987
  return (React.createElement("div", { className: itemClass, role: "presentation", ref: this.rootRef },
3982
3988
  React.createElement("label", { onMouseDown: this.handleOnMouseDown, className: labelClass },
3983
- React.createElement("input", { "aria-errormessage": this.question.ariaErrormessage, className: this.cssClasses.itemControl, id: this.question.getItemId(this.item), type: "radio", name: this.question.questionName, checked: this.isChecked, value: this.item.value, disabled: !this.question.getItemEnabled(this.item), readOnly: this.question.isReadOnlyAttr, onChange: this.handleOnChange }),
3989
+ React.createElement("input", { "aria-errormessage": this.question.ariaErrormessage, className: this.cssClasses.itemControl, id: this.question.getItemId(this.item), type: "radio", name: this.question.questionName, checked: this.isChecked, value: this.item.value, disabled: !this.question.getItemEnabled(this.item), readOnly: this.question.isReadOnlyAttr, onChange: this.handleOnChange, "aria-label": this.ariaLabel }),
3984
3990
  this.cssClasses.materialDecorator ?
3985
3991
  React.createElement("span", { className: this.cssClasses.materialDecorator }, this.question.itemSvgIcon ?
3986
3992
  React.createElement("svg", { className: this.cssClasses.itemDecorator },
@@ -4601,11 +4607,14 @@ class SurveyQuestionMatrixDropdownCell extends SurveyQuestionAndErrorsCell {
4601
4607
  }
4602
4608
  renderCellCheckboxButton() {
4603
4609
  var key = this.cell.question.id + "item" + this.cell.choiceIndex;
4604
- return (React.createElement(SurveyQuestionCheckboxItem, { key: key, question: this.cell.question, cssClasses: this.cell.question.cssClasses, isDisplayMode: this.cell.question.isInputReadOnly, item: this.cell.item, isFirst: this.cell.isFirstChoice, index: this.cell.choiceIndex.toString(), hideCaption: true }));
4610
+ return (React.createElement(SurveyQuestionCheckboxItem, { key: key, question: this.cell.question, cssClasses: this.cell.question.cssClasses, isDisplayMode: this.cell.question.isInputReadOnly, item: this.cell.item, isFirst: this.cell.isFirstChoice, index: this.cell.choiceIndex.toString(), hideCaption: true, ariaLabel: this.getCellAriaLabel() }));
4605
4611
  }
4606
4612
  renderCellRadiogroupButton() {
4607
4613
  var key = this.cell.question.id + "item" + this.cell.choiceIndex;
4608
- return (React.createElement(SurveyQuestionRadioItem, { key: key, question: this.cell.question, cssClasses: this.cell.question.cssClasses, isDisplayMode: this.cell.question.isInputReadOnly, item: this.cell.item, index: this.cell.choiceIndex.toString(), isChecked: this.cell.question.value === this.cell.item.value, isDisabled: this.cell.question.isReadOnly || !this.cell.item.isEnabled, hideCaption: true }));
4614
+ return (React.createElement(SurveyQuestionRadioItem, { key: key, question: this.cell.question, cssClasses: this.cell.question.cssClasses, isDisplayMode: this.cell.question.isInputReadOnly, item: this.cell.item, index: this.cell.choiceIndex.toString(), isChecked: this.cell.question.value === this.cell.item.value, isDisabled: this.cell.question.isReadOnly || !this.cell.item.isEnabled, hideCaption: true, ariaLabel: this.getCellAriaLabel() }));
4615
+ }
4616
+ getCellAriaLabel() {
4617
+ return this.question.parentQuestion.getCellAriaLabel(this.cell.row.locText.renderedHtml, this.cell.column.locTitle.renderedHtml);
4609
4618
  }
4610
4619
  }
4611
4620
 
@@ -5051,7 +5060,7 @@ class List extends SurveyElementBase {
5051
5060
  return null;
5052
5061
  const items = this.renderItems();
5053
5062
  const ulStyle = { display: this.model.isEmpty ? "none" : null };
5054
- return (React.createElement("ul", { className: this.model.getListClass(), style: ulStyle, role: this.model.listRole, "aria-label": this.model.a11yInputAriaLabel, id: this.model.elementId, onMouseDown: (e) => {
5063
+ return (React.createElement("ul", { className: this.model.getListClass(), style: ulStyle, role: this.model.listRole, "aria-label": this.model.a11ya11y_input_ariaLabel, id: this.model.elementId, onMouseDown: (e) => {
5055
5064
  e.preventDefault();
5056
5065
  }, onKeyDown: this.handleKeydown, onMouseMove: this.handleMouseMove }, items));
5057
5066
  }
@@ -5182,6 +5191,91 @@ ReactQuestionFactory.Instance.registerQuestion("sv-rating-dropdown", (props) =>
5182
5191
  });
5183
5192
  RendererFactory.Instance.registerRenderer("rating", "dropdown", "sv-rating-dropdown");
5184
5193
 
5194
+ class SurveyQuestionSlider extends SurveyQuestionElementBase {
5195
+ constructor(props) {
5196
+ super(props);
5197
+ this.rangeInputRef = React.createRef();
5198
+ }
5199
+ componentDidMount() {
5200
+ super.componentDidMount();
5201
+ this.question.refreshInputRange(this.rangeInputRef.current);
5202
+ }
5203
+ get question() {
5204
+ return this.questionBase;
5205
+ }
5206
+ getStateElement() {
5207
+ return this.question;
5208
+ }
5209
+ renderElement() {
5210
+ const { cssClasses, showLabels, sliderType, getTrackPercentLeft, getTrackPercentRight, allowDragRange, setValueByClickOnPath } = this.question;
5211
+ const rangeInput = (sliderType === "single" && allowDragRange) ? null : this.getRangeInput();
5212
+ const thumbsAndInputs = this.getInputsAndThumbs();
5213
+ const labels = showLabels ? this.getLabels() : null;
5214
+ return (React.createElement("div", { className: this.question.rootCss, ref: (div) => (this.setControl(div)) },
5215
+ rangeInput,
5216
+ React.createElement("div", { className: cssClasses.visualContainer, onPointerUp: (e) => { setValueByClickOnPath(e.nativeEvent, this.control); } },
5217
+ React.createElement("div", { className: cssClasses.visualContainerSlider },
5218
+ React.createElement("div", { className: cssClasses.inverseTrackLeft, style: { width: getTrackPercentLeft() + "%" } }),
5219
+ React.createElement("div", { className: cssClasses.inverseTrackRight, style: { width: getTrackPercentRight() + "%" } }),
5220
+ React.createElement("div", { className: cssClasses.rangeTrack, style: { left: getTrackPercentLeft() + "%", right: getTrackPercentRight() + "%" } }),
5221
+ thumbsAndInputs)),
5222
+ labels));
5223
+ }
5224
+ getInputsAndThumbs() {
5225
+ const inputsAndThumbs = [];
5226
+ const value = this.question.getRenderedValue();
5227
+ for (let i = 0; i < value.length; i++) {
5228
+ const thumbAndInput = React.createElement(React.Fragment, { key: i },
5229
+ this.getInput(i),
5230
+ this.getThumb(i));
5231
+ inputsAndThumbs.push(thumbAndInput);
5232
+ }
5233
+ return inputsAndThumbs;
5234
+ }
5235
+ getThumb(i) {
5236
+ const { cssClasses, getThumbContainerCss, tooltipVisibility, tooltipCss, getPercent, getRenderedValue, getTooltipValue } = this.question;
5237
+ const value = getRenderedValue()[i];
5238
+ let tooltip = null;
5239
+ if (tooltipVisibility !== "never") {
5240
+ tooltip = React.createElement("div", { className: tooltipCss },
5241
+ React.createElement("div", { className: cssClasses.tooltipPanel },
5242
+ React.createElement("div", { className: cssClasses.tooltipValue }, getTooltipValue(i))));
5243
+ }
5244
+ const thumb = React.createElement("div", { className: getThumbContainerCss(i), style: { left: getPercent(value) + "%" } },
5245
+ tooltip,
5246
+ React.createElement("div", { className: cssClasses.thumb },
5247
+ React.createElement("div", { className: cssClasses.thumbDot })));
5248
+ return thumb;
5249
+ }
5250
+ getInput(i) {
5251
+ const { renderedMax: max, renderedMin: min, step, cssClasses, isDisabledAttr, getRenderedValue, handleOnChange, handlePointerDown, handlePointerUp, handleKeyDown, handleKeyUp, handleOnFocus, handleOnBlur } = this.question;
5252
+ const value = getRenderedValue()[i];
5253
+ const input = React.createElement("input", { className: cssClasses.input, id: "sjs-slider-input-" + i, type: "range", min: min, max: max, step: step, value: value, onChange: (e) => { handleOnChange(e.nativeEvent, i); }, onPointerDown: (e) => { handlePointerDown(e.nativeEvent); }, onPointerUp: (e) => { e.stopPropagation(); handlePointerUp(e.nativeEvent); }, onKeyDown: (e) => { handleKeyDown(e.nativeEvent); }, onKeyUp: (e) => { handleKeyUp(e.nativeEvent); }, onFocus: () => { handleOnFocus(i); }, onBlur: () => { handleOnBlur(); }, disabled: isDisabledAttr, "aria-required": this.question.a11y_input_ariaRequired, "aria-label": this.question.a11y_input_ariaLabel, "aria-labelledby": this.question.a11y_input_ariaLabelledBy, "aria-describedby": this.question.a11y_input_ariaDescribedBy, "aria-invalid": this.question.a11y_input_ariaInvalid, "aria-errormessage": this.question.a11y_input_ariaErrormessage });
5254
+ return input;
5255
+ }
5256
+ getRangeInput() {
5257
+ const { renderedMax: max, renderedMin: min, step, cssClasses, handleRangeOnChange, handleRangePointerDown, handleRangePointerUp } = this.question;
5258
+ return React.createElement("input", { name: "range-input", ref: this.rangeInputRef, className: cssClasses.input, type: "range", "aria-hidden": "true", min: min, max: max, step: step, tabIndex: -1, onChange: (e) => { handleRangeOnChange(e.nativeEvent); }, onPointerDown: (e) => { e.persist(); handleRangePointerDown(e.nativeEvent, this.control); }, onPointerUp: (e) => { handleRangePointerUp(e.nativeEvent, this.control); } });
5259
+ }
5260
+ getLabels() {
5261
+ const labels = [];
5262
+ const { renderedLabels, cssClasses, handleLabelPointerUp, getLabelCss } = this.question;
5263
+ for (let i = 0; i < renderedLabels.length; i++) {
5264
+ const value = renderedLabels[i].value;
5265
+ const text = renderedLabels[i].locText;
5266
+ const label = React.createElement("div", { key: i, className: getLabelCss(i), style: { left: value + "%" }, onPointerUp: (e) => { handleLabelPointerUp(e.nativeEvent, i); } },
5267
+ React.createElement("div", { className: cssClasses.labelTick }),
5268
+ React.createElement("div", { className: cssClasses.labelText }, this.renderLocString(text)));
5269
+ labels.push(label);
5270
+ }
5271
+ return React.createElement("div", { className: cssClasses.labelsContainer },
5272
+ React.createElement("div", null, labels));
5273
+ }
5274
+ }
5275
+ ReactQuestionFactory.Instance.registerQuestion("slider", (props) => {
5276
+ return React.createElement(SurveyQuestionSlider, props);
5277
+ });
5278
+
5185
5279
  class SurveyQuestionExpression extends SurveyQuestionElementBase {
5186
5280
  constructor(props) {
5187
5281
  super(props);
@@ -6085,7 +6179,7 @@ ReactElementFactory.Instance.registerElement(LocalizableString.editableRenderer,
6085
6179
  return React.createElement(SurveyLocStringEditor, props);
6086
6180
  });
6087
6181
 
6088
- checkLibraryVersion(`${"2.0.10"}`, "survey-react-ui");
6182
+ checkLibraryVersion(`${"2.1.0"}`, "survey-react-ui");
6089
6183
 
6090
- export { CharacterCounterComponent, ComponentsContainer, Header, HeaderCell, HeaderMobile, List, ListItemContent, ListItemGroup, LoadingIndicatorComponent, LogoImage, MatrixRow, NotifierComponent, Popup, PopupModal, PopupSurvey, QuestionErrorComponent, RatingDropdownItem, RatingItem, RatingItemSmiley, RatingItemStar, ReactElementFactory, ReactQuestionFactory, ReactSurveyElement, ReactSurveyElementsWrapper, Scroll, Skeleton, Survey, SurveyActionBar, SurveyElementBase, SurveyElementErrors, SurveyFileChooseButton, SurveyFilePreview, SurveyFlowPanel, SurveyHeader, SurveyLocStringEditor, SurveyLocStringViewer, SurveyNavigationBase, SurveyNavigationButton, SurveyPage, SurveyPanel, SurveyProgress, SurveyProgressButtons, SurveyProgressToc, SurveyQuestion, SurveyQuestionAndErrorsCell, SurveyQuestionBoolean, SurveyQuestionBooleanCheckbox, SurveyQuestionBooleanRadio, SurveyQuestionButtonGroup, SurveyQuestionButtonGroupDropdown, SurveyQuestionCheckbox, SurveyQuestionCheckboxItem, SurveyQuestionComment, SurveyQuestionCommentItem, SurveyQuestionComposite, SurveyQuestionCustom, SurveyQuestionDropdown, SurveyQuestionDropdownBase, SurveyQuestionDropdownSelect, SurveyQuestionElementBase, SurveyQuestionEmpty, SurveyQuestionExpression, SurveyQuestionFile, SurveyQuestionHtml, SurveyQuestionImage, SurveyQuestionImagePicker, SurveyQuestionMatrix, SurveyQuestionMatrixCell, SurveyQuestionMatrixDetailButton, SurveyQuestionMatrixDropdown, SurveyQuestionMatrixDropdownBase, SurveyQuestionMatrixDropdownCell, SurveyQuestionMatrixDynamic, SurveyQuestionMatrixDynamicAddButton, SurveyQuestionMatrixDynamicDragDropIcon, SurveyQuestionMatrixDynamicRemoveButton, SurveyQuestionMatrixRow, SurveyQuestionMultipleText, SurveyQuestionOptionItem, SurveyQuestionPanelDynamic, SurveyQuestionPanelDynamicAddButton, SurveyQuestionPanelDynamicNextButton, SurveyQuestionPanelDynamicPrevButton, SurveyQuestionPanelDynamicProgressText, SurveyQuestionPanelDynamicRemoveButton, SurveyQuestionRadioItem, SurveyQuestionRadiogroup, SurveyQuestionRanking, SurveyQuestionRankingItem, SurveyQuestionRankingItemContent, SurveyQuestionRating, SurveyQuestionRatingDropdown, SurveyQuestionSignaturePad, SurveyQuestionTagbox, SurveyQuestionTagboxItem, SurveyQuestionText, SurveyRow, SurveyTimerPanel, SurveyWindow, SvgBundleComponent, SvgIcon, TagboxFilterString, TitleActions, TitleElement, attachKey2click };
6184
+ export { CharacterCounterComponent, ComponentsContainer, Header, HeaderCell, HeaderMobile, List, ListItemContent, ListItemGroup, LoadingIndicatorComponent, LogoImage, MatrixRow, NotifierComponent, Popup, PopupModal, PopupSurvey, QuestionErrorComponent, RatingDropdownItem, RatingItem, RatingItemSmiley, RatingItemStar, ReactElementFactory, ReactQuestionFactory, ReactSurveyElement, ReactSurveyElementsWrapper, Scroll, Skeleton, Survey, SurveyActionBar, SurveyElementBase, SurveyElementErrors, SurveyFileChooseButton, SurveyFilePreview, SurveyFlowPanel, SurveyHeader, SurveyLocStringEditor, SurveyLocStringViewer, SurveyNavigationBase, SurveyNavigationButton, SurveyPage, SurveyPanel, SurveyProgress, SurveyProgressButtons, SurveyProgressToc, SurveyQuestion, SurveyQuestionAndErrorsCell, SurveyQuestionBoolean, SurveyQuestionBooleanCheckbox, SurveyQuestionBooleanRadio, SurveyQuestionButtonGroup, SurveyQuestionButtonGroupDropdown, SurveyQuestionCheckbox, SurveyQuestionCheckboxItem, SurveyQuestionComment, SurveyQuestionCommentItem, SurveyQuestionComposite, SurveyQuestionCustom, SurveyQuestionDropdown, SurveyQuestionDropdownBase, SurveyQuestionDropdownSelect, SurveyQuestionElementBase, SurveyQuestionEmpty, SurveyQuestionExpression, SurveyQuestionFile, SurveyQuestionHtml, SurveyQuestionImage, SurveyQuestionImagePicker, SurveyQuestionMatrix, SurveyQuestionMatrixCell, SurveyQuestionMatrixDetailButton, SurveyQuestionMatrixDropdown, SurveyQuestionMatrixDropdownBase, SurveyQuestionMatrixDropdownCell, SurveyQuestionMatrixDynamic, SurveyQuestionMatrixDynamicAddButton, SurveyQuestionMatrixDynamicDragDropIcon, SurveyQuestionMatrixDynamicRemoveButton, SurveyQuestionMatrixRow, SurveyQuestionMultipleText, SurveyQuestionOptionItem, SurveyQuestionPanelDynamic, SurveyQuestionPanelDynamicAddButton, SurveyQuestionPanelDynamicNextButton, SurveyQuestionPanelDynamicPrevButton, SurveyQuestionPanelDynamicProgressText, SurveyQuestionPanelDynamicRemoveButton, SurveyQuestionRadioItem, SurveyQuestionRadiogroup, SurveyQuestionRanking, SurveyQuestionRankingItem, SurveyQuestionRankingItemContent, SurveyQuestionRating, SurveyQuestionRatingDropdown, SurveyQuestionSignaturePad, SurveyQuestionSlider, SurveyQuestionTagbox, SurveyQuestionTagboxItem, SurveyQuestionText, SurveyRow, SurveyTimerPanel, SurveyWindow, SvgBundleComponent, SvgIcon, TagboxFilterString, TitleActions, TitleElement, attachKey2click };
6091
6185
  //# sourceMappingURL=survey-react-ui.mjs.map