survey-js-ui 3.0.0-beta.8 → 3.0.0-beta.9

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-beta.9
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
  */
@@ -555,7 +555,7 @@ class SurveyAction extends SurveyElementBase {
555
555
  const itemComponent = ReactElementFactory.Instance.createElement(this.item.component || "sv-action-bar-item", {
556
556
  item: this.item,
557
557
  });
558
- return (_$1("div", { className: itemClass, id: "" + this.item.uniqueId, ref: this.ref },
558
+ return (_$1("div", { className: itemClass, id: this.item.renderedId, ref: this.ref },
559
559
  _$1("div", { className: this.item.getActionRootContentCss() },
560
560
  separator,
561
561
  itemComponent)));
@@ -847,7 +847,7 @@ class SurveyActionBar extends SurveyElementBase {
847
847
  }
848
848
  renderItems() {
849
849
  return this.model.renderedActions.concat([]).map((item, itemIndex) => {
850
- return (_$1(SurveyAction, { item: item, key: item.renderedId }));
850
+ return (_$1(SurveyAction, { item: item, key: item.uniqueId }));
851
851
  });
852
852
  }
853
853
  }
@@ -1686,7 +1686,7 @@ function attachKey2click(element, viewModel, options = { processEsc: true, disab
1686
1686
  props = { tabIndex: -1 };
1687
1687
  }
1688
1688
  else {
1689
- options = Object.assign({}, options);
1689
+ options = { ...options };
1690
1690
  props = {
1691
1691
  tabIndex: 0,
1692
1692
  onKeyUp: (evt) => {
@@ -1829,14 +1829,13 @@ class SurveyRowElement extends SurveyElementBase {
1829
1829
  renderElement() {
1830
1830
  const element = this.element;
1831
1831
  const innerElement = this.createElement(element, this.index);
1832
- const css = element.cssClassesValue;
1833
1832
  const focusIn = () => {
1834
1833
  const el = element;
1835
1834
  if (el && el.isQuestion) {
1836
1835
  el.focusIn();
1837
1836
  }
1838
1837
  };
1839
- return (_$1("div", { className: css.questionWrapper, style: element.rootStyle, "data-key": element.name + this.index, onFocus: focusIn, ref: this.rootRef }, innerElement));
1838
+ return (_$1("div", { className: element.getWrapperCss(), style: element.rootStyle, "data-key": element.name + this.index, onFocus: focusIn, ref: this.rootRef }, innerElement));
1840
1839
  }
1841
1840
  createElement(element, elementIndex) {
1842
1841
  if (!this.row.isNeedRender) {
@@ -2049,6 +2048,14 @@ class TextAreaComponent extends SurveyElementBase {
2049
2048
  this.viewModel.setElement(el);
2050
2049
  }
2051
2050
  }
2051
+ componentDidUpdate(prevProps, prevState) {
2052
+ var _a;
2053
+ super.componentDidUpdate(prevProps, prevState);
2054
+ if (prevProps.viewModel !== this.viewModel) {
2055
+ (_a = prevProps.viewModel) === null || _a === void 0 ? void 0 : _a.resetElement();
2056
+ this.viewModel.setElement(this.textareaRef.current);
2057
+ }
2058
+ }
2052
2059
  componentWillUnmount() {
2053
2060
  var _a;
2054
2061
  super.componentWillUnmount();
@@ -2273,9 +2280,9 @@ class SurveyBreadcrumbs extends SurveyElementBase {
2273
2280
  const result = [];
2274
2281
  this.items.concat([]).forEach((item, itemIndex) => {
2275
2282
  if (itemIndex) {
2276
- result.push(_$1(SvgIcon, { key: item.renderedId + "_separator", className: this.css.breadcrumbsSeparator, iconName: "arrowright-16x16", size: "auto" }));
2283
+ result.push(_$1(SvgIcon, { key: item.uniqueId + "_separator", className: this.css.breadcrumbsSeparator, iconName: "arrowright-16x16", size: "auto" }));
2277
2284
  }
2278
- result.push(_$1(SurveyAction, { key: item.renderedId, item: item }));
2285
+ result.push(_$1(SurveyAction, { key: item.uniqueId, item: item }));
2279
2286
  });
2280
2287
  return result;
2281
2288
  }
@@ -2386,11 +2393,13 @@ class SurveyQuestion extends SurveyElementBase {
2386
2393
  return (_$1(k$3, null,
2387
2394
  _$1("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 },
2388
2395
  singleBreadcrumbs,
2389
- errorsAboveQuestion,
2390
- headerTop,
2391
- questionContent,
2392
- headerBottom,
2393
- errorsBelowQuestion)));
2396
+ _$1("div", { className: question.getQuestionContainerCss() },
2397
+ errorsAboveQuestion,
2398
+ _$1("div", { className: question.getHeaderAndContentContainerCss() },
2399
+ headerTop,
2400
+ questionContent,
2401
+ headerBottom),
2402
+ errorsBelowQuestion))));
2394
2403
  }
2395
2404
  renderSingleInputQuestion(question, cssClasses) {
2396
2405
  const singleQuestion = question.singleInputQuestion;
@@ -2435,7 +2444,7 @@ class SurveyQuestion extends SurveyElementBase {
2435
2444
  return _$1(SurveyElementHeader, { element: question });
2436
2445
  }
2437
2446
  renderErrors(cssClasses, location) {
2438
- return (_$1(SurveyElementErrors, { element: this.question, cssClasses: cssClasses, creator: this.creator, location: location, id: this.question.id + "_errors" }));
2447
+ return (_$1(SurveyElementErrors, { element: this.question, cssClasses: cssClasses, creator: this.creator, location: location, id: this.question.renderedId + "_errors" }));
2439
2448
  }
2440
2449
  }
2441
2450
  ReactElementFactory.Instance.registerElement("question", (props) => {
@@ -2447,7 +2456,7 @@ class SurveyElementErrors extends ReactSurveyElement {
2447
2456
  this.state = this.getState();
2448
2457
  }
2449
2458
  get id() {
2450
- return this.props.element.id + "_errors";
2459
+ return this.props.element.renderedId + "_errors";
2451
2460
  }
2452
2461
  get element() {
2453
2462
  return this.props.element;
@@ -2469,7 +2478,7 @@ class SurveyElementErrors extends ReactSurveyElement {
2469
2478
  const key = "error" + i;
2470
2479
  errors.push(this.creator.renderError(key, this.element.renderedErrors[i], this.cssClasses, this.element));
2471
2480
  }
2472
- return (_$1("div", { className: this.element.cssError, id: this.id }, errors));
2481
+ return (_$1("div", { className: this.element.cssError, id: this.id, role: "alert", "aria-live": "polite", "aria-atomic": "true" }, errors));
2473
2482
  }
2474
2483
  }
2475
2484
  class SurveyQuestionAndErrorsWrapped extends ReactSurveyElement {
@@ -2615,11 +2624,17 @@ class SurveyPage extends SurveyPanelBase {
2615
2624
  var description = this.renderDescription();
2616
2625
  var rows = this.renderRows(this.panelBase.cssClasses);
2617
2626
  const errors = (_$1(SurveyElementErrors, { element: this.panelBase, cssClasses: this.panelBase.cssClasses, creator: this.creator }));
2627
+ var header = null;
2628
+ if (this.page.hasTitle || this.page._showDescription) {
2629
+ header = (_$1("div", { className: this.page.cssHeader },
2630
+ title,
2631
+ description));
2632
+ }
2618
2633
  return (_$1("div", { ref: this.rootRef, className: this.page.cssRoot },
2619
- title,
2620
- description,
2621
- errors,
2622
- rows));
2634
+ header,
2635
+ _$1("div", { className: this.page.cssContent },
2636
+ errors,
2637
+ rows)));
2623
2638
  }
2624
2639
  renderTitle() {
2625
2640
  return _$1(TitleElement, { element: this.page });
@@ -2646,16 +2661,23 @@ class SurveyPanel extends SurveyPanelBase {
2646
2661
  renderElement() {
2647
2662
  const header = this.renderHeader();
2648
2663
  const errors = (_$1(SurveyElementErrors, { element: this.panelBase, cssClasses: this.panelBase.cssClasses, creator: this.creator }));
2664
+ // const panelPaddingHorizontal = "var(--sjs2-layout-component-panel-content-area-padding-horizontal, var(--sjs2-spacing-x500))";
2665
+ const panelPaddingHorizontal = this.panel.isDesignMode ? "var(--sjs2-spacing-x000)" : "var(--sd-base-padding, var(--sjs2-spacing-x500))";
2649
2666
  const style = {
2650
- paddingLeft: this.panel.innerPaddingLeft,
2667
+ paddingInlineStart: this.panel.innerPaddingLeft
2668
+ ? `calc(${panelPaddingHorizontal} + ${this.panel.innerPaddingLeft})`
2669
+ : this.panel.innerPaddingLeft,
2670
+ // paddingInlineEnd: this.panel.innerPaddingLeft ? panelPaddingHorizontal : undefined,
2651
2671
  display: this.panel.renderedIsExpanded ? undefined : "none",
2652
2672
  };
2653
2673
  let content = null;
2674
+ let bottom = null;
2654
2675
  if (this.panel.renderedIsExpanded) {
2655
2676
  // this.hasBeenExpanded = true;
2656
2677
  const rows = this.renderRows(this.panelBase.cssClasses);
2657
2678
  const className = this.panelBase.cssClasses.panel.content;
2658
2679
  content = this.renderContent(style, rows, className);
2680
+ bottom = this.renderBottom();
2659
2681
  }
2660
2682
  const focusIn = () => {
2661
2683
  if (this.panelBase)
@@ -2665,7 +2687,8 @@ class SurveyPanel extends SurveyPanelBase {
2665
2687
  this.panel.showErrorsAbovePanel ? errors : null,
2666
2688
  header,
2667
2689
  this.panel.showErrorsAbovePanel ? null : errors,
2668
- content));
2690
+ content,
2691
+ bottom));
2669
2692
  }
2670
2693
  renderHeader() {
2671
2694
  if (!this.panel.hasTitle && !this.panel.hasDescription) {
@@ -2682,10 +2705,7 @@ class SurveyPanel extends SurveyPanelBase {
2682
2705
  return wrapper !== null && wrapper !== void 0 ? wrapper : element;
2683
2706
  }
2684
2707
  renderContent(style, rows, className) {
2685
- const bottom = this.renderBottom();
2686
- return (_$1("div", { style: style, className: className, id: this.panel.contentId, role: this.panel.ariaRole, "aria-labelledby": this.panel.ariaLabelledBy, "aria-label": this.panel.ariaLabel },
2687
- rows,
2688
- bottom));
2708
+ return (_$1("div", { style: style, className: className, id: this.panel.contentId, role: this.panel.ariaRole, "aria-labelledby": this.panel.ariaLabelledBy, "aria-label": this.panel.ariaLabel }, rows));
2689
2709
  }
2690
2710
  renderTitle() {
2691
2711
  if (!this.panelBase.title)
@@ -3111,7 +3131,7 @@ class SurveyQuestionRanking extends SurveyQuestionElementBase {
3111
3131
  return items;
3112
3132
  }
3113
3133
  renderItem(item, i, handleKeydown, handlePointerDown, handlePointerUp, cssClasses, itemClass, question, unrankedItem) {
3114
- "id-" + item.renderedId;
3134
+ "id-" + item.uniqueId;
3115
3135
  const text = this.renderLocString(item.locText);
3116
3136
  const index = i;
3117
3137
  const indexText = this.question.getNumberByIndex(index);
@@ -4370,13 +4390,11 @@ class SurveyQuestionBooleanSwitch extends SurveyQuestionBoolean {
4370
4390
  const buttonClass = this.question.getSwitchButtonCss();
4371
4391
  const button = attachKey2click(_$1("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 },
4372
4392
  _$1("div", { className: cssClasses.switchThumb },
4373
- _$1("div", { className: cssClasses.switchThumbCircle + " " + cssClasses.switchThumbLeft })),
4374
- _$1("div", { className: cssClasses.switchThumb },
4375
- _$1("div", { className: cssClasses.switchThumbCircle + " " + cssClasses.switchThumbRight }))), this.question, { processEsc: false });
4393
+ _$1("div", { className: cssClasses.switchThumbCircle }))), this.question, { processEsc: false });
4376
4394
  return (_$1("div", { className: cssClasses.rootSwitch, onClick: () => this.question.booleanValue = !this.question.booleanValue },
4377
4395
  button,
4378
- _$1("div", { className: cssClasses.switchCaption },
4379
- _$1("div", { className: cssClasses.switchTitle, id: this.question.labelRenderedAriaID }, SurveyElementBase.renderLocString(this.question.locTitle)))));
4396
+ this.question.isLabelRendered && (_$1("div", { className: cssClasses.switchCaption },
4397
+ _$1("div", { className: cssClasses.switchTitle, id: this.question.labelRenderedAriaID }, SurveyElementBase.renderLocString(this.question.locTitle))))));
4380
4398
  }
4381
4399
  }
4382
4400
  ReactQuestionFactory.Instance.registerQuestion("sv-boolean-switch", (props) => {
@@ -4929,6 +4947,8 @@ class SurveyQuestionPanelDynamic extends SurveyQuestionElementBase {
4929
4947
  if (!this.question.showNavigation)
4930
4948
  return null;
4931
4949
  const range = this.question.isRangeShowing && this.question.isProgressBottomShowing ? this.renderRange() : null;
4950
+ if (!range && !this.question.showFooterToolbar)
4951
+ return null;
4932
4952
  return (_$1("div", { className: this.question.cssClasses.footer },
4933
4953
  _$1("hr", { className: this.question.cssClasses.separator }),
4934
4954
  range,
@@ -5100,7 +5120,15 @@ class ListItem extends SurveyElementBase {
5100
5120
  return null;
5101
5121
  const className = this.model.getItemClass(this.item);
5102
5122
  const itemContent = this.item.component || this.model.itemComponent;
5103
- const newElement = ReactElementFactory.Instance.createElement(itemContent, { item: this.item, key: this.item.id, model: this.model });
5123
+ const itemData = this.item.data;
5124
+ const newElement = ReactElementFactory.Instance.createElement(itemContent, {
5125
+ item: this.item,
5126
+ key: this.item.id,
5127
+ model: this.model,
5128
+ itemData,
5129
+ survey: itemData === null || itemData === void 0 ? void 0 : itemData.survey,
5130
+ page: itemData === null || itemData === void 0 ? void 0 : itemData.page
5131
+ });
5104
5132
  const contentWrap = _$1("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);
5105
5133
  const separator = this.item.needSeparator ? _$1("div", { className: this.model.cssClasses.itemSeparator }) : null;
5106
5134
  const isVisible = this.model.isItemVisible(this.item);
@@ -6001,18 +6029,18 @@ class SliderLabelItem extends SurveyElementBase {
6001
6029
  super.componentDidUpdate(prevProps, prevState);
6002
6030
  }
6003
6031
  renderElement() {
6004
- const { cssClasses, handleLabelPointerUp, getLabelCss, getPercent } = this.question;
6032
+ const { cssClasses, handleLabelPointerUp, getLabelCss, getPercent, getLabelMaxWidth } = this.question;
6005
6033
  const { value, locText } = this.item;
6006
6034
  let labelText = null;
6007
6035
  let labelTextSecondary = null;
6008
6036
  if (this.item.showValue) {
6009
- labelText = _$1("div", { className: cssClasses.labelText }, this.item.value);
6010
- labelTextSecondary = _$1("div", { className: cssClasses.labelTextSecondaryMode }, this.renderLocString(locText));
6037
+ labelText = _$1("div", { className: cssClasses.labelText, title: "" + this.item.value }, this.item.value);
6038
+ labelTextSecondary = _$1("div", { className: cssClasses.labelTextSecondaryMode, title: locText.renderedHtml }, this.renderLocString(locText));
6011
6039
  }
6012
6040
  else {
6013
- labelText = _$1("div", { className: cssClasses.labelText }, this.renderLocString(locText));
6041
+ labelText = _$1("div", { className: cssClasses.labelText, title: locText.renderedHtml }, this.renderLocString(locText));
6014
6042
  }
6015
- return _$1("div", { key: this.item.uniqueId, className: getLabelCss(locText), style: { left: getPercent(value) + "%" }, onPointerUp: (e) => { handleLabelPointerUp(e.nativeEvent, value); } },
6043
+ return _$1("div", { key: this.item.uniqueId, className: getLabelCss(locText), style: { left: getPercent(value) + "%", maxWidth: getLabelMaxWidth(this.item) }, onPointerUp: (e) => { handleLabelPointerUp(e.nativeEvent, value); } },
6016
6044
  _$1("div", { className: cssClasses.labelTick }),
6017
6045
  _$1("div", { className: cssClasses.labelTextContainer },
6018
6046
  labelText,
@@ -6187,11 +6215,11 @@ ReactElementFactory.Instance.registerElement(LocalizableString.editableRenderer,
6187
6215
  });
6188
6216
 
6189
6217
  function renderSurvey(model, element, props = {}) {
6190
- const survey = _$1(Survey, Object.assign({ model }, props));
6218
+ const survey = _$1(Survey, { model, ...props });
6191
6219
  nn$1(survey, element);
6192
6220
  }
6193
6221
  function renderPopupSurvey(model, element, props = {}) {
6194
- const survey = _$1(PopupSurvey, Object.assign({ model }, props));
6222
+ const survey = _$1(PopupSurvey, { model, ...props });
6195
6223
  nn$1(survey, element);
6196
6224
  }
6197
6225
  function doPopupSurvey(props) {
@@ -6235,7 +6263,7 @@ SurveyModel.prototype["render"] = function (element = null) {
6235
6263
  }
6236
6264
  };
6237
6265
  const preact = React;
6238
- checkLibraryVersion(`${"3.0.0-beta.8"}`, "survey-js-ui");
6266
+ checkLibraryVersion(`${"3.0.0-beta.9"}`, "survey-js-ui");
6239
6267
 
6240
6268
  export { CharacterCounterComponent, O as Children, x$3 as Component, ComponentsContainer, k$3 as Fragment, Header, HeaderCell, HeaderMobile, List, ListItemContent, ListItemGroup, LoadingIndicatorComponent, LogoImage, MatrixRow, NotifierComponent, Popup, PopupModal, PopupSurvey, N as PureComponent, QuestionErrorComponent, RatingDropdownItem, RatingItem, RatingItemSmiley, RatingItemStar, ReactElementFactory, ReactQuestionFactory, ReactSurveyElement, ReactSurveyElementsWrapper, Scroll, Skeleton, SliderLabelItem, Cn as StrictMode, 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, P as Suspense, B as SuspenseList, SvgBundleComponent, SvgIcon, TagboxFilterString, TitleActions, TitleElement, attachKey2click, _n as cloneElement, Q$2 as createContext, _$1 as createElement, dn as createFactory, $ as createPortal, b$1 as createRef, Sn as findDOMNode, En as flushSync, D as forwardRef, tn as hydrate, pn as isFragment, yn as isMemo, mn as isValidElement, z as lazy, M as memo, preact, nn as render, renderPopupSurvey, renderSurvey, R as startTransition, bn as unmountComponentAtNode, gn as unstable_batchedUpdates, q$2 as useCallback, x$2 as useContext, P$2 as useDebugValue, w as useDeferredValue, y as useEffect, g$2 as useId, F$2 as useImperativeHandle, I as useInsertionEffect, _ as useLayoutEffect, T$2 as useMemo, h as useReducer, A$2 as useRef, d as useState, C as useSyncExternalStore, k as useTransition, vn as version };
6241
6269
  //# sourceMappingURL=survey-js-ui.mjs.map