css fixes for power dialog

This commit is contained in:
Mike Bloy 2025-06-08 14:52:27 -05:00
parent b41fd8833b
commit 469fad5ba5
4 changed files with 143 additions and 57 deletions

View File

@ -59,7 +59,7 @@ export class PowerFormApplication extends HandlebarsApplicationMixin(Application
width: 600, width: 600,
height: 'auto', height: 'auto',
}, },
classes: ['standard-form', 'mbSwade', 'mbSwadeForm', 'mbSwadePowerEffectsForm'], classes: ['mbSwade', 'mbSwadeForm', 'mbSwadePowerEffectsForm'],
window: { window: {
icon: 'fa-solid fa-hand-sparkles', icon: 'fa-solid fa-hand-sparkles',
title: 'Apply Effect', title: 'Apply Effect',
@ -69,15 +69,14 @@ export class PowerFormApplication extends HandlebarsApplicationMixin(Application
static PARTS = { static PARTS = {
header: { header: {
template: templates['dialogHeader.html'], template: templates['dialogHeader.html'],
classes: ['mbSwade', 'mbSwadeDialogHeader', 'flexrow'], classes: ['mbSwade', 'mbSwadeDialogHeader', 'mbSwadePowerEffectsHeader'],
}, },
body: { body: {
template: templates['powerDialog.html'], template: templates['powerDialog.html'],
classes: ['mbSwadePowerEffectsBody'], classes: ['mbSwade', 'mbSwadePowerEffectsBody', 'scrollable'],
}, },
footer: { footer: {
template: 'templates/generic/form-footer.hbs', template: 'templates/generic/form-footer.hbs',
classes: ['sheet-footer', 'flexrow'],
}, },
}; };
@ -116,9 +115,16 @@ export class PowerFormApplication extends HandlebarsApplicationMixin(Application
modifier.choices[choice] = `${modifier.choices[choice]}${val}`; modifier.choices[choice] = `${modifier.choices[choice]}${val}`;
} }
} }
if (modifier.isRadio) {
for (const choice in modifier.choices) {
let val = modifier.choices[choice];
modifier.choices[choice] = { text: val, checked: choice == modifier.default };
}
}
} }
const data = { const data = {
name: this.powerEffect.name, name: this.powerEffect.name,
formId: foundry.utils.randomID(),
headerTitle: `${this.powerEffect.name} Effect`, headerTitle: `${this.powerEffect.name} Effect`,
headerSubtitle: `Apply the effects from ${this.powerEffect.name}`, headerSubtitle: `Apply the effects from ${this.powerEffect.name}`,
icon: this.powerEffect.icon, icon: this.powerEffect.icon,

View File

@ -1,32 +1,103 @@
.mbSwadeForm { .mbSwade {
label.checkbox { &.mbSwadeForm {
font-size: var(--font-size-14); footer.form-footer {
} display: flex;
} flex-direction: row;
flex-wrap: nowrap;
justify-content: flex-start;
align-items: stretch;
align-content: stretch;
gap: 0.25em;
table.mbForm { &>button {
th { flex-grow: 1;
padding-left: 0.25em; flex-shrink: 1;
padding-right: 0.25em; flex-basis: auto;
} }
} }
.mbSwade.mbSwadeDialogHeader { .mbFormFields {
align-items: flex-start; display: grid;
grid-template-columns: minmax(5em, 2fr) 5fr;
grid-gap: 0.5em 0.5em;
grid-auto-flow: row dense;
img.mbSwadeIcon { &>.form-group {
margin-right: 1em; display: contents;
&>label {
grid-column: 1 / span 1;
justify-self: end;
&::after {
content: ":";
}
&.mbcheckbox {
grid-column: 2 / span 1;
justify-self: start;
&::after {
content: "";
}
}
}
&>input {
grid-column: 2 / span 1;
justify-self: start;
&[type="checkbox"] {
grid-column: 1 / span 1;
justify-self: end;
}
}
&>fieldset {
grid-column: 1 / span 2;
display: flex;
flex-direction: row;
align-items: baseline;
&>label {
text-align: right;
&::after {
content: ":";
}
}
&>input {
margin-right: 2em;
}
}
}
}
} }
.mbSwadeTitle { .mbSwadeDialogHeader {
h2:has(+ p) { display: flex;
margin-bottom: 0; flex-direction: row;
flex-wrap: nowrap;
justify-content: flex-start;
align-items: flex-start;
align-content: stretch;
gap: 0.5em;
&>* {
flex-grow: 1;
flex-shrink: 1;
flex-basis: auto
}
&>.mbSwadeIcon {
flex-grow: 0;
}
&>.mbSwadeTitle {
h2:has(+ p) {
margin-bottom: 0;
}
} }
} }
} }
.mbSwade.mbSwadeForm {
.mbSwadePowerEffectsBody {
margin-bottom: 0.5em;
}
}

View File

@ -1,6 +1,8 @@
<header> <header>
<img src="{{icon}}" height="64" width="64" class="flex0 mbSwadeIcon" title="{{name}} Effect" alt=" " /> {{#if icon}}
<div class="flexcol mbSwadeTitle"> <img src="{{icon}}" height="64" width="64" class="mbSwadeIcon" title="{{name}} Effect" alt=" " />
{{/if}}
<div class="mbSwadeTitle">
<h2>{{headerTitle}}</h2> <h2>{{headerTitle}}</h2>
{{#if headerSubtitle}}<p>{{headerSubtitle}}</p>{{/if}} {{#if headerSubtitle}}<p>{{headerSubtitle}}</p>{{/if}}
</div> </div>

View File

@ -17,31 +17,38 @@
{{/if}} {{/if}}
</p> </p>
{{/if}} {{/if}}
{{#each modifiers}} <section class="mbFormFields">
<div class="form-group"> {{#each modifiers}}
{{#if isCheckbox}} <div class="form-group">
<label class="checkbox"> {{#unless isRadio}}
<input type="checkbox" name="{{id}}" {{checked default}} /> <label class="mb{{type}}" for="{{../formId}}-{{id}}"><span class="mbModName">{{#if epic}}⭐
{{#if epic}}⭐ {{/if}}{{name}} {{/if}}{{name}}</span>{{#if value}}
{{#if value}}({{numberFormat value decimals=0 sign=true}}){{/if}} <span class="mbModValue">({{numberFormat value decimals=0 sign=true}})</span>{{/if}}</label>
</label> {{/unless}}
{{/if}} {{#if isCheckbox}}
{{#if isText}} <input type="checkbox" name="{{id}}" id="{{../formId}}-{{id}}" {{checked default}} />
<label for="{{id}}">{{#if epic}}⭐ {{/if}}{{name}}:</label> {{/if}}
<input name="{{id}}" type="text" value="{{default}}"> {{#if isText}}
{{/if}} <input name="{{id}}" id="{{formid}}-{{id}}" type="text" value="{{default}}">
{{#if isNumber}} {{/if}}
<label for="{{id}}">{{#if epic}}⭐ {{/if}}{{name}}:</label> {{#if isNumber}}
<input name="{{id}}" type="number" value="{{default}}" {{#if step}}step="{{step}}" {{/if}} {{#if min}}min="{{min}}" <input name="{{id}}" id="{{../formId}}-{{id}}" type="number" value="{{default}}" {{#if step}}step="{{step}}"
{{/if}} {{#if max}}max="{{max}}" {{/if}}> {{/if}} {{#if min}}min="{{min}}" {{/if}} {{#if max}}max="{{max}}" {{/if}}>
{{/if}} {{/if}}
{{#if isSelect}} {{#if isSelect}}
<label for="{{id}}">{{#if epic}}⭐ {{/if}}{{name}}:</label> <select name="{{id}}" id="{{../formId}}-{{id}}">{{selectOptions choices selected=default}}</select>
<select name="{{id}}">{{selectOptions choices selected=default}}</select> {{/if}}
{{/if}} {{#if isRadio}}
{{#if isRadio}} <fieldset class="mbRadiogroup">
{{#if epic}}⭐ {{/if}}{{name}}:</label> {{radioBoxes id choices checked=default}} <legend>{{#if epic}}⭐ {{/if}}{{name}}</legend>
{{/if}} {{#each choices}}
</div> <label class="mbradio" for="{{../../formId}}-{{../id}}-{{@key}}">{{text}}</label>
{{/each}} <input type="radio" name="{{../id}}" {{checked checked}} id="{{../../formId}}-{{../id}}-{{@key}}"
value="{{@key}}">
{{/each}}
{{/if}}
</fieldset>
</div>
{{/each}}
</section>
</section> </section>