@elementor/editor-site-navigation 4.5.0-1229 → 4.5.0-1231

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.mts CHANGED
@@ -1,4 +1,6 @@
1
1
  import * as React from 'react';
2
+ import { ReactNode, PropsWithChildren, Ref } from 'react';
3
+ import { IconButtonProps } from '@elementor/ui';
2
4
  import * as _elementor_locations from '@elementor/locations';
3
5
 
4
6
  type IconsMap = {
@@ -8,6 +10,26 @@ declare function extendIconsMap(additionalIcons: IconsMap): void;
8
10
 
9
11
  declare function init(): void;
10
12
 
13
+ type SiteContentSection = {
14
+ id: string;
15
+ priority?: number;
16
+ render: () => ReactNode;
17
+ };
18
+ declare function registerSiteContentSection(section: SiteContentSection): void;
19
+ declare function getSiteContentSections(): SiteContentSection[];
20
+ declare function resetSiteContentSections(): void;
21
+
22
+ type SiteContentHeaderCreateItem = {
23
+ id: string;
24
+ priority?: number;
25
+ renderMenuItem: (onSelect: () => void) => ReactNode;
26
+ };
27
+ declare function registerSiteContentHeaderCreateItem(item: SiteContentHeaderCreateItem): void;
28
+ declare function getSiteContentHeaderCreateItems(): SiteContentHeaderCreateItem[];
29
+ declare function resetSiteContentHeaderCreateItems(): void;
30
+
31
+ type SiteContentSortOption = 'newest' | 'oldest';
32
+
11
33
  type Post = {
12
34
  isHome?: boolean;
13
35
  id: number;
@@ -23,6 +45,150 @@ type Post = {
23
45
  };
24
46
  };
25
47
 
48
+ type Slug = keyof typeof postTypesMap;
49
+ declare const postTypesMap: {
50
+ page: {
51
+ labels: {
52
+ singular_name: string;
53
+ plural_name: string;
54
+ };
55
+ rest_base: string;
56
+ createCapability: string;
57
+ };
58
+ post: {
59
+ labels: {
60
+ singular_name: string;
61
+ plural_name: string;
62
+ };
63
+ rest_base: string;
64
+ createCapability: string;
65
+ };
66
+ };
67
+ declare const POST_PER_PAGE = 10;
68
+
69
+ type SiteContentSelectableStatus = 'draft' | 'future' | 'pending' | 'private' | 'publish' | 'trash';
70
+ type SiteContentStatusFilters = Record<SiteContentSelectableStatus, boolean>;
71
+
72
+ type ContentPanelSectionId = Slug | (string & {});
73
+ type SectionHandlers = {
74
+ setExpanded: (expanded: boolean) => void;
75
+ startCreate: () => void;
76
+ };
77
+ type ContentPanelCoordinatorValue = {
78
+ clearActiveToolbarFilters: () => void;
79
+ clearSiteContentSort: () => void;
80
+ clearStatusFilters: () => void;
81
+ registerSection: (type: ContentPanelSectionId, handlers: SectionHandlers) => void;
82
+ requestCreate: (type: ContentPanelSectionId) => void;
83
+ searchQuery: string;
84
+ setSearchQuery: (query: string) => void;
85
+ setSiteContentSort: (sort: SiteContentSortOption) => void;
86
+ siteContentSort: SiteContentSortOption;
87
+ statusFilters: SiteContentStatusFilters;
88
+ toggleStatusFilter: (filter: SiteContentSelectableStatus) => void;
89
+ unregisterSection: (type: ContentPanelSectionId) => void;
90
+ };
91
+ declare function ContentPanelCoordinatorProvider({ children }: {
92
+ children: ReactNode;
93
+ }): React.JSX.Element;
94
+ declare function useContentPanelCoordinator(): ContentPanelCoordinatorValue;
95
+
96
+ type Props$1 = {
97
+ count: number;
98
+ countChipLabel?: string;
99
+ headerRef?: Ref<HTMLDivElement>;
100
+ isOpen: boolean;
101
+ onOpenChange: (isOpen: boolean) => void;
102
+ title: string;
103
+ trailingActions?: ReactNode;
104
+ };
105
+ declare function CollapsibleList({ count, countChipLabel, headerRef, isOpen, onOpenChange, title, trailingActions, children, }: PropsWithChildren<Props$1>): React.JSX.Element;
106
+
107
+ declare function ErrorState(): React.JSX.Element;
108
+
109
+ type PostListPaginationActionsProps = {
110
+ canLoadMore: boolean;
111
+ canShowLess: boolean;
112
+ isLoadingMore: boolean;
113
+ loadMoreButtonRef?: React.RefObject<HTMLButtonElement | null>;
114
+ onLoadMore: () => void;
115
+ onShowLess: () => void;
116
+ };
117
+ declare function PostListPaginationActions({ canLoadMore, canShowLess, isLoadingMore, loadMoreButtonRef, onLoadMore, onShowLess, }: PostListPaginationActionsProps): React.JSX.Element | null;
118
+
119
+ type UsePostListPaginationArgs = {
120
+ fetchNextPage: () => void;
121
+ hasNextPage: boolean;
122
+ isFetchingNextPage: boolean;
123
+ loadedCount: number;
124
+ resetKey: string;
125
+ totalCount: number;
126
+ };
127
+ declare function usePostListPagination({ fetchNextPage, hasNextPage, isFetchingNextPage, loadedCount, resetKey, totalCount, }: UsePostListPaginationArgs): {
128
+ canLoadMore: boolean;
129
+ canShowLess: boolean;
130
+ handleLoadMore: () => void;
131
+ handleShowLess: () => void;
132
+ visibleCount: number;
133
+ };
134
+
135
+ declare const contentPanelListRowPaddingSx: {
136
+ paddingInline: number;
137
+ };
138
+ declare const contentPanelListItemButtonSx: {
139
+ justifyContent: string;
140
+ paddingInline: number;
141
+ textAlign: string;
142
+ width: string;
143
+ '&.Mui-selected': {
144
+ backgroundColor: string;
145
+ };
146
+ '&.Mui-selected:hover': {
147
+ backgroundColor: string;
148
+ };
149
+ '&:hover:not(.Mui-disabled)': {
150
+ backgroundColor: string;
151
+ };
152
+ };
153
+
154
+ type ContentPanelAddIconButtonProps = Omit<IconButtonProps, 'children' | 'size' | 'variant'>;
155
+ declare function ContentPanelAddIconButton(props: ContentPanelAddIconButtonProps): React.JSX.Element;
156
+
157
+ declare function PageTitleAndStatus({ title, status }: {
158
+ title: string;
159
+ status: string;
160
+ }): React.JSX.Element;
161
+
162
+ type Props = {
163
+ postTitle: string;
164
+ isLoading: boolean;
165
+ callback: (inputValue: string) => void;
166
+ onDismiss?: () => void;
167
+ };
168
+ declare function EditModeTemplate({ postTitle, isLoading, callback, onDismiss }: Props): React.JSX.Element;
169
+
170
+ type PopupSectionAddButtonRef = {
171
+ togglePromotion: () => void;
172
+ };
173
+ type PopupSectionAddButtonProps = {
174
+ disabled?: boolean;
175
+ onBeforeCreate?: () => void;
176
+ onCreate: () => void;
177
+ };
178
+ declare const PopupSectionAddButton: React.ForwardRefExoticComponent<PopupSectionAddButtonProps & React.RefAttributes<PopupSectionAddButtonRef>>;
179
+
180
+ declare const POPUPS_SITE_CONTENT_SECTION_ID = "popups";
181
+
182
+ type PopupsSiteContentEnv = {
183
+ can_use: boolean;
184
+ upgrade_url: string;
185
+ };
186
+ declare const env: {
187
+ can_access_site_content_panel: boolean;
188
+ is_pages_panel_active: boolean;
189
+ popups?: PopupsSiteContentEnv;
190
+ };
191
+
26
192
  type SiteContentListItemActionsProps = {
27
193
  post: Post;
28
194
  title: string;
@@ -30,4 +196,4 @@ type SiteContentListItemActionsProps = {
30
196
  declare const SiteContentListItemActionsSlot: React.ComponentType<SiteContentListItemActionsProps>;
31
197
  declare const injectIntoSiteContentListItemActions: (args: _elementor_locations.InjectArgs<SiteContentListItemActionsProps>) => void;
32
198
 
33
- export { type SiteContentListItemActionsProps, SiteContentListItemActionsSlot, extendIconsMap, init, injectIntoSiteContentListItemActions };
199
+ export { ContentPanelAddIconButton, ContentPanelCoordinatorProvider, type ContentPanelSectionId, POPUPS_SITE_CONTENT_SECTION_ID, POST_PER_PAGE, PopupSectionAddButton, type PopupSectionAddButtonRef, type PopupsSiteContentEnv, type Post, CollapsibleList as SiteContentCollapsibleList, EditModeTemplate as SiteContentEditModeTemplate, type SiteContentHeaderCreateItem, ErrorState as SiteContentListErrorState, type SiteContentListItemActionsProps, SiteContentListItemActionsSlot, PageTitleAndStatus as SiteContentPageTitleAndStatus, PostListPaginationActions as SiteContentPaginationActions, type SiteContentSection, contentPanelListItemButtonSx, contentPanelListRowPaddingSx, env, extendIconsMap, getSiteContentHeaderCreateItems, getSiteContentSections, init, injectIntoSiteContentListItemActions, registerSiteContentHeaderCreateItem, registerSiteContentSection, resetSiteContentHeaderCreateItems, resetSiteContentSections, useContentPanelCoordinator, usePostListPagination };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  import * as React from 'react';
2
+ import { ReactNode, PropsWithChildren, Ref } from 'react';
3
+ import { IconButtonProps } from '@elementor/ui';
2
4
  import * as _elementor_locations from '@elementor/locations';
3
5
 
4
6
  type IconsMap = {
@@ -8,6 +10,26 @@ declare function extendIconsMap(additionalIcons: IconsMap): void;
8
10
 
9
11
  declare function init(): void;
10
12
 
13
+ type SiteContentSection = {
14
+ id: string;
15
+ priority?: number;
16
+ render: () => ReactNode;
17
+ };
18
+ declare function registerSiteContentSection(section: SiteContentSection): void;
19
+ declare function getSiteContentSections(): SiteContentSection[];
20
+ declare function resetSiteContentSections(): void;
21
+
22
+ type SiteContentHeaderCreateItem = {
23
+ id: string;
24
+ priority?: number;
25
+ renderMenuItem: (onSelect: () => void) => ReactNode;
26
+ };
27
+ declare function registerSiteContentHeaderCreateItem(item: SiteContentHeaderCreateItem): void;
28
+ declare function getSiteContentHeaderCreateItems(): SiteContentHeaderCreateItem[];
29
+ declare function resetSiteContentHeaderCreateItems(): void;
30
+
31
+ type SiteContentSortOption = 'newest' | 'oldest';
32
+
11
33
  type Post = {
12
34
  isHome?: boolean;
13
35
  id: number;
@@ -23,6 +45,150 @@ type Post = {
23
45
  };
24
46
  };
25
47
 
48
+ type Slug = keyof typeof postTypesMap;
49
+ declare const postTypesMap: {
50
+ page: {
51
+ labels: {
52
+ singular_name: string;
53
+ plural_name: string;
54
+ };
55
+ rest_base: string;
56
+ createCapability: string;
57
+ };
58
+ post: {
59
+ labels: {
60
+ singular_name: string;
61
+ plural_name: string;
62
+ };
63
+ rest_base: string;
64
+ createCapability: string;
65
+ };
66
+ };
67
+ declare const POST_PER_PAGE = 10;
68
+
69
+ type SiteContentSelectableStatus = 'draft' | 'future' | 'pending' | 'private' | 'publish' | 'trash';
70
+ type SiteContentStatusFilters = Record<SiteContentSelectableStatus, boolean>;
71
+
72
+ type ContentPanelSectionId = Slug | (string & {});
73
+ type SectionHandlers = {
74
+ setExpanded: (expanded: boolean) => void;
75
+ startCreate: () => void;
76
+ };
77
+ type ContentPanelCoordinatorValue = {
78
+ clearActiveToolbarFilters: () => void;
79
+ clearSiteContentSort: () => void;
80
+ clearStatusFilters: () => void;
81
+ registerSection: (type: ContentPanelSectionId, handlers: SectionHandlers) => void;
82
+ requestCreate: (type: ContentPanelSectionId) => void;
83
+ searchQuery: string;
84
+ setSearchQuery: (query: string) => void;
85
+ setSiteContentSort: (sort: SiteContentSortOption) => void;
86
+ siteContentSort: SiteContentSortOption;
87
+ statusFilters: SiteContentStatusFilters;
88
+ toggleStatusFilter: (filter: SiteContentSelectableStatus) => void;
89
+ unregisterSection: (type: ContentPanelSectionId) => void;
90
+ };
91
+ declare function ContentPanelCoordinatorProvider({ children }: {
92
+ children: ReactNode;
93
+ }): React.JSX.Element;
94
+ declare function useContentPanelCoordinator(): ContentPanelCoordinatorValue;
95
+
96
+ type Props$1 = {
97
+ count: number;
98
+ countChipLabel?: string;
99
+ headerRef?: Ref<HTMLDivElement>;
100
+ isOpen: boolean;
101
+ onOpenChange: (isOpen: boolean) => void;
102
+ title: string;
103
+ trailingActions?: ReactNode;
104
+ };
105
+ declare function CollapsibleList({ count, countChipLabel, headerRef, isOpen, onOpenChange, title, trailingActions, children, }: PropsWithChildren<Props$1>): React.JSX.Element;
106
+
107
+ declare function ErrorState(): React.JSX.Element;
108
+
109
+ type PostListPaginationActionsProps = {
110
+ canLoadMore: boolean;
111
+ canShowLess: boolean;
112
+ isLoadingMore: boolean;
113
+ loadMoreButtonRef?: React.RefObject<HTMLButtonElement | null>;
114
+ onLoadMore: () => void;
115
+ onShowLess: () => void;
116
+ };
117
+ declare function PostListPaginationActions({ canLoadMore, canShowLess, isLoadingMore, loadMoreButtonRef, onLoadMore, onShowLess, }: PostListPaginationActionsProps): React.JSX.Element | null;
118
+
119
+ type UsePostListPaginationArgs = {
120
+ fetchNextPage: () => void;
121
+ hasNextPage: boolean;
122
+ isFetchingNextPage: boolean;
123
+ loadedCount: number;
124
+ resetKey: string;
125
+ totalCount: number;
126
+ };
127
+ declare function usePostListPagination({ fetchNextPage, hasNextPage, isFetchingNextPage, loadedCount, resetKey, totalCount, }: UsePostListPaginationArgs): {
128
+ canLoadMore: boolean;
129
+ canShowLess: boolean;
130
+ handleLoadMore: () => void;
131
+ handleShowLess: () => void;
132
+ visibleCount: number;
133
+ };
134
+
135
+ declare const contentPanelListRowPaddingSx: {
136
+ paddingInline: number;
137
+ };
138
+ declare const contentPanelListItemButtonSx: {
139
+ justifyContent: string;
140
+ paddingInline: number;
141
+ textAlign: string;
142
+ width: string;
143
+ '&.Mui-selected': {
144
+ backgroundColor: string;
145
+ };
146
+ '&.Mui-selected:hover': {
147
+ backgroundColor: string;
148
+ };
149
+ '&:hover:not(.Mui-disabled)': {
150
+ backgroundColor: string;
151
+ };
152
+ };
153
+
154
+ type ContentPanelAddIconButtonProps = Omit<IconButtonProps, 'children' | 'size' | 'variant'>;
155
+ declare function ContentPanelAddIconButton(props: ContentPanelAddIconButtonProps): React.JSX.Element;
156
+
157
+ declare function PageTitleAndStatus({ title, status }: {
158
+ title: string;
159
+ status: string;
160
+ }): React.JSX.Element;
161
+
162
+ type Props = {
163
+ postTitle: string;
164
+ isLoading: boolean;
165
+ callback: (inputValue: string) => void;
166
+ onDismiss?: () => void;
167
+ };
168
+ declare function EditModeTemplate({ postTitle, isLoading, callback, onDismiss }: Props): React.JSX.Element;
169
+
170
+ type PopupSectionAddButtonRef = {
171
+ togglePromotion: () => void;
172
+ };
173
+ type PopupSectionAddButtonProps = {
174
+ disabled?: boolean;
175
+ onBeforeCreate?: () => void;
176
+ onCreate: () => void;
177
+ };
178
+ declare const PopupSectionAddButton: React.ForwardRefExoticComponent<PopupSectionAddButtonProps & React.RefAttributes<PopupSectionAddButtonRef>>;
179
+
180
+ declare const POPUPS_SITE_CONTENT_SECTION_ID = "popups";
181
+
182
+ type PopupsSiteContentEnv = {
183
+ can_use: boolean;
184
+ upgrade_url: string;
185
+ };
186
+ declare const env: {
187
+ can_access_site_content_panel: boolean;
188
+ is_pages_panel_active: boolean;
189
+ popups?: PopupsSiteContentEnv;
190
+ };
191
+
26
192
  type SiteContentListItemActionsProps = {
27
193
  post: Post;
28
194
  title: string;
@@ -30,4 +196,4 @@ type SiteContentListItemActionsProps = {
30
196
  declare const SiteContentListItemActionsSlot: React.ComponentType<SiteContentListItemActionsProps>;
31
197
  declare const injectIntoSiteContentListItemActions: (args: _elementor_locations.InjectArgs<SiteContentListItemActionsProps>) => void;
32
198
 
33
- export { type SiteContentListItemActionsProps, SiteContentListItemActionsSlot, extendIconsMap, init, injectIntoSiteContentListItemActions };
199
+ export { ContentPanelAddIconButton, ContentPanelCoordinatorProvider, type ContentPanelSectionId, POPUPS_SITE_CONTENT_SECTION_ID, POST_PER_PAGE, PopupSectionAddButton, type PopupSectionAddButtonRef, type PopupsSiteContentEnv, type Post, CollapsibleList as SiteContentCollapsibleList, EditModeTemplate as SiteContentEditModeTemplate, type SiteContentHeaderCreateItem, ErrorState as SiteContentListErrorState, type SiteContentListItemActionsProps, SiteContentListItemActionsSlot, PageTitleAndStatus as SiteContentPageTitleAndStatus, PostListPaginationActions as SiteContentPaginationActions, type SiteContentSection, contentPanelListItemButtonSx, contentPanelListRowPaddingSx, env, extendIconsMap, getSiteContentHeaderCreateItems, getSiteContentSections, init, injectIntoSiteContentListItemActions, registerSiteContentHeaderCreateItem, registerSiteContentSection, resetSiteContentHeaderCreateItems, resetSiteContentSections, useContentPanelCoordinator, usePostListPagination };