@mercurjs/dashboard-shared 2.3.6-canary.7 → 2.3.6-canary.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +19 -1
- package/dist/index.js +24 -11
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -1790,6 +1790,7 @@ type Widget = {
|
|
|
1790
1790
|
zone: string[];
|
|
1791
1791
|
widgetId: string;
|
|
1792
1792
|
permission?: Permission[];
|
|
1793
|
+
label?: string;
|
|
1793
1794
|
};
|
|
1794
1795
|
type WidgetModule = {
|
|
1795
1796
|
widgets?: Widget[];
|
|
@@ -1812,6 +1813,7 @@ type ResolvedWidget = {
|
|
|
1812
1813
|
Component: Widget["Component"];
|
|
1813
1814
|
widgetId: string;
|
|
1814
1815
|
permission?: Permission[];
|
|
1816
|
+
label?: string;
|
|
1815
1817
|
};
|
|
1816
1818
|
type ZoneWidgets = {
|
|
1817
1819
|
before: ResolvedWidget[];
|
|
@@ -1885,6 +1887,22 @@ type WidgetZoneProps = {
|
|
|
1885
1887
|
*/
|
|
1886
1888
|
declare const WidgetZone: ({ id, data, children }: WidgetZoneProps) => react_jsx_runtime.JSX.Element;
|
|
1887
1889
|
|
|
1890
|
+
type WidgetTab = {
|
|
1891
|
+
id: string;
|
|
1892
|
+
label: string;
|
|
1893
|
+
Component: Widget["Component"];
|
|
1894
|
+
};
|
|
1895
|
+
type WidgetTabs = {
|
|
1896
|
+
before: WidgetTab[];
|
|
1897
|
+
after: WidgetTab[];
|
|
1898
|
+
};
|
|
1899
|
+
/**
|
|
1900
|
+
* Tab-bar host. Returns the widgets targeting a `*.tabs` slot as tabs to place
|
|
1901
|
+
* `before` and `after` the built-in ones. A widget without a `label` cannot be
|
|
1902
|
+
* shown as a tab and is left out.
|
|
1903
|
+
*/
|
|
1904
|
+
declare const useWidgetTabs: (id: string) => WidgetTabs;
|
|
1905
|
+
|
|
1888
1906
|
type CoreNavItem = {
|
|
1889
1907
|
id: string;
|
|
1890
1908
|
label: string;
|
|
@@ -2183,4 +2201,4 @@ declare const RICH_TEXT_ALLOWED_ATTRIBUTES: string[];
|
|
|
2183
2201
|
declare const isHtml: (value?: string | null) => boolean;
|
|
2184
2202
|
declare const plainTextToHtml: (value?: string | null) => string;
|
|
2185
2203
|
|
|
2186
|
-
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, 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, withLinkFields };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -25960,7 +25960,8 @@ var ExtensionRegistry = class {
|
|
|
25960
25960
|
const resolved = {
|
|
25961
25961
|
Component: widget.Component,
|
|
25962
25962
|
widgetId: widget.widgetId,
|
|
25963
|
-
permission: widget.permission
|
|
25963
|
+
permission: widget.permission,
|
|
25964
|
+
label: widget.label
|
|
25964
25965
|
};
|
|
25965
25966
|
entry[placement].push(resolved);
|
|
25966
25967
|
}
|
|
@@ -26113,6 +26114,17 @@ var WidgetZone = ({ id, data, children }) => {
|
|
|
26113
26114
|
] });
|
|
26114
26115
|
};
|
|
26115
26116
|
|
|
26117
|
+
// src/extensions/use-widget-tabs.ts
|
|
26118
|
+
import { useContext as useContext12 } from "react";
|
|
26119
|
+
var useWidgetTabs = (id) => {
|
|
26120
|
+
const widgets = useExtension().getWidgets(id);
|
|
26121
|
+
const permissions = useContext12(PermissionsContext);
|
|
26122
|
+
const toTabs = (placement) => widgets[placement].flatMap(
|
|
26123
|
+
({ Component, widgetId, label, permission }) => label && isPermitted(permissions, permission) ? [{ id: widgetId, label, Component }] : []
|
|
26124
|
+
);
|
|
26125
|
+
return { before: toTabs("before"), after: toTabs("after") };
|
|
26126
|
+
};
|
|
26127
|
+
|
|
26116
26128
|
// src/extensions/nav.ts
|
|
26117
26129
|
import { createElement } from "react";
|
|
26118
26130
|
function applyNavOverrides(coreRoutes, overrides = []) {
|
|
@@ -26703,7 +26715,7 @@ import { Button as Button12, ProgressTabs } from "@medusajs/ui";
|
|
|
26703
26715
|
import {
|
|
26704
26716
|
Children as Children3,
|
|
26705
26717
|
createContext as createContext9,
|
|
26706
|
-
useContext as
|
|
26718
|
+
useContext as useContext13,
|
|
26707
26719
|
useMemo as useMemo22
|
|
26708
26720
|
} from "react";
|
|
26709
26721
|
import { useTranslation as useTranslation36 } from "react-i18next";
|
|
@@ -26778,7 +26790,7 @@ var useTabManagement = ({
|
|
|
26778
26790
|
import { jsx as jsx85, jsxs as jsxs60 } from "react/jsx-runtime";
|
|
26779
26791
|
var TabbedFormContext = createContext9(null);
|
|
26780
26792
|
var useTabbedForm = () => {
|
|
26781
|
-
const form =
|
|
26793
|
+
const form = useContext13(TabbedFormContext);
|
|
26782
26794
|
if (!form) {
|
|
26783
26795
|
throw new Error("useTabbedForm must be used within a TabbedForm");
|
|
26784
26796
|
}
|
|
@@ -26963,10 +26975,10 @@ import { useSearchParams as useSearchParams7 } from "react-router-dom";
|
|
|
26963
26975
|
import { useTranslation as useTranslation41 } from "react-i18next";
|
|
26964
26976
|
|
|
26965
26977
|
// src/components/table/data-table/data-table-filter/context.tsx
|
|
26966
|
-
import { createContext as createContext10, useContext as
|
|
26978
|
+
import { createContext as createContext10, useContext as useContext14 } from "react";
|
|
26967
26979
|
var DataTableFilterContext = createContext10(null);
|
|
26968
26980
|
var useDataTableFilterContext = () => {
|
|
26969
|
-
const ctx =
|
|
26981
|
+
const ctx = useContext14(DataTableFilterContext);
|
|
26970
26982
|
if (!ctx) {
|
|
26971
26983
|
throw new Error(
|
|
26972
26984
|
"useDataTableFacetedFilterContext must be used within a DataTableFacetedFilter"
|
|
@@ -28315,7 +28327,7 @@ import {
|
|
|
28315
28327
|
useEffect as useEffect25,
|
|
28316
28328
|
useRef as useRef19,
|
|
28317
28329
|
useState as useState38,
|
|
28318
|
-
useContext as
|
|
28330
|
+
useContext as useContext15
|
|
28319
28331
|
} from "react";
|
|
28320
28332
|
import { useTranslation as useTranslation44 } from "react-i18next";
|
|
28321
28333
|
import { Link as Link8 } from "react-router-dom";
|
|
@@ -28337,7 +28349,7 @@ var DataTableRoot = ({
|
|
|
28337
28349
|
const scrollableRef = useRef19(null);
|
|
28338
28350
|
const hasSelect = columns.find((c) => c.id === "select");
|
|
28339
28351
|
const hasActions = columns.find((c) => c.id === "actions");
|
|
28340
|
-
const permissions =
|
|
28352
|
+
const permissions = useContext15(PermissionsContext);
|
|
28341
28353
|
const hasCommandBar = commands && commands.length > 0;
|
|
28342
28354
|
const rowSelection = table.getState().rowSelection;
|
|
28343
28355
|
const { pageIndex, pageSize } = table.getState().pagination;
|
|
@@ -29042,9 +29054,9 @@ var PermissionsProvider = ({
|
|
|
29042
29054
|
};
|
|
29043
29055
|
|
|
29044
29056
|
// src/permissions/use-permissions.tsx
|
|
29045
|
-
import { useContext as
|
|
29057
|
+
import { useContext as useContext16 } from "react";
|
|
29046
29058
|
var usePermissions = () => {
|
|
29047
|
-
const context =
|
|
29059
|
+
const context = useContext16(PermissionsContext);
|
|
29048
29060
|
if (!context) {
|
|
29049
29061
|
throw new Error("usePermissions must be used within a PermissionsProvider");
|
|
29050
29062
|
}
|
|
@@ -29244,9 +29256,9 @@ var SidebarProvider = ({ children }) => {
|
|
|
29244
29256
|
import { useEffect as useEffect28, useRef as useRef20 } from "react";
|
|
29245
29257
|
|
|
29246
29258
|
// src/providers/sidebar-provider/use-sidebar.tsx
|
|
29247
|
-
import { useContext as
|
|
29259
|
+
import { useContext as useContext17 } from "react";
|
|
29248
29260
|
var useSidebar = () => {
|
|
29249
|
-
const context =
|
|
29261
|
+
const context = useContext17(SidebarContext);
|
|
29250
29262
|
if (!context) {
|
|
29251
29263
|
throw new Error("useSidebar must be used within a SidebarProvider");
|
|
29252
29264
|
}
|
|
@@ -29627,5 +29639,6 @@ export {
|
|
|
29627
29639
|
useStackedModal,
|
|
29628
29640
|
useTabManagement,
|
|
29629
29641
|
useTabbedForm,
|
|
29642
|
+
useWidgetTabs,
|
|
29630
29643
|
withLinkFields
|
|
29631
29644
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mercurjs/dashboard-shared",
|
|
3
|
-
"version": "2.3.6-canary.
|
|
3
|
+
"version": "2.3.6-canary.9",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/mercurjs/mercur",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@medusajs/dashboard": "2.21.0",
|
|
35
35
|
"@medusajs/icons": "2.21.0",
|
|
36
36
|
"@medusajs/ui": "4.2.3",
|
|
37
|
-
"@mercurjs/client": "2.3.6-canary.
|
|
37
|
+
"@mercurjs/client": "2.3.6-canary.9",
|
|
38
38
|
"@radix-ui/react-dialog": "1.1.19",
|
|
39
39
|
"@radix-ui/react-dismissable-layer": "1.1.4",
|
|
40
40
|
"@tanstack/react-query": "5.64.2",
|
|
@@ -70,9 +70,9 @@
|
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@medusajs/types": "2.21.0",
|
|
73
|
-
"@mercurjs/core": "2.3.6-canary.
|
|
74
|
-
"@mercurjs/dashboard-sdk": "2.3.6-canary.
|
|
75
|
-
"@mercurjs/types": "2.3.6-canary.
|
|
73
|
+
"@mercurjs/core": "2.3.6-canary.9",
|
|
74
|
+
"@mercurjs/dashboard-sdk": "2.3.6-canary.9",
|
|
75
|
+
"@mercurjs/types": "2.3.6-canary.9",
|
|
76
76
|
"@types/lodash.debounce": "^4.0.8",
|
|
77
77
|
"@types/react": "^18.3.2",
|
|
78
78
|
"@types/react-dom": "^18.2.22",
|