@uniformdev/mesh-sdk-react 18.27.1-alpha.23 → 18.27.1-alpha.25
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 +106 -82
- package/dist/index.esm.js +120 -44
- package/dist/index.js +120 -44
- package/dist/index.mjs +120 -44
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -559,15 +559,17 @@ type DataRefreshButtonProps = HTMLAttributes<HTMLButtonElement> & {
|
|
|
559
559
|
buttonText: string;
|
|
560
560
|
/** shows or hides the loading indicator when retrieving data */
|
|
561
561
|
isLoading: boolean;
|
|
562
|
+
/** sets the onClick function */
|
|
563
|
+
onRefreshData: () => void;
|
|
562
564
|
};
|
|
563
565
|
/** @example <DataRefreshButton buttonText="my button" isLoading /> */
|
|
564
|
-
declare const DataRefreshButton: ({ buttonText, isLoading, ...props }: DataRefreshButtonProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
566
|
+
declare const DataRefreshButton: ({ buttonText, isLoading, onRefreshData, ...props }: DataRefreshButtonProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
565
567
|
|
|
566
568
|
type EntrySearchContainerProps = {
|
|
567
569
|
/** a child node that places components within the search location */
|
|
568
570
|
searchFilters: ReactNode;
|
|
569
571
|
/** a child node that places components within a scrollable list location */
|
|
570
|
-
resultList
|
|
572
|
+
resultList?: ReactNode;
|
|
571
573
|
/** allows any child element */
|
|
572
574
|
children?: ReactNode;
|
|
573
575
|
/** function for the save action */
|
|
@@ -612,10 +614,92 @@ type EntrySearchFilterContainerProps = {
|
|
|
612
614
|
};
|
|
613
615
|
declare const EntrySearchFilterContainer: ({ label, children }: EntrySearchFilterContainerProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
614
616
|
|
|
615
|
-
type
|
|
617
|
+
type StatusTypes = 'published' | 'modified' | 'draft' | 'unpublished';
|
|
618
|
+
type PublishStatusProps = {
|
|
619
|
+
status: StatusTypes;
|
|
620
|
+
};
|
|
621
|
+
declare const PublishStatus: ({ status }: PublishStatusProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
622
|
+
|
|
623
|
+
type SearchQueryProps = {
|
|
624
|
+
/** sets the content type in the search context */
|
|
625
|
+
contentType: string | undefined;
|
|
626
|
+
/** sets the keyword search in the search context */
|
|
627
|
+
keywordSearch?: string;
|
|
628
|
+
};
|
|
629
|
+
type SelectedItemProps = {
|
|
630
|
+
/** sets the id value */
|
|
616
631
|
id: string;
|
|
632
|
+
/** sets the title value */
|
|
617
633
|
title: string;
|
|
618
|
-
|
|
634
|
+
/** sets the name valu, sometimes used for products */
|
|
635
|
+
name?: string;
|
|
636
|
+
/** sets the subtitle value */
|
|
637
|
+
subtitle?: string;
|
|
638
|
+
/** sets the content type value */
|
|
639
|
+
contentType?: string;
|
|
640
|
+
/** sets the created date value using TimeAgo to transform the date */
|
|
641
|
+
createdAt?: TDate;
|
|
642
|
+
/** sets the image src */
|
|
643
|
+
imageUrl?: string;
|
|
644
|
+
/** sets the link icon */
|
|
645
|
+
editLinkIcon?: string | React.ComponentType<{
|
|
646
|
+
className?: string;
|
|
647
|
+
}>;
|
|
648
|
+
/** sets the link href value to an external source */
|
|
649
|
+
editLink?: string;
|
|
650
|
+
/** sets the publish status */
|
|
651
|
+
publishStatus?: StatusTypes;
|
|
652
|
+
/** sets any additional meta data */
|
|
653
|
+
metadata?: Record<string, string>;
|
|
654
|
+
/** allows for child react elements to be nested in the popover */
|
|
655
|
+
popoverData?: ReactNode;
|
|
656
|
+
};
|
|
657
|
+
type ItemsProp = Array<SelectedItemProps & Record<string, unknown>>;
|
|
658
|
+
type ItemListProps<TList extends ItemsProp = ItemsProp> = {
|
|
659
|
+
items?: TList;
|
|
660
|
+
[key: string]: unknown;
|
|
661
|
+
};
|
|
662
|
+
type EntrySearchContextProps = {
|
|
663
|
+
/** function that updates / sets the search query state */
|
|
664
|
+
onSetQuery: (value: SearchQueryProps) => void;
|
|
665
|
+
/** current search query state */
|
|
666
|
+
query: SearchQueryProps;
|
|
667
|
+
/** function that sets the selected items to state */
|
|
668
|
+
onSelectItem: (selectedResult: any) => void;
|
|
669
|
+
/** function that clears all selected items from state */
|
|
670
|
+
onRemoveAllSelectedItems: () => void;
|
|
671
|
+
/** current selected items in state */
|
|
672
|
+
selectedListItems: Array<SelectedItemProps>;
|
|
673
|
+
/** current list of results in state */
|
|
674
|
+
list: ItemListProps;
|
|
675
|
+
/** function that sets the list of items to state */
|
|
676
|
+
onSetList: (value: ItemListProps) => void;
|
|
677
|
+
};
|
|
678
|
+
declare const EntrySearchContext: React$1.Context<EntrySearchContextProps>;
|
|
679
|
+
type EntrySearchProviderProps = {
|
|
680
|
+
children: ReactNode;
|
|
681
|
+
currentlySelectedItems?: Array<SelectedItemProps>;
|
|
682
|
+
};
|
|
683
|
+
declare const EntrySearchProvider: ({ currentlySelectedItems, children }: EntrySearchProviderProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
684
|
+
declare const useEntrySearchContext: () => {
|
|
685
|
+
/** function that updates / sets the search query state */
|
|
686
|
+
onSetQuery: (value: SearchQueryProps) => void;
|
|
687
|
+
/** current search query state */
|
|
688
|
+
query: SearchQueryProps;
|
|
689
|
+
/** function that sets the selected items to state */
|
|
690
|
+
onSelectItem: (selectedResult: any) => void;
|
|
691
|
+
/** function that clears all selected items from state */
|
|
692
|
+
onRemoveAllSelectedItems: () => void;
|
|
693
|
+
/** current selected items in state */
|
|
694
|
+
selectedListItems: Array<SelectedItemProps>;
|
|
695
|
+
/** current list of results in state */
|
|
696
|
+
list: ItemListProps;
|
|
697
|
+
/** function that sets the list of items to state */
|
|
698
|
+
onSetList: (value: ItemListProps) => void;
|
|
699
|
+
};
|
|
700
|
+
|
|
701
|
+
type EntrySearchListItemProps = SelectedItemProps & {
|
|
702
|
+
contentType?: string | string[];
|
|
619
703
|
image?: {
|
|
620
704
|
src: string;
|
|
621
705
|
alt: string;
|
|
@@ -626,28 +710,10 @@ type EntrySearchListItemProps = {
|
|
|
626
710
|
popoverInfo?: React$1.ReactNode;
|
|
627
711
|
children?: React$1.ReactNode;
|
|
628
712
|
};
|
|
629
|
-
declare const EntrySearchListItem: ({ id, title,
|
|
713
|
+
declare const EntrySearchListItem: ({ id, title, contentType, image, popoverInfo, onSelect, children, ...props }: EntrySearchListItemProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
630
714
|
declare const EntrySearchListItemLoadingSkeleton: () => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
631
715
|
|
|
632
|
-
type
|
|
633
|
-
type PublishStatusProps = {
|
|
634
|
-
status: StatusTypes;
|
|
635
|
-
};
|
|
636
|
-
declare const PublishStatus: ({ status }: PublishStatusProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
637
|
-
|
|
638
|
-
type EntrySearchResultItemProps = {
|
|
639
|
-
/** sets the id which is used for removal functionality */
|
|
640
|
-
id: string;
|
|
641
|
-
/** sets the title value */
|
|
642
|
-
title: string;
|
|
643
|
-
/** sets the subtitle value */
|
|
644
|
-
subtitle?: string;
|
|
645
|
-
/** sets user defined child nodes inside the popover box */
|
|
646
|
-
popoverInfo?: ReactNode;
|
|
647
|
-
/** sets the publish status */
|
|
648
|
-
publishStatus?: StatusTypes;
|
|
649
|
-
/** sets the created date */
|
|
650
|
-
createdAt?: TDate;
|
|
716
|
+
type EntrySearchResultItemProps = SelectedItemProps & {
|
|
651
717
|
/** sets additional remove functionality onto of default removal */
|
|
652
718
|
onRemove?: () => void;
|
|
653
719
|
/** sets whether to show or hide the remove button
|
|
@@ -657,20 +723,18 @@ type EntrySearchResultItemProps = {
|
|
|
657
723
|
/** sets user defined child nodes that are uncontrolled by Uniform */
|
|
658
724
|
children?: ReactNode;
|
|
659
725
|
};
|
|
660
|
-
declare const EntrySearchResultItem: ({ id, title,
|
|
726
|
+
declare const EntrySearchResultItem: ({ id, title, name, contentType, popoverData, publishStatus, editLinkIcon, editLink, imageUrl, onRemove, createdAt, hideRemoveButton, children, }: EntrySearchResultItemProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
661
727
|
|
|
662
|
-
type EntrySearchResultItemButtonProps = HTMLAttributes<HTMLButtonElement
|
|
663
|
-
text: string;
|
|
664
|
-
icon?: string;
|
|
665
|
-
};
|
|
666
|
-
declare const EntrySearchResultItemButton: ({ text, icon, ...props }: EntrySearchResultItemButtonProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
667
|
-
type LinkButtonProps = AnchorHTMLAttributes<HTMLAnchorElement> & {
|
|
728
|
+
type EntrySearchResultItemButtonProps<THtml extends HTMLAttributes<HTMLElement> = HTMLAttributes<HTMLButtonElement>> = {
|
|
668
729
|
text: string;
|
|
669
|
-
icon?: string
|
|
670
|
-
|
|
671
|
-
|
|
730
|
+
icon?: string | React.ComponentType<{
|
|
731
|
+
className?: string;
|
|
732
|
+
}>;
|
|
733
|
+
} & THtml;
|
|
734
|
+
declare const EntrySearchResultItemButton: ({ text, icon, ...props }: EntrySearchResultItemButtonProps<HTMLAttributes<HTMLButtonElement>>) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
735
|
+
declare const LinkButton: ({ text, icon, ...props }: EntrySearchResultItemButtonProps<AnchorHTMLAttributes<HTMLAnchorElement>>) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
672
736
|
|
|
673
|
-
type EntrySearchResultListProps = {
|
|
737
|
+
type EntrySearchResultListProps<TRenderComponent extends SelectedItemProps = SelectedItemProps> = {
|
|
674
738
|
/** sets the result label value
|
|
675
739
|
* @default 'Selected'
|
|
676
740
|
*/
|
|
@@ -688,9 +752,13 @@ type EntrySearchResultListProps = {
|
|
|
688
752
|
/** allows additional buttons to be added to the result title group */
|
|
689
753
|
additionalButtons?: React.ReactNode;
|
|
690
754
|
/** allows placing child components within the result list area */
|
|
691
|
-
|
|
755
|
+
renderResultComponent?: (value: TRenderComponent) => React.ReactNode;
|
|
756
|
+
/** disable or enable drag and drop functionality
|
|
757
|
+
* @default false
|
|
758
|
+
*/
|
|
759
|
+
disableDnD?: boolean;
|
|
692
760
|
};
|
|
693
|
-
declare const EntrySearchResultList: ({ resultLabelText, removeButtonText, onRemoveAllSelected, hideRemoveButton, additionalButtons,
|
|
761
|
+
declare const EntrySearchResultList: ({ resultLabelText, removeButtonText, onRemoveAllSelected, hideRemoveButton, additionalButtons, renderResultComponent, disableDnD, }: EntrySearchResultListProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
694
762
|
|
|
695
763
|
type QueryFilterSearchProps = {
|
|
696
764
|
count: number;
|
|
@@ -722,50 +790,6 @@ type QueryFilterProps = {
|
|
|
722
790
|
};
|
|
723
791
|
declare const QueryFilter: ({ requireContentType, queryFilterTitle, contentTypeLabel, typeSelectorAllTypesOptionText, contentTypeOptions, countLabel, countValue, sortLabel, sortOptions, sortOrderLabel, sortOrderOptions, children, }: QueryFilterProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
724
792
|
|
|
725
|
-
type SearchQueryProps = {
|
|
726
|
-
/** sets the content type in the search context */
|
|
727
|
-
contentType: string | undefined;
|
|
728
|
-
/** sets the keyword search in the search context */
|
|
729
|
-
keywordSearch?: string;
|
|
730
|
-
[key: string]: unknown;
|
|
731
|
-
};
|
|
732
|
-
interface SelectedItemProps {
|
|
733
|
-
id: string;
|
|
734
|
-
title: string;
|
|
735
|
-
contentType?: string;
|
|
736
|
-
createdAt?: TDate;
|
|
737
|
-
editLink?: string;
|
|
738
|
-
metadata?: Record<string, string>;
|
|
739
|
-
popoverData?: ReactNode;
|
|
740
|
-
}
|
|
741
|
-
type ItemsProp = {
|
|
742
|
-
items?: Array<SelectedItemProps & Record<string, unknown>>;
|
|
743
|
-
};
|
|
744
|
-
type EntrySearchFilterContextProps = {
|
|
745
|
-
onSetQuery: (value: SearchQueryProps) => void;
|
|
746
|
-
query: SearchQueryProps;
|
|
747
|
-
onSelectItem: (selectedResult: any) => void;
|
|
748
|
-
onRemoveAllSelectedItems: () => void;
|
|
749
|
-
selectedListItems: Array<SelectedItemProps>;
|
|
750
|
-
list: ItemsProp;
|
|
751
|
-
onSetList: (value: ItemsProp) => void;
|
|
752
|
-
};
|
|
753
|
-
declare const EntrySearchContext: React$1.Context<EntrySearchFilterContextProps>;
|
|
754
|
-
type EntrySearchProviderProps = {
|
|
755
|
-
children: ReactNode;
|
|
756
|
-
currentlySelectedItems?: Array<SelectedItemProps>;
|
|
757
|
-
};
|
|
758
|
-
declare const EntrySearchProvider: ({ currentlySelectedItems, children }: EntrySearchProviderProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
759
|
-
declare const useEntrySearchContext: () => {
|
|
760
|
-
onSetQuery: (value: SearchQueryProps) => void;
|
|
761
|
-
query: SearchQueryProps;
|
|
762
|
-
onSelectItem: (selectedResult: any) => void;
|
|
763
|
-
onRemoveAllSelectedItems: () => void;
|
|
764
|
-
selectedListItems: Array<SelectedItemProps>;
|
|
765
|
-
list: ItemsProp;
|
|
766
|
-
onSetList: (value: ItemsProp) => void;
|
|
767
|
-
};
|
|
768
|
-
|
|
769
793
|
type MeshAppProps = {
|
|
770
794
|
loadingComponent?: React__default.ComponentType;
|
|
771
795
|
errorComponent?: React__default.ComponentType<{
|
|
@@ -959,4 +983,4 @@ declare function useUniformMeshSdk(): _uniformdev_mesh_sdk.UniformMeshSDK;
|
|
|
959
983
|
*/
|
|
960
984
|
declare function createLocationValidator<TSetValue>(setValue: SetLocationValueDispatch<TSetValue>, validate: (newValue: TSetValue, currentResult: SetValueOptions | undefined) => SetValueOptions): SetLocationValueDispatch<TSetValue>;
|
|
961
985
|
|
|
962
|
-
export { BaseRequestData, Brand, DamItem, DamSelectedItem, DamSelectedItemProps, DataRefreshButton, DataRefreshButtonProps, DataResourceVariableRendererProps, DataResourceVariablesList, DataResourceVariablesListProps, DataSourceEditor, DataSourceEditorProps, DataTypeEditor, DataTypeEditorProps, DataVariableDefinitionWithName, DefaultSearchRow, DefaultSelectedItem, DispatchResult, EntrySearch, EntrySearchContainer, EntrySearchContainerProps, EntrySearchContentType, EntrySearchContext, EntrySearchFilter, EntrySearchFilterContainer, EntrySearchFilterContainerProps,
|
|
986
|
+
export { BaseRequestData, Brand, DamItem, DamSelectedItem, DamSelectedItemProps, DataRefreshButton, DataRefreshButtonProps, DataResourceVariableRendererProps, DataResourceVariablesList, DataResourceVariablesListProps, DataSourceEditor, DataSourceEditorProps, DataTypeEditor, DataTypeEditorProps, DataVariableDefinitionWithName, DefaultSearchRow, DefaultSelectedItem, DispatchResult, EntrySearch, EntrySearchContainer, EntrySearchContainerProps, EntrySearchContentType, EntrySearchContext, EntrySearchContextProps, EntrySearchFilter, EntrySearchFilterContainer, EntrySearchFilterContainerProps, EntrySearchFilterProps, EntrySearchListItem, EntrySearchListItemLoadingSkeleton, EntrySearchListItemProps, EntrySearchProps, EntrySearchProvider, EntrySearchProviderProps, EntrySearchQueryOptions, EntrySearchResult, EntrySearchResultItem, EntrySearchResultItemButton, EntrySearchResultItemButtonProps, EntrySearchResultItemProps, EntrySearchResultList, EntrySearchResultListProps, EntrySearchRowProps, EntrySearchSelectedItemProps, GetProductOptions, GetProductsOptions, index as Icons, InputToken, InputVariables, InputVariablesProps, ItemListProps, LinkButton, MeshApp, MeshAppProps, NoResultsProps, ProductCategory, ProductDynamicSelectorValue, ProductPreviewList, ProductQuery, ProductQueryCategory, ProductQueryContext, ProductQueryContextValue, ProductQueryProps, ProductSearch, ProductSearchContext, ProductSearchContextValue, ProductSearchProps, ProductSearchResult, ProductSearchResults, ProductSearchRow, ProductSelectedItem, PublishStatus, PublishStatusProps, 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, StatusTypes, 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, useEntrySearchContext, useInitializeUniformMeshSdk, useMeshLocation, useProductQueryContext, useProductSearchContext, useRequest, useRequestHeader, useRequestParameter, useUniformMeshLocation, useUniformMeshLocationContext, useUniformMeshSdk, useUniformMeshSdkContext, useVariables, variablesToList };
|
package/dist/index.esm.js
CHANGED
|
@@ -3899,8 +3899,13 @@ function convertRequestDataToDataType(dataType, requestData) {
|
|
|
3899
3899
|
import { css as css25 } from "@emotion/react";
|
|
3900
3900
|
import { Button as Button3, LoadingIndicator as LoadingIndicator2 } from "@uniformdev/design-system";
|
|
3901
3901
|
import { jsx as jsx44, jsxs as jsxs25 } from "@emotion/react/jsx-runtime";
|
|
3902
|
-
var DataRefreshButton = ({
|
|
3903
|
-
|
|
3902
|
+
var DataRefreshButton = ({
|
|
3903
|
+
buttonText,
|
|
3904
|
+
isLoading,
|
|
3905
|
+
onRefreshData,
|
|
3906
|
+
...props
|
|
3907
|
+
}) => {
|
|
3908
|
+
return /* @__PURE__ */ jsxs25(Button3, { buttonType: "primaryInvert", onClick: onRefreshData, disabled: isLoading, ...props, children: [
|
|
3904
3909
|
!isLoading ? null : /* @__PURE__ */ jsx44(
|
|
3905
3910
|
LoadingIndicator2,
|
|
3906
3911
|
{
|
|
@@ -3936,7 +3941,7 @@ var EntrySearchContainer = ({
|
|
|
3936
3941
|
return /* @__PURE__ */ jsx45(IconsProvider, { children: /* @__PURE__ */ jsxs26(VerticalRhythm, { children: [
|
|
3937
3942
|
/* @__PURE__ */ jsx45(Container, { backgroundColor: "gray-50", padding: "var(--spacing-base)", border: true, children: /* @__PURE__ */ jsxs26(VerticalRhythm, { children: [
|
|
3938
3943
|
searchFilters,
|
|
3939
|
-
/* @__PURE__ */ jsx45(ScrollableList, { children: resultList })
|
|
3944
|
+
!resultList ? null : /* @__PURE__ */ jsx45(ScrollableList, { role: "list", children: resultList })
|
|
3940
3945
|
] }) }),
|
|
3941
3946
|
children,
|
|
3942
3947
|
!onSave && !onCancel ? null : /* @__PURE__ */ jsxs26("div", { css: EntrySearchBtnGroup, children: [
|
|
@@ -3959,7 +3964,7 @@ var EntrySearchContext = createContext5({
|
|
|
3959
3964
|
onSelectItem: () => {
|
|
3960
3965
|
},
|
|
3961
3966
|
query: {
|
|
3962
|
-
contentType: "
|
|
3967
|
+
contentType: "",
|
|
3963
3968
|
keywordSearch: ""
|
|
3964
3969
|
},
|
|
3965
3970
|
list: {},
|
|
@@ -3971,7 +3976,7 @@ var EntrySearchContext = createContext5({
|
|
|
3971
3976
|
});
|
|
3972
3977
|
var EntrySearchProvider = ({ currentlySelectedItems, children }) => {
|
|
3973
3978
|
const [query, setQuery] = useState9({
|
|
3974
|
-
contentType: "
|
|
3979
|
+
contentType: "",
|
|
3975
3980
|
keywordSearch: ""
|
|
3976
3981
|
});
|
|
3977
3982
|
const querySearchDeferred = useDeferredValue(query);
|
|
@@ -3985,10 +3990,14 @@ var EntrySearchProvider = ({ currentlySelectedItems, children }) => {
|
|
|
3985
3990
|
);
|
|
3986
3991
|
const onSelectItem = useCallback(
|
|
3987
3992
|
(selectedResult) => {
|
|
3988
|
-
if (
|
|
3989
|
-
setSelectedItems(
|
|
3993
|
+
if (Array.isArray(selectedResult)) {
|
|
3994
|
+
setSelectedItems(selectedResult);
|
|
3990
3995
|
} else {
|
|
3991
|
-
|
|
3996
|
+
if (selectedItems.some((item) => item.id === selectedResult.id)) {
|
|
3997
|
+
setSelectedItems((prev) => prev.filter((item) => item.id !== selectedResult.id));
|
|
3998
|
+
} else {
|
|
3999
|
+
setSelectedItems((prev) => [...prev, selectedResult]);
|
|
4000
|
+
}
|
|
3992
4001
|
}
|
|
3993
4002
|
},
|
|
3994
4003
|
[setSelectedItems, selectedItems]
|
|
@@ -4183,7 +4192,7 @@ import { jsx as jsx49, jsxs as jsxs29 } from "@emotion/react/jsx-runtime";
|
|
|
4183
4192
|
var EntrySearchListItem = ({
|
|
4184
4193
|
id,
|
|
4185
4194
|
title,
|
|
4186
|
-
|
|
4195
|
+
contentType,
|
|
4187
4196
|
image,
|
|
4188
4197
|
popoverInfo,
|
|
4189
4198
|
onSelect,
|
|
@@ -4191,7 +4200,7 @@ var EntrySearchListItem = ({
|
|
|
4191
4200
|
...props
|
|
4192
4201
|
}) => {
|
|
4193
4202
|
const { onSelectItem, selectedListItems } = useEntrySearchContext();
|
|
4194
|
-
const
|
|
4203
|
+
const formatedContentType = Array.isArray(contentType) ? contentType.join(", ") : contentType;
|
|
4195
4204
|
const handleSelectItem = () => {
|
|
4196
4205
|
var _a;
|
|
4197
4206
|
const extraData = (_a = onSelect == null ? void 0 : onSelect()) != null ? _a : {};
|
|
@@ -4202,7 +4211,7 @@ var EntrySearchListItem = ({
|
|
|
4202
4211
|
/* @__PURE__ */ jsxs29("div", { role: "button", onClick: handleSelectItem, css: EntryListItemControlledContent, children: [
|
|
4203
4212
|
!image ? null : /* @__PURE__ */ jsx49("img", { ...image, loading: (image == null ? void 0 : image.width) && image.height ? "lazy" : "eager" }),
|
|
4204
4213
|
/* @__PURE__ */ jsxs29("div", { role: "heading", css: EntryListItemHeadingGroup, children: [
|
|
4205
|
-
!
|
|
4214
|
+
!contentType ? null : /* @__PURE__ */ jsx49("span", { css: EntryListItemSubtitle, children: formatedContentType }),
|
|
4206
4215
|
/* @__PURE__ */ jsx49("span", { css: EntryListItemTitle, children: title })
|
|
4207
4216
|
] })
|
|
4208
4217
|
] }),
|
|
@@ -4289,32 +4298,46 @@ var EntrySearchAuthorStateGroup = css30`
|
|
|
4289
4298
|
display: flex;
|
|
4290
4299
|
gap: var(--spacing-sm);
|
|
4291
4300
|
`;
|
|
4301
|
+
var EntrySearchContentContainer = css30`
|
|
4302
|
+
display: flex;
|
|
4303
|
+
gap: var(--spacing-xs);
|
|
4304
|
+
`;
|
|
4305
|
+
var EntrySearchImage = css30`
|
|
4306
|
+
max-width: 56px;
|
|
4307
|
+
object-fit: contain;
|
|
4308
|
+
`;
|
|
4292
4309
|
|
|
4293
4310
|
// src/components/EntrySearch/EntrySearchResultItem.tsx
|
|
4294
4311
|
import { jsx as jsx51, jsxs as jsxs30 } from "@emotion/react/jsx-runtime";
|
|
4295
4312
|
var EntrySearchResultItem = ({
|
|
4296
4313
|
id,
|
|
4297
4314
|
title,
|
|
4298
|
-
|
|
4299
|
-
|
|
4315
|
+
name,
|
|
4316
|
+
contentType,
|
|
4317
|
+
popoverData,
|
|
4300
4318
|
publishStatus,
|
|
4319
|
+
editLinkIcon,
|
|
4320
|
+
editLink,
|
|
4321
|
+
imageUrl,
|
|
4301
4322
|
onRemove,
|
|
4302
4323
|
createdAt,
|
|
4303
4324
|
hideRemoveButton = false,
|
|
4304
4325
|
children
|
|
4305
4326
|
}) => {
|
|
4306
4327
|
const { onSelectItem } = useEntrySearchContext();
|
|
4328
|
+
const formatedContentType = Array.isArray(contentType) ? contentType.join(", ") : contentType;
|
|
4307
4329
|
const onRemoveItem = () => {
|
|
4308
4330
|
onSelectItem({ id });
|
|
4309
4331
|
onRemove == null ? void 0 : onRemove();
|
|
4310
4332
|
};
|
|
4311
4333
|
return /* @__PURE__ */ jsxs30("div", { css: EntrySearchResultItemContainer, children: [
|
|
4312
|
-
/* @__PURE__ */ jsxs30("div", { children: [
|
|
4334
|
+
/* @__PURE__ */ jsx51("div", { children: /* @__PURE__ */ jsxs30("div", { css: EntrySearchContentContainer, children: [
|
|
4335
|
+
!imageUrl ? null : /* @__PURE__ */ jsx51("img", { src: imageUrl, alt: `Thumbnail for ${title}`, css: EntrySearchImage }),
|
|
4313
4336
|
/* @__PURE__ */ jsxs30("div", { children: [
|
|
4314
|
-
/* @__PURE__ */ jsx51("span", { css: EntrySearchResultItemSubtitle, children:
|
|
4337
|
+
/* @__PURE__ */ jsx51("span", { css: EntrySearchResultItemSubtitle, children: formatedContentType }),
|
|
4315
4338
|
/* @__PURE__ */ jsxs30("span", { role: "heading", css: EntrySearchResultItemTitle, children: [
|
|
4316
|
-
title,
|
|
4317
|
-
!
|
|
4339
|
+
title != null ? title : name,
|
|
4340
|
+
!popoverData ? null : /* @__PURE__ */ jsx51(Popover2, { baseId: title, ariaLabel: title, buttonText: `See ${title} details`, children: popoverData })
|
|
4318
4341
|
] }),
|
|
4319
4342
|
!createdAt && !publishStatus ? null : /* @__PURE__ */ jsxs30("div", { css: EntrySearchAuthorStateGroup, children: [
|
|
4320
4343
|
!publishStatus ? null : /* @__PURE__ */ jsx51(PublishStatus, { status: publishStatus }),
|
|
@@ -4322,11 +4345,14 @@ var EntrySearchResultItem = ({
|
|
|
4322
4345
|
/* @__PURE__ */ jsx51("strong", { children: "Last updated: " }),
|
|
4323
4346
|
timeagoFormat(createdAt)
|
|
4324
4347
|
] })
|
|
4325
|
-
] })
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
] }),
|
|
4329
|
-
hideRemoveButton ? null : /* @__PURE__ */
|
|
4348
|
+
] }),
|
|
4349
|
+
/* @__PURE__ */ jsx51("div", { children })
|
|
4350
|
+
] })
|
|
4351
|
+
] }) }),
|
|
4352
|
+
!editLink && hideRemoveButton ? null : /* @__PURE__ */ jsxs30("div", { css: EntrySearchAuthorStateGroup, children: [
|
|
4353
|
+
!editLink ? null : /* @__PURE__ */ jsx51(LinkButton, { text: "Edit", href: editLink, icon: editLinkIcon }),
|
|
4354
|
+
hideRemoveButton ? null : /* @__PURE__ */ jsx51(Button5, { buttonType: "ghostDestructive", onClick: onRemoveItem, children: "Remove" })
|
|
4355
|
+
] })
|
|
4330
4356
|
] });
|
|
4331
4357
|
};
|
|
4332
4358
|
|
|
@@ -4367,14 +4393,22 @@ var ButtonIcon = css31`
|
|
|
4367
4393
|
|
|
4368
4394
|
// src/components/EntrySearch/EntrySearchResultItemButton.tsx
|
|
4369
4395
|
import { jsx as jsx52, jsxs as jsxs31 } from "@emotion/react/jsx-runtime";
|
|
4370
|
-
var EntrySearchResultItemButton = ({
|
|
4396
|
+
var EntrySearchResultItemButton = ({
|
|
4397
|
+
text,
|
|
4398
|
+
icon,
|
|
4399
|
+
...props
|
|
4400
|
+
}) => {
|
|
4371
4401
|
return /* @__PURE__ */ jsxs31("button", { type: "button", css: ButtonStyles, ...props, children: [
|
|
4372
4402
|
!icon ? null : /* @__PURE__ */ jsx52(Image, { src: icon, css: ButtonIcon }),
|
|
4373
4403
|
text
|
|
4374
4404
|
] });
|
|
4375
4405
|
};
|
|
4376
|
-
var LinkButton = ({
|
|
4377
|
-
|
|
4406
|
+
var LinkButton = ({
|
|
4407
|
+
text,
|
|
4408
|
+
icon,
|
|
4409
|
+
...props
|
|
4410
|
+
}) => {
|
|
4411
|
+
return /* @__PURE__ */ jsxs31("a", { ...props, css: ButtonStyles, target: "_blank", rel: "noopener noreferrer", children: [
|
|
4378
4412
|
!icon ? null : /* @__PURE__ */ jsx52(Image, { src: icon, css: ButtonIcon }),
|
|
4379
4413
|
text
|
|
4380
4414
|
] });
|
|
@@ -4382,6 +4416,7 @@ var LinkButton = ({ text, icon, ...props }) => {
|
|
|
4382
4416
|
|
|
4383
4417
|
// src/components/EntrySearch/EntrySearchResultList.tsx
|
|
4384
4418
|
import { Button as Button6, Counter, VerticalRhythm as VerticalRhythm2 } from "@uniformdev/design-system";
|
|
4419
|
+
import { DragDropContext as DragDropContext3, Draggable as Draggable3, Droppable as Droppable3 } from "react-beautiful-dnd";
|
|
4385
4420
|
|
|
4386
4421
|
// src/components/EntrySearch/styles/EntrySearchResultList.styles.ts
|
|
4387
4422
|
import { css as css32 } from "@emotion/react";
|
|
@@ -4409,33 +4444,70 @@ var EntrySearchResultList = ({
|
|
|
4409
4444
|
onRemoveAllSelected,
|
|
4410
4445
|
hideRemoveButton = false,
|
|
4411
4446
|
additionalButtons,
|
|
4412
|
-
|
|
4447
|
+
renderResultComponent = (value) => /* @__PURE__ */ jsx53(EntrySearchResultItem, { ...value }),
|
|
4448
|
+
disableDnD = false
|
|
4413
4449
|
}) => {
|
|
4414
|
-
const { selectedListItems, onRemoveAllSelectedItems } = useEntrySearchContext();
|
|
4450
|
+
const { selectedListItems, onRemoveAllSelectedItems, onSelectItem } = useEntrySearchContext();
|
|
4415
4451
|
const handleRemoveAllSelectedItems = () => {
|
|
4416
4452
|
onRemoveAllSelectedItems();
|
|
4417
4453
|
onRemoveAllSelected == null ? void 0 : onRemoveAllSelected();
|
|
4418
4454
|
};
|
|
4455
|
+
const onDragEnd = (res) => {
|
|
4456
|
+
var _a, _b;
|
|
4457
|
+
if (res.destination && res.source.droppableId === ((_a = res.destination) == null ? void 0 : _a.droppableId)) {
|
|
4458
|
+
const result = [...selectedListItems || []];
|
|
4459
|
+
const [removed] = (_b = result == null ? void 0 : result.splice(res.source.index, 1)) != null ? _b : [];
|
|
4460
|
+
result == null ? void 0 : result.splice(res.destination.index, 0, removed);
|
|
4461
|
+
onSelectItem(result);
|
|
4462
|
+
return result;
|
|
4463
|
+
}
|
|
4464
|
+
};
|
|
4419
4465
|
return /* @__PURE__ */ jsxs32(Fragment7, { children: [
|
|
4420
4466
|
/* @__PURE__ */ jsxs32("div", { role: "group", css: EntrySearchResultListContainer, children: [
|
|
4421
4467
|
/* @__PURE__ */ jsxs32("div", { role: "note", css: EntrySearchResultListCounterContainer, children: [
|
|
4422
4468
|
/* @__PURE__ */ jsx53("span", { css: EntrySearchResultListTitle, children: resultLabelText }),
|
|
4423
4469
|
" ",
|
|
4424
|
-
/* @__PURE__ */ jsx53(Counter, { count: selectedListItems.length })
|
|
4470
|
+
!selectedListItems.length ? null : /* @__PURE__ */ jsx53(Counter, { count: selectedListItems.length })
|
|
4425
4471
|
] }),
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4472
|
+
/* @__PURE__ */ jsxs32("div", { css: EntrySearchResultListCounterContainer, children: [
|
|
4473
|
+
additionalButtons,
|
|
4474
|
+
hideRemoveButton ? null : /* @__PURE__ */ jsx53(
|
|
4475
|
+
Button6,
|
|
4476
|
+
{
|
|
4477
|
+
buttonType: "ghostDestructive",
|
|
4478
|
+
size: "xs",
|
|
4479
|
+
disabled: selectedListItems.length === 0,
|
|
4480
|
+
onClick: handleRemoveAllSelectedItems,
|
|
4481
|
+
children: removeButtonText
|
|
4482
|
+
}
|
|
4483
|
+
)
|
|
4484
|
+
] })
|
|
4437
4485
|
] }),
|
|
4438
|
-
/* @__PURE__ */ jsx53(
|
|
4486
|
+
!selectedListItems.length ? null : /* @__PURE__ */ jsx53(DragDropContext3, { onDragEnd: (res) => onDragEnd(res), children: /* @__PURE__ */ jsx53(Droppable3, { droppableId: "canvas-multi-select", children: (provided) => /* @__PURE__ */ jsxs32("div", { ...provided.droppableProps, ref: provided.innerRef, children: [
|
|
4487
|
+
/* @__PURE__ */ jsx53(VerticalRhythm2, { gap: "sm", children: selectedListItems.map((item, i) => {
|
|
4488
|
+
const renderListItem = renderResultComponent(item);
|
|
4489
|
+
return /* @__PURE__ */ jsx53(
|
|
4490
|
+
Draggable3,
|
|
4491
|
+
{
|
|
4492
|
+
draggableId: item.title,
|
|
4493
|
+
index: i,
|
|
4494
|
+
isDragDisabled: disableDnD,
|
|
4495
|
+
children: (provided2, snapshot) => /* @__PURE__ */ jsx53(
|
|
4496
|
+
"div",
|
|
4497
|
+
{
|
|
4498
|
+
ref: provided2.innerRef,
|
|
4499
|
+
"data-dragging": snapshot.isDragging,
|
|
4500
|
+
...provided2.draggableProps,
|
|
4501
|
+
...provided2.dragHandleProps,
|
|
4502
|
+
children: renderListItem
|
|
4503
|
+
}
|
|
4504
|
+
)
|
|
4505
|
+
},
|
|
4506
|
+
item.title
|
|
4507
|
+
);
|
|
4508
|
+
}) }),
|
|
4509
|
+
provided.placeholder
|
|
4510
|
+
] }) }) })
|
|
4439
4511
|
] });
|
|
4440
4512
|
};
|
|
4441
4513
|
|
|
@@ -4457,11 +4529,11 @@ var QueryFilter = ({
|
|
|
4457
4529
|
sortOrderOptions = [
|
|
4458
4530
|
{
|
|
4459
4531
|
name: "Ascending",
|
|
4460
|
-
id: "
|
|
4532
|
+
id: "asc"
|
|
4461
4533
|
},
|
|
4462
4534
|
{
|
|
4463
4535
|
name: "Descending",
|
|
4464
|
-
id: "
|
|
4536
|
+
id: "desc"
|
|
4465
4537
|
}
|
|
4466
4538
|
],
|
|
4467
4539
|
children
|
|
@@ -4469,7 +4541,7 @@ var QueryFilter = ({
|
|
|
4469
4541
|
var _a, _b;
|
|
4470
4542
|
const { query, onSetQuery } = useEntrySearchContext();
|
|
4471
4543
|
const [queryState, setQueryState] = useState11({
|
|
4472
|
-
contentType:
|
|
4544
|
+
contentType: "",
|
|
4473
4545
|
count: countValue != null ? countValue : 5,
|
|
4474
4546
|
sortBy: (_a = sortOptions[0].id) != null ? _a : "",
|
|
4475
4547
|
sortOrder: (_b = sortOrderOptions[0].id) != null ? _b : ""
|
|
@@ -4490,7 +4562,7 @@ var QueryFilter = ({
|
|
|
4490
4562
|
{
|
|
4491
4563
|
label: contentTypeLabel,
|
|
4492
4564
|
options: [
|
|
4493
|
-
...!requireContentType ? [{ value: "
|
|
4565
|
+
...!requireContentType ? [{ value: "", label: typeSelectorAllTypesOptionText }] : [],
|
|
4494
4566
|
...contentTypeOptions ? contentTypeOptions.map((option) => {
|
|
4495
4567
|
return { value: option.id, label: option.name };
|
|
4496
4568
|
}) : []
|
|
@@ -4516,6 +4588,10 @@ var QueryFilter = ({
|
|
|
4516
4588
|
{
|
|
4517
4589
|
label: sortLabel,
|
|
4518
4590
|
options: [
|
|
4591
|
+
{
|
|
4592
|
+
label: "Select a sort",
|
|
4593
|
+
value: ""
|
|
4594
|
+
},
|
|
4519
4595
|
...sortOptions ? sortOptions.map((option) => {
|
|
4520
4596
|
return { value: option.id, label: option.name };
|
|
4521
4597
|
}) : []
|
package/dist/index.js
CHANGED
|
@@ -4055,8 +4055,13 @@ function convertRequestDataToDataType(dataType, requestData) {
|
|
|
4055
4055
|
var import_react38 = require("@emotion/react");
|
|
4056
4056
|
var import_design_system23 = require("@uniformdev/design-system");
|
|
4057
4057
|
var import_jsx_runtime44 = require("@emotion/react/jsx-runtime");
|
|
4058
|
-
var DataRefreshButton = ({
|
|
4059
|
-
|
|
4058
|
+
var DataRefreshButton = ({
|
|
4059
|
+
buttonText,
|
|
4060
|
+
isLoading,
|
|
4061
|
+
onRefreshData,
|
|
4062
|
+
...props
|
|
4063
|
+
}) => {
|
|
4064
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_design_system23.Button, { buttonType: "primaryInvert", onClick: onRefreshData, disabled: isLoading, ...props, children: [
|
|
4060
4065
|
!isLoading ? null : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
4061
4066
|
import_design_system23.LoadingIndicator,
|
|
4062
4067
|
{
|
|
@@ -4092,7 +4097,7 @@ var EntrySearchContainer = ({
|
|
|
4092
4097
|
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_design_system24.IconsProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_design_system24.VerticalRhythm, { children: [
|
|
4093
4098
|
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_design_system24.Container, { backgroundColor: "gray-50", padding: "var(--spacing-base)", border: true, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_design_system24.VerticalRhythm, { children: [
|
|
4094
4099
|
searchFilters,
|
|
4095
|
-
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_design_system24.ScrollableList, { children: resultList })
|
|
4100
|
+
!resultList ? null : /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_design_system24.ScrollableList, { role: "list", children: resultList })
|
|
4096
4101
|
] }) }),
|
|
4097
4102
|
children,
|
|
4098
4103
|
!onSave && !onCancel ? null : /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { css: EntrySearchBtnGroup, children: [
|
|
@@ -4115,7 +4120,7 @@ var EntrySearchContext = (0, import_react40.createContext)({
|
|
|
4115
4120
|
onSelectItem: () => {
|
|
4116
4121
|
},
|
|
4117
4122
|
query: {
|
|
4118
|
-
contentType: "
|
|
4123
|
+
contentType: "",
|
|
4119
4124
|
keywordSearch: ""
|
|
4120
4125
|
},
|
|
4121
4126
|
list: {},
|
|
@@ -4127,7 +4132,7 @@ var EntrySearchContext = (0, import_react40.createContext)({
|
|
|
4127
4132
|
});
|
|
4128
4133
|
var EntrySearchProvider = ({ currentlySelectedItems, children }) => {
|
|
4129
4134
|
const [query, setQuery] = (0, import_react40.useState)({
|
|
4130
|
-
contentType: "
|
|
4135
|
+
contentType: "",
|
|
4131
4136
|
keywordSearch: ""
|
|
4132
4137
|
});
|
|
4133
4138
|
const querySearchDeferred = (0, import_react40.useDeferredValue)(query);
|
|
@@ -4141,10 +4146,14 @@ var EntrySearchProvider = ({ currentlySelectedItems, children }) => {
|
|
|
4141
4146
|
);
|
|
4142
4147
|
const onSelectItem = (0, import_react40.useCallback)(
|
|
4143
4148
|
(selectedResult) => {
|
|
4144
|
-
if (
|
|
4145
|
-
setSelectedItems(
|
|
4149
|
+
if (Array.isArray(selectedResult)) {
|
|
4150
|
+
setSelectedItems(selectedResult);
|
|
4146
4151
|
} else {
|
|
4147
|
-
|
|
4152
|
+
if (selectedItems.some((item) => item.id === selectedResult.id)) {
|
|
4153
|
+
setSelectedItems((prev) => prev.filter((item) => item.id !== selectedResult.id));
|
|
4154
|
+
} else {
|
|
4155
|
+
setSelectedItems((prev) => [...prev, selectedResult]);
|
|
4156
|
+
}
|
|
4148
4157
|
}
|
|
4149
4158
|
},
|
|
4150
4159
|
[setSelectedItems, selectedItems]
|
|
@@ -4339,7 +4348,7 @@ var import_jsx_runtime49 = require("@emotion/react/jsx-runtime");
|
|
|
4339
4348
|
var EntrySearchListItem = ({
|
|
4340
4349
|
id,
|
|
4341
4350
|
title,
|
|
4342
|
-
|
|
4351
|
+
contentType,
|
|
4343
4352
|
image,
|
|
4344
4353
|
popoverInfo,
|
|
4345
4354
|
onSelect,
|
|
@@ -4347,7 +4356,7 @@ var EntrySearchListItem = ({
|
|
|
4347
4356
|
...props
|
|
4348
4357
|
}) => {
|
|
4349
4358
|
const { onSelectItem, selectedListItems } = useEntrySearchContext();
|
|
4350
|
-
const
|
|
4359
|
+
const formatedContentType = Array.isArray(contentType) ? contentType.join(", ") : contentType;
|
|
4351
4360
|
const handleSelectItem = () => {
|
|
4352
4361
|
var _a;
|
|
4353
4362
|
const extraData = (_a = onSelect == null ? void 0 : onSelect()) != null ? _a : {};
|
|
@@ -4358,7 +4367,7 @@ var EntrySearchListItem = ({
|
|
|
4358
4367
|
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { role: "button", onClick: handleSelectItem, css: EntryListItemControlledContent, children: [
|
|
4359
4368
|
!image ? null : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("img", { ...image, loading: (image == null ? void 0 : image.width) && image.height ? "lazy" : "eager" }),
|
|
4360
4369
|
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { role: "heading", css: EntryListItemHeadingGroup, children: [
|
|
4361
|
-
!
|
|
4370
|
+
!contentType ? null : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { css: EntryListItemSubtitle, children: formatedContentType }),
|
|
4362
4371
|
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { css: EntryListItemTitle, children: title })
|
|
4363
4372
|
] })
|
|
4364
4373
|
] }),
|
|
@@ -4445,32 +4454,46 @@ var EntrySearchAuthorStateGroup = import_react45.css`
|
|
|
4445
4454
|
display: flex;
|
|
4446
4455
|
gap: var(--spacing-sm);
|
|
4447
4456
|
`;
|
|
4457
|
+
var EntrySearchContentContainer = import_react45.css`
|
|
4458
|
+
display: flex;
|
|
4459
|
+
gap: var(--spacing-xs);
|
|
4460
|
+
`;
|
|
4461
|
+
var EntrySearchImage = import_react45.css`
|
|
4462
|
+
max-width: 56px;
|
|
4463
|
+
object-fit: contain;
|
|
4464
|
+
`;
|
|
4448
4465
|
|
|
4449
4466
|
// src/components/EntrySearch/EntrySearchResultItem.tsx
|
|
4450
4467
|
var import_jsx_runtime51 = require("@emotion/react/jsx-runtime");
|
|
4451
4468
|
var EntrySearchResultItem = ({
|
|
4452
4469
|
id,
|
|
4453
4470
|
title,
|
|
4454
|
-
|
|
4455
|
-
|
|
4471
|
+
name,
|
|
4472
|
+
contentType,
|
|
4473
|
+
popoverData,
|
|
4456
4474
|
publishStatus,
|
|
4475
|
+
editLinkIcon,
|
|
4476
|
+
editLink,
|
|
4477
|
+
imageUrl,
|
|
4457
4478
|
onRemove,
|
|
4458
4479
|
createdAt,
|
|
4459
4480
|
hideRemoveButton = false,
|
|
4460
4481
|
children
|
|
4461
4482
|
}) => {
|
|
4462
4483
|
const { onSelectItem } = useEntrySearchContext();
|
|
4484
|
+
const formatedContentType = Array.isArray(contentType) ? contentType.join(", ") : contentType;
|
|
4463
4485
|
const onRemoveItem = () => {
|
|
4464
4486
|
onSelectItem({ id });
|
|
4465
4487
|
onRemove == null ? void 0 : onRemove();
|
|
4466
4488
|
};
|
|
4467
4489
|
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { css: EntrySearchResultItemContainer, children: [
|
|
4468
|
-
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { children: [
|
|
4490
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { css: EntrySearchContentContainer, children: [
|
|
4491
|
+
!imageUrl ? null : /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("img", { src: imageUrl, alt: `Thumbnail for ${title}`, css: EntrySearchImage }),
|
|
4469
4492
|
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { children: [
|
|
4470
|
-
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { css: EntrySearchResultItemSubtitle, children:
|
|
4493
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { css: EntrySearchResultItemSubtitle, children: formatedContentType }),
|
|
4471
4494
|
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("span", { role: "heading", css: EntrySearchResultItemTitle, children: [
|
|
4472
|
-
title,
|
|
4473
|
-
!
|
|
4495
|
+
title != null ? title : name,
|
|
4496
|
+
!popoverData ? null : /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_design_system28.Popover, { baseId: title, ariaLabel: title, buttonText: `See ${title} details`, children: popoverData })
|
|
4474
4497
|
] }),
|
|
4475
4498
|
!createdAt && !publishStatus ? null : /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { css: EntrySearchAuthorStateGroup, children: [
|
|
4476
4499
|
!publishStatus ? null : /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(PublishStatus, { status: publishStatus }),
|
|
@@ -4478,11 +4501,14 @@ var EntrySearchResultItem = ({
|
|
|
4478
4501
|
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("strong", { children: "Last updated: " }),
|
|
4479
4502
|
(0, import_timeago3.format)(createdAt)
|
|
4480
4503
|
] })
|
|
4481
|
-
] })
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
] }),
|
|
4485
|
-
hideRemoveButton ? null : /* @__PURE__ */ (0, import_jsx_runtime51.
|
|
4504
|
+
] }),
|
|
4505
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { children })
|
|
4506
|
+
] })
|
|
4507
|
+
] }) }),
|
|
4508
|
+
!editLink && hideRemoveButton ? null : /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { css: EntrySearchAuthorStateGroup, children: [
|
|
4509
|
+
!editLink ? null : /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(LinkButton, { text: "Edit", href: editLink, icon: editLinkIcon }),
|
|
4510
|
+
hideRemoveButton ? null : /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_design_system28.Button, { buttonType: "ghostDestructive", onClick: onRemoveItem, children: "Remove" })
|
|
4511
|
+
] })
|
|
4486
4512
|
] });
|
|
4487
4513
|
};
|
|
4488
4514
|
|
|
@@ -4523,14 +4549,22 @@ var ButtonIcon = import_react46.css`
|
|
|
4523
4549
|
|
|
4524
4550
|
// src/components/EntrySearch/EntrySearchResultItemButton.tsx
|
|
4525
4551
|
var import_jsx_runtime52 = require("@emotion/react/jsx-runtime");
|
|
4526
|
-
var EntrySearchResultItemButton = ({
|
|
4552
|
+
var EntrySearchResultItemButton = ({
|
|
4553
|
+
text,
|
|
4554
|
+
icon,
|
|
4555
|
+
...props
|
|
4556
|
+
}) => {
|
|
4527
4557
|
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("button", { type: "button", css: ButtonStyles, ...props, children: [
|
|
4528
4558
|
!icon ? null : /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Image, { src: icon, css: ButtonIcon }),
|
|
4529
4559
|
text
|
|
4530
4560
|
] });
|
|
4531
4561
|
};
|
|
4532
|
-
var LinkButton = ({
|
|
4533
|
-
|
|
4562
|
+
var LinkButton = ({
|
|
4563
|
+
text,
|
|
4564
|
+
icon,
|
|
4565
|
+
...props
|
|
4566
|
+
}) => {
|
|
4567
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("a", { ...props, css: ButtonStyles, target: "_blank", rel: "noopener noreferrer", children: [
|
|
4534
4568
|
!icon ? null : /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Image, { src: icon, css: ButtonIcon }),
|
|
4535
4569
|
text
|
|
4536
4570
|
] });
|
|
@@ -4538,6 +4572,7 @@ var LinkButton = ({ text, icon, ...props }) => {
|
|
|
4538
4572
|
|
|
4539
4573
|
// src/components/EntrySearch/EntrySearchResultList.tsx
|
|
4540
4574
|
var import_design_system30 = require("@uniformdev/design-system");
|
|
4575
|
+
var import_react_beautiful_dnd3 = require("react-beautiful-dnd");
|
|
4541
4576
|
|
|
4542
4577
|
// src/components/EntrySearch/styles/EntrySearchResultList.styles.ts
|
|
4543
4578
|
var import_react47 = require("@emotion/react");
|
|
@@ -4565,33 +4600,70 @@ var EntrySearchResultList = ({
|
|
|
4565
4600
|
onRemoveAllSelected,
|
|
4566
4601
|
hideRemoveButton = false,
|
|
4567
4602
|
additionalButtons,
|
|
4568
|
-
|
|
4603
|
+
renderResultComponent = (value) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(EntrySearchResultItem, { ...value }),
|
|
4604
|
+
disableDnD = false
|
|
4569
4605
|
}) => {
|
|
4570
|
-
const { selectedListItems, onRemoveAllSelectedItems } = useEntrySearchContext();
|
|
4606
|
+
const { selectedListItems, onRemoveAllSelectedItems, onSelectItem } = useEntrySearchContext();
|
|
4571
4607
|
const handleRemoveAllSelectedItems = () => {
|
|
4572
4608
|
onRemoveAllSelectedItems();
|
|
4573
4609
|
onRemoveAllSelected == null ? void 0 : onRemoveAllSelected();
|
|
4574
4610
|
};
|
|
4611
|
+
const onDragEnd = (res) => {
|
|
4612
|
+
var _a, _b;
|
|
4613
|
+
if (res.destination && res.source.droppableId === ((_a = res.destination) == null ? void 0 : _a.droppableId)) {
|
|
4614
|
+
const result = [...selectedListItems || []];
|
|
4615
|
+
const [removed] = (_b = result == null ? void 0 : result.splice(res.source.index, 1)) != null ? _b : [];
|
|
4616
|
+
result == null ? void 0 : result.splice(res.destination.index, 0, removed);
|
|
4617
|
+
onSelectItem(result);
|
|
4618
|
+
return result;
|
|
4619
|
+
}
|
|
4620
|
+
};
|
|
4575
4621
|
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_jsx_runtime53.Fragment, { children: [
|
|
4576
4622
|
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { role: "group", css: EntrySearchResultListContainer, children: [
|
|
4577
4623
|
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { role: "note", css: EntrySearchResultListCounterContainer, children: [
|
|
4578
4624
|
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { css: EntrySearchResultListTitle, children: resultLabelText }),
|
|
4579
4625
|
" ",
|
|
4580
|
-
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_design_system30.Counter, { count: selectedListItems.length })
|
|
4626
|
+
!selectedListItems.length ? null : /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_design_system30.Counter, { count: selectedListItems.length })
|
|
4581
4627
|
] }),
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
|
|
4592
|
-
|
|
4628
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { css: EntrySearchResultListCounterContainer, children: [
|
|
4629
|
+
additionalButtons,
|
|
4630
|
+
hideRemoveButton ? null : /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
4631
|
+
import_design_system30.Button,
|
|
4632
|
+
{
|
|
4633
|
+
buttonType: "ghostDestructive",
|
|
4634
|
+
size: "xs",
|
|
4635
|
+
disabled: selectedListItems.length === 0,
|
|
4636
|
+
onClick: handleRemoveAllSelectedItems,
|
|
4637
|
+
children: removeButtonText
|
|
4638
|
+
}
|
|
4639
|
+
)
|
|
4640
|
+
] })
|
|
4593
4641
|
] }),
|
|
4594
|
-
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
4642
|
+
!selectedListItems.length ? null : /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_react_beautiful_dnd3.DragDropContext, { onDragEnd: (res) => onDragEnd(res), children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_react_beautiful_dnd3.Droppable, { droppableId: "canvas-multi-select", children: (provided) => /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { ...provided.droppableProps, ref: provided.innerRef, children: [
|
|
4643
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_design_system30.VerticalRhythm, { gap: "sm", children: selectedListItems.map((item, i) => {
|
|
4644
|
+
const renderListItem = renderResultComponent(item);
|
|
4645
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
4646
|
+
import_react_beautiful_dnd3.Draggable,
|
|
4647
|
+
{
|
|
4648
|
+
draggableId: item.title,
|
|
4649
|
+
index: i,
|
|
4650
|
+
isDragDisabled: disableDnD,
|
|
4651
|
+
children: (provided2, snapshot) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
4652
|
+
"div",
|
|
4653
|
+
{
|
|
4654
|
+
ref: provided2.innerRef,
|
|
4655
|
+
"data-dragging": snapshot.isDragging,
|
|
4656
|
+
...provided2.draggableProps,
|
|
4657
|
+
...provided2.dragHandleProps,
|
|
4658
|
+
children: renderListItem
|
|
4659
|
+
}
|
|
4660
|
+
)
|
|
4661
|
+
},
|
|
4662
|
+
item.title
|
|
4663
|
+
);
|
|
4664
|
+
}) }),
|
|
4665
|
+
provided.placeholder
|
|
4666
|
+
] }) }) })
|
|
4595
4667
|
] });
|
|
4596
4668
|
};
|
|
4597
4669
|
|
|
@@ -4613,11 +4685,11 @@ var QueryFilter = ({
|
|
|
4613
4685
|
sortOrderOptions = [
|
|
4614
4686
|
{
|
|
4615
4687
|
name: "Ascending",
|
|
4616
|
-
id: "
|
|
4688
|
+
id: "asc"
|
|
4617
4689
|
},
|
|
4618
4690
|
{
|
|
4619
4691
|
name: "Descending",
|
|
4620
|
-
id: "
|
|
4692
|
+
id: "desc"
|
|
4621
4693
|
}
|
|
4622
4694
|
],
|
|
4623
4695
|
children
|
|
@@ -4625,7 +4697,7 @@ var QueryFilter = ({
|
|
|
4625
4697
|
var _a, _b;
|
|
4626
4698
|
const { query, onSetQuery } = useEntrySearchContext();
|
|
4627
4699
|
const [queryState, setQueryState] = (0, import_react48.useState)({
|
|
4628
|
-
contentType:
|
|
4700
|
+
contentType: "",
|
|
4629
4701
|
count: countValue != null ? countValue : 5,
|
|
4630
4702
|
sortBy: (_a = sortOptions[0].id) != null ? _a : "",
|
|
4631
4703
|
sortOrder: (_b = sortOrderOptions[0].id) != null ? _b : ""
|
|
@@ -4646,7 +4718,7 @@ var QueryFilter = ({
|
|
|
4646
4718
|
{
|
|
4647
4719
|
label: contentTypeLabel,
|
|
4648
4720
|
options: [
|
|
4649
|
-
...!requireContentType ? [{ value: "
|
|
4721
|
+
...!requireContentType ? [{ value: "", label: typeSelectorAllTypesOptionText }] : [],
|
|
4650
4722
|
...contentTypeOptions ? contentTypeOptions.map((option) => {
|
|
4651
4723
|
return { value: option.id, label: option.name };
|
|
4652
4724
|
}) : []
|
|
@@ -4672,6 +4744,10 @@ var QueryFilter = ({
|
|
|
4672
4744
|
{
|
|
4673
4745
|
label: sortLabel,
|
|
4674
4746
|
options: [
|
|
4747
|
+
{
|
|
4748
|
+
label: "Select a sort",
|
|
4749
|
+
value: ""
|
|
4750
|
+
},
|
|
4675
4751
|
...sortOptions ? sortOptions.map((option) => {
|
|
4676
4752
|
return { value: option.id, label: option.name };
|
|
4677
4753
|
}) : []
|
package/dist/index.mjs
CHANGED
|
@@ -3899,8 +3899,13 @@ function convertRequestDataToDataType(dataType, requestData) {
|
|
|
3899
3899
|
import { css as css25 } from "@emotion/react";
|
|
3900
3900
|
import { Button as Button3, LoadingIndicator as LoadingIndicator2 } from "@uniformdev/design-system";
|
|
3901
3901
|
import { jsx as jsx44, jsxs as jsxs25 } from "@emotion/react/jsx-runtime";
|
|
3902
|
-
var DataRefreshButton = ({
|
|
3903
|
-
|
|
3902
|
+
var DataRefreshButton = ({
|
|
3903
|
+
buttonText,
|
|
3904
|
+
isLoading,
|
|
3905
|
+
onRefreshData,
|
|
3906
|
+
...props
|
|
3907
|
+
}) => {
|
|
3908
|
+
return /* @__PURE__ */ jsxs25(Button3, { buttonType: "primaryInvert", onClick: onRefreshData, disabled: isLoading, ...props, children: [
|
|
3904
3909
|
!isLoading ? null : /* @__PURE__ */ jsx44(
|
|
3905
3910
|
LoadingIndicator2,
|
|
3906
3911
|
{
|
|
@@ -3936,7 +3941,7 @@ var EntrySearchContainer = ({
|
|
|
3936
3941
|
return /* @__PURE__ */ jsx45(IconsProvider, { children: /* @__PURE__ */ jsxs26(VerticalRhythm, { children: [
|
|
3937
3942
|
/* @__PURE__ */ jsx45(Container, { backgroundColor: "gray-50", padding: "var(--spacing-base)", border: true, children: /* @__PURE__ */ jsxs26(VerticalRhythm, { children: [
|
|
3938
3943
|
searchFilters,
|
|
3939
|
-
/* @__PURE__ */ jsx45(ScrollableList, { children: resultList })
|
|
3944
|
+
!resultList ? null : /* @__PURE__ */ jsx45(ScrollableList, { role: "list", children: resultList })
|
|
3940
3945
|
] }) }),
|
|
3941
3946
|
children,
|
|
3942
3947
|
!onSave && !onCancel ? null : /* @__PURE__ */ jsxs26("div", { css: EntrySearchBtnGroup, children: [
|
|
@@ -3959,7 +3964,7 @@ var EntrySearchContext = createContext5({
|
|
|
3959
3964
|
onSelectItem: () => {
|
|
3960
3965
|
},
|
|
3961
3966
|
query: {
|
|
3962
|
-
contentType: "
|
|
3967
|
+
contentType: "",
|
|
3963
3968
|
keywordSearch: ""
|
|
3964
3969
|
},
|
|
3965
3970
|
list: {},
|
|
@@ -3971,7 +3976,7 @@ var EntrySearchContext = createContext5({
|
|
|
3971
3976
|
});
|
|
3972
3977
|
var EntrySearchProvider = ({ currentlySelectedItems, children }) => {
|
|
3973
3978
|
const [query, setQuery] = useState9({
|
|
3974
|
-
contentType: "
|
|
3979
|
+
contentType: "",
|
|
3975
3980
|
keywordSearch: ""
|
|
3976
3981
|
});
|
|
3977
3982
|
const querySearchDeferred = useDeferredValue(query);
|
|
@@ -3985,10 +3990,14 @@ var EntrySearchProvider = ({ currentlySelectedItems, children }) => {
|
|
|
3985
3990
|
);
|
|
3986
3991
|
const onSelectItem = useCallback(
|
|
3987
3992
|
(selectedResult) => {
|
|
3988
|
-
if (
|
|
3989
|
-
setSelectedItems(
|
|
3993
|
+
if (Array.isArray(selectedResult)) {
|
|
3994
|
+
setSelectedItems(selectedResult);
|
|
3990
3995
|
} else {
|
|
3991
|
-
|
|
3996
|
+
if (selectedItems.some((item) => item.id === selectedResult.id)) {
|
|
3997
|
+
setSelectedItems((prev) => prev.filter((item) => item.id !== selectedResult.id));
|
|
3998
|
+
} else {
|
|
3999
|
+
setSelectedItems((prev) => [...prev, selectedResult]);
|
|
4000
|
+
}
|
|
3992
4001
|
}
|
|
3993
4002
|
},
|
|
3994
4003
|
[setSelectedItems, selectedItems]
|
|
@@ -4183,7 +4192,7 @@ import { jsx as jsx49, jsxs as jsxs29 } from "@emotion/react/jsx-runtime";
|
|
|
4183
4192
|
var EntrySearchListItem = ({
|
|
4184
4193
|
id,
|
|
4185
4194
|
title,
|
|
4186
|
-
|
|
4195
|
+
contentType,
|
|
4187
4196
|
image,
|
|
4188
4197
|
popoverInfo,
|
|
4189
4198
|
onSelect,
|
|
@@ -4191,7 +4200,7 @@ var EntrySearchListItem = ({
|
|
|
4191
4200
|
...props
|
|
4192
4201
|
}) => {
|
|
4193
4202
|
const { onSelectItem, selectedListItems } = useEntrySearchContext();
|
|
4194
|
-
const
|
|
4203
|
+
const formatedContentType = Array.isArray(contentType) ? contentType.join(", ") : contentType;
|
|
4195
4204
|
const handleSelectItem = () => {
|
|
4196
4205
|
var _a;
|
|
4197
4206
|
const extraData = (_a = onSelect == null ? void 0 : onSelect()) != null ? _a : {};
|
|
@@ -4202,7 +4211,7 @@ var EntrySearchListItem = ({
|
|
|
4202
4211
|
/* @__PURE__ */ jsxs29("div", { role: "button", onClick: handleSelectItem, css: EntryListItemControlledContent, children: [
|
|
4203
4212
|
!image ? null : /* @__PURE__ */ jsx49("img", { ...image, loading: (image == null ? void 0 : image.width) && image.height ? "lazy" : "eager" }),
|
|
4204
4213
|
/* @__PURE__ */ jsxs29("div", { role: "heading", css: EntryListItemHeadingGroup, children: [
|
|
4205
|
-
!
|
|
4214
|
+
!contentType ? null : /* @__PURE__ */ jsx49("span", { css: EntryListItemSubtitle, children: formatedContentType }),
|
|
4206
4215
|
/* @__PURE__ */ jsx49("span", { css: EntryListItemTitle, children: title })
|
|
4207
4216
|
] })
|
|
4208
4217
|
] }),
|
|
@@ -4289,32 +4298,46 @@ var EntrySearchAuthorStateGroup = css30`
|
|
|
4289
4298
|
display: flex;
|
|
4290
4299
|
gap: var(--spacing-sm);
|
|
4291
4300
|
`;
|
|
4301
|
+
var EntrySearchContentContainer = css30`
|
|
4302
|
+
display: flex;
|
|
4303
|
+
gap: var(--spacing-xs);
|
|
4304
|
+
`;
|
|
4305
|
+
var EntrySearchImage = css30`
|
|
4306
|
+
max-width: 56px;
|
|
4307
|
+
object-fit: contain;
|
|
4308
|
+
`;
|
|
4292
4309
|
|
|
4293
4310
|
// src/components/EntrySearch/EntrySearchResultItem.tsx
|
|
4294
4311
|
import { jsx as jsx51, jsxs as jsxs30 } from "@emotion/react/jsx-runtime";
|
|
4295
4312
|
var EntrySearchResultItem = ({
|
|
4296
4313
|
id,
|
|
4297
4314
|
title,
|
|
4298
|
-
|
|
4299
|
-
|
|
4315
|
+
name,
|
|
4316
|
+
contentType,
|
|
4317
|
+
popoverData,
|
|
4300
4318
|
publishStatus,
|
|
4319
|
+
editLinkIcon,
|
|
4320
|
+
editLink,
|
|
4321
|
+
imageUrl,
|
|
4301
4322
|
onRemove,
|
|
4302
4323
|
createdAt,
|
|
4303
4324
|
hideRemoveButton = false,
|
|
4304
4325
|
children
|
|
4305
4326
|
}) => {
|
|
4306
4327
|
const { onSelectItem } = useEntrySearchContext();
|
|
4328
|
+
const formatedContentType = Array.isArray(contentType) ? contentType.join(", ") : contentType;
|
|
4307
4329
|
const onRemoveItem = () => {
|
|
4308
4330
|
onSelectItem({ id });
|
|
4309
4331
|
onRemove == null ? void 0 : onRemove();
|
|
4310
4332
|
};
|
|
4311
4333
|
return /* @__PURE__ */ jsxs30("div", { css: EntrySearchResultItemContainer, children: [
|
|
4312
|
-
/* @__PURE__ */ jsxs30("div", { children: [
|
|
4334
|
+
/* @__PURE__ */ jsx51("div", { children: /* @__PURE__ */ jsxs30("div", { css: EntrySearchContentContainer, children: [
|
|
4335
|
+
!imageUrl ? null : /* @__PURE__ */ jsx51("img", { src: imageUrl, alt: `Thumbnail for ${title}`, css: EntrySearchImage }),
|
|
4313
4336
|
/* @__PURE__ */ jsxs30("div", { children: [
|
|
4314
|
-
/* @__PURE__ */ jsx51("span", { css: EntrySearchResultItemSubtitle, children:
|
|
4337
|
+
/* @__PURE__ */ jsx51("span", { css: EntrySearchResultItemSubtitle, children: formatedContentType }),
|
|
4315
4338
|
/* @__PURE__ */ jsxs30("span", { role: "heading", css: EntrySearchResultItemTitle, children: [
|
|
4316
|
-
title,
|
|
4317
|
-
!
|
|
4339
|
+
title != null ? title : name,
|
|
4340
|
+
!popoverData ? null : /* @__PURE__ */ jsx51(Popover2, { baseId: title, ariaLabel: title, buttonText: `See ${title} details`, children: popoverData })
|
|
4318
4341
|
] }),
|
|
4319
4342
|
!createdAt && !publishStatus ? null : /* @__PURE__ */ jsxs30("div", { css: EntrySearchAuthorStateGroup, children: [
|
|
4320
4343
|
!publishStatus ? null : /* @__PURE__ */ jsx51(PublishStatus, { status: publishStatus }),
|
|
@@ -4322,11 +4345,14 @@ var EntrySearchResultItem = ({
|
|
|
4322
4345
|
/* @__PURE__ */ jsx51("strong", { children: "Last updated: " }),
|
|
4323
4346
|
timeagoFormat(createdAt)
|
|
4324
4347
|
] })
|
|
4325
|
-
] })
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
] }),
|
|
4329
|
-
hideRemoveButton ? null : /* @__PURE__ */
|
|
4348
|
+
] }),
|
|
4349
|
+
/* @__PURE__ */ jsx51("div", { children })
|
|
4350
|
+
] })
|
|
4351
|
+
] }) }),
|
|
4352
|
+
!editLink && hideRemoveButton ? null : /* @__PURE__ */ jsxs30("div", { css: EntrySearchAuthorStateGroup, children: [
|
|
4353
|
+
!editLink ? null : /* @__PURE__ */ jsx51(LinkButton, { text: "Edit", href: editLink, icon: editLinkIcon }),
|
|
4354
|
+
hideRemoveButton ? null : /* @__PURE__ */ jsx51(Button5, { buttonType: "ghostDestructive", onClick: onRemoveItem, children: "Remove" })
|
|
4355
|
+
] })
|
|
4330
4356
|
] });
|
|
4331
4357
|
};
|
|
4332
4358
|
|
|
@@ -4367,14 +4393,22 @@ var ButtonIcon = css31`
|
|
|
4367
4393
|
|
|
4368
4394
|
// src/components/EntrySearch/EntrySearchResultItemButton.tsx
|
|
4369
4395
|
import { jsx as jsx52, jsxs as jsxs31 } from "@emotion/react/jsx-runtime";
|
|
4370
|
-
var EntrySearchResultItemButton = ({
|
|
4396
|
+
var EntrySearchResultItemButton = ({
|
|
4397
|
+
text,
|
|
4398
|
+
icon,
|
|
4399
|
+
...props
|
|
4400
|
+
}) => {
|
|
4371
4401
|
return /* @__PURE__ */ jsxs31("button", { type: "button", css: ButtonStyles, ...props, children: [
|
|
4372
4402
|
!icon ? null : /* @__PURE__ */ jsx52(Image, { src: icon, css: ButtonIcon }),
|
|
4373
4403
|
text
|
|
4374
4404
|
] });
|
|
4375
4405
|
};
|
|
4376
|
-
var LinkButton = ({
|
|
4377
|
-
|
|
4406
|
+
var LinkButton = ({
|
|
4407
|
+
text,
|
|
4408
|
+
icon,
|
|
4409
|
+
...props
|
|
4410
|
+
}) => {
|
|
4411
|
+
return /* @__PURE__ */ jsxs31("a", { ...props, css: ButtonStyles, target: "_blank", rel: "noopener noreferrer", children: [
|
|
4378
4412
|
!icon ? null : /* @__PURE__ */ jsx52(Image, { src: icon, css: ButtonIcon }),
|
|
4379
4413
|
text
|
|
4380
4414
|
] });
|
|
@@ -4382,6 +4416,7 @@ var LinkButton = ({ text, icon, ...props }) => {
|
|
|
4382
4416
|
|
|
4383
4417
|
// src/components/EntrySearch/EntrySearchResultList.tsx
|
|
4384
4418
|
import { Button as Button6, Counter, VerticalRhythm as VerticalRhythm2 } from "@uniformdev/design-system";
|
|
4419
|
+
import { DragDropContext as DragDropContext3, Draggable as Draggable3, Droppable as Droppable3 } from "react-beautiful-dnd";
|
|
4385
4420
|
|
|
4386
4421
|
// src/components/EntrySearch/styles/EntrySearchResultList.styles.ts
|
|
4387
4422
|
import { css as css32 } from "@emotion/react";
|
|
@@ -4409,33 +4444,70 @@ var EntrySearchResultList = ({
|
|
|
4409
4444
|
onRemoveAllSelected,
|
|
4410
4445
|
hideRemoveButton = false,
|
|
4411
4446
|
additionalButtons,
|
|
4412
|
-
|
|
4447
|
+
renderResultComponent = (value) => /* @__PURE__ */ jsx53(EntrySearchResultItem, { ...value }),
|
|
4448
|
+
disableDnD = false
|
|
4413
4449
|
}) => {
|
|
4414
|
-
const { selectedListItems, onRemoveAllSelectedItems } = useEntrySearchContext();
|
|
4450
|
+
const { selectedListItems, onRemoveAllSelectedItems, onSelectItem } = useEntrySearchContext();
|
|
4415
4451
|
const handleRemoveAllSelectedItems = () => {
|
|
4416
4452
|
onRemoveAllSelectedItems();
|
|
4417
4453
|
onRemoveAllSelected == null ? void 0 : onRemoveAllSelected();
|
|
4418
4454
|
};
|
|
4455
|
+
const onDragEnd = (res) => {
|
|
4456
|
+
var _a, _b;
|
|
4457
|
+
if (res.destination && res.source.droppableId === ((_a = res.destination) == null ? void 0 : _a.droppableId)) {
|
|
4458
|
+
const result = [...selectedListItems || []];
|
|
4459
|
+
const [removed] = (_b = result == null ? void 0 : result.splice(res.source.index, 1)) != null ? _b : [];
|
|
4460
|
+
result == null ? void 0 : result.splice(res.destination.index, 0, removed);
|
|
4461
|
+
onSelectItem(result);
|
|
4462
|
+
return result;
|
|
4463
|
+
}
|
|
4464
|
+
};
|
|
4419
4465
|
return /* @__PURE__ */ jsxs32(Fragment7, { children: [
|
|
4420
4466
|
/* @__PURE__ */ jsxs32("div", { role: "group", css: EntrySearchResultListContainer, children: [
|
|
4421
4467
|
/* @__PURE__ */ jsxs32("div", { role: "note", css: EntrySearchResultListCounterContainer, children: [
|
|
4422
4468
|
/* @__PURE__ */ jsx53("span", { css: EntrySearchResultListTitle, children: resultLabelText }),
|
|
4423
4469
|
" ",
|
|
4424
|
-
/* @__PURE__ */ jsx53(Counter, { count: selectedListItems.length })
|
|
4470
|
+
!selectedListItems.length ? null : /* @__PURE__ */ jsx53(Counter, { count: selectedListItems.length })
|
|
4425
4471
|
] }),
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4472
|
+
/* @__PURE__ */ jsxs32("div", { css: EntrySearchResultListCounterContainer, children: [
|
|
4473
|
+
additionalButtons,
|
|
4474
|
+
hideRemoveButton ? null : /* @__PURE__ */ jsx53(
|
|
4475
|
+
Button6,
|
|
4476
|
+
{
|
|
4477
|
+
buttonType: "ghostDestructive",
|
|
4478
|
+
size: "xs",
|
|
4479
|
+
disabled: selectedListItems.length === 0,
|
|
4480
|
+
onClick: handleRemoveAllSelectedItems,
|
|
4481
|
+
children: removeButtonText
|
|
4482
|
+
}
|
|
4483
|
+
)
|
|
4484
|
+
] })
|
|
4437
4485
|
] }),
|
|
4438
|
-
/* @__PURE__ */ jsx53(
|
|
4486
|
+
!selectedListItems.length ? null : /* @__PURE__ */ jsx53(DragDropContext3, { onDragEnd: (res) => onDragEnd(res), children: /* @__PURE__ */ jsx53(Droppable3, { droppableId: "canvas-multi-select", children: (provided) => /* @__PURE__ */ jsxs32("div", { ...provided.droppableProps, ref: provided.innerRef, children: [
|
|
4487
|
+
/* @__PURE__ */ jsx53(VerticalRhythm2, { gap: "sm", children: selectedListItems.map((item, i) => {
|
|
4488
|
+
const renderListItem = renderResultComponent(item);
|
|
4489
|
+
return /* @__PURE__ */ jsx53(
|
|
4490
|
+
Draggable3,
|
|
4491
|
+
{
|
|
4492
|
+
draggableId: item.title,
|
|
4493
|
+
index: i,
|
|
4494
|
+
isDragDisabled: disableDnD,
|
|
4495
|
+
children: (provided2, snapshot) => /* @__PURE__ */ jsx53(
|
|
4496
|
+
"div",
|
|
4497
|
+
{
|
|
4498
|
+
ref: provided2.innerRef,
|
|
4499
|
+
"data-dragging": snapshot.isDragging,
|
|
4500
|
+
...provided2.draggableProps,
|
|
4501
|
+
...provided2.dragHandleProps,
|
|
4502
|
+
children: renderListItem
|
|
4503
|
+
}
|
|
4504
|
+
)
|
|
4505
|
+
},
|
|
4506
|
+
item.title
|
|
4507
|
+
);
|
|
4508
|
+
}) }),
|
|
4509
|
+
provided.placeholder
|
|
4510
|
+
] }) }) })
|
|
4439
4511
|
] });
|
|
4440
4512
|
};
|
|
4441
4513
|
|
|
@@ -4457,11 +4529,11 @@ var QueryFilter = ({
|
|
|
4457
4529
|
sortOrderOptions = [
|
|
4458
4530
|
{
|
|
4459
4531
|
name: "Ascending",
|
|
4460
|
-
id: "
|
|
4532
|
+
id: "asc"
|
|
4461
4533
|
},
|
|
4462
4534
|
{
|
|
4463
4535
|
name: "Descending",
|
|
4464
|
-
id: "
|
|
4536
|
+
id: "desc"
|
|
4465
4537
|
}
|
|
4466
4538
|
],
|
|
4467
4539
|
children
|
|
@@ -4469,7 +4541,7 @@ var QueryFilter = ({
|
|
|
4469
4541
|
var _a, _b;
|
|
4470
4542
|
const { query, onSetQuery } = useEntrySearchContext();
|
|
4471
4543
|
const [queryState, setQueryState] = useState11({
|
|
4472
|
-
contentType:
|
|
4544
|
+
contentType: "",
|
|
4473
4545
|
count: countValue != null ? countValue : 5,
|
|
4474
4546
|
sortBy: (_a = sortOptions[0].id) != null ? _a : "",
|
|
4475
4547
|
sortOrder: (_b = sortOrderOptions[0].id) != null ? _b : ""
|
|
@@ -4490,7 +4562,7 @@ var QueryFilter = ({
|
|
|
4490
4562
|
{
|
|
4491
4563
|
label: contentTypeLabel,
|
|
4492
4564
|
options: [
|
|
4493
|
-
...!requireContentType ? [{ value: "
|
|
4565
|
+
...!requireContentType ? [{ value: "", label: typeSelectorAllTypesOptionText }] : [],
|
|
4494
4566
|
...contentTypeOptions ? contentTypeOptions.map((option) => {
|
|
4495
4567
|
return { value: option.id, label: option.name };
|
|
4496
4568
|
}) : []
|
|
@@ -4516,6 +4588,10 @@ var QueryFilter = ({
|
|
|
4516
4588
|
{
|
|
4517
4589
|
label: sortLabel,
|
|
4518
4590
|
options: [
|
|
4591
|
+
{
|
|
4592
|
+
label: "Select a sort",
|
|
4593
|
+
value: ""
|
|
4594
|
+
},
|
|
4519
4595
|
...sortOptions ? sortOptions.map((option) => {
|
|
4520
4596
|
return { value: option.id, label: option.name };
|
|
4521
4597
|
}) : []
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/mesh-sdk-react",
|
|
3
|
-
"version": "18.27.1-alpha.
|
|
3
|
+
"version": "18.27.1-alpha.25+16ccb5a67",
|
|
4
4
|
"description": "Uniform Mesh Framework SDK for React",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"document": "api-extractor run --local"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@uniformdev/design-system": "18.27.1-alpha.
|
|
47
|
-
"@uniformdev/mesh-sdk": "18.27.1-alpha.
|
|
46
|
+
"@uniformdev/design-system": "18.27.1-alpha.25+16ccb5a67",
|
|
47
|
+
"@uniformdev/mesh-sdk": "18.27.1-alpha.25+16ccb5a67",
|
|
48
48
|
"formik": "^2.2.9",
|
|
49
49
|
"react-beautiful-dnd": "13.1.1",
|
|
50
50
|
"react-icons": "4.8.0",
|
|
@@ -73,5 +73,5 @@
|
|
|
73
73
|
"publishConfig": {
|
|
74
74
|
"access": "public"
|
|
75
75
|
},
|
|
76
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "16ccb5a67849a262c250651e2574d64a7edd12a2"
|
|
77
77
|
}
|