@uniformdev/mesh-sdk-react 19.22.1-alpha.8 → 19.23.1-alpha.12

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 CHANGED
@@ -441,6 +441,14 @@ type DispatchResult<TSetValue> = {
441
441
  newValue: TSetValue;
442
442
  };
443
443
 
444
+ type PasteTransformerPluginProps = {
445
+ /**
446
+ * Transforms pasted contents before inserting them.
447
+ * Return undefined to execute default paste behaviour, or a string to set the paste's contents.
448
+ */
449
+ transformPaste?: (pastedText: string) => string | undefined;
450
+ };
451
+
444
452
  type InputToken = {
445
453
  name: string;
446
454
  value: string;
@@ -456,11 +464,6 @@ type InputVariablesProps = {
456
464
  value: string;
457
465
  /** sets the passed down function call */
458
466
  onChange: (newValue: string) => void;
459
- /**
460
- * Called when the field is pasted into
461
- * Note that this will auto-cancel onChange after the paste when defined.
462
- */
463
- onPaste?: (newValue: string) => void;
464
467
  /** Disables using variables in the input */
465
468
  disableVariables?: boolean;
466
469
  /** Turns off the 'Reset' menu option that is added by default when variables are bound to */
@@ -469,6 +472,8 @@ type InputVariablesProps = {
469
472
  showAddVariableMenuOption?: boolean;
470
473
  /** Disables the inline variable selection menu when rendering a variables input */
471
474
  disableInlineMenu?: boolean;
475
+ /** Enables clicking a variable reference to edit the variable */
476
+ enableEditingVariables?: boolean;
472
477
  /**
473
478
  * When no variables are referenced in the value, and this prop is provided,
474
479
  * the variables-injection input will be replaced with this component.
@@ -482,20 +487,23 @@ type InputVariablesProps = {
482
487
  infoMessage?: string;
483
488
  /** (optional) sets caption text value */
484
489
  caption?: string;
485
- };
486
- declare function InputVariables({ id, 'aria-label': ariaLabel, label, value, disableVariables, disableReset, disableInlineMenu, onChange, onPaste, showAddVariableMenuOption, inputWhenNoVariables, caption, errorMessage, warningMessage, infoMessage, ...inputProps }: InputVariablesProps): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
490
+ /** Sets the test ID of the input */
491
+ 'data-test-id'?: string;
492
+ } & PasteTransformerPluginProps;
493
+ declare function InputVariables({ id, 'aria-label': ariaLabel, label, value, disableVariables, disableReset, enableEditingVariables, disableInlineMenu, onChange, transformPaste, showAddVariableMenuOption, inputWhenNoVariables, caption, errorMessage, warningMessage, infoMessage, 'data-test-id': dataTestId, }: InputVariablesProps): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
487
494
 
488
- /**
489
- * A regular expression that matches Uniform variable expressions
490
- * in the form of ${variableName}.
491
- */
492
- declare const variableExpression: RegExp;
495
+ /** Expected prefix for variable expressions */
493
496
  declare const variablePrefix = "${";
497
+ /** Expected suffix for variable expressions */
494
498
  declare const variableSuffix = "}";
495
499
 
496
500
  type DataVariableDefinitionWithName = {
497
501
  name: string;
498
502
  } & DataVariableDefinition;
503
+ /**
504
+ * Converts variable definitions stored in a map into a flat list,
505
+ * respecting their `order` property if set, and sorting by display name otherwise.
506
+ */
499
507
  declare function variablesToList(variables: Record<string, DataVariableDefinition> | undefined): Array<DataVariableDefinitionWithName>;
500
508
 
501
509
  type VariableEditorProps = {
@@ -510,8 +518,21 @@ declare function VariableEditor({ variable, onSubmit, onCancel, disableMeshTip }
510
518
  declare function VariablesList(): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
511
519
 
512
520
  type VariablesProviderProps = React$1.PropsWithChildren<{
521
+ /**
522
+ * Signals that components in this variables context are not intended to allow mutation
523
+ * of the variable values (i.e. editing, adding, or deleting variable definitions).
524
+ *
525
+ * Dispatching updates is still accepted, but will be ignored.
526
+ */
527
+ readOnly?: boolean;
528
+ /** Variable values to load into the context */
513
529
  value: Record<string, DataVariableDefinition>;
514
- onChange: (newValue: Record<string, DataVariableDefinition>) => void;
530
+ /** Function to handle mutations to the variable values (optional when readOnly is true) */
531
+ onChange?: (newValue: Record<string, DataVariableDefinition>) => void;
532
+ /**
533
+ * Provide a component to handle editing a variable definition (e.g. a modal wrapper)
534
+ * If not passed, the editor will be rendered inline, with potentially strange results.
535
+ */
515
536
  editVariableComponent?: React$1.ComponentType<VariableEditorProps>;
516
537
  }>;
517
538
  type VariablesAction = {
@@ -532,6 +553,13 @@ type VariablesEvents = {
532
553
  update: string;
533
554
  };
534
555
  type VariablesContext = {
556
+ /**
557
+ * Signals that components in this variables context are not intended to allow mutation
558
+ * of the variable values (i.e. editing, adding, or deleting variable definitions).
559
+ *
560
+ * Dispatching updates is still accepted, but will be ignored.
561
+ */
562
+ readOnly?: boolean;
535
563
  /** Dispatch update events to the variables */
536
564
  dispatch: (event: VariablesAction) => void;
537
565
  /** The current variables value */
@@ -548,7 +576,7 @@ type VariablesContext = {
548
576
  */
549
577
  flatVariables: Readonly<Record<string, string>>;
550
578
  };
551
- declare function VariablesProvider({ value, onChange, editVariableComponent, children, }: VariablesProviderProps): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
579
+ declare function VariablesProvider({ value, onChange, editVariableComponent, readOnly, children, }: VariablesProviderProps): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
552
580
  declare function useVariables(returnEmptyWithoutProvider?: boolean): VariablesContext;
553
581
 
554
582
  type DataResourceVariablesListProps = {
@@ -766,8 +794,6 @@ type SelectedItemProps<TExtraProps = unknown> = {
766
794
  metadata?: Record<string, string>;
767
795
  /** allows for child react elements to be nested in the popover */
768
796
  popoverData?: ReactNode;
769
- /** disable or enable drag and drop functionality */
770
- disableDnD?: boolean;
771
797
  } & TExtraProps;
772
798
  type ItemListProps<TListItemExtraProps = unknown> = {
773
799
  items?: Array<SelectedItemProps<TListItemExtraProps>>;
@@ -1122,4 +1148,4 @@ declare function useUniformMeshSdk(): _uniformdev_mesh_sdk.UniformMeshSDK;
1122
1148
  */
1123
1149
  declare function createLocationValidator<TSetValue>(setValue: SetLocationValueDispatch<TSetValue>, validate: (newValue: TSetValue, currentResult: SetValueOptions | undefined) => SetValueOptions): SetLocationValueDispatch<TSetValue>;
1124
1150
 
1125
- export { BaseRequestData, Brand, DamItem, DamSelectedItem, DamSelectedItemProps, DataRefreshButton, DataRefreshButtonProps, DataResourceDynamicInputProvider, DataResourceDynamicInputProviderProps, DataResourceVariableRendererProps, DataResourceVariablesList, DataResourceVariablesListExplicit, DataResourceVariablesListProps, DataSourceEditor, DataSourceEditorProps, DataTypeEditor, DataTypeEditorProps, DataVariableDefinitionWithName, DefaultSearchRow, DefaultSelectedItem, DispatchResult, EntrySearch, EntrySearchContentType, EntrySearchProps, EntrySearchQueryOptions, EntrySearchResult, EntrySearchRowProps, EntrySearchSelectedItemProps, GetProductOptions, GetProductsOptions, index as Icons, InputToken, InputVariables, InputVariablesProps, ItemListProps, LinkButton, MeshApp, MeshAppProps, MinimalDynamicInput, MinimalDynamicInputs, NoResultsProps, ObjectSearchContainer, ObjectSearchContainerProps, ObjectSearchContextProps, ObjectSearchFilter, ObjectSearchFilterContainer, ObjectSearchFilterContainerProps, ObjectSearchFilterProps, ObjectSearchListItem, ObjectSearchListItemLoadingSkeleton, ObjectSearchListItemProps, ObjectSearchProvider, ObjectSearchProviderProps, ObjectSearchResultItem, ObjectSearchResultItemButton, ObjectSearchResultItemButtonProps, ObjectSearchResultItemProps, ObjectSearchResultList, ObjectSearchResultListProps, ProductCategory, ProductDynamicSelectorValue, ProductPreviewList, ProductQuery, ProductQueryCategory, ProductQueryContext, ProductQueryContextValue, ProductQueryProps, ProductSearch, ProductSearchContext, ProductSearchContextValue, ProductSearchProps, ProductSearchResult, ProductSearchResults, ProductSearchRow, ProductSelectedItem, QueryFilter, QueryFilterProps, QueryFilterSearchProps, RequestAction, RequestBody, RequestContext, RequestData, RequestHeaders, RequestMethodSelect, RequestParameter, RequestParameters, RequestParametersProps, RequestProvider, RequestProviderProps, RequestTypeContainer, RequestTypeContainerProps, RequestUrl, RequestUrlInput, ResolvableLoadingValue, SearchQueryProps, SelectedItemProps, SelectionField, SelectionFieldValue, SetLocationValueDispatch, SetLocationValueFunction, TextVariableRenderer, VariableEditor, VariableEditorProps, VariablesAction, VariablesContext, VariablesEvents, VariablesList, VariablesProvider, VariablesProviderProps, badgeIcon, createLocationValidator, damSelectItemImage, damSelectedItemContainer, damSelectedItemCopy, damSelectedItemDetails, damSelectedItemIcon, damSelectedItemInfoBtn, damSelectedItemInner, damSelectedItemLinkBtn, damSelectedItemLinkContainer, damSelectedItemMediaContainer, damSelectedItemPopover, damSelectedItemPopoverLabel, damSelectedItemSmallText, damSelectedItemTitle, draggableContainer, draggableIcon, draggableIconOffset, draggableIconWrapper, entrySearchBtn, entrySearchConfig, entrySearchConfigHidden, entrySearchLoadMoreBtn, entrySearchResultList, entrySearchSelectIcon, entrySearchSelectImg, entrySearchSelectInput, entrySearchSelectOption, entrySearchWrapper, productSearchRowActiveIcon, productSearchRowCategory, productSearchRowContainer, productSearchRowContent, productSearchRowContentActive, productSearchRowDetails, productSearchRowTitle, productSelectedItemContainer, productSelectedItemContent, productSelectedItemDetails, productSelectedItemIcon, productSelectedItemImage, productSelectedItemLinkContainer, productedSelectedItemLinkBtn, productedSelectedItemSmallText, searchRowBtn, searchRowContainer, searchRowContainerActive, searchRowContainerWithPopover, searchRowPopover, searchRowText, searchRowTextSmall, selectItemLinkBtn, selectItemLinkContainer, selectItemPopover, selectItemPopoverLabel, selectItemSmallText, selectedItemContainer, selectedItemCopy, selectedItemDetails, selectedItemIcon, selectedItemInner, selectedItemTitle, urlEncodeRequestParameter, urlEncodeRequestUrl, useMeshLocation, useObjectSearchContext, useProductQueryContext, useProductSearchContext, useRequest, useRequestHeader, useRequestParameter, useUniformMeshSdk, useVariables, variableExpression, variablePrefix, variableSuffix, variablesToList };
1151
+ export { BaseRequestData, Brand, DamItem, DamSelectedItem, DamSelectedItemProps, DataRefreshButton, DataRefreshButtonProps, DataResourceDynamicInputProvider, DataResourceDynamicInputProviderProps, DataResourceVariableRendererProps, DataResourceVariablesList, DataResourceVariablesListExplicit, DataResourceVariablesListProps, DataSourceEditor, DataSourceEditorProps, DataTypeEditor, DataTypeEditorProps, DataVariableDefinitionWithName, DefaultSearchRow, DefaultSelectedItem, DispatchResult, EntrySearch, EntrySearchContentType, EntrySearchProps, EntrySearchQueryOptions, EntrySearchResult, EntrySearchRowProps, EntrySearchSelectedItemProps, GetProductOptions, GetProductsOptions, index as Icons, InputToken, InputVariables, InputVariablesProps, ItemListProps, LinkButton, MeshApp, MeshAppProps, MinimalDynamicInput, MinimalDynamicInputs, NoResultsProps, ObjectSearchContainer, ObjectSearchContainerProps, ObjectSearchContextProps, ObjectSearchFilter, ObjectSearchFilterContainer, ObjectSearchFilterContainerProps, ObjectSearchFilterProps, ObjectSearchListItem, ObjectSearchListItemLoadingSkeleton, ObjectSearchListItemProps, ObjectSearchProvider, ObjectSearchProviderProps, ObjectSearchResultItem, ObjectSearchResultItemButton, ObjectSearchResultItemButtonProps, ObjectSearchResultItemProps, ObjectSearchResultList, ObjectSearchResultListProps, ProductCategory, ProductDynamicSelectorValue, ProductPreviewList, ProductQuery, ProductQueryCategory, ProductQueryContext, ProductQueryContextValue, ProductQueryProps, ProductSearch, ProductSearchContext, ProductSearchContextValue, ProductSearchProps, ProductSearchResult, ProductSearchResults, ProductSearchRow, ProductSelectedItem, QueryFilter, QueryFilterProps, QueryFilterSearchProps, RequestAction, RequestBody, RequestContext, RequestData, RequestHeaders, RequestMethodSelect, RequestParameter, RequestParameters, RequestParametersProps, RequestProvider, RequestProviderProps, RequestTypeContainer, RequestTypeContainerProps, RequestUrl, RequestUrlInput, ResolvableLoadingValue, SearchQueryProps, SelectedItemProps, SelectionField, SelectionFieldValue, SetLocationValueDispatch, SetLocationValueFunction, TextVariableRenderer, VariableEditor, VariableEditorProps, VariablesAction, VariablesContext, VariablesEvents, VariablesList, VariablesProvider, VariablesProviderProps, badgeIcon, createLocationValidator, damSelectItemImage, damSelectedItemContainer, damSelectedItemCopy, damSelectedItemDetails, damSelectedItemIcon, damSelectedItemInfoBtn, damSelectedItemInner, damSelectedItemLinkBtn, damSelectedItemLinkContainer, damSelectedItemMediaContainer, damSelectedItemPopover, damSelectedItemPopoverLabel, damSelectedItemSmallText, damSelectedItemTitle, draggableContainer, draggableIcon, draggableIconOffset, draggableIconWrapper, entrySearchBtn, entrySearchConfig, entrySearchConfigHidden, entrySearchLoadMoreBtn, entrySearchResultList, entrySearchSelectIcon, entrySearchSelectImg, entrySearchSelectInput, entrySearchSelectOption, entrySearchWrapper, productSearchRowActiveIcon, productSearchRowCategory, productSearchRowContainer, productSearchRowContent, productSearchRowContentActive, productSearchRowDetails, productSearchRowTitle, productSelectedItemContainer, productSelectedItemContent, productSelectedItemDetails, productSelectedItemIcon, productSelectedItemImage, productSelectedItemLinkContainer, productedSelectedItemLinkBtn, productedSelectedItemSmallText, searchRowBtn, searchRowContainer, searchRowContainerActive, searchRowContainerWithPopover, searchRowPopover, searchRowText, searchRowTextSmall, selectItemLinkBtn, selectItemLinkContainer, selectItemPopover, selectItemPopoverLabel, selectItemSmallText, selectedItemContainer, selectedItemCopy, selectedItemDetails, selectedItemIcon, selectedItemInner, selectedItemTitle, urlEncodeRequestParameter, urlEncodeRequestUrl, useMeshLocation, useObjectSearchContext, useProductQueryContext, useProductSearchContext, useRequest, useRequestHeader, useRequestParameter, useUniformMeshSdk, useVariables, variablePrefix, variableSuffix, variablesToList };