diff --git a/.github/workflows/ci-lint.yaml b/.github/workflows/ci-lint.yaml index e5790f8554f..ee92927258b 100644 --- a/.github/workflows/ci-lint.yaml +++ b/.github/workflows/ci-lint.yaml @@ -52,6 +52,17 @@ jobs: if: ${{ !cancelled() }} run: pnpm run lint working-directory: packages/boxel-ui/addon + - name: Lint Host + # Runs BEFORE Build Boxel UI so host type-checks against the Boxel UI + # source, exactly as local development does (declarations/ is never + # built locally). This also guards against declaration-emit + # regressions: an unresolvable import inside a .d.ts is silently + # suppressed under skipLibCheck and degrades every Boxel UI symbol to + # `any`, turning the host type check into a no-op (see boxel-ui's + # bin/fix-declaration-extensions.mjs). + if: ${{ !cancelled() }} + run: pnpm run lint + working-directory: packages/host - name: Build Boxel UI # To faciliate linting of projects that depend on Boxel UI if: ${{ !cancelled() }} @@ -61,10 +72,6 @@ jobs: if: ${{ !cancelled() }} run: pnpm run lint working-directory: packages/boxel-ui/test-app - - name: Lint Host - if: ${{ !cancelled() }} - run: pnpm run lint - working-directory: packages/host - name: Lint Matrix if: ${{ !cancelled() }} run: pnpm run lint diff --git a/packages/base/amount-with-currency.gts b/packages/base/amount-with-currency.gts index c6b4506560a..14a643377a5 100644 --- a/packages/base/amount-with-currency.gts +++ b/packages/base/amount-with-currency.gts @@ -1,5 +1,7 @@ -import NumberField from './number'; +import NumberField, { deserializeForUI, serializeForUI } from './number'; import { FieldDef, field, contains, Component } from './card-api'; +import { NumberSerializer } from '@cardstack/runtime-common'; +import { TextInputValidator } from './text-input-validator'; import CurrencyField from './currency'; import { action } from '@ember/object'; import { BoxelInputGroup } from '@cardstack/boxel-ui/components'; @@ -28,13 +30,23 @@ class Edit extends Component { } @action - setAmount(val: number) { + setAmount(val: number | null | undefined) { let newModel = new AmountWithCurrency(); - newModel.amount = val; + if (val != null) { + newModel.amount = val; + } newModel.currency.code = newModel.currency.code || 'USD'; this.args.set(newModel); } + textInputValidator: TextInputValidator = new TextInputValidator( + () => this.args.model.amount ?? null, + (val) => this.setAmount(val), + deserializeForUI, + serializeForUI, + NumberSerializer.validate, + ); + @action setCurrency(val: CurrencyField) { let newModel = new AmountWithCurrency(); @@ -47,9 +59,10 @@ class Edit extends Component { { + private handleChange = (value: string | null) => { + this.args.set?.(value); + }; + get paletteColors() { const options = ( this.args.configuration as ColorFieldConfiguration & { @@ -17,7 +21,7 @@ export default class SwatchesPicker extends Component {