@adamosuiteservices/ui 2.13.1 → 2.13.3
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/components/ui/file-upload/file-upload.d.ts +11 -3
- package/dist/components/ui/slider/slider.d.ts +5 -2
- package/dist/components/ui/typography/typography.d.ts +1 -1
- package/dist/file-upload.cjs +6 -18
- package/dist/file-upload.js +264 -134
- package/dist/slider.cjs +6 -7
- package/dist/slider.js +191 -177
- package/dist/styles.css +1 -1
- package/dist/typography-Bj8oEDuE.cjs +1 -0
- package/dist/typography-MnY0LQoZ.js +50 -0
- package/dist/typography.cjs +1 -1
- package/dist/typography.js +1 -1
- package/docs/AI-GUIDE.md +321 -321
- package/docs/components/layout/sidebar.md +399 -399
- package/docs/components/layout/toaster.md +436 -436
- package/docs/components/ui/accordion-rounded.md +584 -584
- package/docs/components/ui/accordion.md +269 -269
- package/docs/components/ui/calendar.md +1159 -1159
- package/docs/components/ui/card.md +1455 -1455
- package/docs/components/ui/checkbox.md +292 -292
- package/docs/components/ui/collapsible.md +323 -323
- package/docs/components/ui/dialog.md +628 -628
- package/docs/components/ui/field.md +706 -706
- package/docs/components/ui/file-upload.md +475 -66
- package/docs/components/ui/hover-card.md +446 -446
- package/docs/components/ui/kbd.md +434 -434
- package/docs/components/ui/label.md +359 -359
- package/docs/components/ui/pagination.md +650 -650
- package/docs/components/ui/popover.md +536 -536
- package/docs/components/ui/progress.md +182 -182
- package/docs/components/ui/radio-group.md +311 -311
- package/docs/components/ui/separator.md +214 -214
- package/docs/components/ui/sheet.md +174 -174
- package/docs/components/ui/skeleton.md +140 -140
- package/docs/components/ui/slider.md +460 -341
- package/docs/components/ui/spinner.md +170 -170
- package/docs/components/ui/switch.md +408 -408
- package/docs/components/ui/tabs-underline.md +106 -106
- package/docs/components/ui/tabs.md +122 -122
- package/docs/components/ui/textarea.md +243 -243
- package/docs/components/ui/toggle.md +237 -237
- package/docs/components/ui/tooltip.md +317 -317
- package/docs/components/ui/typography.md +320 -280
- package/package.json +1 -1
- package/dist/typography-9EoV0kcN.js +0 -44
- package/dist/typography-DqQZZpkD.cjs +0 -1
|
@@ -3,12 +3,20 @@ export type FileUploadLabels = {
|
|
|
3
3
|
dragDrop?: string;
|
|
4
4
|
selectFile?: string;
|
|
5
5
|
fileRequirements?: string;
|
|
6
|
+
filesSelected?: (count: number) => string;
|
|
6
7
|
};
|
|
7
8
|
export type FileUploadProps = ComponentProps<"div"> & Readonly<{
|
|
8
|
-
selectedFile
|
|
9
|
-
|
|
9
|
+
selectedFile?: File | null;
|
|
10
|
+
selectedFiles?: File[];
|
|
11
|
+
onFileSelect?: (file: File | null) => void;
|
|
12
|
+
onFilesSelect?: (files: File[]) => void;
|
|
13
|
+
onInvalidFile?: (file: File, reason: "extension" | "size") => void;
|
|
10
14
|
acceptedExtensions?: string[];
|
|
11
15
|
maxSizeInMB?: number;
|
|
16
|
+
maxFiles?: number;
|
|
17
|
+
multiple?: boolean;
|
|
18
|
+
filesPosition?: "above" | "below";
|
|
19
|
+
invalid?: boolean;
|
|
12
20
|
labels?: FileUploadLabels;
|
|
13
21
|
}>;
|
|
14
|
-
export declare function FileUpload({ className, selectedFile, onFileSelect, acceptedExtensions, maxSizeInMB, labels, ...props }: FileUploadProps): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export declare function FileUpload({ className, selectedFile, selectedFiles, onFileSelect, onFilesSelect, onInvalidFile, acceptedExtensions, maxSizeInMB, maxFiles, multiple, filesPosition, invalid, labels, ...props }: FileUploadProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { Theme } from '../../../types/theme.type';
|
|
2
2
|
import * as SliderPrimitive from "@radix-ui/react-slider";
|
|
3
3
|
import * as React from "react";
|
|
4
|
-
|
|
4
|
+
type SliderColorProp = "full" | [string, string];
|
|
5
|
+
type SliderProps = React.ComponentProps<typeof SliderPrimitive.Root> & {
|
|
5
6
|
theme?: Theme;
|
|
6
|
-
|
|
7
|
+
color?: SliderColorProp;
|
|
8
|
+
};
|
|
9
|
+
declare function Slider({ className, defaultValue, value, min, max, theme, color, ...props }: SliderProps): import("react/jsx-runtime").JSX.Element;
|
|
7
10
|
export { Slider };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { VariantProps } from 'class-variance-authority';
|
|
2
2
|
declare const typographyVariants: (props?: ({
|
|
3
3
|
variant?: "caption" | "sm" | "lg" | "md" | "xs" | null | undefined;
|
|
4
|
-
color?: "default" | "muted" | null | undefined;
|
|
4
|
+
color?: "default" | "success" | "warning" | "destructive" | "secondary" | "waiting" | "muted" | "primary" | 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> & {
|
|
7
7
|
asChild?: boolean;
|
package/dist/file-upload.cjs
CHANGED
|
@@ -1,18 +1,6 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-BB_1_6y_.cjs"),
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-BB_1_6y_.cjs"),T=require("./button-Day6_fbu.cjs"),w=require("./icon-DPMQJBkA.cjs"),h=require("./typography-Bj8oEDuE.cjs"),g=require("./index-DoxiiusW.cjs"),O=require("react");function U({isDragging:r,isMultiple:a,invalid:s,accept:o,acceptedExtensions:n,maxSizeInMB:x,maxFiles:c,labels:i,onDragOver:j,onDragLeave:b,onDrop:R,onFileChange:u}){return e.jsxRuntimeExports.jsxs("div",{onDragOver:j,onDragLeave:b,onDrop:R,className:g.cn(`
|
|
2
|
+
adm:flex adm:flex-col adm:items-center adm:gap-6 adm:rounded-2xl
|
|
3
|
+
adm:border-2
|
|
4
|
+
`,"adm:border-dashed adm:bg-background adm:p-6 adm:transition-colors",{"adm:border-primary":r&&!s,"adm:border-destructive":s,"adm:border-input":!r&&!s}),children:[e.jsxRuntimeExports.jsx("div",{className:g.cn("adm:flex adm:items-center adm:justify-center adm:rounded-xl adm:p-2.5",s?"adm:bg-destructive/10":"adm:bg-primary-50"),children:e.jsxRuntimeExports.jsx(w.Icon,{symbol:"text_snippet",className:s?"adm:text-destructive":"adm:text-primary"})}),e.jsxRuntimeExports.jsxs("div",{className:"adm:flex adm:flex-col adm:items-center adm:gap-2",children:[e.jsxRuntimeExports.jsx(h.Typography,{color:s?"destructive":void 0,children:i?.dragDrop||(a?"Drag and drop your files here or":"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:o,multiple:a,onChange:u,className:"adm:hidden"}),e.jsxRuntimeExports.jsx(T.Button,{asChild:!0,type:"button",variant:"link",className:"adm:cursor-pointer",children:e.jsxRuntimeExports.jsx("span",{children:i?.selectFile||(a?"Select files":"Select the file")})})]})]}),e.jsxRuntimeExports.jsx(h.Typography,{className:"adm:text-center",color:s?"destructive":"muted",children:i?.fileRequirements||`Allowed files: ${n.join(", ")}. Maximum size ${x} MB${a?`. Up to ${c} files`:""}.`})]})}function V({file:r,invalid:a,onRemove:s}){return e.jsxRuntimeExports.jsxs("div",{className:g.cn("adm:flex adm:items-center adm:gap-4 adm:rounded-2xl adm:border adm:p-6",a?"adm:border-destructive adm:bg-destructive/5":"adm:border-input adm:bg-muted"),children:[e.jsxRuntimeExports.jsx("div",{className:g.cn("adm:flex adm:items-center adm:justify-center adm:rounded-xl adm:p-2.5",a?"adm:bg-destructive/10":"adm:bg-primary-50"),children:e.jsxRuntimeExports.jsx(w.Icon,{symbol:"text_snippet",className:a?"adm:text-destructive":"adm:text-primary"})}),e.jsxRuntimeExports.jsxs("div",{className:`
|
|
5
|
+
adm:flex adm:min-w-0 adm:flex-1 adm:items-start adm:gap-3
|
|
6
|
+
`,children:[e.jsxRuntimeExports.jsx("div",{className:"adm:min-w-0 adm:flex-1",children:e.jsxRuntimeExports.jsx(h.Typography,{className:"adm:truncate adm:font-semibold",children:r.name})}),e.jsxRuntimeExports.jsxs(h.Typography,{className:"adm:shrink-0",color:"muted",children:[(r.size/1024/1024).toFixed(1)," MB"]})]}),e.jsxRuntimeExports.jsx(T.Button,{variant:"destructive-medium",onClick:s,type:"button",children:e.jsxRuntimeExports.jsx(w.Icon,{symbol:"delete",className:"adm:text-destructive"})})]})}function A({files:r,isMultiple:a,invalid:s,labels:o,onRemoveFile:n,onClearAll:x}){return r.length===0?null:e.jsxRuntimeExports.jsxs("div",{className:"adm:flex adm:flex-col adm:gap-3",children:[a&&r.length>1&&e.jsxRuntimeExports.jsxs("div",{className:"adm:flex adm:items-center adm:justify-between",children:[e.jsxRuntimeExports.jsx(h.Typography,{className:"adm:text-sm adm:font-medium",color:s?"destructive":void 0,children:o?.filesSelected?.(r.length)||`${r.length} file${r.length!==1?"s":""} selected`}),e.jsxRuntimeExports.jsx(T.Button,{variant:"ghost",size:"sm",onClick:x,type:"button",children:"Clear all"})]}),r.map((c,i)=>e.jsxRuntimeExports.jsx(V,{file:c,invalid:s,onRemove:()=>n(i)},`${c.name}-${i}`))]})}function _({className:r,selectedFile:a,selectedFiles:s,onFileSelect:o,onFilesSelect:n,onInvalidFile:x,acceptedExtensions:c=[".xls",".xlsx",".numbers"],maxSizeInMB:i=50,maxFiles:j=10,multiple:b=!1,filesPosition:R="below",invalid:u=!1,labels:y,...$}){const[q,E]=O.useState(!1),z=c.join(","),k=i*1024*1024,m=b||s!==void 0||n!==void 0,p=m?s||[]:a?[a]:[],B=t=>{t.preventDefault(),E(!0)},F=t=>{t.preventDefault(),E(!1)},I=t=>{if(t.preventDefault(),E(!1),m){const l=Array.from(t.dataTransfer.files).filter(v);if(l.length>0){const C=[...s||[],...l].slice(0,j);n&&n(C)}}else{const d=t.dataTransfer.files[0];d&&v(d)&&o&&o(d)}},L=t=>{if(m){const l=(t.target.files?Array.from(t.target.files):[]).filter(v);if(l.length>0){const C=[...s||[],...l].slice(0,j);n&&n(C)}}else{const d=t.target.files?.[0];d&&v(d)&&o&&o(d)}t.target.value=""},N=t=>{if(m){const d=p.filter((l,f)=>f!==t);n&&n(d)}else o&&o(null)},v=t=>{const d=t.name.substring(t.name.lastIndexOf(".")),l=c.includes(d.toLowerCase()),f=t.size<=k;return!l&&x?x(t,"extension"):!f&&x&&x(t,"size"),l&&f},D=()=>{m?n&&n([]):o&&o(null)};return e.jsxRuntimeExports.jsxs("div",{className:g.cn("adm:flex adm:flex-col adm:gap-4",r),...$,children:[m&&R==="above"&&e.jsxRuntimeExports.jsx(A,{files:p,isMultiple:m,invalid:u,labels:y,onRemoveFile:N,onClearAll:D}),(m||p.length===0)&&e.jsxRuntimeExports.jsx(U,{isDragging:q,isMultiple:m,invalid:u,accept:z,acceptedExtensions:c,maxSizeInMB:i,maxFiles:j,labels:y,onDragOver:B,onDragLeave:F,onDrop:I,onFileChange:L}),!m&&p.length>0&&e.jsxRuntimeExports.jsx(A,{files:p,isMultiple:m,invalid:u,labels:y,onRemoveFile:N,onClearAll:D}),m&&R==="below"&&e.jsxRuntimeExports.jsx(A,{files:p,isMultiple:m,invalid:u,labels:y,onRemoveFile:N,onClearAll:D})]})}exports.FileUpload=_;
|
package/dist/file-upload.js
CHANGED
|
@@ -1,146 +1,276 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-BzflLqGi.js";
|
|
2
|
-
import { B as
|
|
3
|
-
import { I as
|
|
4
|
-
import { T as
|
|
5
|
-
import { c as
|
|
6
|
-
import { useState as
|
|
7
|
-
function
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
2
|
+
import { B as z } from "./button-Bn4LFAa9.js";
|
|
3
|
+
import { I as R } from "./icon-DKAhvlX_.js";
|
|
4
|
+
import { T as g } from "./typography-MnY0LQoZ.js";
|
|
5
|
+
import { c as j } from "./index-CRiPKpXj.js";
|
|
6
|
+
import { useState as _ } from "react";
|
|
7
|
+
function U({
|
|
8
|
+
isDragging: s,
|
|
9
|
+
isMultiple: t,
|
|
10
|
+
invalid: r,
|
|
11
|
+
accept: l,
|
|
12
|
+
acceptedExtensions: d,
|
|
13
|
+
maxSizeInMB: c,
|
|
14
|
+
maxFiles: f,
|
|
15
|
+
labels: o,
|
|
16
|
+
onDragOver: h,
|
|
17
|
+
onDragLeave: N,
|
|
18
|
+
onDrop: v,
|
|
19
|
+
onFileChange: u
|
|
15
20
|
}) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
21
|
+
return /* @__PURE__ */ e.jsxs(
|
|
22
|
+
"div",
|
|
23
|
+
{
|
|
24
|
+
onDragOver: h,
|
|
25
|
+
onDragLeave: N,
|
|
26
|
+
onDrop: v,
|
|
27
|
+
className: j(
|
|
28
|
+
`
|
|
29
|
+
adm:flex adm:flex-col adm:items-center adm:gap-6 adm:rounded-2xl
|
|
30
|
+
adm:border-2
|
|
31
|
+
`,
|
|
32
|
+
"adm:border-dashed adm:bg-background adm:p-6 adm:transition-colors",
|
|
33
|
+
{
|
|
34
|
+
"adm:border-primary": s && !r,
|
|
35
|
+
"adm:border-destructive": r,
|
|
36
|
+
"adm:border-input": !s && !r
|
|
37
|
+
}
|
|
38
|
+
),
|
|
39
|
+
children: [
|
|
40
|
+
/* @__PURE__ */ e.jsx(
|
|
41
|
+
"div",
|
|
42
|
+
{
|
|
43
|
+
className: j(
|
|
44
|
+
"adm:flex adm:items-center adm:justify-center adm:rounded-xl adm:p-2.5",
|
|
45
|
+
r ? "adm:bg-destructive/10" : "adm:bg-primary-50"
|
|
46
|
+
),
|
|
47
|
+
children: /* @__PURE__ */ e.jsx(
|
|
48
|
+
R,
|
|
49
|
+
{
|
|
50
|
+
symbol: "text_snippet",
|
|
51
|
+
className: r ? "adm:text-destructive" : "adm:text-primary"
|
|
52
|
+
}
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
),
|
|
56
|
+
/* @__PURE__ */ e.jsxs("div", { className: "adm:flex adm:flex-col adm:items-center adm:gap-2", children: [
|
|
57
|
+
/* @__PURE__ */ e.jsx(g, { color: r ? "destructive" : void 0, children: o?.dragDrop || (t ? "Drag and drop your files here or" : "Drag and drop your file here or") }),
|
|
58
|
+
/* @__PURE__ */ e.jsxs("label", { htmlFor: "file-upload", children: [
|
|
59
|
+
/* @__PURE__ */ e.jsx(
|
|
60
|
+
"input",
|
|
61
|
+
{
|
|
62
|
+
id: "file-upload",
|
|
63
|
+
type: "file",
|
|
64
|
+
accept: l,
|
|
65
|
+
multiple: t,
|
|
66
|
+
onChange: u,
|
|
67
|
+
className: "adm:hidden"
|
|
68
|
+
}
|
|
69
|
+
),
|
|
70
|
+
/* @__PURE__ */ e.jsx(
|
|
71
|
+
z,
|
|
72
|
+
{
|
|
73
|
+
asChild: !0,
|
|
74
|
+
type: "button",
|
|
75
|
+
variant: "link",
|
|
76
|
+
className: "adm:cursor-pointer",
|
|
77
|
+
children: /* @__PURE__ */ e.jsx("span", { children: o?.selectFile || (t ? "Select files" : "Select the file") })
|
|
78
|
+
}
|
|
79
|
+
)
|
|
80
|
+
] })
|
|
81
|
+
] }),
|
|
82
|
+
/* @__PURE__ */ e.jsx(g, { className: "adm:text-center", color: r ? "destructive" : "muted", children: o?.fileRequirements || `Allowed files: ${d.join(", ")}. Maximum size ${c} MB${t ? `. Up to ${f} files` : ""}.` })
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
function q({ file: s, invalid: t, onRemove: r }) {
|
|
88
|
+
return /* @__PURE__ */ e.jsxs(
|
|
89
|
+
"div",
|
|
90
|
+
{
|
|
91
|
+
className: j(
|
|
92
|
+
"adm:flex adm:items-center adm:gap-4 adm:rounded-2xl adm:border adm:p-6",
|
|
93
|
+
t ? "adm:border-destructive adm:bg-destructive/5" : "adm:border-input adm:bg-muted"
|
|
94
|
+
),
|
|
95
|
+
children: [
|
|
96
|
+
/* @__PURE__ */ e.jsx(
|
|
97
|
+
"div",
|
|
98
|
+
{
|
|
99
|
+
className: j(
|
|
100
|
+
"adm:flex adm:items-center adm:justify-center adm:rounded-xl adm:p-2.5",
|
|
101
|
+
t ? "adm:bg-destructive/10" : "adm:bg-primary-50"
|
|
102
|
+
),
|
|
103
|
+
children: /* @__PURE__ */ e.jsx(
|
|
104
|
+
R,
|
|
105
|
+
{
|
|
106
|
+
symbol: "text_snippet",
|
|
107
|
+
className: t ? "adm:text-destructive" : "adm:text-primary"
|
|
108
|
+
}
|
|
109
|
+
)
|
|
110
|
+
}
|
|
111
|
+
),
|
|
112
|
+
/* @__PURE__ */ e.jsxs(
|
|
113
|
+
"div",
|
|
114
|
+
{
|
|
115
|
+
className: `
|
|
116
|
+
adm:flex adm:min-w-0 adm:flex-1 adm:items-start adm:gap-3
|
|
117
|
+
`,
|
|
118
|
+
children: [
|
|
119
|
+
/* @__PURE__ */ e.jsx("div", { className: "adm:min-w-0 adm:flex-1", children: /* @__PURE__ */ e.jsx(g, { className: "adm:truncate adm:font-semibold", children: s.name }) }),
|
|
120
|
+
/* @__PURE__ */ e.jsxs(g, { className: "adm:shrink-0", color: "muted", children: [
|
|
121
|
+
(s.size / 1024 / 1024).toFixed(1),
|
|
122
|
+
" MB"
|
|
123
|
+
] })
|
|
124
|
+
]
|
|
125
|
+
}
|
|
126
|
+
),
|
|
127
|
+
/* @__PURE__ */ e.jsx(
|
|
128
|
+
z,
|
|
129
|
+
{
|
|
130
|
+
variant: "destructive-medium",
|
|
131
|
+
onClick: r,
|
|
132
|
+
type: "button",
|
|
133
|
+
children: /* @__PURE__ */ e.jsx(R, { symbol: "delete", className: "adm:text-destructive" })
|
|
134
|
+
}
|
|
135
|
+
)
|
|
136
|
+
]
|
|
137
|
+
}
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
function $({ files: s, isMultiple: t, invalid: r, labels: l, onRemoveFile: d, onClearAll: c }) {
|
|
141
|
+
return s.length === 0 ? null : /* @__PURE__ */ e.jsxs("div", { className: "adm:flex adm:flex-col adm:gap-3", children: [
|
|
142
|
+
t && s.length > 1 && /* @__PURE__ */ e.jsxs("div", { className: "adm:flex adm:items-center adm:justify-between", children: [
|
|
143
|
+
/* @__PURE__ */ e.jsx(g, { className: "adm:text-sm adm:font-medium", color: r ? "destructive" : void 0, children: l?.filesSelected?.(s.length) || `${s.length} file${s.length !== 1 ? "s" : ""} selected` }),
|
|
144
|
+
/* @__PURE__ */ e.jsx(
|
|
145
|
+
z,
|
|
146
|
+
{
|
|
147
|
+
variant: "ghost",
|
|
148
|
+
size: "sm",
|
|
149
|
+
onClick: c,
|
|
150
|
+
type: "button",
|
|
151
|
+
children: "Clear all"
|
|
152
|
+
}
|
|
153
|
+
)
|
|
154
|
+
] }),
|
|
155
|
+
s.map((f, o) => /* @__PURE__ */ e.jsx(
|
|
156
|
+
q,
|
|
157
|
+
{
|
|
158
|
+
file: f,
|
|
159
|
+
invalid: r,
|
|
160
|
+
onRemove: () => d(o)
|
|
161
|
+
},
|
|
162
|
+
`${f.name}-${o}`
|
|
163
|
+
))
|
|
164
|
+
] });
|
|
165
|
+
}
|
|
166
|
+
function Q({
|
|
167
|
+
className: s,
|
|
168
|
+
selectedFile: t,
|
|
169
|
+
selectedFiles: r,
|
|
170
|
+
onFileSelect: l,
|
|
171
|
+
onFilesSelect: d,
|
|
172
|
+
onInvalidFile: c,
|
|
173
|
+
acceptedExtensions: f = [".xls", ".xlsx", ".numbers"],
|
|
174
|
+
maxSizeInMB: o = 50,
|
|
175
|
+
maxFiles: h = 10,
|
|
176
|
+
multiple: N = !1,
|
|
177
|
+
filesPosition: v = "below",
|
|
178
|
+
invalid: u = !1,
|
|
179
|
+
labels: b,
|
|
180
|
+
...k
|
|
181
|
+
}) {
|
|
182
|
+
const [B, D] = _(!1), L = f.join(","), T = o * 1024 * 1024, m = N || r !== void 0 || d !== void 0, x = m ? r || [] : t ? [t] : [], F = (a) => {
|
|
183
|
+
a.preventDefault(), D(!0);
|
|
184
|
+
}, I = (a) => {
|
|
185
|
+
a.preventDefault(), D(!1);
|
|
186
|
+
}, O = (a) => {
|
|
187
|
+
if (a.preventDefault(), D(!1), m) {
|
|
188
|
+
const i = Array.from(a.dataTransfer.files).filter(y);
|
|
189
|
+
if (i.length > 0) {
|
|
190
|
+
const w = [...r || [], ...i].slice(0, h);
|
|
191
|
+
d && d(w);
|
|
192
|
+
}
|
|
193
|
+
} else {
|
|
194
|
+
const n = a.dataTransfer.files[0];
|
|
195
|
+
n && y(n) && l && l(n);
|
|
196
|
+
}
|
|
197
|
+
}, V = (a) => {
|
|
198
|
+
if (m) {
|
|
199
|
+
const i = (a.target.files ? Array.from(a.target.files) : []).filter(y);
|
|
200
|
+
if (i.length > 0) {
|
|
201
|
+
const w = [...r || [], ...i].slice(0, h);
|
|
202
|
+
d && d(w);
|
|
203
|
+
}
|
|
204
|
+
} else {
|
|
205
|
+
const n = a.target.files?.[0];
|
|
206
|
+
n && y(n) && l && l(n);
|
|
207
|
+
}
|
|
208
|
+
a.target.value = "";
|
|
209
|
+
}, C = (a) => {
|
|
210
|
+
if (m) {
|
|
211
|
+
const n = x.filter((i, p) => p !== a);
|
|
212
|
+
d && d(n);
|
|
213
|
+
} else
|
|
214
|
+
l && l(null);
|
|
20
215
|
}, y = (a) => {
|
|
21
|
-
a.
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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;
|
|
216
|
+
const n = a.name.substring(a.name.lastIndexOf(".")), i = f.includes(n.toLowerCase()), p = a.size <= T;
|
|
217
|
+
return !i && c ? c(a, "extension") : !p && c && c(a, "size"), i && p;
|
|
218
|
+
}, A = () => {
|
|
219
|
+
m ? d && d([]) : l && l(null);
|
|
32
220
|
};
|
|
33
|
-
return /* @__PURE__ */ e.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"div",
|
|
221
|
+
return /* @__PURE__ */ e.jsxs("div", { className: j("adm:flex adm:flex-col adm:gap-4", s), ...k, children: [
|
|
222
|
+
m && v === "above" && /* @__PURE__ */ e.jsx(
|
|
223
|
+
$,
|
|
37
224
|
{
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
-
]
|
|
225
|
+
files: x,
|
|
226
|
+
isMultiple: m,
|
|
227
|
+
invalid: u,
|
|
228
|
+
labels: b,
|
|
229
|
+
onRemoveFile: C,
|
|
230
|
+
onClearAll: A
|
|
78
231
|
}
|
|
79
|
-
)
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
/* @__PURE__ */ e.jsxs(
|
|
83
|
-
"div",
|
|
232
|
+
),
|
|
233
|
+
(m || x.length === 0) && /* @__PURE__ */ e.jsx(
|
|
234
|
+
U,
|
|
84
235
|
{
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
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
|
-
]
|
|
236
|
+
isDragging: B,
|
|
237
|
+
isMultiple: m,
|
|
238
|
+
invalid: u,
|
|
239
|
+
accept: L,
|
|
240
|
+
acceptedExtensions: f,
|
|
241
|
+
maxSizeInMB: o,
|
|
242
|
+
maxFiles: h,
|
|
243
|
+
labels: b,
|
|
244
|
+
onDragOver: F,
|
|
245
|
+
onDragLeave: I,
|
|
246
|
+
onDrop: O,
|
|
247
|
+
onFileChange: V
|
|
248
|
+
}
|
|
249
|
+
),
|
|
250
|
+
!m && x.length > 0 && /* @__PURE__ */ e.jsx(
|
|
251
|
+
$,
|
|
252
|
+
{
|
|
253
|
+
files: x,
|
|
254
|
+
isMultiple: m,
|
|
255
|
+
invalid: u,
|
|
256
|
+
labels: b,
|
|
257
|
+
onRemoveFile: C,
|
|
258
|
+
onClearAll: A
|
|
259
|
+
}
|
|
260
|
+
),
|
|
261
|
+
m && v === "below" && /* @__PURE__ */ e.jsx(
|
|
262
|
+
$,
|
|
263
|
+
{
|
|
264
|
+
files: x,
|
|
265
|
+
isMultiple: m,
|
|
266
|
+
invalid: u,
|
|
267
|
+
labels: b,
|
|
268
|
+
onRemoveFile: C,
|
|
269
|
+
onClearAll: A
|
|
140
270
|
}
|
|
141
271
|
)
|
|
142
|
-
|
|
272
|
+
] });
|
|
143
273
|
}
|
|
144
274
|
export {
|
|
145
|
-
|
|
275
|
+
Q as FileUpload
|
|
146
276
|
};
|
package/dist/slider.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./jsx-runtime-BB_1_6y_.cjs"),ce=require("react"),F=require("./index-C8ni3LLa.cjs"),P=require("./index-BWaO7kQK.cjs"),_=require("./index-_XxjJPRD.cjs"),ue=require("./index-cwZN7ZY3.cjs"),Y=require("./index-Da298sEl.cjs"),me=require("./index-DYxWvftI.cjs"),fe=require("./index-bSPhqlcX.cjs"),I=require("./index-CocSS1YK.cjs"),N=require("./index-DoxiiusW.cjs");function pe(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const l=pe(ce);var X=["PageUp","PageDown"],G=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],W={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},C="Slider",[V,xe,he]=Y.createCollection(C),[J]=ue.createContextScope(C,[he]),[Se,T]=J(C),Q=l.forwardRef((e,t)=>{const{name:n,min:o=0,max:i=100,step:d=1,orientation:r="horizontal",disabled:a=!1,minStepsBetweenThumbs:c=0,defaultValue:S=[o],value:p,onValueChange:s=()=>{},onValueCommit:m=()=>{},inverted:v=!1,form:w,...g}=e,x=l.useRef(new Set),f=l.useRef(0),b=r==="horizontal"?ge:ve,[h=[],M]=P.useControllableState({prop:p,defaultProp:S,onChange:R=>{[...x.current][f.current]?.focus(),s(R)}}),k=l.useRef(h);function B(R){const E=ye(h,R);A(R,E)}function de(R){A(R,f.current)}function le(){const R=k.current[f.current];h[f.current]!==R&&m(h)}function A(R,E,{commit:z}={commit:!1}){const L=_e(d),H=Ce(Math.round((R-o)/d)*d+o,L),K=F.clamp(H,[o,i]);M((D=[])=>{const y=we(D,K,E);if(De(y,c*d)){f.current=y.indexOf(K);const U=String(y)!==String(D);return U&&z&&m(y),U?y:D}else return D})}return u.jsxRuntimeExports.jsx(Se,{scope:e.__scopeSlider,name:n,disabled:a,min:o,max:i,valueIndexToChangeRef:f,thumbs:x.current,values:h,orientation:r,form:w,children:u.jsxRuntimeExports.jsx(V.Provider,{scope:e.__scopeSlider,children:u.jsxRuntimeExports.jsx(V.Slot,{scope:e.__scopeSlider,children:u.jsxRuntimeExports.jsx(b,{"aria-disabled":a,"data-disabled":a?"":void 0,...g,ref:t,onPointerDown:P.composeEventHandlers(g.onPointerDown,()=>{a||(k.current=h)}),min:o,max:i,inverted:v,onSlideStart:a?void 0:B,onSlideMove:a?void 0:de,onSlideEnd:a?void 0:le,onHomeKeyDown:()=>!a&&A(o,0,{commit:!0}),onEndKeyDown:()=>!a&&A(i,h.length-1,{commit:!0}),onStepKeyDown:({event:R,direction:E})=>{if(!a){const H=X.includes(R.key)||R.shiftKey&&G.includes(R.key)?10:1,K=f.current,D=h[K],y=d*H*E;A(D+y,K,{commit:!0})}}})})})})});Q.displayName=C;var[Z,ee]=J(C,{startEdge:"left",endEdge:"right",size:"width",direction:1}),ge=l.forwardRef((e,t)=>{const{min:n,max:o,dir:i,inverted:d,onSlideStart:r,onSlideMove:a,onSlideEnd:c,onStepKeyDown:S,...p}=e,[s,m]=l.useState(null),v=_.useComposedRefs(t,b=>m(b)),w=l.useRef(void 0),g=Y.useDirection(i),x=g==="ltr",f=x&&!d||!x&&d;function j(b){const h=w.current||s.getBoundingClientRect(),M=[0,h.width],B=q(M,f?[n,o]:[o,n]);return w.current=h,B(b-h.left)}return u.jsxRuntimeExports.jsx(Z,{scope:e.__scopeSlider,startEdge:f?"left":"right",endEdge:f?"right":"left",direction:f?1:-1,size:"width",children:u.jsxRuntimeExports.jsx(te,{dir:g,"data-orientation":"horizontal",...p,ref:v,style:{...p.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:b=>{const h=j(b.clientX);r?.(h)},onSlideMove:b=>{const h=j(b.clientX);a?.(h)},onSlideEnd:()=>{w.current=void 0,c?.()},onStepKeyDown:b=>{const M=W[f?"from-left":"from-right"].includes(b.key);S?.({event:b,direction:M?-1:1})}})})}),ve=l.forwardRef((e,t)=>{const{min:n,max:o,inverted:i,onSlideStart:d,onSlideMove:r,onSlideEnd:a,onStepKeyDown:c,...S}=e,p=l.useRef(null),s=_.useComposedRefs(t,p),m=l.useRef(void 0),v=!i;function w(g){const x=m.current||p.current.getBoundingClientRect(),f=[0,x.height],b=q(f,v?[o,n]:[n,o]);return m.current=x,b(g-x.top)}return u.jsxRuntimeExports.jsx(Z,{scope:e.__scopeSlider,startEdge:v?"bottom":"top",endEdge:v?"top":"bottom",size:"height",direction:v?1:-1,children:u.jsxRuntimeExports.jsx(te,{"data-orientation":"vertical",...S,ref:s,style:{...S.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:g=>{const x=w(g.clientY);d?.(x)},onSlideMove:g=>{const x=w(g.clientY);r?.(x)},onSlideEnd:()=>{m.current=void 0,a?.()},onStepKeyDown:g=>{const f=W[v?"from-bottom":"from-top"].includes(g.key);c?.({event:g,direction:f?-1:1})}})})}),te=l.forwardRef((e,t)=>{const{__scopeSlider:n,onSlideStart:o,onSlideMove:i,onSlideEnd:d,onHomeKeyDown:r,onEndKeyDown:a,onStepKeyDown:c,...S}=e,p=T(C,n);return u.jsxRuntimeExports.jsx(I.Primitive.span,{...S,ref:t,onKeyDown:P.composeEventHandlers(e.onKeyDown,s=>{s.key==="Home"?(r(s),s.preventDefault()):s.key==="End"?(a(s),s.preventDefault()):X.concat(G).includes(s.key)&&(c(s),s.preventDefault())}),onPointerDown:P.composeEventHandlers(e.onPointerDown,s=>{const m=s.target;m.setPointerCapture(s.pointerId),s.preventDefault(),p.thumbs.has(m)?m.focus():o(s)}),onPointerMove:P.composeEventHandlers(e.onPointerMove,s=>{s.target.hasPointerCapture(s.pointerId)&&i(s)}),onPointerUp:P.composeEventHandlers(e.onPointerUp,s=>{const m=s.target;m.hasPointerCapture(s.pointerId)&&(m.releasePointerCapture(s.pointerId),d(s))})})}),ne="SliderTrack",oe=l.forwardRef((e,t)=>{const{__scopeSlider:n,...o}=e,i=T(ne,n);return u.jsxRuntimeExports.jsx(I.Primitive.span,{"data-disabled":i.disabled?"":void 0,"data-orientation":i.orientation,...o,ref:t})});oe.displayName=ne;var O="SliderRange",re=l.forwardRef((e,t)=>{const{__scopeSlider:n,...o}=e,i=T(O,n),d=ee(O,n),r=l.useRef(null),a=_.useComposedRefs(t,r),c=i.values.length,S=i.values.map(m=>ae(m,i.min,i.max)),p=c>1?Math.min(...S):0,s=100-Math.max(...S);return u.jsxRuntimeExports.jsx(I.Primitive.span,{"data-orientation":i.orientation,"data-disabled":i.disabled?"":void 0,...o,ref:a,style:{...e.style,[d.startEdge]:p+"%",[d.endEdge]:s+"%"}})});re.displayName=O;var $="SliderThumb",ie=l.forwardRef((e,t)=>{const n=xe(e.__scopeSlider),[o,i]=l.useState(null),d=_.useComposedRefs(t,a=>i(a)),r=l.useMemo(()=>o?n().findIndex(a=>a.ref.current===o):-1,[n,o]);return u.jsxRuntimeExports.jsx(be,{...e,ref:d,index:r})}),be=l.forwardRef((e,t)=>{const{__scopeSlider:n,index:o,name:i,...d}=e,r=T($,n),a=ee($,n),[c,S]=l.useState(null),p=_.useComposedRefs(t,j=>S(j)),s=c?r.form||!!c.closest("form"):!0,m=fe.useSize(c),v=r.values[o],w=v===void 0?0:ae(v,r.min,r.max),g=Ee(o,r.values.length),x=m?.[a.size],f=x?Pe(x,w,a.direction):0;return l.useEffect(()=>{if(c)return r.thumbs.add(c),()=>{r.thumbs.delete(c)}},[c,r.thumbs]),u.jsxRuntimeExports.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[a.startEdge]:`calc(${w}% + ${f}px)`},children:[u.jsxRuntimeExports.jsx(V.ItemSlot,{scope:e.__scopeSlider,children:u.jsxRuntimeExports.jsx(I.Primitive.span,{role:"slider","aria-label":e["aria-label"]||g,"aria-valuemin":r.min,"aria-valuenow":v,"aria-valuemax":r.max,"aria-orientation":r.orientation,"data-orientation":r.orientation,"data-disabled":r.disabled?"":void 0,tabIndex:r.disabled?void 0:0,...d,ref:p,style:v===void 0?{display:"none"}:e.style,onFocus:P.composeEventHandlers(e.onFocus,()=>{r.valueIndexToChangeRef.current=o})})}),s&&u.jsxRuntimeExports.jsx(se,{name:i??(r.name?r.name+(r.values.length>1?"[]":""):void 0),form:r.form,value:v},o)]})});ie.displayName=$;var Re="RadioBubbleInput",se=l.forwardRef(({__scopeSlider:e,value:t,...n},o)=>{const i=l.useRef(null),d=_.useComposedRefs(i,o),r=me.usePrevious(t);return l.useEffect(()=>{const a=i.current;if(!a)return;const c=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(c,"value").set;if(r!==t&&p){const s=new Event("input",{bubbles:!0});p.call(a,t),a.dispatchEvent(s)}},[r,t]),u.jsxRuntimeExports.jsx(I.Primitive.input,{style:{display:"none"},...n,ref:d,defaultValue:t})});se.displayName=Re;function we(e=[],t,n){const o=[...e];return o[n]=t,o.sort((i,d)=>i-d)}function ae(e,t,n){const d=100/(n-t)*(e-t);return F.clamp(d,[0,100])}function Ee(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function ye(e,t){if(e.length===1)return 0;const n=e.map(i=>Math.abs(i-t)),o=Math.min(...n);return n.indexOf(o)}function Pe(e,t,n){const o=e/2,d=q([0,50],[0,o]);return(o-d(t)*n)*n}function je(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}function De(e,t){if(t>0){const n=je(e);return Math.min(...n)>=t}return!0}function q(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const o=(t[1]-t[0])/(e[1]-e[0]);return t[0]+o*(n-e[0])}}function _e(e){return(String(e).split(".")[1]||"").length}function Ce(e,t){const n=Math.pow(10,t);return Math.round(e*n)/n}var Me=Q,Ae=oe,Ke=re,Ie=ie;function Te({className:e,defaultValue:t,value:n,min:o=0,max:i=100,theme:d,color:r,...a}){const c=l.useMemo(()=>Array.isArray(n)?n:Array.isArray(t)?t:[o,i],[n,t,o,i]),S=l.useMemo(()=>{if(r){if(r==="full")return{background:"linear-gradient(to right, #ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ff0000)"};if(Array.isArray(r)&&r.length===2)return{background:`linear-gradient(to right, ${r[0]}, ${r[1]})`}}},[r]);return u.jsxRuntimeExports.jsxs(Me,{"data-slot":"slider","data-theme":d,defaultValue:t,value:n,min:o,max:i,className:N.cn(`
|
|
2
2
|
adm:relative adm:flex adm:w-full adm:touch-none adm:items-center
|
|
3
3
|
adm:select-none
|
|
4
4
|
adm:data-[disabled]:opacity-50
|
|
@@ -6,22 +6,21 @@
|
|
|
6
6
|
adm:data-[orientation=vertical]:min-h-44
|
|
7
7
|
adm:data-[orientation=vertical]:w-auto
|
|
8
8
|
adm:data-[orientation=vertical]:flex-col
|
|
9
|
-
`,e),...
|
|
9
|
+
`,e),...a,children:[u.jsxRuntimeExports.jsx(Ae,{"data-slot":"slider-track",className:N.cn(`
|
|
10
10
|
adm:relative adm:grow adm:overflow-hidden adm:rounded-full
|
|
11
|
-
adm:bg-muted
|
|
12
11
|
adm:data-[orientation=horizontal]:h-1.5
|
|
13
12
|
adm:data-[orientation=horizontal]:w-full
|
|
14
13
|
adm:data-[orientation=vertical]:h-full
|
|
15
14
|
adm:data-[orientation=vertical]:w-1.5
|
|
16
|
-
|
|
17
|
-
adm:absolute
|
|
15
|
+
`,r?"":"adm:bg-muted"),style:r?S:void 0,children:u.jsxRuntimeExports.jsx(Ke,{"data-slot":"slider-range",className:N.cn(`
|
|
16
|
+
adm:absolute
|
|
18
17
|
adm:data-[orientation=horizontal]:h-full
|
|
19
18
|
adm:data-[orientation=vertical]:w-full
|
|
20
|
-
|
|
19
|
+
`,r?"adm:bg-transparent":"adm:bg-primary")})}),Array.from({length:c.length},(p,s)=>u.jsxRuntimeExports.jsx(Ie,{"data-slot":"slider-thumb",className:`
|
|
21
20
|
adm:block adm:size-4 adm:shrink-0 adm:rounded-full adm:border
|
|
22
21
|
adm:border-primary adm:bg-white adm:shadow-sm adm:ring-ring/50
|
|
23
22
|
adm:transition-[color,box-shadow]
|
|
24
23
|
adm:hover:ring-4
|
|
25
24
|
adm:focus-visible:ring-4 adm:focus-visible:outline-hidden
|
|
26
25
|
adm:disabled:pointer-events-none adm:disabled:opacity-50
|
|
27
|
-
`},
|
|
26
|
+
`},s))]})}exports.Slider=Te;
|