sel

package
v0.0.0-...-958e9d3 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultDisabledStyles = []vecty.Applyer{
	style.OutlineStyle(outlineStyle.None),
}
View Source
var DefaultOptionsStyles = []vecty.Applyer{
	zIndex.Number(1),
	style.BoxShadow(0, 3, 5, -1, "black"),
}
View Source
var DefaultSelectedOptionButtonAlignmentStyles = []vecty.Applyer{
	position.Relative,
	display.Flex,
	justifyContent.SpaceBetween,
	flexWrap.Nowrap,
	alignItems.Center,
}
View Source
var DefaultSelectedOptionFocusedStyles = []vecty.Applyer{
	style.BoxShadow(0, 0, 4, 2, "#a8d1ff"),
}
View Source
var DefaultStyles = []vecty.Applyer{
	vecty.Attribute("tabindex", 0),
	style.OutlineStyle(outlineStyle.None),
}

Functions

This section is empty.

Types

type Generic

type Generic struct {
	vecty.Core
	Options                             []*GenericOption                                                        `vecty:"prop"`
	Placeholder                         GenericOption                                                           `vecty:"prop"`
	Styles                              []vecty.Applyer                                                         `vecty:"prop"`
	DisabledStyles                      []vecty.Applyer                                                         `vecty:"prop"`
	SelectedOptionStyles                []vecty.Applyer                                                         `vecty:"prop"`
	SelectedOptionButtonAlignmentStyles []vecty.Applyer                                                         `vecty:"prop"`
	SelectedOptionFocusedStyles         []vecty.Applyer                                                         `vecty:"prop"`
	OptionsStyles                       []vecty.Applyer                                                         `vecty:"prop"`
	Button                              func(disabled, mouseOver, focused, expanded bool) vecty.ComponentOrHTML `vecty:"prop"`
	SelectedEvent                       func(index int, g *Generic)                                             `vecty:"prop"`
	SelectedPos                         int                                                                     `vecty:"prop"`
	MouseEnter                          func(v *vecty.Event)                                                    `vecty:"prop"`
	MouseLeave                          func(v *vecty.Event)                                                    `vecty:"prop"`
	Disabled                            bool                                                                    `vecty:"prop"` //disables all interactions
	// contains filtered or unexported fields
}

Generic is a generic select It is suggested that the user make the placeholder and all options the same dimensions. Use .SelectedPos (<=0 undefined, 1 zeroth option index) to set the starting selected option position and to retrieve selected (if not using SelectedEvent). Notes: 1) User should NOT create the following events (applies to everything): MouseEnter,MouseLeave and Click. 2) If a *Styles is specified it will replace default styles. (The defaults are public for user to build from) 3) The following should be avoided in styles or components: position, display and justifyContent. 4) To create without a button, set the Button to and empty Div. 5) Normally disabled options are unselectable, at startup this can be overridden by setting .SelectPos (use carefully).

func (*Generic) Render

func (g *Generic) Render() vecty.ComponentOrHTML

type GenericOption

type GenericOption struct {
	vecty.Core
	Option    func(disabled bool, highlight bool, selected bool) vecty.ComponentOrHTML `vecty:"prop"`
	MouseMove func(v *vecty.Event)                                                     `vecty:"prop"`
	Disabled  bool                                                                     `vecty:"prop"`
	Highlight bool                                                                     `vecty:"prop"`
}

GenericOption is effectively a div container for the option Notes: 1) User should not directly create the following events: MouseMove and Click. 2) Each call to GenericOption.Option() should return a distinct vecty.ComponentOrHTML.

func (*GenericOption) Render

func (g *GenericOption) Render() vecty.ComponentOrHTML

Jump to

Keyboard shortcuts

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