contentoh-components-library 21.6.20 → 21.6.21
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/dist/components/atoms/InheritanceTag/index.js +8 -0
- package/dist/components/molecules/TagAndInput/index.js +1 -0
- package/dist/components/molecules/TagAndInputv2/index.js +1 -0
- package/dist/components/organisms/LinkVariantsModal/index.js +4 -1
- package/package.json +1 -1
- package/src/components/atoms/InheritanceTag/index.js +7 -0
- package/src/components/molecules/TagAndInput/index.js +1 -0
- package/src/components/molecules/TagAndInputv2/index.js +1 -0
- package/src/components/organisms/LinkVariantsModal/index.js +6 -1
|
@@ -18,12 +18,19 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
18
18
|
* así que es el que lleva acento y el que ofrece la acción de volver a heredar.
|
|
19
19
|
* "Heredado" es el caso normal y se mantiene discreto: si gritara en cada campo,
|
|
20
20
|
* la ficha entera se volvería ruido.
|
|
21
|
+
*
|
|
22
|
+
* Un campo VACÍO no lleva marca: no heredó nada y tampoco tiene valor propio, así
|
|
23
|
+
* que llamarlo "Heredado" es falso además de ruidoso. Sin esto la ficha de una
|
|
24
|
+
* variante sale con el chip repetido en cada campo, incluidos los obligatorios en
|
|
25
|
+
* rojo que están sin capturar, y la marca deja de distinguir nada.
|
|
21
26
|
*/
|
|
22
27
|
var InheritanceTag = function InheritanceTag(_ref) {
|
|
23
28
|
var _ref$isVariant = _ref.isVariant,
|
|
24
29
|
isVariant = _ref$isVariant === void 0 ? false : _ref$isVariant,
|
|
25
30
|
_ref$isOverridden = _ref.isOverridden,
|
|
26
31
|
isOverridden = _ref$isOverridden === void 0 ? false : _ref$isOverridden,
|
|
32
|
+
_ref$hasValue = _ref.hasValue,
|
|
33
|
+
hasValue = _ref$hasValue === void 0 ? true : _ref$hasValue,
|
|
27
34
|
parentUpc = _ref.parentUpc,
|
|
28
35
|
onRestore = _ref.onRestore,
|
|
29
36
|
_ref$restoreLabel = _ref.restoreLabel,
|
|
@@ -31,6 +38,7 @@ var InheritanceTag = function InheritanceTag(_ref) {
|
|
|
31
38
|
_ref$className = _ref.className,
|
|
32
39
|
className = _ref$className === void 0 ? "" : _ref$className;
|
|
33
40
|
if (!isVariant) return null;
|
|
41
|
+
if (!hasValue) return null;
|
|
34
42
|
var state = isOverridden ? "own" : "inherited";
|
|
35
43
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
|
|
36
44
|
className: "inheritance-tag ".concat(state, " ").concat(className),
|
|
@@ -430,6 +430,7 @@ var TagAndInput = function TagAndInput(_ref) {
|
|
|
430
430
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_InheritanceTag.InheritanceTag, {
|
|
431
431
|
isVariant: isVariant,
|
|
432
432
|
isOverridden: isOverridden,
|
|
433
|
+
hasValue: "".concat(value !== null && value !== void 0 ? value : "").trim() !== "",
|
|
433
434
|
parentUpc: parentUpc,
|
|
434
435
|
onRestore: onRestoreInheritance ? function () {
|
|
435
436
|
return onRestoreInheritance(inputId);
|
|
@@ -70,6 +70,7 @@ var TagAndInputv2 = function TagAndInputv2(_ref) {
|
|
|
70
70
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_InheritanceTag.InheritanceTag, {
|
|
71
71
|
isVariant: isVariant,
|
|
72
72
|
isOverridden: isOverridden,
|
|
73
|
+
hasValue: "".concat(value !== null && value !== void 0 ? value : "").trim() !== "",
|
|
73
74
|
parentUpc: parentUpc,
|
|
74
75
|
onRestore: onRestoreInheritance ? function () {
|
|
75
76
|
return onRestoreInheritance(inputId);
|
|
@@ -605,7 +605,10 @@ var LinkVariantsModal = function LinkVariantsModal(_ref) {
|
|
|
605
605
|
type: "button",
|
|
606
606
|
className: "primary",
|
|
607
607
|
onClick: submit,
|
|
608
|
-
disabled: loading ||
|
|
608
|
+
disabled: loading || // Solo estorba cuando hay algo que elegir y no se eligió nada.
|
|
609
|
+
// Con el padre sin atributos heredables, ligar sigue siendo
|
|
610
|
+
// válido: se heredan imágenes, descripciones y cadenas.
|
|
611
|
+
inheritMode === "selected" && attributes.length > 0 && !chosenAttributes.length,
|
|
609
612
|
children: loading ? "Ligando…" : "Ligar"
|
|
610
613
|
})]
|
|
611
614
|
})]
|
package/package.json
CHANGED
|
@@ -9,16 +9,23 @@ import { Container } from "./styles";
|
|
|
9
9
|
* así que es el que lleva acento y el que ofrece la acción de volver a heredar.
|
|
10
10
|
* "Heredado" es el caso normal y se mantiene discreto: si gritara en cada campo,
|
|
11
11
|
* la ficha entera se volvería ruido.
|
|
12
|
+
*
|
|
13
|
+
* Un campo VACÍO no lleva marca: no heredó nada y tampoco tiene valor propio, así
|
|
14
|
+
* que llamarlo "Heredado" es falso además de ruidoso. Sin esto la ficha de una
|
|
15
|
+
* variante sale con el chip repetido en cada campo, incluidos los obligatorios en
|
|
16
|
+
* rojo que están sin capturar, y la marca deja de distinguir nada.
|
|
12
17
|
*/
|
|
13
18
|
export const InheritanceTag = ({
|
|
14
19
|
isVariant = false,
|
|
15
20
|
isOverridden = false,
|
|
21
|
+
hasValue = true,
|
|
16
22
|
parentUpc,
|
|
17
23
|
onRestore,
|
|
18
24
|
restoreLabel = "Volver a heredar",
|
|
19
25
|
className = "",
|
|
20
26
|
}) => {
|
|
21
27
|
if (!isVariant) return null;
|
|
28
|
+
if (!hasValue) return null;
|
|
22
29
|
|
|
23
30
|
const state = isOverridden ? "own" : "inherited";
|
|
24
31
|
|
|
@@ -460,7 +460,12 @@ export const LinkVariantsModal = ({
|
|
|
460
460
|
onClick={submit}
|
|
461
461
|
disabled={
|
|
462
462
|
loading ||
|
|
463
|
-
|
|
463
|
+
// Solo estorba cuando hay algo que elegir y no se eligió nada.
|
|
464
|
+
// Con el padre sin atributos heredables, ligar sigue siendo
|
|
465
|
+
// válido: se heredan imágenes, descripciones y cadenas.
|
|
466
|
+
(inheritMode === "selected" &&
|
|
467
|
+
attributes.length > 0 &&
|
|
468
|
+
!chosenAttributes.length)
|
|
464
469
|
}
|
|
465
470
|
>
|
|
466
471
|
{loading ? "Ligando…" : "Ligar"}
|