@ckeditor/ckeditor5-ui 41.2.0 → 41.3.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 (98) hide show
  1. package/dist/content-index.css +4 -0
  2. package/dist/editor-index.css +451 -0
  3. package/dist/index.css +856 -0
  4. package/dist/index.css.map +1 -0
  5. package/dist/index.js +13857 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/types/arialiveannouncer.d.ts +98 -0
  8. package/dist/types/augmentation.d.ts +88 -0
  9. package/dist/types/autocomplete/autocompleteview.d.ts +81 -0
  10. package/dist/types/bindings/addkeyboardhandlingforgrid.d.ts +27 -0
  11. package/dist/types/bindings/clickoutsidehandler.d.ts +28 -0
  12. package/dist/types/bindings/csstransitiondisablermixin.d.ts +40 -0
  13. package/dist/types/bindings/draggableviewmixin.d.ts +46 -0
  14. package/dist/types/bindings/injectcsstransitiondisabler.d.ts +59 -0
  15. package/dist/types/bindings/preventdefault.d.ts +33 -0
  16. package/dist/types/bindings/submithandler.d.ts +57 -0
  17. package/dist/types/button/button.d.ts +175 -0
  18. package/dist/types/button/buttonlabel.d.ts +34 -0
  19. package/dist/types/button/buttonlabelview.d.ts +31 -0
  20. package/dist/types/button/buttonview.d.ts +181 -0
  21. package/dist/types/button/switchbuttonview.d.ts +45 -0
  22. package/dist/types/collapsible/collapsibleview.d.ts +70 -0
  23. package/dist/types/colorgrid/colorgridview.d.ts +132 -0
  24. package/dist/types/colorgrid/colortileview.d.ts +28 -0
  25. package/dist/types/colorgrid/utils.d.ts +47 -0
  26. package/dist/types/colorpicker/colorpickerview.d.ts +142 -0
  27. package/dist/types/colorpicker/utils.d.ts +48 -0
  28. package/dist/types/colorselector/colorgridsfragmentview.d.ts +195 -0
  29. package/dist/types/colorselector/colorpickerfragmentview.d.ts +129 -0
  30. package/dist/types/colorselector/colorselectorview.d.ts +242 -0
  31. package/dist/types/colorselector/documentcolorcollection.d.ts +70 -0
  32. package/dist/types/componentfactory.d.ts +81 -0
  33. package/dist/types/dialog/dialog.d.ts +273 -0
  34. package/dist/types/dialog/dialogactionsview.d.ts +69 -0
  35. package/dist/types/dialog/dialogcontentview.d.ts +27 -0
  36. package/dist/types/dialog/dialogview.d.ts +256 -0
  37. package/dist/types/dropdown/button/dropdownbutton.d.ts +25 -0
  38. package/dist/types/dropdown/button/dropdownbuttonview.d.ts +48 -0
  39. package/dist/types/dropdown/button/splitbuttonview.d.ts +162 -0
  40. package/dist/types/dropdown/dropdownpanelfocusable.d.ts +21 -0
  41. package/dist/types/dropdown/dropdownpanelview.d.ts +62 -0
  42. package/dist/types/dropdown/dropdownview.d.ts +315 -0
  43. package/dist/types/dropdown/utils.d.ts +235 -0
  44. package/dist/types/editableui/editableuiview.d.ts +72 -0
  45. package/dist/types/editableui/inline/inlineeditableuiview.d.ts +40 -0
  46. package/dist/types/editorui/accessibilityhelp/accessibilityhelp.d.ts +47 -0
  47. package/dist/types/editorui/accessibilityhelp/accessibilityhelpcontentview.d.ts +35 -0
  48. package/dist/types/editorui/bodycollection.d.ts +55 -0
  49. package/dist/types/editorui/boxed/boxededitoruiview.d.ts +40 -0
  50. package/dist/types/editorui/editorui.d.ts +288 -0
  51. package/dist/types/editorui/editoruiview.d.ts +39 -0
  52. package/dist/types/editorui/poweredby.d.ts +71 -0
  53. package/dist/types/focuscycler.d.ts +245 -0
  54. package/dist/types/formheader/formheaderview.d.ts +59 -0
  55. package/dist/types/highlightedtext/highlightedtextview.d.ts +38 -0
  56. package/dist/types/icon/iconview.d.ts +88 -0
  57. package/dist/types/iframe/iframeview.d.ts +50 -0
  58. package/dist/types/index.d.ts +74 -0
  59. package/dist/types/input/inputbase.d.ts +107 -0
  60. package/dist/types/input/inputview.d.ts +36 -0
  61. package/dist/types/inputnumber/inputnumberview.d.ts +49 -0
  62. package/dist/types/inputtext/inputtextview.d.ts +18 -0
  63. package/dist/types/label/labelview.d.ts +36 -0
  64. package/dist/types/labeledfield/labeledfieldview.d.ts +187 -0
  65. package/dist/types/labeledfield/utils.d.ts +123 -0
  66. package/dist/types/labeledinput/labeledinputview.d.ts +125 -0
  67. package/dist/types/list/listitemgroupview.d.ts +59 -0
  68. package/dist/types/list/listitemview.d.ts +36 -0
  69. package/dist/types/list/listseparatorview.d.ts +18 -0
  70. package/dist/types/list/listview.d.ts +124 -0
  71. package/dist/types/model.d.ts +22 -0
  72. package/dist/types/notification/notification.d.ts +211 -0
  73. package/dist/types/panel/balloon/balloonpanelview.d.ts +685 -0
  74. package/dist/types/panel/balloon/contextualballoon.d.ts +299 -0
  75. package/dist/types/panel/sticky/stickypanelview.d.ts +156 -0
  76. package/dist/types/search/filteredview.d.ts +31 -0
  77. package/dist/types/search/searchinfoview.d.ts +45 -0
  78. package/dist/types/search/searchresultsview.d.ts +54 -0
  79. package/dist/types/search/text/searchtextqueryview.d.ts +76 -0
  80. package/dist/types/search/text/searchtextview.d.ts +219 -0
  81. package/dist/types/spinner/spinnerview.d.ts +25 -0
  82. package/dist/types/template.d.ts +942 -0
  83. package/dist/types/textarea/textareaview.d.ts +104 -0
  84. package/dist/types/toolbar/balloon/balloontoolbar.d.ts +117 -0
  85. package/dist/types/toolbar/block/blockbuttonview.d.ts +35 -0
  86. package/dist/types/toolbar/block/blocktoolbar.d.ts +153 -0
  87. package/dist/types/toolbar/normalizetoolbarconfig.d.ts +40 -0
  88. package/dist/types/toolbar/toolbarlinebreakview.d.ts +18 -0
  89. package/dist/types/toolbar/toolbarseparatorview.d.ts +18 -0
  90. package/dist/types/toolbar/toolbarview.d.ts +267 -0
  91. package/dist/types/tooltipmanager.d.ts +184 -0
  92. package/dist/types/view.d.ts +422 -0
  93. package/dist/types/viewcollection.d.ts +139 -0
  94. package/package.json +4 -3
  95. package/src/colorpicker/colorpickerview.js +0 -1
  96. package/src/index.d.ts +2 -2
  97. package/src/index.js +2 -1
  98. package/src/toolbar/toolbarview.js +2 -3
@@ -0,0 +1,299 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, 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/panel/balloon/contextualballoon
7
+ */
8
+ import BalloonPanelView from './balloonpanelview.js';
9
+ import View from '../../view.js';
10
+ import ButtonView from '../../button/buttonview.js';
11
+ import type ViewCollection from '../../viewcollection.js';
12
+ import { Plugin, type Editor } from '@ckeditor/ckeditor5-core';
13
+ import { FocusTracker, type Locale, type PositionOptions } from '@ckeditor/ckeditor5-utils';
14
+ import '../../../theme/components/panel/balloonrotator.css';
15
+ import '../../../theme/components/panel/fakepanel.css';
16
+ /**
17
+ * Provides the common contextual balloon for the editor.
18
+ *
19
+ * The role of this plugin is to unify the contextual balloons logic, simplify views management and help
20
+ * avoid the unnecessary complexity of handling multiple {@link module:ui/panel/balloon/balloonpanelview~BalloonPanelView}
21
+ * instances in the editor.
22
+ *
23
+ * This plugin allows for creating single or multiple panel stacks.
24
+ *
25
+ * Each stack may have multiple views, with the one on the top being visible. When the visible view is removed from the stack,
26
+ * the previous view becomes visible.
27
+ *
28
+ * It might be useful to implement nested navigation in a balloon. For instance, a toolbar view may contain a link button.
29
+ * When you click it, a link view (which lets you set the URL) is created and put on top of the toolbar view, so the link panel
30
+ * is displayed. When you finish editing the link and close (remove) the link view, the toolbar view is visible again.
31
+ *
32
+ * However, there are cases when there are multiple independent balloons to be displayed, for instance, if the selection
33
+ * is inside two inline comments at the same time. For such cases, you can create two independent panel stacks.
34
+ * The contextual balloon plugin will create a navigation bar to let the users switch between these panel stacks using the "Next"
35
+ * and "Previous" buttons.
36
+ *
37
+ * If there are no views in the current stack, the balloon panel will try to switch to the next stack. If there are no
38
+ * panels in any stack, the balloon panel will be hidden.
39
+ *
40
+ * **Note**: To force the balloon panel to show only one view, even if there are other stacks, use the `singleViewMode=true` option
41
+ * when {@link module:ui/panel/balloon/contextualballoon~ContextualBalloon#add adding} a view to a panel.
42
+ *
43
+ * From the implementation point of view, the contextual ballon plugin is reusing a single
44
+ * {@link module:ui/panel/balloon/balloonpanelview~BalloonPanelView} instance to display multiple contextual balloon
45
+ * panels in the editor. It also creates a special {@link module:ui/panel/balloon/contextualballoon~RotatorView rotator view},
46
+ * used to manage multiple panel stacks. Rotator view is a child of the balloon panel view and the parent of the specific
47
+ * view you want to display. If there is more than one panel stack to be displayed, the rotator view will add a
48
+ * navigation bar. If there is only one stack, the rotator view is transparent (it does not add any UI elements).
49
+ */
50
+ export default class ContextualBalloon extends Plugin {
51
+ /**
52
+ * The {@link module:utils/dom/position~Options#limiter position limiter}
53
+ * for the {@link #view balloon}, used when no `limiter` has been passed into {@link #add}
54
+ * or {@link #updatePosition}.
55
+ *
56
+ * By default, a function that obtains the farthest DOM
57
+ * {@link module:engine/view/rooteditableelement~RootEditableElement}
58
+ * of the {@link module:engine/view/document~Document#selection}.
59
+ */
60
+ positionLimiter: PositionOptions['limiter'];
61
+ visibleStack?: string;
62
+ /**
63
+ * The currently visible view or `null` when there are no views in any stack.
64
+ *
65
+ * @readonly
66
+ * @observable
67
+ */
68
+ visibleView: View | null;
69
+ /**
70
+ * A total number of all stacks in the balloon.
71
+ *
72
+ * @private
73
+ * @readonly
74
+ * @observable
75
+ */
76
+ _numberOfStacks: number;
77
+ /**
78
+ * A flag that controls the single view mode.
79
+ *
80
+ * @private
81
+ * @readonly
82
+ * @observable
83
+ */
84
+ _singleViewMode: boolean;
85
+ /**
86
+ * The map of views and their stacks.
87
+ */
88
+ private _viewToStack;
89
+ /**
90
+ * The map of IDs and stacks.
91
+ */
92
+ private _idToStack;
93
+ /**
94
+ * The common balloon panel view.
95
+ */
96
+ private _view;
97
+ /**
98
+ * Rotator view embedded in the contextual balloon.
99
+ * Displays the currently visible view in the balloon and provides navigation for switching stacks.
100
+ */
101
+ private _rotatorView;
102
+ /**
103
+ * Displays fake panels under the balloon panel view when multiple stacks are added to the balloon.
104
+ */
105
+ private _fakePanelsView;
106
+ /**
107
+ * @inheritDoc
108
+ */
109
+ static get pluginName(): "ContextualBalloon";
110
+ /**
111
+ * @inheritDoc
112
+ */
113
+ constructor(editor: Editor);
114
+ /**
115
+ * @inheritDoc
116
+ */
117
+ destroy(): void;
118
+ /**
119
+ * The common balloon panel view.
120
+ */
121
+ get view(): BalloonPanelView;
122
+ /**
123
+ * Returns `true` when the given view is in one of the stacks. Otherwise returns `false`.
124
+ */
125
+ hasView(view: View): boolean;
126
+ /**
127
+ * Adds a new view to the stack and makes it visible if the current stack is visible
128
+ * or it is the first view in the balloon.
129
+ *
130
+ * @param data The configuration of the view.
131
+ * @param data.stackId The ID of the stack that the view is added to. Defaults to `'main'`.
132
+ * @param data.view The content of the balloon.
133
+ * @param data.position Positioning options.
134
+ * @param data.balloonClassName An additional CSS class added to the {@link #view balloon} when visible.
135
+ * @param data.withArrow Whether the {@link #view balloon} should be rendered with an arrow. Defaults to `true`.
136
+ * @param data.singleViewMode Whether the view should be the only visible view even if other stacks were added. Defaults to `false`.
137
+ */
138
+ add(data: ViewConfiguration): void;
139
+ /**
140
+ * Removes the given view from the stack. If the removed view was visible,
141
+ * the view preceding it in the stack will become visible instead.
142
+ * When there is no view in the stack, the next stack will be displayed.
143
+ * When there are no more stacks, the balloon will hide.
144
+ *
145
+ * @param view A view to be removed from the balloon.
146
+ */
147
+ remove(view: View): void;
148
+ /**
149
+ * Updates the position of the balloon using the position data of the first visible view in the stack.
150
+ * When new position data is given, the position data of the currently visible view will be updated.
151
+ *
152
+ * @param position Position options.
153
+ */
154
+ updatePosition(position?: Partial<PositionOptions>): void;
155
+ /**
156
+ * Shows the last view from the stack of a given ID.
157
+ */
158
+ showStack(id: string): void;
159
+ /**
160
+ * Initializes view instances.
161
+ */
162
+ private _createPanelView;
163
+ /**
164
+ * Returns the stack of the currently visible view.
165
+ */
166
+ private get _visibleStack();
167
+ /**
168
+ * Returns the ID of the given stack.
169
+ */
170
+ private _getStackId;
171
+ /**
172
+ * Shows the last view from the next stack.
173
+ */
174
+ private _showNextStack;
175
+ /**
176
+ * Shows the last view from the previous stack.
177
+ */
178
+ private _showPrevStack;
179
+ /**
180
+ * Creates a rotator view.
181
+ */
182
+ private _createRotatorView;
183
+ /**
184
+ * Creates a fake panels view.
185
+ */
186
+ private _createFakePanelsView;
187
+ /**
188
+ * Sets the view as the content of the balloon and attaches the balloon using position
189
+ * options of the first view.
190
+ *
191
+ * @param data Configuration.
192
+ * @param data.view The view to show in the balloon.
193
+ * @param data.balloonClassName Additional class name which will be added to the {@link #view balloon}.
194
+ * @param data.withArrow Whether the {@link #view balloon} should be rendered with an arrow.
195
+ */
196
+ private _showView;
197
+ /**
198
+ * Returns position options of the last view in the stack.
199
+ * This keeps the balloon in the same position when the view is changed.
200
+ */
201
+ private _getBalloonPosition;
202
+ }
203
+ /**
204
+ * The configuration of the view.
205
+ */
206
+ export interface ViewConfiguration {
207
+ /**
208
+ * The ID of the stack that the view is added to.
209
+ *
210
+ * @default 'main'
211
+ */
212
+ stackId?: string;
213
+ /**
214
+ * The content of the balloon.
215
+ */
216
+ view: View;
217
+ /**
218
+ * Positioning options.
219
+ */
220
+ position?: Partial<PositionOptions>;
221
+ /**
222
+ * An additional CSS class added to the {@link #view balloon} when visible.
223
+ */
224
+ balloonClassName?: string;
225
+ /**
226
+ * Whether the {@link #view balloon} should be rendered with an arrow.
227
+ *
228
+ * @default true
229
+ */
230
+ withArrow?: boolean;
231
+ /**
232
+ * Whether the view should be the only visible view even if other stacks were added.
233
+ *
234
+ * @default false
235
+ */
236
+ singleViewMode?: boolean;
237
+ }
238
+ /**
239
+ * Rotator view is a helper class for the {@link module:ui/panel/balloon/contextualballoon~ContextualBalloon ContextualBalloon}.
240
+ * It is used for displaying the last view from the current stack and providing navigation buttons for switching stacks.
241
+ * See the {@link module:ui/panel/balloon/contextualballoon~ContextualBalloon ContextualBalloon} documentation to learn more.
242
+ */
243
+ export declare class RotatorView extends View {
244
+ /**
245
+ * Used for checking if a view is focused or not.
246
+ */
247
+ readonly focusTracker: FocusTracker;
248
+ /**
249
+ * Navigation button for switching the stack to the previous one.
250
+ */
251
+ readonly buttonPrevView: ButtonView;
252
+ /**
253
+ * Navigation button for switching the stack to the next one.
254
+ */
255
+ readonly buttonNextView: ButtonView;
256
+ /**
257
+ * A collection of the child views that creates the rotator content.
258
+ */
259
+ readonly content: ViewCollection;
260
+ /**
261
+ * Defines whether navigation is visible or not.
262
+ *
263
+ * @observable
264
+ */
265
+ isNavigationVisible: boolean;
266
+ /**
267
+ * @observable
268
+ */
269
+ counter: string;
270
+ /**
271
+ * @inheritDoc
272
+ */
273
+ constructor(locale: Locale);
274
+ /**
275
+ * @inheritDoc
276
+ */
277
+ render(): void;
278
+ /**
279
+ * @inheritDoc
280
+ */
281
+ destroy(): void;
282
+ /**
283
+ * Shows a given view.
284
+ *
285
+ * @param view The view to show.
286
+ */
287
+ showView(view: View): void;
288
+ /**
289
+ * Hides the currently displayed view.
290
+ */
291
+ hideView(): void;
292
+ /**
293
+ * Creates a navigation button view.
294
+ *
295
+ * @param label The button label.
296
+ * @param icon The button icon.
297
+ */
298
+ private _createButtonView;
299
+ }
@@ -0,0 +1,156 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, 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/panel/sticky/stickypanelview
7
+ */
8
+ import View from '../../view.js';
9
+ import type ViewCollection from '../../viewcollection.js';
10
+ import { type Locale } from '@ckeditor/ckeditor5-utils';
11
+ import '../../../theme/components/panel/stickypanel.css';
12
+ /**
13
+ * The sticky panel view class.
14
+ */
15
+ export default class StickyPanelView extends View {
16
+ /**
17
+ * Collection of the child views which creates balloon panel contents.
18
+ */
19
+ readonly content: ViewCollection;
20
+ /**
21
+ * Controls whether the sticky panel should be active.
22
+ *
23
+ * @readonly
24
+ * @observable
25
+ */
26
+ isActive: boolean;
27
+ /**
28
+ * Controls whether the sticky panel is in the "sticky" state.
29
+ *
30
+ * @readonly
31
+ * @observable
32
+ */
33
+ isSticky: boolean;
34
+ /**
35
+ * The limiter element for the sticky panel instance. Its bounding rect limits
36
+ * the "stickyness" of the panel, i.e. when the panel reaches the bottom
37
+ * edge of the limiter, it becomes sticky to that edge and does not float
38
+ * off the limiter. It is mandatory for the panel to work properly and once
39
+ * set, it cannot be changed.
40
+ *
41
+ * @readonly
42
+ * @observable
43
+ */
44
+ limiterElement: HTMLElement | null;
45
+ /**
46
+ * The offset from the bottom edge of {@link #limiterElement}
47
+ * which stops the panel from stickying any further to prevent limiter's content
48
+ * from being completely covered.
49
+ *
50
+ * @readonly
51
+ * @observable
52
+ * @default 50
53
+ */
54
+ limiterBottomOffset: number;
55
+ /**
56
+ * The offset from the top edge of the web browser's viewport which makes the
57
+ * panel become sticky. The default value is `0`, which means the panel becomes
58
+ * sticky when it's upper edge touches the top of the page viewport.
59
+ *
60
+ * This attribute is useful when the web page has UI elements positioned to the top
61
+ * either using `position: fixed` or `position: sticky`, which would cover the
62
+ * sticky panel or vice–versa (depending on the `z-index` hierarchy).
63
+ *
64
+ * Bound to {@link module:ui/editorui/editorui~EditorUI#viewportOffset `EditorUI#viewportOffset`}.
65
+ *
66
+ * If {@link module:core/editor/editorconfig~EditorConfig#ui `EditorConfig#ui.viewportOffset.top`} is defined, then
67
+ * it will override the default value.
68
+ *
69
+ * @observable
70
+ * @default 0
71
+ */
72
+ viewportTopOffset: number;
73
+ /**
74
+ * The panel which accepts children into {@link #content} collection.
75
+ * Also an element which is positioned when {@link #isSticky}.
76
+ */
77
+ contentPanelElement: HTMLElement;
78
+ /**
79
+ * Controls the `margin-left` CSS style of the panel.
80
+ *
81
+ * @private
82
+ * @readonly
83
+ * @observable
84
+ */
85
+ _marginLeft: string | null;
86
+ /**
87
+ * Set `true` if the sticky panel reached the bottom edge of the
88
+ * {@link #limiterElement}.
89
+ *
90
+ * @private
91
+ * @readonly
92
+ * @observable
93
+ */
94
+ _isStickyToTheBottomOfLimiter: boolean;
95
+ /**
96
+ * The `top` CSS position of the panel when it is sticky to the top of the viewport or scrollable
97
+ * ancestors of the {@link #limiterElement}.
98
+ *
99
+ * @private
100
+ * @readonly
101
+ * @observable
102
+ */
103
+ _stickyTopOffset: number | null;
104
+ /**
105
+ * The `bottom` CSS position of the panel when it is sticky to the bottom of the {@link #limiterElement}.
106
+ *
107
+ * @private
108
+ * @readonly
109
+ * @observable
110
+ */
111
+ _stickyBottomOffset: number | null;
112
+ /**
113
+ * A dummy element which visually fills the space as long as the
114
+ * actual panel is sticky. It prevents flickering of the UI.
115
+ */
116
+ private _contentPanelPlaceholder;
117
+ /**
118
+ * @inheritDoc
119
+ */
120
+ constructor(locale?: Locale);
121
+ /**
122
+ * @inheritDoc
123
+ */
124
+ render(): void;
125
+ /**
126
+ * Analyzes the environment to decide whether the panel should be sticky or not.
127
+ * Then handles the positioning of the panel.
128
+ */
129
+ checkIfShouldBeSticky(): void;
130
+ /**
131
+ * Sticks the panel at the given CSS `top` offset.
132
+ *
133
+ * @private
134
+ * @param topOffset
135
+ */
136
+ private _stickToTopOfAncestors;
137
+ /**
138
+ * Sticks the panel at the bottom of the limiter with a given CSS `bottom` offset.
139
+ *
140
+ * @private
141
+ * @param stickyBottomOffset
142
+ */
143
+ private _stickToBottomOfLimiter;
144
+ /**
145
+ * Unsticks the panel putting it back to its original position.
146
+ *
147
+ * @private
148
+ */
149
+ private _unstick;
150
+ /**
151
+ * Returns the bounding rect of the {@link #contentPanelElement}.
152
+ *
153
+ * @private
154
+ */
155
+ private get _contentPanelRect();
156
+ }
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, 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
+ import type { FocusableView } from '../focuscycler.js';
6
+ /**
7
+ * @module ui/search/filteredview
8
+ */
9
+ /**
10
+ * A view that can be filtered by a {@link module:ui/search/text/searchtextview~SearchTextView}.
11
+ */
12
+ export default interface FilteredView extends FocusableView {
13
+ /**
14
+ * Filters the view by the given regular expression.
15
+ */
16
+ filter(regExp: RegExp | null): {
17
+ resultsCount: number;
18
+ totalItemsCount: number;
19
+ };
20
+ }
21
+ /**
22
+ * Fired when the user selects an autocomplete option. The event data should contain the selected value.
23
+ *
24
+ * @eventName ~FilteredView#execute
25
+ */
26
+ export interface FilteredViewExecuteEvent {
27
+ name: 'execute';
28
+ args: [{
29
+ value: string;
30
+ }];
31
+ }
@@ -0,0 +1,45 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, 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/search/searchinfoview
7
+ */
8
+ import type { FocusableView } from '../focuscycler.js';
9
+ import View from '../view.js';
10
+ /**
11
+ * A view displaying an information text related to different states of {@link module:ui/search/text/searchtextview~SearchTextView}.
12
+ *
13
+ * @internal
14
+ */
15
+ export default class SearchInfoView extends View implements FocusableView {
16
+ /**
17
+ * Controls whether the view is visible.
18
+ *
19
+ * @observable
20
+ * @default false
21
+ */
22
+ isVisible: boolean;
23
+ /**
24
+ * Controls the primary line of text in the info.
25
+ *
26
+ * @observable
27
+ * @default ''
28
+ */
29
+ primaryText: string;
30
+ /**
31
+ * Controls the secondary line of text in the info.
32
+ *
33
+ * @observable
34
+ * @default ''
35
+ */
36
+ secondaryText: string;
37
+ /**
38
+ * @inheritDoc
39
+ */
40
+ constructor();
41
+ /**
42
+ * Focuses the view
43
+ */
44
+ focus(): void;
45
+ }
@@ -0,0 +1,54 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, 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/search/searchresultsview
7
+ */
8
+ import View from '../view.js';
9
+ import type ViewCollection from '../viewcollection.js';
10
+ import { FocusTracker, type Locale } from '@ckeditor/ckeditor5-utils';
11
+ import { default as FocusCycler, type FocusableView } from '../focuscycler.js';
12
+ /**
13
+ * A sub-component of {@link module:ui/search/text/searchtextview~SearchTextView}. It hosts the filtered and the information views.
14
+ */
15
+ export default class SearchResultsView extends View implements FocusableView {
16
+ /**
17
+ * Tracks information about the DOM focus in the view.
18
+ *
19
+ * @readonly
20
+ */
21
+ focusTracker: FocusTracker;
22
+ /**
23
+ * The collection of the child views inside of the list item {@link #element}.
24
+ *
25
+ * @readonly
26
+ */
27
+ children: ViewCollection<FocusableView>;
28
+ /**
29
+ * Provides the focus management (keyboard navigation) in the view.
30
+ *
31
+ * @readonly
32
+ */
33
+ protected _focusCycler: FocusCycler;
34
+ /**
35
+ * @inheritDoc
36
+ */
37
+ constructor(locale: Locale);
38
+ /**
39
+ * @inheritDoc
40
+ */
41
+ render(): void;
42
+ /**
43
+ * Focuses the view.
44
+ */
45
+ focus(): void;
46
+ /**
47
+ * Focuses the first child view.
48
+ */
49
+ focusFirst(): void;
50
+ /**
51
+ * Focuses the last child view.
52
+ */
53
+ focusLast(): void;
54
+ }
@@ -0,0 +1,76 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, 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/search/text/searchtextqueryview
7
+ */
8
+ import ButtonView from '../../button/buttonview.js';
9
+ import IconView from '../../icon/iconview.js';
10
+ import LabeledFieldView, { type LabeledFieldViewCreator } from '../../labeledfield/labeledfieldview.js';
11
+ import type InputBase from '../../input/inputbase.js';
12
+ import type { Locale } from '@ckeditor/ckeditor5-utils';
13
+ /**
14
+ * A search input field for the {@link module:ui/search/text/searchtextview~SearchTextView} component.
15
+ *
16
+ * @internal
17
+ * @extends module:ui/labeledfield/labeledfieldview~LabeledFieldView
18
+ */
19
+ export default class SearchTextQueryView<TQueryFieldView extends InputBase<HTMLInputElement | HTMLTextAreaElement>> extends LabeledFieldView<TQueryFieldView> {
20
+ /**
21
+ * The loupe icon displayed next to the {@link #fieldView}.
22
+ */
23
+ iconView?: IconView;
24
+ /**
25
+ * The button that clears and focuses the {@link #fieldView}.
26
+ */
27
+ resetButtonView?: ButtonView;
28
+ /**
29
+ * A reference to the view configuration.
30
+ */
31
+ private readonly _viewConfig;
32
+ /**
33
+ * @inheritDoc
34
+ */
35
+ constructor(locale: Locale, config: SearchTextQueryViewConfig<TQueryFieldView>);
36
+ /**
37
+ * Resets the search field to its default state.
38
+ */
39
+ reset(): void;
40
+ }
41
+ /**
42
+ * An event fired when the field is reset using the
43
+ * {@link module:ui/search/text/searchtextqueryview~SearchTextQueryView#resetButtonView}.
44
+ *
45
+ * @eventName ~SearchTextQueryView#reset
46
+ */
47
+ export type SearchTextQueryViewResetEvent = {
48
+ name: 'reset';
49
+ args: [];
50
+ };
51
+ /**
52
+ * The configuration of the {@link module:ui/search/text/searchtextqueryview~SearchTextQueryView} view.
53
+ */
54
+ export interface SearchTextQueryViewConfig<TConfigSearchField extends InputBase<HTMLInputElement | HTMLTextAreaElement>> {
55
+ /**
56
+ * The human-readable label of the search field.
57
+ */
58
+ label: string;
59
+ /**
60
+ * Determines whether the button that resets the search should be visible.
61
+ *
62
+ * @default true
63
+ */
64
+ showResetButton?: boolean;
65
+ /**
66
+ * Determines whether the loupe icon should be visible.
67
+ *
68
+ * @default true
69
+ */
70
+ showIcon?: boolean;
71
+ /**
72
+ * The function that creates the search field input view. By default, a plain
73
+ * {@link module:ui/inputtext/inputtextview~InputTextView} is used for this purpose.
74
+ */
75
+ creator?: LabeledFieldViewCreator<TConfigSearchField>;
76
+ }