survey-creator-js 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
@@ -2125,7 +2125,7 @@ ReactElementFactory.Instance.registerElement(editableStringRendererName, (props)
2125
2125
  class QuestionErrorComponent extends React.Component {
2126
2126
  render() {
2127
2127
  return (React.createElement("div", null,
2128
- React.createElement(SvgIcon, { "aria-hidden": "true", iconName: "icon-alert_24x24", size: "24", className: this.props.cssClasses.error.icon }),
2128
+ React.createElement(SvgIcon, { "aria-hidden": "true", iconName: "icon-alert_24x24", size: "auto", className: this.props.cssClasses.error.icon }),
2129
2129
  React.createElement("span", { className: this.props.cssClasses.error.item || undefined },
2130
2130
  React.createElement(SurveyLocStringViewer, { model: this.props.error.locText }))));
2131
2131
  }
@@ -2832,12 +2832,44 @@ ReactQuestionFactory.Instance.registerQuestion("spinedit", (props) => {
2832
2832
  return React.createElement(SurveyQuestionSpinEditor, props);
2833
2833
  });
2834
2834
 
2835
+ class Swatch extends React.Component {
2836
+ get rootClassName() {
2837
+ var _a;
2838
+ return (_a = this.props.className) !== null && _a !== void 0 ? _a : "sd-color-swatch";
2839
+ }
2840
+ get rootStyle() {
2841
+ return { backgroundColor: this.props.color };
2842
+ }
2843
+ renderIcon() {
2844
+ var _a, _b;
2845
+ if (!this.props.showIcon)
2846
+ return null;
2847
+ 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" }));
2848
+ }
2849
+ renderColorInput() {
2850
+ const { onColorInputChange, colorInputValue, colorInputClassName, inputDisabled, arias } = this.props;
2851
+ if (!onColorInputChange)
2852
+ return null;
2853
+ return (React.createElement("input", Object.assign({ type: "color", disabled: inputDisabled, value: colorInputValue, className: colorInputClassName, onChange: onColorInputChange, tabIndex: -1 }, arias)));
2854
+ }
2855
+ render() {
2856
+ const content = (React.createElement("div", { className: "sd-color-swatch__content", style: this.rootStyle },
2857
+ this.renderIcon(),
2858
+ this.renderColorInput()));
2859
+ if (this.props.onColorInputChange) {
2860
+ return React.createElement("label", { className: this.rootClassName }, content);
2861
+ }
2862
+ return React.createElement("div", { className: this.rootClassName }, content);
2863
+ }
2864
+ }
2865
+
2835
2866
  class ItemTemplateComponent extends SurveyElementBase {
2836
2867
  render() {
2837
2868
  const item = this.props.item;
2838
- return (React.createElement(React.Fragment, null,
2839
- React.createElement("span", { className: "spg-color-editor__color-swatch", style: { backgroundColor: item.value } }),
2840
- React.createElement("span", { key: 2 }, this.renderLocString(item.locTitle, undefined, "locString"))));
2869
+ return (React.createElement("div", { className: "sd-color-swatch-item" },
2870
+ React.createElement("div", { className: "sd-color-swatch-item__label" },
2871
+ React.createElement("span", { key: 2, className: "sd-color-swatch-item__caption" }, this.renderLocString(item.locTitle, undefined, "locString"))),
2872
+ React.createElement(Swatch, { color: item.value })));
2841
2873
  }
2842
2874
  }
2843
2875
  ReactElementFactory.Instance.registerElement("color-item", (props) => {
@@ -2866,9 +2898,15 @@ class SurveyQuestionColor extends SurveyQuestionText {
2866
2898
  return this.question.renderedValue;
2867
2899
  }
2868
2900
  renderColorSwatch() {
2869
- return React.createElement("label", { className: this.question.getSwatchCss(), style: this.question.getSwatchStyle() },
2870
- React.createElement(SvgIcon, { iconName: this.question.cssClasses.swatchIcon, size: "auto" }),
2871
- 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 }));
2901
+ const question = this.question;
2902
+ return (React.createElement("div", { className: question.cssClasses.colorSwatch },
2903
+ 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: {
2904
+ "aria-required": question.a11y_input_ariaRequired,
2905
+ "aria-labelledby": question.a11y_input_ariaLabelledBy,
2906
+ "aria-label": question.a11y_input_ariaLabel,
2907
+ "aria-invalid": question.a11y_input_ariaInvalid,
2908
+ "aria-describedby": question.a11y_input_ariaDescribedBy,
2909
+ } })));
2872
2910
  }
2873
2911
  renderButtons() {
2874
2912
  return this.question.hasVisibleInputActions ? React.createElement(SurveyActionBar, { model: this.question.inputActionsContainer }) : null;
@@ -2925,27 +2963,9 @@ ReactElementFactory.Instance.registerElement("sv-fileedit-button", (props) => {
2925
2963
  return React.createElement(SurveyQuestionFileEditorButton, props);
2926
2964
  });
2927
2965
 
2928
- class SurveyQuestionBooleanSwitch extends SurveyQuestionElementBase {
2929
- renderElement() {
2930
- 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 },
2931
- React.createElement("div", { className: "spg-boolean-switch__thumb" },
2932
- React.createElement("div", { className: "spg-boolean-switch__thumb-circle spg-boolean-switch__thumb--left" })),
2933
- React.createElement("div", { className: "spg-boolean-switch__thumb" },
2934
- React.createElement("div", { className: "spg-boolean-switch__thumb-circle spg-boolean-switch__thumb--right" }))), this.questionBase, { processEsc: false });
2935
- return (React.createElement("div", { className: "spg-boolean-switch", onClick: () => this.questionBase.booleanValue = !this.questionBase.booleanValue },
2936
- button,
2937
- React.createElement("div", { className: "spg-boolean-switch__caption" },
2938
- React.createElement("div", { className: "spg-boolean-switch__title", id: this.questionBase.labelRenderedAriaID }, SurveyElementBase.renderLocString(this.questionBase.locTitle)))));
2939
- }
2940
- }
2941
- ReactQuestionFactory.Instance.registerQuestion("sv-boolean-switch", (props) => {
2942
- return React.createElement(SurveyQuestionBooleanSwitch, props);
2943
- });
2944
- RendererFactory.Instance.registerRenderer("boolean", "switch", "sv-boolean-switch");
2945
-
2946
2966
  let Version;
2947
- Version = `${"3.0.0-beta.6"}`;
2948
- checkLibraryVersion(`${"3.0.0-beta.6"}`, "survey-creator-react");
2967
+ Version = `${"3.0.0-beta.8"}`;
2968
+ checkLibraryVersion(`${"3.0.0-beta.8"}`, "survey-creator-react");
2949
2969
 
2950
2970
  function renderSurveyCreator(creator, element, props = {}) {
2951
2971
  let node = element;
@@ -2974,5 +2994,5 @@ if (typeof window !== "undefined") {
2974
2994
  }
2975
2995
  }
2976
2996
 
2977
- 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, renderSurveyCreator };
2997
+ 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, renderSurveyCreator };
2978
2998
  //# sourceMappingURL=survey-creator-js.mjs.map