contentoh-components-library 21.6.60 → 21.6.61

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 (76) hide show
  1. package/dist/components/organisms/ServicesNavigation/ServiceToolbar.js +210 -0
  2. package/dist/components/organisms/ServicesNavigation/ServicesNavigation.stories.js +138 -0
  3. package/dist/components/organisms/ServicesNavigation/ServicesRail.js +705 -0
  4. package/dist/components/organisms/ServicesNavigation/catalog.js +505 -0
  5. package/dist/components/organisms/ServicesNavigation/index.js +337 -0
  6. package/dist/components/organisms/ServicesNavigation/model.js +167 -0
  7. package/dist/components/organisms/ServicesNavigation/ui.js +371 -0
  8. package/dist/components/organisms/ServicesNavigation/views.js +1237 -0
  9. package/dist/components/organisms/ServicesWorkspace/AssigneePicker.js +459 -0
  10. package/dist/components/organisms/ServicesWorkspace/ServicesWorkspace.stories.js +119 -0
  11. package/dist/components/organisms/ServicesWorkspace/demo.js +137 -0
  12. package/dist/components/organisms/ServicesWorkspace/index.js +813 -0
  13. package/dist/components/organisms/ServicesWorkspace/servicesModel.js +351 -0
  14. package/dist/components/organisms/ServicesWorkspace/tooltipStyles.js +37 -0
  15. package/dist/components/pages/CreatorsProductEdition/mocks/mockApi.js +40 -0
  16. package/dist/components/pages/CreatorsProductEdition/mocks/productServices.fixtures.js +387 -0
  17. package/dist/components/pages/CreatorsProductEdition/sections/StatusChip.js +13 -4
  18. package/dist/components/pages/ProductEdition/ProductEdition.stories.js +148 -0
  19. package/dist/components/pages/ProductEdition/ProductEditionView.js +1355 -0
  20. package/dist/components/pages/ProductEdition/ServiceHeader.js +142 -0
  21. package/dist/components/pages/ProductEdition/api.js +256 -0
  22. package/dist/components/pages/ProductEdition/index.js +37 -0
  23. package/dist/components/pages/ProductEdition/permissions.js +200 -0
  24. package/dist/components/pages/ProductEdition/permissions.test.js +320 -0
  25. package/dist/components/pages/ProductEdition/sections/CatalogServicePanel.js +237 -0
  26. package/dist/components/pages/ProductEdition/sections/EditionTopBar.js +174 -0
  27. package/dist/components/pages/ProductEdition/sections/ImagePanel.js +440 -0
  28. package/dist/components/pages/ProductEdition/sections/ServiceTeam.js +275 -0
  29. package/dist/components/pages/ProductEdition/sections/ServiceTools.js +186 -0
  30. package/dist/components/pages/ProductEdition/services.js +233 -0
  31. package/dist/components/pages/ProductEdition/services.test.js +195 -0
  32. package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +15 -2
  33. package/dist/components/pages/RetailerProductEdition/index.js +57 -40
  34. package/dist/components/pages/RetailerProductEdition/utils.js +6 -2
  35. package/dist/index.js +13 -0
  36. package/package.json +1 -1
  37. package/src/components/organisms/ServicesNavigation/ServiceToolbar.jsx +143 -0
  38. package/src/components/organisms/ServicesNavigation/ServicesNavigation.stories.js +101 -0
  39. package/src/components/organisms/ServicesNavigation/ServicesRail.jsx +591 -0
  40. package/src/components/organisms/ServicesNavigation/catalog.js +180 -0
  41. package/src/components/organisms/ServicesNavigation/index.jsx +232 -0
  42. package/src/components/organisms/ServicesNavigation/model.js +85 -0
  43. package/src/components/organisms/ServicesNavigation/ui.jsx +229 -0
  44. package/src/components/organisms/ServicesNavigation/views.jsx +705 -0
  45. package/src/components/organisms/ServicesWorkspace/AssigneePicker.js +348 -0
  46. package/src/components/organisms/ServicesWorkspace/ServicesWorkspace.stories.js +61 -0
  47. package/src/components/organisms/ServicesWorkspace/demo.js +58 -0
  48. package/src/components/organisms/ServicesWorkspace/index.js +556 -0
  49. package/src/components/organisms/ServicesWorkspace/servicesModel.js +203 -0
  50. package/src/components/organisms/ServicesWorkspace/tooltipStyles.js +27 -0
  51. package/src/components/pages/CreatorsProductEdition/mocks/mockApi.js +17 -0
  52. package/src/components/pages/CreatorsProductEdition/mocks/productServices.fixtures.js +175 -0
  53. package/src/components/pages/CreatorsProductEdition/sections/StatusChip.jsx +8 -4
  54. package/src/components/pages/ProductEdition/ProductEdition.stories.js +106 -0
  55. package/src/components/pages/ProductEdition/ProductEditionView.jsx +1142 -0
  56. package/src/components/pages/ProductEdition/ServiceHeader.jsx +104 -0
  57. package/src/components/pages/ProductEdition/api.js +84 -0
  58. package/src/components/pages/ProductEdition/index.js +21 -0
  59. package/src/components/pages/ProductEdition/permissions.js +128 -0
  60. package/src/components/pages/ProductEdition/permissions.test.js +249 -0
  61. package/src/components/pages/ProductEdition/sections/CatalogServicePanel.jsx +123 -0
  62. package/src/components/pages/ProductEdition/sections/EditionTopBar.jsx +134 -0
  63. package/src/components/pages/ProductEdition/sections/ImagePanel.jsx +342 -0
  64. package/src/components/pages/ProductEdition/sections/ServiceTeam.jsx +184 -0
  65. package/src/components/pages/ProductEdition/sections/ServiceTools.jsx +134 -0
  66. package/src/components/pages/ProductEdition/services.js +187 -0
  67. package/src/components/pages/ProductEdition/services.test.js +88 -0
  68. package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +12 -0
  69. package/src/components/pages/RetailerProductEdition/index.js +28 -3
  70. package/src/components/pages/RetailerProductEdition/utils.js +5 -0
  71. package/src/index.js +1 -0
  72. package/.claude/settings.local.json +0 -7
  73. package/dist/ai/prompts/attribute.prompt.js +0 -28
  74. package/dist/ai/prompts/description.prompt.js +0 -33
  75. package/dist/ai/schemas/attribute.schema.js +0 -35
  76. package/dist/ai/schemas/description.schema.js +0 -27
@@ -0,0 +1,143 @@
1
+ import { Box, Button, Stack, Typography } from "@mui/material";
2
+ import MenuIcon from "@mui/icons-material/Menu";
3
+ import SaveOutlinedIcon from "@mui/icons-material/SaveOutlined";
4
+
5
+ import {
6
+ COLORS,
7
+ FONT_STACK,
8
+ TITLE_STACK,
9
+ PersonAvatar,
10
+ ServiceIcon,
11
+ StatusChip,
12
+ outlineButtonSx,
13
+ primaryButtonSx,
14
+ } from "./ui";
15
+ import { ROLE_LABELS, fullName, groupLabel, isMine } from "./model";
16
+
17
+ /*
18
+ Barra del servicio abierto. Ocupa el lugar de la barra de pestañas: dice en
19
+ qué servicio estás, su estatus y su equipo, y lleva la acción de guardar.
20
+ No hay botón de «siguiente»: quien produce ya sabe qué le toca, y la lista
21
+ lateral lo marca con el punto rosa.
22
+ */
23
+
24
+ const Team = ({ assignees = {}, userId }) => (
25
+ <Stack direction="row" alignItems="center" spacing={1.5} sx={{ flexWrap: "wrap", rowGap: 0.5 }}>
26
+ {Object.entries(ROLE_LABELS).map(([role, label]) => {
27
+ const user = assignees[role];
28
+ const isMe = Boolean(user) && user.id_user === userId;
29
+ return (
30
+ <Stack key={role} direction="row" alignItems="center" spacing={0.75}>
31
+ <PersonAvatar user={user} isMe={isMe} size={24} title={user ? `${label}: ${fullName(user)}` : `${label}: sin asignar`} />
32
+ <Box sx={{ lineHeight: 1.1 }}>
33
+ <Typography sx={{ fontFamily: FONT_STACK, fontSize: 10, color: COLORS.s4, textTransform: "uppercase", letterSpacing: "0.05em" }}>
34
+ {label}
35
+ </Typography>
36
+ <Typography sx={{ fontFamily: FONT_STACK, fontSize: 12, fontWeight: isMe ? 700 : 400, color: user ? COLORS.s5 : COLORS.s3 }}>
37
+ {user ? (isMe ? "Tú" : user.name) : "Sin asignar"}
38
+ </Typography>
39
+ </Box>
40
+ </Stack>
41
+ );
42
+ })}
43
+ </Stack>
44
+ );
45
+
46
+ export const ServiceToolbar = ({
47
+ service,
48
+ isSummary = false,
49
+ summaryCounts,
50
+ onOpenRail,
51
+ userId,
52
+ }) => {
53
+ const canSave = !isSummary && service && isMine(service, userId);
54
+
55
+ return (
56
+ <Box
57
+ sx={{
58
+ display: "flex",
59
+ flexWrap: "wrap",
60
+ alignItems: "center",
61
+ columnGap: 2,
62
+ rowGap: 1.25,
63
+ pb: 1.5,
64
+ mb: 2,
65
+ borderBottom: `2px solid ${COLORS.s2}`,
66
+ }}
67
+ >
68
+ {onOpenRail && (
69
+ <Button onClick={onOpenRail} startIcon={<MenuIcon sx={{ fontSize: 18 }} />} sx={outlineButtonSx}>
70
+ Servicios
71
+ </Button>
72
+ )}
73
+
74
+ <Stack direction="row" alignItems="center" spacing={1.25} sx={{ minWidth: 0, flex: "1 1 260px" }}>
75
+ <Box
76
+ sx={{
77
+ width: 36,
78
+ height: 36,
79
+ borderRadius: "10px",
80
+ bgcolor: COLORS.s2,
81
+ display: "flex",
82
+ alignItems: "center",
83
+ justifyContent: "center",
84
+ flexShrink: 0,
85
+ }}
86
+ >
87
+ <ServiceIcon icon={isSummary ? "summary" : service?.icon} sx={{ fontSize: 20, color: COLORS.magenta_s2 }} />
88
+ </Box>
89
+ <Box sx={{ minWidth: 0 }}>
90
+ <Typography
91
+ sx={{
92
+ fontFamily: FONT_STACK,
93
+ fontSize: 11,
94
+ fontWeight: 700,
95
+ letterSpacing: "0.06em",
96
+ textTransform: "uppercase",
97
+ color: COLORS.s4,
98
+ }}
99
+ >
100
+ {isSummary ? "Todos los servicios" : groupLabel(service?.group)}
101
+ </Typography>
102
+ <Stack direction="row" alignItems="center" spacing={1} sx={{ minWidth: 0 }}>
103
+ <Typography
104
+ component="h3"
105
+ sx={{
106
+ fontFamily: TITLE_STACK,
107
+ fontWeight: 500,
108
+ fontSize: 20,
109
+ lineHeight: "26px",
110
+ color: COLORS.s5,
111
+ overflow: "hidden",
112
+ textOverflow: "ellipsis",
113
+ whiteSpace: "nowrap",
114
+ }}
115
+ >
116
+ {isSummary ? "Resumen" : service?.display_name}
117
+ </Typography>
118
+ {!isSummary && service && <StatusChip status={service.status} oval />}
119
+ </Stack>
120
+ </Box>
121
+ </Stack>
122
+
123
+ {isSummary ? (
124
+ summaryCounts && (
125
+ <Typography sx={{ fontFamily: FONT_STACK, fontSize: 13, color: COLORS.s4 }}>
126
+ {summaryCounts.total} servicios · {summaryCounts.pending} te{" "}
127
+ {summaryCounts.pending === 1 ? "toca" : "tocan"} a ti
128
+ </Typography>
129
+ )
130
+ ) : (
131
+ <Team assignees={service?.assignees} userId={userId} />
132
+ )}
133
+
134
+ <Stack direction="row" spacing={1} sx={{ ml: "auto" }}>
135
+ {canSave && (
136
+ <Button variant="contained" startIcon={<SaveOutlinedIcon sx={{ fontSize: 18 }} />} sx={primaryButtonSx}>
137
+ Guardar
138
+ </Button>
139
+ )}
140
+ </Stack>
141
+ </Box>
142
+ );
143
+ };
@@ -0,0 +1,101 @@
1
+ import { ServicesNavigation } from "./index";
2
+ import { DEMO_PRODUCT, DEMO_USERS, TWENTY_SERVICES, buildServices } from "./catalog";
3
+ import { SUMMARY } from "./model";
4
+
5
+ /*
6
+ Prototipo de la navegación por servicios en la edición de producto.
7
+ Datos de ejemplo: no le pega a ninguna API.
8
+
9
+ Cada historia es el mismo producto visto por una persona distinta. Lo que hay
10
+ que probar es la navegación: la lista lateral, «Míos / Todos», el Resumen y,
11
+ en las de imágenes, el selector de servicio dentro de la vista.
12
+ */
13
+
14
+ export default {
15
+ title: "Prototipos/Navegación por servicios",
16
+ // Id sin acento, para que la liga de cada historia se pueda compartir.
17
+ id: "prototipos-navegacion-servicios",
18
+ component: ServicesNavigation,
19
+ parameters: { layout: "fullscreen" },
20
+ };
21
+
22
+ // Como en la app: la edición vive en una caja de altura fija.
23
+ const Template = (args) => (
24
+ <div style={{ height: "100vh", display: "flex", overflow: "hidden" }}>
25
+ <ServicesNavigation {...args} />
26
+ </div>
27
+ );
28
+
29
+ const { ana, carlos, diana, helena } = DEMO_USERS;
30
+
31
+ const FOUR_SERVICES = buildServices([
32
+ ["datasheet", "AS", { especialist: ana }],
33
+ ["description", "RA/AS", { especialist: ana }],
34
+ ["images", "PA"],
35
+ ["translation", "CA", { especialist: diana }],
36
+ ]);
37
+
38
+ /** El producto solo lleva Traducción: no hay lista, abre directo en ella. */
39
+ export const SoloTraduccion = Template.bind({});
40
+ SoloTraduccion.storyName = "Solo Traducción";
41
+ SoloTraduccion.args = {
42
+ product: DEMO_PRODUCT,
43
+ services: buildServices([["translation", "CA", { especialist: diana }]]),
44
+ currentUser: diana,
45
+ currentUserRole: "Especialista de traducción",
46
+ };
47
+
48
+ /** Caso de hoy (3 o 4 servicios), visto por la coordinadora: ve todos. */
49
+ export const CuatroServiciosCoordinadora = Template.bind({});
50
+ CuatroServiciosCoordinadora.storyName = "4 servicios · coordinadora";
51
+ CuatroServiciosCoordinadora.args = {
52
+ product: DEMO_PRODUCT,
53
+ services: FOUR_SERVICES,
54
+ currentUser: helena,
55
+ currentUserRole: "Coordinadora",
56
+ };
57
+
58
+ /** Mismo producto, visto por la especialista de textos: «Míos» por omisión. */
59
+ export const CuatroServiciosEspecialistaTextos = Template.bind({});
60
+ CuatroServiciosEspecialistaTextos.storyName = "4 servicios · especialista de textos";
61
+ CuatroServiciosEspecialistaTextos.args = {
62
+ product: DEMO_PRODUCT,
63
+ services: FOUR_SERVICES,
64
+ currentUser: ana,
65
+ currentUserRole: "Especialista de textos",
66
+ };
67
+
68
+ /** 20 servicios; el especialista de imágenes solo ve sus 3 hasta que pide «Todos». */
69
+ export const VeinteServiciosEspecialistaImagenes = Template.bind({});
70
+ VeinteServiciosEspecialistaImagenes.storyName = "20 servicios · especialista de imágenes";
71
+ VeinteServiciosEspecialistaImagenes.args = {
72
+ product: DEMO_PRODUCT,
73
+ services: TWENTY_SERVICES,
74
+ currentUser: carlos,
75
+ currentUserRole: "Especialista de imágenes",
76
+ };
77
+
78
+ /** 20 servicios vistos por la coordinadora: entra al Resumen. */
79
+ export const VeinteServiciosCoordinadora = Template.bind({});
80
+ VeinteServiciosCoordinadora.storyName = "20 servicios · coordinadora";
81
+ VeinteServiciosCoordinadora.args = {
82
+ product: DEMO_PRODUCT,
83
+ services: TWENTY_SERVICES,
84
+ currentUser: helena,
85
+ currentUserRole: "Coordinadora",
86
+ initialService: SUMMARY,
87
+ };
88
+
89
+ /** La lista contraída a íconos, para dejarle todo el ancho al editor. */
90
+ export const VeinteServiciosListaContraida = Template.bind({});
91
+ VeinteServiciosListaContraida.storyName = "20 servicios · lista contraída";
92
+ VeinteServiciosListaContraida.args = {
93
+ ...VeinteServiciosEspecialistaImagenes.args,
94
+ initialCollapsed: true,
95
+ };
96
+
97
+ /** En celular la lista se abre como panel con el botón «Servicios». */
98
+ export const VeinteServiciosCelular = Template.bind({});
99
+ VeinteServiciosCelular.storyName = "20 servicios · celular";
100
+ VeinteServiciosCelular.args = VeinteServiciosEspecialistaImagenes.args;
101
+ VeinteServiciosCelular.parameters = { viewport: { defaultViewport: "mobile2" } };