@aviala-design/spiral 3.1.0 → 4.0.0-next.0
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/README.md +80 -0
- package/dist/{chunk-Q6UMVIGM.cjs → chunk-JZOPCN75.cjs} +45 -5
- package/dist/chunk-JZOPCN75.cjs.map +1 -0
- package/dist/{chunk-G7RVHJIV.js → chunk-NUOJ7QVZ.js} +48 -8
- package/dist/chunk-NUOJ7QVZ.js.map +1 -0
- package/dist/component-catalog.json +4 -1
- package/dist/component-changelogs.json +252 -0
- package/dist/form.cjs +11 -9
- package/dist/form.cjs.map +1 -1
- package/dist/form.js +4 -2
- package/dist/form.js.map +1 -1
- package/dist/index.cjs +5799 -2521
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +981 -168
- package/dist/index.d.ts +981 -168
- package/dist/index.js +6678 -3400
- package/dist/index.js.map +1 -1
- package/dist/props.json +2389 -474
- package/dist/styles.css +5884 -1624
- package/package.json +7 -15
- package/dist/chunk-G7RVHJIV.js.map +0 -1
- package/dist/chunk-Q6UMVIGM.cjs.map +0 -1
|
@@ -52,6 +52,19 @@
|
|
|
52
52
|
}
|
|
53
53
|
],
|
|
54
54
|
"Badge": [
|
|
55
|
+
{
|
|
56
|
+
"version": "Unreleased",
|
|
57
|
+
"sections": {
|
|
58
|
+
"Added": [
|
|
59
|
+
"新增 `style=\"light\"` 浅色样式,消费 `--badge-color-light-secondary-*` 背景、文字与图标 Token;light 仅有 secondary 表面,传入 `primary` 时文字保持深色。",
|
|
60
|
+
"新增 `size` 属性(导出 `BadgeSize`:`default` | `large`),large 按字级消费 `--badge-size-{caption|text}-large-padding-x/y`;默认尺寸不输出额外类名。"
|
|
61
|
+
],
|
|
62
|
+
"Changed": [
|
|
63
|
+
"LineHeightFix 外层最小高度改用 `--badge-size-caption-align-to-text-level-height` / `--badge-size-text-align-to-subtitle-level-height` Fix 高度 Token。",
|
|
64
|
+
"secondary 图标颜色按样式消费 `--badge-color-{level}-{style}-secondary-icon-default`,与文字配色一致;primary 图标沿用 `--badge-color-{level}-primary-icon-default`。"
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
},
|
|
55
68
|
{
|
|
56
69
|
"version": "3.1.0",
|
|
57
70
|
"sections": {
|
|
@@ -64,6 +77,14 @@
|
|
|
64
77
|
}
|
|
65
78
|
],
|
|
66
79
|
"Breadcrumb": [
|
|
80
|
+
{
|
|
81
|
+
"version": "Unreleased",
|
|
82
|
+
"sections": {
|
|
83
|
+
"Changed": [
|
|
84
|
+
"`BreadcrumbItem` 可交互项背景接入新增的 `--breadcrumb-item-color-background-{default,hover,active}` Token(对齐 `Link` / `NoBackground Button` 透明体系),并为背景色与文字/图标透明度补充 `250ms ease` 过渡与 `prefers-reduced-motion` 降级。"
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
},
|
|
67
88
|
{
|
|
68
89
|
"version": "3.1.0",
|
|
69
90
|
"sections": {
|
|
@@ -158,6 +179,17 @@
|
|
|
158
179
|
}
|
|
159
180
|
],
|
|
160
181
|
"Cascader": [
|
|
182
|
+
{
|
|
183
|
+
"version": "Unreleased",
|
|
184
|
+
"sections": {
|
|
185
|
+
"Fixed": [
|
|
186
|
+
"点击浮层外部时焦点留在用户点击的位置,不再被拉回触发器;Esc 等键盘关闭仍会返回触发器。"
|
|
187
|
+
],
|
|
188
|
+
"Changed": [
|
|
189
|
+
"菜单表面改用统一三层浮层阴影(`--cascader-menu-effect-shadow-ambient/near/border-*`),移除 1px 外边框;显式 `--cascader-menu-shadow` 覆盖仍优先。"
|
|
190
|
+
]
|
|
191
|
+
}
|
|
192
|
+
},
|
|
161
193
|
{
|
|
162
194
|
"version": "3.1.0",
|
|
163
195
|
"sections": {
|
|
@@ -271,6 +303,17 @@
|
|
|
271
303
|
}
|
|
272
304
|
],
|
|
273
305
|
"ColorPicker": [
|
|
306
|
+
{
|
|
307
|
+
"version": "Unreleased",
|
|
308
|
+
"sections": {
|
|
309
|
+
"Fixed": [
|
|
310
|
+
"点击浮层外部时焦点留在用户点击的位置,不再被拉回触发器;Esc 等键盘关闭仍会返回触发器。"
|
|
311
|
+
],
|
|
312
|
+
"Changed": [
|
|
313
|
+
"面板表面改用统一三层浮层阴影(`--color-picker-panel-effect-shadow-ambient/near/border-*`),移除 1px 外边框;显式 `--color-picker-panel-shadow` 覆盖仍优先。"
|
|
314
|
+
]
|
|
315
|
+
}
|
|
316
|
+
},
|
|
274
317
|
{
|
|
275
318
|
"version": "3.1.0",
|
|
276
319
|
"sections": {
|
|
@@ -331,6 +374,18 @@
|
|
|
331
374
|
}
|
|
332
375
|
],
|
|
333
376
|
"DatePickerField": [
|
|
377
|
+
{
|
|
378
|
+
"version": "Unreleased",
|
|
379
|
+
"sections": {
|
|
380
|
+
"Fixed": [
|
|
381
|
+
"点击浮层外部时不再把焦点交还给可编辑输入框,避免 `onFocus` 重新打开日历导致焦点环常驻;按 Esc、选择日期等关闭路径仍会把焦点还给触发器。"
|
|
382
|
+
],
|
|
383
|
+
"Changed": [
|
|
384
|
+
"日历菜单表面改用统一三层浮层阴影(`--date-picker-select-menu-effect-shadow-ambient/near/border-*`),移除 1px 外边框;显式 `--datepicker-panel-shadow` 覆盖仍优先。",
|
|
385
|
+
"范围模式触发器对齐 Figma `496:47575`:拆分为起始段、方向箭头与结束段三段式结构,保留完整激活边框,并在当前激活的起始/结束段下方以 `--date-picker-input-color-range-indicator-active` 与 `--date-picker-input-size-range-indicator-height` 渲染 2px 底部指示条。"
|
|
386
|
+
]
|
|
387
|
+
}
|
|
388
|
+
},
|
|
334
389
|
{
|
|
335
390
|
"version": "3.1.0",
|
|
336
391
|
"sections": {
|
|
@@ -407,6 +462,14 @@
|
|
|
407
462
|
}
|
|
408
463
|
],
|
|
409
464
|
"Drawer": [
|
|
465
|
+
{
|
|
466
|
+
"version": "Unreleased",
|
|
467
|
+
"sections": {
|
|
468
|
+
"Changed": [
|
|
469
|
+
"内容表面改用统一三层浮层阴影(`--drawer-view-effect-shadow-ambient/near/border-*`),移除 1px 外边框;显式 `--drawer-content-shadow` 覆盖仍优先。"
|
|
470
|
+
]
|
|
471
|
+
}
|
|
472
|
+
},
|
|
410
473
|
{
|
|
411
474
|
"version": "3.1.0",
|
|
412
475
|
"sections": {
|
|
@@ -428,6 +491,14 @@
|
|
|
428
491
|
}
|
|
429
492
|
],
|
|
430
493
|
"Feedback": [
|
|
494
|
+
{
|
|
495
|
+
"version": "Unreleased",
|
|
496
|
+
"sections": {
|
|
497
|
+
"Changed": [
|
|
498
|
+
"阴影更新为 `--feedback-effect-shadow-ambient-*` + `--feedback-effect-shadow-near-*` 两层浮层阴影;保留语义彩色边框,显式 `--feedback-shadow` 覆盖仍优先。"
|
|
499
|
+
]
|
|
500
|
+
}
|
|
501
|
+
},
|
|
431
502
|
{
|
|
432
503
|
"version": "3.1.0",
|
|
433
504
|
"sections": {
|
|
@@ -499,6 +570,17 @@
|
|
|
499
570
|
}
|
|
500
571
|
],
|
|
501
572
|
"Input": [
|
|
573
|
+
{
|
|
574
|
+
"version": "Unreleased",
|
|
575
|
+
"sections": {
|
|
576
|
+
"Added": [
|
|
577
|
+
"新增 `appearance` 属性并导出 `InputAppearance`(`default` | `outline` | `no-background`);默认外观保持原填充表面与旧覆盖不变。",
|
|
578
|
+
"`outline` 消费 `--base-input-color-outline-*`:背景改用透明体系(`quaternary-background-default` → `quaternary-background-hover` → `white-only`)并由 `::before` 镂空遮罩绘制 2-stop 渐变描边,避免悬浮透出边框底色并保持与 `default` 等高。",
|
|
579
|
+
"`no-background` 默认/悬浮消费 `--base-input-color-no-background-background-*`,激活/焦点切换白底并叠加 primary 渐变描边;交互过渡统一为 `250ms ease`(含 `@property` 渐变边框插值与 `prefers-reduced-motion` 降级)。",
|
|
580
|
+
"`leftBadge` / `rightBadge` 对齐新版 `badge area` 规范:默认采用 `text` + `large` + `lineHeightFix=\"off\"` + `primary={false}` 且无额外纵向内边距;`default` 外观失焦时使用 `light` 白底、聚焦切为 `normal` 灰底(`outline` / `no-background` 始终使用 `normal`),并支持 `250ms ease` 颜色过渡与显式 `<Badge>` props 覆盖。"
|
|
581
|
+
]
|
|
582
|
+
}
|
|
583
|
+
},
|
|
502
584
|
{
|
|
503
585
|
"version": "3.1.0",
|
|
504
586
|
"sections": {
|
|
@@ -545,6 +627,14 @@
|
|
|
545
627
|
}
|
|
546
628
|
],
|
|
547
629
|
"List": [
|
|
630
|
+
{
|
|
631
|
+
"version": "Unreleased",
|
|
632
|
+
"sections": {
|
|
633
|
+
"Fixed": [
|
|
634
|
+
"移除列表项标题上引用不存在 Token `--list-item-size-title-radius` 的圆角声明,title/head/content/last 结构与 Figma `List item` 对齐。"
|
|
635
|
+
]
|
|
636
|
+
}
|
|
637
|
+
},
|
|
548
638
|
{
|
|
549
639
|
"version": "3.1.0",
|
|
550
640
|
"sections": {
|
|
@@ -653,6 +743,14 @@
|
|
|
653
743
|
}
|
|
654
744
|
],
|
|
655
745
|
"Modal": [
|
|
746
|
+
{
|
|
747
|
+
"version": "Unreleased",
|
|
748
|
+
"sections": {
|
|
749
|
+
"Changed": [
|
|
750
|
+
"内容表面改用统一三层浮层阴影(`--modal-effect-shadow-ambient/near/border-*`),移除 1px 外边框;显式 `--modal-content-shadow` 覆盖仍优先。"
|
|
751
|
+
]
|
|
752
|
+
}
|
|
753
|
+
},
|
|
656
754
|
{
|
|
657
755
|
"version": "3.1.0",
|
|
658
756
|
"sections": {
|
|
@@ -692,6 +790,15 @@
|
|
|
692
790
|
}
|
|
693
791
|
],
|
|
694
792
|
"MultiSelect": [
|
|
793
|
+
{
|
|
794
|
+
"version": "Unreleased",
|
|
795
|
+
"sections": {
|
|
796
|
+
"Fixed": [
|
|
797
|
+
"点击浮层外部时焦点留在用户点击的位置,不再被拉回触发器。",
|
|
798
|
+
"打开面板时不再给默认聚焦的已选中项套用悬浮灰底(仅键盘导航 `html[data-aviala-kbd]` 或真实 hover 高亮),选中对勾改为 `SymbolRightCircle` Medium。"
|
|
799
|
+
]
|
|
800
|
+
}
|
|
801
|
+
},
|
|
695
802
|
{
|
|
696
803
|
"version": "3.1.0",
|
|
697
804
|
"sections": {
|
|
@@ -762,6 +869,16 @@
|
|
|
762
869
|
}
|
|
763
870
|
],
|
|
764
871
|
"NumberInput": [
|
|
872
|
+
{
|
|
873
|
+
"version": "Unreleased",
|
|
874
|
+
"sections": {
|
|
875
|
+
"Added": [
|
|
876
|
+
"新增 `appearance` 属性(`InputAppearance`:`default` | `outline` | `no-background`),`outline` 背景默认/禁用对齐透明体系(`quaternary-background-default`),并通过 `::before` 镂空遮罩与 `@property` 渐变插值实现 `250ms ease` 平滑过渡(同步补齐默认悬浮规则与步进按钮过渡)。",
|
|
877
|
+
"新增 `numberStyle` 作为 `inputStyle` 的别名(`numberStyle ?? inputStyle`),两者同时传入时 `numberStyle` 优先;`inputStyle` 行为保持不变。",
|
|
878
|
+
"`leftBadge` / `rightBadge` 同步接入新版 `badge area` 规范(`text` + `large` + `lineHeightFix=\"off\"`,`default` 失焦 `light`/聚焦 `normal`,`outline`/`no-background` 始终 `normal`)。"
|
|
879
|
+
]
|
|
880
|
+
}
|
|
881
|
+
},
|
|
765
882
|
{
|
|
766
883
|
"version": "3.1.0",
|
|
767
884
|
"sections": {
|
|
@@ -828,6 +945,17 @@
|
|
|
828
945
|
}
|
|
829
946
|
],
|
|
830
947
|
"Popover": [
|
|
948
|
+
{
|
|
949
|
+
"version": "Unreleased",
|
|
950
|
+
"sections": {
|
|
951
|
+
"Fixed": [
|
|
952
|
+
"修复 `keepMounted` / `forceMount` 的浮层内容在打开首帧先播放退场动画导致的闪动:打开时同步写入 `data-state`。"
|
|
953
|
+
],
|
|
954
|
+
"Changed": [
|
|
955
|
+
"默认、主题与 tooltip 外观统一使用三层浮层阴影(`--popover-effect-shadow-ambient/near/border-*`,tooltip 外观消费 `--tooltip-effect-shadow-*`),移除默认外观的 1px 外轮廓;显式 `--popover-content-shadow` / `--tooltip-content-shadow` 覆盖仍优先。"
|
|
956
|
+
]
|
|
957
|
+
}
|
|
958
|
+
},
|
|
831
959
|
{
|
|
832
960
|
"version": "3.1.0",
|
|
833
961
|
"sections": {
|
|
@@ -922,6 +1050,14 @@
|
|
|
922
1050
|
}
|
|
923
1051
|
],
|
|
924
1052
|
"RadioGroup": [
|
|
1053
|
+
{
|
|
1054
|
+
"version": "Unreleased",
|
|
1055
|
+
"sections": {
|
|
1056
|
+
"Changed": [
|
|
1057
|
+
"未选中圆环改为 2px 渐变描边:外圆底色承担渐变边框,单层内圆白球在未选态撑满至距边缘 2px(`scale(1)`),选中时带弹性曲线平滑收缩为 8px 中心圆点(`scale(0.5)`)并同步浮现橙色高光表面。"
|
|
1058
|
+
]
|
|
1059
|
+
}
|
|
1060
|
+
},
|
|
925
1061
|
{
|
|
926
1062
|
"version": "3.1.0",
|
|
927
1063
|
"sections": {
|
|
@@ -971,6 +1107,17 @@
|
|
|
971
1107
|
}
|
|
972
1108
|
],
|
|
973
1109
|
"ScrollPicker": [
|
|
1110
|
+
{
|
|
1111
|
+
"version": "Unreleased",
|
|
1112
|
+
"sections": {
|
|
1113
|
+
"Fixed": [
|
|
1114
|
+
"提升 `.aviala-scroll-picker-column__clip-item.aviala-typography` 样式权重,避免被共享 `.aviala-typography--text` 覆盖导致中间选中项失去主题高亮色。"
|
|
1115
|
+
],
|
|
1116
|
+
"Changed": [
|
|
1117
|
+
"表面改用统一三层浮层阴影(`--scroll-picker-effect-shadow-ambient/near/border-*`),移除 1px 外边框;显式 `--scroll-picker-shadow` 覆盖仍优先。"
|
|
1118
|
+
]
|
|
1119
|
+
}
|
|
1120
|
+
},
|
|
974
1121
|
{
|
|
975
1122
|
"version": "3.1.0",
|
|
976
1123
|
"sections": {
|
|
@@ -1009,6 +1156,17 @@
|
|
|
1009
1156
|
}
|
|
1010
1157
|
],
|
|
1011
1158
|
"SegmentatorGroup": [
|
|
1159
|
+
{
|
|
1160
|
+
"version": "Unreleased",
|
|
1161
|
+
"sections": {
|
|
1162
|
+
"Added": [
|
|
1163
|
+
"新增 `appearance` 属性(`themed` / `normal`)对齐 Figma `Style`:默认 `themed` 保持原有高亮外观,`normal` 使用中性描边与浅色选中样式。",
|
|
1164
|
+
"`nested` 与 `tiled` 均支持 `normal`,消费 `--segmentator-button-*-normal-*` 组件 Token,并保留 `--segmentator-fg`、`--segmentator-selected-fg` 等 `--segmentator-*` 自定义覆盖入口。",
|
|
1165
|
+
"`nested` 模式静止时由轨道裁切内部阴影,拖拽期间通过 `data-unclipped=\"true\"` 解除裁切并呈现悬浮阴影;松手回落阶段先通过 `data-unclipped=\"settling\"` 在无裁切状态下将悬浮阴影淡出至透明,回落到位后再恢复轨道裁切并平滑淡入静止态内部阴影;`tiled` 模式在未溢出时保持外层阴影完整显示,溢出滚动行为保持不变。",
|
|
1166
|
+
"升级为 iOS 段落磁吸物理弹簧拖拽引擎(支持触控、手写笔与桌面鼠标拖拽):段内磁吸微位移阻力与标签/图标耦合视差跟随、跨段滞回判定与弹性跃迁、悬浮抬升阴影、Apple 橡皮筋边缘阻尼回弹、速度甩动预测落位、边缘自动跟随滚动,并修复横向溢出滚动时重复叠加 `scrollLeft` 导致的指示器错位问题。"
|
|
1167
|
+
]
|
|
1168
|
+
}
|
|
1169
|
+
},
|
|
1012
1170
|
{
|
|
1013
1171
|
"version": "3.1.0",
|
|
1014
1172
|
"sections": {
|
|
@@ -1091,6 +1249,23 @@
|
|
|
1091
1249
|
}
|
|
1092
1250
|
],
|
|
1093
1251
|
"Select": [
|
|
1252
|
+
{
|
|
1253
|
+
"version": "Unreleased",
|
|
1254
|
+
"sections": {
|
|
1255
|
+
"Changed": [
|
|
1256
|
+
"菜单表面改用统一三层浮层阴影(`--select-menu-effect-shadow-ambient/near/border-*`),移除 1px 外边框;子菜单浮层同步生效,显式 `--select-menu-shadow` 覆盖仍优先。",
|
|
1257
|
+
"梳理 `SelectItem` 功能变体:默认 `itemFunction` 改为 `\"radio\"`(选中显示 `SymbolRight` Medium),`\"checkbox\"` 改用 `SymbolRightCircle` Medium,`\"simple\"` 不渲染尾部图标,`\"action\"` 与 `SelectSubItem` 保留展开箭头;面板打开时不给已选中项套用悬浮背景,仅在真实 hover 或键盘导航(`html[data-aviala-kbd]`)时高亮。"
|
|
1258
|
+
]
|
|
1259
|
+
}
|
|
1260
|
+
},
|
|
1261
|
+
{
|
|
1262
|
+
"version": "3.2.0",
|
|
1263
|
+
"sections": {
|
|
1264
|
+
"Added": [
|
|
1265
|
+
"`SelectTrigger` 新增 `valueText`,菜单内容未挂载时也能在触发器上展示当前值文本;未传入时保持原有行为。"
|
|
1266
|
+
]
|
|
1267
|
+
}
|
|
1268
|
+
},
|
|
1094
1269
|
{
|
|
1095
1270
|
"version": "3.1.0",
|
|
1096
1271
|
"sections": {
|
|
@@ -1148,6 +1323,14 @@
|
|
|
1148
1323
|
}
|
|
1149
1324
|
],
|
|
1150
1325
|
"Slider": [
|
|
1326
|
+
{
|
|
1327
|
+
"version": "Unreleased",
|
|
1328
|
+
"sections": {
|
|
1329
|
+
"Changed": [
|
|
1330
|
+
"拇指阴影升级为三层:`--slider-size-thumb-shadow-1-*` / `--slider-color-thumb-shadow-1`、新增 `--slider-size-thumb-shadow-near-*` / `--slider-color-thumb-shadow-near` 近距层与 `--slider-size-thumb-shadow-2-*` / `--slider-color-thumb-shadow-2` 描边层;显式 `--slider-thumb-shadow` 覆盖仍优先。"
|
|
1331
|
+
]
|
|
1332
|
+
}
|
|
1333
|
+
},
|
|
1151
1334
|
{
|
|
1152
1335
|
"version": "3.1.0",
|
|
1153
1336
|
"sections": {
|
|
@@ -1352,6 +1535,18 @@
|
|
|
1352
1535
|
}
|
|
1353
1536
|
],
|
|
1354
1537
|
"ThemeProvider": [
|
|
1538
|
+
{
|
|
1539
|
+
"version": "Unreleased",
|
|
1540
|
+
"sections": {
|
|
1541
|
+
"Added": [
|
|
1542
|
+
"新增 defineTheme 帮助函数,支持主题包对象或 JSON 字符串,以及直接导入的基础发布 JSON。同步校验主题包与基础发布(ProjectRelease)的 projectId、version 和 contentHash,返回冻结的 DefinedTheme 对象。",
|
|
1543
|
+
"ThemeProvider 支持 theme 单主题与 themes + defaultThemeId 多主题注册表两种接入方式,theme/themes 与 project 互斥,重复 id、缺失 defaultThemeId 等错误在渲染期抛出。",
|
|
1544
|
+
"useTheme 新增 themeId、themes 与 setTheme;setTheme 切换注册表主题,未知 id 抛错,相同 id 不触发重渲染,活跃主题 id 通过 localStorage(`${storageKey}:theme`)持久化。",
|
|
1545
|
+
"主题模式下复用现有 project 管线:materializeTheme 物化后的项目走 applyProjectTheme、projectTarget 与弹层容器继承机制,亮暗、密度、效果切换行为与 project 模式一致。",
|
|
1546
|
+
"切换主题或更新相同 id 的主题包时,保留上一主题的 CSS,物化完成后同步更新 CSS 和 data-theme。配合 projectTarget 可将主题 CSS 作用域限定在局部容器。"
|
|
1547
|
+
]
|
|
1548
|
+
}
|
|
1549
|
+
},
|
|
1355
1550
|
{
|
|
1356
1551
|
"version": "3.1.0",
|
|
1357
1552
|
"sections": {
|
|
@@ -1370,6 +1565,17 @@
|
|
|
1370
1565
|
}
|
|
1371
1566
|
],
|
|
1372
1567
|
"TimePickerField": [
|
|
1568
|
+
{
|
|
1569
|
+
"version": "Unreleased",
|
|
1570
|
+
"sections": {
|
|
1571
|
+
"Fixed": [
|
|
1572
|
+
"点击浮层外部时不再把焦点强制移回触发器,关闭后焦点环随用户点击的位置正常释放;Esc 等键盘关闭仍会返回触发器。"
|
|
1573
|
+
],
|
|
1574
|
+
"Changed": [
|
|
1575
|
+
"时间菜单表面改用统一三层浮层阴影(`--time-picker-select-menu-effect-shadow-ambient/near/border-*`),移除 1px 外边框;显式 `--datepicker-panel-shadow` 覆盖仍优先。"
|
|
1576
|
+
]
|
|
1577
|
+
}
|
|
1578
|
+
},
|
|
1373
1579
|
{
|
|
1374
1580
|
"version": "3.1.0",
|
|
1375
1581
|
"sections": {
|
|
@@ -1418,6 +1624,18 @@
|
|
|
1418
1624
|
}
|
|
1419
1625
|
],
|
|
1420
1626
|
"Tooltip": [
|
|
1627
|
+
{
|
|
1628
|
+
"version": "Unreleased",
|
|
1629
|
+
"sections": {
|
|
1630
|
+
"Fixed": [
|
|
1631
|
+
"修复悬浮打开时提示先播放退场动画再播放入场动画导致的闪动:打开时同步写入 `data-state`,首帧即进入入场动画。",
|
|
1632
|
+
"修复 `OverlayArrowHost` 在 `side=\"left\"` / `side=\"right\"` 时清空 `style.top` 导致箭头纵向偏移错位的问题,保留定位层写入的沿边居中偏移。"
|
|
1633
|
+
],
|
|
1634
|
+
"Changed": [
|
|
1635
|
+
"表面改用统一三层浮层阴影(`--tooltip-effect-shadow-ambient/near/border-*`);显式 `--tooltip-content-shadow` 覆盖仍优先。"
|
|
1636
|
+
]
|
|
1637
|
+
}
|
|
1638
|
+
},
|
|
1421
1639
|
{
|
|
1422
1640
|
"version": "3.1.0",
|
|
1423
1641
|
"sections": {
|
|
@@ -1501,7 +1719,33 @@
|
|
|
1501
1719
|
}
|
|
1502
1720
|
}
|
|
1503
1721
|
],
|
|
1722
|
+
"Typography": [
|
|
1723
|
+
{
|
|
1724
|
+
"version": "Unreleased",
|
|
1725
|
+
"sections": {
|
|
1726
|
+
"Added": [
|
|
1727
|
+
"新增 `footnote` 字级(`TypographyLevel` 与 `typographyVariants`),消费 `--typography-footnote-size`(`--size-tiny`)/ `--typography-footnote-line-height`(`--line-height-tiny`)/ `--font-weight-regular`;白色 tone 复用 caption 白色前景 Token。"
|
|
1728
|
+
],
|
|
1729
|
+
"Changed": [
|
|
1730
|
+
"`title` 字级字号对齐 Figma `size-semilarge`(`--typography-title-size: var(--size-semilarge, 1.375rem)`,22px),文字与数字字重(`--typography-title-weight-text` / `--typography-title-weight-number`)统一为 `var(--font-weight-medium, 500)`,不再使用 semibold/bold。"
|
|
1731
|
+
]
|
|
1732
|
+
}
|
|
1733
|
+
}
|
|
1734
|
+
],
|
|
1504
1735
|
"Upload": [
|
|
1736
|
+
{
|
|
1737
|
+
"version": "Unreleased",
|
|
1738
|
+
"sections": {
|
|
1739
|
+
"Added": [
|
|
1740
|
+
"新增 `UploadList`(`variant`:`default` | `grouped`)与 `UploadListItem`(`status`:`uploading` | `success` | `error`),并从主入口导出。",
|
|
1741
|
+
"`UploadListItem` 支持 `fileName`、`description`/`meta`、`progress`、`actions` 或 `onRetry`/`onRemove`/`onPreview`;文件图标来自 `@aviala-design/icons`,标题与说明使用 Typography,uploading 态渲染 Progress 进度条,回调动作渲染 Button 图标按钮组。",
|
|
1742
|
+
"列表与列表项严格消费 `--upload-list-*` / `--upload-list-item-*` Token:grouped 卡片表面、分隔细线、内容留白与文字/图标配色;中英文 locale 新增 retry/remove/preview 标签。"
|
|
1743
|
+
],
|
|
1744
|
+
"Changed": [
|
|
1745
|
+
"`Upload` 交互态过渡动画(`250ms ease`)、`default` 样式的顶部高光渐变(`--button-color-primary-background-gradient-start/end`)以及 `large` 样式的 hover/active 填充色(`--button-color-tertiary-custom-background-hover/active`)均对齐 `Button`,并补充 `prefers-reduced-motion` 降级。"
|
|
1746
|
+
]
|
|
1747
|
+
}
|
|
1748
|
+
},
|
|
1505
1749
|
{
|
|
1506
1750
|
"version": "3.1.0",
|
|
1507
1751
|
"sections": {
|
|
@@ -1514,6 +1758,14 @@
|
|
|
1514
1758
|
}
|
|
1515
1759
|
],
|
|
1516
1760
|
"Video": [
|
|
1761
|
+
{
|
|
1762
|
+
"version": "Unreleased",
|
|
1763
|
+
"sections": {
|
|
1764
|
+
"Changed": [
|
|
1765
|
+
"`Light` 外观浮动控制栏背景接入 `--video-color-controls-background-light`(`whiteOnly @ 72%`),替换此前基于 `--video-color-controls-background` 的 72% 混色回退;保留 `--video-bar-light-bg` 与 `--video-bar-bg` 覆盖入口,Default 外观继续使用 `--video-color-controls-background`。"
|
|
1766
|
+
]
|
|
1767
|
+
}
|
|
1768
|
+
},
|
|
1517
1769
|
{
|
|
1518
1770
|
"version": "3.1.0",
|
|
1519
1771
|
"sections": {
|
package/dist/form.cjs
CHANGED
|
@@ -5,13 +5,14 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkJZOPCN75cjs = require('./chunk-JZOPCN75.cjs');
|
|
9
9
|
|
|
10
10
|
// src/components/form-field.tsx
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
var _icons = require('@aviala-design/icons');
|
|
15
|
+
var _field = require('@ui-sdk/react/field');
|
|
15
16
|
|
|
16
17
|
|
|
17
18
|
|
|
@@ -47,7 +48,7 @@ var FormFieldLayout = _react.forwardRef.call(void 0,
|
|
|
47
48
|
htmlFor,
|
|
48
49
|
className: "aviala-form__label aviala-form__label--control",
|
|
49
50
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
50
|
-
|
|
51
|
+
_chunkJZOPCN75cjs.Typeface,
|
|
51
52
|
{
|
|
52
53
|
id: labelId,
|
|
53
54
|
content: "textCaption",
|
|
@@ -60,7 +61,7 @@ var FormFieldLayout = _react.forwardRef.call(void 0,
|
|
|
60
61
|
)
|
|
61
62
|
}
|
|
62
63
|
) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
63
|
-
|
|
64
|
+
_chunkJZOPCN75cjs.Typeface,
|
|
64
65
|
{
|
|
65
66
|
id: labelId,
|
|
66
67
|
className: "aviala-form__label",
|
|
@@ -73,17 +74,18 @@ var FormFieldLayout = _react.forwardRef.call(void 0,
|
|
|
73
74
|
}
|
|
74
75
|
) : null;
|
|
75
76
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
76
|
-
|
|
77
|
+
_field.Field,
|
|
77
78
|
{
|
|
78
79
|
ref,
|
|
79
|
-
className:
|
|
80
|
+
className: _chunkJZOPCN75cjs.cn.call(void 0, "aviala-form", className),
|
|
80
81
|
"data-direction": direction,
|
|
81
82
|
"aria-labelledby": hasLabel ? labelId : void 0,
|
|
83
|
+
invalid,
|
|
82
84
|
...props,
|
|
83
85
|
children: [
|
|
84
86
|
labelNode,
|
|
85
87
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "aviala-form__content", children: [
|
|
86
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
88
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJZOPCN75cjs.FormFieldControlContext.Provider, { value: controlContext, children }),
|
|
87
89
|
error ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
88
90
|
"div",
|
|
89
91
|
{
|
|
@@ -100,7 +102,7 @@ var FormFieldLayout = _react.forwardRef.call(void 0,
|
|
|
100
102
|
}
|
|
101
103
|
),
|
|
102
104
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
103
|
-
|
|
105
|
+
_chunkJZOPCN75cjs.Typography,
|
|
104
106
|
{
|
|
105
107
|
level: "caption",
|
|
106
108
|
as: "p",
|
|
@@ -122,7 +124,7 @@ var FormFieldLayout = _react.forwardRef.call(void 0,
|
|
|
122
124
|
}
|
|
123
125
|
),
|
|
124
126
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
125
|
-
|
|
127
|
+
_chunkJZOPCN75cjs.Typography,
|
|
126
128
|
{
|
|
127
129
|
level: "caption",
|
|
128
130
|
as: "p",
|
|
@@ -183,5 +185,5 @@ var Form = _reacthookform.FormProvider;
|
|
|
183
185
|
|
|
184
186
|
|
|
185
187
|
|
|
186
|
-
exports.Form = Form; exports.FormField = FormField; exports.useResolvedControlError =
|
|
188
|
+
exports.Form = Form; exports.FormField = FormField; exports.useResolvedControlError = _chunkJZOPCN75cjs.useResolvedControlError;
|
|
187
189
|
//# sourceMappingURL=form.cjs.map
|
package/dist/form.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/developer-kit/developer-kit/packages/ui/dist/form.cjs","../src/components/form-field.tsx"],"names":[],"mappings":"AAAA,6rBAAY;AACZ;AACE;AACA;AACA;AACA;AACA;AACF,wDAA6B;AA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AA,oBAAA;AAAA,sBAAA;AACO,sBAAA;AACH,sBAAA;AACO,sBAAA;AAET,oBAAA;AACH,kBAAA;AAAA,gBAAA;AAAA,cAAA;AAEA,YAAA;AAEF,YAAA;AACE,8BAAA;AAAC,gBAAA;AAAA,gBAAA;AACC,kBAAA;AACA,kBAAA;AACA,kBAAA;AACA,kBAAA;AAAW,gBAAA;AACb,cAAA;AACA,8BAAA;AAAC,gBAAA;AAAA,gBAAA;AACC,kBAAA;AACA,kBAAA;AACA,kBAAA;AAEC,kBAAA;AAAA,gBAAA;AACH,cAAA;AAEA,YAAA;AACK,YAAA;AACX,UAAA;AAAA,QAAA;AAAA,MAAA;AACF,IAAA;AAEJ,EAAA;AACF;AACgB;AAEV;AAKF,EAAA;AACE,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACG,IAAA;AAGF,EAAA;AACc,IAAA;AACF,IAAA;AACb,MAAA;AACA,MAAA;AACA,MAAA;AACA,MAAA;AACA,MAAA;AACA,MAAA;AACD,IAAA;AAEC,IAAA;AAGA,IAAA;AAIJ,EAAA;AACF;AACoB;AAEX;AAIO,EAAA;AAEhB;AAEsB;AACJ,EAAA;AACV,IAAA;AACK,MAAA;AACT,IAAA;AACO,IAAA;AACT,EAAA;AACF;AA6ByB;AASf;AAGU;ADpIC;AACA;AACA;AACA;AACA","file":"/home/runner/work/developer-kit/developer-kit/packages/ui/dist/form.cjs","sourcesContent":[null,"import {\n SymbolInformationCircle,\n SymbolWrongCircle,\n} from \"@aviala-design/icons\";\nimport {\n forwardRef,\n useId,\n useMemo,\n type HTMLAttributes,\n type ReactElement,\n type ReactNode,\n type Ref,\n} from \"react\";\nimport {\n FormProvider,\n useController,\n type Control,\n type ControllerFieldState,\n type ControllerRenderProps,\n type FieldPath,\n type FieldValues,\n type UseControllerProps,\n type UseFormStateReturn,\n} from \"react-hook-form\";\nimport { cn } from \"../lib/utils\";\nimport { FormFieldControlContext } from \"./form-field-context\";\nimport { Typeface } from \"./typeface\";\nimport { Typography } from \"./typography\";\n\n/** Figma Components → System Composition → Form (527:57461 / 527:57641) */\nexport type FormFieldDirection = \"vertical\" | \"horizontal\";\n\nexport { useResolvedControlError } from \"./form-field-context\";\n\n/** Layout mode — the original props-driven wrapper */\nexport type FormFieldLayoutProps = HTMLAttributes<HTMLDivElement> & {\n label?: ReactNode;\n htmlFor?: string;\n description?: ReactNode;\n error?: ReactNode;\n info?: ReactNode;\n /** Optional Alert / Feedback under the control */\n alert?: ReactNode;\n required?: boolean;\n /** Figma `Direction` — vertical stacks label above control; horizontal places label beside */\n direction?: FormFieldDirection;\n children?: ReactNode;\n};\n\n/** Render arguments passed to `render` in react-hook-form mode */\nexport type FormFieldRenderProps<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> = {\n field: ControllerRenderProps<TFieldValues, TName>;\n fieldState: ControllerFieldState;\n formState: UseFormStateReturn<TFieldValues>;\n /**\n * Auto-generated control id. The field label is already wired to it via\n * `htmlFor` — pass it to the underlying input (`<Input id={id} />`).\n */\n id: string;\n};\n\n/**\n * react-hook-form mode — bind the field to a form via `name` (+ optional\n * `control`; falls back to the surrounding `<Form>` context). Validation\n * errors from the resolver (zod etc.) are rendered automatically unless the\n * `error` prop overrides them. Nested controls inherit the invalid state via\n * context unless they set an explicit `error` prop.\n */\nexport type FormFieldControlledProps<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> = Omit<FormFieldLayoutProps, \"children\" | \"htmlFor\"> &\n Pick<\n UseControllerProps<TFieldValues, TName>,\n \"rules\" | \"defaultValue\" | \"shouldUnregister\" | \"disabled\"\n > & {\n name: TName;\n control?: Control<TFieldValues>;\n render: (props: FormFieldRenderProps<TFieldValues, TName>) => ReactNode;\n /** Overrides the validation error message shown under the control */\n error?: ReactNode;\n };\n\nexport type FormFieldProps<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> = FormFieldLayoutProps | FormFieldControlledProps<TFieldValues, TName>;\n\nconst FormFieldLayout = forwardRef<HTMLDivElement, FormFieldLayoutProps>(\n (\n {\n className,\n label,\n htmlFor,\n description,\n error,\n info,\n alert,\n required,\n direction = \"vertical\",\n children,\n ...props\n },\n ref\n ) => {\n const reactId = useId();\n const labelId = `${reactId}-label`;\n const hasLabel = label != null && label !== \"\";\n const invalid = Boolean(error);\n const controlContext = useMemo(() => ({ invalid }), [invalid]);\n const labelNode =\n hasLabel || description ? (\n htmlFor ? (\n <label\n htmlFor={htmlFor}\n className=\"aviala-form__label aviala-form__label--control\"\n >\n <Typeface\n id={labelId}\n content=\"textCaption\"\n primary={\n hasLabel ? (\n <>\n {label}\n {required ? (\n <span className=\"aviala-form__required\" aria-hidden>\n *\n </span>\n ) : null}\n </>\n ) : undefined\n }\n secondary={description}\n />\n </label>\n ) : (\n <Typeface\n id={labelId}\n className=\"aviala-form__label\"\n content=\"textCaption\"\n primary={\n hasLabel ? (\n <>\n {label}\n {required ? (\n <span className=\"aviala-form__required\" aria-hidden>\n *\n </span>\n ) : null}\n </>\n ) : undefined\n }\n secondary={description}\n />\n )\n ) : null;\n\n return (\n <div\n ref={ref}\n className={cn(\"aviala-form\", className)}\n data-direction={direction}\n aria-labelledby={hasLabel ? labelId : undefined}\n {...props}\n >\n {labelNode}\n <div className=\"aviala-form__content\">\n <FormFieldControlContext.Provider value={controlContext}>\n {children}\n </FormFieldControlContext.Provider>\n {error ? (\n <div\n className=\"aviala-form__message aviala-form__message--error\"\n role=\"alert\"\n >\n <SymbolWrongCircle\n className=\"aviala-form__message-icon\"\n width={14}\n height={14}\n aria-hidden\n />\n <Typography\n level=\"caption\"\n as=\"p\"\n className=\"aviala-form__message-text\"\n >\n {error}\n </Typography>\n </div>\n ) : null}\n {info ? (\n <div className=\"aviala-form__message aviala-form__message--info\">\n <SymbolInformationCircle\n className=\"aviala-form__message-icon\"\n width={14}\n height={14}\n aria-hidden\n />\n <Typography\n level=\"caption\"\n as=\"p\"\n className=\"aviala-form__message-text\"\n >\n {info}\n </Typography>\n </div>\n ) : null}\n {alert ? <div className=\"aviala-form__alert\">{alert}</div> : null}\n </div>\n </div>\n );\n }\n);\nFormFieldLayout.displayName = \"FormFieldLayout\";\n\nconst FormFieldControlled = forwardRef<\n HTMLDivElement,\n FormFieldControlledProps\n>(\n (\n {\n control,\n name,\n rules,\n defaultValue,\n shouldUnregister,\n disabled,\n render,\n error,\n ...layoutProps\n },\n ref\n ) => {\n const id = useId();\n const { field, fieldState, formState } = useController({\n name,\n control,\n rules,\n defaultValue,\n shouldUnregister,\n disabled,\n });\n const message =\n error !== undefined ? error : (fieldState.error?.message ?? null);\n\n return (\n <FormFieldLayout ref={ref} {...layoutProps} htmlFor={id} error={message}>\n {render({ field, fieldState, formState, id })}\n </FormFieldLayout>\n );\n }\n);\nFormFieldControlled.displayName = \"FormFieldControlled\";\n\nfunction isControlledProps(\n props: FormFieldProps\n): props is FormFieldControlledProps {\n return (\n \"render\" in props && typeof props.render === \"function\" && \"name\" in props\n );\n}\n\nconst FormFieldRoot = forwardRef<HTMLDivElement, FormFieldProps>(\n (props, ref) => {\n if (isControlledProps(props)) {\n return <FormFieldControlled ref={ref} {...props} />;\n }\n return <FormFieldLayout ref={ref} {...props} />;\n }\n);\n\n/**\n * FormField — layout wrapper around a form control, or a react-hook-form\n * bound field when given `name` + `render` (shadcn-style).\n *\n * When an error tip is shown, nested Spiral controls that support `error`\n * (Input, Textarea, SelectTrigger, …) inherit the invalid state unless they\n * set an explicit `error` prop.\n *\n * @example Layout mode\n * <FormField label=\"Email\" htmlFor=\"email\" error=\"Required\">\n * <Input id=\"email\" />\n * </FormField>\n *\n * @example react-hook-form + zod mode\n * <Form {...form}>\n * <form onSubmit={form.handleSubmit(onSubmit)}>\n * <FormField\n * control={form.control}\n * name=\"email\"\n * label=\"Email\"\n * render={({ field, id }) => (\n * <Input id={id} {...field} />\n * )}\n * />\n * </form>\n * </Form>\n */\nexport const FormField = FormFieldRoot as {\n <\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n >(\n props: FormFieldProps<TFieldValues, TName> & { ref?: Ref<HTMLDivElement> }\n ): ReactElement | null;\n displayName?: string;\n};\nFormField.displayName = \"FormField\";\n\n/** Alias of react-hook-form's FormProvider — wrap your form with it (shadcn-style `<Form {...form}>`) */\nexport const Form = FormProvider;\n"]}
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/developer-kit/developer-kit/packages/ui/dist/form.cjs","../src/components/form-field.tsx"],"names":[],"mappings":"AAAA,6rBAAY;AACZ;AACE;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACA;ACTA;AACE;AACA;AAAA,6CACK;AACP,4CAAsB;AACtB;AACE;AACA;AACA;AAAA,8BAKK;AACP;AACE;AACA;AAAA,gDAQK;AAsGW,+CAAA;AAlClB,IAAM,gBAAA,EAAkB,+BAAA;AAAA,EACtB,CACE;AAAA,IACE,SAAA;AAAA,IACA,KAAA;AAAA,IACA,OAAA;AAAA,IACA,WAAA;AAAA,IACA,KAAA;AAAA,IACA,IAAA;AAAA,IACA,KAAA;AAAA,IACA,QAAA;AAAA,IACA,UAAA,EAAY,UAAA;AAAA,IACZ,QAAA;AAAA,IACA,GAAG;AAAA,EACL,CAAA,EACA,GAAA,EAAA,GACG;AACH,IAAA,MAAM,QAAA,EAAU,0BAAA,CAAM;AACtB,IAAA,MAAM,QAAA,EAAU,CAAA,EAAA;AACC,IAAA;AACD,IAAA;AACV,IAAA;AACA,IAAA;AAGC,MAAA;AAAA,MAAA;AACC,QAAA;AACU,QAAA;AAEV,QAAA;AAAC,UAAA;AAAA,UAAA;AACK,YAAA;AACI,YAAA;AAEN,YAAA;AAEK,cAAA;AACA,cAAA;AAMD,YAAA;AAEN,YAAA;AAAW,UAAA;AACb,QAAA;AAAA,MAAA;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;AACoB;AAEX;AAIO,EAAA;AAEhB;AAEsB;AACJ,EAAA;AACV,IAAA;AACK,MAAA;AACT,IAAA;AACO,IAAA;AACT,EAAA;AACF;AA6ByB;AASf;AAGU;ADpIC;AACA;AACA;AACA;AACA","file":"/home/runner/work/developer-kit/developer-kit/packages/ui/dist/form.cjs","sourcesContent":[null,"import {\n SymbolInformationCircle,\n SymbolWrongCircle,\n} from \"@aviala-design/icons\";\nimport { Field } from \"@ui-sdk/react/field\";\nimport {\n forwardRef,\n useId,\n useMemo,\n type HTMLAttributes,\n type ReactElement,\n type ReactNode,\n type Ref,\n} from \"react\";\nimport {\n FormProvider,\n useController,\n type Control,\n type ControllerFieldState,\n type ControllerRenderProps,\n type FieldPath,\n type FieldValues,\n type UseControllerProps,\n type UseFormStateReturn,\n} from \"react-hook-form\";\nimport { cn } from \"../lib/utils\";\nimport { FormFieldControlContext } from \"./form-field-context\";\nimport { Typeface } from \"./typeface\";\nimport { Typography } from \"./typography\";\n\n/** Figma Components → System Composition → Form (527:57461 / 527:57641) */\nexport type FormFieldDirection = \"vertical\" | \"horizontal\";\n\nexport { useResolvedControlError } from \"./form-field-context\";\n\n/** Layout mode — the original props-driven wrapper */\nexport type FormFieldLayoutProps = HTMLAttributes<HTMLDivElement> & {\n label?: ReactNode;\n htmlFor?: string;\n description?: ReactNode;\n error?: ReactNode;\n info?: ReactNode;\n /** Optional Alert / Feedback under the control */\n alert?: ReactNode;\n required?: boolean;\n /** Figma `Direction` — vertical stacks label above control; horizontal places label beside */\n direction?: FormFieldDirection;\n children?: ReactNode;\n};\n\n/** Render arguments passed to `render` in react-hook-form mode */\nexport type FormFieldRenderProps<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> = {\n field: ControllerRenderProps<TFieldValues, TName>;\n fieldState: ControllerFieldState;\n formState: UseFormStateReturn<TFieldValues>;\n /**\n * Auto-generated control id. The field label is already wired to it via\n * `htmlFor` — pass it to the underlying input (`<Input id={id} />`).\n */\n id: string;\n};\n\n/**\n * react-hook-form mode — bind the field to a form via `name` (+ optional\n * `control`; falls back to the surrounding `<Form>` context). Validation\n * errors from the resolver (zod etc.) are rendered automatically unless the\n * `error` prop overrides them. Nested controls inherit the invalid state via\n * context unless they set an explicit `error` prop.\n */\nexport type FormFieldControlledProps<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> = Omit<FormFieldLayoutProps, \"children\" | \"htmlFor\"> &\n Pick<\n UseControllerProps<TFieldValues, TName>,\n \"rules\" | \"defaultValue\" | \"shouldUnregister\" | \"disabled\"\n > & {\n name: TName;\n control?: Control<TFieldValues>;\n render: (props: FormFieldRenderProps<TFieldValues, TName>) => ReactNode;\n /** Overrides the validation error message shown under the control */\n error?: ReactNode;\n };\n\nexport type FormFieldProps<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> = FormFieldLayoutProps | FormFieldControlledProps<TFieldValues, TName>;\n\nconst FormFieldLayout = forwardRef<HTMLDivElement, FormFieldLayoutProps>(\n (\n {\n className,\n label,\n htmlFor,\n description,\n error,\n info,\n alert,\n required,\n direction = \"vertical\",\n children,\n ...props\n },\n ref\n ) => {\n const reactId = useId();\n const labelId = `${reactId}-label`;\n const hasLabel = label != null && label !== \"\";\n const invalid = Boolean(error);\n const controlContext = useMemo(() => ({ invalid }), [invalid]);\n const labelNode =\n hasLabel || description ? (\n htmlFor ? (\n <label\n htmlFor={htmlFor}\n className=\"aviala-form__label aviala-form__label--control\"\n >\n <Typeface\n id={labelId}\n content=\"textCaption\"\n primary={\n hasLabel ? (\n <>\n {label}\n {required ? (\n <span className=\"aviala-form__required\" aria-hidden>\n *\n </span>\n ) : null}\n </>\n ) : undefined\n }\n secondary={description}\n />\n </label>\n ) : (\n <Typeface\n id={labelId}\n className=\"aviala-form__label\"\n content=\"textCaption\"\n primary={\n hasLabel ? (\n <>\n {label}\n {required ? (\n <span className=\"aviala-form__required\" aria-hidden>\n *\n </span>\n ) : null}\n </>\n ) : undefined\n }\n secondary={description}\n />\n )\n ) : null;\n\n return (\n <Field\n ref={ref}\n className={cn(\"aviala-form\", className)}\n data-direction={direction}\n aria-labelledby={hasLabel ? labelId : undefined}\n invalid={invalid}\n {...props}\n >\n {labelNode}\n <div className=\"aviala-form__content\">\n <FormFieldControlContext.Provider value={controlContext}>\n {children}\n </FormFieldControlContext.Provider>\n {error ? (\n <div\n className=\"aviala-form__message aviala-form__message--error\"\n role=\"alert\"\n >\n <SymbolWrongCircle\n className=\"aviala-form__message-icon\"\n width={14}\n height={14}\n aria-hidden\n />\n <Typography\n level=\"caption\"\n as=\"p\"\n className=\"aviala-form__message-text\"\n >\n {error}\n </Typography>\n </div>\n ) : null}\n {info ? (\n <div className=\"aviala-form__message aviala-form__message--info\">\n <SymbolInformationCircle\n className=\"aviala-form__message-icon\"\n width={14}\n height={14}\n aria-hidden\n />\n <Typography\n level=\"caption\"\n as=\"p\"\n className=\"aviala-form__message-text\"\n >\n {info}\n </Typography>\n </div>\n ) : null}\n {alert ? <div className=\"aviala-form__alert\">{alert}</div> : null}\n </div>\n </Field>\n );\n }\n);\nFormFieldLayout.displayName = \"FormFieldLayout\";\n\nconst FormFieldControlled = forwardRef<\n HTMLDivElement,\n FormFieldControlledProps\n>(\n (\n {\n control,\n name,\n rules,\n defaultValue,\n shouldUnregister,\n disabled,\n render,\n error,\n ...layoutProps\n },\n ref\n ) => {\n const id = useId();\n const { field, fieldState, formState } = useController({\n name,\n control,\n rules,\n defaultValue,\n shouldUnregister,\n disabled,\n });\n const message =\n error !== undefined ? error : (fieldState.error?.message ?? null);\n\n return (\n <FormFieldLayout ref={ref} {...layoutProps} htmlFor={id} error={message}>\n {render({ field, fieldState, formState, id })}\n </FormFieldLayout>\n );\n }\n);\nFormFieldControlled.displayName = \"FormFieldControlled\";\n\nfunction isControlledProps(\n props: FormFieldProps\n): props is FormFieldControlledProps {\n return (\n \"render\" in props && typeof props.render === \"function\" && \"name\" in props\n );\n}\n\nconst FormFieldRoot = forwardRef<HTMLDivElement, FormFieldProps>(\n (props, ref) => {\n if (isControlledProps(props)) {\n return <FormFieldControlled ref={ref} {...props} />;\n }\n return <FormFieldLayout ref={ref} {...props} />;\n }\n);\n\n/**\n * FormField — layout wrapper around a form control, or a react-hook-form\n * bound field when given `name` + `render` (shadcn-style).\n *\n * When an error tip is shown, nested Spiral controls that support `error`\n * (Input, Textarea, SelectTrigger, …) inherit the invalid state unless they\n * set an explicit `error` prop.\n *\n * @example Layout mode\n * <FormField label=\"Email\" htmlFor=\"email\" error=\"Required\">\n * <Input id=\"email\" />\n * </FormField>\n *\n * @example react-hook-form + zod mode\n * <Form {...form}>\n * <form onSubmit={form.handleSubmit(onSubmit)}>\n * <FormField\n * control={form.control}\n * name=\"email\"\n * label=\"Email\"\n * render={({ field, id }) => (\n * <Input id={id} {...field} />\n * )}\n * />\n * </form>\n * </Form>\n */\nexport const FormField = FormFieldRoot as {\n <\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n >(\n props: FormFieldProps<TFieldValues, TName> & { ref?: Ref<HTMLDivElement> }\n ): ReactElement | null;\n displayName?: string;\n};\nFormField.displayName = \"FormField\";\n\n/** Alias of react-hook-form's FormProvider — wrap your form with it (shadcn-style `<Form {...form}>`) */\nexport const Form = FormProvider;\n"]}
|
package/dist/form.js
CHANGED
|
@@ -5,13 +5,14 @@ import {
|
|
|
5
5
|
Typography,
|
|
6
6
|
cn,
|
|
7
7
|
useResolvedControlError
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-NUOJ7QVZ.js";
|
|
9
9
|
|
|
10
10
|
// src/components/form-field.tsx
|
|
11
11
|
import {
|
|
12
12
|
SymbolInformationCircle,
|
|
13
13
|
SymbolWrongCircle
|
|
14
14
|
} from "@aviala-design/icons";
|
|
15
|
+
import { Field } from "@ui-sdk/react/field";
|
|
15
16
|
import {
|
|
16
17
|
forwardRef,
|
|
17
18
|
useId,
|
|
@@ -73,12 +74,13 @@ var FormFieldLayout = forwardRef(
|
|
|
73
74
|
}
|
|
74
75
|
) : null;
|
|
75
76
|
return /* @__PURE__ */ jsxs(
|
|
76
|
-
|
|
77
|
+
Field,
|
|
77
78
|
{
|
|
78
79
|
ref,
|
|
79
80
|
className: cn("aviala-form", className),
|
|
80
81
|
"data-direction": direction,
|
|
81
82
|
"aria-labelledby": hasLabel ? labelId : void 0,
|
|
83
|
+
invalid,
|
|
82
84
|
...props,
|
|
83
85
|
children: [
|
|
84
86
|
labelNode,
|
package/dist/form.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/form-field.tsx"],"sourcesContent":["import {\n SymbolInformationCircle,\n SymbolWrongCircle,\n} from \"@aviala-design/icons\";\nimport {\n forwardRef,\n useId,\n useMemo,\n type HTMLAttributes,\n type ReactElement,\n type ReactNode,\n type Ref,\n} from \"react\";\nimport {\n FormProvider,\n useController,\n type Control,\n type ControllerFieldState,\n type ControllerRenderProps,\n type FieldPath,\n type FieldValues,\n type UseControllerProps,\n type UseFormStateReturn,\n} from \"react-hook-form\";\nimport { cn } from \"../lib/utils\";\nimport { FormFieldControlContext } from \"./form-field-context\";\nimport { Typeface } from \"./typeface\";\nimport { Typography } from \"./typography\";\n\n/** Figma Components → System Composition → Form (527:57461 / 527:57641) */\nexport type FormFieldDirection = \"vertical\" | \"horizontal\";\n\nexport { useResolvedControlError } from \"./form-field-context\";\n\n/** Layout mode — the original props-driven wrapper */\nexport type FormFieldLayoutProps = HTMLAttributes<HTMLDivElement> & {\n label?: ReactNode;\n htmlFor?: string;\n description?: ReactNode;\n error?: ReactNode;\n info?: ReactNode;\n /** Optional Alert / Feedback under the control */\n alert?: ReactNode;\n required?: boolean;\n /** Figma `Direction` — vertical stacks label above control; horizontal places label beside */\n direction?: FormFieldDirection;\n children?: ReactNode;\n};\n\n/** Render arguments passed to `render` in react-hook-form mode */\nexport type FormFieldRenderProps<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> = {\n field: ControllerRenderProps<TFieldValues, TName>;\n fieldState: ControllerFieldState;\n formState: UseFormStateReturn<TFieldValues>;\n /**\n * Auto-generated control id. The field label is already wired to it via\n * `htmlFor` — pass it to the underlying input (`<Input id={id} />`).\n */\n id: string;\n};\n\n/**\n * react-hook-form mode — bind the field to a form via `name` (+ optional\n * `control`; falls back to the surrounding `<Form>` context). Validation\n * errors from the resolver (zod etc.) are rendered automatically unless the\n * `error` prop overrides them. Nested controls inherit the invalid state via\n * context unless they set an explicit `error` prop.\n */\nexport type FormFieldControlledProps<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> = Omit<FormFieldLayoutProps, \"children\" | \"htmlFor\"> &\n Pick<\n UseControllerProps<TFieldValues, TName>,\n \"rules\" | \"defaultValue\" | \"shouldUnregister\" | \"disabled\"\n > & {\n name: TName;\n control?: Control<TFieldValues>;\n render: (props: FormFieldRenderProps<TFieldValues, TName>) => ReactNode;\n /** Overrides the validation error message shown under the control */\n error?: ReactNode;\n };\n\nexport type FormFieldProps<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> = FormFieldLayoutProps | FormFieldControlledProps<TFieldValues, TName>;\n\nconst FormFieldLayout = forwardRef<HTMLDivElement, FormFieldLayoutProps>(\n (\n {\n className,\n label,\n htmlFor,\n description,\n error,\n info,\n alert,\n required,\n direction = \"vertical\",\n children,\n ...props\n },\n ref\n ) => {\n const reactId = useId();\n const labelId = `${reactId}-label`;\n const hasLabel = label != null && label !== \"\";\n const invalid = Boolean(error);\n const controlContext = useMemo(() => ({ invalid }), [invalid]);\n const labelNode =\n hasLabel || description ? (\n htmlFor ? (\n <label\n htmlFor={htmlFor}\n className=\"aviala-form__label aviala-form__label--control\"\n >\n <Typeface\n id={labelId}\n content=\"textCaption\"\n primary={\n hasLabel ? (\n <>\n {label}\n {required ? (\n <span className=\"aviala-form__required\" aria-hidden>\n *\n </span>\n ) : null}\n </>\n ) : undefined\n }\n secondary={description}\n />\n </label>\n ) : (\n <Typeface\n id={labelId}\n className=\"aviala-form__label\"\n content=\"textCaption\"\n primary={\n hasLabel ? (\n <>\n {label}\n {required ? (\n <span className=\"aviala-form__required\" aria-hidden>\n *\n </span>\n ) : null}\n </>\n ) : undefined\n }\n secondary={description}\n />\n )\n ) : null;\n\n return (\n <div\n ref={ref}\n className={cn(\"aviala-form\", className)}\n data-direction={direction}\n aria-labelledby={hasLabel ? labelId : undefined}\n {...props}\n >\n {labelNode}\n <div className=\"aviala-form__content\">\n <FormFieldControlContext.Provider value={controlContext}>\n {children}\n </FormFieldControlContext.Provider>\n {error ? (\n <div\n className=\"aviala-form__message aviala-form__message--error\"\n role=\"alert\"\n >\n <SymbolWrongCircle\n className=\"aviala-form__message-icon\"\n width={14}\n height={14}\n aria-hidden\n />\n <Typography\n level=\"caption\"\n as=\"p\"\n className=\"aviala-form__message-text\"\n >\n {error}\n </Typography>\n </div>\n ) : null}\n {info ? (\n <div className=\"aviala-form__message aviala-form__message--info\">\n <SymbolInformationCircle\n className=\"aviala-form__message-icon\"\n width={14}\n height={14}\n aria-hidden\n />\n <Typography\n level=\"caption\"\n as=\"p\"\n className=\"aviala-form__message-text\"\n >\n {info}\n </Typography>\n </div>\n ) : null}\n {alert ? <div className=\"aviala-form__alert\">{alert}</div> : null}\n </div>\n </div>\n );\n }\n);\nFormFieldLayout.displayName = \"FormFieldLayout\";\n\nconst FormFieldControlled = forwardRef<\n HTMLDivElement,\n FormFieldControlledProps\n>(\n (\n {\n control,\n name,\n rules,\n defaultValue,\n shouldUnregister,\n disabled,\n render,\n error,\n ...layoutProps\n },\n ref\n ) => {\n const id = useId();\n const { field, fieldState, formState } = useController({\n name,\n control,\n rules,\n defaultValue,\n shouldUnregister,\n disabled,\n });\n const message =\n error !== undefined ? error : (fieldState.error?.message ?? null);\n\n return (\n <FormFieldLayout ref={ref} {...layoutProps} htmlFor={id} error={message}>\n {render({ field, fieldState, formState, id })}\n </FormFieldLayout>\n );\n }\n);\nFormFieldControlled.displayName = \"FormFieldControlled\";\n\nfunction isControlledProps(\n props: FormFieldProps\n): props is FormFieldControlledProps {\n return (\n \"render\" in props && typeof props.render === \"function\" && \"name\" in props\n );\n}\n\nconst FormFieldRoot = forwardRef<HTMLDivElement, FormFieldProps>(\n (props, ref) => {\n if (isControlledProps(props)) {\n return <FormFieldControlled ref={ref} {...props} />;\n }\n return <FormFieldLayout ref={ref} {...props} />;\n }\n);\n\n/**\n * FormField — layout wrapper around a form control, or a react-hook-form\n * bound field when given `name` + `render` (shadcn-style).\n *\n * When an error tip is shown, nested Spiral controls that support `error`\n * (Input, Textarea, SelectTrigger, …) inherit the invalid state unless they\n * set an explicit `error` prop.\n *\n * @example Layout mode\n * <FormField label=\"Email\" htmlFor=\"email\" error=\"Required\">\n * <Input id=\"email\" />\n * </FormField>\n *\n * @example react-hook-form + zod mode\n * <Form {...form}>\n * <form onSubmit={form.handleSubmit(onSubmit)}>\n * <FormField\n * control={form.control}\n * name=\"email\"\n * label=\"Email\"\n * render={({ field, id }) => (\n * <Input id={id} {...field} />\n * )}\n * />\n * </form>\n * </Form>\n */\nexport const FormField = FormFieldRoot as {\n <\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n >(\n props: FormFieldProps<TFieldValues, TName> & { ref?: Ref<HTMLDivElement> }\n ): ReactElement | null;\n displayName?: string;\n};\nFormField.displayName = \"FormField\";\n\n/** Alias of react-hook-form's FormProvider — wrap your form with it (shadcn-style `<Form {...form}>`) */\nexport const Form = FormProvider;\n"],"mappings":";;;;;;;;;;AAAA;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAKK;AAC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AO,YAAY,WAAW,GAAG,CAAC,GAC9C;AAAA,EAEJ;AACF;AACA,oBAAoB,cAAc;AAElC,SAAS,kBACP,OACmC;AACnC,SACE,YAAY,SAAS,OAAO,MAAM,WAAW,cAAc,UAAU;AAEzE;AAEA,IAAM,gBAAgB;AAAA,EACpB,CAAC,OAAO,QAAQ;AACd,QAAI,kBAAkB,KAAK,GAAG;AAC5B,aAAO,oBAAC,uBAAoB,KAAW,GAAG,OAAO;AAAA,IACnD;AACA,WAAO,oBAAC,mBAAgB,KAAW,GAAG,OAAO;AAAA,EAC/C;AACF;AA6BO,IAAM,YAAY;AASzB,UAAU,cAAc;AAGjB,IAAM,OAAO;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/components/form-field.tsx"],"sourcesContent":["import {\n SymbolInformationCircle,\n SymbolWrongCircle,\n} from \"@aviala-design/icons\";\nimport { Field } from \"@ui-sdk/react/field\";\nimport {\n forwardRef,\n useId,\n useMemo,\n type HTMLAttributes,\n type ReactElement,\n type ReactNode,\n type Ref,\n} from \"react\";\nimport {\n FormProvider,\n useController,\n type Control,\n type ControllerFieldState,\n type ControllerRenderProps,\n type FieldPath,\n type FieldValues,\n type UseControllerProps,\n type UseFormStateReturn,\n} from \"react-hook-form\";\nimport { cn } from \"../lib/utils\";\nimport { FormFieldControlContext } from \"./form-field-context\";\nimport { Typeface } from \"./typeface\";\nimport { Typography } from \"./typography\";\n\n/** Figma Components → System Composition → Form (527:57461 / 527:57641) */\nexport type FormFieldDirection = \"vertical\" | \"horizontal\";\n\nexport { useResolvedControlError } from \"./form-field-context\";\n\n/** Layout mode — the original props-driven wrapper */\nexport type FormFieldLayoutProps = HTMLAttributes<HTMLDivElement> & {\n label?: ReactNode;\n htmlFor?: string;\n description?: ReactNode;\n error?: ReactNode;\n info?: ReactNode;\n /** Optional Alert / Feedback under the control */\n alert?: ReactNode;\n required?: boolean;\n /** Figma `Direction` — vertical stacks label above control; horizontal places label beside */\n direction?: FormFieldDirection;\n children?: ReactNode;\n};\n\n/** Render arguments passed to `render` in react-hook-form mode */\nexport type FormFieldRenderProps<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> = {\n field: ControllerRenderProps<TFieldValues, TName>;\n fieldState: ControllerFieldState;\n formState: UseFormStateReturn<TFieldValues>;\n /**\n * Auto-generated control id. The field label is already wired to it via\n * `htmlFor` — pass it to the underlying input (`<Input id={id} />`).\n */\n id: string;\n};\n\n/**\n * react-hook-form mode — bind the field to a form via `name` (+ optional\n * `control`; falls back to the surrounding `<Form>` context). Validation\n * errors from the resolver (zod etc.) are rendered automatically unless the\n * `error` prop overrides them. Nested controls inherit the invalid state via\n * context unless they set an explicit `error` prop.\n */\nexport type FormFieldControlledProps<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> = Omit<FormFieldLayoutProps, \"children\" | \"htmlFor\"> &\n Pick<\n UseControllerProps<TFieldValues, TName>,\n \"rules\" | \"defaultValue\" | \"shouldUnregister\" | \"disabled\"\n > & {\n name: TName;\n control?: Control<TFieldValues>;\n render: (props: FormFieldRenderProps<TFieldValues, TName>) => ReactNode;\n /** Overrides the validation error message shown under the control */\n error?: ReactNode;\n };\n\nexport type FormFieldProps<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> = FormFieldLayoutProps | FormFieldControlledProps<TFieldValues, TName>;\n\nconst FormFieldLayout = forwardRef<HTMLDivElement, FormFieldLayoutProps>(\n (\n {\n className,\n label,\n htmlFor,\n description,\n error,\n info,\n alert,\n required,\n direction = \"vertical\",\n children,\n ...props\n },\n ref\n ) => {\n const reactId = useId();\n const labelId = `${reactId}-label`;\n const hasLabel = label != null && label !== \"\";\n const invalid = Boolean(error);\n const controlContext = useMemo(() => ({ invalid }), [invalid]);\n const labelNode =\n hasLabel || description ? (\n htmlFor ? (\n <label\n htmlFor={htmlFor}\n className=\"aviala-form__label aviala-form__label--control\"\n >\n <Typeface\n id={labelId}\n content=\"textCaption\"\n primary={\n hasLabel ? (\n <>\n {label}\n {required ? (\n <span className=\"aviala-form__required\" aria-hidden>\n *\n </span>\n ) : null}\n </>\n ) : undefined\n }\n secondary={description}\n />\n </label>\n ) : (\n <Typeface\n id={labelId}\n className=\"aviala-form__label\"\n content=\"textCaption\"\n primary={\n hasLabel ? (\n <>\n {label}\n {required ? (\n <span className=\"aviala-form__required\" aria-hidden>\n *\n </span>\n ) : null}\n </>\n ) : undefined\n }\n secondary={description}\n />\n )\n ) : null;\n\n return (\n <Field\n ref={ref}\n className={cn(\"aviala-form\", className)}\n data-direction={direction}\n aria-labelledby={hasLabel ? labelId : undefined}\n invalid={invalid}\n {...props}\n >\n {labelNode}\n <div className=\"aviala-form__content\">\n <FormFieldControlContext.Provider value={controlContext}>\n {children}\n </FormFieldControlContext.Provider>\n {error ? (\n <div\n className=\"aviala-form__message aviala-form__message--error\"\n role=\"alert\"\n >\n <SymbolWrongCircle\n className=\"aviala-form__message-icon\"\n width={14}\n height={14}\n aria-hidden\n />\n <Typography\n level=\"caption\"\n as=\"p\"\n className=\"aviala-form__message-text\"\n >\n {error}\n </Typography>\n </div>\n ) : null}\n {info ? (\n <div className=\"aviala-form__message aviala-form__message--info\">\n <SymbolInformationCircle\n className=\"aviala-form__message-icon\"\n width={14}\n height={14}\n aria-hidden\n />\n <Typography\n level=\"caption\"\n as=\"p\"\n className=\"aviala-form__message-text\"\n >\n {info}\n </Typography>\n </div>\n ) : null}\n {alert ? <div className=\"aviala-form__alert\">{alert}</div> : null}\n </div>\n </Field>\n );\n }\n);\nFormFieldLayout.displayName = \"FormFieldLayout\";\n\nconst FormFieldControlled = forwardRef<\n HTMLDivElement,\n FormFieldControlledProps\n>(\n (\n {\n control,\n name,\n rules,\n defaultValue,\n shouldUnregister,\n disabled,\n render,\n error,\n ...layoutProps\n },\n ref\n ) => {\n const id = useId();\n const { field, fieldState, formState } = useController({\n name,\n control,\n rules,\n defaultValue,\n shouldUnregister,\n disabled,\n });\n const message =\n error !== undefined ? error : (fieldState.error?.message ?? null);\n\n return (\n <FormFieldLayout ref={ref} {...layoutProps} htmlFor={id} error={message}>\n {render({ field, fieldState, formState, id })}\n </FormFieldLayout>\n );\n }\n);\nFormFieldControlled.displayName = \"FormFieldControlled\";\n\nfunction isControlledProps(\n props: FormFieldProps\n): props is FormFieldControlledProps {\n return (\n \"render\" in props && typeof props.render === \"function\" && \"name\" in props\n );\n}\n\nconst FormFieldRoot = forwardRef<HTMLDivElement, FormFieldProps>(\n (props, ref) => {\n if (isControlledProps(props)) {\n return <FormFieldControlled ref={ref} {...props} />;\n }\n return <FormFieldLayout ref={ref} {...props} />;\n }\n);\n\n/**\n * FormField — layout wrapper around a form control, or a react-hook-form\n * bound field when given `name` + `render` (shadcn-style).\n *\n * When an error tip is shown, nested Spiral controls that support `error`\n * (Input, Textarea, SelectTrigger, …) inherit the invalid state unless they\n * set an explicit `error` prop.\n *\n * @example Layout mode\n * <FormField label=\"Email\" htmlFor=\"email\" error=\"Required\">\n * <Input id=\"email\" />\n * </FormField>\n *\n * @example react-hook-form + zod mode\n * <Form {...form}>\n * <form onSubmit={form.handleSubmit(onSubmit)}>\n * <FormField\n * control={form.control}\n * name=\"email\"\n * label=\"Email\"\n * render={({ field, id }) => (\n * <Input id={id} {...field} />\n * )}\n * />\n * </form>\n * </Form>\n */\nexport const FormField = FormFieldRoot as {\n <\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n >(\n props: FormFieldProps<TFieldValues, TName> & { ref?: Ref<HTMLDivElement> }\n ): ReactElement | null;\n displayName?: string;\n};\nFormField.displayName = \"FormField\";\n\n/** Alias of react-hook-form's FormProvider — wrap your form with it (shadcn-style `<Form {...form}>`) */\nexport const Form = FormProvider;\n"],"mappings":";;;;;;;;;;AAAA;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,aAAa;AAC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