fix(color-picker): emit data-state explicitly on Provider props

Audit caught 'data-state not emitted' on the ColorPicker Provider. The
morfo declares `data-state ∈ [open, closed]` with `value: v.stateRef('open')`
— the runtime's `syncAttrs` can sync this from `dom.apply`, but only if
the provider receives a `ref` on its opts (which the ColorPickerProvider
doesn't — `ColorPickerOpts` extends `ProviderOpts` + `StateProps` without
the ref slot).

Rather than re-shape the opts to add ref + bind it in the wrapper, just
emit `data-state` explicitly in the provider's props derivation, same
form as the other six declarative attrs that the provider already
materialises (`data-format`, `data-invalid`, `data-disabled`,
`data-readonly`, `data-required`, `aria-invalid`). Matches the
dialog/drawer/popover doctrinal pattern for disclosure attrs.

After this commit `morfo:check`: 1 issue remaining (date-picker
`data-kind="date"` — separate domain issue, addressed next).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
active-uix
dev 5 months ago
parent 9f1466dc57
commit 59c3bc96c4

@ -368,6 +368,13 @@ export class ColorPickerProvider {
...this.runtimePart.props, ...this.runtimePart.props,
dir: this.opts.dir.current, dir: this.opts.dir.current,
'aria-invalid': this.isInvalid || undefined, 'aria-invalid': this.isInvalid || undefined,
// Mirror the morfo `data-state ∈ [open, closed]` disclosure
// contract (same shape as dialog / drawer / popover). The
// ColorPickerProvider doesn't receive `ref` on its opts, so
// the runtime's `syncAttrs` effect can't bind a target and
// emit this attr via `dom.apply`; we set it explicitly here
// so the contract is satisfied.
'data-state': this.opts.open.current ? ('open' as const) : ('closed' as const),
'data-format': this.opts.format.current, 'data-format': this.opts.format.current,
'data-invalid': boolToEmptyStrOrUndef(this.isInvalid), 'data-invalid': boolToEmptyStrOrUndef(this.isInvalid),
'data-disabled': boolToEmptyStrOrUndef(this.isDisabled), 'data-disabled': boolToEmptyStrOrUndef(this.isDisabled),

Loading…
Cancel
Save

Powered by TurnKey Linux.