@mercurjs/dashboard-shared 2.3.6-canary.0 → 2.3.6-canary.2
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 +37 -2
- package/dist/index.js +76 -0
- package/package.json +5 -5
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 React$1 from 'react';
|
|
7
|
-
import React__default, { ReactNode, PropsWithChildren, ComponentPropsWithoutRef, CSSProperties, ComponentType, ComponentProps, ForwardRefExoticComponent, Ref, RefAttributes, RefCallback } from 'react';
|
|
7
|
+
import React__default, { ReactNode, PropsWithChildren, ComponentPropsWithoutRef, CSSProperties, ComponentType, ComponentProps, ForwardRefExoticComponent, Ref, RefAttributes, RefCallback, Dispatch, SetStateAction } from 'react';
|
|
8
8
|
import { Tooltip, Heading, Text, DataTableColumnDef, DataTableFilter, DataTableCommand, DataTableEmptyStateProps, DataTableRowSelectionState, DataTableRow, Select, Input, Table, Drawer, FocusModal, ProgressStatus } from '@medusajs/ui';
|
|
9
9
|
import * as react_hook_form from 'react-hook-form';
|
|
10
10
|
import { FieldValues, FieldPath, ControllerProps, UseFormReturn, Control, UseFormProps } from 'react-hook-form';
|
|
@@ -1624,6 +1624,41 @@ declare const useResourcePermissions: (resource: PermissionResource) => {
|
|
|
1624
1624
|
isLoading: boolean;
|
|
1625
1625
|
};
|
|
1626
1626
|
|
|
1627
|
+
/**
|
|
1628
|
+
* Applied to anything in the sidebar that has no place in the icon rail —
|
|
1629
|
+
* labels, the store name, the shortcut hint. Expanding waits for the rail to
|
|
1630
|
+
* make room before fading the content back in; collapsing clears it first so
|
|
1631
|
+
* it is never caught mid-fade by the clip.
|
|
1632
|
+
*/
|
|
1633
|
+
declare const SIDEBAR_RAIL_FADE: string;
|
|
1634
|
+
|
|
1635
|
+
type SidebarState = "expanded" | "collapsed";
|
|
1636
|
+
type SidebarContextValue = {
|
|
1637
|
+
/**
|
|
1638
|
+
* `collapsed` renders the desktop sidebar as an icon rail rather than
|
|
1639
|
+
* hiding it. Mirrors the `data-state` attribute the layout styles read.
|
|
1640
|
+
*/
|
|
1641
|
+
state: SidebarState;
|
|
1642
|
+
desktop: boolean;
|
|
1643
|
+
mobile: boolean;
|
|
1644
|
+
toggle: (view: "desktop" | "mobile") => void;
|
|
1645
|
+
setDesktop: Dispatch<SetStateAction<boolean>>;
|
|
1646
|
+
setMobile: Dispatch<SetStateAction<boolean>>;
|
|
1647
|
+
};
|
|
1648
|
+
declare const SidebarContext: React$1.Context<SidebarContextValue | null>;
|
|
1649
|
+
|
|
1650
|
+
declare const SidebarProvider: ({ children }: PropsWithChildren) => react_jsx_runtime.JSX.Element;
|
|
1651
|
+
|
|
1652
|
+
/**
|
|
1653
|
+
* Collapses the desktop sidebar to its icon rail for as long as the calling
|
|
1654
|
+
* component is mounted, restoring whatever the user had open before. Intended
|
|
1655
|
+
* for dense, full-height surfaces — the inbox, the editor — that need the
|
|
1656
|
+
* horizontal space but should not permanently change the user's preference.
|
|
1657
|
+
*/
|
|
1658
|
+
declare const useCollapsedSidebar: (collapsed?: boolean) => void;
|
|
1659
|
+
|
|
1660
|
+
declare const useSidebar: () => SidebarContextValue;
|
|
1661
|
+
|
|
1627
1662
|
type WidgetPlacement = "before" | "after";
|
|
1628
1663
|
type Widget = {
|
|
1629
1664
|
Component: ComponentType<{
|
|
@@ -2018,4 +2053,4 @@ declare const extractPricesFromOffers: (offers: ExtractableOffers, regions: Http
|
|
|
2018
2053
|
variant_id: string;
|
|
2019
2054
|
}[];
|
|
2020
2055
|
|
|
2021
|
-
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, PermissionGuard, type PermissionGuardProps, type PermissionProps, PermissionsContext, PermissionsProvider, type PermissionsProviderProps, PermissionsRequirement, type PermissionsRequirementProps, PermissionsRequirementsContext, PermissionsRequirementsProvider, 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, type ReferenceField, RequiredPermissionsSection, type ResolvedAttribute, type ResolvedDisplays, type ResolvedFormField, RouteDrawer, RouteFocusModal, RoutePermissionGuard, SectionRow, type SectionRowProps, SegmentedControl, type SegmentedControlOption, SidebarLink, type SidebarLinkProps, 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 UseRegisterPermissionsOptions, type VariantGroup, VisuallyHidden, type Widget, type WidgetModule, type WidgetPlacement, WidgetZone, type WidgetZoneProps, type ZoneWidgets, _DataTable, applyNavOverrides, buildAdditionalDataDefaults, buildAdditionalDataSchema, buildOfferGridData, buildProductChangeView, countries, createDataGridHelper, createDataGridPriceColumns, createFormHelper, currencies, extractPricesFromOffers, extractReferenceIds, formatFieldValue, genericForwardRef, getCountryByIso2, getCurrencySymbol, getDecimalDigits, getExtensionRegistry, getFormattedAddress, getFormattedCountry, getLinkQuery, getLocaleAmount, getNativeSymbol, getPriceListStatus, getStylizedAmount, humanizeFieldName, isAmountLessThenRoundingError, isImageList, isOrderActionable, isOrderAwaitingAction, isPriceListGroupRow, isProductRow, isReferenceField, isSameAddress, linkFields, productChangeViewHasContent, queryClient, queryKeysFactory, resolvePermissionProps, useActionLocks, useCombinedRefs, useCommandHistory, useDataTable, useDate, useDisplayFieldOverride, useDocumentDirection, useExtendableForm, useExtendableTable, useExtension, useExtensionActivity, useLinkQuery, usePermissions, useQueryParams, useRegisterPermissions, useRequiredPermissions, useResourcePermissions, useRouteModal, useStackedModal, useTabManagement, useTabbedForm, withLinkFields };
|
|
2056
|
+
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, PermissionGuard, type PermissionGuardProps, type PermissionProps, PermissionsContext, PermissionsProvider, type PermissionsProviderProps, PermissionsRequirement, type PermissionsRequirementProps, PermissionsRequirementsContext, PermissionsRequirementsProvider, 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, type ReferenceField, RequiredPermissionsSection, type ResolvedAttribute, type ResolvedDisplays, type ResolvedFormField, RouteDrawer, RouteFocusModal, RoutePermissionGuard, SIDEBAR_RAIL_FADE, 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 UseRegisterPermissionsOptions, type VariantGroup, VisuallyHidden, type Widget, type WidgetModule, type WidgetPlacement, WidgetZone, type WidgetZoneProps, type ZoneWidgets, _DataTable, applyNavOverrides, buildAdditionalDataDefaults, buildAdditionalDataSchema, buildOfferGridData, buildProductChangeView, countries, createDataGridHelper, createDataGridPriceColumns, createFormHelper, currencies, extractPricesFromOffers, extractReferenceIds, formatFieldValue, genericForwardRef, getCountryByIso2, getCurrencySymbol, getDecimalDigits, getExtensionRegistry, getFormattedAddress, getFormattedCountry, getLinkQuery, getLocaleAmount, getNativeSymbol, getPriceListStatus, getStylizedAmount, humanizeFieldName, isAmountLessThenRoundingError, isImageList, isOrderActionable, isOrderAwaitingAction, isPriceListGroupRow, isProductRow, isReferenceField, isSameAddress, linkFields, productChangeViewHasContent, queryClient, queryKeysFactory, resolvePermissionProps, useActionLocks, useCollapsedSidebar, useCombinedRefs, useCommandHistory, useDataTable, useDate, useDisplayFieldOverride, useDocumentDirection, useExtendableForm, useExtendableTable, useExtension, useExtensionActivity, useLinkQuery, usePermissions, useQueryParams, useRegisterPermissions, useRequiredPermissions, useResourcePermissions, useRouteModal, useSidebar, useStackedModal, useTabManagement, useTabbedForm, withLinkFields };
|
package/dist/index.js
CHANGED
|
@@ -28531,6 +28531,77 @@ var useResourcePermissions = (resource) => {
|
|
|
28531
28531
|
);
|
|
28532
28532
|
};
|
|
28533
28533
|
|
|
28534
|
+
// src/providers/sidebar-provider/classes.ts
|
|
28535
|
+
var SIDEBAR_RAIL_FADE = [
|
|
28536
|
+
"transition-opacity duration-150 delay-100 ease-out motion-reduce:transition-none",
|
|
28537
|
+
"group-data-[state=collapsed]/sidebar:opacity-0",
|
|
28538
|
+
"group-data-[state=collapsed]/sidebar:delay-0 group-data-[state=collapsed]/sidebar:duration-75"
|
|
28539
|
+
].join(" ");
|
|
28540
|
+
|
|
28541
|
+
// src/providers/sidebar-provider/sidebar-context.tsx
|
|
28542
|
+
import { createContext as createContext12 } from "react";
|
|
28543
|
+
var SidebarContext = createContext12(null);
|
|
28544
|
+
|
|
28545
|
+
// src/providers/sidebar-provider/sidebar-provider.tsx
|
|
28546
|
+
import { useCallback as useCallback29, useEffect as useEffect26, useMemo as useMemo27, useState as useState38 } from "react";
|
|
28547
|
+
import { useLocation as useLocation4 } from "react-router-dom";
|
|
28548
|
+
import { jsx as jsx111 } from "react/jsx-runtime";
|
|
28549
|
+
var SidebarProvider = ({ children }) => {
|
|
28550
|
+
const [desktop, setDesktop] = useState38(true);
|
|
28551
|
+
const [mobile, setMobile] = useState38(false);
|
|
28552
|
+
const { pathname } = useLocation4();
|
|
28553
|
+
useEffect26(() => {
|
|
28554
|
+
setMobile(false);
|
|
28555
|
+
}, [pathname]);
|
|
28556
|
+
const toggle = useCallback29((view) => {
|
|
28557
|
+
if (view === "desktop") {
|
|
28558
|
+
setDesktop((open) => !open);
|
|
28559
|
+
} else {
|
|
28560
|
+
setMobile((open) => !open);
|
|
28561
|
+
}
|
|
28562
|
+
}, []);
|
|
28563
|
+
const value = useMemo27(
|
|
28564
|
+
() => ({
|
|
28565
|
+
state: desktop ? "expanded" : "collapsed",
|
|
28566
|
+
desktop,
|
|
28567
|
+
mobile,
|
|
28568
|
+
toggle,
|
|
28569
|
+
setDesktop,
|
|
28570
|
+
setMobile
|
|
28571
|
+
}),
|
|
28572
|
+
[desktop, mobile, toggle]
|
|
28573
|
+
);
|
|
28574
|
+
return /* @__PURE__ */ jsx111(SidebarContext.Provider, { value, children });
|
|
28575
|
+
};
|
|
28576
|
+
|
|
28577
|
+
// src/providers/sidebar-provider/use-collapsed-sidebar.tsx
|
|
28578
|
+
import { useEffect as useEffect27, useRef as useRef17 } from "react";
|
|
28579
|
+
|
|
28580
|
+
// src/providers/sidebar-provider/use-sidebar.tsx
|
|
28581
|
+
import { useContext as useContext13 } from "react";
|
|
28582
|
+
var useSidebar = () => {
|
|
28583
|
+
const context = useContext13(SidebarContext);
|
|
28584
|
+
if (!context) {
|
|
28585
|
+
throw new Error("useSidebar must be used within a SidebarProvider");
|
|
28586
|
+
}
|
|
28587
|
+
return context;
|
|
28588
|
+
};
|
|
28589
|
+
|
|
28590
|
+
// src/providers/sidebar-provider/use-collapsed-sidebar.tsx
|
|
28591
|
+
var useCollapsedSidebar = (collapsed = true) => {
|
|
28592
|
+
const { desktop, setDesktop } = useSidebar();
|
|
28593
|
+
const desktopRef = useRef17(desktop);
|
|
28594
|
+
desktopRef.current = desktop;
|
|
28595
|
+
useEffect27(() => {
|
|
28596
|
+
if (!collapsed) {
|
|
28597
|
+
return;
|
|
28598
|
+
}
|
|
28599
|
+
const previous = desktopRef.current;
|
|
28600
|
+
setDesktop(false);
|
|
28601
|
+
return () => setDesktop(previous);
|
|
28602
|
+
}, [collapsed, setDesktop]);
|
|
28603
|
+
};
|
|
28604
|
+
|
|
28534
28605
|
// src/price-lists/constants.ts
|
|
28535
28606
|
var PriceListStatus = /* @__PURE__ */ ((PriceListStatus2) => {
|
|
28536
28607
|
PriceListStatus2["ACTIVE"] = "active";
|
|
@@ -28771,9 +28842,12 @@ export {
|
|
|
28771
28842
|
RouteDrawer,
|
|
28772
28843
|
RouteFocusModal,
|
|
28773
28844
|
RoutePermissionGuard,
|
|
28845
|
+
SIDEBAR_RAIL_FADE,
|
|
28774
28846
|
SectionRow,
|
|
28775
28847
|
SegmentedControl,
|
|
28848
|
+
SidebarContext,
|
|
28776
28849
|
SidebarLink,
|
|
28850
|
+
SidebarProvider,
|
|
28777
28851
|
SingleColumnPage,
|
|
28778
28852
|
SingleColumnPageSkeleton,
|
|
28779
28853
|
Skeleton,
|
|
@@ -28837,6 +28911,7 @@ export {
|
|
|
28837
28911
|
queryKeysFactory,
|
|
28838
28912
|
resolvePermissionProps,
|
|
28839
28913
|
useActionLocks,
|
|
28914
|
+
useCollapsedSidebar,
|
|
28840
28915
|
useCombinedRefs,
|
|
28841
28916
|
useCommandHistory,
|
|
28842
28917
|
useDataTable2 as useDataTable,
|
|
@@ -28854,6 +28929,7 @@ export {
|
|
|
28854
28929
|
useRequiredPermissions,
|
|
28855
28930
|
useResourcePermissions,
|
|
28856
28931
|
useRouteModal,
|
|
28932
|
+
useSidebar,
|
|
28857
28933
|
useStackedModal,
|
|
28858
28934
|
useTabManagement,
|
|
28859
28935
|
useTabbedForm,
|
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.2",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/mercurjs/mercur",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"build": "tsup"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@mercurjs/client": "2.3.6-canary.
|
|
26
|
+
"@mercurjs/client": "2.3.6-canary.2",
|
|
27
27
|
"@ariakit/react": "^0.4.15",
|
|
28
28
|
"@babel/runtime": "^8.0.0",
|
|
29
29
|
"@dnd-kit/core": "^6.1.0",
|
|
@@ -63,9 +63,9 @@
|
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@medusajs/types": "2.21.0",
|
|
66
|
-
"@mercurjs/core": "2.3.6-canary.
|
|
67
|
-
"@mercurjs/dashboard-sdk": "2.3.6-canary.
|
|
68
|
-
"@mercurjs/types": "2.3.6-canary.
|
|
66
|
+
"@mercurjs/core": "2.3.6-canary.2",
|
|
67
|
+
"@mercurjs/dashboard-sdk": "2.3.6-canary.2",
|
|
68
|
+
"@mercurjs/types": "2.3.6-canary.2",
|
|
69
69
|
"@types/lodash.debounce": "^4.0.8",
|
|
70
70
|
"@types/react": "^18.3.2",
|
|
71
71
|
"@types/react-dom": "^18.2.22",
|