@robert-stackflow/oneui 0.6.50 → 0.6.52

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 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。图标提示的包裹层不会阻断按钮样式。
@@ -347,3 +353,7 @@ Closing returns a visible source image with Hero motion. Missing/offscreen sourc
347
353
  已有 React 事件表单可改为 `<Form onSubmit={submit}>`,保留事件处理、受控值和业务请求。Form 统一处理 required、type、pattern、范围、自定义有效性、首个错误焦点和异步提交锁;错误通过 FormField / Input 的 FieldMessages 展示。未包裹的原生字段使用可聚焦的错误摘要。`validationMode="blur"` 在离开字段后检查,默认提交时检查;出错后修改会更新反馈。内部自动使用 noValidate,不出现原生气泡。
348
354
 
349
355
  `validateForm(formRef.current, false)` 检查并展示字段错误但不抢焦点,适合自动保存;省略第二个参数则聚焦首个错误。保留自定义业务错误、身份验证、并发和请求重试策略。字段使用稳定 id 或 name,并通过 OneUI FormField / 控件提供标签。`controller={useFormState(...)}` 模式保持兼容,用于显式规则与异步字段校验。
356
+
357
+ ### 窄屏分页(0.6.52)
358
+
359
+ 650px 及以下保留上一页、下一页、首页页码、末页页码和当前页;省略相邻页码与重复的首尾双箭头,用省略号标明页码间隔。44px 触屏目标保持不变,320px 视口中分页无需折到第二行。全部页码仍使用同一套按钮/原生链接和回调逻辑。
@@ -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
- padding: 6px 13px;
8
- border: 1px solid var(--line);
9
- border-radius: calc(var(--radius) - 3px);
10
- background: var(--surface);
11
- white-space: nowrap;
12
- transition:
13
- background var(--motion-hover),
14
- transform var(--motion-hover),
15
- border-color var(--motion-hover);
16
- font-size: 12px;
17
- text-decoration: none;
18
- color: var(--fg);
19
- }
20
- .button[aria-disabled="true"] {
21
- opacity: 0.5;
22
- cursor: not-allowed;
23
- }
24
- .button:hover:not(:disabled):not([aria-disabled="true"]) {
25
- background: var(--hover);
26
- border-color: color-mix(in srgb, var(--fg) 18%, var(--surface));
27
- }
28
- .button:active:not(:disabled):not([aria-disabled="true"]) {
29
- transform: translateY(1px);
30
- }
31
- .primary {
32
- background: var(--accent-fill, var(--accent));
33
- border-color: var(--accent-fill, var(--accent));
34
- color: var(--on-accent-fill, var(--on-accent));
35
- }
36
- .primary:hover:not(:disabled):not([aria-disabled="true"]) {
37
- background: var(
38
- --accent-fill-hover,
39
- color-mix(in srgb, var(--accent) 86%, var(--surface))
40
- );
41
- border-color: transparent;
42
- }
43
- .secondary {
44
- box-shadow: 0 1px 1px #00000003;
45
- }
46
- .ghost {
47
- background: transparent;
48
- border-color: transparent;
49
- box-shadow: none;
50
- }
51
- .danger {
52
- color: var(--danger);
53
- background: color-mix(in srgb, var(--danger) 5%, var(--surface));
54
- }
55
- .small {
56
- min-height: var(--control-small);
57
- padding: 4px 9px;
58
- font-size: 11px;
59
- }
60
- .link {
61
- min-height: 0;
62
- padding: 0;
63
- border: 0;
64
- border-radius: 2px;
65
- background: transparent;
66
- box-shadow: none;
67
- color: var(--link-color, var(--accent-ink, var(--accent)));
68
- font-size: 13px;
69
- line-height: 1.6;
70
- text-align: left;
71
- justify-content: flex-start;
72
- white-space: normal;
73
- }
74
- .link:hover:not(:disabled):not([aria-disabled="true"]) {
75
- background: transparent;
76
- color: var(
77
- --link-hover-color,
78
- var(--link-color, var(--accent-hover, var(--accent-ink, var(--accent))))
79
- );
80
- text-decoration: underline;
81
- text-underline-offset: 3px;
82
- }
83
- .link .content {
84
- justify-content: flex-start;
85
- }
86
- .spin {
87
- animation: spin 1s linear infinite;
88
- }
89
-
90
- .button {
91
- position: relative;
92
- }
93
- .content {
94
- display: inline-flex;
95
- align-items: center;
96
- justify-content: center;
97
- gap: 7px;
98
- }
99
- .loader {
100
- position: absolute;
101
- inset: 0;
102
- display: grid;
103
- place-items: center;
104
- }
105
- .button[aria-busy="true"] {
106
- opacity: 0.8;
107
- cursor: wait;
108
- }
109
-
110
- .content > svg {
111
- width: var(--button-icon-size, 16px);
112
- height: var(--button-icon-size, 16px);
113
- flex-shrink: 0;
114
- }
115
-
116
- @keyframes spin {
117
- to {
118
- transform: rotate(360deg);
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(in srgb, var(--accent-ink, var(--accent)) var(--field-focus-strength), transparent);
45
- }
46
- .surface[aria-invalid="true"] {
47
- border-color: var(--danger);
48
- }
49
- .surface[aria-invalid="true"][data-focus="true"],
50
- .surface[aria-invalid="true"]:focus-within {
51
- box-shadow: 0 0 0 var(--field-focus-width)
52
- color-mix(in srgb, var(--danger) var(--field-focus-strength), transparent);
53
- }
54
- .surface:disabled,
55
- .surface[data-disabled="true"] {
56
- opacity: var(--field-disabled-opacity);
57
- cursor: not-allowed;
58
- }
59
- .surface[data-disabled="true"] input:disabled {
60
- opacity: 1;
61
- }
62
- .surface input {
63
- outline: none;
64
- color: inherit;
65
- font-family: inherit;
66
- line-height: inherit;
67
- }
68
- .surface input:focus-visible {
69
- outline: none;
70
- }
71
- .surface::placeholder,
72
- .surface input::placeholder {
73
- color: var(--placeholder);
74
- opacity: 1;
75
- }
76
- .surface[readonly],
77
- .surface[aria-readonly="true"],
78
- .surface:has(input[readonly]) {
79
- background: var(--field-readonly);
80
- }
81
- @media (max-width: 600px) {
82
- .surface:has(input),
83
- .surface:is(input, textarea) {
84
- font-size: 16px;
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"] { -webkit-line-clamp: 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, showJump, 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;
@@ -18,4 +18,6 @@ export declare function Pagination({ page, pageSize, total, onPageChange, onPage
18
18
  label?: string;
19
19
  previousLabel?: string;
20
20
  nextLabel?: string;
21
+ /** Render crawlable links and preserve native modified-click behavior. */
22
+ getPageHref?(page: number): string;
21
23
  }): import("react").JSX.Element;
@@ -1,6 +1,10 @@
1
1
  "use client";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
- import { useEffect, useId, useState } from "react";
3
+ import {
4
+ useEffect,
5
+ useId,
6
+ useState
7
+ } from "react";
4
8
  import {
5
9
  ChevronLeft,
6
10
  ChevronRight,
@@ -28,7 +32,8 @@ function Pagination({
28
32
  showJump = true,
29
33
  label,
30
34
  previousLabel,
31
- nextLabel
35
+ nextLabel,
36
+ getPageHref
32
37
  }) {
33
38
  const { text, english } = useUIText();
34
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));
@@ -52,6 +57,42 @@ function Pagination({
52
57
  pages
53
58
  ])
54
59
  ].sort((a, b) => a - b);
60
+ const compactVisible = [.../* @__PURE__ */ new Set([1, current, pages])].sort(
61
+ (a, b) => a - b
62
+ );
63
+ function pageControl(target, options) {
64
+ const props = {
65
+ className: options.className,
66
+ "aria-label": options.label,
67
+ "data-pagination-boundary": options.boundary || void 0,
68
+ "aria-current": options.current ? "page" : void 0,
69
+ variant: options.current ? "primary" : options.className === s.page ? "ghost" : "secondary"
70
+ };
71
+ if (getPageHref && !options.disabled)
72
+ return /* @__PURE__ */ jsx(
73
+ Button,
74
+ {
75
+ ...props,
76
+ href: getPageHref(target),
77
+ onClick: (event) => {
78
+ if (event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey)
79
+ return;
80
+ event.preventDefault();
81
+ onPageChange(target);
82
+ },
83
+ children: options.children
84
+ }
85
+ );
86
+ return /* @__PURE__ */ jsx(
87
+ Button,
88
+ {
89
+ ...props,
90
+ disabled: options.disabled,
91
+ onClick: () => onPageChange(target),
92
+ children: options.children
93
+ }
94
+ );
95
+ }
55
96
  return /* @__PURE__ */ jsxs(
56
97
  "nav",
57
98
  {
@@ -84,60 +125,64 @@ function Pagination({
84
125
  }
85
126
  ),
86
127
  /* @__PURE__ */ jsxs("div", { className: s.pages, children: [
87
- /* @__PURE__ */ jsx(
88
- Button,
89
- {
90
- className: s.arrow,
91
- "aria-label": text("\u7B2C\u4E00\u9875", "First page", "\u7B2C\u4E00\u9801"),
92
- disabled: current === 1,
93
- onClick: () => onPageChange(1),
94
- children: /* @__PURE__ */ jsx(ChevronsLeft, {})
95
- }
96
- ),
97
- /* @__PURE__ */ jsx(
98
- Button,
99
- {
100
- className: s.arrow,
101
- "aria-label": previousLabel ?? text("\u4E0A\u4E00\u9875", "Previous", "\u4E0A\u4E00\u9801"),
102
- disabled: current === 1,
103
- onClick: () => onPageChange(current - 1),
104
- children: /* @__PURE__ */ jsx(ChevronLeft, {})
105
- }
106
- ),
107
- visible.map((n, i) => /* @__PURE__ */ jsxs("span", { className: s.number, children: [
108
- i > 0 && n - visible[i - 1] > 1 && /* @__PURE__ */ jsx("span", { className: s.ellipsis, children: "\u2026" }),
109
- /* @__PURE__ */ jsx(
110
- Button,
111
- {
112
- className: s.page,
113
- "aria-label": english ? "Page " + n : "\u7B2C " + n + text(" \u9875", "", " \u9801"),
114
- "aria-current": n === current ? "page" : void 0,
115
- variant: n === current ? "primary" : "ghost",
116
- onClick: () => onPageChange(n),
117
- children: n
118
- }
119
- )
120
- ] }, n)),
121
- /* @__PURE__ */ jsx(
122
- Button,
128
+ pageControl(1, {
129
+ className: s.arrow,
130
+ boundary: true,
131
+ label: text("\u7B2C\u4E00\u9875", "First page", "\u7B2C\u4E00\u9801"),
132
+ disabled: current === 1,
133
+ children: /* @__PURE__ */ jsx(ChevronsLeft, {})
134
+ }),
135
+ pageControl(current - 1, {
136
+ className: s.arrow,
137
+ label: previousLabel ?? text("\u4E0A\u4E00\u9875", "Previous", "\u4E0A\u4E00\u9801"),
138
+ disabled: current === 1,
139
+ children: /* @__PURE__ */ jsx(ChevronLeft, {})
140
+ }),
141
+ visible.map((n, i) => /* @__PURE__ */ jsxs(
142
+ "span",
123
143
  {
124
- className: s.arrow,
125
- "aria-label": nextLabel ?? text("\u4E0B\u4E00\u9875", "Next", "\u4E0B\u4E00\u9801"),
126
- disabled: current === pages,
127
- onClick: () => onPageChange(current + 1),
128
- children: /* @__PURE__ */ jsx(ChevronRight, {})
129
- }
130
- ),
131
- /* @__PURE__ */ jsx(
132
- Button,
133
- {
134
- className: s.arrow,
135
- "aria-label": text("\u6700\u540E\u4E00\u9875", "Last page", "\u6700\u5F8C\u4E00\u9801"),
136
- disabled: current === pages,
137
- onClick: () => onPageChange(pages),
138
- children: /* @__PURE__ */ jsx(ChevronsRight, {})
139
- }
140
- )
144
+ className: s.number,
145
+ "data-compact-hidden": !compactVisible.includes(n) || void 0,
146
+ children: [
147
+ i > 0 && n - visible[i - 1] > 1 && /* @__PURE__ */ jsx(
148
+ "span",
149
+ {
150
+ className: `${s.ellipsis} ${s.expandedEllipsis}`,
151
+ "aria-hidden": "true",
152
+ children: "\u2026"
153
+ }
154
+ ),
155
+ compactVisible.indexOf(n) > 0 && n - compactVisible[compactVisible.indexOf(n) - 1] > 1 && /* @__PURE__ */ jsx(
156
+ "span",
157
+ {
158
+ className: `${s.ellipsis} ${s.compactEllipsis}`,
159
+ "aria-hidden": "true",
160
+ children: "\u2026"
161
+ }
162
+ ),
163
+ pageControl(n, {
164
+ className: s.page,
165
+ label: english ? "Page " + n : "\u7B2C " + n + text(" \u9875", "", " \u9801"),
166
+ current: n === current,
167
+ children: n
168
+ })
169
+ ]
170
+ },
171
+ n
172
+ )),
173
+ pageControl(current + 1, {
174
+ className: s.arrow,
175
+ label: nextLabel ?? text("\u4E0B\u4E00\u9875", "Next", "\u4E0B\u4E00\u9801"),
176
+ disabled: current === pages,
177
+ children: /* @__PURE__ */ jsx(ChevronRight, {})
178
+ }),
179
+ pageControl(pages, {
180
+ className: s.arrow,
181
+ boundary: true,
182
+ label: text("\u6700\u540E\u4E00\u9875", "Last page", "\u6700\u5F8C\u4E00\u9801"),
183
+ disabled: current === pages,
184
+ children: /* @__PURE__ */ jsx(ChevronsRight, {})
185
+ })
141
186
  ] }),
142
187
  showJump && /* @__PURE__ */ jsxs(
143
188
  "form",
@@ -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 {
@@ -56,6 +56,9 @@
56
56
  padding: 0 3px;
57
57
  color: var(--muted);
58
58
  }
59
+ .compactEllipsis {
60
+ display: none;
61
+ }
59
62
  .jump {
60
63
  display: flex;
61
64
  align-items: center;
@@ -70,6 +73,14 @@
70
73
  color: var(--fg);
71
74
  }
72
75
  @media (max-width: 650px) {
76
+ .pages [data-pagination-boundary],
77
+ .number[data-compact-hidden],
78
+ .expandedEllipsis {
79
+ display: none;
80
+ }
81
+ .compactEllipsis {
82
+ display: inline;
83
+ }
73
84
  .controls {
74
85
  gap: 10px;
75
86
  width: 100%;
@@ -47,7 +47,8 @@
47
47
  align-items: center;
48
48
  justify-content: center;
49
49
  gap: 6px;
50
- min-height: var(--segment-height-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: 0;
88
+ min-width: var(--touch-target-min, 0px);
88
89
  }
@@ -1,6 +1,6 @@
1
1
  .trigger {
2
- height: var(--control-height);
3
- min-height: var(--control-height);
2
+ height: max(var(--control-height), var(--touch-target-min, 0px));
3
+ min-height: max(var(--control-height), var(--touch-target-min, 0px));
4
4
  flex-shrink: 0;
5
5
  max-width: 100%;
6
6
  }
@@ -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
- white-space: nowrap;
26
- border: 0;
27
- background: transparent;
28
- min-height: 34px;
29
- padding: 7px 12px;
30
- font-size: 12px;
31
- color: var(--muted);
32
- border-radius: 6px;
33
- transition:
34
- color var(--motion-hover),
35
- background var(--motion-hover);
36
- }
37
- .tabs button:hover:not(:disabled) {
38
- color: var(--fg);
39
- }
40
- .tabs button[aria-selected="true"] {
41
- color: var(--fg);
42
- }
43
- .tabs button:focus-visible {
44
- outline-offset: -2px;
45
- }
46
- .indicator {
47
- position: absolute;
48
- z-index: 0;
49
- pointer-events: none;
50
- opacity: var(--tab-opacity, 0);
51
- left: 0;
52
- top: 0;
53
- transform: translate(var(--tab-x, 0px), var(--tab-y, 0px));
54
- width: var(--tab-width, 0px);
55
- height: var(--tab-height, 0px);
56
- background: var(--selected);
57
- border-radius: 6px;
58
- }
59
- .tabs[data-ready="true"] .indicator {
60
- transition:
61
- transform var(--motion-segment) var(--ease),
62
- width var(--motion-segment) var(--ease),
63
- height var(--motion-segment) var(--ease),
64
- opacity var(--motion-hover);
65
- }
66
- .viewport[data-orientation="vertical"] {
67
- width: 112px;
68
- flex: 0 0 112px;
69
- }
70
- .viewport[data-orientation="vertical"] .tabs {
71
- flex-direction: column;
72
- width: 100%;
73
- min-width: 0;
74
- }
75
- .viewport[data-orientation="vertical"] button {
76
- justify-content: flex-start;
77
- padding: 7px 9px;
78
- min-height: 34px;
79
- }
80
- .underlined {
81
- gap: 16px;
82
- border-bottom: var(--separator-width) var(--separator-style)
83
- var(--separator-color);
84
- }
85
- .underlined button {
86
- padding: 9px 2px;
87
- border-radius: 0;
88
- }
89
- .underlined .indicator {
90
- top: auto;
91
- bottom: -1px;
92
- height: 2px;
93
- transform: translateX(var(--tab-x, 0px));
94
- background: var(--tab-selected-color);
95
- border-radius: 2px;
96
- }
97
- .underlined button[aria-selected="true"] {
98
- color: var(--tab-selected-color);
99
- }
100
- @media (max-width: 450px) {
101
- .viewport[data-orientation="vertical"] {
102
- width: 94px;
103
- flex-basis: 94px;
104
- }
105
- }
106
-
107
- .blocked button:hover:not(:disabled) {
108
- background: color-mix(in srgb, var(--hover) 55%, transparent);
109
- }
110
- .underlined button:hover:not(:disabled) {
111
- background: transparent;
112
- color: var(--tab-selected-color);
113
- }
114
- .tabs button {
115
- min-height: var(--tab-height-min);
116
- font-size: var(--field-font-size);
117
- cursor: pointer;
118
- }
119
- .blocked {
120
- width: var(--blocked-width);
121
- min-width: var(--blocked-min-width);
122
- padding: var(--blocked-padding);
123
- border: var(--blocked-border);
124
- background: var(--blocked-background);
125
- border-radius: var(--blocked-radius);
126
- }
127
- .blocked .indicator {
128
- background: var(--blocked-selected);
129
- box-shadow: var(--blocked-shadow);
130
- }
131
- .blocked button {
132
- min-height: var(--blocked-height);
133
- padding: var(--blocked-button-padding);
134
- }
135
- .blocked button[aria-selected="true"] {
136
- color: var(--tab-selected-color);
137
- }
138
- .tabs button:disabled {
139
- opacity: 0.45;
140
- cursor: not-allowed;
141
- }
142
- .viewport[data-orientation="vertical"] {
143
- width: var(--vertical-tab-width);
144
- flex-basis: var(--vertical-tab-width);
145
- }
146
- .viewport[data-orientation="vertical"] .blocked {
147
- width: 100%;
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robert-stackflow/oneui",
3
- "version": "0.6.50",
3
+ "version": "0.6.52",
4
4
  "description": "OneUI React components, application shell and portable visual themes",
5
5
  "type": "module",
6
6
  "sideEffects": [
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
+ }