feat(calcite-stepper): allow calcite-stepper to receive slotted items from wrapper component #11522
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related Issue: #
Summary
In Field Maps, we use the
calcite-stepper
in several places, many times with accompanying forward/backward buttons. So we've bundled them together in a wrapper web-component with a slot allowing each usage to pass in its desiredcalcite-stepper-items
. So it looks something like this:However, this usage passes the
calcite-stepper-items
within thecalcite-stepper
's slot, but does not pass its props to them (numbered
,layout
, etc.) causing them to render incorrectly. I believe this is because the function that performs this task,updateItems
finds the items throughthis.el.querySelector
. This doesn't work in the wrapping component scenario due to them being wrapped in aslot
. I have a branch here that repros the problem on the local demo site with a dummystepper-wrapper
component.I've fixed this by keeping track of the
slot
element after the slot change event and using its assignedcalcite-stepper-items
inupdateItems
instead. I also callupdateItems
in the slot change event. This seems to work for wrapped / unwrapped steppers.