@lanaco/lnc-react-ui 4.0.37 → 4.0.38

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.
@@ -384,4 +384,4 @@
384
384
  display: none;
385
385
  }
386
386
  }
387
- `,te=i.forwardRef(({welcomeTitle:d,welcomeDescription:s,endTitle:m,endDescription:f,image:c,imageComponent:_,questions:r,secondsPerQuestion:E,numOfCredits:C,startQuizText:T="Start quiz",nextText:Q="Next",giveUpText:U="Give up",questionNoText:Z="Question",continueText:W="Continue",endQuizText:g="End quiz",onStartQuiz:N=()=>{},onSelectAnswer:x=()=>{},onGiveUp:I=()=>{},onNext:u=()=>{},onContinue:b=()=>{},onEndQuiz:w=()=>{}},a)=>{const[v,h]=i.useState(l.START_QUIZ),[o,y]=i.useState(1),[t,L]=i.useState(null),[j,R]=i.useState(null),O=i.useRef([]),D=i.useRef(0),M=()=>{h(l.QUIZ),L(r==null?void 0:r.find(n=>(n==null?void 0:n.questionNo)===o)),N==null||N()},P=n=>{R(n),x==null||x()},B=()=>{h(l.START_QUIZ),y(1),R(null),I==null||I()},X=()=>{let n=(j==null?void 0:j.uuid)===(t==null?void 0:t.correctAnswer);n?(h(l.CORRECT_ANSWER),D.current+=C||(t==null?void 0:t.numOfCredits)):o===(r==null?void 0:r.length)?(h(l.START_QUIZ),y(1),R(null)):(y(o+1),L(r==null?void 0:r.find($=>($==null?void 0:$.questionNo)===o+1)),R(null)),O.current=[...O.current,{question:t,selectedAnswer:j,isCorrect:n}],u==null||u()},F=()=>{o===(r==null?void 0:r.length)?(h(l.START_QUIZ),y(1)):(h(l.QUIZ),y(o+1),L(r==null?void 0:r.find(n=>(n==null?void 0:n.questionNo)===o+1))),R(null),b==null||b()},G=()=>{h(l.START_QUIZ),y(1),R(null),w==null||w()};return e.jsxs(re,{children:[e.jsxs("div",{className:"wrapper__outlet",children:[v===l.START_QUIZ&&e.jsx(Y,{title:d,description:s,startQuizText:T,onStartQuiz:M}),v===l.QUIZ&&t&&e.jsx(q,{questionNoText:Z,questionNo:o,totalQuestions:(r==null?void 0:r.length)||0,text:t==null?void 0:t.text,answers:t==null?void 0:t.answers,secondsPerQuestion:E||(t==null?void 0:t.secondsPerQuestion),selectedAnswer:j,nextText:Q,giveUpText:U,nextDisabled:!z.isDefined(j),onSelectAnswer:P,onGiveUp:B,onNext:X},`quiz-question__${o}`),v===l.CORRECT_ANSWER&&e.jsx(ee,{title:m,description:z.formatString(f,C||(t==null?void 0:t.numOfCredits)),continueText:W,endQuizText:g,onContinue:F,onEndQuiz:G})]}),z.isDefined(_)?_:e.jsx("img",{src:c,className:"wrapper__image"})]})});module.exports=te;
387
+ `,te=i.forwardRef(({welcomeTitle:d,welcomeDescription:s,endTitle:m,endDescription:f,image:c,imageComponent:_,questions:r,secondsPerQuestion:E,numOfCredits:C,startQuizText:T="Start quiz",nextText:Q="Next",giveUpText:U="Give up",questionNoText:Z="Question",continueText:W="Continue",endQuizText:g="End quiz",onStartQuiz:N=()=>{},onSelectAnswer:x=()=>{},onGiveUp:I=()=>{},onNext:u=()=>{},onContinue:b=()=>{},onEndQuiz:w=()=>{}},a)=>{const[v,h]=i.useState(l.START_QUIZ),[o,y]=i.useState(1),[t,L]=i.useState(null),[j,R]=i.useState(null),O=i.useRef([]),D=i.useRef(0),M=()=>{h(l.QUIZ),L(r==null?void 0:r.find(n=>(n==null?void 0:n.questionNo)===o)),N==null||N()},P=n=>{R(n),x==null||x()},B=()=>{h(l.START_QUIZ),y(1),R(null),I==null||I()},X=()=>{let n=(j==null?void 0:j.uuid)===(t==null?void 0:t.correctAnswer);n?(h(l.CORRECT_ANSWER),D.current+=C||(t==null?void 0:t.numOfCredits)):o===(r==null?void 0:r.length)?(h(l.START_QUIZ),y(1),R(null)):(y(o+1),L(r==null?void 0:r.find($=>($==null?void 0:$.questionNo)===o+1)),R(null)),O.current=[...O.current,{question:t,selectedAnswer:j,isCorrect:n}],u==null||u()},F=()=>{o===(r==null?void 0:r.length)?(h(l.START_QUIZ),y(1)):(h(l.QUIZ),y(o+1),L(r==null?void 0:r.find(n=>(n==null?void 0:n.questionNo)===o+1))),R(null),b==null||b()},G=()=>{h(l.START_QUIZ),y(1),R(null),w==null||w()};return e.jsxs(re,{ref:a,children:[e.jsxs("div",{className:"wrapper__outlet",children:[v===l.START_QUIZ&&e.jsx(Y,{title:d,description:s,startQuizText:T,onStartQuiz:M}),v===l.QUIZ&&t&&e.jsx(q,{questionNoText:Z,questionNo:o,totalQuestions:(r==null?void 0:r.length)||0,text:t==null?void 0:t.text,answers:t==null?void 0:t.answers,secondsPerQuestion:E||(t==null?void 0:t.secondsPerQuestion),selectedAnswer:j,nextText:Q,giveUpText:U,nextDisabled:!z.isDefined(j),onSelectAnswer:P,onGiveUp:B,onNext:X},`quiz-question__${o}`),v===l.CORRECT_ANSWER&&e.jsx(ee,{title:m,description:z.formatString(f,C||(t==null?void 0:t.numOfCredits)),continueText:W,endQuizText:g,onContinue:F,onEndQuiz:G})]}),z.isDefined(_)?_:e.jsx("img",{src:c,className:"wrapper__image"})]})});module.exports=te;
@@ -1,4 +1,4 @@
1
- import { jsxs as a, jsx as e } from "react/jsx-runtime";
1
+ import { jsxs as i, jsx as e } from "react/jsx-runtime";
2
2
  import { forwardRef as T, useState as b, useRef as D, useEffect as q } from "react";
3
3
  import { p as ee, l as B, q as re } from "./utils-DtRLzzTZ.js";
4
4
  import R from "./Button.js";
@@ -367,8 +367,8 @@ const ae = Q.div`
367
367
  startQuizText: d = "Start quiz",
368
368
  onStartQuiz: _ = () => {
369
369
  }
370
- }, o) => /* @__PURE__ */ a(ae, { children: [
371
- /* @__PURE__ */ a("div", { className: "wrapper__content", children: [
370
+ }, o) => /* @__PURE__ */ i(ae, { children: [
371
+ /* @__PURE__ */ i("div", { className: "wrapper__content", children: [
372
372
  /* @__PURE__ */ e("div", { className: "wrapper__title", children: s }),
373
373
  /* @__PURE__ */ e("div", { className: "wrapper__description", children: c })
374
374
  ] }),
@@ -403,12 +403,12 @@ const ae = Q.div`
403
403
  }, O) => {
404
404
  const [f, k] = b(r), [h, I] = b(!0), u = D(null);
405
405
  q(() => (h && f > 0 && (u.current = setInterval(() => {
406
- k((i) => i > 0 ? i - 1 : 0);
406
+ k((a) => a > 0 ? a - 1 : 0);
407
407
  }, 1e3)), () => clearInterval(u.current)), [h, f]);
408
- const z = f > 0 ? f / r * L : 0, w = (i) => (m == null ? void 0 : m.uuid) === i;
409
- return /* @__PURE__ */ a(ie, { children: [
410
- /* @__PURE__ */ a("div", { className: "wrapper__headline", children: [
411
- /* @__PURE__ */ a("div", { className: "wrapper__question-no", children: [
408
+ const z = f > 0 ? f / r * L : 0, w = (a) => (m == null ? void 0 : m.uuid) === a;
409
+ return /* @__PURE__ */ i(ie, { children: [
410
+ /* @__PURE__ */ i("div", { className: "wrapper__headline", children: [
411
+ /* @__PURE__ */ i("div", { className: "wrapper__question-no", children: [
412
412
  /* @__PURE__ */ e("div", { className: "question-no__text", children: `${s} ${c} / ${d}` }),
413
413
  /* @__PURE__ */ e(
414
414
  te,
@@ -418,8 +418,8 @@ const ae = Q.div`
418
418
  }
419
419
  )
420
420
  ] }),
421
- /* @__PURE__ */ a("div", { className: "wrapper__timer", children: [
422
- /* @__PURE__ */ a("svg", { className: "timer__ring", width: "60", height: "60", children: [
421
+ /* @__PURE__ */ i("div", { className: "wrapper__timer", children: [
422
+ /* @__PURE__ */ i("svg", { className: "timer__ring", width: "60", height: "60", children: [
423
423
  /* @__PURE__ */ e(
424
424
  "circle",
425
425
  {
@@ -452,17 +452,17 @@ const ae = Q.div`
452
452
  /* @__PURE__ */ e("div", { className: "timer__display", children: /* @__PURE__ */ e("span", { className: "timer__text", children: ee(f) }) })
453
453
  ] })
454
454
  ] }),
455
- /* @__PURE__ */ a("div", { className: "wrapper__content", children: [
456
- /* @__PURE__ */ a("div", { className: "wrapper__item", children: [
455
+ /* @__PURE__ */ i("div", { className: "wrapper__content", children: [
456
+ /* @__PURE__ */ i("div", { className: "wrapper__item", children: [
457
457
  /* @__PURE__ */ e("div", { className: "wrapper__text", children: _ }),
458
- /* @__PURE__ */ e("div", { className: "wrapper__answers", children: o && (o == null ? void 0 : o.map((i, x) => /* @__PURE__ */ a(
458
+ /* @__PURE__ */ e("div", { className: "wrapper__answers", children: o && (o == null ? void 0 : o.map((a, x) => /* @__PURE__ */ i(
459
459
  "div",
460
460
  {
461
- className: `wrapper__answer ${w(i == null ? void 0 : i.uuid) ? "active" : ""}`,
462
- onClick: () => Z(i),
461
+ className: `wrapper__answer ${w(a == null ? void 0 : a.uuid) ? "active" : ""}`,
462
+ onClick: () => Z(a),
463
463
  children: [
464
- `${String.fromCharCode(65 + x)}: ${i == null ? void 0 : i.label}`,
465
- w(i == null ? void 0 : i.uuid) && /* @__PURE__ */ e(
464
+ `${String.fromCharCode(65 + x)}: ${a == null ? void 0 : a.label}`,
465
+ w(a == null ? void 0 : a.uuid) && /* @__PURE__ */ e(
466
466
  F,
467
467
  {
468
468
  icon: " mng-lnc-checkmark--filled",
@@ -475,7 +475,7 @@ const ae = Q.div`
475
475
  `quiz-answer__${x + 1}`
476
476
  ))) })
477
477
  ] }),
478
- /* @__PURE__ */ a("div", { className: "wrapper__actions", children: [
478
+ /* @__PURE__ */ i("div", { className: "wrapper__actions", children: [
479
479
  /* @__PURE__ */ e(
480
480
  R,
481
481
  {
@@ -511,8 +511,8 @@ const ae = Q.div`
511
511
  },
512
512
  onEndQuiz: m = () => {
513
513
  }
514
- }, r) => /* @__PURE__ */ a(ne, { children: [
515
- /* @__PURE__ */ a("div", { className: "wrapper__content", children: [
514
+ }, r) => /* @__PURE__ */ i(ne, { children: [
515
+ /* @__PURE__ */ i("div", { className: "wrapper__content", children: [
516
516
  /* @__PURE__ */ e(
517
517
  F,
518
518
  {
@@ -522,12 +522,12 @@ const ae = Q.div`
522
522
  className: "wrapper__icon"
523
523
  }
524
524
  ),
525
- /* @__PURE__ */ a("div", { className: "wrapper__info", children: [
525
+ /* @__PURE__ */ i("div", { className: "wrapper__info", children: [
526
526
  s && /* @__PURE__ */ e("div", { className: "wrapper__title", children: s }),
527
527
  c && /* @__PURE__ */ e("div", { className: "wrapper__description", children: c })
528
528
  ] })
529
529
  ] }),
530
- /* @__PURE__ */ a("div", { className: "wrapper__actions", children: [
530
+ /* @__PURE__ */ i("div", { className: "wrapper__actions", children: [
531
531
  /* @__PURE__ */ e(
532
532
  R,
533
533
  {
@@ -615,7 +615,7 @@ const ae = Q.div`
615
615
  },
616
616
  onEndQuiz: w = () => {
617
617
  }
618
- }, i) => {
618
+ }, a) => {
619
619
  const [x, g] = b(l.START_QUIZ), [p, v] = b(1), [t, j] = b(null), [y, N] = b(null), P = D([]), X = D(0), G = () => {
620
620
  g(l.QUIZ), j(
621
621
  r == null ? void 0 : r.find((n) => (n == null ? void 0 : n.questionNo) === p)
@@ -643,8 +643,8 @@ const ae = Q.div`
643
643
  }, Y = () => {
644
644
  g(l.START_QUIZ), v(1), N(null), w == null || w();
645
645
  };
646
- return /* @__PURE__ */ a(pe, { children: [
647
- /* @__PURE__ */ a("div", { className: "wrapper__outlet", children: [
646
+ return /* @__PURE__ */ i(pe, { ref: a, children: [
647
+ /* @__PURE__ */ i("div", { className: "wrapper__outlet", children: [
648
648
  x === l.START_QUIZ && /* @__PURE__ */ e(
649
649
  le,
650
650
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lanaco/lnc-react-ui",
3
- "version": "4.0.37",
3
+ "version": "4.0.38",
4
4
  "description": "React component library",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -139,7 +139,7 @@
139
139
  "./FieldOfInterestsWithAvatarsCardsSection": "./dist/FieldOfInterestsWithAvatarsCardsSection.js",
140
140
  "./FieldOfInterestsWithTagsCardsSection": "./dist/FieldOfInterestsWithTagsCardsSection.js",
141
141
  "./GeneralWithTagsCardsSection": "./dist/GeneralWithTagsCardsSection.js",
142
- "./QuizSection": "./dist/QuizSection.jsx",
142
+ "./QuizSection": "./dist/QuizSection.js",
143
143
  "./OverlayGeneralCardsSection": "./dist/OverlayGeneralCardsSection.js",
144
144
  "./ShopCardsSection": "./dist/ShopCardsSection.js",
145
145
  "./LocationSearchSection": "./dist/LocationSearchSection.js",