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,210 @@
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.ServiceToolbar = void 0;
9
+
10
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
11
+
12
+ var _material = require("@mui/material");
13
+
14
+ var _Menu = _interopRequireDefault(require("@mui/icons-material/Menu"));
15
+
16
+ var _SaveOutlined = _interopRequireDefault(require("@mui/icons-material/SaveOutlined"));
17
+
18
+ var _ui = require("./ui");
19
+
20
+ var _model = require("./model");
21
+
22
+ var _jsxRuntime = require("react/jsx-runtime");
23
+
24
+ /*
25
+ Barra del servicio abierto. Ocupa el lugar de la barra de pestañas: dice en
26
+ qué servicio estás, su estatus y su equipo, y lleva la acción de guardar.
27
+ No hay botón de «siguiente»: quien produce ya sabe qué le toca, y la lista
28
+ lateral lo marca con el punto rosa.
29
+ */
30
+ var Team = function Team(_ref) {
31
+ var _ref$assignees = _ref.assignees,
32
+ assignees = _ref$assignees === void 0 ? {} : _ref$assignees,
33
+ userId = _ref.userId;
34
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Stack, {
35
+ direction: "row",
36
+ alignItems: "center",
37
+ spacing: 1.5,
38
+ sx: {
39
+ flexWrap: "wrap",
40
+ rowGap: 0.5
41
+ },
42
+ children: Object.entries(_model.ROLE_LABELS).map(function (_ref2) {
43
+ var _ref3 = (0, _slicedToArray2.default)(_ref2, 2),
44
+ role = _ref3[0],
45
+ label = _ref3[1];
46
+
47
+ var user = assignees[role];
48
+ var isMe = Boolean(user) && user.id_user === userId;
49
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Stack, {
50
+ direction: "row",
51
+ alignItems: "center",
52
+ spacing: 0.75,
53
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.PersonAvatar, {
54
+ user: user,
55
+ isMe: isMe,
56
+ size: 24,
57
+ title: user ? "".concat(label, ": ").concat((0, _model.fullName)(user)) : "".concat(label, ": sin asignar")
58
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
59
+ sx: {
60
+ lineHeight: 1.1
61
+ },
62
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
63
+ sx: {
64
+ fontFamily: _ui.FONT_STACK,
65
+ fontSize: 10,
66
+ color: _ui.COLORS.s4,
67
+ textTransform: "uppercase",
68
+ letterSpacing: "0.05em"
69
+ },
70
+ children: label
71
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
72
+ sx: {
73
+ fontFamily: _ui.FONT_STACK,
74
+ fontSize: 12,
75
+ fontWeight: isMe ? 700 : 400,
76
+ color: user ? _ui.COLORS.s5 : _ui.COLORS.s3
77
+ },
78
+ children: user ? isMe ? "Tú" : user.name : "Sin asignar"
79
+ })]
80
+ })]
81
+ }, role);
82
+ })
83
+ });
84
+ };
85
+
86
+ var ServiceToolbar = function ServiceToolbar(_ref4) {
87
+ var service = _ref4.service,
88
+ _ref4$isSummary = _ref4.isSummary,
89
+ isSummary = _ref4$isSummary === void 0 ? false : _ref4$isSummary,
90
+ summaryCounts = _ref4.summaryCounts,
91
+ onOpenRail = _ref4.onOpenRail,
92
+ userId = _ref4.userId;
93
+ var canSave = !isSummary && service && (0, _model.isMine)(service, userId);
94
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
95
+ sx: {
96
+ display: "flex",
97
+ flexWrap: "wrap",
98
+ alignItems: "center",
99
+ columnGap: 2,
100
+ rowGap: 1.25,
101
+ pb: 1.5,
102
+ mb: 2,
103
+ borderBottom: "2px solid ".concat(_ui.COLORS.s2)
104
+ },
105
+ children: [onOpenRail && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
106
+ onClick: onOpenRail,
107
+ startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Menu.default, {
108
+ sx: {
109
+ fontSize: 18
110
+ }
111
+ }),
112
+ sx: _ui.outlineButtonSx,
113
+ children: "Servicios"
114
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Stack, {
115
+ direction: "row",
116
+ alignItems: "center",
117
+ spacing: 1.25,
118
+ sx: {
119
+ minWidth: 0,
120
+ flex: "1 1 260px"
121
+ },
122
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
123
+ sx: {
124
+ width: 36,
125
+ height: 36,
126
+ borderRadius: "10px",
127
+ bgcolor: _ui.COLORS.s2,
128
+ display: "flex",
129
+ alignItems: "center",
130
+ justifyContent: "center",
131
+ flexShrink: 0
132
+ },
133
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.ServiceIcon, {
134
+ icon: isSummary ? "summary" : service === null || service === void 0 ? void 0 : service.icon,
135
+ sx: {
136
+ fontSize: 20,
137
+ color: _ui.COLORS.magenta_s2
138
+ }
139
+ })
140
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
141
+ sx: {
142
+ minWidth: 0
143
+ },
144
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
145
+ sx: {
146
+ fontFamily: _ui.FONT_STACK,
147
+ fontSize: 11,
148
+ fontWeight: 700,
149
+ letterSpacing: "0.06em",
150
+ textTransform: "uppercase",
151
+ color: _ui.COLORS.s4
152
+ },
153
+ children: isSummary ? "Todos los servicios" : (0, _model.groupLabel)(service === null || service === void 0 ? void 0 : service.group)
154
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Stack, {
155
+ direction: "row",
156
+ alignItems: "center",
157
+ spacing: 1,
158
+ sx: {
159
+ minWidth: 0
160
+ },
161
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
162
+ component: "h3",
163
+ sx: {
164
+ fontFamily: _ui.TITLE_STACK,
165
+ fontWeight: 500,
166
+ fontSize: 20,
167
+ lineHeight: "26px",
168
+ color: _ui.COLORS.s5,
169
+ overflow: "hidden",
170
+ textOverflow: "ellipsis",
171
+ whiteSpace: "nowrap"
172
+ },
173
+ children: isSummary ? "Resumen" : service === null || service === void 0 ? void 0 : service.display_name
174
+ }), !isSummary && service && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.StatusChip, {
175
+ status: service.status,
176
+ oval: true
177
+ })]
178
+ })]
179
+ })]
180
+ }), isSummary ? summaryCounts && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Typography, {
181
+ sx: {
182
+ fontFamily: _ui.FONT_STACK,
183
+ fontSize: 13,
184
+ color: _ui.COLORS.s4
185
+ },
186
+ children: [summaryCounts.total, " servicios \xB7 ", summaryCounts.pending, " te", " ", summaryCounts.pending === 1 ? "toca" : "tocan", " a ti"]
187
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(Team, {
188
+ assignees: service === null || service === void 0 ? void 0 : service.assignees,
189
+ userId: userId
190
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Stack, {
191
+ direction: "row",
192
+ spacing: 1,
193
+ sx: {
194
+ ml: "auto"
195
+ },
196
+ children: canSave && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
197
+ variant: "contained",
198
+ startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_SaveOutlined.default, {
199
+ sx: {
200
+ fontSize: 18
201
+ }
202
+ }),
203
+ sx: _ui.primaryButtonSx,
204
+ children: "Guardar"
205
+ })
206
+ })]
207
+ });
208
+ };
209
+
210
+ exports.ServiceToolbar = ServiceToolbar;
@@ -0,0 +1,138 @@
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.default = exports.VeinteServiciosListaContraida = exports.VeinteServiciosEspecialistaImagenes = exports.VeinteServiciosCoordinadora = exports.VeinteServiciosCelular = exports.SoloTraduccion = exports.CuatroServiciosEspecialistaTextos = exports.CuatroServiciosCoordinadora = void 0;
9
+
10
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
11
+
12
+ var _index = require("./index");
13
+
14
+ var _catalog = require("./catalog");
15
+
16
+ var _model = require("./model");
17
+
18
+ var _jsxRuntime = require("react/jsx-runtime");
19
+
20
+ /*
21
+ Prototipo de la navegación por servicios en la edición de producto.
22
+ Datos de ejemplo: no le pega a ninguna API.
23
+
24
+ Cada historia es el mismo producto visto por una persona distinta. Lo que hay
25
+ que probar es la navegación: la lista lateral, «Míos / Todos», el Resumen y,
26
+ en las de imágenes, el selector de servicio dentro de la vista.
27
+ */
28
+ var _default = {
29
+ title: "Prototipos/Navegación por servicios",
30
+ // Id sin acento, para que la liga de cada historia se pueda compartir.
31
+ id: "prototipos-navegacion-servicios",
32
+ component: _index.ServicesNavigation,
33
+ parameters: {
34
+ layout: "fullscreen"
35
+ }
36
+ }; // Como en la app: la edición vive en una caja de altura fija.
37
+
38
+ exports.default = _default;
39
+
40
+ var Template = function Template(args) {
41
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
42
+ style: {
43
+ height: "100vh",
44
+ display: "flex",
45
+ overflow: "hidden"
46
+ },
47
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.ServicesNavigation, (0, _objectSpread2.default)({}, args))
48
+ });
49
+ };
50
+
51
+ var ana = _catalog.DEMO_USERS.ana,
52
+ carlos = _catalog.DEMO_USERS.carlos,
53
+ diana = _catalog.DEMO_USERS.diana,
54
+ helena = _catalog.DEMO_USERS.helena;
55
+ var FOUR_SERVICES = (0, _catalog.buildServices)([["datasheet", "AS", {
56
+ especialist: ana
57
+ }], ["description", "RA/AS", {
58
+ especialist: ana
59
+ }], ["images", "PA"], ["translation", "CA", {
60
+ especialist: diana
61
+ }]]);
62
+ /** El producto solo lleva Traducción: no hay lista, abre directo en ella. */
63
+
64
+ var SoloTraduccion = Template.bind({});
65
+ exports.SoloTraduccion = SoloTraduccion;
66
+ SoloTraduccion.storyName = "Solo Traducción";
67
+ SoloTraduccion.args = {
68
+ product: _catalog.DEMO_PRODUCT,
69
+ services: (0, _catalog.buildServices)([["translation", "CA", {
70
+ especialist: diana
71
+ }]]),
72
+ currentUser: diana,
73
+ currentUserRole: "Especialista de traducción"
74
+ };
75
+ /** Caso de hoy (3 o 4 servicios), visto por la coordinadora: ve todos. */
76
+
77
+ var CuatroServiciosCoordinadora = Template.bind({});
78
+ exports.CuatroServiciosCoordinadora = CuatroServiciosCoordinadora;
79
+ CuatroServiciosCoordinadora.storyName = "4 servicios · coordinadora";
80
+ CuatroServiciosCoordinadora.args = {
81
+ product: _catalog.DEMO_PRODUCT,
82
+ services: FOUR_SERVICES,
83
+ currentUser: helena,
84
+ currentUserRole: "Coordinadora"
85
+ };
86
+ /** Mismo producto, visto por la especialista de textos: «Míos» por omisión. */
87
+
88
+ var CuatroServiciosEspecialistaTextos = Template.bind({});
89
+ exports.CuatroServiciosEspecialistaTextos = CuatroServiciosEspecialistaTextos;
90
+ CuatroServiciosEspecialistaTextos.storyName = "4 servicios · especialista de textos";
91
+ CuatroServiciosEspecialistaTextos.args = {
92
+ product: _catalog.DEMO_PRODUCT,
93
+ services: FOUR_SERVICES,
94
+ currentUser: ana,
95
+ currentUserRole: "Especialista de textos"
96
+ };
97
+ /** 20 servicios; el especialista de imágenes solo ve sus 3 hasta que pide «Todos». */
98
+
99
+ var VeinteServiciosEspecialistaImagenes = Template.bind({});
100
+ exports.VeinteServiciosEspecialistaImagenes = VeinteServiciosEspecialistaImagenes;
101
+ VeinteServiciosEspecialistaImagenes.storyName = "20 servicios · especialista de imágenes";
102
+ VeinteServiciosEspecialistaImagenes.args = {
103
+ product: _catalog.DEMO_PRODUCT,
104
+ services: _catalog.TWENTY_SERVICES,
105
+ currentUser: carlos,
106
+ currentUserRole: "Especialista de imágenes"
107
+ };
108
+ /** 20 servicios vistos por la coordinadora: entra al Resumen. */
109
+
110
+ var VeinteServiciosCoordinadora = Template.bind({});
111
+ exports.VeinteServiciosCoordinadora = VeinteServiciosCoordinadora;
112
+ VeinteServiciosCoordinadora.storyName = "20 servicios · coordinadora";
113
+ VeinteServiciosCoordinadora.args = {
114
+ product: _catalog.DEMO_PRODUCT,
115
+ services: _catalog.TWENTY_SERVICES,
116
+ currentUser: helena,
117
+ currentUserRole: "Coordinadora",
118
+ initialService: _model.SUMMARY
119
+ };
120
+ /** La lista contraída a íconos, para dejarle todo el ancho al editor. */
121
+
122
+ var VeinteServiciosListaContraida = Template.bind({});
123
+ exports.VeinteServiciosListaContraida = VeinteServiciosListaContraida;
124
+ VeinteServiciosListaContraida.storyName = "20 servicios · lista contraída";
125
+ VeinteServiciosListaContraida.args = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, VeinteServiciosEspecialistaImagenes.args), {}, {
126
+ initialCollapsed: true
127
+ });
128
+ /** En celular la lista se abre como panel con el botón «Servicios». */
129
+
130
+ var VeinteServiciosCelular = Template.bind({});
131
+ exports.VeinteServiciosCelular = VeinteServiciosCelular;
132
+ VeinteServiciosCelular.storyName = "20 servicios · celular";
133
+ VeinteServiciosCelular.args = VeinteServiciosEspecialistaImagenes.args;
134
+ VeinteServiciosCelular.parameters = {
135
+ viewport: {
136
+ defaultViewport: "mobile2"
137
+ }
138
+ };