overlay

package
v0.0.0-...-66b229c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 6, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Dummy struct{}

Dummy can be referenced in vugu files to prevent go from causing errors due to not used imports.

Use it like this:

_ = overlay.Dummy

Functions

This section is empty.

Types

type Container

type Container struct {
	// contains filtered or unexported fields
}

Container can be embedded in your root component and provides a way to show overlays like modals and toasts.

func (*Container) AddToast

func (c *Container) AddToast(eventEnv vugu.EventEnv, component vugu.Builder)

func (*Container) Build

func (c *Container) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut)

func (*Container) CloseToast

func (c *Container) CloseToast(component vugu.Builder)

func (*Container) SetModal

func (c *Container) SetModal(component vugu.Builder)

func (*Container) WaitOverlayActive

func (c *Container) WaitOverlayActive() bool

WaitOverlayOpen returns true if the wait overlay is currently opened.

func (*Container) WaitOverlayDone

func (c *Container) WaitOverlayDone()

WaitOverlayDone will mark the current wait overlay as done. Internally this is implemented as counter, so you have to ensure that there are as many WaitOverlayOpen as WaitOverlayDone calls.

func (*Container) WaitOverlayOpen

func (c *Container) WaitOverlayOpen()

WaitOverlayOpen shows the wait overlay. Internally this is implemented as counter, so you have to ensure that there are as many WaitOverlayOpen as WaitOverlayDone calls.

Always ensure that there is the complementary WaitOverlayDone() call, ideally with a defer.

type ContainerToast

type ContainerToast struct {
	// contains filtered or unexported fields
}

type ModalRequester

type ModalRequester struct {
	OverlayContainerRef

	IconSlot vugu.Builder `vugu:"data"` // Slot for the symbol.

	Title   string `vugu:"data"`
	Message string `vugu:"data"`

	SignalColor string // A d3c CSS class for the color scheme of the small bar.

	ClickAbort input.ClickHandler
	ClickYes   input.ClickHandler
}

func (*ModalRequester) Build

func (c *ModalRequester) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut)

func (*ModalRequester) OverlayClasses

func (c *ModalRequester) OverlayClasses() (signalClasses, containerClasses string)

OverlayClasses implements OverlayClassesGetter which is used by the overlay package to add classes to overlay elements.

func (*ModalRequester) PageTitle

func (c *ModalRequester) PageTitle() (title, longTitle, shortTitle string)

PageTitle implements PageTitleGetter which is used by PageInfo.

type OverlayClassesGetter

type OverlayClassesGetter interface {
	OverlayClasses() (signalClasses, containerClasses string)
}

OverlayClassesGetter can be implemented by components that are used in overlays. With this mechanic these components can set additional CSS classes to the modal or toast container. One use case is to give a toast or modal some other color with the `d3c-color-*` classes.

type OverlayContainerRef

type OverlayContainerRef struct {
	*Container
}

func (*OverlayContainerRef) OverlayContainerSet

func (p *OverlayContainerRef) OverlayContainerSet(container *Container)

type OverlayContainerSetter

type OverlayContainerSetter interface {
	OverlayContainerSet(*Container)
}

type ToastDurationGetter

type ToastDurationGetter interface {
	ToastDuration() time.Duration
}

ToastDurationGetter can be implemented by toast components to signal that the toast should close automatically after some given duration.

type ToastMessage

type ToastMessage struct {
	MessageType ToastMessageType `vugu:"data"`
	Message     string           `vugu:"data"`
	Duration    time.Duration    // Auto close toast after this duration.
}

func (*ToastMessage) Build

func (c *ToastMessage) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut)

func (*ToastMessage) OverlayClasses

func (c *ToastMessage) OverlayClasses() (signalClasses, containerClasses string)

func (*ToastMessage) ToastDuration

func (c *ToastMessage) ToastDuration() time.Duration

type ToastMessageType

type ToastMessageType int
const (
	ToastMessageTypeSuccess ToastMessageType = iota
	ToastMessageTypeAttention
	ToastMessageTypeCaution
	ToastMessageTypeCritical
)

type ToastSimple

type ToastSimple struct {
	IconSlot vugu.Builder `vugu:"data"` // Slot for the symbol.

	Message  string        `vugu:"data"`
	Duration time.Duration // Auto close toast after this duration.

	SignalColor string // A d3c CSS class for the color scheme of the small bar.
}

func (*ToastSimple) Build

func (c *ToastSimple) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut)

func (*ToastSimple) OverlayClasses

func (c *ToastSimple) OverlayClasses() (signalClasses, containerClasses string)

func (*ToastSimple) ToastDuration

func (c *ToastSimple) ToastDuration() time.Duration

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL