@me1a/ui 2.2.6 → 2.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dnd-input/index.d.mts +49 -0
- package/dist/dnd-input/index.mjs +2 -0
- package/dist/dnd-input/index.mjs.map +1 -0
- package/dist/index.d.mts +47 -1
- package/dist/index.mjs +3 -0
- package/dist/index.mjs.map +1 -1
- package/dist/rhf-dnd-input/index.d.mts +87 -0
- package/dist/rhf-dnd-input/index.mjs +2 -0
- package/dist/rhf-dnd-input/index.mjs.map +1 -0
- package/dist/scroll-area/index.d.mts +32 -0
- package/dist/scroll-area/index.mjs +2 -0
- package/dist/scroll-area/index.mjs.map +1 -0
- package/package.json +15 -1
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { FieldValues, FieldPath, RegisterOptions } from 'react-hook-form';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { DropzoneOptions } from 'react-dropzone';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Props interface for the DndInput component.
|
|
8
|
+
* Extends react-dropzone's DropzoneOptions to provide file drag-and-drop functionality.
|
|
9
|
+
*
|
|
10
|
+
* @url https://sergii-melnykov.github.io/ui/?path=/docs/atoms-dnd-input--docs
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* <DndInput
|
|
15
|
+
* onDrop={(acceptedFiles) => console.log(acceptedFiles)}
|
|
16
|
+
* accept={{ 'image/*': ['.png', '.jpg'] }}
|
|
17
|
+
* >
|
|
18
|
+
* <CustomUploadContent />
|
|
19
|
+
* </DndInput>
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
interface DndInputProps extends DropzoneOptions {
|
|
23
|
+
/** Additional CSS class name for styling the dropzone container */
|
|
24
|
+
className?: string;
|
|
25
|
+
/** Custom content to render inside the dropzone. If not provided, a default upload UI will be shown */
|
|
26
|
+
children?: React.ReactNode;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Props interface for the RhfDndInput component.
|
|
31
|
+
* Extends DndInputProps to add React Hook Form specific properties.
|
|
32
|
+
*
|
|
33
|
+
* @url https://sergii-melnykov.github.io/ui/?path=/docs/atoms-dnd-input--docs
|
|
34
|
+
*/
|
|
35
|
+
interface RhfDndInputProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> extends Omit<DndInputProps, "name"> {
|
|
36
|
+
/** The name of the form field */
|
|
37
|
+
name: TName;
|
|
38
|
+
/** React Hook Form validation rules */
|
|
39
|
+
rules?: RegisterOptions<TFieldValues, TName>;
|
|
40
|
+
/** Label text for the form field */
|
|
41
|
+
label?: string;
|
|
42
|
+
/** Description text for the form field */
|
|
43
|
+
description?: string;
|
|
44
|
+
/** Whether the field is required */
|
|
45
|
+
required?: boolean;
|
|
46
|
+
/** Whether the field is disabled */
|
|
47
|
+
disabled?: boolean;
|
|
48
|
+
/** ARIA label for accessibility */
|
|
49
|
+
"aria-label"?: string;
|
|
50
|
+
/** ARIA describedby for accessibility */
|
|
51
|
+
"aria-describedby"?: string;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* RhfDndInput is a React Hook Form wrapper around the DndInput component.
|
|
56
|
+
* It provides form integration with validation and error handling.
|
|
57
|
+
*
|
|
58
|
+
* @url https://sergii-melnykov.github.io/ui/?path=/docs/atoms-dnd-input--docs
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```tsx
|
|
62
|
+
* // Basic usage with React Hook Form
|
|
63
|
+
* <Form>
|
|
64
|
+
* <RhfDndInput
|
|
65
|
+
* name="files"
|
|
66
|
+
* label="Upload Files"
|
|
67
|
+
* rules={{ required: "Please upload a file" }}
|
|
68
|
+
* />
|
|
69
|
+
* </Form>
|
|
70
|
+
*
|
|
71
|
+
* // With file type restrictions
|
|
72
|
+
* <Form>
|
|
73
|
+
* <RhfDndInput
|
|
74
|
+
* name="files"
|
|
75
|
+
* label="Upload Images"
|
|
76
|
+
* accept={{ 'image/*': ['.png', '.jpg'] }}
|
|
77
|
+
* rules={{
|
|
78
|
+
* required: "Please upload a file",
|
|
79
|
+
* validate: (files) => files.length > 0 || "At least one file is required"
|
|
80
|
+
* }}
|
|
81
|
+
* />
|
|
82
|
+
* </Form>
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
declare function RhfDndInput<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ name, label, description, className, required, disabled, "aria-label": ariaLabel, "aria-describedby": ariaDescribedby, ...other }: RhfDndInputProps<TFieldValues, TName>): react_jsx_runtime.JSX.Element;
|
|
86
|
+
|
|
87
|
+
export { RhfDndInput, type RhfDndInputProps };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{useFormContext as O}from"react-hook-form";import{useDropzone as A}from"react-dropzone";import{clsx as S}from"clsx";import{twMerge as $}from"tailwind-merge";function m(...e){return $(S(e))}import{UploadIcon as W}from"lucide-react";import{Fragment as z,jsx as F,jsxs as I}from"react/jsx-runtime";var U=I(z,{children:[F(W,{className:"text-blue-600 mr-2","aria-hidden":"true"}),I("span",{children:[F("span",{className:"underline",children:"Upload"})," or drop a file right here"]}),F("span",{className:"ml-auto text-gray-400 text-sm",children:"all file types"})]}),h=({onDrop:e,accept:o,className:t,children:r,...a})=>{let{getRootProps:s,getInputProps:n,isDragActive:C,isFocused:c}=A({onDrop:e,accept:o,...a});return I("div",{...s({className:m("flex items-center border-2 border-dashed border-blue-500 rounded-lg p-4 cursor-pointer transition-colors",t,C?"bg-blue-50 border-blue-700":"",c?"ring-2 ring-blue-400":""),"aria-label":"File upload area",tabIndex:0,role:"button"}),"data-testid":"dnd-input",children:[F("input",{...n()}),r||U]})};import*as i from"react";import{Slot as G}from"@radix-ui/react-slot";import{Controller as J,FormProvider as ce,useFormContext as K}from"react-hook-form";import*as T from"react";import*as V from"@radix-ui/react-label";import{cva as k}from"class-variance-authority";import{jsx as B}from"react/jsx-runtime";var q=k("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),f=T.forwardRef(({className:e,...o},t)=>B(V.Root,{ref:t,className:m(q(),e),...o}));f.displayName=V.Root.displayName;import{jsx as l}from"react/jsx-runtime";var N=i.createContext({}),g=({...e})=>l(N.Provider,{value:{name:e.name},children:l(J,{...e})}),p=()=>{let e=i.useContext(N),o=i.useContext(D),{getFieldState:t,formState:r}=K(),a=t(e.name,r);if(!e)throw new Error("useFormField should be used within <FormField>");let{id:s}=o;return{id:s,name:e.name,formItemId:`${s}-form-item`,formDescriptionId:`${s}-form-item-description`,formMessageId:`${s}-form-item-message`,...a}},D=i.createContext({}),b=i.forwardRef(({className:e,...o},t)=>{let r=i.useId();return l(D.Provider,{value:{id:r},children:l("div",{ref:t,className:m("space-y-2",e),...o})})});b.displayName="FormItem";var x=i.forwardRef(({className:e,...o},t)=>{let{error:r,formItemId:a}=p();return l(f,{ref:t,className:m(r&&"text-destructive",e),htmlFor:a,...o})});x.displayName="FormLabel";var P=i.forwardRef(({...e},o)=>{let{error:t,formItemId:r,formDescriptionId:a,formMessageId:s}=p();return l(G,{ref:o,id:r,"aria-describedby":t?`${a} ${s}`:`${a}`,"aria-invalid":!!t,...e})});P.displayName="FormControl";var R=i.forwardRef(({className:e,...o},t)=>{let{formDescriptionId:r}=p();return l("p",{ref:t,id:r,className:m("text-sm text-muted-foreground",e),...o})});R.displayName="FormDescription";var y=i.forwardRef(({className:e,children:o,...t},r)=>{let{error:a,formMessageId:s}=p(),n=a?String(a?.message??""):o;return n?l("p",{ref:r,id:s,className:m("text-sm font-medium text-destructive",e),...t,children:n}):null});y.displayName="FormMessage";import{jsx as d,jsxs as M}from"react/jsx-runtime";function ge({name:e,label:o,description:t,className:r,required:a,disabled:s,"aria-label":n,"aria-describedby":C,...c}){let{control:w}=O();return d(g,{name:e,control:w,render:({field:v,fieldState:{error:u}})=>M(b,{children:[o&&M(x,{children:[o,a&&d("span",{className:"text-destructive ml-1",children:"*"})]}),d(P,{children:d(h,{...v,...c,disabled:s,"aria-label":n,"aria-describedby":C,"aria-invalid":!!u,"aria-required":a,className:m(u&&"border-destructive focus-visible:ring-destructive",r),onDrop:(L,E,H)=>{v.onChange(L),c.onDrop?.(L,E,H)}})}),t&&d(R,{children:t}),u&&d(y,{children:u.message})]})})}export{ge as RhfDndInput};
|
|
2
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/rhf/rhf-dnd-input/rhf-dnd-input.tsx","../../src/components/atoms/dnd-input/dnd-input.tsx","../../src/utils/cn.ts","../../src/components/rhf/form/form.tsx","../../src/components/atoms/label/label.tsx"],"sourcesContent":["\"use client\";\n\"use client\"\n\nimport * as React from \"react\"\nimport { useFormContext, type FieldValues, type FieldPath } from \"react-hook-form\"\nimport { DndInput } from \"@/components/atoms/dnd-input\"\nimport { cn } from \"@/utils/cn\"\nimport {\n FormControl,\n FormItem,\n FormMessage,\n FormLabel,\n FormDescription,\n FormField\n} from \"@/components/rhf/form\"\nimport type { RhfDndInputProps } from \"./rhf-dnd-input.types\"\n\n/**\n * RhfDndInput is a React Hook Form wrapper around the DndInput component.\n * It provides form integration with validation and error handling.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/atoms-dnd-input--docs\n *\n * @example\n * ```tsx\n * // Basic usage with React Hook Form\n * <Form>\n * <RhfDndInput\n * name=\"files\"\n * label=\"Upload Files\"\n * rules={{ required: \"Please upload a file\" }}\n * />\n * </Form>\n *\n * // With file type restrictions\n * <Form>\n * <RhfDndInput\n * name=\"files\"\n * label=\"Upload Images\"\n * accept={{ 'image/*': ['.png', '.jpg'] }}\n * rules={{\n * required: \"Please upload a file\",\n * validate: (files) => files.length > 0 || \"At least one file is required\"\n * }}\n * />\n * </Form>\n * ```\n */\nexport function RhfDndInput<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n>({\n name,\n label,\n description,\n className,\n required,\n disabled,\n \"aria-label\": ariaLabel,\n \"aria-describedby\": ariaDescribedby,\n ...other\n}: RhfDndInputProps<TFieldValues, TName>) {\n const { control } = useFormContext<TFieldValues>()\n\n return (\n <FormField\n name={name}\n control={control}\n render={({ field, fieldState: { error } }) => (\n <FormItem>\n {label && (\n <FormLabel>\n {label}\n {required && <span className=\"text-destructive ml-1\">*</span>}\n </FormLabel>\n )}\n <FormControl>\n <DndInput\n {...field}\n {...other}\n disabled={disabled}\n aria-label={ariaLabel}\n aria-describedby={ariaDescribedby}\n aria-invalid={!!error}\n aria-required={required}\n className={cn(\n error && \"border-destructive focus-visible:ring-destructive\",\n className\n )}\n onDrop={(acceptedFiles, fileRejections, event) => {\n field.onChange(acceptedFiles)\n other.onDrop?.(acceptedFiles, fileRejections, event)\n }}\n />\n </FormControl>\n {description && <FormDescription>{description}</FormDescription>}\n {error && <FormMessage>{error.message}</FormMessage>}\n </FormItem>\n )}\n />\n )\n}\n","\"use client\";\n\"use client\"\n\nimport React from \"react\"\nimport { useDropzone } from \"react-dropzone\"\nimport { cn } from \"@/utils\"\nimport { UploadIcon } from \"lucide-react\" // or your icon\n\nimport type { DndInputProps } from \"./dnd-input.types\"\n\n/**\n * Default content shown when no children are provided to the DndInput component.\n * Displays an upload icon, text prompt, and file type information.\n */\nconst defaultContent = (\n <>\n <UploadIcon className=\"text-blue-600 mr-2\" aria-hidden=\"true\" />\n <span>\n <span className=\"underline\">Upload</span> or drop a file right here\n </span>\n <span className=\"ml-auto text-gray-400 text-sm\">all file types</span>\n </>\n)\n\n/**\n * DndInput is a drag-and-drop file upload component built on top of react-dropzone.\n * It provides a customizable dropzone area for file uploads with visual feedback for drag states.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/atoms-dnd-input--docs\n *\n * @example\n * ```tsx\n * // Basic usage with default UI\n * <DndInput onDrop={(files) => handleFiles(files)} />\n *\n * // Custom content with file type restrictions\n * <DndInput\n * accept={{ 'image/*': ['.png', '.jpg'] }}\n * onDrop={(files) => handleFiles(files)}\n * >\n * <div>Custom upload UI</div>\n * </DndInput>\n * ```\n */\nexport const DndInput: React.FC<DndInputProps> = ({\n onDrop,\n accept,\n className,\n children,\n ...props\n}) => {\n // Initialize dropzone functionality with provided options\n const { getRootProps, getInputProps, isDragActive, isFocused } = useDropzone({\n onDrop,\n accept,\n ...props\n })\n\n return (\n <div\n {...getRootProps({\n className: cn(\n // Base styles for the dropzone container\n \"flex items-center border-2 border-dashed border-blue-500 rounded-lg p-4 cursor-pointer transition-colors\",\n // Custom className prop for additional styling\n className,\n // Visual feedback for drag state\n isDragActive ? \"bg-blue-50 border-blue-700\" : \"\",\n // Visual feedback for focus state\n isFocused ? \"ring-2 ring-blue-400\" : \"\"\n ),\n \"aria-label\": \"File upload area\",\n tabIndex: 0,\n role: \"button\"\n })}\n data-testid=\"dnd-input\"\n >\n <input {...getInputProps()} />\n {children || defaultContent}\n </div>\n )\n}\n","import { type ClassValue, clsx } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n","\"use client\";\n\"use client\"\n\nimport * as React from \"react\"\nimport * as LabelPrimitive from \"@radix-ui/react-label\"\nimport { Slot } from \"@radix-ui/react-slot\"\nimport {\n Controller,\n FormProvider,\n useFormContext,\n type ControllerProps,\n type FieldPath,\n type FieldValues\n} from \"react-hook-form\"\n\nimport { cn } from \"@/utils/cn\"\nimport { Label } from \"@/components/atoms/label\"\n\nconst Form = FormProvider\n\ntype FormFieldContextValue<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n> = {\n name: TName\n}\n\nconst FormFieldContext = React.createContext<FormFieldContextValue>({} as FormFieldContextValue)\n\nconst FormField = <\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n>({\n ...props\n}: ControllerProps<TFieldValues, TName>) => {\n return (\n <FormFieldContext.Provider value={{ name: props.name }}>\n <Controller {...props} />\n </FormFieldContext.Provider>\n )\n}\n\nconst useFormField = () => {\n const fieldContext = React.useContext(FormFieldContext)\n const itemContext = React.useContext(FormItemContext)\n const { getFieldState, formState } = useFormContext()\n\n const fieldState = getFieldState(fieldContext.name, formState)\n\n if (!fieldContext) {\n throw new Error(\"useFormField should be used within <FormField>\")\n }\n\n const { id } = itemContext\n\n return {\n id,\n name: fieldContext.name,\n formItemId: `${id}-form-item`,\n formDescriptionId: `${id}-form-item-description`,\n formMessageId: `${id}-form-item-message`,\n ...fieldState\n }\n}\n\ntype FormItemContextValue = {\n id: string\n}\n\nconst FormItemContext = React.createContext<FormItemContextValue>({} as FormItemContextValue)\n\nconst FormItem = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => {\n const id = React.useId()\n\n return (\n <FormItemContext.Provider value={{ id }}>\n <div ref={ref} className={cn(\"space-y-2\", className)} {...props} />\n </FormItemContext.Provider>\n )\n }\n)\nFormItem.displayName = \"FormItem\"\n\nconst FormLabel = React.forwardRef<\n React.ElementRef<typeof LabelPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>\n>(({ className, ...props }, ref) => {\n const { error, formItemId } = useFormField()\n\n return (\n <Label\n ref={ref}\n className={cn(error && \"text-destructive\", className)}\n htmlFor={formItemId}\n {...props}\n />\n )\n})\nFormLabel.displayName = \"FormLabel\"\n\nconst FormControl = React.forwardRef<\n React.ElementRef<typeof Slot>,\n React.ComponentPropsWithoutRef<typeof Slot>\n>(({ ...props }, ref) => {\n const { error, formItemId, formDescriptionId, formMessageId } = useFormField()\n\n return (\n <Slot\n ref={ref}\n id={formItemId}\n aria-describedby={!error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`}\n aria-invalid={!!error}\n {...props}\n />\n )\n})\nFormControl.displayName = \"FormControl\"\n\nconst FormDescription = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, ...props }, ref) => {\n const { formDescriptionId } = useFormField()\n\n return (\n <p\n ref={ref}\n id={formDescriptionId}\n className={cn(\"text-sm text-muted-foreground\", className)}\n {...props}\n />\n )\n})\nFormDescription.displayName = \"FormDescription\"\n\nconst FormMessage = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, children, ...props }, ref) => {\n const { error, formMessageId } = useFormField()\n const body = error ? String(error?.message ?? \"\") : children\n\n if (!body) {\n return null\n }\n\n return (\n <p\n ref={ref}\n id={formMessageId}\n className={cn(\"text-sm font-medium text-destructive\", className)}\n {...props}\n >\n {body}\n </p>\n )\n})\nFormMessage.displayName = \"FormMessage\"\n\nexport {\n useFormField,\n Form,\n FormItem,\n FormLabel,\n FormControl,\n FormDescription,\n FormMessage,\n FormField\n}\n","import * as React from \"react\"\nimport * as LabelPrimitive from \"@radix-ui/react-label\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/utils/index\"\n\nconst labelVariants = cva(\n \"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\"\n)\n\nexport interface LabelProps\n extends React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>,\n VariantProps<typeof labelVariants> {}\n\n/**\n * Label component for creating accessible labels.\n * Built on top of Radix UI's Label primitive.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/atoms-label--docs\n *\n */\nconst Label = React.forwardRef<React.ElementRef<typeof LabelPrimitive.Root>, LabelProps>(\n ({ className, ...props }, ref) => (\n <LabelPrimitive.Root ref={ref} className={cn(labelVariants(), className)} {...props} />\n )\n)\nLabel.displayName = LabelPrimitive.Root.displayName\n\nexport { Label }\n"],"mappings":"AAIA,OAAS,kBAAAA,MAAwD,kBC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,mBAAoBC,EACpB,GAAGC,CACL,EAA0C,CACxC,GAAM,CAAE,QAAAC,CAAQ,EAAIC,EAA6B,EAEjD,OACEb,EAACc,EAAA,CACC,KAAMX,EACN,QAASS,EACT,OAAQ,CAAC,CAAE,MAAAG,EAAO,WAAY,CAAE,MAAAC,CAAM,CAAE,IACtCf,EAACgB,EAAA,CACE,UAAAb,GACCH,EAACiB,EAAA,CACE,UAAAd,EACAG,GAAYP,EAAC,QAAK,UAAU,wBAAwB,aAAC,GACxD,EAEFA,EAACmB,EAAA,CACC,SAAAnB,EAACoB,EAAA,CACE,GAAGL,EACH,GAAGJ,EACJ,SAAUH,EACV,aAAYC,EACZ,mBAAkBC,EAClB,eAAc,CAAC,CAACM,EAChB,gBAAeT,EACf,UAAWc,EACTL,GAAS,oDACTV,CACF,EACA,OAAQ,CAACgB,EAAeC,EAAgBC,IAAU,CAChDT,EAAM,SAASO,CAAa,EAC5BX,EAAM,SAASW,EAAeC,EAAgBC,CAAK,CACrD,EACF,EACF,EACCnB,GAAeL,EAACyB,EAAA,CAAiB,SAAApB,EAAY,EAC7CW,GAAShB,EAAC0B,EAAA,CAAa,SAAAV,EAAM,QAAQ,GACxC,EAEJ,CAEJ","names":["useFormContext","useDropzone","clsx","twMerge","cn","inputs","UploadIcon","Fragment","jsx","jsxs","defaultContent","DndInput","onDrop","accept","className","children","props","getRootProps","getInputProps","isDragActive","isFocused","useDropzone","cn","React","Slot","Controller","FormProvider","useFormContext","React","LabelPrimitive","cva","jsx","labelVariants","cva","Label","className","props","ref","cn","jsx","FormFieldContext","FormField","props","jsx","Controller","useFormField","fieldContext","itemContext","FormItemContext","getFieldState","formState","useFormContext","fieldState","id","FormItem","className","ref","cn","FormLabel","error","formItemId","Label","FormControl","formDescriptionId","formMessageId","Slot","FormDescription","FormMessage","children","body","jsx","jsxs","RhfDndInput","name","label","description","className","required","disabled","ariaLabel","ariaDescribedby","other","control","useFormContext","FormField","field","error","FormItem","FormLabel","FormControl","DndInput","cn","acceptedFiles","fileRejections","event","FormDescription","FormMessage"]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* ScrollArea component that provides a custom scrollable area with a styled scrollbar.
|
|
6
|
+
* Built on top of Radix UI's ScrollArea primitive.
|
|
7
|
+
*
|
|
8
|
+
* @url https://sergii-melnykov.github.io/ui/?path=/docs/atoms-scroll-area--docs
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* <ScrollArea className="h-[200px] w-[350px] rounded-md border p-4">
|
|
13
|
+
* <div className="space-y-4">
|
|
14
|
+
* <h4 className="text-sm font-medium leading-none">Scroll Area</h4>
|
|
15
|
+
* <p className="text-sm text-muted-foreground">
|
|
16
|
+
* Scrollable content goes here...
|
|
17
|
+
* </p>
|
|
18
|
+
* </div>
|
|
19
|
+
* </ScrollArea>
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
declare const ScrollArea: React.ForwardRefExoticComponent<Omit<ScrollAreaPrimitive.ScrollAreaProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
23
|
+
declare const ScrollBar: React.ForwardRefExoticComponent<Omit<ScrollAreaPrimitive.ScrollAreaScrollbarProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
24
|
+
orientation?: "vertical" | "horizontal";
|
|
25
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
26
|
+
|
|
27
|
+
type ScrollAreaProps = React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root>;
|
|
28
|
+
type ScrollBarProps = React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar> & {
|
|
29
|
+
orientation?: "vertical" | "horizontal";
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export { ScrollArea, type ScrollAreaProps, ScrollBar, type ScrollBarProps };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import*as c from"react";import*as r from"@radix-ui/react-scroll-area";import{clsx as s}from"clsx";import{twMerge as S}from"tailwind-merge";function a(...l){return S(s(l))}import{jsx as o,jsxs as f}from"react/jsx-runtime";var p=c.forwardRef(({className:l,children:e,...i},t)=>f(r.Root,{ref:t,className:a("relative overflow-hidden",l),...i,children:[o(r.Viewport,{className:"h-full w-full rounded-[inherit]",children:e}),o(m,{}),o(r.Corner,{})]}));p.displayName=r.Root.displayName;var m=c.forwardRef(({className:l,orientation:e="vertical",...i},t)=>o(r.ScrollAreaScrollbar,{ref:t,orientation:e,className:a("flex touch-none select-none transition-colors",e==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",e==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",l),...i,children:o(r.ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border"})}));m.displayName=r.ScrollAreaScrollbar.displayName;export{p as ScrollArea,m as ScrollBar};
|
|
2
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/atoms/scroll-area/scroll-area.tsx","../../src/utils/cn.ts"],"sourcesContent":["/* eslint-disable no-use-before-define */\nimport * as React from \"react\"\nimport * as ScrollAreaPrimitive from \"@radix-ui/react-scroll-area\"\n\nimport { cn } from \"@/utils/index\"\nimport { ScrollAreaProps, ScrollBarProps } from \"./scroll-area.types\"\n\n/**\n * ScrollArea component that provides a custom scrollable area with a styled scrollbar.\n * Built on top of Radix UI's ScrollArea primitive.\n *\n * @url https://sergii-melnykov.github.io/ui/?path=/docs/atoms-scroll-area--docs\n *\n * @example\n * ```tsx\n * <ScrollArea className=\"h-[200px] w-[350px] rounded-md border p-4\">\n * <div className=\"space-y-4\">\n * <h4 className=\"text-sm font-medium leading-none\">Scroll Area</h4>\n * <p className=\"text-sm text-muted-foreground\">\n * Scrollable content goes here...\n * </p>\n * </div>\n * </ScrollArea>\n * ```\n */\nconst ScrollArea = React.forwardRef<\n React.ElementRef<typeof ScrollAreaPrimitive.Root>,\n ScrollAreaProps\n>(({ className, children, ...props }, ref) => (\n <ScrollAreaPrimitive.Root\n ref={ref}\n className={cn(\"relative overflow-hidden\", className)}\n {...props}\n >\n <ScrollAreaPrimitive.Viewport className=\"h-full w-full rounded-[inherit]\">\n {children}\n </ScrollAreaPrimitive.Viewport>\n <ScrollBar />\n <ScrollAreaPrimitive.Corner />\n </ScrollAreaPrimitive.Root>\n))\nScrollArea.displayName = ScrollAreaPrimitive.Root.displayName\n\nconst ScrollBar = React.forwardRef<\n React.ElementRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>,\n ScrollBarProps\n>(({ className, orientation = \"vertical\", ...props }, ref) => (\n <ScrollAreaPrimitive.ScrollAreaScrollbar\n ref={ref}\n orientation={orientation}\n className={cn(\n \"flex touch-none select-none transition-colors\",\n orientation === \"vertical\" && \"h-full w-2.5 border-l border-l-transparent p-[1px]\",\n orientation === \"horizontal\" && \"h-2.5 flex-col border-t border-t-transparent p-[1px]\",\n className\n )}\n {...props}\n >\n <ScrollAreaPrimitive.ScrollAreaThumb className=\"relative flex-1 rounded-full bg-border\" />\n </ScrollAreaPrimitive.ScrollAreaScrollbar>\n))\nScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName\n\nexport { ScrollArea, ScrollBar }\n","import { type ClassValue, clsx } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n"],"mappings":"AACA,UAAYA,MAAW,QACvB,UAAYC,MAAyB,8BCFrC,OAA0B,QAAAC,MAAY,OACtC,OAAS,WAAAC,MAAe,iBAEjB,SAASC,KAAMC,EAAsB,CAC1C,OAAOF,EAAQD,EAAKG,CAAM,CAAC,CAC7B,CDwBE,OAKE,OAAAC,EALF,QAAAC,MAAA,oBAJF,IAAMC,EAAmB,aAGvB,CAAC,CAAE,UAAAC,EAAW,SAAAC,EAAU,GAAGC,CAAM,EAAGC,IACpCL,EAAqB,OAApB,CACC,IAAKK,EACL,UAAWC,EAAG,2BAA4BJ,CAAS,EAClD,GAAGE,EAEJ,UAAAL,EAAqB,WAApB,CAA6B,UAAU,kCACrC,SAAAI,EACH,EACAJ,EAACQ,EAAA,EAAU,EACXR,EAAqB,SAApB,EAA2B,GAC9B,CACD,EACDE,EAAW,YAAkC,OAAK,YAElD,IAAMM,EAAkB,aAGtB,CAAC,CAAE,UAAAL,EAAW,YAAAM,EAAc,WAAY,GAAGJ,CAAM,EAAGC,IACpDN,EAAqB,sBAApB,CACC,IAAKM,EACL,YAAaG,EACb,UAAWF,EACT,gDACAE,IAAgB,YAAc,qDAC9BA,IAAgB,cAAgB,uDAChCN,CACF,EACC,GAAGE,EAEJ,SAAAL,EAAqB,kBAApB,CAAoC,UAAU,yCAAyC,EAC1F,CACD,EACDQ,EAAU,YAAkC,sBAAoB","names":["React","ScrollAreaPrimitive","clsx","twMerge","cn","inputs","jsx","jsxs","ScrollArea","className","children","props","ref","cn","ScrollBar","orientation"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@me1a/ui",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.8",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "./dist/index.mjs",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -77,6 +77,10 @@
|
|
|
77
77
|
"types": "./dist/separator/index.d.mts",
|
|
78
78
|
"import": "./dist/separator/index.mjs"
|
|
79
79
|
},
|
|
80
|
+
"./scroll-area": {
|
|
81
|
+
"types": "./dist/scroll-area/index.d.mts",
|
|
82
|
+
"import": "./dist/scroll-area/index.mjs"
|
|
83
|
+
},
|
|
80
84
|
"./resizable": {
|
|
81
85
|
"types": "./dist/resizable/index.d.mts",
|
|
82
86
|
"import": "./dist/resizable/index.mjs"
|
|
@@ -105,6 +109,10 @@
|
|
|
105
109
|
"types": "./dist/input/index.d.mts",
|
|
106
110
|
"import": "./dist/input/index.mjs"
|
|
107
111
|
},
|
|
112
|
+
"./dnd-input": {
|
|
113
|
+
"types": "./dist/dnd-input/index.d.mts",
|
|
114
|
+
"import": "./dist/dnd-input/index.mjs"
|
|
115
|
+
},
|
|
108
116
|
"./dialog": {
|
|
109
117
|
"types": "./dist/dialog/index.d.mts",
|
|
110
118
|
"import": "./dist/dialog/index.mjs"
|
|
@@ -201,6 +209,10 @@
|
|
|
201
209
|
"types": "./dist/rhf-multi-select/index.d.mts",
|
|
202
210
|
"import": "./dist/rhf-multi-select/index.mjs"
|
|
203
211
|
},
|
|
212
|
+
"./rhf-dnd-input": {
|
|
213
|
+
"types": "./dist/rhf-dnd-input/index.d.mts",
|
|
214
|
+
"import": "./dist/rhf-dnd-input/index.mjs"
|
|
215
|
+
},
|
|
204
216
|
"./rhf-checkbox": {
|
|
205
217
|
"types": "./dist/rhf-checkbox/index.d.mts",
|
|
206
218
|
"import": "./dist/rhf-checkbox/index.mjs"
|
|
@@ -294,6 +306,7 @@
|
|
|
294
306
|
"@radix-ui/react-navigation-menu": "^1.2.12",
|
|
295
307
|
"@radix-ui/react-popover": "^1.1.14",
|
|
296
308
|
"@radix-ui/react-radio-group": "^1.3.7",
|
|
309
|
+
"@radix-ui/react-scroll-area": "^1.2.9",
|
|
297
310
|
"@radix-ui/react-select": "^2.2.5",
|
|
298
311
|
"@radix-ui/react-separator": "^1.1.6",
|
|
299
312
|
"@radix-ui/react-slot": "^1.2.3",
|
|
@@ -306,6 +319,7 @@
|
|
|
306
319
|
"clsx": "^2.1.1",
|
|
307
320
|
"cmdk": "^1.1.1",
|
|
308
321
|
"lucide-react": "^0.511.0",
|
|
322
|
+
"react-dropzone": "^14.3.8",
|
|
309
323
|
"react-resizable-panels": "^3.0.2",
|
|
310
324
|
"vaul": "^1.1.2",
|
|
311
325
|
"vite": "^6.3.5"
|