@morze/ui 0.2.5 → 0.2.7
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/README.md +6 -1
- package/dist/index.cjs +111 -48
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +29 -4
- package/dist/index.d.ts +29 -4
- package/dist/index.js +111 -49
- package/dist/index.js.map +1 -1
- package/dist/morze-ui-tokens.css +1 -1
- package/dist/morze-ui.css +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -164,6 +164,12 @@ declare function Progress({ className, value, max, tone, ...props }: React.Compo
|
|
|
164
164
|
declare function Avatar({ className, size, ...props }: React.ComponentProps<typeof Avatar$1.Root> & {
|
|
165
165
|
size?: 'sm' | 'md' | 'lg';
|
|
166
166
|
}): React.JSX.Element;
|
|
167
|
+
/**
|
|
168
|
+
* Lays avatars in an overlapping stack. Each avatar gets a ring in the
|
|
169
|
+
* surface colour so the overlap reads as depth; set `--mz-avatar-ring` on the
|
|
170
|
+
* group when it sits on something other than a card.
|
|
171
|
+
*/
|
|
172
|
+
declare function AvatarGroup({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
167
173
|
declare function AvatarImage({ className, ...props }: React.ComponentProps<typeof Avatar$1.Image>): React.JSX.Element;
|
|
168
174
|
declare function AvatarFallback({ className, ...props }: React.ComponentProps<typeof Avatar$1.Fallback>): React.JSX.Element;
|
|
169
175
|
|
|
@@ -532,6 +538,12 @@ type DataTableProps<T> = {
|
|
|
532
538
|
/** localStorage key for widths, order, visibility and pinning. */
|
|
533
539
|
persistKey?: string | null;
|
|
534
540
|
toolbar?: React.ReactNode;
|
|
541
|
+
/**
|
|
542
|
+
* `false` drops the Columns button — for a table whose layout the host
|
|
543
|
+
* fixes, or drives from its own UI. The layout itself still works: `layout`,
|
|
544
|
+
* `onLayoutChange` and `persistKey` are unaffected.
|
|
545
|
+
*/
|
|
546
|
+
columnManager?: boolean;
|
|
535
547
|
/**
|
|
536
548
|
* Stretches the columns to fill the container on mount and on container
|
|
537
549
|
* resize, so there is no dead space at the right edge. Columns the user
|
|
@@ -562,7 +574,7 @@ type DataTableProps<T> = {
|
|
|
562
574
|
caption?: string;
|
|
563
575
|
className?: string;
|
|
564
576
|
};
|
|
565
|
-
declare function DataTable<T>({ columns, data, rowKey, total, loading, error, onRetry, query, onQueryChange, selection, onSelectionChange, bulkActions, renderExpanded, onRowClick, rowClassName, rowProps, layout: controlledLayout, onLayoutChange, persistKey, toolbar, autoFit, density, stickyHeader, emptyState, pageSizeOptions, pagination, onLoadMore, hasMore, autoLoadMore, labels: labelsProp, locale, caption, className, }: DataTableProps<T>): React.JSX.Element;
|
|
577
|
+
declare function DataTable<T>({ columns, data, rowKey, total, loading, error, onRetry, query, onQueryChange, selection, onSelectionChange, bulkActions, renderExpanded, onRowClick, rowClassName, rowProps, layout: controlledLayout, onLayoutChange, persistKey, toolbar, columnManager, autoFit, density, stickyHeader, emptyState, pageSizeOptions, pagination, onLoadMore, hasMore, autoLoadMore, labels: labelsProp, locale, caption, className, }: DataTableProps<T>): React.JSX.Element;
|
|
566
578
|
|
|
567
579
|
declare function DataTablePagination({ query, total, rowsOnPage, pageSizeOptions, labels: labelsProp, locale, onQueryChange, }: {
|
|
568
580
|
query: DataTableQuery;
|
|
@@ -584,7 +596,12 @@ type Props$1<T> = {
|
|
|
584
596
|
layout: ColumnLayout;
|
|
585
597
|
onToggleHidden: (id: string) => void;
|
|
586
598
|
onSetPinned: (id: string, side: 'left' | 'right' | undefined) => void;
|
|
587
|
-
|
|
599
|
+
/**
|
|
600
|
+
* Unused since the arrows started moving a column past its neighbour in the
|
|
601
|
+
* same pin group, which `onMoveTo` already expresses. Kept so a host that
|
|
602
|
+
* mounts this component directly still type-checks.
|
|
603
|
+
*/
|
|
604
|
+
onMove?: (id: string, delta: number) => void;
|
|
588
605
|
onMoveTo: (id: string, targetId: string) => void;
|
|
589
606
|
onReset: () => void;
|
|
590
607
|
labels?: Partial<DataTableLabels>;
|
|
@@ -593,8 +610,16 @@ type Props$1<T> = {
|
|
|
593
610
|
* Reordering lives here rather than on the header itself: dragging a header
|
|
594
611
|
* would fight the resize handle, and a list gives keyboard users real controls
|
|
595
612
|
* instead of a drag-only affordance.
|
|
613
|
+
*
|
|
614
|
+
* The list is grouped the way the table paints — pinned left, then loose, then
|
|
615
|
+
* pinned right — because it used to show the raw `layout.order` instead. A
|
|
616
|
+
* column dragged to the top of that list landed second in the table, behind
|
|
617
|
+
* whatever was pinned, and moving a column past a pinned neighbour changed the
|
|
618
|
+
* order without changing anything on screen. Both read as a broken reorder.
|
|
619
|
+
* Moves therefore stay inside a column's own group; crossing between them is
|
|
620
|
+
* what the pin button is for.
|
|
596
621
|
*/
|
|
597
|
-
declare function ColumnManager<T>({ columns, layout, onToggleHidden, onSetPinned,
|
|
622
|
+
declare function ColumnManager<T>({ columns, layout, onToggleHidden, onSetPinned, onMoveTo, onReset, labels: labelsProp, }: Props$1<T>): React.JSX.Element;
|
|
598
623
|
|
|
599
624
|
type Props = {
|
|
600
625
|
columnLabel: string;
|
|
@@ -704,4 +729,4 @@ declare function pageCount(total: number | undefined, pageSize: number): number;
|
|
|
704
729
|
declare function serializeSort(sort: DataTableSort[]): string;
|
|
705
730
|
declare function parseSort(raw: string | null): DataTableSort[];
|
|
706
731
|
|
|
707
|
-
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertTitle, Avatar, AvatarFallback, AvatarImage, Badge, Button, type ButtonProps, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, type CheckboxProps, ColumnFilter, type ColumnFilterDef, type ColumnLayout, ColumnManager, type CustomFilterContext, DataTable, type DataTableColumn, type DataTableFilters, DataTableLabels, DataTablePagination, type DataTableProps, type DataTableQuery, type DataTableSort, 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, type EditableDef, Field, FieldError, FieldHint, FilterChip, type FilterValue, Input, type InputProps, Label, type MorzeTheme, MorzeThemeProvider, type MorzeThemeProviderProps, Popover, PopoverAnchor, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, Progress, RadioGroup, RadioGroupItem, type RowAttributes, type RowSelectionState, type SavedView, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, type SelectOptionDef, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, type SidebarMenuButtonProps, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarPanel, type SidebarProps, SidebarProvider, type SidebarProviderProps, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, type SortDir, Spinner, Switch, type SwitchProps, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toggle, ToggleGroup, ToggleGroupItem, type Tone, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, type UseSavedViewsOptions, type UseTableQueryOptions, activeFilters, badgeVariants, buttonVariants, cn, emptyQuery, isFilterActive, pageCount, parseSort, serializeSort, setFilter, sortStateOf, toggleSort, toggleVariants, useColumnLayout, useIsMobile, useMorzeTheme, useRowSelection, useSavedViews, useSidebar, useTableQuery };
|
|
732
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertTitle, Avatar, AvatarFallback, AvatarGroup, AvatarImage, Badge, Button, type ButtonProps, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, type CheckboxProps, ColumnFilter, type ColumnFilterDef, type ColumnLayout, ColumnManager, type CustomFilterContext, DataTable, type DataTableColumn, type DataTableFilters, DataTableLabels, DataTablePagination, type DataTableProps, type DataTableQuery, type DataTableSort, 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, type EditableDef, Field, FieldError, FieldHint, FilterChip, type FilterValue, Input, type InputProps, Label, type MorzeTheme, MorzeThemeProvider, type MorzeThemeProviderProps, Popover, PopoverAnchor, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, Progress, RadioGroup, RadioGroupItem, type RowAttributes, type RowSelectionState, type SavedView, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, type SelectOptionDef, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, type SidebarMenuButtonProps, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarPanel, type SidebarProps, SidebarProvider, type SidebarProviderProps, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, type SortDir, Spinner, Switch, type SwitchProps, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toggle, ToggleGroup, ToggleGroupItem, type Tone, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, type UseSavedViewsOptions, type UseTableQueryOptions, activeFilters, badgeVariants, buttonVariants, cn, emptyQuery, isFilterActive, pageCount, parseSort, serializeSort, setFilter, sortStateOf, toggleSort, toggleVariants, useColumnLayout, useIsMobile, useMorzeTheme, useRowSelection, useSavedViews, useSidebar, useTableQuery };
|
package/dist/index.d.ts
CHANGED
|
@@ -164,6 +164,12 @@ declare function Progress({ className, value, max, tone, ...props }: React.Compo
|
|
|
164
164
|
declare function Avatar({ className, size, ...props }: React.ComponentProps<typeof Avatar$1.Root> & {
|
|
165
165
|
size?: 'sm' | 'md' | 'lg';
|
|
166
166
|
}): React.JSX.Element;
|
|
167
|
+
/**
|
|
168
|
+
* Lays avatars in an overlapping stack. Each avatar gets a ring in the
|
|
169
|
+
* surface colour so the overlap reads as depth; set `--mz-avatar-ring` on the
|
|
170
|
+
* group when it sits on something other than a card.
|
|
171
|
+
*/
|
|
172
|
+
declare function AvatarGroup({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
167
173
|
declare function AvatarImage({ className, ...props }: React.ComponentProps<typeof Avatar$1.Image>): React.JSX.Element;
|
|
168
174
|
declare function AvatarFallback({ className, ...props }: React.ComponentProps<typeof Avatar$1.Fallback>): React.JSX.Element;
|
|
169
175
|
|
|
@@ -532,6 +538,12 @@ type DataTableProps<T> = {
|
|
|
532
538
|
/** localStorage key for widths, order, visibility and pinning. */
|
|
533
539
|
persistKey?: string | null;
|
|
534
540
|
toolbar?: React.ReactNode;
|
|
541
|
+
/**
|
|
542
|
+
* `false` drops the Columns button — for a table whose layout the host
|
|
543
|
+
* fixes, or drives from its own UI. The layout itself still works: `layout`,
|
|
544
|
+
* `onLayoutChange` and `persistKey` are unaffected.
|
|
545
|
+
*/
|
|
546
|
+
columnManager?: boolean;
|
|
535
547
|
/**
|
|
536
548
|
* Stretches the columns to fill the container on mount and on container
|
|
537
549
|
* resize, so there is no dead space at the right edge. Columns the user
|
|
@@ -562,7 +574,7 @@ type DataTableProps<T> = {
|
|
|
562
574
|
caption?: string;
|
|
563
575
|
className?: string;
|
|
564
576
|
};
|
|
565
|
-
declare function DataTable<T>({ columns, data, rowKey, total, loading, error, onRetry, query, onQueryChange, selection, onSelectionChange, bulkActions, renderExpanded, onRowClick, rowClassName, rowProps, layout: controlledLayout, onLayoutChange, persistKey, toolbar, autoFit, density, stickyHeader, emptyState, pageSizeOptions, pagination, onLoadMore, hasMore, autoLoadMore, labels: labelsProp, locale, caption, className, }: DataTableProps<T>): React.JSX.Element;
|
|
577
|
+
declare function DataTable<T>({ columns, data, rowKey, total, loading, error, onRetry, query, onQueryChange, selection, onSelectionChange, bulkActions, renderExpanded, onRowClick, rowClassName, rowProps, layout: controlledLayout, onLayoutChange, persistKey, toolbar, columnManager, autoFit, density, stickyHeader, emptyState, pageSizeOptions, pagination, onLoadMore, hasMore, autoLoadMore, labels: labelsProp, locale, caption, className, }: DataTableProps<T>): React.JSX.Element;
|
|
566
578
|
|
|
567
579
|
declare function DataTablePagination({ query, total, rowsOnPage, pageSizeOptions, labels: labelsProp, locale, onQueryChange, }: {
|
|
568
580
|
query: DataTableQuery;
|
|
@@ -584,7 +596,12 @@ type Props$1<T> = {
|
|
|
584
596
|
layout: ColumnLayout;
|
|
585
597
|
onToggleHidden: (id: string) => void;
|
|
586
598
|
onSetPinned: (id: string, side: 'left' | 'right' | undefined) => void;
|
|
587
|
-
|
|
599
|
+
/**
|
|
600
|
+
* Unused since the arrows started moving a column past its neighbour in the
|
|
601
|
+
* same pin group, which `onMoveTo` already expresses. Kept so a host that
|
|
602
|
+
* mounts this component directly still type-checks.
|
|
603
|
+
*/
|
|
604
|
+
onMove?: (id: string, delta: number) => void;
|
|
588
605
|
onMoveTo: (id: string, targetId: string) => void;
|
|
589
606
|
onReset: () => void;
|
|
590
607
|
labels?: Partial<DataTableLabels>;
|
|
@@ -593,8 +610,16 @@ type Props$1<T> = {
|
|
|
593
610
|
* Reordering lives here rather than on the header itself: dragging a header
|
|
594
611
|
* would fight the resize handle, and a list gives keyboard users real controls
|
|
595
612
|
* instead of a drag-only affordance.
|
|
613
|
+
*
|
|
614
|
+
* The list is grouped the way the table paints — pinned left, then loose, then
|
|
615
|
+
* pinned right — because it used to show the raw `layout.order` instead. A
|
|
616
|
+
* column dragged to the top of that list landed second in the table, behind
|
|
617
|
+
* whatever was pinned, and moving a column past a pinned neighbour changed the
|
|
618
|
+
* order without changing anything on screen. Both read as a broken reorder.
|
|
619
|
+
* Moves therefore stay inside a column's own group; crossing between them is
|
|
620
|
+
* what the pin button is for.
|
|
596
621
|
*/
|
|
597
|
-
declare function ColumnManager<T>({ columns, layout, onToggleHidden, onSetPinned,
|
|
622
|
+
declare function ColumnManager<T>({ columns, layout, onToggleHidden, onSetPinned, onMoveTo, onReset, labels: labelsProp, }: Props$1<T>): React.JSX.Element;
|
|
598
623
|
|
|
599
624
|
type Props = {
|
|
600
625
|
columnLabel: string;
|
|
@@ -704,4 +729,4 @@ declare function pageCount(total: number | undefined, pageSize: number): number;
|
|
|
704
729
|
declare function serializeSort(sort: DataTableSort[]): string;
|
|
705
730
|
declare function parseSort(raw: string | null): DataTableSort[];
|
|
706
731
|
|
|
707
|
-
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertTitle, Avatar, AvatarFallback, AvatarImage, Badge, Button, type ButtonProps, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, type CheckboxProps, ColumnFilter, type ColumnFilterDef, type ColumnLayout, ColumnManager, type CustomFilterContext, DataTable, type DataTableColumn, type DataTableFilters, DataTableLabels, DataTablePagination, type DataTableProps, type DataTableQuery, type DataTableSort, 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, type EditableDef, Field, FieldError, FieldHint, FilterChip, type FilterValue, Input, type InputProps, Label, type MorzeTheme, MorzeThemeProvider, type MorzeThemeProviderProps, Popover, PopoverAnchor, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, Progress, RadioGroup, RadioGroupItem, type RowAttributes, type RowSelectionState, type SavedView, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, type SelectOptionDef, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, type SidebarMenuButtonProps, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarPanel, type SidebarProps, SidebarProvider, type SidebarProviderProps, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, type SortDir, Spinner, Switch, type SwitchProps, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toggle, ToggleGroup, ToggleGroupItem, type Tone, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, type UseSavedViewsOptions, type UseTableQueryOptions, activeFilters, badgeVariants, buttonVariants, cn, emptyQuery, isFilterActive, pageCount, parseSort, serializeSort, setFilter, sortStateOf, toggleSort, toggleVariants, useColumnLayout, useIsMobile, useMorzeTheme, useRowSelection, useSavedViews, useSidebar, useTableQuery };
|
|
732
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertTitle, Avatar, AvatarFallback, AvatarGroup, AvatarImage, Badge, Button, type ButtonProps, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, type CheckboxProps, ColumnFilter, type ColumnFilterDef, type ColumnLayout, ColumnManager, type CustomFilterContext, DataTable, type DataTableColumn, type DataTableFilters, DataTableLabels, DataTablePagination, type DataTableProps, type DataTableQuery, type DataTableSort, 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, type EditableDef, Field, FieldError, FieldHint, FilterChip, type FilterValue, Input, type InputProps, Label, type MorzeTheme, MorzeThemeProvider, type MorzeThemeProviderProps, Popover, PopoverAnchor, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, Progress, RadioGroup, RadioGroupItem, type RowAttributes, type RowSelectionState, type SavedView, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, type SelectOptionDef, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, type SidebarMenuButtonProps, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarPanel, type SidebarProps, SidebarProvider, type SidebarProviderProps, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, type SortDir, Spinner, Switch, type SwitchProps, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toggle, ToggleGroup, ToggleGroupItem, type Tone, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, type UseSavedViewsOptions, type UseTableQueryOptions, activeFilters, badgeVariants, buttonVariants, cn, emptyQuery, isFilterActive, pageCount, parseSort, serializeSort, setFilter, sortStateOf, toggleSort, toggleVariants, useColumnLayout, useIsMobile, useMorzeTheme, useRowSelection, useSavedViews, useSidebar, useTableQuery };
|
package/dist/index.js
CHANGED
|
@@ -138,8 +138,8 @@ var ArrowUpIcon = icon(/* @__PURE__ */ jsx("path", { d: "M12 19V5m-7 7 7-7 7 7"
|
|
|
138
138
|
var ArrowDownIcon = icon(/* @__PURE__ */ jsx("path", { d: "M12 5v14m7-7-7 7-7-7" }));
|
|
139
139
|
var SortIcon = icon(
|
|
140
140
|
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
141
|
-
/* @__PURE__ */ jsx("path", { d: "
|
|
142
|
-
/* @__PURE__ */ jsx("path", { d: "
|
|
141
|
+
/* @__PURE__ */ jsx("path", { d: "m8 10 4-4 4 4" }),
|
|
142
|
+
/* @__PURE__ */ jsx("path", { d: "m8 14 4 4 4-4" })
|
|
143
143
|
] })
|
|
144
144
|
);
|
|
145
145
|
var FilterIcon = icon(/* @__PURE__ */ jsx("path", { d: "M4 5h16l-6.5 7.5V19l-3 2v-8.5L4 5Z" }));
|
|
@@ -159,7 +159,13 @@ var GripIcon = icon(
|
|
|
159
159
|
/* @__PURE__ */ jsx("circle", { cx: "15", cy: "17", r: "1.4", fill: "currentColor" })
|
|
160
160
|
] })
|
|
161
161
|
);
|
|
162
|
-
var PinIcon = icon(
|
|
162
|
+
var PinIcon = icon(
|
|
163
|
+
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
164
|
+
/* @__PURE__ */ jsx("path", { d: "M9 4h6v5l3 4v2H6v-2l3-4V4Z" }),
|
|
165
|
+
/* @__PURE__ */ jsx("path", { d: "M8 4h8" }),
|
|
166
|
+
/* @__PURE__ */ jsx("path", { d: "M12 15v5" })
|
|
167
|
+
] })
|
|
168
|
+
);
|
|
163
169
|
var EyeIcon = icon(
|
|
164
170
|
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
165
171
|
/* @__PURE__ */ jsx("path", { d: "M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7Z" }),
|
|
@@ -888,6 +894,9 @@ function Avatar({
|
|
|
888
894
|
}
|
|
889
895
|
);
|
|
890
896
|
}
|
|
897
|
+
function AvatarGroup({ className, ...props }) {
|
|
898
|
+
return /* @__PURE__ */ jsx("div", { "data-slot": "avatar-group", role: "group", className: cn("mz-avatar-group", className), ...props });
|
|
899
|
+
}
|
|
891
900
|
function AvatarImage({ className, ...props }) {
|
|
892
901
|
return /* @__PURE__ */ jsx(
|
|
893
902
|
Avatar$1.Image,
|
|
@@ -2079,26 +2088,53 @@ function FilterChip({
|
|
|
2079
2088
|
/* @__PURE__ */ jsx("button", { type: "button", onClick: onClear, "aria-label": clearLabel, className: "mz-focusable", children: "\xD7" })
|
|
2080
2089
|
] });
|
|
2081
2090
|
}
|
|
2091
|
+
function nameOf(column, declaredIndex) {
|
|
2092
|
+
if (column.label?.trim()) return column.label;
|
|
2093
|
+
if (typeof column.header === "string" && column.header.trim()) return column.header;
|
|
2094
|
+
return `#${declaredIndex + 1}`;
|
|
2095
|
+
}
|
|
2082
2096
|
function ColumnManager({
|
|
2083
2097
|
columns,
|
|
2084
2098
|
layout,
|
|
2085
2099
|
onToggleHidden,
|
|
2086
2100
|
onSetPinned,
|
|
2087
|
-
onMove,
|
|
2088
2101
|
onMoveTo,
|
|
2089
2102
|
onReset,
|
|
2090
2103
|
labels: labelsProp
|
|
2091
2104
|
}) {
|
|
2092
2105
|
const labels = resolveLabels(labelsProp);
|
|
2093
2106
|
const [dragging, setDragging] = React39.useState(null);
|
|
2094
|
-
const
|
|
2095
|
-
const
|
|
2107
|
+
const [dropTarget, setDropTarget] = React39.useState(null);
|
|
2108
|
+
const entries = React39.useMemo(() => {
|
|
2109
|
+
const byId = new Map(columns.map((c, index) => [c.id, { column: c, declaredIndex: index }]));
|
|
2110
|
+
const ordered = layout.order.map((id) => byId.get(id)).filter((e) => Boolean(e));
|
|
2111
|
+
const side = (id) => layout.pinned[id];
|
|
2112
|
+
const groups = ["left", void 0, "right"];
|
|
2113
|
+
return groups.flatMap((group) => {
|
|
2114
|
+
const inGroup = ordered.filter((e) => side(e.column.id) === group);
|
|
2115
|
+
return inGroup.map((entry, indexInGroup) => ({
|
|
2116
|
+
...entry,
|
|
2117
|
+
side: group,
|
|
2118
|
+
indexInGroup,
|
|
2119
|
+
groupSize: inGroup.length,
|
|
2120
|
+
previous: inGroup[indexInGroup - 1]?.column.id,
|
|
2121
|
+
next: inGroup[indexInGroup + 1]?.column.id,
|
|
2122
|
+
name: nameOf(entry.column, entry.declaredIndex)
|
|
2123
|
+
}));
|
|
2124
|
+
});
|
|
2125
|
+
}, [columns, layout]);
|
|
2126
|
+
const sideOf = (id) => layout.pinned[id];
|
|
2127
|
+
const canDrop = (targetId) => Boolean(dragging) && dragging !== targetId && sideOf(dragging) === sideOf(targetId);
|
|
2128
|
+
const endDrag = () => {
|
|
2129
|
+
setDragging(null);
|
|
2130
|
+
setDropTarget(null);
|
|
2131
|
+
};
|
|
2096
2132
|
const hiddenCount = layout.hidden.length;
|
|
2097
2133
|
return /* @__PURE__ */ jsxs(Popover, { children: [
|
|
2098
2134
|
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(Button, { variant: "secondary", size: "sm", children: [
|
|
2099
2135
|
/* @__PURE__ */ jsx(ColumnsIcon, {}),
|
|
2100
2136
|
labels.columns,
|
|
2101
|
-
hiddenCount > 0 ? /* @__PURE__ */ jsx("span", { className: "mz-dt__count", children:
|
|
2137
|
+
hiddenCount > 0 ? /* @__PURE__ */ jsx("span", { className: "mz-dt__count", children: entries.length - hiddenCount }) : null
|
|
2102
2138
|
] }) }),
|
|
2103
2139
|
/* @__PURE__ */ jsxs(PopoverContent, { align: "end", className: "mz-dt__columns", children: [
|
|
2104
2140
|
/* @__PURE__ */ jsxs("div", { className: "mz-dt__columns-head", children: [
|
|
@@ -2106,35 +2142,60 @@ function ColumnManager({
|
|
|
2106
2142
|
/* @__PURE__ */ jsx(Button, { variant: "link", size: "xs", onClick: onReset, children: labels.reset })
|
|
2107
2143
|
] }),
|
|
2108
2144
|
/* @__PURE__ */ jsx(Separator, {}),
|
|
2109
|
-
/* @__PURE__ */ jsx("ul", { className: "mz-dt__columns-list", children:
|
|
2145
|
+
/* @__PURE__ */ jsx("ul", { className: "mz-dt__columns-list", children: entries.map((entry) => {
|
|
2146
|
+
const column = entry.column;
|
|
2110
2147
|
const hidden = layout.hidden.includes(column.id);
|
|
2111
|
-
const pinned =
|
|
2112
|
-
const
|
|
2148
|
+
const pinned = entry.side;
|
|
2149
|
+
const name = entry.name;
|
|
2150
|
+
const pinTitle = pinned === "left" ? labels.pinnedLeft : pinned === "right" ? labels.pinnedRight : labels.notPinned;
|
|
2113
2151
|
return /* @__PURE__ */ jsxs(
|
|
2114
2152
|
"li",
|
|
2115
2153
|
{
|
|
2116
2154
|
className: "mz-dt__columns-item",
|
|
2117
2155
|
"data-dragging": dragging === column.id || void 0,
|
|
2156
|
+
"data-drop": dropTarget === column.id || void 0,
|
|
2157
|
+
"data-pinned": pinned,
|
|
2118
2158
|
draggable: true,
|
|
2119
|
-
onDragStart: () =>
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
setDragging(
|
|
2159
|
+
onDragStart: (event) => {
|
|
2160
|
+
if (event.target.closest(".mz-dt__columns-controls")) {
|
|
2161
|
+
event.preventDefault();
|
|
2162
|
+
return;
|
|
2163
|
+
}
|
|
2164
|
+
setDragging(column.id);
|
|
2165
|
+
event.dataTransfer.effectAllowed = "move";
|
|
2166
|
+
try {
|
|
2167
|
+
event.dataTransfer.setData("text/plain", column.id);
|
|
2168
|
+
} catch {
|
|
2169
|
+
}
|
|
2170
|
+
},
|
|
2171
|
+
onDragEnd: endDrag,
|
|
2172
|
+
onDragOver: (event) => {
|
|
2173
|
+
if (!canDrop(column.id)) {
|
|
2174
|
+
event.dataTransfer.dropEffect = "none";
|
|
2175
|
+
return;
|
|
2176
|
+
}
|
|
2177
|
+
event.preventDefault();
|
|
2178
|
+
event.dataTransfer.dropEffect = "move";
|
|
2179
|
+
setDropTarget(column.id);
|
|
2180
|
+
},
|
|
2181
|
+
onDragLeave: () => setDropTarget((c) => c === column.id ? null : c),
|
|
2182
|
+
onDrop: (event) => {
|
|
2183
|
+
event.preventDefault();
|
|
2184
|
+
if (canDrop(column.id)) onMoveTo(dragging, column.id);
|
|
2185
|
+
endDrag();
|
|
2125
2186
|
},
|
|
2126
2187
|
children: [
|
|
2127
2188
|
/* @__PURE__ */ jsx("span", { className: "mz-dt__columns-grip", "aria-hidden": "true", children: /* @__PURE__ */ jsx(GripIcon, {}) }),
|
|
2128
|
-
/* @__PURE__ */ jsx("span", { className: "mz-dt__columns-label", children:
|
|
2129
|
-
/* @__PURE__ */ jsxs("div", { className: "mz-dt__columns-controls", children: [
|
|
2189
|
+
/* @__PURE__ */ jsx("span", { className: "mz-dt__columns-label", children: name }),
|
|
2190
|
+
/* @__PURE__ */ jsxs("div", { className: "mz-dt__columns-controls", draggable: false, children: [
|
|
2130
2191
|
/* @__PURE__ */ jsx(
|
|
2131
2192
|
"button",
|
|
2132
2193
|
{
|
|
2133
2194
|
type: "button",
|
|
2134
2195
|
className: "mz-dt__icon-btn mz-focusable",
|
|
2135
|
-
disabled:
|
|
2136
|
-
onClick: () =>
|
|
2137
|
-
"aria-label": labels.moveUp(
|
|
2196
|
+
disabled: !entry.previous,
|
|
2197
|
+
onClick: () => entry.previous && onMoveTo(column.id, entry.previous),
|
|
2198
|
+
"aria-label": labels.moveUp(name),
|
|
2138
2199
|
children: "\u2191"
|
|
2139
2200
|
}
|
|
2140
2201
|
),
|
|
@@ -2143,9 +2204,9 @@ function ColumnManager({
|
|
|
2143
2204
|
{
|
|
2144
2205
|
type: "button",
|
|
2145
2206
|
className: "mz-dt__icon-btn mz-focusable",
|
|
2146
|
-
disabled:
|
|
2147
|
-
onClick: () =>
|
|
2148
|
-
"aria-label": labels.moveDown(
|
|
2207
|
+
disabled: !entry.next,
|
|
2208
|
+
onClick: () => entry.next && onMoveTo(column.id, entry.next),
|
|
2209
|
+
"aria-label": labels.moveDown(name),
|
|
2149
2210
|
children: "\u2193"
|
|
2150
2211
|
}
|
|
2151
2212
|
),
|
|
@@ -2153,14 +2214,12 @@ function ColumnManager({
|
|
|
2153
2214
|
"button",
|
|
2154
2215
|
{
|
|
2155
2216
|
type: "button",
|
|
2156
|
-
className: "mz-dt__icon-btn mz-focusable",
|
|
2217
|
+
className: "mz-dt__icon-btn mz-dt__pin mz-focusable",
|
|
2157
2218
|
"data-active": pinned ? true : void 0,
|
|
2219
|
+
"data-pinned": pinned,
|
|
2158
2220
|
onClick: () => onSetPinned(column.id, pinned === "left" ? "right" : pinned === "right" ? void 0 : "left"),
|
|
2159
|
-
"aria-label": labels.pinning(
|
|
2160
|
-
|
|
2161
|
-
pinned === "left" ? labels.pinnedLeft : pinned === "right" ? labels.pinnedRight : labels.notPinned
|
|
2162
|
-
),
|
|
2163
|
-
title: pinned === "left" ? labels.pinnedLeft : pinned === "right" ? labels.pinnedRight : labels.notPinned,
|
|
2221
|
+
"aria-label": labels.pinning(name, pinTitle),
|
|
2222
|
+
title: pinTitle,
|
|
2164
2223
|
children: /* @__PURE__ */ jsx(PinIcon, {})
|
|
2165
2224
|
}
|
|
2166
2225
|
),
|
|
@@ -2171,7 +2230,7 @@ function ColumnManager({
|
|
|
2171
2230
|
className: "mz-dt__icon-btn mz-focusable",
|
|
2172
2231
|
disabled: column.hideable === false,
|
|
2173
2232
|
onClick: () => onToggleHidden(column.id),
|
|
2174
|
-
"aria-label": hidden ? labels.show(
|
|
2233
|
+
"aria-label": hidden ? labels.show(name) : labels.hide(name),
|
|
2175
2234
|
children: hidden ? /* @__PURE__ */ jsx(EyeOffIcon, {}) : /* @__PURE__ */ jsx(EyeIcon, {})
|
|
2176
2235
|
}
|
|
2177
2236
|
)
|
|
@@ -2624,6 +2683,7 @@ function DataTable({
|
|
|
2624
2683
|
onLayoutChange,
|
|
2625
2684
|
persistKey = null,
|
|
2626
2685
|
toolbar,
|
|
2686
|
+
columnManager = true,
|
|
2627
2687
|
autoFit = true,
|
|
2628
2688
|
density = "normal",
|
|
2629
2689
|
stickyHeader = true,
|
|
@@ -2652,7 +2712,6 @@ function DataTable({
|
|
|
2652
2712
|
setWidth,
|
|
2653
2713
|
toggleHidden,
|
|
2654
2714
|
setPinned,
|
|
2655
|
-
move,
|
|
2656
2715
|
moveTo,
|
|
2657
2716
|
reset,
|
|
2658
2717
|
fitTo
|
|
@@ -2884,22 +2943,25 @@ function DataTable({
|
|
|
2884
2943
|
className: cn("mz-dt", className),
|
|
2885
2944
|
style: widthVars,
|
|
2886
2945
|
children: [
|
|
2887
|
-
(
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
{
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2946
|
+
(() => {
|
|
2947
|
+
const showManager = columnManager && columns.some((c) => c.hideable !== false);
|
|
2948
|
+
if (!toolbar && chips.length === 0 && !showManager) return null;
|
|
2949
|
+
return /* @__PURE__ */ jsxs("div", { className: "mz-dt__toolbar", children: [
|
|
2950
|
+
/* @__PURE__ */ jsx("div", { className: "mz-dt__toolbar-main", children: toolbar }),
|
|
2951
|
+
showManager && /* @__PURE__ */ jsx("div", { className: "mz-dt__toolbar-side", children: /* @__PURE__ */ jsx(
|
|
2952
|
+
ColumnManager,
|
|
2953
|
+
{
|
|
2954
|
+
columns,
|
|
2955
|
+
layout,
|
|
2956
|
+
labels: labelsProp,
|
|
2957
|
+
onToggleHidden: toggleHidden,
|
|
2958
|
+
onSetPinned: setPinned,
|
|
2959
|
+
onMoveTo: moveTo,
|
|
2960
|
+
onReset: reset
|
|
2961
|
+
}
|
|
2962
|
+
) })
|
|
2963
|
+
] });
|
|
2964
|
+
})(),
|
|
2903
2965
|
chips.length > 0 && /* @__PURE__ */ jsxs("div", { className: "mz-dt__chips", children: [
|
|
2904
2966
|
chips.map(([id, value]) => /* @__PURE__ */ jsx(
|
|
2905
2967
|
FilterChip,
|
|
@@ -3237,6 +3299,6 @@ function useSavedViews({
|
|
|
3237
3299
|
};
|
|
3238
3300
|
}
|
|
3239
3301
|
|
|
3240
|
-
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertTitle, Avatar, AvatarFallback, AvatarImage, Badge, Button, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, ColumnFilter, ColumnManager, DataTable, DataTablePagination, 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, Field, FieldError, FieldHint, FilterChip, Input, Label, MorzeThemeProvider, Popover, PopoverAnchor, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, Progress, RadioGroup, RadioGroupItem, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarPanel, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, Spinner, Switch, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, activeFilters, badgeVariants, buttonVariants, cn, defaultDataTableLabels, emptyQuery, isFilterActive, pageCount, parseSort, resolveLabels, serializeSort, setFilter, sortStateOf, toggleSort, toggleVariants, useColumnLayout, useIsMobile, useMorzeTheme, useRowSelection, useSavedViews, useSidebar, useTableQuery };
|
|
3302
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertTitle, Avatar, AvatarFallback, AvatarGroup, AvatarImage, Badge, Button, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, ColumnFilter, ColumnManager, DataTable, DataTablePagination, 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, Field, FieldError, FieldHint, FilterChip, Input, Label, MorzeThemeProvider, Popover, PopoverAnchor, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, Progress, RadioGroup, RadioGroupItem, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarPanel, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, Spinner, Switch, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, activeFilters, badgeVariants, buttonVariants, cn, defaultDataTableLabels, emptyQuery, isFilterActive, pageCount, parseSort, resolveLabels, serializeSort, setFilter, sortStateOf, toggleSort, toggleVariants, useColumnLayout, useIsMobile, useMorzeTheme, useRowSelection, useSavedViews, useSidebar, useTableQuery };
|
|
3241
3303
|
//# sourceMappingURL=index.js.map
|
|
3242
3304
|
//# sourceMappingURL=index.js.map
|