Kmenger has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/194405

Change subject: LabelWidget: Add description, example, and mark private method
......................................................................

LabelWidget: Add description, example, and mark private method

Change-Id: I4f5d25b26b1294b0f0da58a86b16de017499c46a
---
M src/widgets/LabelWidget.js
1 file changed, 31 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/05/194405/1

diff --git a/src/widgets/LabelWidget.js b/src/widgets/LabelWidget.js
index 684eb47..7844a65 100644
--- a/src/widgets/LabelWidget.js
+++ b/src/widgets/LabelWidget.js
@@ -1,5 +1,32 @@
 /**
- * Label widget.
+ * LabelWidgets help identify the function of interface elements. Each 
LabelWidget can
+ * be configured with a `label` option that is set to a string, a label node, 
or a function:
+ *
+ * - String: a plaintext string
+ * - jQuery selection: a jQuery selection, used for anything other than a 
plaintext label, e.g., a
+ *   label that includes a link or special styling, such as a gray color or 
additional graphical elements.
+ * - Function: a function that will produce a string in the future. Functions 
are used
+ *   in cases where the value of the label is not currently defined.
+ *
+ * In addition, the LabelWidget can be associated with an {@link 
OO.ui.InputWidget input widget}, which
+ * will come into focus when the label is clicked.
+ *
+ *     @example
+ *     // Examples of LabelWidgets
+ *     var label1 = new OO.ui.LabelWidget({
+ *         label: 'plaintext label'
+ *     });
+ *     var label2 = new OO.ui.LabelWidget({
+ *         label: $( '<a href="default.html">jQuery label</a>'  )
+ *     });
+ *     // Create a fieldset layout with fields for each example
+ *     var fieldset = new OO.ui.FieldsetLayout( );
+ *     fieldset.addItems( [
+ *         new OO.ui.FieldLayout( label1 ),
+ *         new OO.ui.FieldLayout( label2 )
+ *     ] );
+ *     $( 'body' ).append( fieldset.$element );
+ *
  *
  * @class
  * @extends OO.ui.Widget
@@ -7,7 +34,8 @@
  *
  * @constructor
  * @param {Object} [config] Configuration options
- * @cfg {OO.ui.InputWidget} [input] Input widget this label is for
+ * @cfg {OO.ui.InputWidget} [input] {@link OO.ui.InputWidget Input widget} 
that uses the label.
+ *  Clicking the label will focus the specified input field.
  */
 OO.ui.LabelWidget = function OoUiLabelWidget( config ) {
        // Configuration initialization
@@ -47,6 +75,7 @@
 /**
  * Handles label mouse click events.
  *
+ * @private
  * @param {jQuery.Event} e Mouse click event
  */
 OO.ui.LabelWidget.prototype.onClick = function () {

-- 
To view, visit https://gerrit.wikimedia.org/r/194405
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4f5d25b26b1294b0f0da58a86b16de017499c46a
Gerrit-PatchSet: 1
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Kmenger <kmen...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to