0.4.11 • Published 5 months ago

@thomasrandolph/glaze v0.4.11

Weekly downloads
-
License
MIT
Repository
gitlab
Last release
5 months ago

Glaze Components

+++++++++++++++++++++++++

Icon

+++++++++++++++++++++++++

Attributes and Properties

NameAttribute (name)PropertyTypeOptionalReason
type✅ (type)StringWhich FontAwesome Classic style to use. Defaults to "solid".
icon✅ (icon)StringWhich icon to display.
sharp✅ (sharp)BooleanWhether to use the FontAwesome Pro Sharp style.
spin✅ (spin)BooleanWhether to spin this icon.
fixedWidth✅ (fixed-width)BooleanWhether to render this icon as a fixed width.
focusable✅ (focusable)BooleanWhether this icon is focusable via keyboard navigation.
title✅ (title)StringAn alternate title to render for accessibility.
transforms✅ (transforms)StringA string of power transforms to apply to this icon.

Note that while icon is technically optional, you will very likely have a very bad time with a blank icon.
Additionally, note that title is an accessibility feature and while it is an optional property, it should be included.

#register

ParameterReasonOptional
definitionsProvide FontAwesome icon definitions for the Icon component to reference

register defines the glaze-icon custom element so it's available to use.

definitions provide a shortcut for registering FontAwesome icon definitions for the Icon component to use.

#addDefinitions

ParameterReasonOptional
definitionsProvide FontAwesome icon definitions for the Icon component to reference

If the component has already been registered with the custom element registry, addDefinitions can update the list of available icons to use at any time.


+++++++++++++++++++++++++

Modal

+++++++++++++++++++++++++

Attributes and Properties

NameAttribute (name)PropertyTypeOptionalReason
show✅ (show)BooleanWhether the modal is visible or not.
label✅ (label)StringA text label to add to the dialog element for accessibility purposes.
defaultCloseButton✅ (default-close-button)BooleanWhether to show the small close button "x" in the top right corner.

Note that label is an accessibility feature and while it is an optional property, it should be included.

#register

register defines the glaze-modal custom element so it's available to use.

As a side effect, #register also registers the Icon component and the Solid-style X-Mark icon to be used as the close button.

Events

NamePayloadWhen
glaze-modal-opennullWhen the show property is changed, and becomes true.
glaze-modal-closenullWhen the show property is changed, and becomes false.

+++++++++++++++++++++++++

Notification

+++++++++++++++++++++++++

Attributes and Properties

NameAttribute (name)PropertyTypeOptionalReason
type✅ (type)StringWhich notification type to display. Options are neutral (equivalent to no type at all), info, okay, attention, and alert.
dismissible✅ (dismissible)StringWhether to show the "x" close button on the right side of the notification.
centered✅ (centered)BooleanWhether to center the text of this notification.
banner✅ (banner)BooleanWhether to display as a banner, which has fixed position and width.
icon✅ (icon)BooleanWhether to show the icon for this type of notification.
inline✅ (inline)BooleanWhether to display as a very minimal output.
iconsObjectThe icons to use when rendering this Notification. See #changeIcons or #defaultIcons for more info.

#register

register defines the glaze-notification custom element so it's available to use.

As side effects, #register also registers the Icon component and the Solid-style Bullhorn, Circle Info, Circle Check, Circle X-Mark, Triangle Exclamation, and X-Mark icons.

#changeIcons

By default, the Notification component ships with FontAwesome Free Solid icons.

Before you register the Notification with the custom element registry (e.g. by calling Notification.register()), you can redefine what icons to use by passing an object to changeIcons.

ParameterReasonOptional
listProvide FontAwesome icon definitions for the Notification component to reference

The list object should have at least these keys: neutral, info, okay, attention, alert, close.

Each entry should have an array value that holds the icon name, type, and whether or not it should be the sharp style.

See the defaultIcons below for an example definition.

#defaultIcons

As noted above, the Notification component ships with Free Solid icons.

The default value is:

{
	"neutral":		[ "bullhorn",				"solid", false ],
	"info": 		[ "circle-info",			"solid", false ],
	"okay":			[ "circle-check",			"solid", false ],
	"attention":	[ "triangle-exclamation",	"solid", false ],
	"alert":		[ "circle-xmark",			"solid", false ],
	"close":		[ "xmark",					"solid", false ]
}

#createBanner

createBanner creates a new Notification component without needing to render it directly into an HTML template.

ParameterReasonOptional
optionsHow and what to render for this Notification

options defaults to:

{
	"type": "neutral",
	"content": undefined,
	"centered": true,
	"dismissible": true,
	"icon": true,
	"icons": Notification.defaultIcons
}

These options properties map directly to the attributes and properties of the same names, with the exception of content.

options.content is a required property (unless you would like to render an empty banner notification), and is rendered as a direct child of the Notification (e.g. <Notification>${options.content}</Notification>).

+++++++++++++++++++++++++

Popover

+++++++++++++++++++++++++

Attributes and Properties

NameAttribute (name)PropertyTypeOptionalReason
attachObjectThe DOM element to attach the popover to. Defaults to document.body.
visible✅ (visible)BooleanWhether this popover should be visible or not. Defaults to false.
placement✅ (placement)StringAny of the values defined by floating-ui. For example: right-end.
blurClose✅ (blur-close)BooleanWhether a click outside the component should close the component. Note that the event listener is bound regardless, but only causes behavior when blurClose is true.
considerInside✅ (consider-inside)ArrayA list of additional nodes to ignore when computing whether a click has occurred "outside" the popover. Normally, only the popover and its .attach are considered "inside". This list allows more nodes that will be added to that list.
offsets✅ (offsets)ObjectAn object with the properties skidding and distance. Skidding moves the popover along the edge of the attach element (parallel), while distance moves the popover away from the edge of the attach element (perpendicular). See the axesOffsets of the Offset middleware for more information. Neither value is optional if any value is provided.

#register

register defines the glaze-popover custom element so it's available to use.

Events

NamePayloadWhen
glaze-popover-visibilityBooleanWhen the visible property is changed.

Slots

NameUse
defaultThis is the content that is displayed in the popover.
0.4.11

5 months ago

0.4.10

9 months ago

0.4.9

1 year ago

0.4.8

1 year ago

0.4.7

1 year ago

0.4.6

1 year ago

0.5.0

1 year ago

0.5.2

1 year ago

0.5.1

1 year ago

0.4.5

2 years ago

0.4.4

2 years ago

0.4.3

2 years ago

0.4.2

2 years ago

0.4.1

2 years ago

0.4.0

2 years ago

0.3.3

2 years ago

0.3.2

2 years ago

0.3.1

2 years ago

0.3.0

2 years ago

0.2.4

2 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago