@etsoo/materialui 1.5.7 → 1.5.9

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.
@@ -74,10 +74,10 @@ root.append(container);
74
74
 
75
75
  // The state provider
76
76
  const Provider = ReactApp.notifierProvider;
77
- const reactRoot = createRoot(container);
78
77
 
79
78
  act(() => {
80
79
  // Concorrent renderer needs act block
80
+ const reactRoot = createRoot(container);
81
81
  reactRoot.render(<Provider />);
82
82
  });
83
83
 
@@ -13,6 +13,11 @@ export type AutocompleteExtendedProps<T extends object, D extends DataTypes.Keys
13
13
  * Id value
14
14
  */
15
15
  idValue?: T[D];
16
+ /**
17
+ * Is the id value a string?
18
+ * @default false
19
+ */
20
+ idIsString?: boolean;
16
21
  /**
17
22
  * Autocomplete for the input
18
23
  */
@@ -27,7 +27,7 @@ function ComboBox(props) {
27
27
  // Labels
28
28
  const labels = app?.getLabels("noOptions", "loading", "open", "add");
29
29
  // Destruct
30
- const { search = false, autoAddBlankItem = search, idField = "id", idValue, inputError, inputHelperText, inputMargin, inputOnChange, inputRequired, inputReset, inputVariant, defaultValue, label, labelField = "label", loadData, onLoadData, name, inputAutoComplete = "off", options, dataReadonly = true, readOnly, onChange, onValueChange, openOnFocus = true, value, disableCloseOnSelect = false, getOptionLabel = (option) => `${option[labelField]}`, sx = { minWidth: "150px", flexGrow: 2 }, noOptionsText = labels?.noOptions, loadingText = labels?.loading, openText = labels?.open, addLabel = labels?.add, onAdd, getOptionKey = (option) => `${option[idField]}`, ...rest } = props;
30
+ const { search = false, autoAddBlankItem = search, idField = "id", idValue, idIsString = false, inputError, inputHelperText, inputMargin, inputOnChange, inputRequired, inputReset, inputVariant, defaultValue, label, labelField = "label", loadData, onLoadData, name, inputAutoComplete = "off", options, dataReadonly = true, readOnly, onChange, onValueChange, openOnFocus = true, value, disableCloseOnSelect = false, getOptionLabel = (option) => `${option[labelField]}`, sx = { minWidth: "150px", flexGrow: 2 }, noOptionsText = labels?.noOptions, loadingText = labels?.loading, openText = labels?.open, addLabel = labels?.add, onAdd, getOptionKey = (option) => `${option[idField]}`, ...rest } = props;
31
31
  // Value input ref
32
32
  const inputRef = react_1.default.createRef();
33
33
  // Options state
@@ -124,7 +124,7 @@ function ComboBox(props) {
124
124
  };
125
125
  }, []);
126
126
  // Layout
127
- return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("input", { ref: inputRef, "data-reset": inputReset ?? true, type: "text", style: { display: "none" }, name: name, value: getValue(stateValue), readOnly: true, onChange: inputOnChange }), (0, jsx_runtime_1.jsxs)(Stack_1.default, { gap: 0.5, direction: "row", width: "100%", children: [(0, jsx_runtime_1.jsx)(Autocomplete_1.default, { value: stateValue, disableCloseOnSelect: disableCloseOnSelect, getOptionLabel: getOptionLabel, isOptionEqualToValue: (option, value) => option[idField] === value[idField], onChange: (event, value, reason, details) => {
127
+ return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("input", { ref: inputRef, "data-reset": inputReset ?? true, type: idIsString ? "text" : "number", name: name, value: getValue(stateValue), readOnly: true, onChange: inputOnChange }), (0, jsx_runtime_1.jsxs)(Stack_1.default, { gap: 0.5, direction: "row", width: "100%", children: [(0, jsx_runtime_1.jsx)(Autocomplete_1.default, { value: stateValue, disableCloseOnSelect: disableCloseOnSelect, getOptionLabel: getOptionLabel, isOptionEqualToValue: (option, value) => option[idField] === value[idField], onChange: (event, value, reason, details) => {
128
128
  // Set value
129
129
  setInputValue(value);
130
130
  // Custom
@@ -23,7 +23,7 @@ function Tiplist(props) {
23
23
  // Labels
24
24
  const { noOptions, loading, more1 = "More", open: openDefault } = app?.getLabels("noOptions", "loading", "more1", "open") ?? {};
25
25
  // Destruct
26
- const { search = false, idField = "id", idValue, inputAutoComplete = "off", inputError, inputHelperText, inputMargin, inputOnChange, inputRequired, inputReset, inputVariant, label, loadData, defaultValue, value, maxItems = 16, width = search ? 160 : undefined, name, readOnly, onChange, onValueChange, openOnFocus = true, noOptionsText = noOptions, loadingText = loading, openText = openDefault, getOptionLabel, getOptionDisabled, sx = {}, minChars, ...rest } = props;
26
+ const { search = false, idField = "id", idValue, idIsString = false, inputAutoComplete = "off", inputError, inputHelperText, inputMargin, inputOnChange, inputRequired, inputReset, inputVariant, label, loadData, defaultValue, value, maxItems = 16, width = search ? 160 : undefined, name, readOnly, onChange, onValueChange, openOnFocus = true, noOptionsText = noOptions, loadingText = loading, openText = openDefault, getOptionLabel, getOptionDisabled, sx = {}, minChars, ...rest } = props;
27
27
  if (width && sx)
28
28
  Object.assign(sx, { width: `${width}px` });
29
29
  // Value input ref
@@ -172,7 +172,7 @@ function Tiplist(props) {
172
172
  };
173
173
  }, []);
174
174
  // Layout
175
- return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("input", { ref: inputRef, "data-reset": inputReset ?? true, type: "text", style: { display: "none" }, name: name, value: `${inputValue ?? (state.current.idSet ? "" : localIdValue ?? "")}`, readOnly: true, onChange: inputOnChange }), (0, jsx_runtime_1.jsx)(Autocomplete_1.default, { filterOptions: (options, _state) => options, value: states.value, options: states.options, onChange: (event, value, reason, details) => {
175
+ return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("input", { ref: inputRef, "data-reset": inputReset ?? true, type: idIsString ? "text" : "number", style: { display: "none" }, name: name, value: `${inputValue ?? (state.current.idSet ? "" : localIdValue ?? "")}`, readOnly: true, onChange: inputOnChange }), (0, jsx_runtime_1.jsx)(Autocomplete_1.default, { filterOptions: (options, _state) => options, value: states.value, options: states.options, onChange: (event, value, reason, details) => {
176
176
  // Set value
177
177
  setInputValue(value);
178
178
  // Custom
@@ -30,6 +30,11 @@ export type TiplistProProps<T extends ListType2 = ListType2> = Omit<Autocomplete
30
30
  * Id value
31
31
  */
32
32
  idValue?: T["id"] | null;
33
+ /**
34
+ * Is the id value a string?
35
+ * @default false
36
+ */
37
+ idIsString?: boolean;
33
38
  /**
34
39
  * Input onChange hanlder
35
40
  */
@@ -22,7 +22,7 @@ function TiplistPro(props) {
22
22
  // Labels
23
23
  const { noOptions, loading, more, open: openDefault } = app?.getLabels("noOptions", "loading", "more", "open") ?? {};
24
24
  // Destruct
25
- const { label, loadData, defaultValue, value, idValue, maxItems = 16, width, name, inputOnChange, inputProps, inputReset, sx, openOnFocus = true, noOptionsText = noOptions, loadingText = loading, openText = openDefault, getOptionDisabled, getOptionLabel, onChange, onValueChange, minChars, ...rest } = props;
25
+ const { label, loadData, defaultValue, value, idValue, idIsString = false, maxItems = 16, width, name, inputOnChange, inputProps, inputReset, sx, openOnFocus = true, noOptionsText = noOptions, loadingText = loading, openText = openDefault, getOptionDisabled, getOptionLabel, onChange, onValueChange, minChars, ...rest } = props;
26
26
  if (width && sx)
27
27
  Object.assign(sx, { width: `${width}px` });
28
28
  // Value input ref
@@ -158,7 +158,7 @@ function TiplistPro(props) {
158
158
  };
159
159
  }, []);
160
160
  // Layout
161
- return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("input", { ref: inputRef, "data-reset": inputReset ?? true, type: "text", style: { display: "none" }, name: name, value: inputValue ?? (state.current.idSet ? "" : localIdValue ?? ""), readOnly: true, onChange: inputOnChange }), (0, jsx_runtime_1.jsx)(Autocomplete_1.default, { filterOptions: (options, _state) => options, value: states.value, options: states.options, freeSolo: true, clearOnBlur: false, onChange: (event, value, reason, details) => {
161
+ return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("input", { ref: inputRef, "data-reset": inputReset ?? true, type: idIsString ? "text" : "number", style: { display: "none" }, name: name, value: inputValue ?? (state.current.idSet ? "" : localIdValue ?? ""), readOnly: true, onChange: inputOnChange }), (0, jsx_runtime_1.jsx)(Autocomplete_1.default, { filterOptions: (options, _state) => options, value: states.value, options: states.options, freeSolo: true, clearOnBlur: false, onChange: (event, value, reason, details) => {
162
162
  if (typeof value === "object") {
163
163
  // Set value
164
164
  setInputValue(value);
@@ -13,6 +13,11 @@ export type AutocompleteExtendedProps<T extends object, D extends DataTypes.Keys
13
13
  * Id value
14
14
  */
15
15
  idValue?: T[D];
16
+ /**
17
+ * Is the id value a string?
18
+ * @default false
19
+ */
20
+ idIsString?: boolean;
16
21
  /**
17
22
  * Autocomplete for the input
18
23
  */
@@ -21,7 +21,7 @@ export function ComboBox(props) {
21
21
  // Labels
22
22
  const labels = app?.getLabels("noOptions", "loading", "open", "add");
23
23
  // Destruct
24
- const { search = false, autoAddBlankItem = search, idField = "id", idValue, inputError, inputHelperText, inputMargin, inputOnChange, inputRequired, inputReset, inputVariant, defaultValue, label, labelField = "label", loadData, onLoadData, name, inputAutoComplete = "off", options, dataReadonly = true, readOnly, onChange, onValueChange, openOnFocus = true, value, disableCloseOnSelect = false, getOptionLabel = (option) => `${option[labelField]}`, sx = { minWidth: "150px", flexGrow: 2 }, noOptionsText = labels?.noOptions, loadingText = labels?.loading, openText = labels?.open, addLabel = labels?.add, onAdd, getOptionKey = (option) => `${option[idField]}`, ...rest } = props;
24
+ const { search = false, autoAddBlankItem = search, idField = "id", idValue, idIsString = false, inputError, inputHelperText, inputMargin, inputOnChange, inputRequired, inputReset, inputVariant, defaultValue, label, labelField = "label", loadData, onLoadData, name, inputAutoComplete = "off", options, dataReadonly = true, readOnly, onChange, onValueChange, openOnFocus = true, value, disableCloseOnSelect = false, getOptionLabel = (option) => `${option[labelField]}`, sx = { minWidth: "150px", flexGrow: 2 }, noOptionsText = labels?.noOptions, loadingText = labels?.loading, openText = labels?.open, addLabel = labels?.add, onAdd, getOptionKey = (option) => `${option[idField]}`, ...rest } = props;
25
25
  // Value input ref
26
26
  const inputRef = React.createRef();
27
27
  // Options state
@@ -118,7 +118,7 @@ export function ComboBox(props) {
118
118
  };
119
119
  }, []);
120
120
  // Layout
121
- return (_jsxs("div", { children: [_jsx("input", { ref: inputRef, "data-reset": inputReset ?? true, type: "text", style: { display: "none" }, name: name, value: getValue(stateValue), readOnly: true, onChange: inputOnChange }), _jsxs(Stack, { gap: 0.5, direction: "row", width: "100%", children: [_jsx(Autocomplete, { value: stateValue, disableCloseOnSelect: disableCloseOnSelect, getOptionLabel: getOptionLabel, isOptionEqualToValue: (option, value) => option[idField] === value[idField], onChange: (event, value, reason, details) => {
121
+ return (_jsxs("div", { children: [_jsx("input", { ref: inputRef, "data-reset": inputReset ?? true, type: idIsString ? "text" : "number", name: name, value: getValue(stateValue), readOnly: true, onChange: inputOnChange }), _jsxs(Stack, { gap: 0.5, direction: "row", width: "100%", children: [_jsx(Autocomplete, { value: stateValue, disableCloseOnSelect: disableCloseOnSelect, getOptionLabel: getOptionLabel, isOptionEqualToValue: (option, value) => option[idField] === value[idField], onChange: (event, value, reason, details) => {
122
122
  // Set value
123
123
  setInputValue(value);
124
124
  // Custom
@@ -17,7 +17,7 @@ export function Tiplist(props) {
17
17
  // Labels
18
18
  const { noOptions, loading, more1 = "More", open: openDefault } = app?.getLabels("noOptions", "loading", "more1", "open") ?? {};
19
19
  // Destruct
20
- const { search = false, idField = "id", idValue, inputAutoComplete = "off", inputError, inputHelperText, inputMargin, inputOnChange, inputRequired, inputReset, inputVariant, label, loadData, defaultValue, value, maxItems = 16, width = search ? 160 : undefined, name, readOnly, onChange, onValueChange, openOnFocus = true, noOptionsText = noOptions, loadingText = loading, openText = openDefault, getOptionLabel, getOptionDisabled, sx = {}, minChars, ...rest } = props;
20
+ const { search = false, idField = "id", idValue, idIsString = false, inputAutoComplete = "off", inputError, inputHelperText, inputMargin, inputOnChange, inputRequired, inputReset, inputVariant, label, loadData, defaultValue, value, maxItems = 16, width = search ? 160 : undefined, name, readOnly, onChange, onValueChange, openOnFocus = true, noOptionsText = noOptions, loadingText = loading, openText = openDefault, getOptionLabel, getOptionDisabled, sx = {}, minChars, ...rest } = props;
21
21
  if (width && sx)
22
22
  Object.assign(sx, { width: `${width}px` });
23
23
  // Value input ref
@@ -166,7 +166,7 @@ export function Tiplist(props) {
166
166
  };
167
167
  }, []);
168
168
  // Layout
169
- return (_jsxs("div", { children: [_jsx("input", { ref: inputRef, "data-reset": inputReset ?? true, type: "text", style: { display: "none" }, name: name, value: `${inputValue ?? (state.current.idSet ? "" : localIdValue ?? "")}`, readOnly: true, onChange: inputOnChange }), _jsx(Autocomplete, { filterOptions: (options, _state) => options, value: states.value, options: states.options, onChange: (event, value, reason, details) => {
169
+ return (_jsxs("div", { children: [_jsx("input", { ref: inputRef, "data-reset": inputReset ?? true, type: idIsString ? "text" : "number", style: { display: "none" }, name: name, value: `${inputValue ?? (state.current.idSet ? "" : localIdValue ?? "")}`, readOnly: true, onChange: inputOnChange }), _jsx(Autocomplete, { filterOptions: (options, _state) => options, value: states.value, options: states.options, onChange: (event, value, reason, details) => {
170
170
  // Set value
171
171
  setInputValue(value);
172
172
  // Custom
@@ -30,6 +30,11 @@ export type TiplistProProps<T extends ListType2 = ListType2> = Omit<Autocomplete
30
30
  * Id value
31
31
  */
32
32
  idValue?: T["id"] | null;
33
+ /**
34
+ * Is the id value a string?
35
+ * @default false
36
+ */
37
+ idIsString?: boolean;
33
38
  /**
34
39
  * Input onChange hanlder
35
40
  */
@@ -16,7 +16,7 @@ export function TiplistPro(props) {
16
16
  // Labels
17
17
  const { noOptions, loading, more, open: openDefault } = app?.getLabels("noOptions", "loading", "more", "open") ?? {};
18
18
  // Destruct
19
- const { label, loadData, defaultValue, value, idValue, maxItems = 16, width, name, inputOnChange, inputProps, inputReset, sx, openOnFocus = true, noOptionsText = noOptions, loadingText = loading, openText = openDefault, getOptionDisabled, getOptionLabel, onChange, onValueChange, minChars, ...rest } = props;
19
+ const { label, loadData, defaultValue, value, idValue, idIsString = false, maxItems = 16, width, name, inputOnChange, inputProps, inputReset, sx, openOnFocus = true, noOptionsText = noOptions, loadingText = loading, openText = openDefault, getOptionDisabled, getOptionLabel, onChange, onValueChange, minChars, ...rest } = props;
20
20
  if (width && sx)
21
21
  Object.assign(sx, { width: `${width}px` });
22
22
  // Value input ref
@@ -152,7 +152,7 @@ export function TiplistPro(props) {
152
152
  };
153
153
  }, []);
154
154
  // Layout
155
- return (_jsxs("div", { children: [_jsx("input", { ref: inputRef, "data-reset": inputReset ?? true, type: "text", style: { display: "none" }, name: name, value: inputValue ?? (state.current.idSet ? "" : localIdValue ?? ""), readOnly: true, onChange: inputOnChange }), _jsx(Autocomplete, { filterOptions: (options, _state) => options, value: states.value, options: states.options, freeSolo: true, clearOnBlur: false, onChange: (event, value, reason, details) => {
155
+ return (_jsxs("div", { children: [_jsx("input", { ref: inputRef, "data-reset": inputReset ?? true, type: idIsString ? "text" : "number", style: { display: "none" }, name: name, value: inputValue ?? (state.current.idSet ? "" : localIdValue ?? ""), readOnly: true, onChange: inputOnChange }), _jsx(Autocomplete, { filterOptions: (options, _state) => options, value: states.value, options: states.options, freeSolo: true, clearOnBlur: false, onChange: (event, value, reason, details) => {
156
156
  if (typeof value === "object") {
157
157
  // Set value
158
158
  setInputValue(value);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/materialui",
3
- "version": "1.5.7",
3
+ "version": "1.5.9",
4
4
  "description": "TypeScript Material-UI Implementation",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -40,10 +40,10 @@
40
40
  "@dnd-kit/sortable": "^10.0.0",
41
41
  "@emotion/react": "^11.14.0",
42
42
  "@emotion/styled": "^11.14.0",
43
- "@etsoo/appscript": "^1.6.20",
44
- "@etsoo/notificationbase": "^1.1.59",
45
- "@etsoo/react": "^1.8.34",
46
- "@etsoo/shared": "^1.2.63",
43
+ "@etsoo/appscript": "^1.6.21",
44
+ "@etsoo/notificationbase": "^1.1.60",
45
+ "@etsoo/react": "^1.8.35",
46
+ "@etsoo/shared": "^1.2.66",
47
47
  "@mui/icons-material": "^7.0.1",
48
48
  "@mui/material": "^7.0.1",
49
49
  "@mui/x-data-grid": "^7.28.2",
@@ -83,6 +83,6 @@
83
83
  "@vitejs/plugin-react": "^4.3.4",
84
84
  "jsdom": "^26.0.0",
85
85
  "typescript": "^5.8.2",
86
- "vitest": "^3.0.9"
86
+ "vitest": "^3.1.1"
87
87
  }
88
88
  }
@@ -23,6 +23,12 @@ export type AutocompleteExtendedProps<
23
23
  */
24
24
  idValue?: T[D];
25
25
 
26
+ /**
27
+ * Is the id value a string?
28
+ * @default false
29
+ */
30
+ idIsString?: boolean;
31
+
26
32
  /**
27
33
  * Autocomplete for the input
28
34
  */
package/src/ComboBox.tsx CHANGED
@@ -90,6 +90,7 @@ export function ComboBox<
90
90
  autoAddBlankItem = search,
91
91
  idField = "id" as D,
92
92
  idValue,
93
+ idIsString = false,
93
94
  inputError,
94
95
  inputHelperText,
95
96
  inputMargin,
@@ -239,8 +240,7 @@ export function ComboBox<
239
240
  <input
240
241
  ref={inputRef}
241
242
  data-reset={inputReset ?? true}
242
- type="text"
243
- style={{ display: "none" }}
243
+ type={idIsString ? "text" : "number"}
244
244
  name={name}
245
245
  value={getValue(stateValue)}
246
246
  readOnly
package/src/Tiplist.tsx CHANGED
@@ -74,6 +74,7 @@ export function Tiplist<
74
74
  search = false,
75
75
  idField = "id" as D,
76
76
  idValue,
77
+ idIsString = false,
77
78
  inputAutoComplete = "off",
78
79
  inputError,
79
80
  inputHelperText,
@@ -287,7 +288,7 @@ export function Tiplist<
287
288
  <input
288
289
  ref={inputRef}
289
290
  data-reset={inputReset ?? true}
290
- type="text"
291
+ type={idIsString ? "text" : "number"}
291
292
  style={{ display: "none" }}
292
293
  name={name}
293
294
  value={`${
@@ -46,6 +46,12 @@ export type TiplistProProps<T extends ListType2 = ListType2> = Omit<
46
46
  */
47
47
  idValue?: T["id"] | null;
48
48
 
49
+ /**
50
+ * Is the id value a string?
51
+ * @default false
52
+ */
53
+ idIsString?: boolean;
54
+
49
55
  /**
50
56
  * Input onChange hanlder
51
57
  */
@@ -107,6 +113,7 @@ export function TiplistPro<T extends ListType2 = ListType2>(
107
113
  defaultValue,
108
114
  value,
109
115
  idValue,
116
+ idIsString = false,
110
117
  maxItems = 16,
111
118
  width,
112
119
  name,
@@ -294,7 +301,7 @@ export function TiplistPro<T extends ListType2 = ListType2>(
294
301
  <input
295
302
  ref={inputRef}
296
303
  data-reset={inputReset ?? true}
297
- type="text"
304
+ type={idIsString ? "text" : "number"}
298
305
  style={{ display: "none" }}
299
306
  name={name}
300
307
  value={inputValue ?? (state.current.idSet ? "" : localIdValue ?? "")}