@etsoo/materialui 1.5.51 → 1.5.52

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.
@@ -20,6 +20,7 @@ const TextField_1 = __importDefault(require("@mui/material/TextField"));
20
20
  const DnDList_1 = require("./DnDList");
21
21
  const FlexBox_1 = require("./FlexBox");
22
22
  const ReactApp_1 = require("./app/ReactApp");
23
+ const FormLabel_1 = __importDefault(require("@mui/material/FormLabel"));
23
24
  function ButtonPopupList(props) {
24
25
  // Destruct
25
26
  const { addSplitter = /\s*[,;]\s*/, ids = [], items, labelField, labelFormatter, labels, onAdd, onValueChange } = props;
@@ -72,12 +73,12 @@ function ButtonPopupCheckbox(props) {
72
73
  // App
73
74
  const app = (0, ReactApp_1.useRequiredAppContext)();
74
75
  // Destruct
75
- const { addSplitter, ids, inputName, label, labelEnd, labelFormatter = (data) => {
76
+ const { addSplitter, ids = [], inputName, label, labelEnd, labelFormatter = (data) => {
76
77
  if (labelField in data) {
77
78
  return data[labelField];
78
79
  }
79
80
  return data.id.toString();
80
- }, labelField, labels = {}, loadData, onAdd, onValueChange, popupTitle = label, popupMessage, required = false, sx = { gap: 1, justifyContent: "flex-start" }, variant = "outlined", ...rest } = props;
81
+ }, labelField, labels = {}, loadData, onAdd, onValueChange, popupTitle = label, popupMessage, required = false, sx = { gap: 1, justifyContent: "flex-start", minHeight: "56px" }, variant = "outlined", ...rest } = props;
81
82
  // Default labels
82
83
  if (!labels.add)
83
84
  labels.add = app.get("add");
@@ -120,7 +121,7 @@ function ButtonPopupCheckbox(props) {
120
121
  fullScreen: app.smDown
121
122
  });
122
123
  };
123
- return ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)("input", { type: "text", style: { position: "absolute", opacity: 0, width: 0 }, name: inputName, required: required, defaultValue: selectedIds?.join(",") }), (0, jsx_runtime_1.jsxs)(Button_1.default, { variant: variant, sx: sx, onClick: () => clickHandler(), ...rest, disabled: !items || items.length === 0, children: [label && (0, jsx_runtime_1.jsxs)(Typography_1.default, { variant: "body2", children: [label, ":"] }), selectedIds?.map((id) => {
124
+ return ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)("input", { type: "text", style: { position: "absolute", opacity: 0, width: 0 }, name: inputName, required: required, defaultValue: selectedIds?.join(",") }), (0, jsx_runtime_1.jsxs)(Button_1.default, { variant: variant, sx: sx, onClick: () => clickHandler(), ...rest, disabled: !items || items.length === 0, children: [label && ((0, jsx_runtime_1.jsx)(FormLabel_1.default, { required: required, sx: { fontSize: (theme) => theme.typography.body2.fontSize }, children: label })), selectedIds?.map((id) => {
124
125
  const item = items.find((item) => item.id === id);
125
126
  if (item == null)
126
127
  return null;
@@ -14,6 +14,7 @@ import TextField from "@mui/material/TextField";
14
14
  import { DnDList } from "./DnDList";
15
15
  import { HBox, VBox } from "./FlexBox";
16
16
  import { useRequiredAppContext } from "./app/ReactApp";
17
+ import FormLabel from "@mui/material/FormLabel";
17
18
  function ButtonPopupList(props) {
18
19
  // Destruct
19
20
  const { addSplitter = /\s*[,;]\s*/, ids = [], items, labelField, labelFormatter, labels, onAdd, onValueChange } = props;
@@ -66,12 +67,12 @@ export function ButtonPopupCheckbox(props) {
66
67
  // App
67
68
  const app = useRequiredAppContext();
68
69
  // Destruct
69
- const { addSplitter, ids, inputName, label, labelEnd, labelFormatter = (data) => {
70
+ const { addSplitter, ids = [], inputName, label, labelEnd, labelFormatter = (data) => {
70
71
  if (labelField in data) {
71
72
  return data[labelField];
72
73
  }
73
74
  return data.id.toString();
74
- }, labelField, labels = {}, loadData, onAdd, onValueChange, popupTitle = label, popupMessage, required = false, sx = { gap: 1, justifyContent: "flex-start" }, variant = "outlined", ...rest } = props;
75
+ }, labelField, labels = {}, loadData, onAdd, onValueChange, popupTitle = label, popupMessage, required = false, sx = { gap: 1, justifyContent: "flex-start", minHeight: "56px" }, variant = "outlined", ...rest } = props;
75
76
  // Default labels
76
77
  if (!labels.add)
77
78
  labels.add = app.get("add");
@@ -114,7 +115,7 @@ export function ButtonPopupCheckbox(props) {
114
115
  fullScreen: app.smDown
115
116
  });
116
117
  };
117
- return (_jsxs(React.Fragment, { children: [_jsx("input", { type: "text", style: { position: "absolute", opacity: 0, width: 0 }, name: inputName, required: required, defaultValue: selectedIds?.join(",") }), _jsxs(Button, { variant: variant, sx: sx, onClick: () => clickHandler(), ...rest, disabled: !items || items.length === 0, children: [label && _jsxs(Typography, { variant: "body2", children: [label, ":"] }), selectedIds?.map((id) => {
118
+ return (_jsxs(React.Fragment, { children: [_jsx("input", { type: "text", style: { position: "absolute", opacity: 0, width: 0 }, name: inputName, required: required, defaultValue: selectedIds?.join(",") }), _jsxs(Button, { variant: variant, sx: sx, onClick: () => clickHandler(), ...rest, disabled: !items || items.length === 0, children: [label && (_jsx(FormLabel, { required: required, sx: { fontSize: (theme) => theme.typography.body2.fontSize }, children: label })), selectedIds?.map((id) => {
118
119
  const item = items.find((item) => item.id === id);
119
120
  if (item == null)
120
121
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/materialui",
3
- "version": "1.5.51",
3
+ "version": "1.5.52",
4
4
  "description": "TypeScript Material-UI Implementation",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -14,6 +14,7 @@ import TextField from "@mui/material/TextField";
14
14
  import { DnDList, DnDListRef } from "./DnDList";
15
15
  import { HBox, VBox } from "./FlexBox";
16
16
  import { useRequiredAppContext } from "./app/ReactApp";
17
+ import FormLabel from "@mui/material/FormLabel";
17
18
 
18
19
  type DnDItemType = {
19
20
  id: IdType;
@@ -261,7 +262,7 @@ export function ButtonPopupCheckbox<D extends DnDItemType>(
261
262
  // Destruct
262
263
  const {
263
264
  addSplitter,
264
- ids,
265
+ ids = [],
265
266
  inputName,
266
267
  label,
267
268
  labelEnd,
@@ -280,7 +281,7 @@ export function ButtonPopupCheckbox<D extends DnDItemType>(
280
281
  popupTitle = label,
281
282
  popupMessage,
282
283
  required = false,
283
- sx = { gap: 1, justifyContent: "flex-start" },
284
+ sx = { gap: 1, justifyContent: "flex-start", minHeight: "56px" },
284
285
  variant = "outlined",
285
286
  ...rest
286
287
  } = props;
@@ -356,7 +357,14 @@ export function ButtonPopupCheckbox<D extends DnDItemType>(
356
357
  {...rest}
357
358
  disabled={!items || items.length === 0}
358
359
  >
359
- {label && <Typography variant="body2">{label}:</Typography>}
360
+ {label && (
361
+ <FormLabel
362
+ required={required}
363
+ sx={{ fontSize: (theme) => theme.typography.body2.fontSize }}
364
+ >
365
+ {label}
366
+ </FormLabel>
367
+ )}
360
368
  {selectedIds?.map((id) => {
361
369
  const item = items.find((item) => item.id === id);
362
370
  if (item == null) return null;