@robert-stackflow/oneui 0.6.4 → 0.6.5
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/CHANGELOG.md +7 -0
- package/components/DataTable.d.ts +3 -1
- package/components/DataTable.js +3 -2
- package/components/NumberInput.d.ts +1 -0
- package/components/NumberInput.js +2 -0
- package/components/NumberInput.module.css +3 -0
- package/components/Popover.d.ts +3 -1
- package/components/Popover.js +3 -2
- package/components/Tab.module.css +4 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.6.5 — 2026-10-29
|
|
4
|
+
|
|
5
|
+
- Popover 默认限制 360px 最大高度,并继续按可用视口收缩;长下拉菜单在内部滚动,可通过 maxHeight 调整。
|
|
6
|
+
- NumberInput 支持 fullWidth,适配双栏、单栏表单。
|
|
7
|
+
- DataTable 列支持 width 与 align,让路径、状态、开关及操作列按内容分配空间。
|
|
8
|
+
- TabList 保留横向滚动与键盘导航,避免下划线溢出造成多余滚动条。
|
|
9
|
+
|
|
3
10
|
## 0.6.4 — 2026-10-29
|
|
4
11
|
|
|
5
12
|
- 极简主题的文字按钮使用前景色,修复深色模式下文字对比度不足;浅深色包消费检查覆盖文字按钮对比度。
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ReactNode } from "react";
|
|
1
|
+
import { type ReactNode, type CSSProperties } from "react";
|
|
2
2
|
export interface TableColumn<T> {
|
|
3
3
|
key: string;
|
|
4
4
|
label: string;
|
|
@@ -7,6 +7,8 @@ export interface TableColumn<T> {
|
|
|
7
7
|
sortable?: boolean;
|
|
8
8
|
filterOptions?: string[];
|
|
9
9
|
hideable?: boolean;
|
|
10
|
+
width?: CSSProperties["width"];
|
|
11
|
+
align?: "left" | "center" | "right";
|
|
10
12
|
}
|
|
11
13
|
export type TableSort = {
|
|
12
14
|
key: string;
|
package/components/DataTable.js
CHANGED
|
@@ -145,9 +145,10 @@ function DataTable({
|
|
|
145
145
|
displayColumns.map((column) => /* @__PURE__ */ jsx(
|
|
146
146
|
"th",
|
|
147
147
|
{
|
|
148
|
+
style: { width: column.width, textAlign: column.align },
|
|
148
149
|
scope: "col",
|
|
149
150
|
"aria-sort": sort?.key === column.key ? sort.direction === "asc" ? "ascending" : "descending" : "none",
|
|
150
|
-
children: /* @__PURE__ */ jsxs("div", { className: s.heading, children: [
|
|
151
|
+
children: /* @__PURE__ */ jsxs("div", { className: s.heading, style: { justifyContent: column.align === "right" ? "flex-end" : column.align === "center" ? "center" : void 0 }, children: [
|
|
151
152
|
column.sortable ? /* @__PURE__ */ jsxs(
|
|
152
153
|
"button",
|
|
153
154
|
{
|
|
@@ -192,7 +193,7 @@ function DataTable({
|
|
|
192
193
|
)
|
|
193
194
|
}
|
|
194
195
|
) }),
|
|
195
|
-
displayColumns.map((column) => /* @__PURE__ */ jsx("td", { children: column.render ? column.render(row) : column.value(row) }, column.key))
|
|
196
|
+
displayColumns.map((column) => /* @__PURE__ */ jsx("td", { style: { textAlign: column.align }, children: column.render ? column.render(row) : column.value(row) }, column.key))
|
|
196
197
|
]
|
|
197
198
|
},
|
|
198
199
|
rowKey(row)
|
|
@@ -16,6 +16,7 @@ function NumberInput(props) {
|
|
|
16
16
|
nullable = false,
|
|
17
17
|
placeholder,
|
|
18
18
|
unit,
|
|
19
|
+
fullWidth = false,
|
|
19
20
|
...options
|
|
20
21
|
} = props;
|
|
21
22
|
const onChange = (next) => {
|
|
@@ -61,6 +62,7 @@ function NumberInput(props) {
|
|
|
61
62
|
{
|
|
62
63
|
className: s.number,
|
|
63
64
|
"data-unit": unit ? true : void 0,
|
|
65
|
+
"data-full-width": fullWidth || void 0,
|
|
64
66
|
"data-disabled": disabled,
|
|
65
67
|
"data-readonly": readOnly || void 0,
|
|
66
68
|
"aria-invalid": field.invalid || invalid,
|
package/components/Popover.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { type ReactNode, type RefObject } from "react";
|
|
2
|
-
export declare function Popover({ open: requestedOpen, onClose, anchor, children, width, label, role, id, onKeyDown, descriptionId, autoFocus, matchAnchorWidth, className, }: {
|
|
2
|
+
export declare function Popover({ open: requestedOpen, onClose, anchor, children, width, maxHeight, label, role, id, onKeyDown, descriptionId, autoFocus, matchAnchorWidth, className, }: {
|
|
3
3
|
open: boolean;
|
|
4
4
|
onClose(): void;
|
|
5
5
|
anchor: RefObject<HTMLElement | null>;
|
|
6
6
|
children: ReactNode;
|
|
7
7
|
width?: number;
|
|
8
|
+
/** Maximum menu height; the viewport can reduce it further. */
|
|
9
|
+
maxHeight?: number;
|
|
8
10
|
label: string;
|
|
9
11
|
role?: string;
|
|
10
12
|
id?: string;
|
package/components/Popover.js
CHANGED
|
@@ -15,6 +15,7 @@ function Popover({
|
|
|
15
15
|
anchor,
|
|
16
16
|
children,
|
|
17
17
|
width = 230,
|
|
18
|
+
maxHeight = 360,
|
|
18
19
|
label,
|
|
19
20
|
role = "dialog",
|
|
20
21
|
id,
|
|
@@ -65,7 +66,7 @@ function Popover({
|
|
|
65
66
|
const viewportLeft = viewport?.offsetLeft ?? 0;
|
|
66
67
|
const viewportWidth = viewport?.width ?? innerWidth;
|
|
67
68
|
const viewportBottom = viewportTop + (viewport?.height ?? innerHeight);
|
|
68
|
-
const rect = trigger.getBoundingClientRect(), available = Math.max(0, viewportBottom - viewportTop - 24);
|
|
69
|
+
const rect = trigger.getBoundingClientRect(), available = Math.max(0, Math.min(maxHeight, viewportBottom - viewportTop - 24));
|
|
69
70
|
surface.style.maxHeight = available + "px";
|
|
70
71
|
const actualWidth = Math.min(
|
|
71
72
|
matchAnchorWidth ? rect.width : width,
|
|
@@ -132,7 +133,7 @@ function Popover({
|
|
|
132
133
|
window.visualViewport?.removeEventListener("resize", position);
|
|
133
134
|
window.visualViewport?.removeEventListener("scroll", position);
|
|
134
135
|
};
|
|
135
|
-
}, [open, anchor, width, role, portalHost, autoFocus, matchAnchorWidth]);
|
|
136
|
+
}, [open, anchor, width, maxHeight, role, portalHost, autoFocus, matchAnchorWidth]);
|
|
136
137
|
return createPortal(
|
|
137
138
|
/* @__PURE__ */ jsx(
|
|
138
139
|
"div",
|