survey-react-ui 3.0.0-beta.8 → 3.0.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 v3.0.0-beta.8
2
+ * surveyjs - Survey JavaScript library v3.0.0
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
  */
@@ -500,7 +500,7 @@ class SurveyAction extends SurveyElementBase {
500
500
  const itemComponent = ReactElementFactory.Instance.createElement(this.item.component || "sv-action-bar-item", {
501
501
  item: this.item,
502
502
  });
503
- return (React.createElement("div", { className: itemClass, id: "" + this.item.uniqueId, ref: this.ref },
503
+ return (React.createElement("div", { className: itemClass, id: this.item.renderedId, ref: this.ref },
504
504
  React.createElement("div", { className: this.item.getActionRootContentCss() },
505
505
  separator,
506
506
  itemComponent)));
@@ -792,7 +792,7 @@ class SurveyActionBar extends SurveyElementBase {
792
792
  }
793
793
  renderItems() {
794
794
  return this.model.renderedActions.concat([]).map((item, itemIndex) => {
795
- return (React.createElement(SurveyAction, { item: item, key: item.renderedId }));
795
+ return (React.createElement(SurveyAction, { item: item, key: item.uniqueId }));
796
796
  });
797
797
  }
798
798
  }
@@ -878,10 +878,10 @@ class TitleElement extends React.Component {
878
878
  return this.props.element;
879
879
  }
880
880
  renderTitleExpandableSvg() {
881
- if (!this.element.getCssTitleExpandableSvg())
881
+ if (!this.element.showTitleExpandableSvg)
882
882
  return null;
883
- let iconName = this.element.isExpanded ? "icon-collapse-16x16" : "icon-expand-16x16";
884
- return React.createElement(SvgIcon, { className: this.element.getCssTitleExpandableSvg(), iconName: iconName, size: "auto" });
883
+ return React.createElement("span", { className: this.element.getCssTitleExpandableSvgContainer() },
884
+ React.createElement(SvgIcon, { className: this.element.getCssTitleExpandableSvg(), iconName: this.element.titleExpandableSvgIconName, size: "auto" }));
885
885
  }
886
886
  render() {
887
887
  const element = this.element;
@@ -1609,7 +1609,7 @@ function attachKey2click(element, viewModel, options = { processEsc: true, disab
1609
1609
  props = { tabIndex: -1 };
1610
1610
  }
1611
1611
  else {
1612
- options = Object.assign({}, options);
1612
+ options = { ...options };
1613
1613
  props = {
1614
1614
  tabIndex: 0,
1615
1615
  onKeyUp: (evt) => {
@@ -1752,14 +1752,13 @@ class SurveyRowElement extends SurveyElementBase {
1752
1752
  renderElement() {
1753
1753
  const element = this.element;
1754
1754
  const innerElement = this.createElement(element, this.index);
1755
- const css = element.cssClassesValue;
1756
1755
  const focusIn = () => {
1757
1756
  const el = element;
1758
1757
  if (el && el.isQuestion) {
1759
1758
  el.focusIn();
1760
1759
  }
1761
1760
  };
1762
- return (React.createElement("div", { className: css.questionWrapper, style: element.rootStyle, "data-key": element.name + this.index, onFocus: focusIn, ref: this.rootRef }, innerElement));
1761
+ return (React.createElement("div", { className: element.getWrapperCss(), style: element.rootStyle, "data-key": element.name + this.index, onFocus: focusIn, ref: this.rootRef }, innerElement));
1763
1762
  }
1764
1763
  createElement(element, elementIndex) {
1765
1764
  if (!this.row.isNeedRender) {
@@ -1972,6 +1971,14 @@ class TextAreaComponent extends SurveyElementBase {
1972
1971
  this.viewModel.setElement(el);
1973
1972
  }
1974
1973
  }
1974
+ componentDidUpdate(prevProps, prevState) {
1975
+ var _a;
1976
+ super.componentDidUpdate(prevProps, prevState);
1977
+ if (prevProps.viewModel !== this.viewModel) {
1978
+ (_a = prevProps.viewModel) === null || _a === void 0 ? void 0 : _a.resetElement();
1979
+ this.viewModel.setElement(this.textareaRef.current);
1980
+ }
1981
+ }
1975
1982
  componentWillUnmount() {
1976
1983
  var _a;
1977
1984
  super.componentWillUnmount();
@@ -2196,9 +2203,9 @@ class SurveyBreadcrumbs extends SurveyElementBase {
2196
2203
  const result = [];
2197
2204
  this.items.concat([]).forEach((item, itemIndex) => {
2198
2205
  if (itemIndex) {
2199
- result.push(React.createElement(SvgIcon, { key: item.renderedId + "_separator", className: this.css.breadcrumbsSeparator, iconName: "arrowright-16x16", size: "auto" }));
2206
+ result.push(React.createElement(SvgIcon, { key: item.uniqueId + "_separator", className: this.css.breadcrumbsSeparator, iconName: "arrowright-16x16", size: "auto" }));
2200
2207
  }
2201
- result.push(React.createElement(SurveyAction, { key: item.renderedId, item: item }));
2208
+ result.push(React.createElement(SurveyAction, { key: item.uniqueId, item: item }));
2202
2209
  });
2203
2210
  return result;
2204
2211
  }
@@ -2307,13 +2314,15 @@ class SurveyQuestion extends SurveyElementBase {
2307
2314
  const singleInput = singleSummary || (question.singleInputQuestion ? this.renderSingleInputQuestion(question, cssClasses) : undefined);
2308
2315
  const questionContent = singleInput || this.wrapQuestionContent(this.renderQuestionContent());
2309
2316
  return (React.createElement(React.Fragment, null,
2310
- React.createElement("div", { ref: this.rootRef, id: question.id, className: question.getRootCss(), style: rootStyle, "data-name": question.name, role: question.ariaRole, "aria-required": this.question.ariaRequired, "aria-invalid": this.question.ariaInvalid, "aria-label": this.question.ariaLabel, "aria-labelledby": question.ariaLabelledBy, "aria-describedby": question.ariaDescribedBy, "aria-expanded": question.ariaExpanded },
2317
+ React.createElement("div", { ref: this.rootRef, id: question.id, className: question.getRootCss(), style: rootStyle, "data-name": question.name, role: question.ariaRole, "aria-required": this.question.ariaRequired, "aria-invalid": this.question.ariaInvalid, "aria-label": this.question.ariaLabel, "aria-labelledby": question.ariaLabelledBy, "aria-describedby": question.ariaDescribedBy, "aria-expanded": question.ariaExpanded, onClick: (event) => question.clickRootFunction && question.clickRootFunction(event.nativeEvent) },
2311
2318
  singleBreadcrumbs,
2312
- errorsAboveQuestion,
2313
- headerTop,
2314
- questionContent,
2315
- headerBottom,
2316
- errorsBelowQuestion)));
2319
+ React.createElement("div", { className: question.getQuestionContainerCss() },
2320
+ errorsAboveQuestion,
2321
+ React.createElement("div", { className: question.getHeaderAndContentContainerCss() },
2322
+ headerTop,
2323
+ questionContent,
2324
+ headerBottom),
2325
+ errorsBelowQuestion))));
2317
2326
  }
2318
2327
  renderSingleInputQuestion(question, cssClasses) {
2319
2328
  const singleQuestion = question.singleInputQuestion;
@@ -2358,7 +2367,7 @@ class SurveyQuestion extends SurveyElementBase {
2358
2367
  return React.createElement(SurveyElementHeader, { element: question });
2359
2368
  }
2360
2369
  renderErrors(cssClasses, location) {
2361
- return (React.createElement(SurveyElementErrors, { element: this.question, cssClasses: cssClasses, creator: this.creator, location: location, id: this.question.id + "_errors" }));
2370
+ return (React.createElement(SurveyElementErrors, { element: this.question, cssClasses: cssClasses, creator: this.creator, location: location, id: this.question.renderedId + "_errors" }));
2362
2371
  }
2363
2372
  }
2364
2373
  ReactElementFactory.Instance.registerElement("question", (props) => {
@@ -2370,7 +2379,7 @@ class SurveyElementErrors extends ReactSurveyElement {
2370
2379
  this.state = this.getState();
2371
2380
  }
2372
2381
  get id() {
2373
- return this.props.element.id + "_errors";
2382
+ return this.props.element.renderedId + "_errors";
2374
2383
  }
2375
2384
  get element() {
2376
2385
  return this.props.element;
@@ -2392,7 +2401,7 @@ class SurveyElementErrors extends ReactSurveyElement {
2392
2401
  const key = "error" + i;
2393
2402
  errors.push(this.creator.renderError(key, this.element.renderedErrors[i], this.cssClasses, this.element));
2394
2403
  }
2395
- return (React.createElement("div", { className: this.element.cssError, id: this.id }, errors));
2404
+ return (React.createElement("div", { className: this.element.cssError, id: this.id, role: "alert", "aria-live": "polite", "aria-atomic": "true" }, errors));
2396
2405
  }
2397
2406
  }
2398
2407
  class SurveyQuestionAndErrorsWrapped extends ReactSurveyElement {
@@ -2538,11 +2547,17 @@ class SurveyPage extends SurveyPanelBase {
2538
2547
  var description = this.renderDescription();
2539
2548
  var rows = this.renderRows(this.panelBase.cssClasses);
2540
2549
  const errors = (React.createElement(SurveyElementErrors, { element: this.panelBase, cssClasses: this.panelBase.cssClasses, creator: this.creator }));
2550
+ var header = null;
2551
+ if (this.page.hasTitle || this.page._showDescription) {
2552
+ header = (React.createElement("div", { className: this.page.cssHeader },
2553
+ title,
2554
+ description));
2555
+ }
2541
2556
  return (React.createElement("div", { ref: this.rootRef, className: this.page.cssRoot },
2542
- title,
2543
- description,
2544
- errors,
2545
- rows));
2557
+ header,
2558
+ React.createElement("div", { className: this.page.cssContent },
2559
+ errors,
2560
+ rows)));
2546
2561
  }
2547
2562
  renderTitle() {
2548
2563
  return React.createElement(TitleElement, { element: this.page });
@@ -2569,26 +2584,34 @@ class SurveyPanel extends SurveyPanelBase {
2569
2584
  renderElement() {
2570
2585
  const header = this.renderHeader();
2571
2586
  const errors = (React.createElement(SurveyElementErrors, { element: this.panelBase, cssClasses: this.panelBase.cssClasses, creator: this.creator }));
2587
+ // const panelPaddingHorizontal = "var(--sjs2-layout-component-panel-content-area-padding-horizontal, var(--sjs2-spacing-x500))";
2588
+ const panelPaddingHorizontal = this.panel.isDesignMode ? "var(--sjs2-spacing-x000)" : "var(--sd-base-padding, var(--sjs2-spacing-x500))";
2572
2589
  const style = {
2573
- paddingLeft: this.panel.innerPaddingLeft,
2590
+ paddingInlineStart: this.panel.innerPaddingLeft
2591
+ ? `calc(${panelPaddingHorizontal} + ${this.panel.innerPaddingLeft})`
2592
+ : this.panel.innerPaddingLeft,
2593
+ // paddingInlineEnd: this.panel.innerPaddingLeft ? panelPaddingHorizontal : undefined,
2574
2594
  display: this.panel.renderedIsExpanded ? undefined : "none",
2575
2595
  };
2576
2596
  let content = null;
2597
+ let bottom = null;
2577
2598
  if (this.panel.renderedIsExpanded) {
2578
2599
  // this.hasBeenExpanded = true;
2579
2600
  const rows = this.renderRows(this.panelBase.cssClasses);
2580
2601
  const className = this.panelBase.cssClasses.panel.content;
2581
2602
  content = this.renderContent(style, rows, className);
2603
+ bottom = this.renderBottom();
2582
2604
  }
2583
2605
  const focusIn = () => {
2584
2606
  if (this.panelBase)
2585
2607
  this.panelBase.focusIn();
2586
2608
  };
2587
- return (React.createElement("div", { ref: this.rootRef, className: this.panelBase.getContainerCss(), onFocus: focusIn, id: this.panelBase.id },
2609
+ return (React.createElement("div", { ref: this.rootRef, className: this.panelBase.getContainerCss(), onFocus: focusIn, id: this.panelBase.id, onClick: (e) => this.panelBase.clickRootFunction && this.panelBase.clickRootFunction(e.nativeEvent) },
2588
2610
  this.panel.showErrorsAbovePanel ? errors : null,
2589
2611
  header,
2590
2612
  this.panel.showErrorsAbovePanel ? null : errors,
2591
- content));
2613
+ content,
2614
+ bottom));
2592
2615
  }
2593
2616
  renderHeader() {
2594
2617
  if (!this.panel.hasTitle && !this.panel.hasDescription) {
@@ -2605,10 +2628,7 @@ class SurveyPanel extends SurveyPanelBase {
2605
2628
  return wrapper !== null && wrapper !== void 0 ? wrapper : element;
2606
2629
  }
2607
2630
  renderContent(style, rows, className) {
2608
- const bottom = this.renderBottom();
2609
- 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 },
2610
- rows,
2611
- bottom));
2631
+ 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 }, rows));
2612
2632
  }
2613
2633
  renderTitle() {
2614
2634
  if (!this.panelBase.title)
@@ -3034,7 +3054,7 @@ class SurveyQuestionRanking extends SurveyQuestionElementBase {
3034
3054
  return items;
3035
3055
  }
3036
3056
  renderItem(item, i, handleKeydown, handlePointerDown, handlePointerUp, cssClasses, itemClass, question, unrankedItem) {
3037
- "id-" + item.renderedId;
3057
+ "id-" + item.uniqueId;
3038
3058
  const text = this.renderLocString(item.locText);
3039
3059
  const index = i;
3040
3060
  const indexText = this.question.getNumberByIndex(index);
@@ -4293,13 +4313,11 @@ class SurveyQuestionBooleanSwitch extends SurveyQuestionBoolean {
4293
4313
  const buttonClass = this.question.getSwitchButtonCss();
4294
4314
  const button = attachKey2click(React.createElement("div", { className: buttonClass, tabIndex: 0, role: "checkbox", "aria-checked": this.question.booleanValue || false, "aria-required": this.question.a11y_input_ariaRequired, "aria-label": this.question.a11y_input_ariaLabel, "aria-labelledby": this.question.a11y_input_ariaLabelledBy, "aria-invalid": this.question.a11y_input_ariaInvalid, "aria-errormessage": this.question.a11y_input_ariaErrormessage },
4295
4315
  React.createElement("div", { className: cssClasses.switchThumb },
4296
- React.createElement("div", { className: cssClasses.switchThumbCircle + " " + cssClasses.switchThumbLeft })),
4297
- React.createElement("div", { className: cssClasses.switchThumb },
4298
- React.createElement("div", { className: cssClasses.switchThumbCircle + " " + cssClasses.switchThumbRight }))), this.question, { processEsc: false });
4316
+ React.createElement("div", { className: cssClasses.switchThumbCircle }))), this.question, { processEsc: false });
4299
4317
  return (React.createElement("div", { className: cssClasses.rootSwitch, onClick: () => this.question.booleanValue = !this.question.booleanValue },
4300
4318
  button,
4301
- React.createElement("div", { className: cssClasses.switchCaption },
4302
- React.createElement("div", { className: cssClasses.switchTitle, id: this.question.labelRenderedAriaID }, SurveyElementBase.renderLocString(this.question.locTitle)))));
4319
+ this.question.isLabelRendered && (React.createElement("div", { className: cssClasses.switchCaption },
4320
+ React.createElement("div", { className: cssClasses.switchTitle, id: this.question.labelRenderedAriaID }, SurveyElementBase.renderLocString(this.question.locTitle))))));
4303
4321
  }
4304
4322
  }
4305
4323
  ReactQuestionFactory.Instance.registerQuestion("sv-boolean-switch", (props) => {
@@ -4852,6 +4870,8 @@ class SurveyQuestionPanelDynamic extends SurveyQuestionElementBase {
4852
4870
  if (!this.question.showNavigation)
4853
4871
  return null;
4854
4872
  const range = this.question.isRangeShowing && this.question.isProgressBottomShowing ? this.renderRange() : null;
4873
+ if (!range && !this.question.showFooterToolbar)
4874
+ return null;
4855
4875
  return (React.createElement("div", { className: this.question.cssClasses.footer },
4856
4876
  React.createElement("hr", { className: this.question.cssClasses.separator }),
4857
4877
  range,
@@ -5023,7 +5043,15 @@ class ListItem extends SurveyElementBase {
5023
5043
  return null;
5024
5044
  const className = this.model.getItemClass(this.item);
5025
5045
  const itemContent = this.item.component || this.model.itemComponent;
5026
- const newElement = ReactElementFactory.Instance.createElement(itemContent, { item: this.item, key: this.item.id, model: this.model });
5046
+ const itemData = this.item.data;
5047
+ const newElement = ReactElementFactory.Instance.createElement(itemContent, {
5048
+ item: this.item,
5049
+ key: this.item.id,
5050
+ model: this.model,
5051
+ itemData,
5052
+ survey: itemData === null || itemData === void 0 ? void 0 : itemData.survey,
5053
+ page: itemData === null || itemData === void 0 ? void 0 : itemData.page
5054
+ });
5027
5055
  const contentWrap = React.createElement("div", { ref: this.elementRef, style: this.model.getItemStyle(this.item), className: this.model.cssClasses.itemBody, title: this.item.getTooltip(), onMouseOver: (event) => { this.model.onItemHover(this.item); }, onMouseLeave: (event) => { this.model.onItemLeave(this.item); } }, newElement);
5028
5056
  const separator = this.item.needSeparator ? React.createElement("div", { className: this.model.cssClasses.itemSeparator }) : null;
5029
5057
  const isVisible = this.model.isItemVisible(this.item);
@@ -5924,18 +5952,18 @@ class SliderLabelItem extends SurveyElementBase {
5924
5952
  super.componentDidUpdate(prevProps, prevState);
5925
5953
  }
5926
5954
  renderElement() {
5927
- const { cssClasses, handleLabelPointerUp, getLabelCss, getPercent } = this.question;
5955
+ const { cssClasses, handleLabelPointerUp, getLabelCss, getPercent, getLabelMaxWidth } = this.question;
5928
5956
  const { value, locText } = this.item;
5929
5957
  let labelText = null;
5930
5958
  let labelTextSecondary = null;
5931
5959
  if (this.item.showValue) {
5932
- labelText = React.createElement("div", { className: cssClasses.labelText }, this.item.value);
5933
- labelTextSecondary = React.createElement("div", { className: cssClasses.labelTextSecondaryMode }, this.renderLocString(locText));
5960
+ labelText = React.createElement("div", { className: cssClasses.labelText, title: "" + this.item.value }, this.item.value);
5961
+ labelTextSecondary = React.createElement("div", { className: cssClasses.labelTextSecondaryMode, title: locText.renderedHtml }, this.renderLocString(locText));
5934
5962
  }
5935
5963
  else {
5936
- labelText = React.createElement("div", { className: cssClasses.labelText }, this.renderLocString(locText));
5964
+ labelText = React.createElement("div", { className: cssClasses.labelText, title: locText.renderedHtml }, this.renderLocString(locText));
5937
5965
  }
5938
- return React.createElement("div", { key: this.item.uniqueId, className: getLabelCss(locText), style: { left: getPercent(value) + "%" }, onPointerUp: (e) => { handleLabelPointerUp(e.nativeEvent, value); } },
5966
+ return React.createElement("div", { key: this.item.uniqueId, className: getLabelCss(locText), style: { left: getPercent(value) + "%", maxWidth: getLabelMaxWidth(this.item) }, onPointerUp: (e) => { handleLabelPointerUp(e.nativeEvent, value); } },
5939
5967
  React.createElement("div", { className: cssClasses.labelTick }),
5940
5968
  React.createElement("div", { className: cssClasses.labelTextContainer },
5941
5969
  labelText,
@@ -6109,7 +6137,7 @@ ReactElementFactory.Instance.registerElement(LocalizableString.editableRenderer,
6109
6137
  return React.createElement(SurveyLocStringEditor, props);
6110
6138
  });
6111
6139
 
6112
- checkLibraryVersion(`${"3.0.0-beta.8"}`, "survey-react-ui");
6140
+ checkLibraryVersion(`${"3.0.0"}`, "survey-react-ui");
6113
6141
 
6114
6142
  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, SurveyQuestionBooleanSwitch, 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 };
6115
6143
  //# sourceMappingURL=survey-react-ui.mjs.map