new Banner(bannerElement, options)
Represents a banner.
Class constructor.
Methods
Links
new ErrorSummary(elements, headingMessage)
Class constructor.
Methods
Example
const elementsExample = [
{
id: 'text-input',
valid: false,
error: 'Please fill out this field',
label: 'Input Label',
element: <Element />,
},
{...},
];
new ErrorSummary(example, 'This is a heading message')
Links
new State(...)
Class constructor.
Methods
Links
ErrorSummaryElement
Properties
-
element
- (type: HTMLInputElement)
the associated element
-
id
- (type: string)
the input element's id
-
valid
- (type: boolean)
was the user's value valid?
-
error
- (type: string)
the error message for this element
-
field
- (type: HTMLElement)
a containing o-forms-field element
-
label
- (type: HTMLLabelElement)
an associated label element
Type
object
Links
Banner#render
Instance Method
Render the banner.
Returns
Links
Banner#open
Instance Method
Open the banner.
Returns
Links
Banner#close
Instance Method
Close the banner.
Returns
Links
Banner#buildBannerElement(bannerElement)
Instance Method
Build a full banner element. This is used when no banner or a partial banner exists in the DOM.
Returns
-
HTMLElement
- Returns the new banner element
Links
Banner.getOptionsFromDom(bannerElement)
Static Method
Get the data attributes from the bannerElement. If the banner is being set up
declaratively, this method is used to extract the data attributes from the DOM.
Returns
-
Object.<string, any>
- - The options
Links
Banner#destroy
Instance Method
Undo the init method
Links
Banner.init(rootElement, options)
Static Method
Initialise banner components.
Returns
-
Banner | Array.<Banner>
- - The newly instantiated Banner (or Banners, if rootElement was not a banner)
Links
ErrorSummary#createSummary
Instance Method
Generate Node to hold list of invalid inputs
Returns
-
HTMLDivElement
- - a div full of error messages
Links
ErrorSummary.createList(inputs)
Static Method
Generate list of anchors
Returns
-
HTMLUListElement
- - the list
Links
ErrorSummary.createItem(input)
Static Method
Generate an item for the error summary
Returns
Links
ErrorSummary.createAnchor(input)
Static Method
Generate anchor element to point at invalid input
Returns
Links
State#set(state, label)
Instance Method
State setter
Links