@mercurjs/dashboard-shared 2.3.6-canary.9 → 2.3.7-canary.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.
Files changed (3) hide show
  1. package/dist/index.d.ts +67 -8
  2. package/dist/index.js +1583 -1411
  3. package/package.json +9 -9
package/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@ import { HttpTypes, AdminOrder } from '@medusajs/types';
4
4
  import { z, ZodObject } from 'zod';
5
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
6
  import * as _mercurjs_dashboard_sdk from '@mercurjs/dashboard-sdk';
7
- import { Permission, PermissionsContextValue, PermissionMap, PermissionKey, PermissionRight, CustomFieldsConfig, NavItemOverride, ActivityEntry, CustomFormField, CustomDisplayField, SectionAction, CustomListExtension } from '@mercurjs/dashboard-sdk';
7
+ import { Permission, PermissionsContextValue, PermissionMap, PermissionKey, PermissionRight, CustomFieldsConfig, NavGroupConfig, NavItemOverride, ActivityEntry, CustomFormField, CustomDisplayField, SectionAction, CustomListExtension, CustomListFilter } from '@mercurjs/dashboard-sdk';
8
8
  import * as React$1 from 'react';
9
9
  import React__default, { ReactNode, PropsWithChildren, ComponentPropsWithoutRef, CSSProperties, ComponentType, ComponentProps, ForwardRefExoticComponent, Ref, RefAttributes, RefCallback, ReactElement, Dispatch, SetStateAction } from 'react';
10
10
  import { Tooltip, Heading, Text, DataTableColumnDef, DataTableFilter, DataTableCommand, DataTableEmptyStateProps, DataTableRowSelectionState, DataTableRow, Select, Input, Table, Drawer, FocusModal, ProgressStatus } from '@medusajs/ui';
@@ -1796,7 +1796,8 @@ type WidgetModule = {
1796
1796
  widgets?: Widget[];
1797
1797
  };
1798
1798
  type NavigationModule = {
1799
- items?: NavItemOverride[];
1799
+ groups?: NavGroupConfig[];
1800
+ items?: NavItemOverride<string>[];
1800
1801
  };
1801
1802
  type CustomFieldsModule = {
1802
1803
  configs?: CustomFieldsConfig[];
@@ -1827,6 +1828,7 @@ type ZoneWidgets = {
1827
1828
  declare class ExtensionRegistry {
1828
1829
  private widgets;
1829
1830
  private navOverrides;
1831
+ private navGroups;
1830
1832
  private customFields;
1831
1833
  constructor(input?: {
1832
1834
  widgets?: WidgetModule;
@@ -1836,7 +1838,8 @@ declare class ExtensionRegistry {
1836
1838
  private ensureSlot;
1837
1839
  private populateWidgets;
1838
1840
  getWidgets(slot: string): ZoneWidgets;
1839
- getNavOverrides(): NavItemOverride[];
1841
+ getNavOverrides(): NavItemOverride<string>[];
1842
+ getNavGroups(): NavGroupConfig[];
1840
1843
  private configsFor;
1841
1844
  /** Distinct module links declared across a model's configs. */
1842
1845
  getLinks(model: string): string[];
@@ -1917,6 +1920,51 @@ type CoreNavItem = {
1917
1920
  * items without a matching override are preserved in their original order.
1918
1921
  */
1919
1922
  declare function applyNavOverrides(coreRoutes: CoreNavItem[], overrides?: NavItemOverride[]): CoreNavItem[];
1923
+ type NavGroupItem = {
1924
+ id: string;
1925
+ label: string;
1926
+ to: string;
1927
+ translationNs?: string;
1928
+ };
1929
+ type NavGroup = {
1930
+ id: string;
1931
+ label: string;
1932
+ translationNs?: string;
1933
+ items: NavGroupItem[];
1934
+ };
1935
+ type ExtensionNavGroupItem = NavGroupItem & {
1936
+ group?: string;
1937
+ rank?: number;
1938
+ };
1939
+ /**
1940
+ * Resolves the grouped settings sidebar: the panel's built-in groups, plus the
1941
+ * groups and per-item overrides (`group`/`rank`/`hidden`/`label`) from the
1942
+ * host's `_navigation.ts`, plus extension routes placed by their route
1943
+ * config's `group`. An unknown group id falls back to the first built-in
1944
+ * group, extension routes list after a group's built-in items, and groups
1945
+ * left without items are dropped.
1946
+ */
1947
+ declare function applyNavGroups(coreGroups: NavGroup[], extensionItems?: ExtensionNavGroupItem[], config?: {
1948
+ groups?: NavGroupConfig[];
1949
+ items?: NavItemOverride<string>[];
1950
+ }): NavGroup[];
1951
+ type NavItemGroup<T> = {
1952
+ id: string;
1953
+ label: string;
1954
+ translationNs?: string;
1955
+ items: T[];
1956
+ };
1957
+ /**
1958
+ * Splits main sidebar items into the ungrouped list and the groups declared in
1959
+ * the host's `_navigation.ts`. The main sidebar has no built-in groups, so an
1960
+ * item whose group isn't declared stays ungrouped. Item order is preserved.
1961
+ */
1962
+ declare function groupNavItems<T extends {
1963
+ group?: string;
1964
+ }>(items: T[], groups?: NavGroupConfig[]): {
1965
+ ungrouped: T[];
1966
+ groups: NavItemGroup<T>[];
1967
+ };
1920
1968
 
1921
1969
  type FormExtensionZoneProps = {
1922
1970
  model: string;
@@ -2006,8 +2054,8 @@ type UseExtendableTableProps<TData> = {
2006
2054
  type ExtendableTable<TData> = {
2007
2055
  /** Base columns with custom override/add/hide/order applied. */
2008
2056
  columns: ColumnDef<TData, unknown>[];
2009
- /** Extra list filters contributed by custom-fields configs. */
2010
- filters: unknown[];
2057
+ /** List filters contributed by custom-fields configs; apply with `mergeListFilters`. */
2058
+ filters: CustomListFilter[];
2011
2059
  /** Extra multi-select bulk actions (rank-sorted). */
2012
2060
  bulkActions: SectionAction[];
2013
2061
  };
@@ -2016,11 +2064,22 @@ type ExtendableTable<TData> = {
2016
2064
  * mirrors `useExtendableForm` for tables. A `columns[]` entry whose `id` matches
2017
2065
  * a base column **overrides** it (custom header/cell), an unknown `id` **adds** a
2018
2066
  * column, `viewDefaults.columnVisibility[id] === false` **hides** it, and
2019
- * `viewDefaults.columnOrder` reorders. Also surfaces the config's `filters` and
2020
- * `bulkActions` for the caller to render.
2067
+ * `viewDefaults.columnOrder` reorders. Also surfaces the config's `filters`
2068
+ * (merge them into the base filters with `mergeListFilters`) and `bulkActions`
2069
+ * for the caller to render.
2021
2070
  */
2022
2071
  declare function useExtendableTable<TData>({ model, columns: baseColumns, }: UseExtendableTableProps<TData>): ExtendableTable<TData>;
2023
2072
 
2073
+ type Keyed = {
2074
+ key: string;
2075
+ };
2076
+ /**
2077
+ * Applies a custom-fields `list.filters` block to a table's built-in filters.
2078
+ * An entry whose `key` matches a built-in filter replaces it in place, an
2079
+ * entry with `remove: true` drops it, and any other key is appended.
2080
+ */
2081
+ declare function mergeListFilters<TFilter extends Keyed>(base: TFilter[], extensions: readonly CustomListFilter[]): TFilter[];
2082
+
2024
2083
  /** Turn a model's `link` relations into `+link.*` merge tokens. */
2025
2084
  declare const linkFields: (links: string[]) => string;
2026
2085
  /**
@@ -2201,4 +2260,4 @@ declare const RICH_TEXT_ALLOWED_ATTRIBUTES: string[];
2201
2260
  declare const isHtml: (value?: string | null) => boolean;
2202
2261
  declare const plainTextToHtml: (value?: string | null) => string;
2203
2262
 
2204
- export { type Action, type ActionGroup, ActionMenu, AddressForm, AddressSchema, type AttributeChange, type AttributeChangeKind, AttributeValueInput, BadgeListSummary, ChipGroup, ChipInput, CodeCell, CodeHeader, Combobox, type Command, ConditionalTooltip, ConfirmPrompt, type ConfirmPromptProps, type CoreNavItem, CountrySelect, CreatedAtCell, CreatedAtHeader, type CurrencyInfo, type CustomFieldsModule, CustomerInfo, DataGrid, DataTable, DateCell, DateHeader, DateRangeDisplay, DeprecatedPercentageInput, DisplayExtensionZone, type DisplayExtensionZoneProps, DisplayField, type DisplayFieldProps, DisplaySection, type DisplaySectionField, type DisplaySectionProps, type EditAttributeAttribute, EditAttributeForm, type EditAttributeFormProps, EmailCell, EmailForm, EmailHeader, EmailSchema, ErrorBoundary, type ExtendableTable, ExtensionProvider, type ExtensionProviderProps, ExtensionRegistry, type ExtractableOffer, type ExtractableOffers, type FieldDiff, FilePreview, type FileType, FileUpload, type FileUploadProps, type Filter, FilterGroup, Form, FormExtensionZone, type FormExtensionZoneProps, GeneralSectionSkeleton, HandleInput, HeadingSkeleton, IconAvatar, IconButtonSkeleton, ImageAvatar, type ImageRef, IncludesTaxTooltip, InfiniteList, JsonViewSection, JsonViewSectionSkeleton, KeyboundForm, LinkButton, ListBadge, ListSummary, Listicle, type ListicleProps, LocalizedTablePagination, type MediaDiff, MetadataForm, MetadataSection, MoneyAmountCell, NameCell, NameHeader, type NavigationModule, NoRecords, type NoRecordsProps, NoResults, type NoResultsProps, OrderBy, PercentageInput, PermissionAction, type PermissionActionProps, PermissionGuard, type PermissionGuardProps, type PermissionedCommand, PermissionsContext, PermissionsProvider, type PermissionsProviderProps, PlaceholderCell, PriceListDateStatus, type PriceListGridGroupRow, type PriceListGridOfferRow, type PriceListGridRow, PriceListStatus, PriceListType, type ProductAttributeBatchPayload, ProductAttributeSection, type ProductAttributeSectionProps, type ProductChangeAttribute, ProductChangePanel, type ProductChangePanelProps, type ProductChangeProduct, type ProductChangeResolvers, type ProductChangeVariant, type ProductChangeView, ProgressBar, ProvinceSelect, Query, REFERENCE_FIELDS, RICH_TEXT_ALLOWED_ATTRIBUTES, RICH_TEXT_ALLOWED_TAGS, type ReferenceField, type ResolvedAttribute, type ResolvedDisplays, type ResolvedFormField, RichText, RichTextEditor, type RichTextEditorProps, RouteDrawer, RouteFocusModal, RoutePermissionGuard, SIDEBAR_MENU_CONTENT, SIDEBAR_RAIL_FADE, SectionNoAccess, SectionRow, type SectionRowProps, SegmentedControl, type SegmentedControlOption, SidebarContext, type SidebarContextValue, SidebarLink, type SidebarLinkProps, SidebarProvider, type SidebarState, SingleColumnPage, SingleColumnPageSkeleton, Skeleton, SortableList, SortableTree, StackedDrawer, StackedFocusModal, type StaticCountry, StatusCell, SwitchBox, type TQueryKey, type TabDefinition, TabbedForm, TableFooterSkeleton, TableSectionSkeleton, TableSkeleton, TextCell, TextHeader, TextSkeleton, Thumbnail, TransferOwnershipSchema, TwoColumnPage, TwoColumnPageSkeleton, type UseExtendableFormProps, type UseExtendableTableProps, type UseQueryOptionsWrapper, type VariantGroup, VisuallyHidden, type Widget, type WidgetModule, type WidgetPlacement, type WidgetTab, type WidgetTabs, WidgetZone, type WidgetZoneProps, type ZoneWidgets, _DataTable, applyActionPermissions, applyNavOverrides, buildAdditionalDataDefaults, buildAdditionalDataSchema, buildOfferGridData, buildProductChangeView, countries, createDataGridHelper, createDataGridPriceColumns, createFormHelper, createWithPermission, currencies, extractPricesFromOffers, extractReferenceIds, filterCommandsByPermission, formatFieldValue, genericForwardRef, getCountryByIso2, getCurrencySymbol, getDecimalDigits, getExtensionRegistry, getFormattedAddress, getFormattedCountry, getLinkQuery, getLocaleAmount, getNativeSymbol, getPriceListStatus, getStylizedAmount, humanizeFieldName, isAmountLessThenRoundingError, isForbidden, isHtml, isImageList, isOrderActionable, isOrderAwaitingAction, isPermitted, isPriceListGroupRow, isProductRow, isReferenceField, isSameAddress, linkFields, permissionMapAllows, plainTextToHtml, productChangeViewHasContent, queryClient, queryKeysFactory, richTextContentClasses, sanitizeRichText, toPermissionList, useActionLocks, useCan, useCollapsedSidebar, useCombinedRefs, useCommandHistory, useDataTable, useDate, useDisplayFieldOverride, useDocumentDirection, useExpandedSidebar, useExtendableForm, useExtendableTable, useExtension, useExtensionActivity, useLinkQuery, usePermissionGate, usePermissions, usePermittedCommands, useQueryParams, useResourcePermissions, useRouteModal, useSidebar, useSidebarMenuPlacement, useStackedModal, useTabManagement, useTabbedForm, useWidgetTabs, withLinkFields };
2263
+ export { type Action, type ActionGroup, ActionMenu, AddressForm, AddressSchema, type AttributeChange, type AttributeChangeKind, AttributeValueInput, BadgeListSummary, ChipGroup, ChipInput, CodeCell, CodeHeader, Combobox, type Command, ConditionalTooltip, ConfirmPrompt, type ConfirmPromptProps, type CoreNavItem, CountrySelect, CreatedAtCell, CreatedAtHeader, type CurrencyInfo, type CustomFieldsModule, CustomerInfo, DataGrid, DataTable, DateCell, DateHeader, DateRangeDisplay, DeprecatedPercentageInput, DisplayExtensionZone, type DisplayExtensionZoneProps, DisplayField, type DisplayFieldProps, DisplaySection, type DisplaySectionField, type DisplaySectionProps, type EditAttributeAttribute, EditAttributeForm, type EditAttributeFormProps, EmailCell, EmailForm, EmailHeader, EmailSchema, ErrorBoundary, type ExtendableTable, ExtensionProvider, type ExtensionProviderProps, ExtensionRegistry, type ExtractableOffer, type ExtractableOffers, type FieldDiff, FilePreview, type FileType, FileUpload, type FileUploadProps, type Filter, FilterGroup, Form, FormExtensionZone, type FormExtensionZoneProps, GeneralSectionSkeleton, HandleInput, HeadingSkeleton, IconAvatar, IconButtonSkeleton, ImageAvatar, type ImageRef, IncludesTaxTooltip, InfiniteList, JsonViewSection, JsonViewSectionSkeleton, KeyboundForm, LinkButton, ListBadge, ListSummary, Listicle, type ListicleProps, LocalizedTablePagination, type MediaDiff, MetadataForm, MetadataSection, MoneyAmountCell, NameCell, NameHeader, type NavGroup, type NavGroupItem, type NavItemGroup, type NavigationModule, NoRecords, type NoRecordsProps, NoResults, type NoResultsProps, OrderBy, PercentageInput, PermissionAction, type PermissionActionProps, PermissionGuard, type PermissionGuardProps, type PermissionedCommand, PermissionsContext, PermissionsProvider, type PermissionsProviderProps, PlaceholderCell, PriceListDateStatus, type PriceListGridGroupRow, type PriceListGridOfferRow, type PriceListGridRow, PriceListStatus, PriceListType, type ProductAttributeBatchPayload, ProductAttributeSection, type ProductAttributeSectionProps, type ProductChangeAttribute, ProductChangePanel, type ProductChangePanelProps, type ProductChangeProduct, type ProductChangeResolvers, type ProductChangeVariant, type ProductChangeView, ProgressBar, ProvinceSelect, Query, REFERENCE_FIELDS, RICH_TEXT_ALLOWED_ATTRIBUTES, RICH_TEXT_ALLOWED_TAGS, type ReferenceField, type ResolvedAttribute, type ResolvedDisplays, type ResolvedFormField, RichText, RichTextEditor, type RichTextEditorProps, RouteDrawer, RouteFocusModal, RoutePermissionGuard, SIDEBAR_MENU_CONTENT, SIDEBAR_RAIL_FADE, SectionNoAccess, SectionRow, type SectionRowProps, SegmentedControl, type SegmentedControlOption, SidebarContext, type SidebarContextValue, SidebarLink, type SidebarLinkProps, SidebarProvider, type SidebarState, SingleColumnPage, SingleColumnPageSkeleton, Skeleton, SortableList, SortableTree, StackedDrawer, StackedFocusModal, type StaticCountry, StatusCell, SwitchBox, type TQueryKey, type TabDefinition, TabbedForm, TableFooterSkeleton, TableSectionSkeleton, TableSkeleton, TextCell, TextHeader, TextSkeleton, Thumbnail, TransferOwnershipSchema, TwoColumnPage, TwoColumnPageSkeleton, type UseExtendableFormProps, type UseExtendableTableProps, type UseQueryOptionsWrapper, type VariantGroup, VisuallyHidden, type Widget, type WidgetModule, type WidgetPlacement, type WidgetTab, type WidgetTabs, WidgetZone, type WidgetZoneProps, type ZoneWidgets, _DataTable, applyActionPermissions, applyNavGroups, applyNavOverrides, buildAdditionalDataDefaults, buildAdditionalDataSchema, buildOfferGridData, buildProductChangeView, countries, createDataGridHelper, createDataGridPriceColumns, createFormHelper, createWithPermission, currencies, extractPricesFromOffers, extractReferenceIds, filterCommandsByPermission, formatFieldValue, genericForwardRef, getCountryByIso2, getCurrencySymbol, getDecimalDigits, getExtensionRegistry, getFormattedAddress, getFormattedCountry, getLinkQuery, getLocaleAmount, getNativeSymbol, getPriceListStatus, getStylizedAmount, groupNavItems, humanizeFieldName, isAmountLessThenRoundingError, isForbidden, isHtml, isImageList, isOrderActionable, isOrderAwaitingAction, isPermitted, isPriceListGroupRow, isProductRow, isReferenceField, isSameAddress, linkFields, mergeListFilters, permissionMapAllows, plainTextToHtml, productChangeViewHasContent, queryClient, queryKeysFactory, richTextContentClasses, sanitizeRichText, toPermissionList, useActionLocks, useCan, useCollapsedSidebar, useCombinedRefs, useCommandHistory, useDataTable, useDate, useDisplayFieldOverride, useDocumentDirection, useExpandedSidebar, useExtendableForm, useExtendableTable, useExtension, useExtensionActivity, useLinkQuery, usePermissionGate, usePermissions, usePermittedCommands, useQueryParams, useResourcePermissions, useRouteModal, useSidebar, useSidebarMenuPlacement, useStackedModal, useTabManagement, useTabbedForm, useWidgetTabs, withLinkFields };