najm-kit 0.0.31 → 0.0.33
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 +232 -164
- package/dist/json.mjs +1 -1
- package/dist/theme.css +20 -13
- 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';
|
|
@@ -30,7 +30,7 @@ import { Toaster as Toaster$1 } from 'sonner';
|
|
|
30
30
|
export { toast } from 'sonner';
|
|
31
31
|
import { FormProvider, Controller, useFormContext, useForm, useFieldArray } from 'react-hook-form';
|
|
32
32
|
import { defaultStyles, FileIcon } from 'react-file-icon';
|
|
33
|
-
import { format } from 'date-fns';
|
|
33
|
+
import { format, parseISO } from 'date-fns';
|
|
34
34
|
import { HexColorPicker } from 'react-colorful';
|
|
35
35
|
import { converter, parse, formatHsl, formatRgb, formatHex } from 'culori';
|
|
36
36
|
import { PhoneInput as PhoneInput$1, defaultCountries } from 'react-international-phone';
|
|
@@ -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 shadow-xs hover:bg-accent hover:text-accent-foreground",
|
|
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",
|
|
@@ -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,
|
|
@@ -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"
|
|
@@ -6028,11 +6180,12 @@ var SwitchInput = ({ value, onChange, label = "", helper, className = "", varian
|
|
|
6028
6180
|
] });
|
|
6029
6181
|
var DateInput = ({ value, onChange, placeholder = "Pick a date", className = "", icon, showIcon = true, iconColor, variant = "default", status = "default", bordered, borderColor }) => {
|
|
6030
6182
|
const iconProps = getIconColorProps(iconColor, "h-4 w-4");
|
|
6031
|
-
const toDateString = (date) => date
|
|
6183
|
+
const toDateString = (date) => date ? format(date, "yyyy-MM-dd") : void 0;
|
|
6184
|
+
const toDate = (val) => typeof val === "string" ? parseISO(val) : val;
|
|
6032
6185
|
return /* @__PURE__ */ jsxs(BaseInput, { variant, status, bordered, borderColor, className, children: [
|
|
6033
6186
|
/* @__PURE__ */ jsxs(Popover, { children: [
|
|
6034
|
-
/* @__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(
|
|
6035
|
-
/* @__PURE__ */ jsx(PopoverContent, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ jsx(Calendar, { mode: "single", selected:
|
|
6187
|
+
/* @__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(toDate(value), "PPP") : placeholder }) }) }),
|
|
6188
|
+
/* @__PURE__ */ jsx(PopoverContent, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ jsx(Calendar, { mode: "single", selected: toDate(value), onSelect: (date) => onChange(toDateString(date)), captionLayout: "dropdown" }) })
|
|
6036
6189
|
] }),
|
|
6037
6190
|
!icon && showIcon && /* @__PURE__ */ jsx(Calendar$1, { className: iconProps.className, style: iconProps.style })
|
|
6038
6191
|
] });
|
|
@@ -8784,7 +8937,7 @@ function NDataCardShell({ row, onClick, onContextMenu, actions, children, classN
|
|
|
8784
8937
|
onContextMenu,
|
|
8785
8938
|
style: recipeStyle,
|
|
8786
8939
|
className: cn(
|
|
8787
|
-
"relative group w-full rounded-lg bg-card overflow-hidden",
|
|
8940
|
+
"relative group w-full rounded-lg bg-card text-card-foreground overflow-hidden",
|
|
8788
8941
|
surfaceBorderClasses(bordered),
|
|
8789
8942
|
isActive && (bordered ? "border-primary" : "ring-2 ring-primary ring-offset-1 ring-offset-background"),
|
|
8790
8943
|
onClick && "cursor-pointer",
|
|
@@ -8975,7 +9128,7 @@ function NTableCards({ effectiveMode }) {
|
|
|
8975
9128
|
onContextMenu: handleCardContextMenu,
|
|
8976
9129
|
"data-row": "true",
|
|
8977
9130
|
"data-row-id": row.id,
|
|
8978
|
-
className: cn("group relative", rowClassName),
|
|
9131
|
+
className: cn("group relative text-card-foreground", rowClassName),
|
|
8979
9132
|
children: [
|
|
8980
9133
|
menuButton && openRowMenu && /* @__PURE__ */ jsx(
|
|
8981
9134
|
"button",
|
|
@@ -9378,6 +9531,7 @@ function NTableJson() {
|
|
|
9378
9531
|
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
9532
|
}
|
|
9380
9533
|
var DEFAULT_ROWS2 = 6;
|
|
9534
|
+
var DEFAULT_CARD_COUNT = 16;
|
|
9381
9535
|
function NTableHeaderSkeleton() {
|
|
9382
9536
|
const filters = useTableStore.use.filters();
|
|
9383
9537
|
const showViewToggle = useTableStore.use.showViewToggle();
|
|
@@ -9471,7 +9625,7 @@ function NTableCardsLoadingSkeleton({ rows }) {
|
|
|
9471
9625
|
const bordered = useTableStore.use.bordered();
|
|
9472
9626
|
const calculatedPageSize = useTableStore.use.calculatedPageSize();
|
|
9473
9627
|
const pagination = useTableStore.use.pagination();
|
|
9474
|
-
const cardCount = rows ?? Math.max(1, calculatedPageSize || pagination?.pageSize ||
|
|
9628
|
+
const cardCount = rows ?? Math.max(1, calculatedPageSize || pagination?.pageSize || DEFAULT_CARD_COUNT);
|
|
9475
9629
|
return /* @__PURE__ */ jsxs("div", { className: "flex min-h-0 flex-1 flex-col gap-2", children: [
|
|
9476
9630
|
hasHeaderSkeleton && /* @__PURE__ */ jsx(NTableHeaderSkeleton, {}),
|
|
9477
9631
|
/* @__PURE__ */ jsx(NajmScroll, { axis: "y", className: "min-h-0 flex-1 overflow-hidden", children: /* @__PURE__ */ jsx(
|
|
@@ -10936,92 +11090,6 @@ function NPageLayout({
|
|
|
10936
11090
|
}
|
|
10937
11091
|
);
|
|
10938
11092
|
}
|
|
10939
|
-
function NPageHeaderActions({ children, className }) {
|
|
10940
|
-
return /* @__PURE__ */ jsx("div", { className: cn("flex shrink-0 items-center gap-2 sm:gap-3", className), children });
|
|
10941
|
-
}
|
|
10942
|
-
NPageHeaderActions.displayName = "NPageHeaderActions";
|
|
10943
|
-
function NPageHeaderFilters({ children, className }) {
|
|
10944
|
-
return /* @__PURE__ */ jsx("div", { className: cn("px-4 py-3 sm:px-5", className), children });
|
|
10945
|
-
}
|
|
10946
|
-
NPageHeaderFilters.displayName = "NPageHeaderFilters";
|
|
10947
|
-
function NPageHeaderTop({ children, className }) {
|
|
10948
|
-
return /* @__PURE__ */ jsx("div", { className, children });
|
|
10949
|
-
}
|
|
10950
|
-
NPageHeaderTop.displayName = "NPageHeaderTop";
|
|
10951
|
-
function isPageHeaderSlot(child, slot) {
|
|
10952
|
-
return React__default.isValidElement(child) && child.type === slot;
|
|
10953
|
-
}
|
|
10954
|
-
function getSlotElements(children, slot) {
|
|
10955
|
-
const matches = React__default.Children.toArray(children).filter((child) => isPageHeaderSlot(child, slot));
|
|
10956
|
-
return matches.length > 0 ? matches : void 0;
|
|
10957
|
-
}
|
|
10958
|
-
function NPageHeader({ icon: Icon2, title, subtitle, actions, filters, top, search, children, className, headerClassName, card, bordered }) {
|
|
10959
|
-
const [internalSearch, setInternalSearch] = useState("");
|
|
10960
|
-
const recipe = useNajmComponentStyle("pageHeader");
|
|
10961
|
-
const searchValue = search?.value ?? internalSearch;
|
|
10962
|
-
const handleSearchChange = useCallback((e) => {
|
|
10963
|
-
setInternalSearch(e.currentTarget.value);
|
|
10964
|
-
search?.onChange?.(e);
|
|
10965
|
-
}, [search?.onChange]);
|
|
10966
|
-
const slottedActions = getSlotElements(children, NPageHeaderActions);
|
|
10967
|
-
const slottedFilters = getSlotElements(children, NPageHeaderFilters);
|
|
10968
|
-
const slottedTop = getSlotElements(children, NPageHeaderTop);
|
|
10969
|
-
const resolvedActions = slottedActions ?? actions;
|
|
10970
|
-
const resolvedFilters = slottedFilters ?? filters;
|
|
10971
|
-
const resolvedTop = slottedTop ?? top;
|
|
10972
|
-
const isCard = card ?? recipe?.card ?? bordered === true;
|
|
10973
|
-
const recipeRadius = resolveRadiusValue(recipe?.radius);
|
|
10974
|
-
const recipeStyle = recipeRadius || recipe?.borderWidth ? {
|
|
10975
|
-
...recipeRadius ? { borderRadius: recipeRadius } : {},
|
|
10976
|
-
...recipe?.borderWidth ? { borderWidth: recipe.borderWidth } : {}
|
|
10977
|
-
} : void 0;
|
|
10978
|
-
return /* @__PURE__ */ jsxs(
|
|
10979
|
-
"div",
|
|
10980
|
-
{
|
|
10981
|
-
"data-slot": "page-header",
|
|
10982
|
-
"data-card": isCard ? "true" : void 0,
|
|
10983
|
-
"data-bordered": bordered === false ? "false" : bordered ? "true" : void 0,
|
|
10984
|
-
style: recipeStyle,
|
|
10985
|
-
className: cn(
|
|
10986
|
-
isCard ? cn("rounded-xl bg-card shadow-none", surfaceBorderClasses(true)) : cn("border-b", surfaceBorderClasses(true, "bottom").replace("najm-border-b", "najm-border-b")),
|
|
10987
|
-
className
|
|
10988
|
-
),
|
|
10989
|
-
children: [
|
|
10990
|
-
resolvedTop,
|
|
10991
|
-
/* @__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: [
|
|
10992
|
-
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center gap-3", children: [
|
|
10993
|
-
/* @__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" }) }),
|
|
10994
|
-
/* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
|
|
10995
|
-
/* @__PURE__ */ jsx("h2", { className: "truncate text-sm font-semibold text-foreground", children: title }),
|
|
10996
|
-
subtitle && /* @__PURE__ */ jsx("p", { className: "truncate text-xs leading-relaxed text-muted-foreground sm:text-sm sm:leading-normal", children: subtitle })
|
|
10997
|
-
] })
|
|
10998
|
-
] }),
|
|
10999
|
-
/* @__PURE__ */ jsxs("div", { className: "flex shrink-0 items-center gap-3", children: [
|
|
11000
|
-
search && /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
11001
|
-
/* @__PURE__ */ jsx(Search, { size: 14, className: "absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none" }),
|
|
11002
|
-
/* @__PURE__ */ jsx(
|
|
11003
|
-
"input",
|
|
11004
|
-
{
|
|
11005
|
-
ref: search.ref,
|
|
11006
|
-
type: "text",
|
|
11007
|
-
value: searchValue,
|
|
11008
|
-
placeholder: search.placeholder ?? "Search...",
|
|
11009
|
-
className: cn(
|
|
11010
|
-
"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",
|
|
11011
|
-
search.className
|
|
11012
|
-
),
|
|
11013
|
-
onChange: handleSearchChange
|
|
11014
|
-
}
|
|
11015
|
-
)
|
|
11016
|
-
] }),
|
|
11017
|
-
resolvedActions && (slottedActions ? resolvedActions : /* @__PURE__ */ jsx(NPageHeaderActions, { children: resolvedActions }))
|
|
11018
|
-
] })
|
|
11019
|
-
] }),
|
|
11020
|
-
resolvedFilters && (slottedFilters ? resolvedFilters : /* @__PURE__ */ jsx(NPageHeaderFilters, { children: resolvedFilters }))
|
|
11021
|
-
]
|
|
11022
|
-
}
|
|
11023
|
-
);
|
|
11024
|
-
}
|
|
11025
11093
|
function NInspectorSheet({ open, onClose, title, children }) {
|
|
11026
11094
|
useEffect(() => {
|
|
11027
11095
|
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 shadow-xs hover:bg-accent hover:text-accent-foreground",
|
|
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,28 +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
|
-
|
|
292
|
-
|
|
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;
|
|
295
|
+
--os-size: 10px;
|
|
293
296
|
--os-padding-perpendicular: 2px;
|
|
294
297
|
--os-padding-axis: 2px;
|
|
295
298
|
--os-track-bg: transparent;
|
|
296
299
|
--os-track-border-radius: 9999px;
|
|
297
300
|
--os-handle-border-radius: 9999px;
|
|
298
|
-
--os-handle-bg: rgba(
|
|
299
|
-
--os-handle-bg-hover: rgba(100, 116, 139, 0.
|
|
300
|
-
--os-handle-bg-active: rgba(71, 85, 105, 0.
|
|
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);
|
|
301
304
|
--os-handle-min-size: 33px;
|
|
302
|
-
--os-handle-perpendicular-size:
|
|
303
|
-
--os-handle-perpendicular-size-hover:
|
|
304
|
-
--os-handle-perpendicular-size-active:
|
|
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);
|
|
305
312
|
}
|
|
306
313
|
|
|
307
314
|
/* Darker, more subtle handle in dark mode */
|
|
308
|
-
.dark .os-theme-najm {
|
|
309
|
-
--os-handle-bg: rgba(
|
|
310
|
-
--os-handle-bg-hover: rgba(
|
|
311
|
-
--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);
|
|
312
319
|
}
|
|
313
320
|
|
|
314
321
|
|