@form-engine-ts/mui 4.8.0 → 5.0.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.
package/dist/index.cjs CHANGED
@@ -1988,6 +1988,28 @@ function SlotCard({
1988
1988
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_material16.Button, { variant: "outlined", onClick: onTranslate, disabled: readOnly, children: "Translate this slot" })
1989
1989
  ] }) }) });
1990
1990
  }
1991
+ function workspaceErrorMessage(error) {
1992
+ switch (error.type) {
1993
+ case "locale_not_allowed":
1994
+ return `Locale "${error.locale}" is not allowed.`;
1995
+ case "locale_already_exists":
1996
+ return `Locale "${error.locale}" is already registered.`;
1997
+ case "invalid_locale_format":
1998
+ return `Invalid locale format: "${error.locale}"`;
1999
+ case "max_locales_exceeded":
2000
+ return `At most ${error.max} locales are allowed.`;
2001
+ case "read_only_mode":
2002
+ return "This workspace is read-only.";
2003
+ case "adapter_not_configured":
2004
+ return "A translation adapter is not configured.";
2005
+ case "target_locale_missing":
2006
+ return "A target locale is required.";
2007
+ case "translation_failed":
2008
+ return error.message;
2009
+ case "custom_validation_failed":
2010
+ return error.message;
2011
+ }
2012
+ }
1991
2013
  function TranslationWorkspace({
1992
2014
  schema,
1993
2015
  onChange,
@@ -2058,7 +2080,7 @@ function TranslationWorkspace({
2058
2080
  }
2059
2081
  )
2060
2082
  ] }),
2061
- workspace.error === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_material16.Typography, { color: "error", children: workspace.error }),
2083
+ workspace.error === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_material16.Typography, { color: "error", children: workspaceErrorMessage(workspace.error) }),
2062
2084
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_material16.Stack, { spacing: 1.5, children: workspace.slots.map((slot) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2063
2085
  SlotCard,
2064
2086
  {
package/dist/index.js CHANGED
@@ -1981,6 +1981,28 @@ function SlotCard({
1981
1981
  /* @__PURE__ */ jsx18(Button3, { variant: "outlined", onClick: onTranslate, disabled: readOnly, children: "Translate this slot" })
1982
1982
  ] }) }) });
1983
1983
  }
1984
+ function workspaceErrorMessage(error) {
1985
+ switch (error.type) {
1986
+ case "locale_not_allowed":
1987
+ return `Locale "${error.locale}" is not allowed.`;
1988
+ case "locale_already_exists":
1989
+ return `Locale "${error.locale}" is already registered.`;
1990
+ case "invalid_locale_format":
1991
+ return `Invalid locale format: "${error.locale}"`;
1992
+ case "max_locales_exceeded":
1993
+ return `At most ${error.max} locales are allowed.`;
1994
+ case "read_only_mode":
1995
+ return "This workspace is read-only.";
1996
+ case "adapter_not_configured":
1997
+ return "A translation adapter is not configured.";
1998
+ case "target_locale_missing":
1999
+ return "A target locale is required.";
2000
+ case "translation_failed":
2001
+ return error.message;
2002
+ case "custom_validation_failed":
2003
+ return error.message;
2004
+ }
2005
+ }
1984
2006
  function TranslationWorkspace({
1985
2007
  schema,
1986
2008
  onChange,
@@ -2051,7 +2073,7 @@ function TranslationWorkspace({
2051
2073
  }
2052
2074
  )
2053
2075
  ] }),
2054
- workspace.error === void 0 ? null : /* @__PURE__ */ jsx18(Typography5, { color: "error", children: workspace.error }),
2076
+ workspace.error === void 0 ? null : /* @__PURE__ */ jsx18(Typography5, { color: "error", children: workspaceErrorMessage(workspace.error) }),
2055
2077
  /* @__PURE__ */ jsx18(Stack6, { spacing: 1.5, children: workspace.slots.map((slot) => /* @__PURE__ */ jsx18(
2056
2078
  SlotCard,
2057
2079
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@form-engine-ts/mui",
3
- "version": "4.8.0",
3
+ "version": "5.0.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -46,8 +46,8 @@
46
46
  "@mui/material": "^6.0.0 || ^7.0.0",
47
47
  "react": "^18.0.0 || ^19.0.0",
48
48
  "react-dom": "^18.0.0 || ^19.0.0",
49
- "@form-engine-ts/core": "4.8.0",
50
- "@form-engine-ts/react": "4.8.0"
49
+ "@form-engine-ts/core": "5.0.0",
50
+ "@form-engine-ts/react": "5.0.0"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@emotion/react": "^11.14.0",
@@ -58,8 +58,8 @@
58
58
  "@types/react-dom": "^19.2.4",
59
59
  "react": "^19.2.8",
60
60
  "react-dom": "^19.2.8",
61
- "@form-engine-ts/core": "4.8.0",
62
- "@form-engine-ts/react": "4.8.0"
61
+ "@form-engine-ts/core": "5.0.0",
62
+ "@form-engine-ts/react": "5.0.0"
63
63
  },
64
64
  "scripts": {
65
65
  "build": "tsup src/index.ts --format esm,cjs --dts --clean --external @emotion/react --external @emotion/styled --external @form-engine-ts/core --external @form-engine-ts/react --external @mui/icons-material --external @mui/material --external react --external react-dom",