@robert-stackflow/oneui 0.6.49 → 0.6.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -1
- package/components/Button.module.css +122 -120
- package/components/Control.module.css +90 -86
- package/components/IconButton.module.css +3 -1
- package/components/MenuItem.module.css +4 -2
- package/components/Pagination.d.ts +5 -1
- package/components/Pagination.js +71 -54
- package/components/Pagination.module.css +3 -3
- package/components/Segmented.module.css +3 -2
- package/components/SelectTrigger.module.css +2 -2
- package/components/Tab.module.css +149 -148
- package/package.json +1 -1
- package/styles/base.css +8 -0
package/README.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
React 组件、应用外壳和两套可互换的主题。无 Electron、React Router、账户 API 或持久化存储依赖。
|
|
4
4
|
|
|
5
|
+
## 触屏尺寸与分页链接(0.6.51)
|
|
6
|
+
|
|
7
|
+
粗指针设备的按钮、图标按钮、分段控件、标签页、菜单、输入及分页使用至少 44px 的操作高度;可编辑字段至少 16px,避免 iOS 聚焦时自动缩放。鼠标设备保留现有密度。公开 CSS 变量 `--touch-target-min`、`--touch-field-font-size` 可按宿主输入策略配置,组件无需私有 DOM 覆盖。
|
|
8
|
+
|
|
9
|
+
`Pagination getPageHref(page)` 为可用的页码和翻页控件输出真实链接,普通点击仍调用 `onPageChange`,修饰键/中键交给浏览器。禁用翻页按钮不生成链接。后台不传该属性时保留原有按钮行为。
|
|
10
|
+
|
|
5
11
|
## 分栏按钮与嵌套浮层(0.6.40)
|
|
6
12
|
|
|
7
13
|
SplitButton 保留 items 菜单,支持 label / iconOnly / size / pressed、ghost 外观、受控 open / onOpenChange,以及自定义 panel / panelWidth / portalContainer。主动作与展开区分别响应,自定义面板复用非模态箭头 Popover。图标提示的包裹层不会阻断按钮样式。
|
|
@@ -240,7 +246,7 @@ export function App() {
|
|
|
240
246
|
|
|
241
247
|
`Dialog` 和 `Drawer` 在普通关闭、条件卸载时都会恢复触发控件的焦点,支持 StrictMode 和嵌套弹窗。异步打开导致触发按钮在加载期间失焦时,可传入 `returnFocus={triggerRef}` 明确返回位置;已卸载、禁用或位于其他模态层之外的目标不会被聚焦。
|
|
242
248
|
|
|
243
|
-
`Pagination` 的 `total` 是总条数,`pageSize` 是每页条数。`compact` 移除外层留白并在窄屏重排页码、统计和跳转,`size="small"`
|
|
249
|
+
`Pagination` 的 `total` 是总条数,`pageSize` 是每页条数。`compact` 移除外层留白并在窄屏重排页码、统计和跳转,`size="small"` 使用当前主题的小尺寸控件;正常和紧凑模式均支持长页码列表换行。`showJump={false}` 隐藏跳转输入,配合 `showSummary={false}` 和省略 `onPageSizeChange` 可只展示首末页、前后页与页码。宿主可通过 `className` 调整外层位置。
|
|
244
250
|
|
|
245
251
|
```tsx
|
|
246
252
|
<Pagination
|
|
@@ -1,120 +1,122 @@
|
|
|
1
|
-
.button {
|
|
2
|
-
display: inline-flex;
|
|
3
|
-
align-items: center;
|
|
4
|
-
justify-content: center;
|
|
5
|
-
gap: 7px;
|
|
6
|
-
min-height: var(--control-height);
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
border
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
color: var(--
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
1
|
+
.button {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
justify-content: center;
|
|
5
|
+
gap: 7px;
|
|
6
|
+
min-height: max(var(--control-height), var(--touch-target-min, 0px));
|
|
7
|
+
min-width: var(--touch-target-min, 0px);
|
|
8
|
+
padding: 6px 13px;
|
|
9
|
+
border: 1px solid var(--line);
|
|
10
|
+
border-radius: calc(var(--radius) - 3px);
|
|
11
|
+
background: var(--surface);
|
|
12
|
+
white-space: nowrap;
|
|
13
|
+
transition:
|
|
14
|
+
background var(--motion-hover),
|
|
15
|
+
transform var(--motion-hover),
|
|
16
|
+
border-color var(--motion-hover);
|
|
17
|
+
font-size: 12px;
|
|
18
|
+
text-decoration: none;
|
|
19
|
+
color: var(--fg);
|
|
20
|
+
}
|
|
21
|
+
.button[aria-disabled="true"] {
|
|
22
|
+
opacity: 0.5;
|
|
23
|
+
cursor: not-allowed;
|
|
24
|
+
}
|
|
25
|
+
.button:hover:not(:disabled):not([aria-disabled="true"]) {
|
|
26
|
+
background: var(--hover);
|
|
27
|
+
border-color: color-mix(in srgb, var(--fg) 18%, var(--surface));
|
|
28
|
+
}
|
|
29
|
+
.button:active:not(:disabled):not([aria-disabled="true"]) {
|
|
30
|
+
transform: translateY(1px);
|
|
31
|
+
}
|
|
32
|
+
.primary {
|
|
33
|
+
background: var(--accent-fill, var(--accent));
|
|
34
|
+
border-color: var(--accent-fill, var(--accent));
|
|
35
|
+
color: var(--on-accent-fill, var(--on-accent));
|
|
36
|
+
}
|
|
37
|
+
.primary:hover:not(:disabled):not([aria-disabled="true"]) {
|
|
38
|
+
background: var(
|
|
39
|
+
--accent-fill-hover,
|
|
40
|
+
color-mix(in srgb, var(--accent) 86%, var(--surface))
|
|
41
|
+
);
|
|
42
|
+
border-color: transparent;
|
|
43
|
+
}
|
|
44
|
+
.secondary {
|
|
45
|
+
box-shadow: 0 1px 1px #00000003;
|
|
46
|
+
}
|
|
47
|
+
.ghost {
|
|
48
|
+
background: transparent;
|
|
49
|
+
border-color: transparent;
|
|
50
|
+
box-shadow: none;
|
|
51
|
+
}
|
|
52
|
+
.danger {
|
|
53
|
+
color: var(--danger);
|
|
54
|
+
background: color-mix(in srgb, var(--danger) 5%, var(--surface));
|
|
55
|
+
}
|
|
56
|
+
.small {
|
|
57
|
+
min-height: max(var(--control-small), var(--touch-target-min, 0px));
|
|
58
|
+
padding: 4px 9px;
|
|
59
|
+
font-size: 11px;
|
|
60
|
+
}
|
|
61
|
+
.link {
|
|
62
|
+
min-height: 0;
|
|
63
|
+
min-width: 0;
|
|
64
|
+
padding: 0;
|
|
65
|
+
border: 0;
|
|
66
|
+
border-radius: 2px;
|
|
67
|
+
background: transparent;
|
|
68
|
+
box-shadow: none;
|
|
69
|
+
color: var(--link-color, var(--accent-ink, var(--accent)));
|
|
70
|
+
font-size: 13px;
|
|
71
|
+
line-height: 1.6;
|
|
72
|
+
text-align: left;
|
|
73
|
+
justify-content: flex-start;
|
|
74
|
+
white-space: normal;
|
|
75
|
+
}
|
|
76
|
+
.link:hover:not(:disabled):not([aria-disabled="true"]) {
|
|
77
|
+
background: transparent;
|
|
78
|
+
color: var(
|
|
79
|
+
--link-hover-color,
|
|
80
|
+
var(--link-color, var(--accent-hover, var(--accent-ink, var(--accent))))
|
|
81
|
+
);
|
|
82
|
+
text-decoration: underline;
|
|
83
|
+
text-underline-offset: 3px;
|
|
84
|
+
}
|
|
85
|
+
.link .content {
|
|
86
|
+
justify-content: flex-start;
|
|
87
|
+
}
|
|
88
|
+
.spin {
|
|
89
|
+
animation: spin 1s linear infinite;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.button {
|
|
93
|
+
position: relative;
|
|
94
|
+
}
|
|
95
|
+
.content {
|
|
96
|
+
display: inline-flex;
|
|
97
|
+
align-items: center;
|
|
98
|
+
justify-content: center;
|
|
99
|
+
gap: 7px;
|
|
100
|
+
}
|
|
101
|
+
.loader {
|
|
102
|
+
position: absolute;
|
|
103
|
+
inset: 0;
|
|
104
|
+
display: grid;
|
|
105
|
+
place-items: center;
|
|
106
|
+
}
|
|
107
|
+
.button[aria-busy="true"] {
|
|
108
|
+
opacity: 0.8;
|
|
109
|
+
cursor: wait;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.content > svg {
|
|
113
|
+
width: var(--button-icon-size, 16px);
|
|
114
|
+
height: var(--button-icon-size, 16px);
|
|
115
|
+
flex-shrink: 0;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
@keyframes spin {
|
|
119
|
+
to {
|
|
120
|
+
transform: rotate(360deg);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
@@ -1,86 +1,90 @@
|
|
|
1
|
-
.surface {
|
|
2
|
-
height: var(--control-height);
|
|
3
|
-
min-width: 0;
|
|
4
|
-
border: 1px solid var(--control-border, var(--line));
|
|
5
|
-
border-radius: var(--field-radius);
|
|
6
|
-
background: var(--field);
|
|
7
|
-
color: var(--fg);
|
|
8
|
-
font-size: var(--field-font-size);
|
|
9
|
-
line-height: var(--field-line-height);
|
|
10
|
-
outline: none;
|
|
11
|
-
transition:
|
|
12
|
-
border-color var(--motion-hover),
|
|
13
|
-
box-shadow var(--motion-hover),
|
|
14
|
-
background-color var(--motion-hover);
|
|
15
|
-
}
|
|
16
|
-
.surface:hover:where(
|
|
17
|
-
:not(
|
|
18
|
-
:disabled,
|
|
19
|
-
[data-disabled="true"],
|
|
20
|
-
[aria-disabled="true"],
|
|
21
|
-
[readonly],
|
|
22
|
-
[aria-readonly="true"],
|
|
23
|
-
[data-readonly="true"],
|
|
24
|
-
[data-disabled="true"] *,
|
|
25
|
-
[aria-disabled="true"] *,
|
|
26
|
-
[data-readonly="true"] *,
|
|
27
|
-
fieldset:disabled *,
|
|
28
|
-
:has(input:disabled, textarea:disabled)
|
|
29
|
-
)
|
|
30
|
-
) {
|
|
31
|
-
border-color: var(
|
|
32
|
-
--field-hover-border,
|
|
33
|
-
color-mix(in srgb, var(--fg) var(--field-hover-strength), var(--surface))
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
.surface[data-focus="true"],
|
|
37
|
-
.surface:focus,
|
|
38
|
-
.surface:focus-visible,
|
|
39
|
-
.surface:focus-within,
|
|
40
|
-
.surface[aria-expanded="true"] {
|
|
41
|
-
outline: none;
|
|
42
|
-
border-color: var(--field-focus-border);
|
|
43
|
-
box-shadow: 0 0 0 var(--field-focus-width)
|
|
44
|
-
color-mix(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
.surface[aria-invalid="true"]
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
.surface:
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
.surface[data-disabled="true"]
|
|
60
|
-
opacity:
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
.surface input
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
.surface
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
1
|
+
.surface {
|
|
2
|
+
height: max(var(--control-height), var(--touch-target-min, 0px));
|
|
3
|
+
min-width: 0;
|
|
4
|
+
border: 1px solid var(--control-border, var(--line));
|
|
5
|
+
border-radius: var(--field-radius);
|
|
6
|
+
background: var(--field);
|
|
7
|
+
color: var(--fg);
|
|
8
|
+
font-size: max(var(--field-font-size), var(--touch-field-font-size, 0px));
|
|
9
|
+
line-height: var(--field-line-height);
|
|
10
|
+
outline: none;
|
|
11
|
+
transition:
|
|
12
|
+
border-color var(--motion-hover),
|
|
13
|
+
box-shadow var(--motion-hover),
|
|
14
|
+
background-color var(--motion-hover);
|
|
15
|
+
}
|
|
16
|
+
.surface:hover:where(
|
|
17
|
+
:not(
|
|
18
|
+
:disabled,
|
|
19
|
+
[data-disabled="true"],
|
|
20
|
+
[aria-disabled="true"],
|
|
21
|
+
[readonly],
|
|
22
|
+
[aria-readonly="true"],
|
|
23
|
+
[data-readonly="true"],
|
|
24
|
+
[data-disabled="true"] *,
|
|
25
|
+
[aria-disabled="true"] *,
|
|
26
|
+
[data-readonly="true"] *,
|
|
27
|
+
fieldset:disabled *,
|
|
28
|
+
:has(input:disabled, textarea:disabled)
|
|
29
|
+
)
|
|
30
|
+
) {
|
|
31
|
+
border-color: var(
|
|
32
|
+
--field-hover-border,
|
|
33
|
+
color-mix(in srgb, var(--fg) var(--field-hover-strength), var(--surface))
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
.surface[data-focus="true"],
|
|
37
|
+
.surface:focus,
|
|
38
|
+
.surface:focus-visible,
|
|
39
|
+
.surface:focus-within,
|
|
40
|
+
.surface[aria-expanded="true"] {
|
|
41
|
+
outline: none;
|
|
42
|
+
border-color: var(--field-focus-border);
|
|
43
|
+
box-shadow: 0 0 0 var(--field-focus-width)
|
|
44
|
+
color-mix(
|
|
45
|
+
in srgb,
|
|
46
|
+
var(--accent-ink, var(--accent)) var(--field-focus-strength),
|
|
47
|
+
transparent
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
.surface[aria-invalid="true"] {
|
|
51
|
+
border-color: var(--danger);
|
|
52
|
+
}
|
|
53
|
+
.surface[aria-invalid="true"][data-focus="true"],
|
|
54
|
+
.surface[aria-invalid="true"]:focus-within {
|
|
55
|
+
box-shadow: 0 0 0 var(--field-focus-width)
|
|
56
|
+
color-mix(in srgb, var(--danger) var(--field-focus-strength), transparent);
|
|
57
|
+
}
|
|
58
|
+
.surface:disabled,
|
|
59
|
+
.surface[data-disabled="true"] {
|
|
60
|
+
opacity: var(--field-disabled-opacity);
|
|
61
|
+
cursor: not-allowed;
|
|
62
|
+
}
|
|
63
|
+
.surface[data-disabled="true"] input:disabled {
|
|
64
|
+
opacity: 1;
|
|
65
|
+
}
|
|
66
|
+
.surface input {
|
|
67
|
+
outline: none;
|
|
68
|
+
color: inherit;
|
|
69
|
+
font-family: inherit;
|
|
70
|
+
line-height: inherit;
|
|
71
|
+
}
|
|
72
|
+
.surface input:focus-visible {
|
|
73
|
+
outline: none;
|
|
74
|
+
}
|
|
75
|
+
.surface::placeholder,
|
|
76
|
+
.surface input::placeholder {
|
|
77
|
+
color: var(--placeholder);
|
|
78
|
+
opacity: 1;
|
|
79
|
+
}
|
|
80
|
+
.surface[readonly],
|
|
81
|
+
.surface[aria-readonly="true"],
|
|
82
|
+
.surface:has(input[readonly]) {
|
|
83
|
+
background: var(--field-readonly);
|
|
84
|
+
}
|
|
85
|
+
@media (max-width: 600px) {
|
|
86
|
+
.surface:has(input),
|
|
87
|
+
.surface:is(input, textarea) {
|
|
88
|
+
font-size: 16px;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
place-items: center;
|
|
5
5
|
width: 32px;
|
|
6
6
|
height: 32px;
|
|
7
|
+
min-width: var(--touch-target-min, 0px);
|
|
8
|
+
min-height: var(--touch-target-min, 0px);
|
|
7
9
|
padding: 0;
|
|
8
10
|
border: 0;
|
|
9
11
|
background: transparent;
|
|
@@ -24,7 +26,7 @@
|
|
|
24
26
|
.iconButton[data-size="small"] {
|
|
25
27
|
width: 30px;
|
|
26
28
|
height: 30px;
|
|
27
|
-
min-width: 30px;
|
|
29
|
+
min-width: max(30px, var(--touch-target-min, 0px));
|
|
28
30
|
}
|
|
29
31
|
.iconButton[data-has-text] {
|
|
30
32
|
display: inline-flex;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
gap: var(--menu-item-gap);
|
|
5
5
|
width: 100%;
|
|
6
6
|
min-width: 0;
|
|
7
|
-
min-height: var(--menu-item-height);
|
|
7
|
+
min-height: max(var(--menu-item-height), var(--touch-target-min, 0px));
|
|
8
8
|
margin: 0;
|
|
9
9
|
padding: max(
|
|
10
10
|
4px,
|
|
@@ -126,7 +126,9 @@
|
|
|
126
126
|
white-space: pre-line;
|
|
127
127
|
overflow-wrap: anywhere;
|
|
128
128
|
}
|
|
129
|
-
.description[data-lines="3"] {
|
|
129
|
+
.description[data-lines="3"] {
|
|
130
|
+
-webkit-line-clamp: 3;
|
|
131
|
+
}
|
|
130
132
|
.shortcut ~ .trailing:empty {
|
|
131
133
|
display: none;
|
|
132
134
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
-
export declare function Pagination({ page, pageSize, total, onPageChange, onPageSizeChange, pageSizes, summary, resetPageOnSizeChange, compact, size: controlSize, className, showSummary, label, previousLabel, nextLabel, }: {
|
|
2
|
+
export declare function Pagination({ page, pageSize, total, onPageChange, onPageSizeChange, pageSizes, summary, resetPageOnSizeChange, compact, size: controlSize, className, showSummary, showJump, label, previousLabel, nextLabel, getPageHref, }: {
|
|
3
3
|
page: number;
|
|
4
4
|
pageSize: number;
|
|
5
5
|
total: number;
|
|
@@ -13,7 +13,11 @@ export declare function Pagination({ page, pageSize, total, onPageChange, onPage
|
|
|
13
13
|
size?: "default" | "small";
|
|
14
14
|
className?: string;
|
|
15
15
|
showSummary?: boolean;
|
|
16
|
+
/** Hide the direct page input for compact public navigation. */
|
|
17
|
+
showJump?: boolean;
|
|
16
18
|
label?: string;
|
|
17
19
|
previousLabel?: string;
|
|
18
20
|
nextLabel?: string;
|
|
21
|
+
/** Render crawlable links and preserve native modified-click behavior. */
|
|
22
|
+
getPageHref?(page: number): string;
|
|
19
23
|
}): import("react").JSX.Element;
|
package/components/Pagination.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
useEffect,
|
|
5
|
+
useId,
|
|
6
|
+
useState
|
|
7
|
+
} from "react";
|
|
4
8
|
import {
|
|
5
9
|
ChevronLeft,
|
|
6
10
|
ChevronRight,
|
|
@@ -25,9 +29,11 @@ function Pagination({
|
|
|
25
29
|
size: controlSize = "default",
|
|
26
30
|
className = "",
|
|
27
31
|
showSummary = true,
|
|
32
|
+
showJump = true,
|
|
28
33
|
label,
|
|
29
34
|
previousLabel,
|
|
30
|
-
nextLabel
|
|
35
|
+
nextLabel,
|
|
36
|
+
getPageHref
|
|
31
37
|
}) {
|
|
32
38
|
const { text, english } = useUIText();
|
|
33
39
|
const size = Math.max(1, pageSize), pages = Math.max(1, Math.ceil(total / size)), current = Math.min(pages, Math.max(1, page)), id = useId(), [draft, setDraft] = useState(String(current));
|
|
@@ -51,6 +57,38 @@ function Pagination({
|
|
|
51
57
|
pages
|
|
52
58
|
])
|
|
53
59
|
].sort((a, b) => a - b);
|
|
60
|
+
function pageControl(target, options) {
|
|
61
|
+
const props = {
|
|
62
|
+
className: options.className,
|
|
63
|
+
"aria-label": options.label,
|
|
64
|
+
"aria-current": options.current ? "page" : void 0,
|
|
65
|
+
variant: options.current ? "primary" : options.className === s.page ? "ghost" : "secondary"
|
|
66
|
+
};
|
|
67
|
+
if (getPageHref && !options.disabled)
|
|
68
|
+
return /* @__PURE__ */ jsx(
|
|
69
|
+
Button,
|
|
70
|
+
{
|
|
71
|
+
...props,
|
|
72
|
+
href: getPageHref(target),
|
|
73
|
+
onClick: (event) => {
|
|
74
|
+
if (event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey)
|
|
75
|
+
return;
|
|
76
|
+
event.preventDefault();
|
|
77
|
+
onPageChange(target);
|
|
78
|
+
},
|
|
79
|
+
children: options.children
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
return /* @__PURE__ */ jsx(
|
|
83
|
+
Button,
|
|
84
|
+
{
|
|
85
|
+
...props,
|
|
86
|
+
disabled: options.disabled,
|
|
87
|
+
onClick: () => onPageChange(target),
|
|
88
|
+
children: options.children
|
|
89
|
+
}
|
|
90
|
+
);
|
|
91
|
+
}
|
|
54
92
|
return /* @__PURE__ */ jsxs(
|
|
55
93
|
"nav",
|
|
56
94
|
{
|
|
@@ -83,62 +121,41 @@ function Pagination({
|
|
|
83
121
|
}
|
|
84
122
|
),
|
|
85
123
|
/* @__PURE__ */ jsxs("div", { className: s.pages, children: [
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
{
|
|
99
|
-
className: s.arrow,
|
|
100
|
-
"aria-label": previousLabel ?? text("\u4E0A\u4E00\u9875", "Previous", "\u4E0A\u4E00\u9801"),
|
|
101
|
-
disabled: current === 1,
|
|
102
|
-
onClick: () => onPageChange(current - 1),
|
|
103
|
-
children: /* @__PURE__ */ jsx(ChevronLeft, {})
|
|
104
|
-
}
|
|
105
|
-
),
|
|
124
|
+
pageControl(1, {
|
|
125
|
+
className: s.arrow,
|
|
126
|
+
label: text("\u7B2C\u4E00\u9875", "First page", "\u7B2C\u4E00\u9801"),
|
|
127
|
+
disabled: current === 1,
|
|
128
|
+
children: /* @__PURE__ */ jsx(ChevronsLeft, {})
|
|
129
|
+
}),
|
|
130
|
+
pageControl(current - 1, {
|
|
131
|
+
className: s.arrow,
|
|
132
|
+
label: previousLabel ?? text("\u4E0A\u4E00\u9875", "Previous", "\u4E0A\u4E00\u9801"),
|
|
133
|
+
disabled: current === 1,
|
|
134
|
+
children: /* @__PURE__ */ jsx(ChevronLeft, {})
|
|
135
|
+
}),
|
|
106
136
|
visible.map((n, i) => /* @__PURE__ */ jsxs("span", { className: s.number, children: [
|
|
107
137
|
i > 0 && n - visible[i - 1] > 1 && /* @__PURE__ */ jsx("span", { className: s.ellipsis, children: "\u2026" }),
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
variant: n === current ? "primary" : "ghost",
|
|
115
|
-
onClick: () => onPageChange(n),
|
|
116
|
-
children: n
|
|
117
|
-
}
|
|
118
|
-
)
|
|
138
|
+
pageControl(n, {
|
|
139
|
+
className: s.page,
|
|
140
|
+
label: english ? "Page " + n : "\u7B2C " + n + text(" \u9875", "", " \u9801"),
|
|
141
|
+
current: n === current,
|
|
142
|
+
children: n
|
|
143
|
+
})
|
|
119
144
|
] }, n)),
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
{
|
|
133
|
-
className: s.arrow,
|
|
134
|
-
"aria-label": text("\u6700\u540E\u4E00\u9875", "Last page", "\u6700\u5F8C\u4E00\u9801"),
|
|
135
|
-
disabled: current === pages,
|
|
136
|
-
onClick: () => onPageChange(pages),
|
|
137
|
-
children: /* @__PURE__ */ jsx(ChevronsRight, {})
|
|
138
|
-
}
|
|
139
|
-
)
|
|
145
|
+
pageControl(current + 1, {
|
|
146
|
+
className: s.arrow,
|
|
147
|
+
label: nextLabel ?? text("\u4E0B\u4E00\u9875", "Next", "\u4E0B\u4E00\u9801"),
|
|
148
|
+
disabled: current === pages,
|
|
149
|
+
children: /* @__PURE__ */ jsx(ChevronRight, {})
|
|
150
|
+
}),
|
|
151
|
+
pageControl(pages, {
|
|
152
|
+
className: s.arrow,
|
|
153
|
+
label: text("\u6700\u540E\u4E00\u9875", "Last page", "\u6700\u5F8C\u4E00\u9801"),
|
|
154
|
+
disabled: current === pages,
|
|
155
|
+
children: /* @__PURE__ */ jsx(ChevronsRight, {})
|
|
156
|
+
})
|
|
140
157
|
] }),
|
|
141
|
-
/* @__PURE__ */ jsxs(
|
|
158
|
+
showJump && /* @__PURE__ */ jsxs(
|
|
142
159
|
"form",
|
|
143
160
|
{
|
|
144
161
|
className: s.jump,
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
}
|
|
44
44
|
.pages .arrow,
|
|
45
45
|
.pages .page {
|
|
46
|
-
height: var(--control-height);
|
|
47
|
-
min-height: var(--control-height);
|
|
48
|
-
min-width: var(--control-height);
|
|
46
|
+
height: max(var(--control-height), var(--touch-target-min, 0px));
|
|
47
|
+
min-height: max(var(--control-height), var(--touch-target-min, 0px));
|
|
48
|
+
min-width: max(var(--control-height), var(--touch-target-min, 0px));
|
|
49
49
|
padding: 0 7px;
|
|
50
50
|
}
|
|
51
51
|
.arrow svg {
|
|
@@ -47,7 +47,8 @@
|
|
|
47
47
|
align-items: center;
|
|
48
48
|
justify-content: center;
|
|
49
49
|
gap: 6px;
|
|
50
|
-
min-
|
|
50
|
+
min-width: var(--touch-target-min, 0px);
|
|
51
|
+
min-height: max(var(--segment-height-min), var(--touch-target-min, 0px));
|
|
51
52
|
border: 0;
|
|
52
53
|
padding: 4px 12px;
|
|
53
54
|
border-radius: calc(var(--radius) - 5px);
|
|
@@ -84,5 +85,5 @@
|
|
|
84
85
|
}
|
|
85
86
|
.segmented[data-full-width] button {
|
|
86
87
|
flex: 1;
|
|
87
|
-
min-width:
|
|
88
|
+
min-width: var(--touch-target-min, 0px);
|
|
88
89
|
}
|
|
@@ -1,148 +1,149 @@
|
|
|
1
|
-
.viewport {
|
|
2
|
-
overflow-x: auto;
|
|
3
|
-
overflow-y: hidden;
|
|
4
|
-
scrollbar-width: none;
|
|
5
|
-
padding-bottom: 1px;
|
|
6
|
-
min-width: 0;
|
|
7
|
-
max-width: 100%;
|
|
8
|
-
}
|
|
9
|
-
.tabs {
|
|
10
|
-
position: relative;
|
|
11
|
-
display: flex;
|
|
12
|
-
align-items: stretch;
|
|
13
|
-
gap: 4px;
|
|
14
|
-
width: max-content;
|
|
15
|
-
min-width: 100%;
|
|
16
|
-
isolation: isolate;
|
|
17
|
-
}
|
|
18
|
-
.tabs button {
|
|
19
|
-
position: relative;
|
|
20
|
-
z-index: 1;
|
|
21
|
-
display: flex;
|
|
22
|
-
align-items: center;
|
|
23
|
-
justify-content: center;
|
|
24
|
-
gap: 7px;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
1
|
+
.viewport {
|
|
2
|
+
overflow-x: auto;
|
|
3
|
+
overflow-y: hidden;
|
|
4
|
+
scrollbar-width: none;
|
|
5
|
+
padding-bottom: 1px;
|
|
6
|
+
min-width: 0;
|
|
7
|
+
max-width: 100%;
|
|
8
|
+
}
|
|
9
|
+
.tabs {
|
|
10
|
+
position: relative;
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: stretch;
|
|
13
|
+
gap: 4px;
|
|
14
|
+
width: max-content;
|
|
15
|
+
min-width: 100%;
|
|
16
|
+
isolation: isolate;
|
|
17
|
+
}
|
|
18
|
+
.tabs button {
|
|
19
|
+
position: relative;
|
|
20
|
+
z-index: 1;
|
|
21
|
+
display: flex;
|
|
22
|
+
align-items: center;
|
|
23
|
+
justify-content: center;
|
|
24
|
+
gap: 7px;
|
|
25
|
+
min-width: var(--touch-target-min, 0px);
|
|
26
|
+
white-space: nowrap;
|
|
27
|
+
border: 0;
|
|
28
|
+
background: transparent;
|
|
29
|
+
min-height: max(34px, var(--touch-target-min, 0px));
|
|
30
|
+
padding: 7px 12px;
|
|
31
|
+
font-size: 12px;
|
|
32
|
+
color: var(--muted);
|
|
33
|
+
border-radius: 6px;
|
|
34
|
+
transition:
|
|
35
|
+
color var(--motion-hover),
|
|
36
|
+
background var(--motion-hover);
|
|
37
|
+
}
|
|
38
|
+
.tabs button:hover:not(:disabled) {
|
|
39
|
+
color: var(--fg);
|
|
40
|
+
}
|
|
41
|
+
.tabs button[aria-selected="true"] {
|
|
42
|
+
color: var(--fg);
|
|
43
|
+
}
|
|
44
|
+
.tabs button:focus-visible {
|
|
45
|
+
outline-offset: -2px;
|
|
46
|
+
}
|
|
47
|
+
.indicator {
|
|
48
|
+
position: absolute;
|
|
49
|
+
z-index: 0;
|
|
50
|
+
pointer-events: none;
|
|
51
|
+
opacity: var(--tab-opacity, 0);
|
|
52
|
+
left: 0;
|
|
53
|
+
top: 0;
|
|
54
|
+
transform: translate(var(--tab-x, 0px), var(--tab-y, 0px));
|
|
55
|
+
width: var(--tab-width, 0px);
|
|
56
|
+
height: var(--tab-height, 0px);
|
|
57
|
+
background: var(--selected);
|
|
58
|
+
border-radius: 6px;
|
|
59
|
+
}
|
|
60
|
+
.tabs[data-ready="true"] .indicator {
|
|
61
|
+
transition:
|
|
62
|
+
transform var(--motion-segment) var(--ease),
|
|
63
|
+
width var(--motion-segment) var(--ease),
|
|
64
|
+
height var(--motion-segment) var(--ease),
|
|
65
|
+
opacity var(--motion-hover);
|
|
66
|
+
}
|
|
67
|
+
.viewport[data-orientation="vertical"] {
|
|
68
|
+
width: 112px;
|
|
69
|
+
flex: 0 0 112px;
|
|
70
|
+
}
|
|
71
|
+
.viewport[data-orientation="vertical"] .tabs {
|
|
72
|
+
flex-direction: column;
|
|
73
|
+
width: 100%;
|
|
74
|
+
min-width: 0;
|
|
75
|
+
}
|
|
76
|
+
.viewport[data-orientation="vertical"] button {
|
|
77
|
+
justify-content: flex-start;
|
|
78
|
+
padding: 7px 9px;
|
|
79
|
+
min-height: max(34px, var(--touch-target-min, 0px));
|
|
80
|
+
}
|
|
81
|
+
.underlined {
|
|
82
|
+
gap: 16px;
|
|
83
|
+
border-bottom: var(--separator-width) var(--separator-style)
|
|
84
|
+
var(--separator-color);
|
|
85
|
+
}
|
|
86
|
+
.underlined button {
|
|
87
|
+
padding: 9px 2px;
|
|
88
|
+
border-radius: 0;
|
|
89
|
+
}
|
|
90
|
+
.underlined .indicator {
|
|
91
|
+
top: auto;
|
|
92
|
+
bottom: -1px;
|
|
93
|
+
height: 2px;
|
|
94
|
+
transform: translateX(var(--tab-x, 0px));
|
|
95
|
+
background: var(--tab-selected-color);
|
|
96
|
+
border-radius: 2px;
|
|
97
|
+
}
|
|
98
|
+
.underlined button[aria-selected="true"] {
|
|
99
|
+
color: var(--tab-selected-color);
|
|
100
|
+
}
|
|
101
|
+
@media (max-width: 450px) {
|
|
102
|
+
.viewport[data-orientation="vertical"] {
|
|
103
|
+
width: 94px;
|
|
104
|
+
flex-basis: 94px;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.blocked button:hover:not(:disabled) {
|
|
109
|
+
background: color-mix(in srgb, var(--hover) 55%, transparent);
|
|
110
|
+
}
|
|
111
|
+
.underlined button:hover:not(:disabled) {
|
|
112
|
+
background: transparent;
|
|
113
|
+
color: var(--tab-selected-color);
|
|
114
|
+
}
|
|
115
|
+
.tabs button {
|
|
116
|
+
min-height: max(var(--tab-height-min), var(--touch-target-min, 0px));
|
|
117
|
+
font-size: var(--field-font-size);
|
|
118
|
+
cursor: pointer;
|
|
119
|
+
}
|
|
120
|
+
.blocked {
|
|
121
|
+
width: var(--blocked-width);
|
|
122
|
+
min-width: var(--blocked-min-width);
|
|
123
|
+
padding: var(--blocked-padding);
|
|
124
|
+
border: var(--blocked-border);
|
|
125
|
+
background: var(--blocked-background);
|
|
126
|
+
border-radius: var(--blocked-radius);
|
|
127
|
+
}
|
|
128
|
+
.blocked .indicator {
|
|
129
|
+
background: var(--blocked-selected);
|
|
130
|
+
box-shadow: var(--blocked-shadow);
|
|
131
|
+
}
|
|
132
|
+
.blocked button {
|
|
133
|
+
min-height: max(var(--blocked-height), var(--touch-target-min, 0px));
|
|
134
|
+
padding: var(--blocked-button-padding);
|
|
135
|
+
}
|
|
136
|
+
.blocked button[aria-selected="true"] {
|
|
137
|
+
color: var(--tab-selected-color);
|
|
138
|
+
}
|
|
139
|
+
.tabs button:disabled {
|
|
140
|
+
opacity: 0.45;
|
|
141
|
+
cursor: not-allowed;
|
|
142
|
+
}
|
|
143
|
+
.viewport[data-orientation="vertical"] {
|
|
144
|
+
width: var(--vertical-tab-width);
|
|
145
|
+
flex-basis: var(--vertical-tab-width);
|
|
146
|
+
}
|
|
147
|
+
.viewport[data-orientation="vertical"] .blocked {
|
|
148
|
+
width: 100%;
|
|
149
|
+
}
|
package/package.json
CHANGED
package/styles/base.css
CHANGED
|
@@ -213,3 +213,11 @@
|
|
|
213
213
|
:root[data-ui-theme][data-theme="dark"] {
|
|
214
214
|
--on-danger: #141414;
|
|
215
215
|
}
|
|
216
|
+
|
|
217
|
+
/* Public input-mode tokens: compact mouse layouts retain their theme dimensions. */
|
|
218
|
+
@media (pointer: coarse) {
|
|
219
|
+
:root[data-ui-theme] {
|
|
220
|
+
--touch-target-min: 44px;
|
|
221
|
+
--touch-field-font-size: 16px;
|
|
222
|
+
}
|
|
223
|
+
}
|