survey-js-ui 3.0.1 → 3.0.3

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,10 +1,10 @@
1
1
  /*!
2
- * surveyjs - Survey JavaScript library v3.0.1
2
+ * surveyjs - Survey JavaScript library v3.0.3
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
  */
6
6
 
7
- import { SurveyModel, Helpers, createSvg, LocalizableString, createPopupViewModel, CssClassBuilder, ActionDropdownViewModel, RendererFactory, doKey2ClickUp, SvgRegistry, PopupModalManager, settings, ScrollViewModel, addIconsToThemeSet, doKey2ClickDown, doKey2ClickBlur, ResizeManager, Question, QuestionTextModel, SurveyProgressModel, PopupSurveyModel, ButtonGroupItemModel, checkLibraryVersion } from 'survey-core';
7
+ import { SurveyModel, Helpers, doKey2ClickUp, doKey2ClickDown, doKey2ClickBlur, createSvg, LocalizableString, RendererFactory, SvgRegistry, createPopupViewModel, CssClassBuilder, PopupModalManager, settings, ScrollViewModel, addIconsToThemeSet, ResizeManager, Question, QuestionTextModel, SurveyProgressModel, PopupSurveyModel, ButtonGroupItemModel, ActionDropdownViewModel, checkLibraryVersion } from 'survey-core';
8
8
  export { SurveyModel as Model, SurveyModel, SurveyWindowModel, settings, surveyLocalization, surveyStrings } from 'survey-core';
9
9
 
10
10
  var n,l$1,u$1,i$1,r$1,o$1,e$1,f$1,c$1,s$1,a$1,h$1,p$1={},v$1=[],y$1=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,w$3=Array.isArray;function d$1(n,l){for(var u in l)n[u]=l[u];return n}function g$3(n){n&&n.parentNode&&n.parentNode.removeChild(n);}function _$1(l,u,t){var i,r,o,e={};for(o in u)"key"==o?i=u[o]:"ref"==o?r=u[o]:e[o]=u[o];if(arguments.length>2&&(e.children=arguments.length>3?n.call(arguments,2):t),"function"==typeof l&&null!=l.defaultProps)for(o in l.defaultProps)void 0===e[o]&&(e[o]=l.defaultProps[o]);return m$1(l,e,i,r,null)}function m$1(n,t,i,r,o){var e={type:n,props:t,key:i,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==o?++u$1:o,__i:-1,__u:0};return null==o&&null!=l$1.vnode&&l$1.vnode(e),e}function b$1(){return {current:null}}function k$3(n){return n.children}function x$3(n,l){this.props=n,this.context=l;}function S(n,l){if(null==l)return n.__?S(n.__,n.__i+1):null;for(var u;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e)return u.__e;return "function"==typeof n.type?S(n):null}function C$3(n){var l,u;if(null!=(n=n.__)&&null!=n.__c){for(n.__e=n.__c.base=null,l=0;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e){n.__e=n.__c.base=u.__e;break}return C$3(n)}}function M$2(n){(!n.__d&&(n.__d=!0)&&i$1.push(n)&&!$$2.__r++||r$1!=l$1.debounceRendering)&&((r$1=l$1.debounceRendering)||o$1)($$2);}function $$2(){for(var n,u,t,r,o,f,c,s=1;i$1.length;)i$1.length>s&&i$1.sort(e$1),n=i$1.shift(),s=i$1.length,n.__d&&(t=void 0,r=void 0,o=(r=(u=n).__v).__e,f=[],c=[],u.__P&&((t=d$1({},r)).__v=r.__v+1,l$1.vnode&&l$1.vnode(t),O$2(u.__P,t,r,u.__n,u.__P.namespaceURI,32&r.__u?[o]:null,f,null==o?S(r):o,!!(32&r.__u),c),t.__v=r.__v,t.__.__k[t.__i]=t,N$2(f,t,c),r.__e=r.__=null,t.__e!=o&&C$3(t)));$$2.__r=0;}function I$2(n,l,u,t,i,r,o,e,f,c,s){var a,h,y,w,d,g,_,m=t&&t.__k||v$1,b=l.length;for(f=P$3(u,l,m,f,b),a=0;a<b;a++)null!=(y=u.__k[a])&&(h=-1==y.__i?p$1:m[y.__i]||p$1,y.__i=a,g=O$2(n,y,h,i,r,o,e,f,c,s),w=y.__e,y.ref&&h.ref!=y.ref&&(h.ref&&B$3(h.ref,null,y),s.push(y.ref,y.__c||w,y)),null==d&&null!=w&&(d=w),(_=!!(4&y.__u))||h.__k===y.__k?f=A$3(y,f,n,_):"function"==typeof y.type&&void 0!==g?f=g:w&&(f=w.nextSibling),y.__u&=-7);return u.__e=d,f}function P$3(n,l,u,t,i){var r,o,e,f,c,s=u.length,a=s,h=0;for(n.__k=new Array(i),r=0;r<i;r++)null!=(o=l[r])&&"boolean"!=typeof o&&"function"!=typeof o?(f=r+h,(o=n.__k[r]="string"==typeof o||"number"==typeof o||"bigint"==typeof o||o.constructor==String?m$1(null,o,null,null,null):w$3(o)?m$1(k$3,{children:o},null,null,null):null==o.constructor&&o.__b>0?m$1(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=n,o.__b=n.__b+1,e=null,-1!=(c=o.__i=L$2(o,u,f,a))&&(a--,(e=u[c])&&(e.__u|=2)),null==e||null==e.__v?(-1==c&&(i>s?h--:i<s&&h++),"function"!=typeof o.type&&(o.__u|=4)):c!=f&&(c==f-1?h--:c==f+1?h++:(c>f?h--:h++,o.__u|=4))):n.__k[r]=null;if(a)for(r=0;r<s;r++)null!=(e=u[r])&&0==(2&e.__u)&&(e.__e==t&&(t=S(e)),D$3(e,e));return t}function A$3(n,l,u,t){var i,r;if("function"==typeof n.type){for(i=n.__k,r=0;i&&r<i.length;r++)i[r]&&(i[r].__=n,l=A$3(i[r],l,u,t));return l}n.__e!=l&&(t&&(l&&n.type&&!l.parentNode&&(l=S(n)),u.insertBefore(n.__e,l||null)),l=n.__e);do{l=l&&l.nextSibling;}while(null!=l&&8==l.nodeType);return l}function H$2(n,l){return l=l||[],null==n||"boolean"==typeof n||(w$3(n)?n.some(function(n){H$2(n,l);}):l.push(n)),l}function L$2(n,l,u,t){var i,r,o,e=n.key,f=n.type,c=l[u],s=null!=c&&0==(2&c.__u);if(null===c&&null==n.key||s&&e==c.key&&f==c.type)return u;if(t>(s?1:0))for(i=u-1,r=u+1;i>=0||r<l.length;)if(null!=(c=l[o=i>=0?i--:r++])&&0==(2&c.__u)&&e==c.key&&f==c.type)return o;return -1}function T$3(n,l,u){"-"==l[0]?n.setProperty(l,null==u?"":u):n[l]=null==u?"":"number"!=typeof u||y$1.test(l)?u:u+"px";}function j$3(n,l,u,t,i){var r,o;n:if("style"==l)if("string"==typeof u)n.style.cssText=u;else {if("string"==typeof t&&(n.style.cssText=t=""),t)for(l in t)u&&l in u||T$3(n.style,l,"");if(u)for(l in u)t&&u[l]==t[l]||T$3(n.style,l,u[l]);}else if("o"==l[0]&&"n"==l[1])r=l!=(l=l.replace(f$1,"$1")),o=l.toLowerCase(),l=o in n||"onFocusOut"==l||"onFocusIn"==l?o.slice(2):l.slice(2),n.l||(n.l={}),n.l[l+r]=u,u?t?u.u=t.u:(u.u=c$1,n.addEventListener(l,r?a$1:s$1,r)):n.removeEventListener(l,r?a$1:s$1,r);else {if("http://www.w3.org/2000/svg"==i)l=l.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=l&&"height"!=l&&"href"!=l&&"list"!=l&&"form"!=l&&"tabIndex"!=l&&"download"!=l&&"rowSpan"!=l&&"colSpan"!=l&&"role"!=l&&"popover"!=l&&l in n)try{n[l]=null==u?"":u;break n}catch(n){}"function"==typeof u||(null==u||!1===u&&"-"!=l[4]?n.removeAttribute(l):n.setAttribute(l,"popover"==l&&1==u?"":u));}}function F$3(n){return function(u){if(this.l){var t=this.l[u.type+n];if(null==u.t)u.t=c$1++;else if(u.t<t.u)return;return t(l$1.event?l$1.event(u):u)}}}function O$2(n,u,t,i,r,o,e,f,c,s){var a,h,p,v,y,_,m,b,S,C,M,$,P,A,H,L,T,j=u.type;if(null!=u.constructor)return null;128&t.__u&&(c=!!(32&t.__u),o=[f=u.__e=t.__e]),(a=l$1.__b)&&a(u);n:if("function"==typeof j)try{if(b=u.props,S="prototype"in j&&j.prototype.render,C=(a=j.contextType)&&i[a.__c],M=a?C?C.props.value:a.__:i,t.__c?m=(h=u.__c=t.__c).__=h.__E:(S?u.__c=h=new j(b,M):(u.__c=h=new x$3(b,M),h.constructor=j,h.render=E$2),C&&C.sub(h),h.props=b,h.state||(h.state={}),h.context=M,h.__n=i,p=h.__d=!0,h.__h=[],h._sb=[]),S&&null==h.__s&&(h.__s=h.state),S&&null!=j.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=d$1({},h.__s)),d$1(h.__s,j.getDerivedStateFromProps(b,h.__s))),v=h.props,y=h.state,h.__v=u,p)S&&null==j.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),S&&null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else {if(S&&null==j.getDerivedStateFromProps&&b!==v&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(b,M),!h.__e&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(b,h.__s,M)||u.__v==t.__v){for(u.__v!=t.__v&&(h.props=b,h.state=h.__s,h.__d=!1),u.__e=t.__e,u.__k=t.__k,u.__k.some(function(n){n&&(n.__=u);}),$=0;$<h._sb.length;$++)h.__h.push(h._sb[$]);h._sb=[],h.__h.length&&e.push(h);break n}null!=h.componentWillUpdate&&h.componentWillUpdate(b,h.__s,M),S&&null!=h.componentDidUpdate&&h.__h.push(function(){h.componentDidUpdate(v,y,_);});}if(h.context=M,h.props=b,h.__P=n,h.__e=!1,P=l$1.__r,A=0,S){for(h.state=h.__s,h.__d=!1,P&&P(u),a=h.render(h.props,h.state,h.context),H=0;H<h._sb.length;H++)h.__h.push(h._sb[H]);h._sb=[];}else do{h.__d=!1,P&&P(u),a=h.render(h.props,h.state,h.context),h.state=h.__s;}while(h.__d&&++A<25);h.state=h.__s,null!=h.getChildContext&&(i=d$1(d$1({},i),h.getChildContext())),S&&!p&&null!=h.getSnapshotBeforeUpdate&&(_=h.getSnapshotBeforeUpdate(v,y)),L=a,null!=a&&a.type===k$3&&null==a.key&&(L=V$2(a.props.children)),f=I$2(n,w$3(L)?L:[L],u,t,i,r,o,e,f,c,s),h.base=u.__e,u.__u&=-161,h.__h.length&&e.push(h),m&&(h.__E=h.__=null);}catch(n){if(u.__v=null,c||null!=o)if(n.then){for(u.__u|=c?160:128;f&&8==f.nodeType&&f.nextSibling;)f=f.nextSibling;o[o.indexOf(f)]=null,u.__e=f;}else {for(T=o.length;T--;)g$3(o[T]);z$3(u);}else u.__e=t.__e,u.__k=t.__k,n.then||z$3(u);l$1.__e(n,u,t);}else null==o&&u.__v==t.__v?(u.__k=t.__k,u.__e=t.__e):f=u.__e=q$3(t.__e,u,t,i,r,o,e,c,s);return (a=l$1.diffed)&&a(u),128&u.__u?void 0:f}function z$3(n){n&&n.__c&&(n.__c.__e=!0),n&&n.__k&&n.__k.forEach(z$3);}function N$2(n,u,t){for(var i=0;i<t.length;i++)B$3(t[i],t[++i],t[++i]);l$1.__c&&l$1.__c(u,n),n.some(function(u){try{n=u.__h,u.__h=[],n.some(function(n){n.call(u);});}catch(n){l$1.__e(n,u.__v);}});}function V$2(n){return "object"!=typeof n||null==n||n.__b&&n.__b>0?n:w$3(n)?n.map(V$2):d$1({},n)}function q$3(u,t,i,r,o,e,f,c,s){var a,h,v,y,d,_,m,b=i.props,k=t.props,x=t.type;if("svg"==x?o="http://www.w3.org/2000/svg":"math"==x?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),null!=e)for(a=0;a<e.length;a++)if((d=e[a])&&"setAttribute"in d==!!x&&(x?d.localName==x:3==d.nodeType)){u=d,e[a]=null;break}if(null==u){if(null==x)return document.createTextNode(k);u=document.createElementNS(o,x,k.is&&k),c&&(l$1.__m&&l$1.__m(t,e),c=!1),e=null;}if(null==x)b===k||c&&u.data==k||(u.data=k);else {if(e=e&&n.call(u.childNodes),b=i.props||p$1,!c&&null!=e)for(b={},a=0;a<u.attributes.length;a++)b[(d=u.attributes[a]).name]=d.value;for(a in b)if(d=b[a],"children"==a);else if("dangerouslySetInnerHTML"==a)v=d;else if(!(a in k)){if("value"==a&&"defaultValue"in k||"checked"==a&&"defaultChecked"in k)continue;j$3(u,a,null,d,o);}for(a in k)d=k[a],"children"==a?y=d:"dangerouslySetInnerHTML"==a?h=d:"value"==a?_=d:"checked"==a?m=d:c&&"function"!=typeof d||b[a]===d||j$3(u,a,d,b[a],o);if(h)c||v&&(h.__html==v.__html||h.__html==u.innerHTML)||(u.innerHTML=h.__html),t.__k=[];else if(v&&(u.innerHTML=""),I$2("template"==t.type?u.content:u,w$3(y)?y:[y],t,i,r,"foreignObject"==x?"http://www.w3.org/1999/xhtml":o,e,f,e?e[0]:i.__k&&S(i,0),c,s),null!=e)for(a=e.length;a--;)g$3(e[a]);c||(a="value","progress"==x&&null==_?u.removeAttribute("value"):null!=_&&(_!==u[a]||"progress"==x&&!_||"option"==x&&_!=b[a])&&j$3(u,a,_,b[a],o),a="checked",null!=m&&m!=u[a]&&j$3(u,a,m,b[a],o));}return u}function B$3(n,u,t){try{if("function"==typeof n){var i="function"==typeof n.__u;i&&n.__u(),i&&null==u||(n.__u=n(u));}else n.current=u;}catch(n){l$1.__e(n,t);}}function D$3(n,u,t){var i,r;if(l$1.unmount&&l$1.unmount(n),(i=n.ref)&&(i.current&&i.current!=n.__e||B$3(i,null,u)),null!=(i=n.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount();}catch(n){l$1.__e(n,u);}i.base=i.__P=null;}if(i=n.__k)for(r=0;r<i.length;r++)i[r]&&D$3(i[r],u,t||"function"!=typeof n.type);t||g$3(n.__e),n.__c=n.__=n.__e=void 0;}function E$2(n,l,u){return this.constructor(n,u)}function G$2(u,t,i){var r,o,e,f;t==document&&(t=document.documentElement),l$1.__&&l$1.__(u,t),o=(r="function"==typeof i)?null:i&&i.__k||t.__k,e=[],f=[],O$2(t,u=(!r&&i||t).__k=_$1(k$3,null,[u]),o||p$1,p$1,t.namespaceURI,!r&&i?[i]:o?null:t.firstChild?n.call(t.childNodes):null,e,!r&&i?i:o?o.__e:t.firstChild,r,f),N$2(e,u,f);}function J$2(n,l){G$2(n,l,J$2);}function K$2(l,u,t){var i,r,o,e,f=d$1({},l.props);for(o in l.type&&l.type.defaultProps&&(e=l.type.defaultProps),u)"key"==o?i=u[o]:"ref"==o?r=u[o]:f[o]=void 0===u[o]&&null!=e?e[o]:u[o];return arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):t),m$1(l.type,f,i||l.key,r||l.ref,null)}function Q$2(n){function l(n){var u,t;return this.getChildContext||(u=new Set,(t={})[l.__c]=this,this.getChildContext=function(){return t},this.componentWillUnmount=function(){u=null;},this.shouldComponentUpdate=function(n){this.props.value!=n.value&&u.forEach(function(n){n.__e=!0,M$2(n);});},this.sub=function(n){u.add(n);var l=n.componentWillUnmount;n.componentWillUnmount=function(){u&&u.delete(n),l&&l.call(n);};}),n.children}return l.__c="__cC"+h$1++,l.__=n,l.Provider=l.__l=(l.Consumer=function(n,l){return n.children(l)}).contextType=l,l}n=v$1.slice,l$1={__e:function(n,l,u,t){for(var i,r,o;l=l.__;)if((i=l.__c)&&!i.__)try{if((r=i.constructor)&&null!=r.getDerivedStateFromError&&(i.setState(r.getDerivedStateFromError(n)),o=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(n,t||{}),o=i.__d),o)return i.__E=i}catch(l){n=l;}throw n}},u$1=0,x$3.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=d$1({},this.state),"function"==typeof n&&(n=n(d$1({},u),this.props)),n&&d$1(u,n),null!=n&&this.__v&&(l&&this._sb.push(l),M$2(this));},x$3.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),M$2(this));},x$3.prototype.render=k$3,i$1=[],o$1="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,e$1=function(n,l){return n.__v.__b-l.__v.__b},$$2.__r=0,f$1=/(PointerCapture)$|Capture$/i,c$1=0,s$1=F$3(!1),a$1=F$3(!0),h$1=0;
@@ -432,6 +432,36 @@ class SurveyQuestionUncontrolledElement extends SurveyQuestionElementBase {
432
432
  }
433
433
  }
434
434
 
435
+ function attachKey2click(element, viewModel, options = { processEsc: true, disableTabStop: false }) {
436
+ let props = {};
437
+ if ((!!viewModel && viewModel.disableTabStop) || (!!options && options.disableTabStop)) {
438
+ props = { tabIndex: -1 };
439
+ }
440
+ else {
441
+ options = { ...options };
442
+ props = {
443
+ tabIndex: 0,
444
+ onKeyUp: (evt) => {
445
+ evt.preventDefault();
446
+ evt.stopPropagation();
447
+ doKey2ClickUp(evt, options);
448
+ },
449
+ onKeyDown: (evt) => doKey2ClickDown(evt, options),
450
+ onBlur: (evt) => doKey2ClickBlur(evt),
451
+ };
452
+ }
453
+ props["onPointerUp"] = (evt) => {
454
+ if (evt.pointerType === "pen") {
455
+ evt.preventDefault();
456
+ evt.stopPropagation();
457
+ const element = evt.target;
458
+ if (element === null || element === void 0 ? void 0 : element.click)
459
+ element.click();
460
+ }
461
+ };
462
+ return _n$1(element, props);
463
+ }
464
+
435
465
  class SvgIcon extends x$3 {
436
466
  constructor(props) {
437
467
  super(props);
@@ -630,174 +660,6 @@ ReactElementFactory.Instance.registerElement("sv-action-bar-item", (props) => {
630
660
  return _$1(SurveyActionBarItem, props);
631
661
  });
632
662
 
633
- class Popup extends SurveyElementBase {
634
- constructor(props) {
635
- super(props);
636
- this.containerRef = b$1();
637
- this.createModel();
638
- }
639
- get model() {
640
- return this.props.model;
641
- }
642
- getStateElement() {
643
- return this.model;
644
- }
645
- createModel() {
646
- this.popup = createPopupViewModel(this.props.model);
647
- }
648
- setTargetElement() {
649
- const container = this.containerRef.current;
650
- this.popup.setComponentElement(container);
651
- }
652
- componentDidMount() {
653
- super.componentDidMount();
654
- this.setTargetElement();
655
- }
656
- componentDidUpdate(prevProps, prevState) {
657
- super.componentDidUpdate(prevProps, prevState);
658
- this.setTargetElement();
659
- }
660
- componentWillUnmount() {
661
- super.componentWillUnmount();
662
- this.popup.resetComponentElement();
663
- }
664
- shouldComponentUpdate(nextProps, nextState) {
665
- var _a;
666
- if (!super.shouldComponentUpdate(nextProps, nextState))
667
- return false;
668
- const isNeedUpdate = nextProps.model !== this.popup.model;
669
- if (isNeedUpdate) {
670
- (_a = this.popup) === null || _a === void 0 ? void 0 : _a.dispose();
671
- this.createModel();
672
- }
673
- return isNeedUpdate;
674
- }
675
- render() {
676
- this.popup.model = this.model;
677
- let popupContainer;
678
- if (this.model.isModal) {
679
- popupContainer = _$1(PopupContainer, { model: this.popup });
680
- }
681
- else {
682
- popupContainer = _$1(PopupDropdownContainer, { model: this.popup });
683
- }
684
- return _$1("div", { ref: this.containerRef }, popupContainer);
685
- }
686
- }
687
- ReactElementFactory.Instance.registerElement("sv-popup", (props) => {
688
- return _$1(Popup, props);
689
- });
690
- class PopupContainer extends SurveyElementBase {
691
- constructor(props) {
692
- super(props);
693
- this.handleKeydown = (event) => {
694
- this.model.onKeyDown(event);
695
- };
696
- this.clickInside = (ev) => {
697
- ev.stopPropagation();
698
- };
699
- }
700
- get model() {
701
- return this.props.model;
702
- }
703
- getStateElement() {
704
- return this.model;
705
- }
706
- componentDidUpdate(prevProps, prevState) {
707
- super.componentDidUpdate(prevProps, prevState);
708
- if (!this.model.isPositionSet && this.model.isVisible) {
709
- this.model.updateOnShowing();
710
- }
711
- }
712
- renderContainer(popupBaseViewModel) {
713
- const headerPopup = popupBaseViewModel.showHeader ? this.renderHeaderPopup(popupBaseViewModel) : null;
714
- const headerContent = !!popupBaseViewModel.title ? this.renderHeaderContent() : null;
715
- const content = this.renderContent();
716
- const footerContent = popupBaseViewModel.showFooter ? this.renderFooter(this.model) : null;
717
- return (_$1("div", { className: "sv-popup__container", style: {
718
- left: popupBaseViewModel.left,
719
- top: popupBaseViewModel.top,
720
- height: popupBaseViewModel.height,
721
- width: popupBaseViewModel.width,
722
- minWidth: popupBaseViewModel.minWidth,
723
- }, onClick: (ev) => {
724
- this.clickInside(ev);
725
- } },
726
- headerPopup,
727
- _$1("div", { className: "sv-popup__body-content" },
728
- headerContent,
729
- _$1("div", { className: "sv-popup__scrolling-content" }, content),
730
- footerContent)));
731
- }
732
- renderHeaderContent() {
733
- return _$1("div", { className: "sv-popup__body-header" }, this.model.title);
734
- }
735
- renderContent() {
736
- const contentComponent = ReactElementFactory.Instance.createElement(this.model.contentComponentName, this.model.contentComponentData);
737
- return _$1("div", { className: "sv-popup__content" }, contentComponent);
738
- }
739
- renderHeaderPopup(popupModel) {
740
- return popupModel.showCloseButton ? _$1("button", { tabIndex: -1, className: "sv-popup__close-button sd-action sd-action--icon", onClick: () => this.model.clickClose() },
741
- _$1(SvgIcon, { className: "sv-popup__close-button-icon", iconName: "icon-close-24x24", size: "auto" })) : null;
742
- }
743
- renderFooter(popuModel) {
744
- return (_$1("div", { className: "sv-popup__body-footer" },
745
- _$1(SurveyActionBar, { model: popuModel.footerToolbar })));
746
- }
747
- render() {
748
- const container = this.renderContainer(this.model);
749
- const className = new CssClassBuilder()
750
- .append("sv-popup")
751
- .append(this.model.styleClass)
752
- .toString();
753
- const style = { display: this.model.isVisible ? "" : "none", };
754
- return (_$1("div", { tabIndex: -1, className: className, style: style, onClick: (e) => {
755
- this.model.clickOutside(e);
756
- }, onBlur: (e) => {
757
- this.model.blur(e);
758
- }, onKeyDown: this.handleKeydown }, container));
759
- }
760
- componentDidMount() {
761
- super.componentDidMount();
762
- if (this.model.isVisible) {
763
- this.model.updateOnShowing();
764
- }
765
- }
766
- }
767
- class PopupDropdownContainer extends PopupContainer {
768
- renderHeaderPopup(popupModel) {
769
- const popupDropdownModel = popupModel;
770
- if (!popupDropdownModel || !popupDropdownModel.showHeader)
771
- return null;
772
- return (_$1("span", { style: {
773
- left: popupDropdownModel.pointerTarget.left,
774
- top: popupDropdownModel.pointerTarget.top,
775
- }, className: "sv-popup__pointer" }));
776
- }
777
- }
778
-
779
- class SurveyActionBarItemDropdown extends SurveyActionBarItem {
780
- constructor(props) {
781
- super(props);
782
- }
783
- renderInnerButton() {
784
- const button = super.renderInnerButton();
785
- return (_$1(k$3, null,
786
- button,
787
- _$1(Popup, { model: this.item.popupModel })));
788
- }
789
- componentDidMount() {
790
- this.viewModel = new ActionDropdownViewModel(this.item);
791
- }
792
- componentWillUnmount() {
793
- super.componentWillUnmount();
794
- this.viewModel.dispose();
795
- }
796
- }
797
- ReactElementFactory.Instance.registerElement("sv-action-bar-item-dropdown", (props) => {
798
- return _$1(SurveyActionBarItemDropdown, props);
799
- });
800
-
801
663
  class SurveyActionBar extends SurveyElementBase {
802
664
  constructor(props) {
803
665
  super(props);
@@ -1114,6 +976,152 @@ class SvgBundleComponent extends x$3 {
1114
976
  }
1115
977
  }
1116
978
 
979
+ class Popup extends SurveyElementBase {
980
+ constructor(props) {
981
+ super(props);
982
+ this.containerRef = b$1();
983
+ this.createModel();
984
+ }
985
+ get model() {
986
+ return this.props.model;
987
+ }
988
+ getStateElement() {
989
+ return this.model;
990
+ }
991
+ createModel() {
992
+ this.popup = createPopupViewModel(this.props.model);
993
+ }
994
+ setTargetElement() {
995
+ const container = this.containerRef.current;
996
+ this.popup.setComponentElement(container);
997
+ }
998
+ componentDidMount() {
999
+ super.componentDidMount();
1000
+ this.setTargetElement();
1001
+ }
1002
+ componentDidUpdate(prevProps, prevState) {
1003
+ super.componentDidUpdate(prevProps, prevState);
1004
+ this.setTargetElement();
1005
+ }
1006
+ componentWillUnmount() {
1007
+ super.componentWillUnmount();
1008
+ this.popup.resetComponentElement();
1009
+ }
1010
+ shouldComponentUpdate(nextProps, nextState) {
1011
+ var _a;
1012
+ if (!super.shouldComponentUpdate(nextProps, nextState))
1013
+ return false;
1014
+ const isNeedUpdate = nextProps.model !== this.popup.model;
1015
+ if (isNeedUpdate) {
1016
+ (_a = this.popup) === null || _a === void 0 ? void 0 : _a.dispose();
1017
+ this.createModel();
1018
+ }
1019
+ return isNeedUpdate;
1020
+ }
1021
+ render() {
1022
+ this.popup.model = this.model;
1023
+ let popupContainer;
1024
+ if (this.model.isModal) {
1025
+ popupContainer = _$1(PopupContainer, { model: this.popup });
1026
+ }
1027
+ else {
1028
+ popupContainer = _$1(PopupDropdownContainer, { model: this.popup });
1029
+ }
1030
+ return _$1("div", { ref: this.containerRef }, popupContainer);
1031
+ }
1032
+ }
1033
+ ReactElementFactory.Instance.registerElement("sv-popup", (props) => {
1034
+ return _$1(Popup, props);
1035
+ });
1036
+ class PopupContainer extends SurveyElementBase {
1037
+ constructor(props) {
1038
+ super(props);
1039
+ this.handleKeydown = (event) => {
1040
+ this.model.onKeyDown(event);
1041
+ };
1042
+ this.clickInside = (ev) => {
1043
+ ev.stopPropagation();
1044
+ };
1045
+ }
1046
+ get model() {
1047
+ return this.props.model;
1048
+ }
1049
+ getStateElement() {
1050
+ return this.model;
1051
+ }
1052
+ componentDidUpdate(prevProps, prevState) {
1053
+ super.componentDidUpdate(prevProps, prevState);
1054
+ if (!this.model.isPositionSet && this.model.isVisible) {
1055
+ this.model.updateOnShowing();
1056
+ }
1057
+ }
1058
+ renderContainer(popupBaseViewModel) {
1059
+ const headerPopup = popupBaseViewModel.showHeader ? this.renderHeaderPopup(popupBaseViewModel) : null;
1060
+ const headerContent = !!popupBaseViewModel.title ? this.renderHeaderContent() : null;
1061
+ const content = this.renderContent();
1062
+ const footerContent = popupBaseViewModel.showFooter ? this.renderFooter(this.model) : null;
1063
+ return (_$1("div", { className: "sv-popup__container", style: {
1064
+ left: popupBaseViewModel.left,
1065
+ top: popupBaseViewModel.top,
1066
+ height: popupBaseViewModel.height,
1067
+ width: popupBaseViewModel.width,
1068
+ minWidth: popupBaseViewModel.minWidth,
1069
+ }, onClick: (ev) => {
1070
+ this.clickInside(ev);
1071
+ } },
1072
+ headerPopup,
1073
+ _$1("div", { className: "sv-popup__body-content" },
1074
+ headerContent,
1075
+ _$1("div", { className: "sv-popup__scrolling-content" }, content),
1076
+ footerContent)));
1077
+ }
1078
+ renderHeaderContent() {
1079
+ return _$1("div", { className: "sv-popup__body-header" }, this.model.title);
1080
+ }
1081
+ renderContent() {
1082
+ const contentComponent = ReactElementFactory.Instance.createElement(this.model.contentComponentName, this.model.contentComponentData);
1083
+ return _$1("div", { className: "sv-popup__content" }, contentComponent);
1084
+ }
1085
+ renderHeaderPopup(popupModel) {
1086
+ return popupModel.showCloseButton ? _$1("button", { tabIndex: -1, className: "sv-popup__close-button sd-action sd-action--icon", onClick: () => this.model.clickClose() },
1087
+ _$1(SvgIcon, { className: "sv-popup__close-button-icon", iconName: "icon-close-24x24", size: "auto" })) : null;
1088
+ }
1089
+ renderFooter(popuModel) {
1090
+ return (_$1("div", { className: "sv-popup__body-footer" },
1091
+ _$1(SurveyActionBar, { model: popuModel.footerToolbar })));
1092
+ }
1093
+ render() {
1094
+ const container = this.renderContainer(this.model);
1095
+ const className = new CssClassBuilder()
1096
+ .append("sv-popup")
1097
+ .append(this.model.styleClass)
1098
+ .toString();
1099
+ const style = { display: this.model.isVisible ? "" : "none", };
1100
+ return (_$1("div", { tabIndex: -1, className: className, style: style, onClick: (e) => {
1101
+ this.model.clickOutside(e);
1102
+ }, onBlur: (e) => {
1103
+ this.model.blur(e);
1104
+ }, onKeyDown: this.handleKeydown }, container));
1105
+ }
1106
+ componentDidMount() {
1107
+ super.componentDidMount();
1108
+ if (this.model.isVisible) {
1109
+ this.model.updateOnShowing();
1110
+ }
1111
+ }
1112
+ }
1113
+ class PopupDropdownContainer extends PopupContainer {
1114
+ renderHeaderPopup(popupModel) {
1115
+ const popupDropdownModel = popupModel;
1116
+ if (!popupDropdownModel || !popupDropdownModel.showHeader)
1117
+ return null;
1118
+ return (_$1("span", { style: {
1119
+ left: popupDropdownModel.pointerTarget.left,
1120
+ top: popupDropdownModel.pointerTarget.top,
1121
+ }, className: "sv-popup__pointer" }));
1122
+ }
1123
+ }
1124
+
1117
1125
  class PopupModal extends SurveyElementBase {
1118
1126
  createPopupModalManager() {
1119
1127
  const modalManager = new PopupModalManager();
@@ -1197,7 +1205,7 @@ function requireIconsV2 () {
1197
1205
 
1198
1206
  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>";
1199
1207
 
1200
- 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>";
1208
+ 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>";
1201
1209
 
1202
1210
  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>";
1203
1211
 
@@ -1511,11 +1519,6 @@ class Survey extends SurveyElementBase {
1511
1519
  const rootCss = this.survey.getRootCss();
1512
1520
  const cssClasses = this.rootNodeClassName ? this.rootNodeClassName + " " + rootCss : rootCss;
1513
1521
  return (_$1("div", { id: this.rootNodeId, ref: this.rootRef, className: cssClasses, style: this.survey.themeVariables, lang: this.survey.locale || "en", dir: this.survey.localeDir },
1514
- this.survey.generateStylesheet ?
1515
- _$1(k$3, null,
1516
- _$1("style", null, this.survey.themeStyle),
1517
- _$1("style", null, this.survey.resetVariablesStyle))
1518
- : null,
1519
1522
  _$1(Scroll, { disabled: this.survey.rootScrollDisabled },
1520
1523
  this.survey.needRenderIcons ? _$1(SvgBundleComponent, null) : null,
1521
1524
  _$1(PopupModal, null),
@@ -1680,35 +1683,6 @@ class Survey extends SurveyElementBase {
1680
1683
  ReactElementFactory.Instance.registerElement("survey", (props) => {
1681
1684
  return _$1(Survey, props);
1682
1685
  });
1683
- function attachKey2click(element, viewModel, options = { processEsc: true, disableTabStop: false }) {
1684
- let props = {};
1685
- if ((!!viewModel && viewModel.disableTabStop) || (!!options && options.disableTabStop)) {
1686
- props = { tabIndex: -1 };
1687
- }
1688
- else {
1689
- options = { ...options };
1690
- props = {
1691
- tabIndex: 0,
1692
- onKeyUp: (evt) => {
1693
- evt.preventDefault();
1694
- evt.stopPropagation();
1695
- doKey2ClickUp(evt, options);
1696
- },
1697
- onKeyDown: (evt) => doKey2ClickDown(evt, options),
1698
- onBlur: (evt) => doKey2ClickBlur(evt),
1699
- };
1700
- }
1701
- props["onPointerUp"] = (evt) => {
1702
- if (evt.pointerType === "pen") {
1703
- evt.preventDefault();
1704
- evt.stopPropagation();
1705
- const element = evt.target;
1706
- if (element === null || element === void 0 ? void 0 : element.click)
1707
- element.click();
1708
- }
1709
- };
1710
- return _n$1(element, props);
1711
- }
1712
1686
 
1713
1687
  class SurveyNavigationBase extends SurveyElementBase {
1714
1688
  constructor(props) {
@@ -5968,6 +5942,28 @@ ReactElementFactory.Instance.registerElement("sv-list-item-group", (props) => {
5968
5942
  return _$1(ListItemGroup, props);
5969
5943
  });
5970
5944
 
5945
+ class SurveyActionBarItemDropdown extends SurveyActionBarItem {
5946
+ constructor(props) {
5947
+ super(props);
5948
+ }
5949
+ renderInnerButton() {
5950
+ const button = super.renderInnerButton();
5951
+ return (_$1(k$3, null,
5952
+ button,
5953
+ _$1(Popup, { model: this.item.popupModel })));
5954
+ }
5955
+ componentDidMount() {
5956
+ this.viewModel = new ActionDropdownViewModel(this.item);
5957
+ }
5958
+ componentWillUnmount() {
5959
+ super.componentWillUnmount();
5960
+ this.viewModel.dispose();
5961
+ }
5962
+ }
5963
+ ReactElementFactory.Instance.registerElement("sv-action-bar-item-dropdown", (props) => {
5964
+ return _$1(SurveyActionBarItemDropdown, props);
5965
+ });
5966
+
5971
5967
  class LogoImage extends x$3 {
5972
5968
  constructor(props) {
5973
5969
  super(props);
@@ -6263,7 +6259,7 @@ SurveyModel.prototype["render"] = function (element = null) {
6263
6259
  }
6264
6260
  };
6265
6261
  const preact = React;
6266
- checkLibraryVersion(`${"3.0.1"}`, "survey-js-ui");
6262
+ checkLibraryVersion(`${"3.0.3"}`, "survey-js-ui");
6267
6263
 
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 };
6264
+ 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, SurveyActionBarItemDropdown, SurveyActionBarSeparator, 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 };
6269
6265
  //# sourceMappingURL=survey-js-ui.mjs.map