@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/index.mjs CHANGED
@@ -4057,22 +4057,31 @@ function TypographyPanel({
4057
4057
  ] });
4058
4058
  }
4059
4059
 
4060
- // src/hooks/index.ts
4061
- import { useState as useState15 } from "react";
4062
- function useDisclosure(initial = false) {
4063
- const [isOpen, setIsOpen] = useState15(initial);
4060
+ // src/setup/hooks/use-fetch.ts
4061
+ import useSWR from "swr";
4062
+ function useFetch(url, options) {
4063
+ const { data, error, isLoading, isValidating, mutate } = useSWR(
4064
+ options?.enabled === false ? null : url,
4065
+ options?.fetcher,
4066
+ {
4067
+ revalidateOnFocus: options?.revalidateOnFocus,
4068
+ refreshInterval: options?.refreshInterval
4069
+ }
4070
+ );
4064
4071
  return {
4065
- isOpen,
4066
- open: () => setIsOpen(true),
4067
- close: () => setIsOpen(false),
4068
- toggle: () => setIsOpen((prev) => !prev),
4069
- onOpenChange: setIsOpen
4072
+ data,
4073
+ isLoading,
4074
+ isValidating,
4075
+ error,
4076
+ isError: !!error,
4077
+ mutate
4070
4078
  };
4071
4079
  }
4072
- function usePagination(total, pageSize = 20) {
4073
- const [page, setPage] = useState15(1);
4074
- const totalPages = Math.ceil(total / pageSize);
4075
- return { page, setPage, pageSize, total, totalPages };
4080
+
4081
+ // src/setup/hooks/use-auth.ts
4082
+ import { useSession } from "next-auth/react";
4083
+ function useAuth() {
4084
+ return useSession();
4076
4085
  }
4077
4086
 
4078
4087
  // src/components/auth/AuthShell.tsx
@@ -4405,74 +4414,32 @@ function AuthProvider({ children, session }) {
4405
4414
  return /* @__PURE__ */ jsx67(SessionProvider, { session, children });
4406
4415
  }
4407
4416
 
4408
- // src/setup/providers/i18n-provider.tsx
4409
- import { IntlProvider } from "next-intl";
4410
- import { jsx as jsx68 } from "react/jsx-runtime";
4411
- function I18nProvider({
4412
- children,
4413
- locale,
4414
- messages,
4415
- timeZone = "UTC"
4416
- }) {
4417
- return /* @__PURE__ */ jsx68(IntlProvider, { locale, messages, timeZone, children });
4418
- }
4419
-
4420
4417
  // src/setup/providers/swr-provider.tsx
4421
4418
  import { SWRConfig } from "swr";
4422
- import { jsx as jsx69 } from "react/jsx-runtime";
4419
+ import { jsx as jsx68 } from "react/jsx-runtime";
4420
+ var fetchFetcher = (url) => fetch(url).then((r) => r.json());
4423
4421
  var DEFAULT_SWR_CONFIG = {
4424
4422
  revalidateOnFocus: false,
4425
4423
  revalidateOnReconnect: true,
4426
4424
  dedupingInterval: 6e4,
4427
4425
  focusThrottleInterval: 3e5
4428
4426
  };
4429
- function SWRProvider({ children }) {
4430
- return /* @__PURE__ */ jsx69(SWRConfig, { value: { fetcher: (url) => fetch(url).then((r) => r.json()), ...DEFAULT_SWR_CONFIG }, children });
4427
+ function SWRProvider({ children, fetcher, config }) {
4428
+ return /* @__PURE__ */ jsx68(SWRConfig, { value: {
4429
+ fetcher: fetcher ?? fetchFetcher,
4430
+ ...DEFAULT_SWR_CONFIG,
4431
+ ...config
4432
+ }, children });
4431
4433
  }
4432
4434
 
4433
4435
  // src/setup/providers/root-provider.tsx
4434
- import { jsx as jsx70 } from "react/jsx-runtime";
4436
+ import { jsx as jsx69 } from "react/jsx-runtime";
4435
4437
  function RootProvider({
4436
4438
  children,
4437
- session,
4438
- locale,
4439
- messages,
4440
- timeZone
4439
+ session
4441
4440
  }) {
4442
- return /* @__PURE__ */ jsx70(AuthProvider, { session, children: /* @__PURE__ */ jsx70(I18nProvider, { locale, messages, timeZone, children: /* @__PURE__ */ jsx70(SWRProvider, { children }) }) });
4441
+ return /* @__PURE__ */ jsx69(AuthProvider, { session, children: /* @__PURE__ */ jsx69(SWRProvider, { children }) });
4443
4442
  }
4444
-
4445
- // src/setup/hooks/use-auth.ts
4446
- import { useSession } from "next-auth/react";
4447
- function useAuth() {
4448
- return useSession();
4449
- }
4450
-
4451
- // src/setup/hooks/use-i18n.ts
4452
- import { useIntl } from "next-intl";
4453
- function useI18n() {
4454
- return useIntl();
4455
- }
4456
-
4457
- // src/setup/hooks/use-fetch.ts
4458
- import useSWR from "swr";
4459
- function useFetch(url, options) {
4460
- const { data, error, isLoading } = useSWR(url, options);
4461
- return {
4462
- data,
4463
- isLoading,
4464
- error,
4465
- isError: !!error
4466
- };
4467
- }
4468
-
4469
- // src/setup/lib/prisma.ts
4470
- import { PrismaClient } from "@prisma/client";
4471
- var globalForPrisma = global;
4472
- var prisma = globalForPrisma.prisma || new PrismaClient({
4473
- log: process.env.NODE_ENV === "development" ? ["query"] : []
4474
- });
4475
- if (process.env.NODE_ENV !== "production") globalForPrisma.prisma = prisma;
4476
4443
  export {
4477
4444
  Alert,
4478
4445
  AppShell,
@@ -4538,7 +4505,6 @@ export {
4538
4505
  FormLayout,
4539
4506
  FormSection,
4540
4507
  HslColorInput,
4541
- I18nProvider,
4542
4508
  ImagePickerField,
4543
4509
  Input,
4544
4510
  Label2 as Label,
@@ -4600,13 +4566,9 @@ export {
4600
4566
  badgeVariants,
4601
4567
  buttonVariants,
4602
4568
  cn,
4603
- prisma,
4604
4569
  useAuth,
4605
4570
  useColorPicker,
4606
- useDisclosure,
4607
4571
  useFetch,
4608
- useI18n,
4609
- usePagination,
4610
4572
  useTheme2 as useTheme
4611
4573
  };
4612
4574
  //# sourceMappingURL=index.mjs.map