@etsoo/materialui 1.6.0 → 1.6.2

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.
@@ -73,6 +73,7 @@ export type AutocompleteExtendedProps<T extends object, D extends DataTypes.Keys
73
73
  /**
74
74
  * Value change handler
75
75
  * @param value New value
76
+ * @param input Input element
76
77
  */
77
- onValueChange?: (value: T | null) => void;
78
+ onValueChange?: (value: T | null, input?: HTMLInputElement | null) => void;
78
79
  };
@@ -56,7 +56,7 @@ function ComboBox(props) {
56
56
  if (localValue != null && localValue != stateValue) {
57
57
  setStateValue(localValue);
58
58
  if (onValueChange)
59
- onValueChange(localValue);
59
+ onValueChange(localValue, inputRef.current);
60
60
  }
61
61
  }, [localValue]);
62
62
  // Add readOnly
@@ -131,7 +131,7 @@ function ComboBox(props) {
131
131
  if (onChange != null)
132
132
  onChange(event, value, reason, details);
133
133
  if (onValueChange)
134
- onValueChange(value);
134
+ onValueChange(value, inputRef.current);
135
135
  }, openOnFocus: openOnFocus, sx: sx, renderInput: (params) => search ? ((0, jsx_runtime_1.jsx)(SearchField_1.SearchField, { ...addReadOnly(params), label: label, name: name + "Input", margin: inputMargin, variant: inputVariant, required: inputRequired, error: inputError, helperText: inputHelperText })) : ((0, jsx_runtime_1.jsx)(InputField_1.InputField, { ...addReadOnly(params), label: label, name: name + "Input", margin: inputMargin, variant: inputVariant, required: inputRequired, error: inputError, helperText: inputHelperText })), options: localOptions, noOptionsText: noOptionsText, loadingText: loadingText, openText: openText, getOptionKey: getOptionKey, ...rest }), onAdd && ((0, jsx_runtime_1.jsx)(IconButton_1.default, { size: "small", onClick: () => {
136
136
  onAdd(doLoadData);
137
137
  }, title: addLabel, children: (0, jsx_runtime_1.jsx)(Add_1.default, {}) }))] })] }));
@@ -0,0 +1,38 @@
1
+ import { ButtonGroupProps } from "@mui/material/ButtonGroup";
2
+ /**
3
+ * Down & Up Button Props
4
+ */
5
+ export type DownUpButtonProps = Omit<ButtonGroupProps, "orientation"> & {
6
+ /**
7
+ * Is down button disabled
8
+ */
9
+ downDisabled?: boolean;
10
+ /**
11
+ * Down button label
12
+ */
13
+ downLabel?: string;
14
+ /**
15
+ * Is up button disabled
16
+ */
17
+ upDisabled?: boolean;
18
+ /**
19
+ * Up button label
20
+ */
21
+ upLabel?: string;
22
+ /**
23
+ * Down button click handler
24
+ * @param event Mouse click event
25
+ */
26
+ onDownClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
27
+ /**
28
+ * Up button click handler
29
+ * @param event Mouse click event
30
+ */
31
+ onUpClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
32
+ };
33
+ /**
34
+ * Down & Up Button
35
+ * @param props Props
36
+ * @returns Component
37
+ */
38
+ export declare function DownUpButton(props: DownUpButtonProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.DownUpButton = DownUpButton;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const Button_1 = __importDefault(require("@mui/material/Button"));
9
+ const ButtonGroup_1 = __importDefault(require("@mui/material/ButtonGroup"));
10
+ const ReactApp_1 = require("./app/ReactApp");
11
+ /**
12
+ * Down & Up Button
13
+ * @param props Props
14
+ * @returns Component
15
+ */
16
+ function DownUpButton(props) {
17
+ // Global app
18
+ const app = (0, ReactApp_1.useAppContext)();
19
+ // Destruct
20
+ const { size = "small", downDisabled, downLabel = app?.get("moveDown") ?? "Down", upDisabled, upLabel = app?.get("moveUp") ?? "Up", onDownClick, onUpClick, ...rest } = props;
21
+ return ((0, jsx_runtime_1.jsxs)(ButtonGroup_1.default, { orientation: "vertical", size: size, ...rest, children: [(0, jsx_runtime_1.jsx)(Button_1.default, { disabled: upDisabled, onClick: onUpClick, children: upLabel }), (0, jsx_runtime_1.jsx)(Button_1.default, { disabled: downDisabled, onClick: onDownClick, children: downLabel })] }));
22
+ }
@@ -113,7 +113,7 @@ function Tiplist(props) {
113
113
  if (id && options && onValueChange) {
114
114
  const option = options.find((o) => o[idField] === id);
115
115
  if (option)
116
- onValueChange(option);
116
+ onValueChange(option, inputRef.current);
117
117
  }
118
118
  // Indicates loading completed
119
119
  stateUpdate({
@@ -183,7 +183,7 @@ function Tiplist(props) {
183
183
  if (onChange != null)
184
184
  onChange(event, value, reason, details);
185
185
  if (onValueChange)
186
- onValueChange(value);
186
+ onValueChange(value, inputRef.current);
187
187
  // For clear case
188
188
  if (reason === "clear") {
189
189
  stateUpdate({ options: [], open: event.type === "click" });
@@ -55,6 +55,7 @@ export * from "./DataSteps";
55
55
  export * from "./DataTable";
56
56
  export * from "./DialogButton";
57
57
  export * from "./DnDList";
58
+ export * from "./DownUpButton";
58
59
  export * from "./DraggablePaperComponent";
59
60
  export * from "./EmailInput";
60
61
  export * from "./ErrorAlert";
package/lib/cjs/index.js CHANGED
@@ -71,6 +71,7 @@ __exportStar(require("./DataSteps"), exports);
71
71
  __exportStar(require("./DataTable"), exports);
72
72
  __exportStar(require("./DialogButton"), exports);
73
73
  __exportStar(require("./DnDList"), exports);
74
+ __exportStar(require("./DownUpButton"), exports);
74
75
  __exportStar(require("./DraggablePaperComponent"), exports);
75
76
  __exportStar(require("./EmailInput"), exports);
76
77
  __exportStar(require("./ErrorAlert"), exports);
@@ -73,6 +73,7 @@ export type AutocompleteExtendedProps<T extends object, D extends DataTypes.Keys
73
73
  /**
74
74
  * Value change handler
75
75
  * @param value New value
76
+ * @param input Input element
76
77
  */
77
- onValueChange?: (value: T | null) => void;
78
+ onValueChange?: (value: T | null, input?: HTMLInputElement | null) => void;
78
79
  };
@@ -50,7 +50,7 @@ export function ComboBox(props) {
50
50
  if (localValue != null && localValue != stateValue) {
51
51
  setStateValue(localValue);
52
52
  if (onValueChange)
53
- onValueChange(localValue);
53
+ onValueChange(localValue, inputRef.current);
54
54
  }
55
55
  }, [localValue]);
56
56
  // Add readOnly
@@ -125,7 +125,7 @@ export function ComboBox(props) {
125
125
  if (onChange != null)
126
126
  onChange(event, value, reason, details);
127
127
  if (onValueChange)
128
- onValueChange(value);
128
+ onValueChange(value, inputRef.current);
129
129
  }, openOnFocus: openOnFocus, sx: sx, renderInput: (params) => search ? (_jsx(SearchField, { ...addReadOnly(params), label: label, name: name + "Input", margin: inputMargin, variant: inputVariant, required: inputRequired, error: inputError, helperText: inputHelperText })) : (_jsx(InputField, { ...addReadOnly(params), label: label, name: name + "Input", margin: inputMargin, variant: inputVariant, required: inputRequired, error: inputError, helperText: inputHelperText })), options: localOptions, noOptionsText: noOptionsText, loadingText: loadingText, openText: openText, getOptionKey: getOptionKey, ...rest }), onAdd && (_jsx(IconButton, { size: "small", onClick: () => {
130
130
  onAdd(doLoadData);
131
131
  }, title: addLabel, children: _jsx(AddIcon, {}) }))] })] }));
@@ -0,0 +1,38 @@
1
+ import { ButtonGroupProps } from "@mui/material/ButtonGroup";
2
+ /**
3
+ * Down & Up Button Props
4
+ */
5
+ export type DownUpButtonProps = Omit<ButtonGroupProps, "orientation"> & {
6
+ /**
7
+ * Is down button disabled
8
+ */
9
+ downDisabled?: boolean;
10
+ /**
11
+ * Down button label
12
+ */
13
+ downLabel?: string;
14
+ /**
15
+ * Is up button disabled
16
+ */
17
+ upDisabled?: boolean;
18
+ /**
19
+ * Up button label
20
+ */
21
+ upLabel?: string;
22
+ /**
23
+ * Down button click handler
24
+ * @param event Mouse click event
25
+ */
26
+ onDownClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
27
+ /**
28
+ * Up button click handler
29
+ * @param event Mouse click event
30
+ */
31
+ onUpClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
32
+ };
33
+ /**
34
+ * Down & Up Button
35
+ * @param props Props
36
+ * @returns Component
37
+ */
38
+ export declare function DownUpButton(props: DownUpButtonProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,16 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import Button from "@mui/material/Button";
3
+ import ButtonGroup from "@mui/material/ButtonGroup";
4
+ import { useAppContext } from "./app/ReactApp";
5
+ /**
6
+ * Down & Up Button
7
+ * @param props Props
8
+ * @returns Component
9
+ */
10
+ export function DownUpButton(props) {
11
+ // Global app
12
+ const app = useAppContext();
13
+ // Destruct
14
+ const { size = "small", downDisabled, downLabel = app?.get("moveDown") ?? "Down", upDisabled, upLabel = app?.get("moveUp") ?? "Up", onDownClick, onUpClick, ...rest } = props;
15
+ return (_jsxs(ButtonGroup, { orientation: "vertical", size: size, ...rest, children: [_jsx(Button, { disabled: upDisabled, onClick: onUpClick, children: upLabel }), _jsx(Button, { disabled: downDisabled, onClick: onDownClick, children: downLabel })] }));
16
+ }
@@ -107,7 +107,7 @@ export function Tiplist(props) {
107
107
  if (id && options && onValueChange) {
108
108
  const option = options.find((o) => o[idField] === id);
109
109
  if (option)
110
- onValueChange(option);
110
+ onValueChange(option, inputRef.current);
111
111
  }
112
112
  // Indicates loading completed
113
113
  stateUpdate({
@@ -177,7 +177,7 @@ export function Tiplist(props) {
177
177
  if (onChange != null)
178
178
  onChange(event, value, reason, details);
179
179
  if (onValueChange)
180
- onValueChange(value);
180
+ onValueChange(value, inputRef.current);
181
181
  // For clear case
182
182
  if (reason === "clear") {
183
183
  stateUpdate({ options: [], open: event.type === "click" });
@@ -55,6 +55,7 @@ export * from "./DataSteps";
55
55
  export * from "./DataTable";
56
56
  export * from "./DialogButton";
57
57
  export * from "./DnDList";
58
+ export * from "./DownUpButton";
58
59
  export * from "./DraggablePaperComponent";
59
60
  export * from "./EmailInput";
60
61
  export * from "./ErrorAlert";
package/lib/mjs/index.js CHANGED
@@ -55,6 +55,7 @@ export * from "./DataSteps";
55
55
  export * from "./DataTable";
56
56
  export * from "./DialogButton";
57
57
  export * from "./DnDList";
58
+ export * from "./DownUpButton";
58
59
  export * from "./DraggablePaperComponent";
59
60
  export * from "./EmailInput";
60
61
  export * from "./ErrorAlert";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/materialui",
3
- "version": "1.6.0",
3
+ "version": "1.6.2",
4
4
  "description": "TypeScript Material-UI Implementation",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -40,9 +40,9 @@
40
40
  "@dnd-kit/sortable": "^10.0.0",
41
41
  "@emotion/react": "^11.14.0",
42
42
  "@emotion/styled": "^11.14.1",
43
- "@etsoo/appscript": "^1.6.51",
43
+ "@etsoo/appscript": "^1.6.52",
44
44
  "@etsoo/notificationbase": "^1.1.66",
45
- "@etsoo/react": "^1.8.68",
45
+ "@etsoo/react": "^1.8.69",
46
46
  "@etsoo/shared": "^1.2.80",
47
47
  "@mui/icons-material": "^7.3.7",
48
48
  "@mui/material": "^7.3.7",
@@ -96,6 +96,7 @@ export type AutocompleteExtendedProps<
96
96
  /**
97
97
  * Value change handler
98
98
  * @param value New value
99
+ * @param input Input element
99
100
  */
100
- onValueChange?: (value: T | null) => void;
101
+ onValueChange?: (value: T | null, input?: HTMLInputElement | null) => void;
101
102
  };
package/src/ComboBox.tsx CHANGED
@@ -160,7 +160,7 @@ export function ComboBox<
160
160
  React.useEffect(() => {
161
161
  if (localValue != null && localValue != stateValue) {
162
162
  setStateValue(localValue);
163
- if (onValueChange) onValueChange(localValue);
163
+ if (onValueChange) onValueChange(localValue, inputRef.current);
164
164
  }
165
165
  }, [localValue]);
166
166
 
@@ -266,7 +266,7 @@ export function ComboBox<
266
266
  // Custom
267
267
  if (onChange != null) onChange(event, value, reason, details);
268
268
 
269
- if (onValueChange) onValueChange(value);
269
+ if (onValueChange) onValueChange(value, inputRef.current);
270
270
  }}
271
271
  openOnFocus={openOnFocus}
272
272
  sx={sx}
@@ -0,0 +1,73 @@
1
+ import Button from "@mui/material/Button";
2
+ import ButtonGroup, { ButtonGroupProps } from "@mui/material/ButtonGroup";
3
+ import { useAppContext } from "./app/ReactApp";
4
+
5
+ /**
6
+ * Down & Up Button Props
7
+ */
8
+ export type DownUpButtonProps = Omit<ButtonGroupProps, "orientation"> & {
9
+ /**
10
+ * Is down button disabled
11
+ */
12
+ downDisabled?: boolean;
13
+
14
+ /**
15
+ * Down button label
16
+ */
17
+ downLabel?: string;
18
+
19
+ /**
20
+ * Is up button disabled
21
+ */
22
+ upDisabled?: boolean;
23
+
24
+ /**
25
+ * Up button label
26
+ */
27
+ upLabel?: string;
28
+
29
+ /**
30
+ * Down button click handler
31
+ * @param event Mouse click event
32
+ */
33
+ onDownClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
34
+
35
+ /**
36
+ * Up button click handler
37
+ * @param event Mouse click event
38
+ */
39
+ onUpClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
40
+ };
41
+
42
+ /**
43
+ * Down & Up Button
44
+ * @param props Props
45
+ * @returns Component
46
+ */
47
+ export function DownUpButton(props: DownUpButtonProps) {
48
+ // Global app
49
+ const app = useAppContext();
50
+
51
+ // Destruct
52
+ const {
53
+ size = "small",
54
+ downDisabled,
55
+ downLabel = app?.get("moveDown") ?? "Down",
56
+ upDisabled,
57
+ upLabel = app?.get("moveUp") ?? "Up",
58
+ onDownClick,
59
+ onUpClick,
60
+ ...rest
61
+ } = props;
62
+
63
+ return (
64
+ <ButtonGroup orientation="vertical" size={size} {...rest}>
65
+ <Button disabled={upDisabled} onClick={onUpClick}>
66
+ {upLabel}
67
+ </Button>
68
+ <Button disabled={downDisabled} onClick={onDownClick}>
69
+ {downLabel}
70
+ </Button>
71
+ </ButtonGroup>
72
+ );
73
+ }
package/src/Tiplist.tsx CHANGED
@@ -220,7 +220,7 @@ export function Tiplist<
220
220
 
221
221
  if (id && options && onValueChange) {
222
222
  const option = options.find((o) => o[idField] === id);
223
- if (option) onValueChange(option);
223
+ if (option) onValueChange(option, inputRef.current);
224
224
  }
225
225
 
226
226
  // Indicates loading completed
@@ -318,7 +318,7 @@ export function Tiplist<
318
318
  // Custom
319
319
  if (onChange != null) onChange(event, value, reason, details);
320
320
 
321
- if (onValueChange) onValueChange(value);
321
+ if (onValueChange) onValueChange(value, inputRef.current);
322
322
 
323
323
  // For clear case
324
324
  if (reason === "clear") {
package/src/index.ts CHANGED
@@ -61,6 +61,7 @@ export * from "./DataSteps";
61
61
  export * from "./DataTable";
62
62
  export * from "./DialogButton";
63
63
  export * from "./DnDList";
64
+ export * from "./DownUpButton";
64
65
  export * from "./DraggablePaperComponent";
65
66
  export * from "./EmailInput";
66
67
  export * from "./ErrorAlert";