contentoh-components-library 21.6.16 → 21.6.18

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.
Files changed (42) hide show
  1. package/dist/ai/prompts/attribute.prompt.js +28 -0
  2. package/dist/ai/prompts/description.prompt.js +33 -0
  3. package/dist/ai/schemas/attribute.schema.js +35 -0
  4. package/dist/ai/schemas/description.schema.js +27 -0
  5. package/dist/components/atoms/InheritanceTag/InheritanceTag.stories.js +56 -0
  6. package/dist/components/atoms/InheritanceTag/index.js +50 -0
  7. package/dist/components/atoms/InheritanceTag/styles.js +22 -0
  8. package/dist/components/atoms/VerticalSideMenuMainPage/styles.js +7 -2
  9. package/dist/components/molecules/TagAndInputv2/index.js +17 -4
  10. package/dist/components/molecules/TagAndInputv2/styles.js +1 -1
  11. package/dist/components/organisms/InputGroupv2/index.js +24 -14
  12. package/dist/index.js +101 -88
  13. package/graphify-out/.graphify_labels.json +1 -0
  14. package/graphify-out/.graphify_python +1 -0
  15. package/graphify-out/.graphify_root +1 -0
  16. package/graphify-out/GRAPH_REPORT.md +903 -0
  17. package/graphify-out/cache/ast/v0.9.46/6d0cee1e8f404fcc1d96c99855263e354d8412e554fdfe066c16575ec14c738f.json +1 -0
  18. package/graphify-out/cache/semantic/pd5fd89c46bb5/13484ffc6f74ff83ebae4566989b1aa8b6510eccae667dc609aaa70089150a26.json +1 -0
  19. package/graphify-out/cache/semantic/pd5fd89c46bb5/14ff90e5ddd895e6e54771ab539f7211ddd194b1499e5fe561fc51f77fe2b245.json +1 -0
  20. package/graphify-out/cache/semantic/pd5fd89c46bb5/428a7d1a9c22e5e911aafd0c6e13f7be64d761e9e3c0cff4ce5b23d88c00175a.json +1 -0
  21. package/graphify-out/cache/semantic/pd5fd89c46bb5/42e7b55e8925a210f897ae43760580b21f7d77566759838870de2279d6c4e1e9.json +1 -0
  22. package/graphify-out/cache/semantic/pd5fd89c46bb5/6928143519ca2ba337c975a219ddb1fc7a11405b889c77924aade75265f71833.json +1 -0
  23. package/graphify-out/cache/semantic/pd5fd89c46bb5/71f0dbaca065136605e31256f61cbfac8f7a3cbbede3834e3b1baafa51c2b7a6.json +1 -0
  24. package/graphify-out/cache/semantic/pd5fd89c46bb5/7e0446f72cc4cb86a5c416da0d60fd5ddd488b17bd8268ea8df34d0c8e8dfa2b.json +1 -0
  25. package/graphify-out/cache/semantic/pd5fd89c46bb5/7ee4b774404d8878da36220627b110f9dc0b971f0597c3f9585bd09cdd214105.json +1 -0
  26. package/graphify-out/cache/semantic/pd5fd89c46bb5/8f4ad140fe6b97f55673f69d813be7c647eb8248e5058396fe0df5fa693d7313.json +1 -0
  27. package/graphify-out/cache/semantic/pd5fd89c46bb5/a192eee79fd368f9a14857aad515e2c01a8a63a69c195272dd7a74e827576572.json +1 -0
  28. package/graphify-out/cache/semantic/pd5fd89c46bb5/c9972dc0b5136350cd35ffbc18454c41b76319c9aed8cc02874623e75f7e0283.json +1 -0
  29. package/graphify-out/cache/stat-index.json +1 -0
  30. package/graphify-out/cost.json +12 -0
  31. package/graphify-out/graph.html +345 -0
  32. package/graphify-out/graph.json +79294 -0
  33. package/graphify-out/manifest.json +4244 -0
  34. package/package.json +1 -1
  35. package/src/components/atoms/InheritanceTag/InheritanceTag.stories.js +39 -0
  36. package/src/components/atoms/InheritanceTag/index.js +45 -0
  37. package/src/components/atoms/InheritanceTag/styles.js +56 -0
  38. package/src/components/atoms/VerticalSideMenuMainPage/styles.js +10 -3
  39. package/src/components/molecules/TagAndInputv2/index.js +15 -0
  40. package/src/components/molecules/TagAndInputv2/styles.js +13 -0
  41. package/src/components/organisms/InputGroupv2/index.js +10 -0
  42. package/src/index.js +1 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contentoh-components-library",
3
- "version": "21.6.16",
3
+ "version": "21.6.18",
4
4
  "dependencies": {
5
5
  "@aws-amplify/auth": "^4.5.3",
6
6
  "@aws-amplify/datastore": "^3.11.0",
@@ -0,0 +1,39 @@
1
+ import { InheritanceTag } from "./index";
2
+
3
+ export default {
4
+ title: "Components/atoms/InheritanceTag",
5
+ label: "Inheritance Tag",
6
+ component: InheritanceTag,
7
+ };
8
+
9
+ const Template = (args) => <InheritanceTag {...args} />;
10
+
11
+ export const Heredado = Template.bind({});
12
+ Heredado.args = {
13
+ isVariant: true,
14
+ isOverridden: false,
15
+ parentUpc: "7501234567890",
16
+ };
17
+
18
+ export const Propio = Template.bind({});
19
+ Propio.args = {
20
+ isVariant: true,
21
+ isOverridden: true,
22
+ parentUpc: "7501234567890",
23
+ onRestore: () => {},
24
+ };
25
+
26
+ // Un valor propio sin onRestore no ofrece la acción: se marca, pero no se puede
27
+ // revertir desde ahí. Es el caso de las vistas de solo lectura.
28
+ export const PropioSinAccion = Template.bind({});
29
+ PropioSinAccion.args = {
30
+ isVariant: true,
31
+ isOverridden: true,
32
+ };
33
+
34
+ // En un producto que no es variante no se pinta nada.
35
+ export const NoEsVariante = Template.bind({});
36
+ NoEsVariante.args = {
37
+ isVariant: false,
38
+ isOverridden: true,
39
+ };
@@ -0,0 +1,45 @@
1
+ import { Container } from "./styles";
2
+
3
+ /**
4
+ * Marca si el valor de un atributo viene del producto padre o es propio de la
5
+ * variante. Solo tiene sentido dentro de una variante: en un producto sin padre
6
+ * no se pinta nada, porque no hay de quién heredar.
7
+ *
8
+ * El estado "propio" es el que carga información —ese campo se separó del padre—
9
+ * así que es el que lleva acento y el que ofrece la acción de volver a heredar.
10
+ * "Heredado" es el caso normal y se mantiene discreto: si gritara en cada campo,
11
+ * la ficha entera se volvería ruido.
12
+ */
13
+ export const InheritanceTag = ({
14
+ isVariant = false,
15
+ isOverridden = false,
16
+ parentUpc,
17
+ onRestore,
18
+ restoreLabel = "Volver a heredar",
19
+ className = "",
20
+ }) => {
21
+ if (!isVariant) return null;
22
+
23
+ const state = isOverridden ? "own" : "inherited";
24
+
25
+ return (
26
+ <Container className={`inheritance-tag ${state} ${className}`}>
27
+ <span
28
+ className="tag-label"
29
+ title={
30
+ isOverridden
31
+ ? "Valor propio de esta variante. La propagación del producto padre no lo modifica."
32
+ : `Valor heredado${parentUpc ? ` del producto ${parentUpc}` : " del producto padre"}.`
33
+ }
34
+ >
35
+ {isOverridden ? "Propio" : "Heredado"}
36
+ </span>
37
+
38
+ {isOverridden && onRestore && (
39
+ <button type="button" className="tag-action" onClick={onRestore}>
40
+ {restoreLabel}
41
+ </button>
42
+ )}
43
+ </Container>
44
+ );
45
+ };
@@ -0,0 +1,56 @@
1
+ import styled from "styled-components";
2
+ import "../../../global-files/global-styles.css";
3
+ import { GlobalColors, FontFamily } from "../../../global-files/variables";
4
+
5
+ export const Container = styled.div`
6
+ display: inline-flex;
7
+ align-items: center;
8
+ gap: 6px;
9
+ width: fit-content;
10
+ height: 16px;
11
+
12
+ .tag-label {
13
+ border-radius: 3px;
14
+ padding: 2px 5px;
15
+ font-family: ${FontFamily.Raleway_500};
16
+ font-size: 10px;
17
+ line-height: 12px;
18
+ letter-spacing: -0.015em;
19
+ white-space: nowrap;
20
+ cursor: default;
21
+ }
22
+
23
+ /* Heredado: el caso normal. Discreto a propósito. */
24
+ &.inherited .tag-label {
25
+ background-color: ${GlobalColors.s2};
26
+ color: ${GlobalColors.gray};
27
+ }
28
+
29
+ /* Propio: la excepción que informa. Lleva el acento de marca. */
30
+ &.own .tag-label {
31
+ background-color: rgba(${GlobalColors.rgb_color_pink}, 0.12);
32
+ color: ${GlobalColors.original_magenta};
33
+ }
34
+
35
+ .tag-action {
36
+ border: none;
37
+ background: none;
38
+ padding: 0;
39
+ font-family: ${FontFamily.Raleway_500};
40
+ font-size: 10px;
41
+ line-height: 12px;
42
+ color: ${GlobalColors.s4};
43
+ text-decoration: underline;
44
+ cursor: pointer;
45
+
46
+ &:hover {
47
+ color: ${GlobalColors.original_magenta};
48
+ }
49
+
50
+ &:focus-visible {
51
+ outline: 1px solid ${GlobalColors.magenta_s2};
52
+ outline-offset: 2px;
53
+ border-radius: 2px;
54
+ }
55
+ }
56
+ `;
@@ -18,10 +18,17 @@ const logoToWhite = "grayscale(1) brightness(0) invert(1)";
18
18
  anterior, lo que ensancha el trazo de forma pareja sin desenfocarlo (blur 0).
19
19
  Va DESPUÉS de logoToWhite a propósito: antes del invert(1) estas sombras
20
20
  blancas se voltearían a negro.
21
+
22
+ El peso se dosifica con el alfa, no con el offset: a 0.15px el desplazamiento
23
+ ya es sub-pixel, así que reducirlo cae en el mismo píxel al rasterizar y no se
24
+ distingue. Medio blanco (0.5) deja el trazo a mitad de camino entre el
25
+ original y el engrosado opaco, conservando las cuatro cardinales.
21
26
  */
22
27
  const logoThicken = `
23
- drop-shadow(0.15px 0 0 #fff) drop-shadow(-0.15px 0 0 #fff)
24
- drop-shadow(0 0.15px 0 #fff) drop-shadow(0 -0.15px 0 #fff)
28
+ drop-shadow(0.15px 0 0 rgba(255, 255, 255, 0.5))
29
+ drop-shadow(-0.15px 0 0 rgba(255, 255, 255, 0.5))
30
+ drop-shadow(0 0.15px 0 rgba(255, 255, 255, 0.5))
31
+ drop-shadow(0 -0.15px 0 rgba(255, 255, 255, 0.5))
25
32
  `;
26
33
 
27
34
  export const Container = styled.div`
@@ -47,7 +54,7 @@ export const Container = styled.div`
47
54
  el ancho es lo que decide si se ven parejos: 26px de alto dan ~156px,
48
55
  cerca de los ~167px del logotipo superior a 22px.
49
56
  */
50
- height: 26px;
57
+ height: 29px;
51
58
  align-self: center;
52
59
  flex-shrink: 0;
53
60
  opacity: 0.9;
@@ -1,6 +1,7 @@
1
1
  import { Container } from "./styles";
2
2
  import { GeneralInputv2 } from "../../atoms/GeneralInputv2";
3
3
  import { ScreenHeaderv2 } from "../../atoms/ScreenHeaderv2";
4
+ import { InheritanceTag } from "../../atoms/InheritanceTag";
4
5
 
5
6
  export const TagAndInputv2 = ({
6
7
  inputType,
@@ -33,6 +34,10 @@ export const TagAndInputv2 = ({
33
34
  showTooltip,
34
35
  auditClass,
35
36
  showMissingChars,
37
+ isVariant,
38
+ isOverridden,
39
+ parentUpc,
40
+ onRestoreInheritance,
36
41
  }) => {
37
42
  return (
38
43
  <Container
@@ -55,6 +60,16 @@ export const TagAndInputv2 = ({
55
60
  description={description}
56
61
  showMissingChars={showMissingChars}
57
62
  />
63
+ <InheritanceTag
64
+ isVariant={isVariant}
65
+ isOverridden={isOverridden}
66
+ parentUpc={parentUpc}
67
+ onRestore={
68
+ onRestoreInheritance
69
+ ? () => onRestoreInheritance(inputId)
70
+ : undefined
71
+ }
72
+ />
58
73
  </div>
59
74
  )}
60
75
  <GeneralInputv2
@@ -4,6 +4,19 @@ import { FontFamily, GlobalColors } from "../../../global-files/variables";
4
4
  export const Container = styled.div`
5
5
  .title-container {
6
6
  position: relative;
7
+ display: flex;
8
+ align-items: center;
9
+ gap: 8px;
10
+
11
+ /* El nombre del atributo manda; el chip se acomoda a su lado sin
12
+ empujarlo ni robarle ancho cuando el texto es largo. */
13
+ & > :first-child {
14
+ min-width: 0;
15
+ }
16
+ .inheritance-tag {
17
+ flex-shrink: 0;
18
+ }
19
+
7
20
  .tooltip {
8
21
  display: none;
9
22
  position: absolute;
@@ -21,6 +21,8 @@ export const InputGroupv2 = ({
21
21
  activeRetailer,
22
22
  setUpdatedBoxData,
23
23
  showMissingChars,
24
+ variant,
25
+ onRestoreInheritance,
24
26
  }) => {
25
27
  const inputTypeValue = (type) => {
26
28
  switch (type) {
@@ -144,6 +146,10 @@ export const InputGroupv2 = ({
144
146
  : ""
145
147
  }
146
148
  showMissingChars={showMissingChars}
149
+ isVariant={variant?.isVariant}
150
+ isOverridden={dataInputs[input]?.isOverridden}
151
+ parentUpc={variant?.parent?.upc}
152
+ onRestoreInheritance={onRestoreInheritance}
147
153
  />
148
154
  </>
149
155
  ) : (
@@ -252,6 +258,10 @@ export const InputGroupv2 = ({
252
258
  : ""
253
259
  }
254
260
  showMissingChars={showMissingChars}
261
+ isVariant={variant?.isVariant}
262
+ isOverridden={dataInputs[input]?.isOverridden}
263
+ parentUpc={variant?.parent?.upc}
264
+ onRestoreInheritance={onRestoreInheritance}
255
265
  />
256
266
  </>
257
267
  ) : (
package/src/index.js CHANGED
@@ -11,6 +11,7 @@ export * from "./components/atoms/GeneralButton/index";
11
11
  export * from "./components/atoms/GeneralInput/index";
12
12
  export * from "./components/atoms/GeneralTextBox/index";
13
13
  export * from "./components/atoms/GradientPanel/index";
14
+ export * from "./components/atoms/InheritanceTag/index";
14
15
  export * from "./components/atoms/Loading/index";
15
16
  export * from "./components/atoms/LogoImage/index";
16
17
  export * from "./components/atoms/PriorityFlag/index";