cloudmr-ux 1.7.4 → 1.7.5

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
@@ -1117,6 +1117,7 @@ var import_DialogContentText5 = __toESM(require("@mui/material/DialogContentText
1117
1117
  var import_Box3 = __toESM(require("@mui/material/Box"));
1118
1118
  var import_Autocomplete = __toESM(require("@mui/material/Autocomplete"));
1119
1119
  var import_TextField5 = __toESM(require("@mui/material/TextField"));
1120
+ var import_Autocomplete2 = require("@mui/material/Autocomplete");
1120
1121
  var import_jsx_runtime18 = require("react/jsx-runtime");
1121
1122
  var CMRSelectUpload = (props) => {
1122
1123
  let [open, setOpen] = import_react8.default.useState(false);
@@ -1127,6 +1128,11 @@ var CMRSelectUpload = (props) => {
1127
1128
  selectFileIndex(-1);
1128
1129
  setOpen(true);
1129
1130
  };
1131
+ const customFilter = (0, import_Autocomplete2.createFilterOptions)({
1132
+ matchFrom: "start",
1133
+ // only match from beginning
1134
+ stringify: (option) => option.fileName
1135
+ });
1130
1136
  const handleClose = () => {
1131
1137
  setOpen(false);
1132
1138
  };
@@ -1143,16 +1149,9 @@ var CMRSelectUpload = (props) => {
1143
1149
  {
1144
1150
  disabled: uploading,
1145
1151
  options: props.fileSelection,
1146
- filterOptions: (options, state) => {
1147
- const input = state.inputValue.toLowerCase();
1148
- const filtered = options.filter(
1149
- (option) => option.fileName.toLowerCase().startsWith(input)
1150
- );
1151
- return filtered.sort(
1152
- (a, b) => a.fileName.toLowerCase().localeCompare(b.fileName.toLowerCase())
1153
- );
1154
- },
1152
+ filterOptions: customFilter,
1155
1153
  getOptionLabel: (option) => option.fileName,
1154
+ noOptionsText: "No files found starting with input",
1156
1155
  isOptionEqualToValue: (option, value) => option.id === value.id,
1157
1156
  onChange: (event, newValue) => {
1158
1157
  if (newValue) {
package/dist/index.mjs CHANGED
@@ -1069,6 +1069,7 @@ import DialogContentText5 from "@mui/material/DialogContentText";
1069
1069
  import Box4 from "@mui/material/Box";
1070
1070
  import Autocomplete from "@mui/material/Autocomplete";
1071
1071
  import TextField5 from "@mui/material/TextField";
1072
+ import { createFilterOptions } from "@mui/material/Autocomplete";
1072
1073
  import { jsx as jsx18, jsxs as jsxs12 } from "react/jsx-runtime";
1073
1074
  var CMRSelectUpload = (props) => {
1074
1075
  let [open, setOpen] = React11.useState(false);
@@ -1079,6 +1080,11 @@ var CMRSelectUpload = (props) => {
1079
1080
  selectFileIndex(-1);
1080
1081
  setOpen(true);
1081
1082
  };
1083
+ const customFilter = createFilterOptions({
1084
+ matchFrom: "start",
1085
+ // only match from beginning
1086
+ stringify: (option) => option.fileName
1087
+ });
1082
1088
  const handleClose = () => {
1083
1089
  setOpen(false);
1084
1090
  };
@@ -1095,16 +1101,9 @@ var CMRSelectUpload = (props) => {
1095
1101
  {
1096
1102
  disabled: uploading,
1097
1103
  options: props.fileSelection,
1098
- filterOptions: (options, state) => {
1099
- const input = state.inputValue.toLowerCase();
1100
- const filtered = options.filter(
1101
- (option) => option.fileName.toLowerCase().startsWith(input)
1102
- );
1103
- return filtered.sort(
1104
- (a, b) => a.fileName.toLowerCase().localeCompare(b.fileName.toLowerCase())
1105
- );
1106
- },
1104
+ filterOptions: customFilter,
1107
1105
  getOptionLabel: (option) => option.fileName,
1106
+ noOptionsText: "No files found starting with input",
1108
1107
  isOptionEqualToValue: (option, value) => option.id === value.id,
1109
1108
  onChange: (event, newValue) => {
1110
1109
  if (newValue) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudmr-ux",
3
- "version": "1.7.4",
3
+ "version": "1.7.5",
4
4
  "author": "erosmontin@gmail.com",
5
5
  "license": "MIT",
6
6
  "repository": "erosmontin/cloudmr-ux",