@@ -34,7 +34,6 @@ import androidx.compose.runtime.setValue
3434import androidx.compose.ui.Alignment
3535import androidx.compose.ui.Modifier
3636import androidx.compose.ui.draw.clip
37- import androidx.compose.ui.graphics.vector.ImageVector
3837import androidx.compose.ui.platform.LocalUriHandler
3938import androidx.compose.ui.text.font.FontWeight
4039import androidx.compose.ui.unit.dp
@@ -58,8 +57,18 @@ import com.composables.icons.lucide.MessageCircle
5857import com.composables.icons.lucide.MessageSquare
5958import com.composables.icons.lucide.MousePointerClick
6059import com.composables.icons.lucide.PanelTopOpen
61- import com.composables.icons.lucide.Scan
60+ import com.composables.icons.lucide.ArrowUpDown
61+ import com.composables.icons.lucide.Box
62+ import com.composables.icons.lucide.ChevronDown
63+ import com.composables.icons.lucide.Component
64+ import com.composables.icons.lucide.Navigation
65+ import com.composables.icons.lucide.Paintbrush
66+ import com.composables.icons.lucide.Palette
67+ import com.composables.icons.lucide.RectangleHorizontal
6268import com.composables.icons.lucide.Search
69+ import com.composables.icons.lucide.ShieldAlert
70+ import com.composables.icons.lucide.SquareMousePointer
71+ import com.composables.icons.lucide.Star
6372import com.composables.icons.lucide.Ruler
6473import com.composables.icons.lucide.SlidersHorizontal
6574import com.composables.icons.lucide.SquareCheck
@@ -95,11 +104,11 @@ import io.github.kdroidfilter.nucleus.ui.apple.macos.components.VerticalScrollba
95104import io.github.kdroidfilter.nucleus.ui.apple.macos.components.rememberScrollbarState
96105import io.github.kdroidfilter.nucleus.ui.apple.macos.components.rememberToastState
97106import io.github.kdroidfilter.nucleus.ui.apple.macos.icons.Icon
98- import io.github.kdroidfilter.nucleus.ui.apple.macos.icons.LucideHome
107+ import io.github.kdroidfilter.nucleus.ui.apple.macos.icons.Icons
99108import io.github.kdroidfilter.nucleus.ui.apple.macos.icons.LucideMoon
100109import io.github.kdroidfilter.nucleus.ui.apple.macos.icons.LucideSettings
101110import io.github.kdroidfilter.nucleus.ui.apple.macos.icons.LucideSun
102- import io.github.kdroidfilter.nucleus.ui.apple.macos.icons.RadixPanelLeft
111+ import io.github.kdroidfilter.nucleus.ui.apple.macos.icons.SystemIcon
103112import io.github.kdroidfilter.nucleus.ui.apple.macos.sample.pages.AccordionPage
104113import io.github.kdroidfilter.nucleus.ui.apple.macos.sample.pages.AddressBarPage
105114import io.github.kdroidfilter.nucleus.ui.apple.macos.sample.pages.AlertPage
@@ -158,59 +167,126 @@ import io.github.kdroidfilter.nucleus.ui.apple.macos.theme.vibrant
158167internal enum class ThemeMode { System , Light , Dark }
159168
160169// Navigation data
161- internal data class SidebarEntryDef (val id : String , val label : String , val group : String , val icon : ImageVector )
170+ internal data class SidebarEntryDef (val id : String , val label : String , val group : String , val icon : SystemIcon )
162171
163172internal val sidebarEntryDefs = listOf (
164- SidebarEntryDef (" home" , " Home" , " GENERAL" , LucideHome ),
165- SidebarEntryDef (" getting-started" , " Getting Started" , " GENERAL" , Lucide .LayoutList ),
166- SidebarEntryDef (" license" , " License" , " GENERAL" , Lucide .Tag ),
167- SidebarEntryDef (" button" , " Button" , " FORM CONTROLS" , Lucide .MousePointerClick ),
168- SidebarEntryDef (" iconbutton" , " Icon Button" , " FORM CONTROLS" , Lucide .CircleDot ),
169- SidebarEntryDef (" input" , " Input" , " FORM CONTROLS" , Lucide .TextCursorInput ),
170- SidebarEntryDef (" textarea" , " Textarea" , " FORM CONTROLS" , Lucide .TextAlignStart ),
171- SidebarEntryDef (" checkbox" , " Checkbox" , " FORM CONTROLS" , Lucide .SquareCheck ),
172- SidebarEntryDef (" radiobutton" , " Radio Button" , " FORM CONTROLS" , Lucide .CircleDot ),
173- SidebarEntryDef (" switch" , " Switch" , " FORM CONTROLS" , Lucide .ToggleLeft ),
174- SidebarEntryDef (" combobox" , " Combo Box" , " FORM CONTROLS" , Lucide .ChevronsUpDown ),
175- SidebarEntryDef (" multiselect" , " Multi Select" , " FORM CONTROLS" , Lucide .ListChecks ),
176- SidebarEntryDef (" searchinput" , " Search Input" , " FORM CONTROLS" , Lucide .Search ),
177- SidebarEntryDef (" slider" , " Slider" , " FORM CONTROLS" , Lucide .SlidersHorizontal ),
178- SidebarEntryDef (" circularslider" , " Circular Slider" , " FORM CONTROLS" , Lucide .Loader ),
179- SidebarEntryDef (" stepper" , " Stepper" , " FORM CONTROLS" , Lucide .ChevronsUpDown ),
180- SidebarEntryDef (" popupbutton" , " Pop-up Button" , " FORM CONTROLS" , Lucide .ChevronsUpDown ),
181- SidebarEntryDef (" datepicker" , " Date Picker" , " FORM CONTROLS" , Lucide .Calendar ),
182- SidebarEntryDef (" colorwell" , " Color Wells & Pickers" , " FORM CONTROLS" , Lucide .Scan ),
183- SidebarEntryDef (" scrollbar" , " Scrollbar" , " DATA DISPLAY" , Lucide .GripVertical ),
184- SidebarEntryDef (" groupbox" , " Group Box" , " DATA DISPLAY" , Lucide .SquareDashed ),
185- SidebarEntryDef (" groupedlist" , " Grouped List" , " DATA DISPLAY" , Lucide .ListChecks ),
186- SidebarEntryDef (" form" , " Form" , " DATA DISPLAY" , Lucide .LayoutList ),
187- SidebarEntryDef (" badge" , " Badge" , " DATA DISPLAY" , Lucide .Tag ),
188- SidebarEntryDef (" avatar" , " Avatar" , " DATA DISPLAY" , Lucide .CircleUser ),
189- SidebarEntryDef (" surface" , " Surface" , " DATA DISPLAY" , Lucide .Layers ),
190- SidebarEntryDef (" card" , " Card" , " DATA DISPLAY" , Lucide .CreditCard ),
191- SidebarEntryDef (" table" , " Table" , " DATA DISPLAY" , Lucide .Table ),
192- SidebarEntryDef (" pagecontrol" , " Page Control" , " DATA DISPLAY" , Lucide .CircleDot ),
193- SidebarEntryDef (" progress" , " Progress" , " DATA DISPLAY" , Lucide .Loader ),
194- SidebarEntryDef (" skeleton" , " Skeleton" , " DATA DISPLAY" , Lucide .Scan ),
195- SidebarEntryDef (" alert" , " Alert" , " FEEDBACK" , Lucide .TriangleAlert ),
196- SidebarEntryDef (" toast" , " Toast" , " FEEDBACK" , Lucide .Bell ),
197- SidebarEntryDef (" dialog" , " Dialog" , " OVERLAYS" , Lucide .MessageSquare ),
198- SidebarEntryDef (" tooltip" , " Tooltip" , " OVERLAYS" , Lucide .MessageCircle ),
199- SidebarEntryDef (" popover" , " Popover" , " OVERLAYS" , Lucide .PanelTopOpen ),
200- SidebarEntryDef (" dropdown" , " Dropdown Menu" , " OVERLAYS" , Lucide .Menu ),
201- SidebarEntryDef (" contextmenu" , " Context Menu" , " OVERLAYS" , Lucide .Ellipsis ),
202- SidebarEntryDef (" tabs" , " Tabs" , " NAVIGATION" , Lucide .Columns3 ),
203- SidebarEntryDef (" accordion" , " Accordion" , " NAVIGATION" , Lucide .ChevronsUpDown ),
204- SidebarEntryDef (" sidebar" , " Sidebar" , " NAVIGATION" , RadixPanelLeft ),
205- SidebarEntryDef (" segmentedcontrol" , " Segmented Control" , " FORM CONTROLS" , Lucide .Columns3 ),
206- SidebarEntryDef (" titlebar" , " Title Bar" , " NAVIGATION" , Lucide .PanelTopOpen ),
207- SidebarEntryDef (" addressbar" , " Address Bar" , " NAVIGATION" , Lucide .Search ),
208- SidebarEntryDef (" scaffold" , " Scaffold" , " NAVIGATION" , RadixPanelLeft ),
209- SidebarEntryDef (" icons" , " Icons" , " THEME" , Lucide .Scan ),
210- SidebarEntryDef (" material" , " Material" , " THEME" , Lucide .Scan ),
211- SidebarEntryDef (" controlsize" , " Control Size" , " THEME" , Lucide .SlidersHorizontal ),
173+ // General
174+ SidebarEntryDef (" home" , " Home" , " GENERAL" , Icons .Home ),
175+ SidebarEntryDef (" getting-started" , " Getting Started" , " GENERAL" , SystemIcon (" list.bullet.rectangle" , Lucide .LayoutList )),
176+ SidebarEntryDef (" license" , " License" , " GENERAL" , Icons .Tag ),
177+
178+ // Controls — Buttons
179+ SidebarEntryDef (" button" , " Button" , " CONTROLS" , SystemIcon (" cursorarrow.click" , Lucide .MousePointerClick )),
180+ SidebarEntryDef (" iconbutton" , " Icon Button" , " CONTROLS" , SystemIcon (" square.and.arrow.up.on.square" , Lucide .SquareMousePointer )),
181+
182+ // Controls — Text input
183+ SidebarEntryDef (" input" , " Input" , " CONTROLS" , SystemIcon (" character.cursor.ibeam" , Lucide .TextCursorInput )),
184+ SidebarEntryDef (" textarea" , " Textarea" , " CONTROLS" , SystemIcon (" text.alignleft" , Lucide .TextAlignStart )),
185+ SidebarEntryDef (" searchinput" , " Search Input" , " CONTROLS" , Icons .Search ),
186+
187+ // Controls — Selection
188+ SidebarEntryDef (" checkbox" , " Checkbox" , " CONTROLS" , SystemIcon (" checkmark.square" , Lucide .SquareCheck )),
189+ SidebarEntryDef (" radiobutton" , " Radio Button" , " CONTROLS" , SystemIcon (" circle.inset.filled" , Lucide .CircleDot )),
190+ SidebarEntryDef (" switch" , " Switch" , " CONTROLS" , SystemIcon (" switch.2" , Lucide .ToggleLeft )),
191+ SidebarEntryDef (" segmentedcontrol" , " Segmented Control" , " CONTROLS" , SystemIcon (" rectangle.split.3x1" , Lucide .Columns3 )),
192+ SidebarEntryDef (" combobox" , " Combo Box" , " CONTROLS" , Icons .ChevronsUpDown ),
193+ SidebarEntryDef (" popupbutton" , " Pop-up Button" , " CONTROLS" , Icons .ChevronDown ),
194+ SidebarEntryDef (" multiselect" , " Multi Select" , " CONTROLS" , SystemIcon (" checklist" , Lucide .ListChecks )),
195+
196+ // Controls — Value input
197+ SidebarEntryDef (" slider" , " Slider" , " CONTROLS" , SystemIcon (" slider.horizontal.3" , Lucide .SlidersHorizontal )),
198+ SidebarEntryDef (" circularslider" , " Circular Slider" , " CONTROLS" , SystemIcon (" dial.min" , Lucide .Loader )),
199+ SidebarEntryDef (" stepper" , " Stepper" , " CONTROLS" , SystemIcon (" plusminus" , Lucide .ArrowUpDown )),
200+ SidebarEntryDef (" datepicker" , " Date Picker" , " CONTROLS" , Icons .Calendar ),
201+ SidebarEntryDef (" colorwell" , " Color Wells & Pickers" , " CONTROLS" , SystemIcon (" paintpalette" , Lucide .Palette )),
202+
203+ // Layout & Containers
204+ SidebarEntryDef (" form" , " Form" , " LAYOUT" , SystemIcon (" list.bullet.rectangle" , Lucide .LayoutList )),
205+ SidebarEntryDef (" groupbox" , " Group Box" , " LAYOUT" , SystemIcon (" rectangle.dashed" , Lucide .SquareDashed )),
206+ SidebarEntryDef (" card" , " Card" , " LAYOUT" , SystemIcon (" rectangle.on.rectangle" , Lucide .CreditCard )),
207+ SidebarEntryDef (" surface" , " Surface" , " LAYOUT" , SystemIcon (" square.stack" , Lucide .Layers )),
208+ SidebarEntryDef (" accordion" , " Accordion" , " LAYOUT" , Icons .ChevronsUpDown ),
209+ SidebarEntryDef (" scaffold" , " Scaffold" , " LAYOUT" , Icons .PanelLeft ),
210+
211+ // Collections
212+ SidebarEntryDef (" groupedlist" , " Grouped List" , " COLLECTIONS" , SystemIcon (" checklist" , Lucide .ListChecks )),
213+ SidebarEntryDef (" table" , " Table" , " COLLECTIONS" , SystemIcon (" tablecells" , Lucide .Table )),
214+
215+ // Navigation
216+ SidebarEntryDef (" tabs" , " Tabs" , " NAVIGATION" , SystemIcon (" rectangle.split.3x1" , Lucide .Columns3 )),
217+ SidebarEntryDef (" sidebar" , " Sidebar" , " NAVIGATION" , Icons .PanelLeft ),
218+ SidebarEntryDef (" titlebar" , " Title Bar" , " NAVIGATION" , SystemIcon (" macwindow" , Lucide .PanelTopOpen )),
219+ SidebarEntryDef (" addressbar" , " Address Bar" , " NAVIGATION" , Icons .Search ),
220+ SidebarEntryDef (" pagecontrol" , " Page Control" , " NAVIGATION" , SystemIcon (" circle.inset.filled" , Lucide .CircleDot )),
221+ SidebarEntryDef (" scrollbar" , " Scrollbar" , " NAVIGATION" , SystemIcon (" arrow.up.and.down" , Lucide .GripVertical )),
222+
223+ // Status & Feedback
224+ SidebarEntryDef (" badge" , " Badge" , " STATUS & FEEDBACK" , Icons .Tag ),
225+ SidebarEntryDef (" avatar" , " Avatar" , " STATUS & FEEDBACK" , SystemIcon (" person.circle" , Lucide .CircleUser )),
226+ SidebarEntryDef (" progress" , " Progress" , " STATUS & FEEDBACK" , SystemIcon (" progress.indicator" , Lucide .Loader )),
227+ SidebarEntryDef (" skeleton" , " Skeleton" , " STATUS & FEEDBACK" , SystemIcon (" rectangle.fill" , Lucide .RectangleHorizontal )),
228+ SidebarEntryDef (" alert" , " Alert" , " STATUS & FEEDBACK" , Icons .TriangleAlert ),
229+ SidebarEntryDef (" toast" , " Toast" , " STATUS & FEEDBACK" , SystemIcon (" bell" , Lucide .Bell )),
230+
231+ // Overlays
232+ SidebarEntryDef (" dialog" , " Dialog" , " OVERLAYS" , SystemIcon (" bubble.left.and.bubble.right" , Lucide .MessageSquare )),
233+ SidebarEntryDef (" popover" , " Popover" , " OVERLAYS" , SystemIcon (" macwindow" , Lucide .PanelTopOpen )),
234+ SidebarEntryDef (" tooltip" , " Tooltip" , " OVERLAYS" , SystemIcon (" text.bubble" , Lucide .MessageCircle )),
235+ SidebarEntryDef (" dropdown" , " Dropdown Menu" , " OVERLAYS" , SystemIcon (" line.3.horizontal" , Lucide .Menu )),
236+ SidebarEntryDef (" contextmenu" , " Context Menu" , " OVERLAYS" , Icons .Ellipsis ),
237+
238+ // Theme & Design
239+ SidebarEntryDef (" icons" , " Icons" , " THEME" , Icons .Star ),
240+ SidebarEntryDef (" material" , " Material" , " THEME" , SystemIcon (" paintpalette" , Lucide .Palette )),
241+ SidebarEntryDef (" controlsize" , " Control Size" , " THEME" , SystemIcon (" slider.horizontal.3" , Lucide .SlidersHorizontal )),
212242)
213243
244+ private fun buildSidebarItems (onNavigate : (String ) -> Unit ): List <SidebarItem > {
245+ fun entry (id : String ) = sidebarEntryDefs.first { it.id == id }
246+ fun leaf (id : String ) = entry(id).let { SidebarItem (it.label, onClick = { onNavigate(it.id) }, icon = it.icon, id = it.id) }
247+
248+ fun group (label : String , icon : SystemIcon , ids : List <String >) = SidebarItem (
249+ label = label,
250+ onClick = {},
251+ icon = icon,
252+ children = ids.map { leaf(it) },
253+ initiallyExpanded = false ,
254+ )
255+
256+ return listOf (
257+ leaf(" home" ),
258+ leaf(" getting-started" ),
259+ leaf(" license" ),
260+
261+ group(" Controls" , SystemIcon (" slider.horizontal.below.rectangle" , Lucide .Component ), listOf (
262+ " button" , " iconbutton" ,
263+ " input" , " textarea" , " searchinput" ,
264+ " checkbox" , " radiobutton" , " switch" , " segmentedcontrol" ,
265+ " combobox" , " popupbutton" , " multiselect" ,
266+ " slider" , " circularslider" , " stepper" ,
267+ " datepicker" , " colorwell" ,
268+ )),
269+ group(" Layout" , SystemIcon (" rectangle.3.group" , Lucide .Box ), listOf (
270+ " form" , " groupbox" , " card" , " surface" , " accordion" , " scaffold" ,
271+ )),
272+ group(" Collections" , Icons .Folder , listOf (
273+ " groupedlist" , " table" ,
274+ )),
275+ group(" Navigation" , SystemIcon (" arrow.triangle.turn.up.right.diamond" , Lucide .Navigation ), listOf (
276+ " tabs" , " sidebar" , " titlebar" , " addressbar" , " pagecontrol" , " scrollbar" ,
277+ )),
278+ group(" Status & Feedback" , SystemIcon (" bell.badge" , Lucide .ShieldAlert ), listOf (
279+ " badge" , " avatar" , " progress" , " skeleton" , " alert" , " toast" ,
280+ )),
281+ group(" Overlays" , SystemIcon (" bubble.left.and.bubble.right" , Lucide .MessageSquare ), listOf (
282+ " dialog" , " popover" , " tooltip" , " dropdown" , " contextmenu" ,
283+ )),
284+ group(" Theme" , SystemIcon (" paintbrush" , Lucide .Paintbrush ), listOf (
285+ " icons" , " material" , " controlsize" ,
286+ )),
287+ )
288+ }
289+
214290@Composable
215291fun App () {
216292 var themeMode by remember { mutableStateOf(ThemeMode .System ) }
@@ -272,14 +348,8 @@ fun App() {
272348 // Navigation helpers
273349 val currentPageLabel = sidebarEntryDefs.firstOrNull { it.id == nav.currentPageId }?.label ? : " "
274350
275- val sidebarItems = sidebarEntryDefs.map { def ->
276- SidebarItem (
277- label = def.label,
278- onClick = { nav.navigateTo(def.id) },
279- icon = def.icon,
280- group = def.group,
281- id = def.id,
282- )
351+ val sidebarItems = remember {
352+ buildSidebarItems { id -> nav.navigateTo(id) }
283353 }
284354
285355 BoxWithConstraints (modifier = Modifier .fillMaxSize()) {
0 commit comments