@oneplatformdev/ui 0.0.1-beta.11
Sign up to get free protection for your applications and to get access to all the features.
- package/Accordion/Accordion.d.ts +7 -0
- package/Accordion/Accordion.mjs +46 -0
- package/Accordion/index.d.ts +1 -0
- package/Accordion/index.mjs +7 -0
- package/Accordion/package.json +7 -0
- package/Alert/Alert.d.ts +7 -0
- package/Alert/Alert.mjs +37 -0
- package/Alert/alertVariants.d.ts +4 -0
- package/Alert/alertVariants.mjs +19 -0
- package/Alert/index.d.ts +1 -0
- package/Alert/index.mjs +6 -0
- package/Alert/package.json +7 -0
- package/AlertDialog/AlertDialog.d.ts +65 -0
- package/AlertDialog/AlertDialog.mjs +97 -0
- package/AlertDialog/AlertDialog.types.d.ts +53 -0
- package/AlertDialog/AlertDialogRoot.d.ts +21 -0
- package/AlertDialog/AlertDialogRoot.mjs +114 -0
- package/AlertDialog/index.d.ts +3 -0
- package/AlertDialog/index.mjs +16 -0
- package/AlertDialog/package.json +7 -0
- package/AreaChart/AreaChart.d.ts +4 -0
- package/AreaChart/AreaChart.mjs +27 -0
- package/AreaChart/AreaChart.types.d.ts +15 -0
- package/AreaChart/index.d.ts +2 -0
- package/AreaChart/index.mjs +4 -0
- package/AreaChart/package.json +7 -0
- package/Aside/Aside.d.ts +4 -0
- package/Aside/Aside.mjs +23 -0
- package/Aside/Aside.types.d.ts +18 -0
- package/Aside/AsideSidebar.d.ts +3 -0
- package/Aside/AsideSidebar.mjs +37 -0
- package/Aside/index.d.ts +3 -0
- package/Aside/index.mjs +7 -0
- package/Aside/package.json +7 -0
- package/AspectRatio/AspectRatio.d.ts +2 -0
- package/AspectRatio/AspectRatio.mjs +5 -0
- package/AspectRatio/index.d.ts +1 -0
- package/AspectRatio/index.mjs +5 -0
- package/AspectRatio/package.json +7 -0
- package/Avatar/Avatar.d.ts +5 -0
- package/Avatar/Avatar.mjs +42 -0
- package/Avatar/index.d.ts +1 -0
- package/Avatar/index.mjs +6 -0
- package/Avatar/package.json +7 -0
- package/Badge/Badge.d.ts +5 -0
- package/Badge/Badge.mjs +10 -0
- package/Badge/Badge.types.d.ts +5 -0
- package/Badge/badgeVariants.d.ts +3 -0
- package/Badge/badgeVariants.mjs +20 -0
- package/Badge/index.d.ts +3 -0
- package/Badge/index.mjs +6 -0
- package/Badge/package.json +7 -0
- package/Breadcrumb/Breadcrumb.d.ts +19 -0
- package/Breadcrumb/Breadcrumb.mjs +90 -0
- package/Breadcrumb/index.d.ts +1 -0
- package/Breadcrumb/index.mjs +10 -0
- package/Breadcrumb/package.json +7 -0
- package/Button/Button.d.ts +4 -0
- package/Button/Button.mjs +31 -0
- package/Button/Button.types.d.ts +8 -0
- package/Button/buttonVariants.d.ts +4 -0
- package/Button/buttonVariants.mjs +29 -0
- package/Button/index.d.ts +3 -0
- package/Button/index.mjs +7 -0
- package/Button/package.json +7 -0
- package/ButtonIcon/ButtonIcon.d.ts +3 -0
- package/ButtonIcon/ButtonIcon.mjs +29 -0
- package/ButtonIcon/ButtonIcon.types.d.ts +7 -0
- package/ButtonIcon/buttonIconVariants.d.ts +7 -0
- package/ButtonIcon/buttonIconVariants.mjs +139 -0
- package/ButtonIcon/index.d.ts +3 -0
- package/ButtonIcon/index.mjs +7 -0
- package/ButtonIcon/package.json +7 -0
- package/Calendar/Calendar.d.ts +8 -0
- package/Calendar/Calendar.mjs +63 -0
- package/Calendar/index.d.ts +1 -0
- package/Calendar/index.mjs +4 -0
- package/Calendar/package.json +7 -0
- package/Card/Card.d.ts +8 -0
- package/Card/Card.mjs +61 -0
- package/Card/index.d.ts +1 -0
- package/Card/index.mjs +9 -0
- package/Card/package.json +7 -0
- package/Carousel/Carousel.d.ts +18 -0
- package/Carousel/Carousel.mjs +168 -0
- package/Carousel/index.d.ts +1 -0
- package/Carousel/index.mjs +8 -0
- package/Carousel/package.json +7 -0
- package/Chart/Chart.d.ts +62 -0
- package/Chart/Chart.mjs +210 -0
- package/Chart/index.d.ts +1 -0
- package/Chart/index.mjs +9 -0
- package/Chart/package.json +7 -0
- package/Checkbox/Checkbox.d.ts +4 -0
- package/Checkbox/Checkbox.mjs +27 -0
- package/Checkbox/index.d.ts +1 -0
- package/Checkbox/index.mjs +4 -0
- package/Checkbox/package.json +7 -0
- package/Collapsible/Collapsible.d.ts +5 -0
- package/Collapsible/Collapsible.mjs +7 -0
- package/Collapsible/index.d.ts +1 -0
- package/Collapsible/index.mjs +6 -0
- package/Collapsible/package.json +7 -0
- package/Combobox/Combobox.d.ts +4 -0
- package/Combobox/Combobox.mjs +126 -0
- package/Combobox/Combobox.types.d.ts +15 -0
- package/Combobox/index.d.ts +2 -0
- package/Combobox/index.mjs +4 -0
- package/Combobox/package.json +7 -0
- package/Command/Command.d.ts +80 -0
- package/Command/Command.mjs +109 -0
- package/Command/index.d.ts +1 -0
- package/Command/index.mjs +12 -0
- package/Command/package.json +7 -0
- package/DataTable/DataTable.d.ts +4 -0
- package/DataTable/DataTable.mjs +64 -0
- package/DataTable/DataTable.types.d.ts +11 -0
- package/DataTable/index.d.ts +2 -0
- package/DataTable/index.mjs +4 -0
- package/DataTable/package.json +7 -0
- package/DataTable/useDataTable.d.ts +3 -0
- package/DataTable/useDataTable.mjs +30 -0
- package/DatePicker/DatePicker.d.ts +3 -0
- package/DatePicker/DatePicker.mjs +699 -0
- package/DatePicker/DatePicker.types.d.ts +5 -0
- package/DatePicker/index.d.ts +3 -0
- package/DatePicker/index.mjs +5 -0
- package/DatePicker/package.json +7 -0
- package/Dialog/Dialog.d.ts +19 -0
- package/Dialog/Dialog.mjs +100 -0
- package/Dialog/index.d.ts +1 -0
- package/Dialog/index.mjs +13 -0
- package/Dialog/package.json +7 -0
- package/Drawer/Drawer.d.ts +22 -0
- package/Drawer/Drawer.mjs +98 -0
- package/Drawer/index.d.ts +1 -0
- package/Drawer/index.mjs +13 -0
- package/Drawer/package.json +7 -0
- package/DropdownMenu/DropdownMenu.d.ts +27 -0
- package/DropdownMenu/DropdownMenu.mjs +144 -0
- package/DropdownMenu/index.d.ts +1 -0
- package/DropdownMenu/index.mjs +18 -0
- package/DropdownMenu/package.json +7 -0
- package/Dropzone/Dropzone.d.ts +16 -0
- package/Dropzone/Dropzone.mjs +2923 -0
- package/Dropzone/Dropzone.types.d.ts +21 -0
- package/Dropzone/FilePreview.d.ts +15 -0
- package/Dropzone/FilePreview.mjs +7 -0
- package/Dropzone/index.d.ts +2 -0
- package/Dropzone/index.mjs +7 -0
- package/Dropzone/package.json +7 -0
- package/FilePreview-C6IeuOqo.js +40 -0
- package/Form/Form.d.ts +23 -0
- package/Form/Form.mjs +95 -0
- package/Form/FormRenderControl.d.ts +5 -0
- package/Form/FormRenderControl.mjs +21 -0
- package/Form/FormRenderControl.types.d.ts +18 -0
- package/Form/index.d.ts +3 -0
- package/Form/index.mjs +13 -0
- package/Form/package.json +7 -0
- package/FormCheckbox/FormCheckbox.d.ts +5 -0
- package/FormCheckbox/FormCheckbox.mjs +30 -0
- package/FormCheckbox/FormCheckbox.types.d.ts +7 -0
- package/FormCheckbox/index.d.ts +2 -0
- package/FormCheckbox/index.mjs +4 -0
- package/FormCheckbox/package.json +7 -0
- package/FormCombobox/FormCombobox.d.ts +4 -0
- package/FormCombobox/FormCombobox.mjs +26 -0
- package/FormCombobox/FormCombobox.types.d.ts +7 -0
- package/FormCombobox/index.d.ts +2 -0
- package/FormCombobox/index.mjs +4 -0
- package/FormCombobox/package.json +7 -0
- package/FormDatePicker/FormDatePicker.d.ts +4 -0
- package/FormDatePicker/FormDatePicker.mjs +27 -0
- package/FormDatePicker/FormDatePicker.types.d.ts +7 -0
- package/FormDatePicker/index.d.ts +3 -0
- package/FormDatePicker/index.mjs +5 -0
- package/FormDatePicker/package.json +7 -0
- package/FormInput/FormInput.d.ts +5 -0
- package/FormInput/FormInput.mjs +26 -0
- package/FormInput/FormInput.types.d.ts +7 -0
- package/FormInput/index.d.ts +2 -0
- package/FormInput/index.mjs +4 -0
- package/FormInput/package.json +7 -0
- package/FormSelect/FormSelect.d.ts +5 -0
- package/FormSelect/FormSelect.mjs +38 -0
- package/FormSelect/FormSelect.types.d.ts +7 -0
- package/FormSelect/index.d.ts +2 -0
- package/FormSelect/index.mjs +4 -0
- package/FormSelect/package.json +7 -0
- package/FormTextarea/FormTextarea.d.ts +5 -0
- package/FormTextarea/FormTextarea.mjs +26 -0
- package/FormTextarea/FormTextarea.types.d.ts +7 -0
- package/FormTextarea/index.d.ts +2 -0
- package/FormTextarea/index.mjs +4 -0
- package/FormTextarea/package.json +7 -0
- package/Header/Header.d.ts +4 -0
- package/Header/Header.mjs +26 -0
- package/Header/Header.types.d.ts +3 -0
- package/Header/index.d.ts +2 -0
- package/Header/index.mjs +5 -0
- package/Header/package.json +7 -0
- package/HoverCard/HoverCard.d.ts +6 -0
- package/HoverCard/HoverCard.mjs +23 -0
- package/HoverCard/index.d.ts +1 -0
- package/HoverCard/index.mjs +6 -0
- package/HoverCard/package.json +7 -0
- package/Input/Input.d.ts +6 -0
- package/Input/Input.mjs +61 -0
- package/Input/Input.types.d.ts +13 -0
- package/Input/index.d.ts +3 -0
- package/Input/index.mjs +7 -0
- package/Input/inputVariants.d.ts +3 -0
- package/Input/inputVariants.mjs +18 -0
- package/Input/package.json +7 -0
- package/InputOTP/InputOTP.d.ts +34 -0
- package/InputOTP/InputOTP.mjs +48 -0
- package/InputOTP/index.d.ts +1 -0
- package/InputOTP/index.mjs +7 -0
- package/InputOTP/package.json +7 -0
- package/Label/Label.d.ts +5 -0
- package/Label/Label.mjs +17 -0
- package/Label/index.d.ts +2 -0
- package/Label/index.mjs +6 -0
- package/Label/labelVariants.d.ts +1 -0
- package/Label/labelVariants.mjs +7 -0
- package/Label/package.json +7 -0
- package/LazyLoader/LazyLoader.d.ts +20 -0
- package/LazyLoader/LazyLoader.mjs +7 -0
- package/LazyLoader/index.d.ts +1 -0
- package/LazyLoader/index.mjs +5 -0
- package/LazyLoader/package.json +7 -0
- package/LoadingMask/LoadingMask.d.ts +1 -0
- package/LoadingMask/LoadingMask.mjs +59 -0
- package/LoadingMask/index.d.ts +1 -0
- package/LoadingMask/index.mjs +4 -0
- package/LoadingMask/package.json +7 -0
- package/LoadingProgress/LoadingProgress.d.ts +4 -0
- package/LoadingProgress/LoadingProgress.mjs +37 -0
- package/LoadingProgress/LoadingProgress.types.d.ts +8 -0
- package/LoadingProgress/index.d.ts +3 -0
- package/LoadingProgress/index.mjs +6 -0
- package/LoadingProgress/loadingProgressVariants.d.ts +4 -0
- package/LoadingProgress/loadingProgressVariants.mjs +24 -0
- package/LoadingProgress/package.json +7 -0
- package/Menubar/Menubar.d.ts +28 -0
- package/Menubar/Menubar.mjs +175 -0
- package/Menubar/index.d.ts +1 -0
- package/Menubar/index.mjs +19 -0
- package/Menubar/package.json +7 -0
- package/NavigationMenu/NavigationMenu.d.ts +11 -0
- package/NavigationMenu/NavigationMenu.mjs +101 -0
- package/NavigationMenu/index.d.ts +2 -0
- package/NavigationMenu/index.mjs +13 -0
- package/NavigationMenu/navigationMenuVariants.d.ts +1 -0
- package/NavigationMenu/navigationMenuVariants.mjs +7 -0
- package/NavigationMenu/package.json +7 -0
- package/Pagination/Pagination.d.ts +28 -0
- package/Pagination/Pagination.mjs +106 -0
- package/Pagination/index.d.ts +1 -0
- package/Pagination/index.mjs +10 -0
- package/Pagination/package.json +7 -0
- package/Popover/Popover.d.ts +7 -0
- package/Popover/Popover.mjs +24 -0
- package/Popover/index.d.ts +1 -0
- package/Popover/index.mjs +7 -0
- package/Popover/package.json +7 -0
- package/Progress/Progress.d.ts +4 -0
- package/Progress/Progress.mjs +26 -0
- package/Progress/index.d.ts +1 -0
- package/Progress/index.mjs +4 -0
- package/Progress/package.json +7 -0
- package/README.md +33 -0
- package/RadioGroup/RadioGroup.d.ts +5 -0
- package/RadioGroup/RadioGroup.mjs +31 -0
- package/RadioGroup/index.d.ts +1 -0
- package/RadioGroup/index.mjs +5 -0
- package/RadioGroup/package.json +7 -0
- package/Resizable/Resizable.d.ts +23 -0
- package/Resizable/Resizable.mjs +36 -0
- package/Resizable/index.d.ts +1 -0
- package/Resizable/index.mjs +6 -0
- package/Resizable/package.json +7 -0
- package/ScrollArea/ScrollArea.d.ts +5 -0
- package/ScrollArea/ScrollArea.mjs +38 -0
- package/ScrollArea/index.d.ts +1 -0
- package/ScrollArea/index.mjs +5 -0
- package/ScrollArea/package.json +7 -0
- package/Search/Search.d.ts +4 -0
- package/Search/Search.mjs +30 -0
- package/Search/Search.types.d.ts +6 -0
- package/Search/index.d.ts +3 -0
- package/Search/index.mjs +5 -0
- package/Search/package.json +7 -0
- package/Select/Select.d.ts +3 -0
- package/Select/Select.mjs +72 -0
- package/Select/Select.types.d.ts +29 -0
- package/Select/SelectRoot.d.ts +13 -0
- package/Select/SelectRoot.mjs +121 -0
- package/Select/index.d.ts +3 -0
- package/Select/index.mjs +15 -0
- package/Select/package.json +7 -0
- package/Separator/Separator.d.ts +4 -0
- package/Separator/Separator.mjs +24 -0
- package/Separator/index.d.ts +1 -0
- package/Separator/index.mjs +4 -0
- package/Separator/package.json +7 -0
- package/Sheet/Sheet.d.ts +25 -0
- package/Sheet/Sheet.mjs +110 -0
- package/Sheet/index.d.ts +1 -0
- package/Sheet/index.mjs +13 -0
- package/Sheet/package.json +7 -0
- package/Sidebar/Sidebar.d.ts +66 -0
- package/Sidebar/Sidebar.mjs +543 -0
- package/Sidebar/index.d.ts +1 -0
- package/Sidebar/index.mjs +27 -0
- package/Sidebar/package.json +7 -0
- package/Skeleton/Skeleton.d.ts +4 -0
- package/Skeleton/Skeleton.mjs +17 -0
- package/Skeleton/index.d.ts +1 -0
- package/Skeleton/index.mjs +4 -0
- package/Skeleton/package.json +7 -0
- package/Slider/Slider.d.ts +4 -0
- package/Slider/Slider.mjs +23 -0
- package/Slider/index.d.ts +1 -0
- package/Slider/index.mjs +4 -0
- package/Slider/package.json +7 -0
- package/Sonner/Sonner.d.ts +5 -0
- package/Sonner/Sonner.mjs +25 -0
- package/Sonner/index.d.ts +1 -0
- package/Sonner/index.mjs +4 -0
- package/Sonner/package.json +7 -0
- package/Switch/Switch.d.ts +4 -0
- package/Switch/Switch.mjs +27 -0
- package/Switch/index.d.ts +1 -0
- package/Switch/index.mjs +4 -0
- package/Switch/package.json +7 -0
- package/Table/Table.d.ts +10 -0
- package/Table/Table.mjs +90 -0
- package/Table/index.d.ts +1 -0
- package/Table/index.mjs +11 -0
- package/Table/package.json +7 -0
- package/Tabs/Tabs.d.ts +4 -0
- package/Tabs/Tabs.mjs +9 -0
- package/Tabs/Tabs.types.d.ts +9 -0
- package/Tabs/TabsRoot.d.ts +7 -0
- package/Tabs/TabsRoot.mjs +46 -0
- package/Tabs/index.d.ts +2 -0
- package/Tabs/index.mjs +9 -0
- package/Tabs/package.json +7 -0
- package/Textarea/Textarea.d.ts +4 -0
- package/Textarea/Textarea.mjs +18 -0
- package/Textarea/Textarea.types.d.ts +4 -0
- package/Textarea/index.d.ts +2 -0
- package/Textarea/index.mjs +4 -0
- package/Textarea/package.json +7 -0
- package/Theme/ThemeModeToggle.d.ts +8 -0
- package/Theme/ThemeModeToggle.mjs +48 -0
- package/Theme/ThemeProvider.d.ts +4 -0
- package/Theme/ThemeProvider.mjs +27 -0
- package/Theme/index.d.ts +2 -0
- package/Theme/index.mjs +6 -0
- package/Theme/package.json +7 -0
- package/Toast/Toast.d.ts +13 -0
- package/Toast/Toast.mjs +80 -0
- package/Toast/Toast.types.d.ts +34 -0
- package/Toast/index.d.ts +3 -0
- package/Toast/index.mjs +15 -0
- package/Toast/package.json +7 -0
- package/Toast/toast.constants.d.ts +6 -0
- package/Toast/toast.constants.mjs +9 -0
- package/Toast/toastVariants.d.ts +3 -0
- package/Toast/toastVariants.mjs +21 -0
- package/Toast/useToast.d.ts +16 -0
- package/Toast/useToast.mjs +101 -0
- package/Toaster/Toaster.d.ts +1 -0
- package/Toaster/Toaster.mjs +22 -0
- package/Toaster/index.d.ts +1 -0
- package/Toaster/index.mjs +4 -0
- package/Toaster/package.json +7 -0
- package/Toggle/Toggle.d.ts +12 -0
- package/Toggle/Toggle.mjs +37 -0
- package/Toggle/index.d.ts +1 -0
- package/Toggle/index.mjs +5 -0
- package/Toggle/package.json +7 -0
- package/ToggleGroup/ToggleGroup.d.ts +12 -0
- package/ToggleGroup/ToggleGroup.mjs +41 -0
- package/ToggleGroup/index.d.ts +1 -0
- package/ToggleGroup/index.mjs +5 -0
- package/ToggleGroup/package.json +7 -0
- package/Tooltip/Tooltip.d.ts +4 -0
- package/Tooltip/Tooltip.mjs +12 -0
- package/Tooltip/Tooltip.types.d.ts +8 -0
- package/Tooltip/TooltipRoot.d.ts +7 -0
- package/Tooltip/TooltipRoot.mjs +23 -0
- package/Tooltip/index.d.ts +3 -0
- package/Tooltip/index.mjs +9 -0
- package/Tooltip/package.json +7 -0
- package/index.css +1 -0
- package/index.d.ts +66 -0
- package/index.mjs +358 -0
- package/package.json +103 -0
- package/tailwind.config.mjs +148 -0
@@ -0,0 +1,21 @@
|
|
1
|
+
import { FileRejection } from 'react-dropzone/.';
|
2
|
+
|
3
|
+
export interface DropzoneTranslations {
|
4
|
+
dropFileHere: string;
|
5
|
+
orClickToSelect: string;
|
6
|
+
selectedFiles: string;
|
7
|
+
uploadErrors: string;
|
8
|
+
fileTooLarge: string;
|
9
|
+
invalidFileType: string;
|
10
|
+
}
|
11
|
+
export interface DropzoneProps {
|
12
|
+
acceptTypes?: string[];
|
13
|
+
maxSizeMB: number;
|
14
|
+
onFilesSelected: (files: File[]) => void;
|
15
|
+
translations: DropzoneTranslations;
|
16
|
+
maxFiles?: number;
|
17
|
+
onErrors?: (errors: FileRejection[]) => void;
|
18
|
+
hideErrors?: boolean;
|
19
|
+
}
|
20
|
+
export declare const DEFAULT_FILE_TYPES: string[];
|
21
|
+
export declare const DEFAULT_IMAGES_TYPES: string[];
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { FC } from 'react';
|
2
|
+
|
3
|
+
interface FilePreviewProps {
|
4
|
+
file: File;
|
5
|
+
}
|
6
|
+
/**
|
7
|
+
* FilePreview component - Displays a preview of image files and a file icon for non-image files.
|
8
|
+
*
|
9
|
+
* @component
|
10
|
+
* @param {Object} props - The component props.
|
11
|
+
* @param {File} props.file - The file to display.
|
12
|
+
* @returns {JSX.Element} A file preview or file icon.
|
13
|
+
*/
|
14
|
+
export declare const FilePreview: FC<FilePreviewProps>;
|
15
|
+
export {};
|
@@ -0,0 +1,40 @@
|
|
1
|
+
import { jsx as t, jsxs as i } from "react/jsx-runtime";
|
2
|
+
import { useState as o, useEffect as c } from "react";
|
3
|
+
import { File as l } from "lucide-react";
|
4
|
+
const f = [
|
5
|
+
"application/msword",
|
6
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
7
|
+
"text/csv",
|
8
|
+
"text/plain",
|
9
|
+
"application/pdf"
|
10
|
+
], m = [
|
11
|
+
"image/png",
|
12
|
+
"image/jpeg",
|
13
|
+
"image/jpg",
|
14
|
+
"image/webp",
|
15
|
+
"image/gif"
|
16
|
+
], g = ({ file: e }) => {
|
17
|
+
const [a, n] = o(null), r = m.includes(e.type);
|
18
|
+
return c(() => {
|
19
|
+
if (!r) return;
|
20
|
+
const s = new FileReader();
|
21
|
+
return s.onloadend = () => n(s.result), s.readAsDataURL(e), () => {
|
22
|
+
n(null);
|
23
|
+
};
|
24
|
+
}, [e, r]), /* @__PURE__ */ t("div", { className: "w-32 h-32 border border-gray-300 rounded-md overflow-hidden flex items-center justify-center", children: r && a ? /* @__PURE__ */ t(
|
25
|
+
"img",
|
26
|
+
{
|
27
|
+
src: a,
|
28
|
+
alt: e.name,
|
29
|
+
className: "w-full h-full object-cover"
|
30
|
+
}
|
31
|
+
) : /* @__PURE__ */ i("div", { className: "flex flex-col items-center justify-center text-gray-500 text-sm", children: [
|
32
|
+
/* @__PURE__ */ t(l, { className: "w-6 h-6" }),
|
33
|
+
/* @__PURE__ */ t("span", { className: "text-xs text-center", children: e.name })
|
34
|
+
] }) });
|
35
|
+
};
|
36
|
+
export {
|
37
|
+
f as D,
|
38
|
+
g as F,
|
39
|
+
m as a
|
40
|
+
};
|
package/Form/Form.d.ts
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
import { ControllerProps, FieldPath, FieldValues } from 'react-hook-form';
|
2
|
+
import * as React from "react";
|
3
|
+
import * as LabelPrimitive from "@radix-ui/react-label";
|
4
|
+
declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransformedValues extends FieldValues | undefined = undefined>(props: import('react-hook-form').FormProviderProps<TFieldValues, TContext, TTransformedValues>) => React.JSX.Element;
|
5
|
+
declare const FormField: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ ...props }: ControllerProps<TFieldValues, TName>) => import("react/jsx-runtime").JSX.Element;
|
6
|
+
declare const useFormField: () => {
|
7
|
+
invalid: boolean;
|
8
|
+
isDirty: boolean;
|
9
|
+
isTouched: boolean;
|
10
|
+
isValidating: boolean;
|
11
|
+
error?: import('react-hook-form').FieldError;
|
12
|
+
id: string;
|
13
|
+
name: string;
|
14
|
+
formItemId: string;
|
15
|
+
formDescriptionId: string;
|
16
|
+
formMessageId: string;
|
17
|
+
};
|
18
|
+
declare const FormItem: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
19
|
+
declare const FormLabel: React.ForwardRefExoticComponent<Omit<LabelPrimitive.LabelProps & React.RefAttributes<HTMLLabelElement>, "ref"> & React.RefAttributes<HTMLLabelElement>>;
|
20
|
+
declare const FormControl: React.ForwardRefExoticComponent<Omit<import('@radix-ui/react-slot').SlotProps & React.RefAttributes<HTMLElement>, "ref"> & React.RefAttributes<HTMLElement>>;
|
21
|
+
declare const FormDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
|
22
|
+
declare const FormMessage: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
|
23
|
+
export { useFormField, Form, FormItem, FormLabel, FormControl, FormDescription, FormMessage, FormField, };
|
package/Form/Form.mjs
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
2
|
+
import * as s from "react";
|
3
|
+
import { Slot as F } from "@radix-ui/react-slot";
|
4
|
+
import { FormProvider as u, Controller as p, useFormContext as x } from "react-hook-form";
|
5
|
+
import { cn as a } from "@oneplatformdev/utils";
|
6
|
+
import { Label as I } from "../Label/Label.mjs";
|
7
|
+
import "../Label/labelVariants.mjs";
|
8
|
+
const M = u, f = s.createContext(
|
9
|
+
{}
|
10
|
+
), S = ({
|
11
|
+
...e
|
12
|
+
}) => /* @__PURE__ */ i(f.Provider, { value: { name: e.name }, children: /* @__PURE__ */ i(p, { ...e }) }), d = () => {
|
13
|
+
const e = s.useContext(f), o = s.useContext(l), { getFieldState: r, formState: t } = x(), m = r(e.name, t);
|
14
|
+
if (!e)
|
15
|
+
throw new Error("useFormField should be used within <FormField>");
|
16
|
+
const { id: n } = o;
|
17
|
+
return {
|
18
|
+
id: n,
|
19
|
+
name: e.name,
|
20
|
+
formItemId: `${n}-form-item`,
|
21
|
+
formDescriptionId: `${n}-form-item-description`,
|
22
|
+
formMessageId: `${n}-form-item-message`,
|
23
|
+
...m
|
24
|
+
};
|
25
|
+
}, l = s.createContext(
|
26
|
+
{}
|
27
|
+
), C = s.forwardRef(({ className: e, ...o }, r) => {
|
28
|
+
const t = s.useId();
|
29
|
+
return /* @__PURE__ */ i(l.Provider, { value: { id: t }, children: /* @__PURE__ */ i("div", { ref: r, className: a("space-y-2", e), ...o }) });
|
30
|
+
});
|
31
|
+
C.displayName = "FormItem";
|
32
|
+
const g = s.forwardRef(({ className: e, ...o }, r) => {
|
33
|
+
const { error: t, formItemId: m } = d();
|
34
|
+
return /* @__PURE__ */ i(
|
35
|
+
I,
|
36
|
+
{
|
37
|
+
ref: r,
|
38
|
+
className: a(t && "text-destructive", e),
|
39
|
+
htmlFor: m,
|
40
|
+
...o
|
41
|
+
}
|
42
|
+
);
|
43
|
+
});
|
44
|
+
g.displayName = "FormLabel";
|
45
|
+
const v = s.forwardRef(({ ...e }, o) => {
|
46
|
+
const { error: r, formItemId: t, formDescriptionId: m, formMessageId: n } = d();
|
47
|
+
return /* @__PURE__ */ i(
|
48
|
+
F,
|
49
|
+
{
|
50
|
+
ref: o,
|
51
|
+
id: t,
|
52
|
+
"aria-describedby": r ? `${m} ${n}` : `${m}`,
|
53
|
+
"aria-invalid": !!r,
|
54
|
+
...e
|
55
|
+
}
|
56
|
+
);
|
57
|
+
});
|
58
|
+
v.displayName = "FormControl";
|
59
|
+
const N = s.forwardRef(({ className: e, ...o }, r) => {
|
60
|
+
const { formDescriptionId: t } = d();
|
61
|
+
return /* @__PURE__ */ i(
|
62
|
+
"p",
|
63
|
+
{
|
64
|
+
ref: r,
|
65
|
+
id: t,
|
66
|
+
className: a("text-[0.8rem] text-muted-foreground", e),
|
67
|
+
...o
|
68
|
+
}
|
69
|
+
);
|
70
|
+
});
|
71
|
+
N.displayName = "FormDescription";
|
72
|
+
const w = s.forwardRef(({ className: e, children: o, ...r }, t) => {
|
73
|
+
const { error: m, formMessageId: n } = d(), c = m ? String(m == null ? void 0 : m.message) : o;
|
74
|
+
return c ? /* @__PURE__ */ i(
|
75
|
+
"p",
|
76
|
+
{
|
77
|
+
ref: t,
|
78
|
+
id: n,
|
79
|
+
className: a("text-[0.8rem] font-medium text-destructive", e),
|
80
|
+
...r,
|
81
|
+
children: c
|
82
|
+
}
|
83
|
+
) : null;
|
84
|
+
});
|
85
|
+
w.displayName = "FormMessage";
|
86
|
+
export {
|
87
|
+
M as Form,
|
88
|
+
v as FormControl,
|
89
|
+
N as FormDescription,
|
90
|
+
S as FormField,
|
91
|
+
C as FormItem,
|
92
|
+
g as FormLabel,
|
93
|
+
w as FormMessage,
|
94
|
+
d as useFormField
|
95
|
+
};
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import { FieldValues } from 'react-hook-form/dist/types/fields';
|
2
|
+
import { UseFormReturn } from 'react-hook-form';
|
3
|
+
import { FormRenderControlProps } from './FormRenderControl.types';
|
4
|
+
|
5
|
+
export declare const FormRenderControl: <Data extends FieldValues, Form extends UseFormReturn<Data>>(props: FormRenderControlProps<Data, Form>) => import("react/jsx-runtime").JSX.Element;
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import { jsx as r, jsxs as c } from "react/jsx-runtime";
|
2
|
+
import { FormField as d, FormItem as F, FormLabel as a, FormMessage as i } from "./Form.mjs";
|
3
|
+
const x = (e) => {
|
4
|
+
const { form: n, name: m, label: o, render: t, ...l } = e;
|
5
|
+
return /* @__PURE__ */ r(
|
6
|
+
d,
|
7
|
+
{
|
8
|
+
control: n.control,
|
9
|
+
name: m,
|
10
|
+
render: (s) => /* @__PURE__ */ c(F, { children: [
|
11
|
+
!!o && /* @__PURE__ */ r(a, { children: o }),
|
12
|
+
t(s),
|
13
|
+
/* @__PURE__ */ r(i, {})
|
14
|
+
] }),
|
15
|
+
...l
|
16
|
+
}
|
17
|
+
);
|
18
|
+
};
|
19
|
+
export {
|
20
|
+
x as FormRenderControl
|
21
|
+
};
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { ControllerFieldState, ControllerRenderProps } from 'react-hook-form/dist/types/controller';
|
2
|
+
import { FieldPath, UseFormStateReturn } from 'react-hook-form/dist/types';
|
3
|
+
import { FieldValues } from 'react-hook-form/dist/types/fields';
|
4
|
+
import { UseFormReturn } from 'react-hook-form';
|
5
|
+
import { default as React } from 'react';
|
6
|
+
|
7
|
+
export type FormRenderProps<Data extends FieldValues> = ({ field, fieldState, formState, }: {
|
8
|
+
field: ControllerRenderProps<Data, FieldPath<Data>>;
|
9
|
+
fieldState: ControllerFieldState;
|
10
|
+
formState: UseFormStateReturn<Data>;
|
11
|
+
}) => React.ReactElement;
|
12
|
+
export interface FormRenderControlProps<Data extends FieldValues, Form extends UseFormReturn<Data>> {
|
13
|
+
form: Form;
|
14
|
+
name: FieldPath<Data>;
|
15
|
+
label?: string;
|
16
|
+
render: FormRenderProps<Data>;
|
17
|
+
}
|
18
|
+
export type FormRenderControlExtendProps<Data extends FieldValues, Form extends UseFormReturn<Data>> = Pick<FormRenderControlProps<Data, Form>, 'form' | 'name' | 'label'>;
|
package/Form/index.d.ts
ADDED
package/Form/index.mjs
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
import { Form as e, FormControl as m, FormDescription as F, FormField as t, FormItem as l, FormLabel as i, FormMessage as n, useFormField as s } from "./Form.mjs";
|
2
|
+
import { FormRenderControl as p } from "./FormRenderControl.mjs";
|
3
|
+
export {
|
4
|
+
e as Form,
|
5
|
+
m as FormControl,
|
6
|
+
F as FormDescription,
|
7
|
+
t as FormField,
|
8
|
+
l as FormItem,
|
9
|
+
i as FormLabel,
|
10
|
+
n as FormMessage,
|
11
|
+
p as FormRenderControl,
|
12
|
+
s as useFormField
|
13
|
+
};
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import { UseFormReturn } from 'react-hook-form';
|
2
|
+
import { FieldValues } from 'react-hook-form/dist/types/fields';
|
3
|
+
import { FormCheckboxProps } from './FormCheckbox.types';
|
4
|
+
|
5
|
+
export declare const FormCheckbox: <Data extends FieldValues, Form extends UseFormReturn<Data>>(props: FormCheckboxProps<Data, Form>) => import("react/jsx-runtime").JSX.Element;
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import { jsx as r, jsxs as s } from "react/jsx-runtime";
|
2
|
+
import { Checkbox as l } from "../Checkbox/Checkbox.mjs";
|
3
|
+
import { FormLabel as h } from "../Form/Form.mjs";
|
4
|
+
import { FormRenderControl as d } from "../Form/FormRenderControl.mjs";
|
5
|
+
const b = (o) => {
|
6
|
+
const { form: m, label: n, name: t, disabled: a, ...c } = o;
|
7
|
+
return /* @__PURE__ */ r(
|
8
|
+
d,
|
9
|
+
{
|
10
|
+
form: m,
|
11
|
+
name: t,
|
12
|
+
render: ({ field: e }) => /* @__PURE__ */ s("div", { className: "flex items-center gap-2 mt-4", children: [
|
13
|
+
/* @__PURE__ */ r(
|
14
|
+
l,
|
15
|
+
{
|
16
|
+
...e,
|
17
|
+
checked: e.value || !1,
|
18
|
+
onCheckedChange: e.onChange,
|
19
|
+
disabled: a
|
20
|
+
}
|
21
|
+
),
|
22
|
+
/* @__PURE__ */ r(h, { children: n })
|
23
|
+
] }),
|
24
|
+
...c
|
25
|
+
}
|
26
|
+
);
|
27
|
+
};
|
28
|
+
export {
|
29
|
+
b as FormCheckbox
|
30
|
+
};
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { UseFormReturn } from 'react-hook-form';
|
2
|
+
import { FieldValues } from 'react-hook-form/dist/types/fields';
|
3
|
+
import { FormRenderControlExtendProps } from '../Form';
|
4
|
+
|
5
|
+
export interface FormCheckboxProps<Data extends FieldValues, Form extends UseFormReturn<Data>> extends FormRenderControlExtendProps<Data, Form> {
|
6
|
+
disabled?: boolean;
|
7
|
+
}
|
@@ -0,0 +1,4 @@
|
|
1
|
+
import { FieldValues, UseFormReturn } from 'react-hook-form';
|
2
|
+
import { FormComboboxProps } from './FormCombobox.types';
|
3
|
+
|
4
|
+
export declare const FormCombobox: <Data extends FieldValues, Form extends UseFormReturn<Data>>(props: FormComboboxProps<Data, Form>) => import("react/jsx-runtime").JSX.Element;
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
2
|
+
import { FormControl as b } from "../Form/Form.mjs";
|
3
|
+
import { FormRenderControl as p } from "../Form/FormRenderControl.mjs";
|
4
|
+
import { Combobox as a } from "../Combobox/Combobox.mjs";
|
5
|
+
const x = (m) => {
|
6
|
+
const { form: n, label: e, name: t, ...C } = m;
|
7
|
+
return /* @__PURE__ */ o(
|
8
|
+
p,
|
9
|
+
{
|
10
|
+
form: n,
|
11
|
+
label: e,
|
12
|
+
name: t,
|
13
|
+
render: ({ field: r }) => /* @__PURE__ */ o(b, { children: /* @__PURE__ */ o(
|
14
|
+
a,
|
15
|
+
{
|
16
|
+
...C,
|
17
|
+
...r,
|
18
|
+
onChange: r.onChange
|
19
|
+
}
|
20
|
+
) })
|
21
|
+
}
|
22
|
+
);
|
23
|
+
};
|
24
|
+
export {
|
25
|
+
x as FormCombobox
|
26
|
+
};
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { FormRenderControlExtendProps } from '../Form';
|
2
|
+
import { ComboboxProps } from '../Combobox';
|
3
|
+
import { UseFormReturn } from 'react-hook-form';
|
4
|
+
import { FieldValues } from 'react-hook-form/dist/types/fields';
|
5
|
+
|
6
|
+
export interface FormComboboxProps<Data extends FieldValues, Form extends UseFormReturn<Data>> extends FormRenderControlExtendProps<Data, Form>, ComboboxProps {
|
7
|
+
}
|
@@ -0,0 +1,4 @@
|
|
1
|
+
import { FormDatePickerProps } from './FormDatePicker.types';
|
2
|
+
import { FieldValues, UseFormReturn } from 'react-hook-form';
|
3
|
+
|
4
|
+
export declare const FormDatePicker: <Data extends FieldValues, Form extends UseFormReturn<Data>>(props: FormDatePickerProps<Data, Form>) => import("react/jsx-runtime").JSX.Element;
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
2
|
+
import { DatePicker as c } from "../DatePicker/DatePicker.mjs";
|
3
|
+
import { FormControl as i } from "../Form/Form.mjs";
|
4
|
+
import { FormRenderControl as l } from "../Form/FormRenderControl.mjs";
|
5
|
+
const f = (e) => {
|
6
|
+
const { form: t, name: m, label: n, ...a } = e;
|
7
|
+
return /* @__PURE__ */ o(
|
8
|
+
l,
|
9
|
+
{
|
10
|
+
form: t,
|
11
|
+
name: m,
|
12
|
+
label: n,
|
13
|
+
render: ({ field: r }) => /* @__PURE__ */ o(i, { children: /* @__PURE__ */ o(
|
14
|
+
c,
|
15
|
+
{
|
16
|
+
...r,
|
17
|
+
...a,
|
18
|
+
selectedDate: r.value,
|
19
|
+
onDateChange: r.onChange
|
20
|
+
}
|
21
|
+
) })
|
22
|
+
}
|
23
|
+
);
|
24
|
+
};
|
25
|
+
export {
|
26
|
+
f as FormDatePicker
|
27
|
+
};
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { DatePickerProps } from '../DatePicker';
|
2
|
+
import { FormRenderControlExtendProps } from '../Form';
|
3
|
+
import { UseFormReturn } from 'react-hook-form';
|
4
|
+
import { FieldValues } from 'react-hook-form/dist/types/fields';
|
5
|
+
|
6
|
+
export interface FormDatePickerProps<Data extends FieldValues, Form extends UseFormReturn<Data>> extends FormRenderControlExtendProps<Data, Form>, DatePickerProps {
|
7
|
+
}
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import { UseFormReturn } from 'react-hook-form';
|
2
|
+
import { FieldValues } from 'react-hook-form/dist/types/fields';
|
3
|
+
import { FormInputProps } from './FormInput.types';
|
4
|
+
|
5
|
+
export declare const FormInput: <Data extends FieldValues, Form extends UseFormReturn<Data>>(props: FormInputProps<Data, Form>) => import("react/jsx-runtime").JSX.Element;
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
2
|
+
import { FormControl as l } from "../Form/Form.mjs";
|
3
|
+
import { FormRenderControl as u } from "../Form/FormRenderControl.mjs";
|
4
|
+
import { Input as a } from "../Input/Input.mjs";
|
5
|
+
const F = (m) => {
|
6
|
+
const { form: t, label: e, name: n, ...p } = m;
|
7
|
+
return /* @__PURE__ */ r(
|
8
|
+
u,
|
9
|
+
{
|
10
|
+
form: t,
|
11
|
+
name: n,
|
12
|
+
label: e,
|
13
|
+
render: ({ field: o }) => /* @__PURE__ */ r(l, { children: /* @__PURE__ */ r(
|
14
|
+
a,
|
15
|
+
{
|
16
|
+
...o,
|
17
|
+
value: o.value || "",
|
18
|
+
...p
|
19
|
+
}
|
20
|
+
) })
|
21
|
+
}
|
22
|
+
);
|
23
|
+
};
|
24
|
+
export {
|
25
|
+
F as FormInput
|
26
|
+
};
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { InputProps } from '../Input';
|
2
|
+
import { FormRenderControlExtendProps } from '../Form';
|
3
|
+
import { UseFormReturn } from 'react-hook-form';
|
4
|
+
import { FieldValues } from 'react-hook-form/dist/types/fields';
|
5
|
+
|
6
|
+
export interface FormInputProps<Data extends FieldValues, Form extends UseFormReturn<Data>> extends FormRenderControlExtendProps<Data, Form>, Omit<InputProps, 'form' | 'name'> {
|
7
|
+
}
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import { UseFormReturn } from 'react-hook-form';
|
2
|
+
import { FieldValues } from 'react-hook-form/dist/types/fields';
|
3
|
+
import { FormSelectProps } from './FormSelect.types';
|
4
|
+
|
5
|
+
export declare const FormSelect: <Data extends FieldValues, Form extends UseFormReturn<Data>, ExtendOptionData>(props: FormSelectProps<Data, Form, ExtendOptionData>) => import("react/jsx-runtime").JSX.Element;
|
@@ -0,0 +1,38 @@
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
2
|
+
import { FormControl as a } from "../Form/Form.mjs";
|
3
|
+
import { FormRenderControl as f } from "../Form/FormRenderControl.mjs";
|
4
|
+
import "../Select/SelectRoot.mjs";
|
5
|
+
import { Select as d } from "../Select/Select.mjs";
|
6
|
+
const x = (m) => {
|
7
|
+
const {
|
8
|
+
form: n,
|
9
|
+
label: i,
|
10
|
+
name: l,
|
11
|
+
options: p = [],
|
12
|
+
onChange: r,
|
13
|
+
...c
|
14
|
+
} = m;
|
15
|
+
return /* @__PURE__ */ e(
|
16
|
+
f,
|
17
|
+
{
|
18
|
+
form: n,
|
19
|
+
name: l,
|
20
|
+
label: i,
|
21
|
+
render: ({ field: t }) => /* @__PURE__ */ e(
|
22
|
+
d,
|
23
|
+
{
|
24
|
+
value: t.value,
|
25
|
+
options: p,
|
26
|
+
onChange: (o) => {
|
27
|
+
t.onChange(o), r == null || r(o);
|
28
|
+
},
|
29
|
+
renderTrigger: (o, s) => /* @__PURE__ */ e(a, { children: s }),
|
30
|
+
...c
|
31
|
+
}
|
32
|
+
)
|
33
|
+
}
|
34
|
+
);
|
35
|
+
};
|
36
|
+
export {
|
37
|
+
x as FormSelect
|
38
|
+
};
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { SelectProps } from '../Select';
|
2
|
+
import { FormRenderControlExtendProps } from '../Form';
|
3
|
+
import { UseFormReturn } from 'react-hook-form';
|
4
|
+
import { FieldValues } from 'react-hook-form/dist/types/fields';
|
5
|
+
|
6
|
+
export interface FormSelectProps<Data extends FieldValues, Form extends UseFormReturn<Data>, ExtendOptionData> extends FormRenderControlExtendProps<Data, Form>, SelectProps<ExtendOptionData> {
|
7
|
+
}
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import { UseFormReturn } from 'react-hook-form';
|
2
|
+
import { FieldValues } from 'react-hook-form/dist/types/fields';
|
3
|
+
import { FormTextareaProps } from './FormTextarea.types';
|
4
|
+
|
5
|
+
export declare const FormTextarea: <Data extends FieldValues, Form extends UseFormReturn<Data>>(props: FormTextareaProps<Data, Form>) => import("react/jsx-runtime").JSX.Element;
|