@deftui/react 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # @deftui/react
2
+
3
+ A React component library built on Base UI, shadcn/ui, and their open-source registry ecosystem, offering easy-to-use compound component APIs.
4
+
5
+ [Upstream documentation](./dist/vendor/README.md): To look up component usage, check the local exports first, then consult the upstream if you really needs them.
6
+
7
+ ## Installation
8
+
9
+ ```sh
10
+ bun add @deftui/react
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ Install Tailwind CSS 4 in your project first, then import the styles in your application's global CSS:
16
+
17
+ ```css
18
+ @import "tailwindcss";
19
+ @import "@deftui/react/styles";
20
+ ```
21
+
22
+ Component Example:
23
+
24
+ ```tsx
25
+ import { Button, Card } from "@deftui/react";
26
+
27
+ export function Example() {
28
+ return (
29
+ <Card>
30
+ <Card.Header>
31
+ <Card.Title>Welcome to Deft UI</Card.Title>
32
+ <Card.Description>Compose your UI using Compound Component API</Card.Description>
33
+ </Card.Header>
34
+
35
+ <Card.Content>
36
+ <Button>Get started</Button>
37
+ </Card.Content>
38
+ </Card>
39
+ );
40
+ }
41
+ ```
package/dist/index.d.mts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { useCopyToClipboard } from "./vendor/coss/hooks/use-copy-to-clipboard.mjs";
2
2
  import { useIsMobile, useMediaQuery } from "./vendor/coss/hooks/use-media-query.mjs";
3
- import { FileUploadProps, useFileUpload as useStore } from "./vendor/diceui/file-upload.mjs";
4
3
  import { Button } from "./vendor/shadcn/button.mjs";
5
4
  import { AlertDialogHandle, createAlertDialogHandle } from "./vendor/shadcn/alert-dialog.mjs";
6
5
  import { Separator } from "./vendor/shadcn/separator.mjs";
@@ -12,11 +11,11 @@ import { Toaster, toast } from "./vendor/shadcn/toast.mjs";
12
11
  import { Input } from "./vendor/shadcn/input.mjs";
13
12
  import { useSidebar } from "./vendor/shadcn/sidebar.mjs";
14
13
  import { Sidebar } from "./widgets/sidebar.mjs";
15
- import { Breadcrumb } from "./widgets/breadcrumb.mjs";
16
- import { Pagination } from "./widgets/pagination.mjs";
14
+ import { DatePicker, DateRange, DateRangePicker, TimePicker } from "./widgets/datetime.mjs";
15
+ import { Dropzone, formatSize } from "./widgets/dropzone.mjs";
17
16
  import { LightboxActions, LightboxBackdrop, LightboxCaptions, LightboxChangeReason, LightboxClose, LightboxContent, LightboxControl, LightboxControlContext, LightboxCounter, LightboxDownload, LightboxImageChangeEventDetails, LightboxImageItem, LightboxItem, LightboxMore, LightboxNext, LightboxOpenEventDetails, LightboxPrevious, LightboxProps, LightboxSlide, LightboxSlides, LightboxThumbnail, LightboxThumbnails, LightboxToolbar, LightboxTrigger, LightboxTriggerProps, LightboxVideoItem, LightboxViewport, LightboxZoom, LightboxZoomButton, useLightbox } from "./vendor/tailored/lightbox.mjs";
18
17
  import { Carousel, Image, ImageProps, Lightbox } from "./widgets/multimedia.mjs";
19
- import { DatePicker, DateRange, DateRangePicker, TimePicker } from "./widgets/datetime-picker.mjs";
18
+ import { Pagination } from "./widgets/pagination.mjs";
20
19
  import { Badge } from "./vendor/shadcn/badge.mjs";
21
20
  import { Switch } from "./vendor/shadcn/switch.mjs";
22
21
  import { Spinner } from "./vendor/shadcn/spinner.mjs";
@@ -26,8 +25,10 @@ import { Textarea } from "./vendor/shadcn/textarea.mjs";
26
25
  import { ScrollArea } from "./vendor/coss/scroll-area.mjs";
27
26
  import { Form } from "./vendor/coss/form.mjs";
28
27
  import { IconSwap } from "./vendor/tailored/icon-swap.mjs";
29
- import { AlertDialog, ButtonGroup, Calendar, Card, Combobox, Dialog, Drawer, Dropdown, Empty, Field, FileUpload, InputGroup, Kbd, Popover, Progress, Radio, Select, Table, Tabs, Tooltip } from "./widgets/index.mjs";
28
+ import { AlertDialog, Breadcrumb, ButtonGroup, Calendar, Card, Combobox, Dialog, Drawer, Dropdown, Empty, Field, InputGroup, Kbd, Popover, Progress, Radio, Select, Table, Tabs, Tooltip } from "./widgets/index.mjs";
30
29
  import { cn } from "cn";
31
30
  import { cva } from "class-variance-authority";
32
31
  import { mergeProps } from "@base-ui/react/merge-props";
33
- export { AlertDialog, type AlertDialogHandle, Badge, Breadcrumb, Button, ButtonGroup, Calendar, Card, Carousel, Checkbox, Combobox, type ComboboxItemCollection, type ComboboxPrimitiveValue, type CreateComboboxItemsOptions, DatePicker, type DateRange, DateRangePicker, Dialog, type DialogHandle, Drawer, type DrawerHandle, Dropdown, Empty, Field, FileUpload, type FileUploadProps, Form, IconSwap, Image, ImageProps, Input, InputGroup, Kbd, Label, Lightbox, type LightboxActions, type LightboxBackdrop, type LightboxCaptions, type LightboxChangeReason, type LightboxClose, type LightboxContent, type LightboxControl, type LightboxControlContext, type LightboxCounter, type LightboxDownload, type LightboxImageChangeEventDetails, type LightboxImageItem, type LightboxItem, type LightboxMore, type LightboxNext, type LightboxOpenEventDetails, type LightboxPrevious, type LightboxProps, type LightboxSlide, type LightboxSlides, type LightboxThumbnail, type LightboxThumbnails, type LightboxToolbar, type LightboxTrigger, type LightboxTriggerProps, type LightboxVideoItem, type LightboxViewport, type LightboxZoom, type LightboxZoomButton, Pagination, Popover, Progress, Radio, ScrollArea, Select, Separator, Sidebar, Skeleton, Spinner, Switch, Table, Tabs, Textarea, TimePicker, Toaster as ToastProvider, Tooltip, cn, createAlertDialogHandle, createComboboxItems, createDialogHandle, createDrawerHandle, cva, mergeProps, toast, useCopyToClipboard, useStore as useFileUpload, useIsMobile, type useLightbox, useMediaQuery, useSidebar };
32
+ import { useDropzone } from "react-dropzone";
33
+ export type * from "react-dropzone";
34
+ export { AlertDialog, type AlertDialogHandle, Badge, Breadcrumb, Button, ButtonGroup, Calendar, Card, Carousel, Checkbox, Combobox, type ComboboxItemCollection, type ComboboxPrimitiveValue, type CreateComboboxItemsOptions, DatePicker, type DateRange, DateRangePicker, Dialog, type DialogHandle, Drawer, type DrawerHandle, Dropdown, Dropzone, Empty, Field, Form, IconSwap, Image, ImageProps, Input, InputGroup, Kbd, Label, Lightbox, type LightboxActions, type LightboxBackdrop, type LightboxCaptions, type LightboxChangeReason, type LightboxClose, type LightboxContent, type LightboxControl, type LightboxControlContext, type LightboxCounter, type LightboxDownload, type LightboxImageChangeEventDetails, type LightboxImageItem, type LightboxItem, type LightboxMore, type LightboxNext, type LightboxOpenEventDetails, type LightboxPrevious, type LightboxProps, type LightboxSlide, type LightboxSlides, type LightboxThumbnail, type LightboxThumbnails, type LightboxToolbar, type LightboxTrigger, type LightboxTriggerProps, type LightboxVideoItem, type LightboxViewport, type LightboxZoom, type LightboxZoomButton, Pagination, Popover, Progress, Radio, ScrollArea, Select, Separator, Sidebar, Skeleton, Spinner, Switch, Table, Tabs, Textarea, TimePicker, Toaster as ToastProvider, Tooltip, cn, createAlertDialogHandle, createComboboxItems, createDialogHandle, createDrawerHandle, cva, formatSize, mergeProps, toast, useCopyToClipboard, useDropzone, useIsMobile, type useLightbox, useMediaQuery, useSidebar };
package/dist/index.mjs CHANGED
@@ -1,6 +1,5 @@
1
1
  import { useCopyToClipboard } from "./vendor/coss/hooks/use-copy-to-clipboard.mjs";
2
2
  import { useIsMobile, useMediaQuery } from "./vendor/coss/hooks/use-media-query.mjs";
3
- import { useFileUpload as useStore } from "./vendor/diceui/file-upload.mjs";
4
3
  import { Spinner } from "./vendor/shadcn/spinner.mjs";
5
4
  import { Button } from "./vendor/shadcn/button.mjs";
6
5
  import { createAlertDialogHandle } from "./vendor/shadcn/alert-dialog.mjs";
@@ -15,18 +14,19 @@ import { Toaster, toast } from "./vendor/shadcn/toast.mjs";
15
14
  import { Skeleton } from "./vendor/shadcn/skeleton.mjs";
16
15
  import { useSidebar } from "./vendor/shadcn/sidebar.mjs";
17
16
  import { Sidebar } from "./widgets/sidebar.mjs";
18
- import { Breadcrumb } from "./widgets/breadcrumb.mjs";
19
- import { Pagination } from "./widgets/pagination.mjs";
17
+ import { DatePicker, DateRangePicker, TimePicker } from "./widgets/datetime.mjs";
18
+ import { Dropzone, formatSize } from "./widgets/dropzone.mjs";
20
19
  import { Carousel, Image, Lightbox } from "./widgets/multimedia.mjs";
21
- import { DatePicker, DateRangePicker, TimePicker } from "./widgets/datetime-picker.mjs";
20
+ import { Pagination } from "./widgets/pagination.mjs";
22
21
  import { Badge } from "./vendor/shadcn/badge.mjs";
23
22
  import { Switch } from "./vendor/shadcn/switch.mjs";
24
23
  import { Checkbox } from "./vendor/shadcn/checkbox.mjs";
25
24
  import { ScrollArea } from "./vendor/coss/scroll-area.mjs";
26
25
  import { Form } from "./vendor/coss/form.mjs";
27
26
  import { IconSwap } from "./vendor/tailored/icon-swap.mjs";
28
- import { AlertDialog, ButtonGroup, Calendar, Card, Combobox, Dialog, Drawer, Dropdown, Empty, Field, FileUpload, InputGroup, Kbd, Popover, Progress, Radio, Select, Table, Tabs, Tooltip } from "./widgets/index.mjs";
27
+ import { AlertDialog, Breadcrumb, ButtonGroup, Calendar, Card, Combobox, Dialog, Drawer, Dropdown, Empty, Field, InputGroup, Kbd, Popover, Progress, Radio, Select, Table, Tabs, Tooltip } from "./widgets/index.mjs";
29
28
  import { cn } from "cn";
30
29
  import { cva } from "class-variance-authority";
31
30
  import { mergeProps } from "@base-ui/react/merge-props";
32
- export { AlertDialog, Badge, Breadcrumb, Button, ButtonGroup, Calendar, Card, Carousel, Checkbox, Combobox, DatePicker, DateRangePicker, Dialog, Drawer, Dropdown, Empty, Field, FileUpload, Form, IconSwap, Image, Input, InputGroup, Kbd, Label, Lightbox, Pagination, Popover, Progress, Radio, ScrollArea, Select, Separator, Sidebar, Skeleton, Spinner, Switch, Table, Tabs, Textarea, TimePicker, Toaster as ToastProvider, Tooltip, cn, createAlertDialogHandle, createComboboxItems, createDialogHandle, createDrawerHandle, cva, mergeProps, toast, useCopyToClipboard, useStore as useFileUpload, useIsMobile, useMediaQuery, useSidebar };
31
+ import { useDropzone } from "react-dropzone";
32
+ export { AlertDialog, Badge, Breadcrumb, Button, ButtonGroup, Calendar, Card, Carousel, Checkbox, Combobox, DatePicker, DateRangePicker, Dialog, Drawer, Dropdown, Dropzone, Empty, Field, Form, IconSwap, Image, Input, InputGroup, Kbd, Label, Lightbox, Pagination, Popover, Progress, Radio, ScrollArea, Select, Separator, Sidebar, Skeleton, Spinner, Switch, Table, Tabs, Textarea, TimePicker, Toaster as ToastProvider, Tooltip, cn, createAlertDialogHandle, createComboboxItems, createDialogHandle, createDrawerHandle, cva, formatSize, mergeProps, toast, useCopyToClipboard, useDropzone, useIsMobile, useMediaQuery, useSidebar };
@@ -1,4 +1,4 @@
1
- /* Ejected from shadcn v4.22.2 — cSpell: disable */
1
+ /* Ejected from shadcn v4.23.0 — cSpell: disable */
2
2
 
3
3
  @theme inline {
4
4
  @keyframes accordion-down {
@@ -16,7 +16,6 @@ shadcn 组件使用 `components.json` 中的 `base-vega` 风格和 Lucide 图标
16
16
  | `@coss/scroll-area` | [coss/scroll-area.tsx](coss/scroll-area.tsx) | [Scroll Area](https://coss.com/ui/docs/components/scroll-area) | — |
17
17
  | `@coss/use-copy-to-clipboard` | [coss/hooks/use-copy-to-clipboard.ts](coss/hooks/use-copy-to-clipboard.ts) | [useCopyToClipboard](https://coss.com/ui/docs/hooks/use-copy-to-clipboard) | — |
18
18
  | `@coss/use-media-query` | [coss/hooks/use-media-query.ts](coss/hooks/use-media-query.ts) | [useMediaQuery](https://coss.com/ui/docs/hooks/use-media-query) | 断点:`md` 设为 768px,与 Tailwind 默认值一致 |
19
- | `@diceui/file-upload` | [diceui/file-upload.tsx](diceui/file-upload.tsx) | [File Upload](https://diceui.com/docs/components/base/file-upload) | — |
20
19
  | `alert-dialog` | [shadcn/alert-dialog.tsx](shadcn/alert-dialog.tsx) | [Alert Dialog](https://ui.shadcn.com/docs/components/base/alert-dialog) | 额外导出 `createAlertDialogHandle` 及其类型 |
21
20
  | `badge` | [shadcn/badge.tsx](shadcn/badge.tsx) | [Badge](https://ui.shadcn.com/docs/components/base/badge) | 提供 `info`、`success`、`warning` 语义变体 |
22
21
  | `breadcrumb` | [shadcn/breadcrumb.tsx](shadcn/breadcrumb.tsx) | [Breadcrumb](https://ui.shadcn.com/docs/components/base/breadcrumb) | — |
@@ -1,9 +1,9 @@
1
1
  import { cn } from "cn";
2
2
  import { mergeProps } from "@base-ui/react/merge-props";
3
3
  import "react";
4
- import { useRender } from "@base-ui/react/use-render";
5
- import { ChevronRightIcon, MoreHorizontalIcon } from "lucide-react";
6
4
  import { jsx, jsxs } from "react/jsx-runtime";
5
+ import { ChevronRightIcon, MoreHorizontalIcon } from "lucide-react";
6
+ import { useRender } from "@base-ui/react/use-render";
7
7
  // src/vendor/shadcn/breadcrumb.tsx
8
8
  function Breadcrumb({ className, ...props }) {
9
9
  return /* @__PURE__ */ jsx("nav", {
@@ -2,8 +2,8 @@ import { Separator } from "./separator.mjs";
2
2
  import { cn } from "cn";
3
3
  import { cva } from "class-variance-authority";
4
4
  import { mergeProps } from "@base-ui/react/merge-props";
5
- import { useRender } from "@base-ui/react/use-render";
6
5
  import { jsx } from "react/jsx-runtime";
6
+ import { useRender } from "@base-ui/react/use-render";
7
7
  // src/vendor/shadcn/button-group.tsx
8
8
  const buttonGroupVariants = cva("flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1", {
9
9
  variants: { orientation: {
@@ -2,8 +2,8 @@
2
2
  import { Button, buttonVariants } from "./button.mjs";
3
3
  import { cn } from "cn";
4
4
  import * as React$1 from "react";
5
- import { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
6
5
  import { jsx } from "react/jsx-runtime";
6
+ import { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
7
7
  import { DayPicker, getDefaultClassNames } from "@daypicker/react";
8
8
  // src/vendor/shadcn/calendar.tsx
9
9
  function Calendar({ className, classNames, showOutsideDays = true, captionLayout = "label", buttonVariant = "ghost", locale, formatters, components, ...props }) {
@@ -2,8 +2,8 @@
2
2
  import { Button } from "./button.mjs";
3
3
  import { cn } from "cn";
4
4
  import * as React$1 from "react";
5
- import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
6
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
7
7
  import useEmblaCarousel from "embla-carousel-react";
8
8
  // src/vendor/shadcn/carousel.tsx
9
9
  const CarouselContext = React$1.createContext(null);
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { cn } from "cn";
3
- import { CheckIcon } from "lucide-react";
4
3
  import { jsx } from "react/jsx-runtime";
4
+ import { CheckIcon } from "lucide-react";
5
5
  import { Checkbox } from "@base-ui/react/checkbox";
6
6
  // src/vendor/shadcn/checkbox.tsx
7
7
  function Checkbox$1({ className, ...props }) {
@@ -3,8 +3,8 @@ import { Button } from "./button.mjs";
3
3
  import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from "./input-group.mjs";
4
4
  import { cn } from "cn";
5
5
  import "react";
6
- import { CheckIcon, ChevronDownIcon, XIcon } from "lucide-react";
7
6
  import { jsx, jsxs } from "react/jsx-runtime";
7
+ import { CheckIcon, ChevronDownIcon, XIcon } from "lucide-react";
8
8
  import { Combobox } from "@base-ui/react";
9
9
  // src/vendor/shadcn/combobox.tsx
10
10
  const Combobox$1 = Combobox.Root;
@@ -2,8 +2,8 @@
2
2
  import { Button } from "./button.mjs";
3
3
  import { cn } from "cn";
4
4
  import "react";
5
- import { XIcon } from "lucide-react";
6
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { XIcon } from "lucide-react";
7
7
  import { Dialog } from "@base-ui/react/dialog";
8
8
  // src/vendor/shadcn/dialog.tsx
9
9
  function Dialog$1({ ...props }) {
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import { cn } from "cn";
3
3
  import "react";
4
- import { CheckIcon, ChevronRightIcon } from "lucide-react";
5
4
  import { jsx, jsxs } from "react/jsx-runtime";
5
+ import { CheckIcon, ChevronRightIcon } from "lucide-react";
6
6
  import { Menu } from "@base-ui/react/menu";
7
7
  // src/vendor/shadcn/dropdown-menu.tsx
8
8
  function DropdownMenu({ ...props }) {
@@ -1,8 +1,8 @@
1
1
  import { Button } from "./button.mjs";
2
2
  import { cn } from "cn";
3
3
  import "react";
4
- import { ChevronLeftIcon, ChevronRightIcon, MoreHorizontalIcon } from "lucide-react";
5
4
  import { jsx, jsxs } from "react/jsx-runtime";
5
+ import { ChevronLeftIcon, ChevronRightIcon, MoreHorizontalIcon } from "lucide-react";
6
6
  // src/vendor/shadcn/pagination.tsx
7
7
  function Pagination({ className, ...props }) {
8
8
  return /* @__PURE__ */ jsx("nav", {
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import { cn } from "cn";
3
3
  import "react";
4
- import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from "lucide-react";
5
4
  import { jsx, jsxs } from "react/jsx-runtime";
5
+ import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from "lucide-react";
6
6
  import { Select } from "@base-ui/react/select";
7
7
  // src/vendor/shadcn/select.tsx
8
8
  const Select$1 = Select.Root;
@@ -2,8 +2,8 @@
2
2
  import { Button } from "./button.mjs";
3
3
  import { cn } from "cn";
4
4
  import "react";
5
- import { XIcon } from "lucide-react";
6
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { XIcon } from "lucide-react";
7
7
  import { Dialog } from "@base-ui/react/dialog";
8
8
  // src/vendor/shadcn/sheet.tsx
9
9
  function Sheet({ ...props }) {
@@ -9,9 +9,9 @@ import { cn } from "cn";
9
9
  import { cva } from "class-variance-authority";
10
10
  import { mergeProps } from "@base-ui/react/merge-props";
11
11
  import * as React$1 from "react";
12
- import { useRender } from "@base-ui/react/use-render";
13
- import { PanelLeftIcon } from "lucide-react";
14
12
  import { jsx, jsxs } from "react/jsx-runtime";
13
+ import { PanelLeftIcon } from "lucide-react";
14
+ import { useRender } from "@base-ui/react/use-render";
15
15
  // src/vendor/shadcn/sidebar.tsx
16
16
  const SIDEBAR_COOKIE_NAME = "sidebar_state";
17
17
  const SIDEBAR_COOKIE_MAX_AGE = 604800;
@@ -1,6 +1,6 @@
1
1
  import { cn } from "cn";
2
- import { Loader2Icon } from "lucide-react";
3
2
  import { jsx } from "react/jsx-runtime";
3
+ import { Loader2Icon } from "lucide-react";
4
4
  // src/vendor/shadcn/spinner.tsx
5
5
  function Spinner({ className, ...props }) {
6
6
  return /* @__PURE__ */ jsx(Loader2Icon, {
@@ -2,8 +2,8 @@
2
2
  import { Button } from "./button.mjs";
3
3
  import { cn } from "cn";
4
4
  import "react";
5
- import { CircleCheckIcon, InfoIcon, Loader2Icon, OctagonXIcon, TriangleAlertIcon, XIcon } from "lucide-react";
6
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { CircleCheckIcon, InfoIcon, Loader2Icon, OctagonXIcon, TriangleAlertIcon, XIcon } from "lucide-react";
7
7
  import { Toast } from "@base-ui/react/toast";
8
8
  // src/vendor/shadcn/toast.tsx
9
9
  const toast = Toast.createToastManager();
@@ -6,9 +6,9 @@ import { Skeleton } from "../shadcn/skeleton.mjs";
6
6
  import { cn } from "cn";
7
7
  import { mergeProps } from "@base-ui/react/merge-props";
8
8
  import * as React$1 from "react";
9
- import { useRender } from "@base-ui/react/use-render";
10
- import { ChevronLeftIcon, ChevronRightIcon, DownloadIcon, EllipsisIcon, ImageOffIcon, XIcon, ZoomInIcon, ZoomOutIcon } from "lucide-react";
11
9
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
10
+ import { ChevronLeftIcon, ChevronRightIcon, DownloadIcon, EllipsisIcon, ImageOffIcon, XIcon, ZoomInIcon, ZoomOutIcon } from "lucide-react";
11
+ import { useRender } from "@base-ui/react/use-render";
12
12
  import { Dialog } from "@base-ui/react/dialog";
13
13
  import { Menu } from "@base-ui/react/menu";
14
14
  import { animate, useReducedMotion } from "motion/react";
@@ -4,10 +4,10 @@ import { Input } from "../vendor/shadcn/input.mjs";
4
4
  import { Popover, PopoverContent, PopoverTrigger } from "../vendor/shadcn/popover.mjs";
5
5
  import { cn } from "cn";
6
6
  import { useState } from "react";
7
- import { CalendarIcon } from "lucide-react";
8
7
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
+ import { CalendarIcon } from "lucide-react";
9
9
  import { format } from "date-fns";
10
- // src/widgets/datetime-picker.tsx
10
+ // src/widgets/datetime.tsx
11
11
  function TimePicker({ className, step = "1", ...props }) {
12
12
  return /* @__PURE__ */ jsx(Input, {
13
13
  ...props,
@@ -0,0 +1,6 @@
1
+ import { DropzoneOptions } from "react-dropzone";
2
+ import { ComponentProps } from "react";
3
+ type DropzoneProps = DropzoneOptions & Omit<ComponentProps<"div">, keyof DropzoneOptions>;
4
+ export declare function formatSize(bytes: number): string;
5
+ export declare function Dropzone({ accept, minSize, maxSize, maxFiles, multiple, disabled, preventDropOnDocument, noClick, noKeyboard, noDrag, noDragEventsBubbling, noPaste, onDrop, onDropAccepted, onDropRejected, onDragEnter, onDragOver, onDragLeave, getFilesFromEvent, onFileDialogCancel, onFileDialogOpen, onError, validator, getErrorMessage, useFsAccessApi, autoFocus, children, className, ref, ...props }: DropzoneProps): import("react").JSX.Element;
6
+ export {};
@@ -0,0 +1,98 @@
1
+ "use client";
2
+ import { buttonVariants } from "../vendor/shadcn/button.mjs";
3
+ import { cn } from "cn";
4
+ import { useDropzone } from "react-dropzone";
5
+ import { useId, useImperativeHandle } from "react";
6
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
7
+ import { UploadIcon } from "lucide-react";
8
+ // src/widgets/dropzone.tsx
9
+ function formatSize(bytes) {
10
+ const units = [
11
+ "B",
12
+ "KB",
13
+ "MB",
14
+ "GB",
15
+ "TB"
16
+ ];
17
+ const index = bytes > 0 ? Math.min(Math.floor(Math.log(bytes) / Math.log(1024)), units.length - 1) : 0;
18
+ return `${Number((bytes / 1024 ** index).toFixed(1))} ${units[index]}`;
19
+ }
20
+ function Dropzone({ accept, minSize, maxSize, maxFiles, multiple, disabled, preventDropOnDocument, noClick, noKeyboard, noDrag, noDragEventsBubbling, noPaste, onDrop, onDropAccepted, onDropRejected, onDragEnter, onDragOver, onDragLeave, getFilesFromEvent, onFileDialogCancel, onFileDialogOpen, onError, validator, getErrorMessage, useFsAccessApi, autoFocus, children, className, ref, ...props }) {
21
+ const { getRootProps, getInputProps, rootRef, isDragActive, isDragReject, isProcessing } = useDropzone({
22
+ accept,
23
+ minSize,
24
+ maxSize,
25
+ maxFiles,
26
+ multiple,
27
+ disabled,
28
+ preventDropOnDocument,
29
+ noClick,
30
+ noKeyboard,
31
+ noDrag,
32
+ noDragEventsBubbling,
33
+ noPaste,
34
+ onDrop,
35
+ onDropAccepted,
36
+ onDropRejected,
37
+ onDragEnter,
38
+ onDragOver,
39
+ onDragLeave,
40
+ getFilesFromEvent,
41
+ onFileDialogCancel,
42
+ onFileDialogOpen,
43
+ onError,
44
+ validator,
45
+ getErrorMessage,
46
+ useFsAccessApi,
47
+ autoFocus
48
+ });
49
+ useImperativeHandle(ref, () => rootRef.current);
50
+ const descriptionId = useId();
51
+ const limits = [multiple === false ? "单个文件" : maxFiles && maxFiles > 0 ? `最多 ${maxFiles} 个文件` : void 0, maxSize !== void 0 && Number.isFinite(maxSize) ? `每个不超过 ${formatSize(maxSize)}` : void 0].filter(Boolean);
52
+ return /* @__PURE__ */ jsxs("div", {
53
+ ...getRootProps({
54
+ "role": "button",
55
+ "aria-label": children == null ? "选择文件" : void 0,
56
+ "data-slot": "dropzone",
57
+ "data-state": isDragReject ? "reject" : isDragActive ? "active" : "idle",
58
+ "data-disabled": disabled || void 0,
59
+ ...props,
60
+ "aria-describedby": children == null ? [props["aria-describedby"], descriptionId].filter(Boolean).join(" ") : props["aria-describedby"],
61
+ "aria-busy": isProcessing || props["aria-busy"],
62
+ "className": cn("bg-background hover:bg-muted/30 focus-visible:border-ring focus-visible:ring-ring/50 data-[state=active]:border-ring data-[state=active]:bg-muted/50 data-[state=reject]:border-destructive data-[state=reject]:bg-destructive/5 data-[disabled]:hover:bg-background flex min-h-48 cursor-pointer flex-col items-center justify-center rounded-lg border-2 border-dashed px-6 py-6 text-center text-sm transition-colors outline-none focus-visible:ring-3 data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50", className)
63
+ }),
64
+ children: [/* @__PURE__ */ jsx("input", { ...getInputProps({
65
+ disabled,
66
+ "aria-hidden": true
67
+ }) }), children ?? /* @__PURE__ */ jsxs(Fragment, { children: [
68
+ /* @__PURE__ */ jsx("span", {
69
+ "data-slot": "dropzone-icon",
70
+ className: "text-muted-foreground mb-2 grid size-11 place-items-center rounded-full border",
71
+ children: /* @__PURE__ */ jsx(UploadIcon, {
72
+ "aria-hidden": "true",
73
+ className: "size-5"
74
+ })
75
+ }),
76
+ /* @__PURE__ */ jsx("p", {
77
+ "data-slot": "dropzone-title",
78
+ className: "font-medium",
79
+ children: isDragReject ? "暂不支持这些文件" : isDragActive ? "松开以添加文件" : "将文件拖到此处"
80
+ }),
81
+ /* @__PURE__ */ jsxs("p", {
82
+ id: descriptionId,
83
+ "data-slot": "dropzone-description",
84
+ className: "text-muted-foreground mt-1 text-xs",
85
+ children: ["或点击选择", limits.length > 0 && `(${limits.join(",")})`]
86
+ }),
87
+ /* @__PURE__ */ jsx("span", {
88
+ "data-slot": "dropzone-action",
89
+ className: cn(buttonVariants({
90
+ variant: "outline",
91
+ size: "sm"
92
+ }), "mt-4"),
93
+ children: "选择文件"
94
+ })
95
+ ] })]
96
+ });
97
+ }
98
+ export { Dropzone, formatSize };
@@ -1,7 +1,7 @@
1
- import { FileUpload as FileUpload$1, FileUploadClear, FileUploadDropzone, FileUploadItem, FileUploadItemDelete, FileUploadItemMetadata, FileUploadItemPreview, FileUploadItemProgress, FileUploadList, FileUploadTrigger } from "../vendor/diceui/file-upload.mjs";
2
1
  import { Empty as Empty$1, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from "../vendor/coss/empty.mjs";
3
2
  import { Button } from "../vendor/shadcn/button.mjs";
4
3
  import { AlertDialog as AlertDialog$1, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHandle, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, createAlertDialogHandle } from "../vendor/shadcn/alert-dialog.mjs";
4
+ import { Breadcrumb as Breadcrumb$1, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator } from "../vendor/shadcn/breadcrumb.mjs";
5
5
  import { Separator } from "../vendor/shadcn/separator.mjs";
6
6
  import { ButtonGroup as ButtonGroup$1, ButtonGroupSeparator, ButtonGroupText } from "../vendor/shadcn/button-group.mjs";
7
7
  import { Calendar as Calendar$1, CalendarDayButton } from "../vendor/shadcn/calendar.mjs";
@@ -27,11 +27,11 @@ import "./toast.mjs";
27
27
  import { Input } from "../vendor/shadcn/input.mjs";
28
28
  import { useSidebar } from "../vendor/shadcn/sidebar.mjs";
29
29
  import { Sidebar } from "./sidebar.mjs";
30
- import { Breadcrumb } from "./breadcrumb.mjs";
31
- import { Pagination } from "./pagination.mjs";
30
+ import { DatePicker, DateRange, DateRangePicker, TimePicker } from "./datetime.mjs";
31
+ import { Dropzone, formatSize } from "./dropzone.mjs";
32
32
  import { LightboxActions, LightboxBackdrop, LightboxCaptions, LightboxChangeReason, LightboxClose, LightboxContent, LightboxControl, LightboxControlContext, LightboxCounter, LightboxDownload, LightboxImageChangeEventDetails, LightboxImageItem, LightboxItem, LightboxMore, LightboxNext, LightboxOpenEventDetails, LightboxPrevious, LightboxProps, LightboxSlide, LightboxSlides, LightboxThumbnail, LightboxThumbnails, LightboxToolbar, LightboxTrigger, LightboxTriggerProps, LightboxVideoItem, LightboxViewport, LightboxZoom, LightboxZoomButton, useLightbox } from "../vendor/tailored/lightbox.mjs";
33
33
  import { Carousel, Image, ImageProps, Lightbox } from "./multimedia.mjs";
34
- import { DatePicker, DateRange, DateRangePicker, TimePicker } from "./datetime-picker.mjs";
34
+ import { Pagination } from "./pagination.mjs";
35
35
  import { Badge } from "../vendor/shadcn/badge.mjs";
36
36
  import { Switch } from "../vendor/shadcn/switch.mjs";
37
37
  import { Spinner } from "../vendor/shadcn/spinner.mjs";
@@ -156,6 +156,14 @@ export declare const Progress: typeof Progress$1 & {
156
156
  export declare const Calendar: typeof Calendar$1 & {
157
157
  DayButton: typeof CalendarDayButton;
158
158
  };
159
+ export declare const Breadcrumb: typeof Breadcrumb$1 & {
160
+ List: typeof BreadcrumbList;
161
+ Item: typeof BreadcrumbItem;
162
+ Separator: typeof BreadcrumbSeparator;
163
+ Link: typeof BreadcrumbLink;
164
+ Ellipsis: typeof BreadcrumbEllipsis;
165
+ Page: typeof BreadcrumbPage;
166
+ };
159
167
  export declare const AlertDialog: typeof AlertDialog$1 & {
160
168
  Trigger: typeof AlertDialogTrigger;
161
169
  Close: typeof AlertDialogCancel;
@@ -177,15 +185,4 @@ export declare const InputGroup: typeof InputGroup$1 & {
177
185
  Textarea: typeof InputGroupTextarea;
178
186
  Button: typeof InputGroupButton;
179
187
  };
180
- export declare const FileUpload: typeof FileUpload$1 & {
181
- Dropzone: typeof FileUploadDropzone;
182
- Trigger: typeof FileUploadTrigger;
183
- List: typeof FileUploadList;
184
- Item: typeof FileUploadItem;
185
- ItemPreview: typeof FileUploadItemPreview;
186
- ItemMetadata: typeof FileUploadItemMetadata;
187
- ItemProgress: typeof FileUploadItemProgress;
188
- ItemDelete: typeof FileUploadItemDelete;
189
- Clear: typeof FileUploadClear;
190
- };
191
- export { type AlertDialogHandle, Badge, Breadcrumb, Button, Carousel, Checkbox, type ComboboxItemCollection, type ComboboxPrimitiveValue, type CreateComboboxItemsOptions, DatePicker, type DateRange, DateRangePicker, type DialogHandle, type DrawerHandle, Form, IconSwap, Image, ImageProps, Input, Label, Lightbox, type LightboxActions, type LightboxBackdrop, type LightboxCaptions, type LightboxChangeReason, type LightboxClose, type LightboxContent, type LightboxControl, type LightboxControlContext, type LightboxCounter, type LightboxDownload, type LightboxImageChangeEventDetails, type LightboxImageItem, type LightboxItem, type LightboxMore, type LightboxNext, type LightboxOpenEventDetails, type LightboxPrevious, type LightboxProps, type LightboxSlide, type LightboxSlides, type LightboxThumbnail, type LightboxThumbnails, type LightboxToolbar, type LightboxTrigger, type LightboxTriggerProps, type LightboxVideoItem, type LightboxViewport, type LightboxZoom, type LightboxZoomButton, Pagination, ScrollArea, Separator, Sidebar, Skeleton, Spinner, Switch, Textarea, TimePicker, Toaster as ToastProvider, createAlertDialogHandle, createComboboxItems, createDialogHandle, createDrawerHandle, toast, type useLightbox, useSidebar };
188
+ export { type AlertDialogHandle, Badge, Button, Carousel, Checkbox, type ComboboxItemCollection, type ComboboxPrimitiveValue, type CreateComboboxItemsOptions, DatePicker, type DateRange, DateRangePicker, type DialogHandle, type DrawerHandle, Dropzone, Form, IconSwap, Image, ImageProps, Input, Label, Lightbox, type LightboxActions, type LightboxBackdrop, type LightboxCaptions, type LightboxChangeReason, type LightboxClose, type LightboxContent, type LightboxControl, type LightboxControlContext, type LightboxCounter, type LightboxDownload, type LightboxImageChangeEventDetails, type LightboxImageItem, type LightboxItem, type LightboxMore, type LightboxNext, type LightboxOpenEventDetails, type LightboxPrevious, type LightboxProps, type LightboxSlide, type LightboxSlides, type LightboxThumbnail, type LightboxThumbnails, type LightboxToolbar, type LightboxTrigger, type LightboxTriggerProps, type LightboxVideoItem, type LightboxViewport, type LightboxZoom, type LightboxZoomButton, Pagination, ScrollArea, Separator, Sidebar, Skeleton, Spinner, Switch, Textarea, TimePicker, Toaster as ToastProvider, createAlertDialogHandle, createComboboxItems, createDialogHandle, createDrawerHandle, formatSize, toast, type useLightbox, useSidebar };
@@ -1,8 +1,8 @@
1
- import { FileUpload as FileUpload$1, FileUploadClear, FileUploadDropzone, FileUploadItem, FileUploadItemDelete, FileUploadItemMetadata, FileUploadItemPreview, FileUploadItemProgress, FileUploadList, FileUploadTrigger } from "../vendor/diceui/file-upload.mjs";
2
1
  import { Empty as Empty$1, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from "../vendor/coss/empty.mjs";
3
2
  import { Spinner } from "../vendor/shadcn/spinner.mjs";
4
3
  import { Button } from "../vendor/shadcn/button.mjs";
5
4
  import { AlertDialog as AlertDialog$1, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, createAlertDialogHandle } from "../vendor/shadcn/alert-dialog.mjs";
5
+ import { Breadcrumb as Breadcrumb$1, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator } from "../vendor/shadcn/breadcrumb.mjs";
6
6
  import { Separator } from "../vendor/shadcn/separator.mjs";
7
7
  import { ButtonGroup as ButtonGroup$1, ButtonGroupSeparator, ButtonGroupText } from "../vendor/shadcn/button-group.mjs";
8
8
  import { Calendar as Calendar$1, CalendarDayButton } from "../vendor/shadcn/calendar.mjs";
@@ -28,10 +28,10 @@ import { Toaster, toast } from "../vendor/shadcn/toast.mjs";
28
28
  import { Skeleton } from "../vendor/shadcn/skeleton.mjs";
29
29
  import { useSidebar } from "../vendor/shadcn/sidebar.mjs";
30
30
  import { Sidebar } from "./sidebar.mjs";
31
- import { Breadcrumb } from "./breadcrumb.mjs";
32
- import { Pagination } from "./pagination.mjs";
31
+ import { DatePicker, DateRangePicker, TimePicker } from "./datetime.mjs";
32
+ import { Dropzone, formatSize } from "./dropzone.mjs";
33
33
  import { Carousel, Image, Lightbox } from "./multimedia.mjs";
34
- import { DatePicker, DateRangePicker, TimePicker } from "./datetime-picker.mjs";
34
+ import { Pagination } from "./pagination.mjs";
35
35
  import { Badge } from "../vendor/shadcn/badge.mjs";
36
36
  import { Switch } from "../vendor/shadcn/switch.mjs";
37
37
  import { Checkbox } from "../vendor/shadcn/checkbox.mjs";
@@ -148,6 +148,14 @@ const Progress = /* @__PURE__ */ Object.assign(Progress$1, {
148
148
  Indicator: ProgressIndicator
149
149
  });
150
150
  const Calendar = /* @__PURE__ */ Object.assign(Calendar$1, { DayButton: CalendarDayButton });
151
+ const Breadcrumb = /* @__PURE__ */ Object.assign(Breadcrumb$1, {
152
+ List: BreadcrumbList,
153
+ Item: BreadcrumbItem,
154
+ Separator: BreadcrumbSeparator,
155
+ Link: BreadcrumbLink,
156
+ Ellipsis: BreadcrumbEllipsis,
157
+ Page: BreadcrumbPage
158
+ });
151
159
  const AlertDialog = /* @__PURE__ */ Object.assign(AlertDialog$1, {
152
160
  Trigger: AlertDialogTrigger,
153
161
  Close: AlertDialogCancel,
@@ -169,15 +177,4 @@ const InputGroup = /* @__PURE__ */ Object.assign(InputGroup$1, {
169
177
  Textarea: InputGroupTextarea,
170
178
  Button: InputGroupButton
171
179
  });
172
- const FileUpload = /* @__PURE__ */ Object.assign(FileUpload$1, {
173
- Dropzone: FileUploadDropzone,
174
- Trigger: FileUploadTrigger,
175
- List: FileUploadList,
176
- Item: FileUploadItem,
177
- ItemPreview: FileUploadItemPreview,
178
- ItemMetadata: FileUploadItemMetadata,
179
- ItemProgress: FileUploadItemProgress,
180
- ItemDelete: FileUploadItemDelete,
181
- Clear: FileUploadClear
182
- });
183
- export { AlertDialog, Badge, Breadcrumb, Button, ButtonGroup, Calendar, Card, Carousel, Checkbox, Combobox, DatePicker, DateRangePicker, Dialog, Drawer, Dropdown, Empty, Field, FileUpload, Form, IconSwap, Image, Input, InputGroup, Kbd, Label, Lightbox, Pagination, Popover, Progress, Radio, ScrollArea, Select, Separator, Sidebar, Skeleton, Spinner, Switch, Table, Tabs, Textarea, TimePicker, Toaster as ToastProvider, Tooltip, createAlertDialogHandle, createComboboxItems, createDialogHandle, createDrawerHandle, toast, useSidebar };
180
+ export { AlertDialog, Badge, Breadcrumb, Button, ButtonGroup, Calendar, Card, Carousel, Checkbox, Combobox, DatePicker, DateRangePicker, Dialog, Drawer, Dropdown, Dropzone, Empty, Field, Form, IconSwap, Image, Input, InputGroup, Kbd, Label, Lightbox, Pagination, Popover, Progress, Radio, ScrollArea, Select, Separator, Sidebar, Skeleton, Spinner, Switch, Table, Tabs, Textarea, TimePicker, Toaster as ToastProvider, Tooltip, createAlertDialogHandle, createComboboxItems, createDialogHandle, createDrawerHandle, formatSize, toast, useSidebar };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deftui/react",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/KiriRainCat/deftui.git",
@@ -33,28 +33,29 @@
33
33
  "fix": "vp check --fix"
34
34
  },
35
35
  "dependencies": {
36
- "@base-ui/react": "^1.9.0",
37
- "@base-ui/utils": "^0.5.0",
38
36
  "@daypicker/react": "^10.0.2",
39
37
  "@fontsource-variable/inter": "^5.3.0",
40
38
  "class-variance-authority": "^0.7.1",
41
- "cn": "^0.5.0",
39
+ "cn": "^0.5.1",
42
40
  "date-fns": "^4.4.0",
43
41
  "embla-carousel-react": "^8.6.0",
44
- "lucide-react": "^1.62.0",
45
- "motion": "^14.7.1",
46
- "radashi": "^12.9.7",
42
+ "lucide-react": "^1.66.0",
43
+ "motion": "^14.9.0",
44
+ "radashi": "^13.0.1",
45
+ "react-dropzone": "^20.1.4",
47
46
  "tw-animate-css": "^1.4.0"
48
47
  },
49
48
  "devDependencies": {
49
+ "@base-ui/react": "^1.9.0",
50
50
  "@types/react": "^19.3.0",
51
51
  "@types/react-dom": "^19.3.0",
52
- "shadcn": "^4.22.2",
52
+ "shadcn": "^4.23.0",
53
53
  "vite-plus": "catalog:"
54
54
  },
55
55
  "peerDependencies": {
56
- "react": "^19",
57
- "react-dom": "^19",
58
- "tailwindcss": "^4"
56
+ "@base-ui/react": "^1.9.0",
57
+ "react": "^19.0.0",
58
+ "react-dom": "^19.0.0",
59
+ "tailwindcss": "^4.3.0"
59
60
  }
60
61
  }