survey-react-ui 3.0.0-beta.5 → 3.0.0-beta.7

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,10 +1,10 @@
1
1
  /*!
2
- * surveyjs - Survey JavaScript library v3.0.0-beta.5
2
+ * surveyjs - Survey JavaScript library v3.0.0-beta.7
3
3
  * Copyright (c) 2015-2026 Devsoft Baltic OÜ - http://surveyjs.io/
4
4
  * License: MIT (http://www.opensource.org/licenses/mit-license.php)
5
5
  */
6
6
 
7
- import { SurveyModel, Helpers, createSvg, LocalizableString, createPopupViewModel, CssClassBuilder, ActionDropdownViewModel, RendererFactory, doKey2ClickUp, SvgRegistry, PopupModalManager, settings, ScrollViewModel, addIconsToThemeSet, doKey2ClickBlur, doKey2ClickDown, ResizeManager, Question, SurveyProgressModel, ProgressButtonsResponsivityManager, PopupSurveyModel, ButtonGroupItemModel, checkLibraryVersion } from 'survey-core';
7
+ import { SurveyModel, Helpers, createSvg, LocalizableString, createPopupViewModel, CssClassBuilder, ActionDropdownViewModel, RendererFactory, doKey2ClickUp, SvgRegistry, PopupModalManager, settings, ScrollViewModel, addIconsToThemeSet, doKey2ClickBlur, doKey2ClickDown, ResizeManager, Question, QuestionTextModel, SurveyProgressModel, PopupSurveyModel, ButtonGroupItemModel, checkLibraryVersion } from 'survey-core';
8
8
  export { SurveyModel as Model, SurveyModel, SurveyWindowModel, settings, surveyLocalization, surveyStrings } from 'survey-core';
9
9
  import * as React from 'react';
10
10
  import * as ReactDOM from 'react-dom';
@@ -451,8 +451,8 @@ class SurveyLocStringViewer extends React.Component {
451
451
  this.locStr.onStringChanged.remove(this.onChangedHandler);
452
452
  }
453
453
  componentDidUpdate(prevProps, prevState) {
454
- if (!!prevProps.locStr) {
455
- prevProps.locStr.onStringChanged.remove(this.onChangedHandler);
454
+ if (!!prevProps.model) {
455
+ prevProps.model.onStringChanged.remove(this.onChangedHandler);
456
456
  }
457
457
  this.reactOnStrChanged();
458
458
  }
@@ -1203,6 +1203,8 @@ var navmenu_24x24 = "<svg viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/s
1203
1203
 
1204
1204
  var noimage_48x48 = "<svg viewBox=\"0 0 48 48\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M30.4975 14.2475C28.7075 14.2475 27.2475 15.7075 27.2475 17.4975C27.2475 19.2875 28.7075 20.7475 30.4975 20.7475C32.2875 20.7475 33.7475 19.2875 33.7475 17.4975C33.7475 15.7075 32.2875 14.2475 30.4975 14.2475ZM30.4975 19.2475C29.5375 19.2475 28.7475 18.4575 28.7475 17.4975C28.7475 16.5375 29.5375 15.7475 30.4975 15.7475C31.4575 15.7475 32.2475 16.5375 32.2475 17.4975C32.2475 18.4575 31.4575 19.2475 30.4975 19.2475ZM13.5175 11.2175C13.4375 10.8075 13.7075 10.4175 14.1175 10.3375C14.4275 10.2775 14.7175 10.2475 14.9975 10.2475H32.9975C35.6175 10.2475 37.7475 12.3775 37.7475 14.9975V32.9975C37.7475 33.2775 37.7175 33.5675 37.6575 33.8775C37.5875 34.2375 37.2775 34.4875 36.9175 34.4875C36.8675 34.4875 36.8275 34.4875 36.7775 34.4775C36.3675 34.3975 36.1075 34.0075 36.1775 33.5975C36.2175 33.3775 36.2375 33.1775 36.2375 32.9975V14.9975C36.2375 13.2075 34.7775 11.7475 32.9875 11.7475H14.9975C14.8075 11.7475 14.6175 11.7675 14.3975 11.8075C13.9875 11.8875 13.5975 11.6175 13.5175 11.2075V11.2175ZM34.4775 36.7775C34.5575 37.1875 34.2875 37.5775 33.8775 37.6575C33.5675 37.7175 33.2775 37.7475 32.9975 37.7475H14.9975C12.3775 37.7475 10.2475 35.6175 10.2475 32.9975V14.9975C10.2475 14.7175 10.2775 14.4275 10.3375 14.1175C10.4175 13.7075 10.8075 13.4375 11.2175 13.5175C11.6275 13.5975 11.8875 13.9875 11.8175 14.3975C11.7775 14.6175 11.7575 14.8175 11.7575 14.9975V32.9975C11.7575 34.7875 13.2175 36.2475 15.0075 36.2475H33.0075C33.1975 36.2475 33.3875 36.2275 33.6075 36.1875C34.0075 36.1075 34.4075 36.3775 34.4875 36.7875L34.4775 36.7775ZM15.8275 31.7975C15.6975 31.9375 15.7575 32.0875 15.7775 32.1175C15.8175 32.1975 15.8675 32.2475 15.9375 32.2475H29.8175C30.2275 32.2475 30.5675 32.5875 30.5675 32.9975C30.5675 33.4075 30.2275 33.7475 29.8175 33.7475H15.9375C15.2675 33.7475 14.6775 33.3475 14.3975 32.7175C14.1075 32.0575 14.2375 31.2975 14.7275 30.7775L19.7275 25.2775C20.0475 24.9275 20.5075 24.7175 20.9875 24.7075C21.4875 24.7275 21.9375 24.8875 22.2675 25.2275L25.4675 28.4775C25.7575 28.7675 25.7575 29.2475 25.4675 29.5375C25.1675 29.8275 24.6975 29.8275 24.4075 29.5375L21.2075 26.2875C21.1475 26.2175 21.0675 26.1875 21.0275 26.2075C20.9875 26.2075 20.9075 26.2175 20.8475 26.2875L15.8375 31.7975H15.8275ZM38.5275 38.5275C38.3775 38.6775 38.1875 38.7475 37.9975 38.7475C37.8075 38.7475 37.6175 38.6775 37.4675 38.5275L9.4675 10.5275C9.1775 10.2375 9.1775 9.7575 9.4675 9.4675C9.7575 9.1775 10.2375 9.1775 10.5275 9.4675L38.5275 37.4675C38.8175 37.7575 38.8175 38.2375 38.5275 38.5275Z\"/></svg>";
1205
1205
 
1206
+ var radio_16x16 = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\"><circle cx=\"8\" cy=\"8\" r=\"4\"/></svg>";
1207
+
1206
1208
  var ranking_arrows = "<svg viewBox=\"0 0 10 24\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M10 5L5 0L0 5H4V9H6V5H10Z\"/><path d=\"M6 19V15H4V19H0L5 24L10 19H6Z\"/></svg>";
1207
1209
 
1208
1210
  var rankingundefined_16x16 = "<svg viewBox=\"0 0 16 16\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M11.75 8C11.75 8.41 11.41 8.75 11 8.75H5C4.59 8.75 4.25 8.41 4.25 8C4.25 7.59 4.59 7.25 5 7.25H11C11.41 7.25 11.75 7.59 11.75 8Z\"/></svg>";
@@ -1286,6 +1288,7 @@ const icons = {
1286
1288
  "more-24x24": more_24x24,
1287
1289
  "navmenu-24x24": navmenu_24x24,
1288
1290
  "noimage-48x48": noimage_48x48,
1291
+ "radio-16x16": radio_16x16,
1289
1292
  "ranking-arrows": ranking_arrows,
1290
1293
  "rankingundefined-16x16": rankingundefined_16x16,
1291
1294
  "rating-star-2": rating_star_2,
@@ -1431,6 +1434,11 @@ class Survey extends SurveyElementBase {
1431
1434
  const rootCss = this.survey.getRootCss();
1432
1435
  const cssClasses = this.rootNodeClassName ? this.rootNodeClassName + " " + rootCss : rootCss;
1433
1436
  return (React.createElement("div", { id: this.rootNodeId, ref: this.rootRef, className: cssClasses, style: this.survey.themeVariables, lang: this.survey.locale || "en", dir: this.survey.localeDir },
1437
+ this.survey.generateStylesheet ?
1438
+ React.createElement(React.Fragment, null,
1439
+ React.createElement("style", null, this.survey.themeStyle),
1440
+ React.createElement("style", null, this.survey.resetVariablesStyle))
1441
+ : null,
1434
1442
  React.createElement(Scroll, { disabled: this.survey.rootScrollDisabled },
1435
1443
  this.survey.needRenderIcons ? React.createElement(SvgBundleComponent, null) : null,
1436
1444
  React.createElement(PopupModal, null),
@@ -4125,6 +4133,13 @@ class SurveyQuestionText extends SurveyQuestionUncontrolledElement {
4125
4133
  }
4126
4134
  return React.createElement("datalist", { id: this.question.dataListId }, options);
4127
4135
  }
4136
+ componentDidUpdate(prevProps, prevState) {
4137
+ var _a;
4138
+ super.componentDidUpdate(prevProps, prevState);
4139
+ if (this.question && this.question instanceof QuestionTextModel) {
4140
+ (_a = this.question) === null || _a === void 0 ? void 0 : _a.updateInputValueFromMask();
4141
+ }
4142
+ }
4128
4143
  }
4129
4144
  ReactQuestionFactory.Instance.registerQuestion("text", (props) => {
4130
4145
  return React.createElement(SurveyQuestionText, props);
@@ -4238,11 +4253,13 @@ class SurveyQuestionBooleanRadio extends SurveyQuestionBoolean {
4238
4253
  renderRadioItem(value, locText) {
4239
4254
  const cssClasses = this.question.cssClasses;
4240
4255
  const handleOnChange = () => {
4241
- this.question.value = value;
4256
+ if (!this.question.isInputReadOnly) {
4257
+ this.question.value = value;
4258
+ }
4242
4259
  };
4243
4260
  return (React.createElement("div", { role: "presentation", className: this.question.getRadioItemClass(cssClasses, value) },
4244
4261
  React.createElement("label", { className: cssClasses.radioLabel },
4245
- React.createElement("input", { type: "radio", name: this.question.name, value: value, "aria-errormessage": this.question.ariaErrormessage, checked: value === this.question.value, disabled: this.question.isDisabledAttr, readOnly: this.question.isReadOnlyAttr, className: cssClasses.itemRadioControl, onChange: handleOnChange }),
4262
+ React.createElement("input", { type: "radio", name: this.question.questionName, value: value, "aria-errormessage": this.question.ariaErrormessage, checked: value === this.question.value, disabled: this.question.isDisabledAttr, readOnly: this.question.isReadOnlyAttr, className: cssClasses.itemRadioControl, onChange: handleOnChange }),
4246
4263
  this.question.cssClasses.materialRadioDecorator ?
4247
4264
  (React.createElement("span", { className: cssClasses.materialRadioDecorator }, this.question.itemSvgIcon ?
4248
4265
  (React.createElement("svg", { className: cssClasses.itemRadioDecorator },
@@ -4251,7 +4268,7 @@ class SurveyQuestionBooleanRadio extends SurveyQuestionBoolean {
4251
4268
  }
4252
4269
  renderElement() {
4253
4270
  const cssClasses = this.question.cssClasses;
4254
- return (React.createElement("div", { className: cssClasses.rootRadio },
4271
+ return (React.createElement("div", { className: cssClasses.rootRadio, onKeyDown: this.handleOnKeyDown },
4255
4272
  React.createElement("fieldset", { role: "presentation", className: cssClasses.radioFieldset }, !this.question.swapOrder ?
4256
4273
  (React.createElement(React.Fragment, null,
4257
4274
  this.renderRadioItem(this.question.getValueFalse(), this.question.locLabelFalse),
@@ -4879,23 +4896,29 @@ class SurveyProgress extends SurveyNavigationBase {
4879
4896
  get isTop() {
4880
4897
  return this.props.isTop;
4881
4898
  }
4899
+ get model() {
4900
+ return this.props.model;
4901
+ }
4902
+ getStateElement() {
4903
+ return this.model;
4904
+ }
4882
4905
  get progress() {
4883
- return this.survey.progressValue;
4906
+ return this.model.progressValue;
4884
4907
  }
4885
4908
  get progressText() {
4886
- return this.survey.progressText;
4909
+ return this.model.progressText;
4887
4910
  }
4888
4911
  get progressBarAriaLabel() {
4889
- return this.survey.progressBarAriaLabel;
4912
+ return this.model.progressBarAriaLabel;
4890
4913
  }
4891
4914
  render() {
4892
4915
  var progressStyle = {
4893
4916
  width: this.progress + "%",
4894
4917
  };
4895
- return (React.createElement("div", { className: this.survey.getProgressCssClasses(this.props.container) },
4896
- React.createElement("div", { style: progressStyle, className: this.css.progressBar, role: "progressbar", "aria-valuemin": 0, "aria-valuemax": 100, "aria-label": this.progressBarAriaLabel },
4897
- React.createElement("span", { className: SurveyProgressModel.getProgressTextInBarCss(this.css) }, this.progressText)),
4898
- React.createElement("span", { className: SurveyProgressModel.getProgressTextUnderBarCss(this.css) }, this.progressText)));
4918
+ return (React.createElement("div", { className: this.model.getProgressCssClasses(this.props.container) },
4919
+ React.createElement("div", { style: progressStyle, className: this.model.css.progressBar, role: "progressbar", "aria-valuemin": 0, "aria-valuemax": 100, "aria-label": this.progressBarAriaLabel },
4920
+ React.createElement("span", { className: SurveyProgressModel.getProgressTextInBarCss(this.model.css) }, this.progressText)),
4921
+ React.createElement("span", { className: SurveyProgressModel.getProgressTextUnderBarCss(this.model.css) }, this.progressText)));
4899
4922
  }
4900
4923
  }
4901
4924
  ReactElementFactory.Instance.registerElement("sv-progress-pages", props => {
@@ -4914,7 +4937,6 @@ ReactElementFactory.Instance.registerElement("sv-progress-requiredquestions", pr
4914
4937
  class SurveyProgressButtons extends SurveyNavigationBase {
4915
4938
  constructor(props) {
4916
4939
  super(props);
4917
- this.listContainerRef = React.createRef();
4918
4940
  }
4919
4941
  get model() {
4920
4942
  return this.props.model;
@@ -4925,28 +4947,11 @@ class SurveyProgressButtons extends SurveyNavigationBase {
4925
4947
  getStateElement() {
4926
4948
  return this.model;
4927
4949
  }
4928
- onResize(canShowItemTitles) {
4929
- this.setState({ canShowItemTitles });
4930
- this.setState({ canShowHeader: !canShowItemTitles });
4931
- }
4932
- onUpdateScroller(hasScroller) {
4933
- this.setState({ hasScroller });
4934
- }
4935
- onUpdateSettings() {
4936
- this.setState({ canShowItemTitles: this.model.showItemTitles });
4937
- this.setState({ canShowFooter: !this.model.showItemTitles });
4938
- }
4939
4950
  render() {
4940
- return (React.createElement("div", { className: this.model.getRootCss(this.props.container), style: { "maxWidth": this.model.progressWidth, ["--sd-progress-buttons-pages-count"]: this.model.visiblePages.length }, role: "progressbar", "aria-valuemin": 0, "aria-valuemax": 100, "aria-label": this.model.progressBarAriaLabel },
4941
- this.state.canShowHeader ? React.createElement("div", { className: this.css.progressButtonsHeader },
4942
- React.createElement("div", { className: this.css.progressButtonsPageTitle, title: this.model.headerText }, this.model.headerText)) : null,
4943
- React.createElement("div", { className: this.css.progressButtonsContainer },
4944
- React.createElement("div", { className: this.model.getScrollButtonCss(this.state.hasScroller, true), role: "button", onClick: () => this.clickScrollButton(this.listContainerRef.current, true) }),
4945
- React.createElement("div", { className: this.css.progressButtonsListContainer, ref: this.listContainerRef },
4946
- React.createElement("ul", { className: this.css.progressButtonsList }, this.getListElements())),
4947
- React.createElement("div", { className: this.model.getScrollButtonCss(this.state.hasScroller, false), role: "button", onClick: () => this.clickScrollButton(this.listContainerRef.current, false) })),
4948
- this.state.canShowFooter ? React.createElement("div", { className: this.css.progressButtonsFooter },
4949
- React.createElement("div", { className: this.css.progressButtonsPageTitle, title: this.model.footerText }, this.model.footerText)) : null));
4951
+ return (React.createElement("div", { className: this.model.getRootCss(this.props.container), style: { "maxWidth": this.model.progressWidth }, role: "tablist", "aria-label": this.model.progressBarAriaLabel, onKeyDown: (event) => this.model.onKeyDown(event.nativeEvent) },
4952
+ React.createElement("div", { className: this.css.progressButtonsContainer, role: "presentation" },
4953
+ React.createElement("div", { className: this.css.progressButtonsListContainer, role: "presentation" },
4954
+ React.createElement("ul", { className: this.css.progressButtonsList, role: "presentation" }, this.getListElements())))));
4950
4955
  }
4951
4956
  getListElements() {
4952
4957
  let buttons = [];
@@ -4957,32 +4962,16 @@ class SurveyProgressButtons extends SurveyNavigationBase {
4957
4962
  }
4958
4963
  renderListElement(page, index) {
4959
4964
  const text = SurveyElementBase.renderLocString(page.locNavigationTitle);
4960
- return (React.createElement("li", { key: "listelement" + index, className: this.model.getListElementCss(index), onClick: this.model.isListElementClickable(index)
4961
- ? () => this.model.clickListElement(page)
4962
- : undefined, "data-page-number": this.model.getItemNumber(page) },
4963
- React.createElement("div", { className: this.css.progressButtonsConnector }),
4964
- this.state.canShowItemTitles ? React.createElement(React.Fragment, null,
4965
- React.createElement("div", { className: this.css.progressButtonsPageTitle, title: page.renderedNavigationTitle }, text),
4966
- React.createElement("div", { className: this.css.progressButtonsPageDescription, title: page.navigationDescription }, page.navigationDescription)) : null,
4967
- React.createElement("div", { className: this.css.progressButtonsButton },
4968
- React.createElement("div", { className: this.css.progressButtonsButtonBackground }),
4969
- React.createElement("div", { className: this.css.progressButtonsButtonContent }),
4970
- React.createElement("span", null, this.model.getItemNumber(page)))));
4971
- }
4972
- clickScrollButton(listContainerElement, isLeftScroll) {
4973
- if (!!listContainerElement) {
4974
- listContainerElement.scrollLeft += (isLeftScroll ? -1 : 1) * 70;
4975
- }
4976
- }
4977
- componentDidMount() {
4978
- super.componentDidMount();
4979
- this.respManager = new ProgressButtonsResponsivityManager(this.model, this.listContainerRef.current, this);
4980
- }
4981
- componentWillUnmount() {
4982
- if (!!this.respManager) {
4983
- this.respManager.dispose();
4984
- }
4985
- super.componentWillUnmount();
4965
+ const onClickHandler = this.model.isListElementClickable(index) ? () => this.model.clickListElement(page) : undefined;
4966
+ return (React.createElement("li", { key: page.uniqueId, className: this.model.getListElementCss(index), "data-page-number": this.model.getItemNumber(page), role: "presentation" },
4967
+ this.model.showItemTitles ? React.createElement("div", { className: this.css.progressButtonsPageTitle, title: page.renderedNavigationTitle, onClick: onClickHandler }, text) : null,
4968
+ this.model.showItemDescriptions ? React.createElement("div", { className: this.css.progressButtonsPageDescription, title: page.navigationDescription, onClick: onClickHandler }, page.navigationDescription) : null,
4969
+ React.createElement("button", { className: this.css.progressButtonsButton, onClick: onClickHandler, role: "tab", type: "button", "aria-selected": this.model.isPageSelected(index), "aria-label": this.model.getButtonAriaLabel(page), tabIndex: this.model.getTabIndex(index), "data-page-index": index }, this.model.showItemNumbers ?
4970
+ this.model.getItemNumber(page) :
4971
+ this.model.isListElementPassed(index) ?
4972
+ React.createElement("svg", { className: this.css.progressButtonsCheckIcon },
4973
+ React.createElement("use", { xlinkHref: `#icon-${this.css.progressButtonsCheckIconId}` })) :
4974
+ React.createElement("div", { className: this.css.progressButtonsDot }))));
4986
4975
  }
4987
4976
  }
4988
4977
  ReactElementFactory.Instance.registerElement("sv-progress-buttons", (props) => {
@@ -6097,7 +6086,7 @@ ReactElementFactory.Instance.registerElement(LocalizableString.editableRenderer,
6097
6086
  return React.createElement(SurveyLocStringEditor, props);
6098
6087
  });
6099
6088
 
6100
- checkLibraryVersion(`${"3.0.0-beta.5"}`, "survey-react-ui");
6089
+ checkLibraryVersion(`${"3.0.0-beta.7"}`, "survey-react-ui");
6101
6090
 
6102
6091
  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, SliderLabelItem, Survey, SurveyActionBar, SurveyElementBase, SurveyElementErrors, SurveyFileChooseButton, SurveyFileItem, SurveyFilePreview, SurveyFlowPanel, SurveyHeader, SurveyLocStringEditor, SurveyLocStringViewer, SurveyNavigationBase, 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, SurveyQuestionImageMap, SurveyQuestionImagePicker, SurveyQuestionMatrix, SurveyQuestionMatrixCell, SurveyQuestionMatrixDropdown, SurveyQuestionMatrixDropdownBase, SurveyQuestionMatrixDropdownCell, SurveyQuestionMatrixDynamic, SurveyQuestionMatrixDynamicDragDropIcon, SurveyQuestionMatrixRow, SurveyQuestionMultipleText, SurveyQuestionOptionItem, SurveyQuestionPanelDynamic, SurveyQuestionPanelDynamicProgressText, SurveyQuestionRadioItem, SurveyQuestionRadiogroup, SurveyQuestionRanking, SurveyQuestionRankingItem, SurveyQuestionRankingItemContent, SurveyQuestionRating, SurveyQuestionRatingDropdown, SurveyQuestionSignaturePad, SurveyQuestionSlider, SurveyQuestionTagbox, SurveyQuestionTagboxItem, SurveyQuestionText, SurveyRow, SurveyTimerPanel, SurveyWindow, SvgBundleComponent, SvgIcon, TagboxFilterString, TitleActions, TitleElement, attachKey2click };
6103
6092
  //# sourceMappingURL=survey-react-ui.mjs.map