contentoh-components-library 21.6.17 → 21.6.19

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 (48) 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/molecules/TagAndInput/index.js +14 -1
  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/InputGroup/index.js +23 -17
  12. package/dist/components/organisms/InputGroupv2/index.js +24 -14
  13. package/dist/components/pages/ProductEditionv2/index.js +3 -0
  14. package/dist/components/pages/ProviderProductEdition/index.js +3 -2
  15. package/dist/index.js +101 -88
  16. package/graphify-out/.graphify_labels.json +1 -0
  17. package/graphify-out/.graphify_python +1 -0
  18. package/graphify-out/.graphify_root +1 -0
  19. package/graphify-out/GRAPH_REPORT.md +903 -0
  20. package/graphify-out/cache/ast/v0.9.46/6d0cee1e8f404fcc1d96c99855263e354d8412e554fdfe066c16575ec14c738f.json +1 -0
  21. package/graphify-out/cache/semantic/pd5fd89c46bb5/13484ffc6f74ff83ebae4566989b1aa8b6510eccae667dc609aaa70089150a26.json +1 -0
  22. package/graphify-out/cache/semantic/pd5fd89c46bb5/14ff90e5ddd895e6e54771ab539f7211ddd194b1499e5fe561fc51f77fe2b245.json +1 -0
  23. package/graphify-out/cache/semantic/pd5fd89c46bb5/428a7d1a9c22e5e911aafd0c6e13f7be64d761e9e3c0cff4ce5b23d88c00175a.json +1 -0
  24. package/graphify-out/cache/semantic/pd5fd89c46bb5/42e7b55e8925a210f897ae43760580b21f7d77566759838870de2279d6c4e1e9.json +1 -0
  25. package/graphify-out/cache/semantic/pd5fd89c46bb5/6928143519ca2ba337c975a219ddb1fc7a11405b889c77924aade75265f71833.json +1 -0
  26. package/graphify-out/cache/semantic/pd5fd89c46bb5/71f0dbaca065136605e31256f61cbfac8f7a3cbbede3834e3b1baafa51c2b7a6.json +1 -0
  27. package/graphify-out/cache/semantic/pd5fd89c46bb5/7e0446f72cc4cb86a5c416da0d60fd5ddd488b17bd8268ea8df34d0c8e8dfa2b.json +1 -0
  28. package/graphify-out/cache/semantic/pd5fd89c46bb5/7ee4b774404d8878da36220627b110f9dc0b971f0597c3f9585bd09cdd214105.json +1 -0
  29. package/graphify-out/cache/semantic/pd5fd89c46bb5/8f4ad140fe6b97f55673f69d813be7c647eb8248e5058396fe0df5fa693d7313.json +1 -0
  30. package/graphify-out/cache/semantic/pd5fd89c46bb5/a192eee79fd368f9a14857aad515e2c01a8a63a69c195272dd7a74e827576572.json +1 -0
  31. package/graphify-out/cache/semantic/pd5fd89c46bb5/c9972dc0b5136350cd35ffbc18454c41b76319c9aed8cc02874623e75f7e0283.json +1 -0
  32. package/graphify-out/cache/stat-index.json +1 -0
  33. package/graphify-out/cost.json +12 -0
  34. package/graphify-out/graph.html +345 -0
  35. package/graphify-out/graph.json +79294 -0
  36. package/graphify-out/manifest.json +4244 -0
  37. package/package.json +1 -1
  38. package/src/components/atoms/InheritanceTag/InheritanceTag.stories.js +39 -0
  39. package/src/components/atoms/InheritanceTag/index.js +45 -0
  40. package/src/components/atoms/InheritanceTag/styles.js +56 -0
  41. package/src/components/molecules/TagAndInput/index.js +15 -0
  42. package/src/components/molecules/TagAndInputv2/index.js +15 -0
  43. package/src/components/molecules/TagAndInputv2/styles.js +13 -0
  44. package/src/components/organisms/InputGroup/index.js +6 -0
  45. package/src/components/organisms/InputGroupv2/index.js +10 -0
  46. package/src/components/pages/ProductEditionv2/index.js +1 -0
  47. package/src/components/pages/ProviderProductEdition/index.js +1 -0
  48. 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.17",
3
+ "version": "21.6.19",
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
+ `;
@@ -1,5 +1,6 @@
1
1
  import { Container } from "./styles";
2
2
  import { ScreenHeader } from "../../atoms/ScreenHeader/index";
3
+ import { InheritanceTag } from "../../atoms/InheritanceTag";
3
4
  import { GeneralInput } from "../../atoms/GeneralInput/index";
4
5
  import { useState, useEffect } from "react";
5
6
  import acceptIcon from "../../../assets/images/generalButton/acceptIcon.svg";
@@ -44,6 +45,10 @@ export const TagAndInput = ({
44
45
  dataInputs,
45
46
  inputGroup,
46
47
  boxOnboardingData,
48
+ isVariant,
49
+ isOverridden,
50
+ parentUpc,
51
+ onRestoreInheritance,
47
52
  }) => {
48
53
  const [boxOnboardingList, setBoxOnboardingList] = useState(
49
54
  boxOnboardingData || []
@@ -323,6 +328,16 @@ export const TagAndInput = ({
323
328
  headerType={"input-name-header"}
324
329
  color={color}
325
330
  />
331
+ <InheritanceTag
332
+ isVariant={isVariant}
333
+ isOverridden={isOverridden}
334
+ parentUpc={parentUpc}
335
+ onRestore={
336
+ onRestoreInheritance
337
+ ? () => onRestoreInheritance(inputId)
338
+ : undefined
339
+ }
340
+ />
326
341
  {description && (
327
342
  <Tooltip
328
343
  componentTooltip={
@@ -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;
@@ -27,6 +27,8 @@ export const InputGroup = ({
27
27
  setUpdatedBoxData,
28
28
  activeRetailer,
29
29
  updateApprovedInputs,
30
+ variant,
31
+ onRestoreInheritance,
30
32
  }) => {
31
33
  const InputReviewSection = ({
32
34
  inputId,
@@ -230,6 +232,10 @@ export const InputGroup = ({
230
232
  optionList={dataInputs[input]?.option_list}
231
233
  description={dataInputs[input]?.description}
232
234
  showTooltip={true}
235
+ isVariant={variant?.isVariant}
236
+ isOverridden={dataInputs[input]?.isOverridden}
237
+ parentUpc={variant?.parent?.upc}
238
+ onRestoreInheritance={onRestoreInheritance}
233
239
  auditClass={
234
240
  compare &&
235
241
  !isEquals(
@@ -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
  ) : (
@@ -1504,6 +1504,7 @@ export const ProductEditionv2 = ({
1504
1504
  activeSection={activeTab}
1505
1505
  inputGroup={dataGroup}
1506
1506
  dataInputs={datasheets[1]}
1507
+ variant={services[0]?.variant}
1507
1508
  updatedDatasheets={updatedDatasheets}
1508
1509
  setUpdatedDatasheets={setUpdatedDatasheets}
1509
1510
  isShowbox={true}
@@ -1433,6 +1433,7 @@ const ProviderProductEditionView = ({
1433
1433
  activeSection={state.active_tab}
1434
1434
  inputGroup={dataGroup}
1435
1435
  dataInputs={state.datasheets_inputs[1] ?? []}
1436
+ variant={state.services?.datasheets?.variant}
1436
1437
  activeRetailer={
1437
1438
  state.services.datasheets[
1438
1439
  state.active_retailer.id_retailer
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";