najm-kit 2.1.18 → 2.1.20
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 +67 -15
- package/dist/index.mjs +383 -51
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -146,6 +146,13 @@ declare function composePreset(mode: NajmMode, accent: NajmAccent): NajmThemeTok
|
|
|
146
146
|
declare function resolvePreset(preset: NajmPreset): NajmThemeTokens;
|
|
147
147
|
|
|
148
148
|
type NajmDensity = "compact" | "default" | "comfortable";
|
|
149
|
+
/** Tailwind's mobile-first viewport breakpoints, plus the default value. */
|
|
150
|
+
type NajmResponsiveBreakpoint = "base" | "sm" | "md" | "lg" | "xl" | "2xl";
|
|
151
|
+
/**
|
|
152
|
+
* A scalar value for every viewport, or mobile-first breakpoint overrides.
|
|
153
|
+
* For example: `{ base: 164, lg: 200, xl: 240 }`.
|
|
154
|
+
*/
|
|
155
|
+
type NajmResponsiveValue<T> = T | Partial<Record<NajmResponsiveBreakpoint, T>>;
|
|
149
156
|
type NajmComponentRadius = "inherit" | "none" | "xs" | "sm" | "md" | "lg" | "xl" | "full" | string;
|
|
150
157
|
interface NajmSlotStyle {
|
|
151
158
|
className?: string;
|
|
@@ -167,10 +174,12 @@ interface NajmComponentStyleConfig {
|
|
|
167
174
|
showSectionLabels?: boolean;
|
|
168
175
|
/** Sidebar-only: render separator lines between nav item sections. */
|
|
169
176
|
showSectionSeparators?: boolean;
|
|
170
|
-
/** Sidebar-only: expanded width in px (default 240). */
|
|
171
|
-
expandedWidth?: number
|
|
172
|
-
/** Sidebar-only: collapsed width in px (default 64). */
|
|
173
|
-
collapsedWidth?: number
|
|
177
|
+
/** Sidebar-only: expanded width in px (default 240). Supports responsive overrides. */
|
|
178
|
+
expandedWidth?: NajmResponsiveValue<number>;
|
|
179
|
+
/** Sidebar-only: collapsed width in px (default 64). Supports responsive overrides. */
|
|
180
|
+
collapsedWidth?: NajmResponsiveValue<number>;
|
|
181
|
+
/** Sidebar-only: mobile drawer width in px. Defaults to the expanded width. */
|
|
182
|
+
mobileWidth?: NajmResponsiveValue<number>;
|
|
174
183
|
defaultVariant?: string;
|
|
175
184
|
defaultSize?: string;
|
|
176
185
|
density?: NajmDensity;
|
|
@@ -335,8 +344,8 @@ declare const NIcon: React__default.FC<NIconProps>;
|
|
|
335
344
|
|
|
336
345
|
declare const buttonVariants: (props?: {
|
|
337
346
|
variant?: "secondary" | "tertiary" | "destructive" | "default" | "link" | "outline" | "ghost" | "success" | "warning" | "info" | "soft" | "subtle" | "plain";
|
|
338
|
-
size?: "default" | "icon" | "
|
|
339
|
-
rounded?: "none" | "default" | "sm" | "md" | "lg" | "xl" | "
|
|
347
|
+
size?: "default" | "icon" | "sm" | "md" | "lg" | "xl" | "2xl" | "xs" | "2xs" | "icon-xs" | "icon-sm" | "icon-lg" | "icon-xl";
|
|
348
|
+
rounded?: "none" | "default" | "sm" | "md" | "lg" | "xl" | "2xl" | "full";
|
|
340
349
|
fullWidth?: boolean;
|
|
341
350
|
} & class_variance_authority_types.ClassProp) => string;
|
|
342
351
|
type ButtonVariantProps = VariantProps<typeof buttonVariants>;
|
|
@@ -1044,7 +1053,7 @@ type AvatarSize = "xs" | "sm" | "md" | "lg" | "xl" | "2xl";
|
|
|
1044
1053
|
type AvatarShape$1 = "circle" | "rounded" | "square";
|
|
1045
1054
|
type AvatarStatusType = "online" | "offline" | "busy" | "away";
|
|
1046
1055
|
declare const avatarVariants: (props?: {
|
|
1047
|
-
size?: "
|
|
1056
|
+
size?: "sm" | "md" | "lg" | "xl" | "2xl" | "xs";
|
|
1048
1057
|
shape?: "square" | "circle" | "rounded";
|
|
1049
1058
|
ring?: boolean;
|
|
1050
1059
|
} & class_variance_authority_types.ClassProp) => string;
|
|
@@ -1317,15 +1326,33 @@ declare function NCardAction({ children }: {
|
|
|
1317
1326
|
declare namespace NCardAction {
|
|
1318
1327
|
var displayName: string;
|
|
1319
1328
|
}
|
|
1320
|
-
declare function NCardFooter({ children
|
|
1329
|
+
declare function NCardFooter({ children }: {
|
|
1321
1330
|
children: React__default.ReactNode;
|
|
1322
1331
|
className?: string;
|
|
1323
1332
|
}): react_jsx_runtime.JSX.Element;
|
|
1324
1333
|
declare namespace NCardFooter {
|
|
1325
1334
|
var displayName: string;
|
|
1326
1335
|
}
|
|
1336
|
+
type NCardMediaVariant = "image" | "avatar" | "hero";
|
|
1337
|
+
type NCardMediaPlacement = "auto" | "side" | "header" | "top";
|
|
1338
|
+
type NCardMediaSize = "sm" | "md" | "lg" | "xl" | number;
|
|
1339
|
+
type NCardMediaAspect = "square" | "4/3" | "3/2" | "16/9";
|
|
1340
|
+
interface NCardMediaProps extends React__default.HTMLAttributes<HTMLDivElement> {
|
|
1341
|
+
variant?: NCardMediaVariant;
|
|
1342
|
+
/** `auto` uses side-to-top for images, side-to-header for avatars, and top for heroes. */
|
|
1343
|
+
placement?: NCardMediaPlacement;
|
|
1344
|
+
/** Side-media size. Presets are 72, 96, 112, and 128 pixels. */
|
|
1345
|
+
size?: NCardMediaSize;
|
|
1346
|
+
/** Hero aspect ratio. */
|
|
1347
|
+
aspect?: NCardMediaAspect;
|
|
1348
|
+
}
|
|
1349
|
+
declare function NCardMedia({ children }: NCardMediaProps): react_jsx_runtime.JSX.Element;
|
|
1350
|
+
declare namespace NCardMedia {
|
|
1351
|
+
var displayName: string;
|
|
1352
|
+
}
|
|
1327
1353
|
interface CardClassNames {
|
|
1328
1354
|
root?: string;
|
|
1355
|
+
media?: string;
|
|
1329
1356
|
header?: string;
|
|
1330
1357
|
icon?: string;
|
|
1331
1358
|
title?: string;
|
|
@@ -1336,8 +1363,8 @@ interface CardClassNames {
|
|
|
1336
1363
|
interface CardProps {
|
|
1337
1364
|
children?: React__default.ReactNode;
|
|
1338
1365
|
onClick?: () => void;
|
|
1339
|
-
title?:
|
|
1340
|
-
description?:
|
|
1366
|
+
title?: React__default.ReactNode;
|
|
1367
|
+
description?: React__default.ReactNode;
|
|
1341
1368
|
icon?: NIconSource;
|
|
1342
1369
|
iconColor?: string;
|
|
1343
1370
|
loading?: boolean;
|
|
@@ -1353,12 +1380,36 @@ interface CardProps {
|
|
|
1353
1380
|
noPadding?: boolean;
|
|
1354
1381
|
separator?: boolean;
|
|
1355
1382
|
bordered?: boolean;
|
|
1383
|
+
/** Remove the visual surface when NDataCardShell or another parent already owns it. */
|
|
1384
|
+
embedded?: boolean;
|
|
1356
1385
|
className?: string;
|
|
1357
1386
|
classNames?: CardClassNames;
|
|
1358
1387
|
}
|
|
1359
|
-
declare function NCard({ children, title, description, icon, iconColor, loading, error, empty, noData, loadingText, errorText, emptyText, noDataText, skeleton, onRetry, noPadding, separator, bordered, className, classNames, onClick, }: CardProps): react_jsx_runtime.JSX.Element;
|
|
1388
|
+
declare function NCard({ children, title, description, icon, iconColor, loading, error, empty, noData, loadingText, errorText, emptyText, noDataText, skeleton, onRetry, noPadding, separator, bordered, embedded, className, classNames, onClick, }: CardProps): react_jsx_runtime.JSX.Element;
|
|
1360
1389
|
|
|
1361
1390
|
declare function truncateByCharacters(text: string, maxCharacters: number, suffix?: string): string;
|
|
1391
|
+
type NCardDensity = "default" | "compact" | "responsive";
|
|
1392
|
+
type NCardSectionSurface = "soft" | "plain" | "responsive";
|
|
1393
|
+
interface NCardInfoProps extends Omit<React__default.HTMLAttributes<HTMLDivElement>, "children"> {
|
|
1394
|
+
icon?: LucideIcon;
|
|
1395
|
+
label?: React__default.ReactNode;
|
|
1396
|
+
value: React__default.ReactNode;
|
|
1397
|
+
density?: NCardDensity;
|
|
1398
|
+
maxChars?: number;
|
|
1399
|
+
iconClassName?: string;
|
|
1400
|
+
labelClassName?: string;
|
|
1401
|
+
valueClassName?: string;
|
|
1402
|
+
}
|
|
1403
|
+
declare function NCardInfo({ icon: Icon, label, value, density, maxChars, iconClassName, labelClassName, valueClassName, className, ...props }: NCardInfoProps): react_jsx_runtime.JSX.Element;
|
|
1404
|
+
interface NCardSectionProps extends Omit<React__default.HTMLAttributes<HTMLDivElement>, "title"> {
|
|
1405
|
+
icon?: LucideIcon;
|
|
1406
|
+
title?: React__default.ReactNode;
|
|
1407
|
+
density?: NCardDensity;
|
|
1408
|
+
surface?: NCardSectionSurface;
|
|
1409
|
+
iconClassName?: string;
|
|
1410
|
+
titleClassName?: string;
|
|
1411
|
+
}
|
|
1412
|
+
declare function NCardSection({ icon: Icon, title, density, surface, iconClassName, titleClassName, children, className, ...props }: NCardSectionProps): react_jsx_runtime.JSX.Element;
|
|
1362
1413
|
interface NSectionInfoProps {
|
|
1363
1414
|
icon?: LucideIcon;
|
|
1364
1415
|
label: string;
|
|
@@ -3210,10 +3261,11 @@ interface NAppShellClassNames {
|
|
|
3210
3261
|
content?: string;
|
|
3211
3262
|
overlay?: string;
|
|
3212
3263
|
}
|
|
3264
|
+
type SidebarWidth = NajmResponsiveValue<number | string>;
|
|
3213
3265
|
interface SidebarWidths {
|
|
3214
|
-
expanded?:
|
|
3215
|
-
collapsed?:
|
|
3216
|
-
mobile?:
|
|
3266
|
+
expanded?: SidebarWidth;
|
|
3267
|
+
collapsed?: SidebarWidth;
|
|
3268
|
+
mobile?: SidebarWidth;
|
|
3217
3269
|
}
|
|
3218
3270
|
interface SidebarProps {
|
|
3219
3271
|
logo?: ReactNode;
|
|
@@ -3508,4 +3560,4 @@ interface NGridItemProps extends Omit<React$1.AllHTMLAttributes<HTMLDivElement>,
|
|
|
3508
3560
|
declare function NGrid({ as: Comp, children, cols, smCols, mdCols, lgCols, xlCols, gap, className, style, ...props }: NGridProps): react_jsx_runtime.JSX.Element;
|
|
3509
3561
|
declare function NGridItem({ children, span, smSpan, mdSpan, lgSpan, xlSpan, className, ...props }: NGridItemProps): react_jsx_runtime.JSX.Element;
|
|
3510
3562
|
|
|
3511
|
-
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 DialogVariant, 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 FormInputBackground, 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 NDialogActionProps, NDialogDescription, type NDialogDescriptionProps, type NDialogDirectProps, NDialogHeader, type NDialogHeaderProps, NDialogPrimaryButton, type NDialogProps, NDialogSecondaryButton, type NEditorTab, NEditorTabs, type NEditorTabsProps, 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, NGrid, type NGridCols, NGridItem, type NGridItemProps, type NGridProps, type NGridSpan, NIcon, type NIconProps, type NIconSource, NIndicator, NInspectorSheet, NLoadingState, type NLoadingStateProps, NMultiDialog, type NMultiDialogProps, NNavbar, NPageHeader, NPageHeaderActions, type NPageHeaderBreakpoint, NPageHeaderCompactActions, 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, getNextEditorTabValue, 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 };
|
|
3563
|
+
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 DialogVariant, 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 FormInputBackground, 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, type NCardDensity, NCardFooter, NCardInfo, type NCardInfoProps, NCardMedia, type NCardMediaAspect, type NCardMediaPlacement, type NCardMediaProps, type NCardMediaSize, type NCardMediaVariant, type CardProps as NCardProps, NCardSection, type NCardSectionProps, type NCardSectionSurface, 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 NDialogActionProps, NDialogDescription, type NDialogDescriptionProps, type NDialogDirectProps, NDialogHeader, type NDialogHeaderProps, NDialogPrimaryButton, type NDialogProps, NDialogSecondaryButton, type NEditorTab, NEditorTabs, type NEditorTabsProps, 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, NGrid, type NGridCols, NGridItem, type NGridItemProps, type NGridProps, type NGridSpan, NIcon, type NIconProps, type NIconSource, NIndicator, NInspectorSheet, NLoadingState, type NLoadingStateProps, NMultiDialog, type NMultiDialogProps, NNavbar, NPageHeader, NPageHeaderActions, type NPageHeaderBreakpoint, NPageHeaderCompactActions, 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, type NajmResponsiveBreakpoint, type NajmResponsiveValue, 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 SidebarWidth, 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, getNextEditorTabValue, 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
|
@@ -610,6 +610,7 @@ var COMPONENT_KEYS = /* @__PURE__ */ new Set([
|
|
|
610
610
|
"showSectionSeparators",
|
|
611
611
|
"expandedWidth",
|
|
612
612
|
"collapsedWidth",
|
|
613
|
+
"mobileWidth",
|
|
613
614
|
"defaultVariant",
|
|
614
615
|
"defaultSize",
|
|
615
616
|
"density",
|
|
@@ -626,6 +627,7 @@ var VARIANT_KEYS = /* @__PURE__ */ new Set(["use", "className", "tokens"]);
|
|
|
626
627
|
var COMPONENT_NAME_SET = new Set(NAJM_COMPONENT_NAMES);
|
|
627
628
|
var DENSITIES = /* @__PURE__ */ new Set(["compact", "default", "comfortable"]);
|
|
628
629
|
var SCALES = /* @__PURE__ */ new Set(["compact", "default", "comfortable"]);
|
|
630
|
+
var RESPONSIVE_BREAKPOINTS = /* @__PURE__ */ new Set(["base", "sm", "md", "lg", "xl", "2xl"]);
|
|
629
631
|
function isRecord2(value) {
|
|
630
632
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
631
633
|
}
|
|
@@ -647,12 +649,20 @@ function optionalBoolean(value, path) {
|
|
|
647
649
|
}
|
|
648
650
|
return value;
|
|
649
651
|
}
|
|
650
|
-
function
|
|
652
|
+
function optionalResponsiveNumber(value, path) {
|
|
651
653
|
if (value === void 0) return void 0;
|
|
652
|
-
if (typeof value
|
|
653
|
-
|
|
654
|
+
if (typeof value === "number") return value;
|
|
655
|
+
if (!isRecord2(value)) throw new TypeError(`${path} must be a number or breakpoint object`);
|
|
656
|
+
const unknown = Object.keys(value).find((key) => !RESPONSIVE_BREAKPOINTS.has(key));
|
|
657
|
+
if (unknown) throw new TypeError(`Unknown ${path} breakpoint: ${unknown}`);
|
|
658
|
+
const parsed = {};
|
|
659
|
+
for (const [breakpoint, width] of Object.entries(value)) {
|
|
660
|
+
if (typeof width !== "number") {
|
|
661
|
+
throw new TypeError(`${path}.${breakpoint} must be a number`);
|
|
662
|
+
}
|
|
663
|
+
parsed[breakpoint] = width;
|
|
654
664
|
}
|
|
655
|
-
return
|
|
665
|
+
return parsed;
|
|
656
666
|
}
|
|
657
667
|
function optionalEnum2(value, values, path) {
|
|
658
668
|
if (value === void 0) return void 0;
|
|
@@ -714,8 +724,9 @@ function parseComponentStyle(value, path) {
|
|
|
714
724
|
const card = optionalBoolean(value.card, `${path}.card`);
|
|
715
725
|
const showSectionLabels = optionalBoolean(value.showSectionLabels, `${path}.showSectionLabels`);
|
|
716
726
|
const showSectionSeparators = optionalBoolean(value.showSectionSeparators, `${path}.showSectionSeparators`);
|
|
717
|
-
const expandedWidth =
|
|
718
|
-
const collapsedWidth =
|
|
727
|
+
const expandedWidth = optionalResponsiveNumber(value.expandedWidth, `${path}.expandedWidth`);
|
|
728
|
+
const collapsedWidth = optionalResponsiveNumber(value.collapsedWidth, `${path}.collapsedWidth`);
|
|
729
|
+
const mobileWidth = optionalResponsiveNumber(value.mobileWidth, `${path}.mobileWidth`);
|
|
719
730
|
const defaultVariant = optionalString2(value.defaultVariant, `${path}.defaultVariant`);
|
|
720
731
|
const defaultSize = optionalString2(value.defaultSize, `${path}.defaultSize`);
|
|
721
732
|
const density = optionalEnum2(value.density, DENSITIES, `${path}.density`);
|
|
@@ -729,6 +740,7 @@ function parseComponentStyle(value, path) {
|
|
|
729
740
|
if (showSectionSeparators !== void 0) cfg.showSectionSeparators = showSectionSeparators;
|
|
730
741
|
if (expandedWidth !== void 0) cfg.expandedWidth = expandedWidth;
|
|
731
742
|
if (collapsedWidth !== void 0) cfg.collapsedWidth = collapsedWidth;
|
|
743
|
+
if (mobileWidth !== void 0) cfg.mobileWidth = mobileWidth;
|
|
732
744
|
if (defaultVariant !== void 0) cfg.defaultVariant = defaultVariant;
|
|
733
745
|
if (defaultSize !== void 0) cfg.defaultSize = defaultSize;
|
|
734
746
|
if (density !== void 0) cfg.density = density;
|
|
@@ -1987,7 +1999,7 @@ var IconButton = React.forwardRef(
|
|
|
1987
1999
|
);
|
|
1988
2000
|
IconButton.displayName = "IconButton";
|
|
1989
2001
|
function NPageHeaderActions({ children, className }) {
|
|
1990
|
-
return /* @__PURE__ */ jsx("div", { className: cn("flex shrink-0 items-center gap-2
|
|
2002
|
+
return /* @__PURE__ */ jsx("div", { className: cn("flex shrink-0 items-center gap-0 lg:gap-1 xl:gap-2 2xl:gap-2", className), children });
|
|
1991
2003
|
}
|
|
1992
2004
|
NPageHeaderActions.displayName = "NPageHeaderActions";
|
|
1993
2005
|
function NPageHeaderCompactActions({ children, className }) {
|
|
@@ -1995,7 +2007,7 @@ function NPageHeaderCompactActions({ children, className }) {
|
|
|
1995
2007
|
}
|
|
1996
2008
|
NPageHeaderCompactActions.displayName = "NPageHeaderCompactActions";
|
|
1997
2009
|
function NPageHeaderFilters({ children, className }) {
|
|
1998
|
-
return /* @__PURE__ */ jsx("div", { className: cn("py-3 lg:px-
|
|
2010
|
+
return /* @__PURE__ */ jsx("div", { className: cn("py-3 lg:px-3 xl:px-4 2xl:px-5", className), children });
|
|
1999
2011
|
}
|
|
2000
2012
|
NPageHeaderFilters.displayName = "NPageHeaderFilters";
|
|
2001
2013
|
function NPageHeaderTop({ children, className }) {
|
|
@@ -2104,7 +2116,7 @@ function NPageHeader({
|
|
|
2104
2116
|
{
|
|
2105
2117
|
"data-slot": "page-header-main",
|
|
2106
2118
|
className: cn(
|
|
2107
|
-
"relative grid min-h-12 grid-cols-[minmax(2.75rem,1fr)_minmax(0,auto)_minmax(2.75rem,1fr)] items-center gap-2 lg:px-
|
|
2119
|
+
"relative grid min-h-12 grid-cols-[minmax(2.75rem,1fr)_minmax(0,auto)_minmax(2.75rem,1fr)] items-center gap-2 lg:px-3 xl:px-4 2xl:px-5",
|
|
2108
2120
|
breakpointClasses.main,
|
|
2109
2121
|
breakpointClasses.minH,
|
|
2110
2122
|
headerClassName
|
|
@@ -2132,7 +2144,7 @@ function NPageHeader({
|
|
|
2132
2144
|
{
|
|
2133
2145
|
"data-slot": "page-header-identity",
|
|
2134
2146
|
className: cn(
|
|
2135
|
-
"col-start-2 row-start-1 flex min-w-0 max-w-full items-center justify-self-center gap-3",
|
|
2147
|
+
"col-start-2 row-start-1 flex min-w-0 max-w-full items-center justify-self-center gap-2 lg:gap-3 xl:gap-3 2xl:gap-4",
|
|
2136
2148
|
breakpointClasses.identity
|
|
2137
2149
|
),
|
|
2138
2150
|
children: [
|
|
@@ -5037,10 +5049,49 @@ function NCardAction({ children }) {
|
|
|
5037
5049
|
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
5038
5050
|
}
|
|
5039
5051
|
NCardAction.displayName = "NCardAction";
|
|
5040
|
-
function NCardFooter({ children
|
|
5052
|
+
function NCardFooter({ children }) {
|
|
5041
5053
|
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
5042
5054
|
}
|
|
5043
5055
|
NCardFooter.displayName = "NCardFooter";
|
|
5056
|
+
function NCardMedia({ children }) {
|
|
5057
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
5058
|
+
}
|
|
5059
|
+
NCardMedia.displayName = "NCardMedia";
|
|
5060
|
+
var CARD_MEDIA_SIZE = {
|
|
5061
|
+
sm: 72,
|
|
5062
|
+
md: 96,
|
|
5063
|
+
lg: 112,
|
|
5064
|
+
xl: 128
|
|
5065
|
+
};
|
|
5066
|
+
var CARD_MEDIA_ASPECT = {
|
|
5067
|
+
square: "aspect-square",
|
|
5068
|
+
"4/3": "aspect-[4/3]",
|
|
5069
|
+
"3/2": "aspect-[3/2]",
|
|
5070
|
+
"16/9": "aspect-video"
|
|
5071
|
+
};
|
|
5072
|
+
function resolveMediaLayout(variant, placement) {
|
|
5073
|
+
if (placement !== "auto") return placement;
|
|
5074
|
+
if (variant === "hero") return "top";
|
|
5075
|
+
return variant === "avatar" ? "responsive-avatar" : "responsive-image";
|
|
5076
|
+
}
|
|
5077
|
+
function getMediaHtmlProps(props) {
|
|
5078
|
+
const htmlProps = { ...props };
|
|
5079
|
+
delete htmlProps.children;
|
|
5080
|
+
delete htmlProps.variant;
|
|
5081
|
+
delete htmlProps.placement;
|
|
5082
|
+
delete htmlProps.size;
|
|
5083
|
+
delete htmlProps.aspect;
|
|
5084
|
+
return htmlProps;
|
|
5085
|
+
}
|
|
5086
|
+
function mediaRootClasses(layout) {
|
|
5087
|
+
if (layout === "top") return "flex flex-col gap-0 overflow-hidden p-0";
|
|
5088
|
+
if (layout === "side") return "grid grid-cols-[auto_minmax(0,1fr)] gap-3 p-3";
|
|
5089
|
+
if (layout === "header") return "grid grid-cols-[auto_minmax(0,1fr)] gap-3 p-3";
|
|
5090
|
+
if (layout === "responsive-avatar") {
|
|
5091
|
+
return "grid grid-cols-[auto_minmax(0,1fr)] gap-3 p-3 sm:p-4";
|
|
5092
|
+
}
|
|
5093
|
+
return "grid grid-cols-[auto_minmax(0,1fr)] gap-3 p-3 sm:flex sm:flex-col sm:p-4";
|
|
5094
|
+
}
|
|
5044
5095
|
function NCard({
|
|
5045
5096
|
children,
|
|
5046
5097
|
title,
|
|
@@ -5060,6 +5111,7 @@ function NCard({
|
|
|
5060
5111
|
noPadding = false,
|
|
5061
5112
|
separator = false,
|
|
5062
5113
|
bordered,
|
|
5114
|
+
embedded = false,
|
|
5063
5115
|
className,
|
|
5064
5116
|
classNames,
|
|
5065
5117
|
onClick
|
|
@@ -5068,61 +5120,183 @@ function NCard({
|
|
|
5068
5120
|
const resolvedEmptyText = emptyText ?? noDataText ?? "No data available";
|
|
5069
5121
|
const recipe = useNajmComponentStyle("card");
|
|
5070
5122
|
const recipeRadius = resolveRadiusValue(recipe?.radius);
|
|
5071
|
-
const recipeStyle = recipeRadius || recipe?.borderWidth ? {
|
|
5123
|
+
const recipeStyle = !embedded && (recipeRadius || recipe?.borderWidth) ? {
|
|
5072
5124
|
...recipeRadius ? { borderRadius: recipeRadius } : {},
|
|
5073
5125
|
...recipe?.borderWidth ? { borderWidth: recipe.borderWidth } : {}
|
|
5074
5126
|
} : void 0;
|
|
5075
5127
|
let actionSlot = null;
|
|
5076
5128
|
let footerSlot = null;
|
|
5129
|
+
let footerClassName;
|
|
5130
|
+
let mediaSlot = null;
|
|
5077
5131
|
const mainChildren = [];
|
|
5078
5132
|
React__default.Children.forEach(children, (child) => {
|
|
5079
|
-
if (React__default.isValidElement(child)) {
|
|
5080
|
-
|
|
5081
|
-
|
|
5082
|
-
|
|
5083
|
-
|
|
5084
|
-
|
|
5085
|
-
|
|
5086
|
-
|
|
5133
|
+
if (!React__default.isValidElement(child)) {
|
|
5134
|
+
mainChildren.push(child);
|
|
5135
|
+
return;
|
|
5136
|
+
}
|
|
5137
|
+
if (child.type === NCardAction) {
|
|
5138
|
+
actionSlot = child.props.children;
|
|
5139
|
+
} else if (child.type === NCardFooter) {
|
|
5140
|
+
const footer = child.props;
|
|
5141
|
+
footerSlot = footer.children;
|
|
5142
|
+
footerClassName = footer.className;
|
|
5143
|
+
} else if (child.type === NCardMedia) {
|
|
5144
|
+
mediaSlot = child;
|
|
5087
5145
|
} else {
|
|
5088
5146
|
mainChildren.push(child);
|
|
5089
5147
|
}
|
|
5090
5148
|
});
|
|
5091
|
-
const
|
|
5149
|
+
const mediaVariant = mediaSlot?.props.variant ?? "image";
|
|
5150
|
+
const mediaPlacement = mediaSlot?.props.placement ?? "auto";
|
|
5151
|
+
const mediaLayout = mediaSlot ? resolveMediaLayout(mediaVariant, mediaPlacement) : null;
|
|
5152
|
+
const mediaSize = mediaSlot?.props.size ?? "md";
|
|
5153
|
+
const resolvedMediaSize = typeof mediaSize === "number" ? mediaSize : CARD_MEDIA_SIZE[mediaSize];
|
|
5154
|
+
const mediaAspect = mediaSlot?.props.aspect ?? "4/3";
|
|
5155
|
+
const mediaHtmlProps = mediaSlot ? getMediaHtmlProps(mediaSlot.props) : {};
|
|
5156
|
+
const hasHeader = Boolean(title || description || actionSlot);
|
|
5092
5157
|
const iconSize = description ? "h-6 w-6 lg:h-8 lg:w-8" : "h-4 w-4 lg:h-5 lg:w-5";
|
|
5158
|
+
const mediaStyle = mediaSlot ? {
|
|
5159
|
+
...mediaSlot.props.style,
|
|
5160
|
+
"--n-card-media-size": `${resolvedMediaSize}px`
|
|
5161
|
+
} : void 0;
|
|
5162
|
+
const sideBody = mediaLayout === "side";
|
|
5163
|
+
const headerBody = mediaLayout === "header";
|
|
5164
|
+
const responsiveAvatarBody = mediaLayout === "responsive-avatar";
|
|
5165
|
+
const responsiveImageBody = mediaLayout === "responsive-image";
|
|
5166
|
+
const topBody = mediaLayout === "top";
|
|
5167
|
+
const compactSideBody = sideBody || responsiveAvatarBody || responsiveImageBody;
|
|
5093
5168
|
return /* @__PURE__ */ jsxs(
|
|
5094
5169
|
Card,
|
|
5095
5170
|
{
|
|
5096
|
-
"data-bordered": bordered === false ? "false" : bordered ? "true" : void 0,
|
|
5171
|
+
"data-bordered": embedded || bordered === false ? "false" : bordered ? "true" : void 0,
|
|
5172
|
+
"data-embedded": embedded ? "true" : void 0,
|
|
5173
|
+
"data-media-layout": mediaLayout ?? void 0,
|
|
5174
|
+
"data-media-variant": mediaSlot ? mediaVariant : void 0,
|
|
5097
5175
|
onClick,
|
|
5098
5176
|
style: recipeStyle,
|
|
5099
5177
|
className: cn(
|
|
5100
|
-
"flex flex-col",
|
|
5101
|
-
!noPadding && "p-2 lg:p-
|
|
5102
|
-
|
|
5178
|
+
mediaLayout ? mediaRootClasses(mediaLayout) : "flex flex-col",
|
|
5179
|
+
!mediaLayout && !noPadding && "p-2 lg:p-3 xl:p-4 2xl:p-5 gap-3",
|
|
5180
|
+
mediaLayout && noPadding && "p-0",
|
|
5181
|
+
embedded && "rounded-none bg-transparent shadow-none",
|
|
5182
|
+
surfaceBorderClasses(embedded ? false : bordered),
|
|
5103
5183
|
classNames?.root,
|
|
5104
5184
|
className
|
|
5105
5185
|
),
|
|
5106
5186
|
children: [
|
|
5107
|
-
|
|
5108
|
-
|
|
5109
|
-
icon && /* @__PURE__ */ jsx(NIcon, { icon, className: cn(iconSize, "shrink-0 text-muted-foreground", iconColor, classNames?.icon) }),
|
|
5110
|
-
/* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
|
|
5111
|
-
title && /* @__PURE__ */ jsx(CardTitle, { className: cn("text-sm lg:text-base leading-snug", classNames?.title), children: title }),
|
|
5112
|
-
description && /* @__PURE__ */ jsx(CardDescription, { className: cn("text-xs mt-0.5", classNames?.description), children: description })
|
|
5113
|
-
] })
|
|
5114
|
-
] }),
|
|
5115
|
-
actionSlot && /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2 shrink-0 ml-2", children: actionSlot })
|
|
5116
|
-
] }),
|
|
5117
|
-
hasHeader && separator && /* @__PURE__ */ jsx("div", { className: "border-t border-border" }),
|
|
5118
|
-
/* @__PURE__ */ jsx(CardContent, { className: cn("flex flex-col flex-1 m-0 p-0", classNames?.content), children: loading && skeleton ? skeleton : loading ? /* @__PURE__ */ jsx(NLoadingState, { label: loadingText }) : error ? /* @__PURE__ */ jsx(
|
|
5119
|
-
NErrorState,
|
|
5187
|
+
mediaSlot ? /* @__PURE__ */ jsx(
|
|
5188
|
+
"div",
|
|
5120
5189
|
{
|
|
5121
|
-
|
|
5122
|
-
|
|
5190
|
+
...mediaHtmlProps,
|
|
5191
|
+
"data-slot": "card-media",
|
|
5192
|
+
"data-placement": mediaPlacement,
|
|
5193
|
+
"data-variant": mediaVariant,
|
|
5194
|
+
"data-size": mediaSize,
|
|
5195
|
+
style: mediaStyle,
|
|
5196
|
+
className: cn(
|
|
5197
|
+
mediaVariant !== "avatar" && "relative overflow-hidden bg-muted",
|
|
5198
|
+
mediaVariant === "image" && "col-start-1 row-start-1 size-[var(--n-card-media-size)] self-start rounded-lg",
|
|
5199
|
+
mediaVariant === "image" && responsiveImageBody && "sm:h-40 sm:w-full sm:shrink-0",
|
|
5200
|
+
mediaVariant === "avatar" && "col-start-1 row-start-1 flex w-[var(--n-card-media-size)] items-start justify-center",
|
|
5201
|
+
mediaVariant === "avatar" && (headerBody || responsiveAvatarBody || topBody) && "sm:justify-start",
|
|
5202
|
+
mediaVariant === "hero" && cn("w-full", CARD_MEDIA_ASPECT[mediaAspect]),
|
|
5203
|
+
mediaLayout === "top" && mediaVariant === "image" && "h-40 w-full rounded-none",
|
|
5204
|
+
classNames?.media,
|
|
5205
|
+
mediaSlot.props.className
|
|
5206
|
+
),
|
|
5207
|
+
children: mediaSlot.props.children
|
|
5208
|
+
}
|
|
5209
|
+
) : null,
|
|
5210
|
+
/* @__PURE__ */ jsxs(
|
|
5211
|
+
"div",
|
|
5212
|
+
{
|
|
5213
|
+
"data-slot": "card-body",
|
|
5214
|
+
className: cn(
|
|
5215
|
+
compactSideBody ? "col-start-2 row-start-1 flex min-w-0 flex-col gap-2 self-start" : "contents",
|
|
5216
|
+
(responsiveAvatarBody || responsiveImageBody) && "sm:contents"
|
|
5217
|
+
),
|
|
5218
|
+
children: [
|
|
5219
|
+
hasHeader ? /* @__PURE__ */ jsxs(
|
|
5220
|
+
CardHeader,
|
|
5221
|
+
{
|
|
5222
|
+
className: cn(
|
|
5223
|
+
"flex min-w-0 flex-row items-center justify-between space-y-0 p-0",
|
|
5224
|
+
mediaLayout && "col-start-2 row-start-1",
|
|
5225
|
+
responsiveImageBody && "sm:col-auto sm:row-auto",
|
|
5226
|
+
topBody && "p-4 pb-0",
|
|
5227
|
+
classNames?.header
|
|
5228
|
+
),
|
|
5229
|
+
children: [
|
|
5230
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
5231
|
+
icon ? /* @__PURE__ */ jsx(
|
|
5232
|
+
NIcon,
|
|
5233
|
+
{
|
|
5234
|
+
icon,
|
|
5235
|
+
className: cn(iconSize, "shrink-0 text-muted-foreground", iconColor, classNames?.icon)
|
|
5236
|
+
}
|
|
5237
|
+
) : null,
|
|
5238
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
|
|
5239
|
+
title ? /* @__PURE__ */ jsx(CardTitle, { className: cn("truncate text-sm leading-snug lg:text-base", classNames?.title), children: title }) : null,
|
|
5240
|
+
description ? /* @__PURE__ */ jsx(CardDescription, { className: cn("mt-0.5 text-xs", classNames?.description), children: description }) : null
|
|
5241
|
+
] })
|
|
5242
|
+
] }),
|
|
5243
|
+
actionSlot ? /* @__PURE__ */ jsx("div", { className: "ml-2 flex shrink-0 items-center gap-2", children: actionSlot }) : null
|
|
5244
|
+
]
|
|
5245
|
+
}
|
|
5246
|
+
) : null,
|
|
5247
|
+
hasHeader && separator ? /* @__PURE__ */ jsx(
|
|
5248
|
+
"div",
|
|
5249
|
+
{
|
|
5250
|
+
className: cn(
|
|
5251
|
+
"border-t border-border",
|
|
5252
|
+
sideBody && "col-start-2",
|
|
5253
|
+
headerBody && "col-span-full",
|
|
5254
|
+
responsiveAvatarBody && "col-start-2 sm:col-span-full",
|
|
5255
|
+
responsiveImageBody && "col-start-2 sm:col-auto",
|
|
5256
|
+
topBody && "mx-4"
|
|
5257
|
+
)
|
|
5258
|
+
}
|
|
5259
|
+
) : null,
|
|
5260
|
+
/* @__PURE__ */ jsx(
|
|
5261
|
+
CardContent,
|
|
5262
|
+
{
|
|
5263
|
+
className: cn(
|
|
5264
|
+
"m-0 flex min-w-0 flex-1 flex-col gap-2 p-0",
|
|
5265
|
+
sideBody && "col-start-2",
|
|
5266
|
+
headerBody && "col-span-full",
|
|
5267
|
+
responsiveAvatarBody && "col-start-2 sm:col-span-full",
|
|
5268
|
+
responsiveImageBody && "col-start-2 sm:col-auto",
|
|
5269
|
+
topBody && "p-4",
|
|
5270
|
+
classNames?.content
|
|
5271
|
+
),
|
|
5272
|
+
children: loading && skeleton ? skeleton : loading ? /* @__PURE__ */ jsx(NLoadingState, { label: loadingText }) : error ? /* @__PURE__ */ jsx(
|
|
5273
|
+
NErrorState,
|
|
5274
|
+
{
|
|
5275
|
+
message: typeof error === "string" ? error : errorText ?? "Something went wrong",
|
|
5276
|
+
onRetry
|
|
5277
|
+
}
|
|
5278
|
+
) : isEmpty ? /* @__PURE__ */ jsx(NEmptyState, { title: resolvedEmptyText }) : mainChildren
|
|
5279
|
+
}
|
|
5280
|
+
),
|
|
5281
|
+
footerSlot ? /* @__PURE__ */ jsx(
|
|
5282
|
+
CardFooter,
|
|
5283
|
+
{
|
|
5284
|
+
className: cn(
|
|
5285
|
+
"mt-auto p-0 pt-3",
|
|
5286
|
+
sideBody && "col-start-2",
|
|
5287
|
+
headerBody && "col-span-full",
|
|
5288
|
+
responsiveAvatarBody && "col-start-2 sm:col-span-full",
|
|
5289
|
+
responsiveImageBody && "col-start-2 sm:col-auto",
|
|
5290
|
+
topBody && "border-t border-border p-4",
|
|
5291
|
+
classNames?.footer,
|
|
5292
|
+
footerClassName
|
|
5293
|
+
),
|
|
5294
|
+
children: footerSlot
|
|
5295
|
+
}
|
|
5296
|
+
) : null
|
|
5297
|
+
]
|
|
5123
5298
|
}
|
|
5124
|
-
)
|
|
5125
|
-
footerSlot && /* @__PURE__ */ jsx(CardFooter, { className: cn("p-0 pt-3 border-t border-border mt-auto", classNames?.footer), children: footerSlot })
|
|
5299
|
+
)
|
|
5126
5300
|
]
|
|
5127
5301
|
}
|
|
5128
5302
|
);
|
|
@@ -5132,6 +5306,115 @@ function truncateByCharacters(text, maxCharacters, suffix = "...") {
|
|
|
5132
5306
|
const str = String(text);
|
|
5133
5307
|
return str.length <= maxCharacters ? str : str.slice(0, maxCharacters) + suffix;
|
|
5134
5308
|
}
|
|
5309
|
+
var CardDensityContext = React__default.createContext("default");
|
|
5310
|
+
function NCardInfo({
|
|
5311
|
+
icon: Icon2,
|
|
5312
|
+
label,
|
|
5313
|
+
value,
|
|
5314
|
+
density,
|
|
5315
|
+
maxChars = 30,
|
|
5316
|
+
iconClassName,
|
|
5317
|
+
labelClassName,
|
|
5318
|
+
valueClassName,
|
|
5319
|
+
className,
|
|
5320
|
+
...props
|
|
5321
|
+
}) {
|
|
5322
|
+
const inheritedDensity = React__default.useContext(CardDensityContext);
|
|
5323
|
+
const resolvedDensity = density ?? inheritedDensity;
|
|
5324
|
+
const isTruncated = typeof value === "string" && value.length > maxChars;
|
|
5325
|
+
const displayValue = isTruncated ? truncateByCharacters(value, maxChars) : value;
|
|
5326
|
+
const valueNode = /* @__PURE__ */ jsx(
|
|
5327
|
+
"span",
|
|
5328
|
+
{
|
|
5329
|
+
"data-slot": "card-info-value",
|
|
5330
|
+
className: cn("min-w-0 truncate text-foreground", isTruncated && "cursor-help", valueClassName),
|
|
5331
|
+
children: displayValue
|
|
5332
|
+
}
|
|
5333
|
+
);
|
|
5334
|
+
return /* @__PURE__ */ jsxs(
|
|
5335
|
+
"div",
|
|
5336
|
+
{
|
|
5337
|
+
"data-slot": "card-info",
|
|
5338
|
+
"data-density": resolvedDensity,
|
|
5339
|
+
className: cn(
|
|
5340
|
+
"flex min-w-0 items-center",
|
|
5341
|
+
resolvedDensity === "default" && "gap-2 text-sm",
|
|
5342
|
+
resolvedDensity === "compact" && "gap-1.5 text-xs",
|
|
5343
|
+
resolvedDensity === "responsive" && "gap-1.5 text-xs sm:gap-2 sm:text-sm",
|
|
5344
|
+
className
|
|
5345
|
+
),
|
|
5346
|
+
...props,
|
|
5347
|
+
children: [
|
|
5348
|
+
Icon2 ? /* @__PURE__ */ jsx(
|
|
5349
|
+
Icon2,
|
|
5350
|
+
{
|
|
5351
|
+
"aria-hidden": "true",
|
|
5352
|
+
"data-slot": "card-info-icon",
|
|
5353
|
+
className: cn(
|
|
5354
|
+
"shrink-0 text-muted-foreground",
|
|
5355
|
+
resolvedDensity === "default" && "size-4",
|
|
5356
|
+
resolvedDensity === "compact" && "size-3.5",
|
|
5357
|
+
resolvedDensity === "responsive" && "size-3.5 sm:size-4",
|
|
5358
|
+
iconClassName
|
|
5359
|
+
)
|
|
5360
|
+
}
|
|
5361
|
+
) : null,
|
|
5362
|
+
label ? /* @__PURE__ */ jsxs(
|
|
5363
|
+
"span",
|
|
5364
|
+
{
|
|
5365
|
+
"data-slot": "card-info-label",
|
|
5366
|
+
className: cn("shrink-0 text-muted-foreground", labelClassName),
|
|
5367
|
+
children: [
|
|
5368
|
+
label,
|
|
5369
|
+
":"
|
|
5370
|
+
]
|
|
5371
|
+
}
|
|
5372
|
+
) : null,
|
|
5373
|
+
isTruncated ? /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
5374
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: valueNode }),
|
|
5375
|
+
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { className: "max-w-xs", children: value }) })
|
|
5376
|
+
] }) : valueNode
|
|
5377
|
+
]
|
|
5378
|
+
}
|
|
5379
|
+
);
|
|
5380
|
+
}
|
|
5381
|
+
function NCardSection({
|
|
5382
|
+
icon: Icon2,
|
|
5383
|
+
title,
|
|
5384
|
+
density = "responsive",
|
|
5385
|
+
surface = "responsive",
|
|
5386
|
+
iconClassName,
|
|
5387
|
+
titleClassName,
|
|
5388
|
+
children,
|
|
5389
|
+
className,
|
|
5390
|
+
...props
|
|
5391
|
+
}) {
|
|
5392
|
+
return /* @__PURE__ */ jsx(CardDensityContext.Provider, { value: density, children: /* @__PURE__ */ jsxs(
|
|
5393
|
+
"div",
|
|
5394
|
+
{
|
|
5395
|
+
"data-slot": "card-section",
|
|
5396
|
+
"data-density": density,
|
|
5397
|
+
"data-surface": surface,
|
|
5398
|
+
className: cn(
|
|
5399
|
+
density === "default" && "space-y-2",
|
|
5400
|
+
density === "compact" && "space-y-1",
|
|
5401
|
+
density === "responsive" && "space-y-1 sm:space-y-2",
|
|
5402
|
+
surface === "soft" && "rounded-lg bg-muted/50 p-3",
|
|
5403
|
+
surface === "plain" && "bg-transparent p-0",
|
|
5404
|
+
surface === "responsive" && "bg-transparent p-0 sm:rounded-lg sm:bg-muted/50 sm:p-3",
|
|
5405
|
+
className
|
|
5406
|
+
),
|
|
5407
|
+
...props,
|
|
5408
|
+
children: [
|
|
5409
|
+
Icon2 || title ? /* @__PURE__ */ jsxs("div", { className: "mb-2 flex items-center gap-2", children: [
|
|
5410
|
+
Icon2 ? /* @__PURE__ */ jsx(Icon2, { "aria-hidden": "true", className: cn("size-4 text-muted-foreground", iconClassName) }) : null,
|
|
5411
|
+
title ? /* @__PURE__ */ jsx("div", { className: cn("text-sm font-medium text-foreground", titleClassName), children: title }) : null
|
|
5412
|
+
] }) : null,
|
|
5413
|
+
children
|
|
5414
|
+
]
|
|
5415
|
+
}
|
|
5416
|
+
) });
|
|
5417
|
+
}
|
|
5135
5418
|
function NSectionInfo({
|
|
5136
5419
|
icon: Icon2,
|
|
5137
5420
|
label = "",
|
|
@@ -5298,26 +5581,26 @@ function DefaultCard({
|
|
|
5298
5581
|
onClick,
|
|
5299
5582
|
bordered,
|
|
5300
5583
|
className: cn(
|
|
5301
|
-
"group p-2 lg:p-
|
|
5584
|
+
"group p-2 lg:p-3 xl:p-4 2xl:p-5 transition-colors",
|
|
5302
5585
|
onClick && "cursor-pointer hover:border-border/60 hover:bg-accent/40",
|
|
5303
5586
|
className
|
|
5304
5587
|
),
|
|
5305
5588
|
classNames: {
|
|
5306
5589
|
root: classNames?.root,
|
|
5307
|
-
content: "flex-row items-center gap-4"
|
|
5590
|
+
content: "flex-row items-center gap-2 lg:gap-3 xl:gap-3 2xl:gap-4"
|
|
5308
5591
|
},
|
|
5309
5592
|
children: [
|
|
5310
5593
|
/* @__PURE__ */ jsx(
|
|
5311
5594
|
"div",
|
|
5312
5595
|
{
|
|
5313
5596
|
className: cn(
|
|
5314
|
-
"flex h-8 w-8 lg:h-9 lg:w-9 shrink-0 items-center justify-center rounded-xl bg-primary/10 text-primary transition-colors group-hover:bg-primary/20",
|
|
5597
|
+
"flex h-8 w-8 lg:h-9 lg:w-9 2xl:h-10 2xl:w-10 shrink-0 items-center justify-center rounded-xl bg-primary/10 text-primary transition-colors group-hover:bg-primary/20",
|
|
5315
5598
|
classNames?.icon
|
|
5316
5599
|
),
|
|
5317
5600
|
children: /* @__PURE__ */ jsx(NIcon, { icon, className: "w-4 h-4 lg:w-5 lg:h-5 2xl:w-6 2xl:h-6" })
|
|
5318
5601
|
}
|
|
5319
5602
|
),
|
|
5320
|
-
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
|
|
5603
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-0 2xl:gap-1", children: [
|
|
5321
5604
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
5322
5605
|
label && /* @__PURE__ */ jsx("p", { className: cn("truncate text-xs text-muted-foreground", classNames?.label), children: label }),
|
|
5323
5606
|
change && /* @__PURE__ */ jsxs(
|
|
@@ -5422,7 +5705,7 @@ function CompactCard({ icon, label, value, unit, iconColor, onClick, bordered, c
|
|
|
5422
5705
|
),
|
|
5423
5706
|
classNames: {
|
|
5424
5707
|
root: classNames?.root,
|
|
5425
|
-
content: "flex-row items-center gap-2
|
|
5708
|
+
content: "flex-row items-center gap-2"
|
|
5426
5709
|
},
|
|
5427
5710
|
children: [
|
|
5428
5711
|
/* @__PURE__ */ jsx(
|
|
@@ -11071,6 +11354,42 @@ var autoCollapseQueries = {
|
|
|
11071
11354
|
lg: "(min-width: 1024px) and (max-width: 1279.98px)",
|
|
11072
11355
|
xl: "(min-width: 1280px) and (max-width: 1535.98px)"
|
|
11073
11356
|
};
|
|
11357
|
+
var responsiveBreakpointQueries = {
|
|
11358
|
+
sm: "(min-width: 640px)",
|
|
11359
|
+
md: "(min-width: 768px)",
|
|
11360
|
+
lg: "(min-width: 1024px)",
|
|
11361
|
+
xl: "(min-width: 1280px)",
|
|
11362
|
+
"2xl": "(min-width: 1536px)"
|
|
11363
|
+
};
|
|
11364
|
+
function useSidebarResponsiveBreakpoint() {
|
|
11365
|
+
const [breakpoint, setBreakpoint] = useState("base");
|
|
11366
|
+
useEffect(() => {
|
|
11367
|
+
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
|
|
11368
|
+
const mediaQueries = Object.entries(responsiveBreakpointQueries).map(([name, query]) => ({
|
|
11369
|
+
name,
|
|
11370
|
+
mediaQuery: window.matchMedia(query)
|
|
11371
|
+
}));
|
|
11372
|
+
const update = () => {
|
|
11373
|
+
const active = [...mediaQueries].reverse().find(({ mediaQuery }) => mediaQuery.matches);
|
|
11374
|
+
setBreakpoint(active?.name ?? "base");
|
|
11375
|
+
};
|
|
11376
|
+
update();
|
|
11377
|
+
mediaQueries.forEach(({ mediaQuery }) => mediaQuery.addEventListener?.("change", update));
|
|
11378
|
+
return () => mediaQueries.forEach(({ mediaQuery }) => mediaQuery.removeEventListener?.("change", update));
|
|
11379
|
+
}, []);
|
|
11380
|
+
return breakpoint;
|
|
11381
|
+
}
|
|
11382
|
+
function resolveSidebarWidth(value, breakpoint, fallback) {
|
|
11383
|
+
if (value === void 0) return fallback;
|
|
11384
|
+
if (typeof value === "number" || typeof value === "string") return value;
|
|
11385
|
+
const breakpoints = ["base", "sm", "md", "lg", "xl", "2xl"];
|
|
11386
|
+
const activeIndex = breakpoints.indexOf(breakpoint);
|
|
11387
|
+
for (let index = activeIndex; index >= 0; index -= 1) {
|
|
11388
|
+
const width = value[breakpoints[index]];
|
|
11389
|
+
if (width !== void 0) return width;
|
|
11390
|
+
}
|
|
11391
|
+
return fallback;
|
|
11392
|
+
}
|
|
11074
11393
|
function useAutoCollapsed(breakpoint) {
|
|
11075
11394
|
const [matches, setMatches] = useState(false);
|
|
11076
11395
|
useEffect(() => {
|
|
@@ -11190,9 +11509,22 @@ function NSidebar({
|
|
|
11190
11509
|
}, [onNavigate, closeOnNavigate]);
|
|
11191
11510
|
const groups = useMemo(() => buildGroups(navItems), [navItems]);
|
|
11192
11511
|
const desktopClass = mobileBreakpoint === "sm" ? "hidden sm:flex" : mobileBreakpoint === "lg" ? "hidden lg:flex" : "hidden md:flex";
|
|
11193
|
-
const
|
|
11194
|
-
const
|
|
11195
|
-
|
|
11512
|
+
const responsiveBreakpoint = useSidebarResponsiveBreakpoint();
|
|
11513
|
+
const expandedWidth = resolveSidebarWidth(
|
|
11514
|
+
widths?.expanded ?? recipe?.expandedWidth,
|
|
11515
|
+
responsiveBreakpoint,
|
|
11516
|
+
240
|
|
11517
|
+
);
|
|
11518
|
+
const collapsedWidth = resolveSidebarWidth(
|
|
11519
|
+
widths?.collapsed ?? recipe?.collapsedWidth,
|
|
11520
|
+
responsiveBreakpoint,
|
|
11521
|
+
64
|
|
11522
|
+
);
|
|
11523
|
+
const mobileWidth = resolveSidebarWidth(
|
|
11524
|
+
widths?.mobile ?? recipe?.mobileWidth,
|
|
11525
|
+
responsiveBreakpoint,
|
|
11526
|
+
expandedWidth
|
|
11527
|
+
);
|
|
11196
11528
|
const railVar = typeof collapsedWidth === "number" ? `${collapsedWidth}px` : collapsedWidth;
|
|
11197
11529
|
const sidebarEdgeWidth = bordered === false ? "0px" : recipe?.borderWidth ?? "var(--border-width, 1px)";
|
|
11198
11530
|
const showEdgeCollapse = showCollapseButton && collapseButtonPosition === "edge" && !autoCollapsed;
|
|
@@ -11639,4 +11971,4 @@ function NGridItem({
|
|
|
11639
11971
|
return /* @__PURE__ */ jsx("div", { className: itemClassName, ...props, children });
|
|
11640
11972
|
}
|
|
11641
11973
|
|
|
11642
|
-
export { Alert, NCard as AsyncCard, Avatar, AvatarFallback, AvatarGroup, AvatarImage, AvatarStatus, Badge, BaseInput, Button, Calendar, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, CheckboxGroupInput, CheckboxInput, Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, ColorArrayInput, ColorPickerInput, Combobox, ComboboxInput, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, DateInput, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, DynamicArray_default as DynamicArray, EmojiInput, FileImportButton, FileInput, Form, FormControl, FormDescription, FormField, FormInput, FormItem, FormLabel, FormMessage, IconButton, ImageInput, Indicator, Input, Label, LangInput, MultiSelectInput, NAJM_COMPONENT_NAMES, NAlert, NAppShell, NCard as NAsyncCard, NAvatar, NBadge, NBulkActionsBar, NButton, NCard, NCardAction, NCardFooter, NCommandPalette, NConfirmDialog, NContextMenu, NDataCardShell, NDeleteDialog, NDeleteDialogContent, NDetailCard, NDetailItem, NDetailList, NDialog, NDialogDescription, NDialogHeader, NDialogPrimaryButton, NDialogSecondaryButton, NEditorTabs, NEmptyState, NErrorBoundary, NErrorState, NFileBrowser, NFileTypeIcon, NFilterBar, NFolderIcon, NForm, NFormSectionHeader, NGrid, NGridItem, NIcon, NIndicator, NInspectorSheet, NLoadingState, NMultiDialog, NNavbar, NPageHeader, NPageHeaderActions, NPageHeaderCompactActions, NPageHeaderFilters, NPageHeaderTop, NPageLayout, NPortalScopeProvider, NProgress, NRowActions, NSection, NSectionHeader, NSectionInfo, NSectionWithInfo, NSheet, NSidebar, NSidebarContent, NSidebarFooter, NSidebarHeader, NSidebarItem, NSidebarLogo, NSidebarMobile, NSidebarSection, NSkeleton, NSkeletonCalendar, NSkeletonChart, NSkeletonDonut, NSkeletonEventList, NSkeletonWidget, NSkeletonWidgets, NSlider, NSmartPasteDialog, NSpinner, NStatCard, NStatCardSkeleton, Swap as NSwap, NTable, NTableCardRoot, NTableCards, NTableContent, NTableHeader, NTableJson, NTableLoadingSkeleton, NTablePagination, NTableRowSkeleton, NTableSkeleton, NTabs, NUploader, NViewBody, NViewToggle, NajmDesignProvider, NajmScroll, NajmThemeProvider, NativeSelect, NumberInput, PasswordInput, PhoneInput, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, PrefixProvider, Progress, RADIUS_VALUE_MAP, RadioGroup2 as RadioGroup, RadioGroupInput, RadioGroupItem, RepeatingFields, ScrollArea, SearchField, SearchField as SearchInput, SegmentedControl, Select, SelectContent, SelectGroup, SelectInput, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator3 as Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, SimpleTooltip, NSkeleton as Skeleton, Slider, SliderInput, StarRatingInput, StatusPill, StepIndicator, StepsHeader, StepsProgress, Swap, SwapIndeterminate, SwapOff, SwapOn, Switch, SwitchInput, TAB_COLORS, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, TableStoreContext, Tabs, TabsContent, TabsList, TabsTrigger, TextAreaInput, TextInput, Textarea, TimeInput, Toaster, Toggle, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, VariantProvider, WizardForm, alertVariants, avatarVariants, badgeColorVariants, badgeVariants, buildDefaultFileColumns, buttonVariants, cn, composePreset, createDialogStore, createTableStore, defineNajmDesignConfig, defineNajmThemeConfig, detectFormat, dialogVariants, formatColor, formatFileBytes, formatFileRelative, getIconColorProps, getNextEditorTabValue, 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 };
|
|
11974
|
+
export { Alert, NCard as AsyncCard, Avatar, AvatarFallback, AvatarGroup, AvatarImage, AvatarStatus, Badge, BaseInput, Button, Calendar, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, CheckboxGroupInput, CheckboxInput, Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, ColorArrayInput, ColorPickerInput, Combobox, ComboboxInput, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, DateInput, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, DynamicArray_default as DynamicArray, EmojiInput, FileImportButton, FileInput, Form, FormControl, FormDescription, FormField, FormInput, FormItem, FormLabel, FormMessage, IconButton, ImageInput, Indicator, Input, Label, LangInput, MultiSelectInput, NAJM_COMPONENT_NAMES, NAlert, NAppShell, NCard as NAsyncCard, NAvatar, NBadge, NBulkActionsBar, NButton, NCard, NCardAction, NCardFooter, NCardInfo, NCardMedia, NCardSection, NCommandPalette, NConfirmDialog, NContextMenu, NDataCardShell, NDeleteDialog, NDeleteDialogContent, NDetailCard, NDetailItem, NDetailList, NDialog, NDialogDescription, NDialogHeader, NDialogPrimaryButton, NDialogSecondaryButton, NEditorTabs, NEmptyState, NErrorBoundary, NErrorState, NFileBrowser, NFileTypeIcon, NFilterBar, NFolderIcon, NForm, NFormSectionHeader, NGrid, NGridItem, NIcon, NIndicator, NInspectorSheet, NLoadingState, NMultiDialog, NNavbar, NPageHeader, NPageHeaderActions, NPageHeaderCompactActions, NPageHeaderFilters, NPageHeaderTop, NPageLayout, NPortalScopeProvider, NProgress, NRowActions, NSection, NSectionHeader, NSectionInfo, NSectionWithInfo, NSheet, NSidebar, NSidebarContent, NSidebarFooter, NSidebarHeader, NSidebarItem, NSidebarLogo, NSidebarMobile, NSidebarSection, NSkeleton, NSkeletonCalendar, NSkeletonChart, NSkeletonDonut, NSkeletonEventList, NSkeletonWidget, NSkeletonWidgets, NSlider, NSmartPasteDialog, NSpinner, NStatCard, NStatCardSkeleton, Swap as NSwap, NTable, NTableCardRoot, NTableCards, NTableContent, NTableHeader, NTableJson, NTableLoadingSkeleton, NTablePagination, NTableRowSkeleton, NTableSkeleton, NTabs, NUploader, NViewBody, NViewToggle, NajmDesignProvider, NajmScroll, NajmThemeProvider, NativeSelect, NumberInput, PasswordInput, PhoneInput, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, PrefixProvider, Progress, RADIUS_VALUE_MAP, RadioGroup2 as RadioGroup, RadioGroupInput, RadioGroupItem, RepeatingFields, ScrollArea, SearchField, SearchField as SearchInput, SegmentedControl, Select, SelectContent, SelectGroup, SelectInput, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator3 as Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, SimpleTooltip, NSkeleton as Skeleton, Slider, SliderInput, StarRatingInput, StatusPill, StepIndicator, StepsHeader, StepsProgress, Swap, SwapIndeterminate, SwapOff, SwapOn, Switch, SwitchInput, TAB_COLORS, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, TableStoreContext, Tabs, TabsContent, TabsList, TabsTrigger, TextAreaInput, TextInput, Textarea, TimeInput, Toaster, Toggle, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, VariantProvider, WizardForm, alertVariants, avatarVariants, badgeColorVariants, badgeVariants, buildDefaultFileColumns, buttonVariants, cn, composePreset, createDialogStore, createTableStore, defineNajmDesignConfig, defineNajmThemeConfig, detectFormat, dialogVariants, formatColor, formatFileBytes, formatFileRelative, getIconColorProps, getNextEditorTabValue, 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 };
|