@refinedev/core 4.44.12 → 4.45.1

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.1",
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
+ };
@@ -1,6 +1,9 @@
1
- import React, { useEffect } from "react";
1
+ import React, { SVGProps, useEffect } from "react";
2
2
  import { CSSRules } from "./styles";
3
3
 
4
+ const text =
5
+ "If you find Refine useful, you can contribute to its growth by giving it a star on GitHub";
6
+
4
7
  export const GitHubBanner = () => {
5
8
  useEffect(() => {
6
9
  const styleTag = document.createElement("style");
@@ -12,69 +15,256 @@ export const GitHubBanner = () => {
12
15
 
13
16
  return (
14
17
  <div
15
- className="banner"
18
+ className="banner bg-top-announcement"
16
19
  style={{
17
- flexDirection: "row",
18
- justifyContent: "center",
19
- alignItems: "center",
20
- position: "relative",
21
- padding: "8px 16px",
22
- backgroundColor: "#0d0d0d",
23
- borderBottom: "1px solid rgba(255, 255, 255, 0.15)",
20
+ width: "100%",
21
+ height: "48px",
24
22
  }}
25
23
  >
26
- {/* sider offset for center alignment */}
27
24
  <div
28
25
  style={{
29
- width: "200px",
26
+ position: "relative",
27
+ display: "flex",
28
+ justifyContent: "center",
29
+ alignItems: "center",
30
+ paddingLeft: "200px",
31
+ width: "100%",
32
+ maxWidth: "100vw",
33
+ height: "100%",
34
+ borderBottom: "1px solid #47ebeb26",
30
35
  }}
31
- />
32
- <a
33
- className="gh-link"
34
- href="https://s.refine.dev/github-support"
35
- target="_blank"
36
- rel="noreferrer"
37
36
  >
38
37
  <div
39
- className="content"
38
+ className="top-announcement-mask"
40
39
  style={{
41
- position: "relative",
42
- zIndex: 2,
43
- color: "#fff",
44
- display: "flex",
45
- flexDirection: "row",
46
- gap: "8px",
40
+ position: "absolute",
41
+ left: 0,
42
+ top: 0,
43
+ width: "100%",
44
+ height: "100%",
45
+ borderBottom: "1px solid #47ebeb26",
47
46
  }}
48
47
  >
49
- <span
50
- className="wizard"
48
+ <div
51
49
  style={{
50
+ position: "relative",
51
+ width: "960px",
52
+ height: "100%",
52
53
  display: "flex",
53
- flexDirection: "row",
54
- justifyContent: "center",
55
- alignItems: "center",
56
- width: "32px",
57
- height: "32px",
58
- fontSize: "32px",
59
- lineHeight: "32px",
54
+ justifyContent: "space-between",
55
+ margin: "0 auto",
60
56
  }}
61
57
  >
62
- 🧙‍♂️
63
- </span>
64
- <span
65
- className="text"
66
- style={{
67
- padding: "4px 0",
68
- fontSize: "16px",
69
- lineHeight: "24px",
70
- textShadow: "0px 0px 4px rgba(255, 255, 255, 0.5)",
71
- }}
72
- >
73
- refine grants your wishes! Please give us a ⭐️ on
74
- GitHub to keep the magic going.
75
- </span>
58
+ <div
59
+ style={{
60
+ width: "calc(50% - 300px)",
61
+ height: "100%",
62
+ position: "relative",
63
+ }}
64
+ >
65
+ <GlowSmall
66
+ style={{
67
+ animationDelay: "1.5s",
68
+ position: "absolute",
69
+ top: "2px",
70
+ right: "220px",
71
+ }}
72
+ id={"1"}
73
+ />
74
+ <GlowSmall
75
+ style={{
76
+ animationDelay: "1s",
77
+ position: "absolute",
78
+ top: "8px",
79
+ right: "100px",
80
+ transform: "rotate(180deg)",
81
+ }}
82
+ id={"2"}
83
+ />
84
+ <GlowBig
85
+ style={{
86
+ position: "absolute",
87
+ right: "10px",
88
+ }}
89
+ id={"3"}
90
+ />
91
+ </div>
92
+
93
+ <div
94
+ style={{
95
+ width: "calc(50% - 300px)",
96
+ height: "100%",
97
+ position: "relative",
98
+ }}
99
+ >
100
+ <GlowSmall
101
+ style={{
102
+ animationDelay: "2s",
103
+ position: "absolute",
104
+ top: "6px",
105
+ right: "180px",
106
+ transform: "rotate(180deg)",
107
+ }}
108
+ id={"4"}
109
+ />
110
+ <GlowSmall
111
+ style={{
112
+ animationDelay: "0.5s",
113
+ transitionDelay: "1.3s",
114
+ position: "absolute",
115
+ top: "2px",
116
+ right: "40px",
117
+ }}
118
+ id={"5"}
119
+ />
120
+ <GlowBig
121
+ style={{
122
+ position: "absolute",
123
+ right: "-70px",
124
+ }}
125
+ id={"6"}
126
+ />
127
+ </div>
128
+ </div>
76
129
  </div>
77
- </a>
130
+ <Text text={text} />
131
+ </div>
78
132
  </div>
79
133
  );
80
134
  };
135
+
136
+ const Text = ({ text }: { text: string }) => {
137
+ return (
138
+ <a
139
+ className="gh-link"
140
+ href="https://s.refine.dev/github-support"
141
+ target="_blank"
142
+ rel="noreferrer"
143
+ style={{
144
+ position: "absolute",
145
+ height: "100%",
146
+ padding: "0 60px",
147
+ display: "flex",
148
+ flexWrap: "nowrap",
149
+ whiteSpace: "nowrap",
150
+ justifyContent: "center",
151
+ alignItems: "center",
152
+ backgroundImage:
153
+ "linear-gradient(90deg, rgba(31, 63, 72, 0.00) 0%, #1F3F48 10%, #1F3F48 90%, rgba(31, 63, 72, 0.00) 100%)",
154
+ }}
155
+ >
156
+ <div
157
+ style={{
158
+ color: "#fff",
159
+ display: "flex",
160
+ flexDirection: "row",
161
+ gap: "8px",
162
+ }}
163
+ >
164
+ <span
165
+ style={{
166
+ display: "flex",
167
+ flexDirection: "row",
168
+ justifyContent: "center",
169
+ alignItems: "center",
170
+ }}
171
+ >
172
+ ⭐️
173
+ </span>
174
+ <span
175
+ className="text"
176
+ style={{
177
+ fontSize: "16px",
178
+ lineHeight: "24px",
179
+ }}
180
+ >
181
+ {text}
182
+ </span>
183
+ <span
184
+ style={{
185
+ display: "flex",
186
+ flexDirection: "row",
187
+ justifyContent: "center",
188
+ alignItems: "center",
189
+ }}
190
+ >
191
+ ⭐️
192
+ </span>
193
+ </div>
194
+ </a>
195
+ );
196
+ };
197
+
198
+ const GlowSmall = ({ style, ...props }: SVGProps<SVGSVGElement>) => {
199
+ return (
200
+ <svg
201
+ xmlns="http://www.w3.org/2000/svg"
202
+ width={80}
203
+ height={40}
204
+ fill="none"
205
+ style={{
206
+ opacity: 1,
207
+ animation:
208
+ "top-announcement-glow 1s ease-in-out infinite alternate",
209
+ ...style,
210
+ }}
211
+ >
212
+ <circle
213
+ cx={40}
214
+ r={40}
215
+ fill={`url(#${props.id}-a)`}
216
+ fillOpacity={0.5}
217
+ />
218
+ <defs>
219
+ <radialGradient
220
+ id={`${props.id}-a`}
221
+ cx={0}
222
+ cy={0}
223
+ r={1}
224
+ gradientTransform="matrix(0 40 -40 0 40 0)"
225
+ gradientUnits="userSpaceOnUse"
226
+ >
227
+ <stop stopColor="#47EBEB" />
228
+ <stop offset={1} stopColor="#47EBEB" stopOpacity={0} />
229
+ </radialGradient>
230
+ </defs>
231
+ </svg>
232
+ );
233
+ };
234
+
235
+ const GlowBig = ({ style, ...props }: SVGProps<SVGSVGElement>) => (
236
+ <svg
237
+ xmlns="http://www.w3.org/2000/svg"
238
+ width={120}
239
+ height={48}
240
+ fill="none"
241
+ {...props}
242
+ style={{
243
+ opacity: 1,
244
+ animation:
245
+ "top-announcement-glow 1s ease-in-out infinite alternate",
246
+ ...style,
247
+ }}
248
+ >
249
+ <circle
250
+ cx={60}
251
+ cy={24}
252
+ r={60}
253
+ fill={`url(#${props.id}-a)`}
254
+ fillOpacity={0.5}
255
+ />
256
+ <defs>
257
+ <radialGradient
258
+ id={`${props.id}-a`}
259
+ cx={0}
260
+ cy={0}
261
+ r={1}
262
+ gradientTransform="matrix(0 60 -60 0 60 24)"
263
+ gradientUnits="userSpaceOnUse"
264
+ >
265
+ <stop stopColor="#47EBEB" />
266
+ <stop offset={1} stopColor="#47EBEB" stopOpacity={0} />
267
+ </radialGradient>
268
+ </defs>
269
+ </svg>
270
+ );
@@ -1,4 +1,24 @@
1
1
  export const CSSRules = [
2
+ `
3
+ .bg-top-announcement {
4
+ border-bottom: 1px solid rgba(71, 235, 235, 0.15);
5
+ background: radial-gradient(
6
+ 218.19% 111.8% at 0% 0%,
7
+ rgba(71, 235, 235, 0.1) 0%,
8
+ rgba(71, 235, 235, 0.2) 100%
9
+ ),
10
+ #14141f;
11
+ }
12
+ `,
13
+ `
14
+ .top-announcement-mask {
15
+ mask-image: url(https://refine.ams3.cdn.digitaloceanspaces.com/website/static/assets/hexagon.svg);
16
+ -webkit-mask-image: url(https://refine.ams3.cdn.digitaloceanspaces.com/website/static/assets/hexagon.svg);
17
+ mask-repeat: repeat;
18
+ -webkit-mask-repeat: repeat;
19
+ background: rgba(71, 235, 235, 0.25);
20
+ }
21
+ `,
2
22
  `
3
23
  .banner {
4
24
  display: flex;
@@ -7,60 +27,20 @@ export const CSSRules = [
7
27
  }
8
28
  }`,
9
29
  `
10
- .banner::before,
11
- .banner::after {
12
- content: '';
13
- position: absolute;
14
- top: 0;
15
- left: 0;
16
- width: 100%;
17
- height: 100%;
18
- }
19
- `,
20
- `
21
- .banner::before {
22
- background-image: linear-gradient(
23
- 270deg,
24
- rgba(255, 76, 77, 0.35) 0%,
25
- rgba(255, 153, 51, 0.35) 12.5%,
26
- rgba(255, 191, 0, 0.35) 25%,
27
- rgba(38, 217, 127, 0.35) 37.5%,
28
- rgba(71, 235, 235, 0.35) 50%,
29
- rgba(0, 128, 255, 0.35) 62.5%,
30
- rgba(51, 51, 255, 0.35) 75%,
31
- rgba(128, 0, 255, 0.35) 87.5%,
32
- rgba(237, 94, 201, 0.35) 100%
33
- );
34
- background-position: 0 0;
35
- background-size: 200% 100%;
36
- background-repeat: repeat-x;
37
- animation: bgpos 4s linear infinite;
38
- }
39
- `,
40
- `
41
- .banner::after {
42
- background: linear-gradient(
43
- 180deg,
44
- rgba(13, 13, 13, 0.85) 0%,
45
- rgba(13, 13, 13, 0) 100%
46
- );
30
+ .gh-link, .gh-link:hover, .gh-link:active, .gh-link:visited, .gh-link:focus {
31
+ text-decoration: none;
32
+ z-index: 9;
47
33
  }
48
34
  `,
49
35
  `
50
- @keyframes bgpos {
36
+ @keyframes top-announcement-glow {
51
37
  0% {
52
- background-position: 0 0;
38
+ opacity: 1;
53
39
  }
54
40
 
55
41
  100% {
56
- background-position: -200% 0;
42
+ opacity: 0;
57
43
  }
58
44
  }
59
45
  `,
60
- `
61
- .gh-link, .gh-link:hover, .gh-link:active, .gh-link:visited, .gh-link:focus {
62
- text-decoration: none;
63
- z-index: 9;
64
- }
65
- `,
66
46
  ];
@@ -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
  };