@payloadcms/ui 3.2.2-canary.a11698b → 3.2.2-canary.d2399ed
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/elements/DocumentFields/index.d.ts.map +1 -1
- package/dist/elements/DocumentFields/index.js +53 -92
- package/dist/elements/DocumentFields/index.js.map +1 -1
- package/dist/exports/client/{CodeEditor-DRTCMRCY.js → CodeEditor-5MCGR4GL.js} +2 -2
- package/dist/exports/client/chunk-4SO5UCQD.js +14 -0
- package/dist/exports/client/chunk-4SO5UCQD.js.map +8 -0
- package/dist/exports/client/index.js +9 -9
- package/dist/exports/client/index.js.map +3 -3
- package/dist/providers/Config/index.d.ts.map +1 -1
- package/dist/providers/Config/index.js +34 -19
- package/dist/providers/Config/index.js.map +1 -1
- package/package.json +4 -4
- package/dist/exports/client/chunk-PNHVQDTJ.js +0 -14
- package/dist/exports/client/chunk-PNHVQDTJ.js.map +0 -8
- /package/dist/exports/client/{CodeEditor-DRTCMRCY.js.map → CodeEditor-5MCGR4GL.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/Config/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAEvF,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/Config/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAEvF,OAAO,KAAsE,MAAM,OAAO,CAAA;AAE1F,MAAM,MAAM,mBAAmB,GAAG;IAChC,MAAM,EAAE,YAAY,CAAA;IACpB,eAAe,EAAE,CAAC,IAAI,EAAE;QACtB,cAAc,CAAC,EAAE,MAAM,CAAA;QACvB,UAAU,CAAC,EAAE,MAAM,CAAA;KACpB,KAAK,sBAAsB,GAAG,kBAAkB,GAAG,IAAI,CAAA;IACxD,SAAS,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,CAAA;CAC1C,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,gBAAgB,CAAC,EAAE,sBAAsB,CAAA;IACzC,YAAY,CAAC,EAAE,kBAAkB,CAAA;IACjC,eAAe,EAAE,CAAC,IAAI,EAAE;QACtB,gBAAgB,CAAC,EAAE,sBAAsB,GAAG,IAAI,CAAA;QAChD,YAAY,CAAC,EAAE,kBAAkB,GAAG,IAAI,CAAA;KACzC,KAAK,IAAI,CAAA;CACX,CAAA;AAID,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC;IACpC,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IAClC,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAA;CAC9B,CA6BA,CAAA;AAED,eAAO,MAAM,SAAS,QAAO,mBAAoD,CAAA"}
|
|
@@ -2,22 +2,37 @@
|
|
|
2
2
|
|
|
3
3
|
import { c as _c } from "react/compiler-runtime";
|
|
4
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
-
import React, { createContext, useCallback, useContext, useState } from 'react';
|
|
5
|
+
import React, { createContext, useCallback, useContext, useEffect, useState } from 'react';
|
|
6
6
|
const RootConfigContext = /*#__PURE__*/createContext(undefined);
|
|
7
7
|
export const ConfigProvider = t0 => {
|
|
8
|
-
const $ = _c(
|
|
8
|
+
const $ = _c(10);
|
|
9
9
|
const {
|
|
10
10
|
children,
|
|
11
11
|
config: configFromProps
|
|
12
12
|
} = t0;
|
|
13
13
|
const [config, setConfig] = useState(configFromProps);
|
|
14
14
|
let t1;
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
let t2;
|
|
16
|
+
if ($[0] !== configFromProps) {
|
|
17
|
+
t1 = () => {
|
|
18
|
+
setConfig(configFromProps);
|
|
19
|
+
};
|
|
20
|
+
t2 = [configFromProps];
|
|
21
|
+
$[0] = configFromProps;
|
|
22
|
+
$[1] = t1;
|
|
23
|
+
$[2] = t2;
|
|
24
|
+
} else {
|
|
25
|
+
t1 = $[1];
|
|
26
|
+
t2 = $[2];
|
|
27
|
+
}
|
|
28
|
+
useEffect(t1, t2);
|
|
29
|
+
let t3;
|
|
30
|
+
if ($[3] !== config.collections || $[4] !== config.globals) {
|
|
31
|
+
t3 = t4 => {
|
|
17
32
|
const {
|
|
18
33
|
collectionSlug,
|
|
19
34
|
globalSlug
|
|
20
|
-
} =
|
|
35
|
+
} = t4;
|
|
21
36
|
if (collectionSlug) {
|
|
22
37
|
return config.collections.find(collection => collection.slug === collectionSlug);
|
|
23
38
|
}
|
|
@@ -26,16 +41,16 @@ export const ConfigProvider = t0 => {
|
|
|
26
41
|
}
|
|
27
42
|
return null;
|
|
28
43
|
};
|
|
29
|
-
$[
|
|
30
|
-
$[
|
|
31
|
-
$[
|
|
44
|
+
$[3] = config.collections;
|
|
45
|
+
$[4] = config.globals;
|
|
46
|
+
$[5] = t3;
|
|
32
47
|
} else {
|
|
33
|
-
|
|
48
|
+
t3 = $[5];
|
|
34
49
|
}
|
|
35
|
-
const getEntityConfig =
|
|
36
|
-
let
|
|
37
|
-
if ($[
|
|
38
|
-
|
|
50
|
+
const getEntityConfig = t3;
|
|
51
|
+
let t4;
|
|
52
|
+
if ($[6] !== config || $[7] !== getEntityConfig || $[8] !== children) {
|
|
53
|
+
t4 = _jsx(RootConfigContext.Provider, {
|
|
39
54
|
value: {
|
|
40
55
|
config,
|
|
41
56
|
getEntityConfig,
|
|
@@ -43,14 +58,14 @@ export const ConfigProvider = t0 => {
|
|
|
43
58
|
},
|
|
44
59
|
children
|
|
45
60
|
});
|
|
46
|
-
$[
|
|
47
|
-
$[
|
|
48
|
-
$[
|
|
49
|
-
$[
|
|
61
|
+
$[6] = config;
|
|
62
|
+
$[7] = getEntityConfig;
|
|
63
|
+
$[8] = children;
|
|
64
|
+
$[9] = t4;
|
|
50
65
|
} else {
|
|
51
|
-
|
|
66
|
+
t4 = $[9];
|
|
52
67
|
}
|
|
53
|
-
return
|
|
68
|
+
return t4;
|
|
54
69
|
};
|
|
55
70
|
export const useConfig = () => {
|
|
56
71
|
return useContext(RootConfigContext);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","React","createContext","useCallback","useContext","useState","RootConfigContext","undefined","ConfigProvider","t0","$","children","config","configFromProps","setConfig","t1","collections","globals","
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","React","createContext","useCallback","useContext","useEffect","useState","RootConfigContext","undefined","ConfigProvider","t0","$","children","config","configFromProps","setConfig","t1","t2","t3","collections","globals","t4","collectionSlug","globalSlug","find","collection","slug","global","getEntityConfig","_jsx","Provider","value","useConfig"],"sources":["../../../src/providers/Config/index.tsx"],"sourcesContent":["'use client'\nimport type { ClientCollectionConfig, ClientConfig, ClientGlobalConfig } from 'payload'\n\nimport React, { createContext, useCallback, useContext, useEffect, useState } from 'react'\n\nexport type ClientConfigContext = {\n config: ClientConfig\n getEntityConfig: (args: {\n collectionSlug?: string\n globalSlug?: string\n }) => ClientCollectionConfig | ClientGlobalConfig | null\n setConfig: (config: ClientConfig) => void\n}\n\nexport type EntityConfigContext = {\n collectionConfig?: ClientCollectionConfig\n globalConfig?: ClientGlobalConfig\n setEntityConfig: (args: {\n collectionConfig?: ClientCollectionConfig | null\n globalConfig?: ClientGlobalConfig | null\n }) => void\n}\n\nconst RootConfigContext = createContext<ClientConfigContext | undefined>(undefined)\n\nexport const ConfigProvider: React.FC<{\n readonly children: React.ReactNode\n readonly config: ClientConfig\n}> = ({ children, config: configFromProps }) => {\n const [config, setConfig] = useState<ClientConfig>(configFromProps)\n\n // Need to update local config state if config from props changes, for HMR.\n // That way, config changes will be updated in the UI immediately without needing a refresh.\n useEffect(() => {\n setConfig(configFromProps)\n }, [configFromProps])\n\n const getEntityConfig = useCallback(\n ({ collectionSlug, globalSlug }: { collectionSlug?: string; globalSlug?: string }) => {\n if (collectionSlug) {\n return config.collections.find((collection) => collection.slug === collectionSlug)\n }\n\n if (globalSlug) {\n return config.globals.find((global) => global.slug === globalSlug)\n }\n\n return null\n },\n [config],\n )\n\n return (\n <RootConfigContext.Provider value={{ config, getEntityConfig, setConfig }}>\n {children}\n </RootConfigContext.Provider>\n )\n}\n\nexport const useConfig = (): ClientConfigContext => useContext(RootConfigContext)\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,OAAOC,KAAA,IAASC,aAAa,EAAEC,WAAW,EAAEC,UAAU,EAAEC,SAAS,EAAEC,QAAQ,QAAQ;AAoBnF,MAAMC,iBAAA,gBAAoBL,aAAA,CAA+CM,SAAA;AAEzE,OAAO,MAAMC,cAAA,GAGRC,EAAA;EAAA,MAAAC,CAAA,GAAAX,EAAA;EAAC;IAAAY,QAAA;IAAAC,MAAA,EAAAC;EAAA,IAAAJ,EAAqC;EACzC,OAAAG,MAAA,EAAAE,SAAA,IAA4BT,QAAA,CAAuBQ,eAAA;EAAA,IAAAE,EAAA;EAAA,IAAAC,EAAA;EAAA,IAAAN,CAAA,QAAAG,eAAA;IAIzCE,EAAA,GAAAA,CAAA;MACRD,SAAA,CAAUD,eAAA;IAAA;IACTG,EAAA,IAACH,eAAA;IAAgBH,CAAA,MAAAG,eAAA;IAAAH,CAAA,MAAAK,EAAA;IAAAL,CAAA,MAAAM,EAAA;EAAA;IAAAD,EAAA,GAAAL,CAAA;IAAAM,EAAA,GAAAN,CAAA;EAAA;EAFpBN,SAAA,CAAUW,EAEV,EAAGC,EAAiB;EAAA,IAAAC,EAAA;EAAA,IAAAP,CAAA,QAAAE,MAAA,CAAAM,WAAA,IAAAR,CAAA,QAAAE,MAAA,CAAAO,OAAA;IAGlBF,EAAA,GAAAG,EAAA;MAAC;QAAAC,cAAA;QAAAC;MAAA,IAAAF,EAAgF;MAAA,IAC3EC,cAAA;QAAA,OACKT,MAAA,CAAAM,WAAA,CAAAK,IAAA,CAAAC,UAAA,IAAwCA,UAAA,CAAAC,IAAA,KAAoBJ,cAAA;MAAA;MAAA,IAGjEC,UAAA;QAAA,OACKV,MAAA,CAAAO,OAAA,CAAAI,IAAA,CAAAG,MAAA,IAAgCA,MAAA,CAAAD,IAAA,KAAgBH,UAAA;MAAA;MAAA;IAAA;IAI3DZ,CAAA,MAAAE,MAAA,CAAAM,WAAA;IAAAR,CAAA,MAAAE,MAAA,CAAAO,OAAA;IAAAT,CAAA,MAAAO,EAAA;EAAA;IAAAA,EAAA,GAAAP,CAAA;EAAA;EAXF,MAAAiB,eAAA,GAAwBV,EAYd;EAAA,IAAAG,EAAA;EAAA,IAAAV,CAAA,QAAAE,MAAA,IAAAF,CAAA,QAAAiB,eAAA,IAAAjB,CAAA,QAAAC,QAAA;IAIRS,EAAA,GAAAQ,IAAA,CAAAtB,iBAAA,CAAAuB,QAAA;MAAAC,KAAA;QAAAlB,MAAA;QAAAe,eAAA;QAAAb;MAAA;MAAAH;IAAA,C;;;;;;;;SAAAS,E;CAIJ;AAEA,OAAO,MAAMW,SAAA,GAAYA,CAAA;EAAA,OAA2B5B,UAAA,CAAAG,iBAAW;AAAA","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/ui",
|
|
3
|
-
"version": "3.2.2-canary.
|
|
3
|
+
"version": "3.2.2-canary.d2399ed",
|
|
4
4
|
"homepage": "https://payloadcms.com",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -132,7 +132,7 @@
|
|
|
132
132
|
"ts-essentials": "10.0.3",
|
|
133
133
|
"use-context-selector": "2.0.0",
|
|
134
134
|
"uuid": "10.0.0",
|
|
135
|
-
"@payloadcms/translations": "3.2.2-canary.
|
|
135
|
+
"@payloadcms/translations": "3.2.2-canary.d2399ed"
|
|
136
136
|
},
|
|
137
137
|
"devDependencies": {
|
|
138
138
|
"@babel/cli": "^7.24.5",
|
|
@@ -151,13 +151,13 @@
|
|
|
151
151
|
"esbuild-sass-plugin": "3.3.1",
|
|
152
152
|
"eslint-plugin-react-compiler": "19.0.0-beta-a7bf2bd-20241110",
|
|
153
153
|
"@payloadcms/eslint-config": "3.0.0",
|
|
154
|
-
"payload": "3.2.2-canary.
|
|
154
|
+
"payload": "3.2.2-canary.d2399ed"
|
|
155
155
|
},
|
|
156
156
|
"peerDependencies": {
|
|
157
157
|
"next": "^15.0.0",
|
|
158
158
|
"react": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
|
|
159
159
|
"react-dom": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
|
|
160
|
-
"payload": "3.2.2-canary.
|
|
160
|
+
"payload": "3.2.2-canary.d2399ed"
|
|
161
161
|
},
|
|
162
162
|
"engines": {
|
|
163
163
|
"node": "^18.20.2 || >=20.9.0"
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
// Workaround for react-datepicker and other cjs dependencies potentially inserting require("react") statements
|
|
3
|
-
import * as requireReact from 'react';
|
|
4
|
-
import * as requireReactDom from 'react-dom';
|
|
5
|
-
|
|
6
|
-
function require(m) {
|
|
7
|
-
if (m === 'react') return requireReact;
|
|
8
|
-
if (m === 'react-dom') return requireReactDom;
|
|
9
|
-
throw new Error(`Unknown module ${m}`);
|
|
10
|
-
}
|
|
11
|
-
// Workaround end
|
|
12
|
-
|
|
13
|
-
import{c as $}from"react/compiler-runtime";import{jsx as v}from"react/jsx-runtime";import{createContext as R,useContext as M,useState as E}from"react";var k=R(void 0),J=l=>{let e=$(7),{children:t,config:r}=l,[o,m]=E(r),s;e[0]!==o.collections||e[1]!==o.globals?(s=u=>{let{collectionSlug:a,globalSlug:c}=u;return a?o.collections.find(f=>f.slug===a):c?o.globals.find(f=>f.slug===c):null},e[0]=o.collections,e[1]=o.globals,e[2]=s):s=e[2];let i=s,n;return e[3]!==o||e[4]!==i||e[5]!==t?(n=v(k.Provider,{value:{config:o,getEntityConfig:i,setConfig:m},children:t}),e[3]=o,e[4]=i,e[5]=t,e[6]=n):n=e[6],n},D=()=>M(k);import{c as P}from"react/compiler-runtime";import*as g from"react";var b=(l,e)=>{let t=P(9),r=e===void 0?!1:e,[o,m]=g.useState(!1),s=g.useRef(void 0),i;t[0]!==l?(i=()=>(m(!1),clearTimeout(s.current),s.current=setTimeout(()=>{m(!0)},l),()=>{clearTimeout(s.current)}),t[0]=l,t[1]=i):i=t[1];let n=i,u,a;t[2]!==r||t[3]!==n?(u=()=>{r&&n()},a=[n,r],t[2]=r,t[3]=n,t[4]=u,t[5]=a):(u=t[4],a=t[5]),g.useEffect(u,a);let c;return t[6]!==o||t[7]!==n?(c=[o,n],t[6]=o,t[7]=n,t[8]=c):c=t[8],c};import{c as j}from"react/compiler-runtime";import{jsx as x}from"react/jsx-runtime";import"react";var A=({animationDelay:l="0ms",height:e="60px",width:t="100%"})=>x("div",{className:"shimmer-effect",style:{height:typeof e=="number"?`${e}px`:e,width:typeof t=="number"?`${t}px`:t},children:x("div",{className:"shimmer-effect__shine",style:{animationDelay:l}})}),te=l=>{let e=j(7),{className:t,count:r,height:o,renderDelay:m,shimmerDelay:s,shimmerItemClassName:i,width:n}=l,u=m===void 0?500:m,a=s===void 0?25:s,c=typeof a=="number"?`${a}ms`:a,[f]=b(u,!0);if(!f)return null;let d;return e[0]!==r||e[1]!==i||e[2]!==c||e[3]!==o||e[4]!==n||e[5]!==t?(d=x("div",{className:t,children:[...Array(r)].map((C,p)=>x("div",{className:i,children:x(A,{animationDelay:`calc(${p} * ${c})`,height:o,width:n})},p))}),e[0]=r,e[1]=i,e[2]=c,e[3]=o,e[4]=n,e[5]=t,e[6]=d):d=e[6],d};import{c as N}from"react/compiler-runtime";import{jsx as S}from"react/jsx-runtime";import{createContext as F,useContext as O,useEffect as H,useState as w}from"react";var I={autoMode:!0,setTheme:()=>null,theme:"light"},_=F(I);function T(l,e,t){let r=new Date;r.setTime(r.getTime()+t*24*60*60*1e3);let o="expires="+r.toUTCString();document.cookie=l+"="+e+";"+o+";path=/"}var K=l=>{let e,t=window.document.cookie.split("; ").find(r=>r.startsWith(`${l}=`))?.split("=")[1];return t==="light"||t==="dark"?e=t:e=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",document.documentElement.setAttribute("data-theme",e),{theme:e,themeFromCookies:t}},U="light",ae=l=>{let e=N(11),{children:t,theme:r}=l,{config:o}=D(),m=o.admin.theme,s=`${o.cookiePrefix||"payload"}-theme`,[i,n]=w(r||U),[u,a]=w(),c,f;e[0]!==m||e[1]!==s?(c=()=>{if(m!=="all")return;let{theme:h,themeFromCookies:y}=K(s);n(h),a(!y)},f=[m,s],e[0]=m,e[1]=s,e[2]=c,e[3]=f):(c=e[2],f=e[3]),H(c,f);let d;e[4]!==s?(d=h=>{if(h==="light"||h==="dark")n(h),a(!1),T(s,h,365),document.documentElement.setAttribute("data-theme",h);else if(h==="auto"){T(s,h,-1);let y=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";document.documentElement.setAttribute("data-theme",y),a(!0),n(y)}},e[4]=s,e[5]=d):d=e[5];let C=d,p;return e[6]!==u||e[7]!==C||e[8]!==i||e[9]!==t?(p=S(_.Provider,{value:{autoMode:u,setTheme:C,theme:i},children:t}),e[6]=u,e[7]=C,e[8]=i,e[9]=t,e[10]=p):p=e[10],p},me=()=>O(_);export{J as a,D as b,b as c,A as d,te as e,U as f,ae as g,me as h};
|
|
14
|
-
//# sourceMappingURL=chunk-PNHVQDTJ.js.map
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
{
|
|
3
|
-
"version": 3,
|
|
4
|
-
"sources": ["../../../src/providers/Config/index.tsx", "../../../src/hooks/useDelay.ts", "../../../src/elements/ShimmerEffect/index.tsx", "../../../src/providers/Theme/index.tsx"],
|
|
5
|
-
"sourcesContent": ["'use client'\nimport type { ClientCollectionConfig, ClientConfig, ClientGlobalConfig } from 'payload'\n\nimport React, { createContext, useCallback, useContext, useState } from 'react'\n\nexport type ClientConfigContext = {\n config: ClientConfig\n getEntityConfig: (args: {\n collectionSlug?: string\n globalSlug?: string\n }) => ClientCollectionConfig | ClientGlobalConfig | null\n setConfig: (config: ClientConfig) => void\n}\n\nexport type EntityConfigContext = {\n collectionConfig?: ClientCollectionConfig\n globalConfig?: ClientGlobalConfig\n setEntityConfig: (args: {\n collectionConfig?: ClientCollectionConfig | null\n globalConfig?: ClientGlobalConfig | null\n }) => void\n}\n\nconst RootConfigContext = createContext<ClientConfigContext | undefined>(undefined)\n\nexport const ConfigProvider: React.FC<{\n readonly children: React.ReactNode\n readonly config: ClientConfig\n}> = ({ children, config: configFromProps }) => {\n const [config, setConfig] = useState<ClientConfig>(configFromProps)\n\n const getEntityConfig = useCallback(\n ({ collectionSlug, globalSlug }: { collectionSlug?: string; globalSlug?: string }) => {\n if (collectionSlug) {\n return config.collections.find((collection) => collection.slug === collectionSlug)\n }\n\n if (globalSlug) {\n return config.globals.find((global) => global.slug === globalSlug)\n }\n\n return null\n },\n [config],\n )\n\n return (\n <RootConfigContext.Provider value={{ config, getEntityConfig, setConfig }}>\n {children}\n </RootConfigContext.Provider>\n )\n}\n\nexport const useConfig = (): ClientConfigContext => useContext(RootConfigContext)\n", "'use client'\nimport * as React from 'react'\n\ntype Result = [boolean, () => void]\nexport const useDelay = (delay: number, triggerOnMount = false): Result => {\n const [hasDelayed, setHasDelayed] = React.useState(false)\n const triggerTimeoutRef = React.useRef<NodeJS.Timeout>(undefined)\n\n const triggerDelay = React.useCallback(() => {\n setHasDelayed(false)\n clearTimeout(triggerTimeoutRef.current)\n triggerTimeoutRef.current = setTimeout(() => {\n setHasDelayed(true)\n }, delay)\n\n return () => {\n clearTimeout(triggerTimeoutRef.current)\n }\n }, [delay])\n\n React.useEffect(() => {\n if (triggerOnMount) {\n triggerDelay()\n }\n }, [triggerDelay, triggerOnMount])\n\n return [hasDelayed, triggerDelay]\n}\n", "'use client'\nimport * as React from 'react'\n\nimport { useDelay } from '../../hooks/useDelay.js'\nimport './index.scss'\n\nexport type ShimmerEffectProps = {\n readonly animationDelay?: string\n readonly height?: number | string\n readonly width?: number | string\n}\n\nexport const ShimmerEffect: React.FC<ShimmerEffectProps> = ({\n animationDelay = '0ms',\n height = '60px',\n width = '100%',\n}) => {\n return (\n <div\n className=\"shimmer-effect\"\n style={{\n height: typeof height === 'number' ? `${height}px` : height,\n width: typeof width === 'number' ? `${width}px` : width,\n }}\n >\n <div\n className=\"shimmer-effect__shine\"\n style={{\n animationDelay,\n }}\n />\n </div>\n )\n}\n\nexport type StaggeredShimmersProps = {\n className?: string\n count: number\n height?: number | string\n renderDelay?: number\n shimmerDelay?: number | string\n shimmerItemClassName?: string\n width?: number | string\n}\n\nexport const StaggeredShimmers: React.FC<StaggeredShimmersProps> = ({\n className,\n count,\n height,\n renderDelay = 500,\n shimmerDelay = 25,\n shimmerItemClassName,\n width,\n}) => {\n const shimmerDelayToPass = typeof shimmerDelay === 'number' ? `${shimmerDelay}ms` : shimmerDelay\n const [hasDelayed] = useDelay(renderDelay, true)\n\n if (!hasDelayed) {\n return null\n }\n\n return (\n <div className={className}>\n {[...Array(count)].map((_, i) => (\n <div className={shimmerItemClassName} key={i}>\n <ShimmerEffect\n animationDelay={`calc(${i} * ${shimmerDelayToPass})`}\n height={height}\n width={width}\n />\n </div>\n ))}\n </div>\n )\n}\n", "'use client'\nimport React, { createContext, useCallback, useContext, useEffect, useState } from 'react'\n\nimport { useConfig } from '../Config/index.js'\n\nexport type Theme = 'dark' | 'light'\n\nexport type ThemeContext = {\n autoMode: boolean\n setTheme: (theme: Theme) => void\n theme: Theme\n}\n\nconst initialContext: ThemeContext = {\n autoMode: true,\n setTheme: () => null,\n theme: 'light',\n}\n\nconst Context = createContext(initialContext)\n\nfunction setCookie(cname, cvalue, exdays) {\n const d = new Date()\n d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1000)\n const expires = 'expires=' + d.toUTCString()\n document.cookie = cname + '=' + cvalue + ';' + expires + ';path=/'\n}\n\nconst getTheme = (\n cookieKey,\n): {\n theme: Theme\n themeFromCookies: null | string\n} => {\n let theme: Theme\n\n const themeFromCookies = window.document.cookie\n .split('; ')\n .find((row) => row.startsWith(`${cookieKey}=`))\n ?.split('=')[1]\n\n if (themeFromCookies === 'light' || themeFromCookies === 'dark') {\n theme = themeFromCookies\n } else {\n theme =\n window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches\n ? 'dark'\n : 'light'\n }\n\n document.documentElement.setAttribute('data-theme', theme)\n\n return { theme, themeFromCookies }\n}\n\nexport const defaultTheme = 'light'\n\nexport const ThemeProvider: React.FC<{\n children?: React.ReactNode\n theme?: Theme\n}> = ({ children, theme: initialTheme }) => {\n const { config } = useConfig()\n\n const preselectedTheme = config.admin.theme\n const cookieKey = `${config.cookiePrefix || 'payload'}-theme`\n\n const [theme, setThemeState] = useState<Theme>(initialTheme || defaultTheme)\n\n const [autoMode, setAutoMode] = useState<boolean>()\n\n useEffect(() => {\n if (preselectedTheme !== 'all') {\n return\n }\n\n const { theme, themeFromCookies } = getTheme(cookieKey)\n setThemeState(theme)\n setAutoMode(!themeFromCookies)\n }, [preselectedTheme, cookieKey])\n\n const setTheme = useCallback(\n (themeToSet: 'auto' | Theme) => {\n if (themeToSet === 'light' || themeToSet === 'dark') {\n setThemeState(themeToSet)\n setAutoMode(false)\n setCookie(cookieKey, themeToSet, 365)\n document.documentElement.setAttribute('data-theme', themeToSet)\n } else if (themeToSet === 'auto') {\n // to delete the cookie, we set an expired date\n setCookie(cookieKey, themeToSet, -1)\n const themeFromOS =\n window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches\n ? 'dark'\n : 'light'\n document.documentElement.setAttribute('data-theme', themeFromOS)\n setAutoMode(true)\n setThemeState(themeFromOS)\n }\n },\n [cookieKey],\n )\n\n return <Context.Provider value={{ autoMode, setTheme, theme }}>{children}</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EAAAc,EAAA,CAAA,EAAAY,EAAAZ,EAAA,CAAA,EAAAa,IAAAD,EAAAZ,EAAA,CAAA,EAAAa,EAAAb,EAAA,CAAA,GARhCe,EAAUH,EAQPC,CAA6B,EAAA,IAAAG,EAAAhB,EAAA,CAAA,IAAAd,GAG9B8B,EAAAC,GAAA,CAAA,GACMA,IAAe,SAAWA,IAAe,OAC3CR,EAAcQ,CAAA,EACdN,EAAA,EAAY,EACZtC,EAAUa,EAAW+B,EAAA,GAAY,EACjClC,SAAAY,gBAAAC,aAAsC,aAAcqB,CAAA,UAC3CA,IAAe,OAAA,CAExB5C,EAAUa,EAAW+B,EAAA,EAAa,EAClC,IAAAC,EACE9B,OAAAK,YAAqBL,OAAAK,WAAkB,8BAAA,EAAAC,QACnC,OACA,QACNX,SAAAY,gBAAAC,aAAsC,aAAcsB,CAAA,EACpDP,EAAA,EAAY,EACZF,EAAcS,CAAA,CAAA,CAAA,EAElBlB,EAAA,CAAA,EAAAd,EAAAc,EAAA,CAAA,EAAAgB,GAAAA,EAAAhB,EAAA,CAAA,EAlBF,IAAA/B,EAAiB+C,EAmBJG,EAAA,OAAAnB,EAAA,CAAA,IAAAhC,GAAAgC,EAAA,CAAA,IAAA/B,GAAA+B,EAAA,CAAA,IAAA9B,GAAA8B,EAAA,CAAA,IAAAE,GAGNiB,EAAAC,EAAAjD,EAAAkD,SAAA,CAAAC,MAAA,CAAAtD,SAAAA,EAAAC,SAAAA,EAAAC,MAAAA,CAAA,EAAAgC,SAAAA,CAAA,CAAA,+CAAAiB,GAGII,GAAWA,IAAoBC,EAAArD,CAAW",
|
|
7
|
-
"names": ["c", "_c", "createContext", "useContext", "useState", "RootConfigContext", "undefined", "ConfigProvider", "t0", "$", "children", "config", "configFromProps", "setConfig", "t1", "collections", "globals", "t2", "collectionSlug", "globalSlug", "find", "collection", "slug", "global", "getEntityConfig", "_jsx", "Provider", "value", "useConfig", "c", "_c", "React", "useDelay", "delay", "t0", "$", "triggerOnMount", "undefined", "hasDelayed", "setHasDelayed", "useState", "triggerTimeoutRef", "useRef", "t1", "clearTimeout", "current", "setTimeout", "triggerDelay", "t2", "t3", "useEffect", "t4", "c", "_c", "ShimmerEffect", "animationDelay", "height", "_jsx", "className", "style", "width", "StaggeredShimmers", "t0", "$", "_c", "count", "t1", "renderDelay", "shimmerDelay", "shimmerItemClassName", "undefined", "shimmerDelayToPass", "hasDelayed", "t3", "_", "i", "children", "c", "_c", "createContext", "useContext", "useEffect", "useState", "initialContext", "autoMode", "setTheme", "theme", "Context", "createContext", "setCookie", "cname", "cvalue", "exdays", "d", "Date", "setTime", "getTime", "expires", "toUTCString", "document", "cookie", "getTheme", "cookieKey", "themeFromCookies", "window", "split", "find", "row", "startsWith", "matchMedia", "matches", "documentElement", "setAttribute", "defaultTheme", "ThemeProvider", "t0", "$", "_c", "children", "initialTheme", "config", "useConfig", "preselectedTheme", "admin", "cookiePrefix", "setThemeState", "useState", "setAutoMode", "t1", "t2", "theme_0", "useEffect", "t3", "themeToSet", "themeFromOS", "t4", "_jsx", "Provider", "value", "useTheme", "useContext"]
|
|
8
|
-
}
|
|
File without changes
|