@cuemath/leap 3.1.7-aa2 → 3.1.7-aa4
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,16 +1,17 @@
|
|
1
1
|
import { jsx as r } from "react/jsx-runtime";
|
2
|
-
import { memo as $, useCallback as d, useMemo as
|
3
|
-
import
|
2
|
+
import { memo as $, useCallback as d, useMemo as h } from "react";
|
3
|
+
import f from "../../ui/buttons/clickable/clickable.js";
|
4
4
|
import l from "../../ui/layout/flex-view.js";
|
5
|
-
import { getColorsForUser as
|
6
|
-
import { ColorPicker as
|
7
|
-
|
8
|
-
|
5
|
+
import { getColorsForUser as p } from "../cue-canvas-helpers.js";
|
6
|
+
import { ColorPicker as u, StyledCheckIcon as g } from "../cue-cavas-styled.js";
|
7
|
+
import { useCueCanvasActions as k } from "../hooks/use-cue-canvas-actions.js";
|
8
|
+
const j = $((c) => {
|
9
|
+
const { activeInstance: t } = k(), { setActiveColor: i, activeColor: n, userType: s, renderAs: o } = c, a = d(
|
9
10
|
(e) => {
|
10
|
-
t(e);
|
11
|
+
i(e), t == null || t.setColor(e);
|
11
12
|
},
|
12
|
-
[t]
|
13
|
-
),
|
13
|
+
[t, i]
|
14
|
+
), m = h(() => p(s, o), [s, o]);
|
14
15
|
return /* @__PURE__ */ r(
|
15
16
|
l,
|
16
17
|
{
|
@@ -18,10 +19,10 @@ const y = $((c) => {
|
|
18
19
|
$flexWrap: !0,
|
19
20
|
$width: o === "canvas" ? 66 : 200,
|
20
21
|
$position: "relative",
|
21
|
-
children:
|
22
|
-
|
22
|
+
children: m.map((e, C) => /* @__PURE__ */ r(
|
23
|
+
f,
|
23
24
|
{
|
24
|
-
onClick: () =>
|
25
|
+
onClick: () => a(e),
|
25
26
|
label: `Color Picker - ${e}`,
|
26
27
|
children: /* @__PURE__ */ r(
|
27
28
|
l,
|
@@ -30,10 +31,10 @@ const y = $((c) => {
|
|
30
31
|
$height: 22,
|
31
32
|
$borderRadius: 11,
|
32
33
|
$justifyContent: "center",
|
33
|
-
$background:
|
34
|
+
$background: n === e ? "BLACK" : "WHITE",
|
34
35
|
$alignItems: "center",
|
35
36
|
children: /* @__PURE__ */ r(
|
36
|
-
|
37
|
+
u,
|
37
38
|
{
|
38
39
|
$width: 20,
|
39
40
|
$height: 20,
|
@@ -41,18 +42,18 @@ const y = $((c) => {
|
|
41
42
|
$color: e,
|
42
43
|
$alignItems: "center",
|
43
44
|
$justifyContent: "center",
|
44
|
-
children:
|
45
|
+
children: n === e && /* @__PURE__ */ r(g, {})
|
45
46
|
}
|
46
47
|
)
|
47
48
|
}
|
48
49
|
)
|
49
50
|
},
|
50
|
-
|
51
|
+
C
|
51
52
|
))
|
52
53
|
}
|
53
54
|
);
|
54
55
|
});
|
55
56
|
export {
|
56
|
-
|
57
|
+
j as default
|
57
58
|
};
|
58
59
|
//# sourceMappingURL=color-palette.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"color-palette.js","sources":["../../../../src/features/cue-canvas/toolbar/color-palette.tsx"],"sourcesContent":["import type { TUserTypes } from '../../ui/types';\nimport type { TCueCanvasColors, TRenderAs } from '../types/cue-canvas';\n\nimport { memo, useCallback, useMemo } from 'react';\n\nimport Clickable from '../../ui/buttons/clickable/clickable';\nimport FlexView from '../../ui/layout/flex-view';\nimport { getColorsForUser } from '../cue-canvas-helpers';\nimport { StyledCheckIcon, ColorPicker } from '../cue-cavas-styled';\n\ninterface IColorPalette {\n setActiveColor: (color: TCueCanvasColors) => void;\n activeColor: TCueCanvasColors;\n userType: TUserTypes;\n renderAs: TRenderAs;\n}\n\nconst ColorPalette: React.FC<IColorPalette> = memo(props => {\n const { setActiveColor, activeColor, userType, renderAs } = props;\n const handleColorChange = useCallback(\n (color: TCueCanvasColors) => {\n setActiveColor(color);\n },\n [setActiveColor],\n );\n const colors = useMemo(() => getColorsForUser(userType, renderAs), [userType, renderAs]);\n\n return (\n <FlexView\n $flexDirection=\"row\"\n $flexWrap\n $width={renderAs === 'canvas' ? 66 : 200}\n $position=\"relative\"\n >\n {colors.map((color, index) => (\n <Clickable\n key={index}\n onClick={() => handleColorChange(color)}\n label={`Color Picker - ${color}`}\n >\n <FlexView\n $width={22}\n $height={22}\n $borderRadius={11}\n $justifyContent=\"center\"\n $background={activeColor === color ? 'BLACK' : 'WHITE'}\n $alignItems=\"center\"\n >\n <ColorPicker\n $width={20}\n $height={20}\n $borderRadius={10}\n $color={color}\n $alignItems=\"center\"\n $justifyContent=\"center\"\n >\n {activeColor === color && <StyledCheckIcon />}\n </ColorPicker>\n </FlexView>\n </Clickable>\n ))}\n </FlexView>\n );\n});\n\nexport default ColorPalette;\n"],"names":["ColorPalette","memo","props","setActiveColor","activeColor","userType","renderAs","handleColorChange","useCallback","color","colors","useMemo","getColorsForUser","jsx","FlexView","index","Clickable","ColorPicker","StyledCheckIcon"],"mappings":"
|
1
|
+
{"version":3,"file":"color-palette.js","sources":["../../../../src/features/cue-canvas/toolbar/color-palette.tsx"],"sourcesContent":["import type { TUserTypes } from '../../ui/types';\nimport type { TCueCanvasColors, TRenderAs } from '../types/cue-canvas';\n\nimport { memo, useCallback, useMemo } from 'react';\n\nimport Clickable from '../../ui/buttons/clickable/clickable';\nimport FlexView from '../../ui/layout/flex-view';\nimport { getColorsForUser } from '../cue-canvas-helpers';\nimport { StyledCheckIcon, ColorPicker } from '../cue-cavas-styled';\nimport { useCueCanvasActions } from '../hooks/use-cue-canvas-actions';\n\ninterface IColorPalette {\n setActiveColor: (color: TCueCanvasColors) => void;\n activeColor: TCueCanvasColors;\n userType: TUserTypes;\n renderAs: TRenderAs;\n}\n\nconst ColorPalette: React.FC<IColorPalette> = memo(props => {\n const { activeInstance: cueCanvas } = useCueCanvasActions();\n const { setActiveColor, activeColor, userType, renderAs } = props;\n const handleColorChange = useCallback(\n (color: TCueCanvasColors) => {\n setActiveColor(color);\n cueCanvas?.setColor(color);\n },\n [cueCanvas, setActiveColor],\n );\n const colors = useMemo(() => getColorsForUser(userType, renderAs), [userType, renderAs]);\n\n return (\n <FlexView\n $flexDirection=\"row\"\n $flexWrap\n $width={renderAs === 'canvas' ? 66 : 200}\n $position=\"relative\"\n >\n {colors.map((color, index) => (\n <Clickable\n key={index}\n onClick={() => handleColorChange(color)}\n label={`Color Picker - ${color}`}\n >\n <FlexView\n $width={22}\n $height={22}\n $borderRadius={11}\n $justifyContent=\"center\"\n $background={activeColor === color ? 'BLACK' : 'WHITE'}\n $alignItems=\"center\"\n >\n <ColorPicker\n $width={20}\n $height={20}\n $borderRadius={10}\n $color={color}\n $alignItems=\"center\"\n $justifyContent=\"center\"\n >\n {activeColor === color && <StyledCheckIcon />}\n </ColorPicker>\n </FlexView>\n </Clickable>\n ))}\n </FlexView>\n );\n});\n\nexport default ColorPalette;\n"],"names":["ColorPalette","memo","props","cueCanvas","useCueCanvasActions","setActiveColor","activeColor","userType","renderAs","handleColorChange","useCallback","color","colors","useMemo","getColorsForUser","jsx","FlexView","index","Clickable","ColorPicker","StyledCheckIcon"],"mappings":";;;;;;;AAkBM,MAAAA,IAAwCC,EAAK,CAASC,MAAA;AAC1D,QAAM,EAAE,gBAAgBC,EAAU,IAAIC,EAAoB,GACpD,EAAE,gBAAAC,GAAgB,aAAAC,GAAa,UAAAC,GAAU,UAAAC,MAAaN,GACtDO,IAAoBC;AAAA,IACxB,CAACC,MAA4B;AAC3B,MAAAN,EAAeM,CAAK,GACpBR,KAAA,QAAAA,EAAW,SAASQ;AAAA,IACtB;AAAA,IACA,CAACR,GAAWE,CAAc;AAAA,EAAA,GAEtBO,IAASC,EAAQ,MAAMC,EAAiBP,GAAUC,CAAQ,GAAG,CAACD,GAAUC,CAAQ,CAAC;AAGrF,SAAA,gBAAAO;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,gBAAe;AAAA,MACf,WAAS;AAAA,MACT,QAAQR,MAAa,WAAW,KAAK;AAAA,MACrC,WAAU;AAAA,MAET,UAAOI,EAAA,IAAI,CAACD,GAAOM,MAClB,gB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