@ckeditor/ckeditor5-ui 29.2.0 → 32.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 (146) hide show
  1. package/LICENSE.md +2 -2
  2. package/lang/translations/ar.po +2 -2
  3. package/lang/translations/ast.po +1 -1
  4. package/lang/translations/az.po +1 -1
  5. package/lang/translations/cs.po +1 -1
  6. package/lang/translations/da.po +1 -1
  7. package/lang/translations/de-ch.po +1 -1
  8. package/lang/translations/de.po +1 -1
  9. package/lang/translations/el.po +2 -2
  10. package/lang/translations/en-au.po +1 -1
  11. package/lang/translations/en-gb.po +1 -1
  12. package/lang/translations/en.po +1 -1
  13. package/lang/translations/eo.po +1 -1
  14. package/lang/translations/es.po +1 -1
  15. package/lang/translations/et.po +1 -1
  16. package/lang/translations/eu.po +1 -1
  17. package/lang/translations/fa.po +1 -1
  18. package/lang/translations/fi.po +1 -1
  19. package/lang/translations/fr.po +1 -1
  20. package/lang/translations/gl.po +1 -1
  21. package/lang/translations/he.po +1 -1
  22. package/lang/translations/hi.po +1 -1
  23. package/lang/translations/hr.po +1 -1
  24. package/lang/translations/hu.po +1 -1
  25. package/lang/translations/id.po +1 -1
  26. package/lang/translations/it.po +1 -1
  27. package/lang/translations/ja.po +1 -1
  28. package/lang/translations/km.po +1 -1
  29. package/lang/translations/kn.po +1 -1
  30. package/lang/translations/ko.po +1 -1
  31. package/lang/translations/ku.po +1 -1
  32. package/lang/translations/lt.po +1 -1
  33. package/lang/translations/lv.po +1 -1
  34. package/lang/translations/nb.po +1 -1
  35. package/lang/translations/ne.po +1 -1
  36. package/lang/translations/nl.po +2 -2
  37. package/lang/translations/no.po +1 -1
  38. package/lang/translations/pl.po +1 -1
  39. package/lang/translations/pt-br.po +1 -1
  40. package/lang/translations/pt.po +1 -1
  41. package/lang/translations/ro.po +1 -1
  42. package/lang/translations/ru.po +1 -1
  43. package/lang/translations/sk.po +1 -1
  44. package/lang/translations/sl.po +1 -1
  45. package/lang/translations/sq.po +1 -1
  46. package/lang/translations/sr-latn.po +1 -1
  47. package/lang/translations/sr.po +1 -1
  48. package/lang/translations/sv.po +1 -1
  49. package/lang/translations/th.po +1 -1
  50. package/lang/translations/tk.po +1 -1
  51. package/lang/translations/tr.po +1 -1
  52. package/lang/translations/ug.po +2 -2
  53. package/lang/translations/uk.po +1 -1
  54. package/lang/translations/uz.po +105 -0
  55. package/lang/translations/vi.po +1 -1
  56. package/lang/translations/zh-cn.po +1 -1
  57. package/lang/translations/zh.po +1 -1
  58. package/package.json +20 -21
  59. package/src/bindings/clickoutsidehandler.js +1 -1
  60. package/src/bindings/injectcsstransitiondisabler.js +1 -1
  61. package/src/bindings/preventdefault.js +1 -1
  62. package/src/bindings/submithandler.js +1 -1
  63. package/src/button/button.jsdoc +1 -1
  64. package/src/button/buttonview.js +2 -2
  65. package/src/button/switchbuttonview.js +1 -1
  66. package/src/colorgrid/colorgridview.js +11 -1
  67. package/src/colorgrid/colortileview.js +1 -1
  68. package/src/colorgrid/utils.js +1 -1
  69. package/src/componentfactory.js +1 -1
  70. package/src/dropdown/button/dropdownbutton.jsdoc +1 -1
  71. package/src/dropdown/button/dropdownbuttonview.js +1 -1
  72. package/src/dropdown/button/splitbuttonview.js +11 -1
  73. package/src/dropdown/dropdownpanelfocusable.jsdoc +1 -1
  74. package/src/dropdown/dropdownpanelview.js +1 -1
  75. package/src/dropdown/dropdownview.js +1 -1
  76. package/src/dropdown/utils.js +1 -1
  77. package/src/editableui/editableuiview.js +1 -1
  78. package/src/editableui/inline/inlineeditableuiview.js +1 -1
  79. package/src/editorui/bodycollection.js +1 -1
  80. package/src/editorui/boxed/boxededitoruiview.js +1 -1
  81. package/src/editorui/editoruiview.js +1 -1
  82. package/src/focuscycler.js +19 -4
  83. package/src/formheader/formheaderview.js +1 -1
  84. package/src/icon/iconview.js +1 -1
  85. package/src/iframe/iframeview.js +1 -1
  86. package/src/index.js +3 -1
  87. package/src/input/inputview.js +216 -0
  88. package/src/inputnumber/inputnumberview.js +71 -0
  89. package/src/inputtext/inputtextview.js +7 -169
  90. package/src/label/labelview.js +1 -1
  91. package/src/labeledfield/labeledfieldview.js +1 -1
  92. package/src/labeledfield/utils.js +54 -5
  93. package/src/labeledinput/labeledinputview.js +1 -1
  94. package/src/list/listitemview.js +1 -1
  95. package/src/list/listseparatorview.js +1 -1
  96. package/src/list/listview.js +11 -1
  97. package/src/model.js +1 -1
  98. package/src/notification/notification.js +2 -2
  99. package/src/panel/balloon/balloonpanelview.js +343 -217
  100. package/src/panel/balloon/contextualballoon.js +32 -5
  101. package/src/panel/sticky/stickypanelview.js +6 -2
  102. package/src/template.js +1 -1
  103. package/src/toolbar/balloon/balloontoolbar.js +49 -36
  104. package/src/toolbar/block/blockbuttonview.js +1 -1
  105. package/src/toolbar/block/blocktoolbar.js +4 -3
  106. package/src/toolbar/enabletoolbarkeyboardfocus.js +1 -1
  107. package/src/toolbar/normalizetoolbarconfig.js +1 -1
  108. package/src/toolbar/toolbarlinebreakview.js +1 -1
  109. package/src/toolbar/toolbarseparatorview.js +1 -1
  110. package/src/toolbar/toolbarview.js +7 -4
  111. package/src/tooltip/tooltipview.js +1 -1
  112. package/src/view.js +1 -1
  113. package/src/viewcollection.js +1 -1
  114. package/theme/components/button/button.css +1 -1
  115. package/theme/components/button/switchbutton.css +1 -1
  116. package/theme/components/colorgrid/colorgrid.css +1 -1
  117. package/theme/components/dropdown/dropdown.css +1 -1
  118. package/theme/components/dropdown/listdropdown.css +1 -1
  119. package/theme/components/dropdown/splitbutton.css +1 -1
  120. package/theme/components/dropdown/toolbardropdown.css +1 -1
  121. package/theme/components/editorui/editorui.css +1 -1
  122. package/theme/components/formheader/formheader.css +1 -1
  123. package/theme/components/icon/icon.css +1 -1
  124. package/theme/components/{inputtext/inputtext.css → input/input.css} +1 -1
  125. package/theme/components/label/label.css +1 -1
  126. package/theme/components/labeledfield/labeledfieldview.css +1 -1
  127. package/theme/components/labeledinput/labeledinput.css +1 -1
  128. package/theme/components/list/list.css +1 -1
  129. package/theme/components/panel/balloonpanel.css +1 -1
  130. package/theme/components/panel/balloonrotator.css +1 -1
  131. package/theme/components/panel/fakepanel.css +1 -1
  132. package/theme/components/panel/stickypanel.css +1 -1
  133. package/theme/components/responsive-form/responsiveform.css +1 -1
  134. package/theme/components/toolbar/blocktoolbar.css +1 -1
  135. package/theme/components/toolbar/toolbar.css +1 -1
  136. package/theme/components/tooltip/mixins/_tooltip.css +1 -1
  137. package/theme/components/tooltip/tooltip.css +1 -1
  138. package/theme/globals/_hidden.css +1 -1
  139. package/theme/globals/_reset.css +1 -1
  140. package/theme/globals/_transition.css +1 -1
  141. package/theme/globals/_zindex.css +1 -1
  142. package/theme/globals/globals.css +1 -1
  143. package/theme/mixins/_dir.css +1 -1
  144. package/theme/mixins/_rwd.css +1 -1
  145. package/theme/mixins/_unselectable.css +1 -1
  146. package/CHANGELOG.md +0 -542
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
2
+ * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
 
@@ -7,189 +7,27 @@
7
7
  * @module ui/inputtext/inputtextview
8
8
  */
9
9
 
10
- import View from '../view';
11
- import FocusTracker from '@ckeditor/ckeditor5-utils/src/focustracker';
12
- import '../../theme/components/inputtext/inputtext.css';
10
+ import InputView from '../input/inputview';
13
11
 
14
12
  /**
15
13
  * The text input view class.
16
14
  *
17
- * @extends module:ui/view~View
15
+ * @extends module:ui/input/inputview~InputView
18
16
  */
19
- export default class InputTextView extends View {
17
+ export default class InputTextView extends InputView {
20
18
  /**
21
19
  * @inheritDoc
22
20
  */
23
21
  constructor( locale ) {
24
22
  super( locale );
25
23
 
26
- /**
27
- * The value of the input.
28
- *
29
- * @observable
30
- * @member {String} #value
31
- */
32
- this.set( 'value' );
33
-
34
- /**
35
- * The `id` attribute of the input (i.e. to pair with a `<label>` element).
36
- *
37
- * @observable
38
- * @member {String} #id
39
- */
40
- this.set( 'id' );
41
-
42
- /**
43
- * The `placeholder` attribute of the input.
44
- *
45
- * @observable
46
- * @member {String} #placeholder
47
- */
48
- this.set( 'placeholder' );
49
-
50
- /**
51
- * Controls whether the input view is in read-only mode.
52
- *
53
- * @observable
54
- * @member {Boolean} #isReadOnly
55
- */
56
- this.set( 'isReadOnly', false );
57
-
58
- /**
59
- * Set to `true` when the field has some error. Usually controlled via
60
- * {@link module:ui/labeledinput/labeledinputview~LabeledInputView#errorText}.
61
- *
62
- * @observable
63
- * @member {Boolean} #hasError
64
- */
65
- this.set( 'hasError', false );
66
-
67
- /**
68
- * The `id` of the element describing this field, e.g. when it has
69
- * some error, it helps screen readers read the error text.
70
- *
71
- * @observable
72
- * @member {Boolean} #ariaDescribedById
73
- */
74
- this.set( 'ariaDescribedById' );
75
-
76
- /**
77
- * Stores information about the editor UI focus and propagates it so various plugins and components
78
- * are unified as a focus group.
79
- *
80
- * @readonly
81
- * @member {module:utils/focustracker~FocusTracker} #focusTracker
82
- */
83
- this.focusTracker = new FocusTracker();
84
-
85
- /**
86
- * An observable flag set to `true` when the input is currently focused by the user.
87
- * Set to `false` otherwise.
88
- *
89
- * @readonly
90
- * @observable
91
- * @member {Boolean} #isFocused
92
- * @default false
93
- */
94
- this.bind( 'isFocused' ).to( this.focusTracker );
95
-
96
- /**
97
- * An observable flag set to `true` when the input contains no text, i.e.
98
- * when {@link #value} is `''`, `null`, or `false`.
99
- *
100
- * @readonly
101
- * @observable
102
- * @member {Boolean} #isEmpty
103
- * @default true
104
- */
105
- this.set( 'isEmpty', true );
106
-
107
- const bind = this.bindTemplate;
108
-
109
- this.setTemplate( {
110
- tag: 'input',
24
+ this.extendTemplate( {
111
25
  attributes: {
112
26
  type: 'text',
113
27
  class: [
114
- 'ck',
115
- 'ck-input',
116
- 'ck-input-text',
117
- bind.if( 'isFocused', 'ck-input_focused' ),
118
- bind.if( 'isEmpty', 'ck-input-text_empty' ),
119
- bind.if( 'hasError', 'ck-error' )
120
- ],
121
- id: bind.to( 'id' ),
122
- placeholder: bind.to( 'placeholder' ),
123
- readonly: bind.to( 'isReadOnly' ),
124
- 'aria-invalid': bind.if( 'hasError', true ),
125
- 'aria-describedby': bind.to( 'ariaDescribedById' )
126
- },
127
- on: {
128
- input: bind.to( 'input' ),
129
- change: bind.to( this._updateIsEmpty.bind( this ) )
28
+ 'ck-input-text'
29
+ ]
130
30
  }
131
31
  } );
132
-
133
- /**
134
- * Fired when the user types in the input. Corresponds to the native
135
- * DOM `input` event.
136
- *
137
- * @event input
138
- */
139
- }
140
-
141
- /**
142
- * @inheritDoc
143
- */
144
- render() {
145
- super.render();
146
-
147
- this.focusTracker.add( this.element );
148
-
149
- this._setDomElementValue( this.value );
150
- this._updateIsEmpty();
151
-
152
- // Bind `this.value` to the DOM element's value.
153
- // We cannot use `value` DOM attribute because removing it on Edge does not clear the DOM element's value property.
154
- this.on( 'change:value', ( evt, name, value ) => {
155
- this._setDomElementValue( value );
156
- this._updateIsEmpty();
157
- } );
158
- }
159
-
160
- /**
161
- * Moves the focus to the input and selects the value.
162
- */
163
- select() {
164
- this.element.select();
165
32
  }
166
-
167
- /**
168
- * Focuses the input.
169
- */
170
- focus() {
171
- this.element.focus();
172
- }
173
-
174
- /**
175
- * Updates the {@link #isEmpty} property value on demand.
176
- *
177
- * @private
178
- */
179
- _updateIsEmpty() {
180
- this.isEmpty = isInputElementEmpty( this.element );
181
- }
182
-
183
- /**
184
- * Sets the `value` property of the {@link #element DOM element} on demand.
185
- *
186
- * @private
187
- */
188
- _setDomElementValue( value ) {
189
- this.element.value = ( !value && value !== 0 ) ? '' : value;
190
- }
191
- }
192
-
193
- function isInputElementEmpty( domElement ) {
194
- return !domElement.value;
195
33
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
2
+ * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
2
+ * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
2
+ * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
 
@@ -8,6 +8,7 @@
8
8
  */
9
9
 
10
10
  import InputTextView from '../inputtext/inputtextview';
11
+ import InputNumberView from '../inputnumber/inputnumberview';
11
12
  import { createDropdown } from '../dropdown/utils';
12
13
 
13
14
  /**
@@ -21,12 +22,12 @@ import { createDropdown } from '../dropdown/utils';
21
22
  * * It sets input's `id` and `ariaDescribedById` attributes.
22
23
  * * It binds input's `isReadOnly` to the labeled view.
23
24
  * * It binds input's `hasError` to the labeled view.
24
- * * It enables a logic that cleans up the error when user starts typing in the input..
25
+ * * It enables a logic that cleans up the error when user starts typing in the input.
25
26
  *
26
27
  * Usage:
27
28
  *
28
- * const labeledInputView = new LabeledFieldView( locale, createLabeledDropdown );
29
- * console.log( labeledInputView.view ); // An input instance.
29
+ * const labeledInputView = new LabeledFieldView( locale, createLabeledInputText );
30
+ * console.log( labeledInputView.fieldView ); // A text input instance.
30
31
  *
31
32
  * @param {module:ui/labeledfield/labeledfieldview~LabeledFieldView} labeledFieldView The instance of the labeled field view.
32
33
  * @param {String} viewUid An UID string that allows DOM logical connection between the
@@ -57,6 +58,54 @@ export function createLabeledInputText( labeledFieldView, viewUid, statusUid ) {
57
58
  return inputView;
58
59
  }
59
60
 
61
+ /**
62
+ * A helper for creating labeled number inputs.
63
+ *
64
+ * It creates an instance of a {@link module:ui/inputnumber/inputnumberview~InputNumberView input number} that is
65
+ * logically related to a {@link module:ui/labeledfield/labeledfieldview~LabeledFieldView labeled view} in DOM.
66
+ *
67
+ * The helper does the following:
68
+ *
69
+ * * It sets input's `id` and `ariaDescribedById` attributes.
70
+ * * It binds input's `isReadOnly` to the labeled view.
71
+ * * It binds input's `hasError` to the labeled view.
72
+ * * It enables a logic that cleans up the error when user starts typing in the input.
73
+ *
74
+ * Usage:
75
+ *
76
+ * const labeledInputView = new LabeledFieldView( locale, createLabeledInputNumber );
77
+ * console.log( labeledInputView.fieldView ); // A number input instance.
78
+ *
79
+ * @param {module:ui/labeledfield/labeledfieldview~LabeledFieldView} labeledFieldView The instance of the labeled field view.
80
+ * @param {String} viewUid An UID string that allows DOM logical connection between the
81
+ * {@link module:ui/labeledfield/labeledfieldview~LabeledFieldView#labelView labeled view's label} and the input.
82
+ * @param {String} statusUid An UID string that allows DOM logical connection between the
83
+ * {@link module:ui/labeledfield/labeledfieldview~LabeledFieldView#statusView labeled view's status} and the input.
84
+ * @returns {module:ui/inputnumber/inputnumberview~InputNumberView} The input number view instance.
85
+ */
86
+ export function createLabeledInputNumber( labeledFieldView, viewUid, statusUid ) {
87
+ const inputView = new InputNumberView( labeledFieldView.locale );
88
+
89
+ inputView.set( {
90
+ id: viewUid,
91
+ ariaDescribedById: statusUid,
92
+ inputMode: 'numeric'
93
+ } );
94
+
95
+ inputView.bind( 'isReadOnly' ).to( labeledFieldView, 'isEnabled', value => !value );
96
+ inputView.bind( 'hasError' ).to( labeledFieldView, 'errorText', value => !!value );
97
+
98
+ inputView.on( 'input', () => {
99
+ // UX: Make the error text disappear and disable the error indicator as the user
100
+ // starts fixing the errors.
101
+ labeledFieldView.errorText = null;
102
+ } );
103
+
104
+ labeledFieldView.bind( 'isEmpty', 'isFocused', 'placeholder' ).to( inputView );
105
+
106
+ return inputView;
107
+ }
108
+
60
109
  /**
61
110
  * A helper for creating labeled dropdowns.
62
111
  *
@@ -71,7 +120,7 @@ export function createLabeledInputText( labeledFieldView, viewUid, statusUid ) {
71
120
  * Usage:
72
121
  *
73
122
  * const labeledInputView = new LabeledFieldView( locale, createLabeledDropdown );
74
- * console.log( labeledInputView.view ); // A dropdown instance.
123
+ * console.log( labeledInputView.fieldView ); // A dropdown instance.
75
124
  *
76
125
  * @param {module:ui/labeledfield/labeledfieldview~LabeledFieldView} labeledFieldView The instance of the labeled field view.
77
126
  * @param {String} viewUid An UID string that allows DOM logical connection between the
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
2
+ * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
2
+ * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
2
+ * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
2
+ * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
 
@@ -109,6 +109,16 @@ export default class ListView extends View {
109
109
  this.keystrokes.listenTo( this.element );
110
110
  }
111
111
 
112
+ /**
113
+ * @inheritDoc
114
+ */
115
+ destroy() {
116
+ super.destroy();
117
+
118
+ this.focusTracker.destroy();
119
+ this.keystrokes.destroy();
120
+ }
121
+
112
122
  /**
113
123
  * Focuses the first focusable in {@link #items}.
114
124
  */
package/src/model.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
2
+ * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
2
+ * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
 
@@ -9,7 +9,7 @@
9
9
 
10
10
  /* globals window */
11
11
 
12
- import { ContextPlugin } from 'ckeditor5/src/core';
12
+ import ContextPlugin from '@ckeditor/ckeditor5-core/src/contextplugin';
13
13
 
14
14
  /**
15
15
  * The Notification plugin.