cloudmr-ux 1.6.9 → 1.7.0

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.
package/dist/index.js CHANGED
@@ -1110,12 +1110,13 @@ var InputNumber_default = CmrInputNumber;
1110
1110
  // src/CmrComponents/select-upload/SelectUpload.tsx
1111
1111
  var import_react8 = __toESM(require("react"));
1112
1112
  var import_material12 = require("@mui/material");
1113
- var import_Select = __toESM(require("@mui/material/Select"));
1114
1113
  var import_Dialog6 = __toESM(require("@mui/material/Dialog"));
1115
1114
  var import_DialogTitle6 = __toESM(require("@mui/material/DialogTitle"));
1116
1115
  var import_DialogContent6 = __toESM(require("@mui/material/DialogContent"));
1117
1116
  var import_DialogContentText5 = __toESM(require("@mui/material/DialogContentText"));
1118
1117
  var import_Box3 = __toESM(require("@mui/material/Box"));
1118
+ var import_Autocomplete = __toESM(require("@mui/material/Autocomplete"));
1119
+ var import_TextField5 = __toESM(require("@mui/material/TextField"));
1119
1120
  var import_jsx_runtime18 = require("react/jsx-runtime");
1120
1121
  var CMRSelectUpload = (props) => {
1121
1122
  let [open, setOpen] = import_react8.default.useState(false);
@@ -1129,9 +1130,6 @@ var CMRSelectUpload = (props) => {
1129
1130
  const handleClose = () => {
1130
1131
  setOpen(false);
1131
1132
  };
1132
- const handleChange = (event) => {
1133
- selectFileIndex(event.target.value);
1134
- };
1135
1133
  const onSet = () => {
1136
1134
  props.onSelected(props.fileSelection[fileIndex]);
1137
1135
  setOpen(false);
@@ -1140,18 +1138,24 @@ var CMRSelectUpload = (props) => {
1140
1138
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_DialogTitle6.default, { children: "Select or Upload" }),
1141
1139
  /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_DialogContent6.default, { sx: { width: 520 }, children: [
1142
1140
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_DialogContentText5.default, { sx: { pl: 1, pr: 1, pb: 0 }, children: uploading ? "Please wait for the upload to finish." : "" }),
1143
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_DialogContent6.default, { sx: { p: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
1144
- import_Select.default,
1141
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_DialogContent6.default, { sx: { p: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1142
+ import_Autocomplete.default,
1145
1143
  {
1146
- value: fileIndex,
1147
- onChange: handleChange,
1148
1144
  disabled: uploading,
1149
- inputProps: { "aria-label": "Without label" },
1150
- sx: { width: "100%" },
1151
- children: [
1152
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_material12.MenuItem, { value: -1, children: props.fileSelection.length < 1 ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("em", { children: "No Stored Files" }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("em", { children: "Select a Stored File" }) }),
1153
- (props.fileSelection != void 0 ? props.fileSelection : []).map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_material12.MenuItem, { value: index, children: option.fileName }, index))
1154
- ]
1145
+ options: props.fileSelection,
1146
+ getOptionLabel: (option) => option.fileName,
1147
+ isOptionEqualToValue: (option, value) => option.id === value.id,
1148
+ value: fileIndex === -1 ? null : props.fileSelection[fileIndex],
1149
+ onChange: (event, newValue) => {
1150
+ if (newValue) {
1151
+ const index = props.fileSelection.findIndex((file) => file.id === newValue.id);
1152
+ selectFileIndex(index);
1153
+ } else {
1154
+ selectFileIndex(-1);
1155
+ }
1156
+ },
1157
+ renderInput: (params) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_TextField5.default, { ...params, label: "Select a Stored File" }),
1158
+ sx: { width: "100%" }
1155
1159
  }
1156
1160
  ) }),
1157
1161
  /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_Box3.default, { sx: { pt: 2, justifyContent: "center", display: "flex", padding: "8px" }, children: [
package/dist/index.mjs CHANGED
@@ -1061,13 +1061,14 @@ var InputNumber_default = CmrInputNumber;
1061
1061
 
1062
1062
  // src/CmrComponents/select-upload/SelectUpload.tsx
1063
1063
  import React11, { Fragment } from "react";
1064
- import { Button as Button4, MenuItem as MenuItem3 } from "@mui/material";
1065
- import Select2 from "@mui/material/Select";
1064
+ import { Button as Button4 } from "@mui/material";
1066
1065
  import Dialog6 from "@mui/material/Dialog";
1067
1066
  import DialogTitle6 from "@mui/material/DialogTitle";
1068
1067
  import DialogContent6 from "@mui/material/DialogContent";
1069
1068
  import DialogContentText5 from "@mui/material/DialogContentText";
1070
1069
  import Box4 from "@mui/material/Box";
1070
+ import Autocomplete from "@mui/material/Autocomplete";
1071
+ import TextField5 from "@mui/material/TextField";
1071
1072
  import { jsx as jsx18, jsxs as jsxs12 } from "react/jsx-runtime";
1072
1073
  var CMRSelectUpload = (props) => {
1073
1074
  let [open, setOpen] = React11.useState(false);
@@ -1081,9 +1082,6 @@ var CMRSelectUpload = (props) => {
1081
1082
  const handleClose = () => {
1082
1083
  setOpen(false);
1083
1084
  };
1084
- const handleChange = (event) => {
1085
- selectFileIndex(event.target.value);
1086
- };
1087
1085
  const onSet = () => {
1088
1086
  props.onSelected(props.fileSelection[fileIndex]);
1089
1087
  setOpen(false);
@@ -1092,18 +1090,24 @@ var CMRSelectUpload = (props) => {
1092
1090
  /* @__PURE__ */ jsx18(DialogTitle6, { children: "Select or Upload" }),
1093
1091
  /* @__PURE__ */ jsxs12(DialogContent6, { sx: { width: 520 }, children: [
1094
1092
  /* @__PURE__ */ jsx18(DialogContentText5, { sx: { pl: 1, pr: 1, pb: 0 }, children: uploading ? "Please wait for the upload to finish." : "" }),
1095
- /* @__PURE__ */ jsx18(DialogContent6, { sx: { p: 1 }, children: /* @__PURE__ */ jsxs12(
1096
- Select2,
1093
+ /* @__PURE__ */ jsx18(DialogContent6, { sx: { p: 1 }, children: /* @__PURE__ */ jsx18(
1094
+ Autocomplete,
1097
1095
  {
1098
- value: fileIndex,
1099
- onChange: handleChange,
1100
1096
  disabled: uploading,
1101
- inputProps: { "aria-label": "Without label" },
1102
- sx: { width: "100%" },
1103
- children: [
1104
- /* @__PURE__ */ jsx18(MenuItem3, { value: -1, children: props.fileSelection.length < 1 ? /* @__PURE__ */ jsx18("em", { children: "No Stored Files" }) : /* @__PURE__ */ jsx18("em", { children: "Select a Stored File" }) }),
1105
- (props.fileSelection != void 0 ? props.fileSelection : []).map((option, index) => /* @__PURE__ */ jsx18(MenuItem3, { value: index, children: option.fileName }, index))
1106
- ]
1097
+ options: props.fileSelection,
1098
+ getOptionLabel: (option) => option.fileName,
1099
+ isOptionEqualToValue: (option, value) => option.id === value.id,
1100
+ value: fileIndex === -1 ? null : props.fileSelection[fileIndex],
1101
+ onChange: (event, newValue) => {
1102
+ if (newValue) {
1103
+ const index = props.fileSelection.findIndex((file) => file.id === newValue.id);
1104
+ selectFileIndex(index);
1105
+ } else {
1106
+ selectFileIndex(-1);
1107
+ }
1108
+ },
1109
+ renderInput: (params) => /* @__PURE__ */ jsx18(TextField5, { ...params, label: "Select a Stored File" }),
1110
+ sx: { width: "100%" }
1107
1111
  }
1108
1112
  ) }),
1109
1113
  /* @__PURE__ */ jsxs12(Box4, { sx: { pt: 2, justifyContent: "center", display: "flex", padding: "8px" }, children: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudmr-ux",
3
- "version": "1.6.9",
3
+ "version": "1.7.0",
4
4
  "author": "erosmontin@gmail.com",
5
5
  "license": "MIT",
6
6
  "repository": "erosmontin/cloudmr-ux",