Documentation
¶
Overview ¶
Package datepicker provides date pickers loosely based on Material 3.
Docked is a text field that opens a calendar. Modal opens that calendar in a dialog. ModalDateInput opens a dialog for typing a date and can switch to the same calendar. All three read and write a Date.
Index ¶
- type Date
- type Docked
- func (d *Docked) Build(context *guigui.Context, adder *guigui.ChildAdder) error
- func (d *Docked) HandleButtonInput(context *guigui.Context, widgetBounds *guigui.WidgetBounds) guigui.HandleInputResult
- func (d *Docked) Layout(context *guigui.Context, widgetBounds *guigui.WidgetBounds, ...)
- func (d *Docked) Measure(context *guigui.Context, constraints guigui.Constraints) image.Point
- func (d *Docked) OnValueChanged(f func(context *guigui.Context, date Date))
- func (d *Docked) SetFirstWeekday(day time.Weekday)
- func (d *Docked) SetMaxDate(date Date)
- func (d *Docked) SetMinDate(date Date)
- func (d *Docked) SetPlaceholder(placeholder string)
- func (d *Docked) SetValue(date Date)
- func (d *Docked) Tick(context *guigui.Context, widgetBounds *guigui.WidgetBounds) error
- func (d *Docked) Value() Date
- type Modal
- func (m *Modal) Build(context *guigui.Context, adder *guigui.ChildAdder) error
- func (m *Modal) HandleButtonInput(context *guigui.Context, widgetBounds *guigui.WidgetBounds) guigui.HandleInputResult
- func (m *Modal) IsOpen() bool
- func (m *Modal) Layout(context *guigui.Context, widgetBounds *guigui.WidgetBounds, ...)
- func (m *Modal) Measure(context *guigui.Context, constraints guigui.Constraints) image.Point
- func (m *Modal) OnValueChanged(f func(context *guigui.Context, date Date))
- func (m *Modal) SetButtonText(text string)
- func (m *Modal) SetFirstWeekday(day time.Weekday)
- func (m *Modal) SetMaxDate(date Date)
- func (m *Modal) SetMinDate(date Date)
- func (m *Modal) SetOpen(open bool)
- func (m *Modal) SetTitle(title string)
- func (m *Modal) SetValue(date Date)
- func (m *Modal) Value() Date
- type ModalDateInput
- func (m *ModalDateInput) Build(context *guigui.Context, adder *guigui.ChildAdder) error
- func (m *ModalDateInput) HandleButtonInput(context *guigui.Context, widgetBounds *guigui.WidgetBounds) guigui.HandleInputResult
- func (m *ModalDateInput) IsOpen() bool
- func (m *ModalDateInput) Layout(context *guigui.Context, widgetBounds *guigui.WidgetBounds, ...)
- func (m *ModalDateInput) Measure(context *guigui.Context, constraints guigui.Constraints) image.Point
- func (m *ModalDateInput) OnValueChanged(f func(context *guigui.Context, date Date))
- func (m *ModalDateInput) SetButtonText(text string)
- func (m *ModalDateInput) SetFirstWeekday(day time.Weekday)
- func (m *ModalDateInput) SetMaxDate(date Date)
- func (m *ModalDateInput) SetMinDate(date Date)
- func (m *ModalDateInput) SetOpen(open bool)
- func (m *ModalDateInput) SetTitle(title string)
- func (m *ModalDateInput) SetValue(date Date)
- func (m *ModalDateInput) Value() Date
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Date ¶
Date is a calendar day without a time of day or location. The zero value is an unset date.
func DateFromTime ¶
DateFromTime returns the year, month, and day of t in t's location.
func (Date) Compare ¶
Compare returns -1 if d is before o, 0 if they are equal, and +1 if d is after o.
type Docked ¶
type Docked struct {
guigui.DefaultWidget
// contains filtered or unexported fields
}
Docked is a text field that opens a calendar dropdown, matching the Material 3 docked date picker: month and year menus, previous/next month, weekday headings, a six-week day grid, and Cancel/OK.
func (*Docked) HandleButtonInput ¶
func (d *Docked) HandleButtonInput(context *guigui.Context, widgetBounds *guigui.WidgetBounds) guigui.HandleInputResult
func (*Docked) Layout ¶
func (d *Docked) Layout(context *guigui.Context, widgetBounds *guigui.WidgetBounds, layouter *guigui.ChildLayouter)
func (*Docked) OnValueChanged ¶
OnValueChanged sets the handler invoked when the user confirms a date.
func (*Docked) SetFirstWeekday ¶
SetFirstWeekday sets the first column of the calendar. The default is Sunday.
func (*Docked) SetMaxDate ¶
SetMaxDate sets the latest selectable date. The zero value leaves it unbounded.
func (*Docked) SetMinDate ¶
SetMinDate sets the earliest selectable date. The zero value leaves it unbounded.
func (*Docked) SetPlaceholder ¶
SetPlaceholder sets the placeholder shown while no date is selected.
type Modal ¶
type Modal struct {
guigui.DefaultWidget
// contains filtered or unexported fields
}
Modal is a button that opens a modal calendar dialog. The calendar matches the Material 3 docked date picker (month/year menus, day grid, OK/Cancel) and adds a headline plus a toggle into text-input mode.
func (*Modal) HandleButtonInput ¶
func (m *Modal) HandleButtonInput(context *guigui.Context, widgetBounds *guigui.WidgetBounds) guigui.HandleInputResult
func (*Modal) Layout ¶
func (m *Modal) Layout(context *guigui.Context, widgetBounds *guigui.WidgetBounds, layouter *guigui.ChildLayouter)
func (*Modal) OnValueChanged ¶
func (*Modal) SetButtonText ¶
func (*Modal) SetFirstWeekday ¶
func (*Modal) SetMaxDate ¶
func (*Modal) SetMinDate ¶
type ModalDateInput ¶
type ModalDateInput struct {
guigui.DefaultWidget
// contains filtered or unexported fields
}
ModalDateInput is a button that opens a modal dialog for typing a date, with a toggle into the same calendar as Modal.
func (*ModalDateInput) Build ¶
func (m *ModalDateInput) Build(context *guigui.Context, adder *guigui.ChildAdder) error
func (*ModalDateInput) HandleButtonInput ¶
func (m *ModalDateInput) HandleButtonInput(context *guigui.Context, widgetBounds *guigui.WidgetBounds) guigui.HandleInputResult
func (*ModalDateInput) IsOpen ¶
func (m *ModalDateInput) IsOpen() bool
func (*ModalDateInput) Layout ¶
func (m *ModalDateInput) Layout(context *guigui.Context, widgetBounds *guigui.WidgetBounds, layouter *guigui.ChildLayouter)
func (*ModalDateInput) Measure ¶
func (m *ModalDateInput) Measure(context *guigui.Context, constraints guigui.Constraints) image.Point
func (*ModalDateInput) OnValueChanged ¶
func (m *ModalDateInput) OnValueChanged(f func(context *guigui.Context, date Date))
func (*ModalDateInput) SetButtonText ¶
func (m *ModalDateInput) SetButtonText(text string)
func (*ModalDateInput) SetFirstWeekday ¶
func (m *ModalDateInput) SetFirstWeekday(day time.Weekday)
func (*ModalDateInput) SetMaxDate ¶
func (m *ModalDateInput) SetMaxDate(date Date)
func (*ModalDateInput) SetMinDate ¶
func (m *ModalDateInput) SetMinDate(date Date)
func (*ModalDateInput) SetOpen ¶
func (m *ModalDateInput) SetOpen(open bool)
func (*ModalDateInput) SetTitle ¶
func (m *ModalDateInput) SetTitle(title string)
func (*ModalDateInput) SetValue ¶
func (m *ModalDateInput) SetValue(date Date)
func (*ModalDateInput) Value ¶
func (m *ModalDateInput) Value() Date