fina-react-ds 1.0.14 → 1.0.15

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.d.ts CHANGED
@@ -39,3 +39,4 @@ export { FormSwitch } from "./components/form-switch";
39
39
  export { FormTextarea } from "./components/form-textarea";
40
40
  export { useFormField, Form, FormItem, FormLabel, FormControl, FormDescription, FormMessage, FormField, } from "./components/form";
41
41
  export { ThemeProvider, useTheme } from "./providers/theme-provider";
42
+ export { LoaderProvider, useLoader } from "./providers/loader-provider";
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import { Badge as T } from "./components/badge.js";
4
4
  import { Button as s, buttonVariants as M } from "./components/button.js";
5
5
  import { Avatar as c, AvatarFallback as A, AvatarImage as P } from "./components/avatar.js";
6
6
  import { Calendar as h } from "./components/calendar.js";
7
- import { Card as I, CardAction as H, CardContent as k, CardDescription as B, CardFooter as L, CardHeader as G, CardTitle as R } from "./components/card.js";
7
+ import { Card as I, CardAction as H, CardContent as L, CardDescription as k, CardFooter as B, CardHeader as G, CardTitle as R } from "./components/card.js";
8
8
  import { Checkbox as O } from "./components/checkbox.js";
9
9
  import { DatePicker as E } from "./components/date-picker.js";
10
10
  import { Dialog as V, DialogClose as j, DialogContent as q, DialogDescription as z, DialogFooter as J, DialogHeader as K, DialogOverlay as Q, DialogPortal as W, DialogTitle as X, DialogTrigger as Y } from "./components/dialog.js";
@@ -15,7 +15,7 @@ import { HoverCard as Te, HoverCardContent as Ce, HoverCardTrigger as se } from
15
15
  import { Input as Fe } from "./components/input.js";
16
16
  import { Label as Ae } from "./components/label.js";
17
17
  import { ModeToggle as we } from "./components/mode-toggle.js";
18
- import { Pagination as ve, PaginationContent as Ie, PaginationEllipsis as He, PaginationItem as ke, PaginationLink as Be, PaginationNext as Le, PaginationPrevious as Ge } from "./components/pagination.js";
18
+ import { Pagination as ve, PaginationContent as Ie, PaginationEllipsis as He, PaginationItem as Le, PaginationLink as ke, PaginationNext as Be, PaginationPrevious as Ge } from "./components/pagination.js";
19
19
  import { PasswordRulesChecker as ye } from "./components/password-rules-checker.js";
20
20
  import { Popover as Ue, PopoverAnchor as Ee, PopoverContent as Ne, PopoverTrigger as Ve } from "./components/popover.js";
21
21
  import { Select as qe } from "./components/select.js";
@@ -23,8 +23,8 @@ import { Separator as Je } from "./components/separator.js";
23
23
  import { Sheet as Qe, SheetBody as We, SheetClose as Xe, SheetContent as Ye, SheetDescription as Ze, SheetFooter as _e, SheetHeader as $e, SheetTitle as eo, SheetTrigger as oo } from "./components/sheet.js";
24
24
  import { Sidebar as to, SidebarContent as ao, SidebarFooter as io, SidebarGroup as no, SidebarGroupAction as po, SidebarGroupContent as lo, SidebarGroupLabel as mo, SidebarHeader as go, SidebarInput as So, SidebarInset as bo, SidebarMenu as uo, SidebarMenuAction as xo, SidebarMenuBadge as Do, SidebarMenuButton as fo, SidebarMenuItem as To, SidebarMenuSkeleton as Co, SidebarMenuSub as so, SidebarMenuSubButton as Mo, SidebarMenuSubItem as Fo, SidebarProvider as co, SidebarRail as Ao, SidebarSeparator as Po, SidebarTrigger as wo, useSidebar as ho } from "./components/sidebar.js";
25
25
  import { SimplePagination as Io } from "./components/simple-pagination.js";
26
- import { SimpleTooltip as ko } from "./components/simple-tooltip.js";
27
- import { Skeleton as Lo } from "./components/skeleton.js";
26
+ import { SimpleTooltip as Lo } from "./components/simple-tooltip.js";
27
+ import { Skeleton as Bo } from "./components/skeleton.js";
28
28
  import { Switch as Ro } from "./components/switch.js";
29
29
  import { Toaster as Oo } from "./components/sonner.js";
30
30
  import { Table as Eo, TableBody as No, TableCaption as Vo, TableCell as jo, TableFooter as qo, TableHead as zo, TableHeader as Jo, TableRow as Ko } from "./components/table.js";
@@ -39,6 +39,7 @@ import { FormSwitch as ur } from "./components/form-switch.js";
39
39
  import { FormTextarea as Dr } from "./components/form-textarea.js";
40
40
  import { Form as Tr, FormControl as Cr, FormDescription as sr, FormField as Mr, FormItem as Fr, FormLabel as cr, FormMessage as Ar, useFormField as Pr } from "./components/form.js";
41
41
  import { ThemeProvider as hr, useTheme as vr } from "./providers/theme-provider.js";
42
+ import { LoaderProvider as Hr, useLoader as Lr } from "./providers/loader-provider.js";
42
43
  export {
43
44
  u as Alert,
44
45
  x as AlertDescription,
@@ -62,9 +63,9 @@ export {
62
63
  h as Calendar,
63
64
  I as Card,
64
65
  H as CardAction,
65
- k as CardContent,
66
- B as CardDescription,
67
- L as CardFooter,
66
+ L as CardContent,
67
+ k as CardDescription,
68
+ B as CardFooter,
68
69
  G as CardHeader,
69
70
  R as CardTitle,
70
71
  O as Checkbox,
@@ -114,13 +115,14 @@ export {
114
115
  se as HoverCardTrigger,
115
116
  Fe as Input,
116
117
  Ae as Label,
118
+ Hr as LoaderProvider,
117
119
  we as ModeToggle,
118
120
  ve as Pagination,
119
121
  Ie as PaginationContent,
120
122
  He as PaginationEllipsis,
121
- ke as PaginationItem,
122
- Be as PaginationLink,
123
- Le as PaginationNext,
123
+ Le as PaginationItem,
124
+ ke as PaginationLink,
125
+ Be as PaginationNext,
124
126
  Ge as PaginationPrevious,
125
127
  ye as PasswordRulesChecker,
126
128
  Ue as Popover,
@@ -162,8 +164,8 @@ export {
162
164
  Po as SidebarSeparator,
163
165
  wo as SidebarTrigger,
164
166
  Io as SimplePagination,
165
- ko as SimpleTooltip,
166
- Lo as Skeleton,
167
+ Lo as SimpleTooltip,
168
+ Bo as Skeleton,
167
169
  Ro as Switch,
168
170
  Eo as Table,
169
171
  No as TableBody,
@@ -186,6 +188,7 @@ export {
186
188
  ar as TooltipTrigger,
187
189
  M as buttonVariants,
188
190
  Pr as useFormField,
191
+ Lr as useLoader,
189
192
  ho as useSidebar,
190
193
  vr as useTheme
191
194
  };
@@ -0,0 +1,27 @@
1
+ import { ToastT } from "sonner";
2
+ interface PromiseIExtendedResult extends ExternalToast {
3
+ message: React.ReactNode;
4
+ }
5
+ type ExternalToast = Omit<ToastT, "id" | "type" | "title" | "jsx" | "delete" | "promise"> & {
6
+ id?: number | string;
7
+ };
8
+ type PromiseExternalToast = Omit<ExternalToast, "description">;
9
+ type PromiseTExtendedResult<Data = any> = PromiseIExtendedResult | ((data: Data) => PromiseIExtendedResult | Promise<PromiseIExtendedResult>);
10
+ type PromiseTResult<Data = any> = string | React.ReactNode | ((data: Data) => React.ReactNode | string | Promise<React.ReactNode | string>);
11
+ type PromiseData<ToastData = any> = PromiseExternalToast & {
12
+ loading?: string | React.ReactNode;
13
+ success?: PromiseTResult<ToastData> | PromiseTExtendedResult<ToastData>;
14
+ error?: PromiseTResult | PromiseTExtendedResult;
15
+ description?: PromiseTResult;
16
+ finally?: () => void | Promise<void>;
17
+ };
18
+ type LoaderProviderProps = {
19
+ children: React.ReactNode;
20
+ };
21
+ type LoaderProviderState = {
22
+ isLoading: boolean;
23
+ loadingWithToast: (promise: Promise<unknown>, options: PromiseData<unknown>) => void;
24
+ };
25
+ export declare function LoaderProvider({ children, ...props }: LoaderProviderProps): import("react/jsx-runtime").JSX.Element;
26
+ export declare const useLoader: () => LoaderProviderState;
27
+ export {};
@@ -0,0 +1,34 @@
1
+ var c = Object.defineProperty;
2
+ var t = (e, o) => c(e, "name", { value: o, configurable: !0 });
3
+ import { jsxs as f, jsx as l } from "react/jsx-runtime";
4
+ import { useState as u, createContext as m, useContext as g } from "react";
5
+ import { toast as h } from "sonner";
6
+ const v = {
7
+ isLoading: !1,
8
+ loadingWithToast: /* @__PURE__ */ t(() => null, "loadingWithToast")
9
+ }, s = m(v);
10
+ function P({ children: e, ...o }) {
11
+ const [r, i] = u(!1), d = {
12
+ isLoading: r,
13
+ loadingWithToast: /* @__PURE__ */ t((a, n) => {
14
+ i(!0), n.loading || (n.loading = "Chargement en cours"), h.promise(a, n), a.finally(() => {
15
+ i(!1);
16
+ });
17
+ }, "loadingWithToast")
18
+ };
19
+ return /* @__PURE__ */ f(s.Provider, { ...o, value: d, children: [
20
+ e,
21
+ r && /* @__PURE__ */ l("div", { className: "fc:fixed fc:inset-0 fc:z-9999 fc:bg-transparent fc:pointer-events-auto" })
22
+ ] });
23
+ }
24
+ t(P, "LoaderProvider");
25
+ const w = /* @__PURE__ */ t(() => {
26
+ const e = g(s);
27
+ if (e === void 0)
28
+ throw new Error("useTheme must be used within a ThemeProvider");
29
+ return e;
30
+ }, "useLoader");
31
+ export {
32
+ P as LoaderProvider,
33
+ w as useLoader
34
+ };
@@ -188,6 +188,9 @@
188
188
  container-type: inline-size;
189
189
  container-name: card-header;
190
190
  }
191
+ .fc\:pointer-events-auto {
192
+ pointer-events: auto;
193
+ }
191
194
  .fc\:pointer-events-none {
192
195
  pointer-events: none;
193
196
  }
@@ -265,6 +268,9 @@
265
268
  .fc\:z-50 {
266
269
  z-index: 50;
267
270
  }
271
+ .fc\:z-9999 {
272
+ z-index: 9999;
273
+ }
268
274
  .fc\:col-start-2 {
269
275
  grid-column-start: 2;
270
276
  }
@@ -623,13 +629,6 @@
623
629
  .fc\:gap-6 {
624
630
  gap: calc(var(--fc-spacing) * 6);
625
631
  }
626
- .fc\:space-y-2 {
627
- :where(& > :not(:last-child)) {
628
- --tw-space-y-reverse: 0;
629
- margin-block-start: calc(calc(var(--fc-spacing) * 2) * var(--tw-space-y-reverse));
630
- margin-block-end: calc(calc(var(--fc-spacing) * 2) * calc(1 - var(--tw-space-y-reverse)));
631
- }
632
- }
633
632
  .fc\:space-y-4 {
634
633
  :where(& > :not(:last-child)) {
635
634
  --tw-space-y-reverse: 0;
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "url": "https://github.com/F1na/fina-react-ds"
6
6
  },
7
7
  "private": false,
8
- "version": "1.0.14",
8
+ "version": "1.0.15",
9
9
  "type": "module",
10
10
  "files": [
11
11
  "dist"