najm-kit 2.1.52 → 2.1.54
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/CHANGELOG.md +19 -0
- package/README.md +46 -1
- package/dist/index.d.ts +76 -4
- package/dist/index.mjs +322 -22
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.1.54
|
|
4
|
+
|
|
5
|
+
- Added controlled remote-search and loading-state props to `ComboboxInput` and `FormInput type="combobox"` while preserving client filtering by default.
|
|
6
|
+
|
|
7
|
+
## 2.1.53 - 2026-08-05
|
|
8
|
+
|
|
9
|
+
- Add typed `NBarChart`, `NLineChart`, `NPieChart`, and `NStatusBreakdown`
|
|
10
|
+
components with caller-formatted generic data, accessible summaries, empty
|
|
11
|
+
states, responsive RTL-safe layouts, and shape-matched loading skeletons.
|
|
12
|
+
- Default chart colors to the live `--chart-1` through `--chart-5` theme
|
|
13
|
+
variables, cycle deterministically after five items, and retain explicit
|
|
14
|
+
per-series/item color overrides.
|
|
15
|
+
- Add preset and numeric chart diameter contracts to `NPieChart` and
|
|
16
|
+
`NDonutCard`, including narrow-container shrinking without clipped legends.
|
|
17
|
+
- Make `NDonutCard` item colors optional and add accessible loading states to
|
|
18
|
+
`NDonutCard` and `NStatCard`.
|
|
19
|
+
- Add public API tests, component tests, README guidance, and playground
|
|
20
|
+
examples for the chart and loading contracts.
|
|
21
|
+
|
|
3
22
|
## 2.1.49 - 2026-08-04
|
|
4
23
|
|
|
5
24
|
### ImageInput and AvatarInput
|
package/README.md
CHANGED
|
@@ -147,7 +147,7 @@ import { Form, FormInput, useNForm } from 'najm-kit';
|
|
|
147
147
|
| Data | Table (NTable), StatCard, DetailList |
|
|
148
148
|
| Overlays | Command palette, Tooltip, Toast |
|
|
149
149
|
|
|
150
|
-
## ImageInput and AvatarInput
|
|
150
|
+
## ImageInput and AvatarInput
|
|
151
151
|
|
|
152
152
|
`ImageInput` and `AvatarInput` ship with a resilient preview contract so
|
|
153
153
|
consumers do not need to wrap them with application-specific preview
|
|
@@ -350,3 +350,48 @@ accumulated pages in card mode, keep those two query shapes in the application
|
|
|
350
350
|
and pass the appropriate `data`. Crossing the `<640px` responsive-card
|
|
351
351
|
breakpoint does not overwrite the user's chosen view, pagination position,
|
|
352
352
|
sorting, filters, expansion, or row selection.
|
|
353
|
+
|
|
354
|
+
## Theme-backed charts
|
|
355
|
+
|
|
356
|
+
`NBarChart`, `NLineChart`, `NPieChart`, and `NStatusBreakdown` accept generic
|
|
357
|
+
caller-formatted data and use `--chart-1` through `--chart-5` by default.
|
|
358
|
+
Colors repeat deterministically after the fifth series or item; set `color` on
|
|
359
|
+
an exceptional series/item to override that one value. Each chart accepts
|
|
360
|
+
`loading`/`loadingLabel` and renders an accessible shape-matched skeleton.
|
|
361
|
+
`NPieChart` and `NDonutCard` accept `size="sm" | "md" | "lg"` or a numeric
|
|
362
|
+
pixel diameter and shrink within narrow containers.
|
|
363
|
+
|
|
364
|
+
```tsx
|
|
365
|
+
import { NBarChart, NPieChart } from "najm-kit";
|
|
366
|
+
|
|
367
|
+
const data = [
|
|
368
|
+
{ id: "jan", label: "Jan", values: { received: 12, refunded: 2 } },
|
|
369
|
+
{ id: "feb", label: "Feb", values: { received: 18, refunded: 1 } },
|
|
370
|
+
];
|
|
371
|
+
|
|
372
|
+
<NBarChart
|
|
373
|
+
title="Monthly activity"
|
|
374
|
+
data={data}
|
|
375
|
+
series={[
|
|
376
|
+
{ id: "received", label: "Received" },
|
|
377
|
+
{ id: "refunded", label: "Refunded" },
|
|
378
|
+
]}
|
|
379
|
+
valueFormatter={(value) => `${value} MAD`}
|
|
380
|
+
/>
|
|
381
|
+
|
|
382
|
+
<NPieChart
|
|
383
|
+
title="Status"
|
|
384
|
+
size={132}
|
|
385
|
+
items={[
|
|
386
|
+
{ id: "active", label: "Active", value: 8 },
|
|
387
|
+
{ id: "pending", label: "Pending", value: 3 },
|
|
388
|
+
]}
|
|
389
|
+
/>
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
### Server-backed combobox search
|
|
393
|
+
|
|
394
|
+
`ComboboxInput` and `FormInput type="combobox"` can delegate filtering to a
|
|
395
|
+
server by setting `shouldFilter={false}` and handling `onSearchChange`. Use
|
|
396
|
+
`loading` and `loadingMessage` while replacement options are being fetched.
|
|
397
|
+
Client-side filtering remains the default.
|
package/dist/index.d.ts
CHANGED
|
@@ -1599,6 +1599,8 @@ interface BaseProps$1 {
|
|
|
1599
1599
|
bordered?: boolean;
|
|
1600
1600
|
className?: string;
|
|
1601
1601
|
classNames?: NStatCardClassNames;
|
|
1602
|
+
loading?: boolean;
|
|
1603
|
+
loadingLabel?: string;
|
|
1602
1604
|
}
|
|
1603
1605
|
interface DefaultProps extends BaseProps$1 {
|
|
1604
1606
|
variant?: "default";
|
|
@@ -1646,6 +1648,61 @@ interface UsageProps extends BaseProps$1 {
|
|
|
1646
1648
|
type NStatCardProps = DefaultProps | UsageProps | CompactProps;
|
|
1647
1649
|
declare function NStatCard(props: NStatCardProps): react_jsx_runtime.JSX.Element;
|
|
1648
1650
|
|
|
1651
|
+
type NChartSize = "sm" | "md" | "lg" | number;
|
|
1652
|
+
interface NChartSeries {
|
|
1653
|
+
id: string;
|
|
1654
|
+
label: React__default.ReactNode;
|
|
1655
|
+
color?: string;
|
|
1656
|
+
}
|
|
1657
|
+
interface NChartDatum {
|
|
1658
|
+
id: string;
|
|
1659
|
+
label: React__default.ReactNode;
|
|
1660
|
+
values: Readonly<Record<string, number>>;
|
|
1661
|
+
}
|
|
1662
|
+
interface NChartItem {
|
|
1663
|
+
id: string;
|
|
1664
|
+
label: React__default.ReactNode;
|
|
1665
|
+
value: number;
|
|
1666
|
+
color?: string;
|
|
1667
|
+
className?: string;
|
|
1668
|
+
}
|
|
1669
|
+
interface NChartCardProps {
|
|
1670
|
+
title: React__default.ReactNode;
|
|
1671
|
+
ariaLabel?: string;
|
|
1672
|
+
icon?: NIconSource;
|
|
1673
|
+
iconColor?: string;
|
|
1674
|
+
className?: string;
|
|
1675
|
+
emptyLabel?: React__default.ReactNode;
|
|
1676
|
+
loading?: boolean;
|
|
1677
|
+
loadingLabel?: string;
|
|
1678
|
+
valueFormatter?: (value: number) => React__default.ReactNode;
|
|
1679
|
+
}
|
|
1680
|
+
interface NCartesianChartProps extends NChartCardProps {
|
|
1681
|
+
data: readonly NChartDatum[];
|
|
1682
|
+
series: readonly NChartSeries[];
|
|
1683
|
+
height?: number;
|
|
1684
|
+
showLegend?: boolean;
|
|
1685
|
+
}
|
|
1686
|
+
type NBarChartProps = NCartesianChartProps;
|
|
1687
|
+
type NLineChartProps = NCartesianChartProps;
|
|
1688
|
+
interface NPieChartProps extends NChartCardProps {
|
|
1689
|
+
items: readonly NChartItem[];
|
|
1690
|
+
size?: NChartSize;
|
|
1691
|
+
showLegend?: boolean;
|
|
1692
|
+
percentageFormatter?: (ratio: number) => React__default.ReactNode;
|
|
1693
|
+
}
|
|
1694
|
+
interface NStatusBreakdownProps extends NChartCardProps {
|
|
1695
|
+
items: readonly NChartItem[];
|
|
1696
|
+
minimumVisiblePercent?: number;
|
|
1697
|
+
}
|
|
1698
|
+
type NChartSkeletonVariant = "bar" | "line" | "pie" | "status";
|
|
1699
|
+
interface NChartSkeletonProps {
|
|
1700
|
+
variant?: NChartSkeletonVariant;
|
|
1701
|
+
points?: number;
|
|
1702
|
+
rows?: number;
|
|
1703
|
+
className?: string;
|
|
1704
|
+
}
|
|
1705
|
+
|
|
1649
1706
|
type NDonutCardVariant = "compact" | "default";
|
|
1650
1707
|
type NDonutCardLayout = "auto" | "vertical" | "horizontal";
|
|
1651
1708
|
type NDonutCardLegendMarker = "dot" | "icon" | "none";
|
|
@@ -1654,7 +1711,7 @@ interface NDonutCardItem {
|
|
|
1654
1711
|
id: string;
|
|
1655
1712
|
label: React__default.ReactNode;
|
|
1656
1713
|
value: number;
|
|
1657
|
-
color
|
|
1714
|
+
color?: string;
|
|
1658
1715
|
icon?: NIconSource;
|
|
1659
1716
|
}
|
|
1660
1717
|
interface NDonutCardClassNames {
|
|
@@ -1684,15 +1741,26 @@ interface NDonutCardProps {
|
|
|
1684
1741
|
emptyLabel?: React__default.ReactNode;
|
|
1685
1742
|
footer?: React__default.ReactNode;
|
|
1686
1743
|
variant?: NDonutCardVariant;
|
|
1687
|
-
/**
|
|
1744
|
+
/** Ring diameter preset or an exact pixel diameter. Custom values are clamped to 64-480px. */
|
|
1745
|
+
size?: NChartSize;
|
|
1746
|
+
/** `"auto"` is horizontal on mobile and switches to vertical from the `md` breakpoint. */
|
|
1688
1747
|
layout?: NDonutCardLayout;
|
|
1689
1748
|
legendMarker?: NDonutCardLegendMarker;
|
|
1690
1749
|
centerOrientation?: NDonutCardCenterOrientation;
|
|
1691
1750
|
percentageFormatter?: (ratio: number) => React__default.ReactNode;
|
|
1692
1751
|
className?: string;
|
|
1693
1752
|
classNames?: NDonutCardClassNames;
|
|
1753
|
+
loading?: boolean;
|
|
1754
|
+
loadingLabel?: string;
|
|
1694
1755
|
}
|
|
1695
|
-
declare function NDonutCard({ title, ariaLabel, icon, iconColor, items, valueFormatter, centerValueFormatter, centerUnit, totalLabel, centerIcon, emptyLabel, footer, variant, layout, legendMarker, centerOrientation, percentageFormatter, className, classNames, }: NDonutCardProps): react_jsx_runtime.JSX.Element;
|
|
1756
|
+
declare function NDonutCard({ title, ariaLabel, icon, iconColor, items, valueFormatter, centerValueFormatter, centerUnit, totalLabel, centerIcon, emptyLabel, footer, variant, size, layout, legendMarker, centerOrientation, percentageFormatter, className, classNames, loading, loadingLabel, }: NDonutCardProps): react_jsx_runtime.JSX.Element;
|
|
1757
|
+
|
|
1758
|
+
declare function getNChartColor(index: number, override?: string): string;
|
|
1759
|
+
declare function NChartSkeleton({ className, points, rows, variant, }: NChartSkeletonProps): react_jsx_runtime.JSX.Element;
|
|
1760
|
+
declare function NBarChart({ ariaLabel, className, data, emptyLabel, height, icon, iconColor, loading, loadingLabel, series, showLegend, title, valueFormatter, }: NBarChartProps): react_jsx_runtime.JSX.Element;
|
|
1761
|
+
declare function NLineChart(props: NLineChartProps): react_jsx_runtime.JSX.Element;
|
|
1762
|
+
declare function NPieChart({ ariaLabel, className, emptyLabel, icon, iconColor, items, loading, loadingLabel, percentageFormatter, showLegend, size, title, valueFormatter, }: NPieChartProps): react_jsx_runtime.JSX.Element;
|
|
1763
|
+
declare function NStatusBreakdown({ ariaLabel, className, emptyLabel, icon, iconColor, items, loading, loadingLabel, minimumVisiblePercent, title, valueFormatter, }: NStatusBreakdownProps): react_jsx_runtime.JSX.Element;
|
|
1696
1764
|
|
|
1697
1765
|
interface NDetailCardClassNames {
|
|
1698
1766
|
root?: string;
|
|
@@ -2085,6 +2153,10 @@ interface ComboboxInputProps extends BaseProps {
|
|
|
2085
2153
|
placeholder?: string;
|
|
2086
2154
|
searchPlaceholder?: string;
|
|
2087
2155
|
emptyMessage?: string;
|
|
2156
|
+
loading?: boolean;
|
|
2157
|
+
loadingMessage?: string;
|
|
2158
|
+
onSearchChange?: (query: string) => void;
|
|
2159
|
+
shouldFilter?: boolean;
|
|
2088
2160
|
icon?: InputIcon;
|
|
2089
2161
|
showIcon?: boolean;
|
|
2090
2162
|
disabled?: boolean;
|
|
@@ -3933,4 +4005,4 @@ interface NGridItemProps extends Omit<React$1.AllHTMLAttributes<HTMLDivElement>,
|
|
|
3933
4005
|
declare function NGrid({ as: Comp, children, cols, smCols, mdCols, lgCols, xlCols, gap, className, style, ...props }: NGridProps): react_jsx_runtime.JSX.Element;
|
|
3934
4006
|
declare function NGridItem({ children, span, smSpan, mdSpan, lgSpan, xlSpan, className, ...props }: NGridItemProps): react_jsx_runtime.JSX.Element;
|
|
3935
4007
|
|
|
3936
|
-
export { Alert, type AlertLook, type AlertOrientation, type AlertProps, type AlertSize, type AlertTone, type AlertVariant, NCard as AsyncCard, Avatar, AvatarFallback, AvatarFormInput, type AvatarFormInputProps, AvatarGroup, type AvatarGroupProps, AvatarImage, AvatarInput, type AvatarInputProps, type AvatarInputRadius, 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, DEFAULT_THEME_FILE_NAME, 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 ImageInputPreviewError, type ImageInputPreviewSource, 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, NDonutCard, type NDonutCardClassNames, type NDonutCardItem, type NDonutCardLayout, type NDonutCardLegendMarker, type NDonutCardProps, type NDonutCardVariant, 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 NSheetClassNames, 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, type NTableCardPagination, NTableCardRoot, type NTableCardRootProps, NTableCards, type NTableClassNames, type NTableColumnBreakpoint, type NTableColumnDef, type NTableColumnMeta, NTableContent, NTableHeader, type NTableLoadMorePagination, NTableLoadingSkeleton, type NTableMenu, type NTableMenuProp, NTablePagination, type NTableProps, NTableRowSkeleton, NTableSkeleton, type NTableState, NTabs, type NTabsClassNames, type NTabsColor, type NTabsItem, type NTabsProps, type NTabsStyles, NThemeCustomizer, type NThemeCustomizerFontOption, type NThemeCustomizerLabels, type NThemeCustomizerProps, type NThemeCustomizerTab, 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 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, OtpInput, type OtpInputProps, 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, TimeZoneInput, type TimeZoneInputProps, 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, filterResponsiveColumns, formatColor, formatFileBytes, formatFileRelative, getIconColorProps, getNextEditorTabValue, hiddenBelowClasses, indicatorVariants, inputBorderClasses, normalizeThemeFileName, parseColor, parseNajmDesignConfig, parseNajmThemeConfig, parseThemeFile, resolveHiddenBelowClass, resolvePreset, resolveRadiusValue, resolveSlot, resolveVariantAlias, sidebarBorderClasses, sliderVariants, stringifyNajmDesignConfig, stringifyNajmThemeConfig, stringifyThemeFile, surfaceBorderClasses, swapVariants, toPickerHex, toggleVariants, tooltipContentVariants, truncateByCharacters, useClickOutside, useContextMenu, useDebouncedValue, useDelayedLoading, useDialog, useDialogStore, useDynamicPageSize, useFormField, useFormSubmission, useInfiniteScroll, useKeyboard, useLocalStorageState, useNForm, useNPortalScope, useNajmAppearance, useNajmComponentStyle, useNajmDesign, useNajmThemeMode, usePrefix, useSelection, useStepNavigation, useStorageContextMenu, useStoreSync, useTable, useTableKeyboard, useTableStore, useVariant, useVariantPreset };
|
|
4008
|
+
export { Alert, type AlertLook, type AlertOrientation, type AlertProps, type AlertSize, type AlertTone, type AlertVariant, NCard as AsyncCard, Avatar, AvatarFallback, AvatarFormInput, type AvatarFormInputProps, AvatarGroup, type AvatarGroupProps, AvatarImage, AvatarInput, type AvatarInputProps, type AvatarInputRadius, 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, DEFAULT_THEME_FILE_NAME, 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 ImageInputPreviewError, type ImageInputPreviewSource, 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, NBarChart, type NBarChartProps, 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, type NCartesianChartProps, type NChartCardProps, type NChartDatum, type NChartItem, type NChartSeries, type NChartSize, NChartSkeleton, type NChartSkeletonProps, type NChartSkeletonVariant, 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, NDonutCard, type NDonutCardClassNames, type NDonutCardItem, type NDonutCardLayout, type NDonutCardLegendMarker, type NDonutCardProps, type NDonutCardVariant, 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, NLineChart, type NLineChartProps, NLoadingState, type NLoadingStateProps, NMultiDialog, type NMultiDialogProps, NNavbar, NPageHeader, NPageHeaderActions, type NPageHeaderBreakpoint, NPageHeaderCompactActions, NPageHeaderFilters, type NPageHeaderProps, NPageHeaderTop, NPageLayout, type NPageLayoutProps, NPieChart, type NPieChartProps, 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 NSheetClassNames, 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, NStatusBreakdown, type NStatusBreakdownProps, Swap as NSwap, type NSwapProps, NTable, type NTableCardPagination, NTableCardRoot, type NTableCardRootProps, NTableCards, type NTableClassNames, type NTableColumnBreakpoint, type NTableColumnDef, type NTableColumnMeta, NTableContent, NTableHeader, type NTableLoadMorePagination, NTableLoadingSkeleton, type NTableMenu, type NTableMenuProp, NTablePagination, type NTableProps, NTableRowSkeleton, NTableSkeleton, type NTableState, NTabs, type NTabsClassNames, type NTabsColor, type NTabsItem, type NTabsProps, type NTabsStyles, NThemeCustomizer, type NThemeCustomizerFontOption, type NThemeCustomizerLabels, type NThemeCustomizerProps, type NThemeCustomizerTab, 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 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, OtpInput, type OtpInputProps, 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, TimeZoneInput, type TimeZoneInputProps, 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, filterResponsiveColumns, formatColor, formatFileBytes, formatFileRelative, getIconColorProps, getNChartColor, getNextEditorTabValue, hiddenBelowClasses, indicatorVariants, inputBorderClasses, normalizeThemeFileName, parseColor, parseNajmDesignConfig, parseNajmThemeConfig, parseThemeFile, resolveHiddenBelowClass, resolvePreset, resolveRadiusValue, resolveSlot, resolveVariantAlias, sidebarBorderClasses, sliderVariants, stringifyNajmDesignConfig, stringifyNajmThemeConfig, stringifyThemeFile, surfaceBorderClasses, swapVariants, toPickerHex, toggleVariants, tooltipContentVariants, truncateByCharacters, useClickOutside, useContextMenu, useDebouncedValue, useDelayedLoading, useDialog, useDialogStore, useDynamicPageSize, useFormField, useFormSubmission, useInfiniteScroll, useKeyboard, useLocalStorageState, useNForm, useNPortalScope, useNajmAppearance, useNajmComponentStyle, useNajmDesign, useNajmThemeMode, usePrefix, useSelection, useStepNavigation, useStorageContextMenu, useStoreSync, useTable, useTableKeyboard, useTableStore, useVariant, useVariantPreset };
|
package/dist/index.mjs
CHANGED
|
@@ -7685,7 +7685,7 @@ function NCard({
|
|
|
7685
7685
|
CardContent,
|
|
7686
7686
|
{
|
|
7687
7687
|
className: cn(
|
|
7688
|
-
"m-0 flex min-w-0 flex-
|
|
7688
|
+
"m-0 flex min-w-0 flex-col gap-2 p-0",
|
|
7689
7689
|
sideBody && "col-start-2",
|
|
7690
7690
|
headerBody && "col-span-full",
|
|
7691
7691
|
responsiveAvatarBody && "col-start-2 sm:col-span-full",
|
|
@@ -8154,6 +8154,9 @@ function CompactCard({ icon, label, value, unit, iconColor, onClick, bordered, c
|
|
|
8154
8154
|
);
|
|
8155
8155
|
}
|
|
8156
8156
|
function NStatCard(props) {
|
|
8157
|
+
if (props.loading) {
|
|
8158
|
+
return /* @__PURE__ */ jsx("div", { "aria-busy": "true", "aria-label": props.loadingLabel ?? "Loading", className: props.className, role: "status", children: /* @__PURE__ */ jsx(NStatCardSkeleton, {}) });
|
|
8159
|
+
}
|
|
8157
8160
|
if (props.variant === "usage") return /* @__PURE__ */ jsx(UsageCard, { ...props });
|
|
8158
8161
|
if (props.variant === "compact") return /* @__PURE__ */ jsx(CompactCard, { ...props });
|
|
8159
8162
|
return /* @__PURE__ */ jsx(DefaultCard, { ...props });
|
|
@@ -8162,6 +8165,14 @@ var SIZE = {
|
|
|
8162
8165
|
compact: { ring: 96, center: 72 },
|
|
8163
8166
|
default: { ring: 144, center: 112 }
|
|
8164
8167
|
};
|
|
8168
|
+
var SIZE_PRESETS = { sm: 112, md: 160, lg: 208 };
|
|
8169
|
+
function resolveRingSize(size, fallback) {
|
|
8170
|
+
if (typeof size === "number") return Math.min(480, Math.max(64, size));
|
|
8171
|
+
return size ? SIZE_PRESETS[size] : fallback;
|
|
8172
|
+
}
|
|
8173
|
+
function chartColor(index, override) {
|
|
8174
|
+
return override ?? `var(--chart-${index % 5 + 1})`;
|
|
8175
|
+
}
|
|
8165
8176
|
function normalizeValue(v) {
|
|
8166
8177
|
if (!Number.isFinite(v) || v <= 0) return 0;
|
|
8167
8178
|
return v;
|
|
@@ -8170,11 +8181,11 @@ function buildConicGradient(items, total) {
|
|
|
8170
8181
|
if (total <= 0) return void 0;
|
|
8171
8182
|
let running = 0;
|
|
8172
8183
|
const stops = [];
|
|
8173
|
-
for (const item of items) {
|
|
8184
|
+
for (const [index, item] of items.entries()) {
|
|
8174
8185
|
const v = normalizeValue(item.value);
|
|
8175
8186
|
if (v <= 0) continue;
|
|
8176
8187
|
const pct = v / total;
|
|
8177
|
-
stops.push(`${item.color} ${running}turn ${running + pct}turn`);
|
|
8188
|
+
stops.push(`${chartColor(index, item.color)} ${running}turn ${running + pct}turn`);
|
|
8178
8189
|
running += pct;
|
|
8179
8190
|
}
|
|
8180
8191
|
if (stops.length === 0) return void 0;
|
|
@@ -8233,12 +8244,15 @@ function NDonutCard({
|
|
|
8233
8244
|
emptyLabel,
|
|
8234
8245
|
footer,
|
|
8235
8246
|
variant = "default",
|
|
8247
|
+
size,
|
|
8236
8248
|
layout = "auto",
|
|
8237
8249
|
legendMarker = "dot",
|
|
8238
8250
|
centerOrientation = "column",
|
|
8239
8251
|
percentageFormatter,
|
|
8240
8252
|
className,
|
|
8241
|
-
classNames
|
|
8253
|
+
classNames,
|
|
8254
|
+
loading = false,
|
|
8255
|
+
loadingLabel = "Loading"
|
|
8242
8256
|
}) {
|
|
8243
8257
|
const computedTotal = useMemo(
|
|
8244
8258
|
() => items.reduce((sum, item) => sum + normalizeValue(item.value), 0),
|
|
@@ -8250,29 +8264,45 @@ function NDonutCard({
|
|
|
8250
8264
|
[items, computedTotal]
|
|
8251
8265
|
);
|
|
8252
8266
|
const normalized = useMemo(
|
|
8253
|
-
() => items.map((item) => ({
|
|
8267
|
+
() => items.map((item, index) => ({
|
|
8254
8268
|
...item,
|
|
8269
|
+
color: chartColor(index, item.color),
|
|
8255
8270
|
value: normalizeValue(item.value),
|
|
8256
8271
|
ratio: computedTotal > 0 ? normalizeValue(item.value) / computedTotal : 0
|
|
8257
8272
|
})),
|
|
8258
8273
|
[items, computedTotal]
|
|
8259
8274
|
);
|
|
8260
8275
|
const sz = SIZE[variant];
|
|
8276
|
+
const ringSize = resolveRingSize(size, sz.ring);
|
|
8261
8277
|
const isTitleString = typeof title === "string";
|
|
8262
|
-
const
|
|
8278
|
+
const accessibleLabel2 = isTitleString ? title : ariaLabel;
|
|
8263
8279
|
const isCompact = variant === "compact";
|
|
8264
8280
|
const isAuto = layout === "auto";
|
|
8265
8281
|
const isHorizontal = layout === "horizontal";
|
|
8266
8282
|
const isCenterRow = centerOrientation === "row";
|
|
8267
8283
|
const ringStyle = {
|
|
8268
|
-
width:
|
|
8269
|
-
|
|
8284
|
+
width: ringSize,
|
|
8285
|
+
maxWidth: "100%",
|
|
8286
|
+
aspectRatio: "1 / 1"
|
|
8270
8287
|
};
|
|
8271
8288
|
if (gradient) ringStyle.background = gradient;
|
|
8272
8289
|
const centerStyle = {
|
|
8273
|
-
width: sz.center
|
|
8274
|
-
|
|
8290
|
+
width: `${sz.center / sz.ring * 100}%`,
|
|
8291
|
+
aspectRatio: "1 / 1"
|
|
8275
8292
|
};
|
|
8293
|
+
if (loading) {
|
|
8294
|
+
return /* @__PURE__ */ jsx(
|
|
8295
|
+
NCard,
|
|
8296
|
+
{
|
|
8297
|
+
title,
|
|
8298
|
+
icon,
|
|
8299
|
+
iconColor,
|
|
8300
|
+
bordered: true,
|
|
8301
|
+
className: cn(className, classNames?.root),
|
|
8302
|
+
children: /* @__PURE__ */ jsx("div", { "aria-busy": "true", "aria-label": loadingLabel, role: "status", children: /* @__PURE__ */ jsx(NSkeletonDonut, {}) })
|
|
8303
|
+
}
|
|
8304
|
+
);
|
|
8305
|
+
}
|
|
8276
8306
|
return /* @__PURE__ */ jsxs(
|
|
8277
8307
|
NCard,
|
|
8278
8308
|
{
|
|
@@ -8290,9 +8320,9 @@ function NDonutCard({
|
|
|
8290
8320
|
"data-variant": variant,
|
|
8291
8321
|
"data-layout": layout,
|
|
8292
8322
|
role: "group",
|
|
8293
|
-
"aria-label":
|
|
8323
|
+
"aria-label": accessibleLabel2,
|
|
8294
8324
|
className: cn(
|
|
8295
|
-
isAuto ? "flex w-full items-center gap-4 p-2 sm:p-3 lg:p-4" : isHorizontal ? "grid grid-cols-[auto_minmax(0,1fr)] items-center gap-5 p-2 lg:p-3 2xl:p-4" : cn(
|
|
8325
|
+
isAuto ? "flex w-full items-center gap-4 p-2 sm:p-3 md:flex-col lg:p-4" : isHorizontal ? "grid grid-cols-[auto_minmax(0,1fr)] items-center gap-5 p-2 lg:p-3 2xl:p-4" : cn(
|
|
8296
8326
|
"flex flex-col items-center p-2 lg:p-3 2xl:p-4",
|
|
8297
8327
|
isCompact ? "gap-2" : "gap-4"
|
|
8298
8328
|
),
|
|
@@ -8395,7 +8425,7 @@ function NDonutCard({
|
|
|
8395
8425
|
{
|
|
8396
8426
|
"data-slot": "donut-legend",
|
|
8397
8427
|
className: cn(
|
|
8398
|
-
isAuto ? "ms-auto shrink-0 space-y-3" : cn(
|
|
8428
|
+
isAuto ? "ms-auto shrink-0 space-y-3 md:ms-0 md:flex md:w-full md:shrink md:flex-col md:gap-1.5 md:space-y-0" : cn(
|
|
8399
8429
|
"flex flex-col gap-1.5 w-full",
|
|
8400
8430
|
isCompact && "gap-1",
|
|
8401
8431
|
isHorizontal && "min-w-0 flex-1 gap-2 pt-0.5"
|
|
@@ -8406,9 +8436,12 @@ function NDonutCard({
|
|
|
8406
8436
|
"div",
|
|
8407
8437
|
{
|
|
8408
8438
|
"data-slot": "donut-legend-item",
|
|
8409
|
-
className: cn(
|
|
8439
|
+
className: cn(
|
|
8440
|
+
isAuto && "md:flex md:items-center md:justify-between md:gap-2",
|
|
8441
|
+
classNames?.legendItem
|
|
8442
|
+
),
|
|
8410
8443
|
children: isAuto ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8411
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
8444
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 md:min-w-0", children: [
|
|
8412
8445
|
/* @__PURE__ */ jsx(
|
|
8413
8446
|
LegendMarker,
|
|
8414
8447
|
{
|
|
@@ -8434,7 +8467,7 @@ function NDonutCard({
|
|
|
8434
8467
|
"span",
|
|
8435
8468
|
{
|
|
8436
8469
|
className: cn(
|
|
8437
|
-
"ms-4 block whitespace-nowrap tabular-nums text-foreground font-semibold",
|
|
8470
|
+
"ms-4 block whitespace-nowrap tabular-nums text-foreground font-semibold md:ms-0",
|
|
8438
8471
|
isCompact ? "text-[11px]" : "text-xs sm:text-sm",
|
|
8439
8472
|
classNames?.legendValue
|
|
8440
8473
|
),
|
|
@@ -8532,6 +8565,265 @@ function NDonutCard({
|
|
|
8532
8565
|
}
|
|
8533
8566
|
);
|
|
8534
8567
|
}
|
|
8568
|
+
var CHART_PALETTE_SIZE = 5;
|
|
8569
|
+
var SIZE_PRESETS2 = { sm: 112, md: 160, lg: 208 };
|
|
8570
|
+
function getNChartColor(index, override) {
|
|
8571
|
+
return override ?? `var(--chart-${Math.max(0, index) % CHART_PALETTE_SIZE + 1})`;
|
|
8572
|
+
}
|
|
8573
|
+
function chartSize(size, fallback = SIZE_PRESETS2.md) {
|
|
8574
|
+
if (typeof size === "number") return Math.min(480, Math.max(64, size));
|
|
8575
|
+
return size ? SIZE_PRESETS2[size] : fallback;
|
|
8576
|
+
}
|
|
8577
|
+
function numberValue(value) {
|
|
8578
|
+
return Number.isFinite(value) && (value ?? 0) > 0 ? Number(value) : 0;
|
|
8579
|
+
}
|
|
8580
|
+
function accessibleLabel(title, ariaLabel) {
|
|
8581
|
+
return typeof title === "string" ? title : ariaLabel;
|
|
8582
|
+
}
|
|
8583
|
+
function ChartLegend({ series }) {
|
|
8584
|
+
return /* @__PURE__ */ jsx("div", { className: "mb-3 flex flex-wrap gap-x-4 gap-y-1", "data-slot": "chart-legend", children: series.map((item, index) => /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
|
|
8585
|
+
/* @__PURE__ */ jsx(
|
|
8586
|
+
"span",
|
|
8587
|
+
{
|
|
8588
|
+
"aria-hidden": "true",
|
|
8589
|
+
className: "size-2.5 shrink-0 rounded-full",
|
|
8590
|
+
style: { backgroundColor: getNChartColor(index, item.color) }
|
|
8591
|
+
}
|
|
8592
|
+
),
|
|
8593
|
+
item.label
|
|
8594
|
+
] }, item.id)) });
|
|
8595
|
+
}
|
|
8596
|
+
function EmptyChart({ children }) {
|
|
8597
|
+
return /* @__PURE__ */ jsx("div", { className: "flex min-h-40 items-center justify-center text-sm text-muted-foreground", children });
|
|
8598
|
+
}
|
|
8599
|
+
function LoadingCard({
|
|
8600
|
+
className,
|
|
8601
|
+
icon,
|
|
8602
|
+
iconColor,
|
|
8603
|
+
label,
|
|
8604
|
+
title,
|
|
8605
|
+
variant
|
|
8606
|
+
}) {
|
|
8607
|
+
return /* @__PURE__ */ jsx(NCard, { className: cn("h-full", className), icon, iconColor, title, children: /* @__PURE__ */ jsx("div", { "aria-busy": "true", "aria-label": label ?? "Loading", className: "min-h-40", role: "status", children: /* @__PURE__ */ jsx(NChartSkeleton, { variant }) }) });
|
|
8608
|
+
}
|
|
8609
|
+
function NChartSkeleton({
|
|
8610
|
+
className,
|
|
8611
|
+
points = 12,
|
|
8612
|
+
rows = 4,
|
|
8613
|
+
variant = "bar"
|
|
8614
|
+
}) {
|
|
8615
|
+
if (variant === "pie") {
|
|
8616
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-5 py-3 sm:flex-col", className), "aria-hidden": "true", children: [
|
|
8617
|
+
/* @__PURE__ */ jsx(NSkeleton, { className: "size-32 shrink-0 rounded-full" }),
|
|
8618
|
+
/* @__PURE__ */ jsx("div", { className: "w-full flex-1 space-y-3", children: Array.from({ length: 3 }, (_, index) => /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-4", children: [
|
|
8619
|
+
/* @__PURE__ */ jsx(NSkeleton, { className: "h-3 w-24" }),
|
|
8620
|
+
/* @__PURE__ */ jsx(NSkeleton, { className: "h-3 w-12" })
|
|
8621
|
+
] }, index)) })
|
|
8622
|
+
] });
|
|
8623
|
+
}
|
|
8624
|
+
if (variant === "status") {
|
|
8625
|
+
return /* @__PURE__ */ jsx("div", { className: cn("space-y-4 py-2", className), "aria-hidden": "true", children: Array.from({ length: rows }, (_, index) => /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
8626
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between", children: [
|
|
8627
|
+
/* @__PURE__ */ jsx(NSkeleton, { className: "h-3 w-24" }),
|
|
8628
|
+
/* @__PURE__ */ jsx(NSkeleton, { className: "h-3 w-8" })
|
|
8629
|
+
] }),
|
|
8630
|
+
/* @__PURE__ */ jsx(NSkeleton, { className: "h-2 w-full rounded-full" })
|
|
8631
|
+
] }, index)) });
|
|
8632
|
+
}
|
|
8633
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("flex min-h-44 flex-col gap-3", className), "aria-hidden": "true", children: [
|
|
8634
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-1 items-end gap-1.5", children: Array.from({ length: Math.max(1, points) }, (_, index) => /* @__PURE__ */ jsx(
|
|
8635
|
+
NSkeleton,
|
|
8636
|
+
{
|
|
8637
|
+
className: cn("min-h-2 flex-1", variant === "bar" ? "rounded-t-sm" : "rounded-full"),
|
|
8638
|
+
style: { height: `${32 + index * 17 % 58}%` }
|
|
8639
|
+
},
|
|
8640
|
+
index
|
|
8641
|
+
)) }),
|
|
8642
|
+
/* @__PURE__ */ jsx("div", { className: "flex justify-between gap-2", children: Array.from({ length: Math.min(6, Math.max(1, points)) }, (_, index) => /* @__PURE__ */ jsx(NSkeleton, { className: "h-3 w-6" }, index)) })
|
|
8643
|
+
] });
|
|
8644
|
+
}
|
|
8645
|
+
function chartMaximum(data, series) {
|
|
8646
|
+
return Math.max(1, ...data.flatMap((point) => series.map((item) => numberValue(point.values[item.id]))));
|
|
8647
|
+
}
|
|
8648
|
+
function NBarChart({
|
|
8649
|
+
ariaLabel,
|
|
8650
|
+
className,
|
|
8651
|
+
data,
|
|
8652
|
+
emptyLabel,
|
|
8653
|
+
height = 176,
|
|
8654
|
+
icon,
|
|
8655
|
+
iconColor,
|
|
8656
|
+
loading,
|
|
8657
|
+
loadingLabel,
|
|
8658
|
+
series,
|
|
8659
|
+
showLegend = true,
|
|
8660
|
+
title,
|
|
8661
|
+
valueFormatter = String
|
|
8662
|
+
}) {
|
|
8663
|
+
if (loading) return /* @__PURE__ */ jsx(LoadingCard, { className, icon, iconColor, label: loadingLabel, title, variant: "bar" });
|
|
8664
|
+
const maximum = chartMaximum(data, series);
|
|
8665
|
+
return /* @__PURE__ */ jsxs(NCard, { className: cn("h-full min-w-0 overflow-hidden", className), icon, iconColor, title, children: [
|
|
8666
|
+
showLegend ? /* @__PURE__ */ jsx(ChartLegend, { series }) : null,
|
|
8667
|
+
!data.length || !series.length ? /* @__PURE__ */ jsx(EmptyChart, { children: emptyLabel }) : /* @__PURE__ */ jsxs("div", { "aria-label": accessibleLabel(title, ariaLabel), role: "img", children: [
|
|
8668
|
+
/* @__PURE__ */ jsx(
|
|
8669
|
+
"div",
|
|
8670
|
+
{
|
|
8671
|
+
className: "grid min-w-0 items-end gap-0.5 border-b border-border/80 px-0.5 pt-3 sm:gap-2 sm:px-1",
|
|
8672
|
+
style: { gridTemplateColumns: `repeat(${data.length}, minmax(0, 1fr))`, height },
|
|
8673
|
+
children: data.map((point) => /* @__PURE__ */ jsxs("div", { className: "flex h-full min-w-0 flex-col justify-end gap-2", children: [
|
|
8674
|
+
/* @__PURE__ */ jsx("div", { className: "flex min-w-0 flex-1 items-end justify-center gap-px sm:gap-1", children: series.map((item, index) => {
|
|
8675
|
+
const value = numberValue(point.values[item.id]);
|
|
8676
|
+
return /* @__PURE__ */ jsx(
|
|
8677
|
+
"div",
|
|
8678
|
+
{
|
|
8679
|
+
"aria-label": `${String(item.label)}: ${String(valueFormatter(value))}`,
|
|
8680
|
+
className: "min-w-px w-full max-w-4 rounded-t-sm transition-opacity hover:opacity-80 focus-visible:opacity-80 sm:rounded-t-md",
|
|
8681
|
+
style: { backgroundColor: getNChartColor(index, item.color), height: value === 0 ? 3 : Math.max(8, Math.round(value / maximum * (height - 26))) },
|
|
8682
|
+
tabIndex: 0
|
|
8683
|
+
},
|
|
8684
|
+
item.id
|
|
8685
|
+
);
|
|
8686
|
+
}) }),
|
|
8687
|
+
/* @__PURE__ */ jsx("span", { className: "truncate text-center text-[8px] leading-none text-muted-foreground sm:text-[10px]", children: point.label })
|
|
8688
|
+
] }, point.id))
|
|
8689
|
+
}
|
|
8690
|
+
),
|
|
8691
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: chartSummary(data, series, valueFormatter) })
|
|
8692
|
+
] })
|
|
8693
|
+
] });
|
|
8694
|
+
}
|
|
8695
|
+
function lineCoordinate(index, count, value, maximum) {
|
|
8696
|
+
return { x: count <= 1 ? 50 : 2 + index / (count - 1) * 96, y: 96 - value / maximum * 88 };
|
|
8697
|
+
}
|
|
8698
|
+
function smoothLinePath(points) {
|
|
8699
|
+
if (!points.length) return "";
|
|
8700
|
+
if (points.length === 1) return `M ${points[0].x} ${points[0].y}`;
|
|
8701
|
+
return points.slice(1).reduce((path, point, index) => {
|
|
8702
|
+
const previous = points[index];
|
|
8703
|
+
const midpointX = (previous.x + point.x) / 2;
|
|
8704
|
+
return `${path} C ${midpointX} ${previous.y}, ${midpointX} ${point.y}, ${point.x} ${point.y}`;
|
|
8705
|
+
}, `M ${points[0].x} ${points[0].y}`);
|
|
8706
|
+
}
|
|
8707
|
+
function NLineChart(props) {
|
|
8708
|
+
const {
|
|
8709
|
+
ariaLabel,
|
|
8710
|
+
className,
|
|
8711
|
+
data,
|
|
8712
|
+
emptyLabel,
|
|
8713
|
+
height = 176,
|
|
8714
|
+
icon,
|
|
8715
|
+
iconColor,
|
|
8716
|
+
loading,
|
|
8717
|
+
loadingLabel,
|
|
8718
|
+
series,
|
|
8719
|
+
showLegend = true,
|
|
8720
|
+
title,
|
|
8721
|
+
valueFormatter = String
|
|
8722
|
+
} = props;
|
|
8723
|
+
if (loading) return /* @__PURE__ */ jsx(LoadingCard, { className, icon, iconColor, label: loadingLabel, title, variant: "line" });
|
|
8724
|
+
const maximum = chartMaximum(data, series);
|
|
8725
|
+
return /* @__PURE__ */ jsxs(NCard, { className: cn("h-full min-w-0 overflow-hidden", className), icon, iconColor, title, children: [
|
|
8726
|
+
showLegend ? /* @__PURE__ */ jsx(ChartLegend, { series }) : null,
|
|
8727
|
+
!data.length || !series.length ? /* @__PURE__ */ jsx(EmptyChart, { children: emptyLabel }) : /* @__PURE__ */ jsxs("div", { "aria-label": accessibleLabel(title, ariaLabel), className: "min-w-0 overflow-hidden pb-1", role: "img", children: [
|
|
8728
|
+
/* @__PURE__ */ jsx("div", { className: "relative w-full min-w-0", style: { height }, children: /* @__PURE__ */ jsx("svg", { "aria-hidden": "true", className: "absolute inset-0 size-full", preserveAspectRatio: "none", viewBox: "0 0 100 100", children: series.map((item, index) => /* @__PURE__ */ jsx(
|
|
8729
|
+
"path",
|
|
8730
|
+
{
|
|
8731
|
+
d: smoothLinePath(data.map((point, pointIndex) => lineCoordinate(pointIndex, data.length, numberValue(point.values[item.id]), maximum))),
|
|
8732
|
+
fill: "none",
|
|
8733
|
+
stroke: getNChartColor(index, item.color),
|
|
8734
|
+
strokeLinecap: "round",
|
|
8735
|
+
strokeLinejoin: "round",
|
|
8736
|
+
strokeWidth: "3",
|
|
8737
|
+
vectorEffect: "non-scaling-stroke"
|
|
8738
|
+
},
|
|
8739
|
+
item.id
|
|
8740
|
+
)) }) }),
|
|
8741
|
+
/* @__PURE__ */ jsx("div", { className: "grid px-1 pt-2", style: { gridTemplateColumns: `repeat(${data.length}, minmax(0, 1fr))` }, children: data.map((point) => /* @__PURE__ */ jsx("span", { className: "truncate text-center text-[10px] text-muted-foreground", children: point.label }, point.id)) }),
|
|
8742
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: chartSummary(data, series, valueFormatter) })
|
|
8743
|
+
] })
|
|
8744
|
+
] });
|
|
8745
|
+
}
|
|
8746
|
+
function chartSummary(data, series, formatter) {
|
|
8747
|
+
return data.flatMap((point) => series.map((item) => `${String(point.label)} \xB7 ${String(item.label)}: ${String(formatter(numberValue(point.values[item.id])))}`)).join("; ");
|
|
8748
|
+
}
|
|
8749
|
+
function piePoint(angle, radius) {
|
|
8750
|
+
const radians = angle * Math.PI / 180;
|
|
8751
|
+
return { x: 50 + Math.cos(radians) * radius, y: 50 + Math.sin(radians) * radius };
|
|
8752
|
+
}
|
|
8753
|
+
function piePath(startAngle, endAngle) {
|
|
8754
|
+
const radius = 47;
|
|
8755
|
+
if (endAngle - startAngle >= 359.999) return `M 50 3 a ${radius} ${radius} 0 1 1 0 ${radius * 2} a ${radius} ${radius} 0 1 1 0 -${radius * 2}`;
|
|
8756
|
+
const start = piePoint(startAngle, radius);
|
|
8757
|
+
const end = piePoint(endAngle, radius);
|
|
8758
|
+
return `M 50 50 L ${start.x} ${start.y} A ${radius} ${radius} 0 ${endAngle - startAngle > 180 ? 1 : 0} 1 ${end.x} ${end.y} Z`;
|
|
8759
|
+
}
|
|
8760
|
+
function NPieChart({
|
|
8761
|
+
ariaLabel,
|
|
8762
|
+
className,
|
|
8763
|
+
emptyLabel,
|
|
8764
|
+
icon,
|
|
8765
|
+
iconColor,
|
|
8766
|
+
items,
|
|
8767
|
+
loading,
|
|
8768
|
+
loadingLabel,
|
|
8769
|
+
percentageFormatter,
|
|
8770
|
+
showLegend = true,
|
|
8771
|
+
size,
|
|
8772
|
+
title,
|
|
8773
|
+
valueFormatter = String
|
|
8774
|
+
}) {
|
|
8775
|
+
if (loading) return /* @__PURE__ */ jsx(LoadingCard, { className, icon, iconColor, label: loadingLabel, title, variant: "pie" });
|
|
8776
|
+
const normalized = items.map((item, index) => ({ ...item, value: numberValue(item.value), color: getNChartColor(index, item.color) }));
|
|
8777
|
+
const total = normalized.reduce((sum, item) => sum + item.value, 0);
|
|
8778
|
+
let angle = -90;
|
|
8779
|
+
const slices = normalized.flatMap((item) => {
|
|
8780
|
+
if (!item.value || !total) return [];
|
|
8781
|
+
const start = angle;
|
|
8782
|
+
angle += item.value / total * 360;
|
|
8783
|
+
return [{ ...item, path: piePath(start, angle), ratio: item.value / total }];
|
|
8784
|
+
});
|
|
8785
|
+
const diameter = chartSize(size);
|
|
8786
|
+
return /* @__PURE__ */ jsx(NCard, { className: cn("h-full min-w-0", className), icon, iconColor, title, children: !total ? /* @__PURE__ */ jsx(EmptyChart, { children: emptyLabel }) : /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center gap-4 sm:flex-col sm:gap-5", role: "img", "aria-label": accessibleLabel(title, ariaLabel), children: [
|
|
8787
|
+
/* @__PURE__ */ jsx("svg", { className: "h-auto max-w-full shrink", style: { width: diameter, maxWidth: "100%" }, viewBox: "0 0 100 100", "aria-hidden": "true", children: slices.map((slice) => /* @__PURE__ */ jsx("path", { d: slice.path, fill: slice.color, stroke: "var(--card)", strokeWidth: "1" }, slice.id)) }),
|
|
8788
|
+
showLegend ? /* @__PURE__ */ jsx("div", { className: "min-w-0 flex-1 space-y-3 sm:w-full sm:flex-none", "data-slot": "chart-legend", children: normalized.map((item) => /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3 text-sm", children: [
|
|
8789
|
+
/* @__PURE__ */ jsxs("span", { className: "flex min-w-0 items-center gap-2 text-muted-foreground", children: [
|
|
8790
|
+
/* @__PURE__ */ jsx("span", { className: "size-2.5 shrink-0 rounded-full", style: { backgroundColor: item.color }, "aria-hidden": "true" }),
|
|
8791
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: item.label })
|
|
8792
|
+
] }),
|
|
8793
|
+
/* @__PURE__ */ jsxs("strong", { className: "shrink-0 tabular-nums", children: [
|
|
8794
|
+
valueFormatter(item.value),
|
|
8795
|
+
percentageFormatter ? /* @__PURE__ */ jsx("span", { className: "ms-1 font-normal text-muted-foreground", children: percentageFormatter(total ? item.value / total : 0) }) : null
|
|
8796
|
+
] })
|
|
8797
|
+
] }, item.id)) }) : null,
|
|
8798
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: normalized.map((item) => `${String(item.label)}: ${String(valueFormatter(item.value))}`).join("; ") })
|
|
8799
|
+
] }) });
|
|
8800
|
+
}
|
|
8801
|
+
function NStatusBreakdown({
|
|
8802
|
+
ariaLabel,
|
|
8803
|
+
className,
|
|
8804
|
+
emptyLabel,
|
|
8805
|
+
icon,
|
|
8806
|
+
iconColor,
|
|
8807
|
+
items,
|
|
8808
|
+
loading,
|
|
8809
|
+
loadingLabel,
|
|
8810
|
+
minimumVisiblePercent = 4,
|
|
8811
|
+
title,
|
|
8812
|
+
valueFormatter = String
|
|
8813
|
+
}) {
|
|
8814
|
+
if (loading) return /* @__PURE__ */ jsx(LoadingCard, { className, icon, iconColor, label: loadingLabel, title, variant: "status" });
|
|
8815
|
+
const maximum = Math.max(1, ...items.map((item) => numberValue(item.value)));
|
|
8816
|
+
return /* @__PURE__ */ jsx(NCard, { className: cn("h-full", className), icon, iconColor, title, children: !items.length ? /* @__PURE__ */ jsx(EmptyChart, { children: emptyLabel }) : /* @__PURE__ */ jsx("div", { "aria-label": accessibleLabel(title, ariaLabel), className: "space-y-3", role: "img", children: items.map((item, index) => {
|
|
8817
|
+
const value = numberValue(item.value);
|
|
8818
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("space-y-1.5", item.className), children: [
|
|
8819
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3 text-sm", children: [
|
|
8820
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: item.label }),
|
|
8821
|
+
/* @__PURE__ */ jsx("strong", { className: "tabular-nums", children: valueFormatter(value) })
|
|
8822
|
+
] }),
|
|
8823
|
+
/* @__PURE__ */ jsx("div", { className: "h-2 overflow-hidden rounded-full bg-muted", children: /* @__PURE__ */ jsx("div", { className: "h-full rounded-full", style: { backgroundColor: getNChartColor(index, item.color), width: `${Math.max(minimumVisiblePercent, value / maximum * 100)}%` } }) })
|
|
8824
|
+
] }, item.id);
|
|
8825
|
+
}) }) });
|
|
8826
|
+
}
|
|
8535
8827
|
function NDetailCard({
|
|
8536
8828
|
title,
|
|
8537
8829
|
description,
|
|
@@ -9518,7 +9810,7 @@ var TextAreaInput = ({ value, onChange, placeholder = "", className = "", varian
|
|
|
9518
9810
|
}
|
|
9519
9811
|
);
|
|
9520
9812
|
};
|
|
9521
|
-
var ComboboxInput = ({ placeholder = "Select...", searchPlaceholder = "Search...", emptyMessage = "No results found.", value, onChange, icon, showIcon = true, iconColor, items = [], className = "", variant = "default", status = "default", bordered, borderColor, disabled = false, allowFreeText = false }) => {
|
|
9813
|
+
var ComboboxInput = ({ placeholder = "Select...", searchPlaceholder = "Search...", emptyMessage = "No results found.", loading = false, loadingMessage = "Loading...", onSearchChange, shouldFilter = true, value, onChange, icon, showIcon = true, iconColor, items = [], className = "", variant = "default", status = "default", bordered, borderColor, disabled = false, allowFreeText = false }) => {
|
|
9522
9814
|
const [open, setOpen] = useState(false);
|
|
9523
9815
|
const triggerRef = React__default.useRef(null);
|
|
9524
9816
|
const pointerDismissedRef = React__default.useRef(false);
|
|
@@ -9535,10 +9827,18 @@ var ComboboxInput = ({ placeholder = "Select...", searchPlaceholder = "Search...
|
|
|
9535
9827
|
onChange(next);
|
|
9536
9828
|
setOpen(false);
|
|
9537
9829
|
setQuery("");
|
|
9830
|
+
onSearchChange?.("");
|
|
9831
|
+
};
|
|
9832
|
+
const updateQuery = (next) => {
|
|
9833
|
+
setQuery(next);
|
|
9834
|
+
onSearchChange?.(next);
|
|
9538
9835
|
};
|
|
9539
9836
|
return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: (o) => {
|
|
9540
9837
|
setOpen(o);
|
|
9541
|
-
if (!o)
|
|
9838
|
+
if (!o) {
|
|
9839
|
+
setQuery("");
|
|
9840
|
+
onSearchChange?.("");
|
|
9841
|
+
}
|
|
9542
9842
|
}, children: [
|
|
9543
9843
|
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, disabled, children: /* @__PURE__ */ jsxs(
|
|
9544
9844
|
BaseInput,
|
|
@@ -9576,14 +9876,14 @@ var ComboboxInput = ({ placeholder = "Select...", searchPlaceholder = "Search...
|
|
|
9576
9876
|
pointerDismissedRef.current = false;
|
|
9577
9877
|
triggerRef.current?.blur();
|
|
9578
9878
|
},
|
|
9579
|
-
children: /* @__PURE__ */ jsxs(Command, { children: [
|
|
9879
|
+
children: /* @__PURE__ */ jsxs(Command, { shouldFilter, children: [
|
|
9580
9880
|
/* @__PURE__ */ jsx(
|
|
9581
9881
|
CommandInput,
|
|
9582
9882
|
{
|
|
9583
9883
|
placeholder: searchPlaceholder,
|
|
9584
9884
|
className: "h-9",
|
|
9585
9885
|
value: query,
|
|
9586
|
-
onValueChange:
|
|
9886
|
+
onValueChange: updateQuery,
|
|
9587
9887
|
onKeyDown: (e) => {
|
|
9588
9888
|
if (e.key === "Enter" && showFreeTextOption) {
|
|
9589
9889
|
e.preventDefault();
|
|
@@ -9593,7 +9893,7 @@ var ComboboxInput = ({ placeholder = "Select...", searchPlaceholder = "Search...
|
|
|
9593
9893
|
}
|
|
9594
9894
|
),
|
|
9595
9895
|
/* @__PURE__ */ jsxs(CommandList, { children: [
|
|
9596
|
-
/* @__PURE__ */ jsx(CommandEmpty, { children: emptyMessage }),
|
|
9896
|
+
/* @__PURE__ */ jsx(CommandEmpty, { children: loading ? loadingMessage : emptyMessage }),
|
|
9597
9897
|
/* @__PURE__ */ jsxs(CommandGroup, { children: [
|
|
9598
9898
|
showFreeTextOption && /* @__PURE__ */ jsxs(CommandItem, { value: trimmedQuery, onSelect: () => commit(trimmedQuery), className: "cursor-pointer", children: [
|
|
9599
9899
|
/* @__PURE__ */ jsx(Check, { className: "mr-2 h-4 w-4 opacity-0" }),
|
|
@@ -15321,4 +15621,4 @@ function NGridItem({
|
|
|
15321
15621
|
return /* @__PURE__ */ jsx("div", { className: itemClassName, ...props, children });
|
|
15322
15622
|
}
|
|
15323
15623
|
|
|
15324
|
-
export { Alert, NCard as AsyncCard, Avatar, AvatarFallback, AvatarFormInput, AvatarGroup, AvatarImage, AvatarInput, 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, DEFAULT_THEME_FILE_NAME, 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, Indicator2 as Indicator, Input, Label2 as 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, NDonutCard, 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, NThemeCustomizer, NUploader, NViewBody, NViewToggle, NajmDesignProvider, NajmScroll, NajmThemeProvider, NativeSelect, NumberInput, OtpInput, 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, TimeZoneInput, Toaster, Toggle, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, VariantProvider, WizardForm, alertVariants, avatarVariants, badgeColorVariants, badgeVariants, buildDefaultFileColumns, buttonVariants, cn, composePreset, createDialogStore, createTableStore, defineNajmDesignConfig, defineNajmThemeConfig, detectFormat, dialogVariants, filterResponsiveColumns, formatColor, formatFileBytes, formatFileRelative, getIconColorProps, getNextEditorTabValue, hiddenBelowClasses, indicatorVariants, inputBorderClasses, normalizeThemeFileName, parseColor, parseNajmDesignConfig, parseNajmThemeConfig, parseThemeFile, resolveHiddenBelowClass, resolvePreset, resolveRadiusValue, resolveSlot, resolveVariantAlias, sidebarBorderClasses, sliderVariants, stringifyNajmDesignConfig, stringifyNajmThemeConfig, stringifyThemeFile, surfaceBorderClasses, swapVariants, toPickerHex, toggleVariants, tooltipContentVariants, truncateByCharacters, useClickOutside, useContextMenu, useDebouncedValue, useDelayedLoading, useDialog, useDialogStore, useDynamicPageSize, useFormField, useFormSubmission, useInfiniteScroll, useKeyboard, useLocalStorageState, useNForm, useNPortalScope, useNajmAppearance, useNajmComponentStyle, useNajmDesign, useNajmThemeMode, usePrefix, useSelection, useStepNavigation, useStorageContextMenu, useStoreSync, useTable, useTableKeyboard, useTableStore, useVariant, useVariantPreset };
|
|
15624
|
+
export { Alert, NCard as AsyncCard, Avatar, AvatarFallback, AvatarFormInput, AvatarGroup, AvatarImage, AvatarInput, 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, DEFAULT_THEME_FILE_NAME, 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, Indicator2 as Indicator, Input, Label2 as Label, LangInput, MultiSelectInput, NAJM_COMPONENT_NAMES, NAlert, NAppShell, NCard as NAsyncCard, NAvatar, NBadge, NBarChart, NBulkActionsBar, NButton, NCard, NCardAction, NCardFooter, NCardInfo, NCardMedia, NCardSection, NChartSkeleton, NCommandPalette, NConfirmDialog, NContextMenu, NDataCardShell, NDeleteDialog, NDeleteDialogContent, NDetailCard, NDetailItem, NDetailList, NDialog, NDialogDescription, NDialogHeader, NDialogPrimaryButton, NDialogSecondaryButton, NDonutCard, NEditorTabs, NEmptyState, NErrorBoundary, NErrorState, NFileBrowser, NFileTypeIcon, NFilterBar, NFolderIcon, NForm, NFormSectionHeader, NGrid, NGridItem, NIcon, NIndicator, NInspectorSheet, NLineChart, NLoadingState, NMultiDialog, NNavbar, NPageHeader, NPageHeaderActions, NPageHeaderCompactActions, NPageHeaderFilters, NPageHeaderTop, NPageLayout, NPieChart, 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, NStatusBreakdown, Swap as NSwap, NTable, NTableCardRoot, NTableCards, NTableContent, NTableHeader, NTableJson, NTableLoadingSkeleton, NTablePagination, NTableRowSkeleton, NTableSkeleton, NTabs, NThemeCustomizer, NUploader, NViewBody, NViewToggle, NajmDesignProvider, NajmScroll, NajmThemeProvider, NativeSelect, NumberInput, OtpInput, 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, TimeZoneInput, Toaster, Toggle, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, VariantProvider, WizardForm, alertVariants, avatarVariants, badgeColorVariants, badgeVariants, buildDefaultFileColumns, buttonVariants, cn, composePreset, createDialogStore, createTableStore, defineNajmDesignConfig, defineNajmThemeConfig, detectFormat, dialogVariants, filterResponsiveColumns, formatColor, formatFileBytes, formatFileRelative, getIconColorProps, getNChartColor, getNextEditorTabValue, hiddenBelowClasses, indicatorVariants, inputBorderClasses, normalizeThemeFileName, parseColor, parseNajmDesignConfig, parseNajmThemeConfig, parseThemeFile, resolveHiddenBelowClass, resolvePreset, resolveRadiusValue, resolveSlot, resolveVariantAlias, sidebarBorderClasses, sliderVariants, stringifyNajmDesignConfig, stringifyNajmThemeConfig, stringifyThemeFile, surfaceBorderClasses, swapVariants, toPickerHex, toggleVariants, tooltipContentVariants, truncateByCharacters, useClickOutside, useContextMenu, useDebouncedValue, useDelayedLoading, useDialog, useDialogStore, useDynamicPageSize, useFormField, useFormSubmission, useInfiniteScroll, useKeyboard, useLocalStorageState, useNForm, useNPortalScope, useNajmAppearance, useNajmComponentStyle, useNajmDesign, useNajmThemeMode, usePrefix, useSelection, useStepNavigation, useStorageContextMenu, useStoreSync, useTable, useTableKeyboard, useTableStore, useVariant, useVariantPreset };
|