Skip to content

Commit 5d4e81b

Browse files
refactor: rename TextField -> TextBox for WinUI parity (#387)
* refactor: rename TextField -> TextBox for WinUI parity Renames the record TextFieldElement to TextBoxElement and introduces TextBox(...) as the canonical DSL factory. TextField(...) remains as a [Obsolete(error: false)] forwarding alias and will be removed in a follow-up PR. Updates analyzers, the loc scanner, samples, tests, doc templates, and the regenerated docs/guide output. MaskedTextField is intentionally deferred. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix: align textbox-config snippet id with new naming The bulk markdown rename used PowerShell's case-insensitive -replace, which mangled the lowercase snippet id forms/textfield-config into forms/TextBox-config in the template but left the App.cs snippet marker untouched. Align both ends to lowercase forms/textbox-config and rename the class to TextBoxConfigDemo. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * review: clear stale Header/Description, scan header positional, tidy test - Reconciler.Update: clear TextBox.Header/Description via ClearValue when the new element transitions them to null. Previously the value stayed stuck on the control across re-renders. - LocalizableStringScanner: also extract the positional header argument (TextBox/TextField index 3); previously only the placeholder at index 2 was scanned, so positional header strings silently lost localization coverage. - UseFocusTests: drop the unused `var el =` assignment flagged by github-code-quality; the chained call still runs and registers. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(test): adjust analyzer span for TextBox length The FormFieldLabelAnalyzer test pinned the diagnostic span to columns 9..25 (16 chars, the length of TextField(value)). After the TextField → TextBox rename, the call site is TextBox(value) — 14 chars — so the diagnostic now ends at column 23. Update the expected span accordingly. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 28630aa commit 5d4e81b

204 files changed

Lines changed: 726 additions & 700 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,18 @@ to land under these conventions; subsequent specs follow this shape.
2929

3030
### Changed
3131

32+
- **`TextField``TextBox` rename.** The record type
33+
`TextFieldElement` is renamed to `TextBoxElement` for parity with
34+
WinUI's `Microsoft.UI.Xaml.Controls.TextBox`. The `TextField(...)`
35+
factory remains as a non-erroring `[Obsolete]` forwarding alias for
36+
one release; call sites should migrate to `TextBox(...)`. The
37+
alias will be removed in a future release.
38+
39+
### Deprecated
40+
41+
- **`Factories.TextField(...)`** — use `Factories.TextBox(...)` instead.
42+
Emits `CS0618` warning; will be removed in a future release.
43+
3244
- **Spec 045 Phase 2 — §2.29 ready for human review gate.**
3345
Every Phase-2 implementation item in
3446
`docs/specs/tasks/045-docking-windows-implementation.md` is now

SKILL.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ Grid(columns: [GridSize.Star(), GridSize.Px(200)],
394394
TitleBar("App") with { Subtitle = "Home", Content = ..., RightHeader = ... }
395395

396396
// Controls
397-
Button("Click", () => ...) TextField(value, setValue, placeholder)
397+
Button("Click", () => ...) TextBox(value, setValue, placeholder)
398398
CheckBox(isChecked, setChecked) ToggleSwitch(on, setOn)
399399
Slider(v, 0, 100, setV) ComboBox(items, index, setIndex)
400400

@@ -544,7 +544,7 @@ release you depend on.
544544
| `<div>` | `FlexColumn() / FlexRow() / Border()` (prefer over `VStack`/`HStack`) |
545545
| `<span>text</span>` | `TextBlock("text")` |
546546
| `<button onClick={fn}>` | `Button("label", fn)` |
547-
| `<input value={v} onChange={fn}>` | `TextField(v, fn)` |
547+
| `<input value={v} onChange={fn}>` | `TextBox(v, fn)` |
548548
| `{cond && <X/>}` | `cond ? X() : null` |
549549
| `{items.map(i => <X/>)}` | `items.Select(i => X()).ToArray()` |
550550
| `<Component />` | `Component<MyComponent>()` |

docs/_pipeline/apps/accessibility/App.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public override Element Render()
2323
TextBlock("Profile")
2424
.FontSize(18).SemiBold()
2525
.HeadingLevel(AutomationHeadingLevel.Level2),
26-
TextField("", _ => { }, placeholder: "Display name")
26+
TextBox("", _ => { }, placeholder: "Display name")
2727
.AutomationName("Display name")
2828
.TabIndex(1)
2929
.AccessKey("N"),
@@ -42,7 +42,7 @@ class Tier2Demo : Component
4242
public override Element Render()
4343
{
4444
return VStack(12,
45-
TextField("", _ => { }, placeholder: "Search...")
45+
TextBox("", _ => { }, placeholder: "Search...")
4646
.AutomationName("Search products")
4747
.HelpText("Type a product name or SKU to filter results")
4848
.Width(300),
@@ -75,9 +75,9 @@ public override Element Render()
7575
return VStack(12,
7676
TextBlock("Create Account").FontSize(24).Bold()
7777
.HeadingLevel(AutomationHeadingLevel.Level1),
78-
TextField(name, setName, header: "Full Name")
78+
TextBox(name, setName, header: "Full Name")
7979
.AutomationName("Full name").Required().TabIndex(1),
80-
TextField(email, setEmail, header: "Email")
80+
TextBox(email, setEmail, header: "Email")
8181
.AutomationName("Email address").Required().TabIndex(2)
8282
.HelpText("We'll send a verification link"),
8383
CheckBox(agree, setAgree, label: "I accept the terms")
@@ -110,7 +110,7 @@ public override Element Render()
110110
).Landmark(AutomationLandmarkType.Main)
111111
.AutomationName("Main content"),
112112

113-
TextField("", _ => { }, placeholder: "Search...")
113+
TextBox("", _ => { }, placeholder: "Search...")
114114
.AutomationName("Site search")
115115
.Landmark(AutomationLandmarkType.Search)
116116
).Padding(24);
@@ -159,7 +159,7 @@ public override Element Render()
159159
VStack(12,
160160
TextBlock("Modal Dialog").FontSize(18).Bold(),
161161
TextBlock("Tab/Shift+Tab stays inside this panel."),
162-
TextField("", _ => { }, placeholder: "Name")
162+
TextBox("", _ => { }, placeholder: "Name")
163163
.TabIndex(0),
164164
Button("Close", () => setShowModal(false))
165165
.TabIndex(1)

docs/_pipeline/apps/advanced/App.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public override Element Render()
141141

142142
return VStack(12,
143143
SubHeading("UseObservableTree"),
144-
TextField(vm.UserName, v => vm.UserName = v,
144+
TextBox(vm.UserName, v => vm.UserName = v,
145145
header: "User Name"),
146146
ToggleSwitch(vm.DarkMode, v => vm.DarkMode = v,
147147
header: "Dark Mode"),
@@ -167,7 +167,7 @@ public override Element Render()
167167
return VStack(12,
168168
SubHeading("UseCollection"),
169169
HStack(8,
170-
TextField(input, setInput, placeholder: "New task")
170+
TextBox(input, setInput, placeholder: "New task")
171171
.Width(200),
172172
Button("Add", () => {
173173
if (!string.IsNullOrWhiteSpace(input))
@@ -196,7 +196,7 @@ public override Element Render()
196196

197197
return VStack(12,
198198
SubHeading("Imperative focus via ElementRef<T>"),
199-
TextField(name, setName, placeholder: "Name").Ref(fieldRef),
199+
TextBox(name, setName, placeholder: "Name").Ref(fieldRef),
200200
Button("Focus the field", () =>
201201
fieldRef.Current?.Focus(FocusState.Programmatic))
202202
).Padding(24);

docs/_pipeline/apps/collections/App.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public override Element Render()
130130
return VStack(12,
131131
SubHeading("VirtualListRef — Imperative Scroll"),
132132
HStack(8,
133-
TextField(targetIndex, setTargetIndex,
133+
TextBox(targetIndex, setTargetIndex,
134134
placeholder: "Index"),
135135
Button("Scroll To", () =>
136136
{
@@ -219,7 +219,7 @@ public override Element Render()
219219
return VStack(12,
220220
SubHeading("Stable Identity with WithKey"),
221221
HStack(8,
222-
TextField(newItem, setNewItem, placeholder: "New item"),
222+
TextBox(newItem, setNewItem, placeholder: "New item"),
223223
Button("Add", () => {
224224
if (!string.IsNullOrWhiteSpace(newItem)) {
225225
updateItems(l => [.. l, newItem.Trim()]);

docs/_pipeline/apps/commanding/App.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public override Element Render()
2828
};
2929

3030
return VStack(12,
31-
TextField(text, v => { setText(v); setSaved(false); })
31+
TextBox(text, v => { setText(v); setSaved(false); })
3232
.Width(400),
3333
HStack(8,
3434
Button(saveCmd),
@@ -114,7 +114,7 @@ public override Element Render()
114114
secondaryCommands: new[] {
115115
AppBarButton(delete) }
116116
),
117-
TextField(text, setText).Margin(16)
117+
TextBox(text, setText).Margin(16)
118118
);
119119
}
120120
}

docs/_pipeline/apps/components/App.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public override Element Render()
1818

1919
return VStack(12,
2020
TextBlock($"Hello, {name}!").FontSize(20).Bold(),
21-
TextField(name, setName, placeholder: "Your name")
21+
TextBox(name, setName, placeholder: "Your name")
2222
.Width(200)
2323
).Padding(16);
2424
}

docs/_pipeline/apps/controls/App.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public override Element Render()
3939
var (volume, setVolume) = UseState(60.0);
4040

4141
return VStack(8,
42-
TextField(name, setName, placeholder: "Name").Width(200),
42+
TextBox(name, setName, placeholder: "Name").Width(200),
4343
CheckBox(agree, setAgree, label: "I agree"),
4444
Slider(volume, 0, 100, setVolume).Width(200),
4545
Button("Submit", () => { })

docs/_pipeline/apps/dev-tooling/App.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public override Element Render()
2424
Button("Click me", () => setCount(count + 1)),
2525
TextBlock($"Clicked {count} times").SemiBold()
2626
),
27-
TextField(message, setMessage, placeholder: "Type something")
27+
TextBox(message, setMessage, placeholder: "Type something")
2828
.Width(300)
2929
).Padding(24);
3030
}
@@ -68,7 +68,7 @@ public override Element Render()
6868
Heading("Iteration Cycle Demo"),
6969
TextBlock("Add items, then edit this code and save to see hot reload."),
7070
HStack(8,
71-
TextField(input, setInput, placeholder: "New item")
71+
TextBox(input, setInput, placeholder: "New item")
7272
.Width(200),
7373
Button("Add", () =>
7474
{

docs/_pipeline/apps/dialogs-and-flyouts/App.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public override Element Render()
8282
"Rename file",
8383
VStack(8,
8484
TextBlock("New filename:"),
85-
TextField(name, setName, placeholder: "untitled.txt")
85+
TextBox(name, setName, placeholder: "untitled.txt")
8686
.Width(280)),
8787
primaryButtonText: "Rename") with
8888
{

0 commit comments

Comments
 (0)