survey-creator-react 3.0.0-beta.6 → 3.0.0-beta.8

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 v3.0.0-beta.6
2
+ * SurveyJS Creator v3.0.0-beta.8
3
3
  * (c) 2015-2026 Devsoft Baltic OÜ - http://surveyjs.io/
4
4
  * Github: https://github.com/surveyjs/survey-creator
5
5
  * License: https://surveyjs.io/Licenses#SurveyCreator
@@ -2127,7 +2127,7 @@ ReactElementFactory.Instance.registerElement(editableStringRendererName, (props)
2127
2127
  class QuestionErrorComponent extends React.Component {
2128
2128
  render() {
2129
2129
  return (React.createElement("div", null,
2130
- React.createElement(SvgIcon, { "aria-hidden": "true", iconName: "icon-alert_24x24", size: "24", className: this.props.cssClasses.error.icon }),
2130
+ React.createElement(SvgIcon, { "aria-hidden": "true", iconName: "icon-alert_24x24", size: "auto", className: this.props.cssClasses.error.icon }),
2131
2131
  React.createElement("span", { className: this.props.cssClasses.error.item || undefined },
2132
2132
  React.createElement(SurveyLocStringViewer, { model: this.props.error.locText }))));
2133
2133
  }
@@ -2834,12 +2834,44 @@ ReactQuestionFactory.Instance.registerQuestion("spinedit", (props) => {
2834
2834
  return React.createElement(SurveyQuestionSpinEditor, props);
2835
2835
  });
2836
2836
 
2837
+ class Swatch extends React.Component {
2838
+ get rootClassName() {
2839
+ var _a;
2840
+ return (_a = this.props.className) !== null && _a !== void 0 ? _a : "sd-color-swatch";
2841
+ }
2842
+ get rootStyle() {
2843
+ return { backgroundColor: this.props.color };
2844
+ }
2845
+ renderIcon() {
2846
+ var _a, _b;
2847
+ if (!this.props.showIcon)
2848
+ return null;
2849
+ return (React.createElement(SvgIcon, { iconName: (_a = this.props.swatchIcon) !== null && _a !== void 0 ? _a : "icon-dropper-16x16", size: "auto", className: (_b = this.props.iconClassName) !== null && _b !== void 0 ? _b : "sd-color-swatch__icon" }));
2850
+ }
2851
+ renderColorInput() {
2852
+ const { onColorInputChange, colorInputValue, colorInputClassName, inputDisabled, arias } = this.props;
2853
+ if (!onColorInputChange)
2854
+ return null;
2855
+ return (React.createElement("input", Object.assign({ type: "color", disabled: inputDisabled, value: colorInputValue, className: colorInputClassName, onChange: onColorInputChange, tabIndex: -1 }, arias)));
2856
+ }
2857
+ render() {
2858
+ const content = (React.createElement("div", { className: "sd-color-swatch__content", style: this.rootStyle },
2859
+ this.renderIcon(),
2860
+ this.renderColorInput()));
2861
+ if (this.props.onColorInputChange) {
2862
+ return React.createElement("label", { className: this.rootClassName }, content);
2863
+ }
2864
+ return React.createElement("div", { className: this.rootClassName }, content);
2865
+ }
2866
+ }
2867
+
2837
2868
  class ItemTemplateComponent extends SurveyElementBase {
2838
2869
  render() {
2839
2870
  const item = this.props.item;
2840
- return (React.createElement(React.Fragment, null,
2841
- React.createElement("span", { className: "spg-color-editor__color-swatch", style: { backgroundColor: item.value } }),
2842
- React.createElement("span", { key: 2 }, this.renderLocString(item.locTitle, undefined, "locString"))));
2871
+ return (React.createElement("div", { className: "sd-color-swatch-item" },
2872
+ React.createElement("div", { className: "sd-color-swatch-item__label" },
2873
+ React.createElement("span", { key: 2, className: "sd-color-swatch-item__caption" }, this.renderLocString(item.locTitle, undefined, "locString"))),
2874
+ React.createElement(Swatch, { color: item.value })));
2843
2875
  }
2844
2876
  }
2845
2877
  ReactElementFactory.Instance.registerElement("color-item", (props) => {
@@ -2868,9 +2900,15 @@ class SurveyQuestionColor extends SurveyQuestionText {
2868
2900
  return this.question.renderedValue;
2869
2901
  }
2870
2902
  renderColorSwatch() {
2871
- return React.createElement("label", { className: this.question.getSwatchCss(), style: this.question.getSwatchStyle() },
2872
- React.createElement(SvgIcon, { iconName: this.question.cssClasses.swatchIcon, size: "auto" }),
2873
- 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 }));
2903
+ const question = this.question;
2904
+ return (React.createElement("div", { className: question.cssClasses.colorSwatch },
2905
+ React.createElement(Swatch, { className: question.getSwatchCss(), swatchIcon: question.cssClasses.swatchIcon, iconClassName: question.cssClasses.iconClassName, color: question.renderedValue, showIcon: true, colorInputValue: question.renderedColorValue, colorInputClassName: question.cssClasses.colorInput, inputDisabled: this.isDisplayMode, onColorInputChange: (event) => question.onColorInputChange(event.nativeEvent), arias: {
2906
+ "aria-required": question.a11y_input_ariaRequired,
2907
+ "aria-labelledby": question.a11y_input_ariaLabelledBy,
2908
+ "aria-label": question.a11y_input_ariaLabel,
2909
+ "aria-invalid": question.a11y_input_ariaInvalid,
2910
+ "aria-describedby": question.a11y_input_ariaDescribedBy,
2911
+ } })));
2874
2912
  }
2875
2913
  renderButtons() {
2876
2914
  return this.question.hasVisibleInputActions ? React.createElement(SurveyActionBar, { model: this.question.inputActionsContainer }) : null;
@@ -2927,27 +2965,9 @@ ReactElementFactory.Instance.registerElement("sv-fileedit-button", (props) => {
2927
2965
  return React.createElement(SurveyQuestionFileEditorButton, props);
2928
2966
  });
2929
2967
 
2930
- class SurveyQuestionBooleanSwitch extends SurveyQuestionElementBase {
2931
- renderElement() {
2932
- const button = attachKey2click(React.createElement("div", { className: "spg-boolean-switch__button" + (this.questionBase.booleanValue ? " 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 },
2933
- React.createElement("div", { className: "spg-boolean-switch__thumb" },
2934
- React.createElement("div", { className: "spg-boolean-switch__thumb-circle spg-boolean-switch__thumb--left" })),
2935
- React.createElement("div", { className: "spg-boolean-switch__thumb" },
2936
- React.createElement("div", { className: "spg-boolean-switch__thumb-circle spg-boolean-switch__thumb--right" }))), this.questionBase, { processEsc: false });
2937
- return (React.createElement("div", { className: "spg-boolean-switch", onClick: () => this.questionBase.booleanValue = !this.questionBase.booleanValue },
2938
- button,
2939
- React.createElement("div", { className: "spg-boolean-switch__caption" },
2940
- React.createElement("div", { className: "spg-boolean-switch__title", id: this.questionBase.labelRenderedAriaID }, SurveyElementBase.renderLocString(this.questionBase.locTitle)))));
2941
- }
2942
- }
2943
- ReactQuestionFactory.Instance.registerQuestion("sv-boolean-switch", (props) => {
2944
- return React.createElement(SurveyQuestionBooleanSwitch, props);
2945
- });
2946
- RendererFactory.Instance.registerRenderer("boolean", "switch", "sv-boolean-switch");
2947
-
2948
2968
  let Version;
2949
- Version = `${"3.0.0-beta.6"}`;
2950
- checkLibraryVersion(`${"3.0.0-beta.6"}`, "survey-creator-react");
2969
+ Version = `${"3.0.0-beta.8"}`;
2970
+ checkLibraryVersion(`${"3.0.0-beta.8"}`, "survey-creator-react");
2951
2971
 
2952
- export { ActionButton, AdaptiveToolbox, AddQuestionButtonComponent, CellQuestionAdornerComponent, CellQuestionDropdownAdornerComponent, ComponentContainer, CreatorSurveyPageComponent, IconItem, ImageItemValueAdornerComponent, ItemValueAdornerComponent, LogoImageComponent, MatrixCellAdornerComponent, PanelAdornerComponent, PropertyGridComponent, PropertyGridPlaceholderComponent, QuestionAdornerComponent, QuestionBanner, QuestionDropdownAdornerComponent, QuestionEditorContentComponent, QuestionErrorComponent, QuestionImageAdornerComponent, QuestionRatingAdornerComponent, QuestionWidgetAdornerComponent, QuestionWrapperFooter, QuestionWrapperHeader, ReactDragEvent, ReactMouseEvent, RowWrapper, SearchComponent, SideBarDefaultHeader, SideBarLaunchCard, SidebarComponent, SurveyCreator, SurveyCreatorComponent, SurveyCreatorToolboxCategory, SurveyCreatorToolboxItem, SurveyCreatorToolboxItemGroup, SurveyCreatorToolboxTool, SurveyElementEmbeddedSurvey, SurveyLocStringEditor, SurveyLogicOpertor, SurveyNavigation, SurveyQuestionBooleanSwitch, SurveyQuestionColor, SurveyQuestionFileEditor, SurveyQuestionFileEditorButton, SurveyQuestionLinkValue, SurveyQuestionSpinEditor, SurveyResults, SurveyResultsByRow, SurveySimulator, SurveySpinEditorButton, SwitcherComponent, TabButtonComponent, TabContainerComponent, TabDesignerComponent, TabJsonEditorAceComponent, TabJsonEditorErrorsComponent, TabJsonEditorTextareaComponent, TabLogicComponent, TabPreviewSurveyComponent, TabThemeSurveyComponent, TabTranslationComponent, TabbedMenuComponent, TabbedMenuItemComponent, ToolboxList, TranslateFromAction, TranslationLineSkeleton, Version };
2972
+ export { ActionButton, AdaptiveToolbox, AddQuestionButtonComponent, CellQuestionAdornerComponent, CellQuestionDropdownAdornerComponent, ComponentContainer, CreatorSurveyPageComponent, IconItem, ImageItemValueAdornerComponent, ItemValueAdornerComponent, LogoImageComponent, MatrixCellAdornerComponent, PanelAdornerComponent, PropertyGridComponent, PropertyGridPlaceholderComponent, QuestionAdornerComponent, QuestionBanner, QuestionDropdownAdornerComponent, QuestionEditorContentComponent, QuestionErrorComponent, QuestionImageAdornerComponent, QuestionRatingAdornerComponent, QuestionWidgetAdornerComponent, QuestionWrapperFooter, QuestionWrapperHeader, ReactDragEvent, ReactMouseEvent, RowWrapper, SearchComponent, SideBarDefaultHeader, SideBarLaunchCard, SidebarComponent, SurveyCreator, SurveyCreatorComponent, SurveyCreatorToolboxCategory, SurveyCreatorToolboxItem, SurveyCreatorToolboxItemGroup, SurveyCreatorToolboxTool, SurveyElementEmbeddedSurvey, SurveyLocStringEditor, SurveyLogicOpertor, SurveyNavigation, SurveyQuestionColor, SurveyQuestionFileEditor, SurveyQuestionFileEditorButton, SurveyQuestionLinkValue, SurveyQuestionSpinEditor, SurveyResults, SurveyResultsByRow, SurveySimulator, SurveySpinEditorButton, SwitcherComponent, TabButtonComponent, TabContainerComponent, TabDesignerComponent, TabJsonEditorAceComponent, TabJsonEditorErrorsComponent, TabJsonEditorTextareaComponent, TabLogicComponent, TabPreviewSurveyComponent, TabThemeSurveyComponent, TabTranslationComponent, TabbedMenuComponent, TabbedMenuItemComponent, ToolboxList, TranslateFromAction, TranslationLineSkeleton, Version };
2953
2973
  //# sourceMappingURL=survey-creator-react.mjs.map