Skip to content
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
d152cd4
fix(bulma-ui): keep a hasName File's CTA corners rounded while there …
allxsmith Oct 8, 2026
58a73dd
fix(bestax-migrate): convert a has-name .file with no name only with …
allxsmith Oct 8, 2026
590288c
fix(bestax-mcp): say that File renders is-empty beside has-name with …
allxsmith Oct 8, 2026
3e8b304
Merge remote-tracking branch 'origin/main' into gate-fix-978-file-is-…
allxsmith Oct 8, 2026
3186d9a
chore: regenerate after merging main
allxsmith Oct 8, 2026
ebb252b
fix(bulma-ui): stop crediting Bulma's is-empty with a boxed File's ro…
allxsmith Oct 8, 2026
e53ee6c
fix(bestax-mcp): mark is-empty rendered by File in its lookup row, no…
allxsmith Oct 8, 2026
8bf99d5
fix(bestax-migrate): pin an empty File name so a pick leaves the conv…
allxsmith Oct 8, 2026
78aac4c
chore: regenerate
allxsmith Oct 8, 2026
188feb0
fix(bestax-mcp): tell the File lookup to pin an empty name with fileN…
allxsmith Oct 8, 2026
b837d62
fix(bestax-migrate): say in the File is-empty TODO that the conversio…
allxsmith Oct 8, 2026
149da29
Merge remote-tracking branch 'origin/main' into work-990-merge
allxsmith Oct 8, 2026
187000a
chore: regenerate after merging main
allxsmith Oct 8, 2026
5330608
fix(bestax-migrate): say the File is-empty TODO wants the class writt…
allxsmith Oct 8, 2026
3d82419
test: pin the Bulma keys rule 4 exempts to the real sass tree
allxsmith Oct 8, 2026
df6f32b
Merge remote-tracking branch 'origin/main' into gate-fix-978-file-is-…
allxsmith Oct 8, 2026
21827d2
chore: cache Bulma's key set only once it is fully read
allxsmith Oct 9, 2026
136bd3a
test(bestax-migrate): hold the empty File name recipe in both skill r…
allxsmith Oct 9, 2026
88af415
Merge remote-tracking branch 'origin/main' into gate-fix-978-file-is-…
allxsmith Oct 9, 2026
111d9e0
chore: regenerate after merging main
allxsmith Oct 9, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bestax-mcp/data/components/File.json
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
"name": "hasName",
"type": "boolean",
"default": "false",
"description": "Show a file name area. Without `fileName` it shows what the user picked: the file's name, or a count when `multiple` lets them pick several (see `pickedFilesLabel`). Before a pick there is no name area. A reset of the input's form clears the name, but clearing the input from code fires no change event and leaves it showing, so pass `fileName` to control the text then.",
"description": "Show a file name area. Without `fileName` it shows what the user picked: the file's name, or a count when `multiple` lets them pick several (see `pickedFilesLabel`). Before a pick there is no name area, and the root takes Bulma's `is-empty`. A reset of the input's form clears the name, but clearing the input from code fires no change event and leaves it showing, so pass `fileName` to control the text then.",
"required": false,
"inherited": false,
"deprecated": false
Expand Down
4 changes: 2 additions & 2 deletions bestax-mcp/data/skills.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
{
"id": "bulma-classes-component-map",
"file": "references/bulma-classes/component-map.md",
"bytes": 24004
"bytes": 24617
},
{
"id": "bulma-classes-prop-map",
Expand All @@ -113,7 +113,7 @@
{
"id": "bulma-classes-unmappables",
"file": "references/bulma-classes/unmappables.md",
"bytes": 23489
"bytes": 23915
},
{
"id": "css-migration",
Expand Down
23 changes: 22 additions & 1 deletion bestax-mcp/src/__tests__/bulma-classes-agree.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,10 @@ function planned(tag: string, tokens: string[]): Outcome {
counted = counts.prop;
}
// One that renders the whole `.file` tree holds it, inside a `.field`,
// which the lookup states as a condition.
// which the lookup states as a condition. Beside `has-name` the tree is
// the one the lookup's answer describes: with a name in it, unless
// Bulma's `is-empty` marks the slot empty, which `File` renders itself
// when it has no name and the lookup says so on that class's row.
if (entry?.status === 'mapped' && entry.buildsFile && !childElements) {
const bare = (tag: string, token: string, extra = {}) => ({
tag,
Expand All @@ -152,6 +155,14 @@ function planned(tag: string, tokens: string[]): Outcome {
}),
],
}),
...(tokens.includes('has-name') && !tokens.includes('is-empty')
? [
bare('span', 'file-name', {
staticContent: true,
text: 'cv.pdf',
}),
]
: []),
],
}),
];
Expand Down Expand Up @@ -368,6 +379,16 @@ describe('lookup_bulma_classes agrees with the codemod planner', () => {
// own. The planner needs a tag, so it runs on that one: a heading's on <p>,
// where its size is exact, and classes with no root on <p>, whose
// Paragraph takes the same color props the no-tag answer names.
it('on a `.file` whose name slot is-empty marks, which File renders itself', () => {
const cases: Array<[string, string[]]> = [
['div', ['file', 'has-name', 'is-empty']],
['div', ['file', 'has-name', 'is-empty', 'is-boxed', 'mt-2']],
// Without `has-name`, `File` renders no `is-empty`, so it stays a class.
['div', ['file', 'is-empty']],
];
expect(compare(cases)).toEqual([]);
});

it('with no tag, on the tag the component renders by itself', () => {
const mismatches: string[] = [];
const check = (tag: string, tokens: string[]) => {
Expand Down
15 changes: 15 additions & 0 deletions bestax-mcp/src/__tests__/server.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -739,6 +739,21 @@ describe('lookup_bulma_classes', () => {
expect(out).toContain('bulma-classes-unmappables');
});

it('says File renders is-empty itself beside has-name with no name', async () => {
// And that the name is pinned empty there, as the codemod writes it, so
// a pick shows no name where the markup shows none.
expect(await lookup('file has-name')).toContain(
'With `hasName` and no `.file-name`, write `fileName=""`, so a file the user picks shows no name where the markup shows none. ' +
"It renders Bulma's `is-empty` there itself, so that class isn't needed."
);
// The class's own row says the same, rather than keeping it as a class.
const out = await lookup('file has-name is-empty');
expect(out).toContain(
'| `is-empty` | rendered by `File` | with no `.file-name` in the tree; beside one it stays in `className` |'
);
expect(out).not.toMatch(/\| `is-empty` \| stays in `className` \|/);
});

it('writes a prop typed as a number as a number', async () => {
const out = await lookup('cell is-col-span-2', 'div');
expect(out).toContain('**Component:** `Cell`.');
Expand Down
31 changes: 29 additions & 2 deletions bestax-mcp/src/bulma-classes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ export type Verdict =
/** A family bestax converts as a whole, by hand. */
| { kind: 'family'; why: string }
| { kind: 'prop'; writes: PropWrite[]; condition?: string }
/** A class the component renders itself, so it goes, on a condition. */
| { kind: 'rendered'; target: string; condition: string }
| { kind: 'class'; why: string };

export type Element =
Expand Down Expand Up @@ -574,6 +576,22 @@ export function lookupClasses(
});
}

// `File` renders Bulma's `is-empty` itself beside `hasName` while it has
// no name to show, so with no `.file-name` the class goes with the tree.
// The lookup can't see the tree, so the row says which tree it means.
if (
entry.buildsFile &&
writes.has('hasName') &&
tokens.includes('is-empty')
) {
verdicts.set('is-empty', {
kind: 'rendered',
target: target!,
condition:
'with no `.file-name` in the tree; beside one it stays in `className`',
});
}

let undone = false;
/** Take a prop back, naming it: the class stays, but the prop is real. */
const undo = (prop: string, why: string) => {
Expand Down Expand Up @@ -835,8 +853,11 @@ export function renderLookup(lookup: Lookup): string {
`content as \`buttonLabel\` (left out for its default text), ` +
`each \`.file-icon\`'s content as \`iconLeft\` or ` +
`\`iconRight\`, and the \`.file-name\`'s text as \`fileName\` ` +
`beside \`hasName\`. Outside a \`Field\` it renders a ` +
`\`.field\` of its own around it.`
`beside \`hasName\`. With \`hasName\` and no \`.file-name\`, ` +
`write \`fileName=""\`, so a file the user picks shows no name ` +
`where the markup shows none. It renders Bulma's \`is-empty\` ` +
`there itself, so that class isn't needed. Outside a \`Field\` ` +
`it renders a \`.field\` of its own around it.`
: '') +
(element.topLevel
? ` It renders \`.${element.topLevel}\` only when no other ` +
Expand Down Expand Up @@ -901,6 +922,12 @@ export function renderLookup(lookup: Lookup): string {
verdict.writes.map(writeText).join(' '),
verdict.condition ?? '',
];
case 'rendered':
return [
`\`${token}\``,
`rendered by \`${verdict.target}\``,
verdict.condition,
];
case 'class':
return [`\`${token}\``, 'stays in `className`', verdict.why];
}
Expand Down
13 changes: 12 additions & 1 deletion bestax-migrate/e2e/bulma-classes-props.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,8 @@ describe('every bulma-classes conversion typechecks', () => {
);
}
// The tree it renders from props: the <input>'s attributes it takes as
// its own, its extra classes, the icons, the default text and a name.
// its own, its extra classes, the icons, the default text, a name and
// an empty name slot, its name pinned empty.
if (entry.buildsFile) {
const trees: FileTree[] = [
{ label: 'Choose a file\u2026' },
Expand Down Expand Up @@ -441,6 +442,16 @@ describe('every bulma-classes conversion typechecks', () => {
fileChildren({ name: 'cv.pdf' })
)
);
add(
converted(
entry.tag!,
[root, 'has-name', 'is-empty'],
[],
undefined,
undefined,
fileChildren({})
)
);
}
expect({ root, conversions: lines.length > 0 }).toEqual({
root,
Expand Down
24 changes: 21 additions & 3 deletions bestax-migrate/e2e/bulma-classes-truth.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -348,9 +348,13 @@ function factsFor(
childElements: [iconChild(['fas', 'fa-home']), textChild()],
}),
// One that renders the whole `.file` tree holds that tree, inside a
// `.field`.
// `.field`, with a name in it beside `has-name`: with none, `File` renders
// Bulma's `is-empty` too, which the tree shapes below cover.
...(entries.some(entry => entry?.buildsFile) && {
childElements: fileChildren({ iconLeft: ['fas', 'fa-upload'] }),
childElements: fileChildren({
iconLeft: ['fas', 'fa-upload'],
...(tokens.includes('has-name') && { name: 'cv.pdf' }),
}),
classesAround: ['field'],
}),
// One that needs element children holds one (`Icon` around an <i>).
Expand Down Expand Up @@ -1202,7 +1206,11 @@ describe.each(mapped.filter(([, entry]) => entry.buildsFile))(
input: { tabIndex: '0' },
});
same('with a name', { name: 'cv.pdf' }, ['has-name']);
same('with a name slot and no name', {}, ['has-name']);
same('with a name slot Bulma marks empty', {}, ['has-name', 'is-empty']);
same('with a name, and is-empty beside it', { name: 'cv.pdf' }, [
'has-name',
'is-empty',
]);
same('with its modifiers together', { iconLeft: ['fas', 'fa-upload'] }, [
'is-boxed',
'is-fullwidth',
Expand All @@ -1211,6 +1219,16 @@ describe.each(mapped.filter(([, entry]) => entry.buildsFile))(
'mt-2',
]);
});

it('leaves a name slot with no name and no is-empty as markup', () => {
// `File` would add the `is-empty` the markup doesn't have.
const facts: ElementFacts = {
...factsFor(entry.tag!, [root, 'has-name']),
childElements: fileChildren({}),
classesAround: ['field'],
};
expect(plan(facts).conversion).toBeNull();
});
}
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,28 @@ export function Uploads({ onPick }: { onPick: () => void }) {
</label>
</div>
</div>
{/* A name slot with nothing in it yet, which Bulma marks is-empty. */}
<div className="field">
<div className="file has-name is-empty">
<label className="file-label">
<input className="file-input" type="file" name="letter" />
<span className="file-cta">
<span className="file-label">Upload</span>
</span>
</label>
</div>
</div>
{/* The same slot without is-empty, which File would add. */}
<div className="field">
<div className="file has-name">
<label className="file-label">
<input className="file-input" type="file" name="note" />
<span className="file-cta">
<span className="file-label">Upload</span>
</span>
</label>
</div>
</div>
{/* An attribute File would put on its input. */}
<div className="field">
<div className="file" id="upload">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Field, File, Icon } from "@allxsmith/bestax-bulma";
export function Uploads({ onPick }: { onPick: () => void }) {
// TODO(bestax-migrate): bestax `File` renders a `.field` of its own around the `.file` unless it sits inside a `Field`, and nothing around this element is one or becomes one here; keep it as markup, or convert the `.field` around it, then re-run
// TODO(bestax-migrate): bestax `File` renders the whole `.file` tree itself, so this converts only when its tree is the one it renders: one bare `.file-label` <label> holding a `.file-input` <input type="file">, a bare `.file-cta` <span> with a bare `.file-label` <span> of static content and at most one bare `.file-icon` <span> of static content on each side of it, and, with `has-name`, at most one bare `.file-name` <span> of static text; keep it as markup, or convert it by hand
// TODO(bestax-migrate): bestax `File` renders Bulma's `is-empty` on a `has-name` `.file` with no `.file-name`, whatever a condition says, so a condition on `is-empty` can't stand in for it; write `is-empty` here as a static class if that is what you want, then re-run, and it converts with `fileName=""`, so a file the user picks shows no name, as this markup shows none
// TODO(bestax-migrate): bestax `File` puts the attributes it's given on its <input>, so this element's `id` would move there; move it onto the <input> if that's what you want, then re-run
return (
<form>
Expand Down Expand Up @@ -44,6 +45,21 @@ export function Uploads({ onPick }: { onPick: () => void }) {
</label>
</div>
</Field>
{/* A name slot with nothing in it yet, which Bulma marks is-empty. */}
<Field>
<File hasName name="letter" buttonLabel="Upload" fileName="" />
</Field>
{/* The same slot without is-empty, which File would add. */}
<Field>
<div className="file has-name">
<label className="file-label">
<input className="file-input" type="file" name="note" />
<span className="file-cta">
<span className="file-label">Upload</span>
</span>
</label>
</div>
</Field>
{/* An attribute File would put on its input. */}
<Field>
<div className="file" id="upload">
Expand Down
40 changes: 40 additions & 0 deletions bestax-migrate/src/sources/bulma-classes/__tests__/plan.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1178,6 +1178,46 @@ describe('plan', () => {
});
});

it('takes is-empty on a name slot with no name, which File renders there itself', () => {
// Bulma's modifier for a `has-name` `.file` with nothing to name (#978).
const empty = file(tree(), 'file has-name is-empty').conversion!;
expect(empty.props).toEqual([['hasName', true]]);
expect(empty.className).toBeNull();
// Its name is pinned empty: unpinned, `File` would show the file a
// user picks, and drop `is-empty` with it, where the markup never does.
expect(empty.file).toEqual({
inputClassName: null,
buttonLabel: 0,
fileName: '',
});
// Without it `File` adds a class the markup doesn't have, and a
// condition can't promise one `File` renders whatever it says.
const bare = file(tree(), 'file has-name');
expect(rules(bare)).toEqual(['defaults:File']);
expect(bare.todos[0].message).toMatch(/`is-empty`/);
// And says what that conversion pins, so a pick never shows a name.
expect(bare.todos[0].message).toContain('converts with `fileName=""`');
// A conditional `is-empty` refuses too, and the TODO says so, or an
// author who has one reads it as already met.
const conditional = file(
tree(),
'file has-name',
{},
{ conditional: [['is-empty']] }
);
expect(rules(conditional)).toEqual(['defaults:File']);
expect(conditional.todos[0].message).toContain(
"a condition on `is-empty` can't stand in for it; write `is-empty` here as a static class"
);
// Beside a name `File` renders none, so one written there stays a class.
const named = file(
tree({ name: span('file-name', { text: 'cv.pdf' }) }),
'file has-name is-empty'
).conversion!;
expect(named.className).toBe('is-empty');
expect(named.file?.fileName).toBe('cv.pdf');
});

it('converts only inside a Field, already there or becoming one', () => {
expect(rules(file(tree(), 'file', {}, { classesAround: [] }))).toEqual([
'context:File',
Expand Down
28 changes: 26 additions & 2 deletions bestax-migrate/src/sources/bulma-classes/plan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,13 +241,19 @@ export interface BuiltFile {
/** Which of them holds the icon before that text, and after it. */
iconLeft?: number;
iconRight?: number;
/** The `.file-name`'s text. */
/**
* The `.file-name`'s text, or an empty string for a `has-name` `.file`
* with none, so the target shows no file a user picks.
*/
fileName?: string;
}

/** The button text `File` renders when it's given none. */
const DEFAULT_FILE_LABEL = 'Choose a file\u2026';

/** The class `File` renders beside `has-name` while it has no name to show. */
const EMPTY_NAME = 'is-empty';

/**
* Why a target that `buildsFile` stays markup outside a `Field`, for the
* planner here and for the transform, which can see whether the `.field`
Expand Down Expand Up @@ -780,10 +786,28 @@ export function plan(facts: ElementFacts): Plan {
}
let file: BuiltFile | undefined;
if (entry.buildsFile) {
const built = buildFile(facts.childElements, entry, writes.has('hasName'));
const hasName = writes.has('hasName');
const built = buildFile(facts.childElements, entry, hasName);
if ('why' in built) return refuse(built.kind, built.token, built.why);
file = built.file;
numbers.push(...built.numbers);
// With `has-name` and no `.file-name`, the target renders Bulma's
// `is-empty` too, whatever a condition says, so the markup has to carry
// it written out; it then goes with the rest of what the target renders.
// Its name is pinned empty, as a `.file-name` pins it to that text:
// unpinned, the target shows the file a user picks, and the markup never
// does.
if (hasName && file.fileName === undefined) {
if (!tokens.includes(EMPTY_NAME)) {
return refuse(
'defaults',
target,
`bestax \`${target}\` renders Bulma's \`${EMPTY_NAME}\` on a \`has-name\` \`.file\` with no \`.file-name\`, whatever a condition says, so a condition on \`${EMPTY_NAME}\` can't stand in for it; write \`${EMPTY_NAME}\` here as a static class if that is what you want, then re-run, and it converts with \`fileName=""\`, so a file the user picks shows no name, as this markup shows none`
);
}
converted.add(EMPTY_NAME);
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
file = { ...file, fileName: '' };
}
}

const props: Array<[string, string | true]> = [];
Expand Down
6 changes: 3 additions & 3 deletions bulma-ui/src/form/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ Conventions:
as escape hatches, so they are public API too.
- Basic inputs (Input, Select, TextArea, …) ship no CSS, but more of this folder has SCSS
than you'd guess: even Checkbox and Radio have themed partials, File has one for its keyboard
focus ring, and every extended input (Autocomplete, DateInput, Numberinput, Rate, Slider,
Switch, Taginput, …) does too. Check `../scss/form/_index.scss` for the authoritative list
before changing visuals.
focus ring and a boxed CTA's corners, and every extended input (Autocomplete, DateInput,
Numberinput, Rate, Slider, Switch, Taginput, …) does too. Check `../scss/form/_index.scss` for
the authoritative list before changing visuals.

Follow the anatomy rule in `bulma-ui/CLAUDE.md` (test + story + docs page + export + catalog).
Loading
Loading