fix(variants): normalize variant axes options and support custom tags in VariantAxesSelector

This commit is contained in:
Inamul-hasan-tec
2026-08-20 11:16:06 +05:30
parent 5f64b3c0d7
commit 3b6563c2b4
@@ -90,7 +90,24 @@ export const VariantAxesSelector: React.FC<VariantAxesSelectorProps> = ({
<div className="p-5 space-y-6">
{axes.map(axis => {
const options = axis.optionsList || [];
let options: any[] = [];
if (Array.isArray(axis.optionsList) && axis.optionsList.length > 0) {
options = axis.optionsList;
} else {
const rawOpts = (axis as any).options || (axis as any).attributeOptions || (axis as any).values || [];
if (Array.isArray(rawOpts)) {
options = rawOpts.map((o: any, idx: number) => {
if (typeof o === 'string') {
return { id: `${axis.code}-${idx}`, code: o, label: o };
}
return {
id: o.id || `${axis.code}-${idx}`,
code: o.code || o.value || String(o.label || ''),
label: o.label || o.value || o.name || o.code
};
});
}
}
const selected = selectedValues[axis.code] || [];
return (