xladmin 0.4.0 → 0.5.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.
Files changed (2) hide show
  1. package/dist/index.js +95 -105
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -876,9 +876,13 @@ var FieldEditor = memo(function FieldEditor2({
876
876
  size: "small",
877
877
  required: field.required,
878
878
  sx: buildRequiredLabelSx(),
879
- placeholder: (_a = field.placeholder) != null ? _a : void 0,
880
- helperText: (_b = field.help_text) != null ? _b : void 0,
881
- slotProps: { htmlInput: buildHtmlInputProps(field) }
879
+ helperText: (_a = field.help_text) != null ? _a : void 0,
880
+ slotProps: {
881
+ htmlInput: {
882
+ ...buildHtmlInputProps(field),
883
+ placeholder: (_b = field.placeholder) != null ? _b : void 0
884
+ }
885
+ }
882
886
  }
883
887
  }
884
888
  }
@@ -910,9 +914,13 @@ var FieldEditor = memo(function FieldEditor2({
910
914
  size: "small",
911
915
  required: field.required,
912
916
  sx: buildRequiredLabelSx(),
913
- placeholder: (_c = field.placeholder) != null ? _c : void 0,
914
- helperText: (_d = field.help_text) != null ? _d : void 0,
915
- slotProps: { htmlInput: buildHtmlInputProps(field) }
917
+ helperText: (_c = field.help_text) != null ? _c : void 0,
918
+ slotProps: {
919
+ htmlInput: {
920
+ ...buildHtmlInputProps(field),
921
+ placeholder: (_d = field.placeholder) != null ? _d : void 0
922
+ }
923
+ }
916
924
  }
917
925
  }
918
926
  }
@@ -1044,8 +1052,8 @@ function renderChoiceEditor({
1044
1052
  listbox: { sx: { maxHeight: 240 } }
1045
1053
  },
1046
1054
  renderInput: (params) => (() => {
1047
- var _a2, _b;
1048
- const { InputProps, inputProps, ...textFieldParams } = params;
1055
+ var _a2, _b, _c;
1056
+ const { slotProps, ...textFieldParams } = params;
1049
1057
  return /* @__PURE__ */ jsx3(
1050
1058
  TextField,
1051
1059
  {
@@ -1056,15 +1064,16 @@ function renderChoiceEditor({
1056
1064
  placeholder: (_a2 = field.placeholder) != null ? _a2 : searchPlaceholder,
1057
1065
  helperText: (_b = field.help_text) != null ? _b : void 0,
1058
1066
  slotProps: {
1067
+ inputLabel: slotProps.inputLabel,
1059
1068
  input: {
1060
- ...InputProps,
1069
+ ...slotProps.input,
1061
1070
  endAdornment: /* @__PURE__ */ jsxs(Fragment, { children: [
1062
1071
  isLoadingChoices ? /* @__PURE__ */ jsx3(CircularProgress, { color: "inherit", size: 16 }) : null,
1063
- InputProps.endAdornment
1072
+ (_c = slotProps.input) == null ? void 0 : _c.endAdornment
1064
1073
  ] })
1065
1074
  },
1066
1075
  htmlInput: {
1067
- ...inputProps,
1076
+ ...slotProps.htmlInput,
1068
1077
  autoComplete: "new-password",
1069
1078
  name: `admin-choice-${field.name}`
1070
1079
  }
@@ -1104,8 +1113,8 @@ function renderChoiceEditor({
1104
1113
  listbox: { sx: { maxHeight: 240 } }
1105
1114
  },
1106
1115
  renderInput: (params) => (() => {
1107
- var _a2, _b;
1108
- const { InputProps, inputProps, ...textFieldParams } = params;
1116
+ var _a2, _b, _c;
1117
+ const { slotProps, ...textFieldParams } = params;
1109
1118
  return /* @__PURE__ */ jsx3(
1110
1119
  TextField,
1111
1120
  {
@@ -1116,15 +1125,16 @@ function renderChoiceEditor({
1116
1125
  placeholder: (_a2 = field.placeholder) != null ? _a2 : searchPlaceholder,
1117
1126
  helperText: (_b = field.help_text) != null ? _b : void 0,
1118
1127
  slotProps: {
1128
+ inputLabel: slotProps.inputLabel,
1119
1129
  input: {
1120
- ...InputProps,
1130
+ ...slotProps.input,
1121
1131
  endAdornment: /* @__PURE__ */ jsxs(Fragment, { children: [
1122
1132
  isLoadingChoices ? /* @__PURE__ */ jsx3(CircularProgress, { color: "inherit", size: 16 }) : null,
1123
- InputProps.endAdornment
1133
+ (_c = slotProps.input) == null ? void 0 : _c.endAdornment
1124
1134
  ] })
1125
1135
  },
1126
1136
  htmlInput: {
1127
- ...inputProps,
1137
+ ...slotProps.htmlInput,
1128
1138
  autoComplete: "new-password",
1129
1139
  name: `admin-choice-${field.name}`
1130
1140
  }
@@ -1294,8 +1304,8 @@ function stringifyJsonValue(value) {
1294
1304
 
1295
1305
  // src/components/layout/AdminMessageContext.tsx
1296
1306
  import { createContext as createContext3, useCallback as useCallback2, useContext as useContext3, useEffect as useEffect3, useMemo as useMemo4, useRef as useRef3, useState as useState3 } from "react";
1297
- import CheckCircleOutlineIcon from "@mui/icons-material/CheckCircleOutline";
1298
- import ErrorOutlineIcon from "@mui/icons-material/ErrorOutline";
1307
+ import CheckCircleOutlinedIcon from "@mui/icons-material/CheckCircleOutlined";
1308
+ import ErrorOutlinedIcon from "@mui/icons-material/ErrorOutlined";
1299
1309
  import InfoOutlinedIcon from "@mui/icons-material/InfoOutlined";
1300
1310
  import { Box, Paper, Portal, Stack, Typography } from "@mui/material";
1301
1311
  import { alpha, useTheme } from "@mui/material/styles";
@@ -1435,7 +1445,7 @@ function AdminMessageBubble({
1435
1445
  }
1436
1446
  }
1437
1447
  },
1438
- children: /* @__PURE__ */ jsxs2(Stack, { direction: "row", spacing: 1.125, alignItems: "center", children: [
1448
+ children: /* @__PURE__ */ jsxs2(Stack, { direction: "row", spacing: 1.125, sx: { alignItems: "center" }, children: [
1439
1449
  /* @__PURE__ */ jsx4(
1440
1450
  Box,
1441
1451
  {
@@ -1477,7 +1487,7 @@ function AdminMessageBubble({
1477
1487
  function getBubbleAppearance(theme, kind) {
1478
1488
  if (kind === "success") {
1479
1489
  return {
1480
- icon: CheckCircleOutlineIcon,
1490
+ icon: CheckCircleOutlinedIcon,
1481
1491
  backgroundColor: alpha(theme.palette.success.main, 0.6),
1482
1492
  iconColor: theme.palette.common.white,
1483
1493
  iconBackgroundColor: alpha(theme.palette.common.white, 0.14),
@@ -1486,7 +1496,7 @@ function getBubbleAppearance(theme, kind) {
1486
1496
  }
1487
1497
  if (kind === "error") {
1488
1498
  return {
1489
- icon: ErrorOutlineIcon,
1499
+ icon: ErrorOutlinedIcon,
1490
1500
  backgroundColor: alpha(theme.palette.error.main, 0.6),
1491
1501
  iconColor: theme.palette.common.white,
1492
1502
  iconBackgroundColor: alpha(theme.palette.common.white, 0.14),
@@ -2150,84 +2160,64 @@ function MainHeader({ title, subtitle, details, error, beforeTitle, beforeSubtit
2150
2160
  },
2151
2161
  children: [
2152
2162
  /* @__PURE__ */ jsxs7(Stack5, { spacing: 0.5, children: [
2153
- /* @__PURE__ */ jsxs7(
2154
- Stack5,
2155
- {
2156
- direction: "row",
2157
- spacing: 1.5,
2158
- alignItems: "center",
2159
- justifyContent: "space-between",
2160
- sx: { minWidth: 0 },
2161
- children: [
2162
- /* @__PURE__ */ jsxs7(Stack5, { direction: "row", spacing: 1, alignItems: "center", sx: { minWidth: 0, flex: 1 }, children: [
2163
- isMobile ? /* @__PURE__ */ jsx13(Box5, { sx: { display: "flex", alignItems: "center", flexShrink: 0 }, children: /* @__PURE__ */ jsx13(
2164
- IconButton,
2165
- {
2166
- "aria-label": t("menu"),
2167
- onClick: openMobileSidebar,
2168
- size: "small",
2169
- sx: { ml: -0.5 },
2170
- children: /* @__PURE__ */ jsx13(MenuIcon, { fontSize: "small" })
2171
- }
2172
- ) }) : null,
2173
- beforeTitle ? /* @__PURE__ */ jsx13(Box5, { sx: { display: "flex", alignItems: "center", flexShrink: 0 }, children: beforeTitle }) : null,
2174
- /* @__PURE__ */ jsx13(
2175
- Typography3,
2176
- {
2177
- variant: "h5",
2178
- sx: {
2179
- fontWeight: 600,
2180
- lineHeight: "2.125rem",
2181
- minWidth: 0
2182
- },
2183
- children: title
2184
- }
2185
- )
2186
- ] }),
2187
- actions ? /* @__PURE__ */ jsx13(Box5, { sx: { display: "flex", alignItems: "center", flexShrink: 0 }, children: actions }) : null
2188
- ]
2189
- }
2190
- ),
2191
- subtitle && !details ? /* @__PURE__ */ jsxs7(Stack5, { direction: "row", spacing: 0.5, alignItems: "center", sx: { minWidth: 0 }, children: [
2163
+ /* @__PURE__ */ jsxs7(Stack5, { direction: "row", spacing: 1.5, sx: { minWidth: 0, alignItems: "center", justifyContent: "space-between" }, children: [
2164
+ /* @__PURE__ */ jsxs7(Stack5, { direction: "row", spacing: 1, sx: { minWidth: 0, flex: 1, alignItems: "center" }, children: [
2165
+ isMobile ? /* @__PURE__ */ jsx13(Box5, { sx: { display: "flex", alignItems: "center", flexShrink: 0 }, children: /* @__PURE__ */ jsx13(
2166
+ IconButton,
2167
+ {
2168
+ "aria-label": t("menu"),
2169
+ onClick: openMobileSidebar,
2170
+ size: "small",
2171
+ sx: { ml: -0.5 },
2172
+ children: /* @__PURE__ */ jsx13(MenuIcon, { fontSize: "small" })
2173
+ }
2174
+ ) }) : null,
2175
+ beforeTitle ? /* @__PURE__ */ jsx13(Box5, { sx: { display: "flex", alignItems: "center", flexShrink: 0 }, children: beforeTitle }) : null,
2176
+ /* @__PURE__ */ jsx13(
2177
+ Typography3,
2178
+ {
2179
+ variant: "h5",
2180
+ sx: {
2181
+ fontWeight: 600,
2182
+ lineHeight: "2.125rem",
2183
+ minWidth: 0
2184
+ },
2185
+ children: title
2186
+ }
2187
+ )
2188
+ ] }),
2189
+ actions ? /* @__PURE__ */ jsx13(Box5, { sx: { display: "flex", alignItems: "center", flexShrink: 0 }, children: actions }) : null
2190
+ ] }),
2191
+ subtitle && !details ? /* @__PURE__ */ jsxs7(Stack5, { direction: "row", spacing: 0.5, sx: { minWidth: 0, alignItems: "center" }, children: [
2192
2192
  beforeSubtitle ? /* @__PURE__ */ jsx13(Box5, { sx: { display: "flex", alignItems: "center", flexShrink: 0 }, children: beforeSubtitle }) : null,
2193
2193
  /* @__PURE__ */ jsx13(Typography3, { color: "text.secondary", sx: { lineHeight: "1rem", minWidth: 0 }, children: subtitle })
2194
2194
  ] }) : null,
2195
2195
  details ? /* @__PURE__ */ jsxs7(Stack5, { spacing: 0.5, children: [
2196
- /* @__PURE__ */ jsxs7(
2197
- Stack5,
2198
- {
2199
- direction: "row",
2200
- spacing: 0.5,
2201
- alignItems: "center",
2202
- justifyContent: "space-between",
2203
- sx: { minWidth: 0 },
2204
- children: [
2205
- /* @__PURE__ */ jsxs7(Stack5, { direction: "row", spacing: 0.5, alignItems: "center", sx: { minWidth: 0, flex: 1 }, children: [
2206
- beforeSubtitle ? /* @__PURE__ */ jsx13(Box5, { sx: { display: "flex", alignItems: "center", flexShrink: 0 }, children: beforeSubtitle }) : null,
2207
- /* @__PURE__ */ jsx13(Typography3, { color: "text.secondary", sx: { lineHeight: "1rem", minWidth: 0 }, children: subtitle })
2208
- ] }),
2209
- /* @__PURE__ */ jsx13(
2210
- IconButton,
2196
+ /* @__PURE__ */ jsxs7(Stack5, { direction: "row", spacing: 0.5, sx: { minWidth: 0, alignItems: "center", justifyContent: "space-between" }, children: [
2197
+ /* @__PURE__ */ jsxs7(Stack5, { direction: "row", spacing: 0.5, sx: { minWidth: 0, flex: 1, alignItems: "center" }, children: [
2198
+ beforeSubtitle ? /* @__PURE__ */ jsx13(Box5, { sx: { display: "flex", alignItems: "center", flexShrink: 0 }, children: beforeSubtitle }) : null,
2199
+ /* @__PURE__ */ jsx13(Typography3, { color: "text.secondary", sx: { lineHeight: "1rem", minWidth: 0 }, children: subtitle })
2200
+ ] }),
2201
+ /* @__PURE__ */ jsx13(
2202
+ IconButton,
2203
+ {
2204
+ "aria-label": isDetailsOpen ? t("hide_details") : t("show_details"),
2205
+ onClick: () => setIsDetailsOpen((current) => !current),
2206
+ size: "small",
2207
+ sx: { mr: -0.5 },
2208
+ children: /* @__PURE__ */ jsx13(
2209
+ ExpandMoreIcon3,
2211
2210
  {
2212
- "aria-label": isDetailsOpen ? t("hide_details") : t("show_details"),
2213
- onClick: () => setIsDetailsOpen((current) => !current),
2214
- size: "small",
2215
- sx: { mr: -0.5 },
2216
- children: /* @__PURE__ */ jsx13(
2217
- ExpandMoreIcon3,
2218
- {
2219
- fontSize: "small",
2220
- sx: {
2221
- transform: isDetailsOpen ? "rotate(180deg)" : "rotate(0deg)",
2222
- transition: "transform 0.2s ease"
2223
- }
2224
- }
2225
- )
2211
+ fontSize: "small",
2212
+ sx: {
2213
+ transform: isDetailsOpen ? "rotate(180deg)" : "rotate(0deg)",
2214
+ transition: "transform 0.2s ease"
2215
+ }
2226
2216
  }
2227
2217
  )
2228
- ]
2229
- }
2230
- ),
2218
+ }
2219
+ )
2220
+ ] }),
2231
2221
  /* @__PURE__ */ jsx13(Collapse, { in: isDetailsOpen, children: /* @__PURE__ */ jsx13(Box5, { sx: { pt: 0.5 }, children: details }) })
2232
2222
  ] }) : null
2233
2223
  ] }),
@@ -2638,7 +2628,7 @@ function DeletePreviewDialog({
2638
2628
  children: [
2639
2629
  /* @__PURE__ */ jsx16(DialogTitle3, { children: title }),
2640
2630
  /* @__PURE__ */ jsxs10(DialogContent3, { dividers: true, children: [
2641
- isLoading ? /* @__PURE__ */ jsxs10(Stack7, { spacing: 1.5, alignItems: "center", justifyContent: "center", sx: { minHeight: 180 }, children: [
2631
+ isLoading ? /* @__PURE__ */ jsxs10(Stack7, { spacing: 1.5, sx: { minHeight: 180, alignItems: "center", justifyContent: "center" }, children: [
2642
2632
  /* @__PURE__ */ jsx16(CircularProgress2, { size: 28, thickness: 4.2, color: "inherit" }),
2643
2633
  /* @__PURE__ */ jsx16(Typography4, { color: "text.secondary", children: t("delete_preview_loading") })
2644
2634
  ] }) : null,
@@ -2796,7 +2786,7 @@ var ListFiltersSidebar = memo3(function ListFiltersSidebar2({
2796
2786
  overflow: "auto"
2797
2787
  },
2798
2788
  children: /* @__PURE__ */ jsxs11(Stack8, { spacing: 1.5, children: [
2799
- /* @__PURE__ */ jsxs11(Stack8, { direction: "row", spacing: 1, alignItems: "center", justifyContent: "space-between", children: [
2789
+ /* @__PURE__ */ jsxs11(Stack8, { direction: "row", spacing: 1, sx: { alignItems: "center", justifyContent: "space-between" }, children: [
2800
2790
  /* @__PURE__ */ jsxs11(Stack8, { spacing: 0.25, children: [
2801
2791
  /* @__PURE__ */ jsx17(Typography5, { sx: { fontSize: 15, fontWeight: 700 }, children: t("filters") }),
2802
2792
  activeFiltersCount > 0 ? /* @__PURE__ */ jsx17(Typography5, { color: "text.secondary", sx: { fontSize: 12 }, children: t("active_filters", { count: activeFiltersCount }) }) : null
@@ -2949,8 +2939,8 @@ function ListFilterField({ client, slug, filter, value, onChange, debounceMs })
2949
2939
  },
2950
2940
  onInputChange: (_, nextInputValue) => setSearchValue(nextInputValue),
2951
2941
  renderInput: (params) => (() => {
2952
- var _a2;
2953
- const { InputProps, inputProps, ...textFieldParams } = params;
2942
+ var _a2, _b2;
2943
+ const { slotProps, ...textFieldParams } = params;
2954
2944
  return /* @__PURE__ */ jsx17(
2955
2945
  TextField2,
2956
2946
  {
@@ -2958,14 +2948,15 @@ function ListFilterField({ client, slug, filter, value, onChange, debounceMs })
2958
2948
  label: filter.label,
2959
2949
  placeholder: (_a2 = filter.placeholder) != null ? _a2 : t("search"),
2960
2950
  slotProps: {
2951
+ inputLabel: slotProps.inputLabel,
2961
2952
  input: {
2962
- ...InputProps,
2953
+ ...slotProps.input,
2963
2954
  endAdornment: /* @__PURE__ */ jsxs11(Fragment2, { children: [
2964
2955
  isLoadingChoices ? /* @__PURE__ */ jsx17(CircularProgress3, { color: "inherit", size: 16 }) : null,
2965
- InputProps.endAdornment
2956
+ (_b2 = slotProps.input) == null ? void 0 : _b2.endAdornment
2966
2957
  ] })
2967
2958
  },
2968
- htmlInput: inputProps
2959
+ htmlInput: slotProps.htmlInput
2969
2960
  }
2970
2961
  }
2971
2962
  );
@@ -3866,7 +3857,7 @@ import { jsx as jsx20, jsxs as jsxs13 } from "react/jsx-runtime";
3866
3857
  function ModelPageSkeleton() {
3867
3858
  return /* @__PURE__ */ jsxs13(Stack9, { spacing: 1.5, sx: { height: "100%", minHeight: 0 }, children: [
3868
3859
  /* @__PURE__ */ jsx20(MainHeaderSkeleton, { titleWidth: 240, subtitleWidth: "38%" }),
3869
- /* @__PURE__ */ jsx20(Paper6, { sx: { p: 1.5, borderRadius: "10px", flexShrink: 0 }, children: /* @__PURE__ */ jsxs13(Stack9, { direction: { xs: "column", lg: "row" }, spacing: 1.5, alignItems: { lg: "center" }, children: [
3860
+ /* @__PURE__ */ jsx20(Paper6, { sx: { p: 1.5, borderRadius: "10px", flexShrink: 0 }, children: /* @__PURE__ */ jsxs13(Stack9, { direction: { xs: "column", lg: "row" }, spacing: 1.5, sx: { alignItems: { lg: "center" } }, children: [
3870
3861
  /* @__PURE__ */ jsx20(Skeleton3, { variant: "rounded", width: 360, height: 40 }),
3871
3862
  /* @__PURE__ */ jsx20(Skeleton3, { variant: "rounded", width: 128, height: 40 }),
3872
3863
  /* @__PURE__ */ jsx20(Box10, { sx: { flex: 1 } }),
@@ -3979,14 +3970,13 @@ function ModelPage({ client, basePath, slug, router, renderBeforePagination }) {
3979
3970
  borderRadius: "10px",
3980
3971
  flexShrink: 0
3981
3972
  },
3982
- children: /* @__PURE__ */ jsxs14(Stack10, { direction: { xs: "column", lg: "row" }, spacing: 1.5, alignItems: { lg: "center" }, children: [
3973
+ children: /* @__PURE__ */ jsxs14(Stack10, { direction: { xs: "column", lg: "row" }, spacing: 1.5, sx: { alignItems: { lg: "center" } }, children: [
3983
3974
  /* @__PURE__ */ jsxs14(
3984
3975
  Stack10,
3985
3976
  {
3986
3977
  direction: { xs: "column", xl: "row" },
3987
3978
  spacing: 1.5,
3988
- alignItems: { xl: "center" },
3989
- sx: { flex: 1, minWidth: 0 },
3979
+ sx: { flex: 1, minWidth: 0, alignItems: { xl: "center" } },
3990
3980
  children: [
3991
3981
  /* @__PURE__ */ jsx21(
3992
3982
  SearchField,
@@ -3997,7 +3987,7 @@ function ModelPage({ client, basePath, slug, router, renderBeforePagination }) {
3997
3987
  placeholder: t("search")
3998
3988
  }
3999
3989
  ),
4000
- controller.hasSelection ? /* @__PURE__ */ jsxs14(Stack10, { direction: "row", spacing: 1, alignItems: "center", sx: { minWidth: 0, flexWrap: "wrap" }, children: [
3990
+ controller.hasSelection ? /* @__PURE__ */ jsxs14(Stack10, { direction: "row", spacing: 1, sx: { minWidth: 0, flexWrap: "wrap", alignItems: "center" }, children: [
4001
3991
  /* @__PURE__ */ jsx21(
4002
3992
  Button5,
4003
3993
  {
@@ -4025,7 +4015,7 @@ function ModelPage({ client, basePath, slug, router, renderBeforePagination }) {
4025
4015
  ]
4026
4016
  }
4027
4017
  ),
4028
- /* @__PURE__ */ jsxs14(Stack10, { direction: "row", spacing: 1, alignItems: "center", sx: { marginLeft: "auto" }, children: [
4018
+ /* @__PURE__ */ jsxs14(Stack10, { direction: "row", spacing: 1, sx: { marginLeft: "auto", alignItems: "center" }, children: [
4029
4019
  beforePagination ? /* @__PURE__ */ jsx21(Box11, { sx: { display: "flex", alignItems: "center", flexShrink: 0 }, children: beforePagination }) : null,
4030
4020
  isMobile && controller.hasListFilters ? /* @__PURE__ */ jsx21(Tooltip, { title: t("filters"), children: /* @__PURE__ */ jsx21(
4031
4021
  IconButton3,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xladmin",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Framework-agnostic React + MUI admin frontend for xladmin.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -38,9 +38,9 @@
38
38
  "peerDependencies": {
39
39
  "@emotion/react": ">=11.14.0 <12.0.0",
40
40
  "@emotion/styled": ">=11.14.0 <12.0.0",
41
- "@mui/icons-material": ">=7.0.0 <8.0.0",
42
- "@mui/material": ">=7.0.0 <8.0.0",
43
- "@mui/x-date-pickers": ">=8.0.0 <9.0.0",
41
+ "@mui/icons-material": ">=9.0.0 <10.0.0",
42
+ "@mui/material": ">=9.0.0 <10.0.0",
43
+ "@mui/x-date-pickers": ">=9.0.0 <10.0.0",
44
44
  "axios": ">=1.0.0 <2.0.0",
45
45
  "dayjs": ">=1.11.0 <2.0.0",
46
46
  "react": ">=19.0.0 <20.0.0",