@brightlocal/ui-components 3.4.0 → 3.5.0
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/AI_USAGE.md +22 -3
- package/README.md +177 -109
- package/component-meta.json +1061 -102
- package/dist/alert-dialog.cjs +1 -1
- package/dist/alert-dialog.d.ts +13 -2
- package/dist/alert-dialog.d.ts.map +1 -1
- package/dist/alert-dialog.js +4 -3
- package/dist/banner.cjs +1 -1
- package/dist/banner.d.ts +47 -11
- package/dist/banner.d.ts.map +1 -1
- package/dist/banner.js +156 -79
- package/dist/blocks/empty-state.cjs +1 -1
- package/dist/blocks/empty-state.d.ts +40 -5
- package/dist/blocks/empty-state.d.ts.map +1 -1
- package/dist/blocks/empty-state.js +59 -52
- package/dist/blocks/input-list.d.ts +1 -0
- package/dist/blocks/input-list.d.ts.map +1 -1
- package/dist/blocks/sidebar.cjs +1 -1
- package/dist/blocks/sidebar.d.ts +12 -6
- package/dist/blocks/sidebar.d.ts.map +1 -1
- package/dist/blocks/sidebar.js +64 -63
- package/dist/button.cjs +1 -1
- package/dist/button.d.ts.map +1 -1
- package/dist/button.js +47 -43
- package/dist/card.cjs +1 -1
- package/dist/card.d.ts +12 -0
- package/dist/card.d.ts.map +1 -1
- package/dist/card.js +115 -97
- package/dist/chart.cjs +6 -6
- package/dist/chart.d.ts +6 -10
- package/dist/chart.d.ts.map +1 -1
- package/dist/chart.js +281 -296
- package/dist/combobox.cjs +3 -3
- package/dist/combobox.d.ts.map +1 -1
- package/dist/combobox.js +430 -343
- package/dist/command.cjs +1 -1
- package/dist/command.d.ts +23 -2
- package/dist/command.d.ts.map +1 -1
- package/dist/command.js +212 -207
- package/dist/count-indicator.cjs +1 -0
- package/dist/count-indicator.d.ts +85 -0
- package/dist/count-indicator.d.ts.map +1 -0
- package/dist/count-indicator.js +72 -0
- package/dist/data-table.cjs +1 -1
- package/dist/data-table.d.ts +101 -11
- package/dist/data-table.d.ts.map +1 -1
- package/dist/data-table.js +593 -523
- package/dist/dialog.cjs +1 -1
- package/dist/dialog.d.ts +26 -3
- package/dist/dialog.d.ts.map +1 -1
- package/dist/dialog.js +62 -47
- package/dist/drawer.cjs +1 -1
- package/dist/drawer.d.ts +8 -4
- package/dist/drawer.d.ts.map +1 -1
- package/dist/drawer.js +37 -38
- package/dist/file-upload.cjs +1 -0
- package/dist/file-upload.d.ts +546 -0
- package/dist/file-upload.d.ts.map +1 -0
- package/dist/file-upload.js +1103 -0
- package/dist/global-layout.cjs +1 -1
- package/dist/global-layout.d.ts +7 -2
- package/dist/global-layout.d.ts.map +1 -1
- package/dist/global-layout.js +52 -52
- package/dist/hooks/use-file-dropzone.cjs +1 -0
- package/dist/hooks/use-file-dropzone.d.ts +75 -0
- package/dist/hooks/use-file-dropzone.d.ts.map +1 -0
- package/dist/hooks/use-file-dropzone.js +133 -0
- package/dist/hover-card.cjs +1 -1
- package/dist/hover-card.d.ts +29 -16
- package/dist/hover-card.d.ts.map +1 -1
- package/dist/hover-card.js +153 -36
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +676 -640
- package/dist/input-chip.cjs +1 -1
- package/dist/input-chip.d.ts +30 -1
- package/dist/input-chip.d.ts.map +1 -1
- package/dist/input-chip.js +131 -115
- package/dist/input-group.cjs +1 -1
- package/dist/input-group.d.ts +37 -2
- package/dist/input-group.d.ts.map +1 -1
- package/dist/input-group.js +131 -114
- package/dist/input-password.cjs +1 -1
- package/dist/input-password.js +6 -6
- package/dist/lib/empty-canvas.cjs +1 -1
- package/dist/lib/empty-canvas.d.ts +27 -1
- package/dist/lib/empty-canvas.d.ts.map +1 -1
- package/dist/lib/empty-canvas.js +27 -23
- package/dist/lib/empty-chip.cjs +1 -1
- package/dist/lib/empty-chip.d.ts +19 -2
- package/dist/lib/empty-chip.d.ts.map +1 -1
- package/dist/lib/empty-chip.js +14 -9
- package/dist/lib/field-aria.cjs +1 -1
- package/dist/lib/field-aria.d.ts +4 -4
- package/dist/lib/field-aria.d.ts.map +1 -1
- package/dist/lib/field-aria.js +7 -5
- package/dist/lib/media-viewer-content.cjs +1 -1
- package/dist/lib/media-viewer-content.js +1 -1
- package/dist/lib/table-internal.cjs +1 -1
- package/dist/lib/table-internal.d.ts +19 -0
- package/dist/lib/table-internal.d.ts.map +1 -1
- package/dist/lib/table-internal.js +22 -7
- package/dist/list.cjs +1 -1
- package/dist/list.d.ts +13 -0
- package/dist/list.d.ts.map +1 -1
- package/dist/list.js +103 -82
- package/dist/logo-mark.cjs +1 -1
- package/dist/logo-mark.d.ts +18 -2
- package/dist/logo-mark.d.ts.map +1 -1
- package/dist/logo-mark.js +159 -79
- package/dist/media-empty.cjs +1 -1
- package/dist/media-empty.d.ts +50 -7
- package/dist/media-empty.d.ts.map +1 -1
- package/dist/media-empty.js +14 -13
- package/dist/media-viewer.cjs +1 -1
- package/dist/media-viewer.js +6 -6
- package/dist/multi-select-filter.cjs +1 -1
- package/dist/multi-select-filter.d.ts.map +1 -1
- package/dist/multi-select-filter.js +92 -101
- package/dist/pagination.cjs +1 -1
- package/dist/pagination.d.ts +11 -0
- package/dist/pagination.d.ts.map +1 -1
- package/dist/pagination.js +17 -17
- package/dist/relative-date.d.ts +6 -0
- package/dist/relative-date.d.ts.map +1 -1
- package/dist/resizable.d.ts +1 -1
- package/dist/result-count.cjs +1 -1
- package/dist/result-count.d.ts +13 -16
- package/dist/result-count.d.ts.map +1 -1
- package/dist/result-count.js +24 -33
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.d.ts +22 -3
- package/dist/sheet.d.ts.map +1 -1
- package/dist/sheet.js +152 -125
- package/dist/single-select-filter.cjs +1 -1
- package/dist/single-select-filter.d.ts.map +1 -1
- package/dist/single-select-filter.js +67 -76
- package/dist/table.cjs +1 -1
- package/dist/table.d.ts.map +1 -1
- package/dist/table.js +77 -76
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.d.ts +39 -3
- package/dist/tabs.d.ts.map +1 -1
- package/dist/tabs.js +127 -76
- package/dist/textarea.cjs +1 -1
- package/dist/textarea.d.ts +34 -0
- package/dist/textarea.d.ts.map +1 -1
- package/dist/textarea.js +115 -19
- package/dist/tooltip.cjs +1 -1
- package/dist/tooltip.d.ts.map +1 -1
- package/dist/tooltip.js +137 -131
- package/dist/typography-text.cjs +1 -1
- package/dist/typography-text.d.ts +6 -2
- package/dist/typography-text.d.ts.map +1 -1
- package/dist/typography-text.js +14 -13
- package/package.json +3 -4
- package/src/blocks/empty-state.tsx +108 -48
- package/src/blocks/input-list.tsx +1 -0
- package/src/blocks/sidebar.tsx +39 -16
- package/src/components/alert-dialog.tsx +18 -2
- package/src/components/banner.tsx +247 -68
- package/src/components/button.tsx +27 -10
- package/src/components/card.tsx +89 -7
- package/src/components/chart.tsx +47 -67
- package/src/components/combobox.tsx +221 -12
- package/src/components/command.tsx +83 -37
- package/src/components/count-indicator.tsx +188 -0
- package/src/components/data-table.tsx +506 -159
- package/src/components/dialog.tsx +74 -5
- package/src/components/drawer.tsx +52 -32
- package/src/components/file-upload.tsx +2574 -0
- package/src/components/global-layout.tsx +18 -5
- package/src/components/hover-card.tsx +395 -65
- package/src/components/input-chip.tsx +67 -2
- package/src/components/input-group.tsx +89 -6
- package/src/components/list.tsx +40 -3
- package/src/components/logo-mark.tsx +109 -25
- package/src/components/media-empty.tsx +62 -7
- package/src/components/multi-select-filter.tsx +9 -16
- package/src/components/pagination.tsx +15 -2
- package/src/components/relative-date.tsx +6 -0
- package/src/components/result-count.tsx +27 -54
- package/src/components/sheet.tsx +86 -8
- package/src/components/single-select-filter.tsx +9 -16
- package/src/components/table.tsx +16 -1
- package/src/components/tabs.tsx +223 -41
- package/src/components/textarea.tsx +271 -4
- package/src/components/tooltip.tsx +29 -2
- package/src/components/typography-text.tsx +7 -2
- package/src/hooks/use-file-dropzone.ts +325 -0
- package/src/index.ts +3 -0
- package/src/lib/empty-canvas.tsx +47 -20
- package/src/lib/empty-chip.tsx +38 -3
- package/src/lib/field-aria.tsx +11 -6
- package/src/lib/table-internal.ts +38 -0
package/dist/dialog.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";const
|
|
1
|
+
"use client";const c=require("./_virtual/_rolldown/runtime.cjs");let l=require("react");l=c.__toESM(l,1);let w=require("@brightlocal/icons"),s=require("@brightlocal/ui-components/lib/utils"),o=require("react/jsx-runtime"),j=require("@brightlocal/ui-components/hooks/use-overlay-pointer-lock"),i=require("@radix-ui/react-dialog");i=c.__toESM(i,1);let k=require("@brightlocal/ui-components/scroll-area");var u=i.Root;u.displayName="Dialog";var m=l.forwardRef(({dataHook:a,...e},t)=>(0,o.jsx)(i.Trigger,{ref:t,"data-slot":"dialog-trigger",...a!=null&&{"data-hook":a},...e}));m.displayName="DialogTrigger";function n({...a}){return(0,o.jsx)(i.Portal,{...a})}n.displayName="DialogPortal";var f=l.forwardRef(({...a},e)=>(0,o.jsx)(i.Close,{ref:e,"data-slot":"dialog-close",...a}));f.displayName="DialogClose";var g=l.forwardRef(({className:a,...e},t)=>(0,o.jsx)(i.Overlay,{ref:t,className:(0,s.cn)("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=open]:duration-slow fixed inset-0 z-50 bg-black/50 ease-out data-[state=closed]:duration-250 data-[state=closed]:ease-in",a),"data-slot":"dialog-overlay",...e}));g.displayName="DialogOverlay";var C=(0,s.cn)("bg-background text-foreground border-card-border fixed inset-x-0 top-[50%] z-50 mx-auto w-min max-w-[min(64rem,100%-2rem)] min-w-[min(32rem,100%-2rem)] translate-y-[-50%] rounded-xl border p-8 shadow-lg","flex max-h-[85svh] flex-col gap-8 overflow-y-auto","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=open]:duration-slow ease-out data-[state=closed]:duration-250 data-[state=closed]:ease-in"),x=l.forwardRef(({className:a,children:e,dataHook:t,trackingEl:r,trackingLabel:d,closeLabel:b,...h},N)=>((0,j.useOverlayPointerLock)(),(0,o.jsxs)(n,{children:[(0,o.jsx)(g,{}),(0,o.jsxs)(i.Content,{ref:N,className:(0,s.cn)(C,a),"data-hook":t,"data-slot":"dialog-content","data-tracking-el":r,"data-tracking-label":d,...h,children:[e,(0,o.jsxs)(i.Close,{className:"ring-offset-background focus-visible:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground duration-fast absolute top-8 right-8 rounded-xs opacity-70 outline-hidden transition-opacity ease-out hover:opacity-100 focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0",children:[(0,o.jsx)(w.X,{}),(0,o.jsx)("span",{className:"sr-only",children:b??"Close"})]})]})]})));x.displayName="DialogContent";var p=l.forwardRef(({className:a,...e},t)=>(0,o.jsx)("div",{ref:t,className:(0,s.cn)("flex flex-col gap-2 text-center sm:text-left",a),"data-slot":"dialog-header",...e}));p.displayName="DialogHeader";var _=l.forwardRef(({className:a,children:e,dataHook:t,...r},d)=>(0,o.jsx)(k.ScrollArea,{ref:d,className:(0,s.cn)("-mx-8 flex min-h-0 flex-1 flex-col","[&>[data-slot=scroll-area-viewport]]:focus-visible:shadow-[inset_0_0_0_var(--ds-spread-xs)_var(--color-outline)]",a),"data-slot":"dialog-body",dataHook:t??"dialog-body",...r,children:(0,o.jsx)("div",{className:"px-7","data-slot":"dialog-body-content",children:e})}));_.displayName="DialogBody";var D=l.forwardRef(({className:a,...e},t)=>(0,o.jsx)("div",{ref:t,className:(0,s.cn)("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",a),"data-slot":"dialog-footer",...e}));D.displayName="DialogFooter";var v=l.forwardRef(({className:a,dataHook:e,...t},r)=>(0,o.jsx)(i.Title,{ref:r,className:(0,s.cn)("text-heading-section",a),"data-hook":e,"data-slot":"dialog-title",...t}));v.displayName="DialogTitle";var y=l.forwardRef(({className:a,dataHook:e,...t},r)=>(0,o.jsx)(i.Description,{ref:r,className:(0,s.cn)("text-body-sm text-muted-foreground",a),"data-hook":e,"data-slot":"dialog-description",...t}));y.displayName="DialogDescription";exports.Dialog=u;exports.DialogBody=_;exports.DialogClose=f;exports.DialogContent=x;exports.DialogDescription=y;exports.DialogFooter=D;exports.DialogHeader=p;exports.DialogOverlay=g;exports.DialogPortal=n;exports.DialogTitle=v;exports.DialogTrigger=m;
|
package/dist/dialog.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ScrollArea } from './scroll-area';
|
|
1
2
|
import * as React from "react";
|
|
2
3
|
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
3
4
|
/**
|
|
@@ -61,7 +62,12 @@ interface DialogContentProps extends React.ComponentProps<typeof DialogPrimitive
|
|
|
61
62
|
}
|
|
62
63
|
/**
|
|
63
64
|
* DialogContent - The main dialog content container
|
|
64
|
-
* @description Contains the dialog's content including header, body, and
|
|
65
|
+
* @description Contains the dialog's content including header, body, and
|
|
66
|
+
* footer. The width follows the content: at least 512px, with text wrapping
|
|
67
|
+
* at 512px, and growing up to 1024px for content with its own width, such as
|
|
68
|
+
* a table or an image. A viewport narrower than that keeps a 16px gutter on
|
|
69
|
+
* each side. The height is capped at 85svh; wrap tall content in
|
|
70
|
+
* `DialogBody` so it scrolls between the header and footer.
|
|
65
71
|
*/
|
|
66
72
|
declare const DialogContent: React.ForwardRefExoticComponent<Omit<DialogContentProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
67
73
|
/**
|
|
@@ -69,6 +75,23 @@ declare const DialogContent: React.ForwardRefExoticComponent<Omit<DialogContentP
|
|
|
69
75
|
* @description Groups the title and description at the top of the dialog
|
|
70
76
|
*/
|
|
71
77
|
declare const DialogHeader: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
78
|
+
/**
|
|
79
|
+
* Props for the DialogBody component
|
|
80
|
+
*/
|
|
81
|
+
interface DialogBodyProps extends Omit<React.ComponentProps<typeof ScrollArea>, "dataHook"> {
|
|
82
|
+
/**
|
|
83
|
+
* Data hook for automated testing
|
|
84
|
+
* @default "dialog-body"
|
|
85
|
+
*/
|
|
86
|
+
dataHook?: string;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* DialogBody - The scrollable region between DialogHeader and DialogFooter.
|
|
90
|
+
* @description Takes the height left inside the 85svh cap and scrolls long
|
|
91
|
+
* content with DS scrollbars in a keyboard-focusable viewport, while the
|
|
92
|
+
* header, footer and close button stay in view.
|
|
93
|
+
*/
|
|
94
|
+
declare const DialogBody: React.ForwardRefExoticComponent<Omit<DialogBodyProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
72
95
|
/**
|
|
73
96
|
* DialogFooter - Container for dialog action buttons.
|
|
74
97
|
* @description Groups action buttons at the bottom of the dialog
|
|
@@ -104,6 +127,6 @@ interface DialogDescriptionProps extends React.ComponentProps<typeof DialogPrimi
|
|
|
104
127
|
* @description Renders an accessible description for the dialog
|
|
105
128
|
*/
|
|
106
129
|
declare const DialogDescription: React.ForwardRefExoticComponent<Omit<DialogDescriptionProps, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
|
|
107
|
-
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, };
|
|
108
|
-
export type { DialogContentProps, DialogDescriptionProps, DialogTitleProps, DialogTriggerProps, };
|
|
130
|
+
export { Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, };
|
|
131
|
+
export type { DialogBodyProps, DialogContentProps, DialogDescriptionProps, DialogTitleProps, DialogTriggerProps, };
|
|
109
132
|
//# sourceMappingURL=dialog.d.ts.map
|
package/dist/dialog.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../src/components/dialog.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../src/components/dialog.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAI1D,OAAO,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AAGpE;;;GAGG;AACH,QAAA,MAAM,MAAM,uCAAuB,CAAC;AAGpC;;GAEG;AACH,UAAU,kBAAmB,SAAQ,KAAK,CAAC,cAAc,CACvD,OAAO,eAAe,CAAC,OAAO,CAC/B;IACC;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,QAAA,MAAM,aAAa,2GAUjB,CAAC;AAGH;;;GAGG;AACH,iBAAS,YAAY,CAAC,EACpB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,MAAM,CAAC,qBAErD;kBAJQ,YAAY;;;AAOrB;;;GAGG;AACH,QAAA,MAAM,WAAW,kKAKf,CAAC;AAGH;;;GAGG;AACH,QAAA,MAAM,aAAa,8JAajB,CAAC;AAqBH;;GAEG;AACH,UAAU,kBAAmB,SAAQ,KAAK,CAAC,cAAc,CACvD,OAAO,eAAe,CAAC,OAAO,CAC/B;IACC;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;GAQG;AACH,QAAA,MAAM,aAAa,wGAqClB,CAAC;AAGF;;;GAGG;AACH,QAAA,MAAM,YAAY,mKAUhB,CAAC;AAGH;;GAEG;AACH,UAAU,eAAgB,SAAQ,IAAI,CACpC,KAAK,CAAC,cAAc,CAAC,OAAO,UAAU,CAAC,EACvC,UAAU,CACX;IACC;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;GAKG;AACH,QAAA,MAAM,UAAU,qGAuBd,CAAC;AAGH;;;GAGG;AACH,QAAA,MAAM,YAAY,mKAahB,CAAC;AAGH;;GAEG;AACH,UAAU,gBAAiB,SAAQ,KAAK,CAAC,cAAc,CACrD,OAAO,eAAe,CAAC,KAAK,CAC7B;IACC;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,QAAA,MAAM,WAAW,0GAWf,CAAC;AAGH;;GAEG;AACH,UAAU,sBAAuB,SAAQ,KAAK,CAAC,cAAc,CAC3D,OAAO,eAAe,CAAC,WAAW,CACnC;IACC;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,QAAA,MAAM,iBAAiB,kHAWrB,CAAC;AAGH,OAAO,EACL,MAAM,EACN,UAAU,EACV,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,WAAW,EACX,aAAa,GACd,CAAC;AAEF,YAAY,EACV,eAAe,EACf,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,EAChB,kBAAkB,GACnB,CAAC"}
|
package/dist/dialog.js
CHANGED
|
@@ -1,92 +1,107 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import * as
|
|
2
|
+
import * as i from "react";
|
|
3
3
|
import { X as u } from "@brightlocal/icons";
|
|
4
4
|
import { cn as r } from "@brightlocal/ui-components/lib/utils";
|
|
5
|
-
import { jsx as
|
|
5
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
6
6
|
import { useOverlayPointerLock as v } from "@brightlocal/ui-components/hooks/use-overlay-pointer-lock";
|
|
7
|
-
import * as
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
import * as l from "@radix-ui/react-dialog";
|
|
8
|
+
import { ScrollArea as x } from "@brightlocal/ui-components/scroll-area";
|
|
9
|
+
var y = l.Root;
|
|
10
|
+
y.displayName = "Dialog";
|
|
11
|
+
var D = i.forwardRef(({ dataHook: a, ...e }, o) => /* @__PURE__ */ t(l.Trigger, {
|
|
12
|
+
ref: o,
|
|
12
13
|
"data-slot": "dialog-trigger",
|
|
13
14
|
...a != null && { "data-hook": a },
|
|
14
15
|
...e
|
|
15
16
|
}));
|
|
16
|
-
|
|
17
|
-
function
|
|
18
|
-
return /* @__PURE__ */
|
|
17
|
+
D.displayName = "DialogTrigger";
|
|
18
|
+
function g({ ...a }) {
|
|
19
|
+
return /* @__PURE__ */ t(l.Portal, { ...a });
|
|
19
20
|
}
|
|
20
|
-
|
|
21
|
-
var
|
|
21
|
+
g.displayName = "DialogPortal";
|
|
22
|
+
var N = i.forwardRef(({ ...a }, e) => /* @__PURE__ */ t(l.Close, {
|
|
22
23
|
ref: e,
|
|
23
24
|
"data-slot": "dialog-close",
|
|
24
25
|
...a
|
|
25
26
|
}));
|
|
26
|
-
|
|
27
|
-
var
|
|
28
|
-
ref:
|
|
27
|
+
N.displayName = "DialogClose";
|
|
28
|
+
var m = i.forwardRef(({ className: a, ...e }, o) => /* @__PURE__ */ t(l.Overlay, {
|
|
29
|
+
ref: o,
|
|
29
30
|
className: r("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=open]:duration-slow fixed inset-0 z-50 bg-black/50 ease-out data-[state=closed]:duration-250 data-[state=closed]:ease-in", a),
|
|
30
31
|
"data-slot": "dialog-overlay",
|
|
31
32
|
...e
|
|
32
33
|
}));
|
|
33
|
-
|
|
34
|
-
var
|
|
34
|
+
m.displayName = "DialogOverlay";
|
|
35
|
+
var b = r("bg-background text-foreground border-card-border fixed inset-x-0 top-[50%] z-50 mx-auto w-min max-w-[min(64rem,100%-2rem)] min-w-[min(32rem,100%-2rem)] translate-y-[-50%] rounded-xl border p-8 shadow-lg", "flex max-h-[85svh] flex-col gap-8 overflow-y-auto", "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=open]:duration-slow ease-out data-[state=closed]:duration-250 data-[state=closed]:ease-in"), h = i.forwardRef(({ className: a, children: e, dataHook: o, trackingEl: s, trackingLabel: d, closeLabel: c, ...f }, p) => (v(), /* @__PURE__ */ n(g, { children: [/* @__PURE__ */ t(m, {}), /* @__PURE__ */ n(l.Content, {
|
|
35
36
|
ref: p,
|
|
36
|
-
className: r(
|
|
37
|
-
"data-hook":
|
|
37
|
+
className: r(b, a),
|
|
38
|
+
"data-hook": o,
|
|
38
39
|
"data-slot": "dialog-content",
|
|
39
40
|
"data-tracking-el": s,
|
|
40
|
-
"data-tracking-label":
|
|
41
|
-
...
|
|
42
|
-
children: [e, /* @__PURE__ */
|
|
41
|
+
"data-tracking-label": d,
|
|
42
|
+
...f,
|
|
43
|
+
children: [e, /* @__PURE__ */ n(l.Close, {
|
|
43
44
|
className: "ring-offset-background focus-visible:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground duration-fast absolute top-8 right-8 rounded-xs opacity-70 outline-hidden transition-opacity ease-out hover:opacity-100 focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
44
|
-
children: [/* @__PURE__ */
|
|
45
|
+
children: [/* @__PURE__ */ t(u, {}), /* @__PURE__ */ t("span", {
|
|
45
46
|
className: "sr-only",
|
|
46
|
-
children:
|
|
47
|
+
children: c ?? "Close"
|
|
47
48
|
})]
|
|
48
49
|
})]
|
|
49
50
|
})] })));
|
|
50
|
-
|
|
51
|
-
var
|
|
52
|
-
ref:
|
|
51
|
+
h.displayName = "DialogContent";
|
|
52
|
+
var w = i.forwardRef(({ className: a, ...e }, o) => /* @__PURE__ */ t("div", {
|
|
53
|
+
ref: o,
|
|
53
54
|
className: r("flex flex-col gap-2 text-center sm:text-left", a),
|
|
54
55
|
"data-slot": "dialog-header",
|
|
55
56
|
...e
|
|
56
57
|
}));
|
|
57
|
-
|
|
58
|
-
var
|
|
59
|
-
ref:
|
|
58
|
+
w.displayName = "DialogHeader";
|
|
59
|
+
var k = i.forwardRef(({ className: a, children: e, dataHook: o, ...s }, d) => /* @__PURE__ */ t(x, {
|
|
60
|
+
ref: d,
|
|
61
|
+
className: r("-mx-8 flex min-h-0 flex-1 flex-col", "[&>[data-slot=scroll-area-viewport]]:focus-visible:shadow-[inset_0_0_0_var(--ds-spread-xs)_var(--color-outline)]", a),
|
|
62
|
+
"data-slot": "dialog-body",
|
|
63
|
+
dataHook: o ?? "dialog-body",
|
|
64
|
+
...s,
|
|
65
|
+
children: /* @__PURE__ */ t("div", {
|
|
66
|
+
className: "px-7",
|
|
67
|
+
"data-slot": "dialog-body-content",
|
|
68
|
+
children: e
|
|
69
|
+
})
|
|
70
|
+
}));
|
|
71
|
+
k.displayName = "DialogBody";
|
|
72
|
+
var R = i.forwardRef(({ className: a, ...e }, o) => /* @__PURE__ */ t("div", {
|
|
73
|
+
ref: o,
|
|
60
74
|
className: r("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", a),
|
|
61
75
|
"data-slot": "dialog-footer",
|
|
62
76
|
...e
|
|
63
77
|
}));
|
|
64
|
-
|
|
65
|
-
var
|
|
78
|
+
R.displayName = "DialogFooter";
|
|
79
|
+
var C = i.forwardRef(({ className: a, dataHook: e, ...o }, s) => /* @__PURE__ */ t(l.Title, {
|
|
66
80
|
ref: s,
|
|
67
81
|
className: r("text-heading-section", a),
|
|
68
82
|
"data-hook": e,
|
|
69
83
|
"data-slot": "dialog-title",
|
|
70
|
-
...
|
|
84
|
+
...o
|
|
71
85
|
}));
|
|
72
|
-
|
|
73
|
-
var
|
|
86
|
+
C.displayName = "DialogTitle";
|
|
87
|
+
var _ = i.forwardRef(({ className: a, dataHook: e, ...o }, s) => /* @__PURE__ */ t(l.Description, {
|
|
74
88
|
ref: s,
|
|
75
89
|
className: r("text-body-sm text-muted-foreground", a),
|
|
76
90
|
"data-hook": e,
|
|
77
91
|
"data-slot": "dialog-description",
|
|
78
|
-
...
|
|
92
|
+
...o
|
|
79
93
|
}));
|
|
80
|
-
|
|
94
|
+
_.displayName = "DialogDescription";
|
|
81
95
|
export {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
N as
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
96
|
+
y as Dialog,
|
|
97
|
+
k as DialogBody,
|
|
98
|
+
N as DialogClose,
|
|
99
|
+
h as DialogContent,
|
|
100
|
+
_ as DialogDescription,
|
|
101
|
+
R as DialogFooter,
|
|
102
|
+
w as DialogHeader,
|
|
103
|
+
m as DialogOverlay,
|
|
104
|
+
g as DialogPortal,
|
|
105
|
+
C as DialogTitle,
|
|
106
|
+
D as DialogTrigger
|
|
92
107
|
};
|
package/dist/drawer.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";const
|
|
1
|
+
"use client";const N=require("./_virtual/_rolldown/runtime.cjs");let o=require("react");o=N.__toESM(o,1);let d=require("@brightlocal/ui-components/lib/utils"),a=require("react/jsx-runtime"),t=require("vaul");function n({...r}){return(0,a.jsx)(t.Drawer.Root,{"data-slot":"drawer",...r})}n.displayName="Drawer";function s({...r}){return(0,a.jsx)(t.Drawer.Trigger,{"data-slot":"drawer-trigger",...r})}s.displayName="DrawerTrigger";function i({...r}){return(0,a.jsx)(t.Drawer.Portal,{...r})}i.displayName="DrawerPortal";function w({...r}){return(0,a.jsx)(t.Drawer.Close,{"data-slot":"drawer-close",...r})}w.displayName="DrawerClose";function l({className:r,...e}){return(0,a.jsx)(t.Drawer.Overlay,{className:(0,d.cn)("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",r),"data-slot":"drawer-overlay",...e})}l.displayName="DrawerOverlay";var c=o.forwardRef(({className:r,children:e,dataHook:f,trackingEl:p,trackingLabel:g,fullHeight:h,...b},y)=>(0,a.jsxs)(i,{children:[(0,a.jsx)(l,{}),(0,a.jsxs)(t.Drawer.Content,{ref:y,className:(0,d.cn)("group/drawer-content bg-background border-border fixed z-50 flex h-auto flex-col","data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:rounded-b-[10px] data-[vaul-drawer-direction=top]:border-b","data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:rounded-t-[10px] data-[vaul-drawer-direction=bottom]:border-t",h?"data-[vaul-drawer-direction=bottom]:max-h-[100svh] data-[vaul-drawer-direction=top]:max-h-[100svh]":"data-[vaul-drawer-direction=bottom]:max-h-[80svh] data-[vaul-drawer-direction=top]:max-h-[80svh]","data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=right]:sm:max-w-sm","data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:sm:max-w-sm",r),"data-hook":f,"data-slot":"drawer-content","data-tracking-el":p,"data-tracking-label":g,...b,children:[(0,a.jsx)("div",{className:"bg-muted mx-auto mt-4 hidden h-2 w-[120px] shrink-0 rounded-full group-data-[vaul-drawer-direction=bottom]/drawer-content:block"}),e]})]}));c.displayName="DrawerContent";function u({className:r,...e}){return(0,a.jsx)("div",{className:(0,d.cn)("flex w-full shrink-0 flex-col gap-1.5 p-4 text-center sm:text-left",r),"data-slot":"drawer-header",...e})}u.displayName="DrawerHeader";function m({className:r,...e}){return(0,a.jsx)("div",{className:(0,d.cn)("min-h-0 w-full flex-1 overflow-x-hidden overflow-y-auto px-4","mt-4 group-has-[[data-slot=drawer-header]]/drawer-content:mt-0",r),"data-slot":"drawer-body",...e})}m.displayName="DrawerBody";function D({className:r,...e}){return(0,a.jsx)("div",{className:(0,d.cn)("mt-auto flex w-full shrink-0 flex-col gap-2 p-4",r),"data-slot":"drawer-footer",...e})}D.displayName="DrawerFooter";function x({className:r,...e}){return(0,a.jsx)(t.Drawer.Title,{className:(0,d.cn)("text-foreground text-heading-section",r),"data-slot":"drawer-title",...e})}x.displayName="DrawerTitle";function v({className:r,...e}){return(0,a.jsx)(t.Drawer.Description,{className:(0,d.cn)("text-body-sm text-muted-foreground",r),"data-slot":"drawer-description",...e})}v.displayName="DrawerDescription";exports.Drawer=n;exports.DrawerBody=m;exports.DrawerClose=w;exports.DrawerContent=c;exports.DrawerDescription=v;exports.DrawerFooter=D;exports.DrawerHeader=u;exports.DrawerOverlay=l;exports.DrawerPortal=i;exports.DrawerTitle=x;exports.DrawerTrigger=s;
|
package/dist/drawer.d.ts
CHANGED
|
@@ -60,15 +60,19 @@ type DrawerContentProps = React.ComponentProps<typeof DrawerPrimitive.Content> &
|
|
|
60
60
|
* Tracking label for analytics context
|
|
61
61
|
*/
|
|
62
62
|
trackingLabel?: string;
|
|
63
|
+
/**
|
|
64
|
+
* Expand the drawer to the full viewport height (100svh) instead of the
|
|
65
|
+
* default 80svh cap. Use for mobile filter sheets or other tall content
|
|
66
|
+
* that needs the entire screen.
|
|
67
|
+
* @default false
|
|
68
|
+
*/
|
|
69
|
+
fullHeight?: boolean;
|
|
63
70
|
};
|
|
64
71
|
/**
|
|
65
72
|
* DrawerContent - The main drawer content container
|
|
66
73
|
* @description Contains the drawer's content including header, body, and footer
|
|
67
74
|
*/
|
|
68
|
-
declare
|
|
69
|
-
declare namespace DrawerContent {
|
|
70
|
-
var displayName: string;
|
|
71
|
-
}
|
|
75
|
+
declare const DrawerContent: React.ForwardRefExoticComponent<Omit<DrawerContentProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
72
76
|
/**
|
|
73
77
|
* DrawerHeader - Container for drawer title and description.
|
|
74
78
|
* @description Groups the title and description at the top of the drawer
|
package/dist/drawer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["../../src/components/drawer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,MAAM,CAAC;AAIjD;;GAEG;AACH,KAAK,WAAW,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC,CAAC;AAErE;;;GAGG;AACH,iBAAS,MAAM,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,WAAW,qBAExC;kBAFQ,MAAM;;;AAKf;;;GAGG;AACH,iBAAS,aAAa,CAAC,EACrB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,OAAO,CAAC,qBAEtD;kBAJQ,aAAa;;;AAOtB;;;GAGG;AACH,iBAAS,YAAY,CAAC,EACpB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,MAAM,CAAC,qBAErD;kBAJQ,YAAY;;;AAOrB;;;GAGG;AACH,iBAAS,WAAW,CAAC,EACnB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,qBAEpD;kBAJQ,WAAW;;;AAOpB;;;GAGG;AACH,iBAAS,aAAa,CAAC,EACrB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,OAAO,CAAC,qBAWtD;kBAdQ,aAAa;;;AAiBtB;;GAEG;AACH,KAAK,kBAAkB,GAAG,KAAK,CAAC,cAAc,CAC5C,OAAO,eAAe,CAAC,OAAO,CAC/B,GAAG;IACF;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["../../src/components/drawer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,MAAM,CAAC;AAIjD;;GAEG;AACH,KAAK,WAAW,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC,CAAC;AAErE;;;GAGG;AACH,iBAAS,MAAM,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,WAAW,qBAExC;kBAFQ,MAAM;;;AAKf;;;GAGG;AACH,iBAAS,aAAa,CAAC,EACrB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,OAAO,CAAC,qBAEtD;kBAJQ,aAAa;;;AAOtB;;;GAGG;AACH,iBAAS,YAAY,CAAC,EACpB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,MAAM,CAAC,qBAErD;kBAJQ,YAAY;;;AAOrB;;;GAGG;AACH,iBAAS,WAAW,CAAC,EACnB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,qBAEpD;kBAJQ,WAAW;;;AAOpB;;;GAGG;AACH,iBAAS,aAAa,CAAC,EACrB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,OAAO,CAAC,qBAWtD;kBAdQ,aAAa;;;AAiBtB;;GAEG;AACH,KAAK,kBAAkB,GAAG,KAAK,CAAC,cAAc,CAC5C,OAAO,eAAe,CAAC,OAAO,CAC/B,GAAG;IACF;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF;;;GAGG;AACH,QAAA,MAAM,aAAa,wGA4ClB,CAAC;AAGF;;;GAGG;AACH,iBAAS,YAAY,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAWzE;kBAXQ,YAAY;;;AAcrB;;;GAGG;AACH,iBAAS,UAAU,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAYvE;kBAZQ,UAAU;;;AAenB;;;GAGG;AACH,iBAAS,YAAY,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAWzE;kBAXQ,YAAY;;;AAcrB;;;GAGG;AACH,iBAAS,WAAW,CAAC,EACnB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,qBAQpD;kBAXQ,WAAW;;;AAcpB;;;GAGG;AACH,iBAAS,iBAAiB,CAAC,EACzB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,WAAW,CAAC,qBAQ1D;kBAXQ,iBAAiB;;;AAc1B,OAAO,EACL,MAAM,EACN,UAAU,EACV,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,WAAW,EACX,aAAa,GACd,CAAC;AAEF,YAAY,EAAE,WAAW,EAAE,kBAAkB,EAAE,CAAC"}
|
package/dist/drawer.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import "react";
|
|
2
|
+
import * as f from "react";
|
|
3
3
|
import { cn as d } from "@brightlocal/ui-components/lib/utils";
|
|
4
4
|
import { jsx as e, jsxs as o } from "react/jsx-runtime";
|
|
5
5
|
import { Drawer as t } from "vaul";
|
|
6
|
-
function
|
|
6
|
+
function p({ ...a }) {
|
|
7
7
|
return /* @__PURE__ */ e(t.Root, {
|
|
8
8
|
"data-slot": "drawer",
|
|
9
9
|
...a
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
function
|
|
12
|
+
p.displayName = "Drawer";
|
|
13
|
+
function v({ ...a }) {
|
|
14
14
|
return /* @__PURE__ */ e(t.Trigger, {
|
|
15
15
|
"data-slot": "drawer-trigger",
|
|
16
16
|
...a
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
v.displayName = "DrawerTrigger";
|
|
20
20
|
function i({ ...a }) {
|
|
21
21
|
return /* @__PURE__ */ e(t.Portal, { ...a });
|
|
22
22
|
}
|
|
23
23
|
i.displayName = "DrawerPortal";
|
|
24
|
-
function
|
|
24
|
+
function x({ ...a }) {
|
|
25
25
|
return /* @__PURE__ */ e(t.Close, {
|
|
26
26
|
"data-slot": "drawer-close",
|
|
27
27
|
...a
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
|
-
|
|
30
|
+
x.displayName = "DrawerClose";
|
|
31
31
|
function l({ className: a, ...r }) {
|
|
32
32
|
return /* @__PURE__ */ e(t.Overlay, {
|
|
33
33
|
className: d("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50", a),
|
|
@@ -36,68 +36,67 @@ function l({ className: a, ...r }) {
|
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
38
|
l.displayName = "DrawerOverlay";
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
function v({ className: a, ...r }) {
|
|
39
|
+
var h = f.forwardRef(({ className: a, children: r, dataHook: n, trackingEl: s, trackingLabel: w, fullHeight: c, ...u }, m) => /* @__PURE__ */ o(i, { children: [/* @__PURE__ */ e(l, {}), /* @__PURE__ */ o(t.Content, {
|
|
40
|
+
ref: m,
|
|
41
|
+
className: d("group/drawer-content bg-background border-border fixed z-50 flex h-auto flex-col", "data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:rounded-b-[10px] data-[vaul-drawer-direction=top]:border-b", "data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:rounded-t-[10px] data-[vaul-drawer-direction=bottom]:border-t", c ? "data-[vaul-drawer-direction=bottom]:max-h-[100svh] data-[vaul-drawer-direction=top]:max-h-[100svh]" : "data-[vaul-drawer-direction=bottom]:max-h-[80svh] data-[vaul-drawer-direction=top]:max-h-[80svh]", "data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=right]:sm:max-w-sm", "data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:sm:max-w-sm", a),
|
|
42
|
+
"data-hook": n,
|
|
43
|
+
"data-slot": "drawer-content",
|
|
44
|
+
"data-tracking-el": s,
|
|
45
|
+
"data-tracking-label": w,
|
|
46
|
+
...u,
|
|
47
|
+
children: [/* @__PURE__ */ e("div", { className: "bg-muted mx-auto mt-4 hidden h-2 w-[120px] shrink-0 rounded-full group-data-[vaul-drawer-direction=bottom]/drawer-content:block" }), r]
|
|
48
|
+
})] }));
|
|
49
|
+
h.displayName = "DrawerContent";
|
|
50
|
+
function g({ className: a, ...r }) {
|
|
52
51
|
return /* @__PURE__ */ e("div", {
|
|
53
52
|
className: d("flex w-full shrink-0 flex-col gap-1.5 p-4 text-center sm:text-left", a),
|
|
54
53
|
"data-slot": "drawer-header",
|
|
55
54
|
...r
|
|
56
55
|
});
|
|
57
56
|
}
|
|
58
|
-
|
|
59
|
-
function
|
|
57
|
+
g.displayName = "DrawerHeader";
|
|
58
|
+
function b({ className: a, ...r }) {
|
|
60
59
|
return /* @__PURE__ */ e("div", {
|
|
61
60
|
className: d("min-h-0 w-full flex-1 overflow-x-hidden overflow-y-auto px-4", "mt-4 group-has-[[data-slot=drawer-header]]/drawer-content:mt-0", a),
|
|
62
61
|
"data-slot": "drawer-body",
|
|
63
62
|
...r
|
|
64
63
|
});
|
|
65
64
|
}
|
|
66
|
-
|
|
67
|
-
function
|
|
65
|
+
b.displayName = "DrawerBody";
|
|
66
|
+
function D({ className: a, ...r }) {
|
|
68
67
|
return /* @__PURE__ */ e("div", {
|
|
69
68
|
className: d("mt-auto flex w-full shrink-0 flex-col gap-2 p-4", a),
|
|
70
69
|
"data-slot": "drawer-footer",
|
|
71
70
|
...r
|
|
72
71
|
});
|
|
73
72
|
}
|
|
74
|
-
|
|
75
|
-
function
|
|
73
|
+
D.displayName = "DrawerFooter";
|
|
74
|
+
function y({ className: a, ...r }) {
|
|
76
75
|
return /* @__PURE__ */ e(t.Title, {
|
|
77
76
|
className: d("text-foreground text-heading-section", a),
|
|
78
77
|
"data-slot": "drawer-title",
|
|
79
78
|
...r
|
|
80
79
|
});
|
|
81
80
|
}
|
|
82
|
-
|
|
83
|
-
function
|
|
81
|
+
y.displayName = "DrawerTitle";
|
|
82
|
+
function N({ className: a, ...r }) {
|
|
84
83
|
return /* @__PURE__ */ e(t.Description, {
|
|
85
84
|
className: d("text-body-sm text-muted-foreground", a),
|
|
86
85
|
"data-slot": "drawer-description",
|
|
87
86
|
...r
|
|
88
87
|
});
|
|
89
88
|
}
|
|
90
|
-
|
|
89
|
+
N.displayName = "DrawerDescription";
|
|
91
90
|
export {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
91
|
+
p as Drawer,
|
|
92
|
+
b as DrawerBody,
|
|
93
|
+
x as DrawerClose,
|
|
94
|
+
h as DrawerContent,
|
|
95
|
+
N as DrawerDescription,
|
|
96
|
+
D as DrawerFooter,
|
|
97
|
+
g as DrawerHeader,
|
|
99
98
|
l as DrawerOverlay,
|
|
100
99
|
i as DrawerPortal,
|
|
101
|
-
|
|
102
|
-
|
|
100
|
+
y as DrawerTitle,
|
|
101
|
+
v as DrawerTrigger
|
|
103
102
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";const ct=require("./_virtual/_rolldown/runtime.cjs"),J=require("./lib/compose-event-handlers.cjs");let o=require("react");o=ct.__toESM(o,1);let _=require("@brightlocal/icons"),C=require("@brightlocal/ui-components/lib/utils"),a=require("react/jsx-runtime"),dt=require("@radix-ui/react-slot"),Ie=require("class-variance-authority"),he=require("@brightlocal/ui-components/button"),ut=require("@brightlocal/ui-components/spinner"),He=require("@brightlocal/ui-components/alert"),pt=require("@brightlocal/ui-components/media-empty"),Te=require("@brightlocal/ui-components/logo-mark"),mt=require("@brightlocal/ui-components/count-indicator"),ft=require("@brightlocal/ui-components/progress"),w=require("@brightlocal/ui-components/typography-text"),Se=require("@brightlocal/ui-components/hooks/use-file-dropzone");function Q(t){if(t<1024)return`${t} B`;const e=["KB","MB","GB"];let s=t/1024,r=0;for(;s>=1024&&r<e.length-1;)s/=1024,r++;return`${s>=10?String(Math.round(s)):s.toFixed(1).replace(/\.0$/,"")} ${e[r]}`}async function We(t){if(typeof window>"u")return null;if(typeof createImageBitmap=="function")try{const e=await createImageBitmap(t),s={width:e.width,height:e.height};return e.close(),s}catch{return null}return new Promise(e=>{const s=URL.createObjectURL(t),r=new window.Image;r.onload=()=>{e({width:r.naturalWidth,height:r.naturalHeight}),URL.revokeObjectURL(s)},r.onerror=()=>{e(null),URL.revokeObjectURL(s)},r.src=s})}function gt(t){if(!t)return"";const e=[];for(const[r,n]of Object.entries(t)){for(const l of n)e.push(l.replace(/^\./,"").toUpperCase());if(n.length===0&&r.includes("/")){const l=r.split("/").pop();l&&l!=="*"&&e.push(l.toUpperCase())}}const s=[...new Set(e)];return s.length<=1?s[0]??"":`${s.slice(0,-1).join(", ")} or ${s[s.length-1]}`}function q(t,e){return t.replace(/\{(\w+)\}/g,(s,r)=>r in e?String(e[r]):s)}function Ge(t){return Math.round(Math.min(100,Math.max(0,t)))}var Ve={invalidType:"This type of file isn't supported.",invalidTypeWithLabel:"This type of file isn't supported. Use {label}.",tooLarge:"This file is {size}. Files need to be {maxSize} or smaller.",tooSmall:"This file is {size}. Files need to be at least {minSize}.",tooManyFilesOne:"You can add one file. Remove it to add a different one.",tooManyFiles:"You've reached the limit of {maxFiles} files. Remove one to add another.",imageUnreadable:"We couldn't read this image.",imageTooSmall:"This image is {width} × {height} px. Images need to be at least {minWidth} × {minHeight} px.",uploadFailed:"Upload failed.",fileRemoved:"{name} removed.",uploadedOne:"1 file uploaded.",uploadedMany:"{n} files uploaded.",uploadFailedOne:"1 file failed to upload.",uploadFailedMany:"{n} files failed to upload."};function Xe(t){return o.useMemo(()=>({...Ve,...t}),[t])}function Ne(t,e,s){const{messages:r}=s;switch(e){case"file-invalid-type":{const n=s.acceptLabel??gt(s.accept);return n?q(r.invalidTypeWithLabel,{label:n}):r.invalidType}case"file-too-large":return q(r.tooLarge,{size:Q(t.size),maxSize:Q(s.maxSize??0)});case"file-too-small":return q(r.tooSmall,{size:Q(t.size),minSize:Q(s.minSize??0)});case"too-many-files":return s.maxFiles===1?r.tooManyFilesOne:q(r.tooManyFiles,{maxFiles:s.maxFiles??0})}}async function Je(t,e){const s=t.type.startsWith("image/")||!t.type&&/\.(jpe?g|png|gif|webp|avif|svg|bmp|ico|tiff?)$/i.test(t.name);if(e.minImageSize&&s){const r=await We(t);if(!r)return e.messages.imageUnreadable;if(r.width<e.minImageSize.width||r.height<e.minImageSize.height)return q(e.messages.imageTooSmall,{width:r.width,height:r.height,minWidth:e.minImageSize.width,minHeight:e.minImageSize.height})}if(e.onFileValidate){const r=await e.onFileValidate(t);if(r)return r}return null}var ht=[{test:t=>t.startsWith("image/"),icon:_.FileImage},{test:(t,e)=>t==="text/csv"||t==="application/vnd.ms-excel"||t==="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"||e==="csv"||e==="xlsx"||e==="xls",icon:_.FileSpreadsheet},{test:(t,e)=>t==="application/json"||e==="json",icon:_.FileJson},{test:(t,e)=>t==="application/xml"||t==="text/xml"||e==="xml"||e==="html"||e==="htm"||e==="svg",icon:_.FileCode},{test:(t,e)=>t==="application/pdf"||t.startsWith("text/")||e==="pdf"||e==="txt"||e==="md"||e==="doc"||e==="docx"||e==="rtf",icon:_.FileText}];function Ye(t){const e=t.type.toLowerCase(),s=t.name.split(".").pop()?.toLowerCase()??"";for(const r of ht)if(r.test(e,s))return r.icon;return _.File}var Be=0;function Ke(){const[t,e]=o.useState(""),s=o.useRef(0);return[t,o.useCallback(r=>{s.current+=1,e(r+(s.current%2===0?"":" "))},[])]}var ce=new Map;function ze(t){const e=ce.get(t);if(e)return e.url;const s=URL.createObjectURL(t);return ce.set(t,{url:s,refs:0}),s}function $e(t){const e=t&&typeof window<"u"?ze(t):void 0;return o.useEffect(()=>{if(!t)return;ze(t);const s=ce.get(t);return s.refs++,()=>{s.refs--,setTimeout(()=>{s.refs<=0&&ce.get(t)===s&&(URL.revokeObjectURL(s.url),ce.delete(t))},0)}},[t]),e}var xe={status:"idle",progress:0},xt={accept:{"image/jpeg":[".jpg",".jpeg"],"image/png":[".png"]},acceptLabel:"JPG or PNG",minSize:10240,maxSize:5242880,minImageSize:{width:250,height:250}},Qe=o.createContext(null);function D(){const t=o.useContext(Qe);if(!t)throw new Error("FileUpload components must be used within a <FileUpload>");return t}var Ze=o.forwardRef(({className:t,dataHook:e,accept:s,acceptLabel:r,maxSize:n,minSize:l,maxFiles:i,multiple:d,minImageSize:m,disabled:u=!1,validate:f,onFileValidate:k,value:N,onValueChange:T,onFileReject:I,onFilesChange:$,onUpload:H,messages:Z,trackingEl:y,trackingLabel:ee,children:Fe,...Ue},B)=>{const[ke,we]=o.useState([]),Y=N!==void 0,M=Y?N:ke,W=Xe(Z),te=o.useRef(null),[ae,se]=o.useState([]),[_e,G]=Ke(),V=o.useCallback(p=>{se(h=>h.filter(g=>g.id!==p))},[]),de=o.useCallback(()=>{se([])},[]),[re,ue]=o.useState(()=>new Map),z=o.useCallback((p,h)=>{ue(g=>{const b=new Map(g),v=b.get(p)??{...xe};return b.set(p,{...v,...h}),b})},[]),K=o.useCallback(p=>re.get(p)??xe,[re]),X=o.useRef(M);o.useEffect(()=>{const p=X.current.filter(h=>!M.includes(h));X.current=M,p.length!==0&&ue(h=>{const g=new Map(h);for(const b of p)g.delete(b);return g})},[M]);const L=o.useRef({files:M,maxFiles:i,minImageSize:m,acceptLabel:r,accept:s,maxSize:n,minSize:l,messages:W,onFileValidate:k,onValueChange:T,onFileReject:I,onFilesChange:$,onUpload:H});o.useEffect(()=>{L.current={files:M,maxFiles:i,minImageSize:m,acceptLabel:r,accept:s,maxSize:n,minSize:l,messages:W,onFileValidate:k,onValueChange:T,onFileReject:I,onFilesChange:$,onUpload:H}});const A=o.useCallback(async p=>{const h=L.current.onUpload;if(!h||p.length===0)return;const{messages:g}=L.current,b=new Map;for(const F of p)z(F,{status:"uploading",progress:0,error:void 0});try{await h(p,{onProgress:(F,j)=>{z(F,{progress:Ge(j)})},onSuccess:F=>{b.set(F,"success"),z(F,{status:"success",progress:100})},onError:(F,j)=>{b.set(F,"error");const x=typeof j=="string"?j:j?.message;z(F,{status:"error",error:x||g.uploadFailed})}})}catch{}let v=0;for(const F of p){const j=b.get(F);j==="error"?v++:j===void 0&&(v++,z(F,{status:"error",error:g.uploadFailed}))}const S=p.length-v,O=[];v>0&&O.push(v===1?g.uploadFailedOne:q(g.uploadFailedMany,{n:v})),S>0&&O.push(S===1?g.uploadedOne:q(g.uploadedMany,{n:S})),G(O.join(" "))},[z,G]),oe=o.useCallback(p=>{(async()=>{const h=L.current,g=[],b=(x,P)=>{h.onFileReject?.(x,P),Be+=1,g.push({id:String(Be),name:x.name,message:P})};for(const{file:x,errors:P}of p.rejectedFiles){const pe=P[0];pe&&b(x,Ne(x,pe,h))}const v=[];for(const x of p.acceptedFiles){const P=await Je(x,h);if(P){b(x,P);continue}v.push(x)}const S=L.current,O=S.files,F=S.maxFiles!==void 0?Math.max(0,S.maxFiles-O.length):1/0,j=v.slice(0,F);for(const x of v.slice(j.length))b(x,Ne(x,"too-many-files",S));g.length>0&&se(x=>[...x,...g]),j.length>0&&(Y||we(x=>[...x,...j]),S.onValueChange?.([...O,...j])),S.onFilesChange?.({acceptedFiles:j,rejectedFiles:p.rejectedFiles}),j.length>0&&S.onUpload&&A(j)})()},[Y,A]),R=(0,Se.useFileDropzone)({accept:s,maxSize:n,minSize:l,maxFiles:void 0,multiple:d??i!==1,disabled:u,validate:f,onFilesChange:oe}),Re=o.useMemo(()=>({state:R.state,dragActive:R.dragActive,disabled:u,files:M,maxFiles:i,openFilePicker:R.openFilePicker,dropzoneProps:R.dropzoneProps,inputProps:R.inputProps,inputRef:R.inputRef,rootRef:te,rejections:ae,dismissRejection:V,clearRejections:de,announce:G,getFileStatus:K,messages:W}),[R,u,M,i,ae,V,de,G,K,W]),ne=o.useCallback(p=>{te.current=p,typeof B=="function"?B(p):B&&(B.current=p)},[B]);return(0,a.jsx)(Qe.Provider,{value:Re,children:(0,a.jsxs)("div",{ref:ne,className:(0,C.cn)("relative flex flex-col gap-3",t),"data-hook":e,"data-slot":"file-upload","data-tracking-el":y??"file-upload","data-tracking-label":ee,...Ue,children:[Fe,(0,a.jsx)("div",{"aria-live":"polite",className:"sr-only","data-slot":"file-upload-announcer",role:"status",children:_e})]})})});Ze.displayName="FileUpload";var vt=(0,Ie.cva)(["relative flex flex-col items-center justify-center gap-2 rounded-lg border-2 border-dashed p-6","transition-[border-color,background-color] duration-fast ease-out","outline-none has-[:focus-visible]:shadow-default has-[:focus-visible]:border-transparent","cursor-pointer"],{variants:{state:{idle:"border-input bg-background hover:bg-accent",accept:"border-success-mark bg-success-mark/5 dark:bg-success-mark/10",reject:"border-destructive bg-destructive/5 dark:bg-destructive/10"},disabled:{true:"pointer-events-none cursor-not-allowed opacity-50"}},defaultVariants:{state:"idle",disabled:!1}}),et=o.forwardRef(({className:t,dataHook:e,ariaLabel:s,children:r,onClick:n,onDragEnter:l,onDragOver:i,onDragLeave:d,onDrop:m,onPaste:u,...f},k)=>{const{state:N,disabled:T,openFilePicker:I,dropzoneProps:$,inputProps:H,inputRef:Z}=D(),y=o.useCallback(ee=>{ee.target.closest("button, a, input")||I()},[I]);return(0,a.jsxs)("div",{ref:k,"aria-disabled":T?"true":void 0,className:(0,C.cn)(vt({state:N,disabled:T}),t),"data-hook":e,"data-slot":"file-upload-dropzone","data-state":N,onClick:J.composeEventHandlers(n,y),onDragEnter:J.composeEventHandlers(l,$.onDragEnter),onDragLeave:J.composeEventHandlers(d,$.onDragLeave),onDragOver:J.composeEventHandlers(i,$.onDragOver),onDrop:J.composeEventHandlers(m,$.onDrop),onPaste:J.composeEventHandlers(u,$.onPaste),...f,children:[(0,a.jsx)("input",{ref:Z,...H,"aria-label":s??"Upload file","data-hook":e?`${e}-input`:void 0,disabled:T,tabIndex:T?-1:0}),r]})});et.displayName="FileUploadDropzone";var Me=o.forwardRef(({asChild:t=!1,dataHook:e,onClick:s,children:r,...n},l)=>{const{disabled:i,openFilePicker:d}=D();return(0,a.jsx)(t?dt.Slot:"button",{ref:l,"data-file-upload-trigger":"","data-hook":e,"data-slot":"file-upload-trigger",disabled:i,type:t?void 0:"button",onClick:J.composeEventHandlers(s,d),...n,children:r})});Me.displayName="FileUploadTrigger";function Ee({children:t}){const{state:e}=D();return e!=="idle"?null:(0,a.jsx)(a.Fragment,{children:t})}Ee.displayName="FileUploadIdle";function Le({children:t}){const{state:e}=D();return e!=="accept"?null:(0,a.jsx)(a.Fragment,{children:t})}Le.displayName="FileUploadAccept";function Pe({children:t}){const{state:e}=D();return e!=="reject"?null:(0,a.jsx)(a.Fragment,{children:t})}Pe.displayName="FileUploadReject";var tt=o.forwardRef(({className:t,dataHook:e,icon:s,title:r,description:n,triggerLabel:l,acceptMessage:i,rejectMessage:d,trackingEl:m,trackingLabel:u,...f},k)=>(0,a.jsxs)("div",{ref:k,className:(0,C.cn)("flex flex-col items-center gap-2 text-center",t),"data-slot":"file-upload-dropzone-content",...f,children:[(0,a.jsxs)(Ee,{children:[(0,a.jsx)(Te.LogoMark,{"data-slot":"file-upload-dropzone-icon","data-state":"idle",dataHook:`${e}-icon`,name:(0,a.jsx)(s,{className:"text-muted-foreground"}),shape:"circle",size:"lg"}),(0,a.jsx)(w.TypographyText,{dataHook:`${e}-title`,children:r}),(0,a.jsx)(w.TypographyText,{color:"muted",dataHook:`${e}-description`,variant:"body-sm",children:n}),l&&(0,a.jsx)(Me,{asChild:!0,dataHook:`${e}-trigger`,children:(0,a.jsx)(he.Button,{className:"mt-1","data-tracking-el":m,"data-tracking-label":u,dataHook:`${e}-trigger-btn`,size:"sm",variant:"outline",children:l})})]}),(0,a.jsxs)(Le,{children:[(0,a.jsx)(Te.LogoMark,{"data-slot":"file-upload-dropzone-icon","data-state":"accept",dataHook:`${e}-icon`,name:(0,a.jsx)(s,{}),shape:"circle",size:"lg",variant:"success"}),(0,a.jsx)(w.TypographyText,{className:"text-score-strong-ink",dataHook:`${e}-accept-message`,children:i??"Release to upload"})]}),(0,a.jsxs)(Pe,{children:[(0,a.jsx)(Te.LogoMark,{"data-slot":"file-upload-dropzone-icon","data-state":"reject",dataHook:`${e}-icon`,name:(0,a.jsx)(_.CircleX,{}),shape:"circle",size:"lg",variant:"destructive"}),(0,a.jsx)(w.TypographyText,{className:"text-score-poor-ink",dataHook:`${e}-reject-message`,children:d??"File not accepted"})]})]}));tt.displayName="FileUploadDropzoneContent";var jt=(0,Ie.cva)("",{variants:{variant:{list:"flex flex-col gap-2",grid:"grid grid-cols-3 gap-2 sm:grid-cols-4 sm:gap-3 xl:grid-cols-5 2xl:grid-cols-6"}},defaultVariants:{variant:"list"}}),at=o.forwardRef(({className:t,dataHook:e,ariaLabel:s,variant:r="list",children:n,...l},i)=>(0,a.jsx)("ul",{ref:i,"aria-label":s??"Uploaded files",className:(0,C.cn)(jt({variant:r}),t),"data-hook":e,"data-slot":"file-upload-list","data-variant":r,...l,children:n}));at.displayName="FileUploadList";var ve=o.forwardRef(({className:t,dataHook:e,children:s,...r},n)=>(0,a.jsx)("li",{ref:n,className:(0,C.cn)("flex items-center gap-2",t),"data-hook":e,"data-slot":"file-upload-item",...r,children:s}));ve.displayName="FileUploadItem";var yt=(0,Ie.cva)("bg-muted text-muted-foreground relative flex items-center justify-center overflow-hidden rounded-md",{variants:{size:{sm:"size-10 shrink-0",lg:"aspect-square w-full"}},defaultVariants:{size:"sm"}}),je=o.forwardRef(({className:t,dataHook:e,file:s,size:r="sm",children:n,...l},i)=>{const d=$e(s),m=s.type.startsWith("image/");return(0,a.jsxs)("div",{ref:i,className:(0,C.cn)(yt({size:r}),t),"data-hook":e,"data-size":r,"data-slot":"file-upload-item-preview",...l,children:[m&&d?(0,a.jsx)("img",{alt:s.name,className:"size-full object-cover",src:d}):o.createElement(Ye(s),{"aria-hidden":!0,size:r==="lg"?32:20,strokeWidth:1.5}),n]})});je.displayName="FileUploadItemPreview";var ye=o.forwardRef(({file:t,dataHook:e,removeAriaLabel:s,onClick:r,children:n,className:l,...i},d)=>{const{rootRef:m,announce:u,messages:f}=D(),k=o.useCallback(N=>{if(r?.(N),N.defaultPrevented)return;u(q(f.fileRemoved,{name:t.name}));const T=N.currentTarget.closest("li"),I=T?.nextElementSibling??T?.previousElementSibling;setTimeout(()=>{((I?.isConnected?I.querySelector("[data-file-upload-remove]"):null)??m.current?.querySelector("[data-file-upload-trigger]"))?.focus()},0)},[r,t.name,m,u,f.fileRemoved]);return(0,a.jsx)("button",{ref:d,"aria-label":s??`Remove ${t.name}`,className:(0,C.cn)("text-muted-foreground hover:text-foreground duration-fast cursor-pointer rounded-sm transition-colors ease-out","focus-visible:shadow-default outline-none","disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",l),"data-file-upload-remove":"","data-hook":e,"data-slot":"file-upload-item-remove",type:"button",onClick:k,...i,children:n})});ye.displayName="FileUploadItemRemove";var be=o.forwardRef(({className:t,dataHook:e,file:s,uploadingLabel:r,successLabel:n,errorLabel:l,...i},d)=>{const{getFileStatus:m}=D(),u=m(s),f=e??"file-upload-item-progress";return u.status==="idle"?null:u.status==="uploading"?(0,a.jsxs)("div",{ref:d,className:(0,C.cn)("flex items-center gap-2",t),"data-hook":f,"data-slot":"file-upload-item-progress","data-status":"uploading",...i,children:[(0,a.jsx)(ft.Progress,{ariaLabel:r??"Uploading…",className:"flex-1",dataHook:`${f}-bar`,size:"sm",value:u.progress}),(0,a.jsx)(w.TypographyText,{asChild:!0,color:"muted",dataHook:`${f}-text`,variant:"body-xs",children:(0,a.jsx)("span",{className:"shrink-0",children:r??"Uploading…"})})]}):u.status==="success"?(0,a.jsxs)("div",{ref:d,className:(0,C.cn)("text-label-sm text-success-foreground flex items-center gap-1",t),"data-hook":f,"data-slot":"file-upload-item-progress","data-status":"success",...i,children:[(0,a.jsx)(_.Check,{"aria-hidden":!0,size:14}),n??"Uploaded"]}):(0,a.jsxs)("div",{ref:d,className:(0,C.cn)("text-label-sm text-destructive-foreground flex items-center gap-1",t),"data-hook":f,"data-slot":"file-upload-item-progress","data-status":"error",...i,children:[(0,a.jsx)(_.TriangleAlert,{"aria-hidden":!0,size:14}),l??u.error??"Upload failed"]})});be.displayName="FileUploadItemProgress";var st=o.forwardRef(({className:t,dataHook:e,file:s,onRemove:r,removeAriaLabel:n,trackingEl:l,trackingLabel:i,...d},m)=>(0,a.jsx)(ve,{ref:m,className:t,dataHook:e,...d,children:(0,a.jsxs)("div",{className:"flex w-full flex-col gap-2 rounded-lg border p-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)(je,{file:s}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)(w.TypographyText,{truncate:!0,"data-slot":"file-upload-file-name",dataHook:`${e}-name`,children:s.name}),(0,a.jsx)(w.TypographyText,{color:"muted","data-slot":"file-upload-file-description",dataHook:`${e}-size`,variant:"body-sm",children:Q(s.size)})]}),r&&(0,a.jsx)(ye,{"data-tracking-el":l,"data-tracking-label":i,dataHook:`${e}-remove`,file:s,removeAriaLabel:n,onClick:r,children:(0,a.jsx)(_.X,{size:16})})]}),(0,a.jsx)(be,{file:s})]})}));st.displayName="FileUploadCardItem";var rt=o.forwardRef(({className:t,dataHook:e,file:s,onRemove:r,removeAriaLabel:n,showName:l=!1,trackingEl:i,trackingLabel:d,...m},u)=>(0,a.jsxs)(ve,{ref:u,className:(0,C.cn)("flex min-w-0 flex-col gap-1.5",t),dataHook:e,...m,children:[(0,a.jsx)(je,{className:"group/thumb",file:s,size:"lg",children:r&&(0,a.jsx)("div",{className:"bg-background/80 hover:bg-background duration-fast absolute top-1.5 right-1.5 rounded-full p-0.5 opacity-0 transition-opacity ease-out group-focus-within/thumb:opacity-100 group-hover/thumb:opacity-100",children:(0,a.jsx)(ye,{className:"flex","data-tracking-el":i,"data-tracking-label":d,dataHook:`${e}-remove`,file:s,removeAriaLabel:n,onClick:r,children:(0,a.jsx)(_.X,{size:16})})})}),l&&(0,a.jsx)(w.TypographyText,{asChild:!0,truncate:!0,color:"muted",dataHook:`${e}-name`,variant:"body-xs",children:(0,a.jsx)("span",{"data-slot":"file-upload-file-name",children:s.name})}),(0,a.jsx)(be,{file:s})]}));rt.displayName="FileUploadGridItem";var ot=o.forwardRef(({className:t,dataHook:e,title:s,dismissLabel:r,...n},l)=>{const{rejections:i,clearRejections:d}=D(),m=e??"file-upload-rejections";if(i.length===0)return null;const u=i.length,f=s?s.replace("{n}",String(u)):u===1?"1 file wasn't added":`${u} files weren't added`;return(0,a.jsxs)(He.Alert,{ref:l,className:t,"data-hook":m,"data-slot":"file-upload-rejections",role:"status",variant:"warning",...n,children:[(0,a.jsx)(_.TriangleAlert,{"aria-hidden":!0,className:"shrink-0 translate-y-0.5"}),(0,a.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,a.jsx)(He.AlertTitle,{children:f}),(0,a.jsx)(he.Button,{"aria-label":r??"Dismiss",className:"-my-1.5 -mr-2 shrink-0",dataHook:`${m}-dismiss`,size:"sm",variant:"ghost",onClick:d,children:(0,a.jsx)(_.X,{"aria-hidden":!0})})]}),(0,a.jsx)(w.TypographyText,{asChild:!0,dataHook:`${m}-list`,variant:"body-sm",children:(0,a.jsx)("ul",{className:"flex flex-col gap-1",children:i.map(k=>(0,a.jsxs)("li",{className:"min-w-0 break-words","data-slot":"file-upload-rejection",children:[(0,a.jsx)("strong",{children:k.name})," — ",k.message]},k.id))})})]})]})});ot.displayName="FileUploadRejections";var nt=o.forwardRef(({className:t,dataHook:e,layout:s="vertical",shape:r="square",label:n,description:l,emptyMessage:i,src:d,onChange:m,onRemove:u,accept:f,acceptLabel:k,maxSize:N,minSize:T,minImageSize:I,onFileValidate:$,onUpload:H,messages:Z,disabled:y=!1,uploadLabel:ee,removeLabel:Fe,uploadingLabel:Ue,actions:B,trackingEl:ke,trackingLabel:we,onDragEnter:Y,onDragOver:M,onDragLeave:W,onDrop:te,onPaste:ae,...se},_e)=>{const G=o.useRef(null),V=o.useRef(!1),[de,re]=o.useState(null),ue=$e(de),z=d!==void 0?d:ue??null,K=Xe(Z),[X,L]=o.useState("idle"),A=o.useRef(0),[oe,R]=o.useState(xe),[Re,ne]=o.useState(null),[p,h]=Ke(),g=o.useCallback(c=>{ne(c),h(c)},[h]),b=o.useRef({accept:f,acceptLabel:k,maxSize:N,minSize:T,minImageSize:I,messages:K,onFileValidate:$,onChange:m,onUpload:H});o.useEffect(()=>{b.current={accept:f,acceptLabel:k,maxSize:N,minSize:T,minImageSize:I,messages:K,onFileValidate:$,onChange:m,onUpload:H}});const v=o.useCallback(c=>{const U=c[0];y||V.current||!U||(async()=>{const E=b.current,Oe=(0,Se.validateFile)(U,{accept:E.accept,maxSize:E.maxSize,minSize:E.minSize})[0];if(Oe){g(Ne(U,Oe,{...E,maxFiles:1}));return}const qe=await Je(U,E);if(qe){g(qe);return}if(ne(null),re(U),E.onChange?.(U,ze(U)),!E.onUpload)return;let Ce;V.current=!0,R({status:"uploading",progress:0});try{await E.onUpload([U],{onProgress:(fe,ie)=>{R(ge=>({...ge,progress:Ge(ie)}))},onSuccess:()=>{Ce="success",R({status:"success",progress:100})},onError:(fe,ie)=>{Ce="error";const ge=(typeof ie=="string"?ie:ie?.message)||E.messages.uploadFailed;R({status:"error",progress:0,error:ge}),h(ge)}})}catch{}if(Ce===void 0){const fe=E.messages.uploadFailed;R({status:"error",progress:0,error:fe}),h(fe)}V.current=!1})()},[y,g,h]),S=o.useCallback(c=>{if(Y?.(c),c.preventDefault(),!y&&(A.current+=1,A.current===1)){const U=(0,Se.dragItemsMatchAccept)(c.dataTransfer.items,f);L(U?"accept":"reject")}},[Y,y,f]),O=o.useCallback(c=>{M?.(c),c.preventDefault(),y||(c.dataTransfer.dropEffect="copy")},[M,y]),F=o.useCallback(c=>{W?.(c),c.preventDefault(),!y&&(A.current-=1,A.current===0&&L("idle"))},[W,y]),j=o.useCallback(c=>{te?.(c),!c.defaultPrevented&&(c.preventDefault(),A.current=0,L("idle"),v(Array.from(c.dataTransfer.files)))},[te,v]),x=o.useCallback(c=>{if(ae?.(c),c.defaultPrevented)return;const U=Array.from(c.clipboardData.files);U.length>0&&(c.preventDefault(),v(U))},[ae,v]),P=o.useCallback(c=>{v(Array.from(c.target.files??[])),c.target.value=""},[v]),pe=o.useCallback(()=>{V.current=!1,re(null),R(xe),ne(null),u?.()},[u]),it=f?Object.entries(f).flatMap(([c,U])=>U.length>0?U:[c]).join(","):void 0,le=oe.status==="uploading",me=Re??(oe.status==="error"?oe.error??K.uploadFailed:null),De=s==="horizontal",Ae=(0,a.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,a.jsx)("input",{ref:G,accept:it,"aria-label":n?`Upload ${n}`:"Upload file",className:"sr-only",disabled:y||le,tabIndex:-1,type:"file",onChange:P}),(0,a.jsx)(he.Button,{dataHook:`${e}-upload`,disabled:y||le,size:"sm",variant:"outline",onClick:()=>G.current?.click(),children:ee??(z?"Replace":"Upload")}),z&&!le&&B,z&&!le&&(0,a.jsx)(he.Button,{dataHook:`${e}-remove`,disabled:y,size:"sm",variant:"ghost",onClick:pe,children:Fe??"Remove"})]});return(0,a.jsxs)("div",{ref:_e,className:(0,C.cn)("relative flex",De?"flex-wrap items-start gap-4":"flex-col items-center gap-2",t),"data-hook":e,"data-slot":"file-upload-slot","data-tracking-el":ke??"file-upload-slot","data-tracking-label":we,onDragEnter:S,onDragLeave:F,onDragOver:O,onDrop:j,onPaste:x,...se,children:[(0,a.jsxs)("div",{className:(0,C.cn)("bg-muted text-muted-foreground relative flex shrink-0 items-center justify-center overflow-hidden rounded-lg","duration-fast transition-shadow ease-out",r==="square"?"size-24":"h-24 w-40",y&&"opacity-50",X==="accept"&&"ring-success-mark ring-2",X==="reject"&&"ring-destructive ring-2"),"data-drag-state":X!=="idle"?X:void 0,"data-hook":`${e}-frame`,"data-slot":"file-upload-slot-frame",children:[z?(0,a.jsx)("img",{alt:n??"",className:"size-full object-cover",src:z}):(0,a.jsx)(pt.MediaEmpty,{dataHook:`${e}-empty`,message:i}),le&&(0,a.jsx)("div",{className:"bg-background/70 absolute inset-0 flex items-center justify-center",children:(0,a.jsx)(ut.Spinner,{className:"text-primary",dataHook:`${e}-spinner`,loadingLabel:Ue??"Uploading…",size:"lg"})})]}),De?(0,a.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-2",children:[n&&(0,a.jsx)(w.TypographyText,{asChild:!0,dataHook:`${e}-label`,variant:"body-sm",children:(0,a.jsx)("span",{children:n})}),l&&(0,a.jsx)(w.TypographyText,{color:"muted",dataHook:`${e}-description`,variant:"body-xs",children:l}),me&&(0,a.jsx)(w.TypographyText,{asChild:!0,color:"destructive",dataHook:`${e}-status-text`,variant:"body-xs",children:(0,a.jsxs)("p",{"aria-hidden":!0,className:"flex items-start gap-1","data-hook":`${e}-status`,"data-slot":"file-upload-slot-status",children:[(0,a.jsx)(_.TriangleAlert,{className:"mt-0.5 shrink-0",size:14}),(0,a.jsx)("span",{children:me})]})}),Ae]}):(0,a.jsxs)(a.Fragment,{children:[n&&(0,a.jsx)(w.TypographyText,{asChild:!0,color:"muted",dataHook:`${e}-label`,variant:"body-xs",children:(0,a.jsx)("span",{children:n})}),l&&(0,a.jsx)(w.TypographyText,{align:"center",className:"max-w-60",color:"muted",dataHook:`${e}-description`,variant:"body-xs",children:l}),me&&(0,a.jsx)(w.TypographyText,{asChild:!0,color:"destructive",dataHook:`${e}-status-text`,variant:"body-xs",children:(0,a.jsxs)("p",{"aria-hidden":!0,className:"flex max-w-60 items-start gap-1 text-center","data-hook":`${e}-status`,"data-slot":"file-upload-slot-status",children:[(0,a.jsx)(_.TriangleAlert,{className:"mt-0.5 shrink-0",size:14}),(0,a.jsx)("span",{children:me})]})}),Ae]}),(0,a.jsx)("div",{"aria-live":"polite",className:"sr-only","data-slot":"file-upload-announcer",role:"status",children:p})]})});nt.displayName="FileUploadSlot";var lt=o.forwardRef(({className:t,count:e,dataHook:s,...r},n)=>{const{files:l,maxFiles:i}=D();return i===void 0?null:(0,a.jsx)(mt.CountIndicator,{ref:n,className:(0,C.cn)("order-last ml-auto pl-3",t),count:e??l.length,"data-slot":"file-upload-count",dataHook:s??"file-upload-count",limit:i,...r})});lt.displayName="FileUploadCount";exports.FILE_UPLOAD_MESSAGES=Ve;exports.FileUpload=Ze;exports.FileUploadAccept=Le;exports.FileUploadCardItem=st;exports.FileUploadCount=lt;exports.FileUploadDropzone=et;exports.FileUploadDropzoneContent=tt;exports.FileUploadGridItem=rt;exports.FileUploadIdle=Ee;exports.FileUploadItem=ve;exports.FileUploadItemPreview=je;exports.FileUploadItemProgress=be;exports.FileUploadItemRemove=ye;exports.FileUploadList=at;exports.FileUploadReject=Pe;exports.FileUploadRejections=ot;exports.FileUploadSlot=nt;exports.FileUploadTrigger=Me;exports.PHOTO_UPLOAD_RULES=xt;exports.formatBytes=Q;exports.getFileTypeIcon=Ye;exports.getImageDimensions=We;exports.useObjectUrl=$e;
|