CharacterHighlight
Properties
-
0
- (type: string)
the character in the suggestion
-
1
- (type: boolean)
should it be highlighted?
Type
Array
Links
PopulateOptions(options)
Returns
Type
function
Links
Source(query, populateOptions)
Returns
Type
function
Links
MapOptionToSuggestedValue(option)
Returns
-
string
- The string to display as the suggestions for this option
Type
function
Links
onConfirm(option)
Returns
Type
function
Links
AutocompleteOptions
Properties
-
defaultValue
- (type: string)
Specify a string to prefill the autocomplete with
-
source
- (type: Source)
The function which retrieves the suggestions to display
-
mapOptionToSuggestedValue
- (type: MapOptionToSuggestedValue)
Function which transforms a suggestion before rendering
-
onConfirm
- (type: onConfirm)
Function which is called when the user selects an option
Type
object
Links
highlightSuggestion(suggestion, query)
Global Function
Returns
-
Array.<CharacterHighlight>
- An array of arrays which contain two items, the first is the character in the suggestion, the second is a boolean which indicates whether the character should be highlighted.
Links
createLoadingContainer
Global Function
Create DOM for the loading container.
Returns
-
HTMLDivElement
- The loading container.
Links
showLoadingPane(instance)
Global Function
Show the loading panel
Returns
Links
hideLoadingPane(instance)
Global Function
Hide the loading panel
Returns
Links
new Autocomplete(autocompleteEl, options)
Class constructor.
Methods
Properties
Links
new Banner(bannerElement, options)
Represents a banner.
Class constructor.
Methods
Links
new Drawer(headerEl)
Class constructor.
Methods
Properties
-
enabled
-
Check if the drawer is currently enabled.
If the burger element is visible, the drawer is enabled.
Links
new DropDown(headerEl, drawer)
Class constructor
Methods
-
handleEvent(event)
- (instance) Event Handler
-
isDrawer
- (instance) Checks if primary nav is in a drawer
This boolean will change the drop down behaviour.
-
reset
- (instance) Returns nav items to their original collapsed state,
items which contain links with the attribute `aria-current`
set to true remain expanded.
-
isExpanded(item)
- (static) Checks whether nav menu is expanded
-
expand(item)
- (static) Expands closed nav menu
-
position(item)
- (static) Changes nav menu position relative to the window
-
collapse(item)
- (static) Collapses open nav menu
-
collapseAll(items)
- (static) Collapses all open nav menus
-
expandAll(items)
- (static) Expands all open nav menus
-
getCurrent(items)
- (static) Returns items which contain an anchor
with the attribute `aria-current` set to true or "page".
Properties
-
navItems
- (type: Array.<Element>)
- Nav items with a dropdown.
Links
new Layout(layoutEl, options)
Class constructor.
Methods
-
constructNavFromDOM
- (instance) Construct the sidebar navigation from headings within the DOM.
-
destroy
- (instance) Unmount the sideBarNavigation.
-
highlightNavItems
- (instance) Enables navigation item highlighting based on scroll position.
Relies on heading ids and anchor href being the same.
-
getDataAttributes(layoutElement)
- (static) Get the data attributes from the layoutEl. If the layout is being set up
declaratively, this method is used to extract the data attributes from the DOM.
-
init(rootEl, opts)
- (static) Initialise layout component.
Properties
Links
new LinkedHeading(...)
Represents a linked heading.
Class constructor.
Links
<anonymous>~customSource
Inner Property
Type
Links
Autocomplete#mapOptionToSuggestedValue
Instance Property
Type
- MapOptionToSuggestedValue
Links
Autocomplete#options.source(query, populateOptions)
Static Method
Returns
Links
Autocomplete#options.source~callback(options)
Inner Function
Returns
Links
templates.suggestion(option)
Static Method
Used when rendering suggestions, the return value of this will be used as the innerHTML for a single suggestion.
Returns
-
string | undefined
- HTML string to represent a single suggestion.
Links
Autocomplete#suggestionTemplate(suggestedValue)
Instance Method
Used when rendering suggestions, the return value of this will be used as the innerHTML for a single suggestion.
Returns
-
string
- HTML string to be represent a single suggestion.
Links
<anonymous>~characters
Inner Property
Type
- Array.<CharacterHighlight>
An array of arrays which contain two items, the first is the character in the suggestion, the second is a boolean which indicates whether the character should be highlighted.
Links
Autocomplete.getDataAttributes(autocompleteEl)
Static Method
Get the data attributes from the AutocompleteElement. If the element is being set up
declaratively, this method is used to extract the data attributes from the DOM.
Returns
-
object
- An options object which can be used for configuring the component
Links
Autocomplete.init(rootElement, options)
Static Method
Initialise o-autocomplete component/s.
Returns
-
Autocomplete | Array.<Autocomplete>
- The newly constructed Autocomplete components
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
Drawer#handleEvent(event)
Instance Method
Event Handler
Returns
Links
Drawer#enabled
Instance Property
Check if the drawer is currently enabled.
If the burger element is visible, the drawer is enabled.
Links
Drawer#render
Instance Method
Drawer rendering
Returns
Links
Drawer#toggleDrawer
Instance Method
Drawer hide/show functionality
Returns
Links
DropDown#navItems
Instance Property
Type
- Nav items with a dropdown.
Links
DropDown#handleEvent(event)
Instance Method
Event Handler
Returns
Links
DropDown#isDrawer
Instance Method
Checks if primary nav is in a drawer
This boolean will change the drop down behaviour.
Returns
-
boolean
- - whether the drawer is enabled or not
Links
DropDown#reset
Instance Method
Returns nav items to their original collapsed state,
items which contain links with the attribute aria-current
set to true remain expanded.
Returns
Links
DropDown.isExpanded(item)
Static Method
Checks whether nav menu is expanded
Returns
-
boolean
- - whether the nav menu is expanded
Links
DropDown.expand(item)
Static Method
Expands closed nav menu
Returns
Links
DropDown.position(item)
Static Method
Changes nav menu position relative to the window
Returns
Links
DropDown.collapse(item)
Static Method
Collapses open nav menu
Returns
Links
DropDown.collapseAll(items)
Static Method
Collapses all open nav menus
Returns
Links
DropDown.expandAll(items)
Static Method
Expands all open nav menus
Returns
Links
DropDown.getCurrent(items)
Static Method
Returns items which contain an anchor
with the attribute aria-current
set to true or "page".
Returns
-
HTMLElement
- - The current menu item
Links
Layout#navAnchors
Instance Property
Type
- Array.<HTMLAnchorElement>
Links
Layout#constructNavFromDOM
Instance Method
Construct the sidebar navigation from headings within the DOM.
Links
Layout#navAnchors
Instance Property
Type
- Array.<HTMLAnchorElement>
Links
Layout#destroy
Instance Method
Unmount the sideBarNavigation.
Links
Layout#highlightNavItems
Instance Method
Enables navigation item highlighting based on scroll position.
Relies on heading ids and anchor href being the same.
Returns
Links
Layout.getDataAttributes(layoutElement)
Static Method
Get the data attributes from the layoutEl. If the layout is being set up
declaratively, this method is used to extract the data attributes from the DOM.
Returns
-
Object.<string, any>
- - Options for configuring the layout
Links
Layout.init(rootEl, opts)
Static Method
Initialise layout component.
Returns
-
Layout | Array.<Layout>
- Returns either a single Layout instance or an array of Layout instances
Links
new Layout(layoutEl, options)
Class constructor.
Methods
-
constructNavFromDOM
- (instance) Construct the sidebar navigation from headings within the DOM.
-
destroy
- (instance) Unmount the sideBarNavigation.
-
highlightNavItems
- (instance) Enables navigation item highlighting based on scroll position.
Relies on heading ids and anchor href being the same.
-
getDataAttributes(layoutElement)
- (static) Get the data attributes from the layoutEl. If the layout is being set up
declaratively, this method is used to extract the data attributes from the DOM.
-
init(rootEl, opts)
- (static) Initialise layout component.
Properties
Links