@@ -0,0 +1,89 @@
1+package list
2+
3+import (
4+ tea "github.com/charmbracelet/bubbletea/v2"
5+ "github.com/charmbracelet/crush/internal/tui/components/core/layout"
6+ "github.com/charmbracelet/crush/internal/tui/util"
7+)
8+
9+type Item interface {
10+ util.Model
11+ layout.Sizeable
12+}
13+
14+type List interface {
15+ util.Model
16+}
17+
18+type list struct {
19+ width, height int
20+ gap int
21+
22+ items []Item
23+
24+ renderedView string
25+
26+ // Filter options
27+ filterable bool
28+ filterPlaceholder string
29+}
30+
31+type listOption func(*list)
32+
33+// WithFilterable enables filtering on the list.
34+func WithFilterable(placeholder string) listOption {
35+ return func(l *list) {
36+ l.filterable = true
37+ l.filterPlaceholder = placeholder
38+ }
39+}
40+
41+// WithItems sets the initial items for the list.
42+func WithItems(items ...Item) listOption {
43+ return func(l *list) {
44+ l.items = items
45+ }
46+}
47+
48+// WithSize sets the size of the list.
49+func WithSize(width, height int) listOption {
50+ return func(l *list) {
51+ l.width = width
52+ l.height = height
53+ }
54+}
55+
56+// WithGap sets the gap between items in the list.
57+func WithGap(gap int) listOption {
58+ return func(l *list) {
59+ l.gap = gap
60+ }
61+}
62+
63+func New(opts ...listOption) List {
64+ list := &list{
65+ items: make([]Item, 0),
66+ }
67+ for _, opt := range opts {
68+ opt(list)
69+ }
70+ return list
71+}
72+
73+// Init implements List.
74+func (l *list) Init() tea.Cmd {
75+ if l.height <= 0 || l.width <= 0 {
76+ return nil
77+ }
78+ return nil
79+}
80+
81+// Update implements List.
82+func (l *list) Update(tea.Msg) (tea.Model, tea.Cmd) {
83+ panic("unimplemented")
84+}
85+
86+// View implements List.
87+func (l *list) View() tea.View {
88+ panic("unimplemented")
89+}