@uniformdev/mesh-sdk-react 17.6.1-alpha.60 → 17.7.1-alpha.34
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 +151 -46
- package/dist/index.esm.js +154 -154
- package/dist/index.js +156 -156
- package/dist/index.mjs +154 -154
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import * as _emotion_react_types_jsx_namespace from '@emotion/react/types/jsx-namespace';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import React__default, { SVGProps } from 'react';
|
|
3
|
+
import React__default, { SVGProps, ComponentType, PropsWithChildren } from 'react';
|
|
4
4
|
import { TDate } from 'timeago.js';
|
|
5
5
|
import * as _emotion_react from '@emotion/react';
|
|
6
|
-
import {
|
|
7
|
-
export { AddListButton, AddListButtonProps, Button, ButtonProps, Callout, CalloutProps, Heading, HeadingProps, Input, InputComboBox, InputComboBoxProps, InputKeywordSearch, InputProps, InputSelect, InputToggle, InputToggleProps, InputKeywordSearch as KeywordSearchInput, Label, LabelProps, LoadingIndicator, LoadingOverlay, Menu, MenuItem, MenuItemProps, MenuProps, ScrollableList, ScrollableListItem, ScrollableListItemProps, ScrollableListProps, Switch, SwitchProps, Textarea, TextareaProps, Theme, ThemeProps } from '@uniformdev/design-system';
|
|
8
|
-
import { DataVariableDefinition } from '@uniformdev/canvas';
|
|
6
|
+
import { DataVariableDefinition, DataResourceVariables } from '@uniformdev/canvas';
|
|
9
7
|
import * as _uniformdev_mesh_sdk from '@uniformdev/mesh-sdk';
|
|
10
|
-
import { MeshLocation, UniformMeshSDK, MeshLocationCore } from '@uniformdev/mesh-sdk';
|
|
8
|
+
import { MeshLocation, SetValueOptions, DataSourceLocationValue, DataTypeLocationValue, UniformMeshSDK, MeshLocationCore } from '@uniformdev/mesh-sdk';
|
|
11
9
|
export * from '@uniformdev/mesh-sdk';
|
|
10
|
+
import { InputSelectProps } from '@uniformdev/design-system';
|
|
11
|
+
export { AddListButton, AddListButtonProps, Button, ButtonProps, Callout, CalloutProps, Heading, HeadingProps, Input, InputComboBox, InputComboBoxProps, InputKeywordSearch, InputProps, InputSelect, InputToggle, InputToggleProps, InputKeywordSearch as KeywordSearchInput, Label, LabelProps, LoadingIndicator, LoadingOverlay, Menu, MenuItem, MenuItemProps, MenuProps, ScrollableList, ScrollableListItem, ScrollableListItemProps, ScrollableListProps, Switch, SwitchProps, Textarea, TextareaProps, Theme, ThemeProps } from '@uniformdev/design-system';
|
|
12
12
|
|
|
13
13
|
declare const SvgCaution: (props: SVGProps<SVGSVGElement>) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
14
14
|
|
|
@@ -370,23 +370,80 @@ declare const damSelectedItemMediaContainer: _emotion_react.SerializedStyles;
|
|
|
370
370
|
declare const damSelectedItemInfoBtn: _emotion_react.SerializedStyles;
|
|
371
371
|
declare const damSelectItemImage: _emotion_react.SerializedStyles;
|
|
372
372
|
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
373
|
+
/**
|
|
374
|
+
* Provides convenient access to the current Uniform Mesh location via React hook.
|
|
375
|
+
* Intended to be used within <MeshApp />.
|
|
376
|
+
*
|
|
377
|
+
* There are three primary ways to invoke this hook:
|
|
378
|
+
* 1. Without any arguments, this hook will return the current location regardless of its type. The result will be a union of all possible locations you can discriminate between i.e. with an if statement on the `type`
|
|
379
|
+
* const location = useMeshLocation();
|
|
380
|
+
* if (location.type === 'paramType') { // location is now known to be a paramType }
|
|
381
|
+
* 2. With a string argument, this hook will assert that the current location is the expected one and return the correct typings for that location.
|
|
382
|
+
* const location = useMeshLocation('settings');
|
|
383
|
+
* 3. With an explicit generic to set the expected param type data or param type settings data. This is useful because (2) will return unknown as the value type for param types.
|
|
384
|
+
* const location = useMeshLocation<'paramType', MyParamTypeValueType>();
|
|
385
|
+
*
|
|
386
|
+
* You can also combine (2) and (3) to get both explicit value typing and assertion of the location.
|
|
387
|
+
*/
|
|
388
|
+
declare function useMeshLocation<TLocationType extends MeshLocation['type'], TLocationValue = unknown, TLocationSetValue = TLocationValue>(expectedLocation?: TLocationType): Omit<Extract<_uniformdev_mesh_sdk.DataSourceLocation, {
|
|
389
|
+
type: TLocationType;
|
|
390
|
+
}> | Extract<_uniformdev_mesh_sdk.DataTypeLocation, {
|
|
391
|
+
type: TLocationType;
|
|
392
|
+
}> | Extract<_uniformdev_mesh_sdk.DataTypeInstanceLocation, {
|
|
393
|
+
type: TLocationType;
|
|
394
|
+
}> | Extract<_uniformdev_mesh_sdk.DataResourceLocation, {
|
|
395
|
+
type: TLocationType;
|
|
396
|
+
}> | Extract<_uniformdev_mesh_sdk.ParamTypeLocation<TLocationValue, unknown, TLocationSetValue, unknown>, {
|
|
397
|
+
type: TLocationType;
|
|
398
|
+
}> | Extract<_uniformdev_mesh_sdk.ParamTypeConfigLocation<TLocationValue, unknown>, {
|
|
399
|
+
type: TLocationType;
|
|
400
|
+
}> | Extract<_uniformdev_mesh_sdk.SettingsLocation<TLocationValue>, {
|
|
401
|
+
type: TLocationType;
|
|
402
|
+
}>, "setValue"> & {
|
|
403
|
+
setValue: SetLocationValueDispatch<(Extract<_uniformdev_mesh_sdk.DataSourceLocation, {
|
|
404
|
+
type: TLocationType;
|
|
405
|
+
}> | Extract<_uniformdev_mesh_sdk.DataTypeLocation, {
|
|
406
|
+
type: TLocationType;
|
|
407
|
+
}> | Extract<_uniformdev_mesh_sdk.DataTypeInstanceLocation, {
|
|
408
|
+
type: TLocationType;
|
|
409
|
+
}> | Extract<_uniformdev_mesh_sdk.DataResourceLocation, {
|
|
410
|
+
type: TLocationType;
|
|
411
|
+
}> | Extract<_uniformdev_mesh_sdk.ParamTypeLocation<TLocationValue, unknown, TLocationSetValue, unknown>, {
|
|
412
|
+
type: TLocationType;
|
|
413
|
+
}> | Extract<_uniformdev_mesh_sdk.ParamTypeConfigLocation<TLocationValue, unknown>, {
|
|
414
|
+
type: TLocationType;
|
|
415
|
+
}> | Extract<_uniformdev_mesh_sdk.SettingsLocation<TLocationValue>, {
|
|
416
|
+
type: TLocationType;
|
|
417
|
+
}>)["value"], Parameters<(Extract<_uniformdev_mesh_sdk.DataSourceLocation, {
|
|
418
|
+
type: TLocationType;
|
|
419
|
+
}> | Extract<_uniformdev_mesh_sdk.DataTypeLocation, {
|
|
420
|
+
type: TLocationType;
|
|
421
|
+
}> | Extract<_uniformdev_mesh_sdk.DataTypeInstanceLocation, {
|
|
422
|
+
type: TLocationType;
|
|
423
|
+
}> | Extract<_uniformdev_mesh_sdk.DataResourceLocation, {
|
|
424
|
+
type: TLocationType;
|
|
425
|
+
}> | Extract<_uniformdev_mesh_sdk.ParamTypeLocation<TLocationValue, unknown, TLocationSetValue, unknown>, {
|
|
426
|
+
type: TLocationType;
|
|
427
|
+
}> | Extract<_uniformdev_mesh_sdk.ParamTypeConfigLocation<TLocationValue, unknown>, {
|
|
428
|
+
type: TLocationType;
|
|
429
|
+
}> | Extract<_uniformdev_mesh_sdk.SettingsLocation<TLocationValue>, {
|
|
430
|
+
type: TLocationType;
|
|
431
|
+
}>)["setValue"]>[0]>;
|
|
432
|
+
};
|
|
433
|
+
declare type SetLocationValueDispatch<TValue, TSetValue = TValue> = (dispatch: SetLocationValueFunction<TValue, TSetValue>) => Promise<void> | void;
|
|
434
|
+
declare type SetLocationValueFunction<TValue, TSetValue> = (previousValue: TValue) => DispatchResult<TSetValue>;
|
|
435
|
+
declare type DispatchResult<TSetValue> = {
|
|
436
|
+
options?: SetValueOptions;
|
|
437
|
+
newValue: TSetValue;
|
|
378
438
|
};
|
|
379
|
-
declare const MeshApp: React__default.FC<React__default.PropsWithChildren<MeshAppProps>>;
|
|
380
|
-
|
|
381
|
-
declare function RequestBody(): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
382
439
|
|
|
383
440
|
declare type InputToken = {
|
|
384
441
|
name: string;
|
|
385
442
|
value: string;
|
|
386
443
|
};
|
|
387
444
|
declare type InputVariablesProps = {
|
|
388
|
-
/** sets the input label value */
|
|
389
|
-
label
|
|
445
|
+
/** sets the input aria-label value. */
|
|
446
|
+
'aria-label'?: string;
|
|
390
447
|
/** sets the value of the input */
|
|
391
448
|
value: string;
|
|
392
449
|
/** sets the passed down function call */
|
|
@@ -395,7 +452,7 @@ declare type InputVariablesProps = {
|
|
|
395
452
|
onPaste?: (newValue: string) => void;
|
|
396
453
|
disableVariables?: boolean;
|
|
397
454
|
};
|
|
398
|
-
declare function InputVariables({ label, value, disableVariables, onChange, onPaste }: InputVariablesProps): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
455
|
+
declare function InputVariables({ 'aria-label': ariaLabel, value, disableVariables, onChange, onPaste, }: InputVariablesProps): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
399
456
|
|
|
400
457
|
declare type DataVariableDefinitionWithName = {
|
|
401
458
|
name: string;
|
|
@@ -437,6 +494,74 @@ declare type VariablesContext = {
|
|
|
437
494
|
declare function VariablesProvider({ value, onChange, editVariableComponent, children, }: VariablesProviderProps): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
438
495
|
declare function useVariables(): VariablesContext;
|
|
439
496
|
|
|
497
|
+
declare type DataResourceVariablesListProps = {
|
|
498
|
+
/**
|
|
499
|
+
* Overrides rendering of a variable based on the `type` property it has set on it.
|
|
500
|
+
* If this is not passed, all variables are rendered using TextVariableRenderer.
|
|
501
|
+
*/
|
|
502
|
+
typeRenderers?: Record<string, ComponentType<DataResourceVariableRendererProps> | undefined>;
|
|
503
|
+
/**
|
|
504
|
+
* Callback when the state changes in the data resource variables.
|
|
505
|
+
* Can be sent directly to `useMeshLocation`'s `setValue` or intercepted for validation
|
|
506
|
+
* by `createLocationValidator`.
|
|
507
|
+
*/
|
|
508
|
+
setVariables: SetLocationValueDispatch<DataResourceVariables>;
|
|
509
|
+
/**
|
|
510
|
+
* Component that is rendered if no variables are set on the data resource.
|
|
511
|
+
* Defaults to a callout stating that no settings are required.
|
|
512
|
+
*/
|
|
513
|
+
noVariables?: ComponentType;
|
|
514
|
+
};
|
|
515
|
+
declare function DataResourceVariablesList({ setVariables, noVariables: NoVariablesComponent, typeRenderers, }: DataResourceVariablesListProps): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
516
|
+
declare type DataResourceVariableRendererProps = {
|
|
517
|
+
/** Current value of the variable on the data resource */
|
|
518
|
+
value: string | undefined;
|
|
519
|
+
/** Updates the value of the variable on the data resource */
|
|
520
|
+
setValue: (newValue: string | undefined) => void;
|
|
521
|
+
/** The definition of the data variable */
|
|
522
|
+
definition: DataVariableDefinitionWithName;
|
|
523
|
+
};
|
|
524
|
+
/** Default data resource variable renderer, uses a text input */
|
|
525
|
+
declare function TextVariableRenderer({ definition, value, setValue }: DataResourceVariableRendererProps): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
526
|
+
|
|
527
|
+
declare type DataSourceEditorProps = PropsWithChildren<{
|
|
528
|
+
/**
|
|
529
|
+
* Callback when the state changes in the request or variables contexts.
|
|
530
|
+
* Can be sent directly to `useMeshLocation`'s `setValue` or intercepted for validation
|
|
531
|
+
* by `createLocationValidator`.
|
|
532
|
+
*/
|
|
533
|
+
onChange: SetLocationValueDispatch<DataSourceLocationValue>;
|
|
534
|
+
}>;
|
|
535
|
+
/**
|
|
536
|
+
* Wrapper for editing a data source using Uniform Mesh SDK components that rely on `useRequest()`
|
|
537
|
+
* or `useVariables()`, or custom components that use the same hooks.
|
|
538
|
+
*/
|
|
539
|
+
declare function DataSourceEditor({ onChange, children }: DataSourceEditorProps): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
540
|
+
|
|
541
|
+
declare type DataTypeEditorProps = PropsWithChildren<{
|
|
542
|
+
/**
|
|
543
|
+
* Callback when the state changes in the request or variables contexts.
|
|
544
|
+
* Can be sent directly to `useMeshLocation`'s `setValue` or intercepted for validation
|
|
545
|
+
* by `createLocationValidator`.
|
|
546
|
+
*/
|
|
547
|
+
onChange: SetLocationValueDispatch<DataTypeLocationValue>;
|
|
548
|
+
}>;
|
|
549
|
+
/**
|
|
550
|
+
* Wrapper for editing a data type using Uniform Mesh SDK components that rely on `useRequest()`
|
|
551
|
+
* or `useVariables()`, or custom components that use the same hooks.
|
|
552
|
+
*/
|
|
553
|
+
declare function DataTypeEditor({ onChange, children }: DataTypeEditorProps): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
554
|
+
|
|
555
|
+
declare type MeshAppProps = {
|
|
556
|
+
loadingComponent?: React__default.ComponentType;
|
|
557
|
+
errorComponent?: React__default.ComponentType<{
|
|
558
|
+
error: Error;
|
|
559
|
+
}>;
|
|
560
|
+
};
|
|
561
|
+
declare const MeshApp: React__default.FC<React__default.PropsWithChildren<MeshAppProps>>;
|
|
562
|
+
|
|
563
|
+
declare function RequestBody(): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
564
|
+
|
|
440
565
|
declare function RequestHeaders({ disableVariables }: Pick<InputVariablesProps, 'disableVariables'>): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
441
566
|
|
|
442
567
|
declare function RequestMethodSelect(props: Omit<InputSelectProps, 'value' | 'onChange' | 'options'>): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
@@ -561,35 +686,6 @@ declare const useInitializeUniformMeshSdk: ({ autoResizingDisabled }?: UseUnifor
|
|
|
561
686
|
sdk: UniformMeshSDK | undefined;
|
|
562
687
|
};
|
|
563
688
|
|
|
564
|
-
/**
|
|
565
|
-
* Provides convenient access to the current Uniform Mesh location via React hook.
|
|
566
|
-
* Intended to be used within <MeshApp />.
|
|
567
|
-
*
|
|
568
|
-
* There are three primary ways to invoke this hook:
|
|
569
|
-
* 1. Without any arguments, this hook will return the current location regardless of its type. The result will be a union of all possible locations you can discriminate between i.e. with an if statement on the `type`
|
|
570
|
-
* const location = useMeshLocation();
|
|
571
|
-
* if (location.type === 'paramType') { // location is now known to be a paramType }
|
|
572
|
-
* 2. With a string argument, this hook will assert that the current location is the expected one and return the correct typings for that location.
|
|
573
|
-
* const location = useMeshLocation('settings');
|
|
574
|
-
* 3. With an explicit generic to set the expected param type data or param type settings data. This is useful because (2) will return unknown as the value type for param types.
|
|
575
|
-
* const location = useMeshLocation<'paramType', MyParamTypeValueType>();
|
|
576
|
-
*
|
|
577
|
-
* You can also combine (2) and (3) to get both explicit value typing and assertion of the location.
|
|
578
|
-
*/
|
|
579
|
-
declare function useMeshLocation<TLocationType extends MeshLocation['type'], TLocationValue = unknown, TLocationSetValue = TLocationValue>(expectedLocation?: TLocationType): Extract<_uniformdev_mesh_sdk.DataSourceLocation, {
|
|
580
|
-
type: TLocationType;
|
|
581
|
-
}> | Extract<_uniformdev_mesh_sdk.DataTypeLocation, {
|
|
582
|
-
type: TLocationType;
|
|
583
|
-
}> | Extract<_uniformdev_mesh_sdk.DataTypeInstanceLocation, {
|
|
584
|
-
type: TLocationType;
|
|
585
|
-
}> | Extract<_uniformdev_mesh_sdk.ParamTypeLocation<TLocationValue, unknown, TLocationSetValue, unknown>, {
|
|
586
|
-
type: TLocationType;
|
|
587
|
-
}> | Extract<_uniformdev_mesh_sdk.ParamTypeConfigLocation<TLocationValue, unknown>, {
|
|
588
|
-
type: TLocationType;
|
|
589
|
-
}> | Extract<_uniformdev_mesh_sdk.SettingsLocation<TLocationValue>, {
|
|
590
|
-
type: TLocationType;
|
|
591
|
-
}>;
|
|
592
|
-
|
|
593
689
|
/**
|
|
594
690
|
* Provides convenient access to the current Uniform Mesh location via React hook.
|
|
595
691
|
* Intended to be used within <MeshApp />.
|
|
@@ -604,4 +700,13 @@ declare function useUniformMeshLocation<TLocationValue = unknown, TLocationMetad
|
|
|
604
700
|
*/
|
|
605
701
|
declare function useUniformMeshSdk(): _uniformdev_mesh_sdk.UniformMeshSDK;
|
|
606
702
|
|
|
607
|
-
|
|
703
|
+
/**
|
|
704
|
+
* Creates a validation interceptor between useMeshLocation's setValue function and your code.
|
|
705
|
+
* You can use this utility to write cleaner validation logic for your Mesh Location UIs.
|
|
706
|
+
* @param setValue The location's raw setValue function
|
|
707
|
+
* @param validate A function to validate the new location's value.
|
|
708
|
+
* @returns An equivalent to the setValue function that intercepts sets, performs validation, and emits the result with the new value.
|
|
709
|
+
*/
|
|
710
|
+
declare function createLocationValidator<TSetValue>(setValue: SetLocationValueDispatch<TSetValue>, validate: (newValue: TSetValue, currentResult: SetValueOptions | undefined) => SetValueOptions): SetLocationValueDispatch<TSetValue>;
|
|
711
|
+
|
|
712
|
+
export { BaseRequestData, Brand, DamItem, DamSelectedItem, DamSelectedItemProps, DataResourceVariableRendererProps, DataResourceVariablesList, DataResourceVariablesListProps, DataSourceEditor, DataSourceEditorProps, DataTypeEditor, DataTypeEditorProps, DataVariableDefinitionWithName, DefaultSearchRow, DefaultSelectedItem, DispatchResult, EntrySearch, EntrySearchContentType, EntrySearchProps, EntrySearchQueryOptions, EntrySearchResult, EntrySearchRowProps, EntrySearchSelectedItemProps, GetProductOptions, GetProductsOptions, index as Icons, InputToken, InputVariables, InputVariablesProps, MeshApp, MeshAppProps, NoResultsProps, ProductCategory, ProductDynamicSelectorValue, ProductPreviewList, ProductQuery, ProductQueryCategory, ProductQueryContext, ProductQueryContextValue, ProductQueryProps, ProductSearch, ProductSearchContext, ProductSearchContextValue, ProductSearchProps, ProductSearchResult, ProductSearchResults, ProductSearchRow, ProductSelectedItem, RequestAction, RequestBody, RequestContext, RequestData, RequestHeaders, RequestMethodSelect, RequestParameter, RequestParameters, RequestParametersProps, RequestProvider, RequestProviderProps, RequestTypeContainer, RequestTypeContainerProps, RequestUrl, RequestUrlInput, ResolvableLoadingValue, SelectionField, SelectionFieldValue, SetLocationValueDispatch, SetLocationValueFunction, TextVariableRenderer, UniformMeshLocationContext, UniformMeshLocationContextProvider, UniformMeshLocationContextValue, UniformMeshSdkContext, UniformMeshSdkContextProvider, UniformMeshSdkContextValue, UseUniformMeshSdkOptions, VariableEditor, VariableEditorProps, VariablesAction, VariablesContext, 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, useInitializeUniformMeshSdk, useMeshLocation, useProductQueryContext, useProductSearchContext, useRequest, useUniformMeshLocation, useUniformMeshLocationContext, useUniformMeshSdk, useUniformMeshSdkContext, useVariables, variablesToList };
|