@refinedev/core 4.44.12 → 4.45.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.
@@ -1,3 +1,4 @@
1
+ import React from "react";
1
2
  import { BaseRecord, HttpError, UpdateResponse } from ".";
2
3
  import { UseUpdateReturnType } from "../hooks/data/useUpdate";
3
4
  export declare type AutoSaveProps<TVariables> = {
@@ -13,6 +14,7 @@ export declare type AutoSaveReturnType<TData extends BaseRecord = BaseRecord, TE
13
14
  autoSaveProps: Pick<UseUpdateReturnType<TData, TError, TVariables>, "data" | "error" | "status">;
14
15
  onFinishAutoSave: (values: TVariables) => Promise<UpdateResponse<TData> | void> | void;
15
16
  };
17
+ export declare type AutoSaveIndicatorElements = Partial<Record<"success" | "error" | "loading" | "idle", React.ReactNode>>;
16
18
  export declare type AutoSaveIndicatorProps<TData extends BaseRecord = BaseRecord, TError extends HttpError = HttpError, TVariables = {}> = {
17
19
  /**
18
20
  * The data returned by the update request.
@@ -26,5 +28,9 @@ export declare type AutoSaveIndicatorProps<TData extends BaseRecord = BaseRecord
26
28
  * The status of the update request.
27
29
  */
28
30
  status: UseUpdateReturnType<TData, TError, TVariables>["status"];
31
+ /**
32
+ * The elements to display for each status.
33
+ */
34
+ elements?: AutoSaveIndicatorElements;
29
35
  };
30
36
  //# sourceMappingURL=autoSave.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"autoSave.d.ts","sourceRoot":"","sources":["../../src/interfaces/autoSave.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,GAAG,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,oBAAY,aAAa,CAAC,UAAU,IAAI;IACpC,QAAQ,CAAC,EAAE;QACP,OAAO,EAAE,OAAO,CAAC;QACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,QAAQ,CAAC,EAAE,CAAC,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M,EAAE,UAAU,CAAC,CAAC,QAAQ,CAAC,CAAC;IACjE;;OAEG;IACH,QAAQ,CAAC,EAAE,yBAAyB,CAAC;CACxC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@refinedev/core",
3
- "version": "4.44.12",
3
+ "version": "4.45.0",
4
4
  "description": "refine is a React-based framework for building internal tools, rapidly. It ships with Ant Design System, an enterprise-level UI toolkit.",
5
5
  "private": false,
6
6
  "sideEffects": false,
package/refine.config.js CHANGED
@@ -73,6 +73,16 @@ module.exports = {
73
73
  },
74
74
  ],
75
75
  },
76
+ {
77
+ group: "Other",
78
+ label: "AutoSaveIndicator",
79
+ files: [
80
+ {
81
+ src: "./src/components/autoSaveIndicator/index.tsx",
82
+ dest: "./components/autoSaveIndicator.tsx",
83
+ },
84
+ ],
85
+ },
76
86
  ],
77
87
  transform: (content) => {
78
88
  let newContent = content;
@@ -0,0 +1,40 @@
1
+ import React from "react";
2
+ import { AutoSaveIndicatorProps } from "../../interfaces";
3
+ import { useTranslate } from "@hooks/translate";
4
+
5
+ export const AutoSaveIndicator: React.FC<AutoSaveIndicatorProps> = ({
6
+ status,
7
+ elements: {
8
+ success = <Message key="autoSave.success" defaultMessage="saved" />,
9
+ error = (
10
+ <Message key="autoSave.error" defaultMessage="auto save failure" />
11
+ ),
12
+ loading = <Message key="autoSave.loading" defaultMessage="saving..." />,
13
+ idle = (
14
+ <Message key="autoSave.idle" defaultMessage="waiting for changes" />
15
+ ),
16
+ } = {},
17
+ }) => {
18
+ switch (status) {
19
+ case "success":
20
+ return <>{success}</>;
21
+ case "error":
22
+ return <>{error}</>;
23
+ case "loading":
24
+ return <>{loading}</>;
25
+ default:
26
+ return <>{idle}</>;
27
+ }
28
+ };
29
+
30
+ const Message = ({
31
+ key,
32
+ defaultMessage,
33
+ }: {
34
+ key: string;
35
+ defaultMessage: string;
36
+ }) => {
37
+ const translate = useTranslate();
38
+
39
+ return <span>{translate(key, defaultMessage)}</span>;
40
+ };
@@ -10,6 +10,9 @@ export const GitHubBanner = () => {
10
10
  );
11
11
  }, []);
12
12
 
13
+
14
+ const texts = ["Be a part of our journey. Star Refine on GitHub!", "Join our community. Star Refine on GitHub!", "Let's elevate Refine together. Star us on GitHub!", "Enhance Refine's reach. Give us a star on GitHub!"]
15
+
13
16
  return (
14
17
  <div
15
18
  className="banner"
@@ -47,19 +50,14 @@ export const GitHubBanner = () => {
47
50
  }}
48
51
  >
49
52
  <span
50
- className="wizard"
51
53
  style={{
52
54
  display: "flex",
53
55
  flexDirection: "row",
54
56
  justifyContent: "center",
55
57
  alignItems: "center",
56
- width: "32px",
57
- height: "32px",
58
- fontSize: "32px",
59
- lineHeight: "32px",
60
58
  }}
61
59
  >
62
- 🧙‍♂️
60
+ ⭐️
63
61
  </span>
64
62
  <span
65
63
  className="text"
@@ -70,8 +68,17 @@ export const GitHubBanner = () => {
70
68
  textShadow: "0px 0px 4px rgba(255, 255, 255, 0.5)",
71
69
  }}
72
70
  >
73
- refine grants your wishes! Please give us a ⭐️ on
74
- GitHub to keep the magic going.
71
+ {texts[Math.floor(Math.random() * texts.length)]}
72
+ </span>
73
+ <span
74
+ style={{
75
+ display: "flex",
76
+ flexDirection: "row",
77
+ justifyContent: "center",
78
+ alignItems: "center",
79
+ }}
80
+ >
81
+ ⭐️
75
82
  </span>
76
83
  </div>
77
84
  </a>
@@ -7,3 +7,4 @@ export { Authenticated } from "./authenticated";
7
7
  export { RouteChangeHandler } from "./routeChangeHandler";
8
8
  export { CanAccess, CanAccessProps } from "./canAccess";
9
9
  export { GitHubBanner } from "./gh-banner";
10
+ export { AutoSaveIndicator } from "./autoSaveIndicator";
@@ -1,3 +1,4 @@
1
+ import React from "react";
1
2
  import { BaseRecord, HttpError, UpdateResponse } from ".";
2
3
  import { UseUpdateReturnType } from "../hooks/data/useUpdate";
3
4
 
@@ -25,6 +26,10 @@ export type AutoSaveReturnType<
25
26
  ) => Promise<UpdateResponse<TData> | void> | void;
26
27
  };
27
28
 
29
+ export type AutoSaveIndicatorElements = Partial<
30
+ Record<"success" | "error" | "loading" | "idle", React.ReactNode>
31
+ >;
32
+
28
33
  export type AutoSaveIndicatorProps<
29
34
  TData extends BaseRecord = BaseRecord,
30
35
  TError extends HttpError = HttpError,
@@ -42,4 +47,8 @@ export type AutoSaveIndicatorProps<
42
47
  * The status of the update request.
43
48
  */
44
49
  status: UseUpdateReturnType<TData, TError, TVariables>["status"];
50
+ /**
51
+ * The elements to display for each status.
52
+ */
53
+ elements?: AutoSaveIndicatorElements;
45
54
  };