survey-creator-js 2.0.3 → 2.0.5

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 Creator UI v2.0.3
2
+ * SurveyJS Creator UI v2.0.5
3
3
  * (c) 2015-2025 Devsoft Baltic OÜ - http://surveyjs.io/
4
4
  * Github: https://github.com/surveyjs/survey-creator
5
5
  * License: https://surveyjs.io/Licenses#SurveyCreator
@@ -24,7 +24,7 @@ class TabbedMenuComponent extends SurveyElementBase {
24
24
  }
25
25
  renderElement() {
26
26
  const items = this.model.renderedActions.map((item) => React.createElement(TabbedMenuItemWrapper, { item: item, key: item.renderedId }));
27
- return (React.createElement("div", { ref: this.rootRef, className: "svc-tabbed-menu" }, items));
27
+ return (React.createElement("div", { ref: this.rootRef, className: "svc-tabbed-menu", role: "tablist" }, items));
28
28
  }
29
29
  componentDidMount() {
30
30
  super.componentDidMount();
@@ -1465,11 +1465,9 @@ class SurveyCreatorToolboxCategory extends SurveyElementBase {
1465
1465
  renderButton() {
1466
1466
  if (!this.toolbox.canCollapseCategories)
1467
1467
  return null;
1468
- const iconName = this.category.collapsed ? "arrow-down" : "arrow-up";
1469
- const suffixName = this.category.collapsed ? "expand" : "collapse";
1470
- const svgIconClassName = "svc-toolbox__category-header__button svc-string-editor__button--" + suffixName;
1468
+ const iconName = this.category.iconName;
1471
1469
  return (React.createElement("div", { className: "svc-toolbox__category-header__controls" },
1472
- React.createElement(SvgIcon, { className: svgIconClassName, iconName: "icon-" + iconName, size: "auto" })));
1470
+ React.createElement(SvgIcon, { className: this.category.iconClassName, iconName: iconName, size: "auto" })));
1473
1471
  }
1474
1472
  renderCategoryContent() {
1475
1473
  return this.renderItems(this.category.items);
@@ -2060,7 +2058,7 @@ class SurveyLogicOpertor extends SurveyQuestionDropdown {
2060
2058
  return (React.createElement("div", { id: this.question.inputId, className: q.getControlClass(), tabIndex: this.question.isInputReadOnly ? undefined : 0,
2061
2059
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2062
2060
  // @ts-ignore
2063
- disabled: this.question.isInputReadOnly, required: this.question.isRequired, onChange: this.updateValueOnEvent, onInput: this.updateValueOnEvent, onKeyUp: this.keyhandler, role: this.question.ariaRole, "aria-required": this.question.ariaRequired, "aria-label": this.question.ariaLabel, "aria-invalid": this.question.ariaInvalid, "aria-describedby": this.question.ariaDescribedBy },
2061
+ disabled: this.question.isInputReadOnly, required: this.question.isRequired, onChange: this.updateValueOnEvent, onInput: this.updateValueOnEvent, onKeyUp: this.keyhandler, role: this.question.ariaRole, "aria-required": this.question.ariaRequired, "aria-label": this.question.ariaLabel, "aria-labelledby": this.question.ariaLabelledBy, "aria-invalid": this.question.ariaInvalid, "aria-errormessage": this.question.ariaErrormessage, "aria-expanded": this.question.ariaExpanded },
2064
2062
  React.createElement("div", { className: this.question.cssClasses.controlValue },
2065
2063
  text,
2066
2064
  React.createElement("div", null, q.readOnlyText)),
@@ -2653,7 +2651,7 @@ class SurveyQuestionSpinEditor extends SurveyQuestionText {
2653
2651
  }
2654
2652
  renderInput() {
2655
2653
  return (React.createElement(React.Fragment, null,
2656
- React.createElement("input", { id: this.question.inputId, disabled: this.isDisplayMode, className: this.question.cssClasses.control, ref: (input) => (this.setControl(input)), placeholder: this.question.renderedPlaceholder, autoComplete: "off", onBlur: (event) => this.question.onBlur(event.nativeEvent), onFocus: (event) => this.question.onFocus(event.nativeEvent), onChange: this.question.onChange, onBeforeInput: event => this.question.onBeforeInput(event.nativeEvent), onKeyUp: (event) => this.question.onKeyUp(event.nativeEvent), onKeyDown: (event) => this.question.onInputKeyDown(event.nativeEvent), "aria-required": this.question.ariaRequired, "aria-label": this.question.ariaLabel, "aria-invalid": this.question.ariaInvalid, "aria-describedby": this.question.ariaDescribedBy })));
2654
+ React.createElement("input", { role: "spinbutton", id: this.question.inputId, disabled: this.isDisplayMode, className: this.question.cssClasses.control, ref: (input) => (this.setControl(input)), placeholder: this.question.renderedPlaceholder, autoComplete: "off", onBlur: (event) => this.question.onBlur(event.nativeEvent), onFocus: (event) => this.question.onFocus(event.nativeEvent), onChange: this.question.onChange, onBeforeInput: event => this.question.onBeforeInput(event.nativeEvent), onKeyUp: (event) => this.question.onKeyUp(event.nativeEvent), onKeyDown: (event) => this.question.onInputKeyDown(event.nativeEvent), "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 })));
2657
2655
  }
2658
2656
  renderElement() {
2659
2657
  return (React.createElement("div", { className: this.question.cssClasses.root, onKeyDown: event => this.question.onKeyDown(event.nativeEvent) },
@@ -2665,9 +2663,9 @@ class SurveyQuestionSpinEditor extends SurveyQuestionText {
2665
2663
  }
2666
2664
  renderButtons() {
2667
2665
  return (React.createElement("span", { className: this.question.cssClasses.buttonsContainer },
2668
- React.createElement("button", { tabIndex: -1, className: this.question.cssClasses.arrowButton, disabled: this.isDisplayMode, onClick: this.question.onDownButtonClick, onMouseDown: this.question.onDownButtonMouseDown, onMouseUp: this.question.onButtonMouseUp, onMouseLeave: this.question.onButtonMouseLeave, onBlur: event => this.question.onBlur(event.nativeEvent), onFocus: event => this.question.onFocus(event.nativeEvent) },
2666
+ React.createElement("button", { tabIndex: -1, "aria-hidden": "true", className: this.question.cssClasses.arrowButton, disabled: this.isDisplayMode, onClick: this.question.onDownButtonClick, onMouseDown: this.question.onDownButtonMouseDown, onMouseUp: this.question.onButtonMouseUp, onMouseLeave: this.question.onButtonMouseLeave, onBlur: event => this.question.onBlur(event.nativeEvent), onFocus: event => this.question.onFocus(event.nativeEvent) },
2669
2667
  React.createElement(SvgIcon, { iconName: this.question.cssClasses.decreaseButtonIcon, size: "auto" })),
2670
- React.createElement("button", { tabIndex: -1, className: this.question.cssClasses.arrowButton, disabled: this.isDisplayMode, onClick: this.question.onUpButtonClick, onMouseDown: this.question.onUpButtonMouseDown, onMouseUp: this.question.onButtonMouseUp, onMouseLeave: this.question.onButtonMouseLeave, onBlur: event => this.question.onBlur(event.nativeEvent), onFocus: event => this.question.onFocus(event.nativeEvent) },
2668
+ React.createElement("button", { tabIndex: -1, "aria-hidden": "true", className: this.question.cssClasses.arrowButton, disabled: this.isDisplayMode, onClick: this.question.onUpButtonClick, onMouseDown: this.question.onUpButtonMouseDown, onMouseUp: this.question.onButtonMouseUp, onMouseLeave: this.question.onButtonMouseLeave, onBlur: event => this.question.onBlur(event.nativeEvent), onFocus: event => this.question.onFocus(event.nativeEvent) },
2671
2669
  React.createElement(SvgIcon, { iconName: this.question.cssClasses.increaseButtonIcon, size: "auto" }))));
2672
2670
  }
2673
2671
  }
@@ -2696,7 +2694,7 @@ class SurveyQuestionColor extends SurveyQuestionText {
2696
2694
  }
2697
2695
  renderInput() {
2698
2696
  return (React.createElement(React.Fragment, null,
2699
- React.createElement("input", { id: this.question.inputId, disabled: this.isDisplayMode, className: this.question.cssClasses.control, ref: (input) => (this.setControl(input)), placeholder: this.question.renderedPlaceholder, autoComplete: "off", onKeyUp: (event) => this.question.onKeyUp(event.nativeEvent), onBlur: (event) => this.question.onBlur(event.nativeEvent), onChange: this.question.onChange, onBeforeInput: event => this.question.onBeforeInput(event.nativeEvent), "aria-required": this.question.ariaRequired, "aria-label": this.question.ariaLabel, "aria-invalid": this.question.ariaInvalid, "aria-describedby": this.question.ariaDescribedBy })));
2697
+ React.createElement("input", { id: this.question.inputId, disabled: this.isDisplayMode, className: this.question.cssClasses.control, ref: (input) => (this.setControl(input)), placeholder: this.question.renderedPlaceholder, autoComplete: "off", onKeyUp: (event) => this.question.onKeyUp(event.nativeEvent), onBlur: (event) => this.question.onBlur(event.nativeEvent), onChange: this.question.onChange, onBeforeInput: event => this.question.onBeforeInput(event.nativeEvent), "aria-required": this.question.a11y_input_ariaRequired, "aria-labelledby": this.question.a11y_input_ariaLabelledBy, "aria-label": this.question.a11y_input_ariaLabel, "aria-invalid": this.question.a11y_input_ariaInvalid, "aria-describedby": this.question.a11y_input_ariaDescribedBy })));
2700
2698
  }
2701
2699
  renderElement() {
2702
2700
  return (React.createElement("div", { className: this.question.cssClasses.root, onKeyDown: event => this.question.onKeyDown(event.nativeEvent) },
@@ -2710,11 +2708,11 @@ class SurveyQuestionColor extends SurveyQuestionText {
2710
2708
  renderColorSwatch() {
2711
2709
  return React.createElement("label", { className: this.question.getSwatchCss(), style: this.question.getSwatchStyle() },
2712
2710
  React.createElement(SvgIcon, { iconName: this.question.cssClasses.swatchIcon, size: "auto" }),
2713
- React.createElement("input", { type: "color", disabled: this.isDisplayMode, value: this.question.renderedColorValue, className: this.question.cssClasses.colorInput, onChange: (event) => this.question.onColorInputChange(event.nativeEvent), tabIndex: -1 }));
2711
+ React.createElement("input", { type: "color", disabled: this.isDisplayMode, value: this.question.renderedColorValue, className: this.question.cssClasses.colorInput, onChange: (event) => this.question.onColorInputChange(event.nativeEvent), tabIndex: -1, "aria-required": this.question.a11y_input_ariaRequired, "aria-labelledby": this.question.a11y_input_ariaLabelledBy, "aria-label": this.question.a11y_input_ariaLabel, "aria-invalid": this.question.a11y_input_ariaInvalid, "aria-describedby": this.question.a11y_input_ariaDescribedBy }));
2714
2712
  }
2715
2713
  renderDropdownAction() {
2716
2714
  return (React.createElement(React.Fragment, null,
2717
- ReactElementFactory.Instance.createElement("sv-action-bar-item", { item: this.question.dropdownAction }),
2715
+ React.createElement("div", { "aria-hidden": "true", className: this.question.cssClasses.choicesButtonWrapper }, ReactElementFactory.Instance.createElement("sv-action-bar-item", { item: this.question.dropdownAction })),
2718
2716
  this.renderPopup()));
2719
2717
  }
2720
2718
  renderPopup() {
@@ -2748,11 +2746,11 @@ class SurveyQuestionFileEditor extends SurveyQuestionText {
2748
2746
  this.renderChooseButton()));
2749
2747
  }
2750
2748
  renderClearButton() {
2751
- return attachKey2click((React.createElement("button", { type: "button", className: this.questionFile.cssClasses.clearButton, disabled: this.questionFile.getIsClearButtonDisabled(), onClick: this.questionFile.doClean },
2752
- React.createElement(SvgIcon, { iconName: this.questionFile.cssClasses.clearButtonIcon, size: "auto", title: this.questionFile.clearButtonCaption }))));
2749
+ return attachKey2click((React.createElement("button", { className: this.questionFile.cssClasses.clearButton, title: this.questionFile.clearButtonCaption, disabled: this.questionFile.getIsClearButtonDisabled(), onClick: this.questionFile.doClean },
2750
+ React.createElement(SvgIcon, { iconName: this.questionFile.cssClasses.clearButtonIcon, size: "auto" }))));
2753
2751
  }
2754
2752
  renderChooseButton() {
2755
- return (attachKey2click(React.createElement("label", { role: "button", onClick: event => this.questionFile.chooseFiles(event.nativeEvent), className: this.questionFile.getChooseButtonCss(), htmlFor: this.questionFile.inputId, "aria-label": this.questionFile.chooseButtonCaption },
2753
+ return (attachKey2click(React.createElement("label", { onClick: event => this.questionFile.chooseFiles(event.nativeEvent), className: this.questionFile.getChooseButtonCss(), htmlFor: this.questionFile.inputId, "aria-label": this.questionFile.chooseButtonCaption },
2756
2754
  React.createElement(SvgIcon, { iconName: this.questionFile.cssClasses.chooseButtonIcon, size: "auto", title: this.questionFile.chooseButtonCaption }))));
2757
2755
  }
2758
2756
  renderElement() {
@@ -2798,7 +2796,7 @@ ReactQuestionFactory.Instance.registerQuestion("commentwithreset", (props) => {
2798
2796
 
2799
2797
  class SurveyQuestionBooleanSwitch extends SurveyQuestionElementBase {
2800
2798
  renderElement() {
2801
- const button = attachKey2click(React.createElement("div", { className: "spg-boolean-switch__button" + (this.questionBase.value ? " spg-boolean-switch__button--checked" : ""), tabIndex: 0, role: "checkbox", "aria-required": this.questionBase.ariaRequired, "aria-label": this.questionBase.ariaLabel, "aria-invalid": this.questionBase.ariaInvalid, "aria-errormessage": this.questionBase.ariaErrormessage },
2799
+ const button = attachKey2click(React.createElement("div", { className: "spg-boolean-switch__button" + (this.questionBase.value ? " spg-boolean-switch__button--checked" : ""), tabIndex: 0, role: "checkbox", "aria-checked": this.questionBase.booleanValue || false, "aria-required": this.questionBase.a11y_input_ariaRequired, "aria-label": this.questionBase.a11y_input_ariaLabel, "aria-labelledby": this.questionBase.a11y_input_ariaLabelledBy, "aria-invalid": this.questionBase.a11y_input_ariaInvalid, "aria-errormessage": this.questionBase.a11y_input_ariaErrormessage },
2802
2800
  React.createElement("div", { className: "spg-boolean-switch__thumb" },
2803
2801
  React.createElement("div", { className: "spg-boolean-switch__thumb-circle spg-boolean-switch__thumb--left" })),
2804
2802
  React.createElement("div", { className: "spg-boolean-switch__thumb" },
@@ -2806,7 +2804,7 @@ class SurveyQuestionBooleanSwitch extends SurveyQuestionElementBase {
2806
2804
  return (React.createElement("div", { className: "spg-boolean-switch", onClick: () => this.questionBase.value = !this.questionBase.value },
2807
2805
  button,
2808
2806
  React.createElement("div", { className: "spg-boolean-switch__caption" },
2809
- React.createElement("div", { className: "spg-boolean-switch__title" }, SurveyElementBase.renderLocString(this.questionBase.locTitle)))));
2807
+ React.createElement("div", { className: "spg-boolean-switch__title", id: this.questionBase.labelRenderedAriaID }, SurveyElementBase.renderLocString(this.questionBase.locTitle)))));
2810
2808
  }
2811
2809
  }
2812
2810
  ReactQuestionFactory.Instance.registerQuestion("sv-boolean-switch", (props) => {
@@ -2815,22 +2813,24 @@ ReactQuestionFactory.Instance.registerQuestion("sv-boolean-switch", (props) => {
2815
2813
  RendererFactory.Instance.registerRenderer("boolean", "switch", "sv-boolean-switch");
2816
2814
 
2817
2815
  let Version;
2818
- Version = `${"2.0.3"}`;
2819
- checkLibraryVersion(`${"2.0.3"}`, "survey-creator-react");
2816
+ Version = `${"2.0.5"}`;
2817
+ checkLibraryVersion(`${"2.0.5"}`, "survey-creator-react");
2820
2818
 
2821
- const jQuery = window["jQuery"] || window["$"];
2822
2819
  function renderSurveyCreator(creator, element, props = {}) {
2823
2820
  const survey = preact.createElement(SurveyCreatorComponent, Object.assign({ creator }, props));
2824
2821
  preact.render(survey, element);
2825
2822
  }
2826
- if (!!jQuery) {
2827
- jQuery["fn"].extend({
2828
- SurveyCreator: function (props) {
2829
- return this.each(function () {
2830
- renderSurveyCreator(props.model, this, props);
2831
- });
2832
- },
2833
- });
2823
+ if (typeof window !== "undefined") {
2824
+ const jQuery = window["jQuery"] || window["$"];
2825
+ if (!!jQuery) {
2826
+ jQuery["fn"].extend({
2827
+ SurveyCreator: function (props) {
2828
+ return this.each(function () {
2829
+ renderSurveyCreator(props.model, this, props);
2830
+ });
2831
+ },
2832
+ });
2833
+ }
2834
2834
  }
2835
2835
 
2836
2836
  export { ActionButton, AdaptiveToolbox, CellQuestionAdornerComponent, CellQuestionDropdownAdornerComponent, CreatorSurveyPageComponent, ImageItemValueAdornerComponent, ItemValueAdornerComponent, LogoImageComponent, MatrixCellAdornerComponent, PanelAdornerComponent, PropertyGridComponent, PropertyGridPlaceholderComponent, QuestionAdornerComponent, QuestionBanner, QuestionDropdownAdornerComponent, QuestionEditorContentComponent, QuestionErrorComponent, QuestionImageAdornerComponent, QuestionRatingAdornerComponent, QuestionWidgetAdornerComponent, QuestionWrapperFooter, QuestionWrapperHeader, ReactDragEvent, ReactMouseEvent, RowWrapper, SearchComponent, SideBarDefaultHeader, SidebarComponent, SurveyCreator, SurveyCreatorComponent, SurveyCreatorToolboxCategory, SurveyCreatorToolboxItem, SurveyCreatorToolboxItemGroup, SurveyCreatorToolboxTool, SurveyElementEmbeddedSurvey, SurveyLocStringEditor, SurveyLogicOpertor, SurveyNavigation, SurveyQuestionBooleanSwitch, SurveyQuestionColor, SurveyQuestionFileEditor, SurveyQuestionLinkValue, SurveyQuestionSpinEditor, SurveyQuestionTextWithReset, SurveyResults, SurveyResultsByRow, SurveySimulator, SwitcherComponent, TabButtonComponent, TabDesignerComponent, TabJsonEditorAceComponent, TabJsonEditorErrorsComponent, TabJsonEditorTextareaComponent, TabLogicAddButtonComponent, TabLogicComponent, TabPreviewSurveyComponent, TabPreviewTestSurveyAgainComponent, TabThemeSurveyComponent, TabTranslationComponent, TabbedMenuComponent, TabbedMenuItemComponent, ToolboxList, TranslateFromAction, TranslationLineSkeleton, Version, renderSurveyCreator };