@oneplatformdev/ui 0.0.1-beta.100
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/Accordion/Accordion.d.ts +9 -0
- package/Accordion/Accordion.mjs +49 -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 +32 -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 +64 -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 +5 -0
- package/Checkbox/Checkbox.mjs +54 -0
- package/Checkbox/Checkbox.types.d.ts +10 -0
- package/Checkbox/index.d.ts +2 -0
- package/Checkbox/index.mjs +5 -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 +15 -0
- package/Combobox/Combobox.types.d.ts +38 -0
- package/Combobox/ComboboxOptionItem.d.ts +5 -0
- package/Combobox/ComboboxOptionItem.mjs +67 -0
- package/Combobox/ComboboxOptions.d.ts +4 -0
- package/Combobox/ComboboxOptions.mjs +12 -0
- package/Combobox/index.d.ts +2 -0
- package/Combobox/index.mjs +4 -0
- package/Combobox/package.json +7 -0
- package/Combobox-Dfbnw0oF.js +303 -0
- package/Command/Command.d.ts +80 -0
- package/Command/Command.mjs +116 -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 +11 -0
- package/DataTable/DataTable.mjs +64 -0
- package/DataTable/DataTable.types.d.ts +11 -0
- package/DataTable/DataTableColumnFilter.d.ts +4 -0
- package/DataTable/DataTableColumnFilter.mjs +31 -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 +21 -0
- package/Dialog/Dialog.mjs +117 -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 +148 -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 +22 -0
- package/Dropzone/Dropzone.mjs +152 -0
- package/Dropzone/Dropzone.types.d.ts +42 -0
- package/Dropzone/DropzoneFilePreview.d.ts +4 -0
- package/Dropzone/DropzoneFilePreview.mjs +9 -0
- package/Dropzone/DropzoneSinglePickPreview.d.ts +10 -0
- package/Dropzone/DropzoneSinglePickPreview.mjs +41 -0
- package/Dropzone/DropzoneUtils.d.ts +5 -0
- package/Dropzone/DropzoneUtils.mjs +24 -0
- package/Dropzone/index.d.ts +2 -0
- package/Dropzone/index.mjs +7 -0
- package/Dropzone/package.json +7 -0
- package/DropzoneFilePreview-Dhtv8F4u.js +67 -0
- package/Form/Form.d.ts +23 -0
- package/Form/Form.mjs +98 -0
- package/Form/FormRenderControl.d.ts +4 -0
- package/Form/FormRenderControl.mjs +21 -0
- package/Form/FormRenderControl.types.d.ts +16 -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 +4 -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 +6 -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 +29 -0
- package/FormDatePicker/FormDatePicker.types.d.ts +6 -0
- package/FormDatePicker/index.d.ts +3 -0
- package/FormDatePicker/index.mjs +5 -0
- package/FormDatePicker/package.json +7 -0
- package/FormDropzone/FormDropzone.d.ts +4 -0
- package/FormDropzone/FormDropzone.mjs +19 -0
- package/FormDropzone/FormDropzone.types.d.ts +6 -0
- package/FormDropzone/index.d.ts +2 -0
- package/FormDropzone/index.mjs +4 -0
- package/FormDropzone/package.json +7 -0
- package/FormInput/FormInput.d.ts +7 -0
- package/FormInput/FormInput.mjs +44 -0
- package/FormInput/FormInput.types.d.ts +6 -0
- package/FormInput/index.d.ts +2 -0
- package/FormInput/index.mjs +4 -0
- package/FormInput/package.json +7 -0
- package/FormRadio/FormRadio.d.ts +4 -0
- package/FormRadio/FormRadio.mjs +40 -0
- package/FormRadio/FormRadio.types.d.ts +6 -0
- package/FormRadio/index.d.ts +2 -0
- package/FormRadio/index.mjs +4 -0
- package/FormRadio/package.json +7 -0
- package/FormSelect/FormSelect.d.ts +4 -0
- package/FormSelect/FormSelect.mjs +40 -0
- package/FormSelect/FormSelect.types.d.ts +6 -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 +4 -0
- package/FormTextarea/FormTextarea.mjs +27 -0
- package/FormTextarea/FormTextarea.types.d.ts +6 -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 +73 -0
- package/Input/Input.types.d.ts +17 -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 +24 -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 +10 -0
- package/Label/package.json +7 -0
- package/LazyLoader/LazyLoader.d.ts +20 -0
- package/LazyLoader/LazyLoader.mjs +8 -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 +4 -0
- package/LoadingMask/LoadingMask.mjs +21 -0
- package/LoadingMask/LoadingMask.types.d.ts +5 -0
- package/LoadingMask/RenderLoadingMask.d.ts +3 -0
- package/LoadingMask/RenderLoadingMask.mjs +108 -0
- package/LoadingMask/index.d.ts +3 -0
- package/LoadingMask/index.mjs +6 -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 +28 -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/Radio/Radio.d.ts +4 -0
- package/Radio/Radio.mjs +12 -0
- package/Radio/Radio.types.d.ts +11 -0
- package/Radio/index.d.ts +2 -0
- package/Radio/index.mjs +4 -0
- package/Radio/package.json +7 -0
- package/RadioGroup/RadioGroup.d.ts +11 -0
- package/RadioGroup/RadioGroup.mjs +49 -0
- package/RadioGroup/index.d.ts +1 -0
- package/RadioGroup/index.mjs +6 -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 +51 -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 +103 -0
- package/Select/Select.types.d.ts +37 -0
- package/Select/SelectRoot.d.ts +13 -0
- package/Select/SelectRoot.mjs +126 -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 +28 -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/TablePagination/TablePagination.d.ts +16 -0
- package/TablePagination/TablePagination.mjs +74 -0
- package/TablePagination/index.d.ts +1 -0
- package/TablePagination/index.mjs +4 -0
- package/TablePagination/package.json +7 -0
- package/Tabs/Tabs.d.ts +5 -0
- package/Tabs/Tabs.mjs +23 -0
- package/Tabs/Tabs.types.d.ts +12 -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 +10 -0
- package/Tabs/package.json +7 -0
- package/Textarea/Textarea.d.ts +4 -0
- package/Textarea/Textarea.mjs +75 -0
- package/Textarea/Textarea.types.d.ts +18 -0
- package/Textarea/index.d.ts +2 -0
- package/Textarea/index.mjs +4 -0
- package/Textarea/package.json +7 -0
- package/Textarea/useAutosizeTextArea.d.ts +3 -0
- package/Textarea/useAutosizeTextArea.mjs +20 -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 +68 -0
- package/index.mjs +367 -0
- package/package.json +103 -0
- package/tailwind.config.mjs +148 -0
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { jsxs as r, jsx as i, Fragment as U } from "react/jsx-runtime";
|
|
2
|
+
import { X as j } from "lucide-react";
|
|
3
|
+
import { forwardRef as H, useState as w, useImperativeHandle as O } from "react";
|
|
4
|
+
import { useDropzone as X } from "react-dropzone";
|
|
5
|
+
import { cn as f } from "@oneplatformdev/utils";
|
|
6
|
+
import { Card as Y } from "../Card/Card.mjs";
|
|
7
|
+
import { F as q, D as G } from "../DropzoneFilePreview-Dhtv8F4u.js";
|
|
8
|
+
import { DropzoneSinglePickPreview as J } from "./DropzoneSinglePickPreview.mjs";
|
|
9
|
+
import { DefaultFileIcon as K, isFile as g, extractName as Q } from "./DropzoneUtils.mjs";
|
|
10
|
+
const R = H(
|
|
11
|
+
({
|
|
12
|
+
acceptTypes: y = G,
|
|
13
|
+
maxSizeMB: F,
|
|
14
|
+
maxFiles: v = 1,
|
|
15
|
+
onErrors: a,
|
|
16
|
+
hideErrors: D = !1,
|
|
17
|
+
disabled: p = !1,
|
|
18
|
+
classNames: o,
|
|
19
|
+
value: z = [],
|
|
20
|
+
onChangeValue: s,
|
|
21
|
+
className: I,
|
|
22
|
+
labelDropzonePrompt: E = "Drop files here or click to select",
|
|
23
|
+
labelDropzoneSubPrompt: b = "",
|
|
24
|
+
labelOrClickToSelect: Z = "Click to select files",
|
|
25
|
+
labelSelectedFiles: S = "Selected Files",
|
|
26
|
+
labelUploadErrors: N = "Upload Errors",
|
|
27
|
+
labelFileTooLarge: W = "File is too large",
|
|
28
|
+
labelInvalidFileType: k = "Invalid file type",
|
|
29
|
+
singlePick: c = !1,
|
|
30
|
+
...B
|
|
31
|
+
}, T) => {
|
|
32
|
+
const [n, x] = w(z), [m, _] = w([]), A = (e, l) => {
|
|
33
|
+
_(l), a == null || a(l);
|
|
34
|
+
const t = c ? e.slice(0, 1) : [...n, ...e].slice(0, v);
|
|
35
|
+
x(t), s == null || s(t);
|
|
36
|
+
}, u = (e, l) => {
|
|
37
|
+
if (p) return;
|
|
38
|
+
e.stopPropagation();
|
|
39
|
+
const t = n.filter((d, h) => h !== l);
|
|
40
|
+
x(t), s == null || s(t);
|
|
41
|
+
}, { getRootProps: L, getInputProps: M, isDragActive: P } = X({
|
|
42
|
+
onDrop: A,
|
|
43
|
+
accept: y.reduce((e, l) => (e[l] = [], e), {}),
|
|
44
|
+
maxSize: F * 1024 * 1024,
|
|
45
|
+
maxFiles: c ? 1 : v,
|
|
46
|
+
disabled: p
|
|
47
|
+
});
|
|
48
|
+
return O(T, () => ({
|
|
49
|
+
setItems: x
|
|
50
|
+
}), []), /* @__PURE__ */ r(
|
|
51
|
+
Y,
|
|
52
|
+
{
|
|
53
|
+
...L(),
|
|
54
|
+
...B,
|
|
55
|
+
className: f(
|
|
56
|
+
"border-dashed p-2 text-center flex flex-col items-center justify-center cursor-pointer",
|
|
57
|
+
p && "border-[#E4E4E7] pointer-events-none",
|
|
58
|
+
m.length > 0 ? "border-red-500" : "!border-[#E4E4E7]",
|
|
59
|
+
P && "bg-gray-100",
|
|
60
|
+
c && "!shadow-none",
|
|
61
|
+
c && n.length > 0 && "!p-0 !shadow-none",
|
|
62
|
+
I
|
|
63
|
+
),
|
|
64
|
+
children: [
|
|
65
|
+
/* @__PURE__ */ i("input", { ...M() }),
|
|
66
|
+
n.length === 0 && m.length === 0 && /* @__PURE__ */ r(
|
|
67
|
+
"div",
|
|
68
|
+
{
|
|
69
|
+
className: f(
|
|
70
|
+
"flex flex-col items-center gap-1",
|
|
71
|
+
o == null ? void 0 : o.idleWrapper
|
|
72
|
+
),
|
|
73
|
+
children: [
|
|
74
|
+
/* @__PURE__ */ i(K, {}),
|
|
75
|
+
!p && /* @__PURE__ */ r(U, { children: [
|
|
76
|
+
/* @__PURE__ */ i("span", { className: "font-medium text-md text-foreground max-w-[200px]", children: E }),
|
|
77
|
+
/* @__PURE__ */ i("span", { className: "font-normal text-xs text-foreground max-w-[250px]", children: b })
|
|
78
|
+
] })
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
),
|
|
82
|
+
m.length > 0 && /* @__PURE__ */ r("div", { className: f("w-full mt-4", o == null ? void 0 : o.errorWrapper), children: [
|
|
83
|
+
/* @__PURE__ */ r("span", { className: "font-semibold text-red-500", children: [
|
|
84
|
+
N,
|
|
85
|
+
":"
|
|
86
|
+
] }),
|
|
87
|
+
/* @__PURE__ */ i("ul", { className: "mt-2 text-sm text-red-500 list-disc list-inside", children: m.map((e, l) => /* @__PURE__ */ r("li", { children: [
|
|
88
|
+
e.file.name,
|
|
89
|
+
" (",
|
|
90
|
+
(e.file.size / (1024 * 1024)).toFixed(2),
|
|
91
|
+
" MB)",
|
|
92
|
+
!D && /* @__PURE__ */ i("ul", { className: "ml-4 list-disc list-inside", children: e.errors.map((t, d) => /* @__PURE__ */ r("li", { children: [
|
|
93
|
+
t.code === "file-too-large" && W,
|
|
94
|
+
t.code === "file-invalid-type" && k,
|
|
95
|
+
t.code !== "file-too-large" && t.code !== "file-invalid-type" && t.message
|
|
96
|
+
] }, d)) })
|
|
97
|
+
] }, l)) })
|
|
98
|
+
] }),
|
|
99
|
+
!!(c && n.length) && /* @__PURE__ */ i(
|
|
100
|
+
J,
|
|
101
|
+
{
|
|
102
|
+
item: n[0],
|
|
103
|
+
onRemoveClick: (e) => u(e, 0),
|
|
104
|
+
disabled: p
|
|
105
|
+
}
|
|
106
|
+
),
|
|
107
|
+
!c && n.length > 0 && /* @__PURE__ */ r("div", { className: f("w-full mt-2", o == null ? void 0 : o.previewWrapper), children: [
|
|
108
|
+
/* @__PURE__ */ r("pre", { className: "font-semibold text-gray-600", children: [
|
|
109
|
+
S,
|
|
110
|
+
":"
|
|
111
|
+
] }),
|
|
112
|
+
/* @__PURE__ */ i("ul", { className: "mt-2 text-sm text-gray-500 flex flex-wrap gap-4 items-start justify-center", children: n.map((e, l) => {
|
|
113
|
+
const t = g(e) ? e.name : Q(e), d = g(e) ? (e.size / (1024 * 1024)).toFixed(2) + " MB" : "";
|
|
114
|
+
return /* @__PURE__ */ r(
|
|
115
|
+
"li",
|
|
116
|
+
{
|
|
117
|
+
className: "flex flex-col items-center gap-2 relative",
|
|
118
|
+
children: [
|
|
119
|
+
/* @__PURE__ */ r("div", { className: "relative", children: [
|
|
120
|
+
/* @__PURE__ */ i(q, { item: e, styles: o }),
|
|
121
|
+
/* @__PURE__ */ i(
|
|
122
|
+
"div",
|
|
123
|
+
{
|
|
124
|
+
className: "absolute top-0 right-0 cursor-pointer bg-gray-300 rounded-sm",
|
|
125
|
+
onClick: (h) => u(h, l),
|
|
126
|
+
children: /* @__PURE__ */ i(j, { size: 16, strokeWidth: 1, color: "black" })
|
|
127
|
+
}
|
|
128
|
+
)
|
|
129
|
+
] }),
|
|
130
|
+
/* @__PURE__ */ r("span", { className: "inline-flex flex-col items-center", children: [
|
|
131
|
+
/* @__PURE__ */ i("span", { className: "max-w-[80px] text-ellipsis overflow-hidden whitespace-nowrap", children: t }),
|
|
132
|
+
d && /* @__PURE__ */ r("span", { children: [
|
|
133
|
+
"(",
|
|
134
|
+
d,
|
|
135
|
+
")"
|
|
136
|
+
] })
|
|
137
|
+
] })
|
|
138
|
+
]
|
|
139
|
+
},
|
|
140
|
+
l
|
|
141
|
+
);
|
|
142
|
+
}) })
|
|
143
|
+
] })
|
|
144
|
+
]
|
|
145
|
+
}
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
);
|
|
149
|
+
R.displayName = "Dropzone";
|
|
150
|
+
export {
|
|
151
|
+
R as Dropzone
|
|
152
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
2
|
+
import { FileRejection } from 'react-dropzone';
|
|
3
|
+
|
|
4
|
+
export type DropzoneValueItem = File | string;
|
|
5
|
+
export interface FilePreviewProps {
|
|
6
|
+
item: DropzoneValueItem;
|
|
7
|
+
styles?: Pick<DropzoneStyles, 'previewWraper' | 'previewImage' | 'previewFile'>;
|
|
8
|
+
}
|
|
9
|
+
export interface DropzoneTranslations {
|
|
10
|
+
labelDropzonePrompt?: string;
|
|
11
|
+
labelDropzoneSubPrompt?: string;
|
|
12
|
+
labelOrClickToSelect?: string;
|
|
13
|
+
labelSelectedFiles?: string;
|
|
14
|
+
labelUploadErrors?: string;
|
|
15
|
+
labelFileTooLarge?: string;
|
|
16
|
+
labelInvalidFileType?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface DropzoneProps extends DropzoneTranslations, React.HTMLAttributes<HTMLDivElement> {
|
|
19
|
+
acceptTypes?: string[];
|
|
20
|
+
maxSizeMB: number;
|
|
21
|
+
maxFiles?: number;
|
|
22
|
+
onErrors?: (errors: FileRejection[]) => void;
|
|
23
|
+
hideErrors?: boolean;
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
classNames?: DropzoneStyles;
|
|
26
|
+
value?: DropzoneValueItem[];
|
|
27
|
+
onChangeValue?: (items: DropzoneValueItem[]) => void;
|
|
28
|
+
singlePick?: boolean;
|
|
29
|
+
}
|
|
30
|
+
export interface DropzoneStyles {
|
|
31
|
+
idleWrapper?: string;
|
|
32
|
+
previewWrapper?: string;
|
|
33
|
+
errorWrapper?: string;
|
|
34
|
+
previewWraper?: string;
|
|
35
|
+
previewImage?: string;
|
|
36
|
+
previewFile?: string;
|
|
37
|
+
}
|
|
38
|
+
export declare const DEFAULT_FILE_TYPES: string[];
|
|
39
|
+
export declare const DEFAULT_IMAGES_TYPES: string[];
|
|
40
|
+
export interface DropzoneControl {
|
|
41
|
+
setItems: Dispatch<SetStateAction<DropzoneValueItem[]>>;
|
|
42
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DropzoneValueItem } from './Dropzone.types';
|
|
2
|
+
|
|
3
|
+
export declare const transformImageToSrc: (preview?: string | File | null) => string;
|
|
4
|
+
interface SinglePickPreviewProps {
|
|
5
|
+
item: DropzoneValueItem;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
onRemoveClick: (e: React.MouseEvent<HTMLDivElement>) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const DropzoneSinglePickPreview: ({ item, disabled, onRemoveClick, }: SinglePickPreviewProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsxs as s, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as c } from "react";
|
|
3
|
+
import { isFile as i } from "./DropzoneUtils.mjs";
|
|
4
|
+
import { X as a, FileIcon as u } from "lucide-react";
|
|
5
|
+
const d = (t) => {
|
|
6
|
+
if (!t) return "";
|
|
7
|
+
switch (!0) {
|
|
8
|
+
case (typeof t == "string" && !!t.trim() && t !== "null"):
|
|
9
|
+
return t;
|
|
10
|
+
case t instanceof File:
|
|
11
|
+
return URL.createObjectURL(t);
|
|
12
|
+
case t instanceof FileList:
|
|
13
|
+
return t[0] ? URL.createObjectURL(t[0]) : "";
|
|
14
|
+
default:
|
|
15
|
+
return "";
|
|
16
|
+
}
|
|
17
|
+
}, p = ({
|
|
18
|
+
item: t,
|
|
19
|
+
disabled: l,
|
|
20
|
+
onRemoveClick: n
|
|
21
|
+
}) => {
|
|
22
|
+
const e = i(t) ? t.name : t, o = c(() => d(t), [t]);
|
|
23
|
+
return /* @__PURE__ */ s("div", { className: "relative w-full h-64 sm:h-80 md:h-96 overflow-hidden outline-[#E4E4E7] outline-[2px] outline-dashed outline-offset-[-1px] rounded-lg", children: [
|
|
24
|
+
!l && /* @__PURE__ */ r("div", { className: "absolute top-2 right-2 cursor-pointer bg-white/70 rounded-[4px] p-1 shadow", onClick: n, children: /* @__PURE__ */ r(a, { size: 16, strokeWidth: 2, color: "black" }) }),
|
|
25
|
+
o ? /* @__PURE__ */ r(
|
|
26
|
+
"img",
|
|
27
|
+
{
|
|
28
|
+
src: o,
|
|
29
|
+
alt: e == null ? void 0 : e.toString(),
|
|
30
|
+
className: "w-full h-full object-cover rounded-lg "
|
|
31
|
+
}
|
|
32
|
+
) : /* @__PURE__ */ s("div", { className: "w-full h-full flex flex-col items-center justify-center text-gray-600", children: [
|
|
33
|
+
/* @__PURE__ */ r(u, { size: 28 }),
|
|
34
|
+
/* @__PURE__ */ r("span", { className: "text-sm mt-2 break-all px-2 text-center", children: e == null ? void 0 : e.toString() })
|
|
35
|
+
] })
|
|
36
|
+
] });
|
|
37
|
+
};
|
|
38
|
+
export {
|
|
39
|
+
p as DropzoneSinglePickPreview,
|
|
40
|
+
d as transformImageToSrc
|
|
41
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { DropzoneValueItem } from './Dropzone.types';
|
|
2
|
+
|
|
3
|
+
export declare function isFile(item: DropzoneValueItem): item is File;
|
|
4
|
+
export declare function extractName(url: string): string;
|
|
5
|
+
export declare const DefaultFileIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsxs as t, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
function d(e) {
|
|
3
|
+
return e instanceof File;
|
|
4
|
+
}
|
|
5
|
+
function r(e) {
|
|
6
|
+
try {
|
|
7
|
+
const i = e.split("?")[0].split("#")[0].split("/");
|
|
8
|
+
return i[i.length - 1] || e;
|
|
9
|
+
} catch {
|
|
10
|
+
return e;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
const o = () => /* @__PURE__ */ t("svg", { width: "55", height: "55", viewBox: "0 0 55 55", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
14
|
+
/* @__PURE__ */ l("mask", { id: "mask0_2430_114601", maskUnits: "userSpaceOnUse", x: "7", y: "4", width: "39", height: "46", children: /* @__PURE__ */ l("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M7.25 4.68359H45.6174V49.354H7.25V4.68359Z", fill: "white" }) }),
|
|
15
|
+
/* @__PURE__ */ l("g", { mask: "url(#mask0_2430_114601)", children: /* @__PURE__ */ l("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M17.5386 8.05859C13.8103 8.05859 10.7143 11.0781 10.6266 14.8018V38.9196C10.5456 42.7468 13.5606 45.8968 17.3518 45.9801H35.5386C39.2938 45.8451 42.2661 42.7468 42.2413 38.9308V18.9216L31.8148 8.05859H17.5656H17.5386ZM17.5664 49.3551H17.2829C11.6309 49.2336 7.1309 44.5356 7.2524 38.8836V14.7613C7.38515 9.17909 11.9932 4.68359 17.5327 4.68359H17.5732H32.5334C32.9924 4.68359 33.4312 4.87034 33.7507 5.20109L45.1492 17.0743C45.4484 17.3871 45.6172 17.8078 45.6172 18.2421V38.9196C45.6532 44.5648 41.2522 49.1526 35.5979 49.3551H17.5664Z", fill: "#0D0E2B", "fill-opacity": "0.7" }) }),
|
|
16
|
+
/* @__PURE__ */ l("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M43.9198 20.3703H37.7233C33.6036 20.359 30.2578 17.002 30.2578 12.889V6.34375C30.2578 5.41225 31.0138 4.65625 31.9453 4.65625C32.8768 4.65625 33.6328 5.41225 33.6328 6.34375V12.889C33.6328 15.148 35.4688 16.9885 37.7278 16.9953H43.9198C44.8513 16.9953 45.6073 17.7513 45.6073 18.6828C45.6073 19.6143 44.8513 20.3703 43.9198 20.3703Z", fill: "#0D0E2B", "fill-opacity": "0.7" }),
|
|
17
|
+
/* @__PURE__ */ l("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M25.5708 37.729C24.6393 37.729 23.8833 36.973 23.8833 36.0415V22.4492C23.8833 21.5177 24.6393 20.7617 25.5708 20.7617C26.5023 20.7617 27.2583 21.5177 27.2583 22.4492V36.0415C27.2583 36.973 26.5023 37.729 25.5708 37.729Z", fill: "#0D0E2B", "fill-opacity": "0.7" }),
|
|
18
|
+
/* @__PURE__ */ l("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M25.5678 37.7279C25.1201 37.7279 24.6881 37.5501 24.3731 37.2306L19.0968 31.9341C18.4398 31.2726 18.4421 30.2039 19.1013 29.5469C19.7628 28.8899 20.8316 28.8899 21.4886 29.5514L25.5678 33.6509L29.6471 29.5514C30.3041 28.8899 31.3728 28.8899 32.0343 29.5469C32.6936 30.2039 32.6958 31.2726 32.0388 31.9341L26.7626 37.2306C26.4476 37.5501 26.0156 37.7279 25.5678 37.7279Z", fill: "#0D0E2B", "fill-opacity": "0.7" })
|
|
19
|
+
] });
|
|
20
|
+
export {
|
|
21
|
+
o as DefaultFileIcon,
|
|
22
|
+
r as extractName,
|
|
23
|
+
d as isFile
|
|
24
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { jsx as l, jsxs as d } from "react/jsx-runtime";
|
|
2
|
+
import { useState as m, useEffect as f } from "react";
|
|
3
|
+
import { File as s } from "lucide-react";
|
|
4
|
+
import { isFile as o } from "./Dropzone/DropzoneUtils.mjs";
|
|
5
|
+
import { cn as c } from "@oneplatformdev/utils";
|
|
6
|
+
const h = [
|
|
7
|
+
"application/msword",
|
|
8
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
9
|
+
"text/csv",
|
|
10
|
+
"text/plain",
|
|
11
|
+
"application/pdf"
|
|
12
|
+
], u = [
|
|
13
|
+
"image/png",
|
|
14
|
+
"image/jpeg",
|
|
15
|
+
"image/jpg",
|
|
16
|
+
"image/webp",
|
|
17
|
+
"image/gif"
|
|
18
|
+
], j = ({ item: e, styles: r }) => {
|
|
19
|
+
const [t, a] = m(null), p = o(e) && u.includes(e.type);
|
|
20
|
+
return f(() => {
|
|
21
|
+
let n = null;
|
|
22
|
+
if (o(e) && p) {
|
|
23
|
+
const i = new FileReader();
|
|
24
|
+
return i.onloadend = () => a(i.result), i.readAsDataURL(e), () => a(null);
|
|
25
|
+
} else {
|
|
26
|
+
if (typeof e == "string")
|
|
27
|
+
return n = new Image(), n.src = e, n.onload = () => a(e), n.onerror = () => a(null), () => {
|
|
28
|
+
n.onload = null, n.onerror = null;
|
|
29
|
+
};
|
|
30
|
+
a(null);
|
|
31
|
+
}
|
|
32
|
+
return () => a(null);
|
|
33
|
+
}, [e, p]), /* @__PURE__ */ l(
|
|
34
|
+
"div",
|
|
35
|
+
{
|
|
36
|
+
className: c(
|
|
37
|
+
"w-32 h-32 border border-gray-300 rounded-md overflow-hidden flex items-center justify-center",
|
|
38
|
+
r == null ? void 0 : r.previewWraper
|
|
39
|
+
),
|
|
40
|
+
children: t ? /* @__PURE__ */ l(
|
|
41
|
+
"img",
|
|
42
|
+
{
|
|
43
|
+
src: t,
|
|
44
|
+
alt: o(e) ? e.name : "external-image",
|
|
45
|
+
className: c("w-full h-full object-cover", r == null ? void 0 : r.previewImage)
|
|
46
|
+
}
|
|
47
|
+
) : /* @__PURE__ */ d(
|
|
48
|
+
"div",
|
|
49
|
+
{
|
|
50
|
+
className: c(
|
|
51
|
+
"flex flex-col items-center justify-center text-gray-500 text-sm p-2 text-center",
|
|
52
|
+
r == null ? void 0 : r.previewFile
|
|
53
|
+
),
|
|
54
|
+
children: [
|
|
55
|
+
/* @__PURE__ */ l(s, { className: "w-6 h-6" }),
|
|
56
|
+
o(e) ? /* @__PURE__ */ l("span", { className: "text-xs break-all", children: e.name }) : /* @__PURE__ */ l("span", { className: "text-xs break-all", children: e })
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
};
|
|
63
|
+
export {
|
|
64
|
+
h as D,
|
|
65
|
+
j as F,
|
|
66
|
+
u as a
|
|
67
|
+
};
|
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,98 @@
|
|
|
1
|
+
import { jsx as n } 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, l = s.createContext(
|
|
9
|
+
{}
|
|
10
|
+
), S = ({
|
|
11
|
+
...e
|
|
12
|
+
}) => /* @__PURE__ */ n(l.Provider, { value: { name: e.name }, children: /* @__PURE__ */ n(p, { ...e }) }), c = () => {
|
|
13
|
+
const e = s.useContext(l), t = s.useContext(f), { getFieldState: o, formState: r } = x(), m = o(e.name, r);
|
|
14
|
+
if (!e)
|
|
15
|
+
throw new Error("useFormField should be used within <FormField>");
|
|
16
|
+
const { id: i } = t;
|
|
17
|
+
return {
|
|
18
|
+
id: i,
|
|
19
|
+
name: e.name,
|
|
20
|
+
formItemId: `${i}-form-item`,
|
|
21
|
+
formDescriptionId: `${i}-form-item-description`,
|
|
22
|
+
formMessageId: `${i}-form-item-message`,
|
|
23
|
+
...m
|
|
24
|
+
};
|
|
25
|
+
}, f = s.createContext(
|
|
26
|
+
{}
|
|
27
|
+
), v = s.forwardRef(({ className: e, ...t }, o) => {
|
|
28
|
+
const r = s.useId();
|
|
29
|
+
return /* @__PURE__ */ n(f.Provider, { value: { id: r }, children: /* @__PURE__ */ n("div", { ref: o, className: a("space-y-1", e), ...t }) });
|
|
30
|
+
});
|
|
31
|
+
v.displayName = "FormItem";
|
|
32
|
+
const C = s.forwardRef(({ className: e, ...t }, o) => {
|
|
33
|
+
const { error: r, formItemId: m } = c();
|
|
34
|
+
return /* @__PURE__ */ n(
|
|
35
|
+
I,
|
|
36
|
+
{
|
|
37
|
+
ref: o,
|
|
38
|
+
"data-state": r ? "invalid" : "valid",
|
|
39
|
+
className: a(r && "text-destructive", e),
|
|
40
|
+
htmlFor: m,
|
|
41
|
+
...t
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
});
|
|
45
|
+
C.displayName = "FormLabel";
|
|
46
|
+
const g = s.forwardRef(({ className: e, ...t }, o) => {
|
|
47
|
+
const { error: r, formItemId: m, formDescriptionId: i, formMessageId: d } = c();
|
|
48
|
+
return /* @__PURE__ */ n(
|
|
49
|
+
F,
|
|
50
|
+
{
|
|
51
|
+
ref: o,
|
|
52
|
+
id: m,
|
|
53
|
+
"data-state": r ? "invalid" : "valid",
|
|
54
|
+
"aria-describedby": r ? `${i} ${d}` : `${i}`,
|
|
55
|
+
"aria-invalid": !!r,
|
|
56
|
+
className: a("group/form-control", e),
|
|
57
|
+
...t
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
});
|
|
61
|
+
g.displayName = "FormControl";
|
|
62
|
+
const N = s.forwardRef(({ className: e, ...t }, o) => {
|
|
63
|
+
const { formDescriptionId: r } = c();
|
|
64
|
+
return /* @__PURE__ */ n(
|
|
65
|
+
"p",
|
|
66
|
+
{
|
|
67
|
+
ref: o,
|
|
68
|
+
id: r,
|
|
69
|
+
className: a("text-[0.8rem] text-muted-foreground", e),
|
|
70
|
+
...t
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
});
|
|
74
|
+
N.displayName = "FormDescription";
|
|
75
|
+
const w = s.forwardRef(({ className: e, children: t, ...o }, r) => {
|
|
76
|
+
const { error: m, formMessageId: i } = c(), d = m ? String(m == null ? void 0 : m.message) : t;
|
|
77
|
+
return d ? /* @__PURE__ */ n(
|
|
78
|
+
"p",
|
|
79
|
+
{
|
|
80
|
+
ref: r,
|
|
81
|
+
id: i,
|
|
82
|
+
className: a("text-[0.8rem] font-medium text-destructive", e),
|
|
83
|
+
...o,
|
|
84
|
+
children: d
|
|
85
|
+
}
|
|
86
|
+
) : null;
|
|
87
|
+
});
|
|
88
|
+
w.displayName = "FormMessage";
|
|
89
|
+
export {
|
|
90
|
+
M as Form,
|
|
91
|
+
g as FormControl,
|
|
92
|
+
N as FormDescription,
|
|
93
|
+
S as FormField,
|
|
94
|
+
v as FormItem,
|
|
95
|
+
C as FormLabel,
|
|
96
|
+
w as FormMessage,
|
|
97
|
+
c as useFormField
|
|
98
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as r, jsxs as a } from "react/jsx-runtime";
|
|
2
|
+
import { FormField as d, FormItem as i, FormLabel as F, FormMessage as p } from "./Form.mjs";
|
|
3
|
+
const b = (e) => {
|
|
4
|
+
const { form: n, name: m, label: o, render: t, containerProps: l = {}, ...s } = e;
|
|
5
|
+
return /* @__PURE__ */ r(
|
|
6
|
+
d,
|
|
7
|
+
{
|
|
8
|
+
control: n.control,
|
|
9
|
+
name: m,
|
|
10
|
+
render: (c) => /* @__PURE__ */ a(i, { ...l, children: [
|
|
11
|
+
!!o && /* @__PURE__ */ r(F, { children: o }),
|
|
12
|
+
t(c),
|
|
13
|
+
/* @__PURE__ */ r(p, {})
|
|
14
|
+
] }),
|
|
15
|
+
...s
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
b as FormRenderControl
|
|
21
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ControllerFieldState, ControllerRenderProps, FieldPath, FieldValues, UseFormReturn, UseFormStateReturn } from 'react-hook-form';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
|
|
4
|
+
export type FormRenderProps<Data extends FieldValues> = ({ field, fieldState, formState, }: {
|
|
5
|
+
field: ControllerRenderProps<Data, FieldPath<Data>>;
|
|
6
|
+
fieldState: ControllerFieldState;
|
|
7
|
+
formState: UseFormStateReturn<Data>;
|
|
8
|
+
}) => React.ReactElement;
|
|
9
|
+
export interface FormRenderControlProps<Data extends FieldValues> {
|
|
10
|
+
form: UseFormReturn<Data>;
|
|
11
|
+
name: FieldPath<Data>;
|
|
12
|
+
label?: string;
|
|
13
|
+
render: FormRenderProps<Data>;
|
|
14
|
+
containerProps?: React.HTMLAttributes<HTMLDivElement>;
|
|
15
|
+
}
|
|
16
|
+
export type FormRenderControlExtendProps<Data extends FieldValues> = Omit<FormRenderControlProps<Data>, 'render'>;
|
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,30 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { FormControl as h } from "../Form/Form.mjs";
|
|
3
|
+
import { FormRenderControl as p } from "../Form/FormRenderControl.mjs";
|
|
4
|
+
import { CheckboxLabel as s } from "../Checkbox/Checkbox.mjs";
|
|
5
|
+
const i = (t) => {
|
|
6
|
+
const { form: c, label: a, name: l, onCheckedChange: o, ...m } = t;
|
|
7
|
+
return /* @__PURE__ */ e(
|
|
8
|
+
p,
|
|
9
|
+
{
|
|
10
|
+
form: c,
|
|
11
|
+
name: l,
|
|
12
|
+
render: ({ field: r }) => /* @__PURE__ */ e(h, { children: /* @__PURE__ */ e(
|
|
13
|
+
s,
|
|
14
|
+
{
|
|
15
|
+
...r,
|
|
16
|
+
...m,
|
|
17
|
+
label: a,
|
|
18
|
+
checked: r.value || !1,
|
|
19
|
+
onCheckedChange: (n) => {
|
|
20
|
+
r.onChange(n), o == null || o(n);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
) }),
|
|
24
|
+
...m
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
export {
|
|
29
|
+
i as FormCheckbox
|
|
30
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FormRenderControlExtendProps } from '../Form';
|
|
2
|
+
import { FieldValues } from 'react-hook-form';
|
|
3
|
+
import { CheckboxProps } from '../Checkbox';
|
|
4
|
+
|
|
5
|
+
export interface FormCheckboxProps<Data extends FieldValues> extends FormRenderControlExtendProps<Data>, Omit<CheckboxProps, 'form' | 'name' | 'label'> {
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
}
|