@cuemath/leap 3.0.3 → 3.0.4-as1

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,30 +1,35 @@
1
- import { jsx as r, jsxs as h } from "react/jsx-runtime";
2
- import { memo as c, useCallback as _ } from "react";
3
- import b from "../../../../../../ui/arrow-tooltip/arrow-tooltip.js";
4
- import u from "../../../../../../ui/image/image.js";
5
- import $ from "../../../../../../ui/layout/flex-view.js";
6
- import { ChapterItemWrapper as g, StyledText as f } from "./chapter-item-styled.js";
7
- const k = c(({ chapter: l, selected: t, onChapterSelection: o }) => {
1
+ import { jsx as r, jsxs as b } from "react/jsx-runtime";
2
+ import { memo as $, useCallback as T } from "react";
3
+ import { NODE_TYPE as l } from "../../../../../../sheets/constants/sheet.js";
4
+ import u from "../../../../../../ui/arrow-tooltip/arrow-tooltip.js";
5
+ import f from "../../../../../../ui/image/image.js";
6
+ import C from "../../../../../../ui/layout/flex-view.js";
7
+ import { ChapterItemWrapper as E, StyledText as g } from "./chapter-item-styled.js";
8
+ const y = $(({ chapter: m, selected: t, onChapterSelection: o }) => {
8
9
  const {
9
- image_url: d,
10
- name: a,
11
- id: n,
12
- sheets_data: m,
13
- item_bank_enabled: s
14
- } = l, { test: i } = m.supplementary_sheets_grouped, e = !s && !(i != null && i.length), p = _(() => {
10
+ image_url: s,
11
+ name: i,
12
+ id: a,
13
+ blocks: d,
14
+ item_bank_enabled: p
15
+ } = m, h = d.some(
16
+ (_) => _.sheets.some(
17
+ (n) => n.node_type === l.ASSESSMENT || n.node_type === l.CHAPTER_ASSESSMENT
18
+ )
19
+ ), e = !p && !h, c = T(() => {
15
20
  if (e) return null;
16
- o(n);
17
- }, [o, n, e]);
21
+ o(a);
22
+ }, [o, a, e]);
18
23
  return /* @__PURE__ */ r(
19
- b,
24
+ u,
20
25
  {
21
26
  position: "bottom",
22
27
  renderAs: "primary",
23
28
  tooltipItem: "Chapter unavailable for test creation",
24
29
  hidden: !e,
25
30
  widthX: 9.5,
26
- children: /* @__PURE__ */ h(
27
- g,
31
+ children: /* @__PURE__ */ b(
32
+ E,
28
33
  {
29
34
  $widthX: 9.5,
30
35
  $heightX: 8.875,
@@ -36,13 +41,13 @@ const k = c(({ chapter: l, selected: t, onChapterSelection: o }) => {
36
41
  $disabled: e,
37
42
  $borderColor: t ? "BLACK_T_87" : "WHITE_5",
38
43
  $background: t ? "WHITE_3" : "WHITE_1",
39
- onClick: p,
44
+ onClick: c,
40
45
  children: [
41
- /* @__PURE__ */ r($, { $position: "relative", children: /* @__PURE__ */ r(
42
- u,
46
+ /* @__PURE__ */ r(C, { $position: "relative", children: /* @__PURE__ */ r(
47
+ f,
43
48
  {
44
- src: d || "",
45
- alt: a,
49
+ src: s || "",
50
+ alt: i,
46
51
  withLoader: !0,
47
52
  width: 56,
48
53
  height: 56,
@@ -50,12 +55,12 @@ const k = c(({ chapter: l, selected: t, onChapterSelection: o }) => {
50
55
  }
51
56
  ) }),
52
57
  /* @__PURE__ */ r(
53
- f,
58
+ g,
54
59
  {
55
60
  $renderAs: t ? "ab3-bold" : "ab3",
56
61
  $align: "center",
57
62
  $color: e ? "BLACK_T_38" : "BLACK_T_87",
58
- children: a
63
+ children: i
59
64
  }
60
65
  )
61
66
  ]
@@ -65,6 +70,6 @@ const k = c(({ chapter: l, selected: t, onChapterSelection: o }) => {
65
70
  );
66
71
  });
67
72
  export {
68
- k as default
73
+ y as default
69
74
  };
70
75
  //# sourceMappingURL=chapter-item.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"chapter-item.js","sources":["../../../../../../../../src/features/milestone/milestone-tests/tests-creation/test-stages/chapter-selection/chapter-item/chapter-item.tsx"],"sourcesContent":["import type { IChapterItem } from './chapter-item-types';\nimport type { FC } from 'react';\n\nimport { useCallback, memo } from 'react';\n\nimport ArrowTooltip from '../../../../../../ui/arrow-tooltip/arrow-tooltip';\nimport Image from '../../../../../../ui/image/image';\nimport FlexView from '../../../../../../ui/layout/flex-view';\nimport * as Styled from './chapter-item-styled';\n\nconst ChapterItem: FC<IChapterItem> = memo(({ chapter, selected, onChapterSelection }) => {\n const {\n image_url: imageUrl,\n name,\n id: userChapterId,\n sheets_data: sheetData,\n item_bank_enabled: itemBankEnabled,\n } = chapter;\n const { test } = sheetData.supplementary_sheets_grouped;\n\n const isDisabled = !itemBankEnabled && !test?.length;\n\n const handleOnChapterSelection = useCallback(() => {\n if (isDisabled) return null;\n\n onChapterSelection(userChapterId);\n }, [onChapterSelection, userChapterId, isDisabled]);\n\n return (\n <ArrowTooltip\n position=\"bottom\"\n renderAs=\"primary\"\n tooltipItem=\"Chapter unavailable for test creation\"\n hidden={!isDisabled}\n widthX={9.5}\n >\n <Styled.ChapterItemWrapper\n $widthX={9.5}\n $heightX={8.875}\n $gapX={1}\n $gutterX={1}\n $flexGap={12}\n $position=\"relative\"\n $alignItems=\"center\"\n $disabled={isDisabled}\n $borderColor={selected ? 'BLACK_T_87' : 'WHITE_5'}\n $background={selected ? 'WHITE_3' : 'WHITE_1'}\n onClick={handleOnChapterSelection}\n >\n <FlexView $position=\"relative\">\n <Image\n src={imageUrl || ''}\n alt={name}\n withLoader\n width={56}\n height={56}\n borderRadius={50}\n />\n </FlexView>\n <Styled.StyledText\n $renderAs={selected ? 'ab3-bold' : 'ab3'}\n $align=\"center\"\n $color={isDisabled ? 'BLACK_T_38' : 'BLACK_T_87'}\n >\n {name}\n </Styled.StyledText>\n </Styled.ChapterItemWrapper>\n </ArrowTooltip>\n );\n});\n\nexport default ChapterItem;\n"],"names":["ChapterItem","memo","chapter","selected","onChapterSelection","imageUrl","name","userChapterId","sheetData","itemBankEnabled","test","isDisabled","handleOnChapterSelection","useCallback","jsx","ArrowTooltip","jsxs","Styled.ChapterItemWrapper","FlexView","Image","Styled.StyledText"],"mappings":";;;;;;AAUA,MAAMA,IAAgCC,EAAK,CAAC,EAAE,SAAAC,GAAS,UAAAC,GAAU,oBAAAC,QAAyB;AAClF,QAAA;AAAA,IAC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AAGN,CAAC;"}
1
+ {"version":3,"file":"chapter-item.js","sources":["../../../../../../../../src/features/milestone/milestone-tests/tests-creation/test-stages/chapter-selection/chapter-item/chapter-item.tsx"],"sourcesContent":["import type { IChapterItem } from './chapter-item-types';\nimport type { FC } from 'react';\n\nimport { useCallback, memo } from 'react';\n\nimport { NODE_TYPE } from '../../../../../../sheets/constants/sheet';\nimport ArrowTooltip from '../../../../../../ui/arrow-tooltip/arrow-tooltip';\nimport Image from '../../../../../../ui/image/image';\nimport FlexView from '../../../../../../ui/layout/flex-view';\nimport * as Styled from './chapter-item-styled';\n\nconst ChapterItem: FC<IChapterItem> = memo(({ chapter, selected, onChapterSelection }) => {\n const {\n image_url: imageUrl,\n name,\n id: userChapterId,\n blocks,\n item_bank_enabled: itemBankEnabled,\n } = chapter;\n const hasTestSheets = blocks.some(block =>\n block.sheets.some(\n sheet =>\n sheet.node_type === NODE_TYPE.ASSESSMENT ||\n sheet.node_type === NODE_TYPE.CHAPTER_ASSESSMENT,\n ),\n );\n\n const isDisabled = !itemBankEnabled && !hasTestSheets;\n\n const handleOnChapterSelection = useCallback(() => {\n if (isDisabled) return null;\n\n onChapterSelection(userChapterId);\n }, [onChapterSelection, userChapterId, isDisabled]);\n\n return (\n <ArrowTooltip\n position=\"bottom\"\n renderAs=\"primary\"\n tooltipItem=\"Chapter unavailable for test creation\"\n hidden={!isDisabled}\n widthX={9.5}\n >\n <Styled.ChapterItemWrapper\n $widthX={9.5}\n $heightX={8.875}\n $gapX={1}\n $gutterX={1}\n $flexGap={12}\n $position=\"relative\"\n $alignItems=\"center\"\n $disabled={isDisabled}\n $borderColor={selected ? 'BLACK_T_87' : 'WHITE_5'}\n $background={selected ? 'WHITE_3' : 'WHITE_1'}\n onClick={handleOnChapterSelection}\n >\n <FlexView $position=\"relative\">\n <Image\n src={imageUrl || ''}\n alt={name}\n withLoader\n width={56}\n height={56}\n borderRadius={50}\n />\n </FlexView>\n <Styled.StyledText\n $renderAs={selected ? 'ab3-bold' : 'ab3'}\n $align=\"center\"\n $color={isDisabled ? 'BLACK_T_38' : 'BLACK_T_87'}\n >\n {name}\n </Styled.StyledText>\n </Styled.ChapterItemWrapper>\n </ArrowTooltip>\n );\n});\n\nexport default ChapterItem;\n"],"names":["ChapterItem","memo","chapter","selected","onChapterSelection","imageUrl","name","userChapterId","blocks","itemBankEnabled","hasTestSheets","block","sheet","NODE_TYPE","isDisabled","handleOnChapterSelection","useCallback","jsx","ArrowTooltip","jsxs","Styled.ChapterItemWrapper","FlexView","Image","Styled.StyledText"],"mappings":";;;;;;;AAWA,MAAMA,IAAgCC,EAAK,CAAC,EAAE,SAAAC,GAAS,UAAAC,GAAU,oBAAAC,QAAyB;AAClF,QAAA;AAAA,IACJ,WAAWC;AAAA,IACX,MAAAC;AAAA,IACA,IAAIC;AAAA,IACJ,QAAAC;AAAA,IACA,mBAAmBC;AAAA,EACjB,IAAAP,GACEQ,IAAgBF,EAAO;AAAA,IAAK,CAAAG,MAChCA,EAAM,OAAO;AAAA,MACX,OACEC,EAAM,cAAcC,EAAU,cAC9BD,EAAM,cAAcC,EAAU;AAAA,IAClC;AAAA,EAAA,GAGIC,IAAa,CAACL,KAAmB,CAACC,GAElCK,IAA2BC,EAAY,MAAM;AACjD,QAAIF,EAAmB,QAAA;AAEvB,IAAAV,EAAmBG,CAAa;AAAA,EAC/B,GAAA,CAACH,GAAoBG,GAAeO,CAAU,CAAC;AAGhD,SAAA,gBAAAG;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,UAAS;AAAA,MACT,UAAS;AAAA,MACT,aAAY;AAAA,MACZ,QAAQ,CAACJ;AAAA,MACT,QAAQ;AAAA,MAER,UAAA,gBAAAK;AAAA,QAACC;AAAAA,QAAA;AAAA,UACC,SAAS;AAAA,UACT,UAAU;AAAA,UACV,OAAO;AAAA,UACP,UAAU;AAAA,UACV,UAAU;AAAA,UACV,WAAU;AAAA,UACV,aAAY;AAAA,UACZ,WAAWN;AAAA,UACX,cAAcX,IAAW,eAAe;AAAA,UACxC,aAAaA,IAAW,YAAY;AAAA,UACpC,SAASY;AAAA,UAET,UAAA;AAAA,YAAC,gBAAAE,EAAAI,GAAA,EAAS,WAAU,YAClB,UAAA,gBAAAJ;AAAA,cAACK;AAAA,cAAA;AAAA,gBACC,KAAKjB,KAAY;AAAA,gBACjB,KAAKC;AAAA,gBACL,YAAU;AAAA,gBACV,OAAO;AAAA,gBACP,QAAQ;AAAA,gBACR,cAAc;AAAA,cAAA;AAAA,YAAA,GAElB;AAAA,YACA,gBAAAW;AAAA,cAACM;AAAAA,cAAA;AAAA,gBACC,WAAWpB,IAAW,aAAa;AAAA,gBACnC,QAAO;AAAA,gBACP,QAAQW,IAAa,eAAe;AAAA,gBAEnC,UAAAR;AAAA,cAAA;AAAA,YACH;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAAA;AAGN,CAAC;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cuemath/leap",
3
- "version": "3.0.3",
3
+ "version": "3.0.4-as1",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"