@sitecore-content-sdk/react 2.0.0-canary.1 → 2.0.0-canary.10
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/cjs/components/Date.js +13 -11
- package/dist/cjs/components/DefaultEmptyFieldEditingComponents.js +2 -1
- package/dist/cjs/components/DesignLibrary/DesignLibrary.js +5 -9
- package/dist/cjs/components/DesignLibrary/DesignLibraryClientEvents.js +14 -6
- package/dist/cjs/components/DesignLibrary/DesignLibraryServer.js +11 -5
- package/dist/cjs/components/EditingScripts.js +2 -2
- package/dist/cjs/components/ErrorBoundary.js +10 -6
- package/dist/cjs/components/File.js +3 -1
- package/dist/cjs/components/Form.js +12 -5
- package/dist/cjs/components/Image.js +12 -9
- package/dist/cjs/components/Link.js +19 -46
- package/dist/cjs/components/Placeholder/AppPlaceholder.js +56 -58
- package/dist/cjs/components/Placeholder/ClientComponentWrapper.js +5 -9
- package/dist/cjs/components/Placeholder/Placeholder.js +21 -93
- package/dist/cjs/components/Placeholder/index.js +1 -2
- package/dist/cjs/components/Placeholder/placeholder-utils.js +7 -35
- package/dist/cjs/components/RichText.js +18 -49
- package/dist/cjs/components/SitecoreProvider.js +81 -33
- package/dist/cjs/components/Text.js +12 -8
- package/dist/cjs/enhancers/withAppPlaceholder.js +6 -0
- package/dist/cjs/enhancers/withDatasourceCheck.js +4 -3
- package/dist/cjs/enhancers/withEditorChromes.js +50 -15
- package/dist/cjs/enhancers/withEmptyFieldEditingComponent.js +8 -38
- package/dist/cjs/enhancers/withFieldMetadata.js +9 -39
- package/dist/cjs/enhancers/withPlaceholder.js +16 -52
- package/dist/cjs/enhancers/withSitecore.js +5 -29
- package/dist/cjs/index.js +9 -7
- package/dist/cjs/search/utils.js +2 -2
- package/dist/esm/components/Date.js +13 -11
- package/dist/esm/components/DefaultEmptyFieldEditingComponents.js +2 -1
- package/dist/esm/components/DesignLibrary/DesignLibrary.js +5 -9
- package/dist/esm/components/DesignLibrary/DesignLibraryClientEvents.js +13 -5
- package/dist/esm/components/DesignLibrary/DesignLibraryServer.js +11 -5
- package/dist/esm/components/EditingScripts.js +2 -2
- package/dist/esm/components/ErrorBoundary.js +10 -6
- package/dist/esm/components/File.js +3 -1
- package/dist/esm/components/Form.js +11 -4
- package/dist/esm/components/Image.js +12 -9
- package/dist/esm/components/Link.js +16 -13
- package/dist/esm/components/Placeholder/AppPlaceholder.js +57 -59
- package/dist/esm/components/Placeholder/ClientComponentWrapper.js +4 -8
- package/dist/esm/components/Placeholder/Placeholder.js +20 -89
- package/dist/esm/components/Placeholder/index.js +1 -1
- package/dist/esm/components/Placeholder/placeholder-utils.js +5 -32
- package/dist/esm/components/RichText.js +15 -16
- package/dist/esm/components/SitecoreProvider.js +46 -32
- package/dist/esm/components/Text.js +12 -8
- package/dist/esm/enhancers/withAppPlaceholder.js +6 -0
- package/dist/esm/enhancers/withDatasourceCheck.js +3 -2
- package/dist/esm/enhancers/withEditorChromes.js +17 -12
- package/dist/esm/enhancers/withEmptyFieldEditingComponent.js +5 -5
- package/dist/esm/enhancers/withFieldMetadata.js +6 -6
- package/dist/esm/enhancers/withPlaceholder.js +15 -52
- package/dist/esm/enhancers/withSitecore.js +6 -29
- package/dist/esm/index.js +4 -3
- package/dist/esm/search/utils.js +1 -1
- package/package.json +5 -5
- package/types/components/Date.d.ts.map +1 -1
- package/types/components/DefaultEmptyFieldEditingComponents.d.ts.map +1 -1
- package/types/components/DesignLibrary/DesignLibrary.d.ts +0 -2
- package/types/components/DesignLibrary/DesignLibrary.d.ts.map +1 -1
- package/types/components/DesignLibrary/DesignLibraryClientEvents.d.ts.map +1 -1
- package/types/components/DesignLibrary/DesignLibraryServer.d.ts.map +1 -1
- package/types/components/DesignLibrary/models.d.ts +9 -3
- package/types/components/DesignLibrary/models.d.ts.map +1 -1
- package/types/components/EditingScripts.d.ts +2 -2
- package/types/components/EditingScripts.d.ts.map +1 -1
- package/types/components/ErrorBoundary.d.ts +2 -2
- package/types/components/ErrorBoundary.d.ts.map +1 -1
- package/types/components/File.d.ts.map +1 -1
- package/types/components/Form.d.ts.map +1 -1
- package/types/components/Image.d.ts.map +1 -1
- package/types/components/Link.d.ts.map +1 -1
- package/types/components/Placeholder/AppPlaceholder.d.ts +1 -1
- package/types/components/Placeholder/AppPlaceholder.d.ts.map +1 -1
- package/types/components/Placeholder/ClientComponentWrapper.d.ts +2 -2
- package/types/components/Placeholder/ClientComponentWrapper.d.ts.map +1 -1
- package/types/components/Placeholder/Placeholder.d.ts +4 -19
- package/types/components/Placeholder/Placeholder.d.ts.map +1 -1
- package/types/components/Placeholder/index.d.ts +1 -1
- package/types/components/Placeholder/index.d.ts.map +1 -1
- package/types/components/Placeholder/models.d.ts +35 -58
- package/types/components/Placeholder/models.d.ts.map +1 -1
- package/types/components/Placeholder/placeholder-utils.d.ts +5 -13
- package/types/components/Placeholder/placeholder-utils.d.ts.map +1 -1
- package/types/components/RichText.d.ts +2 -0
- package/types/components/RichText.d.ts.map +1 -1
- package/types/components/SitecoreProvider.d.ts +43 -13
- package/types/components/SitecoreProvider.d.ts.map +1 -1
- package/types/components/Text.d.ts.map +1 -1
- package/types/enhancers/withAppPlaceholder.d.ts +6 -0
- package/types/enhancers/withAppPlaceholder.d.ts.map +1 -1
- package/types/enhancers/withDatasourceCheck.d.ts.map +1 -1
- package/types/enhancers/withEditorChromes.d.ts +4 -1
- package/types/enhancers/withEditorChromes.d.ts.map +1 -1
- package/types/enhancers/withEmptyFieldEditingComponent.d.ts +5 -3
- package/types/enhancers/withEmptyFieldEditingComponent.d.ts.map +1 -1
- package/types/enhancers/withFieldMetadata.d.ts +4 -2
- package/types/enhancers/withFieldMetadata.d.ts.map +1 -1
- package/types/enhancers/withPlaceholder.d.ts +14 -32
- package/types/enhancers/withPlaceholder.d.ts.map +1 -1
- package/types/enhancers/withSitecore.d.ts +8 -50
- package/types/enhancers/withSitecore.d.ts.map +1 -1
- package/types/index.d.ts +4 -3
- package/types/index.d.ts.map +1 -1
- package/dist/cjs/enhancers/withComponentMap.js +0 -24
- package/dist/cjs/enhancers/withLoadImportMap.js +0 -62
- package/dist/esm/enhancers/withComponentMap.js +0 -18
- package/dist/esm/enhancers/withLoadImportMap.js +0 -25
- package/types/enhancers/withComponentMap.d.ts +0 -13
- package/types/enhancers/withComponentMap.d.ts.map +0 -1
- package/types/enhancers/withLoadImportMap.d.ts +0 -28
- package/types/enhancers/withLoadImportMap.d.ts.map +0 -1
|
@@ -6,21 +6,11 @@ export type { ComponentType };
|
|
|
6
6
|
type ErrorComponentProps = {
|
|
7
7
|
[prop: string]: unknown;
|
|
8
8
|
};
|
|
9
|
-
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export interface AppComponentProps {
|
|
15
|
-
fields: {
|
|
16
|
-
[name: string]: Field | Item | Item[];
|
|
17
|
-
};
|
|
18
|
-
params: {
|
|
19
|
-
[name: string]: string;
|
|
20
|
-
};
|
|
21
|
-
rendering: ComponentRendering;
|
|
22
|
-
}
|
|
23
|
-
export interface BasePlaceholderProps {
|
|
9
|
+
/**
|
|
10
|
+
* Base Placeholder props
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
export interface PlaceholderProps {
|
|
24
14
|
/** Name of the placeholder to render. */
|
|
25
15
|
name: string;
|
|
26
16
|
/** Rendering data to be used when rendering the placeholder. */
|
|
@@ -57,14 +47,17 @@ export interface BasePlaceholderProps {
|
|
|
57
47
|
* Page data.
|
|
58
48
|
* This data is passed by the SitecoreProvider.
|
|
59
49
|
*/
|
|
60
|
-
page
|
|
50
|
+
page?: Page;
|
|
61
51
|
/**
|
|
62
52
|
* The message that gets displayed while component is loading
|
|
63
53
|
*/
|
|
64
54
|
componentLoadingMessage?: string;
|
|
65
55
|
/**
|
|
66
|
-
*
|
|
67
|
-
*
|
|
56
|
+
* @deprecated The `disableSuspense` prop is deprecated and will be removed in version 3.0.0.
|
|
57
|
+
* The default value is set to `true` to avoid forcing Suspense usage across all components which could negatively impact performance metrics. Suspense can now be enabled explicitly when needed.
|
|
58
|
+
*
|
|
59
|
+
* If `false`, enables Suspense in ErrorBoundary for the components rendered by placeholder.
|
|
60
|
+
* @default true
|
|
68
61
|
*/
|
|
69
62
|
disableSuspense?: boolean;
|
|
70
63
|
/**
|
|
@@ -76,66 +69,50 @@ export interface BasePlaceholderProps {
|
|
|
76
69
|
* Mutually exclusive with `render`.
|
|
77
70
|
*/
|
|
78
71
|
renderEach?: (component: React.ReactNode, index: number) => React.ReactNode;
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* The interface for the Placeholder component props.
|
|
82
|
-
* @public
|
|
83
|
-
*/
|
|
84
|
-
export interface PlaceholderProps extends BasePlaceholderProps {
|
|
85
|
-
[key: string]: unknown;
|
|
86
72
|
/**
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
* When rendered as a server placeholder, this prop must be provided. This prop is not used in AppPlaceholder.
|
|
73
|
+
* Render props function that enables control over the rendering of the components in the placeholder.
|
|
74
|
+
* Useful for techniques like wrapping each child in a wrapper component.
|
|
90
75
|
*/
|
|
91
|
-
|
|
76
|
+
render?: (components: React.ReactNode[], data: ComponentRendering[], props: PlaceholderProps) => React.ReactNode;
|
|
92
77
|
/**
|
|
93
78
|
* Modify final props of component (before render) provided by rendering data.
|
|
94
79
|
* Can be used in case when you need to insert additional data into the component.
|
|
95
|
-
* @param {
|
|
96
|
-
* @returns {
|
|
80
|
+
* @param {ChildComponentProps} componentProps component props to be modified
|
|
81
|
+
* @returns {ChildComponentProps} modified or initial props
|
|
97
82
|
*/
|
|
98
|
-
modifyComponentProps?: (componentProps:
|
|
83
|
+
modifyComponentProps?: (componentProps: ChildComponentProps) => ChildComponentProps;
|
|
99
84
|
/**
|
|
100
|
-
*
|
|
101
|
-
*
|
|
85
|
+
* An alternative to `modifyComponentProps` that allows passing additional props to the component without modifying the CSDK Placeholder props from Sitecore.
|
|
86
|
+
* These props will be merged into the result of modifyComponentProps if you use both
|
|
87
|
+
* Make sure to not include non-serializable props here in RSC server context https://react.dev/reference/rsc/use-server#serializable-parameters-and-return-values
|
|
102
88
|
*/
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
* The interface for the AppPlaceholder component props.
|
|
107
|
-
* @public
|
|
108
|
-
*/
|
|
109
|
-
export interface AppPlaceholderProps extends BasePlaceholderProps {
|
|
89
|
+
passThroughComponentProps?: {
|
|
90
|
+
[key: string]: unknown;
|
|
91
|
+
};
|
|
110
92
|
/**
|
|
111
93
|
* Component Map will be used to map Sitecore component names to app implementation
|
|
112
94
|
* When rendered within a <SitecoreProvider> component, defaults to the context componentMap.
|
|
113
95
|
* When rendered as a server placeholder, this prop must be provided. This prop is not used in AppPlaceholder.
|
|
114
96
|
*/
|
|
115
|
-
componentMap
|
|
116
|
-
/**
|
|
117
|
-
* Modify final props of component (before render) provided by rendering data.
|
|
118
|
-
* Can be used in case when you need to insert additional data into the component.
|
|
119
|
-
* @param {AppComponentProps} componentProps component props to be modified
|
|
120
|
-
* @returns {AppComponentProps} modified or initial props
|
|
121
|
-
*/
|
|
122
|
-
modifyComponentProps?: (componentProps: AppComponentProps) => AppComponentProps;
|
|
123
|
-
/**
|
|
124
|
-
* Render props function that enables control over the rendering of the components in the placeholder.
|
|
125
|
-
* Useful for techniques like wrapping each child in a wrapper component.
|
|
126
|
-
*/
|
|
127
|
-
render?: (components: React.ReactNode[], data: ComponentRendering[], props: AppPlaceholderProps) => React.ReactNode;
|
|
97
|
+
componentMap?: ComponentMap;
|
|
128
98
|
}
|
|
129
|
-
|
|
99
|
+
/**
|
|
100
|
+
* The interface for the AppPlaceholder server-side component props.
|
|
101
|
+
* @public
|
|
102
|
+
*/
|
|
103
|
+
export type AppPlaceholderProps = Omit<PlaceholderProps, 'componentMap' | 'page'> & Required<Pick<PlaceholderProps, 'componentMap' | 'page'>>;
|
|
104
|
+
export type RenderedProps = ChildComponentProps & {
|
|
130
105
|
key: string;
|
|
106
|
+
};
|
|
107
|
+
export interface ChildComponentProps {
|
|
131
108
|
fields: {
|
|
132
|
-
[
|
|
109
|
+
[name: string]: Field | Item | Item[];
|
|
133
110
|
};
|
|
134
111
|
params: {
|
|
135
|
-
[
|
|
112
|
+
[name: string]: string;
|
|
136
113
|
};
|
|
137
114
|
rendering: ComponentRendering;
|
|
138
|
-
}
|
|
115
|
+
}
|
|
139
116
|
export interface ComponentForRendering {
|
|
140
117
|
component: React.ComponentType<any>;
|
|
141
118
|
isEmpty: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../../src/components/Placeholder/models.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,sCAAsC,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAClG,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,YAAY,EAAE,aAAa,EAAE,CAAC;AAE9B,KAAK,mBAAmB,GAAG;IACzB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;CACzB,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../../src/components/Placeholder/models.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,sCAAsC,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAClG,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,YAAY,EAAE,aAAa,EAAE,CAAC;AAE9B,KAAK,mBAAmB,GAAG;IACzB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC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,IAAI,EAAE,kBAAkB,EAAE,EAC1B,KAAK,EAAE,gBAAgB,KACpB,KAAK,CAAC,SAAS,CAAC;IAErB;;;;;OAKG;IACH,oBAAoB,CAAC,EAAE,CAAC,cAAc,EAAE,mBAAmB,KAAK,mBAAmB,CAAC;IAEpF;;;;OAIG;IACH,yBAAyB,CAAC,EAAE;QAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KACxB,CAAC;IAEF;;;;OAIG;IACH,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B;AAED;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,gBAAgB,EAAE,cAAc,GAAG,MAAM,CAAC,GAC/E,QAAQ,CAAC,IAAI,CAAC,gBAAgB,EAAE,cAAc,GAAG,MAAM,CAAC,CAAC,CAAC;AAE5D,MAAM,MAAM,aAAa,GAAG,mBAAmB,GAAG;IAChD,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE;QACN,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,GAAG,IAAI,GAAG,IAAI,EAAE,CAAC;KACvC,CAAC;IACF,MAAM,EAAE;QACN,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;KACxB,CAAC;IACF,SAAS,EAAE,kBAAkB,CAAC;CAC/B;AAED,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B;AAED;;GAEG;AACH,eAAO,MAAM,6BAA6B,+LAWK,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ComponentMap } from '../sharedTypes';
|
|
3
3
|
import { ComponentRendering, RouteData } from '@sitecore-content-sdk/content/layout';
|
|
4
|
-
import {
|
|
4
|
+
import { ChildComponentProps, PlaceholderProps, ComponentForRendering } from './models';
|
|
5
5
|
/**
|
|
6
|
-
* Get the renderings for the specified placeholder from the rendering data.
|
|
6
|
+
* Get the renderings for the specified placeholder from the rendering layout data.
|
|
7
7
|
* @param {ComponentRendering | RouteData } rendering rendering data
|
|
8
8
|
* @param {string} name placeholder name
|
|
9
9
|
* @param {boolean} isEditing whether components should be rendered in editing mode
|
|
@@ -26,20 +26,12 @@ export declare const getSXAParams: (rendering: ComponentRendering) => "" | {
|
|
|
26
26
|
*/
|
|
27
27
|
export declare const renderEmptyPlaceholder: (node: React.ReactNode | React.ReactElement[]) => React.JSX.Element;
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
30
|
-
* @param {PlaceholderProps} placeholderProps
|
|
31
|
-
* @param {ComponentRendering} componentRendering rendering to be rendered
|
|
32
|
-
* @param {string} renderingKey unique key to pass over to rendering props
|
|
33
|
-
* @returns {RenderedProps} props to be passed to the rendered component
|
|
34
|
-
*/
|
|
35
|
-
export declare const getRenderedComponentProps: (placeholderProps: PlaceholderProps, componentRendering: ComponentRendering, renderingKey: string) => RenderedProps;
|
|
36
|
-
/**
|
|
37
|
-
* Merge placeholder and component field and params content props.
|
|
38
|
-
* @param {BasePlaceholderProps} placeholderProps placeholder props
|
|
29
|
+
* Merge specific placeholder props with component field and params content props.
|
|
30
|
+
* @param {PlaceholderProps} placeholderProps placeholder props
|
|
39
31
|
* @param {ComponentRendering} componentRendering component rendering
|
|
40
32
|
* @returns {ComponentProps} merged props
|
|
41
33
|
*/
|
|
42
|
-
export declare function
|
|
34
|
+
export declare function getChildComponentProps<T extends PlaceholderProps>(placeholderProps: T, componentRendering: ComponentRendering): ChildComponentProps;
|
|
43
35
|
/**
|
|
44
36
|
* Get component implemenation from the component map based on the rendering definition.
|
|
45
37
|
* @param {ComponentRendering} renderingDefinition rendering data
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"placeholder-utils.d.ts","sourceRoot":"","sources":["../../../src/components/Placeholder/placeholder-utils.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAE7C,OAAO,EAAE,YAAY,EAAuD,MAAM,gBAAgB,CAAC;AACnG,OAAO,EACL,kBAAkB,EAClB,SAAS,EAGV,MAAM,sCAAsC,CAAC;AAa9C,OAAO,
|
|
1
|
+
{"version":3,"file":"placeholder-utils.d.ts","sourceRoot":"","sources":["../../../src/components/Placeholder/placeholder-utils.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAE7C,OAAO,EAAE,YAAY,EAAuD,MAAM,gBAAgB,CAAC;AACnG,OAAO,EACL,kBAAkB,EAClB,SAAS,EAGV,MAAM,sCAAsC,CAAC;AAa9C,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAExF;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,GACnC,WAAW,kBAAkB,GAAG,SAAS,EACzC,MAAM,MAAM,EACZ,WAAW,OAAO,yFA2CnB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,YAAY,GAAI,WAAW,kBAAkB;;CAUzD,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,GAAI,MAAM,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,YAAY,EAAE,sBAElF,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,gBAAgB,EAC/D,gBAAgB,EAAE,CAAC,EACnB,kBAAkB,EAAE,kBAAkB,GACrC,mBAAmB,CAYrB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,wBAAwB,GACnC,qBAAqB,kBAAkB,EACvC,iBAAiB,MAAM,EACvB,eAAe,YAAY,EAC3B,2BAA2B,KAAK,CAAC,cAAc,GAAG,KAAK,CAAC,EAAE,EAC1D,4BAA4B,KAAK,CAAC,cAAc,GAAG,KAAK,CAAC,EAAE,KAC1D,qBA0GF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RichText.d.ts","sourceRoot":"","sources":["../../src/components/RichText.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"RichText.d.ts","sourceRoot":"","sources":["../../src/components/RichText.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAqB,MAAM,sCAAsC,CAAC;AAIxF,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD;;;GAGG;AACH,MAAM,WAAW,aAAc,SAAQ,aAAa;IAClD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,aAAc,SAAQ,kBAAkB,CAAC,aAAa,CAAC;IACtE,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC;IAClC,gCAAgC;IAChC,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,yCAAyC;IACzC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;CAC9B;AAsBD;;;;GAIG;AACH,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAI5C,CAAC"}
|
|
@@ -32,16 +32,34 @@ export interface SitecoreProviderState {
|
|
|
32
32
|
* @param {Page} value New page value.
|
|
33
33
|
* @returns {void}
|
|
34
34
|
*/
|
|
35
|
-
setPage
|
|
35
|
+
setPage?: (value: Page) => void;
|
|
36
36
|
/**
|
|
37
|
-
* The
|
|
37
|
+
* The page data.
|
|
38
38
|
*/
|
|
39
39
|
page: Page;
|
|
40
|
+
/**
|
|
41
|
+
* The dynamic import for import map to be used in variant generation mode.
|
|
42
|
+
*/
|
|
43
|
+
loadImportMap: () => Promise<ImportMapImport>;
|
|
44
|
+
/**
|
|
45
|
+
* The component map to use for rendering components.
|
|
46
|
+
*/
|
|
47
|
+
componentMap: ComponentMap;
|
|
40
48
|
/**
|
|
41
49
|
* The API configuration defined in the `SitecoreConfig`.
|
|
42
50
|
*/
|
|
43
51
|
api?: SitecoreProviderProps['api'];
|
|
44
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* The options for the useSitecore hook.
|
|
55
|
+
* @public
|
|
56
|
+
*/
|
|
57
|
+
export interface UseSitecoreOptions {
|
|
58
|
+
/**
|
|
59
|
+
* If set to true, the `updateContext` method will be injected into the component props.
|
|
60
|
+
*/
|
|
61
|
+
updatable?: boolean;
|
|
62
|
+
}
|
|
45
63
|
/**
|
|
46
64
|
* The context for the SitecoreProvider component.
|
|
47
65
|
* @public
|
|
@@ -51,17 +69,29 @@ export declare const ComponentMapReactContext: React.Context<ComponentMap>;
|
|
|
51
69
|
export declare const ImportMapReactContext: React.Context<(() => Promise<ImportMapImport>) | undefined>;
|
|
52
70
|
/**
|
|
53
71
|
* The SitecoreProvider component.
|
|
72
|
+
* @param {SitecoreProviderProps} props - The props for the SitecoreProvider component.
|
|
73
|
+
* @param {SitecoreProviderProps['api']} props.api - The API configuration.
|
|
74
|
+
* @param {SitecoreProviderProps['page']} props.page - The page data.
|
|
75
|
+
* @param {SitecoreProviderProps['componentMap']} props.componentMap - The component map.
|
|
76
|
+
* @param {SitecoreProviderProps['loadImportMap']} props.loadImportMap - The function to load the import map.
|
|
77
|
+
* @param {React.ReactNode} props.children - The children to render.
|
|
78
|
+
* @returns {React.ReactNode} The SitecoreProvider component.
|
|
54
79
|
* @public
|
|
55
80
|
*/
|
|
56
|
-
export declare
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
81
|
+
export declare const SitecoreProvider: {
|
|
82
|
+
(props: SitecoreProviderProps): React.JSX.Element;
|
|
83
|
+
displayName: string;
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* This hook grants acсess to the current Sitecore page and api.
|
|
87
|
+
* @param {UseSitecoreOptions} [options] hook options
|
|
88
|
+
* @example
|
|
89
|
+
* const EditMode = () => {
|
|
90
|
+
* const { page } = useSitecore();
|
|
91
|
+
* return <span>Edit Mode is {page.mode.isEditing ? 'active' : 'inactive'}</span>
|
|
92
|
+
* }
|
|
93
|
+
* @returns {SitecoreProviderState} The current Sitecore context, including the page and api.
|
|
94
|
+
* @public
|
|
95
|
+
*/
|
|
96
|
+
export declare function useSitecore(options?: UseSitecoreOptions): SitecoreProviderState;
|
|
67
97
|
//# sourceMappingURL=SitecoreProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SitecoreProvider.d.ts","sourceRoot":"","sources":["../../src/components/SitecoreProvider.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"SitecoreProvider.d.ts","sourceRoot":"","sources":["../../src/components/SitecoreProvider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAgE,MAAM,OAAO,CAAC;AAErF,OAAO,EAAE,IAAI,EAAE,MAAM,sCAAsC,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,GAAG,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC;IAC3B;;OAEG;IACH,YAAY,EAAE,YAAY,CAAC;IAC3B;;OAEG;IACH,IAAI,EAAE,IAAI,CAAC;IACX;;OAEG;IACH,aAAa,EAAE,MAAM,OAAO,CAAC,eAAe,CAAC,CAAC;IAE9C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;;GAGG;AACH,MAAM,WAAW,qBAAqB;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E,SAAS,CAAC;IAClB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;
|
|
1
|
+
{"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../src/components/Text.tsx"],"names":[],"mappings":"AACA,OAAO,KAAuB,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAqB,MAAM,sCAAsC,CAAC;AAIxF,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD;;;GAGG;AACH,MAAM,WAAW,SAAU,SAAQ,aAAa;IAC9C,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,SAAU,SAAQ,kBAAkB,CAAC,SAAS,CAAC;IAC9D,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC;IAClC,2BAA2B;IAC3B,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAkED;;;GAGG;AACH,eAAO,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CAIpC,CAAC"}
|
|
@@ -12,5 +12,11 @@ export type WrapperProps = {
|
|
|
12
12
|
page: Page;
|
|
13
13
|
componentMap: ComponentMap;
|
|
14
14
|
};
|
|
15
|
+
/**
|
|
16
|
+
* Provides a slot-like functionality by wrapping a component and rendering placeholders defined in the layout data.
|
|
17
|
+
* @param {ComponentType<T>} Component - The component to be wrapped around placeholders.
|
|
18
|
+
* @returns {React.ReactNode} A new component that renders the original component with placeholders.
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
15
21
|
export declare const withAppPlaceholder: <T extends ComponentProps, W extends T & WrapperProps>(Component: ComponentType<T>) => (props: W) => React.JSX.Element;
|
|
16
22
|
//# sourceMappingURL=withAppPlaceholder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withAppPlaceholder.d.ts","sourceRoot":"","sources":["../../src/enhancers/withAppPlaceholder.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EAAE,IAAI,EAAE,MAAM,sCAAsC,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,MAAM,MAAM,cAAc,GAAG;IAC3B,SAAS,EAAE,kBAAkB,CAAC;IAC9B,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;CAC/C,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,SAAS,EAAE,kBAAkB,CAAC;IAC9B,IAAI,EAAE,IAAI,CAAC;IACX,YAAY,EAAE,YAAY,CAAC;CAC5B,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,CAAC,SAAS,cAAc,EAAE,CAAC,SAAS,CAAC,GAAG,YAAY,EACrF,WAAW,aAAa,CAAC,CAAC,CAAC,MAEnB,OAAO,CAAC,sBAoBjB,CAAC"}
|
|
1
|
+
{"version":3,"file":"withAppPlaceholder.d.ts","sourceRoot":"","sources":["../../src/enhancers/withAppPlaceholder.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EAAE,IAAI,EAAE,MAAM,sCAAsC,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,MAAM,MAAM,cAAc,GAAG;IAC3B,SAAS,EAAE,kBAAkB,CAAC;IAC9B,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;CAC/C,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,SAAS,EAAE,kBAAkB,CAAC;IAC9B,IAAI,EAAE,IAAI,CAAC;IACX,YAAY,EAAE,YAAY,CAAC;CAC5B,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,GAAI,CAAC,SAAS,cAAc,EAAE,CAAC,SAAS,CAAC,GAAG,YAAY,EACrF,WAAW,aAAa,CAAC,CAAC,CAAC,MAEnB,OAAO,CAAC,sBAoBjB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withDatasourceCheck.d.ts","sourceRoot":"","sources":["../../src/enhancers/withDatasourceCheck.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"withDatasourceCheck.d.ts","sourceRoot":"","sources":["../../src/enhancers/withDatasourceCheck.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAG1E,eAAO,MAAM,mBAAmB,QAAO,GAAG,CAAC,OAI1C,CAAC;AAEF,MAAM,WAAW,wBAAwB;IACvC,SAAS,EAAE,kBAAkB,CAAC;CAC/B;AAED,MAAM,WAAW,0BAA0B;IACzC;;;OAGG;IACH,qBAAqB,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC;CAC3E;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,CAAC,EAAE,0BAA0B,IAC/B,cAAc,SAAS,wBAAwB,EACpF,WAAW,KAAK,CAAC,aAAa,CAAC,cAAc,CAAC,MAEtC,OAAO,cAAc,wBAchC"}
|
|
@@ -4,5 +4,8 @@ import React from 'react';
|
|
|
4
4
|
* @param {React.ComponentClass<unknown> | React.FC<unknown>} WrappedComponent - The component to wrap.
|
|
5
5
|
* @public
|
|
6
6
|
*/
|
|
7
|
-
export declare const withEditorChromes: (WrappedComponent: React.ComponentClass<unknown> | React.FC<unknown>) =>
|
|
7
|
+
export declare const withEditorChromes: (WrappedComponent: React.ComponentClass<unknown> | React.FC<unknown>) => {
|
|
8
|
+
(props: Record<string, unknown>): React.JSX.Element;
|
|
9
|
+
displayName: string;
|
|
10
|
+
};
|
|
8
11
|
//# sourceMappingURL=withEditorChromes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withEditorChromes.d.ts","sourceRoot":"","sources":["../../src/enhancers/withEditorChromes.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"withEditorChromes.d.ts","sourceRoot":"","sources":["../../src/enhancers/withEditorChromes.tsx"],"names":[],"mappings":"AACA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAGhE;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAC5B,kBAAkB,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC,EAAE,CAAC,OAAO,CAAC;YAE1C,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;CAoBjD,CAAC"}
|
|
@@ -9,7 +9,7 @@ export interface WithEmptyFieldEditingComponentOptions {
|
|
|
9
9
|
*/
|
|
10
10
|
defaultEmptyFieldEditingComponent: React.FC;
|
|
11
11
|
/**
|
|
12
|
-
* 'true' if
|
|
12
|
+
* 'true' if the ref prop should be explicitly accepted and forwarded
|
|
13
13
|
*/
|
|
14
14
|
isForwardRef?: boolean;
|
|
15
15
|
}
|
|
@@ -21,9 +21,11 @@ interface WithEmptyFieldEditingComponentProps<Props> {
|
|
|
21
21
|
/**
|
|
22
22
|
* Returns the passed field component or default component in case field value is empty and edit mode is 'metadata'
|
|
23
23
|
* @param {ComponentType<FieldComponentProps>} FieldComponent the field component
|
|
24
|
-
* @param {
|
|
24
|
+
* @param {WithEmptyFieldEditingComponentOptions} options the options of the HOC;
|
|
25
25
|
* @public
|
|
26
26
|
*/
|
|
27
|
-
export declare function withEmptyFieldEditingComponent<FieldComponentProps extends WithEmptyFieldEditingComponentProps<FieldComponentProps>, RefElementType = HTMLElement>(FieldComponent: ComponentType<FieldComponentProps>, options: WithEmptyFieldEditingComponentOptions):
|
|
27
|
+
export declare function withEmptyFieldEditingComponent<FieldComponentProps extends WithEmptyFieldEditingComponentProps<FieldComponentProps>, RefElementType = HTMLElement>(FieldComponent: ComponentType<FieldComponentProps>, options: WithEmptyFieldEditingComponentOptions): (props: FieldComponentProps & {
|
|
28
|
+
ref?: React.Ref<RefElementType>;
|
|
29
|
+
}) => React.JSX.Element;
|
|
28
30
|
export {};
|
|
29
31
|
//# sourceMappingURL=withEmptyFieldEditingComponent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withEmptyFieldEditingComponent.d.ts","sourceRoot":"","sources":["../../src/enhancers/withEmptyFieldEditingComponent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"withEmptyFieldEditingComponent.d.ts","sourceRoot":"","sources":["../../src/enhancers/withEmptyFieldEditingComponent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EACL,iBAAiB,EACjB,KAAK,EAEL,aAAa,EACd,MAAM,sCAAsC,CAAC;AAE9C;;GAEG;AACH,MAAM,WAAW,qCAAqC;IACpD;;OAEG;IACH,iCAAiC,EAAE,KAAK,CAAC,EAAE,CAAC;IAC5C;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAKD,UAAU,mCAAmC,CAAC,KAAK;IAEjD,KAAK,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,iBAAiB,CAAC,GAAG,aAAa,CAAC;IAC7D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,0BAA0B,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;CAC5E;AAED;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAC5C,mBAAmB,SAAS,mCAAmC,CAAC,mBAAmB,CAAC,EACpF,cAAc,GAAG,WAAW,EAE5B,cAAc,EAAE,aAAa,CAAC,mBAAmB,CAAC,EAClD,OAAO,EAAE,qCAAqC,WA2B7B,mBAAmB,GAAG;IAAE,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAA;CAAE,uBAgB3E"}
|
|
@@ -10,9 +10,11 @@ interface WithMetadataProps {
|
|
|
10
10
|
/**
|
|
11
11
|
* Wraps the field component with metadata markup intended to be used for chromes hydration in Pages
|
|
12
12
|
* @param {ComponentType<FieldComponentProps>} FieldComponent the field component
|
|
13
|
-
* @param {boolean} isForwardRef set to 'true' if
|
|
13
|
+
* @param {boolean} isForwardRef set to 'true' if the ref prop should be explicitly accepted and forwarded
|
|
14
14
|
* @public
|
|
15
15
|
*/
|
|
16
|
-
export declare function withFieldMetadata<FieldComponentProps extends WithMetadataProps, RefElementType = HTMLElement>(FieldComponent: ComponentType<FieldComponentProps>, isForwardRef?: boolean):
|
|
16
|
+
export declare function withFieldMetadata<FieldComponentProps extends WithMetadataProps, RefElementType = HTMLElement>(FieldComponent: ComponentType<FieldComponentProps>, isForwardRef?: boolean): (props: FieldComponentProps & {
|
|
17
|
+
ref?: React.Ref<RefElementType>;
|
|
18
|
+
}) => React.JSX.Element;
|
|
17
19
|
export {};
|
|
18
20
|
//# sourceMappingURL=withFieldMetadata.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withFieldMetadata.d.ts","sourceRoot":"","sources":["../../src/enhancers/withFieldMetadata.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"withFieldMetadata.d.ts","sourceRoot":"","sources":["../../src/enhancers/withFieldMetadata.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAG7C,UAAU,iBAAiB;IACzB,KAAK,CAAC,EAAE;QACN,QAAQ,CAAC,EAAE;YAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;SAAE,CAAC;KACvC,CAAC;IACF,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,mBAAmB,SAAS,iBAAiB,EAC7C,cAAc,GAAG,WAAW,EAC5B,cAAc,EAAE,aAAa,CAAC,mBAAmB,CAAC,EAAE,YAAY,UAAQ,WAEvD,mBAAmB,GAAG;IAAE,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAA;CAAE,uBA8B3E"}
|
|
@@ -1,37 +1,19 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Function to alter the placeholder props from within the HOC. Enables the props to be
|
|
14
|
-
* transformed before being used by the placeholder/HOC, for example to customize the
|
|
15
|
-
* error or missing component display
|
|
16
|
-
*/
|
|
17
|
-
propsTransformer?: (props: PlaceholderProps) => PlaceholderProps;
|
|
18
|
-
}
|
|
19
|
-
export interface PlaceholderToPropMapping {
|
|
20
|
-
/**
|
|
21
|
-
* The name of the placeholder this component will expose
|
|
22
|
-
*/
|
|
23
|
-
placeholder: string;
|
|
24
|
-
/**
|
|
25
|
-
* The name of the prop on your wrapped component that you would like the placeholder data injected on
|
|
26
|
-
*/
|
|
27
|
-
prop: string;
|
|
28
|
-
}
|
|
29
|
-
export type WithPlaceholderSpec = (string | PlaceholderToPropMapping) | (string | PlaceholderToPropMapping)[];
|
|
2
|
+
import { ComponentType } from 'react';
|
|
3
|
+
import { ComponentRendering } from '@sitecore-content-sdk/content/layout';
|
|
4
|
+
import { Page } from '@sitecore-content-sdk/content/client';
|
|
5
|
+
import { ComponentMap } from '../components/sharedTypes';
|
|
6
|
+
import { ComponentProps } from './withAppPlaceholder';
|
|
7
|
+
export type WrapperProps = {
|
|
8
|
+
rendering: ComponentRendering;
|
|
9
|
+
page?: Page;
|
|
10
|
+
componentMap?: ComponentMap;
|
|
11
|
+
};
|
|
30
12
|
/**
|
|
31
|
-
*
|
|
32
|
-
* @param {
|
|
33
|
-
* @
|
|
13
|
+
* Provides a slot-like functionality by wrapping a component in client/SSR context and rendering placeholders defined in the layout data.
|
|
14
|
+
* @param {ComponentType<T>} Component - The component to be wrapped around placeholders.
|
|
15
|
+
* @returns {React.ReactNode} A new component that renders the original component with placeholders.
|
|
34
16
|
* @public
|
|
35
17
|
*/
|
|
36
|
-
export declare
|
|
18
|
+
export declare const withPlaceholder: <T extends ComponentProps, W extends T & WrapperProps>(Component: ComponentType<T>) => (props: W) => React.JSX.Element;
|
|
37
19
|
//# sourceMappingURL=withPlaceholder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withPlaceholder.d.ts","sourceRoot":"","sources":["../../src/enhancers/withPlaceholder.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"withPlaceholder.d.ts","sourceRoot":"","sources":["../../src/enhancers/withPlaceholder.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EAAE,IAAI,EAAE,MAAM,sCAAsC,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,MAAM,MAAM,YAAY,GAAG;IACzB,SAAS,EAAE,kBAAkB,CAAC;IAC9B,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAAI,CAAC,SAAS,cAAc,EAAE,CAAC,SAAS,CAAC,GAAG,YAAY,EAClF,WAAW,aAAa,CAAC,CAAC,CAAC,MAEnB,OAAO,CAAC,sBAmBjB,CAAC"}
|
|
@@ -1,63 +1,21 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { EnhancedOmit } from '@sitecore-content-sdk/core/tools';
|
|
3
|
-
import { SitecoreProviderState } from '../components/SitecoreProvider';
|
|
4
|
-
import { Page } from '@sitecore-content-sdk/content/client';
|
|
3
|
+
import { SitecoreProviderState, UseSitecoreOptions } from '../components/SitecoreProvider';
|
|
5
4
|
/**
|
|
6
|
-
* The
|
|
5
|
+
* The props that HOC will inject into the wrapped component — the full Sitecore context state.
|
|
7
6
|
* @public
|
|
8
7
|
*/
|
|
9
|
-
export
|
|
10
|
-
/**
|
|
11
|
-
* If set to true, the `updateContext` method will be injected into the component props.
|
|
12
|
-
*/
|
|
13
|
-
updatable?: boolean;
|
|
14
|
-
}
|
|
8
|
+
export type WithSitecoreProps = SitecoreProviderState;
|
|
15
9
|
/**
|
|
16
|
-
* The props that HOC will
|
|
17
|
-
* @public
|
|
18
|
-
*/
|
|
19
|
-
export interface WithSitecoreProps {
|
|
20
|
-
/**
|
|
21
|
-
* The current page context.
|
|
22
|
-
*/
|
|
23
|
-
page: Page;
|
|
24
|
-
/**
|
|
25
|
-
* The API configuration defined in the `SitecoreConfig`.
|
|
26
|
-
*/
|
|
27
|
-
api?: SitecoreProviderState['api'];
|
|
28
|
-
/**
|
|
29
|
-
* Method to update the page. This is only available if `updatable` is set to true.
|
|
30
|
-
* @param {Page} value New page value.
|
|
31
|
-
* @returns {void}
|
|
32
|
-
*/
|
|
33
|
-
updatePage?: ((value: Page) => void) | false;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* The type of the props that HOC will receive.
|
|
10
|
+
* The type of the props that the HOC-wrapped component will receive (injected props omitted).
|
|
37
11
|
* @public
|
|
38
12
|
*/
|
|
39
13
|
export type WithSitecoreHocProps<ComponentProps> = EnhancedOmit<ComponentProps, keyof WithSitecoreProps>;
|
|
40
14
|
/**
|
|
41
|
-
* @
|
|
42
|
-
* @
|
|
43
|
-
|
|
44
|
-
export declare function withSitecore(options?: WithSitecoreOptions): <ComponentProps extends WithSitecoreProps>(Component: React.ComponentType<ComponentProps>) => (props: WithSitecoreHocProps<ComponentProps>) => React.JSX.Element;
|
|
45
|
-
/**
|
|
46
|
-
* This hook grants acсess to the current Sitecore page and api.
|
|
47
|
-
* @param {WithSitecoreOptions} [options] hook options
|
|
48
|
-
* @example
|
|
49
|
-
* const EditMode = () => {
|
|
50
|
-
* const { page } = useSitecore();
|
|
51
|
-
* return <span>Edit Mode is {page.mode.isEditing ? 'active' : 'inactive'}</span>
|
|
52
|
-
* }
|
|
53
|
-
* @example
|
|
54
|
-
* const EditMode = () => {
|
|
55
|
-
* const { page, updatePage } = useSitecore({ updatable: true });
|
|
56
|
-
* const onClick = () => updatePage({ itemId: '123' });
|
|
57
|
-
* return <span onClick={onClick}>Item id is {page.itemId}</span>
|
|
58
|
-
* }
|
|
59
|
-
* @returns {object} { api, page, updatePage }
|
|
15
|
+
* @deprecated `useSitecore` hook is a better practice for consuming Sitecore context in components
|
|
16
|
+
* @param {UseSitecoreOptions} [options] - Options for whether return page context update method alongside the rest of context
|
|
17
|
+
* @returns A higher-order component that injects Sitecore context into the wrapped component.
|
|
60
18
|
* @public
|
|
61
19
|
*/
|
|
62
|
-
export declare function
|
|
20
|
+
export declare function withSitecore(options?: UseSitecoreOptions): <ComponentProps extends Partial<SitecoreProviderState> & Pick<SitecoreProviderState, "page">>(Component: React.ComponentType<ComponentProps>) => (props: WithSitecoreHocProps<ComponentProps>) => React.JSX.Element;
|
|
63
21
|
//# sourceMappingURL=withSitecore.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withSitecore.d.ts","sourceRoot":"","sources":["../../src/enhancers/withSitecore.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,
|
|
1
|
+
{"version":3,"file":"withSitecore.d.ts","sourceRoot":"","sources":["../../src/enhancers/withSitecore.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EACL,qBAAqB,EAErB,kBAAkB,EACnB,MAAM,gCAAgC,CAAC;AAExC;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,qBAAqB,CAAC;AAEtD;;;GAGG;AACH,MAAM,MAAM,oBAAoB,CAAC,cAAc,IAAI,YAAY,CAC7D,cAAc,EACd,MAAM,iBAAiB,CACxB,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,OAAO,CAAC,EAAE,kBAAkB,IAErD,cAAc,SAAS,OAAO,CAAC,qBAAqB,CAAC,GAAG,IAAI,CAAC,qBAAqB,EAAE,MAAM,CAAC,EAC3F,WAAW,KAAK,CAAC,aAAa,CAAC,cAAc,CAAC,MACT,OAAO,oBAAoB,CAAC,cAAc,CAAC,uBAcnF"}
|
package/types/index.d.ts
CHANGED
|
@@ -17,13 +17,14 @@ export { DesignLibrary, DesignLibraryApp } from './components/DesignLibrary';
|
|
|
17
17
|
export {} from './components/FEaaS/BYOCComponent';
|
|
18
18
|
export { Link, LinkField, LinkFieldValue, LinkProps } from './components/Link';
|
|
19
19
|
export { File, FileField } from './components/File';
|
|
20
|
-
export { SitecoreProvider, SitecoreProviderState, SitecoreProviderReactContext, } from './components/SitecoreProvider';
|
|
21
|
-
export { withSitecore, useSitecore, WithSitecoreOptions, WithSitecoreProps, WithSitecoreHocProps, } from './enhancers/withSitecore';
|
|
20
|
+
export { SitecoreProvider, SitecoreProviderState, SitecoreProviderReactContext, useSitecore, } from './components/SitecoreProvider';
|
|
22
21
|
export { withEditorChromes } from './enhancers/withEditorChromes';
|
|
23
|
-
export {
|
|
22
|
+
export { withSitecore } from './enhancers/withSitecore';
|
|
24
23
|
export { withDatasourceCheck } from './enhancers/withDatasourceCheck';
|
|
25
24
|
export { withFieldMetadata } from './enhancers/withFieldMetadata';
|
|
26
25
|
export { withEmptyFieldEditingComponent } from './enhancers/withEmptyFieldEditingComponent';
|
|
26
|
+
export { withAppPlaceholder } from './enhancers/withAppPlaceholder';
|
|
27
|
+
export { withPlaceholder } from './enhancers/withPlaceholder';
|
|
27
28
|
export { EditingScripts } from './components/EditingScripts';
|
|
28
29
|
export { DefaultEmptyFieldEditingComponentText, DefaultEmptyFieldEditingComponentImage, } from './components/DefaultEmptyFieldEditingComponents';
|
|
29
30
|
export { ClientEditingChromesUpdate } from './components/ClientEditingChromesUpdate';
|
package/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,WAAW,EACX,WAAW,EACX,WAAW,EACX,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EACjB,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3F,OAAO,EACL,wBAAwB,EACxB,+BAA+B,EAC/B,iBAAiB,EACjB,sBAAsB,EACtB,oBAAoB,EACpB,wBAAwB,EACxB,aAAa,EACb,S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E,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,8BAA8B,EAAE,MAAM,4CAA4C,CAAC;AAC5F,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EACL,qCAAqC,EACrC,sCAAsC,GACvC,MAAM,iDAAiD,CAAC;AACzD,OAAO,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AACrF,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.withComponentMap = withComponentMap;
|
|
7
|
-
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const SitecoreProvider_1 = require("../components/SitecoreProvider");
|
|
9
|
-
const react_2 = require("react");
|
|
10
|
-
/**
|
|
11
|
-
* @param {React.ComponentClass<T> | React.FC<T>} Component
|
|
12
|
-
*/
|
|
13
|
-
function withComponentMap(Component) {
|
|
14
|
-
/**
|
|
15
|
-
* @param {T} props - props to pass to the wrapped component
|
|
16
|
-
* @returns {JSX.Element} - the rendered component
|
|
17
|
-
*/
|
|
18
|
-
function WithComponentMap(props) {
|
|
19
|
-
const context = (0, react_2.useContext)(SitecoreProvider_1.ComponentMapReactContext);
|
|
20
|
-
return react_1.default.createElement(Component, Object.assign({}, props, { componentMap: props.componentMap || context }));
|
|
21
|
-
}
|
|
22
|
-
WithComponentMap.displayName = `withComponentMap(${Component.displayName || Component.name || 'Anonymous'})`;
|
|
23
|
-
return WithComponentMap;
|
|
24
|
-
}
|