@faasjs/ant-design 3.5.0 → 3.5.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.
package/dist/index.d.mts CHANGED
@@ -201,7 +201,7 @@ interface useAppProps {
201
201
  */
202
202
  declare function App(props: AppProps): react_jsx_runtime.JSX.Element;
203
203
  declare namespace App {
204
- var useApp: <NewT extends useAppProps = useAppProps>() => Readonly<useAppProps | NewT>;
204
+ var useApp: <NewT extends useAppProps = useAppProps>() => Readonly<NewT>;
205
205
  var whyDidYouRender: boolean;
206
206
  }
207
207
  /**
@@ -213,7 +213,7 @@ declare namespace App {
213
213
  * const { message, notification, setModalProps, setDrawerProps } = useApp()
214
214
  * ```
215
215
  */
216
- declare const useApp: <NewT extends useAppProps = useAppProps>() => Readonly<useAppProps | NewT>;
216
+ declare const useApp: <NewT extends useAppProps = useAppProps>() => Readonly<NewT>;
217
217
 
218
218
  interface BlankProps {
219
219
  value?: any;
package/dist/index.d.ts CHANGED
@@ -201,7 +201,7 @@ interface useAppProps {
201
201
  */
202
202
  declare function App(props: AppProps): react_jsx_runtime.JSX.Element;
203
203
  declare namespace App {
204
- var useApp: <NewT extends useAppProps = useAppProps>() => Readonly<useAppProps | NewT>;
204
+ var useApp: <NewT extends useAppProps = useAppProps>() => Readonly<NewT>;
205
205
  var whyDidYouRender: boolean;
206
206
  }
207
207
  /**
@@ -213,7 +213,7 @@ declare namespace App {
213
213
  * const { message, notification, setModalProps, setDrawerProps } = useApp()
214
214
  * ```
215
215
  */
216
- declare const useApp: <NewT extends useAppProps = useAppProps>() => Readonly<useAppProps | NewT>;
216
+ declare const useApp: <NewT extends useAppProps = useAppProps>() => Readonly<NewT>;
217
217
 
218
218
  interface BlankProps {
219
219
  value?: any;
package/dist/index.js CHANGED
@@ -93,7 +93,6 @@ function ErrorBoundary(props) {
93
93
  return /* @__PURE__ */ jsxRuntime.jsx(react.ErrorBoundary, { errorChildren: /* @__PURE__ */ jsxRuntime.jsx(ErrorChildren, {}), ...props });
94
94
  }
95
95
  ErrorBoundary.whyDidYouRender = true;
96
- var isZH = /^zh/i.test(navigator.language);
97
96
  var zh = {
98
97
  lang: "zh",
99
98
  blank: "\u7A7A",
@@ -118,12 +117,11 @@ var en = {
118
117
  search: "Search",
119
118
  reset: "Reset"
120
119
  };
121
- var common = isZH ? zh : en;
122
120
  var baseTheme = {
123
121
  lang: "en",
124
- common,
125
- Blank: { text: common.blank },
126
- Form: { submit: { text: common.submit } },
122
+ common: en,
123
+ Blank: { text: en.blank },
124
+ Form: { submit: { text: en.submit } },
127
125
  Title: {
128
126
  separator: " - ",
129
127
  suffix: ""
@@ -134,9 +132,10 @@ var ConfigContext = react$1.createContext({
134
132
  theme: baseTheme
135
133
  });
136
134
  function ConfigProvider(props) {
137
- const [theme, setTheme] = react$1.useState();
135
+ const [theme, setTheme] = react$1.useState(baseTheme);
138
136
  react.useEqualEffect(() => {
139
- if (props.theme?.lang === "zh") {
137
+ const lang = props.theme?.lang || (!props.theme?.lang && /^zh/i.test(navigator.language) ? "zh" : "en");
138
+ if (lang === "zh") {
140
139
  setTheme(
141
140
  lodashEs.defaultsDeep(
142
141
  props.theme,
package/dist/index.mjs CHANGED
@@ -89,7 +89,6 @@ function ErrorBoundary(props) {
89
89
  return /* @__PURE__ */ jsx(ErrorBoundary$1, { errorChildren: /* @__PURE__ */ jsx(ErrorChildren, {}), ...props });
90
90
  }
91
91
  ErrorBoundary.whyDidYouRender = true;
92
- var isZH = /^zh/i.test(navigator.language);
93
92
  var zh = {
94
93
  lang: "zh",
95
94
  blank: "\u7A7A",
@@ -114,12 +113,11 @@ var en = {
114
113
  search: "Search",
115
114
  reset: "Reset"
116
115
  };
117
- var common = isZH ? zh : en;
118
116
  var baseTheme = {
119
117
  lang: "en",
120
- common,
121
- Blank: { text: common.blank },
122
- Form: { submit: { text: common.submit } },
118
+ common: en,
119
+ Blank: { text: en.blank },
120
+ Form: { submit: { text: en.submit } },
123
121
  Title: {
124
122
  separator: " - ",
125
123
  suffix: ""
@@ -130,9 +128,10 @@ var ConfigContext = createContext({
130
128
  theme: baseTheme
131
129
  });
132
130
  function ConfigProvider(props) {
133
- const [theme, setTheme] = useState();
131
+ const [theme, setTheme] = useState(baseTheme);
134
132
  useEqualEffect(() => {
135
- if (props.theme?.lang === "zh") {
133
+ const lang = props.theme?.lang || (!props.theme?.lang && /^zh/i.test(navigator.language) ? "zh" : "en");
134
+ if (lang === "zh") {
136
135
  setTheme(
137
136
  defaultsDeep(
138
137
  props.theme,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faasjs/ant-design",
3
- "version": "3.5.0",
3
+ "version": "3.5.2",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -34,7 +34,7 @@
34
34
  "dist"
35
35
  ],
36
36
  "peerDependencies": {
37
- "@faasjs/react": "3.5.0",
37
+ "@faasjs/react": "3.5.2",
38
38
  "antd": "*",
39
39
  "@ant-design/icons": "*",
40
40
  "lodash-es": "*",
@@ -44,7 +44,7 @@
44
44
  },
45
45
  "devDependencies": {
46
46
  "@types/lodash-es": "*",
47
- "@faasjs/react": "3.5.0",
47
+ "@faasjs/react": "3.5.2",
48
48
  "antd": "*",
49
49
  "@ant-design/icons": "*",
50
50
  "lodash-es": "*",