contentoh-components-library 21.6.25 → 21.6.26

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.
@@ -0,0 +1,198 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.SingleSelect = void 0;
9
+
10
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
11
+
12
+ var _react = require("react");
13
+
14
+ var _styles = require("./styles");
15
+
16
+ var _jsxRuntime = require("react/jsx-runtime");
17
+
18
+ /*
19
+ Select de opción única con búsqueda escribiendo.
20
+
21
+ Es el CustomSelect que la aplicación usa en el alta de productos, traído a la
22
+ librería para que las pantallas que viven aquí no tengan que caer en el <select>
23
+ del sistema, que se ve ajeno al resto de la plataforma.
24
+
25
+ Se llama distinto porque la librería ya exporta un `CustomSelect`: aquel es un
26
+ filtro de selección múltiple con calendario, otra cosa. Compartir nombre habría
27
+ roto el export global.
28
+
29
+ Tres cambios respecto al original, todos porque aquí el entorno es otro:
30
+ el ancho es flexible en vez de 210px fijos —en el modal van tres en fila—, los
31
+ colores salen de las variables de la librería en lugar de `var(--gray)`, y la
32
+ flecha va dibujada porque la fuente de iconos de Material la carga la
33
+ aplicación, no esta librería.
34
+
35
+ props:
36
+ - options: [{ label, value }]
37
+ - value: el value seleccionado
38
+ - onChange: recibe el value elegido, o null al limpiar
39
+ - placeholder, disabled, loading
40
+ */
41
+ var SingleSelect = function SingleSelect(_ref) {
42
+ var id = _ref.id,
43
+ className = _ref.className,
44
+ _ref$placeholder = _ref.placeholder,
45
+ placeholder = _ref$placeholder === void 0 ? "Selecciona una opción" : _ref$placeholder,
46
+ _ref$options = _ref.options,
47
+ options = _ref$options === void 0 ? [] : _ref$options,
48
+ onChange = _ref.onChange,
49
+ _ref$loading = _ref.loading,
50
+ loading = _ref$loading === void 0 ? false : _ref$loading,
51
+ _ref$value = _ref.value,
52
+ value = _ref$value === void 0 ? "" : _ref$value,
53
+ _ref$disabled = _ref.disabled,
54
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled;
55
+
56
+ var _useState = (0, _react.useState)(false),
57
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
58
+ isOpen = _useState2[0],
59
+ setIsOpen = _useState2[1];
60
+
61
+ var _useState3 = (0, _react.useState)(value),
62
+ _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
63
+ selectedValue = _useState4[0],
64
+ setSelectedValue = _useState4[1];
65
+
66
+ var _useState5 = (0, _react.useState)(""),
67
+ _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
68
+ inputValue = _useState6[0],
69
+ setInputValue = _useState6[1];
70
+
71
+ var wrapperRef = (0, _react.useRef)(null);
72
+ var inputRef = (0, _react.useRef)(null);
73
+ var selectedOption = options.find(function (option) {
74
+ return "".concat(option === null || option === void 0 ? void 0 : option.value) === "".concat(selectedValue);
75
+ });
76
+ var filteredOptions = loading ? [] : options.filter(function (option) {
77
+ var _option$label;
78
+
79
+ return ((_option$label = option === null || option === void 0 ? void 0 : option.label) !== null && _option$label !== void 0 ? _option$label : "").toLowerCase().includes(inputValue.toLowerCase());
80
+ });
81
+
82
+ var handleSelect = function handleSelect(option) {
83
+ setSelectedValue(option === null || option === void 0 ? void 0 : option.value);
84
+ setInputValue("");
85
+ onChange === null || onChange === void 0 ? void 0 : onChange(option === null || option === void 0 ? void 0 : option.value);
86
+ setIsOpen(false);
87
+ };
88
+
89
+ var clearSelected = function clearSelected() {
90
+ setSelectedValue("");
91
+ setInputValue("");
92
+ onChange === null || onChange === void 0 ? void 0 : onChange(null);
93
+ };
94
+
95
+ (0, _react.useEffect)(function () {
96
+ var handleClickOutside = function handleClickOutside(event) {
97
+ if (wrapperRef.current && !wrapperRef.current.contains(event.target)) {
98
+ setIsOpen(false);
99
+ }
100
+ };
101
+
102
+ document.addEventListener("mousedown", handleClickOutside);
103
+ return function () {
104
+ return document.removeEventListener("mousedown", handleClickOutside);
105
+ };
106
+ }, []); // Al deshabilitarse se limpia: un nivel de cascada que se apaga no puede
107
+ // quedarse mostrando la elección anterior, que ya no significa nada.
108
+
109
+ (0, _react.useEffect)(function () {
110
+ if (disabled) {
111
+ setSelectedValue("");
112
+ setInputValue("");
113
+ }
114
+ }, [disabled]);
115
+ (0, _react.useEffect)(function () {
116
+ setSelectedValue(value);
117
+ }, [value]);
118
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.SelectWrapper, {
119
+ id: id,
120
+ className: className,
121
+ ref: wrapperRef,
122
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.SelectBase, {
123
+ disabled: disabled,
124
+ className: "selectBase",
125
+ onClick: function onClick() {
126
+ if (!disabled && !isOpen) setIsOpen(true);
127
+ },
128
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
129
+ children: [selectedOption ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.SelectedOptionItem, {
130
+ title: selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.label,
131
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
132
+ children: selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.label
133
+ })
134
+ }) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
135
+ type: "text",
136
+ placeholder: selectedOption ? "" : placeholder,
137
+ value: inputValue,
138
+ disabled: disabled,
139
+ ref: inputRef,
140
+ onChange: function onChange(event) {
141
+ return setInputValue(event.target.value);
142
+ },
143
+ onFocus: function onFocus() {
144
+ if (!isOpen) setIsOpen(true);
145
+ },
146
+ onKeyDown: function onKeyDown(event) {
147
+ var _inputRef$current;
148
+
149
+ var esBorrar = event.key === "Backspace";
150
+ var vacio = (((_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.value) || "") === "";
151
+ if (!isOpen) setIsOpen(true); // Borrar con el campo vacío deshace la elección, que es lo que
152
+ // espera quien escribe para cambiarla.
153
+
154
+ if (esBorrar && vacio && selectedValue !== "") clearSelected();
155
+
156
+ if (event.key === "Enter" && filteredOptions.length > 0) {
157
+ event.preventDefault();
158
+ handleSelect(filteredOptions[0]);
159
+ }
160
+ },
161
+ onBlur: function onBlur() {
162
+ setTimeout(function () {
163
+ if (wrapperRef.current && !wrapperRef.current.contains(document.activeElement)) {
164
+ setIsOpen(false);
165
+ }
166
+ }, 0);
167
+ }
168
+ })]
169
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Arrow, {
170
+ "aria-hidden": "true",
171
+ children: "\u25BC"
172
+ })]
173
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Options, {
174
+ open: isOpen,
175
+ "data-testid": "options",
176
+ children: filteredOptions.length > 0 ? filteredOptions.map(function (option) {
177
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.OptionItem, {
178
+ selected: "".concat(option === null || option === void 0 ? void 0 : option.value) === "".concat(selectedValue),
179
+ onClick: function onClick() {
180
+ return handleSelect(option);
181
+ },
182
+ className: inputValue.trim() !== "" && option === filteredOptions[0] ? "first" : "",
183
+ tabIndex: -1,
184
+ children: option === null || option === void 0 ? void 0 : option.label
185
+ }, option === null || option === void 0 ? void 0 : option.value);
186
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.OptionItem, {
187
+ disabled: true,
188
+ style: {
189
+ pointerEvents: "none",
190
+ opacity: 0.5
191
+ },
192
+ children: loading ? "Cargando…" : "No se encontraron elementos"
193
+ })
194
+ })]
195
+ });
196
+ };
197
+
198
+ exports.SingleSelect = SingleSelect;
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.SelectedOptionItem = exports.SelectWrapper = exports.SelectBase = exports.Options = exports.OptionItem = exports.Arrow = void 0;
9
+
10
+ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/taggedTemplateLiteral"));
11
+
12
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
13
+
14
+ require("../../../global-files/global-styles.css");
15
+
16
+ var _variables = require("../../../global-files/variables");
17
+
18
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
19
+
20
+ var PINK = "#E13AA8";
21
+
22
+ var SelectWrapper = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n position: relative;\n display: flex;\n align-items: center;\n flex: 1 1 0;\n min-width: 0;\n font-family: ", ";\n font-size: 13px;\n user-select: none;\n box-sizing: border-box;\n"])), _variables.FontFamily.Raleway);
23
+
24
+ exports.SelectWrapper = SelectWrapper;
25
+
26
+ var SelectBase = _styledComponents.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n position: relative;\n width: 100%;\n min-width: 0;\n border-radius: 5px 5px 0 0;\n border-bottom: 1px solid rgba(225, 58, 168, 0.5);\n color: ", ";\n display: flex;\n gap: 8px;\n align-items: center;\n white-space: nowrap;\n overflow-x: hidden;\n padding: 0;\n\n cursor: ", ";\n opacity: ", ";\n pointer-events: ", ";\n\n > div {\n position: relative;\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n min-width: 0;\n }\n\n > div > input {\n width: 100%;\n min-width: 0;\n border: none;\n outline: none;\n padding: 9px 22px 9px 10px;\n border-radius: 5px 5px 0 0;\n font-family: ", ";\n font-size: 13px;\n color: ", ";\n background: none;\n }\n\n > div > input::placeholder {\n color: ", ";\n }\n"])), _variables.GlobalColors.deep_gray, function (_ref) {
27
+ var disabled = _ref.disabled;
28
+ return disabled ? "not-allowed" : "pointer";
29
+ }, function (_ref2) {
30
+ var disabled = _ref2.disabled;
31
+ return disabled ? 0.5 : 1;
32
+ }, function (_ref3) {
33
+ var disabled = _ref3.disabled;
34
+ return disabled ? "none" : "auto";
35
+ }, _variables.FontFamily.Raleway, _variables.GlobalColors.deep_gray, _variables.GlobalColors.gray);
36
+
37
+ exports.SelectBase = SelectBase;
38
+
39
+ var SelectedOptionItem = _styledComponents.default.div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n position: relative;\n max-width: 60%;\n display: flex;\n align-items: center;\n border-radius: 5px;\n padding: 5px 8px;\n background-color: rgba(225, 58, 168, 0.06);\n color: ", ";\n font-size: 12px;\n\n > p {\n width: 100%;\n margin: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n"])), _variables.GlobalColors.gray);
40
+ /*
41
+ Flecha dibujada, no un icono de fuente. El componente original usaba
42
+ material-symbols-outlined, que la aplicación carga y esta librería no: aquí
43
+ habría salido la palabra "arrow_drop_down" escrita donde debería ir el triángulo.
44
+ */
45
+
46
+
47
+ exports.SelectedOptionItem = SelectedOptionItem;
48
+
49
+ var Arrow = _styledComponents.default.span(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n position: absolute;\n right: 6px;\n pointer-events: none;\n color: ", ";\n font-size: 10px;\n line-height: 1;\n"])), PINK);
50
+
51
+ exports.Arrow = Arrow;
52
+
53
+ var Options = _styledComponents.default.ul(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n position: absolute;\n top: 100%;\n left: 0;\n width: 100%;\n max-height: 180px;\n overflow-y: auto;\n background-color: ", ";\n border-radius: 8px;\n border: 1px solid ", ";\n box-shadow: 0 4px 8px rgb(0 0 0 / 18%);\n margin: 0;\n padding: 0;\n list-style: none;\n display: ", ";\n z-index: 1000;\n"])), _variables.GlobalColors.white, _variables.GlobalColors.s2, function (_ref4) {
54
+ var open = _ref4.open;
55
+ return open ? "block" : "none";
56
+ });
57
+
58
+ exports.Options = Options;
59
+
60
+ var OptionItem = _styledComponents.default.li(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n padding: 9px 12px;\n cursor: pointer;\n font-size: 12px;\n white-space: normal;\n background-color: ", ";\n color: ", ";\n\n &.first {\n background-color: ", ";\n }\n\n &:hover {\n background-color: ", ";\n }\n"])), function (_ref5) {
61
+ var selected = _ref5.selected;
62
+ return selected ? PINK : _variables.GlobalColors.white;
63
+ }, function (_ref6) {
64
+ var selected = _ref6.selected;
65
+ return selected ? _variables.GlobalColors.white : _variables.GlobalColors.gray;
66
+ }, function (_ref7) {
67
+ var selected = _ref7.selected;
68
+ return selected ? PINK : "rgba(225, 58, 168, 0.1)";
69
+ }, function (_ref8) {
70
+ var selected = _ref8.selected;
71
+ return selected ? PINK : "rgba(225, 58, 168, 0.06)";
72
+ });
73
+
74
+ exports.OptionItem = OptionItem;
@@ -25,6 +25,8 @@ var _axios = _interopRequireDefault(require("axios"));
25
25
 
26
26
  var _api = require("./api");
27
27
 
28
+ var _SingleSelect = require("../../molecules/SingleSelect");
29
+
28
30
  var _helper = require("../../../_utils/helper");
29
31
 
30
32
  var _styles = require("./styles");
@@ -568,13 +570,19 @@ var LinkVariantsModal = function LinkVariantsModal(_ref) {
568
570
  }),
569
571
  categories: []
570
572
  });
571
- }
573
+ } // El tercer nivel no viene como {id, name} sino como
574
+ // {category_id, subcategory}: con el mapeo de los otros dos, la
575
+ // categoría salía en la lista pero sin texto. Mismo criterio que usa
576
+ // el alta de productos, incluido el separador legible.
577
+
572
578
 
573
579
  return (0, _objectSpread6.default)((0, _objectSpread6.default)({}, current), {}, {
574
580
  categories: lista.map(function (item) {
581
+ var _item$subcategory;
582
+
575
583
  return {
576
- value: item.id,
577
- label: item.name
584
+ value: item.category_id,
585
+ label: ((_item$subcategory = item.subcategory) !== null && _item$subcategory !== void 0 ? _item$subcategory : "").replace("|", " > ")
578
586
  };
579
587
  })
580
588
  });
@@ -1065,62 +1073,45 @@ var LinkVariantsModal = function LinkVariantsModal(_ref) {
1065
1073
  }, item.clave);
1066
1074
  })
1067
1075
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.AddRetailer, {
1068
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("select", {
1076
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_SingleSelect.SingleSelect, {
1077
+ id: "link-variants-retailer",
1078
+ placeholder: "Agregar otra cadena\u2026",
1079
+ options: filters.retailers,
1069
1080
  value: newRetailer,
1070
- onChange: function onChange(event) {
1071
- var valor = event.target.value;
1072
- setNewRetailer(valor);
1081
+ loading: loadingFilters && !filters.retailers.length,
1082
+ onChange: function onChange(valor) {
1083
+ setNewRetailer(valor !== null && valor !== void 0 ? valor : "");
1073
1084
  setNewDepartment("");
1074
1085
  setNewCategory("");
1075
1086
  if (valor) loadFilters(valor, null);
1076
- },
1077
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
1078
- value: "",
1079
- children: "Agregar otra cadena\u2026"
1080
- }), filters.retailers.map(function (item) {
1081
- return /*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
1082
- value: item.value,
1083
- children: item.label
1084
- }, item.value);
1085
- })]
1086
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("select", {
1087
+ }
1088
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_SingleSelect.SingleSelect, {
1089
+ id: "link-variants-department",
1090
+ placeholder: "Departamento\u2026",
1091
+ options: filters.departments,
1087
1092
  value: newDepartment,
1088
- disabled: !newRetailer || !filters.departments.length,
1089
- onChange: function onChange(event) {
1090
- var valor = event.target.value;
1091
- setNewDepartment(valor);
1093
+ disabled: !newRetailer,
1094
+ loading: loadingFilters && !!newRetailer,
1095
+ onChange: function onChange(valor) {
1096
+ setNewDepartment(valor !== null && valor !== void 0 ? valor : "");
1092
1097
  setNewCategory("");
1093
1098
  if (valor) loadFilters(newRetailer, valor);
1094
- },
1095
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
1096
- value: "",
1097
- children: "Departamento\u2026"
1098
- }), filters.departments.map(function (item) {
1099
- return /*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
1100
- value: item.value,
1101
- children: item.label
1102
- }, item.value);
1103
- })]
1104
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("select", {
1099
+ }
1100
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_SingleSelect.SingleSelect, {
1101
+ id: "link-variants-category",
1102
+ placeholder: "Categor\xEDa\u2026",
1103
+ options: filters.categories,
1105
1104
  value: newCategory,
1106
- disabled: !newDepartment || !filters.categories.length,
1107
- onChange: function onChange(event) {
1108
- return setNewCategory(event.target.value);
1109
- },
1110
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
1111
- value: "",
1112
- children: "Categor\xEDa\u2026"
1113
- }), filters.categories.map(function (item) {
1114
- return /*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
1115
- value: item.value,
1116
- children: item.label
1117
- }, item.value);
1118
- })]
1105
+ disabled: !newDepartment,
1106
+ loading: loadingFilters && !!newDepartment,
1107
+ onChange: function onChange(valor) {
1108
+ return setNewCategory(valor !== null && valor !== void 0 ? valor : "");
1109
+ }
1119
1110
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
1120
1111
  type: "button",
1121
1112
  onClick: addRetailer,
1122
1113
  disabled: !newRetailer || !newCategory || loadingFilters,
1123
- children: loadingFilters ? "…" : "Agregar"
1114
+ children: "Agregar"
1124
1115
  })]
1125
1116
  })]
1126
1117
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Block, {
@@ -1262,72 +1253,68 @@ var LinkVariantsModal = function LinkVariantsModal(_ref) {
1262
1253
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Message, {
1263
1254
  children: "El producto padre no tiene atributos con valor que heredar."
1264
1255
  })]
1265
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Block, {
1256
+ }), imagenesUtiles.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Block, {
1266
1257
  children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("h3", {
1267
1258
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
1268
1259
  className: "paso",
1269
1260
  children: "4"
1270
1261
  }), " Im\xE1genes"]
1271
- }), imagenesUtiles.length ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
1272
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Choices, {
1273
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("label", {
1274
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
1275
- type: "radio",
1276
- name: "images-".concat(activeChild !== null && activeChild !== void 0 ? activeChild : "todos"),
1277
- checked: modes.images === "all",
1278
- onChange: function onChange() {
1279
- return chooseMode("images", "all", imagenesUtiles.map(function (item) {
1280
- return item.id;
1281
- }));
1282
- }
1283
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
1284
- children: ["Todas", /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
1285
- className: "hint",
1286
- children: [imagenesUtiles.length, " imagen(es) en el padre."]
1287
- })]
1262
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Choices, {
1263
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("label", {
1264
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
1265
+ type: "radio",
1266
+ name: "images-".concat(activeChild !== null && activeChild !== void 0 ? activeChild : "todos"),
1267
+ checked: modes.images === "all",
1268
+ onChange: function onChange() {
1269
+ return chooseMode("images", "all", imagenesUtiles.map(function (item) {
1270
+ return item.id;
1271
+ }));
1272
+ }
1273
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
1274
+ children: ["Todas", /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
1275
+ className: "hint",
1276
+ children: [imagenesUtiles.length, " imagen(es) en el padre."]
1288
1277
  })]
1289
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("label", {
1278
+ })]
1279
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("label", {
1280
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
1281
+ type: "radio",
1282
+ name: "images-".concat(activeChild !== null && activeChild !== void 0 ? activeChild : "todos"),
1283
+ checked: modes.images === "some",
1284
+ onChange: function onChange() {
1285
+ return chooseMode("images", "some", []);
1286
+ }
1287
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
1288
+ children: ["Elegir cu\xE1les", /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
1289
+ className: "hint",
1290
+ children: "\xDAtil cuando la variante cambia de color o de empaque."
1291
+ })]
1292
+ })]
1293
+ })]
1294
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.ImageGrid, {
1295
+ children: imagenesUtiles.map(function (image) {
1296
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("label", {
1297
+ className: [chosen.images.includes(image.id) ? "picked" : "", modes.images === "all" ? "locked" : ""].filter(Boolean).join(" "),
1290
1298
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
1291
- type: "radio",
1292
- name: "images-".concat(activeChild !== null && activeChild !== void 0 ? activeChild : "todos"),
1293
- checked: modes.images === "some",
1299
+ type: "checkbox",
1300
+ disabled: modes.images === "all",
1301
+ checked: chosen.images.includes(image.id),
1294
1302
  onChange: function onChange() {
1295
- return chooseMode("images", "some", []);
1303
+ return toggleChoice("images", image.id);
1296
1304
  }
1297
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
1298
- children: ["Elegir cu\xE1les", /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
1299
- className: "hint",
1300
- children: "\xDAtil cuando la variante cambia de color o de empaque."
1301
- })]
1305
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
1306
+ src: (0, _helper.getProductImage)(image.src),
1307
+ alt: "",
1308
+ onError: function onError() {
1309
+ return setBrokenImages(function (current) {
1310
+ return current.includes(image.id) ? current : [].concat((0, _toConsumableArray2.default)(current), [image.id]);
1311
+ });
1312
+ }
1313
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
1314
+ children: image.imageType || "Sin tipo de toma"
1302
1315
  })]
1303
- })]
1304
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.ImageGrid, {
1305
- children: imagenesUtiles.map(function (image) {
1306
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)("label", {
1307
- className: [chosen.images.includes(image.id) ? "picked" : "", modes.images === "all" ? "locked" : ""].filter(Boolean).join(" "),
1308
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
1309
- type: "checkbox",
1310
- disabled: modes.images === "all",
1311
- checked: chosen.images.includes(image.id),
1312
- onChange: function onChange() {
1313
- return toggleChoice("images", image.id);
1314
- }
1315
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
1316
- src: (0, _helper.getProductImage)(image.src),
1317
- alt: "",
1318
- onError: function onError() {
1319
- return setBrokenImages(function (current) {
1320
- return current.includes(image.id) ? current : [].concat((0, _toConsumableArray2.default)(current), [image.id]);
1321
- });
1322
- }
1323
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
1324
- children: image.imageType || "Sin tipo de toma"
1325
- })]
1326
- }, image.id);
1327
- })
1328
- })]
1329
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Message, {
1330
- children: "El producto padre no tiene im\xE1genes que heredar."
1316
+ }, image.id);
1317
+ })
1331
1318
  })]
1332
1319
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Message, {
1333
1320
  children: "Lo que elijas heredar reemplaza el valor actual de la variante, incluso si alguien lo hab\xEDa capturado a mano."
@@ -73,7 +73,7 @@ var ImageGrid = _styledComponents.default.div(_templateObject12 || (_templateObj
73
73
 
74
74
  exports.ImageGrid = ImageGrid;
75
75
 
76
- var AddRetailer = _styledComponents.default.div(_templateObject13 || (_templateObject13 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n margin-bottom: 16px;\n\n select {\n flex: 1 1 140px;\n min-width: 0;\n height: 32px;\n padding: 0 8px;\n border: 1px solid ", ";\n border-radius: 6px;\n font-family: ", ";\n font-size: 13px;\n color: ", ";\n background-color: ", ";\n }\n\n button {\n height: 32px;\n padding: 0 14px;\n border: 1px solid ", ";\n border-radius: 6px;\n background: none;\n font-family: ", ";\n font-size: 13px;\n color: ", ";\n cursor: pointer;\n }\n\n select:disabled {\n opacity: 0.5;\n cursor: default;\n }\n\n button:disabled {\n opacity: 0.4;\n cursor: default;\n }\n"])), _variables.GlobalColors.s2, _variables.FontFamily.Raleway, _variables.GlobalColors.deep_gray, _variables.GlobalColors.white, PINK, _variables.FontFamily.Raleway_600, PINK);
76
+ var AddRetailer = _styledComponents.default.div(_templateObject13 || (_templateObject13 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-wrap: wrap;\n align-items: flex-end;\n gap: 8px;\n margin-bottom: 16px;\n\n button {\n height: 38px;\n padding: 0 14px;\n border: 1px solid ", ";\n border-radius: 6px;\n background: none;\n font-family: ", ";\n font-size: 13px;\n color: ", ";\n cursor: pointer;\n flex-shrink: 0;\n }\n\n button:disabled {\n opacity: 0.4;\n cursor: default;\n }\n"])), PINK, _variables.FontFamily.Raleway_600, PINK);
77
77
 
78
78
  exports.AddRetailer = AddRetailer;
79
79