@robert-stackflow/oneui 0.6.59 → 0.6.60

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,7 @@
1
+ ## 0.6.60
2
+
3
+ - 标签页和分段控件以浅底色和短线提示键盘焦点,面板以顶部分隔线提示焦点。高对比度模式保留系统焦点轮廓。
4
+
1
5
  ## 0.6.59
2
6
 
3
7
  - Align dialog titles and close buttons on a shared centerline and separate the header from scrolling content.
@@ -12,7 +12,7 @@
12
12
  text-decoration: underline;
13
13
  }
14
14
  .link:focus-visible {
15
- outline: 2px solid var(--accent-ink, var(--accent));
15
+ outline: 2px solid var(--keyboard-focus-stroke, var(--accent));
16
16
  outline-offset: 3px;
17
17
  }
18
18
  .link[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
@@ -79,7 +79,7 @@
79
79
  .link:focus-visible,
80
80
  .menuItem:focus-visible,
81
81
  .brand:focus-visible {
82
- outline: 2px solid var(--accent-ink, var(--accent));
82
+ outline: 2px solid var(--keyboard-focus-stroke, var(--accent));
83
83
  outline-offset: -2px;
84
84
  }
85
85
  .chevron {
@@ -2,6 +2,7 @@
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import { useLayoutEffect, useRef } from "react";
4
4
  import s from "./Segmented.module.css";
5
+ import focus from "./TabFocus.module.css";
5
6
  function Segmented({
6
7
  value,
7
8
  onChange,
@@ -67,6 +68,7 @@ function Segmented({
67
68
  "button",
68
69
  {
69
70
  type: "button",
71
+ className: focus.target,
70
72
  ref: (node) => {
71
73
  if (node) buttons.current.set(option.value, node);
72
74
  else buttons.current.delete(option.value);
@@ -75,9 +75,6 @@
75
75
  width: 16px;
76
76
  height: 16px;
77
77
  }
78
- .segmented button:focus-visible {
79
- outline-offset: -2px;
80
- }
81
78
 
82
79
  .segmented[data-full-width] {
83
80
  width: 100%;
@@ -171,7 +171,7 @@
171
171
  .navigationButton:focus-visible,
172
172
  .groupToggle:focus-visible,
173
173
  .disclosure:focus-visible {
174
- outline: 2px solid var(--accent-ink, var(--accent));
174
+ outline: 2px solid var(--keyboard-focus-stroke, var(--accent));
175
175
  outline-offset: -2px;
176
176
  }
177
177
  .children {
@@ -41,9 +41,6 @@
41
41
  .tabs button[aria-selected="true"] {
42
42
  color: var(--fg);
43
43
  }
44
- .tabs button:focus-visible {
45
- outline-offset: -2px;
46
- }
47
44
  .indicator {
48
45
  position: absolute;
49
46
  z-index: 0;
@@ -0,0 +1,34 @@
1
+ .target:focus-visible {
2
+ outline: none;
3
+ }
4
+ .target:focus-visible::before,
5
+ .target:focus-visible::after {
6
+ content: "";
7
+ position: absolute;
8
+ pointer-events: none;
9
+ }
10
+ .target:focus-visible::before {
11
+ inset: 2px 0;
12
+ border-radius: 5px;
13
+ background: var(--keyboard-focus-fill);
14
+ z-index: -1;
15
+ }
16
+ .target:focus-visible::after {
17
+ inset-inline: 0;
18
+ bottom: 4px;
19
+ width: min(20px, 55%);
20
+ height: 2px;
21
+ margin-inline: auto;
22
+ border-radius: 2px;
23
+ background: var(--keyboard-focus-stroke);
24
+ }
25
+ @media (forced-colors: active) {
26
+ .target:focus-visible {
27
+ outline: 2px solid Highlight;
28
+ outline-offset: -2px;
29
+ }
30
+ .target:focus-visible::before,
31
+ .target:focus-visible::after {
32
+ display: none;
33
+ }
34
+ }
@@ -2,6 +2,7 @@
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import { useTabIndicator } from "./useTabIndicator.js";
4
4
  import s from "./Tab.module.css";
5
+ import focus from "./TabFocus.module.css";
5
6
  function TabList({
6
7
  value,
7
8
  onChange,
@@ -32,6 +33,7 @@ function TabList({
32
33
  {
33
34
  type: "button",
34
35
  role: "tab",
36
+ className: focus.target,
35
37
  "data-value": option.value,
36
38
  id: option.id,
37
39
  "aria-controls": option.panelId,
@@ -74,7 +74,7 @@
74
74
  color: var(--fg);
75
75
  }
76
76
  .link:focus-visible {
77
- outline: 2px solid var(--accent-ink, var(--accent));
77
+ outline: 2px solid var(--keyboard-focus-stroke, var(--accent));
78
78
  outline-offset: -2px;
79
79
  border-radius: 5px;
80
80
  }
@@ -133,7 +133,7 @@
133
133
  opacity: 0.65;
134
134
  }
135
135
  .trigger:focus-visible {
136
- outline: 2px solid var(--accent-ink, var(--accent));
136
+ outline: 2px solid var(--keyboard-focus-stroke, var(--accent));
137
137
  outline-offset: 2px;
138
138
  }
139
139
  .card {
@@ -203,7 +203,7 @@
203
203
  background: var(--selected);
204
204
  }
205
205
  .flatLink:focus-visible {
206
- outline: 2px solid var(--accent-ink, var(--accent));
206
+ outline: 2px solid var(--keyboard-focus-stroke, var(--accent));
207
207
  outline-offset: -2px;
208
208
  }
209
209
  .number {
@@ -234,7 +234,7 @@
234
234
  }
235
235
 
236
236
  .railItem:focus-visible {
237
- outline: 2px solid var(--accent-ink, var(--accent));
237
+ outline: 2px solid var(--keyboard-focus-stroke, var(--accent));
238
238
  outline-offset: 1px;
239
239
  border-radius: 4px;
240
240
  }
@@ -1,3 +1,13 @@
1
1
  .panel {
2
2
  padding: 20px 0;
3
3
  }
4
+ .panel:focus-visible {
5
+ outline: none;
6
+ box-shadow: inset 0 2px var(--keyboard-focus-stroke);
7
+ }
8
+ @media (forced-colors: active) {
9
+ .panel:focus-visible {
10
+ outline: 2px solid Highlight;
11
+ outline-offset: -2px;
12
+ }
13
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robert-stackflow/oneui",
3
- "version": "0.6.59",
3
+ "version": "0.6.60",
4
4
  "description": "OneUI React components, application shell and portable visual themes",
5
5
  "type": "module",
6
6
  "sideEffects": [
package/styles/base.css CHANGED
@@ -64,6 +64,8 @@
64
64
 
65
65
  :root[data-ui-theme] {
66
66
  --ui-font: "Segoe UI", "Microsoft YaHei", sans-serif;
67
+ --keyboard-focus-stroke: color-mix(in srgb, var(--accent-ink, var(--fg)) 72%, var(--surface));
68
+ --keyboard-focus-fill: color-mix(in srgb, var(--accent-ink, var(--fg)) 10%, transparent);
67
69
  }
68
70
  :root[data-ui-theme] body {
69
71
  font: 14px/1.6 var(--ui-font);
@@ -91,8 +93,8 @@
91
93
  summary,
92
94
  [tabindex]
93
95
  ):focus-visible {
94
- outline: 2px solid var(--accent-ink, var(--accent));
95
- outline-offset: 3px;
96
+ outline: 2px solid var(--keyboard-focus-stroke);
97
+ outline-offset: 2px;
96
98
  }
97
99
  :root[data-ui-theme="minimal"] {
98
100
  --sidebar: var(--navigation);