@rpg-engine/long-bow 0.1.29 → 0.1.35

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,2 +1,2 @@
1
- "use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var n=require("react"),t=e(n);require("rpgui/rpgui.min.css"),require("rpgui/rpgui.min.js");var i,r=e(require("styled-components")),o=require("uuid"),a=RPGUI,l=function(e){return t.createElement("div",{className:"rpgui-content"},e.children)},u=["children","type"];(i=exports.IButtonTypes||(exports.IButtonTypes={})).RPGUIButton="rpgui-button",i.RPGUIGoldButton="rpgui-button golden";var s,c=r.div.withConfig({displayName:"ListMenu__Container",componentId:"sc-i9097t-0"})(["display:flex;flex-direction:column;width:100%;justify-content:start;align-items:flex-start;position:absolute;top:","px;left:","px;"],(function(e){return e.y||0}),(function(e){return e.x||0})),d=r.li.withConfig({displayName:"ListMenu__ListElement",componentId:"sc-i9097t-1"})(["margin-right:0.5rem;"]);(s=exports.RPGUIContainerTypes||(exports.RPGUIContainerTypes={})).Framed="framed",s.FramedGold="framed-golden",s.FramedGold2="framed-golden-2",s.FramedGrey="framed-grey";var p=function(e){var n=e.width;return t.createElement(m,{width:void 0===n?"50%":n,height:e.height||"auto",className:"rpgui-container "+e.type},e.children)},m=r.div.withConfig({displayName:"RPGUIContainer__Container",componentId:"sc-a8l4p8-0"})(["height:",";width:",";display:flex;flex-wrap:wrap;image-rendering:pixelated;"],(function(e){return e.height}),(function(e){return e.width}));const f=require("./alice.png"),x=require("./space.gif");var g,h=function(e){var i=e.text,r=e.onFinish,o=e.onStart,a=n.useState(""),l=a[0],u=a[1];return n.useEffect((function(){var e=0,n=setInterval((function(){0===e&&o&&o(),e<i.length?(u(i.substring(0,e+1)),e++):(clearInterval(n),r&&r())}),50);return function(){clearInterval(n)}}),[i]),t.createElement(w,null,l)},w=r.p.withConfig({displayName:"DynamicText__TextContainer",componentId:"sc-1ggl9nd-0"})(["font-size:0.7rem !important;color:white;text-shadow:1px 1px 0px #000000;letter-spacing:1.2px;word-break:normal;"]),y=function(e){var i=e.onClose,r=e.onEndStep,o=e.onStartStep,a=e.text.match(new RegExp(".{1,85}","g")),l=n.useState(0),u=l[0],s=l[1],c=function(e){"Space"===e.code&&((null==a?void 0:a[u+1])?s((function(e){return e+1})):i())};return n.useEffect((function(){return document.addEventListener("keydown",c),function(){return document.removeEventListener("keydown",c)}}),[u]),t.createElement(v,null,t.createElement(h,{text:(null==a?void 0:a[u])||"",onFinish:r,onStart:o}))},v=r.div.withConfig({displayName:"NPCDialogText__Container",componentId:"sc-1cxkdh9-0"})([""]),C=function(e,n,i){void 0===i&&(i=window);var r=t.useRef();t.useEffect((function(){r.current=n}),[n]),t.useEffect((function(){var n=function(e){return r.current(e)};return i.addEventListener(e,n),function(){i.removeEventListener(e,n)}}),[e,i])},I=function(e){var i=e.questions,r=e.answers,o=e.onClose,a=n.useState(i[0]),l=a[0],u=a[1],s=n.useState(!1),c=s[0],d=s[1],p=function(){if(!l.answerIds||0===l.answerIds.length)return null;var e=l.answerIds[0];return r.find((function(n){return n.id===e}))},m=n.useState(p()),f=m[0],x=m[1];n.useEffect((function(){x(p())}),[l]);var g=function(e){return e.map((function(e){return r.find((function(n){return n.id===e}))}))};return C("keydown",(function(e){switch(e.key){case"ArrowDown":var n=g(l.answerIds).findIndex((function(e){return(null==e?void 0:e.id)===f.id+1})),t=l.answerIds[n],r=g(l.answerIds).find((function(e){return(null==e?void 0:e.id)===t}));x(r||p());break;case"ArrowUp":var a=g(l.answerIds).findIndex((function(e){return(null==e?void 0:e.id)===f.id-1})),s=l.answerIds&&l.answerIds[a],c=g(l.answerIds).find((function(e){return(null==e?void 0:e.id)===s}));x(c||g(l.answerIds).pop());break;case"Enter":if(d(!1),null==f||!f.nextQuestionId)return void o();u(i.find((function(e){return e.id===f.nextQuestionId})))}})),t.createElement(E,null,t.createElement(b,null,t.createElement(h,{text:l.text,onStart:function(){return d(!1)},onFinish:function(){return d(!0)}})),c&&t.createElement(N,null,function(){var e=l.answerIds;if(!e)return null;var n=g(e);return n?n.map((function(e){var n=(null==f?void 0:f.id)===(null==e?void 0:e.id),r=n?"yellow":"white";return e?t.createElement(S,{key:"answer_"+e.id},t.createElement(_,{color:r},n?"X":null),t.createElement(T,{key:e.id,onClick:function(){return function(e){d(!1),e.nextQuestionId?u(i.find((function(n){return n.id===e.nextQuestionId}))):o()}(e)},color:r},e.text)):null})):null}()))},E=r.div.withConfig({displayName:"QuestionDialog__Container",componentId:"sc-bxc5u0-0"})(["display:flex;word-break:break-all;box-sizing:border-box;justify-content:flex-start;align-items:flex-start;flex-wrap:wrap;"]),b=r.div.withConfig({displayName:"QuestionDialog__QuestionContainer",componentId:"sc-bxc5u0-1"})(["flex:100%;width:100%;"]),N=r.div.withConfig({displayName:"QuestionDialog__AnswersContainer",componentId:"sc-bxc5u0-2"})(["flex:100%;"]),T=r.p.withConfig({displayName:"QuestionDialog__Answer",componentId:"sc-bxc5u0-3"})(["flex:auto;color:"," !important;font-size:0.65rem !important;background:inherit;border:none;"],(function(e){return e.color})),_=r.span.withConfig({displayName:"QuestionDialog__AnswerSelectedIcon",componentId:"sc-bxc5u0-4"})(["flex:5% 0 0;color:"," !important;"],(function(e){return e.color})),S=r.div.withConfig({displayName:"QuestionDialog__AnswerRow",componentId:"sc-bxc5u0-5"})(["display:flex;flex-wrap:wrap;justify-content:center;align-items:center;margin-bottom:0.5rem;height:22px;p{line-height:unset;margin-top:0;margin-bottom:0rem;}"]);(g=exports.NPCDialogType||(exports.NPCDialogType={})).TextOnly="TextOnly",g.TextAndThumbnail="TextAndThumbnail";var P,D=r.div.withConfig({displayName:"NPCDialog__Container",componentId:"sc-1b4aw74-0"})(["display:flex;width:100%;height:100%;box-sizing:border-box;justify-content:center;align-items:flex-start;position:relative;"]),R=r.div.withConfig({displayName:"NPCDialog__TextContainer",componentId:"sc-1b4aw74-1"})(["flex:"," 0 0;width:355px;"],(function(e){return e.flex})),k=r.div.withConfig({displayName:"NPCDialog__ThumbnailContainer",componentId:"sc-1b4aw74-2"})(["flex:30% 0 0;display:flex;justify-content:flex-end;"]),G=r.img.withConfig({displayName:"NPCDialog__NPCThumbnail",componentId:"sc-1b4aw74-3"})(["image-rendering:pixelated;height:128px;width:128px;"]),Q=r.img.withConfig({displayName:"NPCDialog__PressSpaceIndicator",componentId:"sc-1b4aw74-4"})(["position:absolute;right:",";bottom:1rem;height:20.7px;image-rendering:-webkit-optimize-contrast;"],(function(e){return e.right}));(P=exports.RangeSliderType||(exports.RangeSliderType={})).Slider="rpgui-slider",P.GoldSlider="rpgui-slider golden";var A=r.input.withConfig({displayName:"RangeSlider__Input",componentId:"sc-v8mte9-0"})(["opacity:0;"]);exports.Button=function(e){var n=e.children,i=e.type,r=function(e,n){if(null==e)return{};var t,i,r={},o=Object.keys(e);for(i=0;i<o.length;i++)n.indexOf(t=o[i])>=0||(r[t]=e[t]);return r}(e,u);return t.createElement(l,null,t.createElement("button",Object.assign({className:i,type:"button"},r),t.createElement("p",null,n)))},exports.DynamicText=h,exports.ListMenu=function(e){var n=e.onSelected;return t.createElement(l,null,t.createElement(c,{x:e.x,y:e.y},t.createElement("ul",{className:"rpgui-list-imp",style:{overflow:"hidden"}},e.options.map((function(e){return t.createElement(d,{key:e.text,onClick:function(){n(e.id)}},e.text)})))))},exports.NPCDialog=function(e){var i=e.text,r=e.type,o=e.onClose,a=e.imagePath,u=e.isQuestionDialog,s=void 0!==u&&u,c=e.questions,d=e.answers,m=n.useState(!1),g=m[0],h=m[1];return t.createElement(l,null,t.createElement(p,{type:exports.RPGUIContainerTypes.FramedGold,width:s?"600px":"50%",height:"180px"},s&&c&&d?t.createElement(t.Fragment,null,t.createElement(R,{flex:r===exports.NPCDialogType.TextAndThumbnail?"70%":"100%"},t.createElement(I,{questions:c,answers:d,onClose:function(){o&&o()}})),r===exports.NPCDialogType.TextAndThumbnail&&t.createElement(k,null,t.createElement(G,{src:a||f}))):t.createElement(t.Fragment,null,t.createElement(D,null,t.createElement(R,{flex:r===exports.NPCDialogType.TextAndThumbnail?"70%":"100%"},t.createElement(y,{onStartStep:function(){return h(!1)},onEndStep:function(){return h(!0)},text:i||"No text provided.",onClose:function(){o&&o()}})),r===exports.NPCDialogType.TextAndThumbnail&&t.createElement(k,null,t.createElement(G,{src:a||f}))),g&&t.createElement(Q,{right:r===exports.NPCDialogType.TextOnly?"1rem":"10.5rem",src:x}))))},exports.QuestionDialog=I,exports.RPGUIContainer=p,exports.RPGUIRoot=l,exports.RangeSlider=function(e){var i=e.type,r=e.valueMin,u=e.valueMax,s=e.width,c=e.onChange,d=o.v4(),p=n.useState(!1),m=p[0],f=p[1];C("mouseup",(function(){m&&x(),f(!1)}));var x=function(){var e=document.getElementById("rpgui-slider-"+d),n=a.get_value(e);c(Number(n))};return t.createElement(l,null,t.createElement("div",{onMouseUp:x,onMouseDown:function(){return f(!0)}},t.createElement(A,{className:i===exports.RangeSliderType.Slider?exports.RangeSliderType.Slider:exports.RangeSliderType.GoldSlider,type:"range",style:{width:s},min:r,max:u,id:"rpgui-slider-"+d})))},exports._RPGUI=a,exports.useEventListener=C;
1
+ "use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var n=require("react"),t=e(n),i=e(require("styled-components")),r=require("uuid");function o(){return(o=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e}).apply(this,arguments)}require("rpgui/rpgui.min.css"),require("rpgui/rpgui.min.js");var a,l=["children","buttonType"];(a=exports.ButtonTypes||(exports.ButtonTypes={})).RPGUIButton="rpgui-button",a.RPGUIGoldButton="rpgui-button golden";var u,c=i.button.withConfig({displayName:"Button__ButtonContainer",componentId:"sc-obzd3o-0"})(["height:45px;font-size:11.5px;"]),s=RPGUI,d=i.div.withConfig({displayName:"ListMenu__Container",componentId:"sc-i9097t-0"})(["display:flex;flex-direction:column;width:100%;justify-content:start;align-items:flex-start;position:absolute;top:","px;left:","px;li{font-size:","em;}"],(function(e){return e.y||0}),(function(e){return e.x||0}),(function(e){return e.fontSize})),p=i.li.withConfig({displayName:"ListMenu__ListElement",componentId:"sc-i9097t-1"})(["margin-right:0.5rem;"]);(u=exports.RPGUIContainerTypes||(exports.RPGUIContainerTypes={})).Framed="framed",u.FramedGold="framed-golden",u.FramedGold2="framed-golden-2",u.FramedGrey="framed-grey";var m=function(e){var n=e.width;return t.createElement(f,{width:void 0===n?"50%":n,height:e.height||"auto",className:"rpgui-container "+e.type},e.children)},f=i.div.withConfig({displayName:"RPGUIContainer__Container",componentId:"sc-a8l4p8-0"})(["height:",";width:",";display:flex;flex-wrap:wrap;image-rendering:pixelated;"],(function(e){return e.height}),(function(e){return e.width}));const g=require("./alice.png"),x=require("./space.gif");var h,v=function(e){var i=e.text,r=e.onFinish,o=e.onStart,a=n.useState(""),l=a[0],u=a[1];return n.useEffect((function(){var e=0,n=setInterval((function(){0===e&&o&&o(),e<i.length?(u(i.substring(0,e+1)),e++):(clearInterval(n),r&&r())}),50);return function(){clearInterval(n)}}),[i]),t.createElement(w,null,l)},w=i.p.withConfig({displayName:"DynamicText__TextContainer",componentId:"sc-1ggl9nd-0"})(["font-size:0.7rem !important;color:white;text-shadow:1px 1px 0px #000000;letter-spacing:1.2px;word-break:normal;"]),y=function(e){var i=e.onClose,r=e.onEndStep,o=e.onStartStep,a=e.text.match(new RegExp(".{1,85}","g")),l=n.useState(0),u=l[0],c=l[1],s=function(e){"Space"===e.code&&((null==a?void 0:a[u+1])?c((function(e){return e+1})):i())};return n.useEffect((function(){return document.addEventListener("keydown",s),function(){return document.removeEventListener("keydown",s)}}),[u]),t.createElement(b,null,t.createElement(v,{text:(null==a?void 0:a[u])||"",onFinish:r,onStart:o}))},b=i.div.withConfig({displayName:"NPCDialogText__Container",componentId:"sc-1cxkdh9-0"})([""]),E=function(e,n,i){void 0===i&&(i=window);var r=t.useRef();t.useEffect((function(){r.current=n}),[n]),t.useEffect((function(){var n=function(e){return r.current(e)};return i.addEventListener(e,n),function(){i.removeEventListener(e,n)}}),[e,i])},C=function(e){var i=e.questions,r=e.answers,o=e.onClose,a=n.useState(i[0]),l=a[0],u=a[1],c=n.useState(!1),s=c[0],d=c[1],p=function(){if(!l.answerIds||0===l.answerIds.length)return null;var e=l.answerIds[0];return r.find((function(n){return n.id===e}))},m=n.useState(p()),f=m[0],g=m[1];n.useEffect((function(){g(p())}),[l]);var x=function(e){return e.map((function(e){return r.find((function(n){return n.id===e}))}))};return E("keydown",(function(e){switch(e.key){case"ArrowDown":var n=x(l.answerIds).findIndex((function(e){return(null==e?void 0:e.id)===f.id+1})),t=l.answerIds[n],r=x(l.answerIds).find((function(e){return(null==e?void 0:e.id)===t}));g(r||p());break;case"ArrowUp":var a=x(l.answerIds).findIndex((function(e){return(null==e?void 0:e.id)===f.id-1})),c=l.answerIds&&l.answerIds[a],s=x(l.answerIds).find((function(e){return(null==e?void 0:e.id)===c}));g(s||x(l.answerIds).pop());break;case"Enter":if(d(!1),null==f||!f.nextQuestionId)return void o();u(i.find((function(e){return e.id===f.nextQuestionId})))}})),t.createElement(I,null,t.createElement(_,null,t.createElement(v,{text:l.text,onStart:function(){return d(!1)},onFinish:function(){return d(!0)}})),s&&t.createElement(N,null,function(){var e=l.answerIds;if(!e)return null;var n=x(e);return n?n.map((function(e){var n=(null==f?void 0:f.id)===(null==e?void 0:e.id),r=n?"yellow":"white";return e?t.createElement(k,{key:"answer_"+e.id},t.createElement(S,{color:r},n?"X":null),t.createElement(T,{key:e.id,onClick:function(){return function(e){d(!1),e.nextQuestionId?u(i.find((function(n){return n.id===e.nextQuestionId}))):o()}(e)},color:r},e.text)):null})):null}()))},I=i.div.withConfig({displayName:"QuestionDialog__Container",componentId:"sc-bxc5u0-0"})(["display:flex;word-break:break-all;box-sizing:border-box;justify-content:flex-start;align-items:flex-start;flex-wrap:wrap;"]),_=i.div.withConfig({displayName:"QuestionDialog__QuestionContainer",componentId:"sc-bxc5u0-1"})(["flex:100%;width:100%;"]),N=i.div.withConfig({displayName:"QuestionDialog__AnswersContainer",componentId:"sc-bxc5u0-2"})(["flex:100%;"]),T=i.p.withConfig({displayName:"QuestionDialog__Answer",componentId:"sc-bxc5u0-3"})(["flex:auto;color:"," !important;font-size:0.65rem !important;background:inherit;border:none;"],(function(e){return e.color})),S=i.span.withConfig({displayName:"QuestionDialog__AnswerSelectedIcon",componentId:"sc-bxc5u0-4"})(["flex:5% 0 0;color:"," !important;"],(function(e){return e.color})),k=i.div.withConfig({displayName:"QuestionDialog__AnswerRow",componentId:"sc-bxc5u0-5"})(["display:flex;flex-wrap:wrap;justify-content:center;align-items:center;margin-bottom:0.5rem;height:22px;p{line-height:unset;margin-top:0;margin-bottom:0rem;}"]);(h=exports.NPCDialogType||(exports.NPCDialogType={})).TextOnly="TextOnly",h.TextAndThumbnail="TextAndThumbnail";var P,D=i.div.withConfig({displayName:"NPCDialog__Container",componentId:"sc-1b4aw74-0"})(["display:flex;width:100%;height:100%;box-sizing:border-box;justify-content:center;align-items:flex-start;position:relative;"]),R=i.div.withConfig({displayName:"NPCDialog__TextContainer",componentId:"sc-1b4aw74-1"})(["flex:"," 0 0;width:355px;"],(function(e){return e.flex})),G=i.div.withConfig({displayName:"NPCDialog__ThumbnailContainer",componentId:"sc-1b4aw74-2"})(["flex:30% 0 0;display:flex;justify-content:flex-end;"]),j=i.img.withConfig({displayName:"NPCDialog__NPCThumbnail",componentId:"sc-1b4aw74-3"})(["image-rendering:pixelated;height:128px;width:128px;"]),A=i.img.withConfig({displayName:"NPCDialog__PressSpaceIndicator",componentId:"sc-1b4aw74-4"})(["position:absolute;right:",";bottom:1rem;height:20.7px;image-rendering:-webkit-optimize-contrast;"],(function(e){return e.right}));(P=exports.RangeSliderType||(exports.RangeSliderType={})).Slider="rpgui-slider",P.GoldSlider="rpgui-slider golden";var L=i.input.withConfig({displayName:"RangeSlider__Input",componentId:"sc-v8mte9-0"})(["opacity:0;"]),Q=i.div.withConfig({displayName:"Truncate__Container",componentId:"sc-6x00qb-0"})(["display:-webkit-box;max-width:100%;max-height:100%;-webkit-line-clamp:",";-webkit-box-orient:vertical;overflow:hidden;"],(function(e){return e.maxLines}));exports.Button=function(e){var n=e.children,i=e.buttonType,r=function(e,n){if(null==e)return{};var t,i,r={},o=Object.keys(e);for(i=0;i<o.length;i++)n.indexOf(t=o[i])>=0||(r[t]=e[t]);return r}(e,l);return t.createElement(c,Object.assign({className:""+i},r),t.createElement("p",null,n))},exports.CheckButton=function(e){var i=e.items,r=e.onChange,a=n.useState(function(){var e={};return i.forEach((function(n){e[n.label]=!1})),e}()),l=a[0],u=a[1];return n.useEffect((function(){l&&r(l)}),[l]),t.createElement("div",{id:"elemento-checkbox"},null==i?void 0:i.map((function(e,n){return t.createElement("div",{key:e.label+"_"+n},t.createElement("input",{className:"rpgui-checkbox",type:"checkbox",checked:l[e.label],onChange:function(){}}),t.createElement("label",{onClick:function(){var n,t;u(o({},l,((t={})[n=e.label]=!l[n],t)))}},e.label),t.createElement("br",null))})))},exports.Dropdown=function(e){var i=e.options,o=e.width,a=e.onChange,l=r.v4(),u=n.useState(""),c=u[0],d=u[1];return n.useEffect((function(){var e=document.getElementById("rpgui-dropdown-"+l),n=s.get_value(e);d(n),null==e||e.addEventListener("change",(function(e){d(null==e?void 0:e.target.value)}))}),[]),n.useEffect((function(){c&&a(c)}),[c]),t.createElement("select",{id:"rpgui-dropdown-"+l,style:{width:o},className:"rpgui-dropdown"},i.map((function(e){return t.createElement("option",{key:e.id,value:e.value},e.option)})))},exports.DynamicText=v,exports.Input=function(e){var n=o({},e);return t.createElement("input",Object.assign({},n))},exports.InputRadio=function(e){var i=e.name,r=e.items,o=e.onChange,a=n.useState(),l=a[0],u=a[1],c=function(){var e=document.querySelector("input[name="+i+"]:checked");u(e.value)};return n.useEffect((function(){l&&o(l)}),[l]),t.createElement("div",{id:"elemento-radio"},r.map((function(e){return t.createElement(t.Fragment,null,t.createElement("input",{key:e.value,className:"rpgui-radio",value:e.value,name:i,type:"radio"}),t.createElement("label",{onClick:c},e.label),t.createElement("br",null))})))},exports.ListMenu=function(e){var n=e.onSelected,i=e.fontSize;return t.createElement(d,{x:e.x,y:e.y,fontSize:void 0===i?.8:i},t.createElement("ul",{className:"rpgui-list-imp",style:{overflow:"hidden"}},e.options.map((function(e){return t.createElement(p,{key:e.text,onClick:function(){n(e.id)}},e.text)}))))},exports.NPCDialog=function(e){var i=e.text,r=e.type,o=e.onClose,a=e.imagePath,l=e.isQuestionDialog,u=void 0!==l&&l,c=e.questions,s=e.answers,d=n.useState(!1),p=d[0],f=d[1];return t.createElement(m,{type:exports.RPGUIContainerTypes.FramedGold,width:u?"600px":"50%",height:"180px"},u&&c&&s?t.createElement(t.Fragment,null,t.createElement(R,{flex:r===exports.NPCDialogType.TextAndThumbnail?"70%":"100%"},t.createElement(C,{questions:c,answers:s,onClose:function(){o&&o()}})),r===exports.NPCDialogType.TextAndThumbnail&&t.createElement(G,null,t.createElement(j,{src:a||g}))):t.createElement(t.Fragment,null,t.createElement(D,null,t.createElement(R,{flex:r===exports.NPCDialogType.TextAndThumbnail?"70%":"100%"},t.createElement(y,{onStartStep:function(){return f(!1)},onEndStep:function(){return f(!0)},text:i||"No text provided.",onClose:function(){o&&o()}})),r===exports.NPCDialogType.TextAndThumbnail&&t.createElement(G,null,t.createElement(j,{src:a||g}))),p&&t.createElement(A,{right:r===exports.NPCDialogType.TextOnly?"1rem":"10.5rem",src:x})))},exports.QuestionDialog=C,exports.RPGUIContainer=m,exports.RPGUIRoot=function(e){return t.createElement("div",{className:"rpgui-content"},e.children)},exports.RangeSlider=function(e){var i=e.type,o=e.valueMin,a=e.valueMax,l=e.width,u=e.onChange,c=r.v4(),d=n.useState(!1),p=d[0],m=d[1];E("mouseup",(function(){p&&f(),m(!1)}));var f=function(){var e=document.getElementById("rpgui-slider-"+c),n=s.get_value(e);u(Number(n))};return t.createElement("div",{onMouseUp:f,onMouseDown:function(){return m(!0)}},t.createElement(L,{className:i===exports.RangeSliderType.Slider?exports.RangeSliderType.Slider:exports.RangeSliderType.GoldSlider,type:"range",style:{width:l},min:o,max:a,id:"rpgui-slider-"+c}))},exports.TextArea=function(e){var n=o({},e);return t.createElement("textarea",Object.assign({},n))},exports.Truncate=function(e){var n=e.maxLines;return t.createElement(Q,{maxLines:void 0===n?1:n},e.children)},exports._RPGUI=s,exports.useEventListener=E;
2
2
  //# sourceMappingURL=long-bow.cjs.production.min.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"long-bow.cjs.production.min.js","sources":["../src/components/Button.tsx","../src/components/RPGUIRoot.tsx","../src/components/RPGUIContainer.tsx","../src/components/ListMenu.tsx","../src/components/NPCDialog/img/npcDialog/npcThumbnails/alice.png","../src/components/NPCDialog/img/space.gif","../src/libs/StringHelpers.ts","../src/components/NPCDialog/NPCDialog.tsx","../src/components/typography/DynamicText.tsx","../src/components/NPCDialog/NPCDialogText.tsx","../src/hooks/useEventListener.ts","../src/components/NPCDialog/QuestionDialog/QuestionDialog.tsx","../src/components/RangeSlider.tsx"],"sourcesContent":["import React from 'react';\nimport { RPGUIRoot } from './RPGUIRoot';\n\nexport enum IButtonTypes {\n RPGUIButton = 'rpgui-button',\n RPGUIGoldButton = 'rpgui-button golden',\n}\n\nexport interface IButtonsProps {\n children: React.ReactNode;\n type: IButtonTypes;\n}\n\nexport const Button: React.FC<IButtonsProps> = ({\n children,\n type,\n ...props\n}) => {\n return (\n <RPGUIRoot>\n <button className={type} type=\"button\" {...props}>\n <p>{children}</p>\n </button>\n </RPGUIRoot>\n );\n};\n","import React from 'react';\nimport 'rpgui/rpgui.min.css';\nimport 'rpgui/rpgui.min.js';\n\ninterface IProps {\n children: React.ReactNode;\n}\n\n//@ts-ignore\nexport const _RPGUI = RPGUI;\n\nexport const RPGUIRoot: React.FC<IProps> = ({ children }) => {\n return <div className=\"rpgui-content\">{children}</div>;\n};\n","import React from 'react';\nimport styled from 'styled-components';\n\nexport enum RPGUIContainerTypes {\n Framed = 'framed',\n FramedGold = 'framed-golden',\n FramedGold2 = 'framed-golden-2',\n FramedGrey = 'framed-grey',\n}\nexport interface IRPGUIContainerProps {\n type: RPGUIContainerTypes;\n children: React.ReactNode;\n width?: string;\n height?: string;\n}\n\nexport const RPGUIContainer: React.FC<IRPGUIContainerProps> = ({\n children,\n type,\n width = '50%',\n height,\n}) => {\n return (\n <Container\n width={width}\n height={height || 'auto'}\n className={`rpgui-container ${type}`}\n >\n {children}\n </Container>\n );\n};\n\ninterface IContainerProps {\n width: string;\n height: string;\n}\n\nconst Container = styled.div<IContainerProps>`\n height: ${(props) => props.height};\n width: ${({ width }) => width};\n display: flex;\n flex-wrap: wrap;\n image-rendering: pixelated;\n`;\n","import React from 'react';\nimport styled from 'styled-components';\nimport { RPGUIRoot } from './RPGUIRoot';\n\ninterface IListMenuOption {\n id: string;\n text: string;\n}\n\nexport interface IListMenuProps {\n x: number;\n y: number;\n options: IListMenuOption[];\n onSelected: (selectedOptionId: string) => void;\n}\n\nexport const ListMenu: React.FC<IListMenuProps> = ({\n options,\n onSelected,\n x,\n y,\n}) => {\n return (\n <RPGUIRoot>\n <Container x={x} y={y}>\n <ul className=\"rpgui-list-imp\" style={{ overflow: 'hidden' }}>\n {options.map((params) => (\n <ListElement\n key={params.text}\n onClick={() => {\n onSelected(params.id);\n }}\n >\n {params.text}\n </ListElement>\n ))}\n </ul>\n </Container>\n </RPGUIRoot>\n );\n};\n\ninterface IContainerProps {\n x?: number;\n y?: number;\n}\n\nconst Container = styled.div<IContainerProps>`\n display: flex;\n flex-direction: column;\n width: 100%;\n justify-content: start;\n align-items: flex-start;\n position: absolute;\n top: ${(props) => props.y || 0}px;\n left: ${(props) => props.x || 0}px;\n`;\n\nconst ListElement = styled.li`\n margin-right: 0.5rem;\n`;\n","const img = require('./alice.png'); export default img;","const img = require('./space.gif'); export default img;","export const chunkString = (str: string, length: number) => {\n return str.match(new RegExp('.{1,' + length + '}', 'g'));\n};\n","import React, { useState } from 'react';\nimport styled from 'styled-components';\nimport { RPGUIContainer, RPGUIContainerTypes } from '../RPGUIContainer';\nimport { RPGUIRoot } from '../RPGUIRoot';\nimport aliceDefaultThumbnail from './img/npcDialog/npcThumbnails/alice.png';\nimport pressSpaceGif from './img/space.gif';\nimport { NPCDialogText } from './NPCDialogText';\nimport {\n IQuestionDialog,\n IQuestionDialogAnswer,\n QuestionDialog,\n} from './QuestionDialog/QuestionDialog';\n\nexport enum NPCDialogType {\n TextOnly = 'TextOnly',\n TextAndThumbnail = 'TextAndThumbnail',\n}\n\nexport interface INPCDialogProps {\n text?: string;\n type: NPCDialogType;\n imagePath?: string;\n onClose?: () => void;\n isQuestionDialog?: boolean;\n answers?: IQuestionDialogAnswer[];\n questions?: IQuestionDialog[];\n}\n\nexport const NPCDialog: React.FC<INPCDialogProps> = ({\n text,\n type,\n onClose,\n imagePath,\n isQuestionDialog = false,\n questions,\n answers,\n}) => {\n const [showGoNextIndicator, setShowGoNextIndicator] =\n useState<boolean>(false);\n\n return (\n <RPGUIRoot>\n <RPGUIContainer\n type={RPGUIContainerTypes.FramedGold}\n width={isQuestionDialog ? '600px' : '50%'}\n height={'180px'}\n >\n {isQuestionDialog && questions && answers ? (\n <>\n <TextContainer\n flex={type === NPCDialogType.TextAndThumbnail ? '70%' : '100%'}\n >\n <QuestionDialog\n questions={questions}\n answers={answers}\n onClose={() => {\n if (onClose) {\n onClose();\n }\n }}\n />\n </TextContainer>\n {type === NPCDialogType.TextAndThumbnail && (\n <ThumbnailContainer>\n <NPCThumbnail src={imagePath || aliceDefaultThumbnail} />\n </ThumbnailContainer>\n )}\n </>\n ) : (\n <>\n <Container>\n <TextContainer\n flex={type === NPCDialogType.TextAndThumbnail ? '70%' : '100%'}\n >\n <NPCDialogText\n onStartStep={() => setShowGoNextIndicator(false)}\n onEndStep={() => setShowGoNextIndicator(true)}\n text={text || 'No text provided.'}\n onClose={() => {\n if (onClose) {\n onClose();\n }\n }}\n />\n </TextContainer>\n {type === NPCDialogType.TextAndThumbnail && (\n <ThumbnailContainer>\n <NPCThumbnail src={imagePath || aliceDefaultThumbnail} />\n </ThumbnailContainer>\n )}\n </Container>\n {showGoNextIndicator && (\n <PressSpaceIndicator\n right={type === NPCDialogType.TextOnly ? '1rem' : '10.5rem'}\n src={pressSpaceGif}\n />\n )}\n </>\n )}\n </RPGUIContainer>\n </RPGUIRoot>\n );\n};\n\nconst Container = styled.div`\n display: flex;\n width: 100%;\n height: 100%;\n\n box-sizing: border-box;\n justify-content: center;\n align-items: flex-start;\n position: relative;\n`;\n\ninterface ITextContainerProps {\n flex: string;\n}\n\nconst TextContainer = styled.div<ITextContainerProps>`\n flex: ${({ flex }) => flex} 0 0;\n width: 355px;\n`;\n\nconst ThumbnailContainer = styled.div`\n flex: 30% 0 0;\n display: flex;\n justify-content: flex-end;\n`;\n\nconst NPCThumbnail = styled.img`\n image-rendering: pixelated;\n height: 128px;\n width: 128px;\n`;\n\ninterface IPressSpaceIndicatorProps {\n right: string;\n}\n\nconst PressSpaceIndicator = styled.img<IPressSpaceIndicatorProps>`\n position: absolute;\n right: ${({ right }) => right};\n bottom: 1rem;\n height: 20.7px;\n image-rendering: -webkit-optimize-contrast;\n`;\n","import React, { useEffect, useState } from 'react';\nimport styled from 'styled-components';\n\ninterface IProps {\n text: string;\n onFinish?: () => void;\n onStart?: () => void;\n}\n\nexport const DynamicText: React.FC<IProps> = ({ text, onFinish, onStart }) => {\n const [textState, setTextState] = useState<string>('');\n\n useEffect(() => {\n let i = 0;\n const interval = setInterval(() => {\n // on every interval, show one more character\n\n if (i === 0) {\n if (onStart) {\n onStart();\n }\n }\n\n if (i < text.length) {\n setTextState(text.substring(0, i + 1));\n i++;\n } else {\n clearInterval(interval);\n if (onFinish) {\n onFinish();\n }\n }\n }, 50);\n\n return () => {\n clearInterval(interval);\n };\n }, [text]);\n\n return <TextContainer>{textState}</TextContainer>;\n};\n\nconst TextContainer = styled.p`\n font-size: 0.7rem !important;\n color: white;\n text-shadow: 1px 1px 0px #000000;\n letter-spacing: 1.2px;\n word-break: normal;\n`;\n","import React, { useEffect, useState } from 'react';\nimport styled from 'styled-components';\nimport { chunkString } from '../../libs/StringHelpers';\nimport { DynamicText } from '../typography/DynamicText';\n\ninterface IProps {\n text: string;\n onClose: () => void;\n onEndStep: () => void;\n onStartStep: () => void;\n}\n\nexport const NPCDialogText: React.FC<IProps> = ({\n text,\n onClose,\n onEndStep,\n onStartStep,\n}) => {\n const textChunks = chunkString(text, 85);\n\n const [chunkIndex, setChunkIndex] = useState<number>(0);\n\n const onHandleSpacePress = (event: KeyboardEvent) => {\n if (event.code === 'Space') {\n const hasNextChunk = textChunks?.[chunkIndex + 1] || false;\n\n if (hasNextChunk) {\n setChunkIndex((prev) => prev + 1);\n } else {\n // if there's no more text chunks, close the dialog\n onClose();\n }\n }\n };\n\n useEffect(() => {\n document.addEventListener('keydown', onHandleSpacePress);\n\n return () => document.removeEventListener('keydown', onHandleSpacePress);\n }, [chunkIndex]);\n\n return (\n <Container>\n <DynamicText\n text={textChunks?.[chunkIndex] || ''}\n onFinish={onEndStep}\n onStart={onStartStep}\n />\n </Container>\n );\n};\n\nconst Container = styled.div``;\n","import React from 'react';\n\n//@ts-ignore\nexport const useEventListener = (type, handler, el = window) => {\n const savedHandler = React.useRef();\n\n React.useEffect(() => {\n savedHandler.current = handler;\n }, [handler]);\n\n React.useEffect(() => {\n //@ts-ignore\n const listener = (e) => savedHandler.current(e);\n\n el.addEventListener(type, listener);\n\n return () => {\n el.removeEventListener(type, listener);\n };\n }, [type, el]);\n};\n","import React, { useEffect, useState } from 'react';\nimport styled from 'styled-components';\nimport { useEventListener } from '../../../hooks/useEventListener';\nimport { DynamicText } from '../../typography/DynamicText';\n\nexport interface IQuestionDialogAnswer {\n id: number;\n text: string;\n nextQuestionId?: number;\n}\n\nexport interface IQuestionDialog {\n id: number;\n text: string;\n answerIds?: number[];\n}\n\nexport interface IProps {\n questions: IQuestionDialog[];\n answers: IQuestionDialogAnswer[];\n onClose: () => void;\n}\n\nexport const QuestionDialog: React.FC<IProps> = ({\n questions,\n answers,\n onClose,\n}) => {\n const [currentQuestion, setCurrentQuestion] = useState(questions[0]);\n\n const [canShowAnswers, setCanShowAnswers] = useState<boolean>(false);\n\n const onGetFirstAnswer = () => {\n if (!currentQuestion.answerIds || currentQuestion.answerIds.length === 0) {\n return null;\n }\n\n const firstAnswerId = currentQuestion.answerIds![0];\n\n return answers.find((answer) => answer.id === firstAnswerId);\n };\n\n const [currentAnswer, setCurrentAnswer] =\n useState<IQuestionDialogAnswer | null>(onGetFirstAnswer()!);\n\n useEffect(() => {\n setCurrentAnswer(onGetFirstAnswer()!);\n }, [currentQuestion]);\n\n const onGetAnswers = (answerIds: number[]) => {\n return answerIds.map((answerId: number) =>\n answers.find((answer) => answer.id === answerId)\n );\n };\n\n const onKeyPress = (e: KeyboardEvent) => {\n switch (e.key) {\n case 'ArrowDown':\n // select next answer, if any.\n // if no next answer, select first answer\n // const nextAnswer = onGetAnswers(currentQuestion.answerIds!).find(\n // (answer) => answer?.id === currentAnswer!.id + 1\n // );\n\n const nextAnswerIndex = onGetAnswers(\n currentQuestion.answerIds!\n ).findIndex((answer) => answer?.id === currentAnswer!.id + 1);\n\n const nextAnswerID = currentQuestion.answerIds![nextAnswerIndex];\n\n // console.log(nextAnswerIndex);\n\n const nextAnswer = onGetAnswers(currentQuestion.answerIds!).find(\n (answer) => answer?.id === nextAnswerID\n );\n\n setCurrentAnswer(nextAnswer || onGetFirstAnswer()!);\n\n break;\n case 'ArrowUp':\n // select previous answer, if any.\n // if no previous answer, select last answer\n\n const previousAnswerIndex = onGetAnswers(\n currentQuestion.answerIds!\n ).findIndex((answer) => answer?.id === currentAnswer!.id - 1);\n\n const previousAnswerID =\n currentQuestion.answerIds &&\n currentQuestion.answerIds[previousAnswerIndex];\n\n const previousAnswer = onGetAnswers(currentQuestion.answerIds!).find(\n (answer) => answer?.id === previousAnswerID\n );\n\n if (previousAnswer) {\n setCurrentAnswer(previousAnswer);\n } else {\n setCurrentAnswer(onGetAnswers(currentQuestion.answerIds!).pop()!);\n }\n\n break;\n case 'Enter':\n setCanShowAnswers(false);\n\n if (!currentAnswer?.nextQuestionId) {\n onClose();\n return;\n } else {\n setCurrentQuestion(\n questions.find(\n (question) => question.id === currentAnswer!.nextQuestionId\n )!\n );\n }\n\n break;\n }\n };\n useEventListener('keydown', onKeyPress);\n\n const onAnswerClick = (answer: IQuestionDialogAnswer) => {\n setCanShowAnswers(false);\n if (answer.nextQuestionId) {\n // if there is a next question, go to it\n setCurrentQuestion(\n questions.find((question) => question.id === answer.nextQuestionId)!\n );\n } else {\n // else, finish dialog!\n onClose();\n }\n };\n\n const onRenderCurrentAnswers = () => {\n const answerIds = currentQuestion.answerIds;\n if (!answerIds) {\n return null;\n }\n\n const answers = onGetAnswers(answerIds);\n\n if (!answers) {\n return null;\n }\n\n return answers.map((answer) => {\n const isSelected = currentAnswer?.id === answer?.id;\n const selectedColor = isSelected ? 'yellow' : 'white';\n\n if (answer) {\n return (\n <AnswerRow key={`answer_${answer.id}`}>\n <AnswerSelectedIcon color={selectedColor}>\n {isSelected ? 'X' : null}\n </AnswerSelectedIcon>\n\n <Answer\n key={answer.id}\n onClick={() => onAnswerClick(answer)}\n color={selectedColor}\n >\n {answer.text}\n </Answer>\n </AnswerRow>\n );\n }\n\n return null;\n });\n };\n\n return (\n <Container>\n <QuestionContainer>\n <DynamicText\n text={currentQuestion.text}\n onStart={() => setCanShowAnswers(false)}\n onFinish={() => setCanShowAnswers(true)}\n />\n </QuestionContainer>\n\n {canShowAnswers && (\n <AnswersContainer>{onRenderCurrentAnswers()}</AnswersContainer>\n )}\n </Container>\n );\n};\n\nconst Container = styled.div`\n display: flex;\n\n word-break: break-all;\n\n box-sizing: border-box;\n justify-content: flex-start;\n align-items: flex-start;\n flex-wrap: wrap;\n`;\n\nconst QuestionContainer = styled.div`\n flex: 100%;\n width: 100%;\n`;\n\nconst AnswersContainer = styled.div`\n flex: 100%;\n`;\n\ninterface IAnswerProps {\n color: string;\n}\n\nconst Answer = styled.p<IAnswerProps>`\n flex: auto;\n color: ${(props) => props.color} !important;\n font-size: 0.65rem !important;\n background: inherit;\n border: none;\n`;\n\nconst AnswerSelectedIcon = styled.span<IAnswerProps>`\n flex: 5% 0 0;\n color: ${(props) => props.color} !important;\n`;\n\nconst AnswerRow = styled.div`\n display: flex;\n flex-wrap: wrap;\n justify-content: center;\n align-items: center;\n margin-bottom: 0.5rem;\n height: 22px;\n\n p {\n line-height: unset;\n margin-top: 0;\n margin-bottom: 0rem;\n }\n`;\n","import React, { useState } from 'react';\nimport styled from 'styled-components';\nimport { v4 as uuidv4 } from 'uuid';\nimport { useEventListener } from '../hooks/useEventListener';\nimport { RPGUIRoot, _RPGUI } from './RPGUIRoot';\n\nexport enum RangeSliderType {\n Slider = 'rpgui-slider',\n GoldSlider = 'rpgui-slider golden',\n}\n\nexport interface IRangeSliderProps {\n type: RangeSliderType;\n valueMin: number;\n valueMax: number;\n width: string;\n onChange: (value: number) => void;\n}\n\nexport const RangeSlider: React.FC<IRangeSliderProps> = ({\n type,\n valueMin,\n valueMax,\n width,\n onChange,\n}) => {\n const sliderId = uuidv4();\n\n const [wasMouseDownFirst, setWasMouseDownFirst] = useState<boolean>(false);\n\n useEventListener('mouseup', () => {\n if (wasMouseDownFirst) {\n onHandleMouseUp();\n }\n setWasMouseDownFirst(false);\n });\n\n const onHandleMouseUp = () => {\n const rpguiSlider = document.getElementById(`rpgui-slider-${sliderId}`);\n const value = _RPGUI.get_value(rpguiSlider);\n\n onChange(Number(value));\n };\n\n return (\n <RPGUIRoot>\n <div\n onMouseUp={onHandleMouseUp}\n onMouseDown={() => setWasMouseDownFirst(true)}\n >\n <Input\n className={\n type === RangeSliderType.Slider\n ? RangeSliderType.Slider\n : RangeSliderType.GoldSlider\n }\n type=\"range\"\n style={{ width: width }}\n min={valueMin}\n max={valueMax}\n id={`rpgui-slider-${sliderId}`}\n />\n </div>\n </RPGUIRoot>\n );\n};\n\nconst Input = styled.input`\n opacity: 0;\n`;\n"],"names":["IButtonTypes","_RPGUI","RPGUI","RPGUIRoot","React","className","children","RPGUIContainerTypes","Container","styled","div","props","y","x","ListElement","li","RPGUIContainer","width","height","type","img","require","NPCDialogType","DynamicText","text","onFinish","onStart","useState","textState","setTextState","useEffect","i","interval","setInterval","length","substring","clearInterval","TextContainer","p","NPCDialogText","onClose","onEndStep","onStartStep","textChunks","match","RegExp","chunkIndex","setChunkIndex","onHandleSpacePress","event","code","prev","document","addEventListener","removeEventListener","useEventListener","handler","el","window","savedHandler","useRef","current","listener","e","QuestionDialog","questions","answers","currentQuestion","setCurrentQuestion","canShowAnswers","setCanShowAnswers","onGetFirstAnswer","answerIds","firstAnswerId","find","answer","id","currentAnswer","setCurrentAnswer","onGetAnswers","map","answerId","key","nextAnswerIndex","findIndex","nextAnswerID","nextAnswer","previousAnswerIndex","previousAnswerID","previousAnswer","pop","nextQuestionId","question","QuestionContainer","AnswersContainer","isSelected","selectedColor","AnswerRow","AnswerSelectedIcon","color","Answer","onClick","onAnswerClick","onRenderCurrentAnswers","span","RangeSliderType","flex","ThumbnailContainer","NPCThumbnail","PressSpaceIndicator","right","Input","input","onSelected","style","overflow","options","params","imagePath","isQuestionDialog","showGoNextIndicator","setShowGoNextIndicator","FramedGold","TextAndThumbnail","src","aliceDefaultThumbnail","TextOnly","pressSpaceGif","valueMin","valueMax","onChange","sliderId","uuidv4","wasMouseDownFirst","setWasMouseDownFirst","onHandleMouseUp","rpguiSlider","getElementById","value","get_value","Number","onMouseUp","onMouseDown","Slider","GoldSlider","min","max"],"mappings":"yOAGYA,sDCMCC,EAASC,MAETC,EAA8B,mBAClCC,uBAAKC,UAAU,mBADsBC,kCDRlCN,EAAAA,uBAAAA,qDAEVA,4CEFUO,EC4CNC,EAAYC,EAAOC,6EAAPD,yIAOT,SAACE,UAAUA,EAAMC,GAAK,KACrB,SAACD,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,oBACdgB,QAAS,WACHA,GACFA,QAKPrB,IAASG,sBAAcqG,kBACtBvH,gBAACuG,OACCvG,gBAACwG,GAAagB,IAAKN,GAAaO,MAIrCL,GACCpH,gBAACyG,GACCC,MAAO3F,IAASG,sBAAcwG,SAAW,OAAS,UAClDF,IAAKG,kGK3EmC,gBACtD5G,IAAAA,KACA6G,IAAAA,SACAC,IAAAA,SACAhH,IAAAA,MACAiH,IAAAA,SAEMC,EAAWC,SAEiCzG,YAAkB,GAA7D0G,OAAmBC,OAE1B/E,EAAiB,WAAW,WACtB8E,GACFE,IAEFD,GAAqB,UAGjBC,EAAkB,eAChBC,EAAcpF,SAASqF,+BAA+BN,GACtDO,EAAQzI,EAAO0I,UAAUH,GAE/BN,EAASU,OAAOF,YAIhBtI,gBAACD,OACCC,uBACEyI,UAAWN,EACXO,YAAa,kBAAMR,GAAqB,KAExClI,gBAAC2G,GACC1G,UACEc,IAASsF,wBAAgBsC,OACrBtC,wBAAgBsC,OAChBtC,wBAAgBuC,WAEtB7H,KAAK,QACL+F,MAAO,CAAEjG,MAAOA,GAChBgI,IAAKjB,EACLkB,IAAKjB,EACLrD,mBAAoBuD"}
1
+ {"version":3,"file":"long-bow.cjs.production.min.js","sources":["../src/components/Button.tsx","../src/components/RPGUIContainer.tsx","../src/components/RPGUIRoot.tsx","../src/components/ListMenu.tsx","../src/components/NPCDialog/img/npcDialog/npcThumbnails/alice.png","../src/components/NPCDialog/img/space.gif","../src/libs/StringHelpers.ts","../src/components/NPCDialog/NPCDialog.tsx","../src/components/typography/DynamicText.tsx","../src/components/NPCDialog/NPCDialogText.tsx","../src/hooks/useEventListener.ts","../src/components/NPCDialog/QuestionDialog/QuestionDialog.tsx","../src/components/RangeSlider.tsx","../src/components/Truncate.tsx","../src/components/CheckButton.tsx","../src/components/Dropdown.tsx","../src/components/Input.tsx","../src/components/RadioButton.tsx","../src/components/TextArea.tsx"],"sourcesContent":["import React from 'react';\nimport styled from 'styled-components';\n\nexport enum ButtonTypes {\n RPGUIButton = 'rpgui-button',\n RPGUIGoldButton = 'rpgui-button golden',\n}\n\nexport interface IButtonProps {\n children: React.ReactNode;\n buttonType: ButtonTypes;\n}\n\nexport const Button: React.FC<\n IButtonProps &\n React.DetailedHTMLProps<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n HTMLButtonElement\n >\n> = ({ children, buttonType, ...props }) => {\n return (\n <ButtonContainer className={`${buttonType}`} {...props}>\n <p>{children}</p>\n </ButtonContainer>\n );\n};\n\nconst ButtonContainer = styled.button<any>`\n height: 45px;\n font-size: 11.5px;\n`;\n","import React from 'react';\nimport styled from 'styled-components';\n\nexport enum RPGUIContainerTypes {\n Framed = 'framed',\n FramedGold = 'framed-golden',\n FramedGold2 = 'framed-golden-2',\n FramedGrey = 'framed-grey',\n}\nexport interface IRPGUIContainerProps {\n type: RPGUIContainerTypes;\n children: React.ReactNode;\n width?: string;\n height?: string;\n}\n\nexport const RPGUIContainer: React.FC<IRPGUIContainerProps> = ({\n children,\n type,\n width = '50%',\n height,\n}) => {\n return (\n <Container\n width={width}\n height={height || 'auto'}\n className={`rpgui-container ${type}`}\n >\n {children}\n </Container>\n );\n};\n\ninterface IContainerProps {\n width: string;\n height: string;\n}\n\nconst Container = styled.div<IContainerProps>`\n height: ${(props) => props.height};\n width: ${({ width }) => width};\n display: flex;\n flex-wrap: wrap;\n image-rendering: pixelated;\n`;\n","import React from 'react';\nimport 'rpgui/rpgui.min.css';\nimport 'rpgui/rpgui.min.js';\n\ninterface IProps {\n children: React.ReactNode;\n}\n\n//@ts-ignore\nexport const _RPGUI = RPGUI;\n\nexport const RPGUIRoot: React.FC<IProps> = ({ children }) => {\n return <div className=\"rpgui-content\">{children}</div>;\n};\n","import React from 'react';\nimport styled from 'styled-components';\n\ninterface IListMenuOption {\n id: string;\n text: string;\n}\n\nexport interface IListMenuProps {\n x: number;\n y: number;\n options: IListMenuOption[];\n onSelected: (selectedOptionId: string) => void;\n fontSize?: number;\n}\n\nexport const ListMenu: React.FC<IListMenuProps> = ({\n options,\n onSelected,\n x,\n y,\n fontSize = 0.8,\n}) => {\n return (\n <Container x={x} y={y} fontSize={fontSize}>\n <ul className=\"rpgui-list-imp\" style={{ overflow: 'hidden' }}>\n {options.map((params) => (\n <ListElement\n key={params.text}\n onClick={() => {\n onSelected(params.id);\n }}\n >\n {params.text}\n </ListElement>\n ))}\n </ul>\n </Container>\n );\n};\n\ninterface IContainerProps {\n x?: number;\n y?: number;\n fontSize?: number;\n}\n\nconst Container = styled.div<IContainerProps>`\n display: flex;\n flex-direction: column;\n width: 100%;\n justify-content: start;\n align-items: flex-start;\n position: absolute;\n top: ${(props) => props.y || 0}px;\n left: ${(props) => props.x || 0}px;\n\n li {\n font-size: ${(props) => props.fontSize}em;\n }\n`;\n\nconst ListElement = styled.li`\n margin-right: 0.5rem;\n`;\n","const img = require('./alice.png'); export default img;","const img = require('./space.gif'); export default img;","export const chunkString = (str: string, length: number) => {\n return str.match(new RegExp('.{1,' + length + '}', 'g'));\n};\n","import React, { useState } from 'react';\nimport styled from 'styled-components';\nimport { RPGUIContainer, RPGUIContainerTypes } from '../RPGUIContainer';\nimport aliceDefaultThumbnail from './img/npcDialog/npcThumbnails/alice.png';\nimport pressSpaceGif from './img/space.gif';\nimport { NPCDialogText } from './NPCDialogText';\nimport {\n IQuestionDialog,\n IQuestionDialogAnswer,\n QuestionDialog,\n} from './QuestionDialog/QuestionDialog';\n\nexport enum NPCDialogType {\n TextOnly = 'TextOnly',\n TextAndThumbnail = 'TextAndThumbnail',\n}\n\nexport interface INPCDialogProps {\n text?: string;\n type: NPCDialogType;\n imagePath?: string;\n onClose?: () => void;\n isQuestionDialog?: boolean;\n answers?: IQuestionDialogAnswer[];\n questions?: IQuestionDialog[];\n}\n\nexport const NPCDialog: React.FC<INPCDialogProps> = ({\n text,\n type,\n onClose,\n imagePath,\n isQuestionDialog = false,\n questions,\n answers,\n}) => {\n const [showGoNextIndicator, setShowGoNextIndicator] =\n useState<boolean>(false);\n\n return (\n <RPGUIContainer\n type={RPGUIContainerTypes.FramedGold}\n width={isQuestionDialog ? '600px' : '50%'}\n height={'180px'}\n >\n {isQuestionDialog && questions && answers ? (\n <>\n <TextContainer\n flex={type === NPCDialogType.TextAndThumbnail ? '70%' : '100%'}\n >\n <QuestionDialog\n questions={questions}\n answers={answers}\n onClose={() => {\n if (onClose) {\n onClose();\n }\n }}\n />\n </TextContainer>\n {type === NPCDialogType.TextAndThumbnail && (\n <ThumbnailContainer>\n <NPCThumbnail src={imagePath || aliceDefaultThumbnail} />\n </ThumbnailContainer>\n )}\n </>\n ) : (\n <>\n <Container>\n <TextContainer\n flex={type === NPCDialogType.TextAndThumbnail ? '70%' : '100%'}\n >\n <NPCDialogText\n onStartStep={() => setShowGoNextIndicator(false)}\n onEndStep={() => setShowGoNextIndicator(true)}\n text={text || 'No text provided.'}\n onClose={() => {\n if (onClose) {\n onClose();\n }\n }}\n />\n </TextContainer>\n {type === NPCDialogType.TextAndThumbnail && (\n <ThumbnailContainer>\n <NPCThumbnail src={imagePath || aliceDefaultThumbnail} />\n </ThumbnailContainer>\n )}\n </Container>\n {showGoNextIndicator && (\n <PressSpaceIndicator\n right={type === NPCDialogType.TextOnly ? '1rem' : '10.5rem'}\n src={pressSpaceGif}\n />\n )}\n </>\n )}\n </RPGUIContainer>\n );\n};\n\nconst Container = styled.div`\n display: flex;\n width: 100%;\n height: 100%;\n\n box-sizing: border-box;\n justify-content: center;\n align-items: flex-start;\n position: relative;\n`;\n\ninterface ITextContainerProps {\n flex: string;\n}\n\nconst TextContainer = styled.div<ITextContainerProps>`\n flex: ${({ flex }) => flex} 0 0;\n width: 355px;\n`;\n\nconst ThumbnailContainer = styled.div`\n flex: 30% 0 0;\n display: flex;\n justify-content: flex-end;\n`;\n\nconst NPCThumbnail = styled.img`\n image-rendering: pixelated;\n height: 128px;\n width: 128px;\n`;\n\ninterface IPressSpaceIndicatorProps {\n right: string;\n}\n\nconst PressSpaceIndicator = styled.img<IPressSpaceIndicatorProps>`\n position: absolute;\n right: ${({ right }) => right};\n bottom: 1rem;\n height: 20.7px;\n image-rendering: -webkit-optimize-contrast;\n`;\n","import React, { useEffect, useState } from 'react';\nimport styled from 'styled-components';\n\ninterface IProps {\n text: string;\n onFinish?: () => void;\n onStart?: () => void;\n}\n\nexport const DynamicText: React.FC<IProps> = ({ text, onFinish, onStart }) => {\n const [textState, setTextState] = useState<string>('');\n\n useEffect(() => {\n let i = 0;\n const interval = setInterval(() => {\n // on every interval, show one more character\n\n if (i === 0) {\n if (onStart) {\n onStart();\n }\n }\n\n if (i < text.length) {\n setTextState(text.substring(0, i + 1));\n i++;\n } else {\n clearInterval(interval);\n if (onFinish) {\n onFinish();\n }\n }\n }, 50);\n\n return () => {\n clearInterval(interval);\n };\n }, [text]);\n\n return <TextContainer>{textState}</TextContainer>;\n};\n\nconst TextContainer = styled.p`\n font-size: 0.7rem !important;\n color: white;\n text-shadow: 1px 1px 0px #000000;\n letter-spacing: 1.2px;\n word-break: normal;\n`;\n","import React, { useEffect, useState } from 'react';\nimport styled from 'styled-components';\nimport { chunkString } from '../../libs/StringHelpers';\nimport { DynamicText } from '../typography/DynamicText';\n\ninterface IProps {\n text: string;\n onClose: () => void;\n onEndStep: () => void;\n onStartStep: () => void;\n}\n\nexport const NPCDialogText: React.FC<IProps> = ({\n text,\n onClose,\n onEndStep,\n onStartStep,\n}) => {\n const textChunks = chunkString(text, 85);\n\n const [chunkIndex, setChunkIndex] = useState<number>(0);\n\n const onHandleSpacePress = (event: KeyboardEvent) => {\n if (event.code === 'Space') {\n const hasNextChunk = textChunks?.[chunkIndex + 1] || false;\n\n if (hasNextChunk) {\n setChunkIndex((prev) => prev + 1);\n } else {\n // if there's no more text chunks, close the dialog\n onClose();\n }\n }\n };\n\n useEffect(() => {\n document.addEventListener('keydown', onHandleSpacePress);\n\n return () => document.removeEventListener('keydown', onHandleSpacePress);\n }, [chunkIndex]);\n\n return (\n <Container>\n <DynamicText\n text={textChunks?.[chunkIndex] || ''}\n onFinish={onEndStep}\n onStart={onStartStep}\n />\n </Container>\n );\n};\n\nconst Container = styled.div``;\n","import React from 'react';\n\n//@ts-ignore\nexport const useEventListener = (type, handler, el = window) => {\n const savedHandler = React.useRef();\n\n React.useEffect(() => {\n savedHandler.current = handler;\n }, [handler]);\n\n React.useEffect(() => {\n //@ts-ignore\n const listener = (e) => savedHandler.current(e);\n\n el.addEventListener(type, listener);\n\n return () => {\n el.removeEventListener(type, listener);\n };\n }, [type, el]);\n};\n","import React, { useEffect, useState } from 'react';\nimport styled from 'styled-components';\nimport { useEventListener } from '../../../hooks/useEventListener';\nimport { DynamicText } from '../../typography/DynamicText';\n\nexport interface IQuestionDialogAnswer {\n id: number;\n text: string;\n nextQuestionId?: number;\n}\n\nexport interface IQuestionDialog {\n id: number;\n text: string;\n answerIds?: number[];\n}\n\nexport interface IProps {\n questions: IQuestionDialog[];\n answers: IQuestionDialogAnswer[];\n onClose: () => void;\n}\n\nexport const QuestionDialog: React.FC<IProps> = ({\n questions,\n answers,\n onClose,\n}) => {\n const [currentQuestion, setCurrentQuestion] = useState(questions[0]);\n\n const [canShowAnswers, setCanShowAnswers] = useState<boolean>(false);\n\n const onGetFirstAnswer = () => {\n if (!currentQuestion.answerIds || currentQuestion.answerIds.length === 0) {\n return null;\n }\n\n const firstAnswerId = currentQuestion.answerIds![0];\n\n return answers.find((answer) => answer.id === firstAnswerId);\n };\n\n const [currentAnswer, setCurrentAnswer] =\n useState<IQuestionDialogAnswer | null>(onGetFirstAnswer()!);\n\n useEffect(() => {\n setCurrentAnswer(onGetFirstAnswer()!);\n }, [currentQuestion]);\n\n const onGetAnswers = (answerIds: number[]) => {\n return answerIds.map((answerId: number) =>\n answers.find((answer) => answer.id === answerId)\n );\n };\n\n const onKeyPress = (e: KeyboardEvent) => {\n switch (e.key) {\n case 'ArrowDown':\n // select next answer, if any.\n // if no next answer, select first answer\n // const nextAnswer = onGetAnswers(currentQuestion.answerIds!).find(\n // (answer) => answer?.id === currentAnswer!.id + 1\n // );\n\n const nextAnswerIndex = onGetAnswers(\n currentQuestion.answerIds!\n ).findIndex((answer) => answer?.id === currentAnswer!.id + 1);\n\n const nextAnswerID = currentQuestion.answerIds![nextAnswerIndex];\n\n // console.log(nextAnswerIndex);\n\n const nextAnswer = onGetAnswers(currentQuestion.answerIds!).find(\n (answer) => answer?.id === nextAnswerID\n );\n\n setCurrentAnswer(nextAnswer || onGetFirstAnswer()!);\n\n break;\n case 'ArrowUp':\n // select previous answer, if any.\n // if no previous answer, select last answer\n\n const previousAnswerIndex = onGetAnswers(\n currentQuestion.answerIds!\n ).findIndex((answer) => answer?.id === currentAnswer!.id - 1);\n\n const previousAnswerID =\n currentQuestion.answerIds &&\n currentQuestion.answerIds[previousAnswerIndex];\n\n const previousAnswer = onGetAnswers(currentQuestion.answerIds!).find(\n (answer) => answer?.id === previousAnswerID\n );\n\n if (previousAnswer) {\n setCurrentAnswer(previousAnswer);\n } else {\n setCurrentAnswer(onGetAnswers(currentQuestion.answerIds!).pop()!);\n }\n\n break;\n case 'Enter':\n setCanShowAnswers(false);\n\n if (!currentAnswer?.nextQuestionId) {\n onClose();\n return;\n } else {\n setCurrentQuestion(\n questions.find(\n (question) => question.id === currentAnswer!.nextQuestionId\n )!\n );\n }\n\n break;\n }\n };\n useEventListener('keydown', onKeyPress);\n\n const onAnswerClick = (answer: IQuestionDialogAnswer) => {\n setCanShowAnswers(false);\n if (answer.nextQuestionId) {\n // if there is a next question, go to it\n setCurrentQuestion(\n questions.find((question) => question.id === answer.nextQuestionId)!\n );\n } else {\n // else, finish dialog!\n onClose();\n }\n };\n\n const onRenderCurrentAnswers = () => {\n const answerIds = currentQuestion.answerIds;\n if (!answerIds) {\n return null;\n }\n\n const answers = onGetAnswers(answerIds);\n\n if (!answers) {\n return null;\n }\n\n return answers.map((answer) => {\n const isSelected = currentAnswer?.id === answer?.id;\n const selectedColor = isSelected ? 'yellow' : 'white';\n\n if (answer) {\n return (\n <AnswerRow key={`answer_${answer.id}`}>\n <AnswerSelectedIcon color={selectedColor}>\n {isSelected ? 'X' : null}\n </AnswerSelectedIcon>\n\n <Answer\n key={answer.id}\n onClick={() => onAnswerClick(answer)}\n color={selectedColor}\n >\n {answer.text}\n </Answer>\n </AnswerRow>\n );\n }\n\n return null;\n });\n };\n\n return (\n <Container>\n <QuestionContainer>\n <DynamicText\n text={currentQuestion.text}\n onStart={() => setCanShowAnswers(false)}\n onFinish={() => setCanShowAnswers(true)}\n />\n </QuestionContainer>\n\n {canShowAnswers && (\n <AnswersContainer>{onRenderCurrentAnswers()}</AnswersContainer>\n )}\n </Container>\n );\n};\n\nconst Container = styled.div`\n display: flex;\n\n word-break: break-all;\n\n box-sizing: border-box;\n justify-content: flex-start;\n align-items: flex-start;\n flex-wrap: wrap;\n`;\n\nconst QuestionContainer = styled.div`\n flex: 100%;\n width: 100%;\n`;\n\nconst AnswersContainer = styled.div`\n flex: 100%;\n`;\n\ninterface IAnswerProps {\n color: string;\n}\n\nconst Answer = styled.p<IAnswerProps>`\n flex: auto;\n color: ${(props) => props.color} !important;\n font-size: 0.65rem !important;\n background: inherit;\n border: none;\n`;\n\nconst AnswerSelectedIcon = styled.span<IAnswerProps>`\n flex: 5% 0 0;\n color: ${(props) => props.color} !important;\n`;\n\nconst AnswerRow = styled.div`\n display: flex;\n flex-wrap: wrap;\n justify-content: center;\n align-items: center;\n margin-bottom: 0.5rem;\n height: 22px;\n\n p {\n line-height: unset;\n margin-top: 0;\n margin-bottom: 0rem;\n }\n`;\n","import React, { useState } from 'react';\nimport styled from 'styled-components';\nimport { v4 as uuidv4 } from 'uuid';\nimport { useEventListener } from '../hooks/useEventListener';\nimport { _RPGUI } from './RPGUIRoot';\n\nexport enum RangeSliderType {\n Slider = 'rpgui-slider',\n GoldSlider = 'rpgui-slider golden',\n}\n\nexport interface IRangeSliderProps {\n type: RangeSliderType;\n valueMin: number;\n valueMax: number;\n width: string;\n onChange: (value: number) => void;\n}\n\nexport const RangeSlider: React.FC<IRangeSliderProps> = ({\n type,\n valueMin,\n valueMax,\n width,\n onChange,\n}) => {\n const sliderId = uuidv4();\n\n const [wasMouseDownFirst, setWasMouseDownFirst] = useState<boolean>(false);\n\n useEventListener('mouseup', () => {\n if (wasMouseDownFirst) {\n onHandleMouseUp();\n }\n setWasMouseDownFirst(false);\n });\n\n const onHandleMouseUp = () => {\n const rpguiSlider = document.getElementById(`rpgui-slider-${sliderId}`);\n const value = _RPGUI.get_value(rpguiSlider);\n\n onChange(Number(value));\n };\n\n return (\n <div\n onMouseUp={onHandleMouseUp}\n onMouseDown={() => setWasMouseDownFirst(true)}\n >\n <Input\n className={\n type === RangeSliderType.Slider\n ? RangeSliderType.Slider\n : RangeSliderType.GoldSlider\n }\n type=\"range\"\n style={{ width: width }}\n min={valueMin}\n max={valueMax}\n id={`rpgui-slider-${sliderId}`}\n />\n </div>\n );\n};\n\nconst Input = styled.input`\n opacity: 0;\n`;\n","/* eslint-disable react/require-default-props */\nimport React from 'react';\nimport styled from 'styled-components';\n\ninterface IProps {\n maxLines?: number;\n children: React.ReactNode;\n}\n\nexport const Truncate: React.FC<IProps> = ({ maxLines = 1, children }) => {\n return <Container maxLines={maxLines}>{children}</Container>;\n};\n\ninterface IContainerProps {\n maxLines: number;\n}\n\nconst Container = styled.div<IContainerProps>`\n display: -webkit-box;\n max-width: 100%;\n max-height: 100%;\n -webkit-line-clamp: ${(props) => props.maxLines};\n -webkit-box-orient: vertical;\n overflow: hidden;\n`;\n","import React, { useEffect, useState } from 'react';\n\nexport interface ICheckItems {\n label: string;\n value: string;\n}\n\nexport interface ICheckProps {\n items: ICheckItems[];\n onChange: (selectedValues: IChecklistSelectedValues) => void;\n}\n\ninterface IChecklistSelectedValues {\n [label: string]: boolean;\n}\n\nexport const CheckButton: React.FC<ICheckProps> = ({ items, onChange }) => {\n const generateSelectedValuesList = () => {\n const selectedValues: IChecklistSelectedValues = {};\n\n items.forEach((item) => {\n selectedValues[item.label] = false;\n });\n\n return selectedValues;\n };\n\n const [selectedValues, setSelectedValues] =\n useState<IChecklistSelectedValues>(generateSelectedValuesList());\n\n const handleClick = (label: string) => {\n setSelectedValues({\n ...selectedValues,\n [label]: !selectedValues[label],\n });\n };\n\n useEffect(() => {\n if (selectedValues) {\n onChange(selectedValues);\n }\n }, [selectedValues]);\n\n return (\n <div id=\"elemento-checkbox\">\n {items?.map((element, index) => {\n return (\n <div key={`${element.label}_${index}`}>\n <input\n className=\"rpgui-checkbox\"\n type=\"checkbox\"\n checked={selectedValues[element.label]}\n onChange={() => {}}\n />\n <label onClick={() => handleClick(element.label)}>\n {element.label}\n </label>\n <br />\n </div>\n );\n })}\n </div>\n );\n};\n","import React, { useEffect, useState } from 'react';\nimport { v4 as uuidv4 } from 'uuid';\nimport { _RPGUI } from './RPGUIRoot';\n\nexport interface IOptionsProps {\n id: number;\n value: string;\n option: string;\n}\n\nexport interface IDropdownProps {\n options: IOptionsProps[];\n width?: string;\n onChange: (value: string) => void;\n}\n\nexport const Dropdown: React.FC<IDropdownProps> = ({\n options,\n width,\n onChange,\n}) => {\n const dropdownId = uuidv4();\n\n const [selectedValue, setSelectedValue] = useState<string>('');\n\n useEffect(() => {\n const element = document.getElementById(`rpgui-dropdown-${dropdownId}`);\n const dropdownValue = _RPGUI.get_value(element);\n setSelectedValue(dropdownValue);\n\n element?.addEventListener('change', (event: any) => {\n setSelectedValue(event?.target.value);\n });\n }, []);\n\n useEffect(() => {\n if (selectedValue) {\n onChange(selectedValue);\n }\n }, [selectedValue]);\n\n return (\n <select\n id={`rpgui-dropdown-${dropdownId}`}\n style={{ width: width }}\n className=\"rpgui-dropdown\"\n >\n {options.map((option) => {\n return (\n <option key={option.id} value={option.value}>\n {option.option}\n </option>\n );\n })}\n </select>\n );\n};\n","import React from 'react';\n\nexport interface IInputProps\n extends React.DetailedHTMLProps<\n React.InputHTMLAttributes<HTMLInputElement>,\n HTMLInputElement\n > {}\n\nexport const Input: React.FC<IInputProps> = ({ ...props }) => {\n return <input {...props} />;\n};\n","import React, { useEffect, useState } from 'react';\n\nexport interface IRadioItems {\n label: string;\n value: string;\n}\n\nexport interface IRadioProps {\n name: string;\n items: IRadioItems[];\n onChange: (value: string) => void;\n}\n\nexport const InputRadio: React.FC<IRadioProps> = ({\n name,\n items,\n onChange,\n}) => {\n const [selectedValue, setSelectedValue] = useState<string>();\n const handleClick = () => {\n let element = document.querySelector(\n `input[name=${name}]:checked`\n ) as HTMLInputElement;\n const elementValue = element.value;\n setSelectedValue(elementValue);\n };\n\n useEffect(() => {\n if (selectedValue) {\n onChange(selectedValue);\n }\n }, [selectedValue]);\n\n return (\n <div id=\"elemento-radio\">\n {items.map((element) => {\n return (\n <>\n <input\n key={element.value}\n className=\"rpgui-radio\"\n value={element.value}\n name={name}\n type=\"radio\"\n />\n <label onClick={handleClick}>{element.label}</label>\n <br />\n </>\n );\n })}\n </div>\n );\n};\n","import React from 'react';\n\nexport interface ITextArea\n extends React.DetailedHTMLProps<\n React.TextareaHTMLAttributes<HTMLTextAreaElement>,\n HTMLTextAreaElement\n > {}\n\nexport const TextArea: React.FC<ITextArea> = ({ ...props }) => {\n return <textarea {...props} />;\n};\n"],"names":["ButtonTypes","RPGUIContainerTypes","ButtonContainer","styled","button","_RPGUI","RPGUI","Container","div","props","y","x","fontSize","ListElement","li","RPGUIContainer","width","React","height","className","type","children","img","require","NPCDialogType","DynamicText","text","onFinish","onStart","useState","textState","setTextState","useEffect","i","interval","setInterval","length","substring","clearInterval","TextContainer","p","NPCDialogText","onClose","onEndStep","onStartStep","textChunks","match","RegExp","chunkIndex","setChunkIndex","onHandleSpacePress","event","code","prev","document","addEventListener","removeEventListener","useEventListener","handler","el","window","savedHandler","useRef","current","listener","e","QuestionDialog","questions","answers","currentQuestion","setCurrentQuestion","canShowAnswers","setCanShowAnswers","onGetFirstAnswer","answerIds","firstAnswerId","find","answer","id","currentAnswer","setCurrentAnswer","onGetAnswers","map","answerId","key","nextAnswerIndex","findIndex","nextAnswerID","nextAnswer","previousAnswerIndex","previousAnswerID","previousAnswer","pop","nextQuestionId","question","QuestionContainer","AnswersContainer","isSelected","selectedColor","AnswerRow","AnswerSelectedIcon","color","Answer","onClick","onAnswerClick","onRenderCurrentAnswers","span","RangeSliderType","flex","ThumbnailContainer","NPCThumbnail","PressSpaceIndicator","right","Input","input","maxLines","buttonType","items","onChange","selectedValues","forEach","item","label","generateSelectedValuesList","setSelectedValues","element","index","checked","options","dropdownId","uuidv4","selectedValue","setSelectedValue","getElementById","dropdownValue","get_value","target","value","style","option","name","handleClick","querySelector","onSelected","overflow","params","imagePath","isQuestionDialog","showGoNextIndicator","setShowGoNextIndicator","FramedGold","TextAndThumbnail","src","aliceDefaultThumbnail","TextOnly","pressSpaceGif","valueMin","valueMax","sliderId","wasMouseDownFirst","setWasMouseDownFirst","onHandleMouseUp","rpguiSlider","Number","onMouseUp","onMouseDown","Slider","GoldSlider","min","max"],"mappings":"4eAGYA,+BAAAA,EAAAA,sBAAAA,oDAEVA,4CCFUC,EDwBNC,EAAkBC,EAAOC,oFAAPD,oCElBXE,EAASC,MCsChBC,EAAYJ,EAAOK,6EAAPL,6JAOT,SAACM,UAAUA,EAAMC,GAAK,KACrB,SAACD,UAAUA,EAAME,GAAK,KAGf,SAACF,UAAUA,EAAMG,YAI5BC,EAAcV,EAAOW,8EAAPX,4BF3DRF,EAAAA,8BAAAA,iDAEVA,6BACAA,gCACAA,+BASWc,EAAiD,oBAG5DC,aAIEC,gBAACV,GACCS,iBALI,QAMJE,SALJA,QAKsB,OAClBC,+BARJC,QADAC,WAqBId,EAAYJ,EAAOK,mFAAPL,kFACN,SAACM,UAAUA,EAAMS,UAClB,qBAAGF,SGxCd,MAAMM,EAAMC,QAAQ,eCAdD,EAAMC,QAAQ,eCAb,ICYKC,ECHCC,EAAgC,gBAAGC,IAAAA,KAAMC,IAAAA,SAAUC,IAAAA,UAC5BC,WAAiB,IAA5CC,OAAWC,cAElBC,aAAU,eACJC,EAAI,EACFC,EAAWC,aAAY,WAGjB,IA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UAClDF,IAAKG,2ELjFwB,mBAClC1I,uBAAKE,UAAU,mBADsBE,+BUQU,gBACtDD,IAAAA,KACAwI,IAAAA,SACAC,IAAAA,SACA7I,IAAAA,MACAsG,IAAAA,SAEMwC,EAAW5B,SAEiCrG,YAAkB,GAA7DkI,OAAmBC,OAE1BvG,EAAiB,WAAW,WACtBsG,GACFE,IAEFD,GAAqB,UAGjBC,EAAkB,eAChBC,EAAc5G,SAAS+E,+BAA+ByB,GACtDrB,EAAQpI,EAAOkI,UAAU2B,GAE/B5C,EAAS6C,OAAO1B,YAIhBxH,uBACEmJ,UAAWH,EACXI,YAAa,kBAAML,GAAqB,KAExC/I,gBAACgG,GACC9F,UACEC,IAASuF,wBAAgB2D,OACrB3D,wBAAgB2D,OAChB3D,wBAAgB4D,WAEtBnJ,KAAK,QACLsH,MAAO,CAAE1H,MAAOA,GAChBwJ,IAAKZ,EACLa,IAAKZ,EACL/E,mBAAoBgF,uBMnDiB,gBAAMrJ,iBAC1CQ,4CAAcR,sBLAmB,oBAAG0G,gBACpClG,gBAACV,GAAU4G,oBADoC,OAAG9F"}
@@ -1,8 +1,26 @@
1
1
  import React, { useState, useEffect } from 'react';
2
- import 'rpgui/rpgui.min.css';
3
- import 'rpgui/rpgui.min.js';
4
2
  import styled from 'styled-components';
5
3
  import { v4 } from 'uuid';
4
+ import 'rpgui/rpgui.min.css';
5
+ import 'rpgui/rpgui.min.js';
6
+
7
+ function _extends() {
8
+ _extends = Object.assign || function (target) {
9
+ for (var i = 1; i < arguments.length; i++) {
10
+ var source = arguments[i];
11
+
12
+ for (var key in source) {
13
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
14
+ target[key] = source[key];
15
+ }
16
+ }
17
+ }
18
+
19
+ return target;
20
+ };
21
+
22
+ return _extends.apply(this, arguments);
23
+ }
6
24
 
7
25
  function _objectWithoutPropertiesLoose(source, excluded) {
8
26
  if (source == null) return {};
@@ -19,6 +37,73 @@ function _objectWithoutPropertiesLoose(source, excluded) {
19
37
  return target;
20
38
  }
21
39
 
40
+ var _excluded = ["children", "buttonType"];
41
+ var ButtonTypes;
42
+
43
+ (function (ButtonTypes) {
44
+ ButtonTypes["RPGUIButton"] = "rpgui-button";
45
+ ButtonTypes["RPGUIGoldButton"] = "rpgui-button golden";
46
+ })(ButtonTypes || (ButtonTypes = {}));
47
+
48
+ var Button = function Button(_ref) {
49
+ var children = _ref.children,
50
+ buttonType = _ref.buttonType,
51
+ props = _objectWithoutPropertiesLoose(_ref, _excluded);
52
+
53
+ return React.createElement(ButtonContainer, Object.assign({
54
+ className: "" + buttonType
55
+ }, props), React.createElement("p", null, children));
56
+ };
57
+ var ButtonContainer = /*#__PURE__*/styled.button.withConfig({
58
+ displayName: "Button__ButtonContainer",
59
+ componentId: "sc-obzd3o-0"
60
+ })(["height:45px;font-size:11.5px;"]);
61
+
62
+ var CheckButton = function CheckButton(_ref) {
63
+ var items = _ref.items,
64
+ onChange = _ref.onChange;
65
+
66
+ var generateSelectedValuesList = function generateSelectedValuesList() {
67
+ var selectedValues = {};
68
+ items.forEach(function (item) {
69
+ selectedValues[item.label] = false;
70
+ });
71
+ return selectedValues;
72
+ };
73
+
74
+ var _useState = useState(generateSelectedValuesList()),
75
+ selectedValues = _useState[0],
76
+ setSelectedValues = _useState[1];
77
+
78
+ var handleClick = function handleClick(label) {
79
+ var _extends2;
80
+
81
+ setSelectedValues(_extends({}, selectedValues, (_extends2 = {}, _extends2[label] = !selectedValues[label], _extends2)));
82
+ };
83
+
84
+ useEffect(function () {
85
+ if (selectedValues) {
86
+ onChange(selectedValues);
87
+ }
88
+ }, [selectedValues]);
89
+ return React.createElement("div", {
90
+ id: "elemento-checkbox"
91
+ }, items == null ? void 0 : items.map(function (element, index) {
92
+ return React.createElement("div", {
93
+ key: element.label + "_" + index
94
+ }, React.createElement("input", {
95
+ className: "rpgui-checkbox",
96
+ type: "checkbox",
97
+ checked: selectedValues[element.label],
98
+ onChange: function onChange() {}
99
+ }), React.createElement("label", {
100
+ onClick: function onClick() {
101
+ return handleClick(element.label);
102
+ }
103
+ }, element.label), React.createElement("br", null));
104
+ }));
105
+ };
106
+
22
107
  var _RPGUI = RPGUI;
23
108
  var RPGUIRoot = function RPGUIRoot(_ref) {
24
109
  var children = _ref.children;
@@ -27,33 +112,62 @@ var RPGUIRoot = function RPGUIRoot(_ref) {
27
112
  }, children);
28
113
  };
29
114
 
30
- var _excluded = ["children", "type"];
31
- var IButtonTypes;
115
+ var Dropdown = function Dropdown(_ref) {
116
+ var options = _ref.options,
117
+ width = _ref.width,
118
+ onChange = _ref.onChange;
119
+ var dropdownId = v4();
120
+
121
+ var _useState = useState(''),
122
+ selectedValue = _useState[0],
123
+ setSelectedValue = _useState[1];
32
124
 
33
- (function (IButtonTypes) {
34
- IButtonTypes["RPGUIButton"] = "rpgui-button";
35
- IButtonTypes["RPGUIGoldButton"] = "rpgui-button golden";
36
- })(IButtonTypes || (IButtonTypes = {}));
125
+ useEffect(function () {
126
+ var element = document.getElementById("rpgui-dropdown-" + dropdownId);
37
127
 
38
- var Button = function Button(_ref) {
39
- var children = _ref.children,
40
- type = _ref.type,
41
- props = _objectWithoutPropertiesLoose(_ref, _excluded);
128
+ var dropdownValue = _RPGUI.get_value(element);
42
129
 
43
- return React.createElement(RPGUIRoot, null, React.createElement("button", Object.assign({
44
- className: type,
45
- type: "button"
46
- }, props), React.createElement("p", null, children)));
130
+ setSelectedValue(dropdownValue);
131
+ element == null ? void 0 : element.addEventListener('change', function (event) {
132
+ setSelectedValue(event == null ? void 0 : event.target.value);
133
+ });
134
+ }, []);
135
+ useEffect(function () {
136
+ if (selectedValue) {
137
+ onChange(selectedValue);
138
+ }
139
+ }, [selectedValue]);
140
+ return React.createElement("select", {
141
+ id: "rpgui-dropdown-" + dropdownId,
142
+ style: {
143
+ width: width
144
+ },
145
+ className: "rpgui-dropdown"
146
+ }, options.map(function (option) {
147
+ return React.createElement("option", {
148
+ key: option.id,
149
+ value: option.value
150
+ }, option.option);
151
+ }));
152
+ };
153
+
154
+ var Input = function Input(_ref) {
155
+ var props = _extends({}, _ref);
156
+
157
+ return React.createElement("input", Object.assign({}, props));
47
158
  };
48
159
 
49
160
  var ListMenu = function ListMenu(_ref) {
50
161
  var options = _ref.options,
51
162
  onSelected = _ref.onSelected,
52
163
  x = _ref.x,
53
- y = _ref.y;
54
- return React.createElement(RPGUIRoot, null, React.createElement(Container, {
164
+ y = _ref.y,
165
+ _ref$fontSize = _ref.fontSize,
166
+ fontSize = _ref$fontSize === void 0 ? 0.8 : _ref$fontSize;
167
+ return React.createElement(Container, {
55
168
  x: x,
56
- y: y
169
+ y: y,
170
+ fontSize: fontSize
57
171
  }, React.createElement("ul", {
58
172
  className: "rpgui-list-imp",
59
173
  style: {
@@ -66,15 +180,17 @@ var ListMenu = function ListMenu(_ref) {
66
180
  onSelected(params.id);
67
181
  }
68
182
  }, params.text);
69
- }))));
183
+ })));
70
184
  };
71
185
  var Container = /*#__PURE__*/styled.div.withConfig({
72
186
  displayName: "ListMenu__Container",
73
187
  componentId: "sc-i9097t-0"
74
- })(["display:flex;flex-direction:column;width:100%;justify-content:start;align-items:flex-start;position:absolute;top:", "px;left:", "px;"], function (props) {
188
+ })(["display:flex;flex-direction:column;width:100%;justify-content:start;align-items:flex-start;position:absolute;top:", "px;left:", "px;li{font-size:", "em;}"], function (props) {
75
189
  return props.y || 0;
76
190
  }, function (props) {
77
191
  return props.x || 0;
192
+ }, function (props) {
193
+ return props.fontSize;
78
194
  });
79
195
  var ListElement = /*#__PURE__*/styled.li.withConfig({
80
196
  displayName: "ListMenu__ListElement",
@@ -431,7 +547,7 @@ var NPCDialog = function NPCDialog(_ref) {
431
547
  showGoNextIndicator = _useState[0],
432
548
  setShowGoNextIndicator = _useState[1];
433
549
 
434
- return React.createElement(RPGUIRoot, null, React.createElement(RPGUIContainer, {
550
+ return React.createElement(RPGUIContainer, {
435
551
  type: RPGUIContainerTypes.FramedGold,
436
552
  width: isQuestionDialog ? '600px' : '50%',
437
553
  height: '180px'
@@ -467,7 +583,7 @@ var NPCDialog = function NPCDialog(_ref) {
467
583
  }))), showGoNextIndicator && React.createElement(PressSpaceIndicator, {
468
584
  right: type === NPCDialogType.TextOnly ? '1rem' : '10.5rem',
469
585
  src: img$1
470
- }))));
586
+ })));
471
587
  };
472
588
  var Container$4 = /*#__PURE__*/styled.div.withConfig({
473
589
  displayName: "NPCDialog__Container",
@@ -496,6 +612,41 @@ var PressSpaceIndicator = /*#__PURE__*/styled.img.withConfig({
496
612
  return right;
497
613
  });
498
614
 
615
+ var InputRadio = function InputRadio(_ref) {
616
+ var name = _ref.name,
617
+ items = _ref.items,
618
+ onChange = _ref.onChange;
619
+
620
+ var _useState = useState(),
621
+ selectedValue = _useState[0],
622
+ setSelectedValue = _useState[1];
623
+
624
+ var handleClick = function handleClick() {
625
+ var element = document.querySelector("input[name=" + name + "]:checked");
626
+ var elementValue = element.value;
627
+ setSelectedValue(elementValue);
628
+ };
629
+
630
+ useEffect(function () {
631
+ if (selectedValue) {
632
+ onChange(selectedValue);
633
+ }
634
+ }, [selectedValue]);
635
+ return React.createElement("div", {
636
+ id: "elemento-radio"
637
+ }, items.map(function (element) {
638
+ return React.createElement(React.Fragment, null, React.createElement("input", {
639
+ key: element.value,
640
+ className: "rpgui-radio",
641
+ value: element.value,
642
+ name: name,
643
+ type: "radio"
644
+ }), React.createElement("label", {
645
+ onClick: handleClick
646
+ }, element.label), React.createElement("br", null));
647
+ }));
648
+ };
649
+
499
650
  var RangeSliderType;
500
651
 
501
652
  (function (RangeSliderType) {
@@ -531,12 +682,12 @@ var RangeSlider = function RangeSlider(_ref) {
531
682
  onChange(Number(value));
532
683
  };
533
684
 
534
- return React.createElement(RPGUIRoot, null, React.createElement("div", {
685
+ return React.createElement("div", {
535
686
  onMouseUp: onHandleMouseUp,
536
687
  onMouseDown: function onMouseDown() {
537
688
  return setWasMouseDownFirst(true);
538
689
  }
539
- }, React.createElement(Input, {
690
+ }, React.createElement(Input$1, {
540
691
  className: type === RangeSliderType.Slider ? RangeSliderType.Slider : RangeSliderType.GoldSlider,
541
692
  type: "range",
542
693
  style: {
@@ -545,12 +696,34 @@ var RangeSlider = function RangeSlider(_ref) {
545
696
  min: valueMin,
546
697
  max: valueMax,
547
698
  id: "rpgui-slider-" + sliderId
548
- })));
699
+ }));
549
700
  };
550
- var Input = /*#__PURE__*/styled.input.withConfig({
701
+ var Input$1 = /*#__PURE__*/styled.input.withConfig({
551
702
  displayName: "RangeSlider__Input",
552
703
  componentId: "sc-v8mte9-0"
553
704
  })(["opacity:0;"]);
554
705
 
555
- export { Button, DynamicText, IButtonTypes, ListMenu, NPCDialog, NPCDialogType, QuestionDialog, RPGUIContainer, RPGUIContainerTypes, RPGUIRoot, RangeSlider, RangeSliderType, _RPGUI, useEventListener };
706
+ var TextArea = function TextArea(_ref) {
707
+ var props = _extends({}, _ref);
708
+
709
+ return React.createElement("textarea", Object.assign({}, props));
710
+ };
711
+
712
+ /* eslint-disable react/require-default-props */
713
+ var Truncate = function Truncate(_ref) {
714
+ var _ref$maxLines = _ref.maxLines,
715
+ maxLines = _ref$maxLines === void 0 ? 1 : _ref$maxLines,
716
+ children = _ref.children;
717
+ return React.createElement(Container$5, {
718
+ maxLines: maxLines
719
+ }, children);
720
+ };
721
+ var Container$5 = /*#__PURE__*/styled.div.withConfig({
722
+ displayName: "Truncate__Container",
723
+ componentId: "sc-6x00qb-0"
724
+ })(["display:-webkit-box;max-width:100%;max-height:100%;-webkit-line-clamp:", ";-webkit-box-orient:vertical;overflow:hidden;"], function (props) {
725
+ return props.maxLines;
726
+ });
727
+
728
+ export { Button, ButtonTypes, CheckButton, Dropdown, DynamicText, Input, InputRadio, ListMenu, NPCDialog, NPCDialogType, QuestionDialog, RPGUIContainer, RPGUIContainerTypes, RPGUIRoot, RangeSlider, RangeSliderType, TextArea, Truncate, _RPGUI, useEventListener };
556
729
  //# sourceMappingURL=long-bow.esm.js.map