Skip to content

Commit 45fe52e

Browse files
committed
library: ListPopup: OS3 style like
* anim style is similar to OS3, but not exactly the same. * SuperDropdown/SuperSpinner will only be displayed on the right side now
1 parent 4b4662a commit 45fe52e

File tree

14 files changed

+108
-348
lines changed

14 files changed

+108
-348
lines changed

docs/components/superdropdown.md

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
`SuperDropdown` is a dropdown menu component in Miuix that provides a title, summary, and a list of dropdown options. It supports click interaction and is commonly used in option settings and list selections.
44

5-
<div style="position: relative; max-width: 700px; height: 285px; border-radius: 10px; overflow: hidden; border: 1px solid #777;">
5+
<div style="position: relative; max-width: 700px; height: 262px; border-radius: 10px; overflow: hidden; border: 1px solid #777;">
66
<iframe id="demoIframe" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: none;" src="../compose/index.html?id=superDropdown" title="Demo" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin"></iframe>
77
</div>
88

@@ -14,7 +14,6 @@
1414

1515
```kotlin
1616
import top.yukonga.miuix.kmp.extra.SuperDropdown
17-
import top.yukonga.miuix.kmp.extra.DropDownMode
1817
```
1918

2019
## Basic Usage
@@ -67,43 +66,7 @@ SuperDropdown(
6766
)
6867
```
6968

70-
## Dropdown Position
7169

72-
SuperDropdown supports different dropdown position modes:
73-
74-
### Normal Mode (Auto-adaptive based on click position)
75-
76-
```kotlin
77-
var selectedIndex by remember { mutableStateOf(0) }
78-
val options = listOf("Option 1", "Option 2", "Option 3")
79-
80-
Scaffold {
81-
SuperDropdown(
82-
title = "Normal Mode",
83-
items = options,
84-
selectedIndex = selectedIndex,
85-
onSelectedIndexChange = { selectedIndex = it },
86-
mode = DropDownMode.Normal // Default value
87-
)
88-
}
89-
```
90-
91-
### Always on Right Mode
92-
93-
```kotlin
94-
var selectedIndex by remember { mutableStateOf(0) }
95-
val options = listOf("Option 1", "Option 2", "Option 3")
96-
97-
Scaffold {
98-
SuperDropdown(
99-
title = "Always on Right Mode",
100-
items = options,
101-
selectedIndex = selectedIndex,
102-
onSelectedIndexChange = { selectedIndex = it },
103-
mode = DropDownMode.AlwaysOnRight
104-
)
105-
}
106-
```
10770

10871
## Properties
10972

@@ -118,7 +81,6 @@ Scaffold {
11881
| summary | String? | Summary description of dropdown | null | No |
11982
| summaryColor | BasicComponentColors | Summary text color configuration | BasicComponentDefaults.summaryColor() | No |
12083
| dropdownColors | DropdownColors | Color configuration for dropdown | DropdownDefaults.dropdownColors() | No |
121-
| mode | DropDownMode | Display mode of dropdown menu | DropDownMode.Normal | No |
12284
| modifier | Modifier | Modifier applied to the component | Modifier | No |
12385
| insideMargin | PaddingValues | Internal content padding | BasicComponentDefaults.InsideMargin | No |
12486
| maxHeight | Dp? | Maximum height of dropdown menu | null | No |

docs/components/superspinner.md

Lines changed: 2 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
`SuperSpinner` is a dropdown selector component in Miuix that provides titles, summaries, and a list of options with icons and text. It supports click interaction and various display modes, commonly used in option settings with visual aids. This component is similar to `SuperDropdown` but offers richer functionality and interaction experience.
44

5-
<div style="position: relative; max-width: 700px; height: 282px; border-radius: 10px; overflow: hidden; border: 1px solid #777;">
5+
<div style="position: relative; max-width: 700px; height: 262px; border-radius: 10px; overflow: hidden; border: 1px solid #777;">
66
<iframe id="demoIframe" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: none;" src="../compose/index.html?id=superSpinner" title="Demo" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin"></iframe>
77
</div>
88

@@ -15,7 +15,6 @@
1515
```kotlin
1616
import top.yukonga.miuix.kmp.extra.SuperSpinner
1717
import top.yukonga.miuix.kmp.extra.SpinnerEntry
18-
import top.yukonga.miuix.kmp.extra.SpinnerMode
1918
```
2019

2120
## Basic Usage
@@ -108,51 +107,7 @@ SuperSpinner(
108107
)
109108
```
110109

111-
## Display Modes
112-
113-
SuperSpinner supports different display modes:
114-
115-
### Normal Mode (Adaptive to Click Position)
116-
117-
```kotlin
118-
var selectedIndex by remember { mutableStateOf(0) }
119-
val options = listOf(
120-
SpinnerEntry(title = "Option 1"),
121-
SpinnerEntry(title = "Option 2"),
122-
SpinnerEntry(title = "Option 3")
123-
)
124-
125-
Scaffold {
126-
SuperSpinner(
127-
title = "Normal Mode",
128-
items = options,
129-
selectedIndex = selectedIndex,
130-
onSelectedIndexChange = { selectedIndex = it },
131-
mode = SpinnerMode.Normal // Default value
132-
)
133-
}
134-
```
135-
136-
### Always on Right Mode
137-
138-
```kotlin
139-
var selectedIndex by remember { mutableStateOf(0) }
140-
val options = listOf(
141-
SpinnerEntry(title = "Option 1"),
142-
SpinnerEntry(title = "Option 2"),
143-
SpinnerEntry(title = "Option 3")
144-
)
145-
146-
Scaffold {
147-
SuperSpinner(
148-
title = "Always on Right Mode",
149-
items = options,
150-
selectedIndex = selectedIndex,
151-
onSelectedIndexChange = { selectedIndex = it },
152-
mode = SpinnerMode.AlwaysOnRight // Always on right mode
153-
)
154-
}
155-
```
110+
## Dialog Mode
156111

157112
### Display Dropdown Menu in Dialog
158113

@@ -188,7 +143,6 @@ Scaffold {
188143
| summary | String? | Selector description | null | No |
189144
| summaryColor | BasicComponentColors | Summary text color config | BasicComponentDefaults.summaryColor() | No |
190145
| leftAction | @Composable (() -> Unit)? | Custom left content | null | No |
191-
| mode | SpinnerMode | Display mode | SpinnerMode.Normal | No |
192146
| modifier | Modifier | Component modifier | Modifier | No |
193147
| insideMargin | PaddingValues | Internal content padding | BasicComponentDefaults.InsideMargin | No |
194148
| maxHeight | Dp? | Maximum dropdown height | null | No |

docs/demo/src/commonMain/kotlin/ListPopupDemo.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ fun ListPopupDemo() {
4646
)
4747
ListPopup(
4848
show = showPopup,
49-
alignment = PopupPositionProvider.Align.Left,
49+
alignment = PopupPositionProvider.Align.TopLeft,
5050
onDismissRequest = { showPopup.value = false } // Close the popup menu
5151
) {
5252
ListPopupColumn {

docs/demo/src/commonMain/kotlin/SuperDropdownDemo.kt

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import androidx.compose.ui.graphics.Color
2121
import androidx.compose.ui.unit.dp
2222
import top.yukonga.miuix.kmp.basic.Card
2323
import top.yukonga.miuix.kmp.basic.Scaffold
24-
import top.yukonga.miuix.kmp.extra.DropDownMode
2524
import top.yukonga.miuix.kmp.extra.SuperDropdown
2625

2726
@Composable
@@ -45,8 +44,6 @@ fun SuperDropdownDemo() {
4544
val options1 = listOf("Option 1", "Option 2", "Option 3")
4645
var selectedIndex2 by remember { mutableStateOf(0) }
4746
val options2 = listOf("Chinese", "English", "Japanese")
48-
var selectedIndex3 by remember { mutableStateOf(0) }
49-
val options3 = listOf("Option 1", "Option 2", "Option 3")
5047

5148
Card {
5249
SuperDropdown(
@@ -62,13 +59,6 @@ fun SuperDropdownDemo() {
6259
selectedIndex = selectedIndex2,
6360
onSelectedIndexChange = { selectedIndex2 = it }
6461
)
65-
SuperDropdown(
66-
title = "Always on Right Mode",
67-
items = options3,
68-
selectedIndex = selectedIndex3,
69-
onSelectedIndexChange = { selectedIndex3 = it },
70-
mode = DropDownMode.AlwaysOnRight
71-
)
7262
SuperDropdown(
7363
title = "Disabled Dropdown",
7464
summary = "This dropdown menu is currently unavailable",

docs/demo/src/commonMain/kotlin/SuperSpinnerDemo.kt

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import top.yukonga.miuix.kmp.basic.Card
2828
import top.yukonga.miuix.kmp.basic.Icon
2929
import top.yukonga.miuix.kmp.basic.Scaffold
3030
import top.yukonga.miuix.kmp.extra.SpinnerEntry
31-
import top.yukonga.miuix.kmp.extra.SpinnerMode
3231
import top.yukonga.miuix.kmp.extra.SuperSpinner
3332

3433
@Composable
@@ -77,12 +76,6 @@ fun SuperSpinnerDemo() {
7776
summary = "Bright yellow"
7877
)
7978
)
80-
var selectedIndex3 by remember { mutableStateOf(0) }
81-
val options3 = listOf(
82-
SpinnerEntry(title = "Option 1"),
83-
SpinnerEntry(title = "Option 2"),
84-
SpinnerEntry(title = "Option 3")
85-
)
8679

8780
Card {
8881
SuperSpinner(
@@ -98,13 +91,6 @@ fun SuperSpinnerDemo() {
9891
selectedIndex = selectedIndex2,
9992
onSelectedIndexChange = { selectedIndex2 = it }
10093
)
101-
SuperSpinner(
102-
title = "Always on Right Mode",
103-
items = options3,
104-
selectedIndex = selectedIndex3,
105-
onSelectedIndexChange = { selectedIndex3 = it },
106-
mode = SpinnerMode.AlwaysOnRight // Always on right mode
107-
)
10894
SuperSpinner(
10995
title = "Disabled Selector",
11096
summary = "This selector is currently unavailable",

docs/zh_CN/components/superdropdown.md

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
```kotlin
1616
import top.yukonga.miuix.kmp.extra.SuperDropdown
17-
import top.yukonga.miuix.kmp.extra.DropDownMode
1817
```
1918

2019
## 基本用法
@@ -67,43 +66,7 @@ SuperDropdown(
6766
)
6867
```
6968

70-
## 下拉菜单位置
7169

72-
SuperDropdown 支持不同的下拉位置模式:
73-
74-
### 普通模式(根据点击位置自适应)
75-
76-
```kotlin
77-
var selectedIndex by remember { mutableStateOf(0) }
78-
val options = listOf("选项 1", "选项 2", "选项 3")
79-
80-
Scaffold {
81-
SuperDropdown(
82-
title = "普通模式",
83-
items = options,
84-
selectedIndex = selectedIndex,
85-
onSelectedIndexChange = { selectedIndex = it },
86-
mode = DropDownMode.Normal // 默认值
87-
)
88-
}
89-
```
90-
91-
### 总是在右侧模式
92-
93-
```kotlin
94-
var selectedIndex by remember { mutableStateOf(0) }
95-
val options = listOf("选项 1", "选项 2", "选项 3")
96-
97-
Scaffold {
98-
SuperDropdown(
99-
title = "总是在右侧模式",
100-
items = options,
101-
selectedIndex = selectedIndex,
102-
onSelectedIndexChange = { selectedIndex = it },
103-
mode = DropDownMode.AlwaysOnRight
104-
)
105-
}
106-
```
10770

10871
## 属性
10972

@@ -118,7 +81,6 @@ Scaffold {
11881
| summary | String? | 下拉菜单的摘要说明 | null ||
11982
| summaryColor | BasicComponentColors | 摘要文本的颜色配置 | BasicComponentDefaults.summaryColor() ||
12083
| dropdownColors | DropdownColors | 下拉菜单的颜色配置 | DropdownDefaults.dropdownColors() ||
121-
| mode | DropDownMode | 下拉菜单的显示模式 | DropDownMode.Normal ||
12284
| modifier | Modifier | 应用于组件的修饰符 | Modifier ||
12385
| insideMargin | PaddingValues | 组件内部内容的边距 | BasicComponentDefaults.InsideMargin ||
12486
| maxHeight | Dp? | 下拉菜单的最大高度 | null ||

docs/zh_CN/components/superspinner.md

Lines changed: 1 addition & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
```kotlin
1616
import top.yukonga.miuix.kmp.extra.SuperSpinner
1717
import top.yukonga.miuix.kmp.extra.SpinnerEntry
18-
import top.yukonga.miuix.kmp.extra.SpinnerMode
1918
```
2019

2120
## 基本用法
@@ -108,51 +107,7 @@ SuperSpinner(
108107
)
109108
```
110109

111-
## 显示模式
112-
113-
SuperSpinner 支持不同的显示模式:
114-
115-
### 普通模式(根据点击位置自适应)
116-
117-
```kotlin
118-
var selectedIndex by remember { mutableStateOf(0) }
119-
val options = listOf(
120-
SpinnerEntry(title = "选项 1"),
121-
SpinnerEntry(title = "选项 2"),
122-
SpinnerEntry(title = "选项 3")
123-
)
124-
125-
Scaffold {
126-
SuperSpinner(
127-
title = "普通模式",
128-
items = options,
129-
selectedIndex = selectedIndex,
130-
onSelectedIndexChange = { selectedIndex = it },
131-
mode = SpinnerMode.Normal // 默认值
132-
)
133-
}
134-
```
135-
136-
### 总是在右侧模式
137-
138-
```kotlin
139-
var selectedIndex by remember { mutableStateOf(0) }
140-
val options = listOf(
141-
SpinnerEntry(title = "选项 1"),
142-
SpinnerEntry(title = "选项 2"),
143-
SpinnerEntry(title = "选项 3")
144-
)
145-
146-
Scaffold {
147-
SuperSpinner(
148-
title = "总是在右侧模式",
149-
items = options,
150-
selectedIndex = selectedIndex,
151-
onSelectedIndexChange = { selectedIndex = it },
152-
mode = SpinnerMode.AlwaysOnRight // 总是在右侧模式
153-
)
154-
}
155-
```
110+
## 对话框模式
156111

157112
### 将下拉菜单显示在对话框中
158113

@@ -188,7 +143,6 @@ Scaffold {
188143
| summary | String? | 选择器的摘要说明 | null ||
189144
| summaryColor | BasicComponentColors | 摘要文本的颜色配置 | BasicComponentDefaults.summaryColor() ||
190145
| leftAction | @Composable (() -> Unit)? | 左侧显示的自定义内容 | null ||
191-
| mode | SpinnerMode | 选择器的显示模式 | SpinnerMode.Normal ||
192146
| modifier | Modifier | 应用于组件的修饰符 | Modifier ||
193147
| insideMargin | PaddingValues | 组件内部内容的边距 | BasicComponentDefaults.InsideMargin ||
194148
| maxHeight | Dp? | 下拉菜单的最大高度 | null ||

example/src/commonMain/kotlin/MainPage.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,7 @@ fun MainPage(
9393
val switch = remember { mutableStateOf(false) }
9494
val switchTrue = remember { mutableStateOf(true) }
9595
val dropdownOptionSelected = remember { mutableStateOf(0) }
96-
val dropdownOptionSelectedRight = remember { mutableStateOf(1) }
9796
val spinnerOptionSelected = remember { mutableStateOf(0) }
98-
val spinnerOptionSelectedRight = remember { mutableStateOf(1) }
9997
val spinnerOptionSelectedDialog = remember { mutableStateOf(2) }
10098
val superCheckbox = remember { mutableStateOf("State: false") }
10199
val superCheckboxState = remember { mutableStateOf(false) }
@@ -119,9 +117,7 @@ fun MainPage(
119117
switch,
120118
switchTrue,
121119
dropdownOptionSelected,
122-
dropdownOptionSelectedRight,
123120
spinnerOptionSelected,
124-
spinnerOptionSelectedRight,
125121
spinnerOptionSelectedDialog,
126122
superCheckbox,
127123
superCheckboxState,

0 commit comments

Comments
 (0)