@ckeditor/ckeditor5-ui 36.0.0 → 37.0.0-alpha.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 (114) hide show
  1. package/package.json +23 -22
  2. package/src/bindings/addkeyboardhandlingforgrid.d.ts +27 -0
  3. package/src/bindings/addkeyboardhandlingforgrid.js +42 -34
  4. package/src/bindings/clickoutsidehandler.d.ts +28 -0
  5. package/src/bindings/clickoutsidehandler.js +5 -6
  6. package/src/bindings/csstransitiondisablermixin.d.ts +40 -0
  7. package/src/bindings/csstransitiondisablermixin.js +55 -0
  8. package/src/bindings/injectcsstransitiondisabler.d.ts +59 -0
  9. package/src/bindings/injectcsstransitiondisabler.js +23 -20
  10. package/src/bindings/preventdefault.d.ts +33 -0
  11. package/src/bindings/preventdefault.js +13 -15
  12. package/src/bindings/submithandler.d.ts +57 -0
  13. package/src/bindings/submithandler.js +22 -23
  14. package/src/button/button.d.ts +154 -0
  15. package/src/button/buttonview.d.ts +155 -0
  16. package/src/button/buttonview.js +16 -60
  17. package/src/button/switchbuttonview.d.ts +45 -0
  18. package/src/button/switchbuttonview.js +9 -18
  19. package/src/colorgrid/colorgridview.d.ts +132 -0
  20. package/src/colorgrid/colorgridview.js +8 -40
  21. package/src/colorgrid/colortileview.d.ts +28 -0
  22. package/src/colorgrid/colortileview.js +0 -13
  23. package/src/colorgrid/utils.d.ts +47 -0
  24. package/src/colorgrid/utils.js +7 -13
  25. package/src/componentfactory.d.ts +81 -0
  26. package/src/componentfactory.js +21 -35
  27. package/src/dropdown/button/dropdownbutton.d.ts +25 -0
  28. package/src/dropdown/button/dropdownbuttonview.d.ts +48 -0
  29. package/src/dropdown/button/dropdownbuttonview.js +11 -21
  30. package/src/dropdown/button/splitbuttonview.d.ts +145 -0
  31. package/src/dropdown/button/splitbuttonview.js +10 -51
  32. package/src/dropdown/dropdownpanelfocusable.d.ts +21 -0
  33. package/src/dropdown/dropdownpanelview.d.ts +62 -0
  34. package/src/dropdown/dropdownpanelview.js +2 -30
  35. package/src/dropdown/dropdownview.d.ts +315 -0
  36. package/src/dropdown/dropdownview.js +121 -222
  37. package/src/dropdown/utils.d.ts +219 -0
  38. package/src/dropdown/utils.js +112 -106
  39. package/src/editableui/editableuiview.d.ts +71 -0
  40. package/src/editableui/editableuiview.js +14 -43
  41. package/src/editableui/inline/inlineeditableuiview.d.ts +40 -0
  42. package/src/editableui/inline/inlineeditableuiview.js +5 -15
  43. package/src/editorui/bodycollection.d.ts +51 -0
  44. package/src/editorui/bodycollection.js +2 -16
  45. package/src/editorui/boxed/boxededitoruiview.d.ts +40 -0
  46. package/src/editorui/boxed/boxededitoruiview.js +1 -27
  47. package/src/editorui/editorui.d.ts +264 -0
  48. package/src/editorui/editorui.js +21 -128
  49. package/src/editorui/editoruiview.d.ts +39 -0
  50. package/src/editorui/editoruiview.js +1 -10
  51. package/src/focuscycler.d.ts +183 -0
  52. package/src/focuscycler.js +34 -90
  53. package/src/formheader/formheaderview.d.ts +53 -0
  54. package/src/formheader/formheaderview.js +3 -24
  55. package/src/icon/iconview.d.ts +78 -0
  56. package/src/icon/iconview.js +0 -50
  57. package/src/iframe/iframeview.d.ts +50 -0
  58. package/src/iframe/iframeview.js +2 -2
  59. package/src/index.d.ts +54 -0
  60. package/src/index.js +1 -0
  61. package/src/input/inputview.d.ts +121 -0
  62. package/src/input/inputview.js +0 -82
  63. package/src/inputnumber/inputnumberview.d.ts +49 -0
  64. package/src/inputnumber/inputnumberview.js +5 -28
  65. package/src/inputtext/inputtextview.d.ts +18 -0
  66. package/src/inputtext/inputtextview.js +0 -2
  67. package/src/label/labelview.d.ts +36 -0
  68. package/src/label/labelview.js +0 -20
  69. package/src/labeledfield/labeledfieldview.d.ts +182 -0
  70. package/src/labeledfield/labeledfieldview.js +20 -126
  71. package/src/labeledfield/utils.d.ts +93 -0
  72. package/src/labeledfield/utils.js +24 -18
  73. package/src/labeledinput/labeledinputview.d.ts +125 -0
  74. package/src/labeledinput/labeledinputview.js +7 -90
  75. package/src/list/listitemview.d.ts +35 -0
  76. package/src/list/listitemview.js +0 -16
  77. package/src/list/listseparatorview.d.ts +18 -0
  78. package/src/list/listseparatorview.js +0 -2
  79. package/src/list/listview.d.ts +59 -0
  80. package/src/list/listview.js +0 -33
  81. package/src/model.d.ts +22 -0
  82. package/src/model.js +2 -4
  83. package/src/notification/notification.d.ts +216 -0
  84. package/src/notification/notification.js +64 -51
  85. package/src/panel/balloon/balloonpanelview.d.ts +685 -0
  86. package/src/panel/balloon/balloonpanelview.js +146 -168
  87. package/src/panel/balloon/contextualballoon.d.ts +240 -0
  88. package/src/panel/balloon/contextualballoon.js +41 -171
  89. package/src/panel/sticky/stickypanelview.d.ts +132 -0
  90. package/src/panel/sticky/stickypanelview.js +0 -115
  91. package/src/template.d.ts +940 -0
  92. package/src/template.js +396 -460
  93. package/src/toolbar/balloon/balloontoolbar.d.ts +124 -0
  94. package/src/toolbar/balloon/balloontoolbar.js +15 -81
  95. package/src/toolbar/block/blockbuttonview.d.ts +35 -0
  96. package/src/toolbar/block/blockbuttonview.js +1 -13
  97. package/src/toolbar/block/blocktoolbar.d.ts +159 -0
  98. package/src/toolbar/block/blocktoolbar.js +32 -69
  99. package/src/toolbar/normalizetoolbarconfig.d.ts +39 -0
  100. package/src/toolbar/normalizetoolbarconfig.js +12 -8
  101. package/src/toolbar/toolbarlinebreakview.d.ts +18 -0
  102. package/src/toolbar/toolbarlinebreakview.js +0 -2
  103. package/src/toolbar/toolbarseparatorview.d.ts +18 -0
  104. package/src/toolbar/toolbarseparatorview.js +0 -2
  105. package/src/toolbar/toolbarview.d.ts +241 -0
  106. package/src/toolbar/toolbarview.js +54 -305
  107. package/src/tooltipmanager.d.ts +180 -0
  108. package/src/tooltipmanager.js +47 -94
  109. package/src/uiconfig.d.ts +82 -0
  110. package/src/uiconfig.js +5 -0
  111. package/src/view.d.ts +422 -0
  112. package/src/view.js +182 -251
  113. package/src/viewcollection.d.ts +139 -0
  114. package/src/viewcollection.js +62 -56
@@ -0,0 +1,145 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @module ui/dropdown/button/splitbuttonview
7
+ */
8
+ import View from '../../view';
9
+ import ButtonView from '../../button/buttonview';
10
+ import type ViewCollection from '../../viewcollection';
11
+ import type Button from '../../button/button';
12
+ import type DropdownButton from './dropdownbutton';
13
+ import { KeystrokeHandler, FocusTracker, type Locale } from '@ckeditor/ckeditor5-utils';
14
+ import '../../../theme/components/dropdown/splitbutton.css';
15
+ /**
16
+ * The split button view class.
17
+ *
18
+ * ```ts
19
+ * const view = new SplitButtonView();
20
+ *
21
+ * view.set( {
22
+ * label: 'A button',
23
+ * keystroke: 'Ctrl+B',
24
+ * tooltip: true
25
+ * } );
26
+ *
27
+ * view.render();
28
+ *
29
+ * document.body.append( view.element );
30
+ * ```
31
+ *
32
+ * Also see the {@link module:ui/dropdown/utils~createDropdown `createDropdown()` util}.
33
+ */
34
+ export default class SplitButtonView extends View<HTMLDivElement> implements DropdownButton {
35
+ /**
36
+ * Collection of the child views inside of the split button {@link #element}.
37
+ */
38
+ readonly children: ViewCollection;
39
+ /**
40
+ * A main button of split button.
41
+ */
42
+ readonly actionView: ButtonView;
43
+ /**
44
+ * A secondary button of split button that opens dropdown.
45
+ */
46
+ readonly arrowView: ButtonView;
47
+ /**
48
+ * Instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}. It manages
49
+ * keystrokes of the split button:
50
+ *
51
+ * * <kbd>▶</kbd> moves focus to arrow view when action view is focused,
52
+ * * <kbd>◀</kbd> moves focus to action view when arrow view is focused.
53
+ */
54
+ readonly keystrokes: KeystrokeHandler;
55
+ /**
56
+ * Tracks information about DOM focus in the dropdown.
57
+ */
58
+ readonly focusTracker: FocusTracker;
59
+ /**
60
+ * @inheritDoc
61
+ */
62
+ label: string | undefined;
63
+ /**
64
+ * @inheritDoc
65
+ */
66
+ keystroke: string | undefined;
67
+ /**
68
+ * @inheritDoc
69
+ */
70
+ tooltip: Button['tooltip'];
71
+ /**
72
+ * @inheritDoc
73
+ */
74
+ tooltipPosition: Button['tooltipPosition'];
75
+ /**
76
+ * @inheritDoc
77
+ */
78
+ type: Button['type'];
79
+ /**
80
+ * @inheritDoc
81
+ */
82
+ isOn: boolean;
83
+ /**
84
+ * @inheritDoc
85
+ */
86
+ isEnabled: boolean;
87
+ /**
88
+ * @inheritDoc
89
+ */
90
+ isVisible: boolean;
91
+ /**
92
+ * @inheritDoc
93
+ */
94
+ isToggleable: boolean;
95
+ /**
96
+ * @inheritDoc
97
+ */
98
+ withText: boolean;
99
+ /**
100
+ * @inheritDoc
101
+ */
102
+ withKeystroke: boolean;
103
+ /**
104
+ * @inheritDoc
105
+ */
106
+ icon: string | undefined;
107
+ /**
108
+ * @inheritDoc
109
+ */
110
+ tabindex: number;
111
+ /**
112
+ * @inheritDoc
113
+ */
114
+ class: string | undefined;
115
+ /**
116
+ * @inheritDoc
117
+ */
118
+ labelStyle: string | undefined;
119
+ /**
120
+ * @inheritDoc
121
+ */
122
+ constructor(locale?: Locale);
123
+ /**
124
+ * @inheritDoc
125
+ */
126
+ render(): void;
127
+ /**
128
+ * @inheritDoc
129
+ */
130
+ destroy(): void;
131
+ /**
132
+ * Focuses the {@link #actionView#element} of the action part of split button.
133
+ */
134
+ focus(): void;
135
+ /**
136
+ * Creates a {@link module:ui/button/buttonview~ButtonView} instance as {@link #actionView} and binds it with main split button
137
+ * attributes.
138
+ */
139
+ private _createActionView;
140
+ /**
141
+ * Creates a {@link module:ui/button/buttonview~ButtonView} instance as {@link #arrowView} and binds it with main split button
142
+ * attributes.
143
+ */
144
+ private _createArrowView;
145
+ }
@@ -13,22 +13,21 @@ import '../../../theme/components/dropdown/splitbutton.css';
13
13
  /**
14
14
  * The split button view class.
15
15
  *
16
- * const view = new SplitButtonView();
16
+ * ```ts
17
+ * const view = new SplitButtonView();
17
18
  *
18
- * view.set( {
19
- * label: 'A button',
20
- * keystroke: 'Ctrl+B',
21
- * tooltip: true
22
- * } );
19
+ * view.set( {
20
+ * label: 'A button',
21
+ * keystroke: 'Ctrl+B',
22
+ * tooltip: true
23
+ * } );
23
24
  *
24
- * view.render();
25
+ * view.render();
25
26
  *
26
- * document.body.append( view.element );
27
+ * document.body.append( view.element );
28
+ * ```
27
29
  *
28
30
  * Also see the {@link module:ui/dropdown/utils~createDropdown `createDropdown()` util}.
29
- *
30
- * @implements module:ui/dropdown/button/dropdownbutton~DropdownButton
31
- * @extends module:ui/view~View
32
31
  */
33
32
  export default class SplitButtonView extends View {
34
33
  /**
@@ -53,44 +52,10 @@ export default class SplitButtonView extends View {
53
52
  this.set('tooltipPosition', 's');
54
53
  this.set('type', 'button');
55
54
  this.set('withText', false);
56
- /**
57
- * Collection of the child views inside of the split button {@link #element}.
58
- *
59
- * @readonly
60
- * @member {module:ui/viewcollection~ViewCollection}
61
- */
62
55
  this.children = this.createCollection();
63
- /**
64
- * A main button of split button.
65
- *
66
- * @readonly
67
- * @member {module:ui/button/buttonview~ButtonView}
68
- */
69
56
  this.actionView = this._createActionView();
70
- /**
71
- * A secondary button of split button that opens dropdown.
72
- *
73
- * @readonly
74
- * @member {module:ui/button/buttonview~ButtonView}
75
- */
76
57
  this.arrowView = this._createArrowView();
77
- /**
78
- * Instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}. It manages
79
- * keystrokes of the split button:
80
- *
81
- * * <kbd>▶</kbd> moves focus to arrow view when action view is focused,
82
- * * <kbd>◀</kbd> moves focus to action view when arrow view is focused.
83
- *
84
- * @readonly
85
- * @member {module:utils/keystrokehandler~KeystrokeHandler}
86
- */
87
58
  this.keystrokes = new KeystrokeHandler();
88
- /**
89
- * Tracks information about DOM focus in the dropdown.
90
- *
91
- * @readonly
92
- * @member {module:utils/focustracker~FocusTracker}
93
- */
94
59
  this.focusTracker = new FocusTracker();
95
60
  this.setTemplate({
96
61
  tag: 'div',
@@ -148,9 +113,6 @@ export default class SplitButtonView extends View {
148
113
  /**
149
114
  * Creates a {@link module:ui/button/buttonview~ButtonView} instance as {@link #actionView} and binds it with main split button
150
115
  * attributes.
151
- *
152
- * @private
153
- * @returns {module:ui/button/buttonview~ButtonView}
154
116
  */
155
117
  _createActionView() {
156
118
  const actionView = new ButtonView();
@@ -166,9 +128,6 @@ export default class SplitButtonView extends View {
166
128
  /**
167
129
  * Creates a {@link module:ui/button/buttonview~ButtonView} instance as {@link #arrowView} and binds it with main split button
168
130
  * attributes.
169
- *
170
- * @private
171
- * @returns {module:ui/button/buttonview~ButtonView}
172
131
  */
173
132
  _createArrowView() {
174
133
  const arrowView = new ButtonView();
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @module ui/dropdown/dropdownpanelfocusable
7
+ */
8
+ /**
9
+ * The dropdown panel interface for focusable contents. It provides two methods for managing focus of the contents
10
+ * of dropdown's panel.
11
+ */
12
+ export default interface DropdownPanelFocusable {
13
+ /**
14
+ * Focuses the view element or first item in view collection on opening dropdown's panel.
15
+ */
16
+ focus(): void;
17
+ /**
18
+ * Focuses the view element or last item in view collection on opening dropdown's panel.
19
+ */
20
+ focusLast(): void;
21
+ }
@@ -0,0 +1,62 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @module ui/dropdown/dropdownpanelview
7
+ */
8
+ import View from '../view';
9
+ import type ViewCollection from '../viewcollection';
10
+ import type DropdownPanelFocusable from './dropdownpanelfocusable';
11
+ import { type Locale } from '@ckeditor/ckeditor5-utils';
12
+ /**
13
+ * The dropdown panel view class.
14
+ *
15
+ * See {@link module:ui/dropdown/dropdownview~DropdownView} to learn about the common usage.
16
+ */
17
+ export default class DropdownPanelView extends View implements DropdownPanelFocusable {
18
+ /**
19
+ * Collection of the child views in this panel.
20
+ *
21
+ * A common child type is the {@link module:ui/list/listview~ListView} and {@link module:ui/toolbar/toolbarview~ToolbarView}.
22
+ * See {@link module:ui/dropdown/utils~addListToDropdown} and
23
+ * {@link module:ui/dropdown/utils~addToolbarToDropdown} to learn more about child views of dropdowns.
24
+ */
25
+ readonly children: ViewCollection;
26
+ /**
27
+ * Controls whether the panel is visible.
28
+ *
29
+ * @observable
30
+ */
31
+ isVisible: boolean;
32
+ /**
33
+ * The position of the panel, relative to the parent.
34
+ *
35
+ * This property is reflected in the CSS class set to {@link #element} that controls
36
+ * the position of the panel.
37
+ *
38
+ * @observable
39
+ * @default 'se'
40
+ */
41
+ position: PanelPosition;
42
+ /**
43
+ * @inheritDoc
44
+ */
45
+ constructor(locale?: Locale);
46
+ /**
47
+ * Focuses the first view in the {@link #children} collection.
48
+ *
49
+ * See also {@link module:ui/dropdown/dropdownpanelfocusable~DropdownPanelFocusable}.
50
+ */
51
+ focus(): void;
52
+ /**
53
+ * Focuses the view element or last item in view collection on opening dropdown's panel.
54
+ *
55
+ * See also {@link module:ui/dropdown/dropdownpanelfocusable~DropdownPanelFocusable}.
56
+ */
57
+ focusLast(): void;
58
+ }
59
+ /**
60
+ * The position of the panel, relative to the parent.
61
+ */
62
+ export type PanelPosition = 's' | 'se' | 'sw' | 'sme' | 'smw' | 'n' | 'ne' | 'nw' | 'nme' | 'nmw';
@@ -11,8 +11,6 @@ import { logWarning } from '@ckeditor/ckeditor5-utils';
11
11
  * The dropdown panel view class.
12
12
  *
13
13
  * See {@link module:ui/dropdown/dropdownview~DropdownView} to learn about the common usage.
14
- *
15
- * @extends module:ui/view~View
16
14
  */
17
15
  export default class DropdownPanelView extends View {
18
16
  /**
@@ -21,34 +19,8 @@ export default class DropdownPanelView extends View {
21
19
  constructor(locale) {
22
20
  super(locale);
23
21
  const bind = this.bindTemplate;
24
- /**
25
- * Controls whether the panel is visible.
26
- *
27
- * @observable
28
- * @member {Boolean} #isVisible
29
- */
30
22
  this.set('isVisible', false);
31
- /**
32
- * The position of the panel, relative to the parent.
33
- *
34
- * This property is reflected in the CSS class set to {@link #element} that controls
35
- * the position of the panel.
36
- *
37
- * @observable
38
- * @default 'se'
39
- * @member {'s'|'se'|'sw'|'sme'|'smw'|'n'|'ne'|'nw'|'nme'|'nmw'} #position
40
- */
41
23
  this.set('position', 'se');
42
- /**
43
- * Collection of the child views in this panel.
44
- *
45
- * A common child type is the {@link module:ui/list/listview~ListView} and {@link module:ui/toolbar/toolbarview~ToolbarView}.
46
- * See {@link module:ui/dropdown/utils~addListToDropdown} and
47
- * {@link module:ui/dropdown/utils~addToolbarToDropdown} to learn more about child views of dropdowns.
48
- *
49
- * @readonly
50
- * @member {module:ui/viewcollection~ViewCollection}
51
- */
52
24
  this.children = this.createCollection();
53
25
  this.setTemplate({
54
26
  tag: 'div',
@@ -93,8 +65,8 @@ export default class DropdownPanelView extends View {
93
65
  * provides the `focus()` method for the best user experience.
94
66
  *
95
67
  * @error ui-dropdown-panel-focus-child-missing-focus
96
- * @param {module:ui/view~View} childView
97
- * @param {module:ui/dropdown/dropdownpanelview~DropdownPanelView} dropdownPanel
68
+ * @param childView
69
+ * @param dropdownPanel
98
70
  */
99
71
  logWarning('ui-dropdown-panel-focus-child-missing-focus', { childView: this.children.first, dropdownPanel: this });
100
72
  }
@@ -0,0 +1,315 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @module ui/dropdown/dropdownview
7
+ */
8
+ import View from '../view';
9
+ import type { default as DropdownButton } from './button/dropdownbutton';
10
+ import type { default as DropdownPanelView, PanelPosition } from './dropdownpanelview';
11
+ import type { FocusableView } from '../focuscycler';
12
+ import type ListView from '../list/listview';
13
+ import type ToolbarView from '../toolbar/toolbarview';
14
+ import { KeystrokeHandler, FocusTracker, type Locale, type PositioningFunction } from '@ckeditor/ckeditor5-utils';
15
+ import '../../theme/components/dropdown/dropdown.css';
16
+ /**
17
+ * The dropdown view class. It manages the dropdown button and dropdown panel.
18
+ *
19
+ * In most cases, the easiest way to create a dropdown is by using the {@link module:ui/dropdown/utils~createDropdown}
20
+ * util:
21
+ *
22
+ * ```ts
23
+ * const dropdown = createDropdown( locale );
24
+ *
25
+ * // Configure dropdown's button properties:
26
+ * dropdown.buttonView.set( {
27
+ * label: 'A dropdown',
28
+ * withText: true
29
+ * } );
30
+ *
31
+ * dropdown.render();
32
+ *
33
+ * dropdown.panelView.element.textContent = 'Content of the panel';
34
+ *
35
+ * // Will render a dropdown with a panel containing a "Content of the panel" text.
36
+ * document.body.appendChild( dropdown.element );
37
+ * ```
38
+ *
39
+ * If you want to add a richer content to the dropdown panel, you can use the {@link module:ui/dropdown/utils~addListToDropdown}
40
+ * and {@link module:ui/dropdown/utils~addToolbarToDropdown} helpers. See more examples in
41
+ * {@link module:ui/dropdown/utils~createDropdown} documentation.
42
+ *
43
+ * If you want to create a completely custom dropdown, then you can compose it manually:
44
+ *
45
+ * ```ts
46
+ * const button = new DropdownButtonView( locale );
47
+ * const panel = new DropdownPanelView( locale );
48
+ * const dropdown = new DropdownView( locale, button, panel );
49
+ *
50
+ * button.set( {
51
+ * label: 'A dropdown',
52
+ * withText: true
53
+ * } );
54
+ *
55
+ * dropdown.render();
56
+ *
57
+ * panel.element.textContent = 'Content of the panel';
58
+ *
59
+ * // Will render a dropdown with a panel containing a "Content of the panel" text.
60
+ * document.body.appendChild( dropdown.element );
61
+ * ```
62
+ *
63
+ * However, dropdown created this way will contain little behavior. You will need to implement handlers for actions
64
+ * such as {@link module:ui/bindings/clickoutsidehandler~clickOutsideHandler clicking outside an open dropdown}
65
+ * (which should close it) and support for arrow keys inside the panel. Therefore, unless you really know what
66
+ * you do and you really need to do it, it is recommended to use the {@link module:ui/dropdown/utils~createDropdown} helper.
67
+ */
68
+ export default class DropdownView extends View<HTMLDivElement> {
69
+ /**
70
+ * Button of the dropdown view. Clicking the button opens the {@link #panelView}.
71
+ */
72
+ readonly buttonView: DropdownButton & FocusableView;
73
+ /**
74
+ * Panel of the dropdown. It opens when the {@link #buttonView} is
75
+ * {@link module:ui/button/buttonview~ButtonView#event:execute executed} (i.e. clicked).
76
+ *
77
+ * Child views can be added to the panel's `children` collection:
78
+ *
79
+ * ```ts
80
+ * dropdown.panelView.children.add( childView );
81
+ * ```
82
+ *
83
+ * See {@link module:ui/dropdown/dropdownpanelview~DropdownPanelView#children} and
84
+ * {@link module:ui/viewcollection~ViewCollection#add}.
85
+ */
86
+ readonly panelView: DropdownPanelView;
87
+ /**
88
+ * Tracks information about the DOM focus in the dropdown.
89
+ */
90
+ readonly focusTracker: FocusTracker;
91
+ /**
92
+ * Instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}. It manages
93
+ * keystrokes of the dropdown:
94
+ *
95
+ * * <kbd>▼</kbd> opens the dropdown,
96
+ * * <kbd>◀</kbd> and <kbd>Esc</kbd> closes the dropdown.
97
+ */
98
+ readonly keystrokes: KeystrokeHandler;
99
+ /**
100
+ * A child {@link module:ui/list/listview~ListView list view} of the dropdown located
101
+ * in its {@link module:ui/dropdown/dropdownview~DropdownView#panelView panel}.
102
+ *
103
+ * **Note**: Only supported when dropdown has list view added using {@link module:ui/dropdown/utils~addListToDropdown}.
104
+ */
105
+ listView?: ListView;
106
+ /**
107
+ * A child toolbar of the dropdown located in the
108
+ * {@link module:ui/dropdown/dropdownview~DropdownView#panelView panel}.
109
+ *
110
+ * **Note**: Only supported when dropdown has list view added using {@link module:ui/dropdown/utils~addToolbarToDropdown}.
111
+ */
112
+ toolbarView?: ToolbarView;
113
+ /**
114
+ * Controls whether the dropdown view is open, i.e. shows or hides the {@link #panelView panel}.
115
+ *
116
+ * **Note**: When the dropdown gets open, it will attempt to call `focus()` on the first child of its {@link #panelView}.
117
+ * See {@link module:ui/dropdown/utils~addToolbarToDropdown}, {@link module:ui/dropdown/utils~addListToDropdown}, and
118
+ * {@link module:ui/dropdown/utils~focusChildOnDropdownOpen} to learn more about focus management in dropdowns.
119
+ *
120
+ * @observable
121
+ */
122
+ isOpen: boolean;
123
+ /**
124
+ * Controls whether the dropdown is enabled, i.e. it can be clicked and execute an action.
125
+ *
126
+ * See {@link module:ui/button/buttonview~ButtonView#isEnabled}.
127
+ *
128
+ * @observable
129
+ */
130
+ isEnabled: boolean;
131
+ /**
132
+ * (Optional) The additional CSS class set on the dropdown {@link #element}.
133
+ *
134
+ * @observable
135
+ */
136
+ class: string | undefined;
137
+ /**
138
+ * (Optional) The `id` attribute of the dropdown (i.e. to pair with a `<label>` element).
139
+ *
140
+ * @observable
141
+ */
142
+ id: string | undefined;
143
+ /**
144
+ * The position of the panel, relative to the dropdown.
145
+ *
146
+ * **Note**: When `'auto'`, the panel will use one of the remaining positions to stay
147
+ * in the viewport, visible to the user. The positions correspond directly to
148
+ * {@link module:ui/dropdown/dropdownview~DropdownView.defaultPanelPositions default panel positions}.
149
+ *
150
+ * **Note**: This value has an impact on the
151
+ * {@link module:ui/dropdown/dropdownpanelview~DropdownPanelView#position} property
152
+ * each time the panel becomes {@link #isOpen open}.
153
+ *
154
+ * @observable
155
+ * @default 'auto'
156
+ */
157
+ panelPosition: PanelPosition | 'auto';
158
+ /**
159
+ * @observable
160
+ */
161
+ ariaDescribedById: string | undefined;
162
+ /**
163
+ * Creates an instance of the dropdown.
164
+ *
165
+ * Also see {@link #render}.
166
+ *
167
+ * @param locale The localization services instance.
168
+ */
169
+ constructor(locale: Locale | undefined, buttonView: DropdownButton & FocusableView, panelView: DropdownPanelView);
170
+ /**
171
+ * @inheritDoc
172
+ */
173
+ render(): void;
174
+ /**
175
+ * Focuses the {@link #buttonView}.
176
+ */
177
+ focus(): void;
178
+ /**
179
+ * Returns {@link #panelView panel} positions to be used by the
180
+ * {@link module:utils/dom/position~getOptimalPosition `getOptimalPosition()`}
181
+ * utility considering the direction of the language the UI of the editor is displayed in.
182
+ */
183
+ private get _panelPositions();
184
+ /**
185
+ * A set of positioning functions used by the dropdown view to determine
186
+ * the optimal position (i.e. fitting into the browser viewport) of its
187
+ * {@link module:ui/dropdown/dropdownview~DropdownView#panelView panel} when
188
+ * {@link module:ui/dropdown/dropdownview~DropdownView#panelPosition} is set to 'auto'`.
189
+ *
190
+ * The available positioning functions are as follow:
191
+ *
192
+ * **South**
193
+ *
194
+ * * `south`
195
+ *
196
+ * ```
197
+ * [ Button ]
198
+ * +-----------------+
199
+ * | Panel |
200
+ * +-----------------+
201
+ * ```
202
+ *
203
+ * * `southEast`
204
+ *
205
+ * ```
206
+ * [ Button ]
207
+ * +-----------------+
208
+ * | Panel |
209
+ * +-----------------+
210
+ * ```
211
+ *
212
+ * * `southWest`
213
+ *
214
+ * ```
215
+ * [ Button ]
216
+ * +-----------------+
217
+ * | Panel |
218
+ * +-----------------+
219
+ * ```
220
+ *
221
+ * * `southMiddleEast`
222
+ *
223
+ * ```
224
+ * [ Button ]
225
+ * +-----------------+
226
+ * | Panel |
227
+ * +-----------------+
228
+ * ```
229
+ *
230
+ * * `southMiddleWest`
231
+ *
232
+ * ```
233
+ * [ Button ]
234
+ * +-----------------+
235
+ * | Panel |
236
+ * +-----------------+
237
+ * ```
238
+ *
239
+ * **North**
240
+ *
241
+ * * `north`
242
+ *
243
+ * ```
244
+ * +-----------------+
245
+ * | Panel |
246
+ * +-----------------+
247
+ * [ Button ]
248
+ * ```
249
+ *
250
+ * * `northEast`
251
+ *
252
+ * ```
253
+ * +-----------------+
254
+ * | Panel |
255
+ * +-----------------+
256
+ * [ Button ]
257
+ * ```
258
+ *
259
+ * * `northWest`
260
+ *
261
+ * ```
262
+ * +-----------------+
263
+ * | Panel |
264
+ * +-----------------+
265
+ * [ Button ]
266
+ * ```
267
+ *
268
+ * * `northMiddleEast`
269
+ *
270
+ * ```
271
+ * +-----------------+
272
+ * | Panel |
273
+ * +-----------------+
274
+ * [ Button ]
275
+ * ```
276
+ *
277
+ * * `northMiddleWest`
278
+ *
279
+ * ```
280
+ * +-----------------+
281
+ * | Panel |
282
+ * +-----------------+
283
+ * [ Button ]
284
+ * ```
285
+ *
286
+ * Positioning functions are compatible with {@link module:utils/dom/position~Position}.
287
+ *
288
+ * The name that position function returns will be reflected in dropdown panel's class that
289
+ * controls its placement. See {@link module:ui/dropdown/dropdownview~DropdownView#panelPosition}
290
+ * to learn more.
291
+ */
292
+ static defaultPanelPositions: Record<string, PositioningFunction>;
293
+ /**
294
+ * A function used to calculate the optimal position for the dropdown panel.
295
+ */
296
+ private static _getOptimalPosition;
297
+ }
298
+ /**
299
+ * Fired when the toolbar button or list item is executed.
300
+ *
301
+ * For {@link #listView} It fires when a child of some {@link module:ui/list/listitemview~ListItemView}
302
+ * fired `execute`.
303
+ *
304
+ * For {@link #toolbarView} It fires when one of the buttons has been
305
+ * {@link module:ui/button/buttonview~ButtonView#event:execute executed}.
306
+ *
307
+ * **Note**: Only supported when dropdown has list view added using {@link module:ui/dropdown/utils~addListToDropdown}
308
+ * or {@link module:ui/dropdown/utils~addToolbarToDropdown}.
309
+ *
310
+ * @eventName execute
311
+ */
312
+ export type DropdownViewEvent = {
313
+ name: 'execute';
314
+ args: [];
315
+ };