survey-js-ui 3.0.2 → 3.0.4

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.
package/index.html CHANGED
@@ -8,6 +8,9 @@
8
8
  <script src="./node_modules/survey-core/survey.core.js"></script>
9
9
  <script src="./build/survey-js-ui.js"></script>
10
10
  <link rel="stylesheet" href="./index.css" />
11
+ <!-- survey-core embeds no @font-face rule; the page supplies Open Sans itself.
12
+ Pinned to the files the reference screenshots were taken with - see fonts.css. -->
13
+ <link rel="stylesheet" href="./fonts.css" />
11
14
  </head>
12
15
 
13
16
  <body spellcheck="false">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "survey-js-ui",
3
- "version": "3.0.2",
3
+ "version": "3.0.4",
4
4
  "license": "MIT",
5
5
  "homepage": "https://surveyjs.io/",
6
6
  "author": "DevSoft Baltic OU <info@devsoftbaltic.com>",
@@ -60,7 +60,7 @@
60
60
  },
61
61
  "dependencies": {},
62
62
  "peerDependencies": {
63
- "survey-core": "3.0.2",
63
+ "survey-core": "3.0.4",
64
64
  "@types/react-dom": "*",
65
65
  "@types/react": "*"
66
66
  }
package/survey-js-ui.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * surveyjs - Survey JavaScript library v3.0.2
2
+ * surveyjs - Survey JavaScript library v3.0.4
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
  */
@@ -433,6 +433,36 @@
433
433
  }
434
434
  }
435
435
 
436
+ function attachKey2click(element, viewModel, options = { processEsc: true, disableTabStop: false }) {
437
+ let props = {};
438
+ if ((!!viewModel && viewModel.disableTabStop) || (!!options && options.disableTabStop)) {
439
+ props = { tabIndex: -1 };
440
+ }
441
+ else {
442
+ options = { ...options };
443
+ props = {
444
+ tabIndex: 0,
445
+ onKeyUp: (evt) => {
446
+ evt.preventDefault();
447
+ evt.stopPropagation();
448
+ surveyCore.doKey2ClickUp(evt, options);
449
+ },
450
+ onKeyDown: (evt) => surveyCore.doKey2ClickDown(evt, options),
451
+ onBlur: (evt) => surveyCore.doKey2ClickBlur(evt),
452
+ };
453
+ }
454
+ props["onPointerUp"] = (evt) => {
455
+ if (evt.pointerType === "pen") {
456
+ evt.preventDefault();
457
+ evt.stopPropagation();
458
+ const element = evt.target;
459
+ if (element === null || element === void 0 ? void 0 : element.click)
460
+ element.click();
461
+ }
462
+ };
463
+ return _n(element, props);
464
+ }
465
+
436
466
  class SvgIcon extends x$2 {
437
467
  constructor(props) {
438
468
  super(props);
@@ -631,174 +661,6 @@
631
661
  return _$1(SurveyActionBarItem, props);
632
662
  });
633
663
 
634
- class Popup extends SurveyElementBase {
635
- constructor(props) {
636
- super(props);
637
- this.containerRef = b$1();
638
- this.createModel();
639
- }
640
- get model() {
641
- return this.props.model;
642
- }
643
- getStateElement() {
644
- return this.model;
645
- }
646
- createModel() {
647
- this.popup = surveyCore.createPopupViewModel(this.props.model);
648
- }
649
- setTargetElement() {
650
- const container = this.containerRef.current;
651
- this.popup.setComponentElement(container);
652
- }
653
- componentDidMount() {
654
- super.componentDidMount();
655
- this.setTargetElement();
656
- }
657
- componentDidUpdate(prevProps, prevState) {
658
- super.componentDidUpdate(prevProps, prevState);
659
- this.setTargetElement();
660
- }
661
- componentWillUnmount() {
662
- super.componentWillUnmount();
663
- this.popup.resetComponentElement();
664
- }
665
- shouldComponentUpdate(nextProps, nextState) {
666
- var _a;
667
- if (!super.shouldComponentUpdate(nextProps, nextState))
668
- return false;
669
- const isNeedUpdate = nextProps.model !== this.popup.model;
670
- if (isNeedUpdate) {
671
- (_a = this.popup) === null || _a === void 0 ? void 0 : _a.dispose();
672
- this.createModel();
673
- }
674
- return isNeedUpdate;
675
- }
676
- render() {
677
- this.popup.model = this.model;
678
- let popupContainer;
679
- if (this.model.isModal) {
680
- popupContainer = _$1(PopupContainer, { model: this.popup });
681
- }
682
- else {
683
- popupContainer = _$1(PopupDropdownContainer, { model: this.popup });
684
- }
685
- return _$1("div", { ref: this.containerRef }, popupContainer);
686
- }
687
- }
688
- ReactElementFactory.Instance.registerElement("sv-popup", (props) => {
689
- return _$1(Popup, props);
690
- });
691
- class PopupContainer extends SurveyElementBase {
692
- constructor(props) {
693
- super(props);
694
- this.handleKeydown = (event) => {
695
- this.model.onKeyDown(event);
696
- };
697
- this.clickInside = (ev) => {
698
- ev.stopPropagation();
699
- };
700
- }
701
- get model() {
702
- return this.props.model;
703
- }
704
- getStateElement() {
705
- return this.model;
706
- }
707
- componentDidUpdate(prevProps, prevState) {
708
- super.componentDidUpdate(prevProps, prevState);
709
- if (!this.model.isPositionSet && this.model.isVisible) {
710
- this.model.updateOnShowing();
711
- }
712
- }
713
- renderContainer(popupBaseViewModel) {
714
- const headerPopup = popupBaseViewModel.showHeader ? this.renderHeaderPopup(popupBaseViewModel) : null;
715
- const headerContent = !!popupBaseViewModel.title ? this.renderHeaderContent() : null;
716
- const content = this.renderContent();
717
- const footerContent = popupBaseViewModel.showFooter ? this.renderFooter(this.model) : null;
718
- return (_$1("div", { className: "sv-popup__container", style: {
719
- left: popupBaseViewModel.left,
720
- top: popupBaseViewModel.top,
721
- height: popupBaseViewModel.height,
722
- width: popupBaseViewModel.width,
723
- minWidth: popupBaseViewModel.minWidth,
724
- }, onClick: (ev) => {
725
- this.clickInside(ev);
726
- } },
727
- headerPopup,
728
- _$1("div", { className: "sv-popup__body-content" },
729
- headerContent,
730
- _$1("div", { className: "sv-popup__scrolling-content" }, content),
731
- footerContent)));
732
- }
733
- renderHeaderContent() {
734
- return _$1("div", { className: "sv-popup__body-header" }, this.model.title);
735
- }
736
- renderContent() {
737
- const contentComponent = ReactElementFactory.Instance.createElement(this.model.contentComponentName, this.model.contentComponentData);
738
- return _$1("div", { className: "sv-popup__content" }, contentComponent);
739
- }
740
- renderHeaderPopup(popupModel) {
741
- return popupModel.showCloseButton ? _$1("button", { tabIndex: -1, className: "sv-popup__close-button sd-action sd-action--icon", onClick: () => this.model.clickClose() },
742
- _$1(SvgIcon, { className: "sv-popup__close-button-icon", iconName: "icon-close-24x24", size: "auto" })) : null;
743
- }
744
- renderFooter(popuModel) {
745
- return (_$1("div", { className: "sv-popup__body-footer" },
746
- _$1(SurveyActionBar, { model: popuModel.footerToolbar })));
747
- }
748
- render() {
749
- const container = this.renderContainer(this.model);
750
- const className = new surveyCore.CssClassBuilder()
751
- .append("sv-popup")
752
- .append(this.model.styleClass)
753
- .toString();
754
- const style = { display: this.model.isVisible ? "" : "none", };
755
- return (_$1("div", { tabIndex: -1, className: className, style: style, onClick: (e) => {
756
- this.model.clickOutside(e);
757
- }, onBlur: (e) => {
758
- this.model.blur(e);
759
- }, onKeyDown: this.handleKeydown }, container));
760
- }
761
- componentDidMount() {
762
- super.componentDidMount();
763
- if (this.model.isVisible) {
764
- this.model.updateOnShowing();
765
- }
766
- }
767
- }
768
- class PopupDropdownContainer extends PopupContainer {
769
- renderHeaderPopup(popupModel) {
770
- const popupDropdownModel = popupModel;
771
- if (!popupDropdownModel || !popupDropdownModel.showHeader)
772
- return null;
773
- return (_$1("span", { style: {
774
- left: popupDropdownModel.pointerTarget.left,
775
- top: popupDropdownModel.pointerTarget.top,
776
- }, className: "sv-popup__pointer" }));
777
- }
778
- }
779
-
780
- class SurveyActionBarItemDropdown extends SurveyActionBarItem {
781
- constructor(props) {
782
- super(props);
783
- }
784
- renderInnerButton() {
785
- const button = super.renderInnerButton();
786
- return (_$1(k$2, null,
787
- button,
788
- _$1(Popup, { model: this.item.popupModel })));
789
- }
790
- componentDidMount() {
791
- this.viewModel = new surveyCore.ActionDropdownViewModel(this.item);
792
- }
793
- componentWillUnmount() {
794
- super.componentWillUnmount();
795
- this.viewModel.dispose();
796
- }
797
- }
798
- ReactElementFactory.Instance.registerElement("sv-action-bar-item-dropdown", (props) => {
799
- return _$1(SurveyActionBarItemDropdown, props);
800
- });
801
-
802
664
  class SurveyActionBar extends SurveyElementBase {
803
665
  constructor(props) {
804
666
  super(props);
@@ -1115,6 +977,152 @@
1115
977
  }
1116
978
  }
1117
979
 
980
+ class Popup extends SurveyElementBase {
981
+ constructor(props) {
982
+ super(props);
983
+ this.containerRef = b$1();
984
+ this.createModel();
985
+ }
986
+ get model() {
987
+ return this.props.model;
988
+ }
989
+ getStateElement() {
990
+ return this.model;
991
+ }
992
+ createModel() {
993
+ this.popup = surveyCore.createPopupViewModel(this.props.model);
994
+ }
995
+ setTargetElement() {
996
+ const container = this.containerRef.current;
997
+ this.popup.setComponentElement(container);
998
+ }
999
+ componentDidMount() {
1000
+ super.componentDidMount();
1001
+ this.setTargetElement();
1002
+ }
1003
+ componentDidUpdate(prevProps, prevState) {
1004
+ super.componentDidUpdate(prevProps, prevState);
1005
+ this.setTargetElement();
1006
+ }
1007
+ componentWillUnmount() {
1008
+ super.componentWillUnmount();
1009
+ this.popup.resetComponentElement();
1010
+ }
1011
+ shouldComponentUpdate(nextProps, nextState) {
1012
+ var _a;
1013
+ if (!super.shouldComponentUpdate(nextProps, nextState))
1014
+ return false;
1015
+ const isNeedUpdate = nextProps.model !== this.popup.model;
1016
+ if (isNeedUpdate) {
1017
+ (_a = this.popup) === null || _a === void 0 ? void 0 : _a.dispose();
1018
+ this.createModel();
1019
+ }
1020
+ return isNeedUpdate;
1021
+ }
1022
+ render() {
1023
+ this.popup.model = this.model;
1024
+ let popupContainer;
1025
+ if (this.model.isModal) {
1026
+ popupContainer = _$1(PopupContainer, { model: this.popup });
1027
+ }
1028
+ else {
1029
+ popupContainer = _$1(PopupDropdownContainer, { model: this.popup });
1030
+ }
1031
+ return _$1("div", { ref: this.containerRef }, popupContainer);
1032
+ }
1033
+ }
1034
+ ReactElementFactory.Instance.registerElement("sv-popup", (props) => {
1035
+ return _$1(Popup, props);
1036
+ });
1037
+ class PopupContainer extends SurveyElementBase {
1038
+ constructor(props) {
1039
+ super(props);
1040
+ this.handleKeydown = (event) => {
1041
+ this.model.onKeyDown(event);
1042
+ };
1043
+ this.clickInside = (ev) => {
1044
+ ev.stopPropagation();
1045
+ };
1046
+ }
1047
+ get model() {
1048
+ return this.props.model;
1049
+ }
1050
+ getStateElement() {
1051
+ return this.model;
1052
+ }
1053
+ componentDidUpdate(prevProps, prevState) {
1054
+ super.componentDidUpdate(prevProps, prevState);
1055
+ if (!this.model.isPositionSet && this.model.isVisible) {
1056
+ this.model.updateOnShowing();
1057
+ }
1058
+ }
1059
+ renderContainer(popupBaseViewModel) {
1060
+ const headerPopup = popupBaseViewModel.showHeader ? this.renderHeaderPopup(popupBaseViewModel) : null;
1061
+ const headerContent = !!popupBaseViewModel.title ? this.renderHeaderContent() : null;
1062
+ const content = this.renderContent();
1063
+ const footerContent = popupBaseViewModel.showFooter ? this.renderFooter(this.model) : null;
1064
+ return (_$1("div", { className: "sv-popup__container", style: {
1065
+ left: popupBaseViewModel.left,
1066
+ top: popupBaseViewModel.top,
1067
+ height: popupBaseViewModel.height,
1068
+ width: popupBaseViewModel.width,
1069
+ minWidth: popupBaseViewModel.minWidth,
1070
+ }, onClick: (ev) => {
1071
+ this.clickInside(ev);
1072
+ } },
1073
+ headerPopup,
1074
+ _$1("div", { className: "sv-popup__body-content" },
1075
+ headerContent,
1076
+ _$1("div", { className: "sv-popup__scrolling-content" }, content),
1077
+ footerContent)));
1078
+ }
1079
+ renderHeaderContent() {
1080
+ return _$1("div", { className: "sv-popup__body-header" }, this.model.title);
1081
+ }
1082
+ renderContent() {
1083
+ const contentComponent = ReactElementFactory.Instance.createElement(this.model.contentComponentName, this.model.contentComponentData);
1084
+ return _$1("div", { className: "sv-popup__content" }, contentComponent);
1085
+ }
1086
+ renderHeaderPopup(popupModel) {
1087
+ return popupModel.showCloseButton ? _$1("button", { tabIndex: -1, className: "sv-popup__close-button sd-action sd-action--icon", onClick: () => this.model.clickClose() },
1088
+ _$1(SvgIcon, { className: "sv-popup__close-button-icon", iconName: "icon-close-24x24", size: "auto" })) : null;
1089
+ }
1090
+ renderFooter(popuModel) {
1091
+ return (_$1("div", { className: "sv-popup__body-footer" },
1092
+ _$1(SurveyActionBar, { model: popuModel.footerToolbar })));
1093
+ }
1094
+ render() {
1095
+ const container = this.renderContainer(this.model);
1096
+ const className = new surveyCore.CssClassBuilder()
1097
+ .append("sv-popup")
1098
+ .append(this.model.styleClass)
1099
+ .toString();
1100
+ const style = { display: this.model.isVisible ? "" : "none", };
1101
+ return (_$1("div", { tabIndex: -1, className: className, style: style, onClick: (e) => {
1102
+ this.model.clickOutside(e);
1103
+ }, onBlur: (e) => {
1104
+ this.model.blur(e);
1105
+ }, onKeyDown: this.handleKeydown }, container));
1106
+ }
1107
+ componentDidMount() {
1108
+ super.componentDidMount();
1109
+ if (this.model.isVisible) {
1110
+ this.model.updateOnShowing();
1111
+ }
1112
+ }
1113
+ }
1114
+ class PopupDropdownContainer extends PopupContainer {
1115
+ renderHeaderPopup(popupModel) {
1116
+ const popupDropdownModel = popupModel;
1117
+ if (!popupDropdownModel || !popupDropdownModel.showHeader)
1118
+ return null;
1119
+ return (_$1("span", { style: {
1120
+ left: popupDropdownModel.pointerTarget.left,
1121
+ top: popupDropdownModel.pointerTarget.top,
1122
+ }, className: "sv-popup__pointer" }));
1123
+ }
1124
+ }
1125
+
1118
1126
  class PopupModal extends SurveyElementBase {
1119
1127
  createPopupModalManager() {
1120
1128
  const modalManager = new surveyCore.PopupModalManager();
@@ -1198,7 +1206,7 @@
1198
1206
 
1199
1207
  var removefile = "<svg viewBox=\"0 0 16 16\"><path d=\"M8,2C4.7,2,2,4.7,2,8s2.7,6,6,6s6-2.7,6-6S11.3,2,8,2z M11,10l-1,1L8,9l-2,2l-1-1l2-2L5,6l1-1l2,2l2-2l1,1L9,8 L11,10z\"/></svg>";
1200
1208
 
1201
- var timercircle = "<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" viewBox=\"0 0 160 160\"><circle cx=\"80\" cy=\"80\" r=\"70\" style=\"stroke:var(--sd-timer-stroke-background-color);stroke-width:var(--sd-timer-stroke-background-width)\" stroke-dasharray=\"none\" stroke-dashoffset=\"none\"/><circle cx=\"80\" cy=\"80\" r=\"70\"/></svg>";
1209
+ var timercircle = "<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" viewBox=\"0 0 160 160\"><circle cx=\"80\" cy=\"80\" r=\"70\" class=\"sd-timer__stroke-background\" stroke-dasharray=\"none\" stroke-dashoffset=\"none\"/><circle cx=\"80\" cy=\"80\" r=\"70\"/></svg>";
1202
1210
 
1203
1211
  var add_24x24 = "<svg viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M15.75 12C15.75 12.41 15.41 12.75 15 12.75H12.75V15C12.75 15.41 12.41 15.75 12 15.75C11.59 15.75 11.25 15.41 11.25 15V12.75H9C8.59 12.75 8.25 12.41 8.25 12C8.25 11.59 8.59 11.25 9 11.25H11.25V9C11.25 8.59 11.59 8.25 12 8.25C12.41 8.25 12.75 8.59 12.75 9V11.25H15C15.41 11.25 15.75 11.59 15.75 12ZM21.75 12C21.75 17.38 17.38 21.75 12 21.75C6.62 21.75 2.25 17.38 2.25 12C2.25 6.62 6.62 2.25 12 2.25C17.38 2.25 21.75 6.62 21.75 12ZM20.25 12C20.25 7.45 16.55 3.75 12 3.75C7.45 3.75 3.75 7.45 3.75 12C3.75 16.55 7.45 20.25 12 20.25C16.55 20.25 20.25 16.55 20.25 12Z\"/></svg>";
1204
1212
 
@@ -1512,11 +1520,6 @@
1512
1520
  const rootCss = this.survey.getRootCss();
1513
1521
  const cssClasses = this.rootNodeClassName ? this.rootNodeClassName + " " + rootCss : rootCss;
1514
1522
  return (_$1("div", { id: this.rootNodeId, ref: this.rootRef, className: cssClasses, style: this.survey.themeVariables, lang: this.survey.locale || "en", dir: this.survey.localeDir },
1515
- this.survey.generateStylesheet ?
1516
- _$1(k$2, null,
1517
- _$1("style", null, this.survey.themeStyle),
1518
- _$1("style", null, this.survey.resetVariablesStyle))
1519
- : null,
1520
1523
  _$1(Scroll, { disabled: this.survey.rootScrollDisabled },
1521
1524
  this.survey.needRenderIcons ? _$1(SvgBundleComponent, null) : null,
1522
1525
  _$1(PopupModal, null),
@@ -1681,35 +1684,6 @@
1681
1684
  ReactElementFactory.Instance.registerElement("survey", (props) => {
1682
1685
  return _$1(Survey, props);
1683
1686
  });
1684
- function attachKey2click(element, viewModel, options = { processEsc: true, disableTabStop: false }) {
1685
- let props = {};
1686
- if ((!!viewModel && viewModel.disableTabStop) || (!!options && options.disableTabStop)) {
1687
- props = { tabIndex: -1 };
1688
- }
1689
- else {
1690
- options = { ...options };
1691
- props = {
1692
- tabIndex: 0,
1693
- onKeyUp: (evt) => {
1694
- evt.preventDefault();
1695
- evt.stopPropagation();
1696
- surveyCore.doKey2ClickUp(evt, options);
1697
- },
1698
- onKeyDown: (evt) => surveyCore.doKey2ClickDown(evt, options),
1699
- onBlur: (evt) => surveyCore.doKey2ClickBlur(evt),
1700
- };
1701
- }
1702
- props["onPointerUp"] = (evt) => {
1703
- if (evt.pointerType === "pen") {
1704
- evt.preventDefault();
1705
- evt.stopPropagation();
1706
- const element = evt.target;
1707
- if (element === null || element === void 0 ? void 0 : element.click)
1708
- element.click();
1709
- }
1710
- };
1711
- return _n(element, props);
1712
- }
1713
1687
 
1714
1688
  class SurveyNavigationBase extends SurveyElementBase {
1715
1689
  constructor(props) {
@@ -5969,6 +5943,28 @@
5969
5943
  return _$1(ListItemGroup, props);
5970
5944
  });
5971
5945
 
5946
+ class SurveyActionBarItemDropdown extends SurveyActionBarItem {
5947
+ constructor(props) {
5948
+ super(props);
5949
+ }
5950
+ renderInnerButton() {
5951
+ const button = super.renderInnerButton();
5952
+ return (_$1(k$2, null,
5953
+ button,
5954
+ _$1(Popup, { model: this.item.popupModel })));
5955
+ }
5956
+ componentDidMount() {
5957
+ this.viewModel = new surveyCore.ActionDropdownViewModel(this.item);
5958
+ }
5959
+ componentWillUnmount() {
5960
+ super.componentWillUnmount();
5961
+ this.viewModel.dispose();
5962
+ }
5963
+ }
5964
+ ReactElementFactory.Instance.registerElement("sv-action-bar-item-dropdown", (props) => {
5965
+ return _$1(SurveyActionBarItemDropdown, props);
5966
+ });
5967
+
5972
5968
  class LogoImage extends x$2 {
5973
5969
  constructor(props) {
5974
5970
  super(props);
@@ -6264,7 +6260,7 @@
6264
6260
  }
6265
6261
  };
6266
6262
  const preact = React;
6267
- surveyCore.checkLibraryVersion(`${"3.0.2"}`, "survey-js-ui");
6263
+ surveyCore.checkLibraryVersion(`${"3.0.4"}`, "survey-js-ui");
6268
6264
 
6269
6265
  Object.defineProperty(exports, 'Model', {
6270
6266
  enumerable: true,
@@ -6324,6 +6320,8 @@
6324
6320
  exports.StrictMode = Cn;
6325
6321
  exports.Survey = Survey;
6326
6322
  exports.SurveyActionBar = SurveyActionBar;
6323
+ exports.SurveyActionBarItemDropdown = SurveyActionBarItemDropdown;
6324
+ exports.SurveyActionBarSeparator = SurveyActionBarSeparator;
6327
6325
  exports.SurveyElementBase = SurveyElementBase;
6328
6326
  exports.SurveyElementErrors = SurveyElementErrors;
6329
6327
  exports.SurveyFileChooseButton = SurveyFileChooseButton;