Popup
A floating Popup widget, which can contain child widgets or plain html. Serves as the base class for Menu / Tooltip.
When it contains focus, the Escape key closes the picker. When it hides, focus is reverted to the element from which it entered the Popup, or, if that is no longer focusable, a close relative of that element.
const popup = new Popup({
forElement : document.querySelector('button'),
items : {
text : { type : 'text', placeholder: 'Text' },
button : { type: 'button', text: 'Okay', style: 'width: 100%', color: 'b-orange'}
}
});
Dragging & Resizing
Popups can be resized and dragged around the screen. To enable resizing, set the resizable config to true or an object with specific options. To enable dragging, set the draggable config to true.
For example:
const popup = new Popup({
draggable : true,
resizable : {
handles : {
top : false,
minWidth : 100
}
}
});
Configs
Configs are options you supply in a configuration object when creating an instance of this class-
Auto show flag for Popup. If truthy then Popup is shown automatically upon hover.
-
Show a tool in the header to close this Popup. The tool is available in the tools object under the name
close. It uses the CSS classb-popup-closeto apply a default close icon. This may be customized with your own CSS rules. -
Close popup when Escape key is pressed.
-
By default a Popup is focused when it is shown. Configure this as
falseto prevent automatic focus on show. -
DOM element to attach popup.
-
Show a tool in the header to maximize this popup
-
Show popup when user clicks the element that it is anchored to. Cannot be combined with showOnHover. Can also be provided as the button number (0: main button, 2: right button).
-
By default, tabbing within a Popup is circular - that is it does not exit. Configure this as
falseto allow tabbing out of the Popup. -
Set to
falseto prevent dragging the popup element.- handleSelector : String
CSS selector used to determine if a drag operation can be started from a mouse-downed element inside the popup
- handleSelector : String
-
Set to
trueto make this widget take all available space in the visible viewport.Has a corresponding runtime maximized property.
Properties
Properties are getters/setters or publicly accessible variables on this class-
Returns the modal mask element. It does NOT guarantee its placement in the DOM relative to any Popup. To get the modal mask for a particular Popup, use the instance property.
-
Identifies an object as an instance of Popup class, or subclass thereof.
Functions
Functions are methods available for calling on the class-
Performs the configured closeAction upon this popup. By default, the popup hides. The closeAction may be configured as
'destroy'.
Triggers: beforeClose