NOBUG: Fixed file access permissions
[moodle.git] / lib / yuilib / 3.13.0 / panel / panel.js
blob4783a077b9f9072d118d1f2e9c65a5621631c2c5
1 /*
2 YUI 3.13.0 (build 508226d)
3 Copyright 2013 Yahoo! Inc. All rights reserved.
4 Licensed under the BSD License.
5 http://yuilibrary.com/license/
6 */
8 YUI.add('panel', function (Y, NAME) {
10 // TODO: Change this description!
11 /**
12 Provides a Panel widget, a widget that mimics the functionality of a regular OS
13 window. Comes with Standard Module support, XY Positioning, Alignment Support,
14 Stack (z-index) support, modality, auto-focus and auto-hide functionality, and
15 header/footer button support.
17 @module panel
18 **/
20 var getClassName = Y.ClassNameManager.getClassName;
22 // TODO: Change this description!
23 /**
24 A basic Panel Widget, which can be positioned based on Page XY co-ordinates and
25 is stackable (z-index support). It also provides alignment and centering support
26 and uses a standard module format for it's content, with header, body and footer
27 section support. It can be made modal, and has functionality to hide and focus
28 on different events. The header and footer sections can be modified to allow for
29 button support.
31 @class Panel
32 @constructor
33 @extends Widget
34 @uses WidgetAutohide
35 @uses WidgetButtons
36 @uses WidgetModality
37 @uses WidgetPosition
38 @uses WidgetPositionAlign
39 @uses WidgetPositionConstrain
40 @uses WidgetStack
41 @uses WidgetStdMod
42 @since 3.4.0
43  */
44 Y.Panel = Y.Base.create('panel', Y.Widget, [
45     // Other Widget extensions depend on these two.
46     Y.WidgetPosition,
47     Y.WidgetStdMod,
49     Y.WidgetAutohide,
50     Y.WidgetButtons,
51     Y.WidgetModality,
52     Y.WidgetPositionAlign,
53     Y.WidgetPositionConstrain,
54     Y.WidgetStack
55 ], {
56     // -- Public Properties ----------------------------------------------------
58     /**
59     Collection of predefined buttons mapped from name => config.
61     Panel includes a "close" button which can be use by name. When the close
62     button is in the header (which is the default), it will look like: [x].
64     See `addButton()` for a list of possible configuration values.
66     @example
67         // Panel with close button in header.
68         var panel = new Y.Panel({
69             buttons: ['close']
70         });
72         // Panel with close button in footer.
73         var otherPanel = new Y.Panel({
74             buttons: {
75                 footer: ['close']
76             }
77         });
79     @property BUTTONS
80     @type Object
81     @default {close: {}}
82     @since 3.5.0
83     **/
84     BUTTONS: {
85         close: {
86             label  : 'Close',
87             action : 'hide',
88             section: 'header',
90             // Uses `type="button"` so the button's default action can still
91             // occur but it won't cause things like a form to submit.
92             template  : '<button type="button" />',
93             classNames: getClassName('button', 'close')
94         }
95     }
96 }, {
97     ATTRS: {
98         // TODO: API Docs.
99         buttons: {
100             value: ['close']
101         }
102     }
106 }, '3.13.0', {
107     "requires": [
108         "widget",
109         "widget-autohide",
110         "widget-buttons",
111         "widget-modality",
112         "widget-position",
113         "widget-position-align",
114         "widget-position-constrain",
115         "widget-stack",
116         "widget-stdmod"
117     ],
118     "skinnable": true