najm-kit 0.0.30 → 0.0.32
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.ts +56 -41
- package/dist/index.mjs +265 -196
- package/dist/json.mjs +1 -1
- package/dist/theme.css +20 -11
- package/package.json +1 -1
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$1 from 'react';
|
|
3
|
-
import React__default, { RefObject, ComponentType, ReactNode,
|
|
3
|
+
import React__default, { RefObject, ComponentType, ReactNode, InputHTMLAttributes, Ref, CSSProperties, MouseEvent, MouseEventHandler } from 'react';
|
|
4
4
|
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
5
5
|
import { VariantProps } from 'class-variance-authority';
|
|
6
6
|
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
@@ -442,7 +442,14 @@ declare function DialogTrigger({ ...props }: React$1.ComponentProps<typeof Dialo
|
|
|
442
442
|
declare function DialogPortal({ ...props }: React$1.ComponentProps<typeof DialogPrimitive.Portal>): react_jsx_runtime.JSX.Element;
|
|
443
443
|
declare function DialogClose({ ...props }: React$1.ComponentProps<typeof DialogPrimitive.Close>): react_jsx_runtime.JSX.Element;
|
|
444
444
|
declare function DialogOverlay({ className, ...props }: React$1.ComponentProps<typeof DialogPrimitive.Overlay>): react_jsx_runtime.JSX.Element;
|
|
445
|
-
|
|
445
|
+
type DialogPadding = "none" | "sm" | "md" | "lg";
|
|
446
|
+
interface DialogContentProps extends React$1.ComponentProps<typeof DialogPrimitive.Content> {
|
|
447
|
+
/** Controls the padding of the dialog surface. `none` also collapses the header/body/footer gap. Defaults to `md` (p-6). */
|
|
448
|
+
padding?: DialogPadding;
|
|
449
|
+
/** Hides the built-in top-right close (X). Use when the content provides its own close control (e.g. inside a page header). */
|
|
450
|
+
hideClose?: boolean;
|
|
451
|
+
}
|
|
452
|
+
declare function DialogContent({ className, children, padding, hideClose, ...props }: DialogContentProps): react_jsx_runtime.JSX.Element;
|
|
446
453
|
declare function DialogHeader({ className, ...props }: React$1.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
447
454
|
declare function DialogFooter({ className, ...props }: React$1.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
448
455
|
declare function DialogTitle({ className, ...props }: React$1.ComponentProps<typeof DialogPrimitive.Title>): react_jsx_runtime.JSX.Element;
|
|
@@ -460,6 +467,44 @@ type DialogWidth = 'sm' | 'md' | 'lg' | 'xl' | 'xxl' | '3xl' | '4xl' | '5xl' | '
|
|
|
460
467
|
type DialogHeight = 'auto' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl' | 'full';
|
|
461
468
|
type RenderSlot<T = any> = T | ((ctx: T) => ReactNode);
|
|
462
469
|
|
|
470
|
+
interface PageHeaderSlotProps {
|
|
471
|
+
children: ReactNode;
|
|
472
|
+
className?: string;
|
|
473
|
+
}
|
|
474
|
+
interface NPageHeaderProps {
|
|
475
|
+
icon: ComponentType<{
|
|
476
|
+
className?: string;
|
|
477
|
+
}>;
|
|
478
|
+
title: string;
|
|
479
|
+
subtitle?: string;
|
|
480
|
+
actions?: ReactNode;
|
|
481
|
+
filters?: ReactNode;
|
|
482
|
+
top?: ReactNode;
|
|
483
|
+
search?: InputHTMLAttributes<HTMLInputElement> & {
|
|
484
|
+
placeholder?: string;
|
|
485
|
+
ref?: Ref<HTMLInputElement>;
|
|
486
|
+
};
|
|
487
|
+
children?: ReactNode;
|
|
488
|
+
className?: string;
|
|
489
|
+
headerClassName?: string;
|
|
490
|
+
/** Renders the header as a card-like surface. `bordered` is kept as an alias. */
|
|
491
|
+
card?: boolean;
|
|
492
|
+
bordered?: boolean;
|
|
493
|
+
}
|
|
494
|
+
declare function NPageHeaderActions({ children, className }: PageHeaderSlotProps): react_jsx_runtime.JSX.Element;
|
|
495
|
+
declare namespace NPageHeaderActions {
|
|
496
|
+
var displayName: string;
|
|
497
|
+
}
|
|
498
|
+
declare function NPageHeaderFilters({ children, className }: PageHeaderSlotProps): react_jsx_runtime.JSX.Element;
|
|
499
|
+
declare namespace NPageHeaderFilters {
|
|
500
|
+
var displayName: string;
|
|
501
|
+
}
|
|
502
|
+
declare function NPageHeaderTop({ children, className }: PageHeaderSlotProps): react_jsx_runtime.JSX.Element;
|
|
503
|
+
declare namespace NPageHeaderTop {
|
|
504
|
+
var displayName: string;
|
|
505
|
+
}
|
|
506
|
+
declare function NPageHeader({ icon: Icon, title, subtitle, actions, filters, top, search, children, className, headerClassName, card, bordered }: NPageHeaderProps): react_jsx_runtime.JSX.Element;
|
|
507
|
+
|
|
463
508
|
type DialogActionMode = "auto" | "dialog" | "content";
|
|
464
509
|
interface ButtonConfig {
|
|
465
510
|
text: string;
|
|
@@ -486,6 +531,10 @@ interface DialogConfig {
|
|
|
486
531
|
id: string;
|
|
487
532
|
title?: string;
|
|
488
533
|
description?: string;
|
|
534
|
+
/** Renders an NPageHeader as the dialog's header (icon, title, subtitle, actions). Replaces the plain title/description header; `title` is still used as the accessible label. */
|
|
535
|
+
pageHeader?: NPageHeaderProps;
|
|
536
|
+
/** Padding preset for the dialog surface. `none` is ideal for full-bleed content (custom headers, tables). Defaults to `md`. */
|
|
537
|
+
padding?: DialogPadding;
|
|
489
538
|
children?: ReactNode;
|
|
490
539
|
primaryButton?: ButtonConfig;
|
|
491
540
|
secondaryButton?: ButtonConfig;
|
|
@@ -505,6 +554,10 @@ interface PromiseDialogConfig extends DialogConfig {
|
|
|
505
554
|
interface PushDialogOptions {
|
|
506
555
|
title?: string;
|
|
507
556
|
description?: string;
|
|
557
|
+
/** Renders an NPageHeader as the dialog's header (icon, title, subtitle, actions). Replaces the plain title/description header; `title` is still used as the accessible label. */
|
|
558
|
+
pageHeader?: NPageHeaderProps;
|
|
559
|
+
/** Padding preset for the dialog surface. `none` is ideal for full-bleed content (custom headers, tables). Defaults to `md`. */
|
|
560
|
+
padding?: DialogPadding;
|
|
508
561
|
children?: ReactNode;
|
|
509
562
|
primaryButton?: Partial<ButtonConfig>;
|
|
510
563
|
secondaryButton?: Partial<ButtonConfig>;
|
|
@@ -3302,44 +3355,6 @@ interface NPageLayoutProps extends React$1.HTMLAttributes<HTMLElement> {
|
|
|
3302
3355
|
}
|
|
3303
3356
|
declare function NPageLayout({ as: Comp, className, style, ...props }: NPageLayoutProps): react_jsx_runtime.JSX.Element;
|
|
3304
3357
|
|
|
3305
|
-
interface PageHeaderSlotProps {
|
|
3306
|
-
children: ReactNode;
|
|
3307
|
-
className?: string;
|
|
3308
|
-
}
|
|
3309
|
-
interface NPageHeaderProps {
|
|
3310
|
-
icon: ComponentType<{
|
|
3311
|
-
className?: string;
|
|
3312
|
-
}>;
|
|
3313
|
-
title: string;
|
|
3314
|
-
subtitle?: string;
|
|
3315
|
-
actions?: ReactNode;
|
|
3316
|
-
filters?: ReactNode;
|
|
3317
|
-
top?: ReactNode;
|
|
3318
|
-
search?: InputHTMLAttributes<HTMLInputElement> & {
|
|
3319
|
-
placeholder?: string;
|
|
3320
|
-
ref?: Ref<HTMLInputElement>;
|
|
3321
|
-
};
|
|
3322
|
-
children?: ReactNode;
|
|
3323
|
-
className?: string;
|
|
3324
|
-
headerClassName?: string;
|
|
3325
|
-
/** Renders the header as a card-like surface. `bordered` is kept as an alias. */
|
|
3326
|
-
card?: boolean;
|
|
3327
|
-
bordered?: boolean;
|
|
3328
|
-
}
|
|
3329
|
-
declare function NPageHeaderActions({ children, className }: PageHeaderSlotProps): react_jsx_runtime.JSX.Element;
|
|
3330
|
-
declare namespace NPageHeaderActions {
|
|
3331
|
-
var displayName: string;
|
|
3332
|
-
}
|
|
3333
|
-
declare function NPageHeaderFilters({ children, className }: PageHeaderSlotProps): react_jsx_runtime.JSX.Element;
|
|
3334
|
-
declare namespace NPageHeaderFilters {
|
|
3335
|
-
var displayName: string;
|
|
3336
|
-
}
|
|
3337
|
-
declare function NPageHeaderTop({ children, className }: PageHeaderSlotProps): react_jsx_runtime.JSX.Element;
|
|
3338
|
-
declare namespace NPageHeaderTop {
|
|
3339
|
-
var displayName: string;
|
|
3340
|
-
}
|
|
3341
|
-
declare function NPageHeader({ icon: Icon, title, subtitle, actions, filters, top, search, children, className, headerClassName, card, bordered }: NPageHeaderProps): react_jsx_runtime.JSX.Element;
|
|
3342
|
-
|
|
3343
3358
|
interface InspectorSheetProps {
|
|
3344
3359
|
open: boolean;
|
|
3345
3360
|
onClose: () => void;
|
|
@@ -3348,4 +3363,4 @@ interface InspectorSheetProps {
|
|
|
3348
3363
|
}
|
|
3349
3364
|
declare function NInspectorSheet({ open, onClose, title, children }: InspectorSheetProps): react_jsx_runtime.JSX.Element;
|
|
3350
3365
|
|
|
3351
|
-
export { Alert, type AlertLook, type AlertOrientation, type AlertProps, type AlertSize, type AlertTone, type AlertVariant, NCard as AsyncCard, Avatar, AvatarFallback, AvatarGroup, type AvatarGroupProps, AvatarImage, type AvatarProps$1 as AvatarProps, type AvatarShape$1 as AvatarShape, type AvatarSize, AvatarStatus, type AvatarStatusType, Badge, type BadgeColor, type BadgeIcon, type BadgeLook, type BadgeProps, type BadgeShape, type BadgeSize, type BadgeVariant, BaseInput, type BuildDefaultFileColumnsOptions, Button, type ButtonConfig, type ButtonIcon, type ButtonLoaderPosition, type ButtonProps, type ButtonRounded, type ButtonSize, type ButtonVariant, Calendar, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, CheckboxGroupInput, type CheckboxGroupInputProps, CheckboxInput, type CheckboxInputProps, Collapsible, CollapsibleContent, CollapsibleTrigger, ColorArrayInput, type ColorArrayInputProps, type ColorFormat, ColorPickerInput, type ColorPickerInputProps, Combobox, ComboboxInput, type ComboboxInputProps, type ComboboxOption, type ComboboxProps, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, type ContextMenuItem, DateInput, type DateInputProps, type DeleteDialogOptions, Dialog, type DialogActionMode, type DialogApi, DialogClose, type DialogConfig, DialogContent, DialogDescription, DialogFooter, DialogHeader, type DialogHeight, DialogOverlay, DialogPortal, type DialogRenderContext, type DialogRenderer, type DialogSize, type DialogStore, DialogTitle, DialogTrigger, type DialogWidth, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, DynamicArray, type DynamicArrayProps, EmojiInput, type EmojiInputProps, type FileBrowserMode, FileImportButton, FileInput, type FileInputProps, type FileNode, Form, FormControl, FormDescription, FormField, FormInput, type FormInputProps, FormItem, FormLabel, FormMessage, type FormProps, type FormSlotClassNames, type FormVariant, IconButton, type IconButtonProps, type IconButtonSize, type IconButtonVariant, ImageInput, type ImageInputProps, Indicator, type IndicatorHorizontal, type IndicatorOverlay, type IndicatorPosition, type IndicatorProps, type IndicatorResponsivePosition, type IndicatorSize, type IndicatorVertical, Input, type InputIcon, Label, LangInput, type LangInputProps, type LinkComponentType, MultiSelectInput, type MultiSelectInputProps, NAJM_COMPONENT_NAMES, NAlert, type NAppCommandItem, NAppShell, type NAppShellAction, type NAppShellClassNames, type NAppShellProps, type NAppShellUser, NCard as NAsyncCard, type CardClassNames as NAsyncCardClassNames, type CardProps as NAsyncCardProps, NAvatar, type NAvatarClassNames, type NAvatarProps, type AvatarShape as NAvatarShape, NBadge, type NBadgeLook, type NBadgeProps, type NBulkAction, type NBulkActionButton, type NBulkActionSelect, NBulkActionsBar, type NBulkActionsBarProps, NButton, type NButtonProps, NCard, NCardAction, type CardClassNames as NCardClassNames, NCardFooter, type CardProps as NCardProps, NCommandPalette, type NCommandPaletteProps, NConfirmDialog, type NConfirmDialogProps, NContextMenu, type NContextMenuItem, type NContextMenuProps, NDataCardShell, type NDataCardShellActions, type NDataCardShellProps, NDeleteDialog, NDeleteDialogContent, type NDeleteDialogContentProps, type NDeleteDialogProps, NDetailCard, type NDetailCardClassNames, type NDetailCardProps, NDetailItem, type NDetailItemProps, NDetailList, type NDetailListItem, type NDetailListProps, NDialog, type NDialogDirectProps, type NDialogProps, NEmptyState, type NEmptyStateProps, NErrorBoundary, NErrorState, type NErrorStateProps, NFileBrowser, type NFileBrowserCardProps, type NFileBrowserProps, type NFileBrowserRenderThumbProps, NFileTypeIcon, type NFileTypeIconProps, NFilterBar, NFolderIcon, type NFolderIconProps, NForm, NFormSectionHeader, type NFormSectionHeaderProps, NIcon, type NIconProps, type NIconSource, NIndicator, NInspectorSheet, NLoadingState, type NLoadingStateProps, NMultiDialog, type NMultiDialogProps, NNavbar, NPageHeader, NPageHeaderActions, NPageHeaderFilters, type NPageHeaderProps, NPageHeaderTop, NPageLayout, type NPageLayoutProps, NPortalScopeProvider, NProgress, type NProgressProps, NRowActions, NSection, NSectionHeader, type NSectionHeaderActionsProps, type NSectionHeaderContentProps, type NSectionHeaderProps, type NSectionHeaderSubtitleProps, type NSectionHeaderTitleProps, NSectionInfo, type NSectionInfoProps, type NSectionProps, NSectionWithInfo, type NSectionWithInfoItem, type NSectionWithInfoProps, NSheet, type NSheetProps, NSidebar, NSidebarContent, type NSidebarContentProps, NSidebarFooter, type NSidebarFooterProps, NSidebarHeader, type NSidebarHeaderProps, NSidebarItem, NSidebarLogo, type NSidebarLogoProps, NSidebarMobile, type NSidebarMobileProps, NSidebarSection, type NSidebarSectionProps, NSkeleton, NSkeletonCalendar, NSkeletonChart, NSkeletonDonut, NSkeletonEventList, NSkeletonWidget, NSkeletonWidgets, NSlider, type NSliderProps, NSmartPasteDialog, type NSmartPasteDialogProps, NSpinner, type NSpinnerProps, NStatCard, type NStatCardClassNames, type NStatCardProps, NStatCardSkeleton, type NStatCardVariant, Swap as NSwap, type NSwapProps, NTable, NTableCardRoot, type NTableCardRootProps, NTableCards, type NTableClassNames, NTableContent, NTableHeader, NTableLoadingSkeleton, type NTableMenu, type NTableMenuProp, NTablePagination, type NTableProps, NTableRowSkeleton, NTableSkeleton, type NTableState, NTabs, type NTabsClassNames, type NTabsColor, type NTabsItem, type NTabsProps, type NTabsStyles, NUploader, type NUploaderItem, type NUploaderItemStatus, type NUploaderProps, NViewBody, NViewToggle, type NajmAccent, type NajmAppearance, type NajmBorderSide, type NajmComponentName, type NajmComponentRadius, type NajmComponentStyleConfig, type NajmComponentThemeConfig, type NajmDensity, type NajmDesignConfig, NajmDesignProvider, type NajmDesignProviderProps, type NajmLayoutConfig, type NajmMode, type NajmPreset, type NajmRadiusScale, NajmScroll, type NajmScrollProps, type NajmSlotStyle, type NajmThemeConfig, NajmThemeProvider, type NajmThemeProviderProps, type NajmThemeTokens, type NajmTypographyConfig, type NajmVariantStyle, NativeSelect, type NativeSelectOption, type NativeSelectProps, type NavItem, type NavItemGroup, NumberInput, type NumberInputProps, PasswordInput, type PasswordInputProps, PhoneInput, type PhoneInputProps, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, PrefixProvider, Progress, type ProgressColor, type ProgressLabelPosition, type ProgressProps, type ProgressSize, type PushDialogOptions, RADIUS_VALUE_MAP, RadioGroup, RadioGroupInput, type RadioGroupInputProps, RadioGroupItem, type RenderSlot, RepeatingFields, type RepeatingFieldsProps, ScrollArea, type ScrollAreaProps, SearchField, SearchField as SearchInput, SegmentedControl, type SegmentedControlOption, type SegmentedControlProps, Select, SelectContent, SelectGroup, SelectInput, type SelectInputProps, SelectItem, type SelectItemType$1 as SelectItemDataType, type SelectItemType, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, type SidebarItemProps, type SidebarProps, type SidebarWidths, SimpleTooltip, type SimpleTooltipProps, NSkeleton as Skeleton, Slider, SliderInput, type SliderInputProps, type SliderOrientation, type SliderProps, type SliderSize, type SliderVariant, type SmartPastePreview, type SpinnerVariant, StarRatingInput, type StarRatingInputProps, StatusPill, type StatusPillProps, type StatusPillTone, type StepConfig, StepIndicator, type StepMeta, StepsHeader, StepsProgress, type StorageMenuAction, type StorageSortOption, type StorageTarget, Swap, type SwapEffect, SwapIndeterminate, SwapOff, SwapOn, type SwapProps, type SwapSize, type SwapState, Switch, type SwitchColor, SwitchInput, type SwitchInputProps, type SwitchSize, TAB_COLORS, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, type TableHeaderColor, TableRow, type TableState, type TableStore, TableStoreContext, Tabs, TabsContent, TabsList, type TabsListProps, type TabsOrientation, type TabsProps, TabsTrigger, type TabsTriggerProps, type TabsVariant, TextAreaInput, type TextAreaInputProps, TextInput, type TextInputProps, Textarea, TimeInput, type TimeInputProps, Toaster, Toggle, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, type UseContextMenuResult, type UseNFormOptions, type UseStorageContextMenuOptions, type UseStorageContextMenuResult, type UserMenuAction, VariantProvider, type WizardClassNames, WizardForm, type WizardFormProps, alertVariants, avatarVariants, badgeColorVariants, badgeVariants, buildDefaultFileColumns, buttonVariants, cn, composePreset, createDialogStore, createTableStore, defineNajmDesignConfig, defineNajmThemeConfig, detectFormat, dialogVariants, formatColor, formatFileBytes, formatFileRelative, getIconColorProps, indicatorVariants, inputBorderClasses, parseColor, parseNajmDesignConfig, parseNajmThemeConfig, resolvePreset, resolveRadiusValue, resolveSlot, resolveVariantAlias, sidebarBorderClasses, sliderVariants, stringifyNajmDesignConfig, stringifyNajmThemeConfig, surfaceBorderClasses, swapVariants, toPickerHex, toggleVariants, tooltipContentVariants, truncateByCharacters, useClickOutside, useContextMenu, useDebouncedValue, useDelayedLoading, useDialog, useDialogStore, useDynamicPageSize, useFormField, useFormSubmission, useInfiniteScroll, useKeyboard, useLocalStorageState, useNForm, useNPortalScope, useNajmAppearance, useNajmComponentStyle, useNajmDesign, usePrefix, useSelection, useStepNavigation, useStorageContextMenu, useStoreSync, useTable, useTableKeyboard, useTableStore, useVariant, useVariantPreset };
|
|
3366
|
+
export { Alert, type AlertLook, type AlertOrientation, type AlertProps, type AlertSize, type AlertTone, type AlertVariant, NCard as AsyncCard, Avatar, AvatarFallback, AvatarGroup, type AvatarGroupProps, AvatarImage, type AvatarProps$1 as AvatarProps, type AvatarShape$1 as AvatarShape, type AvatarSize, AvatarStatus, type AvatarStatusType, Badge, type BadgeColor, type BadgeIcon, type BadgeLook, type BadgeProps, type BadgeShape, type BadgeSize, type BadgeVariant, BaseInput, type BuildDefaultFileColumnsOptions, Button, type ButtonConfig, type ButtonIcon, type ButtonLoaderPosition, type ButtonProps, type ButtonRounded, type ButtonSize, type ButtonVariant, Calendar, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, CheckboxGroupInput, type CheckboxGroupInputProps, CheckboxInput, type CheckboxInputProps, Collapsible, CollapsibleContent, CollapsibleTrigger, ColorArrayInput, type ColorArrayInputProps, type ColorFormat, ColorPickerInput, type ColorPickerInputProps, Combobox, ComboboxInput, type ComboboxInputProps, type ComboboxOption, type ComboboxProps, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, type ContextMenuItem, DateInput, type DateInputProps, type DeleteDialogOptions, Dialog, type DialogActionMode, type DialogApi, DialogClose, type DialogConfig, DialogContent, type DialogContentProps, DialogDescription, DialogFooter, DialogHeader, type DialogHeight, DialogOverlay, type DialogPadding, DialogPortal, type DialogRenderContext, type DialogRenderer, type DialogSize, type DialogStore, DialogTitle, DialogTrigger, type DialogWidth, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, DynamicArray, type DynamicArrayProps, EmojiInput, type EmojiInputProps, type FileBrowserMode, FileImportButton, FileInput, type FileInputProps, type FileNode, Form, FormControl, FormDescription, FormField, FormInput, type FormInputProps, FormItem, FormLabel, FormMessage, type FormProps, type FormSlotClassNames, type FormVariant, IconButton, type IconButtonProps, type IconButtonSize, type IconButtonVariant, ImageInput, type ImageInputProps, Indicator, type IndicatorHorizontal, type IndicatorOverlay, type IndicatorPosition, type IndicatorProps, type IndicatorResponsivePosition, type IndicatorSize, type IndicatorVertical, Input, type InputIcon, Label, LangInput, type LangInputProps, type LinkComponentType, MultiSelectInput, type MultiSelectInputProps, NAJM_COMPONENT_NAMES, NAlert, type NAppCommandItem, NAppShell, type NAppShellAction, type NAppShellClassNames, type NAppShellProps, type NAppShellUser, NCard as NAsyncCard, type CardClassNames as NAsyncCardClassNames, type CardProps as NAsyncCardProps, NAvatar, type NAvatarClassNames, type NAvatarProps, type AvatarShape as NAvatarShape, NBadge, type NBadgeLook, type NBadgeProps, type NBulkAction, type NBulkActionButton, type NBulkActionSelect, NBulkActionsBar, type NBulkActionsBarProps, NButton, type NButtonProps, NCard, NCardAction, type CardClassNames as NCardClassNames, NCardFooter, type CardProps as NCardProps, NCommandPalette, type NCommandPaletteProps, NConfirmDialog, type NConfirmDialogProps, NContextMenu, type NContextMenuItem, type NContextMenuProps, NDataCardShell, type NDataCardShellActions, type NDataCardShellProps, NDeleteDialog, NDeleteDialogContent, type NDeleteDialogContentProps, type NDeleteDialogProps, NDetailCard, type NDetailCardClassNames, type NDetailCardProps, NDetailItem, type NDetailItemProps, NDetailList, type NDetailListItem, type NDetailListProps, NDialog, type NDialogDirectProps, type NDialogProps, NEmptyState, type NEmptyStateProps, NErrorBoundary, NErrorState, type NErrorStateProps, NFileBrowser, type NFileBrowserCardProps, type NFileBrowserProps, type NFileBrowserRenderThumbProps, NFileTypeIcon, type NFileTypeIconProps, NFilterBar, NFolderIcon, type NFolderIconProps, NForm, NFormSectionHeader, type NFormSectionHeaderProps, NIcon, type NIconProps, type NIconSource, NIndicator, NInspectorSheet, NLoadingState, type NLoadingStateProps, NMultiDialog, type NMultiDialogProps, NNavbar, NPageHeader, NPageHeaderActions, NPageHeaderFilters, type NPageHeaderProps, NPageHeaderTop, NPageLayout, type NPageLayoutProps, NPortalScopeProvider, NProgress, type NProgressProps, NRowActions, NSection, NSectionHeader, type NSectionHeaderActionsProps, type NSectionHeaderContentProps, type NSectionHeaderProps, type NSectionHeaderSubtitleProps, type NSectionHeaderTitleProps, NSectionInfo, type NSectionInfoProps, type NSectionProps, NSectionWithInfo, type NSectionWithInfoItem, type NSectionWithInfoProps, NSheet, type NSheetProps, NSidebar, NSidebarContent, type NSidebarContentProps, NSidebarFooter, type NSidebarFooterProps, NSidebarHeader, type NSidebarHeaderProps, NSidebarItem, NSidebarLogo, type NSidebarLogoProps, NSidebarMobile, type NSidebarMobileProps, NSidebarSection, type NSidebarSectionProps, NSkeleton, NSkeletonCalendar, NSkeletonChart, NSkeletonDonut, NSkeletonEventList, NSkeletonWidget, NSkeletonWidgets, NSlider, type NSliderProps, NSmartPasteDialog, type NSmartPasteDialogProps, NSpinner, type NSpinnerProps, NStatCard, type NStatCardClassNames, type NStatCardProps, NStatCardSkeleton, type NStatCardVariant, Swap as NSwap, type NSwapProps, NTable, NTableCardRoot, type NTableCardRootProps, NTableCards, type NTableClassNames, NTableContent, NTableHeader, NTableLoadingSkeleton, type NTableMenu, type NTableMenuProp, NTablePagination, type NTableProps, NTableRowSkeleton, NTableSkeleton, type NTableState, NTabs, type NTabsClassNames, type NTabsColor, type NTabsItem, type NTabsProps, type NTabsStyles, NUploader, type NUploaderItem, type NUploaderItemStatus, type NUploaderProps, NViewBody, NViewToggle, type NajmAccent, type NajmAppearance, type NajmBorderSide, type NajmComponentName, type NajmComponentRadius, type NajmComponentStyleConfig, type NajmComponentThemeConfig, type NajmDensity, type NajmDesignConfig, NajmDesignProvider, type NajmDesignProviderProps, type NajmLayoutConfig, type NajmMode, type NajmPreset, type NajmRadiusScale, NajmScroll, type NajmScrollProps, type NajmSlotStyle, type NajmThemeConfig, NajmThemeProvider, type NajmThemeProviderProps, type NajmThemeTokens, type NajmTypographyConfig, type NajmVariantStyle, NativeSelect, type NativeSelectOption, type NativeSelectProps, type NavItem, type NavItemGroup, NumberInput, type NumberInputProps, PasswordInput, type PasswordInputProps, PhoneInput, type PhoneInputProps, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, PrefixProvider, Progress, type ProgressColor, type ProgressLabelPosition, type ProgressProps, type ProgressSize, type PushDialogOptions, RADIUS_VALUE_MAP, RadioGroup, RadioGroupInput, type RadioGroupInputProps, RadioGroupItem, type RenderSlot, RepeatingFields, type RepeatingFieldsProps, ScrollArea, type ScrollAreaProps, SearchField, SearchField as SearchInput, SegmentedControl, type SegmentedControlOption, type SegmentedControlProps, Select, SelectContent, SelectGroup, SelectInput, type SelectInputProps, SelectItem, type SelectItemType$1 as SelectItemDataType, type SelectItemType, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, type SidebarItemProps, type SidebarProps, type SidebarWidths, SimpleTooltip, type SimpleTooltipProps, NSkeleton as Skeleton, Slider, SliderInput, type SliderInputProps, type SliderOrientation, type SliderProps, type SliderSize, type SliderVariant, type SmartPastePreview, type SpinnerVariant, StarRatingInput, type StarRatingInputProps, StatusPill, type StatusPillProps, type StatusPillTone, type StepConfig, StepIndicator, type StepMeta, StepsHeader, StepsProgress, type StorageMenuAction, type StorageSortOption, type StorageTarget, Swap, type SwapEffect, SwapIndeterminate, SwapOff, SwapOn, type SwapProps, type SwapSize, type SwapState, Switch, type SwitchColor, SwitchInput, type SwitchInputProps, type SwitchSize, TAB_COLORS, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, type TableHeaderColor, TableRow, type TableState, type TableStore, TableStoreContext, Tabs, TabsContent, TabsList, type TabsListProps, type TabsOrientation, type TabsProps, TabsTrigger, type TabsTriggerProps, type TabsVariant, TextAreaInput, type TextAreaInputProps, TextInput, type TextInputProps, Textarea, TimeInput, type TimeInputProps, Toaster, Toggle, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, type UseContextMenuResult, type UseNFormOptions, type UseStorageContextMenuOptions, type UseStorageContextMenuResult, type UserMenuAction, VariantProvider, type WizardClassNames, WizardForm, type WizardFormProps, alertVariants, avatarVariants, badgeColorVariants, badgeVariants, buildDefaultFileColumns, buttonVariants, cn, composePreset, createDialogStore, createTableStore, defineNajmDesignConfig, defineNajmThemeConfig, detectFormat, dialogVariants, formatColor, formatFileBytes, formatFileRelative, getIconColorProps, indicatorVariants, inputBorderClasses, parseColor, parseNajmDesignConfig, parseNajmThemeConfig, resolvePreset, resolveRadiusValue, resolveSlot, resolveVariantAlias, sidebarBorderClasses, sliderVariants, stringifyNajmDesignConfig, stringifyNajmThemeConfig, surfaceBorderClasses, swapVariants, toPickerHex, toggleVariants, tooltipContentVariants, truncateByCharacters, useClickOutside, useContextMenu, useDebouncedValue, useDelayedLoading, useDialog, useDialogStore, useDynamicPageSize, useFormField, useFormSubmission, useInfiniteScroll, useKeyboard, useLocalStorageState, useNForm, useNPortalScope, useNajmAppearance, useNajmComponentStyle, useNajmDesign, usePrefix, useSelection, useStepNavigation, useStorageContextMenu, useStoreSync, useTable, useTableKeyboard, useTableStore, useVariant, useVariantPreset };
|
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import React__default, { createContext, useContext, useCallback, useEffect, useS
|
|
|
3
3
|
import { Slot } from '@radix-ui/react-slot';
|
|
4
4
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
5
5
|
import * as LucideIcons from 'lucide-react';
|
|
6
|
-
import { ChevronDown, AlertTriangle, RefreshCw, LoaderCircleIcon, X, XIcon, ChevronRightIcon, CheckIcon, CircleIcon, ChevronDownIcon, ChevronUpIcon, ChevronLeftIcon, SearchIcon, Table as Table$1, FileJson, ChevronRight, CheckSquare, FilePlus, FolderPlus, Trash2, Share2, Move, ClipboardPaste, Copy, Scissors, Pencil, Download, Eye, ArrowUpDown, Loader2, ChevronUp, Folder, EyeOff, ChevronsUpDown, Check, Calendar as Calendar$1, FileUp, UploadCloud, CheckCircle2, AlertCircle, Star, Globe, Clock,
|
|
6
|
+
import { ChevronDown, AlertTriangle, RefreshCw, LoaderCircleIcon, X, XIcon, Search, ChevronRightIcon, CheckIcon, CircleIcon, ChevronDownIcon, ChevronUpIcon, ChevronLeftIcon, SearchIcon, Table as Table$1, FileJson, ChevronRight, CheckSquare, FilePlus, FolderPlus, Trash2, Share2, Move, ClipboardPaste, Copy, Scissors, Pencil, Download, Eye, ArrowUpDown, Loader2, ChevronUp, Folder, EyeOff, ChevronsUpDown, Check, Calendar as Calendar$1, FileUp, UploadCloud, CheckCircle2, AlertCircle, Star, Globe, Clock, Upload, Plus, MoreVertical, Edit, ChevronsLeft, ChevronLeft, ChevronsRight, Merge, PanelLeftOpen, PanelLeftClose, Menu, LogOut, Image, ArrowUp, ArrowDown, LoaderPinwheelIcon, LoaderIcon, ArrowUpRight, ArrowDownRight, SlidersHorizontal, Columns3, Settings, SearchX, Inbox, List, LayoutGrid, Code, FolderOpen } from 'lucide-react';
|
|
7
7
|
import { cva } from 'class-variance-authority';
|
|
8
8
|
import { clsx } from 'clsx';
|
|
9
9
|
import { twMerge } from 'tailwind-merge';
|
|
@@ -319,6 +319,12 @@ function NajmThemeProvider({
|
|
|
319
319
|
);
|
|
320
320
|
const Comp = asChild ? Slot : "div";
|
|
321
321
|
const [container, setContainer] = React.useState(null);
|
|
322
|
+
const containerRef = React.useRef(null);
|
|
323
|
+
const handleContainerRef = React.useCallback((node) => {
|
|
324
|
+
if (containerRef.current === node) return;
|
|
325
|
+
containerRef.current = node;
|
|
326
|
+
setContainer(node);
|
|
327
|
+
}, []);
|
|
322
328
|
const resolvedAppearance = React.useMemo(
|
|
323
329
|
() => ({ ...parentAppearance, ...config?.appearance ?? {}, ...appearance ?? {} }),
|
|
324
330
|
[parentAppearance, config?.appearance, appearance]
|
|
@@ -326,7 +332,8 @@ function NajmThemeProvider({
|
|
|
326
332
|
return /* @__PURE__ */ jsx(NajmThemeDepthContext.Provider, { value: depth + 1, children: /* @__PURE__ */ jsx(NajmAppearanceContext.Provider, { value: resolvedAppearance, children: /* @__PURE__ */ jsx(NajmThemeContainerCtx.Provider, { value: container, children: /* @__PURE__ */ jsx(
|
|
327
333
|
Comp,
|
|
328
334
|
{
|
|
329
|
-
ref:
|
|
335
|
+
ref: handleContainerRef,
|
|
336
|
+
suppressHydrationWarning: true,
|
|
330
337
|
"data-najm-theme": effectivePreset ?? `${effectiveMode ?? "light"}-${effectiveAccent ?? "neutral"}`,
|
|
331
338
|
className,
|
|
332
339
|
style,
|
|
@@ -1090,7 +1097,7 @@ var buttonVariants = cva(
|
|
|
1090
1097
|
variant: {
|
|
1091
1098
|
default: "bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",
|
|
1092
1099
|
destructive: "bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40",
|
|
1093
|
-
outline: "border border-input bg-
|
|
1100
|
+
outline: "border border-input bg-transparent text-foreground shadow-xs hover:bg-accent hover:text-accent-foreground",
|
|
1094
1101
|
secondary: "bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
|
|
1095
1102
|
tertiary: "bg-tertiary text-tertiary-foreground shadow-xs hover:bg-tertiary/80",
|
|
1096
1103
|
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
@@ -1622,7 +1629,7 @@ function Input({ className, type, ...props }) {
|
|
|
1622
1629
|
type,
|
|
1623
1630
|
"data-slot": "input",
|
|
1624
1631
|
className: cn(
|
|
1625
|
-
"file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground border-input flex h-9 w-full min-w-0 rounded-md border bg-card px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
1632
|
+
"file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground border-input flex h-9 w-full min-w-0 rounded-md border bg-card px-3 py-1 text-base text-foreground shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
1626
1633
|
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
1627
1634
|
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
1628
1635
|
className
|
|
@@ -1637,7 +1644,7 @@ function Textarea({ className, ...props }) {
|
|
|
1637
1644
|
{
|
|
1638
1645
|
"data-slot": "textarea",
|
|
1639
1646
|
className: cn(
|
|
1640
|
-
"border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
1647
|
+
"border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base text-foreground shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
1641
1648
|
className
|
|
1642
1649
|
),
|
|
1643
1650
|
...props
|
|
@@ -1649,7 +1656,7 @@ function Label({ className, ...props }) {
|
|
|
1649
1656
|
LabelPrimitive.Root,
|
|
1650
1657
|
{
|
|
1651
1658
|
"data-slot": "label",
|
|
1652
|
-
className: cn("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50", className),
|
|
1659
|
+
className: cn("flex items-center gap-2 text-sm leading-none font-medium text-foreground select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50", className),
|
|
1653
1660
|
...props
|
|
1654
1661
|
}
|
|
1655
1662
|
);
|
|
@@ -1874,7 +1881,13 @@ function DialogOverlay({ className, ...props }) {
|
|
|
1874
1881
|
}
|
|
1875
1882
|
);
|
|
1876
1883
|
}
|
|
1877
|
-
|
|
1884
|
+
var dialogPaddingMap = {
|
|
1885
|
+
none: "p-0 gap-0 overflow-hidden",
|
|
1886
|
+
sm: "p-3",
|
|
1887
|
+
md: "p-6",
|
|
1888
|
+
lg: "p-8"
|
|
1889
|
+
};
|
|
1890
|
+
function DialogContent({ className, children, padding = "md", hideClose = false, ...props }) {
|
|
1878
1891
|
const portalClassName = useNPortalScope();
|
|
1879
1892
|
return /* @__PURE__ */ jsx(DialogPortal, { "data-slot": "dialog-portal", children: /* @__PURE__ */ jsxs("div", { className: portalClassName, children: [
|
|
1880
1893
|
/* @__PURE__ */ jsx(DialogOverlay, {}),
|
|
@@ -1882,14 +1895,16 @@ function DialogContent({ className, children, ...props }) {
|
|
|
1882
1895
|
SheetPrimitive.Content,
|
|
1883
1896
|
{
|
|
1884
1897
|
"data-slot": "dialog-content",
|
|
1898
|
+
"data-padding": padding,
|
|
1885
1899
|
className: cn(
|
|
1886
|
-
"bg-card text-card-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-sm translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg najm-border border-border
|
|
1900
|
+
"bg-card text-card-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-sm translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg najm-border border-border shadow-lg duration-200",
|
|
1901
|
+
dialogPaddingMap[padding],
|
|
1887
1902
|
className
|
|
1888
1903
|
),
|
|
1889
1904
|
...props,
|
|
1890
1905
|
children: [
|
|
1891
1906
|
children,
|
|
1892
|
-
/* @__PURE__ */ jsxs(SheetPrimitive.Close, { className: "ring-offset-background cursor-pointer focus:ring-ring absolute top-4 right-4 rounded-xs text-muted-foreground hover:text-foreground transition-colors focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", children: [
|
|
1907
|
+
!hideClose && /* @__PURE__ */ jsxs(SheetPrimitive.Close, { className: "ring-offset-background cursor-pointer focus:ring-ring absolute top-4 right-4 rounded-xs text-muted-foreground hover:text-foreground transition-colors focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", children: [
|
|
1893
1908
|
/* @__PURE__ */ jsx(XIcon, {}),
|
|
1894
1909
|
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
|
|
1895
1910
|
] })
|
|
@@ -1910,6 +1925,135 @@ function DialogTitle({ className, ...props }) {
|
|
|
1910
1925
|
function DialogDescription({ className, ...props }) {
|
|
1911
1926
|
return /* @__PURE__ */ jsx(SheetPrimitive.Description, { "data-slot": "dialog-description", className: cn("text-muted-foreground text-sm", className), ...props });
|
|
1912
1927
|
}
|
|
1928
|
+
var variantClasses = {
|
|
1929
|
+
primary: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
1930
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
1931
|
+
ghost: "bg-transparent text-muted-foreground hover:bg-accent hover:text-accent-foreground",
|
|
1932
|
+
destructive: "bg-transparent text-destructive hover:bg-destructive/10"
|
|
1933
|
+
};
|
|
1934
|
+
var sizeClasses = {
|
|
1935
|
+
sm: "h-6 w-6",
|
|
1936
|
+
md: "h-8 w-8",
|
|
1937
|
+
lg: "h-10 w-10"
|
|
1938
|
+
};
|
|
1939
|
+
var IconButton = React.forwardRef(
|
|
1940
|
+
({
|
|
1941
|
+
className,
|
|
1942
|
+
variant = "ghost",
|
|
1943
|
+
size = "md",
|
|
1944
|
+
active = false,
|
|
1945
|
+
type = "button",
|
|
1946
|
+
children,
|
|
1947
|
+
...props
|
|
1948
|
+
}, ref) => {
|
|
1949
|
+
return /* @__PURE__ */ jsx(
|
|
1950
|
+
"button",
|
|
1951
|
+
{
|
|
1952
|
+
ref,
|
|
1953
|
+
type,
|
|
1954
|
+
"aria-pressed": active || void 0,
|
|
1955
|
+
className: cn(
|
|
1956
|
+
"inline-flex shrink-0 cursor-pointer items-center justify-center rounded-md transition-colors",
|
|
1957
|
+
"outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
|
|
1958
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
1959
|
+
variantClasses[variant],
|
|
1960
|
+
sizeClasses[size],
|
|
1961
|
+
active && "bg-accent text-accent-foreground",
|
|
1962
|
+
className
|
|
1963
|
+
),
|
|
1964
|
+
...props,
|
|
1965
|
+
children
|
|
1966
|
+
}
|
|
1967
|
+
);
|
|
1968
|
+
}
|
|
1969
|
+
);
|
|
1970
|
+
IconButton.displayName = "IconButton";
|
|
1971
|
+
function NPageHeaderActions({ children, className }) {
|
|
1972
|
+
return /* @__PURE__ */ jsx("div", { className: cn("flex shrink-0 items-center gap-2 sm:gap-3", className), children });
|
|
1973
|
+
}
|
|
1974
|
+
NPageHeaderActions.displayName = "NPageHeaderActions";
|
|
1975
|
+
function NPageHeaderFilters({ children, className }) {
|
|
1976
|
+
return /* @__PURE__ */ jsx("div", { className: cn("px-4 py-3 sm:px-5", className), children });
|
|
1977
|
+
}
|
|
1978
|
+
NPageHeaderFilters.displayName = "NPageHeaderFilters";
|
|
1979
|
+
function NPageHeaderTop({ children, className }) {
|
|
1980
|
+
return /* @__PURE__ */ jsx("div", { className, children });
|
|
1981
|
+
}
|
|
1982
|
+
NPageHeaderTop.displayName = "NPageHeaderTop";
|
|
1983
|
+
function isPageHeaderSlot(child, slot) {
|
|
1984
|
+
return React__default.isValidElement(child) && child.type === slot;
|
|
1985
|
+
}
|
|
1986
|
+
function getSlotElements(children, slot) {
|
|
1987
|
+
const matches = React__default.Children.toArray(children).filter((child) => isPageHeaderSlot(child, slot));
|
|
1988
|
+
return matches.length > 0 ? matches : void 0;
|
|
1989
|
+
}
|
|
1990
|
+
function NPageHeader({ icon: Icon2, title, subtitle, actions, filters, top, search, children, className, headerClassName, card, bordered }) {
|
|
1991
|
+
const [internalSearch, setInternalSearch] = useState("");
|
|
1992
|
+
const recipe = useNajmComponentStyle("pageHeader");
|
|
1993
|
+
const searchValue = search?.value ?? internalSearch;
|
|
1994
|
+
const handleSearchChange = useCallback((e) => {
|
|
1995
|
+
setInternalSearch(e.currentTarget.value);
|
|
1996
|
+
search?.onChange?.(e);
|
|
1997
|
+
}, [search?.onChange]);
|
|
1998
|
+
const slottedActions = getSlotElements(children, NPageHeaderActions);
|
|
1999
|
+
const slottedFilters = getSlotElements(children, NPageHeaderFilters);
|
|
2000
|
+
const slottedTop = getSlotElements(children, NPageHeaderTop);
|
|
2001
|
+
const resolvedActions = slottedActions ?? actions;
|
|
2002
|
+
const resolvedFilters = slottedFilters ?? filters;
|
|
2003
|
+
const resolvedTop = slottedTop ?? top;
|
|
2004
|
+
const isCard = card ?? recipe?.card ?? bordered === true;
|
|
2005
|
+
const recipeRadius = resolveRadiusValue(recipe?.radius);
|
|
2006
|
+
const recipeStyle = recipeRadius || recipe?.borderWidth ? {
|
|
2007
|
+
...recipeRadius ? { borderRadius: recipeRadius } : {},
|
|
2008
|
+
...recipe?.borderWidth ? { borderWidth: recipe.borderWidth } : {}
|
|
2009
|
+
} : void 0;
|
|
2010
|
+
return /* @__PURE__ */ jsxs(
|
|
2011
|
+
"div",
|
|
2012
|
+
{
|
|
2013
|
+
"data-slot": "page-header",
|
|
2014
|
+
"data-card": isCard ? "true" : void 0,
|
|
2015
|
+
"data-bordered": bordered === false ? "false" : bordered ? "true" : void 0,
|
|
2016
|
+
style: recipeStyle,
|
|
2017
|
+
className: cn(
|
|
2018
|
+
isCard ? cn("rounded-xl bg-card text-card-foreground shadow-none", surfaceBorderClasses(true)) : cn("border-b bg-background text-foreground", surfaceBorderClasses(true, "bottom").replace("najm-border-b", "najm-border-b")),
|
|
2019
|
+
className
|
|
2020
|
+
),
|
|
2021
|
+
children: [
|
|
2022
|
+
resolvedTop,
|
|
2023
|
+
/* @__PURE__ */ jsxs("div", { className: cn("flex min-h-14 flex-row items-center justify-between gap-2 px-4 pl-16 sm:px-5 md:pl-5", headerClassName), children: [
|
|
2024
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center gap-3", children: [
|
|
2025
|
+
/* @__PURE__ */ jsx("div", { className: "flex h-8 w-8 shrink-0 rounded-lg bg-primary/10 items-center justify-center", children: /* @__PURE__ */ jsx(Icon2, { className: "h-4 w-4 text-primary" }) }),
|
|
2026
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
|
|
2027
|
+
/* @__PURE__ */ jsx("h2", { className: "truncate text-sm font-semibold text-foreground", children: title }),
|
|
2028
|
+
subtitle && /* @__PURE__ */ jsx("p", { className: "truncate text-xs leading-relaxed text-muted-foreground sm:text-sm sm:leading-normal", children: subtitle })
|
|
2029
|
+
] })
|
|
2030
|
+
] }),
|
|
2031
|
+
/* @__PURE__ */ jsxs("div", { className: "flex shrink-0 items-center gap-3", children: [
|
|
2032
|
+
search && /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
2033
|
+
/* @__PURE__ */ jsx(Search, { size: 14, className: "absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none" }),
|
|
2034
|
+
/* @__PURE__ */ jsx(
|
|
2035
|
+
"input",
|
|
2036
|
+
{
|
|
2037
|
+
ref: search.ref,
|
|
2038
|
+
type: "text",
|
|
2039
|
+
value: searchValue,
|
|
2040
|
+
placeholder: search.placeholder ?? "Search...",
|
|
2041
|
+
className: cn(
|
|
2042
|
+
"h-9 w-full max-w-[280px] rounded-lg bg-background pl-9 pr-3 text-sm text-foreground placeholder:text-muted-foreground outline-none border border-border focus:border-primary focus:ring-1 focus:ring-primary/20 transition-colors",
|
|
2043
|
+
search.className
|
|
2044
|
+
),
|
|
2045
|
+
onChange: handleSearchChange
|
|
2046
|
+
}
|
|
2047
|
+
)
|
|
2048
|
+
] }),
|
|
2049
|
+
resolvedActions && (slottedActions ? resolvedActions : /* @__PURE__ */ jsx(NPageHeaderActions, { children: resolvedActions }))
|
|
2050
|
+
] })
|
|
2051
|
+
] }),
|
|
2052
|
+
resolvedFilters && (slottedFilters ? resolvedFilters : /* @__PURE__ */ jsx(NPageHeaderFilters, { children: resolvedFilters }))
|
|
2053
|
+
]
|
|
2054
|
+
}
|
|
2055
|
+
);
|
|
2056
|
+
}
|
|
1913
2057
|
var generateId = () => `dialog-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
|
|
1914
2058
|
var buildButtonConfig = (partial, defaults) => {
|
|
1915
2059
|
return { ...defaults, ...partial };
|
|
@@ -1938,6 +2082,8 @@ function createDialogStore() {
|
|
|
1938
2082
|
id,
|
|
1939
2083
|
title: config.title,
|
|
1940
2084
|
description: config.description,
|
|
2085
|
+
pageHeader: config.pageHeader,
|
|
2086
|
+
padding: config.padding,
|
|
1941
2087
|
children: config.children,
|
|
1942
2088
|
primaryButton: primaryButtonConfig,
|
|
1943
2089
|
secondaryButton: secondaryButtonConfig,
|
|
@@ -2144,13 +2290,20 @@ var CONTENT_ACTIONS_SELECTOR = '[data-najm-dialog-actions="content"], [data-najm
|
|
|
2144
2290
|
function useContentOwnsActions() {
|
|
2145
2291
|
const [contentElement, setContentElement] = React__default.useState(null);
|
|
2146
2292
|
const [contentOwnsActions, setContentOwnsActions] = React__default.useState(false);
|
|
2293
|
+
const contentElementRef = React__default.useRef(null);
|
|
2294
|
+
const handleContentElementRef = React__default.useCallback((node) => {
|
|
2295
|
+
if (contentElementRef.current === node) return;
|
|
2296
|
+
contentElementRef.current = node;
|
|
2297
|
+
setContentElement(node);
|
|
2298
|
+
}, []);
|
|
2147
2299
|
React__default.useLayoutEffect(() => {
|
|
2148
2300
|
if (!contentElement) {
|
|
2149
|
-
setContentOwnsActions(false);
|
|
2301
|
+
setContentOwnsActions((current) => current ? false : current);
|
|
2150
2302
|
return;
|
|
2151
2303
|
}
|
|
2152
2304
|
const update = () => {
|
|
2153
|
-
|
|
2305
|
+
const next = !!contentElement.querySelector(CONTENT_ACTIONS_SELECTOR);
|
|
2306
|
+
setContentOwnsActions((current) => current === next ? current : next);
|
|
2154
2307
|
};
|
|
2155
2308
|
update();
|
|
2156
2309
|
const observer = new MutationObserver(update);
|
|
@@ -2162,13 +2315,43 @@ function useContentOwnsActions() {
|
|
|
2162
2315
|
});
|
|
2163
2316
|
return () => observer.disconnect();
|
|
2164
2317
|
}, [contentElement]);
|
|
2165
|
-
return { contentOwnsActions, setContentElement };
|
|
2318
|
+
return { contentOwnsActions, setContentElement: handleContentElementRef };
|
|
2166
2319
|
}
|
|
2167
2320
|
function shouldRenderDialogButtons(showButtons, actionMode = "auto", contentOwnsActions) {
|
|
2168
2321
|
if (!showButtons || actionMode === "content") return false;
|
|
2169
2322
|
if (actionMode === "auto" && contentOwnsActions) return false;
|
|
2170
2323
|
return true;
|
|
2171
2324
|
}
|
|
2325
|
+
function DialogChrome({ pageHeader, title, description, padding, contentRef, children }) {
|
|
2326
|
+
const noTitle = !title || title.trim() === "";
|
|
2327
|
+
const noDescription = !description || description.trim() === "";
|
|
2328
|
+
const noHeader = noTitle && noDescription;
|
|
2329
|
+
const flush = padding === "none";
|
|
2330
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2331
|
+
pageHeader ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2332
|
+
/* @__PURE__ */ jsx(DialogTitle, { className: "sr-only", children: pageHeader.title || title || "Dialog" }),
|
|
2333
|
+
(pageHeader.subtitle || description) && /* @__PURE__ */ jsx(DialogDescription, { className: "sr-only", children: pageHeader.subtitle || description }),
|
|
2334
|
+
/* @__PURE__ */ jsx("div", { className: "shrink-0", children: /* @__PURE__ */ jsx(
|
|
2335
|
+
NPageHeader,
|
|
2336
|
+
{
|
|
2337
|
+
...pageHeader,
|
|
2338
|
+
card: false,
|
|
2339
|
+
actions: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2340
|
+
pageHeader.actions,
|
|
2341
|
+
/* @__PURE__ */ jsx(DialogClose, { asChild: true, children: /* @__PURE__ */ jsx(IconButton, { "aria-label": "Close", variant: "ghost", children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" }) }) })
|
|
2342
|
+
] })
|
|
2343
|
+
}
|
|
2344
|
+
) })
|
|
2345
|
+
] }) : /* @__PURE__ */ jsxs(DialogHeader, { className: cn(noHeader && "sr-only"), children: [
|
|
2346
|
+
/* @__PURE__ */ jsx(DialogTitle, { className: cn(noTitle && "sr-only"), children: title }),
|
|
2347
|
+
/* @__PURE__ */ jsx(DialogDescription, { className: cn(noDescription && "sr-only"), children: description })
|
|
2348
|
+
] }),
|
|
2349
|
+
flush ? (
|
|
2350
|
+
// Full-bleed content owns its own layout/scrolling; no outer scroll wrapper.
|
|
2351
|
+
/* @__PURE__ */ jsx("div", { ref: contentRef, className: "flex min-h-0 flex-1 flex-col", children })
|
|
2352
|
+
) : /* @__PURE__ */ jsx(NajmScroll, { axis: "y", className: "flex-1 px-1 -mx-1", children: /* @__PURE__ */ jsx("div", { ref: contentRef, style: { display: "contents" }, children }) })
|
|
2353
|
+
] });
|
|
2354
|
+
}
|
|
2172
2355
|
function DialogItem({ dialog, index, store }) {
|
|
2173
2356
|
if (dialog.render) {
|
|
2174
2357
|
return /* @__PURE__ */ jsx(Fragment, { children: dialog.render({
|
|
@@ -2185,6 +2368,8 @@ function DialogItem({ dialog, index, store }) {
|
|
|
2185
2368
|
id,
|
|
2186
2369
|
title,
|
|
2187
2370
|
description,
|
|
2371
|
+
pageHeader,
|
|
2372
|
+
padding,
|
|
2188
2373
|
children,
|
|
2189
2374
|
primaryButton,
|
|
2190
2375
|
secondaryButton,
|
|
@@ -2197,9 +2382,6 @@ function DialogItem({ dialog, index, store }) {
|
|
|
2197
2382
|
} = dialog;
|
|
2198
2383
|
const { contentOwnsActions, setContentElement } = useContentOwnsActions();
|
|
2199
2384
|
const renderDialogButtons = shouldRenderDialogButtons(showButtons, actionMode, contentOwnsActions);
|
|
2200
|
-
const noTitle = !title || title.trim() === "";
|
|
2201
|
-
const noDescription = !description || description.trim() === "";
|
|
2202
|
-
const noHeader = noTitle && noDescription;
|
|
2203
2385
|
const handlePrimary = async (e) => {
|
|
2204
2386
|
const hasForm = !!primaryButton?.form;
|
|
2205
2387
|
if (!hasForm && e) e.preventDefault();
|
|
@@ -2214,14 +2396,22 @@ function DialogItem({ dialog, index, store }) {
|
|
|
2214
2396
|
DialogContent,
|
|
2215
2397
|
{
|
|
2216
2398
|
"data-dialog-id": id,
|
|
2399
|
+
padding,
|
|
2400
|
+
hideClose: !!pageHeader,
|
|
2217
2401
|
className: cn(dialogVariants({ size, width, height }), className),
|
|
2218
2402
|
style: { zIndex: 9990 + index },
|
|
2219
2403
|
children: [
|
|
2220
|
-
/* @__PURE__ */
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2404
|
+
/* @__PURE__ */ jsx(
|
|
2405
|
+
DialogChrome,
|
|
2406
|
+
{
|
|
2407
|
+
pageHeader,
|
|
2408
|
+
title,
|
|
2409
|
+
description,
|
|
2410
|
+
padding,
|
|
2411
|
+
contentRef: setContentElement,
|
|
2412
|
+
children
|
|
2413
|
+
}
|
|
2414
|
+
),
|
|
2225
2415
|
/* @__PURE__ */ jsxs(DialogFooter, { className: cn(!renderDialogButtons && "sr-only"), children: [
|
|
2226
2416
|
renderDialogButtons && secondaryButton && /* @__PURE__ */ jsx(
|
|
2227
2417
|
Button,
|
|
@@ -2270,7 +2460,7 @@ var buildButtonConfig2 = (partial, defaults) => {
|
|
|
2270
2460
|
return { ...defaults, ...partial };
|
|
2271
2461
|
};
|
|
2272
2462
|
var isDirectDialogProps = (props) => {
|
|
2273
|
-
return "trigger" in props || "open" in props || "defaultOpen" in props || "onOpenChange" in props || "title" in props || "description" in props || "children" in props || "primaryButton" in props || "secondaryButton" in props || "showButtons" in props || "size" in props || "width" in props || "height" in props || "className" in props;
|
|
2463
|
+
return "trigger" in props || "open" in props || "defaultOpen" in props || "onOpenChange" in props || "title" in props || "description" in props || "children" in props || "primaryButton" in props || "secondaryButton" in props || "showButtons" in props || "size" in props || "width" in props || "height" in props || "className" in props || "pageHeader" in props || "padding" in props;
|
|
2274
2464
|
};
|
|
2275
2465
|
function NDirectDialog({
|
|
2276
2466
|
trigger,
|
|
@@ -2279,6 +2469,8 @@ function NDirectDialog({
|
|
|
2279
2469
|
onOpenChange,
|
|
2280
2470
|
title,
|
|
2281
2471
|
description,
|
|
2472
|
+
pageHeader,
|
|
2473
|
+
padding,
|
|
2282
2474
|
children,
|
|
2283
2475
|
primaryButton,
|
|
2284
2476
|
secondaryButton,
|
|
@@ -2315,9 +2507,6 @@ function NDirectDialog({
|
|
|
2315
2507
|
disabled: false,
|
|
2316
2508
|
loadingText: "Processing..."
|
|
2317
2509
|
});
|
|
2318
|
-
const noTitle = !title || title.trim() === "";
|
|
2319
|
-
const noDescription = !description || description.trim() === "";
|
|
2320
|
-
const noHeader = noTitle && noDescription;
|
|
2321
2510
|
const isPrimaryLoading = primaryLoading || !!resolvedPrimaryButton.loading;
|
|
2322
2511
|
const { contentOwnsActions, setContentElement } = useContentOwnsActions();
|
|
2323
2512
|
const renderDialogButtons = shouldRenderDialogButtons(showButtons, actionMode, contentOwnsActions);
|
|
@@ -2348,12 +2537,18 @@ function NDirectDialog({
|
|
|
2348
2537
|
};
|
|
2349
2538
|
return /* @__PURE__ */ jsxs(Dialog, { open: currentOpen, onOpenChange: setOpen, children: [
|
|
2350
2539
|
trigger ? /* @__PURE__ */ jsx(DialogTrigger, { asChild: true, children: trigger }) : null,
|
|
2351
|
-
/* @__PURE__ */ jsxs(DialogContent, { className: cn(dialogVariants({ size, width, height }), className), children: [
|
|
2352
|
-
/* @__PURE__ */
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2540
|
+
/* @__PURE__ */ jsxs(DialogContent, { padding, hideClose: !!pageHeader, className: cn(dialogVariants({ size, width, height }), className), children: [
|
|
2541
|
+
/* @__PURE__ */ jsx(
|
|
2542
|
+
DialogChrome,
|
|
2543
|
+
{
|
|
2544
|
+
pageHeader,
|
|
2545
|
+
title,
|
|
2546
|
+
description,
|
|
2547
|
+
padding,
|
|
2548
|
+
contentRef: setContentElement,
|
|
2549
|
+
children
|
|
2550
|
+
}
|
|
2551
|
+
),
|
|
2357
2552
|
/* @__PURE__ */ jsx(DialogFooter, { className: cn(!renderDialogButtons && "sr-only"), children: renderDialogButtons && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2358
2553
|
/* @__PURE__ */ jsx(
|
|
2359
2554
|
Button,
|
|
@@ -2978,7 +3173,7 @@ function Checkbox({ className, ...props }) {
|
|
|
2978
3173
|
{
|
|
2979
3174
|
"data-slot": "checkbox",
|
|
2980
3175
|
className: cn(
|
|
2981
|
-
"peer border-foreground/40 dark:border-foreground/50 dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
|
|
3176
|
+
"peer cursor-pointer border-foreground/40 dark:border-foreground/50 dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
|
|
2982
3177
|
className
|
|
2983
3178
|
),
|
|
2984
3179
|
...props,
|
|
@@ -3873,7 +4068,7 @@ function CommandItem({ className, ...props }) {
|
|
|
3873
4068
|
Command$1.Item,
|
|
3874
4069
|
{
|
|
3875
4070
|
"data-slot": "command-item",
|
|
3876
|
-
className: cn("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
4071
|
+
className: cn("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-50 [&>svg.opacity-0:first-child]:hidden [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
3877
4072
|
...props
|
|
3878
4073
|
}
|
|
3879
4074
|
);
|
|
@@ -3913,49 +4108,6 @@ var toggleVariants = cva(
|
|
|
3913
4108
|
function Toggle({ className, variant, size, ...props }) {
|
|
3914
4109
|
return /* @__PURE__ */ jsx(TogglePrimitive.Root, { "data-slot": "toggle", className: cn(toggleVariants({ variant, size, className })), ...props });
|
|
3915
4110
|
}
|
|
3916
|
-
var variantClasses = {
|
|
3917
|
-
primary: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
3918
|
-
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
3919
|
-
ghost: "bg-transparent text-muted-foreground hover:bg-accent hover:text-accent-foreground",
|
|
3920
|
-
destructive: "bg-transparent text-destructive hover:bg-destructive/10"
|
|
3921
|
-
};
|
|
3922
|
-
var sizeClasses = {
|
|
3923
|
-
sm: "h-6 w-6",
|
|
3924
|
-
md: "h-8 w-8",
|
|
3925
|
-
lg: "h-10 w-10"
|
|
3926
|
-
};
|
|
3927
|
-
var IconButton = React.forwardRef(
|
|
3928
|
-
({
|
|
3929
|
-
className,
|
|
3930
|
-
variant = "ghost",
|
|
3931
|
-
size = "md",
|
|
3932
|
-
active = false,
|
|
3933
|
-
type = "button",
|
|
3934
|
-
children,
|
|
3935
|
-
...props
|
|
3936
|
-
}, ref) => {
|
|
3937
|
-
return /* @__PURE__ */ jsx(
|
|
3938
|
-
"button",
|
|
3939
|
-
{
|
|
3940
|
-
ref,
|
|
3941
|
-
type,
|
|
3942
|
-
"aria-pressed": active || void 0,
|
|
3943
|
-
className: cn(
|
|
3944
|
-
"inline-flex shrink-0 cursor-pointer items-center justify-center rounded-md transition-colors",
|
|
3945
|
-
"outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
|
|
3946
|
-
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
3947
|
-
variantClasses[variant],
|
|
3948
|
-
sizeClasses[size],
|
|
3949
|
-
active && "bg-accent text-accent-foreground",
|
|
3950
|
-
className
|
|
3951
|
-
),
|
|
3952
|
-
...props,
|
|
3953
|
-
children
|
|
3954
|
-
}
|
|
3955
|
-
);
|
|
3956
|
-
}
|
|
3957
|
-
);
|
|
3958
|
-
IconButton.displayName = "IconButton";
|
|
3959
4111
|
var sizeClasses2 = {
|
|
3960
4112
|
sm: "p-0.5 [&_button]:h-6 [&_button]:px-1.5 [&_button]:text-xs",
|
|
3961
4113
|
md: "p-0.5 [&_button]:h-7 [&_button]:px-2 [&_button]:text-sm"
|
|
@@ -4130,7 +4282,7 @@ function FormMessage({ className, children, ...props }) {
|
|
|
4130
4282
|
return /* @__PURE__ */ jsx("p", { "data-slot": "form-message", id: formMessageId, className: cn("text-destructive text-[0.8rem] font-medium", className), ...props, children: body });
|
|
4131
4283
|
}
|
|
4132
4284
|
function Table({ className, ...props }) {
|
|
4133
|
-
return /* @__PURE__ */ jsx("div", { "data-slot": "table-container", className: "relative w-full", children: /* @__PURE__ */ jsx("table", { "data-slot": "table", className: cn("w-full caption-bottom text-sm", className), ...props }) });
|
|
4285
|
+
return /* @__PURE__ */ jsx("div", { "data-slot": "table-container", className: "relative w-full", children: /* @__PURE__ */ jsx("table", { "data-slot": "table", className: cn("w-full caption-bottom text-sm text-foreground", className), ...props }) });
|
|
4134
4286
|
}
|
|
4135
4287
|
function TableHeader({ className, ...props }) {
|
|
4136
4288
|
return /* @__PURE__ */ jsx("thead", { "data-slot": "table-header", className: cn("[&_tr]:border-b [&_tr]:border-border/40", className), ...props });
|
|
@@ -4148,7 +4300,7 @@ function TableHead({ className, ...props }) {
|
|
|
4148
4300
|
return /* @__PURE__ */ jsx("th", { "data-slot": "table-head", className: cn("text-foreground h-9 px-3 text-left align-middle text-xs font-medium uppercase tracking-wide whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", className), ...props });
|
|
4149
4301
|
}
|
|
4150
4302
|
function TableCell({ className, ...props }) {
|
|
4151
|
-
return /* @__PURE__ */ jsx("td", { "data-slot": "table-cell", className: cn("px-3 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", className), ...props });
|
|
4303
|
+
return /* @__PURE__ */ jsx("td", { "data-slot": "table-cell", className: cn("px-3 align-middle whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", className), ...props });
|
|
4152
4304
|
}
|
|
4153
4305
|
function TableCaption({ className, ...props }) {
|
|
4154
4306
|
return /* @__PURE__ */ jsx("caption", { "data-slot": "table-caption", className: cn("text-muted-foreground mt-4 text-sm", className), ...props });
|
|
@@ -5081,7 +5233,7 @@ function NContextMenu({ x, y, items, onAction, onClose, className }) {
|
|
|
5081
5233
|
onClose();
|
|
5082
5234
|
},
|
|
5083
5235
|
className: cn(
|
|
5084
|
-
"flex w-full items-center justify-between gap-2 px-3 py-1.5 text-xs hover:bg-accent hover:text-accent-foreground disabled:
|
|
5236
|
+
"flex w-full cursor-pointer items-center justify-between gap-2 px-3 py-1.5 text-xs hover:bg-accent hover:text-accent-foreground disabled:cursor-not-allowed disabled:opacity-40",
|
|
5085
5237
|
item.danger && "text-destructive hover:text-destructive"
|
|
5086
5238
|
),
|
|
5087
5239
|
children: [
|
|
@@ -5107,7 +5259,7 @@ function NContextMenu({ x, y, items, onAction, onClose, className }) {
|
|
|
5107
5259
|
onClose();
|
|
5108
5260
|
},
|
|
5109
5261
|
className: cn(
|
|
5110
|
-
"flex w-full items-center gap-2 px-3 py-1.5 text-xs hover:bg-accent hover:text-accent-foreground disabled:opacity-40",
|
|
5262
|
+
"flex w-full cursor-pointer items-center gap-2 px-3 py-1.5 text-xs hover:bg-accent hover:text-accent-foreground disabled:cursor-not-allowed disabled:opacity-40",
|
|
5111
5263
|
sub.danger && "text-destructive hover:text-destructive"
|
|
5112
5264
|
),
|
|
5113
5265
|
children: [
|
|
@@ -5691,7 +5843,7 @@ var PRESETS2 = {
|
|
|
5691
5843
|
destructive: "border-red-600"
|
|
5692
5844
|
};
|
|
5693
5845
|
var inputVariants = cva(
|
|
5694
|
-
"relative w-full flex items-center h-10 bg-card overflow-hidden transition-colors",
|
|
5846
|
+
"relative w-full flex items-center h-10 bg-card text-foreground overflow-hidden transition-colors",
|
|
5695
5847
|
{
|
|
5696
5848
|
variants: {
|
|
5697
5849
|
variant: {
|
|
@@ -5766,7 +5918,7 @@ var TextInput = ({ value, onChange, placeholder = "", icon, showIcon = true, ico
|
|
|
5766
5918
|
const iconProps = getIconColorProps(iconColor, "h-4 w-4");
|
|
5767
5919
|
return /* @__PURE__ */ jsxs(BaseInput, { variant, status, bordered, borderColor, className: cn("gap-2", className), disabled, children: [
|
|
5768
5920
|
shouldDisplayIcon && /* @__PURE__ */ jsx("span", { className: iconProps.className, style: iconProps.style, children: resolveIcon(icon) }),
|
|
5769
|
-
/* @__PURE__ */ jsx(Input, { placeholder, value, onChange: (ev) => onChange(ev.target.value), className: "p-0 border-0 shadow-none bg-transparent dark:bg-transparent focus-visible:ring-0 focus-visible:ring-transparent focus-visible:ring-offset-0 text-muted-foreground", disabled, ...props })
|
|
5921
|
+
/* @__PURE__ */ jsx(Input, { placeholder, value, onChange: (ev) => onChange(ev.target.value), className: "p-0 border-0 shadow-none bg-transparent dark:bg-transparent focus-visible:ring-0 focus-visible:ring-transparent focus-visible:ring-offset-0 text-foreground placeholder:text-muted-foreground", disabled, ...props })
|
|
5770
5922
|
] });
|
|
5771
5923
|
};
|
|
5772
5924
|
var NumberInput = ({ value, onChange, placeholder = "", icon, showIcon = true, iconColor, className = "", variant = "default", status = "default", bordered, borderColor }) => {
|
|
@@ -5774,7 +5926,7 @@ var NumberInput = ({ value, onChange, placeholder = "", icon, showIcon = true, i
|
|
|
5774
5926
|
const iconProps = getIconColorProps(iconColor, "h-4 w-4");
|
|
5775
5927
|
return /* @__PURE__ */ jsxs(BaseInput, { variant, status, bordered, borderColor, className: cn("gap-2", className), children: [
|
|
5776
5928
|
shouldDisplayIcon && /* @__PURE__ */ jsx("span", { className: iconProps.className, style: iconProps.style, children: resolveIcon(icon) }),
|
|
5777
|
-
/* @__PURE__ */ jsx(Input, { type: "number", placeholder, value: value ?? "", onChange: (ev) => onChange(Number(ev.target.value)), className: "p-0 border-0 shadow-none bg-transparent dark:bg-transparent focus-visible:ring-0 focus-visible:ring-transparent focus-visible:ring-offset-0 text-muted-foreground" })
|
|
5929
|
+
/* @__PURE__ */ jsx(Input, { type: "number", placeholder, value: value ?? "", onChange: (ev) => onChange(Number(ev.target.value)), className: "p-0 border-0 shadow-none bg-transparent dark:bg-transparent focus-visible:ring-0 focus-visible:ring-transparent focus-visible:ring-offset-0 text-foreground placeholder:text-muted-foreground" })
|
|
5778
5930
|
] });
|
|
5779
5931
|
};
|
|
5780
5932
|
var PasswordInput = ({ value, onChange, placeholder = "", icon, showIcon = true, iconColor, className = "", variant = "default", status = "default", bordered, borderColor }) => {
|
|
@@ -5783,7 +5935,7 @@ var PasswordInput = ({ value, onChange, placeholder = "", icon, showIcon = true,
|
|
|
5783
5935
|
const iconProps = getIconColorProps(iconColor, "h-4 w-4");
|
|
5784
5936
|
return /* @__PURE__ */ jsxs(BaseInput, { variant, status, bordered, borderColor, className: cn("gap-2", className), children: [
|
|
5785
5937
|
shouldDisplayIcon && /* @__PURE__ */ jsx("span", { className: iconProps.className, style: iconProps.style, children: resolveIcon(icon) }),
|
|
5786
|
-
/* @__PURE__ */ jsx(Input, { type: showPassword ? "text" : "password", placeholder, value, onChange: (ev) => onChange(ev.target.value), className: "p-0 border-0 shadow-none bg-transparent dark:bg-transparent focus-visible:ring-0 focus-visible:ring-transparent focus-visible:ring-offset-0 text-muted-foreground" }),
|
|
5938
|
+
/* @__PURE__ */ jsx(Input, { type: showPassword ? "text" : "password", placeholder, value, onChange: (ev) => onChange(ev.target.value), className: "p-0 border-0 shadow-none bg-transparent dark:bg-transparent focus-visible:ring-0 focus-visible:ring-transparent focus-visible:ring-offset-0 text-foreground placeholder:text-muted-foreground" }),
|
|
5787
5939
|
showPassword ? /* @__PURE__ */ jsx(Eye, { className: "absolute right-2 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground cursor-pointer", onClick: () => setShowPassword(false) }) : /* @__PURE__ */ jsx(EyeOff, { className: "absolute right-2 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground cursor-pointer", onClick: () => setShowPassword(true) })
|
|
5788
5940
|
] });
|
|
5789
5941
|
};
|
|
@@ -5810,7 +5962,7 @@ var TextAreaInput = ({ value, onChange, placeholder = "", className = "", varian
|
|
|
5810
5962
|
placeholder,
|
|
5811
5963
|
value,
|
|
5812
5964
|
onChange: (ev) => onChange(ev.target.value),
|
|
5813
|
-
className: "h-full min-h-0 resize-y border-0 bg-transparent p-0 text-muted-foreground shadow-none focus-visible:border-transparent focus-visible:ring-0 focus-visible:ring-transparent focus-visible:ring-offset-0 dark:bg-transparent"
|
|
5965
|
+
className: "h-full min-h-0 resize-y border-0 bg-transparent p-0 text-foreground placeholder:text-muted-foreground shadow-none focus-visible:border-transparent focus-visible:ring-0 focus-visible:ring-transparent focus-visible:ring-offset-0 dark:bg-transparent"
|
|
5814
5966
|
}
|
|
5815
5967
|
)
|
|
5816
5968
|
}
|
|
@@ -6031,7 +6183,7 @@ var DateInput = ({ value, onChange, placeholder = "Pick a date", className = "",
|
|
|
6031
6183
|
const toDateString = (date) => date?.toISOString().split("T")[0];
|
|
6032
6184
|
return /* @__PURE__ */ jsxs(BaseInput, { variant, status, bordered, borderColor, className, children: [
|
|
6033
6185
|
/* @__PURE__ */ jsxs(Popover, { children: [
|
|
6034
|
-
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx("div", { className:
|
|
6186
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx("div", { className: "w-full flex items-center cursor-pointer gap-2 justify-start text-left font-normal", children: /* @__PURE__ */ jsx(Label, { className: cn("cursor-pointer", value ? "text-foreground" : "text-muted-foreground"), children: value ? format(typeof value === "string" ? new Date(value) : value, "PPP") : placeholder }) }) }),
|
|
6035
6187
|
/* @__PURE__ */ jsx(PopoverContent, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ jsx(Calendar, { mode: "single", selected: typeof value === "string" ? new Date(value) : value, onSelect: (date) => onChange(toDateString(date)), captionLayout: "dropdown" }) })
|
|
6036
6188
|
] }),
|
|
6037
6189
|
!icon && showIcon && /* @__PURE__ */ jsx(Calendar$1, { className: iconProps.className, style: iconProps.style })
|
|
@@ -6052,13 +6204,13 @@ var FileInput = ({ value, onChange, placeholder = "No file chosen", icon, showIc
|
|
|
6052
6204
|
const filename = typeof value === "string" ? value.split(/[\\/]/).pop() || "" : value.name;
|
|
6053
6205
|
return truncateFilename(filename);
|
|
6054
6206
|
};
|
|
6055
|
-
return /* @__PURE__ */ jsxs(BaseInput, { variant, status, bordered, borderColor, className: cn("flex px-0 p-0
|
|
6207
|
+
return /* @__PURE__ */ jsxs(BaseInput, { variant, status, bordered, borderColor, className: cn("flex px-0 p-0", className), onClick: () => fileInputRef.current?.click(), children: [
|
|
6056
6208
|
/* @__PURE__ */ jsx("input", { type: "file", ref: fileInputRef, onChange: (e) => onChange(e.target.files?.[0] || null), className: "hidden" }),
|
|
6057
6209
|
/* @__PURE__ */ jsxs("div", { className: "bg-muted flex h-full items-center px-3", children: [
|
|
6058
6210
|
showIcon && (icon ? /* @__PURE__ */ jsx("span", { className: iconProps.className, style: iconProps.style, children: resolveIcon(icon) }) : /* @__PURE__ */ jsx(FileUp, { className: cn(iconProps.className) })),
|
|
6059
6211
|
/* @__PURE__ */ jsx(Label, { className: "flex cursor-pointer h-full justify-center items-center px-2 text-muted-foreground", children: "Choose File" })
|
|
6060
6212
|
] }),
|
|
6061
|
-
/* @__PURE__ */ jsx(Label, { className: "ml-2 flex-1", children: displayFilename() || /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: placeholder }) })
|
|
6213
|
+
/* @__PURE__ */ jsx(Label, { className: "ml-2 flex-1 text-foreground", children: displayFilename() || /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: placeholder }) })
|
|
6062
6214
|
] });
|
|
6063
6215
|
};
|
|
6064
6216
|
function formatBytes2(bytes) {
|
|
@@ -6877,7 +7029,7 @@ var TimeInput = ({ value = "", onChange, placeholder = "", icon, showIcon = true
|
|
|
6877
7029
|
showIcon && (icon ? /* @__PURE__ */ jsx("span", { className: iconProps.className, style: iconProps.style, children: resolveIcon(icon) }) : /* @__PURE__ */ jsx(Clock, { className: iconProps.className, style: iconProps.style })),
|
|
6878
7030
|
/* @__PURE__ */ jsx(Input, { type: "text", placeholder: placeholder || (showSeconds ? "HH:MM:SS" : "HH:MM"), value: inputValue, onChange: (e) => handleInputChange(e.target.value), onKeyDown: (e) => {
|
|
6879
7031
|
if (!/\d/.test(e.key) && !["Backspace", "Delete", "ArrowLeft", "ArrowRight", "Tab"].includes(e.key)) e.preventDefault();
|
|
6880
|
-
}, onBlur: handleBlur, disabled, className: cn("p-0 border-0 shadow-none bg-transparent dark:bg-transparent focus-visible:ring-0", !isValid ? "text-red-500" : "text-
|
|
7032
|
+
}, onBlur: handleBlur, disabled, className: cn("p-0 border-0 shadow-none bg-transparent dark:bg-transparent focus-visible:ring-0 placeholder:text-muted-foreground", !isValid ? "text-red-500" : "text-foreground") })
|
|
6881
7033
|
] });
|
|
6882
7034
|
};
|
|
6883
7035
|
var RANGE_COLOR = {
|
|
@@ -8784,7 +8936,7 @@ function NDataCardShell({ row, onClick, onContextMenu, actions, children, classN
|
|
|
8784
8936
|
onContextMenu,
|
|
8785
8937
|
style: recipeStyle,
|
|
8786
8938
|
className: cn(
|
|
8787
|
-
"relative group w-full rounded-lg bg-card",
|
|
8939
|
+
"relative group w-full rounded-lg bg-card text-card-foreground overflow-hidden",
|
|
8788
8940
|
surfaceBorderClasses(bordered),
|
|
8789
8941
|
isActive && (bordered ? "border-primary" : "ring-2 ring-primary ring-offset-1 ring-offset-background"),
|
|
8790
8942
|
onClick && "cursor-pointer",
|
|
@@ -8975,7 +9127,7 @@ function NTableCards({ effectiveMode }) {
|
|
|
8975
9127
|
onContextMenu: handleCardContextMenu,
|
|
8976
9128
|
"data-row": "true",
|
|
8977
9129
|
"data-row-id": row.id,
|
|
8978
|
-
className: cn("group relative", rowClassName),
|
|
9130
|
+
className: cn("group relative text-card-foreground", rowClassName),
|
|
8979
9131
|
children: [
|
|
8980
9132
|
menuButton && openRowMenu && /* @__PURE__ */ jsx(
|
|
8981
9133
|
"button",
|
|
@@ -8986,7 +9138,7 @@ function NTableCards({ effectiveMode }) {
|
|
|
8986
9138
|
e.stopPropagation();
|
|
8987
9139
|
openRowMenu(e, row.original);
|
|
8988
9140
|
},
|
|
8989
|
-
className: "absolute top-2 right-2 z-10 flex h-7 w-7 items-center justify-center rounded-md p-0 text-muted-foreground opacity-0 transition-all duration-200 hover:bg-muted/50 hover:text-foreground group-hover:opacity-100 focus:opacity-100 focus-visible:opacity-100",
|
|
9141
|
+
className: "absolute top-2 right-2 z-10 flex h-7 w-7 cursor-pointer items-center justify-center rounded-md p-0 text-muted-foreground opacity-0 transition-all duration-200 hover:bg-muted/50 hover:text-foreground group-hover:opacity-100 focus:opacity-100 focus-visible:opacity-100",
|
|
8990
9142
|
children: /* @__PURE__ */ jsx(MoreVertical, { className: "h-4 w-4" })
|
|
8991
9143
|
}
|
|
8992
9144
|
),
|
|
@@ -9082,36 +9234,36 @@ function NTablePagination() {
|
|
|
9082
9234
|
const newSize = Number(value);
|
|
9083
9235
|
setPagination({ pageIndex: 0, pageSize: newSize });
|
|
9084
9236
|
};
|
|
9085
|
-
return /* @__PURE__ */ jsxs("div", { className: cn("flex items-center justify-between gap-4", classNames?.pagination), children: [
|
|
9086
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4 lg:gap-6", children: [
|
|
9087
|
-
(!isPaginationControlled || manualPagination) && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
9088
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium", children: "Rows/page" }),
|
|
9237
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("flex w-full min-w-0 flex-wrap items-center justify-between gap-x-4 gap-y-2 py-1 text-foreground", classNames?.pagination), children: [
|
|
9238
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 flex-wrap items-center gap-4 lg:gap-6", children: [
|
|
9239
|
+
(!isPaginationControlled || manualPagination) && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-foreground", children: [
|
|
9240
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-foreground", children: "Rows/page" }),
|
|
9089
9241
|
/* @__PURE__ */ jsxs(Select, { value: `${pageSize}`, onValueChange: handlePageSizeChange, children: [
|
|
9090
9242
|
/* @__PURE__ */ jsx(
|
|
9091
9243
|
SelectTrigger,
|
|
9092
9244
|
{
|
|
9093
9245
|
"data-bordered": bordered ? "true" : void 0,
|
|
9094
|
-
className: cn("h-8 w-[80px]", bordered && "najm-border border-border"),
|
|
9246
|
+
className: cn("h-8 w-[80px] text-foreground", bordered && "najm-border border-border"),
|
|
9095
9247
|
children: /* @__PURE__ */ jsx(SelectValue, { placeholder: pageSize })
|
|
9096
9248
|
}
|
|
9097
9249
|
),
|
|
9098
9250
|
/* @__PURE__ */ jsx(SelectContent, { side: "top", children: currentPageSizeOptions.map((size) => /* @__PURE__ */ jsx(SelectItem, { value: `${size}`, children: size }, size)) })
|
|
9099
9251
|
] })
|
|
9100
9252
|
] }),
|
|
9101
|
-
/* @__PURE__ */ jsxs("div", { className: "text-sm font-medium", children: [
|
|
9253
|
+
/* @__PURE__ */ jsxs("div", { className: "text-sm font-medium text-foreground", children: [
|
|
9102
9254
|
"Page ",
|
|
9103
9255
|
pageIndex + 1,
|
|
9104
9256
|
" of ",
|
|
9105
9257
|
effectivePageCount
|
|
9106
9258
|
] }),
|
|
9107
9259
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
9108
|
-
/* @__PURE__ */ jsx(Button, { bordered, variant: "outline", className: "h-8 w-8 p-0
|
|
9109
|
-
/* @__PURE__ */ jsx(Button, { bordered, variant: "outline", className: "h-8 w-8 p-0", "aria-label": "Previous", onClick: () => navigate("prev"), disabled: !table.getCanPreviousPage?.() || pageIndex === 0, children: /* @__PURE__ */ jsx(ChevronLeft, { className: "h-4 w-4" }) }),
|
|
9110
|
-
/* @__PURE__ */ jsx(Button, { bordered, variant: "outline", className: "h-8 w-8 p-0", "aria-label": "Next", onClick: () => navigate("next"), disabled: !table.getCanNextPage?.() || pageIndex >= effectivePageCount - 1, children: /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4" }) }),
|
|
9111
|
-
/* @__PURE__ */ jsx(Button, { bordered, variant: "outline", className: "h-8 w-8 p-0
|
|
9260
|
+
/* @__PURE__ */ jsx(Button, { bordered, variant: "outline", className: "hidden h-8 w-8 p-0 text-foreground disabled:text-muted-foreground disabled:opacity-70 lg:flex", "aria-label": "First page", onClick: () => navigate("first"), disabled: !table.getCanPreviousPage?.() || pageIndex === 0, children: /* @__PURE__ */ jsx(ChevronsLeft, { className: "h-4 w-4" }) }),
|
|
9261
|
+
/* @__PURE__ */ jsx(Button, { bordered, variant: "outline", className: "h-8 w-8 p-0 text-foreground disabled:text-muted-foreground disabled:opacity-70", "aria-label": "Previous", onClick: () => navigate("prev"), disabled: !table.getCanPreviousPage?.() || pageIndex === 0, children: /* @__PURE__ */ jsx(ChevronLeft, { className: "h-4 w-4" }) }),
|
|
9262
|
+
/* @__PURE__ */ jsx(Button, { bordered, variant: "outline", className: "h-8 w-8 p-0 text-foreground disabled:text-muted-foreground disabled:opacity-70", "aria-label": "Next", onClick: () => navigate("next"), disabled: !table.getCanNextPage?.() || pageIndex >= effectivePageCount - 1, children: /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4" }) }),
|
|
9263
|
+
/* @__PURE__ */ jsx(Button, { bordered, variant: "outline", className: "hidden h-8 w-8 p-0 text-foreground disabled:text-muted-foreground disabled:opacity-70 lg:flex", "aria-label": "Last page", onClick: () => navigate("last"), disabled: !table.getCanNextPage?.() || pageIndex >= effectivePageCount - 1, children: /* @__PURE__ */ jsx(ChevronsRight, { className: "h-4 w-4" }) })
|
|
9112
9264
|
] })
|
|
9113
9265
|
] }),
|
|
9114
|
-
/* @__PURE__ */ jsxs("div", { className: "text-sm text-muted-foreground", children: [
|
|
9266
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-none whitespace-nowrap text-sm text-muted-foreground max-sm:hidden", children: [
|
|
9115
9267
|
selectedRows.length,
|
|
9116
9268
|
" of ",
|
|
9117
9269
|
manualPagination && rowCount !== void 0 ? rowCount : filteredRows.length,
|
|
@@ -9378,6 +9530,7 @@ function NTableJson() {
|
|
|
9378
9530
|
return /* @__PURE__ */ jsx("div", { className: "flex-1 flex flex-col min-h-0 overflow-hidden", children: renderJson?.() ?? /* @__PURE__ */ jsx(NajmScroll, { axis: "both", className: "h-full min-h-0 rounded-md border border-border bg-muted/40", children: /* @__PURE__ */ jsx("pre", { className: "p-4 font-mono text-xs leading-relaxed text-foreground", children: formatJsonValue(jsonValue) }) }) });
|
|
9379
9531
|
}
|
|
9380
9532
|
var DEFAULT_ROWS2 = 6;
|
|
9533
|
+
var DEFAULT_CARD_COUNT = 16;
|
|
9381
9534
|
function NTableHeaderSkeleton() {
|
|
9382
9535
|
const filters = useTableStore.use.filters();
|
|
9383
9536
|
const showViewToggle = useTableStore.use.showViewToggle();
|
|
@@ -9457,7 +9610,7 @@ function NTableLoadingSkeleton({ rows = DEFAULT_ROWS2 }) {
|
|
|
9457
9610
|
)
|
|
9458
9611
|
] });
|
|
9459
9612
|
}
|
|
9460
|
-
function NTableCardsLoadingSkeleton({ rows
|
|
9613
|
+
function NTableCardsLoadingSkeleton({ rows }) {
|
|
9461
9614
|
const filters = useTableStore.use.filters();
|
|
9462
9615
|
const showViewToggle = useTableStore.use.showViewToggle();
|
|
9463
9616
|
const showColumnVisibility = useTableStore.use.showColumnVisibility();
|
|
@@ -9469,18 +9622,21 @@ function NTableCardsLoadingSkeleton({ rows = 8 }) {
|
|
|
9469
9622
|
);
|
|
9470
9623
|
const classNames = useTableStore.use.classNames();
|
|
9471
9624
|
const bordered = useTableStore.use.bordered();
|
|
9625
|
+
const calculatedPageSize = useTableStore.use.calculatedPageSize();
|
|
9626
|
+
const pagination = useTableStore.use.pagination();
|
|
9627
|
+
const cardCount = rows ?? Math.max(1, calculatedPageSize || pagination?.pageSize || DEFAULT_CARD_COUNT);
|
|
9472
9628
|
return /* @__PURE__ */ jsxs("div", { className: "flex min-h-0 flex-1 flex-col gap-2", children: [
|
|
9473
9629
|
hasHeaderSkeleton && /* @__PURE__ */ jsx(NTableHeaderSkeleton, {}),
|
|
9474
|
-
/* @__PURE__ */ jsx(
|
|
9630
|
+
/* @__PURE__ */ jsx(NajmScroll, { axis: "y", className: "min-h-0 flex-1 overflow-hidden", children: /* @__PURE__ */ jsx(
|
|
9475
9631
|
"div",
|
|
9476
9632
|
{
|
|
9477
9633
|
"data-testid": "ntable-cards-loading-skeleton",
|
|
9478
9634
|
"aria-busy": "true",
|
|
9479
9635
|
className: cn("grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4", classNames?.cards),
|
|
9480
|
-
children: Array.from({ length:
|
|
9636
|
+
children: Array.from({ length: cardCount }).map((_, index) => /* @__PURE__ */ jsx(
|
|
9481
9637
|
Card,
|
|
9482
9638
|
{
|
|
9483
|
-
className: cn("rounded-lg bg-card p-4 shadow-none", bordered
|
|
9639
|
+
className: cn("rounded-lg bg-card p-4 shadow-none", surfaceBorderClasses(bordered)),
|
|
9484
9640
|
children: /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-4", children: [
|
|
9485
9641
|
/* @__PURE__ */ jsx(NSkeleton, { className: "h-12 w-12 shrink-0 rounded-full" }),
|
|
9486
9642
|
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-3", children: [
|
|
@@ -9499,7 +9655,7 @@ function NTableCardsLoadingSkeleton({ rows = 8 }) {
|
|
|
9499
9655
|
index
|
|
9500
9656
|
))
|
|
9501
9657
|
}
|
|
9502
|
-
)
|
|
9658
|
+
) })
|
|
9503
9659
|
] });
|
|
9504
9660
|
}
|
|
9505
9661
|
function TableStateSlot({ children }) {
|
|
@@ -9585,7 +9741,7 @@ function TableLayout(props) {
|
|
|
9585
9741
|
/* @__PURE__ */ jsx(NTableCards, { effectiveMode }),
|
|
9586
9742
|
/* @__PURE__ */ jsx(NTableJson, {})
|
|
9587
9743
|
] }) }),
|
|
9588
|
-
/* @__PURE__ */ jsx("div", { "data-ntable-pagination": true, className: "shrink-0", children: /* @__PURE__ */ jsx(NTablePagination, {}) })
|
|
9744
|
+
/* @__PURE__ */ jsx("div", { "data-ntable-pagination": true, className: "min-w-0 shrink-0 bg-background text-foreground", children: /* @__PURE__ */ jsx(NTablePagination, {}) })
|
|
9589
9745
|
] });
|
|
9590
9746
|
}
|
|
9591
9747
|
function NTable(props) {
|
|
@@ -9668,8 +9824,7 @@ function NTable(props) {
|
|
|
9668
9824
|
[onRowContextMenu]
|
|
9669
9825
|
);
|
|
9670
9826
|
const autoOpenRowMenu = effectiveRowMenu ? handleOpenRowMenu : onRowContextMenu ? handleManualRowMenu : null;
|
|
9671
|
-
const
|
|
9672
|
-
const effectiveMenuButton = Boolean(autoOpenRowMenu) && (menuButtonProp ?? shouldCollapseActions);
|
|
9827
|
+
const effectiveMenuButton = Boolean(autoOpenRowMenu) && (menuButtonProp ?? true);
|
|
9673
9828
|
const store = useStoreSync({
|
|
9674
9829
|
data: props.data ?? [],
|
|
9675
9830
|
columns: props.columns ?? [],
|
|
@@ -10934,92 +11089,6 @@ function NPageLayout({
|
|
|
10934
11089
|
}
|
|
10935
11090
|
);
|
|
10936
11091
|
}
|
|
10937
|
-
function NPageHeaderActions({ children, className }) {
|
|
10938
|
-
return /* @__PURE__ */ jsx("div", { className: cn("flex shrink-0 items-center gap-2 sm:gap-3", className), children });
|
|
10939
|
-
}
|
|
10940
|
-
NPageHeaderActions.displayName = "NPageHeaderActions";
|
|
10941
|
-
function NPageHeaderFilters({ children, className }) {
|
|
10942
|
-
return /* @__PURE__ */ jsx("div", { className: cn("px-4 py-3 sm:px-5", className), children });
|
|
10943
|
-
}
|
|
10944
|
-
NPageHeaderFilters.displayName = "NPageHeaderFilters";
|
|
10945
|
-
function NPageHeaderTop({ children, className }) {
|
|
10946
|
-
return /* @__PURE__ */ jsx("div", { className, children });
|
|
10947
|
-
}
|
|
10948
|
-
NPageHeaderTop.displayName = "NPageHeaderTop";
|
|
10949
|
-
function isPageHeaderSlot(child, slot) {
|
|
10950
|
-
return React__default.isValidElement(child) && child.type === slot;
|
|
10951
|
-
}
|
|
10952
|
-
function getSlotElements(children, slot) {
|
|
10953
|
-
const matches = React__default.Children.toArray(children).filter((child) => isPageHeaderSlot(child, slot));
|
|
10954
|
-
return matches.length > 0 ? matches : void 0;
|
|
10955
|
-
}
|
|
10956
|
-
function NPageHeader({ icon: Icon2, title, subtitle, actions, filters, top, search, children, className, headerClassName, card, bordered }) {
|
|
10957
|
-
const [internalSearch, setInternalSearch] = useState("");
|
|
10958
|
-
const recipe = useNajmComponentStyle("pageHeader");
|
|
10959
|
-
const searchValue = search?.value ?? internalSearch;
|
|
10960
|
-
const handleSearchChange = useCallback((e) => {
|
|
10961
|
-
setInternalSearch(e.currentTarget.value);
|
|
10962
|
-
search?.onChange?.(e);
|
|
10963
|
-
}, [search?.onChange]);
|
|
10964
|
-
const slottedActions = getSlotElements(children, NPageHeaderActions);
|
|
10965
|
-
const slottedFilters = getSlotElements(children, NPageHeaderFilters);
|
|
10966
|
-
const slottedTop = getSlotElements(children, NPageHeaderTop);
|
|
10967
|
-
const resolvedActions = slottedActions ?? actions;
|
|
10968
|
-
const resolvedFilters = slottedFilters ?? filters;
|
|
10969
|
-
const resolvedTop = slottedTop ?? top;
|
|
10970
|
-
const isCard = card ?? recipe?.card ?? bordered === true;
|
|
10971
|
-
const recipeRadius = resolveRadiusValue(recipe?.radius);
|
|
10972
|
-
const recipeStyle = recipeRadius || recipe?.borderWidth ? {
|
|
10973
|
-
...recipeRadius ? { borderRadius: recipeRadius } : {},
|
|
10974
|
-
...recipe?.borderWidth ? { borderWidth: recipe.borderWidth } : {}
|
|
10975
|
-
} : void 0;
|
|
10976
|
-
return /* @__PURE__ */ jsxs(
|
|
10977
|
-
"div",
|
|
10978
|
-
{
|
|
10979
|
-
"data-slot": "page-header",
|
|
10980
|
-
"data-card": isCard ? "true" : void 0,
|
|
10981
|
-
"data-bordered": bordered === false ? "false" : bordered ? "true" : void 0,
|
|
10982
|
-
style: recipeStyle,
|
|
10983
|
-
className: cn(
|
|
10984
|
-
isCard ? cn("rounded-xl bg-card shadow-none", surfaceBorderClasses(true)) : cn("border-b", surfaceBorderClasses(true, "bottom").replace("najm-border-b", "najm-border-b")),
|
|
10985
|
-
className
|
|
10986
|
-
),
|
|
10987
|
-
children: [
|
|
10988
|
-
resolvedTop,
|
|
10989
|
-
/* @__PURE__ */ jsxs("div", { className: cn("flex min-h-14 flex-row items-center justify-between gap-2 px-4 pl-16 sm:px-5 md:pl-5", headerClassName), children: [
|
|
10990
|
-
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center gap-3", children: [
|
|
10991
|
-
/* @__PURE__ */ jsx("div", { className: "flex h-8 w-8 shrink-0 rounded-lg bg-primary/10 items-center justify-center", children: /* @__PURE__ */ jsx(Icon2, { className: "h-4 w-4 text-primary" }) }),
|
|
10992
|
-
/* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
|
|
10993
|
-
/* @__PURE__ */ jsx("h2", { className: "truncate text-sm font-semibold text-foreground", children: title }),
|
|
10994
|
-
subtitle && /* @__PURE__ */ jsx("p", { className: "truncate text-xs leading-relaxed text-muted-foreground sm:text-sm sm:leading-normal", children: subtitle })
|
|
10995
|
-
] })
|
|
10996
|
-
] }),
|
|
10997
|
-
/* @__PURE__ */ jsxs("div", { className: "flex shrink-0 items-center gap-3", children: [
|
|
10998
|
-
search && /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
10999
|
-
/* @__PURE__ */ jsx(Search, { size: 14, className: "absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none" }),
|
|
11000
|
-
/* @__PURE__ */ jsx(
|
|
11001
|
-
"input",
|
|
11002
|
-
{
|
|
11003
|
-
ref: search.ref,
|
|
11004
|
-
type: "text",
|
|
11005
|
-
value: searchValue,
|
|
11006
|
-
placeholder: search.placeholder ?? "Search...",
|
|
11007
|
-
className: cn(
|
|
11008
|
-
"h-9 w-full max-w-[280px] rounded-lg bg-background pl-9 pr-3 text-sm text-foreground placeholder:text-muted-foreground outline-none border border-border focus:border-primary focus:ring-1 focus:ring-primary/20 transition-colors",
|
|
11009
|
-
search.className
|
|
11010
|
-
),
|
|
11011
|
-
onChange: handleSearchChange
|
|
11012
|
-
}
|
|
11013
|
-
)
|
|
11014
|
-
] }),
|
|
11015
|
-
resolvedActions && (slottedActions ? resolvedActions : /* @__PURE__ */ jsx(NPageHeaderActions, { children: resolvedActions }))
|
|
11016
|
-
] })
|
|
11017
|
-
] }),
|
|
11018
|
-
resolvedFilters && (slottedFilters ? resolvedFilters : /* @__PURE__ */ jsx(NPageHeaderFilters, { children: resolvedFilters }))
|
|
11019
|
-
]
|
|
11020
|
-
}
|
|
11021
|
-
);
|
|
11022
|
-
}
|
|
11023
11092
|
function NInspectorSheet({ open, onClose, title, children }) {
|
|
11024
11093
|
useEffect(() => {
|
|
11025
11094
|
const handleKey = (e) => {
|
package/dist/json.mjs
CHANGED
|
@@ -368,7 +368,7 @@ var buttonVariants = cva(
|
|
|
368
368
|
variant: {
|
|
369
369
|
default: "bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",
|
|
370
370
|
destructive: "bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40",
|
|
371
|
-
outline: "border border-input bg-
|
|
371
|
+
outline: "border border-input bg-transparent text-foreground shadow-xs hover:bg-accent hover:text-accent-foreground",
|
|
372
372
|
secondary: "bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
|
|
373
373
|
tertiary: "bg-tertiary text-tertiary-foreground shadow-xs hover:bg-tertiary/80",
|
|
374
374
|
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
package/dist/theme.css
CHANGED
|
@@ -287,26 +287,35 @@
|
|
|
287
287
|
}
|
|
288
288
|
|
|
289
289
|
/* OverlayScrollbars theme used by the <NajmScroll> component — a thin,
|
|
290
|
-
translucent slate bar that floats over content with no reserved space.
|
|
291
|
-
|
|
290
|
+
translucent slate bar that floats over content with no reserved space.
|
|
291
|
+
Keep this selector more specific than OverlayScrollbars' appended
|
|
292
|
+
`.os-scrollbar` variable reset in dist/theme.css. */
|
|
293
|
+
.os-scrollbar.os-theme-najm {
|
|
294
|
+
z-index: 20;
|
|
292
295
|
--os-size: 10px;
|
|
293
296
|
--os-padding-perpendicular: 2px;
|
|
294
297
|
--os-padding-axis: 2px;
|
|
298
|
+
--os-track-bg: transparent;
|
|
295
299
|
--os-track-border-radius: 9999px;
|
|
296
300
|
--os-handle-border-radius: 9999px;
|
|
297
|
-
--os-handle-bg: rgba(
|
|
298
|
-
--os-handle-bg-hover: rgba(
|
|
299
|
-
--os-handle-bg-active: rgba(
|
|
301
|
+
--os-handle-bg: rgba(100, 116, 139, 0.22);
|
|
302
|
+
--os-handle-bg-hover: rgba(100, 116, 139, 0.5);
|
|
303
|
+
--os-handle-bg-active: rgba(71, 85, 105, 0.62);
|
|
300
304
|
--os-handle-min-size: 33px;
|
|
301
|
-
--os-handle-perpendicular-size:
|
|
302
|
-
--os-handle-perpendicular-size-hover:
|
|
305
|
+
--os-handle-perpendicular-size: 4px;
|
|
306
|
+
--os-handle-perpendicular-size-hover: 6px;
|
|
307
|
+
--os-handle-perpendicular-size-active: 6px;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
.os-scrollbar.os-theme-najm:hover .os-scrollbar-handle {
|
|
311
|
+
background: var(--os-handle-bg-hover);
|
|
303
312
|
}
|
|
304
313
|
|
|
305
314
|
/* Darker, more subtle handle in dark mode */
|
|
306
|
-
.dark .os-theme-najm {
|
|
307
|
-
--os-handle-bg: rgba(
|
|
308
|
-
--os-handle-bg-hover: rgba(
|
|
309
|
-
--os-handle-bg-active: rgba(
|
|
315
|
+
.dark .os-scrollbar.os-theme-najm {
|
|
316
|
+
--os-handle-bg: rgba(113, 113, 122, 0.36);
|
|
317
|
+
--os-handle-bg-hover: rgba(161, 161, 170, 0.62);
|
|
318
|
+
--os-handle-bg-active: rgba(212, 212, 216, 0.72);
|
|
310
319
|
}
|
|
311
320
|
|
|
312
321
|
|