@trafilea/afrodita-components 4.4.0-beta.7 → 5.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.d.ts CHANGED
@@ -67,8 +67,11 @@ declare type Pattern = {
67
67
  };
68
68
  declare type ColorPickerOption = {
69
69
  label: string;
70
- color?: Color;
71
- pattern?: Pattern;
70
+ description: string;
71
+ meta: {
72
+ color?: Color;
73
+ pattern?: Pattern;
74
+ };
72
75
  };
73
76
  declare type RadioGroupOption = {
74
77
  value: string;
@@ -4451,13 +4451,19 @@ var PatternSelector = function (_a) {
4451
4451
  var templateObject_1$V, templateObject_2$y;
4452
4452
 
4453
4453
  var renderOptions$1 = function (options) {
4454
- if (options.length)
4455
- return options.map(function (option) { return (jsx(ColorRadioGroup$1.Option, __assign({ value: option }, { children: function (_a) {
4456
- var checked = _a.checked;
4457
- return option.color ? (jsx(ColorSelector, __assign({}, option.color, { selected: checked, testId: "".concat(option.label.split(' ').join('-').toLowerCase(), "-selector") }), void 0)) : (option.pattern && jsx(PatternSelector, { url: option.pattern.url, selected: checked }, void 0));
4458
- } }), option.label)); });
4459
- else
4454
+ if (options.length === 0) {
4460
4455
  return jsx(OutOfStock, { title: "out of stock color" }, void 0);
4456
+ }
4457
+ return options.map(function (option) { return (jsx(ColorRadioGroup$1.Option, __assign({ value: option }, { children: function (_a) {
4458
+ var checked = _a.checked;
4459
+ if (option.meta.color) {
4460
+ return (jsx(ColorSelector, __assign({}, option.meta.color, { selected: checked, testId: "".concat(option.label.split(' ').join('-').toLowerCase(), "-selector") }), void 0));
4461
+ }
4462
+ if (option.meta.pattern) {
4463
+ return jsx(PatternSelector, { url: option.meta.pattern.url, selected: checked }, void 0);
4464
+ }
4465
+ return null;
4466
+ } }), option.label)); });
4461
4467
  };
4462
4468
  var SingleColorPicker = function (_a) {
4463
4469
  var options = _a.options, selectedValue = _a.selectedValue, label = _a.label, onChange = _a.onChange, _b = _a.inline, inline = _b === void 0 ? false : _b;
@@ -4465,10 +4471,10 @@ var SingleColorPicker = function (_a) {
4465
4471
  };
4466
4472
 
4467
4473
  var renderOptions = function (selectedColor, options) {
4468
- if (options && options.length)
4469
- return options.map(function (option) { return (jsx$1(ColorRadioGroup$1.Option, __assign({ value: option }, { children: option.color ? (jsx$1(ColorSelector, __assign({}, option.color, { selected: selectedColor.has(option), testId: "".concat(option.label, "-selector") }), void 0)) : (option.pattern && (jsx$1(PatternSelector, { url: option.pattern.url, selected: selectedColor.has(option) }, void 0))) }), option.label)); });
4470
- else
4474
+ if (options == null || options.length === 0) {
4471
4475
  return jsx$1(OutOfStock, { title: "out of stock color" }, void 0);
4476
+ }
4477
+ return options.map(function (option) { return (jsx$1(ColorRadioGroup$1.Option, __assign({ value: option }, { children: option.meta.color ? (jsx$1(ColorSelector, __assign({}, option.meta.color, { selected: selectedColor.has(option), testId: "".concat(option.label, "-selector") }), void 0)) : option.meta.pattern ? (jsx$1(PatternSelector, { url: option.meta.pattern.url, selected: selectedColor.has(option) }, void 0)) : null }), option.label)); });
4472
4478
  };
4473
4479
  var getInitialValue = function (options, selectedValue) {
4474
4480
  if (selectedValue && options.includes(selectedValue))