Workday/canvas-kit

Models config should allow overwriting defaults, specifically for Select + Combobox

Opened this issue ยท 0 comments

๐Ÿ› Bug Report

Select should allow to overwrite the selection manager so that consumers can reset the select to a non selected state. Currently, once you select an item, there's no way to reset the value of the select. In order for us to do this, we'll need to update models.ts so that configs are merge properly and whatever the consumer passes overwrites the default config.

  • Automatic controllable state. If you provide the state value in config, it will be used, otherwise initial* will be used for initial value. This would probably be a breaking change since any state would automatically become config options and there may be config clashes.
  • Access to model config.
  • Subscribe to events after model creation to avoid having to use useEffect in elemProps hooks to track state changes since there's no access to direct model events. Something like useModelCallback(model, 'eventName', (data) => {}) and possibly a guard subscription useModelGuard(model, 'eventName', data => true).