swoop-common 2.2.85 → 2.2.89

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,5 +1,6 @@
1
1
  import React, { useMemo, useState } from "react";
2
- import { Box, debounce, MenuItem, Select, TextField } from "@mui/material";
2
+ import { debounce, FormControl, InputLabel, MenuItem, Select, } from "@mui/material";
3
+ import Editor from "react-simple-wysiwyg";
3
4
  import { useLocalErrors } from "../../hooks/errors";
4
5
  import { ComponentPool } from "../../registry/types";
5
6
  import { registerComponent } from "../../registry/components";
@@ -10,23 +11,25 @@ const TestCompForm = ({ textValues, onChange, getError, label, enabled, }) => {
10
11
  const error = getError ? (_a = getError("testComp")) === null || _a === void 0 ? void 0 : _a.message : undefined;
11
12
  const onChangeDebounced = useMemo(() => debounce(onChange, 300), [onChange]);
12
13
  // Update text field value when key selection changes
13
- const val = key ? ((_b = values[key]) !== null && _b !== void 0 ? _b : "") : "";
14
+ const html = key ? ((_b = values[key]) !== null && _b !== void 0 ? _b : "") : "";
14
15
  const handleSelectChange = (selectedKey) => {
15
16
  setKey(selectedKey);
16
17
  };
17
- const update = (value) => {
18
+ const update = (event) => {
19
+ const newValue = event.target.value;
18
20
  setValues((prev) => {
19
- const updated = Object.assign(Object.assign({}, prev), { [key]: value });
21
+ const updated = Object.assign(Object.assign({}, prev), { [key]: newValue });
20
22
  onChangeDebounced(updated);
21
23
  return updated;
22
24
  });
23
25
  };
24
- return (React.createElement(Box, null,
25
- React.createElement(Select, { fullWidth: true, value: key, onChange: (e) => handleSelectChange(e.target.value), disabled: !enabled },
26
+ return (React.createElement(FormControl, { sx: { p: 4, my: 2 }, fullWidth: true, error: !!error, disabled: !enabled },
27
+ React.createElement(InputLabel, { id: "note-type-label" }, "Select note type"),
28
+ React.createElement(Select, { fullWidth: true, value: key, onChange: (e) => handleSelectChange(e.target.value), disabled: !enabled, label: "note-type-label" },
26
29
  React.createElement(MenuItem, { value: "option1" }, "Option 1"),
27
30
  React.createElement(MenuItem, { value: "option2" }, "Option 2"),
28
31
  React.createElement(MenuItem, { value: "option3" }, "Option 3")),
29
- React.createElement(TextField, { label: label, value: val, onChange: (e) => update(e.target.value), error: !!error, helperText: error, multiline: true, fullWidth: true, sx: { mb: 1 }, disabled: !enabled || !key })));
32
+ React.createElement(Editor, { value: html, onChange: (event) => update(event), disabled: !enabled || !key })));
30
33
  };
31
34
  const FormRendererExample = ({ data, handleChange, path, label, enabled, }) => {
32
35
  const getError = useLocalErrors(path);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swoop-common",
3
- "version": "2.2.85",
3
+ "version": "2.2.89",
4
4
  "main": "dist/api/index.js",
5
5
  "types": "dist/api/index.d.ts",
6
6
  "exports": {
@@ -49,6 +49,7 @@
49
49
  "lodash.merge": "^4.6.2",
50
50
  "openapi-ts": "^0.3.4",
51
51
  "react": "^19.0.0",
52
+ "react-simple-wysiwyg": "^3.4.1",
52
53
  "rimraf": "^6.0.1",
53
54
  "swoop-common": "^2.1.55"
54
55
  },