@robert-stackflow/oneui 0.6.38 → 0.6.40

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 CHANGED
@@ -1,3 +1,21 @@
1
+ ## 0.6.40
2
+
3
+ - 合入分栏按钮的自定义面板、图标与小尺寸、受控展开及 ghost 选中态;嵌套浮层 Escape 优先关闭内层,保留近期图文按钮、禁用与自适应宽度修正。
4
+
5
+ - 统一 Card、Section、FormGroup 与设置行的标题层级;两套主题的字段标签保持常规字重,辅助说明使用一致字号。
6
+ - Section 与 Card 支持 headingLevel,语义层级独立于字号;Section 的 settings 内容布局补偿设置行内边距,末组不增加尾距。
7
+ - 增加公开标题与间距变量、表单规范及组合示例;不新增装饰性标签或重复卡片。
8
+
9
+ ## 0.6.39
10
+
11
+ - SelectOption 与 MenuItem 新增可选 descriptionLines (1–3),Combobox / Select 支持多行简介,默认保持单行;搜索、键盘选择和已有选项行为不变。
12
+
13
+ ## 0.6.38
14
+
15
+ - IconButton 的 disabled / aria-disabled 统一降低不透明度,禁用 hover 填充。
16
+ - ContributionCalendar 新增 fill、source、footer 插槽,用于完整日历和来源/统计布局。
17
+ - 正式 tarball 消费类型、构建及交互验证通过。
18
+
1
19
  ## 0.6.37
2
20
 
3
21
  - Keep wheel input inside open ContextMenu layers. Short menus and scroll boundaries no longer scroll the document or nested workspace behind them; long menus retain native scrolling.
package/README.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  React 组件、应用外壳和两套可互换的主题。无 Electron、React Router、账户 API 或持久化存储依赖。
4
4
 
5
+ ## 分栏按钮与嵌套浮层(0.6.40)
6
+
7
+ SplitButton 保留 items 菜单,支持 label / iconOnly / size / pressed、ghost 外观、受控 open / onOpenChange,以及自定义 panel / panelWidth / portalContainer。主动作与展开区分别响应,自定义面板复用非模态箭头 Popover。图标提示的包裹层不会阻断按钮样式。
8
+
9
+ ghost 图标按钮及分栏按钮的展开 / 选中态使用主题轻背景;嵌套 Popover 按 Escape 先关闭最内层。保留现有图文动作、禁用状态、Popover 自适应内容宽度和主题能力。
10
+
11
+ ## 禁用按钮与贡献日历(0.6.38)
12
+
13
+ `IconButton disabled` / `aria-disabled` 使用统一的弱化外观,不再响应 hover 填充。应用按业务边界传入禁用状态,不额外覆盖按钮皮肤。
14
+
15
+ `ContributionCalendar fill` 在可用版心中放大网格;`source` 替换左下角默认日期范围,`footer` 在分隔线下提供统计等组合内容。调用方复用原生日历的主题、边框、提示和交互,不在外层再套 Card。
16
+
5
17
  ## 菜单滚动边界(0.6.37)
6
18
 
7
19
  ContextMenu 打开期间会接管滚轮:长菜单仍可在内部滚动,短菜单及边界滚动不会传递到正文或嵌套工作区;关闭后恢复。
@@ -50,12 +62,18 @@ ContextMenu 打开期间会接管滚轮:长菜单仍可在内部滚动,短
50
62
 
51
63
  indicator 风格的 SideBar 使用当前主题的导航前景色绘制细线,极简深色不再复用深灰强调色。自定义强调色会混入当前前景色,保持浅、深模式中的可辨识度;可通过 `--navigation-indicator-color` 覆盖。此颜色独立于按钮填充色,几何和滑动动画保持原有行为。
52
64
 
65
+ ## 表单与设置的标题层级(0.6.40)
66
+
67
+ 卡片标题为 16px / 600,分组标题及 FormGroup legend 为 14px / 600,字段标签为 13px / 400,辅助说明为 12px。两套主题及深浅色使用同一层级,颜色跟随主题。不要通过加粗所有字段来制造分组,也不要为已经明确的结构重复添加小标题。
68
+
69
+ Section 支持 headingLevel(2–6,默认 2)和 contentLayout="settings";卡片内分组通常传 headingLevel={3}。普通内容的标题间距为 12px;SettingRow 列表传 settings 以避免标题与设置行内边距叠加。连续 Section 的父容器使用 gap={0},组间距交给 Section,末组无尾距。Card 支持 headingLevel,标题级别独立于视觉字号。规范及主题变量见仓库 docs/form-hierarchy.md。
70
+
53
71
  ## 设置项(0.6.14 候选)
54
72
 
55
73
  基础 `SettingRow` 保留自由组合的右侧内容,支持 `titleBold`(默认 false)、`align` 和 `controlWidth`。派生组件复用同一行布局:`TextSettingRow`、`TextAreaSettingRow`、`SwitchSettingRow`、`SelectSettingRow`,均支持 title、description、divider、titleBold;文本控件支持原生输入属性、ref、hint 和 error,`onChange` 直接返回文本值,开关返回 boolean。下拉选择继承 Select 的 options/value/onChange 等属性。
56
74
 
57
75
  ```tsx
58
- <TextSettingRow title="工作区名称" titleBold value={name} onChange={setName} />
76
+ <TextSettingRow title="工作区名称" value={name} onChange={setName} />
59
77
  <TextAreaSettingRow title="个人简介" value={bio} onChange={setBio} rows={3} />
60
78
  <SwitchSettingRow title="接收通知" checked={enabled} onChange={setEnabled} />
61
79
  <SelectSettingRow title="默认语言" value={language} onChange={setLanguage} options={languages} />
@@ -317,3 +335,7 @@ Image changes retain the existing outgoing image for a directional fade/slide, w
317
335
  Clicking empty viewer space closes it. Pointer origin, movement and cancellation are tracked so image/control clicks, dragging and multi-pointer gestures do not accidentally dismiss it. Escape and the close button remain available.
318
336
 
319
337
  Closing returns a visible source image with Hero motion. Missing/offscreen sources, zoomed images and origin-resolution errors use a gentle image fade/scale; the opaque black canvas fades with the surface rather than leaving a solid backdrop that snaps away. The canvas spans the viewport while the underlying document retains its scrollbar gutter.
338
+
339
+ ### Multiline option descriptions
340
+
341
+ `SelectOption.descriptionLines` opts into two or three wrapping description lines in `Combobox` and `Select`. Use `description: "identifier\nShort explanation", descriptionLines: 3` for rich choices. `MenuItem` supports the same property. The default remains one truncated line. Search still includes the complete description.
@@ -1,5 +1,5 @@
1
1
  import type { ReactNode, ComponentPropsWithRef } from "react";
2
- export declare function Card({ title, description, action, children, className, onClick, bodyClassName, padding, ...props }: Omit<ComponentPropsWithRef<"section">, "title"> & {
2
+ export declare function Card({ title, description, action, children, className, onClick, bodyClassName, padding, headingLevel, ...props }: Omit<ComponentPropsWithRef<"section">, "title"> & {
3
3
  title?: ReactNode;
4
4
  description?: ReactNode;
5
5
  action?: ReactNode;
@@ -7,4 +7,5 @@ export declare function Card({ title, description, action, children, className,
7
7
  className?: string;
8
8
  bodyClassName?: string;
9
9
  padding?: "normal" | "compact" | "none";
10
+ headingLevel?: 2 | 3 | 4 | 5 | 6;
10
11
  }): import("react").JSX.Element;
@@ -10,14 +10,16 @@ function Card({
10
10
  onClick,
11
11
  bodyClassName,
12
12
  padding = "normal",
13
+ headingLevel = 2,
13
14
  ...props
14
15
  }) {
16
+ const Heading = `h${headingLevel}`;
15
17
  const hasBody = children != null && children !== false;
16
18
  const classes = `${s.card} ${!hasBody ? s.headerOnly : ""} ${s[padding]} ${className}`;
17
19
  const content = /* @__PURE__ */ jsxs(Fragment, { children: [
18
20
  (title || description || action) && /* @__PURE__ */ jsxs("header", { className: s.header, children: [
19
21
  /* @__PURE__ */ jsxs("div", { className: s.heading, children: [
20
- title && /* @__PURE__ */ jsx("h2", { children: title }),
22
+ title && /* @__PURE__ */ jsx(Heading, { className: s.title, children: title }),
21
23
  description && /* @__PURE__ */ jsx("div", { className: s.description, children: description })
22
24
  ] }),
23
25
  action
@@ -36,8 +36,13 @@
36
36
  flex: 1;
37
37
  min-width: 0;
38
38
  }
39
- .heading h2 {
39
+ .title {
40
+ margin: 0;
40
41
  color: var(--fg);
42
+ font-size: var(--card-title-size, 16px);
43
+ font-weight: var(--card-title-weight, 600);
44
+ line-height: 1.5;
45
+ overflow-wrap: anywhere;
41
46
  }
42
47
  .description {
43
48
  margin-top: 6px;
@@ -307,6 +307,7 @@ function Combobox({
307
307
  label: item.label,
308
308
  icon: item.icon,
309
309
  description: item.description,
310
+ descriptionLines: item.descriptionLines,
310
311
  shortcut: item.shortcut,
311
312
  reserveIcon: filtered.some((option) => !!option.icon),
312
313
  selected: value === item.value,
@@ -1,127 +1,127 @@
1
- .calendar {
2
- container-type: inline-size;
3
- --calendar-cell: 13px;
4
- --calendar-gap: 3px;
5
- min-width: 0;
6
- border: 1px solid var(--line);
7
- border-radius: var(--radius);
8
- padding: 20px;
9
- background: var(--surface);
10
- }
11
- .header,
12
- .footer {
13
- display: flex;
14
- align-items: center;
15
- justify-content: space-between;
16
- gap: 14px;
17
- }
18
- .header {
19
- margin-bottom: 16px;
20
- }
21
- .header > span,
22
- .footer {
23
- font-size: 11px;
24
- color: var(--muted);
25
- }
26
- .scroll {
27
- --calendar-cell: clamp(
28
- 9px,
29
- calc((100cqw - 32px) / var(--calendar-weeks) - var(--calendar-gap)),
30
- var(--calendar-cell-max, 13px)
31
- );
32
- overflow: auto;
33
- padding: 3px 2px 6px;
34
- }
35
- .months,
36
- .row {
37
- display: grid;
38
- column-gap: var(--calendar-gap);
39
- width: max-content;
40
- align-items: center;
41
- }
42
- .months {
43
- height: 22px;
44
- font-size: 10px;
45
- color: var(--muted);
46
- }
47
- .months > span {
48
- grid-row: 1;
49
- white-space: nowrap;
50
- }
51
- .row {
52
- height: calc(var(--calendar-cell) + var(--calendar-gap));
53
- }
54
- .weekday {
55
- font-size: 10px;
56
- color: var(--muted);
57
- }
58
- .day,
59
- .pad {
60
- width: var(--calendar-cell);
61
- height: var(--calendar-cell);
62
- }
63
- .day {
64
- display: block;
65
- padding: 0;
66
- border: 1px solid color-mix(in srgb, var(--fg) 6%, transparent);
67
- border-radius: 3px;
68
- background: color-mix(in srgb, var(--fg) 8%, var(--surface));
69
- transition:
70
- transform var(--motion-press),
71
- box-shadow var(--motion-hover);
72
- }
73
- .day[data-level="1"] {
74
- background: color-mix(in srgb, var(--calendar-color) 25%, var(--surface));
75
- }
76
- .day[data-level="2"] {
77
- background: color-mix(in srgb, var(--calendar-color) 45%, var(--surface));
78
- }
79
- .day[data-level="3"] {
80
- background: color-mix(in srgb, var(--calendar-color) 70%, var(--surface));
81
- }
82
- .day[data-level="4"] {
83
- background: var(--calendar-color);
84
- }
85
- .day[data-future="true"] {
86
- opacity: 0.3;
87
- cursor: default;
88
- }
89
- .day[data-missing="true"] {
90
- background: repeating-linear-gradient(
91
- 135deg,
92
- transparent,
93
- transparent 2px,
94
- color-mix(in srgb, var(--fg) 12%, var(--surface)) 2px,
95
- color-mix(in srgb, var(--fg) 12%, var(--surface)) 3px
96
- );
97
- }
98
- .day:hover:not([data-future="true"]) {
99
- transform: scale(1.12);
100
- }
101
- .day:focus-visible,
102
- .day[aria-selected="true"] {
103
- outline: 2px solid var(--accent-ink, var(--accent));
104
- outline-offset: 1px;
105
- }
106
- .footer {
107
- margin-top: 12px;
108
- min-height: 18px;
109
- }
110
- .legend {
111
- display: flex;
112
- align-items: center;
113
- gap: 4px;
114
- margin-left: auto;
115
- }
116
- .legend > span {
117
- margin: 0 3px;
118
- }
119
- .legend .day {
120
- cursor: default;
121
- }
122
-
123
- .extraFooter {
124
- margin-top: 16px;
125
- padding-top: 16px;
126
- border-top: 1px solid var(--line);
127
- }
1
+ .calendar {
2
+ container-type: inline-size;
3
+ --calendar-cell: 13px;
4
+ --calendar-gap: 3px;
5
+ min-width: 0;
6
+ border: 1px solid var(--line);
7
+ border-radius: var(--radius);
8
+ padding: 20px;
9
+ background: var(--surface);
10
+ }
11
+ .header,
12
+ .footer {
13
+ display: flex;
14
+ align-items: center;
15
+ justify-content: space-between;
16
+ gap: 14px;
17
+ }
18
+ .header {
19
+ margin-bottom: 16px;
20
+ }
21
+ .header > span,
22
+ .footer {
23
+ font-size: 11px;
24
+ color: var(--muted);
25
+ }
26
+ .scroll {
27
+ --calendar-cell: clamp(
28
+ 9px,
29
+ calc((100cqw - 32px) / var(--calendar-weeks) - var(--calendar-gap)),
30
+ var(--calendar-cell-max, 13px)
31
+ );
32
+ overflow: auto;
33
+ padding: 3px 2px 6px;
34
+ }
35
+ .months,
36
+ .row {
37
+ display: grid;
38
+ column-gap: var(--calendar-gap);
39
+ width: max-content;
40
+ align-items: center;
41
+ }
42
+ .months {
43
+ height: 22px;
44
+ font-size: 10px;
45
+ color: var(--muted);
46
+ }
47
+ .months > span {
48
+ grid-row: 1;
49
+ white-space: nowrap;
50
+ }
51
+ .row {
52
+ height: calc(var(--calendar-cell) + var(--calendar-gap));
53
+ }
54
+ .weekday {
55
+ font-size: 10px;
56
+ color: var(--muted);
57
+ }
58
+ .day,
59
+ .pad {
60
+ width: var(--calendar-cell);
61
+ height: var(--calendar-cell);
62
+ }
63
+ .day {
64
+ display: block;
65
+ padding: 0;
66
+ border: 1px solid color-mix(in srgb, var(--fg) 6%, transparent);
67
+ border-radius: 3px;
68
+ background: color-mix(in srgb, var(--fg) 8%, var(--surface));
69
+ transition:
70
+ transform var(--motion-press),
71
+ box-shadow var(--motion-hover);
72
+ }
73
+ .day[data-level="1"] {
74
+ background: color-mix(in srgb, var(--calendar-color) 25%, var(--surface));
75
+ }
76
+ .day[data-level="2"] {
77
+ background: color-mix(in srgb, var(--calendar-color) 45%, var(--surface));
78
+ }
79
+ .day[data-level="3"] {
80
+ background: color-mix(in srgb, var(--calendar-color) 70%, var(--surface));
81
+ }
82
+ .day[data-level="4"] {
83
+ background: var(--calendar-color);
84
+ }
85
+ .day[data-future="true"] {
86
+ opacity: 0.3;
87
+ cursor: default;
88
+ }
89
+ .day[data-missing="true"] {
90
+ background: repeating-linear-gradient(
91
+ 135deg,
92
+ transparent,
93
+ transparent 2px,
94
+ color-mix(in srgb, var(--fg) 12%, var(--surface)) 2px,
95
+ color-mix(in srgb, var(--fg) 12%, var(--surface)) 3px
96
+ );
97
+ }
98
+ .day:hover:not([data-future="true"]) {
99
+ transform: scale(1.12);
100
+ }
101
+ .day:focus-visible,
102
+ .day[aria-selected="true"] {
103
+ outline: 2px solid var(--accent-ink, var(--accent));
104
+ outline-offset: 1px;
105
+ }
106
+ .footer {
107
+ margin-top: 12px;
108
+ min-height: 18px;
109
+ }
110
+ .legend {
111
+ display: flex;
112
+ align-items: center;
113
+ gap: 4px;
114
+ margin-left: auto;
115
+ }
116
+ .legend > span {
117
+ margin: 0 3px;
118
+ }
119
+ .legend .day {
120
+ cursor: default;
121
+ }
122
+
123
+ .extraFooter {
124
+ margin-top: 16px;
125
+ padding-top: 16px;
126
+ border-top: 1px solid var(--line);
127
+ }
@@ -3,9 +3,10 @@
3
3
  container-type: inline-size;
4
4
  }
5
5
  .title {
6
- margin-bottom: 16px;
7
- font-size: 14px;
8
- font-weight: 600;
6
+ margin-bottom: var(--section-title-gap, 12px);
7
+ font-size: var(--section-title-size, 14px);
8
+ font-weight: var(--section-title-weight, 600);
9
+ line-height: var(--section-title-line-height, 1.5);
9
10
  }
10
11
  .list {
11
12
  display: grid;