@mercurjs/dashboard-shared 2.2.0 → 2.2.1-canary.1

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 +54 -6
  2. package/dist/index.js +5546 -4389
  3. package/package.json +14 -14
package/dist/index.d.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  import { QueryKey, UseQueryOptions } from '@tanstack/react-query';
2
- import { ProductChangeActionDTO, HttpTypes } from '@mercurjs/types';
2
+ import { ProductChangeActionDTO, HttpTypes, AttributeType, ProductAttributeBatchInput, ProductAttributeDTO } from '@mercurjs/types';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import * as React$1 from 'react';
5
5
  import React__default, { ReactNode, PropsWithChildren, ComponentPropsWithoutRef, CSSProperties, ComponentType, Ref, RefCallback } from 'react';
6
6
  import { Tooltip, Heading, Text, DataTableColumnDef, DataTableFilter, DataTableCommand, DataTableEmptyStateProps, DataTableRowSelectionState, DataTableRow, Drawer, FocusModal, ProgressStatus } from '@medusajs/ui';
7
7
  import * as react_hook_form from 'react-hook-form';
8
8
  import { FieldValues, FieldPath, ControllerProps, UseFormReturn, Control, UseFormProps } from 'react-hook-form';
9
- import { Label } from 'radix-ui';
9
+ import { Label, Slot } from 'radix-ui';
10
10
  import { Link, Path } from 'react-router-dom';
11
11
  import { UniqueIdentifier } from '@dnd-kit/core';
12
12
  import * as _tanstack_react_table from '@tanstack/react-table';
@@ -285,9 +285,7 @@ declare const Form: (<TFieldValues extends FieldValues, TContext = any, TTransfo
285
285
  tooltip?: ReactNode;
286
286
  icon?: ReactNode;
287
287
  } & React__default.RefAttributes<HTMLLabelElement>>;
288
- Control: React__default.ForwardRefExoticComponent<Omit<React__default.HTMLAttributes<HTMLElement> & {
289
- children?: React__default.ReactNode;
290
- } & React__default.RefAttributes<HTMLElement>, "ref"> & React__default.RefAttributes<HTMLElement>>;
288
+ Control: React__default.ForwardRefExoticComponent<Omit<Slot.SlotProps & React__default.RefAttributes<HTMLElement>, "ref"> & React__default.RefAttributes<HTMLElement>>;
291
289
  Hint: React__default.ForwardRefExoticComponent<React__default.HTMLAttributes<HTMLParagraphElement> & React__default.RefAttributes<HTMLParagraphElement>>;
292
290
  ErrorMessage: React__default.ForwardRefExoticComponent<React__default.HTMLAttributes<HTMLParagraphElement> & React__default.RefAttributes<HTMLParagraphElement>>;
293
291
  Field: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ ...props }: ControllerProps<TFieldValues, TName>) => react_jsx_runtime.JSX.Element;
@@ -853,6 +851,30 @@ type AddressFormProps = {
853
851
  };
854
852
  declare const AddressForm: ({ control, countries, layout, }: AddressFormProps) => react_jsx_runtime.JSX.Element;
855
853
 
854
+ type ProductAttributeBatchPayload = Omit<ProductAttributeBatchInput, "product_id">;
855
+ type AttributeValue = {
856
+ id: string;
857
+ name: string;
858
+ };
859
+ type EditAttributeAttribute = {
860
+ id: string;
861
+ name: string;
862
+ type: AttributeType | string;
863
+ description?: string;
864
+ is_required?: boolean;
865
+ is_variant_axis?: boolean;
866
+ is_scoped?: boolean;
867
+ values?: AttributeValue[];
868
+ all_values?: AttributeValue[];
869
+ };
870
+ type EditAttributeFormProps = {
871
+ attribute: EditAttributeAttribute;
872
+ isAttached?: boolean;
873
+ isPending: boolean;
874
+ onSubmit: (payload: ProductAttributeBatchPayload) => Promise<void>;
875
+ };
876
+ declare const EditAttributeForm: (props: EditAttributeFormProps) => react_jsx_runtime.JSX.Element;
877
+
856
878
  type EmailFieldValues = z.infer<typeof EmailSchema>;
857
879
  type EmailFormProps = {
858
880
  control: Control<EmailFieldValues>;
@@ -879,6 +901,18 @@ type IconProps = React$1.SVGProps<SVGSVGElement> & {
879
901
  };
880
902
  declare const ListBadge: React$1.ForwardRefExoticComponent<Omit<IconProps, "ref"> & React$1.RefAttributes<SVGSVGElement>>;
881
903
 
904
+ type AttributeValueInputProps = {
905
+ type: AttributeType | string;
906
+ value: string | string[];
907
+ onChange: (value: string | string[]) => void;
908
+ availableValues?: {
909
+ id: string;
910
+ name: string;
911
+ }[];
912
+ placeholder?: string;
913
+ };
914
+ declare const AttributeValueInput: ({ type, value, onChange, availableValues, placeholder, }: AttributeValueInputProps) => react_jsx_runtime.JSX.Element;
915
+
882
916
  interface PageProps<TData> {
883
917
  children: ReactNode;
884
918
  data?: TData;
@@ -1005,6 +1039,20 @@ declare const useStackedModal: () => {
1005
1039
  unregister: (id: string) => void;
1006
1040
  };
1007
1041
 
1042
+ type ProductWithAttributes = {
1043
+ id: string;
1044
+ attributes?: ProductAttributeDTO[] | null;
1045
+ };
1046
+ type ProductAttributeSectionProps = {
1047
+ product: ProductWithAttributes;
1048
+ requiredAttributes?: ProductAttributeDTO[];
1049
+ onDeleteAttribute: (attribute: ProductAttributeDTO) => Promise<void>;
1050
+ getEditHref?: (attribute: ProductAttributeDTO) => string;
1051
+ addExistingHref?: string;
1052
+ createNewHref?: string;
1053
+ };
1054
+ declare const ProductAttributeSection: ({ product, requiredAttributes, onDeleteAttribute, getEditHref, addExistingHref, createNewHref, }: ProductAttributeSectionProps) => react_jsx_runtime.JSX.Element;
1055
+
1008
1056
  interface TabDefinition<T extends FieldValues = FieldValues> {
1009
1057
  id: string;
1010
1058
  labelKey: string;
@@ -1573,4 +1621,4 @@ interface UseExtendableFormProps<TSchema extends ZodObject<Record<string, z.ZodT
1573
1621
  */
1574
1622
  declare const useExtendableForm: <TSchema extends ZodObject<Record<string, z.ZodTypeAny>>, TContext = unknown, TTransformedValues extends FieldValues | undefined = undefined>({ schema: baseSchema, defaultValues: baseDefaultValues, model, data, zone, tab, ...props }: UseExtendableFormProps<TSchema, TContext>) => react_hook_form.UseFormReturn<WithAdditionalData<z.TypeOf<TSchema>>, TContext, TTransformedValues>;
1575
1623
 
1576
- export { type Action, type ActionGroup, ActionMenu, AddressForm, type AttributeChange, type AttributeChangeKind, BadgeListSummary, ChipGroup, CodeCell, CodeHeader, type Command, ConditionalTooltip, ConfirmPrompt, type ConfirmPromptProps, type CoreNavItem, CreatedAtCell, CreatedAtHeader, type CustomFieldsModule, CustomerInfo, DataGrid, DataTable, DateCell, DateHeader, DateRangeDisplay, DisplayExtensionZone, type DisplayExtensionZoneProps, DisplayField, type DisplayFieldProps, DisplaySection, type DisplaySectionField, type DisplaySectionProps, EmailCell, EmailForm, EmailHeader, type ExtendableTable, ExtensionProvider, type ExtensionProviderProps, ExtensionRegistry, type FieldDiff, FilePreview, type FileType, FileUpload, type FileUploadProps, type Filter, FilterGroup, Form, FormExtensionZone, type FormExtensionZoneProps, GeneralSectionSkeleton, HeadingSkeleton, IconAvatar, IconButtonSkeleton, ImageAvatar, type ImageRef, IncludesTaxTooltip, InfiniteList, JsonViewSection, JsonViewSectionSkeleton, LinkButton, ListBadge, ListSummary, Listicle, type ListicleProps, type MediaDiff, MetadataForm, MetadataSection, MoneyAmountCell, NameCell, NameHeader, type NavigationModule, NoRecords, NoResults, type NoResultsProps, OrderBy, PlaceholderCell, type ProductChangeAttribute, ProductChangePanel, type ProductChangePanelProps, type ProductChangeProduct, type ProductChangeResolvers, type ProductChangeVariant, type ProductChangeView, ProgressBar, Query, REFERENCE_FIELDS, type ReferenceField, type ResolvedAttribute, type ResolvedDisplays, type ResolvedFormField, RouteDrawer, RouteFocusModal, SectionRow, type SectionRowProps, SegmentedControl, type SegmentedControlOption, SidebarLink, type SidebarLinkProps, SingleColumnPage, SingleColumnPageSkeleton, Skeleton, SortableList, SortableTree, StackedDrawer, StackedFocusModal, StatusCell, SwitchBox, type TQueryKey, type TabDefinition, TabbedForm, TableFooterSkeleton, TableSectionSkeleton, TableSkeleton, TextCell, TextHeader, TextSkeleton, Thumbnail, TwoColumnPage, TwoColumnPageSkeleton, type UseExtendableFormProps, type UseExtendableTableProps, type UseQueryOptionsWrapper, type VariantGroup, type Widget, type WidgetModule, type WidgetPlacement, WidgetZone, type WidgetZoneProps, type ZoneWidgets, _DataTable, applyNavOverrides, buildAdditionalDataDefaults, buildAdditionalDataSchema, buildProductChangeView, createDataGridHelper, createDataGridPriceColumns, createFormHelper, extractReferenceIds, formatFieldValue, getExtensionRegistry, getLinkQuery, humanizeFieldName, isImageList, isReferenceField, linkFields, productChangeViewHasContent, queryKeysFactory, useCombinedRefs, useCommandHistory, useDataTable, useDate, useDisplayFieldOverride, useDocumentDirection, useExtendableForm, useExtendableTable, useExtension, useLinkQuery, useQueryParams, useRouteModal, useStackedModal, useTabManagement, useTabbedForm, withLinkFields };
1624
+ export { type Action, type ActionGroup, ActionMenu, AddressForm, type AttributeChange, type AttributeChangeKind, AttributeValueInput, BadgeListSummary, ChipGroup, CodeCell, CodeHeader, type Command, ConditionalTooltip, ConfirmPrompt, type ConfirmPromptProps, type CoreNavItem, CreatedAtCell, CreatedAtHeader, type CustomFieldsModule, CustomerInfo, DataGrid, DataTable, DateCell, DateHeader, DateRangeDisplay, DisplayExtensionZone, type DisplayExtensionZoneProps, DisplayField, type DisplayFieldProps, DisplaySection, type DisplaySectionField, type DisplaySectionProps, type EditAttributeAttribute, EditAttributeForm, type EditAttributeFormProps, EmailCell, EmailForm, EmailHeader, type ExtendableTable, ExtensionProvider, type ExtensionProviderProps, ExtensionRegistry, type FieldDiff, FilePreview, type FileType, FileUpload, type FileUploadProps, type Filter, FilterGroup, Form, FormExtensionZone, type FormExtensionZoneProps, GeneralSectionSkeleton, HeadingSkeleton, IconAvatar, IconButtonSkeleton, ImageAvatar, type ImageRef, IncludesTaxTooltip, InfiniteList, JsonViewSection, JsonViewSectionSkeleton, LinkButton, ListBadge, ListSummary, Listicle, type ListicleProps, type MediaDiff, MetadataForm, MetadataSection, MoneyAmountCell, NameCell, NameHeader, type NavigationModule, NoRecords, NoResults, type NoResultsProps, OrderBy, PlaceholderCell, type ProductAttributeBatchPayload, ProductAttributeSection, type ProductAttributeSectionProps, type ProductChangeAttribute, ProductChangePanel, type ProductChangePanelProps, type ProductChangeProduct, type ProductChangeResolvers, type ProductChangeVariant, type ProductChangeView, ProgressBar, Query, REFERENCE_FIELDS, type ReferenceField, type ResolvedAttribute, type ResolvedDisplays, type ResolvedFormField, RouteDrawer, RouteFocusModal, SectionRow, type SectionRowProps, SegmentedControl, type SegmentedControlOption, SidebarLink, type SidebarLinkProps, SingleColumnPage, SingleColumnPageSkeleton, Skeleton, SortableList, SortableTree, StackedDrawer, StackedFocusModal, StatusCell, SwitchBox, type TQueryKey, type TabDefinition, TabbedForm, TableFooterSkeleton, TableSectionSkeleton, TableSkeleton, TextCell, TextHeader, TextSkeleton, Thumbnail, TwoColumnPage, TwoColumnPageSkeleton, type UseExtendableFormProps, type UseExtendableTableProps, type UseQueryOptionsWrapper, type VariantGroup, type Widget, type WidgetModule, type WidgetPlacement, WidgetZone, type WidgetZoneProps, type ZoneWidgets, _DataTable, applyNavOverrides, buildAdditionalDataDefaults, buildAdditionalDataSchema, buildProductChangeView, createDataGridHelper, createDataGridPriceColumns, createFormHelper, extractReferenceIds, formatFieldValue, getExtensionRegistry, getLinkQuery, humanizeFieldName, isImageList, isReferenceField, linkFields, productChangeViewHasContent, queryKeysFactory, useCombinedRefs, useCommandHistory, useDataTable, useDate, useDisplayFieldOverride, useDocumentDirection, useExtendableForm, useExtendableTable, useExtension, useLinkQuery, useQueryParams, useRouteModal, useStackedModal, useTabManagement, useTabbedForm, withLinkFields };