How to make inner components take the remaining space while using wrap in Auto Layout?

Is it possible to create something similar to this using Figma?

Example: https://codepen.io/raul-rogojan/pen/vYvNwXP?editors=1100

So far, I’ve been able to make the elements wrap as the container is resized. However, their width is set as hug-contents, and I’d prefer them to fill the remaining space. If I change the element width to fill-container, they won’t wrap anymore.

I’ve also noticed that applying a min-width somewhat works, but the elements don’t share the same width. Is it possible to set only the min-width as hug-contents?