@webdevarif/dashui 1.2.7 → 1.2.8
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/hooks.js +70 -0
- package/dist/hooks.js.map +1 -0
- package/dist/hooks.mjs +33 -0
- package/dist/hooks.mjs.map +1 -0
- package/dist/i18n.js +52 -0
- package/dist/i18n.js.map +1 -0
- package/dist/i18n.mjs +25 -0
- package/dist/i18n.mjs.map +1 -0
- package/dist/index.js +34 -77
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +33 -71
- package/dist/index.mjs.map +1 -1
- package/dist/setup.js +85 -54
- package/dist/setup.js.map +1 -1
- package/dist/setup.mjs +82 -49
- package/dist/setup.mjs.map +1 -1
- package/dist/styles/globals.css +4 -52
- package/package.json +14 -3
package/dist/hooks.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
|
|
31
|
+
// src/hooks.ts
|
|
32
|
+
var hooks_exports = {};
|
|
33
|
+
__export(hooks_exports, {
|
|
34
|
+
useAuth: () => useAuth,
|
|
35
|
+
useFetch: () => useFetch
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(hooks_exports);
|
|
38
|
+
|
|
39
|
+
// src/setup/hooks/use-fetch.ts
|
|
40
|
+
var import_swr = __toESM(require("swr"));
|
|
41
|
+
function useFetch(url, options) {
|
|
42
|
+
const { data, error, isLoading, isValidating, mutate } = (0, import_swr.default)(
|
|
43
|
+
options?.enabled === false ? null : url,
|
|
44
|
+
options?.fetcher,
|
|
45
|
+
{
|
|
46
|
+
revalidateOnFocus: options?.revalidateOnFocus,
|
|
47
|
+
refreshInterval: options?.refreshInterval
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
return {
|
|
51
|
+
data,
|
|
52
|
+
isLoading,
|
|
53
|
+
isValidating,
|
|
54
|
+
error,
|
|
55
|
+
isError: !!error,
|
|
56
|
+
mutate
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// src/setup/hooks/use-auth.ts
|
|
61
|
+
var import_react = require("next-auth/react");
|
|
62
|
+
function useAuth() {
|
|
63
|
+
return (0, import_react.useSession)();
|
|
64
|
+
}
|
|
65
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
66
|
+
0 && (module.exports = {
|
|
67
|
+
useAuth,
|
|
68
|
+
useFetch
|
|
69
|
+
});
|
|
70
|
+
//# sourceMappingURL=hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/hooks.ts","../src/setup/hooks/use-fetch.ts","../src/setup/hooks/use-auth.ts"],"sourcesContent":["/**\n * @webdevarif/dashui/hooks - Client-only hooks\n * \n * Import separately to avoid server-side bundling issues:\n * import { useFetch } from '@webdevarif/dashui/hooks'\n */\n\n'use client'\n\nexport { useFetch } from './setup/hooks/use-fetch'\nexport { useAuth } from './setup/hooks/use-auth'\n","import useSWR from 'swr'\n\ninterface UseFetchOptions {\n /** Custom fetcher override */\n fetcher?: (url: string) => Promise<any>\n /** SWR options */\n revalidateOnFocus?: boolean\n refreshInterval?: number\n /** Don't fetch until condition is true */\n enabled?: boolean\n}\n\n/**\n * useFetch - SWR-powered data fetching hook\n * \n * Uses global SWR config by default (from SWRProvider)\n * Supports fetch, axios, or any custom fetcher\n * \n * Basic:\n * ```tsx\n * const { data, isLoading } = useFetch('/api/users')\n * ```\n * \n * With axios:\n * ```tsx\n * import axios from 'axios'\n * const { data } = useFetch('/api/users', { \n * fetcher: (url) => axios.get(url).then(r => r.data) \n * })\n * ```\n * \n * Conditional:\n * ```tsx\n * const { data } = useFetch(userId ? `/api/users/${userId}` : null)\n * ```\n */\nexport function useFetch<T = any>(url: string | null, options?: UseFetchOptions) {\n const { data, error, isLoading, isValidating, mutate } = useSWR<T>(\n options?.enabled === false ? null : url,\n options?.fetcher,\n {\n revalidateOnFocus: options?.revalidateOnFocus,\n refreshInterval: options?.refreshInterval,\n }\n )\n\n return {\n data,\n isLoading,\n isValidating,\n error,\n isError: !!error,\n mutate,\n }\n}\n","import { useSession } from 'next-auth/react'\n\n/**\n * useAuth - Hook to access current session and auth methods\n * \n * Returns the NextAuth useSession hook result\n * \n * Usage:\n * ```tsx\n * import { useAuth } from '@webdevarif/dashui-setup/hooks'\n * \n * function Profile() {\n * const { data: session, status } = useAuth()\n * \n * if (status === 'loading') return <div>Loading...</div>\n * if (status === 'unauthenticated') return <div>Not logged in</div>\n * \n * return <div>Welcome {session?.user?.name}</div>\n * }\n * ```\n */\nexport function useAuth() {\n return useSession()\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,iBAAmB;AAoCZ,SAAS,SAAkB,KAAoB,SAA2B;AAC/E,QAAM,EAAE,MAAM,OAAO,WAAW,cAAc,OAAO,QAAI,WAAAA;AAAA,IACvD,SAAS,YAAY,QAAQ,OAAO;AAAA,IACpC,SAAS;AAAA,IACT;AAAA,MACE,mBAAmB,SAAS;AAAA,MAC5B,iBAAiB,SAAS;AAAA,IAC5B;AAAA,EACF;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS,CAAC,CAAC;AAAA,IACX;AAAA,EACF;AACF;;;ACtDA,mBAA2B;AAqBpB,SAAS,UAAU;AACxB,aAAO,yBAAW;AACpB;","names":["useSWR"]}
|
package/dist/hooks.mjs
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/setup/hooks/use-fetch.ts
|
|
4
|
+
import useSWR from "swr";
|
|
5
|
+
function useFetch(url, options) {
|
|
6
|
+
const { data, error, isLoading, isValidating, mutate } = useSWR(
|
|
7
|
+
options?.enabled === false ? null : url,
|
|
8
|
+
options?.fetcher,
|
|
9
|
+
{
|
|
10
|
+
revalidateOnFocus: options?.revalidateOnFocus,
|
|
11
|
+
refreshInterval: options?.refreshInterval
|
|
12
|
+
}
|
|
13
|
+
);
|
|
14
|
+
return {
|
|
15
|
+
data,
|
|
16
|
+
isLoading,
|
|
17
|
+
isValidating,
|
|
18
|
+
error,
|
|
19
|
+
isError: !!error,
|
|
20
|
+
mutate
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// src/setup/hooks/use-auth.ts
|
|
25
|
+
import { useSession } from "next-auth/react";
|
|
26
|
+
function useAuth() {
|
|
27
|
+
return useSession();
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
useAuth,
|
|
31
|
+
useFetch
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=hooks.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/setup/hooks/use-fetch.ts","../src/setup/hooks/use-auth.ts"],"sourcesContent":["import useSWR from 'swr'\n\ninterface UseFetchOptions {\n /** Custom fetcher override */\n fetcher?: (url: string) => Promise<any>\n /** SWR options */\n revalidateOnFocus?: boolean\n refreshInterval?: number\n /** Don't fetch until condition is true */\n enabled?: boolean\n}\n\n/**\n * useFetch - SWR-powered data fetching hook\n * \n * Uses global SWR config by default (from SWRProvider)\n * Supports fetch, axios, or any custom fetcher\n * \n * Basic:\n * ```tsx\n * const { data, isLoading } = useFetch('/api/users')\n * ```\n * \n * With axios:\n * ```tsx\n * import axios from 'axios'\n * const { data } = useFetch('/api/users', { \n * fetcher: (url) => axios.get(url).then(r => r.data) \n * })\n * ```\n * \n * Conditional:\n * ```tsx\n * const { data } = useFetch(userId ? `/api/users/${userId}` : null)\n * ```\n */\nexport function useFetch<T = any>(url: string | null, options?: UseFetchOptions) {\n const { data, error, isLoading, isValidating, mutate } = useSWR<T>(\n options?.enabled === false ? null : url,\n options?.fetcher,\n {\n revalidateOnFocus: options?.revalidateOnFocus,\n refreshInterval: options?.refreshInterval,\n }\n )\n\n return {\n data,\n isLoading,\n isValidating,\n error,\n isError: !!error,\n mutate,\n }\n}\n","import { useSession } from 'next-auth/react'\n\n/**\n * useAuth - Hook to access current session and auth methods\n * \n * Returns the NextAuth useSession hook result\n * \n * Usage:\n * ```tsx\n * import { useAuth } from '@webdevarif/dashui-setup/hooks'\n * \n * function Profile() {\n * const { data: session, status } = useAuth()\n * \n * if (status === 'loading') return <div>Loading...</div>\n * if (status === 'unauthenticated') return <div>Not logged in</div>\n * \n * return <div>Welcome {session?.user?.name}</div>\n * }\n * ```\n */\nexport function useAuth() {\n return useSession()\n}\n"],"mappings":";;;AAAA,OAAO,YAAY;AAoCZ,SAAS,SAAkB,KAAoB,SAA2B;AAC/E,QAAM,EAAE,MAAM,OAAO,WAAW,cAAc,OAAO,IAAI;AAAA,IACvD,SAAS,YAAY,QAAQ,OAAO;AAAA,IACpC,SAAS;AAAA,IACT;AAAA,MACE,mBAAmB,SAAS;AAAA,MAC5B,iBAAiB,SAAS;AAAA,IAC5B;AAAA,EACF;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS,CAAC,CAAC;AAAA,IACX;AAAA,EACF;AACF;;;ACtDA,SAAS,kBAAkB;AAqBpB,SAAS,UAAU;AACxB,SAAO,WAAW;AACpB;","names":[]}
|
package/dist/i18n.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/i18n.ts
|
|
21
|
+
var i18n_exports = {};
|
|
22
|
+
__export(i18n_exports, {
|
|
23
|
+
I18nProvider: () => I18nProvider
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(i18n_exports);
|
|
26
|
+
|
|
27
|
+
// src/setup/providers/i18n-provider.tsx
|
|
28
|
+
var import_next_intl = require("next-intl");
|
|
29
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
30
|
+
function I18nProvider({
|
|
31
|
+
children,
|
|
32
|
+
locale,
|
|
33
|
+
messages,
|
|
34
|
+
timeZone = "UTC",
|
|
35
|
+
now
|
|
36
|
+
}) {
|
|
37
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
38
|
+
import_next_intl.NextIntlClientProvider,
|
|
39
|
+
{
|
|
40
|
+
locale,
|
|
41
|
+
messages,
|
|
42
|
+
timeZone,
|
|
43
|
+
now,
|
|
44
|
+
children
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
49
|
+
0 && (module.exports = {
|
|
50
|
+
I18nProvider
|
|
51
|
+
});
|
|
52
|
+
//# sourceMappingURL=i18n.js.map
|
package/dist/i18n.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/i18n.ts","../src/setup/providers/i18n-provider.tsx"],"sourcesContent":["// Separate i18n entry point - optional, import only when needed\n// This avoids next-intl server/client module conflicts in the main setup bundle\nexport { I18nProvider } from './setup/providers/i18n-provider'\n","'use client'\n\nimport { ReactNode } from 'react'\nimport { NextIntlClientProvider } from 'next-intl'\n\ninterface I18nProviderProps {\n children: ReactNode\n locale: string\n messages: Record<string, any>\n timeZone?: string\n now?: Date\n}\n\n/**\n * I18nProvider - Optional wrapper for next-intl\n * \n * Usage:\n * ```tsx\n * import { I18nProvider } from '@webdevarif/dashui/i18n'\n * \n * <I18nProvider locale=\"en\" messages={messages} timeZone=\"Asia/Dhaka\">\n * {children}\n * </I18nProvider>\n * ```\n */\nexport function I18nProvider({ \n children, \n locale, \n messages, \n timeZone = 'UTC',\n now,\n}: I18nProviderProps) {\n return (\n <NextIntlClientProvider\n locale={locale}\n messages={messages}\n timeZone={timeZone}\n now={now}\n >\n {children}\n </NextIntlClientProvider>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACGA,uBAAuC;AA8BnC;AARG,SAAS,aAAa;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX;AACF,GAAsB;AACpB,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MAEC;AAAA;AAAA,EACH;AAEJ;","names":[]}
|
package/dist/i18n.mjs
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// src/setup/providers/i18n-provider.tsx
|
|
2
|
+
import { NextIntlClientProvider } from "next-intl";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
function I18nProvider({
|
|
5
|
+
children,
|
|
6
|
+
locale,
|
|
7
|
+
messages,
|
|
8
|
+
timeZone = "UTC",
|
|
9
|
+
now
|
|
10
|
+
}) {
|
|
11
|
+
return /* @__PURE__ */ jsx(
|
|
12
|
+
NextIntlClientProvider,
|
|
13
|
+
{
|
|
14
|
+
locale,
|
|
15
|
+
messages,
|
|
16
|
+
timeZone,
|
|
17
|
+
now,
|
|
18
|
+
children
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
I18nProvider
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=i18n.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/setup/providers/i18n-provider.tsx"],"sourcesContent":["'use client'\n\nimport { ReactNode } from 'react'\nimport { NextIntlClientProvider } from 'next-intl'\n\ninterface I18nProviderProps {\n children: ReactNode\n locale: string\n messages: Record<string, any>\n timeZone?: string\n now?: Date\n}\n\n/**\n * I18nProvider - Optional wrapper for next-intl\n * \n * Usage:\n * ```tsx\n * import { I18nProvider } from '@webdevarif/dashui/i18n'\n * \n * <I18nProvider locale=\"en\" messages={messages} timeZone=\"Asia/Dhaka\">\n * {children}\n * </I18nProvider>\n * ```\n */\nexport function I18nProvider({ \n children, \n locale, \n messages, \n timeZone = 'UTC',\n now,\n}: I18nProviderProps) {\n return (\n <NextIntlClientProvider\n locale={locale}\n messages={messages}\n timeZone={timeZone}\n now={now}\n >\n {children}\n </NextIntlClientProvider>\n )\n}\n"],"mappings":";AAGA,SAAS,8BAA8B;AA8BnC;AARG,SAAS,aAAa;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX;AACF,GAAsB;AACpB,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MAEC;AAAA;AAAA,EACH;AAEJ;","names":[]}
|
package/dist/index.js
CHANGED
|
@@ -94,7 +94,6 @@ __export(src_exports, {
|
|
|
94
94
|
FormLayout: () => FormLayout,
|
|
95
95
|
FormSection: () => FormSection,
|
|
96
96
|
HslColorInput: () => HslColorInput,
|
|
97
|
-
I18nProvider: () => I18nProvider,
|
|
98
97
|
ImagePickerField: () => ImagePickerField,
|
|
99
98
|
Input: () => Input,
|
|
100
99
|
Label: () => Label2,
|
|
@@ -156,13 +155,9 @@ __export(src_exports, {
|
|
|
156
155
|
badgeVariants: () => badgeVariants,
|
|
157
156
|
buttonVariants: () => buttonVariants,
|
|
158
157
|
cn: () => cn,
|
|
159
|
-
prisma: () => prisma,
|
|
160
158
|
useAuth: () => useAuth,
|
|
161
159
|
useColorPicker: () => useColorPicker,
|
|
162
|
-
useDisclosure: () => useDisclosure,
|
|
163
160
|
useFetch: () => useFetch,
|
|
164
|
-
useI18n: () => useI18n,
|
|
165
|
-
usePagination: () => usePagination,
|
|
166
161
|
useTheme: () => import_next_themes2.useTheme
|
|
167
162
|
});
|
|
168
163
|
module.exports = __toCommonJS(src_exports);
|
|
@@ -4217,22 +4212,31 @@ function TypographyPanel({
|
|
|
4217
4212
|
] });
|
|
4218
4213
|
}
|
|
4219
4214
|
|
|
4220
|
-
// src/hooks/
|
|
4221
|
-
var
|
|
4222
|
-
function
|
|
4223
|
-
const
|
|
4215
|
+
// src/setup/hooks/use-fetch.ts
|
|
4216
|
+
var import_swr = __toESM(require("swr"));
|
|
4217
|
+
function useFetch(url, options) {
|
|
4218
|
+
const { data, error, isLoading, isValidating, mutate } = (0, import_swr.default)(
|
|
4219
|
+
options?.enabled === false ? null : url,
|
|
4220
|
+
options?.fetcher,
|
|
4221
|
+
{
|
|
4222
|
+
revalidateOnFocus: options?.revalidateOnFocus,
|
|
4223
|
+
refreshInterval: options?.refreshInterval
|
|
4224
|
+
}
|
|
4225
|
+
);
|
|
4224
4226
|
return {
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4227
|
+
data,
|
|
4228
|
+
isLoading,
|
|
4229
|
+
isValidating,
|
|
4230
|
+
error,
|
|
4231
|
+
isError: !!error,
|
|
4232
|
+
mutate
|
|
4230
4233
|
};
|
|
4231
4234
|
}
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
|
|
4235
|
+
|
|
4236
|
+
// src/setup/hooks/use-auth.ts
|
|
4237
|
+
var import_react11 = require("next-auth/react");
|
|
4238
|
+
function useAuth() {
|
|
4239
|
+
return (0, import_react11.useSession)();
|
|
4236
4240
|
}
|
|
4237
4241
|
|
|
4238
4242
|
// src/components/auth/AuthShell.tsx
|
|
@@ -4565,74 +4569,32 @@ function AuthProvider({ children, session }) {
|
|
|
4565
4569
|
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_react12.SessionProvider, { session, children });
|
|
4566
4570
|
}
|
|
4567
4571
|
|
|
4568
|
-
// src/setup/providers/i18n-provider.tsx
|
|
4569
|
-
var import_next_intl = require("next-intl");
|
|
4570
|
-
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
4571
|
-
function I18nProvider({
|
|
4572
|
-
children,
|
|
4573
|
-
locale,
|
|
4574
|
-
messages,
|
|
4575
|
-
timeZone = "UTC"
|
|
4576
|
-
}) {
|
|
4577
|
-
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_next_intl.IntlProvider, { locale, messages, timeZone, children });
|
|
4578
|
-
}
|
|
4579
|
-
|
|
4580
4572
|
// src/setup/providers/swr-provider.tsx
|
|
4581
|
-
var
|
|
4582
|
-
var
|
|
4573
|
+
var import_swr2 = require("swr");
|
|
4574
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
4575
|
+
var fetchFetcher = (url) => fetch(url).then((r) => r.json());
|
|
4583
4576
|
var DEFAULT_SWR_CONFIG = {
|
|
4584
4577
|
revalidateOnFocus: false,
|
|
4585
4578
|
revalidateOnReconnect: true,
|
|
4586
4579
|
dedupingInterval: 6e4,
|
|
4587
4580
|
focusThrottleInterval: 3e5
|
|
4588
4581
|
};
|
|
4589
|
-
function SWRProvider({ children }) {
|
|
4590
|
-
return /* @__PURE__ */ (0,
|
|
4582
|
+
function SWRProvider({ children, fetcher, config }) {
|
|
4583
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_swr2.SWRConfig, { value: {
|
|
4584
|
+
fetcher: fetcher ?? fetchFetcher,
|
|
4585
|
+
...DEFAULT_SWR_CONFIG,
|
|
4586
|
+
...config
|
|
4587
|
+
}, children });
|
|
4591
4588
|
}
|
|
4592
4589
|
|
|
4593
4590
|
// src/setup/providers/root-provider.tsx
|
|
4594
|
-
var
|
|
4591
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
4595
4592
|
function RootProvider({
|
|
4596
4593
|
children,
|
|
4597
|
-
session
|
|
4598
|
-
locale,
|
|
4599
|
-
messages,
|
|
4600
|
-
timeZone
|
|
4594
|
+
session
|
|
4601
4595
|
}) {
|
|
4602
|
-
return /* @__PURE__ */ (0,
|
|
4603
|
-
}
|
|
4604
|
-
|
|
4605
|
-
// src/setup/hooks/use-auth.ts
|
|
4606
|
-
var import_react13 = require("next-auth/react");
|
|
4607
|
-
function useAuth() {
|
|
4608
|
-
return (0, import_react13.useSession)();
|
|
4609
|
-
}
|
|
4610
|
-
|
|
4611
|
-
// src/setup/hooks/use-i18n.ts
|
|
4612
|
-
var import_next_intl2 = require("next-intl");
|
|
4613
|
-
function useI18n() {
|
|
4614
|
-
return (0, import_next_intl2.useIntl)();
|
|
4615
|
-
}
|
|
4616
|
-
|
|
4617
|
-
// src/setup/hooks/use-fetch.ts
|
|
4618
|
-
var import_swr2 = __toESM(require("swr"));
|
|
4619
|
-
function useFetch(url, options) {
|
|
4620
|
-
const { data, error, isLoading } = (0, import_swr2.default)(url, options);
|
|
4621
|
-
return {
|
|
4622
|
-
data,
|
|
4623
|
-
isLoading,
|
|
4624
|
-
error,
|
|
4625
|
-
isError: !!error
|
|
4626
|
-
};
|
|
4596
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(AuthProvider, { session, children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(SWRProvider, { children }) });
|
|
4627
4597
|
}
|
|
4628
|
-
|
|
4629
|
-
// src/setup/lib/prisma.ts
|
|
4630
|
-
var import_client = require("@prisma/client");
|
|
4631
|
-
var globalForPrisma = global;
|
|
4632
|
-
var prisma = globalForPrisma.prisma || new import_client.PrismaClient({
|
|
4633
|
-
log: process.env.NODE_ENV === "development" ? ["query"] : []
|
|
4634
|
-
});
|
|
4635
|
-
if (process.env.NODE_ENV !== "production") globalForPrisma.prisma = prisma;
|
|
4636
4598
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4637
4599
|
0 && (module.exports = {
|
|
4638
4600
|
Alert,
|
|
@@ -4699,7 +4661,6 @@ if (process.env.NODE_ENV !== "production") globalForPrisma.prisma = prisma;
|
|
|
4699
4661
|
FormLayout,
|
|
4700
4662
|
FormSection,
|
|
4701
4663
|
HslColorInput,
|
|
4702
|
-
I18nProvider,
|
|
4703
4664
|
ImagePickerField,
|
|
4704
4665
|
Input,
|
|
4705
4666
|
Label,
|
|
@@ -4761,13 +4722,9 @@ if (process.env.NODE_ENV !== "production") globalForPrisma.prisma = prisma;
|
|
|
4761
4722
|
badgeVariants,
|
|
4762
4723
|
buttonVariants,
|
|
4763
4724
|
cn,
|
|
4764
|
-
prisma,
|
|
4765
4725
|
useAuth,
|
|
4766
4726
|
useColorPicker,
|
|
4767
|
-
useDisclosure,
|
|
4768
4727
|
useFetch,
|
|
4769
|
-
useI18n,
|
|
4770
|
-
usePagination,
|
|
4771
4728
|
useTheme
|
|
4772
4729
|
});
|
|
4773
4730
|
//# sourceMappingURL=index.js.map
|