@robert-stackflow/oneui 0.6.4 → 0.6.6
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 +106 -92
- package/components/DataTable.d.ts +3 -1
- package/components/DataTable.js +3 -2
- package/components/DataTable.module.css +103 -112
- 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/Segmented.d.ts +2 -1
- package/components/Segmented.js +3 -2
- package/components/Segmented.module.css +85 -82
- package/components/Tab.module.css +4 -1
- package/package.json +1 -1
- package/styles/minimal.css +340 -339
package/CHANGELOG.md
CHANGED
|
@@ -1,92 +1,106 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
## 0.6.
|
|
4
|
-
|
|
5
|
-
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
|
|
17
|
-
## 0.6.
|
|
18
|
-
|
|
19
|
-
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
|
|
38
|
-
## 0.
|
|
39
|
-
|
|
40
|
-
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
-
|
|
55
|
-
-
|
|
56
|
-
-
|
|
57
|
-
|
|
58
|
-
## 0.4.
|
|
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
|
-
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.6.6
|
|
4
|
+
|
|
5
|
+
- Add Segmented fullWidth to align evenly distributed options with navigation or form containers.
|
|
6
|
+
|
|
7
|
+
- Fix minimal-theme placeholder color for text, password, numeric and multiline controls in both color modes.
|
|
8
|
+
- Preserve native switch and button appearance inside DataTable cells; remove the table's broad button style override.
|
|
9
|
+
|
|
10
|
+
## 0.6.5 — 2026-10-29
|
|
11
|
+
|
|
12
|
+
- Popover 默认限制 360px 最大高度,并继续按可用视口收缩;长下拉菜单在内部滚动,可通过 maxHeight 调整。
|
|
13
|
+
- NumberInput 支持 fullWidth,适配双栏、单栏表单。
|
|
14
|
+
- DataTable 列支持 width 与 align,让路径、状态、开关及操作列按内容分配空间。
|
|
15
|
+
- TabList 保留横向滚动与键盘导航,避免下划线溢出造成多余滚动条。
|
|
16
|
+
|
|
17
|
+
## 0.6.4 — 2026-10-29
|
|
18
|
+
|
|
19
|
+
- 极简主题的文字按钮使用前景色,修复深色模式下文字对比度不足;浅深色包消费检查覆盖文字按钮对比度。
|
|
20
|
+
|
|
21
|
+
## 0.6.3 — 2026-10-29
|
|
22
|
+
|
|
23
|
+
- 横向 Divider 在居中网格中与文字保持垂直居中,同时保留普通块、纵向弹性布局及 inset 的宽度行为。
|
|
24
|
+
- 包消费验证覆盖两套主题、深浅色和桌面/手机宽度下的分割线几何对齐。
|
|
25
|
+
|
|
26
|
+
## 0.6.2 — 2026-10-29
|
|
27
|
+
|
|
28
|
+
- Text 与 Heading 的多行省略明确恢复正常换行,避免继承表格的 nowrap 后长文本撑开列宽。
|
|
29
|
+
- 增加浅色、深色及窄屏下表格内两行截断的回归验证。
|
|
30
|
+
|
|
31
|
+
## 0.6.1 — 2026-10-29
|
|
32
|
+
|
|
33
|
+
- 在 0.5.2 基础上保留可创建多选、分组导航及可选页面标题;新增嵌套侧栏、资源卡片、登录布局和页面标题组合。
|
|
34
|
+
- 复用现有 Card/Table 样式,提供布局基础组件、TableMarkup、CopyButton 与 BarChart;普通选择与可搜索选择分别沿用现有 Select/Combobox。
|
|
35
|
+
- Menu 支持自定义触发内容,NumberInput 支持单位,Button 支持文字链接;修复日历月份标签碰撞及表格圆角继承。
|
|
36
|
+
- 保留现有公开接口,并验证独立包消费、账户表单、弹窗、分组/嵌套导航及窄屏视觉基础。
|
|
37
|
+
|
|
38
|
+
## 0.6.0 — 2026-10-29
|
|
39
|
+
|
|
40
|
+
- 发布了较早的组合组件候选;0.6.1 补齐 0.5.1 分组导航、多选创建及 0.5.2 CSS Modules 动画兼容修复。请使用 0.6.1。
|
|
41
|
+
|
|
42
|
+
## 0.5.2 — 2026-10-29
|
|
43
|
+
|
|
44
|
+
- 将 Page、Dialog、Drawer、Button 的动画关键帧放回各自 CSS Module。
|
|
45
|
+
|
|
46
|
+
## 0.5.1 — 2026-10-29
|
|
47
|
+
|
|
48
|
+
- MultiSelect 新增 `onCreate`,标签模式在同一触发框内展示已选项,支持搜索创建、连续多选、错误重试,以及关闭后忽略异步创建结果。
|
|
49
|
+
- Page 支持可选 ReactNode 标题,可为无标题的内容区复用共享入场动画。
|
|
50
|
+
- AppShell 新增 `navigationGroups`,桌面侧栏与移动导航共享分组和分隔布局;保留原有扁平导航 API。
|
|
51
|
+
|
|
52
|
+
## 0.5.0 — 2026-10-29
|
|
53
|
+
|
|
54
|
+
- 新增 ActionSheet,复用 IconButton、Drawer 和 MenuItem;桌面使用紧凑底部面板,手机适配底部安全区域,支持禁用和危险操作。
|
|
55
|
+
- Drawer 新增 `onAfterClose`,在关闭动画与焦点恢复完成后执行后续操作,避免操作面板与新弹窗重叠。
|
|
56
|
+
- 横向 FormField 包含多行输入时,标签靠上对齐;单行控件和手机纵向布局保持原有排列。
|
|
57
|
+
|
|
58
|
+
## 0.4.2 — 2026-10-29
|
|
59
|
+
|
|
60
|
+
- 图标、Emoji 和符号目录改用可被构建工具识别的异步 JSON 导入,修复 npm 包在 Vite 开发预打包后资源相对路径失效的问题;生产构建继续按需加载。
|
|
61
|
+
- Card 新增 `description` 与无正文模式,标题和正文使用一致的横向间距,避免只含概览和操作时产生空白正文。
|
|
62
|
+
- 独立 tarball 消费测试增加开发模式预打包下的三套完整目录加载验证。
|
|
63
|
+
|
|
64
|
+
## 0.4.1 — 2026-10-29
|
|
65
|
+
|
|
66
|
+
- Dialog、Drawer 统一处理普通关闭和条件卸载后的焦点恢复,兼容 StrictMode、嵌套与替换弹窗,不抢夺其他弹窗的焦点。
|
|
67
|
+
- 新增 `returnFocus` 引用,可为异步打开的弹窗明确指定关闭后返回的控件。
|
|
68
|
+
- 修复 FormField 在卸载失焦时访问已清空引用的运行错误,避免 StrictMode 模拟清理触发额外失焦。
|
|
69
|
+
- Pagination 新增 `compact`、`size="small"` 和 `className`;紧凑排列、尺寸及窄屏换行由组件管理,宿主不再依赖内部 DOM 覆盖样式。
|
|
70
|
+
- 增加独立构建包的双主题、深浅色、1280/390/320px 焦点和分页交互验证。
|
|
71
|
+
|
|
72
|
+
## 0.4.0 — 2026-10-29
|
|
73
|
+
|
|
74
|
+
- 新增 AccountItem、PasskeyItem、SessionItem,统一账户设备列表的图标、元数据、操作按钮和移动布局;业务与日期格式由宿主负责。
|
|
75
|
+
- Form、FormGroup、FormField 支持 stacked / inline 两种排版,继承布局并可逐字段覆盖;窄屏自动改为上下排列。
|
|
76
|
+
- 修复 FormField 空标签占位造成的控件垂直错位,RadioGroup 在 FormField 中不再重复显示标签。
|
|
77
|
+
- NumberInput 新增 nullable 模式,清空返回 null,保留小数、范围、键盘与只读行为。
|
|
78
|
+
- Dialog 在关闭动画期间保留最终内容,避免宿主清空选择时先显示空弹窗。
|
|
79
|
+
- 两端共享示例新增设置表单与账户设备项目。
|
|
80
|
+
|
|
81
|
+
## 0.3.0 — 2026-10-28
|
|
82
|
+
|
|
83
|
+
- AppShell 新增 brandName、brandIcon、brand、homePath、basePath 和 showHeader;支持无顶部栏的移动导航,可省略设置入口及侧栏折叠回调。普通点击向宿主传递内部路径,链接和新标签页使用完整基础路径。
|
|
84
|
+
- 新增 createToaster 独立通知控制器,可由 React 组件外代码调用;ToastProvider 可接收 controller,保留原 useToast API 和单条通知替换行为。
|
|
85
|
+
- IconPicker 支持 valuePrefix、自定义图标目录与 React 图标内容,保留存储 ID;统一字段、只读、禁用和表单值行为。
|
|
86
|
+
- DatePicker 支持 timeZone、clearable、placeholder;指定时区影响今天/此刻及日历当天标记,输入的日历时间保持原值,不隐式转换为 UTC。
|
|
87
|
+
- React/React DOM peer 范围调整为 ^19.2.0,独立消费验证覆盖 React 19.3.0 + TypeScript 5.9.3 和现有 React 19.3.1。
|
|
88
|
+
- 两端示例增加前缀/自定义图标和指定时区日期示例;未迁移或修改 Moment 业务代码。
|
|
89
|
+
- 修复极简深色导航选中文字过暗的问题。
|
|
90
|
+
|
|
91
|
+
## 0.2.0 — 2026-10-28
|
|
92
|
+
|
|
93
|
+
- 新增 MessageDialog、ConfirmDialog、FormDialog 与统一 LoadingState,复用表单校验、异步提交、错误反馈和焦点管理。
|
|
94
|
+
- TreeSelect 新增 category 图标、数量、层级连线样式;保留 tree 风格,支持父子联动多选。
|
|
95
|
+
- 新增 TreeTable,复用 Table 列定义,支持受控展开、多级连线和键盘导航;列支持 align、width。
|
|
96
|
+
- Combobox 新增 mode="input" 触发框补全;保留弹层搜索,支持异步加载、取消、创建与失败重试。
|
|
97
|
+
- MultiSelect 新增 display="tags",与 TagInput 共用标签实现;保留摘要模式及选择限制。
|
|
98
|
+
- 蓝白主题采用 Moment 对应色板、输入 hover 混色和深色参数;修复默认色板迁移与选择器分类栏底色。
|
|
99
|
+
- 统一菜单项 1px 间距,修复快捷键右对齐、宿主 kbd 边框干扰、关闭的 Popover 被布局样式显示等问题。
|
|
100
|
+
- 树选择器底部清空/完成操作使用独立的 8px 按钮间距。
|
|
101
|
+
- 共享应用外壳与示例布局统一,修复图标尺寸、链接文字、动效示例、表单间距、弹层和移动布局。
|
|
102
|
+
- 发布构建使用干净输出并检查包内引用;增加独立 tarball 消费项目的类型、生产与交互验证。
|
|
103
|
+
|
|
104
|
+
## 0.1.0 — 2026-10-28
|
|
105
|
+
|
|
106
|
+
- 首次发布 React 组件、应用外壳、极简/蓝白主题与图标字符资源。
|
|
@@ -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)
|
|
@@ -1,112 +1,103 @@
|
|
|
1
|
-
.container {
|
|
2
|
-
min-width: 0;
|
|
3
|
-
}
|
|
4
|
-
.toolbar {
|
|
5
|
-
display: flex;
|
|
6
|
-
justify-content: flex-end;
|
|
7
|
-
align-items: center;
|
|
8
|
-
gap: 8px;
|
|
9
|
-
flex-wrap: wrap;
|
|
10
|
-
margin-bottom: 12px;
|
|
11
|
-
}
|
|
12
|
-
.columnMenu {
|
|
13
|
-
display: flex;
|
|
14
|
-
flex-direction: column;
|
|
15
|
-
}
|
|
16
|
-
.scroll {
|
|
17
|
-
overflow: auto;
|
|
18
|
-
border: 1px solid var(--line);
|
|
19
|
-
border-radius: var(--radius);
|
|
20
|
-
}
|
|
21
|
-
.table {
|
|
22
|
-
width: 100%;
|
|
23
|
-
border-collapse: collapse;
|
|
24
|
-
text-align: left;
|
|
25
|
-
white-space: nowrap;
|
|
26
|
-
}
|
|
27
|
-
.table th {
|
|
28
|
-
background: var(--soft);
|
|
29
|
-
font-size: 12px;
|
|
30
|
-
font-weight: 500;
|
|
31
|
-
color: var(--muted);
|
|
32
|
-
}
|
|
33
|
-
.table td,
|
|
34
|
-
.table th {
|
|
35
|
-
padding: 12px 16px;
|
|
36
|
-
border-bottom: var(--separator-width) var(--separator-style)
|
|
37
|
-
var(--separator-color);
|
|
38
|
-
height: 48px;
|
|
39
|
-
}
|
|
40
|
-
.table tbody tr:last-child td {
|
|
41
|
-
border-bottom: 0;
|
|
42
|
-
}
|
|
43
|
-
.table tbody tr:hover {
|
|
44
|
-
background: var(--hover);
|
|
45
|
-
}
|
|
46
|
-
.table tr[data-selected="true"] {
|
|
47
|
-
background: var(--selected);
|
|
48
|
-
}
|
|
49
|
-
.heading {
|
|
50
|
-
display: flex;
|
|
51
|
-
align-items: center;
|
|
52
|
-
justify-content: space-between;
|
|
53
|
-
gap: 8px;
|
|
54
|
-
}
|
|
55
|
-
.sort,
|
|
56
|
-
.filter {
|
|
57
|
-
display: inline-flex;
|
|
58
|
-
align-items: center;
|
|
59
|
-
gap: 7px;
|
|
60
|
-
border: 0;
|
|
61
|
-
background: transparent;
|
|
62
|
-
padding: 4px;
|
|
63
|
-
border-radius: 5px;
|
|
64
|
-
color: inherit;
|
|
65
|
-
}
|
|
66
|
-
.sort:hover,
|
|
67
|
-
.filter:hover {
|
|
68
|
-
background: var(--hover);
|
|
69
|
-
color: var(--fg);
|
|
70
|
-
}
|
|
71
|
-
.sort svg,
|
|
72
|
-
.filter svg {
|
|
73
|
-
width: 14px;
|
|
74
|
-
height: 14px;
|
|
75
|
-
}
|
|
76
|
-
.filter[data-active="true"] {
|
|
77
|
-
color: var(--accent);
|
|
78
|
-
background: var(--selected);
|
|
79
|
-
}
|
|
80
|
-
.filterPanel {
|
|
81
|
-
max-height: 300px;
|
|
82
|
-
overflow: auto;
|
|
83
|
-
}
|
|
84
|
-
.selection {
|
|
85
|
-
width: 44px;
|
|
86
|
-
}
|
|
87
|
-
.selection label > span:last-child {
|
|
88
|
-
position: absolute;
|
|
89
|
-
width: 1px;
|
|
90
|
-
height: 1px;
|
|
91
|
-
overflow: hidden;
|
|
92
|
-
clip-path: inset(50%);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
.filterReset {
|
|
106
|
-
display: flex;
|
|
107
|
-
justify-content: flex-end;
|
|
108
|
-
margin-top: 6px;
|
|
109
|
-
padding-top: 6px;
|
|
110
|
-
border-top: var(--separator-width) var(--separator-style)
|
|
111
|
-
var(--separator-color);
|
|
112
|
-
}
|
|
1
|
+
.container {
|
|
2
|
+
min-width: 0;
|
|
3
|
+
}
|
|
4
|
+
.toolbar {
|
|
5
|
+
display: flex;
|
|
6
|
+
justify-content: flex-end;
|
|
7
|
+
align-items: center;
|
|
8
|
+
gap: 8px;
|
|
9
|
+
flex-wrap: wrap;
|
|
10
|
+
margin-bottom: 12px;
|
|
11
|
+
}
|
|
12
|
+
.columnMenu {
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
}
|
|
16
|
+
.scroll {
|
|
17
|
+
overflow: auto;
|
|
18
|
+
border: 1px solid var(--line);
|
|
19
|
+
border-radius: var(--radius);
|
|
20
|
+
}
|
|
21
|
+
.table {
|
|
22
|
+
width: 100%;
|
|
23
|
+
border-collapse: collapse;
|
|
24
|
+
text-align: left;
|
|
25
|
+
white-space: nowrap;
|
|
26
|
+
}
|
|
27
|
+
.table th {
|
|
28
|
+
background: var(--soft);
|
|
29
|
+
font-size: 12px;
|
|
30
|
+
font-weight: 500;
|
|
31
|
+
color: var(--muted);
|
|
32
|
+
}
|
|
33
|
+
.table td,
|
|
34
|
+
.table th {
|
|
35
|
+
padding: 12px 16px;
|
|
36
|
+
border-bottom: var(--separator-width) var(--separator-style)
|
|
37
|
+
var(--separator-color);
|
|
38
|
+
height: 48px;
|
|
39
|
+
}
|
|
40
|
+
.table tbody tr:last-child td {
|
|
41
|
+
border-bottom: 0;
|
|
42
|
+
}
|
|
43
|
+
.table tbody tr:hover {
|
|
44
|
+
background: var(--hover);
|
|
45
|
+
}
|
|
46
|
+
.table tr[data-selected="true"] {
|
|
47
|
+
background: var(--selected);
|
|
48
|
+
}
|
|
49
|
+
.heading {
|
|
50
|
+
display: flex;
|
|
51
|
+
align-items: center;
|
|
52
|
+
justify-content: space-between;
|
|
53
|
+
gap: 8px;
|
|
54
|
+
}
|
|
55
|
+
.sort,
|
|
56
|
+
.filter {
|
|
57
|
+
display: inline-flex;
|
|
58
|
+
align-items: center;
|
|
59
|
+
gap: 7px;
|
|
60
|
+
border: 0;
|
|
61
|
+
background: transparent;
|
|
62
|
+
padding: 4px;
|
|
63
|
+
border-radius: 5px;
|
|
64
|
+
color: inherit;
|
|
65
|
+
}
|
|
66
|
+
.sort:hover,
|
|
67
|
+
.filter:hover {
|
|
68
|
+
background: var(--hover);
|
|
69
|
+
color: var(--fg);
|
|
70
|
+
}
|
|
71
|
+
.sort svg,
|
|
72
|
+
.filter svg {
|
|
73
|
+
width: 14px;
|
|
74
|
+
height: 14px;
|
|
75
|
+
}
|
|
76
|
+
.filter[data-active="true"] {
|
|
77
|
+
color: var(--accent);
|
|
78
|
+
background: var(--selected);
|
|
79
|
+
}
|
|
80
|
+
.filterPanel {
|
|
81
|
+
max-height: 300px;
|
|
82
|
+
overflow: auto;
|
|
83
|
+
}
|
|
84
|
+
.selection {
|
|
85
|
+
width: 44px;
|
|
86
|
+
}
|
|
87
|
+
.selection label > span:last-child {
|
|
88
|
+
position: absolute;
|
|
89
|
+
width: 1px;
|
|
90
|
+
height: 1px;
|
|
91
|
+
overflow: hidden;
|
|
92
|
+
clip-path: inset(50%);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
.filterReset {
|
|
97
|
+
display: flex;
|
|
98
|
+
justify-content: flex-end;
|
|
99
|
+
margin-top: 6px;
|
|
100
|
+
padding-top: 6px;
|
|
101
|
+
border-top: var(--separator-width) var(--separator-style)
|
|
102
|
+
var(--separator-color);
|
|
103
|
+
}
|
|
@@ -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",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
-
export declare function Segmented<T extends string>({ value, onChange, options, label, }: {
|
|
2
|
+
export declare function Segmented<T extends string>({ value, onChange, options, label, fullWidth, }: {
|
|
3
3
|
value: T;
|
|
4
4
|
onChange(value: T): void;
|
|
5
5
|
options: {
|
|
@@ -8,4 +8,5 @@ export declare function Segmented<T extends string>({ value, onChange, options,
|
|
|
8
8
|
disabled?: boolean;
|
|
9
9
|
}[];
|
|
10
10
|
label: string;
|
|
11
|
+
fullWidth?: boolean;
|
|
11
12
|
}): import("react").JSX.Element;
|
package/components/Segmented.js
CHANGED
|
@@ -5,7 +5,8 @@ function Segmented({
|
|
|
5
5
|
value,
|
|
6
6
|
onChange,
|
|
7
7
|
options,
|
|
8
|
-
label
|
|
8
|
+
label,
|
|
9
|
+
fullWidth = false
|
|
9
10
|
}) {
|
|
10
11
|
const root = useRef(null), buttons = useRef(/* @__PURE__ */ new Map());
|
|
11
12
|
useLayoutEffect(() => {
|
|
@@ -51,7 +52,7 @@ function Segmented({
|
|
|
51
52
|
onChange(enabled[target].value);
|
|
52
53
|
buttons.current.get(enabled[target].value)?.focus();
|
|
53
54
|
};
|
|
54
|
-
return /* @__PURE__ */ jsxs("div", { ref: root, className: s.segmented, role: "group", "aria-label": label, children: [
|
|
55
|
+
return /* @__PURE__ */ jsxs("div", { ref: root, className: s.segmented, "data-full-width": fullWidth || void 0, role: "group", "aria-label": label, children: [
|
|
55
56
|
/* @__PURE__ */ jsx("span", { className: s.indicator, "aria-hidden": "true", "data-segment-indicator": true }),
|
|
56
57
|
options.map((option, index) => /* @__PURE__ */ jsx(
|
|
57
58
|
"button",
|