@uniformdev/mesh-sdk-react 19.24.0 → 19.25.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.
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,19 +464,24 @@ 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
- /** Turns off the 'Reset' menu option that is added by default when variables are bound to */
469
+ /**
470
+ * Turns off the 'Reset' menu option that is added when:
471
+ * - inputWhenNoVariables is passed in
472
+ * - variables are, or have have been bound to
473
+ *
474
+ * The reset button returns the editor to the inputWithNoVariables state
475
+ *
476
+ * @deprecated not usually necessary to set this, it's automatic
477
+ */
467
478
  disableReset?: boolean;
468
479
  /** Enables adding variables from the menu */
469
480
  showAddVariableMenuOption?: boolean;
470
481
  /** Disables the inline variable selection menu when rendering a variables input */
471
482
  disableInlineMenu?: boolean;
483
+ /** Enables clicking a variable reference to edit the variable */
484
+ enableEditingVariables?: boolean;
472
485
  /**
473
486
  * When no variables are referenced in the value, and this prop is provided,
474
487
  * the variables-injection input will be replaced with this component.
@@ -482,20 +495,23 @@ type InputVariablesProps = {
482
495
  infoMessage?: string;
483
496
  /** (optional) sets caption text value */
484
497
  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;
498
+ /** Sets the test ID of the input */
499
+ 'data-test-id'?: string;
500
+ } & PasteTransformerPluginProps;
501
+ 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
502
 
488
- /**
489
- * A regular expression that matches Uniform variable expressions
490
- * in the form of ${variableName}.
491
- */
492
- declare const variableExpression: RegExp;
503
+ /** Expected prefix for variable expressions */
493
504
  declare const variablePrefix = "${";
505
+ /** Expected suffix for variable expressions */
494
506
  declare const variableSuffix = "}";
495
507
 
496
508
  type DataVariableDefinitionWithName = {
497
509
  name: string;
498
510
  } & DataVariableDefinition;
511
+ /**
512
+ * Converts variable definitions stored in a map into a flat list,
513
+ * respecting their `order` property if set, and sorting by display name otherwise.
514
+ */
499
515
  declare function variablesToList(variables: Record<string, DataVariableDefinition> | undefined): Array<DataVariableDefinitionWithName>;
500
516
 
501
517
  type VariableEditorProps = {
@@ -510,8 +526,21 @@ declare function VariableEditor({ variable, onSubmit, onCancel, disableMeshTip }
510
526
  declare function VariablesList(): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
511
527
 
512
528
  type VariablesProviderProps = React$1.PropsWithChildren<{
529
+ /**
530
+ * Signals that components in this variables context are not intended to allow mutation
531
+ * of the variable values (i.e. editing, adding, or deleting variable definitions).
532
+ *
533
+ * Dispatching updates is still accepted, but will be ignored.
534
+ */
535
+ readOnly?: boolean;
536
+ /** Variable values to load into the context */
513
537
  value: Record<string, DataVariableDefinition>;
514
- onChange: (newValue: Record<string, DataVariableDefinition>) => void;
538
+ /** Function to handle mutations to the variable values (optional when readOnly is true) */
539
+ onChange?: (newValue: Record<string, DataVariableDefinition>) => void;
540
+ /**
541
+ * Provide a component to handle editing a variable definition (e.g. a modal wrapper)
542
+ * If not passed, the editor will be rendered inline, with potentially strange results.
543
+ */
515
544
  editVariableComponent?: React$1.ComponentType<VariableEditorProps>;
516
545
  }>;
517
546
  type VariablesAction = {
@@ -532,6 +561,13 @@ type VariablesEvents = {
532
561
  update: string;
533
562
  };
534
563
  type VariablesContext = {
564
+ /**
565
+ * Signals that components in this variables context are not intended to allow mutation
566
+ * of the variable values (i.e. editing, adding, or deleting variable definitions).
567
+ *
568
+ * Dispatching updates is still accepted, but will be ignored.
569
+ */
570
+ readOnly?: boolean;
535
571
  /** Dispatch update events to the variables */
536
572
  dispatch: (event: VariablesAction) => void;
537
573
  /** The current variables value */
@@ -548,7 +584,7 @@ type VariablesContext = {
548
584
  */
549
585
  flatVariables: Readonly<Record<string, string>>;
550
586
  };
551
- declare function VariablesProvider({ value, onChange, editVariableComponent, children, }: VariablesProviderProps): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
587
+ declare function VariablesProvider({ value, onChange, editVariableComponent, readOnly, children, }: VariablesProviderProps): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
552
588
  declare function useVariables(returnEmptyWithoutProvider?: boolean): VariablesContext;
553
589
 
554
590
  type DataResourceVariablesListProps = {
@@ -1120,4 +1156,4 @@ declare function useUniformMeshSdk(): _uniformdev_mesh_sdk.UniformMeshSDK;
1120
1156
  */
1121
1157
  declare function createLocationValidator<TSetValue>(setValue: SetLocationValueDispatch<TSetValue>, validate: (newValue: TSetValue, currentResult: SetValueOptions | undefined) => SetValueOptions): SetLocationValueDispatch<TSetValue>;
1122
1158
 
1123
- 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 };
1159
+ 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 };