@ckeditor/ckeditor5-ui 40.1.0 → 40.2.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.
package/CHANGELOG.md CHANGED
@@ -5,7 +5,7 @@ All changes in the package are documented in the main repository. See: https://g
5
5
 
6
6
  Changes for the past releases are available below.
7
7
 
8
- ## [19.0.0](https://github.com/ckeditor/ckeditor5-ui/compare/v18.0.0...v19.0.0) (2020-04-29)
8
+ ## [19.0.0](https://github.com/ckeditor/ckeditor5-ui/compare/v18.0.0...v19.0.0) (April 29, 2020)
9
9
 
10
10
  ### MAJOR BREAKING CHANGES
11
11
 
@@ -38,7 +38,7 @@ Changes for the past releases are available below.
38
38
  * Updated translations. ([2a391d6](https://github.com/ckeditor/ckeditor5-ui/commit/2a391d6))
39
39
 
40
40
 
41
- ## [18.0.0](https://github.com/ckeditor/ckeditor5-ui/compare/v17.0.0...v18.0.0) (2020-03-19)
41
+ ## [18.0.0](https://github.com/ckeditor/ckeditor5-ui/compare/v17.0.0...v18.0.0) (March 19, 2020)
42
42
 
43
43
  ### MAJOR BREAKING CHANGES
44
44
 
@@ -55,7 +55,7 @@ Changes for the past releases are available below.
55
55
  * Updated translations. ([ace38eb](https://github.com/ckeditor/ckeditor5-ui/commit/ace38eb))
56
56
 
57
57
 
58
- ## [17.0.0](https://github.com/ckeditor/ckeditor5-ui/compare/v16.0.0...v17.0.0) (2020-02-19)
58
+ ## [17.0.0](https://github.com/ckeditor/ckeditor5-ui/compare/v16.0.0...v17.0.0) (February 19, 2020)
59
59
 
60
60
  ### Features
61
61
 
@@ -77,7 +77,7 @@ Changes for the past releases are available below.
77
77
  * Updated translations. ([b8bd38e](https://github.com/ckeditor/ckeditor5-ui/commit/b8bd38e))
78
78
 
79
79
 
80
- ## [16.0.0](https://github.com/ckeditor/ckeditor5-ui/compare/v15.0.0...v16.0.0) (2019-12-04)
80
+ ## [16.0.0](https://github.com/ckeditor/ckeditor5-ui/compare/v15.0.0...v16.0.0) (December 4, 2019)
81
81
 
82
82
  ### Features
83
83
 
@@ -92,7 +92,7 @@ Changes for the past releases are available below.
92
92
  * Updated translations. ([16ee253](https://github.com/ckeditor/ckeditor5-ui/commit/16ee253))
93
93
 
94
94
 
95
- ## [15.0.0](https://github.com/ckeditor/ckeditor5-ui/compare/v14.0.0...v15.0.0) (2019-10-23)
95
+ ## [15.0.0](https://github.com/ckeditor/ckeditor5-ui/compare/v14.0.0...v15.0.0) (October 23, 2019)
96
96
 
97
97
  ### MAJOR BREAKING CHANGES
98
98
 
@@ -107,7 +107,7 @@ Changes for the past releases are available below.
107
107
  * Updated translations. ([c233bb7](https://github.com/ckeditor/ckeditor5-ui/commit/c233bb7)) ([f8f07b2](https://github.com/ckeditor/ckeditor5-ui/commit/f8f07b2))
108
108
 
109
109
 
110
- ## [14.0.0](https://github.com/ckeditor/ckeditor5-ui/compare/v13.0.2...v14.0.0) (2019-08-26)
110
+ ## [14.0.0](https://github.com/ckeditor/ckeditor5-ui/compare/v13.0.2...v14.0.0) (August 26, 2019)
111
111
 
112
112
  ### Features
113
113
 
@@ -129,21 +129,21 @@ Changes for the past releases are available below.
129
129
  * The `ToolbarView` class requires the [editor locale](https://ckeditor.com/docs/ckeditor5/latest/api/module_utils_locale-Locale.html) to be passed into the constructor.
130
130
 
131
131
 
132
- ## [13.0.2](https://github.com/ckeditor/ckeditor5-ui/compare/v13.0.1...v13.0.2) (2019-07-10)
132
+ ## [13.0.2](https://github.com/ckeditor/ckeditor5-ui/compare/v13.0.1...v13.0.2) (July 10, 2019)
133
133
 
134
134
  ### Other changes
135
135
 
136
136
  * Updated translations. ([ad189b6](https://github.com/ckeditor/ckeditor5-ui/commit/ad189b6))
137
137
 
138
138
 
139
- ## [13.0.1](https://github.com/ckeditor/ckeditor5-ui/compare/v13.0.0...v13.0.1) (2019-07-04)
139
+ ## [13.0.1](https://github.com/ckeditor/ckeditor5-ui/compare/v13.0.0...v13.0.1) (July 4, 2019)
140
140
 
141
141
  ### Other changes
142
142
 
143
143
  * Updated translations. ([1964cc0](https://github.com/ckeditor/ckeditor5-ui/commit/1964cc0)) ([11cfd41](https://github.com/ckeditor/ckeditor5-ui/commit/11cfd41))
144
144
 
145
145
 
146
- ## [13.0.0](https://github.com/ckeditor/ckeditor5-ui/compare/v12.1.0...v13.0.0) (2019-06-05)
146
+ ## [13.0.0](https://github.com/ckeditor/ckeditor5-ui/compare/v12.1.0...v13.0.0) (June 6, 2019)
147
147
 
148
148
  ### Features
149
149
 
@@ -162,7 +162,7 @@ Changes for the past releases are available below.
162
162
  * The (misspelled) `InputTextView#ariaDesribedById` property is no longer available. Use `ariaDescribedById` instead.
163
163
 
164
164
 
165
- ## [12.1.0](https://github.com/ckeditor/ckeditor5-ui/compare/v12.0.0...v12.1.0) (2019-04-10)
165
+ ## [12.1.0](https://github.com/ckeditor/ckeditor5-ui/compare/v12.0.0...v12.1.0) (April 4, 2019)
166
166
 
167
167
  ### Features
168
168
 
@@ -178,7 +178,7 @@ Changes for the past releases are available below.
178
178
  * Updated translations. ([dcdca2e](https://github.com/ckeditor/ckeditor5-ui/commit/dcdca2e))
179
179
 
180
180
 
181
- ## [12.0.0](https://github.com/ckeditor/ckeditor5-ui/compare/v11.2.0...v12.0.0) (2019-02-28)
181
+ ## [12.0.0](https://github.com/ckeditor/ckeditor5-ui/compare/v11.2.0...v12.0.0) (February 28, 2019)
182
182
 
183
183
  ### Bug fixes
184
184
 
@@ -199,7 +199,7 @@ Changes for the past releases are available below.
199
199
  * The `EditorUIView#editableElement` property was made private. Use `editor.ui.getEditableElement()` method instead.
200
200
 
201
201
 
202
- ## [11.2.0](https://github.com/ckeditor/ckeditor5-ui/compare/v11.1.0...v11.2.0) (2018-12-05)
202
+ ## [11.2.0](https://github.com/ckeditor/ckeditor5-ui/compare/v11.1.0...v11.2.0) (December 5, 2018)
203
203
 
204
204
  ### Features
205
205
 
@@ -216,7 +216,7 @@ Changes for the past releases are available below.
216
216
  * Updated translations. ([2e409a9](https://github.com/ckeditor/ckeditor5-ui/commit/2e409a9)) ([611bd04](https://github.com/ckeditor/ckeditor5-ui/commit/611bd04)) ([c6689e4](https://github.com/ckeditor/ckeditor5-ui/commit/c6689e4)) ([07c4fdb](https://github.com/ckeditor/ckeditor5-ui/commit/07c4fdb))
217
217
 
218
218
 
219
- ## [11.1.0](https://github.com/ckeditor/ckeditor5-ui/compare/v11.0.0...v11.1.0) (2018-10-08)
219
+ ## [11.1.0](https://github.com/ckeditor/ckeditor5-ui/compare/v11.0.0...v11.1.0) (October 8, 2018)
220
220
 
221
221
  ### Features
222
222
 
@@ -232,7 +232,7 @@ Changes for the past releases are available below.
232
232
  * Updated translations. ([e58bcbb](https://github.com/ckeditor/ckeditor5-ui/commit/e58bcbb))
233
233
 
234
234
 
235
- ## [11.0.0](https://github.com/ckeditor/ckeditor5-ui/compare/v10.1.0...v11.0.0) (2018-07-18)
235
+ ## [11.0.0](https://github.com/ckeditor/ckeditor5-ui/compare/v10.1.0...v11.0.0) (July 18, 2018)
236
236
 
237
237
  ### Features
238
238
 
@@ -263,7 +263,7 @@ Changes for the past releases are available below.
263
263
  * The `.ck-button` and `.ck-list` classes are using `flex` which may have an impact on rendering.
264
264
 
265
265
 
266
- ## [10.1.0](https://github.com/ckeditor/ckeditor5-ui/compare/v10.0.0...v10.1.0) (2018-06-21)
266
+ ## [10.1.0](https://github.com/ckeditor/ckeditor5-ui/compare/v10.0.0...v10.1.0) (June 21, 2018)
267
267
 
268
268
  ### Features
269
269
 
@@ -283,7 +283,7 @@ Changes for the past releases are available below.
283
283
  * Updated translations. ([084e8c6](https://github.com/ckeditor/ckeditor5-ui/commit/084e8c6))
284
284
 
285
285
 
286
- ## [10.0.0](https://github.com/ckeditor/ckeditor5-ui/compare/v1.0.0-beta.4...v10.0.0) (2018-04-25)
286
+ ## [10.0.0](https://github.com/ckeditor/ckeditor5-ui/compare/v1.0.0-beta.4...v10.0.0) (April 25, 2018)
287
287
 
288
288
  ### Other changes
289
289
 
@@ -294,12 +294,12 @@ Changes for the past releases are available below.
294
294
  * The license under which CKEditor 5 is released has been changed from a triple GPL, LGPL and MPL license to a GPL2+ only. See [ckeditor/ckeditor5#991](https://github.com/ckeditor/ckeditor5/issues/991) for more information.
295
295
 
296
296
 
297
- ## [1.0.0-beta.4](https://github.com/ckeditor/ckeditor5-ui/compare/v1.0.0-beta.2...v1.0.0-beta.4) (2018-04-19)
297
+ ## [1.0.0-beta.4](https://github.com/ckeditor/ckeditor5-ui/compare/v1.0.0-beta.2...v1.0.0-beta.4) (April 19, 2018)
298
298
 
299
299
  Internal changes only (updated dependencies, documentation, etc.).
300
300
 
301
301
 
302
- ## [1.0.0-beta.2](https://github.com/ckeditor/ckeditor5-ui/compare/v1.0.0-beta.1...v1.0.0-beta.2) (2018-04-10)
302
+ ## [1.0.0-beta.2](https://github.com/ckeditor/ckeditor5-ui/compare/v1.0.0-beta.1...v1.0.0-beta.2) (April 10, 2018)
303
303
 
304
304
  ### Other changes
305
305
 
@@ -310,7 +310,7 @@ Internal changes only (updated dependencies, documentation, etc.).
310
310
  * `View#registerChildren()` and `View#deregisterChildren()` have been renamed to `View#registerChild()` and `View#deregisterChild()`.
311
311
 
312
312
 
313
- ## [1.0.0-beta.1](https://github.com/ckeditor/ckeditor5-ui/compare/v1.0.0-alpha.2...v1.0.0-beta.1) (2018-03-15)
313
+ ## [1.0.0-beta.1](https://github.com/ckeditor/ckeditor5-ui/compare/v1.0.0-alpha.2...v1.0.0-beta.1) (March 15, 2018)
314
314
 
315
315
  ### Features
316
316
 
@@ -356,7 +356,7 @@ Internal changes only (updated dependencies, documentation, etc.).
356
356
  * The styles are no longer developed in SASS which means the `.scss` files became unavailable. Please refer to the [Theme Customization](https://ckeditor.com/docs/ckeditor5/latest/framework/guides/ui/theme-customization.html) guide to learn more about migration to PostCSS.
357
357
 
358
358
 
359
- ## [1.0.0-alpha.2](https://github.com/ckeditor/ckeditor5-ui/compare/v1.0.0-alpha.1...v1.0.0-alpha.2) (2017-11-14)
359
+ ## [1.0.0-alpha.2](https://github.com/ckeditor/ckeditor5-ui/compare/v1.0.0-alpha.1...v1.0.0-alpha.2) (November 14, 2017)
360
360
 
361
361
  ### Bug fixes
362
362
 
@@ -385,14 +385,14 @@ Internal changes only (updated dependencies, documentation, etc.).
385
385
  * The DOM structure of the `StickyPanelView` has changed along with the class names. Please refer to the component documentation to learn more.
386
386
 
387
387
 
388
- ## [1.0.0-alpha.1](https://github.com/ckeditor/ckeditor5-ui/compare/v0.10.0...v1.0.0-alpha.1) (2017-10-03)
388
+ ## [1.0.0-alpha.1](https://github.com/ckeditor/ckeditor5-ui/compare/v0.10.0...v1.0.0-alpha.1) (October 3, 2017)
389
389
 
390
390
  ### Bug fixes
391
391
 
392
392
  * `ContextualBalloon` should remember position passed to `#updatePosition()`. Closes [#305](https://github.com/ckeditor/ckeditor5-ui/issues/305). Closes [ckeditor/ckeditor5-image#141](https://github.com/ckeditor/ckeditor5-image/issues/141). ([c787c0d](https://github.com/ckeditor/ckeditor5-ui/commit/c787c0d))
393
393
  * `ContextualToolbar` should not be positioned to a zero–width DOM rect when invoked for a multi-line forward selection. Closes [#308](https://github.com/ckeditor/ckeditor5-ui/issues/308). ([00b701b](https://github.com/ckeditor/ckeditor5-ui/commit/00b701b))
394
394
  * `ContextualToolbar` will accept the object format of `config.contextualToolbar`. Closes [#316](https://github.com/ckeditor/ckeditor5-ui/issues/316). ([d71cad8](https://github.com/ckeditor/ckeditor5-ui/commit/d71cad8))
395
- * Fixed sticky panel's `z-index` so it's correctly rendered above images (or other relatively positioned elements). Closes [#315](https://github.com/ckeditor/ckeditor5-ui/issues/315). ([00f2add](https://github.com/ckeditor/ckeditor5-ui/commit/00f2add))
395
+ * Fixed sticky panel's `z-index` so it is correctly rendered above images (or other relatively positioned elements). Closes [#315](https://github.com/ckeditor/ckeditor5-ui/issues/315). ([00f2add](https://github.com/ckeditor/ckeditor5-ui/commit/00f2add))
396
396
  * The content of the `BalloonPanelView` should be selectable. Closes [#294](https://github.com/ckeditor/ckeditor5-ui/issues/294). Closes https://github.com/ckeditor/ckeditor5/issues/498. ([e5315df](https://github.com/ckeditor/ckeditor5-ui/commit/e5315df))
397
397
 
398
398
  ### Features
@@ -413,7 +413,7 @@ refer to the `KeystrokeHandler` helper to learn more.
413
413
  * The `StickyToolbarView` and corresponding CSS `.ck-sticky-panel` classes are no longer available. `StickyPanelView` + `ToolbarView` combo should be used instead.
414
414
 
415
415
 
416
- ## [0.10.0](https://github.com/ckeditor/ckeditor5-ui/compare/v0.9.0...v0.10.0) (2017-09-03)
416
+ ## [0.10.0](https://github.com/ckeditor/ckeditor5-ui/compare/v0.9.0...v0.10.0) (September 3, 2017)
417
417
 
418
418
  ### Bug fixes
419
419
 
@@ -460,7 +460,7 @@ refer to the `KeystrokeHandler` helper to learn more.
460
460
  * The position names in `BalloonPanelView.defaultPositions` and their results have changed. Please refer to the latest API documentation to learn more.
461
461
 
462
462
 
463
- ## [0.9.0](https://github.com/ckeditor/ckeditor5-ui/compare/v0.8.0...v0.9.0) (2017-05-07)
463
+ ## [0.9.0](https://github.com/ckeditor/ckeditor5-ui/compare/v0.8.0...v0.9.0) (May 7, 2017)
464
464
 
465
465
  ### Bug fixes
466
466
 
@@ -506,7 +506,7 @@ refer to the `KeystrokeHandler` helper to learn more.
506
506
  * Default position names in `BalloonPanelView.defaultPositions` have changed. Now prefixed with `arrow_`.
507
507
 
508
508
 
509
- ## [0.8.0](https://github.com/ckeditor/ckeditor5-ui/compare/v0.7.1...v0.8.0) (2017-04-05)
509
+ ## [0.8.0](https://github.com/ckeditor/ckeditor5-ui/compare/v0.7.1...v0.8.0) (April 5, 2017)
510
510
 
511
511
  ### Features
512
512
 
@@ -527,7 +527,7 @@ refer to the `KeystrokeHandler` helper to learn more.
527
527
  * The `ui/balloonpanel/balloonpanelview` module was renamed to `ui/panel/balloon/balloonpanelview`. See [#152](https://github.com/ckeditor/ckeditor5-ui/issues/152).
528
528
 
529
529
 
530
- ## [0.7.1](https://github.com/ckeditor/ckeditor5-ui/compare/v0.7.0...v0.8.0) (2017-03-06)
530
+ ## [0.7.1](https://github.com/ckeditor/ckeditor5-ui/compare/v0.7.0...v0.8.0) (March 6, 2017)
531
531
 
532
532
  ### Bug fixes
533
533
 
@@ -31,11 +31,11 @@ msgstr "Editar bloque"
31
31
 
32
32
  msgctxt "First part of the label of the block toolbar icon when functionality of drag and drop is available (a block toolbar is displayed next to each paragraph, heading, list item, etc. and contains e.g. block formatting options)"
33
33
  msgid "Click to edit block"
34
- msgstr ""
34
+ msgstr "Prema para editar o bloque"
35
35
 
36
36
  msgctxt "Second part of the label of the block toolbar icon when functionality of drag and drop is available (a block toolbar is displayed next to each paragraph, heading, list item, etc. and contains e.g. block formatting options)"
37
37
  msgid "Drag to move"
38
- msgstr ""
38
+ msgstr "Arrastre para mover"
39
39
 
40
40
  msgctxt "Label for a button showing the next thing (tab, page, etc.)."
41
41
  msgid "Next"
@@ -131,8 +131,8 @@ msgstr "Aceptar"
131
131
 
132
132
  msgctxt "The main text of the message shown to the user when given query does not match any results."
133
133
  msgid "No results found"
134
- msgstr ""
134
+ msgstr "Non se atoparon resultados"
135
135
 
136
136
  msgctxt "The main text of the message shown to the user when no results are available."
137
137
  msgid "No searchable items"
138
- msgstr ""
138
+ msgstr "Non hai elementos que se poidan buscar"
@@ -31,11 +31,11 @@ msgstr "Blok uređivač"
31
31
 
32
32
  msgctxt "First part of the label of the block toolbar icon when functionality of drag and drop is available (a block toolbar is displayed next to each paragraph, heading, list item, etc. and contains e.g. block formatting options)"
33
33
  msgid "Click to edit block"
34
- msgstr ""
34
+ msgstr "Kliknite da biste uredili blok"
35
35
 
36
36
  msgctxt "Second part of the label of the block toolbar icon when functionality of drag and drop is available (a block toolbar is displayed next to each paragraph, heading, list item, etc. and contains e.g. block formatting options)"
37
37
  msgid "Drag to move"
38
- msgstr ""
38
+ msgstr "Prevucite da biste premestili"
39
39
 
40
40
  msgctxt "Label for a button showing the next thing (tab, page, etc.)."
41
41
  msgid "Next"
@@ -123,16 +123,16 @@ msgstr "Kontekstualna traka sa alatkama Editor"
123
123
 
124
124
  msgctxt "Label of an input field for typing colors in the HEX color format."
125
125
  msgid "HEX"
126
- msgstr ""
126
+ msgstr "HEX"
127
127
 
128
128
  msgctxt "Label of the button closing the color picker and confirming the changes done in the color selector component."
129
129
  msgid "Accept"
130
- msgstr ""
130
+ msgstr "Prihvati"
131
131
 
132
132
  msgctxt "The main text of the message shown to the user when given query does not match any results."
133
133
  msgid "No results found"
134
- msgstr ""
134
+ msgstr "Nije pronađen nijedan rezultat"
135
135
 
136
136
  msgctxt "The main text of the message shown to the user when no results are available."
137
137
  msgid "No searchable items"
138
- msgstr ""
138
+ msgstr "Nema stavki koje se mogu pretražiti"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-ui",
3
- "version": "40.1.0",
3
+ "version": "40.2.0",
4
4
  "description": "The UI framework and standard UI library of CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -11,8 +11,8 @@
11
11
  ],
12
12
  "main": "src/index.js",
13
13
  "dependencies": {
14
- "@ckeditor/ckeditor5-core": "40.1.0",
15
- "@ckeditor/ckeditor5-utils": "40.1.0",
14
+ "@ckeditor/ckeditor5-core": "40.2.0",
15
+ "@ckeditor/ckeditor5-utils": "40.2.0",
16
16
  "color-convert": "2.0.1",
17
17
  "color-parse": "1.4.2",
18
18
  "lodash-es": "4.17.21",
@@ -0,0 +1,69 @@
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/collapsible/collapsibleview
7
+ */
8
+ import type { Locale } from '@ckeditor/ckeditor5-utils';
9
+ import View from '../view';
10
+ import ButtonView from '../button/buttonview';
11
+ import type ViewCollection from '../viewcollection';
12
+ import '../../theme/components/collapsible/collapsible.css';
13
+ /**
14
+ * A collapsible UI component. Consists of a labeled button and a container which can be collapsed
15
+ * by clicking the button. The collapsible container can be a host to other UI views.
16
+ *
17
+ * @internal
18
+ */
19
+ export default class CollapsibleView extends View {
20
+ /**
21
+ * `true` when the container with {@link #children} is collapsed. `false` otherwise.
22
+ *
23
+ * @observable
24
+ */
25
+ isCollapsed: boolean;
26
+ /**
27
+ * The text label of the {@link #buttonView}.
28
+ *
29
+ * @observable
30
+ * @default 'Show more'
31
+ */
32
+ label: string;
33
+ /**
34
+ * The ID of the label inside the {@link #buttonView} that describes the collapsible
35
+ * container for assistive technologies. Set after the button was {@link #render rendered}.
36
+ *
37
+ * @internal
38
+ * @readonly
39
+ * @observable
40
+ */
41
+ _collapsibleAriaLabelUid: string | undefined;
42
+ /**
43
+ * The main button that, when clicked, collapses or expands the container with {@link #children}.
44
+ */
45
+ readonly buttonView: ButtonView;
46
+ /**
47
+ * A collection of the child views that can be collapsed by clicking the {@link #buttonView}.
48
+ */
49
+ readonly children: ViewCollection;
50
+ /**
51
+ * Creates an instance of the collapsible view.
52
+ *
53
+ * @param locale The {@link module:core/editor/editor~Editor#locale} instance.
54
+ * @param childViews An optional array of initial child views to be inserted into the collapsible.
55
+ */
56
+ constructor(locale: Locale, childViews?: Array<View>);
57
+ /**
58
+ * @inheritDoc
59
+ */
60
+ render(): void;
61
+ /**
62
+ * Focuses the first focusable.
63
+ */
64
+ focus(): void;
65
+ /**
66
+ * Creates the main {@link #buttonView} of the collapsible.
67
+ */
68
+ private _createButtonView;
69
+ }
@@ -0,0 +1,95 @@
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
+ import View from '../view';
6
+ import ButtonView from '../button/buttonview';
7
+ import dropdownArrowIcon from '../../theme/icons/dropdown-arrow.svg';
8
+ import '../../theme/components/collapsible/collapsible.css';
9
+ /**
10
+ * A collapsible UI component. Consists of a labeled button and a container which can be collapsed
11
+ * by clicking the button. The collapsible container can be a host to other UI views.
12
+ *
13
+ * @internal
14
+ */
15
+ export default class CollapsibleView extends View {
16
+ /**
17
+ * Creates an instance of the collapsible view.
18
+ *
19
+ * @param locale The {@link module:core/editor/editor~Editor#locale} instance.
20
+ * @param childViews An optional array of initial child views to be inserted into the collapsible.
21
+ */
22
+ constructor(locale, childViews) {
23
+ super(locale);
24
+ const bind = this.bindTemplate;
25
+ this.set('isCollapsed', false);
26
+ this.set('label', '');
27
+ this.buttonView = this._createButtonView();
28
+ this.children = this.createCollection();
29
+ this.set('_collapsibleAriaLabelUid', undefined);
30
+ if (childViews) {
31
+ this.children.addMany(childViews);
32
+ }
33
+ this.setTemplate({
34
+ tag: 'div',
35
+ attributes: {
36
+ class: [
37
+ 'ck',
38
+ 'ck-collapsible',
39
+ bind.if('isCollapsed', 'ck-collapsible_collapsed')
40
+ ]
41
+ },
42
+ children: [
43
+ this.buttonView,
44
+ {
45
+ tag: 'div',
46
+ attributes: {
47
+ class: [
48
+ 'ck',
49
+ 'ck-collapsible__children'
50
+ ],
51
+ role: 'region',
52
+ hidden: bind.if('isCollapsed', 'hidden'),
53
+ 'aria-labelledby': bind.to('_collapsibleAriaLabelUid')
54
+ },
55
+ children: this.children
56
+ }
57
+ ]
58
+ });
59
+ }
60
+ /**
61
+ * @inheritDoc
62
+ */
63
+ render() {
64
+ super.render();
65
+ this._collapsibleAriaLabelUid = this.buttonView.labelView.element.id;
66
+ }
67
+ /**
68
+ * Focuses the first focusable.
69
+ */
70
+ focus() {
71
+ this.buttonView.focus();
72
+ }
73
+ /**
74
+ * Creates the main {@link #buttonView} of the collapsible.
75
+ */
76
+ _createButtonView() {
77
+ const buttonView = new ButtonView(this.locale);
78
+ const bind = buttonView.bindTemplate;
79
+ buttonView.set({
80
+ withText: true,
81
+ icon: dropdownArrowIcon
82
+ });
83
+ buttonView.extendTemplate({
84
+ attributes: {
85
+ 'aria-expanded': bind.to('isOn', value => String(value))
86
+ }
87
+ });
88
+ buttonView.bind('label').to(this);
89
+ buttonView.bind('isOn').to(this, 'isCollapsed', isCollapsed => !isCollapsed);
90
+ buttonView.on('execute', () => {
91
+ this.isCollapsed = !this.isCollapsed;
92
+ });
93
+ return buttonView;
94
+ }
95
+ }
@@ -10,6 +10,7 @@ import ButtonView from '../../button/buttonview';
10
10
  import type ViewCollection from '../../viewcollection';
11
11
  import type Button from '../../button/button';
12
12
  import type DropdownButton from './dropdownbutton';
13
+ import type { FocusableView } from '../../focuscycler';
13
14
  import { KeystrokeHandler, FocusTracker, type Locale } from '@ckeditor/ckeditor5-utils';
14
15
  import '../../../theme/components/dropdown/splitbutton.css';
15
16
  /**
@@ -135,7 +136,7 @@ export default class SplitButtonView extends View<HTMLDivElement> implements Dro
135
136
  /**
136
137
  * @inheritDoc
137
138
  */
138
- constructor(locale?: Locale);
139
+ constructor(locale?: Locale, actionButton?: ButtonView & FocusableView);
139
140
  /**
140
141
  * @inheritDoc
141
142
  */
@@ -33,7 +33,7 @@ export default class SplitButtonView extends View {
33
33
  /**
34
34
  * @inheritDoc
35
35
  */
36
- constructor(locale) {
36
+ constructor(locale, actionButton) {
37
37
  super(locale);
38
38
  const bind = this.bindTemplate;
39
39
  // Implement the Button interface.
@@ -53,7 +53,7 @@ export default class SplitButtonView extends View {
53
53
  this.set('type', 'button');
54
54
  this.set('withText', false);
55
55
  this.children = this.createCollection();
56
- this.actionView = this._createActionView();
56
+ this.actionView = this._createActionView(actionButton);
57
57
  this.arrowView = this._createArrowView();
58
58
  this.keystrokes = new KeystrokeHandler();
59
59
  this.focusTracker = new FocusTracker();
@@ -114,9 +114,11 @@ export default class SplitButtonView extends View {
114
114
  * Creates a {@link module:ui/button/buttonview~ButtonView} instance as {@link #actionView} and binds it with main split button
115
115
  * attributes.
116
116
  */
117
- _createActionView() {
118
- const actionView = new ButtonView();
119
- actionView.bind('icon', 'isEnabled', 'isOn', 'isToggleable', 'keystroke', 'label', 'tabindex', 'tooltip', 'tooltipPosition', 'type', 'withText').to(this);
117
+ _createActionView(actionButton) {
118
+ const actionView = actionButton || new ButtonView();
119
+ if (!actionButton) {
120
+ actionView.bind('icon', 'isEnabled', 'isOn', 'isToggleable', 'keystroke', 'label', 'tabindex', 'tooltip', 'tooltipPosition', 'type', 'withText').to(this);
121
+ }
120
122
  actionView.extendTemplate({
121
123
  attributes: {
122
124
  class: 'ck-splitbutton__action'
@@ -76,11 +76,11 @@ import '../../theme/components/dropdown/listdropdown.css';
76
76
  * {@link module:ui/dropdown/utils~addToolbarToDropdown} utils.
77
77
  *
78
78
  * @param locale The locale instance.
79
- * @param ButtonClass The dropdown button view class. Needs to implement the
79
+ * @param ButtonClassOrInstance The dropdown button view class. Needs to implement the
80
80
  * {@link module:ui/dropdown/button/dropdownbutton~DropdownButton} interface.
81
81
  * @returns The dropdown view instance.
82
82
  */
83
- export declare function createDropdown(locale: Locale | undefined, ButtonClass?: new (locale?: Locale) => DropdownButton & FocusableView): DropdownView;
83
+ export declare function createDropdown(locale: Locale | undefined, ButtonClassOrInstance?: (new (locale?: Locale) => DropdownButton & FocusableView) | (DropdownButton & FocusableView)): DropdownView;
84
84
  /**
85
85
  * Adds an instance of {@link module:ui/toolbar/toolbarview~ToolbarView} to a dropdown.
86
86
  *
@@ -85,12 +85,12 @@ import ListItemGroupView from '../list/listitemgroupview';
85
85
  * {@link module:ui/dropdown/utils~addToolbarToDropdown} utils.
86
86
  *
87
87
  * @param locale The locale instance.
88
- * @param ButtonClass The dropdown button view class. Needs to implement the
88
+ * @param ButtonClassOrInstance The dropdown button view class. Needs to implement the
89
89
  * {@link module:ui/dropdown/button/dropdownbutton~DropdownButton} interface.
90
90
  * @returns The dropdown view instance.
91
91
  */
92
- export function createDropdown(locale, ButtonClass = DropdownButtonView) {
93
- const buttonView = new ButtonClass(locale);
92
+ export function createDropdown(locale, ButtonClassOrInstance = DropdownButtonView) {
93
+ const buttonView = typeof ButtonClassOrInstance == 'function' ? new ButtonClassOrInstance(locale) : ButtonClassOrInstance;
94
94
  const panelView = new DropdownPanelView(locale);
95
95
  const dropdownView = new DropdownView(locale, buttonView, panelView);
96
96
  buttonView.bind('isEnabled').to(dropdownView);
package/src/index.d.ts CHANGED
@@ -12,7 +12,7 @@ export { default as submitHandler } from './bindings/submithandler';
12
12
  export { default as addKeyboardHandlingForGrid } from './bindings/addkeyboardhandlingforgrid';
13
13
  export { default as BodyCollection } from './editorui/bodycollection';
14
14
  export { type ButtonExecuteEvent } from './button/button';
15
- export { type default as ButtonLabel } from './button/buttonlabel';
15
+ export type { default as ButtonLabel } from './button/buttonlabel';
16
16
  export { default as ButtonView } from './button/buttonview';
17
17
  export { default as ButtonLabelView } from './button/buttonlabelview';
18
18
  export { default as SwitchButtonView } from './button/switchbuttonview';
@@ -56,6 +56,7 @@ export { default as SearchTextView, type SearchTextViewSearchEvent, type SearchT
56
56
  export { default as SearchInfoView } from './search/searchinfoview';
57
57
  export { default as FilteredView, type FilteredViewExecuteEvent } from './search/filteredview';
58
58
  export { default as HighlightedTextView } from './highlightedtext/highlightedtextview';
59
+ export { default as CollapsibleView } from './collapsible/collapsibleview';
59
60
  export { default as TooltipManager } from './tooltipmanager';
60
61
  export { default as Template, type TemplateDefinition } from './template';
61
62
  export { default as SpinnerView } from './spinner/spinnerview';
package/src/index.js CHANGED
@@ -52,6 +52,7 @@ export { default as AutocompleteView } from './autocomplete/autocompleteview';
52
52
  export { default as SearchTextView } from './search/text/searchtextview';
53
53
  export { default as SearchInfoView } from './search/searchinfoview';
54
54
  export { default as HighlightedTextView } from './highlightedtext/highlightedtextview';
55
+ export { default as CollapsibleView } from './collapsible/collapsibleview';
55
56
  export { default as TooltipManager } from './tooltipmanager';
56
57
  export { default as Template } from './template';
57
58
  export { default as SpinnerView } from './spinner/spinnerview';
@@ -53,7 +53,7 @@ export default class ListItemGroupView extends View {
53
53
  */
54
54
  constructor(locale?: Locale, labelView?: LabelView);
55
55
  /**
56
- * Focuses the list item.
56
+ * Focuses the list item (which is not a separator).
57
57
  */
58
58
  focus(): void;
59
59
  }
@@ -8,6 +8,7 @@
8
8
  import View from '../view';
9
9
  import ListView from './listview';
10
10
  import LabelView from '../label/labelview';
11
+ import ListSeparatorView from './listseparatorview';
11
12
  /**
12
13
  * The list item group view class.
13
14
  */
@@ -53,11 +54,14 @@ export default class ListItemGroupView extends View {
53
54
  });
54
55
  }
55
56
  /**
56
- * Focuses the list item.
57
+ * Focuses the list item (which is not a separator).
57
58
  */
58
59
  focus() {
59
- if (this.items.first) {
60
- this.items.first.focus();
60
+ if (this.items) {
61
+ const firstListItem = this.items.find(item => !(item instanceof ListSeparatorView));
62
+ if (firstListItem) {
63
+ firstListItem.focus();
64
+ }
61
65
  }
62
66
  }
63
67
  }
@@ -6,8 +6,9 @@
6
6
  * @module ui/list/listview
7
7
  */
8
8
  import View from '../view';
9
- import type ListItemView from './listitemview';
9
+ import ListItemView from './listitemview';
10
10
  import ListItemGroupView from './listitemgroupview';
11
+ import type ListSeparatorView from './listseparatorview';
11
12
  import type DropdownPanelFocusable from '../dropdown/dropdownpanelfocusable';
12
13
  import ViewCollection from '../viewcollection';
13
14
  import { FocusTracker, KeystrokeHandler, type Locale } from '@ckeditor/ckeditor5-utils';
@@ -25,7 +26,7 @@ export default class ListView extends View<HTMLUListElement> implements Dropdown
25
26
  /**
26
27
  * Collection of the child list views.
27
28
  */
28
- readonly items: ViewCollection<ListItemView | ListItemGroupView>;
29
+ readonly items: ViewCollection<ListItemView | ListItemGroupView | ListSeparatorView>;
29
30
  /**
30
31
  * Tracks information about DOM focus in the list.
31
32
  */
@@ -7,6 +7,7 @@
7
7
  */
8
8
  import View from '../view';
9
9
  import FocusCycler from '../focuscycler';
10
+ import ListItemView from './listitemview';
10
11
  import ListItemGroupView from './listitemgroupview';
11
12
  import ViewCollection from '../viewcollection';
12
13
  import { FocusTracker, KeystrokeHandler } from '@ckeditor/ckeditor5-utils';
@@ -69,7 +70,7 @@ export default class ListView extends View {
69
70
  if (item instanceof ListItemGroupView) {
70
71
  this._registerFocusableItemsGroup(item);
71
72
  }
72
- else {
73
+ else if (item instanceof ListItemView) {
73
74
  this._registerFocusableListItem(item);
74
75
  }
75
76
  }
@@ -0,0 +1,10 @@
1
+ /*
2
+ * 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
+ .ck.ck-collapsible.ck-collapsible_collapsed {
7
+ & > .ck-collapsible__children {
8
+ display: none;
9
+ }
10
+ }