form

package
v0.0.1-alpha.0 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	InputDefaultStyle = InputStyle{
		TextBase:         lipgloss.NewStyle().Foreground(lipgloss.Color("15")),
		TextFocus:        lipgloss.NewStyle().Foreground(lipgloss.Color("15")),
		PromptBase:       lipgloss.NewStyle().Foreground(lipgloss.Color("15")),
		PromptFocus:      lipgloss.NewStyle().Foreground(lipgloss.Color("15")),
		PlaceholderBase:  lipgloss.NewStyle().Foreground(lipgloss.Color("8")),
		PlaceholderFocus: lipgloss.NewStyle().Foreground(lipgloss.Color("8")),
		Cursor:           lipgloss.NewStyle().Foreground(lipgloss.Color("33")),
		Error:            lipgloss.NewStyle().Foreground(lipgloss.Color("9")),
	}
)

Functions

This section is empty.

Types

type Field

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

func NewField

func NewField(label string, child component.Component) *Field

func (*Field) Child

func (m *Field) Child() component.Component

func (*Field) Init

func (m *Field) Init() tea.Cmd

func (*Field) SetTextBaseStyle

func (m *Field) SetTextBaseStyle(style lipgloss.Style) *Field

func (*Field) Update

func (m *Field) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*Field) View

func (m *Field) View() string

type FieldStyle

type FieldStyle struct {
	TextBase lipgloss.Style
}

type Form

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

func NewForm

func NewForm(items []FormItem) *Form

func (*Form) Completed

func (m *Form) Completed() bool

func (*Form) Error

func (m *Form) Error(name string) error

func (*Form) Errors

func (m *Form) Errors() map[string]error

func (*Form) Init

func (m *Form) Init() tea.Cmd

func (*Form) Keys

func (m *Form) Keys() []key.Binding

func (*Form) SetSelectedIndex

func (m *Form) SetSelectedIndex(index int) *Form

func (*Form) SetStep

func (m *Form) SetStep(step int) *Form

func (*Form) Update

func (m *Form) Update(msg tea.Msg) (*Form, tea.Cmd)

func (*Form) Value

func (m *Form) Value(name string) any

func (*Form) Values

func (m *Form) Values() map[string]any

func (*Form) View

func (m *Form) View() string

type FormItem

type FormItem struct {
	Name      string
	Component component.Component
}

type FormKeyMap

type FormKeyMap struct {
	Prev key.Binding
	Next key.Binding
}

type FormState

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

type Hide

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

func NewHide

func NewHide(child component.Component) *Hide

func (*Hide) Child

func (m *Hide) Child() component.Component

func (*Hide) Hide

func (m *Hide) Hide() bool

func (*Hide) Init

func (m *Hide) Init() tea.Cmd

func (*Hide) SetHide

func (m *Hide) SetHide(hide func() bool) *Hide

func (*Hide) Update

func (m *Hide) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*Hide) View

func (m *Hide) View() string

type Input

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

func NewInput

func NewInput() *Input

func (*Input) Error

func (m *Input) Error() error

func (*Input) Init

func (m *Input) Init() tea.Cmd

func (*Input) SetCursorStyle

func (m *Input) SetCursorStyle(style lipgloss.Style) *Input

func (*Input) SetErrorStyle

func (m *Input) SetErrorStyle(style lipgloss.Style) *Input

func (*Input) SetPlaceholder

func (m *Input) SetPlaceholder(placeholder string) *Input

func (*Input) SetPlaceholderBaseStyle

func (m *Input) SetPlaceholderBaseStyle(style lipgloss.Style) *Input

func (*Input) SetPlaceholderFocusStyle

func (m *Input) SetPlaceholderFocusStyle(style lipgloss.Style) *Input

func (*Input) SetPromptBaseStyle

func (m *Input) SetPromptBaseStyle(style lipgloss.Style) *Input

func (*Input) SetPromptFocusStyle

func (m *Input) SetPromptFocusStyle(style lipgloss.Style) *Input

func (*Input) SetTextBaseStyle

func (m *Input) SetTextBaseStyle(style lipgloss.Style) *Input

func (*Input) SetTextFocusStyle

func (m *Input) SetTextFocusStyle(style lipgloss.Style) *Input

func (*Input) SetValidateFunc

func (m *Input) SetValidateFunc(fn func(string) error) *Input

func (*Input) SetValue

func (m *Input) SetValue(value string) *Input

func (*Input) Update

func (m *Input) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*Input) Validate

func (m *Input) Validate() bool

func (*Input) Value

func (m *Input) Value() string

func (*Input) View

func (m *Input) View() string

type InputState

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

type InputStyle

type InputStyle struct {
	TextBase         lipgloss.Style
	TextFocus        lipgloss.Style
	Error            lipgloss.Style
	PromptBase       lipgloss.Style
	PromptFocus      lipgloss.Style
	PlaceholderBase  lipgloss.Style
	PlaceholderFocus lipgloss.Style
	Cursor           lipgloss.Style
}

type Loader

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

func NewLoader

func NewLoader(childFn func() component.Component) *Loader

func (*Loader) Bindings

func (m *Loader) Bindings() any

func (*Loader) Child

func (m *Loader) Child() component.Component

func (*Loader) Init

func (m *Loader) Init() tea.Cmd

func (*Loader) SetBindings

func (m *Loader) SetBindings(bindings func() any) *Loader

func (*Loader) Update

func (m *Loader) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*Loader) View

func (m *Loader) View() string

type Select

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

func NewSelect

func NewSelect(items []SelectItemProps) *Select

func (*Select) Init

func (m *Select) Init() tea.Cmd

func (*Select) Keys

func (m *Select) Keys() []key.Binding

func (*Select) SetInline

func (m *Select) SetInline(inline bool) *Select

func (*Select) SetSelectedIndex

func (m *Select) SetSelectedIndex(index int) *Select

func (*Select) Update

func (m *Select) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*Select) Value

func (m *Select) Value() string

func (*Select) View

func (m *Select) View() string

type SelectItemProps

type SelectItemProps struct {
	Component component.Component
	Value     string
}

type SelectKeyMap

type SelectKeyMap struct {
	Prev key.Binding
	Next key.Binding
}

type SelectState

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

type Skip

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

func NewSkip

func NewSkip(child component.Component) *Skip

func (*Skip) Child

func (m *Skip) Child() component.Component

func (*Skip) Init

func (m *Skip) Init() tea.Cmd

func (*Skip) SetSkip

func (m *Skip) SetSkip(skip func() bool) *Skip

func (*Skip) Skip

func (m *Skip) Skip() bool

func (*Skip) Update

func (m *Skip) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*Skip) View

func (m *Skip) View() string

type WithHide

type WithHide interface {
	Hide() bool
}

type WithKeys

type WithKeys interface {
	Keys() []key.Binding
}

type WithSkip

type WithSkip interface {
	Skip() bool
}

type WithValidation

type WithValidation interface {
	Validate() bool
	Error() error
}

type WithValue

type WithValue interface {
	Value() string
}

Jump to

Keyboard shortcuts

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