@dimaan/ui 0.0.22 → 0.0.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as react from 'react';
3
- import { ComponentPropsWithoutRef, HTMLAttributes, ReactNode, ButtonHTMLAttributes, ReactElement, InputHTMLAttributes, ChangeEvent, FormEventHandler, FieldsetHTMLAttributes, Ref, TextareaHTMLAttributes } from 'react';
3
+ import { ComponentPropsWithoutRef, HTMLAttributes, ReactNode, ButtonHTMLAttributes, ReactElement, InputHTMLAttributes, ChangeEvent, ForwardRefExoticComponent, RefAttributes, FormEventHandler, FieldsetHTMLAttributes, Ref, TextareaHTMLAttributes } from 'react';
4
4
  import * as RadixAlertDialog from '@radix-ui/react-alert-dialog';
5
5
  import { LinkProps } from 'react-router-dom';
6
6
  import { Locale } from 'react-day-picker';
@@ -1029,6 +1029,117 @@ type FieldProps<TValues extends FieldValues = FieldValues, TName extends FieldPa
1029
1029
  */
1030
1030
  declare function Field<TValues extends FieldValues = FieldValues, TName extends FieldPath<TValues> = FieldPath<TValues>>(props: FieldProps<TValues, TName>): ReactElement;
1031
1031
 
1032
+ type FileUploadErrorCode = 'file-too-large' | 'file-type-rejected';
1033
+ interface FileUploadError {
1034
+ code: FileUploadErrorCode;
1035
+ /** Direction-aware human-readable message. */
1036
+ message: string;
1037
+ /** The rejected file. */
1038
+ file: File;
1039
+ }
1040
+ interface FileUploadLabels {
1041
+ /** Empty-dropzone prompt. Direction-aware default. */
1042
+ prompt?: string;
1043
+ /** Hint line under the prompt. Defaults to `Max {maxSize} MB` (direction-aware). */
1044
+ hint?: string;
1045
+ /** aria-label prefix for the remove (×) button. Direction-aware default. */
1046
+ remove?: string;
1047
+ }
1048
+ interface FileUploadBaseProps {
1049
+ /** Native `accept` filter (e.g. `"image/*,.pdf"`). Also enforced on drop. */
1050
+ accept?: string;
1051
+ /** Max size per file, in MB. Defaults to `5`. */
1052
+ maxSize?: number;
1053
+ disabled?: boolean;
1054
+ /** Marks the underlying input required (for form validation). */
1055
+ required?: boolean;
1056
+ /** Native form name. */
1057
+ name?: string;
1058
+ /** Override id (otherwise auto-generated via useId). */
1059
+ id?: string;
1060
+ /** Fires when a file is rejected by `accept` / `maxSize`. */
1061
+ onError?: (error: FileUploadError) => void;
1062
+ /** Called when focus leaves the input. */
1063
+ onBlur?: () => void;
1064
+ /** Localized copy. */
1065
+ labels?: FileUploadLabels;
1066
+ /** Class on the outer wrapper. */
1067
+ className?: string;
1068
+ 'aria-invalid'?: boolean | 'true' | 'false';
1069
+ 'aria-describedby'?: string;
1070
+ 'aria-label'?: string;
1071
+ }
1072
+ /**
1073
+ * Discriminated on `multiple`: the value is `File | null` for single mode and
1074
+ * `File[]` for multiple mode.
1075
+ */
1076
+ type FileUploadProps = FileUploadBaseProps & ({
1077
+ multiple?: false;
1078
+ value?: File | null;
1079
+ defaultValue?: File | null;
1080
+ onValueChange?: (file: File | null) => void;
1081
+ onChange?: (file: File | null) => void;
1082
+ } | {
1083
+ multiple: true;
1084
+ value?: File[];
1085
+ defaultValue?: File[];
1086
+ onValueChange?: (files: File[]) => void;
1087
+ onChange?: (files: File[]) => void;
1088
+ });
1089
+ /**
1090
+ * Drag-and-drop file picker. **Bare control** (no inline label/error) — wrap in
1091
+ * `<Field label="…">` for label + helper + error wiring (ADR-007). Discriminated
1092
+ * on `multiple`: value is `File | null` (single) or `File[]` (multiple).
1093
+ *
1094
+ * Rejected files (by `accept` / `maxSize`) are not added and reported through
1095
+ * `onError` — surface them via `toast(...)` or the wrapping `<Field>` error.
1096
+ * Direction-aware copy (EN / AR) via `useDirection()`; override with `labels`.
1097
+ *
1098
+ * @example Single file inside a Field (RHF + Zod)
1099
+ * ```tsx
1100
+ * <Field name="cv" label="CV (PDF)" required>
1101
+ * <FileUpload accept=".pdf" maxSize={10} onError={(e) => toast.error(e.message)} />
1102
+ * </Field>
1103
+ * ```
1104
+ *
1105
+ * @example Multiple files, controlled
1106
+ * ```tsx
1107
+ * <FileUpload
1108
+ * multiple
1109
+ * accept="image/*"
1110
+ * value={images}
1111
+ * onValueChange={setImages}
1112
+ * aria-label="Gallery images"
1113
+ * />
1114
+ * ```
1115
+ */
1116
+ declare const FileUpload: ForwardRefExoticComponent<FileUploadProps & RefAttributes<HTMLDivElement>>;
1117
+
1118
+ /**
1119
+ * FileUpload styling. The dropzone is a `<label>` whose state is driven by
1120
+ * `data-drag-active` / `data-invalid` / `data-disabled` and the focus ring of
1121
+ * the visually-hidden `peer` input. Re-exported from `src/index.ts` so consumers
1122
+ * can compose the same look onto custom elements.
1123
+ */
1124
+ /** Outer wrapper — owns the drag handlers + stacks the dropzone and file rows. */
1125
+ declare const fileUploadBaseClass = "flex w-full min-w-0 flex-col gap-2";
1126
+ /** The clickable / drop target. */
1127
+ declare const fileUploadDropzoneClass: string;
1128
+ /** Upload glyph in the empty dropzone. */
1129
+ declare const fileUploadIconClass = "size-8 text-muted-foreground";
1130
+ /** Primary prompt line. */
1131
+ declare const fileUploadPromptClass = "text-sm text-foreground";
1132
+ /** Secondary hint line (size limit, etc.). */
1133
+ declare const fileUploadHintClass = "text-xs text-muted-foreground";
1134
+ /** A selected-file row (icon + name/size + remove). */
1135
+ declare const fileUploadFileRowClass = "flex items-center justify-between gap-2 rounded-md border border-border bg-card px-3 py-2";
1136
+ /** File name (truncates). */
1137
+ declare const fileUploadFileNameClass = "truncate text-sm font-medium text-foreground";
1138
+ /** File size sub-label. */
1139
+ declare const fileUploadFileSizeClass = "text-xs text-muted-foreground";
1140
+ /** The per-file "×" remove button. */
1141
+ declare const fileUploadRemoveClass = "inline-flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40 disabled:pointer-events-none disabled:opacity-50";
1142
+
1032
1143
  interface FormPageLabels {
1033
1144
  /** Back button label (top-left). Direction-aware default: `"Back"` / `"رجوع"`. */
1034
1145
  back?: string;
@@ -2261,4 +2372,4 @@ declare function useDirection(): Direction;
2261
2372
 
2262
2373
  declare function cn(...inputs: ClassValue[]): string;
2263
2374
 
2264
- export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, type AlertDialogContentProps, AlertDialogDescription, type AlertDialogDescriptionProps, AlertDialogFooter, type AlertDialogFooterProps, AlertDialogHeader, type AlertDialogHeaderProps, AlertDialogOverlay, type AlertDialogOverlayProps, AlertDialogPortal, AlertDialogTitle, type AlertDialogTitleProps, AlertDialogTrigger, AppShell, type AppShellBrand, type AppShellNavGroup, type AppShellNavItem, type AppShellProps, Avatar, type AvatarProps, Badge, type BadgeProps, type BadgeSize, type BadgeVariant, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Checkbox, type CheckboxProps, type CheckboxSize, type Column, type ColumnAlign, type ConfirmDialogLabels, ConfirmDialogProvider, type ConfirmDialogProviderProps, type ConfirmOptions, DashboardContent, type DashboardContentProps, DashboardHeader, type DashboardHeaderProps, DashboardLayout, type DashboardLayoutContextValue, type DashboardLayoutProps, DashboardMain, type DashboardMainProps, DatePicker, type DatePickerProps, type DatePickerSize, type DatePickerVariant, DetailPage, type DetailPageLabels, type DetailPageNotFoundState, type DetailPageProps, Dialog, DialogClose, DialogContent, type DialogContentProps, DialogDescription, type DialogDescriptionProps, DialogFooter, type DialogFooterProps, DialogHeader, type DialogHeaderProps, DialogOverlay, type DialogOverlayProps, DialogPortal, DialogTitle, type DialogTitleProps, DialogTrigger, type Direction, DropdownMenu, DropdownMenuContent, type DropdownMenuContentProps, DropdownMenuGroup, DropdownMenuItem, type DropdownMenuItemProps, type DropdownMenuItemVariant, DropdownMenuLabel, type DropdownMenuLabelProps, DropdownMenuPortal, DropdownMenuSeparator, type DropdownMenuSeparatorProps, DropdownMenuShortcut, type DropdownMenuShortcutProps, DropdownMenuTrigger, EmptyState, type EmptyStateProps, type EmptyStateSize, Field, type FieldOrientation, type FieldProps, type FieldRHFProps, FormPage, type FormPageLabels, type FormPageProps, HeaderActions, type HeaderActionsProps, HeaderCollapseTrigger, type HeaderCollapseTriggerProps, HeaderMobileTrigger, type HeaderMobileTriggerProps, HeaderSearch, type HeaderSearchProps, HeaderTitle, type HeaderTitleProps, Input, type InputProps, type InputSize, type InputVariant, type LanguageOption, LanguageSwitcher, type LanguageSwitcherProps, ListPage, type ListPageDateFilter, type ListPageEmptyState, type ListPageFilter, type ListPageFilterWidth, type ListPageLabels, type ListPageMultiSelectFilter, type ListPageProps, type ListPageSelectFilter, type ListPageTextFilter, MultiSelect, type MultiSelectLabels, type MultiSelectProps, PageHeader, type PageHeaderBackProps, type PageHeaderBackRenderProps, type PageHeaderHeadingLevel, type PageHeaderProps, type PaginationState, RadioGroup, RadioGroupItem, type RadioGroupOption, type RadioGroupOrientation, type RadioGroupProps, type RadioGroupSize, type RowSelectionState, Select, type SelectOption, type SelectProps, type SelectSize, type SelectVariant, Sidebar, SidebarFooter, type SidebarFooterProps, SidebarGroup, type SidebarGroupProps, SidebarHeader, type SidebarHeaderProps, SidebarNav, SidebarNavGroup, type SidebarNavGroupProps, SidebarNavItem, type SidebarNavItemProps, type SidebarNavItemRenderProps, type SidebarNavProps, type SidebarProps, type SortDirection, type SortState, Switch, type SwitchProps, type SwitchSize, Table, type TableLabels, type TableProps, type TableSize, type TableSizeClasses, Textarea, type TextareaProps, type TextareaResize, type TextareaSize, type TextareaVariant, Toaster, type ToasterProps, Tooltip, type TooltipProps, TooltipProvider, type TooltipProviderProps, badgeBaseClass, badgeDotSizeClass, badgeSizeClass, badgeVariantClass, buttonBaseClass, buttonSizeClass, buttonVariantClass, cn, datePickerCalendarClass, datePickerCaptionClass, datePickerContentClass, datePickerDayBaseClass, datePickerDayWrapperClass, datePickerDisabledClass, datePickerMonthClass, datePickerMonthGridClass, datePickerMonthsClass, datePickerNavButtonClass, datePickerNavClass, datePickerOutsideClass, datePickerPlaceholderClass, datePickerSelectedClass, datePickerTodayClass, datePickerTriggerBaseClass, datePickerTriggerSizeClass, datePickerTriggerVariantClass, datePickerValueClass, datePickerWeekClass, datePickerWeekdayClass, datePickerWeekdaysClass, detailPageBaseClass, detailPageBodyClass, detailPageEmptyClass, detailPageSkeletonRowClass, dialogCloseButtonClass, dialogContentClass, dialogDescriptionClass, dialogFooterClass, dialogHeaderClass, dialogOverlayClass, dialogTitleClass, dropdownMenuContentClass, dropdownMenuItemBaseClass, dropdownMenuItemInsetClass, dropdownMenuItemVariantClass, dropdownMenuLabelClass, dropdownMenuSeparatorClass, dropdownMenuShortcutClass, emptyStateActionsSpacingClass, emptyStateBaseClass, emptyStateContainerSizeClass, emptyStateDescriptionSizeClass, emptyStateIconWrapperBaseClass, emptyStateIconWrapperSizeClass, emptyStateTitleSizeClass, formPageActionsBarClass, formPageBaseClass, formPageBodyClass, formPageSkeletonRowClass, inputBaseClass, inputSizeClass, inputVariantClass, multiSelectChipClass, multiSelectChipRemoveClass, multiSelectContentClass, multiSelectEmptyClass, multiSelectListClass, multiSelectOptionClass, multiSelectSearchRowClass, multiSelectTriggerSizeClass, multiSelectValueRowClass, pageHeaderActionsClass, pageHeaderBackClass, pageHeaderBackIconClass, pageHeaderBaseClass, pageHeaderBorderedClass, pageHeaderBreadcrumbsClass, pageHeaderDescriptionClass, pageHeaderTitleBlockClass, pageHeaderTitleClass, pageHeaderTitleRowClass, radioGroupBaseClass, radioGroupOrientationClass, radioIndicatorBaseClass, radioIndicatorDotClass, radioIndicatorSizeClass, radioItemBaseClass, radioItemSizeClass, radioLabelSizeClass, radioOptionRowClass, selectBaseClass, selectSizeClass, selectVariantClass, switchThumbBaseClass, switchThumbClass, switchTrackBaseClass, switchTrackClass, alignClass as tableAlignClass, tableBaseClass, selectedRowClass as tableSelectedRowClass, tableSizeClass, sortIconClass as tableSortIconClass, textareaBaseClass, textareaResizeClass, textareaSizeClass, textareaVariantClass, toastClassNames, tooltipArrowClass, tooltipContentClass, useConfirm, useDashboardLayout, useDirection };
2375
+ export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, type AlertDialogContentProps, AlertDialogDescription, type AlertDialogDescriptionProps, AlertDialogFooter, type AlertDialogFooterProps, AlertDialogHeader, type AlertDialogHeaderProps, AlertDialogOverlay, type AlertDialogOverlayProps, AlertDialogPortal, AlertDialogTitle, type AlertDialogTitleProps, AlertDialogTrigger, AppShell, type AppShellBrand, type AppShellNavGroup, type AppShellNavItem, type AppShellProps, Avatar, type AvatarProps, Badge, type BadgeProps, type BadgeSize, type BadgeVariant, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Checkbox, type CheckboxProps, type CheckboxSize, type Column, type ColumnAlign, type ConfirmDialogLabels, ConfirmDialogProvider, type ConfirmDialogProviderProps, type ConfirmOptions, DashboardContent, type DashboardContentProps, DashboardHeader, type DashboardHeaderProps, DashboardLayout, type DashboardLayoutContextValue, type DashboardLayoutProps, DashboardMain, type DashboardMainProps, DatePicker, type DatePickerProps, type DatePickerSize, type DatePickerVariant, DetailPage, type DetailPageLabels, type DetailPageNotFoundState, type DetailPageProps, Dialog, DialogClose, DialogContent, type DialogContentProps, DialogDescription, type DialogDescriptionProps, DialogFooter, type DialogFooterProps, DialogHeader, type DialogHeaderProps, DialogOverlay, type DialogOverlayProps, DialogPortal, DialogTitle, type DialogTitleProps, DialogTrigger, type Direction, DropdownMenu, DropdownMenuContent, type DropdownMenuContentProps, DropdownMenuGroup, DropdownMenuItem, type DropdownMenuItemProps, type DropdownMenuItemVariant, DropdownMenuLabel, type DropdownMenuLabelProps, DropdownMenuPortal, DropdownMenuSeparator, type DropdownMenuSeparatorProps, DropdownMenuShortcut, type DropdownMenuShortcutProps, DropdownMenuTrigger, EmptyState, type EmptyStateProps, type EmptyStateSize, Field, type FieldOrientation, type FieldProps, type FieldRHFProps, FileUpload, type FileUploadError, type FileUploadErrorCode, type FileUploadLabels, type FileUploadProps, FormPage, type FormPageLabels, type FormPageProps, HeaderActions, type HeaderActionsProps, HeaderCollapseTrigger, type HeaderCollapseTriggerProps, HeaderMobileTrigger, type HeaderMobileTriggerProps, HeaderSearch, type HeaderSearchProps, HeaderTitle, type HeaderTitleProps, Input, type InputProps, type InputSize, type InputVariant, type LanguageOption, LanguageSwitcher, type LanguageSwitcherProps, ListPage, type ListPageDateFilter, type ListPageEmptyState, type ListPageFilter, type ListPageFilterWidth, type ListPageLabels, type ListPageMultiSelectFilter, type ListPageProps, type ListPageSelectFilter, type ListPageTextFilter, MultiSelect, type MultiSelectLabels, type MultiSelectProps, PageHeader, type PageHeaderBackProps, type PageHeaderBackRenderProps, type PageHeaderHeadingLevel, type PageHeaderProps, type PaginationState, RadioGroup, RadioGroupItem, type RadioGroupOption, type RadioGroupOrientation, type RadioGroupProps, type RadioGroupSize, type RowSelectionState, Select, type SelectOption, type SelectProps, type SelectSize, type SelectVariant, Sidebar, SidebarFooter, type SidebarFooterProps, SidebarGroup, type SidebarGroupProps, SidebarHeader, type SidebarHeaderProps, SidebarNav, SidebarNavGroup, type SidebarNavGroupProps, SidebarNavItem, type SidebarNavItemProps, type SidebarNavItemRenderProps, type SidebarNavProps, type SidebarProps, type SortDirection, type SortState, Switch, type SwitchProps, type SwitchSize, Table, type TableLabels, type TableProps, type TableSize, type TableSizeClasses, Textarea, type TextareaProps, type TextareaResize, type TextareaSize, type TextareaVariant, Toaster, type ToasterProps, Tooltip, type TooltipProps, TooltipProvider, type TooltipProviderProps, badgeBaseClass, badgeDotSizeClass, badgeSizeClass, badgeVariantClass, buttonBaseClass, buttonSizeClass, buttonVariantClass, cn, datePickerCalendarClass, datePickerCaptionClass, datePickerContentClass, datePickerDayBaseClass, datePickerDayWrapperClass, datePickerDisabledClass, datePickerMonthClass, datePickerMonthGridClass, datePickerMonthsClass, datePickerNavButtonClass, datePickerNavClass, datePickerOutsideClass, datePickerPlaceholderClass, datePickerSelectedClass, datePickerTodayClass, datePickerTriggerBaseClass, datePickerTriggerSizeClass, datePickerTriggerVariantClass, datePickerValueClass, datePickerWeekClass, datePickerWeekdayClass, datePickerWeekdaysClass, detailPageBaseClass, detailPageBodyClass, detailPageEmptyClass, detailPageSkeletonRowClass, dialogCloseButtonClass, dialogContentClass, dialogDescriptionClass, dialogFooterClass, dialogHeaderClass, dialogOverlayClass, dialogTitleClass, dropdownMenuContentClass, dropdownMenuItemBaseClass, dropdownMenuItemInsetClass, dropdownMenuItemVariantClass, dropdownMenuLabelClass, dropdownMenuSeparatorClass, dropdownMenuShortcutClass, emptyStateActionsSpacingClass, emptyStateBaseClass, emptyStateContainerSizeClass, emptyStateDescriptionSizeClass, emptyStateIconWrapperBaseClass, emptyStateIconWrapperSizeClass, emptyStateTitleSizeClass, fileUploadBaseClass, fileUploadDropzoneClass, fileUploadFileNameClass, fileUploadFileRowClass, fileUploadFileSizeClass, fileUploadHintClass, fileUploadIconClass, fileUploadPromptClass, fileUploadRemoveClass, formPageActionsBarClass, formPageBaseClass, formPageBodyClass, formPageSkeletonRowClass, inputBaseClass, inputSizeClass, inputVariantClass, multiSelectChipClass, multiSelectChipRemoveClass, multiSelectContentClass, multiSelectEmptyClass, multiSelectListClass, multiSelectOptionClass, multiSelectSearchRowClass, multiSelectTriggerSizeClass, multiSelectValueRowClass, pageHeaderActionsClass, pageHeaderBackClass, pageHeaderBackIconClass, pageHeaderBaseClass, pageHeaderBorderedClass, pageHeaderBreadcrumbsClass, pageHeaderDescriptionClass, pageHeaderTitleBlockClass, pageHeaderTitleClass, pageHeaderTitleRowClass, radioGroupBaseClass, radioGroupOrientationClass, radioIndicatorBaseClass, radioIndicatorDotClass, radioIndicatorSizeClass, radioItemBaseClass, radioItemSizeClass, radioLabelSizeClass, radioOptionRowClass, selectBaseClass, selectSizeClass, selectVariantClass, switchThumbBaseClass, switchThumbClass, switchTrackBaseClass, switchTrackClass, alignClass as tableAlignClass, tableBaseClass, selectedRowClass as tableSelectedRowClass, tableSizeClass, sortIconClass as tableSortIconClass, textareaBaseClass, textareaResizeClass, textareaSizeClass, textareaVariantClass, toastClassNames, tooltipArrowClass, tooltipContentClass, useConfirm, useDashboardLayout, useDirection };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as react from 'react';
3
- import { ComponentPropsWithoutRef, HTMLAttributes, ReactNode, ButtonHTMLAttributes, ReactElement, InputHTMLAttributes, ChangeEvent, FormEventHandler, FieldsetHTMLAttributes, Ref, TextareaHTMLAttributes } from 'react';
3
+ import { ComponentPropsWithoutRef, HTMLAttributes, ReactNode, ButtonHTMLAttributes, ReactElement, InputHTMLAttributes, ChangeEvent, ForwardRefExoticComponent, RefAttributes, FormEventHandler, FieldsetHTMLAttributes, Ref, TextareaHTMLAttributes } from 'react';
4
4
  import * as RadixAlertDialog from '@radix-ui/react-alert-dialog';
5
5
  import { LinkProps } from 'react-router-dom';
6
6
  import { Locale } from 'react-day-picker';
@@ -1029,6 +1029,117 @@ type FieldProps<TValues extends FieldValues = FieldValues, TName extends FieldPa
1029
1029
  */
1030
1030
  declare function Field<TValues extends FieldValues = FieldValues, TName extends FieldPath<TValues> = FieldPath<TValues>>(props: FieldProps<TValues, TName>): ReactElement;
1031
1031
 
1032
+ type FileUploadErrorCode = 'file-too-large' | 'file-type-rejected';
1033
+ interface FileUploadError {
1034
+ code: FileUploadErrorCode;
1035
+ /** Direction-aware human-readable message. */
1036
+ message: string;
1037
+ /** The rejected file. */
1038
+ file: File;
1039
+ }
1040
+ interface FileUploadLabels {
1041
+ /** Empty-dropzone prompt. Direction-aware default. */
1042
+ prompt?: string;
1043
+ /** Hint line under the prompt. Defaults to `Max {maxSize} MB` (direction-aware). */
1044
+ hint?: string;
1045
+ /** aria-label prefix for the remove (×) button. Direction-aware default. */
1046
+ remove?: string;
1047
+ }
1048
+ interface FileUploadBaseProps {
1049
+ /** Native `accept` filter (e.g. `"image/*,.pdf"`). Also enforced on drop. */
1050
+ accept?: string;
1051
+ /** Max size per file, in MB. Defaults to `5`. */
1052
+ maxSize?: number;
1053
+ disabled?: boolean;
1054
+ /** Marks the underlying input required (for form validation). */
1055
+ required?: boolean;
1056
+ /** Native form name. */
1057
+ name?: string;
1058
+ /** Override id (otherwise auto-generated via useId). */
1059
+ id?: string;
1060
+ /** Fires when a file is rejected by `accept` / `maxSize`. */
1061
+ onError?: (error: FileUploadError) => void;
1062
+ /** Called when focus leaves the input. */
1063
+ onBlur?: () => void;
1064
+ /** Localized copy. */
1065
+ labels?: FileUploadLabels;
1066
+ /** Class on the outer wrapper. */
1067
+ className?: string;
1068
+ 'aria-invalid'?: boolean | 'true' | 'false';
1069
+ 'aria-describedby'?: string;
1070
+ 'aria-label'?: string;
1071
+ }
1072
+ /**
1073
+ * Discriminated on `multiple`: the value is `File | null` for single mode and
1074
+ * `File[]` for multiple mode.
1075
+ */
1076
+ type FileUploadProps = FileUploadBaseProps & ({
1077
+ multiple?: false;
1078
+ value?: File | null;
1079
+ defaultValue?: File | null;
1080
+ onValueChange?: (file: File | null) => void;
1081
+ onChange?: (file: File | null) => void;
1082
+ } | {
1083
+ multiple: true;
1084
+ value?: File[];
1085
+ defaultValue?: File[];
1086
+ onValueChange?: (files: File[]) => void;
1087
+ onChange?: (files: File[]) => void;
1088
+ });
1089
+ /**
1090
+ * Drag-and-drop file picker. **Bare control** (no inline label/error) — wrap in
1091
+ * `<Field label="…">` for label + helper + error wiring (ADR-007). Discriminated
1092
+ * on `multiple`: value is `File | null` (single) or `File[]` (multiple).
1093
+ *
1094
+ * Rejected files (by `accept` / `maxSize`) are not added and reported through
1095
+ * `onError` — surface them via `toast(...)` or the wrapping `<Field>` error.
1096
+ * Direction-aware copy (EN / AR) via `useDirection()`; override with `labels`.
1097
+ *
1098
+ * @example Single file inside a Field (RHF + Zod)
1099
+ * ```tsx
1100
+ * <Field name="cv" label="CV (PDF)" required>
1101
+ * <FileUpload accept=".pdf" maxSize={10} onError={(e) => toast.error(e.message)} />
1102
+ * </Field>
1103
+ * ```
1104
+ *
1105
+ * @example Multiple files, controlled
1106
+ * ```tsx
1107
+ * <FileUpload
1108
+ * multiple
1109
+ * accept="image/*"
1110
+ * value={images}
1111
+ * onValueChange={setImages}
1112
+ * aria-label="Gallery images"
1113
+ * />
1114
+ * ```
1115
+ */
1116
+ declare const FileUpload: ForwardRefExoticComponent<FileUploadProps & RefAttributes<HTMLDivElement>>;
1117
+
1118
+ /**
1119
+ * FileUpload styling. The dropzone is a `<label>` whose state is driven by
1120
+ * `data-drag-active` / `data-invalid` / `data-disabled` and the focus ring of
1121
+ * the visually-hidden `peer` input. Re-exported from `src/index.ts` so consumers
1122
+ * can compose the same look onto custom elements.
1123
+ */
1124
+ /** Outer wrapper — owns the drag handlers + stacks the dropzone and file rows. */
1125
+ declare const fileUploadBaseClass = "flex w-full min-w-0 flex-col gap-2";
1126
+ /** The clickable / drop target. */
1127
+ declare const fileUploadDropzoneClass: string;
1128
+ /** Upload glyph in the empty dropzone. */
1129
+ declare const fileUploadIconClass = "size-8 text-muted-foreground";
1130
+ /** Primary prompt line. */
1131
+ declare const fileUploadPromptClass = "text-sm text-foreground";
1132
+ /** Secondary hint line (size limit, etc.). */
1133
+ declare const fileUploadHintClass = "text-xs text-muted-foreground";
1134
+ /** A selected-file row (icon + name/size + remove). */
1135
+ declare const fileUploadFileRowClass = "flex items-center justify-between gap-2 rounded-md border border-border bg-card px-3 py-2";
1136
+ /** File name (truncates). */
1137
+ declare const fileUploadFileNameClass = "truncate text-sm font-medium text-foreground";
1138
+ /** File size sub-label. */
1139
+ declare const fileUploadFileSizeClass = "text-xs text-muted-foreground";
1140
+ /** The per-file "×" remove button. */
1141
+ declare const fileUploadRemoveClass = "inline-flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40 disabled:pointer-events-none disabled:opacity-50";
1142
+
1032
1143
  interface FormPageLabels {
1033
1144
  /** Back button label (top-left). Direction-aware default: `"Back"` / `"رجوع"`. */
1034
1145
  back?: string;
@@ -2261,4 +2372,4 @@ declare function useDirection(): Direction;
2261
2372
 
2262
2373
  declare function cn(...inputs: ClassValue[]): string;
2263
2374
 
2264
- export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, type AlertDialogContentProps, AlertDialogDescription, type AlertDialogDescriptionProps, AlertDialogFooter, type AlertDialogFooterProps, AlertDialogHeader, type AlertDialogHeaderProps, AlertDialogOverlay, type AlertDialogOverlayProps, AlertDialogPortal, AlertDialogTitle, type AlertDialogTitleProps, AlertDialogTrigger, AppShell, type AppShellBrand, type AppShellNavGroup, type AppShellNavItem, type AppShellProps, Avatar, type AvatarProps, Badge, type BadgeProps, type BadgeSize, type BadgeVariant, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Checkbox, type CheckboxProps, type CheckboxSize, type Column, type ColumnAlign, type ConfirmDialogLabels, ConfirmDialogProvider, type ConfirmDialogProviderProps, type ConfirmOptions, DashboardContent, type DashboardContentProps, DashboardHeader, type DashboardHeaderProps, DashboardLayout, type DashboardLayoutContextValue, type DashboardLayoutProps, DashboardMain, type DashboardMainProps, DatePicker, type DatePickerProps, type DatePickerSize, type DatePickerVariant, DetailPage, type DetailPageLabels, type DetailPageNotFoundState, type DetailPageProps, Dialog, DialogClose, DialogContent, type DialogContentProps, DialogDescription, type DialogDescriptionProps, DialogFooter, type DialogFooterProps, DialogHeader, type DialogHeaderProps, DialogOverlay, type DialogOverlayProps, DialogPortal, DialogTitle, type DialogTitleProps, DialogTrigger, type Direction, DropdownMenu, DropdownMenuContent, type DropdownMenuContentProps, DropdownMenuGroup, DropdownMenuItem, type DropdownMenuItemProps, type DropdownMenuItemVariant, DropdownMenuLabel, type DropdownMenuLabelProps, DropdownMenuPortal, DropdownMenuSeparator, type DropdownMenuSeparatorProps, DropdownMenuShortcut, type DropdownMenuShortcutProps, DropdownMenuTrigger, EmptyState, type EmptyStateProps, type EmptyStateSize, Field, type FieldOrientation, type FieldProps, type FieldRHFProps, FormPage, type FormPageLabels, type FormPageProps, HeaderActions, type HeaderActionsProps, HeaderCollapseTrigger, type HeaderCollapseTriggerProps, HeaderMobileTrigger, type HeaderMobileTriggerProps, HeaderSearch, type HeaderSearchProps, HeaderTitle, type HeaderTitleProps, Input, type InputProps, type InputSize, type InputVariant, type LanguageOption, LanguageSwitcher, type LanguageSwitcherProps, ListPage, type ListPageDateFilter, type ListPageEmptyState, type ListPageFilter, type ListPageFilterWidth, type ListPageLabels, type ListPageMultiSelectFilter, type ListPageProps, type ListPageSelectFilter, type ListPageTextFilter, MultiSelect, type MultiSelectLabels, type MultiSelectProps, PageHeader, type PageHeaderBackProps, type PageHeaderBackRenderProps, type PageHeaderHeadingLevel, type PageHeaderProps, type PaginationState, RadioGroup, RadioGroupItem, type RadioGroupOption, type RadioGroupOrientation, type RadioGroupProps, type RadioGroupSize, type RowSelectionState, Select, type SelectOption, type SelectProps, type SelectSize, type SelectVariant, Sidebar, SidebarFooter, type SidebarFooterProps, SidebarGroup, type SidebarGroupProps, SidebarHeader, type SidebarHeaderProps, SidebarNav, SidebarNavGroup, type SidebarNavGroupProps, SidebarNavItem, type SidebarNavItemProps, type SidebarNavItemRenderProps, type SidebarNavProps, type SidebarProps, type SortDirection, type SortState, Switch, type SwitchProps, type SwitchSize, Table, type TableLabels, type TableProps, type TableSize, type TableSizeClasses, Textarea, type TextareaProps, type TextareaResize, type TextareaSize, type TextareaVariant, Toaster, type ToasterProps, Tooltip, type TooltipProps, TooltipProvider, type TooltipProviderProps, badgeBaseClass, badgeDotSizeClass, badgeSizeClass, badgeVariantClass, buttonBaseClass, buttonSizeClass, buttonVariantClass, cn, datePickerCalendarClass, datePickerCaptionClass, datePickerContentClass, datePickerDayBaseClass, datePickerDayWrapperClass, datePickerDisabledClass, datePickerMonthClass, datePickerMonthGridClass, datePickerMonthsClass, datePickerNavButtonClass, datePickerNavClass, datePickerOutsideClass, datePickerPlaceholderClass, datePickerSelectedClass, datePickerTodayClass, datePickerTriggerBaseClass, datePickerTriggerSizeClass, datePickerTriggerVariantClass, datePickerValueClass, datePickerWeekClass, datePickerWeekdayClass, datePickerWeekdaysClass, detailPageBaseClass, detailPageBodyClass, detailPageEmptyClass, detailPageSkeletonRowClass, dialogCloseButtonClass, dialogContentClass, dialogDescriptionClass, dialogFooterClass, dialogHeaderClass, dialogOverlayClass, dialogTitleClass, dropdownMenuContentClass, dropdownMenuItemBaseClass, dropdownMenuItemInsetClass, dropdownMenuItemVariantClass, dropdownMenuLabelClass, dropdownMenuSeparatorClass, dropdownMenuShortcutClass, emptyStateActionsSpacingClass, emptyStateBaseClass, emptyStateContainerSizeClass, emptyStateDescriptionSizeClass, emptyStateIconWrapperBaseClass, emptyStateIconWrapperSizeClass, emptyStateTitleSizeClass, formPageActionsBarClass, formPageBaseClass, formPageBodyClass, formPageSkeletonRowClass, inputBaseClass, inputSizeClass, inputVariantClass, multiSelectChipClass, multiSelectChipRemoveClass, multiSelectContentClass, multiSelectEmptyClass, multiSelectListClass, multiSelectOptionClass, multiSelectSearchRowClass, multiSelectTriggerSizeClass, multiSelectValueRowClass, pageHeaderActionsClass, pageHeaderBackClass, pageHeaderBackIconClass, pageHeaderBaseClass, pageHeaderBorderedClass, pageHeaderBreadcrumbsClass, pageHeaderDescriptionClass, pageHeaderTitleBlockClass, pageHeaderTitleClass, pageHeaderTitleRowClass, radioGroupBaseClass, radioGroupOrientationClass, radioIndicatorBaseClass, radioIndicatorDotClass, radioIndicatorSizeClass, radioItemBaseClass, radioItemSizeClass, radioLabelSizeClass, radioOptionRowClass, selectBaseClass, selectSizeClass, selectVariantClass, switchThumbBaseClass, switchThumbClass, switchTrackBaseClass, switchTrackClass, alignClass as tableAlignClass, tableBaseClass, selectedRowClass as tableSelectedRowClass, tableSizeClass, sortIconClass as tableSortIconClass, textareaBaseClass, textareaResizeClass, textareaSizeClass, textareaVariantClass, toastClassNames, tooltipArrowClass, tooltipContentClass, useConfirm, useDashboardLayout, useDirection };
2375
+ export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, type AlertDialogContentProps, AlertDialogDescription, type AlertDialogDescriptionProps, AlertDialogFooter, type AlertDialogFooterProps, AlertDialogHeader, type AlertDialogHeaderProps, AlertDialogOverlay, type AlertDialogOverlayProps, AlertDialogPortal, AlertDialogTitle, type AlertDialogTitleProps, AlertDialogTrigger, AppShell, type AppShellBrand, type AppShellNavGroup, type AppShellNavItem, type AppShellProps, Avatar, type AvatarProps, Badge, type BadgeProps, type BadgeSize, type BadgeVariant, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Checkbox, type CheckboxProps, type CheckboxSize, type Column, type ColumnAlign, type ConfirmDialogLabels, ConfirmDialogProvider, type ConfirmDialogProviderProps, type ConfirmOptions, DashboardContent, type DashboardContentProps, DashboardHeader, type DashboardHeaderProps, DashboardLayout, type DashboardLayoutContextValue, type DashboardLayoutProps, DashboardMain, type DashboardMainProps, DatePicker, type DatePickerProps, type DatePickerSize, type DatePickerVariant, DetailPage, type DetailPageLabels, type DetailPageNotFoundState, type DetailPageProps, Dialog, DialogClose, DialogContent, type DialogContentProps, DialogDescription, type DialogDescriptionProps, DialogFooter, type DialogFooterProps, DialogHeader, type DialogHeaderProps, DialogOverlay, type DialogOverlayProps, DialogPortal, DialogTitle, type DialogTitleProps, DialogTrigger, type Direction, DropdownMenu, DropdownMenuContent, type DropdownMenuContentProps, DropdownMenuGroup, DropdownMenuItem, type DropdownMenuItemProps, type DropdownMenuItemVariant, DropdownMenuLabel, type DropdownMenuLabelProps, DropdownMenuPortal, DropdownMenuSeparator, type DropdownMenuSeparatorProps, DropdownMenuShortcut, type DropdownMenuShortcutProps, DropdownMenuTrigger, EmptyState, type EmptyStateProps, type EmptyStateSize, Field, type FieldOrientation, type FieldProps, type FieldRHFProps, FileUpload, type FileUploadError, type FileUploadErrorCode, type FileUploadLabels, type FileUploadProps, FormPage, type FormPageLabels, type FormPageProps, HeaderActions, type HeaderActionsProps, HeaderCollapseTrigger, type HeaderCollapseTriggerProps, HeaderMobileTrigger, type HeaderMobileTriggerProps, HeaderSearch, type HeaderSearchProps, HeaderTitle, type HeaderTitleProps, Input, type InputProps, type InputSize, type InputVariant, type LanguageOption, LanguageSwitcher, type LanguageSwitcherProps, ListPage, type ListPageDateFilter, type ListPageEmptyState, type ListPageFilter, type ListPageFilterWidth, type ListPageLabels, type ListPageMultiSelectFilter, type ListPageProps, type ListPageSelectFilter, type ListPageTextFilter, MultiSelect, type MultiSelectLabels, type MultiSelectProps, PageHeader, type PageHeaderBackProps, type PageHeaderBackRenderProps, type PageHeaderHeadingLevel, type PageHeaderProps, type PaginationState, RadioGroup, RadioGroupItem, type RadioGroupOption, type RadioGroupOrientation, type RadioGroupProps, type RadioGroupSize, type RowSelectionState, Select, type SelectOption, type SelectProps, type SelectSize, type SelectVariant, Sidebar, SidebarFooter, type SidebarFooterProps, SidebarGroup, type SidebarGroupProps, SidebarHeader, type SidebarHeaderProps, SidebarNav, SidebarNavGroup, type SidebarNavGroupProps, SidebarNavItem, type SidebarNavItemProps, type SidebarNavItemRenderProps, type SidebarNavProps, type SidebarProps, type SortDirection, type SortState, Switch, type SwitchProps, type SwitchSize, Table, type TableLabels, type TableProps, type TableSize, type TableSizeClasses, Textarea, type TextareaProps, type TextareaResize, type TextareaSize, type TextareaVariant, Toaster, type ToasterProps, Tooltip, type TooltipProps, TooltipProvider, type TooltipProviderProps, badgeBaseClass, badgeDotSizeClass, badgeSizeClass, badgeVariantClass, buttonBaseClass, buttonSizeClass, buttonVariantClass, cn, datePickerCalendarClass, datePickerCaptionClass, datePickerContentClass, datePickerDayBaseClass, datePickerDayWrapperClass, datePickerDisabledClass, datePickerMonthClass, datePickerMonthGridClass, datePickerMonthsClass, datePickerNavButtonClass, datePickerNavClass, datePickerOutsideClass, datePickerPlaceholderClass, datePickerSelectedClass, datePickerTodayClass, datePickerTriggerBaseClass, datePickerTriggerSizeClass, datePickerTriggerVariantClass, datePickerValueClass, datePickerWeekClass, datePickerWeekdayClass, datePickerWeekdaysClass, detailPageBaseClass, detailPageBodyClass, detailPageEmptyClass, detailPageSkeletonRowClass, dialogCloseButtonClass, dialogContentClass, dialogDescriptionClass, dialogFooterClass, dialogHeaderClass, dialogOverlayClass, dialogTitleClass, dropdownMenuContentClass, dropdownMenuItemBaseClass, dropdownMenuItemInsetClass, dropdownMenuItemVariantClass, dropdownMenuLabelClass, dropdownMenuSeparatorClass, dropdownMenuShortcutClass, emptyStateActionsSpacingClass, emptyStateBaseClass, emptyStateContainerSizeClass, emptyStateDescriptionSizeClass, emptyStateIconWrapperBaseClass, emptyStateIconWrapperSizeClass, emptyStateTitleSizeClass, fileUploadBaseClass, fileUploadDropzoneClass, fileUploadFileNameClass, fileUploadFileRowClass, fileUploadFileSizeClass, fileUploadHintClass, fileUploadIconClass, fileUploadPromptClass, fileUploadRemoveClass, formPageActionsBarClass, formPageBaseClass, formPageBodyClass, formPageSkeletonRowClass, inputBaseClass, inputSizeClass, inputVariantClass, multiSelectChipClass, multiSelectChipRemoveClass, multiSelectContentClass, multiSelectEmptyClass, multiSelectListClass, multiSelectOptionClass, multiSelectSearchRowClass, multiSelectTriggerSizeClass, multiSelectValueRowClass, pageHeaderActionsClass, pageHeaderBackClass, pageHeaderBackIconClass, pageHeaderBaseClass, pageHeaderBorderedClass, pageHeaderBreadcrumbsClass, pageHeaderDescriptionClass, pageHeaderTitleBlockClass, pageHeaderTitleClass, pageHeaderTitleRowClass, radioGroupBaseClass, radioGroupOrientationClass, radioIndicatorBaseClass, radioIndicatorDotClass, radioIndicatorSizeClass, radioItemBaseClass, radioItemSizeClass, radioLabelSizeClass, radioOptionRowClass, selectBaseClass, selectSizeClass, selectVariantClass, switchThumbBaseClass, switchThumbClass, switchTrackBaseClass, switchTrackClass, alignClass as tableAlignClass, tableBaseClass, selectedRowClass as tableSelectedRowClass, tableSizeClass, sortIconClass as tableSortIconClass, textareaBaseClass, textareaResizeClass, textareaSizeClass, textareaVariantClass, toastClassNames, tooltipArrowClass, tooltipContentClass, useConfirm, useDashboardLayout, useDirection };
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import { forwardRef, Children, isValidElement, cloneElement, createContext, useR
3
3
  import { clsx } from 'clsx';
4
4
  import { twMerge } from 'tailwind-merge';
5
5
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
6
- import { Loader2, Check, Minus, Calendar, X, ChevronLeft, ChevronRight, ChevronDown, Search, ChevronUp, ArrowLeft, Menu, FileQuestion, ChevronsUpDown, Inbox, RefreshCw, SearchX } from 'lucide-react';
6
+ import { Loader2, Check, Minus, Calendar, X, ChevronLeft, ChevronRight, Upload, File as File$1, ChevronDown, Search, ChevronUp, ArrowLeft, Menu, FileQuestion, ChevronsUpDown, Inbox, RefreshCw, SearchX } from 'lucide-react';
7
7
  import { DirectionProvider } from '@radix-ui/react-direction';
8
8
  import { Link, useLocation, useResolvedPath, useNavigate } from 'react-router-dom';
9
9
  import * as RadixPopover from '@radix-ui/react-popover';
@@ -271,7 +271,9 @@ function DashboardContent({ className, children, ...props }) {
271
271
  "main",
272
272
  {
273
273
  className: cn(
274
- "flex min-h-[calc(100vh-var(--header-height))] flex-1 flex-col gap-6 p-4 sm:p-6 lg:p-8",
274
+ // `min-w-0` keeps wide children (Table, code blocks) scrolling within
275
+ // this column instead of widening the page past 100%.
276
+ "flex min-h-[calc(100vh-var(--header-height))] min-w-0 flex-1 flex-col gap-6 p-4 sm:p-6 lg:p-8",
275
277
  className
276
278
  ),
277
279
  ...props,
@@ -337,7 +339,10 @@ function DashboardMain({ className, children, ...props }) {
337
339
  "div",
338
340
  {
339
341
  className: cn(
340
- "flex min-h-screen flex-1 flex-col transition-[margin] duration-200 ease-out",
342
+ // `min-w-0` lets this flex column shrink below its content's intrinsic
343
+ // width so wide children (e.g. a Table) scroll internally instead of
344
+ // stretching the whole layout past 100%.
345
+ "flex min-h-screen min-w-0 flex-1 flex-col transition-[margin] duration-200 ease-out",
341
346
  // On desktop, push the main column past the fixed sidebar using logical margin.
342
347
  collapsed ? "lg:ms-[var(--sidebar-width-collapsed)]" : "lg:ms-[var(--sidebar-width)]",
343
348
  className
@@ -1697,19 +1702,231 @@ function mergeRefs(...refs) {
1697
1702
  };
1698
1703
  }
1699
1704
 
1705
+ // src/components/file-upload/fileUploadVariants.ts
1706
+ var fileUploadBaseClass = "flex w-full min-w-0 flex-col gap-2";
1707
+ var fileUploadDropzoneClass = "flex cursor-pointer flex-col items-center justify-center gap-2 rounded-lg border-2 border-dashed border-input bg-muted/40 px-6 py-8 text-center transition-colors hover:border-ring peer-focus-visible:border-ring peer-focus-visible:ring-2 peer-focus-visible:ring-ring/40 data-[drag-active=true]:border-ring data-[drag-active=true]:bg-accent data-[invalid=true]:border-destructive data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-50 data-[disabled=true]:hover:border-input";
1708
+ var fileUploadIconClass = "size-8 text-muted-foreground";
1709
+ var fileUploadPromptClass = "text-sm text-foreground";
1710
+ var fileUploadHintClass = "text-xs text-muted-foreground";
1711
+ var fileUploadFileRowClass = "flex items-center justify-between gap-2 rounded-md border border-border bg-card px-3 py-2";
1712
+ var fileUploadFileNameClass = "truncate text-sm font-medium text-foreground";
1713
+ var fileUploadFileSizeClass = "text-xs text-muted-foreground";
1714
+ var fileUploadRemoveClass = "inline-flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40 disabled:pointer-events-none disabled:opacity-50";
1715
+ var DEFAULT_MAX_SIZE_MB = 5;
1716
+ var DEFAULT_LABELS_LTR2 = {
1717
+ prompt: "Drag & drop a file or click to browse",
1718
+ remove: "Remove"
1719
+ };
1720
+ var DEFAULT_LABELS_RTL2 = {
1721
+ prompt: "\u0627\u0633\u062D\u0628 \u0648\u0623\u0641\u0644\u062A \u0645\u0644\u0641\u064B\u0627 \u0623\u0648 \u0627\u0636\u063A\u0637 \u0644\u0644\u0627\u062E\u062A\u064A\u0627\u0631",
1722
+ remove: "\u0625\u0632\u0627\u0644\u0629"
1723
+ };
1724
+ function normalizeFiles(value) {
1725
+ if (Array.isArray(value)) return value.filter((f) => f instanceof File);
1726
+ return value instanceof File ? [value] : [];
1727
+ }
1728
+ function fileKey(file) {
1729
+ return `${file.name}:${file.size}:${file.lastModified}`;
1730
+ }
1731
+ function formatBytes(bytes) {
1732
+ if (bytes < 1024) return `${bytes} B`;
1733
+ const kb = bytes / 1024;
1734
+ if (kb < 1024) return `${kb.toFixed(1)} KB`;
1735
+ return `${(kb / 1024).toFixed(1)} MB`;
1736
+ }
1737
+ function matchesAccept(file, accept) {
1738
+ if (!accept) return true;
1739
+ const tokens = accept.split(",").map((t) => t.trim().toLowerCase()).filter(Boolean);
1740
+ if (tokens.length === 0 || tokens.includes("*") || tokens.includes("*/*")) return true;
1741
+ const name = file.name.toLowerCase();
1742
+ const type = file.type.toLowerCase();
1743
+ return tokens.some((token) => {
1744
+ if (token.startsWith(".")) return name.endsWith(token);
1745
+ if (token.endsWith("/*")) return type.startsWith(token.slice(0, -1));
1746
+ return type === token;
1747
+ });
1748
+ }
1749
+ var FileUploadImpl = forwardRef(
1750
+ function FileUpload(props, ref) {
1751
+ const {
1752
+ multiple = false,
1753
+ accept,
1754
+ maxSize = DEFAULT_MAX_SIZE_MB,
1755
+ disabled = false,
1756
+ required,
1757
+ name,
1758
+ id,
1759
+ onError,
1760
+ onBlur,
1761
+ labels: labelsProp,
1762
+ className,
1763
+ value,
1764
+ defaultValue,
1765
+ onValueChange,
1766
+ onChange,
1767
+ "aria-invalid": ariaInvalid,
1768
+ "aria-describedby": ariaDescribedBy,
1769
+ "aria-label": ariaLabel
1770
+ } = props;
1771
+ const dir = useDirection();
1772
+ const generatedId = useId();
1773
+ const inputId = id ?? generatedId;
1774
+ const [dragActive, setDragActive] = useState(false);
1775
+ const baseLabels = dir === "rtl" ? DEFAULT_LABELS_RTL2 : DEFAULT_LABELS_LTR2;
1776
+ const prompt = labelsProp?.prompt ?? baseLabels.prompt;
1777
+ const removeLabel = labelsProp?.remove ?? baseLabels.remove;
1778
+ const hint = labelsProp?.hint ?? (dir === "rtl" ? `\u0627\u0644\u062D\u062F \u0627\u0644\u0623\u0642\u0635\u0649 ${maxSize} \u0645\u064A\u062C\u0627\u0628\u0627\u064A\u062A` : `Max ${maxSize} MB`);
1779
+ const isControlled = value !== void 0;
1780
+ const [internal, setInternal] = useState(() => normalizeFiles(defaultValue));
1781
+ const files = isControlled ? normalizeFiles(value) : internal;
1782
+ const invalid = ariaInvalid === true || ariaInvalid === "true";
1783
+ const emit = (next) => {
1784
+ if (!isControlled) setInternal(next);
1785
+ onValueChange?.(multiple ? next : next[0] ?? null);
1786
+ onChange?.(multiple ? next : next[0] ?? null);
1787
+ };
1788
+ const tooLargeMessage = (file) => dir === "rtl" ? `${file.name} \u0623\u0643\u0628\u0631 \u0645\u0646 ${maxSize} \u0645\u064A\u062C\u0627\u0628\u0627\u064A\u062A` : `${file.name} is larger than ${maxSize} MB`;
1789
+ const wrongTypeMessage = (file) => dir === "rtl" ? `${file.name} \u0644\u064A\u0633 \u0646\u0648\u0639 \u0645\u0644\u0641 \u0645\u0642\u0628\u0648\u0644` : `${file.name} is not an accepted file type`;
1790
+ const addFiles = (incoming) => {
1791
+ if (disabled) return;
1792
+ const accepted = [];
1793
+ for (const file of Array.from(incoming)) {
1794
+ if (!matchesAccept(file, accept)) {
1795
+ onError?.({ code: "file-type-rejected", message: wrongTypeMessage(file), file });
1796
+ continue;
1797
+ }
1798
+ if (maxSize && file.size > maxSize * 1024 * 1024) {
1799
+ onError?.({ code: "file-too-large", message: tooLargeMessage(file), file });
1800
+ continue;
1801
+ }
1802
+ accepted.push(file);
1803
+ }
1804
+ if (accepted.length === 0) return;
1805
+ if (!multiple) {
1806
+ const [first] = accepted;
1807
+ if (first) emit([first]);
1808
+ return;
1809
+ }
1810
+ const byKey = new Map(files.map((f) => [fileKey(f), f]));
1811
+ for (const f of accepted) byKey.set(fileKey(f), f);
1812
+ emit([...byKey.values()]);
1813
+ };
1814
+ const handleInputChange = (event) => {
1815
+ if (event.target.files) addFiles(event.target.files);
1816
+ event.target.value = "";
1817
+ };
1818
+ const handleDrag = (event) => {
1819
+ event.preventDefault();
1820
+ event.stopPropagation();
1821
+ if (disabled) return;
1822
+ if (event.type === "dragenter" || event.type === "dragover") setDragActive(true);
1823
+ else if (event.type === "dragleave") setDragActive(false);
1824
+ };
1825
+ const handleDrop = (event) => {
1826
+ event.preventDefault();
1827
+ event.stopPropagation();
1828
+ setDragActive(false);
1829
+ if (!disabled && event.dataTransfer.files) addFiles(event.dataTransfer.files);
1830
+ };
1831
+ const remove = (file) => emit(files.filter((f) => fileKey(f) !== fileKey(file)));
1832
+ const showDropzone = multiple || files.length === 0;
1833
+ return (
1834
+ // biome-ignore lint/a11y/noStaticElementInteractions: drag-and-drop is a wrapper affordance; keyboard/click access is the inner <label> + focusable <input>.
1835
+ /* @__PURE__ */ jsxs(
1836
+ "div",
1837
+ {
1838
+ ref,
1839
+ "data-slot": "file-upload",
1840
+ className: cn(fileUploadBaseClass, className),
1841
+ onDragEnter: handleDrag,
1842
+ onDragOver: handleDrag,
1843
+ onDragLeave: handleDrag,
1844
+ onDrop: handleDrop,
1845
+ children: [
1846
+ /* @__PURE__ */ jsx(
1847
+ "input",
1848
+ {
1849
+ id: inputId,
1850
+ type: "file",
1851
+ accept,
1852
+ multiple,
1853
+ name,
1854
+ required,
1855
+ disabled,
1856
+ onChange: handleInputChange,
1857
+ onBlur,
1858
+ "aria-invalid": ariaInvalid,
1859
+ "aria-describedby": ariaDescribedBy,
1860
+ "aria-label": ariaLabel,
1861
+ className: "peer sr-only"
1862
+ }
1863
+ ),
1864
+ showDropzone ? /* @__PURE__ */ jsxs(
1865
+ "label",
1866
+ {
1867
+ htmlFor: inputId,
1868
+ "data-slot": "file-upload-dropzone",
1869
+ "data-drag-active": dragActive ? "true" : void 0,
1870
+ "data-invalid": invalid ? "true" : void 0,
1871
+ "data-disabled": disabled ? "true" : void 0,
1872
+ className: fileUploadDropzoneClass,
1873
+ children: [
1874
+ /* @__PURE__ */ jsx(Upload, { "aria-hidden": "true", className: fileUploadIconClass }),
1875
+ /* @__PURE__ */ jsx("span", { className: fileUploadPromptClass, children: prompt }),
1876
+ /* @__PURE__ */ jsx("span", { className: fileUploadHintClass, children: hint })
1877
+ ]
1878
+ }
1879
+ ) : null,
1880
+ files.length > 0 ? /* @__PURE__ */ jsx("ul", { className: "flex flex-col gap-2", children: files.map((file) => /* @__PURE__ */ jsxs(
1881
+ "li",
1882
+ {
1883
+ "data-slot": "file-upload-file",
1884
+ className: fileUploadFileRowClass,
1885
+ children: [
1886
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [
1887
+ /* @__PURE__ */ jsx(File$1, { "aria-hidden": "true", className: "size-5 shrink-0 text-muted-foreground" }),
1888
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
1889
+ /* @__PURE__ */ jsx("p", { className: fileUploadFileNameClass, children: file.name }),
1890
+ /* @__PURE__ */ jsx("p", { className: fileUploadFileSizeClass, children: formatBytes(file.size) })
1891
+ ] })
1892
+ ] }),
1893
+ /* @__PURE__ */ jsx(
1894
+ "button",
1895
+ {
1896
+ type: "button",
1897
+ disabled,
1898
+ "aria-label": `${removeLabel}: ${file.name}`,
1899
+ "data-slot": "file-upload-remove",
1900
+ className: fileUploadRemoveClass,
1901
+ onClick: () => remove(file),
1902
+ children: /* @__PURE__ */ jsx(X, { "aria-hidden": "true", className: "size-4" })
1903
+ }
1904
+ )
1905
+ ]
1906
+ },
1907
+ fileKey(file)
1908
+ )) }) : null
1909
+ ]
1910
+ }
1911
+ )
1912
+ );
1913
+ }
1914
+ );
1915
+ var FileUpload2 = FileUploadImpl;
1916
+
1700
1917
  // src/components/form-page/formPageVariants.ts
1701
1918
  var formPageBaseClass = "flex w-full flex-col gap-6";
1702
1919
  var formPageBodyClass = "flex-1";
1703
1920
  var formPageActionsBarClass = "sticky bottom-0 -mx-6 -mb-6 mt-6 flex items-center justify-end gap-2 border-t border-border bg-background/95 px-6 py-3 backdrop-blur supports-[backdrop-filter]:bg-background/80";
1704
1921
  var formPageSkeletonRowClass = "h-10 w-full animate-pulse rounded-md bg-muted";
1705
1922
  var DEFAULT_SKELETON_ROW_COUNT2 = 6;
1706
- var DEFAULT_LABELS_LTR2 = {
1923
+ var DEFAULT_LABELS_LTR3 = {
1707
1924
  back: "Back",
1708
1925
  cancel: "Cancel",
1709
1926
  save: "Save",
1710
1927
  saving: "Saving\u2026"
1711
1928
  };
1712
- var DEFAULT_LABELS_RTL2 = {
1929
+ var DEFAULT_LABELS_RTL3 = {
1713
1930
  back: "\u0631\u062C\u0648\u0639",
1714
1931
  cancel: "\u0625\u0644\u063A\u0627\u0621",
1715
1932
  save: "\u062D\u0641\u0638",
@@ -1736,7 +1953,7 @@ function FormPage({
1736
1953
  const dir = useDirection();
1737
1954
  const formContext = useFormContext();
1738
1955
  const submitting = isSubmitting ?? formContext?.formState?.isSubmitting ?? false;
1739
- const defaults = dir === "rtl" ? DEFAULT_LABELS_RTL2 : DEFAULT_LABELS_LTR2;
1956
+ const defaults = dir === "rtl" ? DEFAULT_LABELS_RTL3 : DEFAULT_LABELS_LTR3;
1740
1957
  const labels = { ...defaults, ...labelsProp };
1741
1958
  const goBack = () => navigate(-1);
1742
1959
  return /* @__PURE__ */ jsxs("div", { "data-slot": "form-page", className: cn(formPageBaseClass, className), children: [
@@ -2154,7 +2371,7 @@ function Table(props) {
2154
2371
  const sizeClasses = tableSizeClass[size];
2155
2372
  const showToolbar = enableRowSelection && bulkActions !== void 0 && selected.size > 0;
2156
2373
  const skeletonCount = loadingRowCount ?? pageSize;
2157
- return /* @__PURE__ */ jsxs("div", { className: cn("flex w-full flex-col gap-3", className), children: [
2374
+ return /* @__PURE__ */ jsxs("div", { className: cn("flex w-full min-w-0 flex-col gap-3", className), children: [
2158
2375
  showToolbar && /* @__PURE__ */ jsx(
2159
2376
  Toolbar,
2160
2377
  {
@@ -2187,7 +2404,9 @@ function Table(props) {
2187
2404
  "thead",
2188
2405
  {
2189
2406
  className: cn(
2190
- "bg-muted/40 text-muted-foreground",
2407
+ // Opaque (not bg-muted/40) so a sticky header fully hides the rows
2408
+ // scrolling underneath it.
2409
+ "bg-muted text-muted-foreground",
2191
2410
  maxHeight !== void 0 && "sticky top-0 z-10"
2192
2411
  ),
2193
2412
  children: /* @__PURE__ */ jsxs("tr", { children: [
@@ -2389,11 +2608,11 @@ var multiSelectSearchRowClass = "border-b border-border p-1";
2389
2608
  var multiSelectListClass = "max-h-60 overflow-y-auto overflow-x-hidden p-1";
2390
2609
  var multiSelectOptionClass = "flex w-full cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none hover:bg-accent hover:text-accent-foreground has-[:focus-visible]:bg-accent has-[:disabled]:pointer-events-none has-[:disabled]:opacity-50";
2391
2610
  var multiSelectEmptyClass = "px-2 py-6 text-center text-sm text-muted-foreground";
2392
- var DEFAULT_LABELS_LTR3 = {
2611
+ var DEFAULT_LABELS_LTR4 = {
2393
2612
  search: "Search\u2026",
2394
2613
  empty: "No results"
2395
2614
  };
2396
- var DEFAULT_LABELS_RTL3 = {
2615
+ var DEFAULT_LABELS_RTL4 = {
2397
2616
  search: "\u0628\u062D\u062B\u2026",
2398
2617
  empty: "\u0644\u0627 \u0646\u062A\u0627\u0626\u062C"
2399
2618
  };
@@ -2424,7 +2643,7 @@ var MultiSelect = forwardRef(function MultiSelect2({
2424
2643
  "aria-label": ariaLabel
2425
2644
  }, ref) {
2426
2645
  const dir = useDirection();
2427
- const labels = { ...dir === "rtl" ? DEFAULT_LABELS_RTL3 : DEFAULT_LABELS_LTR3, ...labelsProp };
2646
+ const labels = { ...dir === "rtl" ? DEFAULT_LABELS_RTL4 : DEFAULT_LABELS_LTR4, ...labelsProp };
2428
2647
  const generatedId = useId();
2429
2648
  const triggerId = id ?? generatedId;
2430
2649
  const isControlled = value !== void 0;
@@ -3262,6 +3481,6 @@ function Tooltip({
3262
3481
  );
3263
3482
  }
3264
3483
 
3265
- export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AppShell, Avatar, Badge, Button, Checkbox, ConfirmDialogProvider, DashboardContent, DashboardHeader, DashboardLayout, DashboardMain, DatePicker, DetailPage, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuTrigger, EmptyState, Field, FormPage, HeaderActions, HeaderCollapseTrigger, HeaderMobileTrigger, HeaderSearch, HeaderTitle, Input, LanguageSwitcher, ListPage, MultiSelect, PageHeader, RadioGroup, RadioGroupItem, Select, Sidebar, SidebarFooter, SidebarGroup, SidebarHeader, SidebarNav, SidebarNavGroup, SidebarNavItem, Switch, Table, Textarea, Toaster, Tooltip, TooltipProvider, badgeBaseClass, badgeDotSizeClass, badgeSizeClass, badgeVariantClass, buttonBaseClass, buttonSizeClass, buttonVariantClass, cn, datePickerCalendarClass, datePickerCaptionClass, datePickerContentClass, datePickerDayBaseClass, datePickerDayWrapperClass, datePickerDisabledClass, datePickerMonthClass, datePickerMonthGridClass, datePickerMonthsClass, datePickerNavButtonClass, datePickerNavClass, datePickerOutsideClass, datePickerPlaceholderClass, datePickerSelectedClass, datePickerTodayClass, datePickerTriggerBaseClass, datePickerTriggerSizeClass, datePickerTriggerVariantClass, datePickerValueClass, datePickerWeekClass, datePickerWeekdayClass, datePickerWeekdaysClass, detailPageBaseClass, detailPageBodyClass, detailPageEmptyClass, detailPageSkeletonRowClass, dialogCloseButtonClass, dialogContentClass, dialogDescriptionClass, dialogFooterClass, dialogHeaderClass, dialogOverlayClass, dialogTitleClass, dropdownMenuContentClass, dropdownMenuItemBaseClass, dropdownMenuItemInsetClass, dropdownMenuItemVariantClass, dropdownMenuLabelClass, dropdownMenuSeparatorClass, dropdownMenuShortcutClass, emptyStateActionsSpacingClass, emptyStateBaseClass, emptyStateContainerSizeClass, emptyStateDescriptionSizeClass, emptyStateIconWrapperBaseClass, emptyStateIconWrapperSizeClass, emptyStateTitleSizeClass, formPageActionsBarClass, formPageBaseClass, formPageBodyClass, formPageSkeletonRowClass, inputBaseClass, inputSizeClass, inputVariantClass, multiSelectChipClass, multiSelectChipRemoveClass, multiSelectContentClass, multiSelectEmptyClass, multiSelectListClass, multiSelectOptionClass, multiSelectSearchRowClass, multiSelectTriggerSizeClass, multiSelectValueRowClass, pageHeaderActionsClass, pageHeaderBackClass, pageHeaderBackIconClass, pageHeaderBaseClass, pageHeaderBorderedClass, pageHeaderBreadcrumbsClass, pageHeaderDescriptionClass, pageHeaderTitleBlockClass, pageHeaderTitleClass, pageHeaderTitleRowClass, radioGroupBaseClass, radioGroupOrientationClass, radioIndicatorBaseClass, radioIndicatorDotClass, radioIndicatorSizeClass, radioItemBaseClass, radioItemSizeClass, radioLabelSizeClass, radioOptionRowClass, selectBaseClass, selectSizeClass, selectVariantClass, switchThumbBaseClass, switchThumbClass, switchTrackBaseClass, switchTrackClass, alignClass as tableAlignClass, tableBaseClass, selectedRowClass as tableSelectedRowClass, tableSizeClass, sortIconClass as tableSortIconClass, textareaBaseClass, textareaResizeClass, textareaSizeClass, textareaVariantClass, toastClassNames, tooltipArrowClass, tooltipContentClass, useConfirm, useDashboardLayout, useDirection };
3484
+ export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AppShell, Avatar, Badge, Button, Checkbox, ConfirmDialogProvider, DashboardContent, DashboardHeader, DashboardLayout, DashboardMain, DatePicker, DetailPage, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuTrigger, EmptyState, Field, FileUpload2 as FileUpload, FormPage, HeaderActions, HeaderCollapseTrigger, HeaderMobileTrigger, HeaderSearch, HeaderTitle, Input, LanguageSwitcher, ListPage, MultiSelect, PageHeader, RadioGroup, RadioGroupItem, Select, Sidebar, SidebarFooter, SidebarGroup, SidebarHeader, SidebarNav, SidebarNavGroup, SidebarNavItem, Switch, Table, Textarea, Toaster, Tooltip, TooltipProvider, badgeBaseClass, badgeDotSizeClass, badgeSizeClass, badgeVariantClass, buttonBaseClass, buttonSizeClass, buttonVariantClass, cn, datePickerCalendarClass, datePickerCaptionClass, datePickerContentClass, datePickerDayBaseClass, datePickerDayWrapperClass, datePickerDisabledClass, datePickerMonthClass, datePickerMonthGridClass, datePickerMonthsClass, datePickerNavButtonClass, datePickerNavClass, datePickerOutsideClass, datePickerPlaceholderClass, datePickerSelectedClass, datePickerTodayClass, datePickerTriggerBaseClass, datePickerTriggerSizeClass, datePickerTriggerVariantClass, datePickerValueClass, datePickerWeekClass, datePickerWeekdayClass, datePickerWeekdaysClass, detailPageBaseClass, detailPageBodyClass, detailPageEmptyClass, detailPageSkeletonRowClass, dialogCloseButtonClass, dialogContentClass, dialogDescriptionClass, dialogFooterClass, dialogHeaderClass, dialogOverlayClass, dialogTitleClass, dropdownMenuContentClass, dropdownMenuItemBaseClass, dropdownMenuItemInsetClass, dropdownMenuItemVariantClass, dropdownMenuLabelClass, dropdownMenuSeparatorClass, dropdownMenuShortcutClass, emptyStateActionsSpacingClass, emptyStateBaseClass, emptyStateContainerSizeClass, emptyStateDescriptionSizeClass, emptyStateIconWrapperBaseClass, emptyStateIconWrapperSizeClass, emptyStateTitleSizeClass, fileUploadBaseClass, fileUploadDropzoneClass, fileUploadFileNameClass, fileUploadFileRowClass, fileUploadFileSizeClass, fileUploadHintClass, fileUploadIconClass, fileUploadPromptClass, fileUploadRemoveClass, formPageActionsBarClass, formPageBaseClass, formPageBodyClass, formPageSkeletonRowClass, inputBaseClass, inputSizeClass, inputVariantClass, multiSelectChipClass, multiSelectChipRemoveClass, multiSelectContentClass, multiSelectEmptyClass, multiSelectListClass, multiSelectOptionClass, multiSelectSearchRowClass, multiSelectTriggerSizeClass, multiSelectValueRowClass, pageHeaderActionsClass, pageHeaderBackClass, pageHeaderBackIconClass, pageHeaderBaseClass, pageHeaderBorderedClass, pageHeaderBreadcrumbsClass, pageHeaderDescriptionClass, pageHeaderTitleBlockClass, pageHeaderTitleClass, pageHeaderTitleRowClass, radioGroupBaseClass, radioGroupOrientationClass, radioIndicatorBaseClass, radioIndicatorDotClass, radioIndicatorSizeClass, radioItemBaseClass, radioItemSizeClass, radioLabelSizeClass, radioOptionRowClass, selectBaseClass, selectSizeClass, selectVariantClass, switchThumbBaseClass, switchThumbClass, switchTrackBaseClass, switchTrackClass, alignClass as tableAlignClass, tableBaseClass, selectedRowClass as tableSelectedRowClass, tableSizeClass, sortIconClass as tableSortIconClass, textareaBaseClass, textareaResizeClass, textareaSizeClass, textareaVariantClass, toastClassNames, tooltipArrowClass, tooltipContentClass, useConfirm, useDashboardLayout, useDirection };
3266
3485
  //# sourceMappingURL=index.js.map
3267
3486
  //# sourceMappingURL=index.js.map