@atlaskit/editor-common 71.0.2 → 72.0.0

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.
Files changed (130) hide show
  1. package/CHANGELOG.md +77 -0
  2. package/dist/cjs/analytics/types/enums.js +20 -1
  3. package/dist/cjs/i18n/index.js +13 -5
  4. package/dist/cjs/i18n/languages.js +42 -0
  5. package/dist/cjs/keymaps/index.js +55 -3
  6. package/dist/cjs/styles/index.js +8 -2
  7. package/dist/cjs/styles/shared/annotation.js +4 -7
  8. package/dist/cjs/styles/shared/block-marks.js +1 -1
  9. package/dist/cjs/styles/shared/code-block.js +3 -4
  10. package/dist/cjs/styles/shared/lists.js +55 -4
  11. package/dist/cjs/styles/shared/panel.js +6 -12
  12. package/dist/cjs/styles/shared/shadow.js +3 -1
  13. package/dist/cjs/styles/shared/table.js +2 -2
  14. package/dist/cjs/types/next-editor-plugin.js +5 -0
  15. package/dist/cjs/ui/DropList/index.js +1 -1
  16. package/dist/cjs/ui/Emoji/index.js +11 -2
  17. package/dist/cjs/ui/Popup/index.js +72 -2
  18. package/dist/cjs/ui/Popup/utils.js +13 -6
  19. package/dist/cjs/ui/UnsupportedBlock/index.js +2 -2
  20. package/dist/cjs/ui/UnsupportedInline/index.js +2 -2
  21. package/dist/cjs/ui-color/ColorPalette/Palettes/paletteMessagesTokenModeNames.js +138 -0
  22. package/dist/cjs/ui-color/ColorPalette/index.js +19 -1
  23. package/dist/cjs/ui-menu/DropdownMenu/index.js +2 -0
  24. package/dist/cjs/ui-menu/ToolbarButton/index.js +3 -1
  25. package/dist/cjs/utils/analytics.js +1 -38
  26. package/dist/cjs/utils/builder.js +44 -0
  27. package/dist/cjs/utils/compareNodes.js +86 -33
  28. package/dist/cjs/utils/index.js +47 -1
  29. package/dist/cjs/utils/list.js +47 -0
  30. package/dist/cjs/utils/plugin-state-factory.js +9 -9
  31. package/dist/cjs/utils/referentiality.js +281 -2
  32. package/dist/cjs/utils/track-unsupported-content.js +19 -20
  33. package/dist/cjs/utils/validate-using-spec.js +8 -2
  34. package/dist/cjs/version.json +1 -1
  35. package/dist/es2019/analytics/types/enums.js +20 -1
  36. package/dist/es2019/i18n/index.js +4 -3
  37. package/dist/es2019/i18n/languages.js +34 -0
  38. package/dist/es2019/keymaps/index.js +47 -0
  39. package/dist/es2019/styles/index.js +1 -1
  40. package/dist/es2019/styles/shared/annotation.js +4 -7
  41. package/dist/es2019/styles/shared/block-marks.js +8 -1
  42. package/dist/es2019/styles/shared/code-block.js +7 -6
  43. package/dist/es2019/styles/shared/lists.js +44 -2
  44. package/dist/es2019/styles/shared/panel.js +6 -11
  45. package/dist/es2019/styles/shared/shadow.js +21 -6
  46. package/dist/es2019/styles/shared/table.js +2 -3
  47. package/dist/es2019/types/next-editor-plugin.js +1 -0
  48. package/dist/es2019/ui/DropList/index.js +1 -1
  49. package/dist/es2019/ui/Emoji/index.js +11 -2
  50. package/dist/es2019/ui/Popup/index.js +68 -2
  51. package/dist/es2019/ui/Popup/utils.js +13 -6
  52. package/dist/es2019/ui/UnsupportedBlock/index.js +1 -1
  53. package/dist/es2019/ui/UnsupportedInline/index.js +1 -1
  54. package/dist/es2019/ui-color/ColorPalette/Palettes/paletteMessagesTokenModeNames.js +120 -0
  55. package/dist/es2019/ui-color/ColorPalette/index.js +28 -12
  56. package/dist/es2019/ui-menu/DropdownMenu/index.js +2 -0
  57. package/dist/es2019/ui-menu/ToolbarButton/index.js +3 -1
  58. package/dist/es2019/utils/analytics.js +0 -33
  59. package/dist/es2019/utils/builder.js +16 -0
  60. package/dist/es2019/utils/compareNodes.js +79 -28
  61. package/dist/es2019/utils/index.js +4 -2
  62. package/dist/es2019/utils/list.js +31 -0
  63. package/dist/es2019/utils/plugin-state-factory.js +9 -9
  64. package/dist/es2019/utils/referentiality.js +240 -0
  65. package/dist/es2019/utils/track-unsupported-content.js +20 -16
  66. package/dist/es2019/utils/validate-using-spec.js +8 -2
  67. package/dist/es2019/version.json +1 -1
  68. package/dist/esm/analytics/types/enums.js +20 -1
  69. package/dist/esm/i18n/index.js +4 -3
  70. package/dist/esm/i18n/languages.js +34 -0
  71. package/dist/esm/keymaps/index.js +48 -0
  72. package/dist/esm/styles/index.js +1 -1
  73. package/dist/esm/styles/shared/annotation.js +4 -7
  74. package/dist/esm/styles/shared/block-marks.js +1 -1
  75. package/dist/esm/styles/shared/code-block.js +3 -4
  76. package/dist/esm/styles/shared/lists.js +49 -2
  77. package/dist/esm/styles/shared/panel.js +6 -11
  78. package/dist/esm/styles/shared/shadow.js +2 -2
  79. package/dist/esm/styles/shared/table.js +2 -3
  80. package/dist/esm/types/next-editor-plugin.js +1 -0
  81. package/dist/esm/ui/DropList/index.js +1 -1
  82. package/dist/esm/ui/Emoji/index.js +11 -2
  83. package/dist/esm/ui/Popup/index.js +73 -2
  84. package/dist/esm/ui/Popup/utils.js +13 -6
  85. package/dist/esm/ui/UnsupportedBlock/index.js +1 -1
  86. package/dist/esm/ui/UnsupportedInline/index.js +1 -1
  87. package/dist/esm/ui-color/ColorPalette/Palettes/paletteMessagesTokenModeNames.js +124 -0
  88. package/dist/esm/ui-color/ColorPalette/index.js +18 -2
  89. package/dist/esm/ui-menu/DropdownMenu/index.js +2 -0
  90. package/dist/esm/ui-menu/ToolbarButton/index.js +3 -1
  91. package/dist/esm/utils/analytics.js +0 -33
  92. package/dist/esm/utils/builder.js +30 -0
  93. package/dist/esm/utils/compareNodes.js +83 -32
  94. package/dist/esm/utils/index.js +4 -2
  95. package/dist/esm/utils/list.js +31 -0
  96. package/dist/esm/utils/plugin-state-factory.js +9 -9
  97. package/dist/esm/utils/referentiality.js +269 -0
  98. package/dist/esm/utils/track-unsupported-content.js +19 -20
  99. package/dist/esm/utils/validate-using-spec.js +8 -2
  100. package/dist/esm/version.json +1 -1
  101. package/dist/types/analytics/types/enums.d.ts +23 -4
  102. package/dist/types/collab/types.d.ts +1 -1
  103. package/dist/types/i18n/index.d.ts +4 -3
  104. package/dist/types/i18n/languages.d.ts +35 -0
  105. package/dist/types/keymaps/index.d.ts +1 -0
  106. package/dist/types/styles/index.d.ts +1 -1
  107. package/dist/types/styles/shared/lists.d.ts +3 -1
  108. package/dist/types/types/collab.d.ts +1 -1
  109. package/dist/types/types/copy-button.d.ts +4 -0
  110. package/dist/types/types/feature-flags.d.ts +30 -25
  111. package/dist/types/types/floating-toolbar.d.ts +26 -1
  112. package/dist/types/types/index.d.ts +2 -1
  113. package/dist/types/types/next-editor-plugin.d.ts +61 -0
  114. package/dist/types/ui/Emoji/index.d.ts +2 -0
  115. package/dist/types/ui/Popup/index.d.ts +19 -0
  116. package/dist/types/ui/Popup/utils.d.ts +3 -3
  117. package/dist/types/ui-color/ColorPalette/Palettes/paletteMessagesTokenModeNames.d.ts +214 -0
  118. package/dist/types/ui-color/ColorPalette/index.d.ts +7 -0
  119. package/dist/types/ui-menu/DropdownMenu/types.d.ts +1 -0
  120. package/dist/types/ui-menu/ToolbarButton/index.d.ts +3 -1
  121. package/dist/types/utils/analytics.d.ts +1 -21
  122. package/dist/types/utils/builder.d.ts +8 -0
  123. package/dist/types/utils/compareNodes.d.ts +16 -0
  124. package/dist/types/utils/index.d.ts +3 -1
  125. package/dist/types/utils/list.d.ts +10 -0
  126. package/dist/types/utils/plugin-state-factory.d.ts +1 -1
  127. package/dist/types/utils/referentiality.d.ts +4 -0
  128. package/dist/types/utils/track-unsupported-content.d.ts +14 -2
  129. package/package.json +15 -12
  130. package/report.api.md +1 -1
@@ -1,6 +1,6 @@
1
1
  import { validator } from '@atlaskit/adf-utils/validator';
2
+ import { ACTION_SUBJECT_ID } from '../analytics';
2
3
  export var UNSUPPORTED_NODE_ATTRIBUTE = 'unsupportedNodeAttribute';
3
- import { ACTION_SUBJECT_ID } from './analytics';
4
4
  import { fireUnsupportedEvent } from './track-unsupported-content';
5
5
 
6
6
  var errorCallbackFor = function errorCallbackFor(marks, validate, dispatchAnalyticsEvent) {
@@ -106,7 +106,13 @@ function trackValidationError(dispatchAnalyticsEvent, error, entity) {
106
106
  return;
107
107
  }
108
108
 
109
- fireUnsupportedEvent(dispatchAnalyticsEvent, ACTION_SUBJECT_ID.UNSUPPORTED_ERROR, entity, error.code);
109
+ fireUnsupportedEvent(dispatchAnalyticsEvent, ACTION_SUBJECT_ID.UNSUPPORTED_ERROR, {
110
+ type: entity.type || '',
111
+ ancestry: entity.ancestorHierarchy || '',
112
+ parentType: entity.parentType || '',
113
+ marks: entity.marks || [],
114
+ attrs: entity.attrs || {}
115
+ }, error.code);
110
116
  }
111
117
 
112
118
  export var validateADFEntity = function validateADFEntity(schema, node, dispatchAnalyticsEvent) {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "71.0.2",
3
+ "version": "72.0.0",
4
4
  "sideEffects": false
5
5
  }
@@ -99,7 +99,7 @@ export declare enum ACTION {
99
99
  TYPING_FINISHED = "typingFinished",
100
100
  TYPING_STARTED = "typingStarted",
101
101
  UNLINK = "unlinked",
102
- UNSUPPORTED_CONTENT_ENCOUNTERED = "unsupportedContentEncountered",
102
+ UNSUPPORTED_CONTENT_ENCOUNTERED = "unsupportedContentEncounteredV2",
103
103
  UPDATED = "updated",
104
104
  /** used in @atlassian/editor-referentiality */
105
105
  UPDATED_FRAGMENT_MARK_NAME = "updatedFragmentMarkName",
@@ -118,7 +118,17 @@ export declare enum ACTION {
118
118
  REMOVE_ICON = "removedIcon",
119
119
  UFO_SESSION_COMPLETE = "ufoSessionComplete",
120
120
  INVALID_PROSEMIRROR_DOCUMENT = "invalidProsemirrorDocument",
121
- DOCUMENT_PROCESSING_ERROR = "documentProcessingError"
121
+ DOCUMENT_PROCESSING_ERROR = "documentProcessingError",
122
+ RENDERER_TTI = "tti",
123
+ CRASHED = "unhandledErrorCaught",
124
+ SELECT_ALL_CAUGHT = "selectAllCaught",
125
+ SELECT_ALL_ESCAPED = "selectAllEscaped",
126
+ SORT_COLUMN = "sortedColumn",
127
+ SORT_COLUMN_NOT_ALLOWED = "sortColumnNotAllowed",
128
+ CREATE_NOT_ALLOWED = "createNotAllowed",
129
+ UNSUPPORTED_CONTENT_LEVELS_TRACKING_SUCCEEDED = "unsupportedContentLevelsTrackingSucceeded",
130
+ UNSUPPORTED_CONTENT_LEVELS_TRACKING_ERRORED = "unsupportedContentLevelsTrackingErrored",
131
+ UNSUPPORTED_TOOLTIP_VIEWED = "viewed"
122
132
  }
123
133
  export declare enum INPUT_METHOD {
124
134
  ASCII = "ascii",
@@ -195,7 +205,11 @@ export declare enum ACTION_SUBJECT {
195
205
  SEARCH_RESULT = "searchResult",
196
206
  CREATE_LINK_INLINE_DIALOG = "createLinkInlineDialog",
197
207
  CODE_BLOCK = "codeBlock",
198
- REACT_EDITOR_VIEW = "reactEditorView"
208
+ REACT_EDITOR_VIEW = "reactEditorView",
209
+ RENDERER = "renderer",
210
+ ANCHOR_LINK = "anchorLink",
211
+ LINK = "link",
212
+ TOOLTIP = "tooltip"
199
213
  }
200
214
  export declare enum ACTION_SUBJECT_ID {
201
215
  ACTION = "action",
@@ -310,9 +324,14 @@ export declare enum ACTION_SUBJECT_ID {
310
324
  TYPEAHEAD_QUICK_INSERT = "quickInsertTypeAhead",
311
325
  UNKNOWN_NODE = "unknownNode",
312
326
  UNLINK = "unlink",
327
+ HEADING_ANCHOR_LINK = "headingAnchorLink",
328
+ UNSUPPORTED_ERROR = "unsupportedUnhandled",
329
+ UNSUPPORTED_NODE_ATTRIBUTE = "unsupportedNodeAttribute",
313
330
  UNSUPPORTED_BLOCK = "unsupportedBlock",
314
331
  UNSUPPORTED_INLINE = "unsupportedInline",
315
- UNSUPPORTED_MARK = "unsupportedMark"
332
+ UNSUPPORTED_MARK = "unsupportedMark",
333
+ ON_UNSUPPORTED_INLINE = "onUnsupportedInline",
334
+ ON_UNSUPPORTED_BLOCK = "onUnsupportedBlock"
316
335
  }
317
336
  export declare enum FLOATING_CONTROLS_TITLE {
318
337
  CODE_BLOCK = "codeBlockFloatingControls",
@@ -20,7 +20,7 @@ export interface CollabEventInitData {
20
20
  export interface CollabEventRemoteData {
21
21
  json?: any;
22
22
  newState?: EditorState;
23
- userIds?: string[];
23
+ userIds?: (number | string)[];
24
24
  }
25
25
  export interface CollabEventConnectionData {
26
26
  sid: string;
@@ -1,15 +1,16 @@
1
1
  /**
2
2
  * NOTE:
3
3
  *
4
- * This file is automatically generated by i18n-tools.
5
- * DO NOT CHANGE IT BY HAND or your changes will be lost.
4
+ * ED-16073:
5
+ * This was manually updated since the original `@atlaskit/i18n-tools` has been deprecated
6
6
  */
7
7
  export { default as zh } from './zh';
8
8
  export { default as zh_TW } from './zh_TW';
9
9
  export { default as cs } from './cs';
10
10
  export { default as da } from './da';
11
11
  export { default as nl } from './nl';
12
- export { default as et } from './et';
12
+ export { default as en } from './en';
13
+ export { default as en_GB } from './en_GB';
13
14
  export { default as fi } from './fi';
14
15
  export { default as fr } from './fr';
15
16
  export { default as de } from './de';
@@ -0,0 +1,35 @@
1
+ declare const _default: {
2
+ zh: string;
3
+ zh_TW: string;
4
+ cs: string;
5
+ da: string;
6
+ nl: string;
7
+ en: string;
8
+ en_GB: string;
9
+ fi: string;
10
+ fr: string;
11
+ de: string;
12
+ hu: string;
13
+ it: string;
14
+ ja: string;
15
+ ko: string;
16
+ nb: string;
17
+ pl: string;
18
+ pt_BR: string;
19
+ pt_PT: string;
20
+ ru: string;
21
+ sk: string;
22
+ es: string;
23
+ sv: string;
24
+ th: string;
25
+ tr: string;
26
+ uk: string;
27
+ vi: string;
28
+ };
29
+ /**
30
+ * NOTE:
31
+ *
32
+ * ED-16073:
33
+ * This was manually updated since the original `@atlaskit/i18n-tools` has been deprecated
34
+ */
35
+ export default _default;
@@ -73,6 +73,7 @@ export declare const ToolTipContent: React.MemoExoticComponent<({ description, s
73
73
  export declare function findKeymapByDescription(description: string): Keymap | undefined;
74
74
  export declare function findShortcutByDescription(description: string): string | undefined;
75
75
  export declare function findShortcutByKeymap(keymap: Keymap): string | undefined;
76
+ export declare function getAriaKeyshortcuts(keymap: Keymap | string | undefined): string | undefined;
76
77
  export declare function makeKeymap(description: string, windows: string, mac: string, common?: string): Keymap;
77
78
  export declare function makeKeyMapWithCommon(description: string, common: string): Keymap;
78
79
  export interface Keymap {
@@ -9,7 +9,7 @@ export { ruleSharedStyles } from './shared/rule';
9
9
  export { whitespaceSharedStyles } from './shared/whitespace';
10
10
  export { paragraphSharedStyles } from './shared/paragraph';
11
11
  export { linkSharedStyle } from './shared/link';
12
- export { listsSharedStyles, listPaddingLeftMarkerSpace } from './shared/lists';
12
+ export { listsSharedStyles, listItemCounterPadding, getOrderedListInlineStyles, } from './shared/lists';
13
13
  export { indentationSharedStyles } from './shared/indentation';
14
14
  export { blockMarksSharedStyles } from './shared/block-marks';
15
15
  export { codeMarkSharedStyles } from './shared/code-mark';
@@ -1,2 +1,4 @@
1
- export declare const listPaddingLeftMarkerSpace = 24;
1
+ export declare const listItemCounterPadding = 24;
2
+ export declare function getOrderedListInlineStyles(itemCounterDigitsSize: number, styleFormat: 'string'): string;
3
+ export declare function getOrderedListInlineStyles(itemCounterDigitsSize: number, styleFormat: 'object'): Record<string, any>;
2
4
  export declare const listsSharedStyles: import("@emotion/react").SerializedStyles;
@@ -2,7 +2,7 @@ export declare type NewCollabSyncUpErrorAttributes = {
2
2
  lengthOfUnconfirmedSteps?: number;
3
3
  tries: number;
4
4
  maxRetries: number;
5
- clientId?: string;
5
+ clientId?: number | string;
6
6
  version: number;
7
7
  };
8
8
  export declare type SyncUpErrorFunction = (attributes: NewCollabSyncUpErrorAttributes) => void;
@@ -9,6 +9,8 @@ export declare type MarkOptions = {
9
9
  markType: MarkType;
10
10
  onMouseEnter?: undefined;
11
11
  onMouseLeave?: undefined;
12
+ onFocus?: Command;
13
+ onBlur?: Command;
12
14
  };
13
15
  export declare type NodeOptions = {
14
16
  state: EditorState;
@@ -17,4 +19,6 @@ export declare type NodeOptions = {
17
19
  markType?: undefined;
18
20
  onMouseEnter?: Command;
19
21
  onMouseLeave?: Command;
22
+ onFocus?: Command;
23
+ onBlur?: Command;
20
24
  };
@@ -58,15 +58,6 @@ export declare type FeatureFlags = {
58
58
  * @default true
59
59
  */
60
60
  placeholderBracketHint?: boolean;
61
- /**
62
- * @description
63
- * Whether placeholder hints were provided (`string[] => boolean`)
64
- * Placeholder text values to display on new empty lines.
65
- *
66
- * @see https://product-fabric.atlassian.net/l/c/GG1Yv9cK
67
- * @default false
68
- */
69
- placeholderHints?: boolean;
70
61
  /**
71
62
  * @description
72
63
  * Enable additional text colours within the colour palette.
@@ -99,15 +90,6 @@ export declare type FeatureFlags = {
99
90
  * @default false
100
91
  */
101
92
  extensionLocalIdGeneration?: boolean;
102
- /**
103
- * @description
104
- * Enable date picker which has a textbox for internationalised keyboard date
105
- * input.
106
- *
107
- * @see https://product-fabric.atlassian.net/browse/ED-8928
108
- * @default false
109
- */
110
- keyboardAccessibleDatepicker?: boolean;
111
93
  /**
112
94
  * @description
113
95
  * Enable add column custom step
@@ -264,13 +246,6 @@ export declare type FeatureFlags = {
264
246
  * @default false
265
247
  */
266
248
  tableCellOptionsInFloatingToolbar?: boolean;
267
- /**
268
- * Number to distinguish between which different toolbar is being displayed
269
- * as part of the smart link view changing experiment run by the Linking Platform.
270
- * @see https://product-fabric.atlassian.net/browse/EDM-2640
271
- * @default null
272
- */
273
- viewChangingExperimentToolbarStyle?: string;
274
249
  /**
275
250
  * @description
276
251
  * Enable display of a preview modal on mouse over of inline smart card
@@ -324,6 +299,16 @@ export declare type FeatureFlags = {
324
299
  * @default false
325
300
  */
326
301
  lpLinkPicker?: boolean;
302
+ /**
303
+ * @description
304
+ * Enables focus trap for the linking platform link picker
305
+ *
306
+ * @see https://product-fabric.atlassian.net/wiki/spaces/EM/pages/3158246501/PP+Link+Picker+-+Standalone
307
+ * @see https://product-fabric.atlassian.net/browse/EDM-2577
308
+ * @see https://product-fabric.atlassian.net/browse/EDM-4919
309
+ * @default false
310
+ */
311
+ lpLinkPickerFocusTrap?: boolean;
327
312
  /**
328
313
  * @description
329
314
  * Show link settings button in the Floating toolbar
@@ -360,6 +345,26 @@ export declare type FeatureFlags = {
360
345
  * @default false
361
346
  */
362
347
  restartNumberedListsToolbar?: boolean;
348
+ /**
349
+ * @description
350
+ * Show semantic text color names in tooltips when hovering over colors in the text color picker.
351
+ * Note that this flag is called 'somewhat semantic' as the text color names for white/dark gray
352
+ * colors are not semantic.
353
+ *
354
+ * @see https://product-fabric.atlassian.net/wiki/spaces/EUXQ/pages/3365994869/EXTERNAL+MAKE+PP+COMMIT-5058+Enable+dark+mode+usage+of+text+colors+in+UGC+and+non+custom+panels+in+Jira
355
+ * @see https://product-fabric.atlassian.net/browse/ED-16176
356
+ * @default false
357
+ */
358
+ useSomewhatSemanticTextColorNames?: boolean;
359
+ /**
360
+ * @description
361
+ * Force the Popup placement if the space does not accomodate the Popup fitHeight
362
+ *
363
+ * @see https://product-fabric.atlassian.net/wiki/spaces/EM/pages/3158246501/PP+Link+Picker+-+Standalone
364
+ * @see https://product-fabric.atlassian.net/browse/EDM-2577
365
+ * @default false
366
+ */
367
+ preventPopupOverflow?: boolean;
363
368
  };
364
369
  export declare type FeatureFlagKey = keyof FeatureFlags;
365
370
  export declare type GetEditorFeatureFlags = () => FeatureFlags;
@@ -20,6 +20,8 @@ export interface DropdownOptionT<T> {
20
20
  onMouseOver?: T;
21
21
  onMouseEnter?: T;
22
22
  onMouseLeave?: T;
23
+ onFocus?: T;
24
+ onBlur?: T;
23
25
  selected?: boolean;
24
26
  disabled?: boolean;
25
27
  hidden?: boolean;
@@ -52,12 +54,28 @@ interface Position {
52
54
  bottom?: number;
53
55
  left?: number;
54
56
  }
57
+ export declare type ConfirmDialogChildInfo = {
58
+ id: string;
59
+ name: string;
60
+ amount: number;
61
+ };
55
62
  export interface ConfirmDialogOptions {
56
63
  title?: string;
57
64
  message: string;
58
65
  okButtonLabel?: string;
59
66
  cancelButtonLabel?: string;
67
+ isReferentialityDialog?: boolean;
68
+ checkboxLabel?: string;
69
+ messagePrefix?: string;
70
+ getChildrenInfo?: () => ConfirmDialogChildInfo[];
71
+ onConfirm?: (...args: any[]) => Command;
60
72
  }
73
+ export declare type ConfirmationDialogProps = {
74
+ onConfirm: (isCheck?: boolean) => void;
75
+ onClose: () => void;
76
+ options?: ConfirmDialogOptions;
77
+ testId?: string;
78
+ };
61
79
  export declare type FloatingToolbarCopyButton = {
62
80
  type: 'copy-button';
63
81
  items: Array<FloatingToolbarSeparator | MarkOptions | NodeOptions>;
@@ -84,12 +102,13 @@ export declare type FloatingToolbarButton<T> = {
84
102
  tooltipContent?: React.ReactNode;
85
103
  testId?: string;
86
104
  hideTooltipOnClick?: boolean;
87
- confirmDialog?: ConfirmDialogOptions;
105
+ confirmDialog?: ConfirmDialogOptions | (() => ConfirmDialogOptions);
88
106
  metadata?: {
89
107
  [key: string]: string;
90
108
  };
91
109
  ariaHasPopup?: boolean | 'dialog' | 'menu' | 'listbox' | 'tree' | 'grid' | undefined;
92
110
  tabIndex?: number | null | undefined;
111
+ focusEditoronEnter?: boolean;
93
112
  };
94
113
  export declare type FloatingToolbarInput<T> = {
95
114
  id: string;
@@ -153,6 +172,7 @@ export declare type FloatingToolbarSeparator = {
153
172
  hidden?: boolean;
154
173
  };
155
174
  export declare type FloatingToolbarDropdown<T> = {
175
+ testId?: string;
156
176
  id?: string;
157
177
  type: 'dropdown';
158
178
  title: string;
@@ -206,6 +226,11 @@ export interface FloatingToolbarConfig {
206
226
  forcePlacement?: boolean;
207
227
  onPositionCalculated?: (editorView: EditorView, nextPos: Position) => Position;
208
228
  scrollable?: boolean;
229
+ /**
230
+ * Enable Popup component's focus trap
231
+ */
232
+ focusTrap?: boolean;
233
+ preventPopupOverflow?: boolean;
209
234
  }
210
235
  export declare type FloatingToolbarHandler = (state: EditorState, intl: IntlShape, providerFactory: ProviderFactory) => FloatingToolbarConfig | undefined;
211
236
  export {};
@@ -18,7 +18,7 @@ export type { FeatureFlags, FeatureFlagKey, GetEditorFeatureFlags, } from './fea
18
18
  export type { Browsers, Range, DisableSpellcheckByBrowser, } from './supported-browsers';
19
19
  export type { EditorContainerWidth, GetEditorContainerWidth, } from './editor-container-width';
20
20
  export type { EmptyStateHandler, EmptyStateHandlerParams, } from './empty-state-handler';
21
- export type { RenderOptionsPropsT, DropdownOptionT, DropdownOptions, SelectOption, ButtonAppearance, Icon, RenderOptionsProps, AlignType, ConfirmDialogOptions, FloatingToolbarButton, FloatingToolbarCopyButton, FloatingToolbarInput, FloatingToolbarCustom, FloatingToolbarListPicker, FloatingToolbarColorPicker, FloatingToolbarEmojiPicker, FloatingToolbarDatePicker, FloatingToolbarSelect, FloatingToolbarSeparator, FloatingToolbarDropdown, FloatingToolbarFallbackItem, FloatingToolbarItem, FloatingToolbarConfig, FloatingToolbarHandler, } from './floating-toolbar';
21
+ export type { RenderOptionsPropsT, DropdownOptionT, DropdownOptions, SelectOption, ButtonAppearance, Icon, RenderOptionsProps, AlignType, ConfirmDialogChildInfo, ConfirmDialogOptions, ConfirmationDialogProps, FloatingToolbarButton, FloatingToolbarCopyButton, FloatingToolbarInput, FloatingToolbarCustom, FloatingToolbarListPicker, FloatingToolbarColorPicker, FloatingToolbarEmojiPicker, FloatingToolbarDatePicker, FloatingToolbarSelect, FloatingToolbarSeparator, FloatingToolbarDropdown, FloatingToolbarFallbackItem, FloatingToolbarItem, FloatingToolbarConfig, FloatingToolbarHandler, } from './floating-toolbar';
22
22
  export type { MarkOptions, NodeOptions } from './copy-button';
23
23
  export type { ContextPanelHandler } from './context-panel';
24
24
  export type { EditorAppearance } from './editor-appearance';
@@ -29,6 +29,7 @@ export type { EditorReactContext } from './editor-react-context';
29
29
  export type { PMPluginFactoryParams, PMPluginFactory, PMPlugin, } from './plugin-factory';
30
30
  export type { NodeConfig, MarkConfig, NodeViewConfig, } from './prosemirror-config';
31
31
  export type { PluginsOptions, EditorPlugin, getPosHandler, getPosHandlerNode, } from './editor-plugin';
32
+ export type { AllBuilderPlugins, VerifyPluginDependencies, AllNextEditorPlugins, NextEditorPlugin, NextEditorPluginWithDependencies, SafePresetCheck, } from './next-editor-plugin';
32
33
  export declare type IconProps = {
33
34
  label?: string;
34
35
  };
@@ -0,0 +1,61 @@
1
+ /**
2
+ * This entire file attempts to build out the type safety needed in our new
3
+ * plugin dependency injection approach, alongside our current implementation of
4
+ * `Presets` - if the generics get too unwieldy, we may redesign how presets
5
+ * are put together - but for now `Builder` & `Preset` aim to beinterchangeable.
6
+ */
7
+ import type { EditorState } from 'prosemirror-state';
8
+ import type { EditorPlugin } from './editor-plugin';
9
+ interface DefaultEditorPlugin<Name extends string> extends EditorPlugin {
10
+ name: Name;
11
+ }
12
+ interface DefaultEditorPluginWithSharedPluginState<Name, PublicState> {
13
+ name: Name;
14
+ getSharedState: (editorState: EditorState) => PublicState;
15
+ }
16
+ declare type CheckSharedState<Name extends string, PublicState = never> = Exclude<PublicState, never> extends never ? DefaultEditorPlugin<Name> : DefaultEditorPluginWithSharedPluginState<Name, PublicState>;
17
+ export declare type NextEditorPlugin<Name extends string, PublicState = never, PluginConfiguration extends unknown | undefined = unknown> = any extends Function ? Exclude<unknown, PluginConfiguration> extends never ? (optionalConfig?: PluginConfiguration) => CheckSharedState<Name, PublicState> : Exclude<PluginConfiguration, Exclude<PluginConfiguration, undefined>> extends never ? (mandatoryConfig: PluginConfiguration) => CheckSharedState<Name, PublicState> : (optionalKnownConfig?: PluginConfiguration) => CheckSharedState<Name, PublicState> : never;
18
+ declare type getNextEditorPluginStateType<T> = T extends NextEditorPlugin<any, infer U, any> ? U : never;
19
+ declare type getNextEditorPluginNameType<T> = T extends NextEditorPlugin<infer U, any, any> ? U : never;
20
+ declare type ExternalPluginAPIProps<T extends NextEditorPlugin<any, any, any>> = {
21
+ sharedPluginState: {
22
+ currentState: () => getNextEditorPluginStateType<T>;
23
+ onChange: (sub: (props: getNextEditorPluginStateType<T>) => void) => void;
24
+ };
25
+ };
26
+ declare type ExternalPluginAPI<PluginList extends AllBuilderPlugins[]> = {
27
+ [Plugin in PluginList[number] extends NextEditorPluginWithDependencies<any, any, any, any> ? ReturnType<PluginList[number]> : PluginList[number] as getNextEditorPluginNameType<Plugin>]: Plugin extends NextEditorPlugin<any, any, any> ? ExternalPluginAPIProps<Plugin> : never;
28
+ };
29
+ export declare type NextEditorPluginWithDependencies<NextEditorPluginKey extends string, NextEditorPluginPublicState, D extends AllBuilderPlugins[], NextEditorPluginConfiguration extends unknown | undefined = unknown> = (props: {
30
+ externalPlugins: ExternalPluginAPI<D>;
31
+ }) => NextEditorPlugin<NextEditorPluginKey, NextEditorPluginPublicState, NextEditorPluginConfiguration>;
32
+ export declare type PluginAsArray<A extends string, B = never, C = unknown> = C extends C & undefined ? [NextEditorPlugin<A, B, C>, C?] : [NextEditorPlugin<A, B, C>, C];
33
+ export declare type PluginWithDependenciesAsArray<A extends string, B, C extends AllBuilderPlugins[], D extends unknown = unknown> = D extends D & undefined ? [NextEditorPluginWithDependencies<A, B, C, D>, D?] : [NextEditorPluginWithDependencies<A, B, C, D>, D];
34
+ declare type AllPluginsAsArray = PluginAsArray<string, any, any> | PluginWithDependenciesAsArray<string, any, any, any>;
35
+ export declare type AllNextEditorPlugins = NextEditorPlugin<string, any, any> | NextEditorPluginWithDependencies<string, any, any, any>;
36
+ export declare type AllBuilderPlugins = AllPluginsAsArray | AllNextEditorPlugins;
37
+ declare type ExtractNextEditorPlugin<T> = T extends PluginAsArray<string, any, any> | PluginWithDependenciesAsArray<string, any, any, any> ? T[0] : never;
38
+ export declare type VerifyPluginDependencies<T, Plugins extends AllBuilderPlugins[]> = T extends NextEditorPluginWithDependencies<string, any, infer D, any> | PluginWithDependenciesAsArray<string, any, infer D, any> ?
39
+ /**
40
+ * case 1: We're looking for its dependent plugins indexed on `AllBuilderPlugins`
41
+ */
42
+ D[number] extends (D[number] & Plugins[number])
43
+ /**
44
+ * case 2:
45
+ * Otherwise check whether the dependent-plugin, is hidden inside a tuple,
46
+ * unwrapping `Plugins` via `ExtractNextEditorPlugin`
47
+ */
48
+ | (D[number] & ExtractNextEditorPlugin<Plugins[number]>) ? T : never : T extends PluginAsArray<any, any, any> | NextEditorPlugin<any, any, any> ? T : never;
49
+ /**
50
+ * Used to check if a plugin being added can be added to a Preset/builder
51
+ */
52
+ export declare type SafePresetCheck<Plugin, StackPlugins extends AllBuilderPlugins[]> = Plugin extends Plugin & VerifyPluginDependencies<Plugin, StackPlugins> ? Plugin extends NextEditorPluginWithDependencies<string, any, any, infer Config> ? CheckPluginWithDependency<Plugin, Config, StackPlugins> : Plugin extends NextEditorPlugin<any, any, infer Config> ? CheckBasicPlugin<Plugin, Config> : never : Plugin extends (config: infer Config) => EditorPlugin ?
53
+ /** Checks whether config has any mandatory fields - if so, config cannot be optional */
54
+ Exclude<unknown, Config> extends never ? Plugin | [Plugin] : Exclude<unknown, Config> extends never ? Plugin | [Plugin] | [Plugin, Config] : [
55
+ Plugin,
56
+ Config
57
+ ] : never;
58
+ declare type CheckTupleRequirements<Plugin, Config, ArrayType> = Plugin extends Plugin ? Exclude<unknown, Config> extends never ? Plugin | ArrayType : Exclude<Config, Exclude<Config, undefined>> extends never ? Plugin | ArrayType : ArrayType : never;
59
+ declare type CheckPluginWithDependency<Plugin, Config, StackPlugins extends AllBuilderPlugins[]> = Plugin extends (...args: any) => (...args: any) => EditorPlugin ? CheckTupleRequirements<Plugin, Config, PluginWithDependenciesAsArray<any, any, StackPlugins, Config | undefined>> : never;
60
+ declare type CheckBasicPlugin<Plugin, Config> = Plugin extends (...args: any) => EditorPlugin ? CheckTupleRequirements<Plugin, Config, PluginAsArray<any, any, Config | undefined>> : never;
61
+ export {};
@@ -1,4 +1,5 @@
1
1
  import { PureComponent } from 'react';
2
+ import { EmojiResourceConfig } from '@atlaskit/emoji/resource';
2
3
  import { EmojiId } from '@atlaskit/emoji/types';
3
4
  import { ProviderFactory } from '../../provider-factory';
4
5
  export interface EmojiProps extends EmojiId {
@@ -6,6 +7,7 @@ export interface EmojiProps extends EmojiId {
6
7
  providers?: ProviderFactory;
7
8
  fitToHeight?: number;
8
9
  showTooltip?: boolean;
10
+ resourceConfig?: EmojiResourceConfig;
9
11
  }
10
12
  export default class EmojiNode extends PureComponent<EmojiProps, {}> {
11
13
  static displayName: string;
@@ -20,6 +20,9 @@ export interface Props {
20
20
  allowOutOfBounds?: boolean;
21
21
  rect?: DOMRect;
22
22
  style?: React.CSSProperties;
23
+ /** Enable focus trap to contain the user's focus within the popup */
24
+ focusTrap?: boolean;
25
+ preventOverflow?: boolean;
23
26
  }
24
27
  export interface State {
25
28
  popup?: HTMLElement;
@@ -35,6 +38,8 @@ export default class Popup extends React.Component<Props, State> {
35
38
  allowOutOfBound: boolean;
36
39
  };
37
40
  state: State;
41
+ private popupRef;
42
+ private focusTrap?;
38
43
  private placement;
39
44
  /**
40
45
  * Calculates new popup position
@@ -52,6 +57,20 @@ export default class Popup extends React.Component<Props, State> {
52
57
  onResize: () => void;
53
58
  UNSAFE_componentWillReceiveProps(newProps: Props): void;
54
59
  resizeObserver: ResizeObserver | undefined;
60
+ /**
61
+ * Raf scheduled so that it also occurs after the initial update position
62
+ */
63
+ private initFocusTrap;
64
+ /**
65
+ * Cancels the initialisation of the focus trap if it has not yet occured
66
+ * Deactivates the focus trap if it exists
67
+ */
68
+ private destroyFocusTrap;
69
+ /**
70
+ * Handle pausing, unpausing, and initialising (if not yet initialised) of the focus trap
71
+ */
72
+ handleChangedFocusTrapProp(prevProps: Props): void;
73
+ componentDidUpdate(prevProps: Props): void;
55
74
  componentDidMount(): void;
56
75
  componentWillUnmount(): void;
57
76
  private renderPopup;
@@ -18,12 +18,12 @@ export declare function isTextNode(elem: HTMLElement | Element): boolean;
18
18
  /**
19
19
  * Decides if given fitHeight fits below or above the target taking boundaries into account.
20
20
  */
21
- export declare function getVerticalPlacement(target: HTMLElement, boundariesElement: HTMLElement, fitHeight?: number, alignY?: string, forcePlacement?: boolean): string;
21
+ export declare function getVerticalPlacement(target: HTMLElement, boundariesElement: HTMLElement, fitHeight?: number, alignY?: string, forcePlacement?: boolean, preventOverflow?: boolean): string;
22
22
  /**
23
23
  * Decides if given fitWidth fits to the left or to the right of the target taking boundaries into account.
24
24
  */
25
- export declare function getHorizontalPlacement(target: HTMLElement, boundariesElement: HTMLElement, fitWidth?: number, alignX?: string, forcePlacement?: boolean): string;
26
- export declare function calculatePlacement(target: HTMLElement, boundariesElement: HTMLElement, fitWidth?: number, fitHeight?: number, alignX?: string, alignY?: string, forcePlacement?: boolean): [string, string];
25
+ export declare function getHorizontalPlacement(target: HTMLElement, boundariesElement: HTMLElement, fitWidth?: number, alignX?: string, forcePlacement?: boolean, preventOverflow?: boolean): string;
26
+ export declare function calculatePlacement(target: HTMLElement, boundariesElement: HTMLElement, fitWidth?: number, fitHeight?: number, alignX?: string, alignY?: string, forcePlacement?: boolean, preventOverflow?: boolean): [string, string];
27
27
  /**
28
28
  * Calculates relative coordinates for placing popup along with the target.
29
29
  * Uses placement from calculatePlacement.