najm-kit 2.2.9 → 2.5.0
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 +17 -0
- package/dist/index.d.ts +97 -1
- package/dist/index.mjs +140 -20
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.5.0
|
|
4
|
+
|
|
5
|
+
- Added `NTableDefaultsProvider`, so an application supplies `paginationLabels` once instead of at every table. Labels merge per key, most specific first: a table's own `paginationLabels` override the provider's for the keys it sets, the provider covers the rest, and anything neither supplies falls back to the packaged English. Also exports `useNTableDefaults` and the `NTableDefaults` type.
|
|
6
|
+
- `value` is passed through the provider unmemoized; memoize it in the caller, or every table below re-renders with the shell.
|
|
7
|
+
|
|
8
|
+
## 2.4.0
|
|
9
|
+
|
|
10
|
+
- `NTablePagination` renders numbered page buttons instead of `Page X of Y`. The window shows the first and last page, the current page, and one page either side, collapsing the rest into at most two gaps. The slot count is constant for any result longer than the window, so the bar does not change width as the reader pages through it, and a gap never stands in for a single page — that slot goes to the page instead.
|
|
11
|
+
- Added `paginationVariant`, defaulting to `"numbered"`. Pass `"compact"` to keep the previous position text with first/previous/next/last controls. **This changes the default appearance of every paginated `NTable`.**
|
|
12
|
+
- The numbered variant drops the first/last double chevrons, because page 1 and page N are now single-click targets of their own. Previous and next remain. The compact variant is unchanged.
|
|
13
|
+
- Numbered pages fall back to compact on their own when the page count is not trustworthy — that is, under `manualPagination` with no `pageCount` supplied, where TanStack infers a count from the rows it happens to hold rather than from a result total. Numbering that would invite clicks on pages that may not exist is not rendered.
|
|
14
|
+
- Below the `sm` breakpoint the numbers give way to the position text; seven page buttons plus the rows-per-page select do not fit a phone.
|
|
15
|
+
- Added `paginationLabels` so the bar can be localized: `rowsPerPage`, `pagination`, `goToPage`, `currentPage`, `firstPage`, `previousPage`, `nextPage`, `lastPage`, `pageOf`, and `rowsSelected`. All optional, all falling back to the previous English strings.
|
|
16
|
+
- Pagination chevrons now mirror under `dir="rtl"`. They previously pointed against the reading direction in right-to-left layouts.
|
|
17
|
+
- The page controls are wrapped in a labelled `nav`, and the current page carries `aria-current="page"`.
|
|
18
|
+
- Exported `buildPageItems` and `NTablePageItem` for consumers that need the same windowing outside the table.
|
|
19
|
+
|
|
3
20
|
## 2.2.1
|
|
4
21
|
|
|
5
22
|
- Fixed a regression in 2.2.0: the dynamic page size reported under `manualPagination` could oscillate. Card row height is measured from rendered cards, so it grows as images decode; feeding that back into the page size refetched, re-rendered, re-measured, and refetched again. A list visibly settled from one page size to another with the loading skeleton flashing twice. The report is now allowed once per container geometry, which does not depend on the rows inside it, so it terminates. A resize still re-arms it, and the debounce still waits for the measurement to settle before reporting.
|
package/dist/index.d.ts
CHANGED
|
@@ -2771,6 +2771,42 @@ type StepSubmitResult = {
|
|
|
2771
2771
|
};
|
|
2772
2772
|
declare function useFormSubmission({ steps, schema, defaultValues, onSubmit, currentStep, isLastStep, handleNext, markStepCompleted, reset, }: UseFormSubmissionOptions): FormSubmissionState;
|
|
2773
2773
|
|
|
2774
|
+
/**
|
|
2775
|
+
* How the page controls present position within the result.
|
|
2776
|
+
*
|
|
2777
|
+
* `numbered` renders a windowed list of page buttons. `compact` renders the
|
|
2778
|
+
* `Page X of Y` text with first/previous/next/last controls.
|
|
2779
|
+
*
|
|
2780
|
+
* `numbered` needs a trustworthy page count. Under `manualPagination` that
|
|
2781
|
+
* means the application must pass a `pageCount` derived from a real result
|
|
2782
|
+
* total; without one, the bar falls back to `compact` on its own rather than
|
|
2783
|
+
* inviting clicks on pages that may not exist.
|
|
2784
|
+
*/
|
|
2785
|
+
type NTablePaginationVariant = "numbered" | "compact";
|
|
2786
|
+
/**
|
|
2787
|
+
* Accessible names and visible copy for the page controls.
|
|
2788
|
+
*
|
|
2789
|
+
* Every field is optional and falls back to English. Supply them to localize —
|
|
2790
|
+
* the numbered variant is mostly digits, but its controls still need names.
|
|
2791
|
+
*/
|
|
2792
|
+
interface NTablePaginationLabels {
|
|
2793
|
+
/** Labels the rows-per-page select. Defaults to `"Rows/page"`. */
|
|
2794
|
+
rowsPerPage?: string;
|
|
2795
|
+
/** Accessible name of the whole page control group. Defaults to `"Pagination"`. */
|
|
2796
|
+
pagination?: string;
|
|
2797
|
+
/** Accessible name for one page button, given a 1-based page. */
|
|
2798
|
+
goToPage?: (page: number) => string;
|
|
2799
|
+
/** Accessible name of the current page button, given a 1-based page. */
|
|
2800
|
+
currentPage?: (page: number) => string;
|
|
2801
|
+
firstPage?: string;
|
|
2802
|
+
previousPage?: string;
|
|
2803
|
+
nextPage?: string;
|
|
2804
|
+
lastPage?: string;
|
|
2805
|
+
/** The `compact` variant's position text, given 1-based values. */
|
|
2806
|
+
pageOf?: (page: number, pageCount: number) => string;
|
|
2807
|
+
/** The selection summary, given selected and total row counts. */
|
|
2808
|
+
rowsSelected?: (selected: number, total: number) => string;
|
|
2809
|
+
}
|
|
2774
2810
|
interface NTableLoadMorePagination {
|
|
2775
2811
|
/** Render the supplied rows as one card list with an explicit continuation control. */
|
|
2776
2812
|
mode: "load-more";
|
|
@@ -2933,6 +2969,8 @@ interface TableState {
|
|
|
2933
2969
|
availableModes: readonly ViewMode[];
|
|
2934
2970
|
setViewMode: (mode: ViewMode) => void;
|
|
2935
2971
|
hasSyncedFromProps: boolean;
|
|
2972
|
+
paginationVariant: NTablePaginationVariant;
|
|
2973
|
+
paginationLabels: NTablePaginationLabels;
|
|
2936
2974
|
manualPagination: boolean;
|
|
2937
2975
|
pageCount: number | undefined;
|
|
2938
2976
|
rowCount: number | undefined;
|
|
@@ -3071,6 +3109,8 @@ declare const createTableStore: (seed?: Partial<TableState>) => {
|
|
|
3071
3109
|
availableModes: () => readonly ViewMode[];
|
|
3072
3110
|
setViewMode: () => (mode: ViewMode) => void;
|
|
3073
3111
|
hasSyncedFromProps: () => boolean;
|
|
3112
|
+
paginationVariant: () => NTablePaginationVariant;
|
|
3113
|
+
paginationLabels: () => NTablePaginationLabels;
|
|
3074
3114
|
manualPagination: () => boolean;
|
|
3075
3115
|
pageCount: () => number;
|
|
3076
3116
|
rowCount: () => number;
|
|
@@ -3262,6 +3302,14 @@ interface NTableProps<T = any, M extends ViewMode = ViewMode> {
|
|
|
3262
3302
|
}) => void;
|
|
3263
3303
|
/** Pagination presentation used whenever NTable is actually rendering cards. */
|
|
3264
3304
|
cardPagination?: NTableCardPagination;
|
|
3305
|
+
/**
|
|
3306
|
+
* How the page controls present position. Defaults to `"numbered"`, which
|
|
3307
|
+
* falls back to `"compact"` on its own when the page count is not
|
|
3308
|
+
* trustworthy. Pass `"compact"` for the `Page X of Y` text everywhere.
|
|
3309
|
+
*/
|
|
3310
|
+
paginationVariant?: NTablePaginationVariant;
|
|
3311
|
+
/** Accessible names and visible copy for the page controls. */
|
|
3312
|
+
paginationLabels?: NTablePaginationLabels;
|
|
3265
3313
|
rowSelection?: RowSelectionState;
|
|
3266
3314
|
defaultRowSelection?: RowSelectionState;
|
|
3267
3315
|
onRowSelectionChange?: (state: RowSelectionState) => void;
|
|
@@ -3324,6 +3372,50 @@ declare function NTable<T = any, M extends ViewMode = ViewMode>(props: NTableCol
|
|
|
3324
3372
|
*/
|
|
3325
3373
|
declare function NTable<T = any, M extends ViewMode = ViewMode>(props: NTableProps<T, M>): React__default.ReactElement;
|
|
3326
3374
|
|
|
3375
|
+
/** A rendered slot in the numbered page list. */
|
|
3376
|
+
type NTablePageItem = {
|
|
3377
|
+
type: "page";
|
|
3378
|
+
pageIndex: number;
|
|
3379
|
+
} | {
|
|
3380
|
+
type: "gap";
|
|
3381
|
+
key: "start" | "end";
|
|
3382
|
+
};
|
|
3383
|
+
/**
|
|
3384
|
+
* The page numbers to render for a given position in the result.
|
|
3385
|
+
*
|
|
3386
|
+
* Always yields the first and last page, the current page, and `siblingCount`
|
|
3387
|
+
* pages either side of it, collapsing the rest into at most two gaps. Near
|
|
3388
|
+
* either end, where one gap is not needed, the freed slots extend the run of
|
|
3389
|
+
* pages instead of being dropped — so the slot count stays constant at
|
|
3390
|
+
* `2 * siblingCount + 5` for any result longer than that. A bar that changes
|
|
3391
|
+
* width on every click is worse than the text it replaced.
|
|
3392
|
+
*/
|
|
3393
|
+
declare function buildPageItems(pageIndex: number, pageCount: number, siblingCount?: number): NTablePageItem[];
|
|
3394
|
+
|
|
3395
|
+
/**
|
|
3396
|
+
* Defaults every `NTable` beneath the provider inherits.
|
|
3397
|
+
*
|
|
3398
|
+
* Localized copy is the motivating case: an application with more than a couple
|
|
3399
|
+
* of tables should not repeat the same label bundle at every render site, and
|
|
3400
|
+
* an application with more than one locale should not have to remember to.
|
|
3401
|
+
*/
|
|
3402
|
+
interface NTableDefaults {
|
|
3403
|
+
paginationLabels?: NTablePaginationLabels;
|
|
3404
|
+
}
|
|
3405
|
+
/**
|
|
3406
|
+
* Supply table defaults to everything below.
|
|
3407
|
+
*
|
|
3408
|
+
* `value` is passed straight through, so memoize it in the caller — an inline
|
|
3409
|
+
* object literal rebuilds on every render of the shell and re-renders every
|
|
3410
|
+
* table beneath it. Most label fields are functions, so `useMemo` on the
|
|
3411
|
+
* translator is usually the whole job.
|
|
3412
|
+
*/
|
|
3413
|
+
declare function NTableDefaultsProvider({ children, value, }: {
|
|
3414
|
+
children: React__default.ReactNode;
|
|
3415
|
+
value: NTableDefaults;
|
|
3416
|
+
}): react_jsx_runtime.JSX.Element;
|
|
3417
|
+
declare function useNTableDefaults(): NTableDefaults;
|
|
3418
|
+
|
|
3327
3419
|
declare function NTableContent({ effectiveMode }: {
|
|
3328
3420
|
effectiveMode?: string;
|
|
3329
3421
|
}): react_jsx_runtime.JSX.Element;
|
|
@@ -3519,6 +3611,8 @@ declare const TableStoreContext: React$1.Context<{
|
|
|
3519
3611
|
availableModes: () => readonly ViewMode[];
|
|
3520
3612
|
setViewMode: () => (mode: ViewMode) => void;
|
|
3521
3613
|
hasSyncedFromProps: () => boolean;
|
|
3614
|
+
paginationVariant: () => NTablePaginationVariant;
|
|
3615
|
+
paginationLabels: () => NTablePaginationLabels;
|
|
3522
3616
|
manualPagination: () => boolean;
|
|
3523
3617
|
pageCount: () => number;
|
|
3524
3618
|
rowCount: () => number;
|
|
@@ -3652,6 +3746,8 @@ declare function useStoreSync(props: any): {
|
|
|
3652
3746
|
availableModes: () => readonly ViewMode[];
|
|
3653
3747
|
setViewMode: () => (mode: ViewMode) => void;
|
|
3654
3748
|
hasSyncedFromProps: () => boolean;
|
|
3749
|
+
paginationVariant: () => NTablePaginationVariant;
|
|
3750
|
+
paginationLabels: () => NTablePaginationLabels;
|
|
3655
3751
|
manualPagination: () => boolean;
|
|
3656
3752
|
pageCount: () => number;
|
|
3657
3753
|
rowCount: () => number;
|
|
@@ -4092,4 +4188,4 @@ interface NGridItemProps extends Omit<React$1.AllHTMLAttributes<HTMLDivElement>,
|
|
|
4092
4188
|
declare function NGrid({ as: Comp, children, cols, smCols, mdCols, lgCols, xlCols, gap, className, style, ...props }: NGridProps): react_jsx_runtime.JSX.Element;
|
|
4093
4189
|
declare function NGridItem({ children, span, smSpan, mdSpan, lgSpan, xlSpan, className, ...props }: NGridItemProps): react_jsx_runtime.JSX.Element;
|
|
4094
4190
|
|
|
4095
|
-
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 NTableInfinitePagination, 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 };
|
|
4191
|
+
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, type NTableDefaults, NTableDefaultsProvider, NTableHeader, type NTableInfinitePagination, type NTableLoadMorePagination, NTableLoadingSkeleton, type NTableMenu, type NTableMenuProp, type NTablePageItem, NTablePagination, type NTablePaginationLabels, type NTablePaginationVariant, 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, buildPageItems, 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, useNTableDefaults, useNajmAppearance, useNajmComponentStyle, useNajmDesign, useNajmThemeMode, usePrefix, useSelection, useStepNavigation, useStorageContextMenu, useStoreSync, useTable, useTableKeyboard, useTableStore, useVariant, useVariantPreset };
|
package/dist/index.mjs
CHANGED
|
@@ -12222,6 +12222,8 @@ var createTableStore = (seed) => {
|
|
|
12222
12222
|
hasMeasuredLayout: false,
|
|
12223
12223
|
skeletonRowCount: 6,
|
|
12224
12224
|
maxHeight: null,
|
|
12225
|
+
paginationVariant: "numbered",
|
|
12226
|
+
paginationLabels: {},
|
|
12225
12227
|
bodyWidth: 0,
|
|
12226
12228
|
bodyHeight: 0,
|
|
12227
12229
|
tableHeaderHeight: 48,
|
|
@@ -13728,6 +13730,69 @@ function NTableCards({ effectiveMode }) {
|
|
|
13728
13730
|
) : null
|
|
13729
13731
|
] });
|
|
13730
13732
|
}
|
|
13733
|
+
|
|
13734
|
+
// src/components/table/paginationPages.ts
|
|
13735
|
+
function buildPageItems(pageIndex, pageCount, siblingCount = 1) {
|
|
13736
|
+
const pages = Math.max(0, Math.floor(pageCount));
|
|
13737
|
+
if (pages <= 0) return [];
|
|
13738
|
+
const current = Math.min(Math.max(0, Math.floor(pageIndex)), pages - 1);
|
|
13739
|
+
const siblings = Math.max(0, Math.floor(siblingCount));
|
|
13740
|
+
const lastIndex = pages - 1;
|
|
13741
|
+
const windowSize = siblings * 2 + 5;
|
|
13742
|
+
if (pages <= windowSize) {
|
|
13743
|
+
return range(0, lastIndex);
|
|
13744
|
+
}
|
|
13745
|
+
const left = Math.max(current - siblings, 0);
|
|
13746
|
+
const right = Math.min(current + siblings, lastIndex);
|
|
13747
|
+
const showStartGap = left - 1 >= 2;
|
|
13748
|
+
const showEndGap = lastIndex - 1 - right >= 2;
|
|
13749
|
+
const runLength = siblings * 2 + 3;
|
|
13750
|
+
if (!showStartGap && showEndGap) {
|
|
13751
|
+
return [
|
|
13752
|
+
...range(0, runLength - 1),
|
|
13753
|
+
{ type: "gap", key: "end" },
|
|
13754
|
+
page(lastIndex)
|
|
13755
|
+
];
|
|
13756
|
+
}
|
|
13757
|
+
if (showStartGap && !showEndGap) {
|
|
13758
|
+
return [
|
|
13759
|
+
page(0),
|
|
13760
|
+
{ type: "gap", key: "start" },
|
|
13761
|
+
...range(lastIndex - runLength + 1, lastIndex)
|
|
13762
|
+
];
|
|
13763
|
+
}
|
|
13764
|
+
return [
|
|
13765
|
+
page(0),
|
|
13766
|
+
{ type: "gap", key: "start" },
|
|
13767
|
+
...range(left, right),
|
|
13768
|
+
{ type: "gap", key: "end" },
|
|
13769
|
+
page(lastIndex)
|
|
13770
|
+
];
|
|
13771
|
+
}
|
|
13772
|
+
function page(pageIndex) {
|
|
13773
|
+
return { type: "page", pageIndex };
|
|
13774
|
+
}
|
|
13775
|
+
function range(from, to) {
|
|
13776
|
+
return Array.from({ length: to - from + 1 }, (_, index) => page(from + index));
|
|
13777
|
+
}
|
|
13778
|
+
var NTableDefaultsContext = React__default.createContext({});
|
|
13779
|
+
function NTableDefaultsProvider({
|
|
13780
|
+
children,
|
|
13781
|
+
value
|
|
13782
|
+
}) {
|
|
13783
|
+
return /* @__PURE__ */ jsx(NTableDefaultsContext.Provider, { value, children });
|
|
13784
|
+
}
|
|
13785
|
+
function useNTableDefaults() {
|
|
13786
|
+
return React__default.useContext(NTableDefaultsContext);
|
|
13787
|
+
}
|
|
13788
|
+
function useResolvedPaginationLabels(own) {
|
|
13789
|
+
const defaults = useNTableDefaults();
|
|
13790
|
+
const inherited = defaults.paginationLabels;
|
|
13791
|
+
return React__default.useMemo(
|
|
13792
|
+
() => ({ ...inherited, ...own }),
|
|
13793
|
+
[inherited, own]
|
|
13794
|
+
);
|
|
13795
|
+
}
|
|
13731
13796
|
function CardLoadMorePagination({
|
|
13732
13797
|
config,
|
|
13733
13798
|
rowCount,
|
|
@@ -13821,6 +13886,44 @@ function CardLoadMorePagination({
|
|
|
13821
13886
|
}
|
|
13822
13887
|
);
|
|
13823
13888
|
}
|
|
13889
|
+
var navButtonClass = "h-8 w-8 p-0 text-foreground disabled:text-muted-foreground disabled:opacity-70";
|
|
13890
|
+
var chevronClass = "h-4 w-4 rtl:-scale-x-100";
|
|
13891
|
+
function PageNumbers({
|
|
13892
|
+
pageIndex,
|
|
13893
|
+
pageCount,
|
|
13894
|
+
bordered,
|
|
13895
|
+
labels,
|
|
13896
|
+
onSelect
|
|
13897
|
+
}) {
|
|
13898
|
+
return /* @__PURE__ */ jsx(Fragment, { children: buildPageItems(pageIndex, pageCount).map((item) => {
|
|
13899
|
+
if (item.type === "gap") {
|
|
13900
|
+
return /* @__PURE__ */ jsx(
|
|
13901
|
+
"span",
|
|
13902
|
+
{
|
|
13903
|
+
"aria-hidden": "true",
|
|
13904
|
+
className: "flex h-8 w-8 items-center justify-center text-sm text-muted-foreground",
|
|
13905
|
+
children: "\u2026"
|
|
13906
|
+
},
|
|
13907
|
+
`gap-${item.key}`
|
|
13908
|
+
);
|
|
13909
|
+
}
|
|
13910
|
+
const page2 = item.pageIndex + 1;
|
|
13911
|
+
const isCurrent = item.pageIndex === pageIndex;
|
|
13912
|
+
return /* @__PURE__ */ jsx(
|
|
13913
|
+
Button,
|
|
13914
|
+
{
|
|
13915
|
+
bordered,
|
|
13916
|
+
variant: isCurrent ? "default" : "outline",
|
|
13917
|
+
className: cn(navButtonClass, "tabular-nums"),
|
|
13918
|
+
"aria-label": isCurrent ? labels.currentPage?.(page2) ?? `Page ${page2}, current page` : labels.goToPage?.(page2) ?? `Go to page ${page2}`,
|
|
13919
|
+
"aria-current": isCurrent ? "page" : void 0,
|
|
13920
|
+
onClick: () => onSelect(item.pageIndex),
|
|
13921
|
+
children: page2
|
|
13922
|
+
},
|
|
13923
|
+
item.pageIndex
|
|
13924
|
+
);
|
|
13925
|
+
}) });
|
|
13926
|
+
}
|
|
13824
13927
|
function NTablePagination() {
|
|
13825
13928
|
const table = useTableStore.use.table();
|
|
13826
13929
|
const showPagination = useTableStore.use.showPagination();
|
|
@@ -13837,6 +13940,9 @@ function NTablePagination() {
|
|
|
13837
13940
|
const setPagination = useTableStore.use.setPagination();
|
|
13838
13941
|
const isPaginationControlled = useTableStore.use.isPaginationControlled();
|
|
13839
13942
|
const bordered = useTableStore.use.bordered();
|
|
13943
|
+
const paginationVariant = useTableStore.use.paginationVariant();
|
|
13944
|
+
const ownLabels = useTableStore.use.paginationLabels();
|
|
13945
|
+
const labels = useResolvedPaginationLabels(ownLabels);
|
|
13840
13946
|
if (!showPagination || effectiveViewMode === "json" || effectiveViewMode === "files") return null;
|
|
13841
13947
|
if (cardPagination.mode === "all") return null;
|
|
13842
13948
|
if (effectiveViewMode === "cards" && cardPagination.mode === "infinite") return null;
|
|
@@ -13879,10 +13985,15 @@ function NTablePagination() {
|
|
|
13879
13985
|
const newSize = Number(value);
|
|
13880
13986
|
setPagination({ pageIndex: 0, pageSize: newSize });
|
|
13881
13987
|
};
|
|
13988
|
+
const hasTrustworthyPageCount = manualPagination ? pageCount !== void 0 && pageCount > 0 : effectivePageCount > 0;
|
|
13989
|
+
const showNumbers = paginationVariant === "numbered" && hasTrustworthyPageCount;
|
|
13990
|
+
const canPrevious = (table?.getCanPreviousPage?.() ?? pageIndex > 0) && pageIndex > 0;
|
|
13991
|
+
const canNext = (table?.getCanNextPage?.() ?? true) && pageIndex < effectivePageCount - 1;
|
|
13992
|
+
const selectedTotal = manualPagination && rowCount !== void 0 ? rowCount : filteredRows.length;
|
|
13882
13993
|
return /* @__PURE__ */ jsxs("div", { className: cn("flex w-full min-w-0 flex-wrap items-center justify-between gap-x-4 gap-y-2 py-1 text-foreground", classNames?.pagination), children: [
|
|
13883
13994
|
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 flex-wrap items-center gap-4 lg:gap-6", children: [
|
|
13884
13995
|
(!isPaginationControlled || manualPagination) && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-foreground", children: [
|
|
13885
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-foreground", children: "Rows/page" }),
|
|
13996
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-foreground", children: labels.rowsPerPage ?? "Rows/page" }),
|
|
13886
13997
|
/* @__PURE__ */ jsxs(Select, { value: `${pageSize}`, onValueChange: handlePageSizeChange, children: [
|
|
13887
13998
|
/* @__PURE__ */ jsx(
|
|
13888
13999
|
SelectTrigger,
|
|
@@ -13895,25 +14006,32 @@ function NTablePagination() {
|
|
|
13895
14006
|
/* @__PURE__ */ jsx(SelectContent, { side: "top", children: currentPageSizeOptions.map((size) => /* @__PURE__ */ jsx(SelectItem, { value: `${size}`, children: size }, size)) })
|
|
13896
14007
|
] })
|
|
13897
14008
|
] }),
|
|
13898
|
-
/* @__PURE__ */
|
|
13899
|
-
|
|
13900
|
-
|
|
13901
|
-
|
|
13902
|
-
|
|
13903
|
-
|
|
13904
|
-
|
|
13905
|
-
|
|
13906
|
-
|
|
13907
|
-
|
|
13908
|
-
|
|
13909
|
-
|
|
14009
|
+
/* @__PURE__ */ jsx("div", { className: cn("text-sm font-medium text-foreground", showNumbers && "sm:hidden"), children: labels.pageOf?.(pageIndex + 1, effectivePageCount) ?? `Page ${pageIndex + 1} of ${effectivePageCount}` }),
|
|
14010
|
+
/* @__PURE__ */ jsxs(
|
|
14011
|
+
"nav",
|
|
14012
|
+
{
|
|
14013
|
+
"aria-label": labels.pagination ?? "Pagination",
|
|
14014
|
+
className: "flex items-center gap-2",
|
|
14015
|
+
children: [
|
|
14016
|
+
!showNumbers && /* @__PURE__ */ jsx(Button, { bordered, variant: "outline", className: cn(navButtonClass, "hidden lg:flex"), "aria-label": labels.firstPage ?? "First page", onClick: () => navigate("first"), disabled: !canPrevious, children: /* @__PURE__ */ jsx(ChevronsLeft, { className: chevronClass }) }),
|
|
14017
|
+
/* @__PURE__ */ jsx(Button, { bordered, variant: "outline", className: navButtonClass, "aria-label": labels.previousPage ?? "Previous", onClick: () => navigate("prev"), disabled: !canPrevious, children: /* @__PURE__ */ jsx(ChevronLeft, { className: chevronClass }) }),
|
|
14018
|
+
showNumbers && /* @__PURE__ */ jsx("div", { className: "hidden items-center gap-2 sm:flex", children: /* @__PURE__ */ jsx(
|
|
14019
|
+
PageNumbers,
|
|
14020
|
+
{
|
|
14021
|
+
pageIndex,
|
|
14022
|
+
pageCount: effectivePageCount,
|
|
14023
|
+
bordered,
|
|
14024
|
+
labels,
|
|
14025
|
+
onSelect: (next) => setPagination({ ...currentPagination, pageIndex: next })
|
|
14026
|
+
}
|
|
14027
|
+
) }),
|
|
14028
|
+
/* @__PURE__ */ jsx(Button, { bordered, variant: "outline", className: navButtonClass, "aria-label": labels.nextPage ?? "Next", onClick: () => navigate("next"), disabled: !canNext, children: /* @__PURE__ */ jsx(ChevronRight, { className: chevronClass }) }),
|
|
14029
|
+
!showNumbers && /* @__PURE__ */ jsx(Button, { bordered, variant: "outline", className: cn(navButtonClass, "hidden lg:flex"), "aria-label": labels.lastPage ?? "Last page", onClick: () => navigate("last"), disabled: !canNext, children: /* @__PURE__ */ jsx(ChevronsRight, { className: chevronClass }) })
|
|
14030
|
+
]
|
|
14031
|
+
}
|
|
14032
|
+
)
|
|
13910
14033
|
] }),
|
|
13911
|
-
/* @__PURE__ */
|
|
13912
|
-
selectedRows.length,
|
|
13913
|
-
" of ",
|
|
13914
|
-
manualPagination && rowCount !== void 0 ? rowCount : filteredRows.length,
|
|
13915
|
-
" row(s) selected."
|
|
13916
|
-
] })
|
|
14034
|
+
/* @__PURE__ */ jsx("div", { className: "min-w-0 flex-none whitespace-nowrap text-sm text-muted-foreground max-sm:hidden", children: labels.rowsSelected?.(selectedRows.length, selectedTotal) ?? `${selectedRows.length} of ${selectedTotal} row(s) selected.` })
|
|
13917
14035
|
] });
|
|
13918
14036
|
}
|
|
13919
14037
|
function PendingFilter({ placeholder, icon, bordered }) {
|
|
@@ -14501,6 +14619,8 @@ function NTable(props) {
|
|
|
14501
14619
|
defaultPagination: props.defaultPagination,
|
|
14502
14620
|
onPaginationChange: props.onPaginationChange ?? null,
|
|
14503
14621
|
cardPagination: props.cardPagination ?? { mode: "paged" },
|
|
14622
|
+
paginationVariant: props.paginationVariant ?? "numbered",
|
|
14623
|
+
paginationLabels: props.paginationLabels ?? {},
|
|
14504
14624
|
// Row selection
|
|
14505
14625
|
rowSelection: props.rowSelection,
|
|
14506
14626
|
defaultRowSelection: props.defaultRowSelection,
|
|
@@ -15869,4 +15989,4 @@ function NGridItem({
|
|
|
15869
15989
|
return /* @__PURE__ */ jsx("div", { className: itemClassName, ...props, children });
|
|
15870
15990
|
}
|
|
15871
15991
|
|
|
15872
|
-
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 };
|
|
15992
|
+
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, NTableDefaultsProvider, 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, buildPageItems, 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, useNTableDefaults, useNajmAppearance, useNajmComponentStyle, useNajmDesign, useNajmThemeMode, usePrefix, useSelection, useStepNavigation, useStorageContextMenu, useStoreSync, useTable, useTableKeyboard, useTableStore, useVariant, useVariantPreset };
|