@tridion-docs/extensions 2.1.4 → 2.1.6

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @tridion-docs/extensions
2
2
 
3
+ ## 2.1.6
4
+
5
+ ### Patch Changes
6
+
7
+ - Make styled-components an optional peer dependency and omit it from generated extensions, avoiding missing-peer warnings for extensions that don’t use it.
8
+
9
+ ## 2.1.5
10
+
11
+ ### Patch Changes
12
+
13
+ - Fixed dependencies for known vulnerabilities
14
+
3
15
  ## 2.1.4
4
16
 
5
17
  ### Patch Changes
package/README.md CHANGED
@@ -1,8 +1,9 @@
1
1
  # Docs Extensions
2
2
 
3
- This project contains the helper function, components and hooks for working with Tridion Docs extensions.
3
+ This project contains the helper function, components and hooks for working with Tridion Docs extensions.
4
4
 
5
5
  # License
6
+
6
7
  License: https://www.rws.com/legal/terms-and-conditions/rws-technology/
7
8
 
8
9
  Copyright © 2026 RWS Holdings plc including its subsidiaries and affiliated companies. All rights reserved.
@@ -14,6 +15,7 @@ This version of the package is compatible with Tridion Docs 15.2 and 15.3
14
15
  # Upgrade instruction
15
16
 
16
17
  ## Packages
18
+
17
19
  To use latest version of extension and extension-cli you need to update versions of package.json in your extension application.
18
20
 
19
21
  You need to update versions of these two packages `@tridion-docs/extensions` and `@tridion-docs/extensions-cli`. We also recommend you to keep all other dependencies up to date. You can find examples of packages and their versions in package.json of extension-example application available on CD.
@@ -30,6 +32,11 @@ You need to update versions of these two packages `@tridion-docs/extensions` and
30
32
  ...
31
33
  }
32
34
  ```
35
+ ## Peer dependencies
36
+
37
+ `react` and `react-dom` are required peer dependencies. `styled-components` is an optional peer dependency; install it only if your extension uses it. Extensions that do not use `styled-components` do not need to install it and will not receive a missing peer dependency warning.
38
+
39
+ Tridion Docs shares these libraries with extensions at runtime, so the major version you use must match the version declared in the `peerDependencies` of this package. An extension with an unsupported major version fails to load with an error.
33
40
 
34
41
  # Documentation
35
42
 
@@ -40,9 +47,7 @@ You need to update versions of these two packages `@tridion-docs/extensions` and
40
47
  - [Extension Points](#extension-points) - Allows to register custom components in one of the available areas.
41
48
 
42
49
  - Other documentation
43
- - [Working with Oapi client](#generate-open-api-typescript-client-from-the-swagger)
44
-
45
-
50
+ - [Working with Oapi client](#generate-open-api-typescript-client-from-the-swagger)
46
51
 
47
52
  # Components
48
53
 
@@ -54,6 +59,11 @@ The `Iframe` component allows you to embed an HTML page inside the extension are
54
59
  The width and height can be defined as seen in the example below, these can also be
55
60
  percentages, e.g.: `"50%"`, `"100%"`, etc.
56
61
 
62
+ Only embed content from trusted sources. You may need to update the site’s Content Security Policy to
63
+ permit the iframe URL through frame-src; for example, configure the
64
+ response header (in IIS, this may be set in web.config) with
65
+ frame-src 'self' https://trusted.example;.
66
+
57
67
  The [security sandbox](https://www.w3schools.com/tags/att_iframe_sandbox.asp)
58
68
  is pretty relaxed: `allow-forms`, `allow-popups`, `allow-same-origin`, `allow-scripts`,
59
69
  however the iframe content is not allowed to access data from the parent frame
@@ -72,12 +82,12 @@ export const CustomIframePage = () => {
72
82
 
73
83
  **Props**
74
84
 
75
- | Name | Type | Description
76
- | ----------- | ------------------- | ----------------------------------------
77
- `src` | `string` | Url to load inside the iframe
78
- `width` | `number` / `string` | Width of the iframe ("100%" by default)
79
- `height` | `number` / `string` | Height of the iframe ("100%" by default)
80
- `className` | `string` | Optional CSS classname
85
+ | Name | Type | Description |
86
+ | ----------- | ------------------- | ---------------------------------------- |
87
+ | `src` | `string` | Url to load inside the iframe |
88
+ | `width` | `number` / `string` | Width of the iframe ("100%" by default) |
89
+ | `height` | `number` / `string` | Height of the iframe ("100%" by default) |
90
+ | `className` | `string` | Optional CSS classname |
81
91
 
82
92
  ## React component: `DataIndicator`
83
93
 
@@ -100,14 +110,14 @@ export const CustomPage = () => {
100
110
 
101
111
  **Props**
102
112
 
103
- | Name | Type | Description
104
- | --------------- | ------------------- | ----------------------------------------
105
- `children` | `ReactNode` | Content that should be rendered when hasData is `true` AND isLoading is `false` AND isLoadingFailed is `false`
106
- `errorMessage` | `string` | Message that rendered when isLoadingFailed is `true`
107
- `hasData` | `boolean` | Indicates that content is ready to be rendered (children). When `true` children is rendered
108
- `isLoading` | `boolean` | Controls loading indicator. When `true` loading indicator is shown
109
- `isLoadingFailed`| `boolean` | Controls error message. When `true` error message is rendered
110
- `noDataMessage` | `string` | Rendered when hasData is `false`
113
+ | Name | Type | Description |
114
+ | ----------------- | ----------- | -------------------------------------------------------------------------------------------------------------- |
115
+ | `children` | `ReactNode` | Content that should be rendered when hasData is `true` AND isLoading is `false` AND isLoadingFailed is `false` |
116
+ | `errorMessage` | `string` | Message that rendered when isLoadingFailed is `true` |
117
+ | `hasData` | `boolean` | Indicates that content is ready to be rendered (children). When `true` children is rendered |
118
+ | `isLoading` | `boolean` | Controls loading indicator. When `true` loading indicator is shown |
119
+ | `isLoadingFailed` | `boolean` | Controls error message. When `true` error message is rendered |
120
+ | `noDataMessage` | `string` | Rendered when hasData is `false` |
111
121
 
112
122
  # Hooks
113
123
 
@@ -117,14 +127,12 @@ The extension library provides hooks to assist with extension development.
117
127
 
118
128
  The `useItemSelector` allows you to show dialog with a structured folder tree on the left side and the content of the folder on the right side. This dialog supposes to help you to select one of the multiple objects based on your configuration.
119
129
 
120
-
121
130
  **Example**
122
131
 
123
132
  ```typescript jsx
124
133
  import { useItemSelector, ItemSelectorObjectType } from '@tridion-docs/extensions';
125
134
 
126
135
  export const useCustomHook = () => {
127
-
128
136
  const itemSelectorProps = {
129
137
  objectTypesToSelect: [
130
138
  DocumentObjectType.Illustration,
@@ -145,34 +153,30 @@ export const useCustomHook = () => {
145
153
  return {
146
154
  showItemSelector: execute,
147
155
  };
148
- }
149
-
156
+ };
150
157
  ```
151
158
 
152
159
  **Props**
153
160
 
154
- | Name | Type | Description |
155
- | --------------------- | ------------------- | ---------------------------------------- |
156
- `isMultiSelect` | `boolean` | Whether multiple items can be selected |
157
- `objectTypesToSelect` | `ItemSelectorObjectType` | List of object types that can be selected. Default available types: `undefined`, `illustration`, `library`, `map`, `other`, `topic`, `publication`
158
- `onOk` | `function` | Function that will be called when a user clicks the OK button
159
- `okLabel` | `string` | Label of the 'Ok' button
160
- `cancelLabel` | `string` | Label of the 'Cancel' button
161
- `modalZindex` | `number` | Property to set z-index property on the item selector modal
162
-
161
+ | Name | Type | Description |
162
+ | --------------------- | ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------- |
163
+ | `isMultiSelect` | `boolean` | Whether multiple items can be selected |
164
+ | `objectTypesToSelect` | `ItemSelectorObjectType` | List of object types that can be selected. Default available types: `undefined`, `illustration`, `library`, `map`, `other`, `topic`, `publication` |
165
+ | `onOk` | `function` | Function that will be called when a user clicks the OK button |
166
+ | `okLabel` | `string` | Label of the 'Ok' button |
167
+ | `cancelLabel` | `string` | Label of the 'Cancel' button |
168
+ | `modalZindex` | `number` | Property to set z-index property on the item selector modal |
163
169
 
164
170
  **Return**
165
171
 
166
- | Name | Type | Description |
167
- | --------------------- | ------------------- | ---------------------------------------- |
168
- `execute` | `function` | By calling this function you will show item selector on the screen.
169
-
172
+ | Name | Type | Description |
173
+ | --------- | ---------- | ------------------------------------------------------------------- |
174
+ | `execute` | `function` | By calling this function you will show item selector on the screen. |
170
175
 
171
- ## `useFolderSelector`
176
+ ## `useFolderSelector`
172
177
 
173
178
  The `useFolderSelector` allows you to show dialog with a structured folder tree. This dialog supposes to help you to select one folder.
174
179
 
175
-
176
180
  **Example**
177
181
 
178
182
  ```typescript jsx
@@ -205,27 +209,26 @@ export const useCustomHook = () => {
205
209
 
206
210
  **Props**
207
211
 
208
- | Name | Type | Description |
209
- | --------------------- |------------|-------------------------------------------------------------------------------------------------------------------------------------|
210
- `getDisabledFolderIds` | `function` | Disable the ability to select a list of Folders |
211
- `showConstraints` | `boolean` | Show or Hide the `Show Constraints` button
212
- `constraintsComponent` | `boolean` | Component to show when user clicks on `Show Constraints` button
213
- `onOk` | `function` | Function that will be called when a user clicks the OK button
214
- `okButtonLabel` | `string` | Label of the 'Ok' button
215
- `cancelButtonLabel` | `string` | Label of the 'Cancel' button
216
- `modalTitle` | `string` | Title of the Modal
217
- `modalIcon` | `string` | Icon of Modal Title
218
- `cancelButtonLabel` | `string` | Label of the 'Cancel' button
219
-
212
+ | Name | Type | Description |
213
+ | ---------------------- | ---------- | --------------------------------------------------------------- |
214
+ | `getDisabledFolderIds` | `function` | Disable the ability to select a list of Folders |
215
+ | `showConstraints` | `boolean` | Show or Hide the `Show Constraints` button |
216
+ | `constraintsComponent` | `boolean` | Component to show when user clicks on `Show Constraints` button |
217
+ | `onOk` | `function` | Function that will be called when a user clicks the OK button |
218
+ | `okButtonLabel` | `string` | Label of the 'Ok' button |
219
+ | `cancelButtonLabel` | `string` | Label of the 'Cancel' button |
220
+ | `modalTitle` | `string` | Title of the Modal |
221
+ | `modalIcon` | `string` | Icon of Modal Title |
222
+ | `cancelButtonLabel` | `string` | Label of the 'Cancel' button |
220
223
 
221
224
  **Return**
222
225
 
223
- | Name | Type | Description |
224
- | --------------------- | ------------------- | ---------------------------------------- |
225
- `execute` | `function` | By calling this function you will show folder selector on the screen.
226
-
226
+ | Name | Type | Description |
227
+ | --------- | ---------- | --------------------------------------------------------------------- |
228
+ | `execute` | `function` | By calling this function you will show folder selector on the screen. |
227
229
 
228
230
  ## Notifications
231
+
229
232
  Hook for displaying a notification message.
230
233
 
231
234
  **Example**
@@ -239,24 +242,21 @@ export const useCustomHook = (props: any) => {
239
242
  description: 'Notification message',
240
243
  severity: messageSeverity.SUCCESS,
241
244
  });
242
-
243
- }
245
+ };
244
246
  ```
245
247
 
246
-
247
248
  **Props**
248
249
 
249
- | Name | Type | Description |
250
- | --------------------- | ------------------- | ---------------------------------------- |
251
- **none**
252
-
250
+ | Name | Type | Description |
251
+ | -------- | ---- | ----------- |
252
+ | **none** |
253
253
 
254
254
  **Return**
255
- | Name | Type | Description |
256
- | :-------------------- | :------------------ | :---------------------------------------- |
257
- `execute` | `function(message, description, severity, actionArea)` | By calling this function you will show a notification message. `message`: Title of the notification, `description`: Body or text of the notification, `severity`: notification type, `actionArea`: Area to add action button (optional)
258
- `messageSeverity` | `MessageSeverity` | Message type, based on the type design and behavior of notification may vary.
259
255
 
256
+ | Name | Type | Description |
257
+ | :---------------- | :----------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
258
+ | `execute` | `function(message, description, severity, actionArea)` | By calling this function you will show a notification message. `message`: Title of the notification, `description`: Body or text of the notification, `severity`: notification type, `actionArea`: Area to add action button (optional) |
259
+ | `messageSeverity` | `MessageSeverity` | Message type, based on the type design and behavior of notification may vary. |
260
260
 
261
261
  ## useRepositoryFolderRefresh
262
262
 
@@ -270,23 +270,21 @@ export const useCustomHook = (props: any) => {
270
270
 
271
271
  executeRepositoryFolderRefresh().then(() => {
272
272
  console.log('refresh complete');
273
- })
274
- }
273
+ });
274
+ };
275
275
  ```
276
276
 
277
277
  **Props**
278
278
 
279
- | Name | Type | Description |
280
- | --------------------- | ------------------- | ---------------------------------------- |
281
- `item` | `Content` | Folder to be refreshed
282
-
283
-
279
+ | Name | Type | Description |
280
+ | ------ | --------- | ---------------------- |
281
+ | `item` | `Content` | Folder to be refreshed |
284
282
 
285
283
  **Return**
286
- | Name | Type | Description |
287
- | :-------------------- | :------------------ | :--------------------------------------- |
288
- `execute` | `() => Promise<Content>` | By calling this function you will refresh folder content, promise will be resolved when the data fetching is completed.
289
284
 
285
+ | Name | Type | Description |
286
+ | :-------- | :----------------------- | :---------------------------------------------------------------------------------------------------------------------- |
287
+ | `execute` | `() => Promise<Content>` | By calling this function you will refresh folder content, promise will be resolved when the data fetching is completed. |
290
288
 
291
289
  ## useRepositoryObjectDetailsRefresh
292
290
 
@@ -298,23 +296,23 @@ Hook to refresh current details view
298
296
  export const useCustomHook = (props: any) => {
299
297
  const { execute } = useRepositoryObjectDetailsRefresh();
300
298
 
301
- execute().then(() => { console.log('refresh complete') })
302
- }
299
+ execute().then(() => {
300
+ console.log('refresh complete');
301
+ });
302
+ };
303
303
  ```
304
304
 
305
305
  **Props**
306
306
 
307
- | Name | Type | Description |
308
- | --------------------- | ------------------- | ---------------------------------------- |
309
- **none**
310
-
311
-
307
+ | Name | Type | Description |
308
+ | -------- | ---- | ----------- |
309
+ | **none** |
312
310
 
313
311
  **Return**
314
- | Name | Type | Description |
315
- | :-------------------- | :------------------ | :--------------------------------------- |
316
- `execute` | `() => Promise<Content>` | By calling this function you will refresh details view, promise will be resolved when the data fetching is completed.
317
312
 
313
+ | Name | Type | Description |
314
+ | :-------- | :----------------------- | :-------------------------------------------------------------------------------------------------------------------- |
315
+ | `execute` | `() => Promise<Content>` | By calling this function you will refresh details view, promise will be resolved when the data fetching is completed. |
318
316
 
319
317
  ## useRepositoryObjectRefresh
320
318
 
@@ -326,23 +324,23 @@ Hook to refresh content of the provided item
326
324
  export const useCustomHook = (props: any) => {
327
325
  const { execute } = useRepositoryObjectRefresh();
328
326
 
329
- execute().then(() => { console.log('refresh complete') })
330
- }
327
+ execute().then(() => {
328
+ console.log('refresh complete');
329
+ });
330
+ };
331
331
  ```
332
332
 
333
333
  **Props**
334
334
 
335
- | Name | Type | Description |
336
- | --------------------- | ------------------- | ---------------------------------------- |
337
- `item` | `Content` | Content item to be refreshed
338
-
339
-
335
+ | Name | Type | Description |
336
+ | ------ | --------- | ---------------------------- |
337
+ | `item` | `Content` | Content item to be refreshed |
340
338
 
341
339
  **Return**
342
- | Name | Type | Description |
343
- | :-------------------- | :------------------ | :--------------------------------------- |
344
- `execute` | `() => Promise<Content>` | By calling this function you will refresh content, promise will be resolved when the data fetching is completed.
345
340
 
341
+ | Name | Type | Description |
342
+ | :-------- | :----------------------- | :--------------------------------------------------------------------------------------------------------------- |
343
+ | `execute` | `() => Promise<Content>` | By calling this function you will refresh content, promise will be resolved when the data fetching is completed. |
346
344
 
347
345
  ## useUserProfile
348
346
 
@@ -368,16 +366,15 @@ export const CustomComponents = (props: any) => {
368
366
 
369
367
  **Props**
370
368
 
371
- | Name | Type | Description |
372
- | --------------------- | ------------------- | ---------------------------------------- |
373
- **none**
374
-
375
-
369
+ | Name | Type | Description |
370
+ | -------- | ---- | ----------- |
371
+ | **none** |
376
372
 
377
373
  **Return**
378
- | Name | Type | Description |
379
- | :-------------------- | :------------------ | :--------------------------------------- |
380
- `execute` | `() => UserInfo` | By calling this function you will get current logged user information. `userName`: User name, `displayName`: Display name, `uiLanguage`: Ui language of the user, `workingLanguage`: Working language, `privileges`: list of available privileges
374
+
375
+ | Name | Type | Description |
376
+ | :-------- | :--------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
377
+ | `execute` | `() => UserInfo` | By calling this function you will get current logged user information. `userName`: User name, `displayName`: Display name, `uiLanguage`: Ui language of the user, `workingLanguage`: Working language, `privileges`: list of available privileges |
381
378
 
382
379
  # Extension points
383
380
 
@@ -386,37 +383,35 @@ Organize Space of Tridion Docs supports several areas that can be extended and c
386
383
  To register your extension you need to call a builder function inside `initialize` method.
387
384
 
388
385
  ```typescript jsx
389
-
390
386
  const extensionModule: ExtensionModule = {
391
387
  runtimeInfo: packageJson,
392
388
  initializeGlobals,
393
389
  initialize: builder => {
394
390
  builder.objectInsight.addObjectInsightItem(() => ({
395
- //...
391
+ //...
396
392
  }));
397
393
 
398
394
  builder.action.addExplorerAction(() => ({
399
- //...
395
+ //...
400
396
  }));
401
397
 
402
398
  builder.header.addMainNavigationLink(() => ({
403
- //...
399
+ //...
404
400
  }));
405
401
 
406
402
  builder.header.addMainNavigationItem(() => ({
407
- //...
403
+ //...
408
404
  }));
409
405
  },
410
406
  };
411
-
412
-
413
407
  ```
414
408
 
415
409
  ## Header
416
- A header extension point is providing the ability to extend the main navigation and add a link button to the right side of the header
417
410
 
411
+ A header extension point is providing the ability to extend the main navigation and add a link button to the right side of the header
418
412
 
419
413
  ### mainNavigationItem
414
+
420
415
  Registration of new navigation items is required to call the builder function `builder.header.addMainNavigationItem`
421
416
 
422
417
  ```typescript jsx
@@ -437,14 +432,14 @@ Registration of new navigation items is required to call the builder function `b
437
432
 
438
433
  **Props**
439
434
 
440
- | Name | Type | Description |
441
- | --------------------- | ------------------- | ---------------------------------------- |
442
- `id` | `string` | Unique Id for menu item
443
- `title` | `string` | Menu item title
444
- `path` | `string` | Menu item path (should be unique)
445
- `position` | [`Position`](#positiontype) | Menu item relative position.
446
- `isVisible` | `({userProfile: UserInfo}) => boolean` | Function to determine if the menu item should be visible, it receives the current user and should return a boolean value (show/hide)
447
- `component` | `ComponentType` | Component that will be rendered
435
+ | Name | Type | Description |
436
+ | ----------- | -------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
437
+ | `id` | `string` | Unique Id for menu item |
438
+ | `title` | `string` | Menu item title |
439
+ | `path` | `string` | Menu item path (should be unique) |
440
+ | `position` | [`Position`](#positiontype) | Menu item relative position. |
441
+ | `isVisible` | `({userProfile: UserInfo}) => boolean` | Function to determine if the menu item should be visible, it receives the current user and should return a boolean value (show/hide) |
442
+ | `component` | `ComponentType` | Component that will be rendered |
448
443
 
449
444
  ### mainNavigationLink
450
445
 
@@ -457,7 +452,7 @@ builder.header.addMainNavigationLink(() => ({
457
452
  tooltip: '',
458
453
  popupProperties: {
459
454
  width: '600px',
460
- height: '600px'
455
+ height: '600px',
461
456
  },
462
457
 
463
458
  isVisible: () => {
@@ -470,29 +465,28 @@ builder.header.addMainNavigationLink(() => ({
470
465
 
471
466
  **Props**
472
467
 
473
- | Name | Type | Description |
474
- | --------------------- | ------------------- | ---------------------------------------- |
475
- `id` | `string` | Unique Id for navigation link used by system to identify it
476
- `title` | `string` | Title of navigation link that will be visible on UI
477
- `tooltip` | `string` | Tooltip of navigation link that will be visible on mouse hover
478
- `popupProperties` | `{ width: string, height: string }` | Configuration for popup
479
- `isVisible` | `({userProfile: UserInfo}) => boolean` | Function to determine if the menu item should be visible, it receives the current user and should return a boolean value (show/hide)
480
- `icon` | `ComponentType` | Component that will be rendered in place of the icon
481
- `component` | `ComponentType` | Component that will be rendered after mouse click
468
+ | Name | Type | Description |
469
+ | ----------------- | -------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
470
+ | `id` | `string` | Unique Id for navigation link used by system to identify it |
471
+ | `title` | `string` | Title of navigation link that will be visible on UI |
472
+ | `tooltip` | `string` | Tooltip of navigation link that will be visible on mouse hover |
473
+ | `popupProperties` | `{ width: string, height: string }` | Configuration for popup |
474
+ | `isVisible` | `({userProfile: UserInfo}) => boolean` | Function to determine if the menu item should be visible, it receives the current user and should return a boolean value (show/hide) |
475
+ | `icon` | `ComponentType` | Component that will be rendered in place of the icon |
476
+ | `component` | `ComponentType` | Component that will be rendered after mouse click |
482
477
 
483
478
  ## Action
479
+
484
480
  Custom action button that might be used for executing custom logic for selected items. Registration of new navigation items is required to call the builder function `builder.header.builder.action.addExplorerAction`.
485
481
 
486
482
  `addExplorerAction` supports generic type definition, so we specify expected selected object type [more about generics](#generic-types).
487
483
 
488
-
489
484
  ```typescript jsx
490
-
491
485
  builder.action.addExplorerAction(() => ({
492
486
  id: 'id',
493
487
  title: 'title',
494
488
  tooltip: '',
495
- isVisible: (props) => {
489
+ isVisible: props => {
496
490
  return true;
497
491
  },
498
492
  icon: CustomIcon,
@@ -515,24 +509,26 @@ builder.action.addExplorerAction<Project>(() => ({
515
509
 
516
510
  **Props**
517
511
 
518
- | Name | Type | Description |
519
- | --------------------- | ------------------- | ---------------------------------------- |
520
- `id` | `string` | Unique Id for action button used by system to identify it
521
- `title` | `string` | Title of navigation action button will be visible on UI
522
- `tooltip` | `string` | Tooltip of action button that will be visible on mouse hover
523
- `isVisible` | `({activeView: ViewType, userProfile: UserInfo}) => boolean` | Function to determine if the action button should be visible, it receives the current user and should return a boolean value (show/hide)
524
- `icon` | `ComponentType` | Component that will be rendered in place of the icon
525
- `hook` | `function` | Hook that will be used for this action.
512
+ | Name | Type | Description |
513
+ | ----------- | ------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------- |
514
+ | `id` | `string` | Unique Id for action button used by system to identify it |
515
+ | `title` | `string` | Title of navigation action button will be visible on UI |
516
+ | `tooltip` | `string` | Tooltip of action button that will be visible on mouse hover |
517
+ | `isVisible` | `({activeView: ViewType, userProfile: UserInfo}) => boolean` | Function to determine if the action button should be visible, it receives the current user and should return a boolean value (show/hide) |
518
+ | `icon` | `ComponentType` | Component that will be rendered in place of the icon |
519
+ | `hook` | `function` | Hook that will be used for this action. |
526
520
 
527
521
  ## Object Insight
522
+
528
523
  The object right side panel is representing a custom data view for one or multiple selected items. Registration of new object insight is required to call the builder function `builder.objectInsight.addObjectInsightItem`
529
524
 
530
525
  `addObjectInsightItem` supports generic type definition, so we specify expected selected object type [more about generics](#generic-types).
526
+
531
527
  ```typescript jsx
532
528
  builder.objectInsight.addObjectInsightItem(() => ({
533
529
  id: 'id',
534
530
  tooltip: 'tooltip',
535
- isVisible: (props) => {
531
+ isVisible: props => {
536
532
  return false;
537
533
  },
538
534
  icon: CustomIcon,
@@ -543,30 +539,28 @@ builder.objectInsight.addObjectInsightItem(() => ({
543
539
  builder.objectInsight.addObjectInsightItem<Project>(() => ({
544
540
  id: 'id',
545
541
  tooltip: 'tooltip',
546
- isVisible: (props) => {
542
+ isVisible: props => {
547
543
  return false;
548
544
  },
549
545
  icon: CustomIcon,
550
546
  component: CustomComponent,
551
547
  }));
552
-
553
548
  ```
554
549
 
555
-
556
550
  **Props**
557
551
 
558
- | Name | Type | Description |
559
- | --------------------- | ------------------- | ---------------------------------------- |
560
- `id` | `string` | Unique Id for insight panel used by system to identify it
561
- `tooltip` | `string` | Tooltip for insight panel that will be visible on mouse hover
562
- `isVisible` | `({activeView: ViewType, userProfile: UserInfo}) => boolean` | Function to determine if the panel should be visible, it receives the current user and should return a boolean value (show/hide)
563
- `icon` | `ComponentType` | Component that will be rendered in place of the icon
564
- `component` | `ComponentType` | Component that will be rendered after mouse click
565
-
552
+ | Name | Type | Description |
553
+ | ----------- | ------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------- |
554
+ | `id` | `string` | Unique Id for insight panel used by system to identify it |
555
+ | `tooltip` | `string` | Tooltip for insight panel that will be visible on mouse hover |
556
+ | `isVisible` | `({activeView: ViewType, userProfile: UserInfo}) => boolean` | Function to determine if the panel should be visible, it receives the current user and should return a boolean value (show/hide) |
557
+ | `icon` | `ComponentType` | Component that will be rendered in place of the icon |
558
+ | `component` | `ComponentType` | Component that will be rendered after mouse click |
566
559
 
567
560
  ## Types Explanations
568
561
 
569
562
  ### PositionType
563
+
570
564
  ```js
571
565
  {
572
566
  item: 'settings',
@@ -574,53 +568,55 @@ builder.objectInsight.addObjectInsightItem<Project>(() => ({
574
568
  }
575
569
  ```
576
570
 
577
- | Name | Type | Description |
578
- | --------------------- | ------------------- | ---------------------------------------- |
579
- `item` | `string` | Id of the navigation item that will be used for positioning. Default navigation items ('content', 'events', 'settings'), also you can use a previously added custom navigation items id
580
- `PositioningType` | `PositioningType`| `string` | Indicate where should be located navigation item relative to previously selected item (`after` or `before`)
571
+ | Name | Type | Description |
572
+ | ----------------- | ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
573
+ | `item` | `string` | Id of the navigation item that will be used for positioning. Default navigation items ('content', 'events', 'settings'), also you can use a previously added custom navigation items id |
574
+ | `PositioningType` | `PositioningType` | `string` | Indicate where should be located navigation item relative to previously selected item (`after` or `before`) |
581
575
 
582
576
  ### Generic types
577
+
583
578
  As far as we're supporting extensions in different areas like Publication Hub and Content Explorer hooks or components will operate with different types of input parameters. It doesn't not affect the API of the function but it will affect the types of arguments. For example, if we define action in Project or Project assignees in "Publication hub" we will get a `Project` type object instead of `Content` type. To support this case we introduced a generic type for some of the functions like `addExplorerAction` where you may specify the expected type of the active objects.
584
579
 
585
580
  The default type is `Content`. That means `addExplorerAction<Content>()` and `addExplorerAction()` are equal code blocks.
586
581
 
587
582
  [More about typescript generics](https://www.typescriptlang.org/docs/handbook/2/generics.html)
588
583
 
589
-
590
584
  ## Translations
585
+
591
586
  Translation records can be registered per language by using the function `builder.translations.addTranslation`
592
587
 
593
588
  ```typescript jsx
594
- builder.translations.addTranslation('en', {
595
- key: 'EN Value',
596
- });
589
+ builder.translations.addTranslation('en', {
590
+ key: 'EN Value',
591
+ });
597
592
 
598
- builder.translations.addTranslation('es', {
599
- key: 'ES Value',
600
- });
593
+ builder.translations.addTranslation('es', {
594
+ key: 'ES Value',
595
+ });
601
596
 
602
- //....
597
+ //....
603
598
  ```
604
599
 
605
-
606
600
  ### Usage
607
- Import ```t``` function returned by ```createExtensionGlobals``` and pass it the translation key.
601
+
602
+ Import `t` function returned by `createExtensionGlobals` and pass it the translation key.
608
603
 
609
604
  ```typescript jsx
610
- `Hello in, {t('key')}`
605
+ `Hello in, {t('key')}`;
611
606
  ```
612
607
 
613
608
  ### Supported language
614
- | Name | Code |
615
- |----------------------|---------------------|
616
- | English | `en` |
617
- | Deutsch | `de` |
618
- | Spanish | `es` |
619
- | French | `fr` |
620
- | French (Canada) | `fr-CA` |
621
- | Italian | `it` |
622
- | Japanese | `ja` |
623
- | Chinese (Simplified) | `zh` |
609
+
610
+ | Name | Code |
611
+ | -------------------- | ------- |
612
+ | English | `en` |
613
+ | Deutsch | `de` |
614
+ | Spanish | `es` |
615
+ | French | `fr` |
616
+ | French (Canada) | `fr-CA` |
617
+ | Italian | `it` |
618
+ | Japanese | `ja` |
619
+ | Chinese (Simplified) | `zh` |
624
620
 
625
621
  # Generate open api typescript client from the swagger
626
622
 
@@ -695,11 +691,12 @@ const client = new Client(baseUrl);
695
691
  ```
696
692
 
697
693
  # FAQ
694
+
698
695
  **I want to use [useItemSelector](#useitemselector) inside [Antd Modal](https://ant.design/components/modal) component but I can't see popups and filters in item selector.**
699
696
 
700
697
  This is a known issue caused by mixing two different UI frameworks. To resolve this issue, there are two approaches:
701
698
 
702
- *Preferable way*
699
+ _Preferable way_
703
700
 
704
701
  Reset the zIndex property for the Antd Modal and specify a custom container that positions it correctly relative to the ItemSelector.
705
702
 
@@ -715,7 +712,7 @@ Reset the zIndex property for the Antd Modal and specify a custom container that
715
712
  getContainer={popupContainer}
716
713
  ```
717
714
 
718
- *Complete page example*
715
+ _Complete page example_
719
716
 
720
717
  ```js
721
718
  import { Content, DocumentObjectType, useItemSelector } from '@tridion-docs/extensions';
@@ -763,7 +760,7 @@ export const CustomPage = () => {
763
760
  };
764
761
  ```
765
762
 
766
- *Alternative way*
763
+ _Alternative way_
767
764
 
768
765
  If you prefer a simpler fix, you can use CSS to globally adjust the z-index for popups. However, this may cause issues with other components and is less reliable across different library versions.
769
766
 
@@ -810,20 +807,16 @@ export const CustomPage = () => {
810
807
 
811
808
  ```
812
809
 
813
-
814
810
  ```css
815
811
  /* CustomPage.module.css */
816
812
 
817
- div[data-test~='popup'] {
813
+ div[data-test~="popup"] {
818
814
  z-index: 9999;
819
815
  }
820
816
 
821
- body > div > div[class*='ant-select-dropdown'] {
817
+ body > div > div[class*="ant-select-dropdown"] {
822
818
  z-index: 10000;
823
819
  }
824
820
  ```
825
821
 
826
-
827
-
828
- *Note:* This solution applies globally, affecting all popups on the page. It is not guaranteed to work consistently across future releases, as the CSS selector may change.
829
-
822
+ _Note:_ This solution applies globally, affecting all popups on the page. It is not guaranteed to work consistently across future releases, as the CSS selector may change.
@@ -1,9 +1,9 @@
1
- const version = "2.1.4";
1
+ const version = "2.1.6";
2
2
  const peerDependencies = {
3
3
  react: "18.3.1",
4
4
  "react-dom": "18.3.1",
5
5
  "react-is": "18.3.1",
6
- "styled-components": "^6.3"
6
+ "styled-components": "6.3.11"
7
7
  };
8
8
 
9
9
  export { peerDependencies, version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tridion-docs/extensions",
3
- "version": "2.1.4",
3
+ "version": "2.1.6",
4
4
  "description": "Tridion Docs Extensions API",
5
5
  "author": "RWS Group for and on behalf of its affiliates and subsidiaries",
6
6
  "license": "SEE LICENSE IN LICENSE.md",
@@ -31,7 +31,12 @@
31
31
  "react": "18.3.1",
32
32
  "react-dom": "18.3.1",
33
33
  "react-is": "18.3.1",
34
- "styled-components": "^6.3"
34
+ "styled-components": "6.3.11"
35
+ },
36
+ "peerDependenciesMeta": {
37
+ "styled-components": {
38
+ "optional": true
39
+ }
35
40
  },
36
41
  "devDependencies": {
37
42
  "@rollup/plugin-commonjs": "29.0.0",
@@ -48,7 +53,6 @@
48
53
  "rollup": "4.57.1",
49
54
  "rollup-plugin-delete": "3.0.2",
50
55
  "rollup-plugin-node-externals": "8.1.2",
51
- "styled-components": "6.3.11",
52
56
  "typescript": "5.9.3",
53
57
  "typescript-transform-paths": "3.5.6"
54
58
  }