@pie-element/categorize 13.4.0-beta.6 → 14.0.0-next.20261002094057

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.
Files changed (215) hide show
  1. package/author.js +2 -0
  2. package/configure.js +2 -0
  3. package/controller.js +1 -0
  4. package/dist/author/defaults.d.ts +222 -0
  5. package/dist/author/defaults.js +168 -0
  6. package/dist/author/design/builder.d.ts +10 -0
  7. package/dist/author/design/builder.js +24 -0
  8. package/dist/author/design/buttons.d.ts +28 -0
  9. package/dist/author/design/buttons.js +36 -0
  10. package/dist/author/design/categories/RowLabel.d.ts +23 -0
  11. package/dist/author/design/categories/RowLabel.js +47 -0
  12. package/dist/author/design/categories/alternateResponses.d.ts +31 -0
  13. package/dist/author/design/categories/alternateResponses.js +62 -0
  14. package/dist/author/design/categories/category.d.ts +44 -0
  15. package/dist/author/design/categories/category.js +98 -0
  16. package/dist/author/design/categories/choice-preview.d.ts +25 -0
  17. package/dist/author/design/categories/choice-preview.js +60 -0
  18. package/dist/author/design/categories/droppable-placeholder.d.ts +11 -0
  19. package/dist/author/design/categories/droppable-placeholder.js +71 -0
  20. package/dist/author/design/categories/index.d.ts +41 -0
  21. package/dist/author/design/categories/index.js +146 -0
  22. package/dist/author/design/choices/choice.d.ts +11 -0
  23. package/dist/author/design/choices/choice.js +129 -0
  24. package/dist/author/design/choices/config.d.ts +21 -0
  25. package/dist/author/design/choices/config.js +33 -0
  26. package/dist/author/design/choices/index.d.ts +41 -0
  27. package/dist/author/design/choices/index.js +110 -0
  28. package/dist/author/design/header.d.ts +24 -0
  29. package/dist/author/design/header.js +49 -0
  30. package/dist/author/design/index.d.ts +52 -0
  31. package/dist/author/design/index.js +427 -0
  32. package/dist/author/design/input-header.d.ts +39 -0
  33. package/dist/author/design/input-header.js +69 -0
  34. package/dist/author/design/utils.d.ts +9 -0
  35. package/dist/author/design/utils.js +7 -0
  36. package/dist/author/index.d.ts +50 -0
  37. package/dist/author/index.js +87 -0
  38. package/dist/author/main.d.ts +23 -0
  39. package/dist/author/main.js +30 -0
  40. package/dist/author/utils.d.ts +16 -0
  41. package/dist/author/utils.js +17 -0
  42. package/dist/browser/alert-dialog-DjezK_ch.js +11690 -0
  43. package/dist/browser/alert-dialog-DjezK_ch.js.map +1 -0
  44. package/dist/browser/assets/Symbola-4c507403.woff2 +0 -0
  45. package/dist/browser/author/index.js +35706 -0
  46. package/dist/browser/author/index.js.map +1 -0
  47. package/dist/browser/controller/index.js +372 -0
  48. package/dist/browser/controller/index.js.map +1 -0
  49. package/dist/browser/delivery/index.js +1220 -0
  50. package/dist/browser/delivery/index.js.map +1 -0
  51. package/dist/browser/dist-Denz71xw.js +1973 -0
  52. package/dist/browser/dist-Denz71xw.js.map +1 -0
  53. package/dist/browser/editor-runtime/alert-dialog-DegUZr32.js +11690 -0
  54. package/dist/browser/editor-runtime/alert-dialog-DegUZr32.js.map +1 -0
  55. package/dist/browser/editor-runtime/assets/Symbola-4c507403.woff2 +0 -0
  56. package/dist/browser/editor-runtime/author/index.js +19297 -0
  57. package/dist/browser/editor-runtime/author/index.js.map +1 -0
  58. package/dist/browser/editor-runtime/controller/index.js +372 -0
  59. package/dist/browser/editor-runtime/controller/index.js.map +1 -0
  60. package/dist/browser/editor-runtime/delivery/index.js +1220 -0
  61. package/dist/browser/editor-runtime/delivery/index.js.map +1 -0
  62. package/dist/browser/editor-runtime/dist-BiRlv37L.js +1973 -0
  63. package/dist/browser/editor-runtime/dist-BiRlv37L.js.map +1 -0
  64. package/dist/browser/editor-runtime/rolldown-runtime-CHQKHQ89.js +32 -0
  65. package/dist/browser/rolldown-runtime-CWhphoD1.js +32 -0
  66. package/dist/controller/defaults.d.ts +33 -0
  67. package/dist/controller/defaults.js +27 -0
  68. package/dist/controller/index.d.ts +62 -0
  69. package/dist/controller/index.js +168 -0
  70. package/dist/controller/utils.d.ts +20 -0
  71. package/dist/controller/utils.js +35 -0
  72. package/dist/delivery/categorize/__tests__/categories.test.d.ts +1 -0
  73. package/dist/delivery/categorize/__tests__/category.test.d.ts +1 -0
  74. package/dist/delivery/categorize/__tests__/choice.test.d.ts +1 -0
  75. package/dist/delivery/categorize/__tests__/choices.test.d.ts +1 -0
  76. package/dist/delivery/categorize/__tests__/droppable-placeholder.test.d.ts +1 -0
  77. package/dist/delivery/categorize/__tests__/grid-content.test.d.ts +1 -0
  78. package/dist/delivery/categorize/__tests__/index.test.d.ts +1 -0
  79. package/dist/delivery/categorize/__tests__/keyboard-coordinates.test.d.ts +1 -0
  80. package/dist/delivery/categorize/categories.d.ts +37 -0
  81. package/dist/delivery/categorize/categories.js +72 -0
  82. package/dist/delivery/categorize/category.d.ts +31 -0
  83. package/dist/delivery/categorize/category.js +55 -0
  84. package/dist/delivery/categorize/choice.d.ts +28 -0
  85. package/dist/delivery/categorize/choice.js +114 -0
  86. package/dist/delivery/categorize/choices.d.ts +42 -0
  87. package/dist/delivery/categorize/choices.js +58 -0
  88. package/dist/delivery/categorize/droppable-placeholder.d.ts +36 -0
  89. package/dist/delivery/categorize/droppable-placeholder.js +77 -0
  90. package/dist/delivery/categorize/grid-content.d.ts +25 -0
  91. package/dist/delivery/categorize/grid-content.js +39 -0
  92. package/dist/delivery/categorize/index.d.ts +70 -0
  93. package/dist/delivery/categorize/index.js +323 -0
  94. package/dist/delivery/categorize/keyboard-coordinates.d.ts +22 -0
  95. package/dist/delivery/categorize/keyboard-coordinates.js +49 -0
  96. package/dist/delivery/index.d.ts +27 -0
  97. package/dist/delivery/index.js +154 -0
  98. package/dist/index.d.ts +1 -0
  99. package/dist/index.iife.d.ts +8 -0
  100. package/dist/index.iife.js +152 -0
  101. package/dist/index.js +2 -0
  102. package/dist/runtime-support.d.ts +12 -0
  103. package/dist/runtime-support.js +12 -0
  104. package/package.json +96 -23
  105. package/CHANGELOG.json +0 -1637
  106. package/CHANGELOG.md +0 -2587
  107. package/LICENSE.md +0 -5
  108. package/README.md +0 -5
  109. package/configure/CHANGELOG.json +0 -1202
  110. package/configure/CHANGELOG.md +0 -2166
  111. package/configure/lib/__tests__/main.test.js +0 -100
  112. package/configure/lib/__tests__/utils.js +0 -39
  113. package/configure/lib/defaults.js +0 -220
  114. package/configure/lib/defaults.js.map +0 -1
  115. package/configure/lib/design/__tests__/builder.test.js +0 -34
  116. package/configure/lib/design/__tests__/buttons.test.js +0 -36
  117. package/configure/lib/design/__tests__/header.test.js +0 -37
  118. package/configure/lib/design/__tests__/index.test.js +0 -269
  119. package/configure/lib/design/__tests__/input-header.test.js +0 -41
  120. package/configure/lib/design/builder.js +0 -55
  121. package/configure/lib/design/builder.js.map +0 -1
  122. package/configure/lib/design/buttons.js +0 -59
  123. package/configure/lib/design/buttons.js.map +0 -1
  124. package/configure/lib/design/categories/RowLabel.js +0 -66
  125. package/configure/lib/design/categories/RowLabel.js.map +0 -1
  126. package/configure/lib/design/categories/__tests__/alternateResponses.test.js +0 -93
  127. package/configure/lib/design/categories/__tests__/category.test.js +0 -65
  128. package/configure/lib/design/categories/__tests__/choice-preview.test.js +0 -52
  129. package/configure/lib/design/categories/__tests__/droppable-placeholder.test.js +0 -63
  130. package/configure/lib/design/categories/__tests__/index.test.js +0 -91
  131. package/configure/lib/design/categories/alternateResponses.js +0 -116
  132. package/configure/lib/design/categories/alternateResponses.js.map +0 -1
  133. package/configure/lib/design/categories/category.js +0 -153
  134. package/configure/lib/design/categories/category.js.map +0 -1
  135. package/configure/lib/design/categories/choice-preview.js +0 -79
  136. package/configure/lib/design/categories/choice-preview.js.map +0 -1
  137. package/configure/lib/design/categories/droppable-placeholder.js +0 -93
  138. package/configure/lib/design/categories/droppable-placeholder.js.map +0 -1
  139. package/configure/lib/design/categories/index.js +0 -256
  140. package/configure/lib/design/categories/index.js.map +0 -1
  141. package/configure/lib/design/choices/__tests__/choice.test.js +0 -62
  142. package/configure/lib/design/choices/__tests__/config.test.js +0 -66
  143. package/configure/lib/design/choices/__tests__/index.test.js +0 -70
  144. package/configure/lib/design/choices/choice.js +0 -187
  145. package/configure/lib/design/choices/choice.js.map +0 -1
  146. package/configure/lib/design/choices/config.js +0 -58
  147. package/configure/lib/design/choices/config.js.map +0 -1
  148. package/configure/lib/design/choices/index.js +0 -197
  149. package/configure/lib/design/choices/index.js.map +0 -1
  150. package/configure/lib/design/header.js +0 -71
  151. package/configure/lib/design/header.js.map +0 -1
  152. package/configure/lib/design/index.js +0 -741
  153. package/configure/lib/design/index.js.map +0 -1
  154. package/configure/lib/design/input-header.js +0 -105
  155. package/configure/lib/design/input-header.js.map +0 -1
  156. package/configure/lib/design/utils.js +0 -12
  157. package/configure/lib/design/utils.js.map +0 -1
  158. package/configure/lib/index.js +0 -148
  159. package/configure/lib/index.js.map +0 -1
  160. package/configure/lib/main.js +0 -44
  161. package/configure/lib/main.js.map +0 -1
  162. package/configure/lib/utils.js +0 -43
  163. package/configure/lib/utils.js.map +0 -1
  164. package/configure/package.json +0 -32
  165. package/controller/CHANGELOG.json +0 -452
  166. package/controller/CHANGELOG.md +0 -1420
  167. package/controller/lib/__tests__/index.test.js +0 -526
  168. package/controller/lib/defaults.js +0 -31
  169. package/controller/lib/defaults.js.map +0 -1
  170. package/controller/lib/index.js +0 -506
  171. package/controller/lib/index.js.map +0 -1
  172. package/controller/lib/utils.js +0 -69
  173. package/controller/lib/utils.js.map +0 -1
  174. package/controller/package.json +0 -18
  175. package/docs/config-schema.json +0 -2897
  176. package/docs/config-schema.json.md +0 -2138
  177. package/docs/demo/.pie/.configure/package.json +0 -10
  178. package/docs/demo/.pie/.configure/yarn.lock +0 -2122
  179. package/docs/demo/.pie/.controllers/package.json +0 -10
  180. package/docs/demo/.pie/.controllers/yarn.lock +0 -110
  181. package/docs/demo/.pie/info.entry.js +0 -89
  182. package/docs/demo/.pie/info.webpack.config.js +0 -119
  183. package/docs/demo/.pie/package.json +0 -10
  184. package/docs/demo/.pie/yarn.lock +0 -2137
  185. package/docs/demo/config.js +0 -8
  186. package/docs/demo/generate.js +0 -357
  187. package/docs/demo/index.html +0 -1
  188. package/docs/demo/pie.manifest.json +0 -11
  189. package/docs/demo/session.js +0 -12
  190. package/docs/pie-schema.json +0 -1784
  191. package/docs/pie-schema.json.md +0 -1046
  192. package/lib/__tests__/index.test.js +0 -197
  193. package/lib/categorize/__tests__/categories.test.js +0 -138
  194. package/lib/categorize/__tests__/category.test.js +0 -137
  195. package/lib/categorize/__tests__/choice.test.js +0 -88
  196. package/lib/categorize/__tests__/choices.test.js +0 -118
  197. package/lib/categorize/__tests__/droppable-placeholder.test.js +0 -96
  198. package/lib/categorize/__tests__/grid-content.test.js +0 -48
  199. package/lib/categorize/__tests__/index.test.js +0 -250
  200. package/lib/categorize/categories.js +0 -135
  201. package/lib/categorize/categories.js.map +0 -1
  202. package/lib/categorize/category.js +0 -67
  203. package/lib/categorize/category.js.map +0 -1
  204. package/lib/categorize/choice.js +0 -140
  205. package/lib/categorize/choice.js.map +0 -1
  206. package/lib/categorize/choices.js +0 -99
  207. package/lib/categorize/choices.js.map +0 -1
  208. package/lib/categorize/droppable-placeholder.js +0 -84
  209. package/lib/categorize/droppable-placeholder.js.map +0 -1
  210. package/lib/categorize/grid-content.js +0 -55
  211. package/lib/categorize/grid-content.js.map +0 -1
  212. package/lib/categorize/index.js +0 -450
  213. package/lib/categorize/index.js.map +0 -1
  214. package/lib/index.js +0 -316
  215. package/lib/index.js.map +0 -1
@@ -0,0 +1,114 @@
1
+ import e from "react";
2
+ import { color as t } from "@pie-lib/render-ui";
3
+ import n from "prop-types";
4
+ import r from "debug";
5
+ import { styled as i } from "@mui/material/styles";
6
+ import { useDraggable as a } from "@dnd-kit/core";
7
+ import { uid as o } from "@pie-lib/drag";
8
+ import { jsx as s } from "react/jsx-runtime";
9
+ import c from "@mui/material/Card";
10
+ import l from "@mui/material/CardContent";
11
+ //#region src/delivery/categorize/choice.tsx
12
+ r("@pie-ui:categorize:choice");
13
+ var u = {
14
+ content: n.string.isRequired,
15
+ id: n.string
16
+ }, d = i("div", { shouldForwardProp: (e) => ![
17
+ "isDragging",
18
+ "disabled",
19
+ "correct",
20
+ "isSelected"
21
+ ].includes(e) })(({ isDragging: e, disabled: n, correct: r, isSelected: i }) => ({
22
+ direction: "initial",
23
+ cursor: n ? "not-allowed" : e ? "move" : "pointer",
24
+ width: "100%",
25
+ borderRadius: "6px",
26
+ ...i && { border: `solid 2px ${t.buttonFocusOutline()}` },
27
+ ...r === !0 && { border: `solid 2px ${t.correct()}` },
28
+ ...r === !1 && { border: `solid 2px ${t.incorrect()}` }
29
+ })), f = i(c, { shouldForwardProp: (e) => e !== "isSelected" })(({ isSelected: e }) => ({
30
+ color: t.text(),
31
+ backgroundColor: t.background(),
32
+ width: "100%",
33
+ opacity: e ? .5 : 1
34
+ })), p = i(l)(({ theme: e }) => ({
35
+ color: t.text(),
36
+ backgroundColor: t.white(),
37
+ "&:last-child": { paddingBottom: e.spacing(2) },
38
+ borderRadius: "4px",
39
+ border: "1px solid",
40
+ "& p": { margin: "0px" }
41
+ })), m = class extends e.Component {
42
+ static propTypes = {
43
+ ...u,
44
+ disabled: n.bool,
45
+ correct: n.bool,
46
+ isDragging: n.bool,
47
+ isSelected: n.bool
48
+ };
49
+ static defaultProps = {};
50
+ render() {
51
+ let { content: e, isDragging: t, disabled: n, correct: r, isSelected: i, showsSelectionBorder: a } = this.props;
52
+ return /* @__PURE__ */ s(d, {
53
+ isDragging: t,
54
+ disabled: n,
55
+ correct: r,
56
+ isSelected: i,
57
+ children: /* @__PURE__ */ s(f, {
58
+ isSelected: i,
59
+ children: /* @__PURE__ */ s(p, { dangerouslySetInnerHTML: { __html: e } })
60
+ })
61
+ });
62
+ }
63
+ }, h = ({ id: e, content: t, disabled: n, correct: r, extraStyle: i, categoryId: o, choiceIndex: c, selectedItem: l, onSelectClick: u }) => {
64
+ let d = o === void 0 ? `choice-${e}-board` : `choice-${e}-${o}-${c}`, f = {
65
+ id: e,
66
+ categoryId: o,
67
+ choiceIndex: c,
68
+ value: t,
69
+ itemType: "categorize",
70
+ type: "choice"
71
+ }, { attributes: p, listeners: h, setNodeRef: g, isDragging: _ } = a({
72
+ id: d,
73
+ data: f,
74
+ disabled: n
75
+ }), v = !!l && l.id === e && l.categoryId === o && l.choiceIndex === c, y = (e) => {
76
+ if (!n) {
77
+ if (v) {
78
+ e.stopPropagation(), u?.(f);
79
+ return;
80
+ }
81
+ l && o !== void 0 || (e.stopPropagation(), u?.(f));
82
+ }
83
+ };
84
+ return /* @__PURE__ */ s("div", {
85
+ ref: g,
86
+ style: {
87
+ margin: "4px",
88
+ ...i
89
+ },
90
+ onClick: y,
91
+ ...h,
92
+ ...p,
93
+ children: /* @__PURE__ */ s(m, {
94
+ id: e,
95
+ content: t,
96
+ disabled: n,
97
+ correct: r,
98
+ isDragging: _,
99
+ isSelected: v
100
+ })
101
+ });
102
+ };
103
+ h.propTypes = {
104
+ ...u,
105
+ extraStyle: n.object,
106
+ categoryId: n.string,
107
+ choiceIndex: n.number,
108
+ onRemoveChoice: n.func,
109
+ selectedItem: n.object,
110
+ onSelectClick: n.func
111
+ };
112
+ var g = o.withUid(h);
113
+ //#endregion
114
+ export { u as ChoiceType, m as Layout, g as default };
@@ -0,0 +1,42 @@
1
+ /**
2
+ * @synced-from pie-elements/packages/categorize/src/categorize/choices.jsx
3
+ * @auto-generated
4
+ *
5
+ * This file is automatically synced from pie-elements and converted to TypeScript.
6
+ * Manual edits will be overwritten on next sync.
7
+ * To make changes, edit the upstream JavaScript file and run sync again.
8
+ */
9
+ import React from 'react';
10
+ import PropTypes from 'prop-types';
11
+ import { ChoiceType } from './choice.js';
12
+ export { ChoiceType };
13
+ export declare class Choices extends React.Component {
14
+ static propTypes: {
15
+ choices: PropTypes.Requireable<(NonNullable<PropTypes.InferProps<{
16
+ content: PropTypes.Validator<string>;
17
+ id: PropTypes.Requireable<string>;
18
+ }> | PropTypes.InferProps<{
19
+ empty: PropTypes.Requireable<boolean>;
20
+ }> | null | undefined> | null | undefined)[]>;
21
+ model: PropTypes.Requireable<PropTypes.InferProps<{
22
+ categoriesPerRow: PropTypes.Requireable<number>;
23
+ choicesLabel: PropTypes.Requireable<string>;
24
+ }>>;
25
+ disabled: PropTypes.Requireable<boolean>;
26
+ choicePosition: PropTypes.Requireable<string>;
27
+ onDropChoice: PropTypes.Requireable<(...args: any[]) => any>;
28
+ onRemoveChoice: PropTypes.Requireable<(...args: any[]) => any>;
29
+ correct: any;
30
+ selectedItem: PropTypes.Requireable<object>;
31
+ onSelectClick: PropTypes.Requireable<(...args: any[]) => any>;
32
+ onPlacementClick: PropTypes.Requireable<(...args: any[]) => any>;
33
+ };
34
+ static defaultProps: {
35
+ model: {
36
+ categoriesPerRow: number;
37
+ choicesLabel: string;
38
+ };
39
+ };
40
+ render(): React.JSX.Element;
41
+ }
42
+ export default Choices;
@@ -0,0 +1,58 @@
1
+ import e, { ChoiceType as t } from "./choice.js";
2
+ import n from "./droppable-placeholder.js";
3
+ import r from "react";
4
+ import i from "prop-types";
5
+ import { styled as a } from "@mui/material/styles";
6
+ import { jsx as o, jsxs as s } from "react/jsx-runtime";
7
+ //#region src/delivery/categorize/choices.tsx
8
+ var c = a("div")({
9
+ flex: 1,
10
+ touchAction: "none"
11
+ }), l = a("div")(({ theme: e }) => ({
12
+ margin: "0 auto",
13
+ textAlign: "center",
14
+ paddingTop: e.spacing(1)
15
+ })), u = class extends r.Component {
16
+ static propTypes = {
17
+ choices: i.arrayOf(i.oneOfType([i.shape(t), i.shape({ empty: i.bool })])),
18
+ model: i.shape({
19
+ categoriesPerRow: i.number,
20
+ choicesLabel: i.string
21
+ }),
22
+ disabled: i.bool,
23
+ choicePosition: i.string,
24
+ onDropChoice: i.func,
25
+ onRemoveChoice: i.func,
26
+ correct: i.boolean,
27
+ selectedItem: i.object,
28
+ onSelectClick: i.func,
29
+ onPlacementClick: i.func
30
+ };
31
+ static defaultProps = { model: {
32
+ categoriesPerRow: 1,
33
+ choicesLabel: ""
34
+ } };
35
+ render() {
36
+ let { choices: t = [], model: r, disabled: i, onDropChoice: a, onRemoveChoice: u, choicePosition: d, correct: f, selectedItem: p, onSelectClick: m, onPlacementClick: h } = this.props, g = { textAlign: "center" };
37
+ return d === "left" && (g.direction = "rtl"), /* @__PURE__ */ o(c, { children: /* @__PURE__ */ s(n, {
38
+ id: "choices-board",
39
+ onDropChoice: a,
40
+ onRemoveChoice: u,
41
+ disabled: i,
42
+ style: { background: "none" },
43
+ choiceBoard: !0,
44
+ correct: f,
45
+ selectedItem: p,
46
+ onPlacementClick: h,
47
+ children: [r.choicesLabel && r.choicesLabel !== "" && /* @__PURE__ */ o(l, { dangerouslySetInnerHTML: { __html: r.choicesLabel } }), t.map((t, n) => t.empty ? /* @__PURE__ */ o("div", {}, n) : /* @__PURE__ */ o(e, {
48
+ disabled: i,
49
+ extraStyle: { maxWidth: `${95 / r.categoriesPerRow}%` },
50
+ selectedItem: p,
51
+ onSelectClick: m,
52
+ ...t
53
+ }, n))]
54
+ }) });
55
+ }
56
+ };
57
+ //#endregion
58
+ export { t as ChoiceType, u as Choices, u as default };
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @synced-from pie-elements/packages/categorize/src/categorize/droppable-placeholder.jsx
3
+ * @auto-generated
4
+ *
5
+ * This file is automatically synced from pie-elements and converted to TypeScript.
6
+ * Manual edits will be overwritten on next sync.
7
+ * To make changes, edit the upstream JavaScript file and run sync again.
8
+ */
9
+ import React from 'react';
10
+ import PropTypes from 'prop-types';
11
+ declare const DroppablePlaceholder: {
12
+ ({ children, grid, disabled, choiceBoard, minRowHeight, id, correct, selectedItem, onPlacementClick, }: {
13
+ children: any;
14
+ grid: any;
15
+ disabled: any;
16
+ choiceBoard: any;
17
+ minRowHeight: any;
18
+ id: any;
19
+ correct: any;
20
+ selectedItem: any;
21
+ onPlacementClick: any;
22
+ }): React.JSX.Element;
23
+ propTypes: {
24
+ choiceBoard: PropTypes.Requireable<boolean>;
25
+ children: PropTypes.Validator<NonNullable<PropTypes.ReactNodeLike>>;
26
+ grid: PropTypes.Requireable<object>;
27
+ disabled: PropTypes.Requireable<boolean>;
28
+ minRowHeight: PropTypes.Requireable<string>;
29
+ onDropChoice: PropTypes.Requireable<(...args: any[]) => any>;
30
+ id: PropTypes.Validator<string>;
31
+ correct: PropTypes.Requireable<boolean>;
32
+ selectedItem: PropTypes.Requireable<object>;
33
+ onPlacementClick: PropTypes.Requireable<(...args: any[]) => any>;
34
+ };
35
+ };
36
+ export default DroppablePlaceholder;
@@ -0,0 +1,77 @@
1
+ import { useState as e } from "react";
2
+ import { color as t } from "@pie-lib/render-ui";
3
+ import n from "prop-types";
4
+ import r from "debug";
5
+ import { useTheme as i } from "@mui/material/styles";
6
+ import { useDroppable as a } from "@dnd-kit/core";
7
+ import { PlaceHolder as o } from "@pie-lib/drag";
8
+ import { jsx as s } from "react/jsx-runtime";
9
+ //#region src/delivery/categorize/droppable-placeholder.tsx
10
+ r("@pie-ui:categorize:droppable-placeholder");
11
+ var c = ({ children: n, grid: r, disabled: c, choiceBoard: l, minRowHeight: u, id: d, correct: f, selectedItem: p, onPlacementClick: m }) => {
12
+ let h = i(), [g, _] = e(!1), { setNodeRef: v, isOver: y } = a({
13
+ id: d,
14
+ data: {
15
+ itemType: "categorize",
16
+ categoryId: d
17
+ },
18
+ disabled: c
19
+ }), b = !!p, x = y || b && g && !c, S = !c, C = () => {
20
+ c || !p || m?.(d);
21
+ }, w = (e) => {
22
+ e.target === e.currentTarget && (e.code === "Space" || e.code === "Enter") && (e.preventDefault(), C());
23
+ }, T = {
24
+ padding: h.spacing(.5),
25
+ borderRadius: h.spacing(.5),
26
+ gridColumnGap: 0,
27
+ gridRowGap: 0,
28
+ display: "flex",
29
+ flexWrap: "wrap",
30
+ justifyContent: "center",
31
+ alignItems: "center",
32
+ alignContent: "flex-start",
33
+ width: "100%",
34
+ height: "100%",
35
+ ...f === !1 && !l && { border: `solid 2px ${t.incorrect()}` },
36
+ ...f === !0 && !l && { border: `solid 2px ${t.correct()}` }
37
+ };
38
+ return /* @__PURE__ */ s("div", {
39
+ ref: v,
40
+ role: S ? "button" : void 0,
41
+ tabIndex: S ? 0 : -1,
42
+ onClick: C,
43
+ onKeyDown: S ? w : void 0,
44
+ onMouseEnter: () => _(!0),
45
+ onMouseLeave: () => _(!1),
46
+ style: {
47
+ flex: 1,
48
+ minHeight: u || "80px",
49
+ position: "relative",
50
+ touchAction: "none",
51
+ ...b && !c && { cursor: "pointer" }
52
+ },
53
+ children: /* @__PURE__ */ s(o, {
54
+ isOver: x,
55
+ grid: r,
56
+ disabled: c,
57
+ choiceBoard: l,
58
+ isCategorize: !0,
59
+ extraStyles: T,
60
+ children: n
61
+ })
62
+ });
63
+ };
64
+ c.propTypes = {
65
+ choiceBoard: n.bool,
66
+ children: n.node.isRequired,
67
+ grid: n.object,
68
+ disabled: n.bool,
69
+ minRowHeight: n.string,
70
+ onDropChoice: n.func,
71
+ id: n.string.isRequired,
72
+ correct: n.bool,
73
+ selectedItem: n.object,
74
+ onPlacementClick: n.func
75
+ };
76
+ //#endregion
77
+ export { c as default };
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @synced-from pie-elements/packages/categorize/src/categorize/grid-content.jsx
3
+ * @auto-generated
4
+ *
5
+ * This file is automatically synced from pie-elements and converted to TypeScript.
6
+ * Manual edits will be overwritten on next sync.
7
+ * To make changes, edit the upstream JavaScript file and run sync again.
8
+ */
9
+ import React from 'react';
10
+ import PropTypes from 'prop-types';
11
+ export declare class GridContent extends React.Component {
12
+ static propTypes: {
13
+ className: PropTypes.Requireable<string>;
14
+ children: PropTypes.Validator<NonNullable<NonNullable<PropTypes.ReactNodeLike>>>;
15
+ columns: PropTypes.Requireable<number>;
16
+ rows: PropTypes.Requireable<number>;
17
+ extraStyle: PropTypes.Requireable<object>;
18
+ };
19
+ static defaultProps: {
20
+ columns: number;
21
+ rows: number;
22
+ };
23
+ render(): React.JSX.Element;
24
+ }
25
+ export default GridContent;
@@ -0,0 +1,39 @@
1
+ import e from "react";
2
+ import t from "prop-types";
3
+ import { styled as n } from "@mui/material/styles";
4
+ import { jsx as r } from "react/jsx-runtime";
5
+ //#region src/delivery/categorize/grid-content.tsx
6
+ var i = class extends e.Component {
7
+ static propTypes = {
8
+ className: t.string,
9
+ children: t.oneOfType([t.arrayOf(t.node), t.node]).isRequired,
10
+ columns: t.number,
11
+ rows: t.number,
12
+ extraStyle: t.object
13
+ };
14
+ static defaultProps = {
15
+ columns: 2,
16
+ rows: 2
17
+ };
18
+ render() {
19
+ let { className: e, children: t, columns: n, extraStyle: i, rows: o } = this.props;
20
+ return /* @__PURE__ */ r(a, {
21
+ style: {
22
+ gridTemplateColumns: `repeat(${n}, 1fr)`,
23
+ gridTemplateRows: o === 2 ? "auto 1fr" : `repeat(${o}, auto)`,
24
+ ...i
25
+ },
26
+ className: e,
27
+ children: t
28
+ });
29
+ }
30
+ }, a = n("div")(({ theme: e }) => ({
31
+ display: "grid",
32
+ columnGap: e.spacing(1),
33
+ gridColumnGap: e.spacing(1),
34
+ rowGap: e.spacing(1),
35
+ gridRowGap: e.spacing(1),
36
+ gridAutoRows: "1fr"
37
+ }));
38
+ //#endregion
39
+ export { i as GridContent, i as default };
@@ -0,0 +1,70 @@
1
+ /**
2
+ * @synced-from pie-elements/packages/categorize/src/categorize/index.jsx
3
+ * @auto-generated
4
+ *
5
+ * This file is automatically synced from pie-elements and converted to TypeScript.
6
+ * Manual edits will be overwritten on next sync.
7
+ * To make changes, edit the upstream JavaScript file and run sync again.
8
+ */
9
+ import React from 'react';
10
+ import PropTypes from 'prop-types';
11
+ export declare class Categorize extends React.Component {
12
+ static propTypes: {
13
+ model: PropTypes.Requireable<object>;
14
+ session: PropTypes.Requireable<PropTypes.InferProps<{
15
+ answers: PropTypes.Requireable<(PropTypes.InferProps<{
16
+ choice: PropTypes.Requireable<string>;
17
+ category: PropTypes.Requireable<string>;
18
+ }> | null | undefined)[]>;
19
+ }>>;
20
+ onAnswersChange: PropTypes.Validator<(...args: any[]) => any>;
21
+ onShowCorrectToggle: PropTypes.Validator<(...args: any[]) => any>;
22
+ pauseMathObserver: PropTypes.Requireable<(...args: any[]) => any>;
23
+ resumeMathObserver: PropTypes.Requireable<(...args: any[]) => any>;
24
+ selectedItem: PropTypes.Requireable<object>;
25
+ onSelectClick: PropTypes.Requireable<(...args: any[]) => any>;
26
+ onPlacementClick: PropTypes.Requireable<(...args: any[]) => any>;
27
+ };
28
+ static defaultProps: {
29
+ disabled: boolean;
30
+ };
31
+ constructor(props: any);
32
+ removeChoice: any;
33
+ dropChoice: any;
34
+ UNSAFE_componentWillReceiveProps(nextProps: any): void;
35
+ toggleShowCorrect: () => void;
36
+ getPositionDirection: any;
37
+ existAlternateResponse: (correctResponse: any) => any;
38
+ render(): React.JSX.Element;
39
+ }
40
+ declare class CategorizeProvider extends React.Component {
41
+ static propTypes: {
42
+ model: PropTypes.Requireable<object>;
43
+ session: PropTypes.Requireable<PropTypes.InferProps<{
44
+ answers: PropTypes.Requireable<(PropTypes.InferProps<{
45
+ choice: PropTypes.Requireable<string>;
46
+ category: PropTypes.Requireable<string>;
47
+ }> | null | undefined)[]>;
48
+ }>>;
49
+ onAnswersChange: PropTypes.Validator<(...args: any[]) => any>;
50
+ onShowCorrectToggle: PropTypes.Validator<(...args: any[]) => any>;
51
+ pauseMathObserver: PropTypes.Requireable<(...args: any[]) => any>;
52
+ resumeMathObserver: PropTypes.Requireable<(...args: any[]) => any>;
53
+ };
54
+ constructor(props: any);
55
+ onDragStart: any;
56
+ commitPlacement: any;
57
+ onDragEnd: any;
58
+ onDragCancel: any;
59
+ isSameItem: (a: any, b: any) => boolean;
60
+ toggleItemSelection: any;
61
+ cancelSelection: any;
62
+ endAnyLiveKeyboardDrag: any;
63
+ placeSelectedItem: any;
64
+ isClickSoonAfterDragEnd: () => boolean;
65
+ onItemClick: any;
66
+ onPlacementClick: any;
67
+ renderDragOverlay: any;
68
+ render(): React.JSX.Element;
69
+ }
70
+ export default CategorizeProvider;