@adamosuiteservices/ui 2.12.2 → 2.13.1

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.
@@ -0,0 +1,14 @@
1
+ import { ComponentProps } from 'react';
2
+ export type FileUploadLabels = {
3
+ dragDrop?: string;
4
+ selectFile?: string;
5
+ fileRequirements?: string;
6
+ };
7
+ export type FileUploadProps = ComponentProps<"div"> & Readonly<{
8
+ selectedFile: File | null;
9
+ onFileSelect: (file: File | null) => void;
10
+ acceptedExtensions?: string[];
11
+ maxSizeInMB?: number;
12
+ labels?: FileUploadLabels;
13
+ }>;
14
+ export declare function FileUpload({ className, selectedFile, onFileSelect, acceptedExtensions, maxSizeInMB, labels, ...props }: FileUploadProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export * from './file-upload';
@@ -1,6 +1,6 @@
1
1
  import { VariantProps } from 'class-variance-authority';
2
2
  declare const typographyVariants: (props?: ({
3
- variant?: "caption" | "sm" | "lg" | "xs" | "md" | null | undefined;
3
+ variant?: "caption" | "sm" | "lg" | "md" | "xs" | null | undefined;
4
4
  color?: "default" | "muted" | null | undefined;
5
5
  } & import('class-variance-authority/types').ClassProp) | undefined) => string;
6
6
  declare function Typography({ className, variant, color, asChild, ...props }: React.ComponentProps<"p"> & VariantProps<typeof typographyVariants> & {
package/dist/dialog.cjs CHANGED
@@ -21,14 +21,14 @@
21
21
  adm:focus:ring-2 adm:focus:ring-ring adm:focus:ring-offset-2
22
22
  adm:focus:outline-hidden
23
23
  adm:disabled:pointer-events-none
24
+ adm:**:data-[slot=icon]:pointer-events-none
25
+ adm:**:data-[slot=icon]:shrink-0
24
26
  adm:data-[state=open]:bg-accent
25
27
  adm:data-[state=open]:text-muted-foreground
26
- adm:[&_[data-slot=icon]]:pointer-events-none
27
- adm:[&_[data-slot=icon]]:shrink-0
28
28
  adm:[&_[data-slot=icon]:not([class*=text-])]:text-lg
29
29
  adm:[&_svg]:pointer-events-none adm:[&_svg]:shrink-0
30
30
  adm:[&_svg:not([class*=size-])]:size-4
31
31
  `,children:[t.jsxRuntimeExports.jsx(r.Icon,{symbol:"close"}),t.jsxRuntimeExports.jsx("span",{className:"adm:sr-only",children:"Close"})]})]})]})}function p({className:a,...o}){return t.jsxRuntimeExports.jsx("div",{"data-slot":"dialog-header",className:s.cn("adm:flex adm:flex-col adm:gap-2",a),...o})}function f({className:a,...o}){return t.jsxRuntimeExports.jsx("div",{"data-slot":"dialog-footer",className:s.cn(`
32
- adm:flex adm:gap-2
32
+ adm:flex adm:gap-6
33
33
  adm:sm:flex-row adm:sm:justify-start
34
- `,a),...o})}function j({className:a,...o}){return t.jsxRuntimeExports.jsx(e.Title,{"data-slot":"dialog-title",className:s.cn("adm:text-sm adm:font-semibold adm:text-foreground",a),...o})}function D({className:a,...o}){return t.jsxRuntimeExports.jsx(e.Description,{"data-slot":"dialog-description",className:s.cn("adm:text-sm adm:text-muted-foreground",a),...o})}function R({className:a,...o}){return t.jsxRuntimeExports.jsx("div",{"data-slot":"dialog-body",className:s.cn("adm:mt-2 adm:mb-6",a),...o})}exports.Dialog=c;exports.DialogBody=R;exports.DialogClose=u;exports.DialogContent=g;exports.DialogDescription=D;exports.DialogFooter=f;exports.DialogHeader=p;exports.DialogOverlay=n;exports.DialogPortal=d;exports.DialogTitle=j;exports.DialogTrigger=x;
34
+ `,a),...o})}function j({className:a,...o}){return t.jsxRuntimeExports.jsx(e.Title,{"data-slot":"dialog-title",className:s.cn("adm:text-sm adm:font-semibold adm:text-foreground",a),...o})}function D({className:a,...o}){return t.jsxRuntimeExports.jsx(e.Description,{"data-slot":"dialog-description",className:s.cn("adm:text-sm adm:text-muted-foreground",a),...o})}function R({className:a,...o}){return t.jsxRuntimeExports.jsx("div",{"data-slot":"dialog-body",className:s.cn("adm:mt-4 adm:mb-10",a),...o})}exports.Dialog=c;exports.DialogBody=R;exports.DialogClose=u;exports.DialogContent=g;exports.DialogDescription=D;exports.DialogFooter=f;exports.DialogHeader=p;exports.DialogOverlay=n;exports.DialogPortal=d;exports.DialogTitle=j;exports.DialogTrigger=x;
package/dist/dialog.js CHANGED
@@ -44,7 +44,7 @@ function j({
44
44
  }
45
45
  );
46
46
  }
47
- function _({
47
+ function k({
48
48
  className: a,
49
49
  children: d,
50
50
  showCloseButton: s = !0,
@@ -88,10 +88,10 @@ function _({
88
88
  adm:focus:ring-2 adm:focus:ring-ring adm:focus:ring-offset-2
89
89
  adm:focus:outline-hidden
90
90
  adm:disabled:pointer-events-none
91
+ adm:**:data-[slot=icon]:pointer-events-none
92
+ adm:**:data-[slot=icon]:shrink-0
91
93
  adm:data-[state=open]:bg-accent
92
94
  adm:data-[state=open]:text-muted-foreground
93
- adm:[&_[data-slot=icon]]:pointer-events-none
94
- adm:[&_[data-slot=icon]]:shrink-0
95
95
  adm:[&_[data-slot=icon]:not([class*=text-])]:text-lg
96
96
  adm:[&_svg]:pointer-events-none adm:[&_svg]:shrink-0
97
97
  adm:[&_svg:not([class*=size-])]:size-4
@@ -107,7 +107,7 @@ function _({
107
107
  )
108
108
  ] });
109
109
  }
110
- function k({ className: a, ...d }) {
110
+ function w({ className: a, ...d }) {
111
111
  return /* @__PURE__ */ t.jsx(
112
112
  "div",
113
113
  {
@@ -117,14 +117,14 @@ function k({ className: a, ...d }) {
117
117
  }
118
118
  );
119
119
  }
120
- function w({ className: a, ...d }) {
120
+ function T({ className: a, ...d }) {
121
121
  return /* @__PURE__ */ t.jsx(
122
122
  "div",
123
123
  {
124
124
  "data-slot": "dialog-footer",
125
125
  className: o(
126
126
  `
127
- adm:flex adm:gap-2
127
+ adm:flex adm:gap-6
128
128
  adm:sm:flex-row adm:sm:justify-start
129
129
  `,
130
130
  a
@@ -133,7 +133,7 @@ function w({ className: a, ...d }) {
133
133
  }
134
134
  );
135
135
  }
136
- function T({
136
+ function _({
137
137
  className: a,
138
138
  ...d
139
139
  }) {
@@ -167,7 +167,7 @@ function P({
167
167
  "div",
168
168
  {
169
169
  "data-slot": "dialog-body",
170
- className: o("adm:mt-2 adm:mb-6", a),
170
+ className: o("adm:mt-4 adm:mb-10", a),
171
171
  ...d
172
172
  }
173
173
  );
@@ -176,12 +176,12 @@ export {
176
176
  N as Dialog,
177
177
  P as DialogBody,
178
178
  C as DialogClose,
179
- _ as DialogContent,
179
+ k as DialogContent,
180
180
  O as DialogDescription,
181
- w as DialogFooter,
182
- k as DialogHeader,
181
+ T as DialogFooter,
182
+ w as DialogHeader,
183
183
  j as DialogOverlay,
184
184
  p as DialogPortal,
185
- T as DialogTitle,
185
+ _ as DialogTitle,
186
186
  z as DialogTrigger
187
187
  };
@@ -0,0 +1,18 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-BB_1_6y_.cjs"),p=require("./button-Day6_fbu.cjs"),l=require("./icon-DPMQJBkA.cjs"),r=require("./typography-DqQZZpkD.cjs"),a=require("./index-DoxiiusW.cjs"),N=require("react");function D({className:j,selectedFile:n,onFileSelect:m,acceptedExtensions:d=[".xls",".xlsx",".numbers"],maxSizeInMB:x=50,labels:i,...f}){const[c,o]=N.useState(!1),h=d.join(","),g=x*1024*1024,y=s=>{s.preventDefault(),o(!0)},R=s=>{s.preventDefault(),o(!1)},b=s=>{s.preventDefault(),o(!1);const t=s.dataTransfer.files[0];t&&u(t)&&m(t)},v=s=>{const t=s.target.files?.[0];t&&u(t)&&m(t)},E=()=>{m(null)},u=s=>{const t=s.name.substring(s.name.lastIndexOf("."));return d.includes(t.toLowerCase())&&s.size<=g};return e.jsxRuntimeExports.jsx("div",{className:a.cn("adm:flex adm:flex-col",j),...f,children:n?e.jsxRuntimeExports.jsxs("div",{className:a.cn(`
2
+ adm:flex adm:items-center adm:gap-4 adm:rounded-2xl adm:border
3
+ adm:border-input adm:bg-muted adm:p-6
4
+ `),children:[e.jsxRuntimeExports.jsx("div",{className:a.cn(`
5
+ adm:flex adm:items-center adm:justify-center adm:rounded-xl
6
+ adm:bg-primary-50 adm:p-2.5
7
+ `),children:e.jsxRuntimeExports.jsx(l.Icon,{symbol:"text_snippet",className:"adm:text-primary"})}),e.jsxRuntimeExports.jsxs("div",{className:`
8
+ adm:flex adm:min-w-0 adm:flex-1 adm:items-start adm:gap-3
9
+ `,children:[e.jsxRuntimeExports.jsx("div",{className:"adm:min-w-0 adm:flex-1",children:e.jsxRuntimeExports.jsx(r.Typography,{className:"adm:truncate adm:font-semibold",children:n.name})}),e.jsxRuntimeExports.jsxs(r.Typography,{className:"adm:shrink-0",color:"muted",children:[(n.size/1024/1024).toFixed(1)," MB"]})]}),e.jsxRuntimeExports.jsx(p.Button,{variant:"destructive-medium",onClick:E,type:"button",children:e.jsxRuntimeExports.jsx(l.Icon,{symbol:"delete",className:"adm:text-destructive"})})]}):e.jsxRuntimeExports.jsxs("div",{onDragOver:y,onDragLeave:R,onDrop:b,className:a.cn(`
10
+ adm:flex adm:flex-col adm:items-center adm:gap-6 adm:rounded-2xl
11
+ adm:border-2
12
+ `,`
13
+ adm:border-dashed adm:bg-background adm:p-6
14
+ adm:transition-colors
15
+ `,{"adm:border-primary":c,"adm:border-input":!c}),children:[e.jsxRuntimeExports.jsx("div",{className:a.cn(`
16
+ adm:flex adm:items-center adm:justify-center adm:rounded-xl
17
+ adm:bg-primary-50 adm:p-2.5
18
+ `),children:e.jsxRuntimeExports.jsx(l.Icon,{symbol:"text_snippet",className:"adm:text-primary"})}),e.jsxRuntimeExports.jsxs("div",{className:"adm:flex adm:flex-col adm:items-center adm:gap-2",children:[e.jsxRuntimeExports.jsx(r.Typography,{children:i?.dragDrop||"Drag and drop your file here or"}),e.jsxRuntimeExports.jsxs("label",{htmlFor:"file-upload",children:[e.jsxRuntimeExports.jsx("input",{id:"file-upload",type:"file",accept:h,onChange:v,className:"adm:hidden"}),e.jsxRuntimeExports.jsx(p.Button,{asChild:!0,type:"button",variant:"link",className:"adm:cursor-pointer",children:e.jsxRuntimeExports.jsx("span",{children:i?.selectFile||"Select the file"})})]})]}),e.jsxRuntimeExports.jsx(r.Typography,{className:"adm:text-center",color:"muted",children:i?.fileRequirements||`Allowed files: ${d.join(", ")}. Maximum size ${x} MB.`})]})})}exports.FileUpload=D;
@@ -0,0 +1,146 @@
1
+ import { j as e } from "./jsx-runtime-BzflLqGi.js";
2
+ import { B as f } from "./button-Bn4LFAa9.js";
3
+ import { I as o } from "./icon-DKAhvlX_.js";
4
+ import { T as m } from "./typography-9EoV0kcN.js";
5
+ import { c as s } from "./index-CRiPKpXj.js";
6
+ import { useState as I } from "react";
7
+ function L({
8
+ className: u,
9
+ selectedFile: r,
10
+ onFileSelect: t,
11
+ acceptedExtensions: n = [".xls", ".xlsx", ".numbers"],
12
+ maxSizeInMB: c = 50,
13
+ labels: i,
14
+ ...h
15
+ }) {
16
+ const [x, l] = I(!1), j = n.join(","), g = c * 1024 * 1024, v = (a) => {
17
+ a.preventDefault(), l(!0);
18
+ }, b = (a) => {
19
+ a.preventDefault(), l(!1);
20
+ }, y = (a) => {
21
+ a.preventDefault(), l(!1);
22
+ const d = a.dataTransfer.files[0];
23
+ d && p(d) && t(d);
24
+ }, N = (a) => {
25
+ const d = a.target.files?.[0];
26
+ d && p(d) && t(d);
27
+ }, D = () => {
28
+ t(null);
29
+ }, p = (a) => {
30
+ const d = a.name.substring(a.name.lastIndexOf("."));
31
+ return n.includes(d.toLowerCase()) && a.size <= g;
32
+ };
33
+ return /* @__PURE__ */ e.jsx("div", { className: s("adm:flex adm:flex-col", u), ...h, children: r ? (
34
+ // Selected File Display (when file is selected)
35
+ /* @__PURE__ */ e.jsxs(
36
+ "div",
37
+ {
38
+ className: s(`
39
+ adm:flex adm:items-center adm:gap-4 adm:rounded-2xl adm:border
40
+ adm:border-input adm:bg-muted adm:p-6
41
+ `),
42
+ children: [
43
+ /* @__PURE__ */ e.jsx(
44
+ "div",
45
+ {
46
+ className: s(`
47
+ adm:flex adm:items-center adm:justify-center adm:rounded-xl
48
+ adm:bg-primary-50 adm:p-2.5
49
+ `),
50
+ children: /* @__PURE__ */ e.jsx(o, { symbol: "text_snippet", className: "adm:text-primary" })
51
+ }
52
+ ),
53
+ /* @__PURE__ */ e.jsxs(
54
+ "div",
55
+ {
56
+ className: `
57
+ adm:flex adm:min-w-0 adm:flex-1 adm:items-start adm:gap-3
58
+ `,
59
+ children: [
60
+ /* @__PURE__ */ e.jsx("div", { className: "adm:min-w-0 adm:flex-1", children: /* @__PURE__ */ e.jsx(m, { className: "adm:truncate adm:font-semibold", children: r.name }) }),
61
+ /* @__PURE__ */ e.jsxs(m, { className: "adm:shrink-0", color: "muted", children: [
62
+ (r.size / 1024 / 1024).toFixed(1),
63
+ " MB"
64
+ ] })
65
+ ]
66
+ }
67
+ ),
68
+ /* @__PURE__ */ e.jsx(
69
+ f,
70
+ {
71
+ variant: "destructive-medium",
72
+ onClick: D,
73
+ type: "button",
74
+ children: /* @__PURE__ */ e.jsx(o, { symbol: "delete", className: "adm:text-destructive" })
75
+ }
76
+ )
77
+ ]
78
+ }
79
+ )
80
+ ) : (
81
+ // Drag & Drop Area (when no file is selected)
82
+ /* @__PURE__ */ e.jsxs(
83
+ "div",
84
+ {
85
+ onDragOver: v,
86
+ onDragLeave: b,
87
+ onDrop: y,
88
+ className: s(
89
+ `
90
+ adm:flex adm:flex-col adm:items-center adm:gap-6 adm:rounded-2xl
91
+ adm:border-2
92
+ `,
93
+ `
94
+ adm:border-dashed adm:bg-background adm:p-6
95
+ adm:transition-colors
96
+ `,
97
+ {
98
+ "adm:border-primary": x,
99
+ "adm:border-input": !x
100
+ }
101
+ ),
102
+ children: [
103
+ /* @__PURE__ */ e.jsx(
104
+ "div",
105
+ {
106
+ className: s(`
107
+ adm:flex adm:items-center adm:justify-center adm:rounded-xl
108
+ adm:bg-primary-50 adm:p-2.5
109
+ `),
110
+ children: /* @__PURE__ */ e.jsx(o, { symbol: "text_snippet", className: "adm:text-primary" })
111
+ }
112
+ ),
113
+ /* @__PURE__ */ e.jsxs("div", { className: "adm:flex adm:flex-col adm:items-center adm:gap-2", children: [
114
+ /* @__PURE__ */ e.jsx(m, { children: i?.dragDrop || "Drag and drop your file here or" }),
115
+ /* @__PURE__ */ e.jsxs("label", { htmlFor: "file-upload", children: [
116
+ /* @__PURE__ */ e.jsx(
117
+ "input",
118
+ {
119
+ id: "file-upload",
120
+ type: "file",
121
+ accept: j,
122
+ onChange: N,
123
+ className: "adm:hidden"
124
+ }
125
+ ),
126
+ /* @__PURE__ */ e.jsx(
127
+ f,
128
+ {
129
+ asChild: !0,
130
+ type: "button",
131
+ variant: "link",
132
+ className: "adm:cursor-pointer",
133
+ children: /* @__PURE__ */ e.jsx("span", { children: i?.selectFile || "Select the file" })
134
+ }
135
+ )
136
+ ] })
137
+ ] }),
138
+ /* @__PURE__ */ e.jsx(m, { className: "adm:text-center", color: "muted", children: i?.fileRequirements || `Allowed files: ${n.join(", ")}. Maximum size ${c} MB.` })
139
+ ]
140
+ }
141
+ )
142
+ ) });
143
+ }
144
+ export {
145
+ L as FileUpload
146
+ };