@robert-stackflow/oneui 0.6.40 → 0.6.41

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.
Files changed (42) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +6 -0
  3. package/components/AccountItem.module.css +103 -103
  4. package/components/AppShell.module.css +223 -223
  5. package/components/Badge.module.css +30 -30
  6. package/components/BarChart.module.css +35 -35
  7. package/components/Breadcrumb.module.css +97 -97
  8. package/components/Button.module.css +120 -120
  9. package/components/Checkbox.module.css +95 -95
  10. package/components/Control.module.css +86 -86
  11. package/components/DataTable.module.css +75 -75
  12. package/components/Form.d.ts +5 -1
  13. package/components/Form.js +5 -1
  14. package/components/FormField.js +1 -0
  15. package/components/HierarchyPicker.module.css +185 -185
  16. package/components/Indicator.module.css +83 -83
  17. package/components/Layout.module.css +82 -82
  18. package/components/Markdown.module.css +227 -227
  19. package/components/NativeForm.d.ts +10 -0
  20. package/components/NativeForm.js +155 -0
  21. package/components/NavBar.module.css +130 -130
  22. package/components/Progress.module.css +33 -33
  23. package/components/RadioGroup.module.css +87 -87
  24. package/components/RangeSlider.module.css +141 -141
  25. package/components/ResizablePanel.module.css +101 -101
  26. package/components/ResourceCard.module.css +98 -98
  27. package/components/Slider.module.css +19 -19
  28. package/components/Steps.module.css +176 -176
  29. package/components/Tab.module.css +148 -148
  30. package/components/ThemePicker.module.css +178 -178
  31. package/components/TimeColumns.module.css +47 -47
  32. package/components/Timeline.module.css +202 -202
  33. package/components/TreeTable.module.css +57 -57
  34. package/components/UptimeChart.module.css +15 -15
  35. package/components/field.d.ts +1 -1
  36. package/components/field.js +2 -1
  37. package/components/form-validation.d.ts +4 -0
  38. package/components/form-validation.js +22 -0
  39. package/components/index.d.ts +4 -2
  40. package/components/index.js +9 -3
  41. package/package.json +1 -1
  42. package/styles/blue.css +270 -270
package/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 0.6.41
2
+
3
+ - Form 支持保留现有事件处理的原生约束模式,统一行内校验、错误焦点、外部提交、重置和异步提交锁;保留 useFormState 控制器模式。
4
+ - FormField 与输入控件自动读取表单校验状态,不再显示浏览器原生校验气泡;修正受控输入与捕获事件的更新顺序,保留用户输入。
5
+ - 导出 validateForm 供弹窗和自动保存流程触发同一校验反馈。
6
+
1
7
  ## 0.6.40
2
8
 
3
9
  - 合入分栏按钮的自定义面板、图标与小尺寸、受控展开及 ghost 选中态;嵌套浮层 Escape 优先关闭内层,保留近期图文按钮、禁用与自适应宽度修正。
package/README.md CHANGED
@@ -339,3 +339,9 @@ Closing returns a visible source image with Hero motion. Missing/offscreen sourc
339
339
  ### Multiline option descriptions
340
340
 
341
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.
342
+
343
+ ## 原生约束表单(0.6.41)
344
+
345
+ 已有 React 事件表单可改为 `<Form onSubmit={submit}>`,保留事件处理、受控值和业务请求。Form 统一处理 required、type、pattern、范围、自定义有效性、首个错误焦点和异步提交锁;错误通过 FormField / Input 的 FieldMessages 展示。未包裹的原生字段使用可聚焦的错误摘要。`validationMode="blur"` 在离开字段后检查,默认提交时检查;出错后修改会更新反馈。内部自动使用 noValidate,不出现原生气泡。
346
+
347
+ `validateForm(formRef.current, false)` 检查并展示字段错误但不抢焦点,适合自动保存;省略第二个参数则聚焦首个错误。保留自定义业务错误、身份验证、并发和请求重试策略。字段使用稳定 id 或 name,并通过 OneUI FormField / 控件提供标签。`controller={useFormState(...)}` 模式保持兼容,用于显式规则与异步字段校验。
@@ -1,103 +1,103 @@
1
- .item {
2
- display: grid;
3
- grid-template-columns: 40px minmax(0, 1fr) auto;
4
- gap: 16px;
5
- align-items: start;
6
- padding: 20px;
7
- border: 1px solid var(--line);
8
- border-radius: var(--card-radius);
9
- background: var(--surface);
10
- min-width: 0;
11
- }
12
- .item[data-highlighted] {
13
- background: color-mix(in srgb, var(--selected) 35%, var(--surface));
14
- }
15
- .icon {
16
- display: grid;
17
- place-items: center;
18
- width: 40px;
19
- height: 40px;
20
- border-radius: var(--radius);
21
- background: var(--selected);
22
- color: var(--fg);
23
- }
24
- .icon svg {
25
- width: 21px;
26
- height: 21px;
27
- }
28
- .body {
29
- min-width: 0;
30
- }
31
- .heading {
32
- display: flex;
33
- align-items: center;
34
- flex-wrap: wrap;
35
- gap: 10px;
36
- }
37
- .heading strong {
38
- font-size: 14px;
39
- font-weight: 600;
40
- color: var(--fg);
41
- overflow-wrap: anywhere;
42
- }
43
- .description {
44
- font-size: 12px;
45
- color: var(--muted);
46
- margin-top: 5px;
47
- overflow-wrap: anywhere;
48
- }
49
- .metadata {
50
- display: flex;
51
- flex-wrap: wrap;
52
- gap: 14px 28px;
53
- margin: 16px 0 0;
54
- }
55
- .metadata > div {
56
- min-width: 0;
57
- }
58
- .metadata dt {
59
- font-size: 11px;
60
- color: var(--muted);
61
- }
62
- .metadata dd {
63
- margin: 4px 0 0;
64
- font-size: 12px;
65
- color: var(--fg);
66
- font-variant-numeric: tabular-nums;
67
- overflow-wrap: anywhere;
68
- }
69
- .actions {
70
- display: flex;
71
- align-items: center;
72
- gap: 6px;
73
- justify-content: flex-end;
74
- }
75
- @media (max-width: 700px) {
76
- .item {
77
- grid-template-columns: 36px minmax(0, 1fr);
78
- gap: 12px;
79
- padding: 16px;
80
- }
81
- .icon {
82
- width: 36px;
83
- height: 36px;
84
- }
85
- .actions {
86
- grid-column: 2;
87
- }
88
- .metadata {
89
- display: flex;
90
- flex-direction: column;
91
- gap: 10px;
92
- }
93
- .metadata > div {
94
- display: flex;
95
- align-items: baseline;
96
- justify-content: space-between;
97
- gap: 12px;
98
- }
99
- .metadata dd {
100
- margin: 0;
101
- text-align: right;
102
- }
103
- }
1
+ .item {
2
+ display: grid;
3
+ grid-template-columns: 40px minmax(0, 1fr) auto;
4
+ gap: 16px;
5
+ align-items: start;
6
+ padding: 20px;
7
+ border: 1px solid var(--line);
8
+ border-radius: var(--card-radius);
9
+ background: var(--surface);
10
+ min-width: 0;
11
+ }
12
+ .item[data-highlighted] {
13
+ background: color-mix(in srgb, var(--selected) 35%, var(--surface));
14
+ }
15
+ .icon {
16
+ display: grid;
17
+ place-items: center;
18
+ width: 40px;
19
+ height: 40px;
20
+ border-radius: var(--radius);
21
+ background: var(--selected);
22
+ color: var(--fg);
23
+ }
24
+ .icon svg {
25
+ width: 21px;
26
+ height: 21px;
27
+ }
28
+ .body {
29
+ min-width: 0;
30
+ }
31
+ .heading {
32
+ display: flex;
33
+ align-items: center;
34
+ flex-wrap: wrap;
35
+ gap: 10px;
36
+ }
37
+ .heading strong {
38
+ font-size: 14px;
39
+ font-weight: 600;
40
+ color: var(--fg);
41
+ overflow-wrap: anywhere;
42
+ }
43
+ .description {
44
+ font-size: 12px;
45
+ color: var(--muted);
46
+ margin-top: 5px;
47
+ overflow-wrap: anywhere;
48
+ }
49
+ .metadata {
50
+ display: flex;
51
+ flex-wrap: wrap;
52
+ gap: 14px 28px;
53
+ margin: 16px 0 0;
54
+ }
55
+ .metadata > div {
56
+ min-width: 0;
57
+ }
58
+ .metadata dt {
59
+ font-size: 11px;
60
+ color: var(--muted);
61
+ }
62
+ .metadata dd {
63
+ margin: 4px 0 0;
64
+ font-size: 12px;
65
+ color: var(--fg);
66
+ font-variant-numeric: tabular-nums;
67
+ overflow-wrap: anywhere;
68
+ }
69
+ .actions {
70
+ display: flex;
71
+ align-items: center;
72
+ gap: 6px;
73
+ justify-content: flex-end;
74
+ }
75
+ @media (max-width: 700px) {
76
+ .item {
77
+ grid-template-columns: 36px minmax(0, 1fr);
78
+ gap: 12px;
79
+ padding: 16px;
80
+ }
81
+ .icon {
82
+ width: 36px;
83
+ height: 36px;
84
+ }
85
+ .actions {
86
+ grid-column: 2;
87
+ }
88
+ .metadata {
89
+ display: flex;
90
+ flex-direction: column;
91
+ gap: 10px;
92
+ }
93
+ .metadata > div {
94
+ display: flex;
95
+ align-items: baseline;
96
+ justify-content: space-between;
97
+ gap: 12px;
98
+ }
99
+ .metadata dd {
100
+ margin: 0;
101
+ text-align: right;
102
+ }
103
+ }
@@ -1,223 +1,223 @@
1
- .shell {
2
- height: 100dvh;
3
- display: grid;
4
- grid-template-columns: 228px minmax(0, 1fr);
5
- overflow: hidden;
6
- color: var(--fg);
7
- background: var(--app-background, var(--canvas));
8
- font: 14px/1.6 var(--ui-font, "Segoe UI", "Microsoft YaHei", sans-serif);
9
- transition: grid-template-columns var(--motion-panel) var(--ease);
10
- }
11
- .shell[data-collapsed="true"] {
12
- grid-template-columns: 76px minmax(0, 1fr);
13
- }
14
- .sidebar {
15
- min-width: 0;
16
- display: flex;
17
- flex-direction: column;
18
- gap: 24px;
19
- padding: 24px 16px 18px;
20
- background: var(--navigation);
21
- border-right: 1px solid var(--line);
22
- overflow: hidden;
23
- }
24
- .brand {
25
- display: flex;
26
- align-items: center;
27
- gap: 10px;
28
- min-height: 38px;
29
- padding: 0 10px;
30
- color: var(--fg);
31
- text-decoration: none;
32
- flex-shrink: 0;
33
- }
34
- .brand strong {
35
- font-size: 16px;
36
- letter-spacing: -0.4px;
37
- }
38
- .mark {
39
- display: grid;
40
- place-items: center;
41
- width: 32px;
42
- height: 32px;
43
- flex-shrink: 0;
44
- border-radius: 10px;
45
- background: var(--accent);
46
- color: var(--on-accent);
47
- }
48
- .navigation {
49
- display: flex;
50
- flex-direction: column;
51
- gap: 4px;
52
- min-height: 0;
53
- overflow: auto;
54
- }
55
- .bottom {
56
- display: flex;
57
- flex-direction: column;
58
- gap: 8px;
59
- margin-top: auto;
60
- flex-shrink: 0;
61
- }
62
- .workspace {
63
- display: flex;
64
- flex-direction: column;
65
- min-width: 0;
66
- min-height: 0;
67
- }
68
- .header {
69
- height: 60px;
70
- min-height: 60px;
71
- display: flex;
72
- align-items: center;
73
- justify-content: space-between;
74
- gap: 16px;
75
- padding: 0 8px;
76
- border-bottom: 1px solid var(--line);
77
- background: var(--surface);
78
- color: var(--fg);
79
- }
80
- .header[data-draggable="true"] {
81
- -webkit-app-region: drag;
82
- }
83
- .header button,
84
- .header a,
85
- .headerEnd {
86
- -webkit-app-region: no-drag;
87
- }
88
- .headerStart,
89
- .headerEnd {
90
- display: flex;
91
- align-items: center;
92
- gap: 12px;
93
- min-width: 0;
94
- }
95
- .headerEnd {
96
- flex-shrink: 0;
97
- }
98
- .title {
99
- font-size: 13px;
100
- overflow: hidden;
101
- text-overflow: ellipsis;
102
- white-space: nowrap;
103
- }
104
- .main {
105
- flex: 1;
106
- min-height: 0;
107
- overflow: auto;
108
- outline: none;
109
- scrollbar-gutter: stable;
110
- overscroll-behavior: contain;
111
- }
112
- .page {
113
- width: 100%;
114
- max-width: 1390px;
115
- margin: 0 auto;
116
- padding: 42px 40px 52px;
117
- --page-max-width: none;
118
- --page-margin: 0;
119
- --page-inset: 0;
120
- --page-wide-top: 0;
121
- --page-title-size: 28px;
122
- --page-title-line-height: 1.3;
123
- }
124
- .page h1 {
125
- margin: 0;
126
- font-size: 28px;
127
- line-height: 1.3;
128
- }
129
- .shell[data-collapsed="true"] > .sidebar .brand strong,
130
- .shell[data-collapsed="true"] > .sidebar .navigation a span {
131
- display: none;
132
- }
133
- .shell[data-collapsed="true"] > .sidebar {
134
- padding-inline: 12px;
135
- }
136
- .shell[data-collapsed="true"] > .sidebar .brand {
137
- padding: 0;
138
- justify-content: center;
139
- }
140
- .shell[data-collapsed="true"] > .sidebar .navigation a {
141
- justify-content: center;
142
- padding-inline: 0;
143
- }
144
- .mobileToggle {
145
- display: none;
146
- }
147
- .floatingNavigation {
148
- position: fixed;
149
- z-index: 50;
150
- top: 12px;
151
- left: 12px;
152
- background: var(--surface);
153
- border: 1px solid var(--line);
154
- box-shadow: var(--shadow-sm);
155
- }
156
- .mobileNav {
157
- display: flex;
158
- flex-direction: column;
159
- gap: 24px;
160
- min-height: 100%;
161
- padding: 8px 0;
162
- }
163
- .mobileNav .bottom {
164
- margin-top: 24px;
165
- }
166
- .skip {
167
- position: fixed;
168
- top: -60px;
169
- left: 12px;
170
- z-index: 5000;
171
- padding: 10px 16px;
172
- background: var(--surface);
173
- color: var(--fg);
174
- }
175
- .skip:focus {
176
- top: 12px;
177
- }
178
- @media (max-width: 800px) {
179
- .shell,
180
- .shell[data-collapsed="true"] {
181
- grid-template-columns: minmax(0, 1fr);
182
- }
183
- .sidebar {
184
- display: none;
185
- }
186
- .desktopToggle {
187
- display: none;
188
- }
189
- .mobileToggle {
190
- display: grid;
191
- }
192
- .header {
193
- padding-inline: 8px;
194
- gap: 8px;
195
- }
196
- .headerStart,
197
- .headerEnd {
198
- gap: 8px;
199
- }
200
- .page {
201
- padding: 28px 24px 40px;
202
- }
203
- .shell[data-header="false"] .page {
204
- padding-top: 64px;
205
- }
206
- }
207
- @media (max-width: 540px) {
208
- .page {
209
- padding: 24px 16px 36px;
210
- }
211
- .page h1 {
212
- font-size: 25px;
213
- }
214
- }
215
-
216
- .page {
217
- font-size: 13px;
218
- line-height: 1.6;
219
- }
220
-
221
- .header[data-window-controls="true"] {
222
- padding-right: 8px;
223
- }
1
+ .shell {
2
+ height: 100dvh;
3
+ display: grid;
4
+ grid-template-columns: 228px minmax(0, 1fr);
5
+ overflow: hidden;
6
+ color: var(--fg);
7
+ background: var(--app-background, var(--canvas));
8
+ font: 14px/1.6 var(--ui-font, "Segoe UI", "Microsoft YaHei", sans-serif);
9
+ transition: grid-template-columns var(--motion-panel) var(--ease);
10
+ }
11
+ .shell[data-collapsed="true"] {
12
+ grid-template-columns: 76px minmax(0, 1fr);
13
+ }
14
+ .sidebar {
15
+ min-width: 0;
16
+ display: flex;
17
+ flex-direction: column;
18
+ gap: 24px;
19
+ padding: 24px 16px 18px;
20
+ background: var(--navigation);
21
+ border-right: 1px solid var(--line);
22
+ overflow: hidden;
23
+ }
24
+ .brand {
25
+ display: flex;
26
+ align-items: center;
27
+ gap: 10px;
28
+ min-height: 38px;
29
+ padding: 0 10px;
30
+ color: var(--fg);
31
+ text-decoration: none;
32
+ flex-shrink: 0;
33
+ }
34
+ .brand strong {
35
+ font-size: 16px;
36
+ letter-spacing: -0.4px;
37
+ }
38
+ .mark {
39
+ display: grid;
40
+ place-items: center;
41
+ width: 32px;
42
+ height: 32px;
43
+ flex-shrink: 0;
44
+ border-radius: 10px;
45
+ background: var(--accent);
46
+ color: var(--on-accent);
47
+ }
48
+ .navigation {
49
+ display: flex;
50
+ flex-direction: column;
51
+ gap: 4px;
52
+ min-height: 0;
53
+ overflow: auto;
54
+ }
55
+ .bottom {
56
+ display: flex;
57
+ flex-direction: column;
58
+ gap: 8px;
59
+ margin-top: auto;
60
+ flex-shrink: 0;
61
+ }
62
+ .workspace {
63
+ display: flex;
64
+ flex-direction: column;
65
+ min-width: 0;
66
+ min-height: 0;
67
+ }
68
+ .header {
69
+ height: 60px;
70
+ min-height: 60px;
71
+ display: flex;
72
+ align-items: center;
73
+ justify-content: space-between;
74
+ gap: 16px;
75
+ padding: 0 8px;
76
+ border-bottom: 1px solid var(--line);
77
+ background: var(--surface);
78
+ color: var(--fg);
79
+ }
80
+ .header[data-draggable="true"] {
81
+ -webkit-app-region: drag;
82
+ }
83
+ .header button,
84
+ .header a,
85
+ .headerEnd {
86
+ -webkit-app-region: no-drag;
87
+ }
88
+ .headerStart,
89
+ .headerEnd {
90
+ display: flex;
91
+ align-items: center;
92
+ gap: 12px;
93
+ min-width: 0;
94
+ }
95
+ .headerEnd {
96
+ flex-shrink: 0;
97
+ }
98
+ .title {
99
+ font-size: 13px;
100
+ overflow: hidden;
101
+ text-overflow: ellipsis;
102
+ white-space: nowrap;
103
+ }
104
+ .main {
105
+ flex: 1;
106
+ min-height: 0;
107
+ overflow: auto;
108
+ outline: none;
109
+ scrollbar-gutter: stable;
110
+ overscroll-behavior: contain;
111
+ }
112
+ .page {
113
+ width: 100%;
114
+ max-width: 1390px;
115
+ margin: 0 auto;
116
+ padding: 42px 40px 52px;
117
+ --page-max-width: none;
118
+ --page-margin: 0;
119
+ --page-inset: 0;
120
+ --page-wide-top: 0;
121
+ --page-title-size: 28px;
122
+ --page-title-line-height: 1.3;
123
+ }
124
+ .page h1 {
125
+ margin: 0;
126
+ font-size: 28px;
127
+ line-height: 1.3;
128
+ }
129
+ .shell[data-collapsed="true"] > .sidebar .brand strong,
130
+ .shell[data-collapsed="true"] > .sidebar .navigation a span {
131
+ display: none;
132
+ }
133
+ .shell[data-collapsed="true"] > .sidebar {
134
+ padding-inline: 12px;
135
+ }
136
+ .shell[data-collapsed="true"] > .sidebar .brand {
137
+ padding: 0;
138
+ justify-content: center;
139
+ }
140
+ .shell[data-collapsed="true"] > .sidebar .navigation a {
141
+ justify-content: center;
142
+ padding-inline: 0;
143
+ }
144
+ .mobileToggle {
145
+ display: none;
146
+ }
147
+ .floatingNavigation {
148
+ position: fixed;
149
+ z-index: 50;
150
+ top: 12px;
151
+ left: 12px;
152
+ background: var(--surface);
153
+ border: 1px solid var(--line);
154
+ box-shadow: var(--shadow-sm);
155
+ }
156
+ .mobileNav {
157
+ display: flex;
158
+ flex-direction: column;
159
+ gap: 24px;
160
+ min-height: 100%;
161
+ padding: 8px 0;
162
+ }
163
+ .mobileNav .bottom {
164
+ margin-top: 24px;
165
+ }
166
+ .skip {
167
+ position: fixed;
168
+ top: -60px;
169
+ left: 12px;
170
+ z-index: 5000;
171
+ padding: 10px 16px;
172
+ background: var(--surface);
173
+ color: var(--fg);
174
+ }
175
+ .skip:focus {
176
+ top: 12px;
177
+ }
178
+ @media (max-width: 800px) {
179
+ .shell,
180
+ .shell[data-collapsed="true"] {
181
+ grid-template-columns: minmax(0, 1fr);
182
+ }
183
+ .sidebar {
184
+ display: none;
185
+ }
186
+ .desktopToggle {
187
+ display: none;
188
+ }
189
+ .mobileToggle {
190
+ display: grid;
191
+ }
192
+ .header {
193
+ padding-inline: 8px;
194
+ gap: 8px;
195
+ }
196
+ .headerStart,
197
+ .headerEnd {
198
+ gap: 8px;
199
+ }
200
+ .page {
201
+ padding: 28px 24px 40px;
202
+ }
203
+ .shell[data-header="false"] .page {
204
+ padding-top: 64px;
205
+ }
206
+ }
207
+ @media (max-width: 540px) {
208
+ .page {
209
+ padding: 24px 16px 36px;
210
+ }
211
+ .page h1 {
212
+ font-size: 25px;
213
+ }
214
+ }
215
+
216
+ .page {
217
+ font-size: 13px;
218
+ line-height: 1.6;
219
+ }
220
+
221
+ .header[data-window-controls="true"] {
222
+ padding-right: 8px;
223
+ }