contentoh-components-library 21.6.57 → 21.6.59

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 (49) hide show
  1. package/.claude/settings.local.json +7 -0
  2. package/dist/components/pages/CreatorsProductEdition/CreatorsProductEditionView.js +90 -135
  3. package/dist/components/pages/CreatorsProductEdition/hooks/useCreatorsProductEdition.js +148 -162
  4. package/dist/components/pages/CreatorsProductEdition/mocks/api.fixtures.js +16 -0
  5. package/dist/components/pages/CreatorsProductEdition/mocks/mockApi.js +1 -0
  6. package/dist/components/pages/CreatorsProductEdition/sections/ImageGallery.js +433 -0
  7. package/dist/components/pages/CreatorsProductEdition/sections/NoticeDialog.js +155 -0
  8. package/dist/components/pages/CreatorsProductEdition/sections/RejectDialog.js +201 -0
  9. package/dist/components/pages/CreatorsProductEdition/sections/VersionDrawer.js +615 -0
  10. package/dist/components/pages/CreatorsProductEdition/stories/CreatorsProductEdition.stories.js +3 -31
  11. package/dist/components/pages/CreatorsProductEdition/stories/CreatorsProductEditionAPI.stories.js +55 -30
  12. package/dist/components/pages/CreatorsProductEdition/stories/products.js +923 -0
  13. package/dist/components/pages/CreatorsProductEdition/styles.js +27 -7
  14. package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +2 -1
  15. package/dist/components/pages/ProviderProductEdition/context/provider-product-edition.context.js +325 -10
  16. package/dist/components/pages/ProviderProductEdition/context/provider-product-edition.reducer.js +12 -2
  17. package/dist/components/pages/ProviderProductEdition/index.js +486 -231
  18. package/dist/index.js +13 -0
  19. package/package.json +1 -1
  20. package/src/components/pages/CreatorsProductEdition/CreatorsProductEditionView.jsx +777 -0
  21. package/src/components/pages/CreatorsProductEdition/constants.js +21 -0
  22. package/src/components/pages/CreatorsProductEdition/hooks/useCreatorsProductEdition.js +2238 -0
  23. package/src/components/pages/CreatorsProductEdition/index.js +19 -0
  24. package/src/components/pages/CreatorsProductEdition/mocks/api.fixtures.js +357 -0
  25. package/src/components/pages/CreatorsProductEdition/mocks/mockApi.js +144 -0
  26. package/src/components/pages/CreatorsProductEdition/sections/CommentBox.jsx +183 -0
  27. package/src/components/pages/CreatorsProductEdition/sections/ImageGallery.jsx +269 -0
  28. package/src/components/pages/CreatorsProductEdition/sections/ImagePanel.jsx +332 -0
  29. package/src/components/pages/CreatorsProductEdition/sections/ImagesSection.jsx +385 -0
  30. package/src/components/pages/CreatorsProductEdition/sections/NoticeDialog.jsx +111 -0
  31. package/src/components/pages/CreatorsProductEdition/sections/ProductHeader.jsx +305 -0
  32. package/src/components/pages/CreatorsProductEdition/sections/ProductMedia.jsx +101 -0
  33. package/src/components/pages/CreatorsProductEdition/sections/RejectDialog.jsx +125 -0
  34. package/src/components/pages/CreatorsProductEdition/sections/RetailerMenu.jsx +129 -0
  35. package/src/components/pages/CreatorsProductEdition/sections/ServiceActions.jsx +382 -0
  36. package/src/components/pages/CreatorsProductEdition/sections/StatusChip.jsx +37 -0
  37. package/src/components/pages/CreatorsProductEdition/sections/TabsBar.jsx +187 -0
  38. package/src/components/pages/CreatorsProductEdition/sections/VariantsPanel.jsx +311 -0
  39. package/src/components/pages/CreatorsProductEdition/sections/VersionDrawer.jsx +357 -0
  40. package/src/components/pages/CreatorsProductEdition/sections/tokens.js +63 -0
  41. package/src/components/pages/CreatorsProductEdition/stories/CreatorsProductEdition.stories.js +111 -0
  42. package/src/components/pages/CreatorsProductEdition/stories/CreatorsProductEditionAPI.stories.js +85 -0
  43. package/src/components/pages/CreatorsProductEdition/stories/products.js +966 -0
  44. package/src/components/pages/CreatorsProductEdition/styles.js +178 -0
  45. package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +1 -0
  46. package/src/components/pages/ProviderProductEdition/context/provider-product-edition.context.jsx +201 -0
  47. package/src/components/pages/ProviderProductEdition/context/provider-product-edition.reducer.js +12 -0
  48. package/src/components/pages/ProviderProductEdition/index.js +228 -7
  49. package/src/index.js +1 -0
@@ -0,0 +1,433 @@
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.ImageGallery = void 0;
9
+
10
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
11
+
12
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
13
+
14
+ var _react = require("react");
15
+
16
+ var _material = require("@mui/material");
17
+
18
+ var _Close = _interopRequireDefault(require("@mui/icons-material/Close"));
19
+
20
+ var _ChevronLeft = _interopRequireDefault(require("@mui/icons-material/ChevronLeft"));
21
+
22
+ var _ChevronRight = _interopRequireDefault(require("@mui/icons-material/ChevronRight"));
23
+
24
+ var _react2 = require("swiper/react");
25
+
26
+ var _swiper = require("swiper");
27
+
28
+ require("swiper/swiper.min.css");
29
+
30
+ var _acceptIcon = _interopRequireDefault(require("../../../../assets/images/generalButton/acceptIcon.svg"));
31
+
32
+ var _rejectIcon = _interopRequireDefault(require("../../../../assets/images/generalButton/rejectIcon.svg"));
33
+
34
+ var _nullIcon = _interopRequireDefault(require("../../../../assets/images/generalButton/nullIcon.svg"));
35
+
36
+ var _ProductMedia = require("./ProductMedia");
37
+
38
+ var _tokens = require("./tokens");
39
+
40
+ var _jsxRuntime = require("react/jsx-runtime");
41
+
42
+ /*
43
+ Galería de imágenes en grande.
44
+
45
+ Reemplaza a `organisms/ProductImageModal` con los mismos props y hecho con el
46
+ Dialog de MUI. El original ponía la imagen y un panel de 375px mínimo lado a
47
+ lado, así que en celular no cabía. Aquí:
48
+ - en desktop, imagen a la izquierda y datos + miniaturas a la derecha;
49
+ - en celular, pantalla completa: imagen arriba y datos debajo.
50
+ Se navega con las flechas del teclado o con los botones sobre la imagen.
51
+
52
+ La imagen grande es la original de S3 (`srcDB`), como en el original; las
53
+ miniaturas usan la versión reducida (`src`). Una imagen recién agregada aún
54
+ no tiene `srcDB`, así que se usa su `src` local.
55
+ */
56
+ var bucketUrl = function bucketUrl(image) {
57
+ return image !== null && image !== void 0 && image.srcDB ? "https://".concat(process.env.REACT_APP_IMAGES_BUCKET, ".s3.amazonaws.com/").concat(image.srcDB) : image === null || image === void 0 ? void 0 : image.src;
58
+ };
59
+
60
+ var VALIDATION_ICONS = {
61
+ approve: _acceptIcon.default,
62
+ reject: _rejectIcon.default
63
+ };
64
+
65
+ var DataRow = function DataRow(_ref) {
66
+ var label = _ref.label,
67
+ value = _ref.value;
68
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Stack, {
69
+ direction: "row",
70
+ justifyContent: "space-between",
71
+ gap: 2,
72
+ sx: {
73
+ py: "3px"
74
+ },
75
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
76
+ sx: {
77
+ fontFamily: _tokens.FONTS.AvenirNext,
78
+ fontSize: 12,
79
+ color: _tokens.COLORS.s3
80
+ },
81
+ children: label
82
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
83
+ sx: {
84
+ fontFamily: _tokens.FONTS.AvenirNext,
85
+ fontSize: 12,
86
+ color: _tokens.COLORS.white,
87
+ textAlign: "right",
88
+ overflowWrap: "anywhere"
89
+ },
90
+ children: value || "-"
91
+ })]
92
+ });
93
+ };
94
+
95
+ var arrowSx = {
96
+ position: "absolute",
97
+ top: "50%",
98
+ transform: "translateY(-50%)",
99
+ bgcolor: "rgba(40, 31, 51, 0.55)",
100
+ color: _tokens.COLORS.white,
101
+ "&:hover": {
102
+ bgcolor: "rgba(40, 31, 51, 0.8)"
103
+ }
104
+ };
105
+
106
+ var ImageGallery = function ImageGallery(_ref2) {
107
+ var _images$values, _images$inputs, _images$inputs$find, _VALIDATION_ICONS$val;
108
+
109
+ var _ref2$open = _ref2.open,
110
+ open = _ref2$open === void 0 ? true : _ref2$open,
111
+ _ref2$images = _ref2.images,
112
+ images = _ref2$images === void 0 ? {} : _ref2$images,
113
+ _ref2$initialIndex = _ref2.initialIndex,
114
+ initialIndex = _ref2$initialIndex === void 0 ? 0 : _ref2$initialIndex,
115
+ setShowModal = _ref2.setShowModal,
116
+ sendToFacilitator = _ref2.sendToFacilitator,
117
+ _ref2$approveRejectBu = _ref2.approveRejectButtons,
118
+ approveRejectButtons = _ref2$approveRejectBu === void 0 ? false : _ref2$approveRejectBu;
119
+ var values = (_images$values = images === null || images === void 0 ? void 0 : images.values) !== null && _images$values !== void 0 ? _images$values : [];
120
+
121
+ var _useState = (0, _react.useState)(initialIndex),
122
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
123
+ index = _useState2[0],
124
+ setIndex = _useState2[1];
125
+
126
+ var _useState3 = (0, _react.useState)(null),
127
+ _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
128
+ validation = _useState4[0],
129
+ setValidation = _useState4[1];
130
+
131
+ var _useState5 = (0, _react.useState)(null),
132
+ _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
133
+ menuAnchor = _useState6[0],
134
+ setMenuAnchor = _useState6[1];
135
+
136
+ var isPhone = (0, _material.useMediaQuery)("(max-width:599.95px)");
137
+ (0, _react.useEffect)(function () {
138
+ if (open) setIndex(Math.min(initialIndex, Math.max(values.length - 1, 0)));
139
+ }, [open, initialIndex]); // eslint-disable-line react-hooks/exhaustive-deps
140
+
141
+ var image = values[index];
142
+ var hasMany = values.length > 1;
143
+
144
+ var go = function go(step) {
145
+ return setIndex(function (i) {
146
+ return (i + step + values.length) % values.length;
147
+ });
148
+ };
149
+
150
+ var close = function close() {
151
+ return setShowModal(false);
152
+ };
153
+
154
+ var onKeyDown = function onKeyDown(e) {
155
+ if (!hasMany) return;
156
+ if (e.key === "ArrowRight") go(1);
157
+ if (e.key === "ArrowLeft") go(-1);
158
+ };
159
+
160
+ var validate = function validate(kind) {
161
+ setMenuAnchor(null);
162
+ setValidation(kind);
163
+ sendToFacilitator && sendToFacilitator(kind === "approve" ? "A" : "R");
164
+ };
165
+
166
+ var shotName = images === null || images === void 0 ? void 0 : (_images$inputs = images.inputs) === null || _images$inputs === void 0 ? void 0 : (_images$inputs$find = _images$inputs.find(function (f) {
167
+ return f.id === +(image === null || image === void 0 ? void 0 : image.image_id);
168
+ })) === null || _images$inputs$find === void 0 ? void 0 : _images$inputs$find.name;
169
+ var size = image !== null && image !== void 0 && image.width && image !== null && image !== void 0 && image.height ? "".concat(image.width, "x").concat(image.height, "px") : null;
170
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Dialog, {
171
+ open: open,
172
+ onClose: close,
173
+ onKeyDown: onKeyDown,
174
+ fullScreen: isPhone,
175
+ maxWidth: false,
176
+ PaperProps: {
177
+ sx: {
178
+ m: {
179
+ sm: 2
180
+ },
181
+ width: {
182
+ sm: "min(1200px, calc(100% - 32px))"
183
+ },
184
+ height: {
185
+ sm: "min(760px, calc(100% - 32px))"
186
+ },
187
+ maxHeight: "none",
188
+ borderRadius: {
189
+ xs: 0,
190
+ sm: "4px"
191
+ },
192
+ overflow: "hidden",
193
+ display: "flex",
194
+ flexDirection: {
195
+ xs: "column",
196
+ sm: "row"
197
+ },
198
+ bgcolor: _tokens.COLORS.deep_gray
199
+ }
200
+ },
201
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
202
+ sx: {
203
+ position: "relative",
204
+ flex: {
205
+ xs: "0 0 auto",
206
+ sm: "1 1 auto"
207
+ },
208
+ height: {
209
+ xs: "min(60vh, 100vw)",
210
+ sm: "auto"
211
+ },
212
+ minWidth: 0,
213
+ bgcolor: _tokens.COLORS.white
214
+ },
215
+ children: [image ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ProductMedia.ProductMedia, {
216
+ src: bucketUrl(image),
217
+ ext: image.ext,
218
+ alt: image.name
219
+ }, index) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Stack, {
220
+ alignItems: "center",
221
+ justifyContent: "center",
222
+ sx: {
223
+ height: "100%"
224
+ },
225
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
226
+ sx: {
227
+ color: _tokens.COLORS.s4
228
+ },
229
+ children: "Sin im\xE1genes"
230
+ })
231
+ }), hasMany && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
232
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
233
+ "aria-label": "Imagen anterior",
234
+ onClick: function onClick() {
235
+ return go(-1);
236
+ },
237
+ sx: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, arrowSx), {}, {
238
+ left: 8
239
+ }),
240
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChevronLeft.default, {})
241
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
242
+ "aria-label": "Imagen siguiente",
243
+ onClick: function onClick() {
244
+ return go(1);
245
+ },
246
+ sx: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, arrowSx), {}, {
247
+ right: 8
248
+ }),
249
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChevronRight.default, {})
250
+ })]
251
+ })]
252
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Stack, {
253
+ sx: {
254
+ flex: {
255
+ xs: "1 1 auto",
256
+ sm: "0 0 375px"
257
+ },
258
+ minHeight: 0,
259
+ p: "15px",
260
+ gap: 2,
261
+ overflowY: "auto",
262
+ color: _tokens.COLORS.white
263
+ },
264
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Stack, {
265
+ direction: "row",
266
+ alignItems: "center",
267
+ gap: 1,
268
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
269
+ title: image === null || image === void 0 ? void 0 : image.name,
270
+ sx: {
271
+ flex: 1,
272
+ minWidth: 0,
273
+ fontFamily: _tokens.FONTS.Raleway,
274
+ fontSize: 14,
275
+ overflow: "hidden",
276
+ textOverflow: "ellipsis",
277
+ whiteSpace: "nowrap"
278
+ },
279
+ children: (image === null || image === void 0 ? void 0 : image.name) || "-"
280
+ }), hasMany && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Typography, {
281
+ sx: {
282
+ fontFamily: _tokens.FONTS.AvenirNext,
283
+ fontSize: 12,
284
+ color: _tokens.COLORS.s3
285
+ },
286
+ children: [index + 1, "/", values.length]
287
+ }), approveRejectButtons && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
288
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
289
+ title: "Validar",
290
+ arrow: true,
291
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
292
+ "aria-label": "Validar",
293
+ onClick: function onClick(e) {
294
+ return setMenuAnchor(e.currentTarget);
295
+ },
296
+ sx: {
297
+ width: 30,
298
+ height: 30,
299
+ p: 0,
300
+ border: "1px solid ".concat(_tokens.COLORS.s2),
301
+ borderRadius: "50%"
302
+ },
303
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
304
+ component: "img",
305
+ src: (_VALIDATION_ICONS$val = VALIDATION_ICONS[validation]) !== null && _VALIDATION_ICONS$val !== void 0 ? _VALIDATION_ICONS$val : _nullIcon.default,
306
+ alt: "",
307
+ sx: {
308
+ width: 16
309
+ }
310
+ })
311
+ })
312
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Menu, {
313
+ anchorEl: menuAnchor,
314
+ open: Boolean(menuAnchor),
315
+ onClose: function onClose() {
316
+ return setMenuAnchor(null);
317
+ },
318
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.MenuItem, {
319
+ onClick: function onClick() {
320
+ return validate("approve");
321
+ },
322
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemIcon, {
323
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
324
+ component: "img",
325
+ src: _acceptIcon.default,
326
+ alt: "",
327
+ sx: {
328
+ width: 16
329
+ }
330
+ })
331
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemText, {
332
+ children: "Validado"
333
+ })]
334
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.MenuItem, {
335
+ onClick: function onClick() {
336
+ return validate("reject");
337
+ },
338
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemIcon, {
339
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
340
+ component: "img",
341
+ src: _rejectIcon.default,
342
+ alt: "",
343
+ sx: {
344
+ width: 16
345
+ }
346
+ })
347
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemText, {
348
+ children: "Rechazado"
349
+ })]
350
+ })]
351
+ })]
352
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
353
+ "aria-label": "Cerrar",
354
+ onClick: close,
355
+ sx: {
356
+ width: 30,
357
+ height: 30,
358
+ color: _tokens.COLORS.white,
359
+ border: "1px solid ".concat(_tokens.COLORS.s2),
360
+ borderRadius: "3px"
361
+ },
362
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Close.default, {
363
+ fontSize: "small"
364
+ })
365
+ })]
366
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
367
+ sx: {
368
+ borderTop: "1px solid ".concat(_tokens.COLORS.s4),
369
+ pt: 1
370
+ },
371
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(DataRow, {
372
+ label: "Tipo de toma",
373
+ value: shotName
374
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(DataRow, {
375
+ label: "Formato",
376
+ value: image === null || image === void 0 ? void 0 : image.ext
377
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(DataRow, {
378
+ label: "Tama\xF1o de imagen",
379
+ value: size
380
+ })]
381
+ }), hasMany && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
382
+ sx: {
383
+ mt: {
384
+ sm: "auto"
385
+ }
386
+ },
387
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_react2.Swiper, {
388
+ modules: [_swiper.FreeMode, _swiper.Mousewheel],
389
+ slidesPerView: "auto",
390
+ spaceBetween: 6,
391
+ freeMode: true,
392
+ mousewheel: {
393
+ forceToAxis: true
394
+ },
395
+ style: {
396
+ width: "100%"
397
+ },
398
+ children: values.map(function (item, i) {
399
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_react2.SwiperSlide, {
400
+ style: {
401
+ width: 85
402
+ },
403
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ButtonBase, {
404
+ "aria-label": "Ver imagen ".concat(i + 1),
405
+ "aria-pressed": i === index,
406
+ onClick: function onClick() {
407
+ return setIndex(i);
408
+ },
409
+ sx: {
410
+ width: 85,
411
+ height: 55,
412
+ borderRadius: "3px",
413
+ overflow: "hidden",
414
+ bgcolor: _tokens.COLORS.white,
415
+ outline: i === index ? "2px solid ".concat(_tokens.COLORS.magenta_s2) : "none",
416
+ outlineOffset: -2
417
+ },
418
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ProductMedia.ProductMedia, {
419
+ src: item.src,
420
+ ext: item.ext,
421
+ alt: item.altText,
422
+ thumbnail: true
423
+ })
424
+ })
425
+ }, "".concat(i, "-").concat(item === null || item === void 0 ? void 0 : item.name));
426
+ })
427
+ })
428
+ })]
429
+ })]
430
+ });
431
+ };
432
+
433
+ exports.ImageGallery = ImageGallery;
@@ -0,0 +1,155 @@
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.NoticeDialog = void 0;
9
+
10
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
11
+
12
+ var _material = require("@mui/material");
13
+
14
+ var _Close = _interopRequireDefault(require("@mui/icons-material/Close"));
15
+
16
+ var _tokens = require("./tokens");
17
+
18
+ var _jsxRuntime = require("react/jsx-runtime");
19
+
20
+ /*
21
+ Aviso de la edición de producto (guardado, error, confirmaciones).
22
+
23
+ Reemplaza a `atoms/GenericModal` + ScreenHeader con el mismo `state.modal`
24
+ (`image`, `title`, `message`, `buttons`) y el mismo diseño oscuro, hecho con
25
+ el Dialog de MUI: en celular no se sale de la pantalla (el original medía
26
+ 500px fijos) y se cierra con Escape o tocando fuera.
27
+
28
+ Los botones llegan con los `buttonType` de GeneralButton; se traducen a los
29
+ dos estilos que usa la pantalla: contorno blanco o relleno magenta.
30
+ */
31
+ var pill = {
32
+ minWidth: 140,
33
+ height: 40,
34
+ borderRadius: "20px",
35
+ textTransform: "none",
36
+ fontFamily: _tokens.FONTS.Raleway_500,
37
+ fontSize: 14,
38
+ boxShadow: "none",
39
+ "&:hover": {
40
+ boxShadow: "none"
41
+ }
42
+ };
43
+
44
+ var buttonSx = function buttonSx() {
45
+ var buttonType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
46
+ return buttonType.includes("white") ? (0, _objectSpread2.default)((0, _objectSpread2.default)({}, pill), {}, {
47
+ color: _tokens.COLORS.s2,
48
+ border: "1px solid ".concat(_tokens.COLORS.white),
49
+ "&:hover": (0, _objectSpread2.default)((0, _objectSpread2.default)({}, pill["&:hover"]), {}, {
50
+ bgcolor: "rgba(255,255,255,0.08)"
51
+ })
52
+ }) : (0, _objectSpread2.default)((0, _objectSpread2.default)({}, pill), {}, {
53
+ color: _tokens.COLORS.white,
54
+ bgcolor: _tokens.COLORS.magenta_s2,
55
+ "&:hover": (0, _objectSpread2.default)((0, _objectSpread2.default)({}, pill["&:hover"]), {}, {
56
+ bgcolor: _tokens.COLORS.secondary_magenta
57
+ })
58
+ });
59
+ };
60
+
61
+ var NoticeDialog = function NoticeDialog(_ref) {
62
+ var _ref$modal = _ref.modal,
63
+ modal = _ref$modal === void 0 ? {} : _ref$modal,
64
+ onClose = _ref.onClose;
65
+ var show = modal.show,
66
+ image = modal.image,
67
+ title = modal.title,
68
+ message = modal.message,
69
+ buttons = modal.buttons;
70
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Dialog, {
71
+ open: Boolean(show),
72
+ onClose: onClose,
73
+ fullWidth: true,
74
+ maxWidth: false,
75
+ PaperProps: {
76
+ sx: {
77
+ width: "min(500px, calc(100% - 32px))",
78
+ m: 2,
79
+ bgcolor: _tokens.COLORS.deep_gray,
80
+ borderRadius: "15px",
81
+ p: {
82
+ xs: "40px 20px 30px",
83
+ sm: "40px"
84
+ },
85
+ textAlign: "center",
86
+ color: _tokens.COLORS.white
87
+ }
88
+ },
89
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
90
+ "aria-label": "Cerrar",
91
+ onClick: onClose,
92
+ size: "small",
93
+ sx: {
94
+ position: "absolute",
95
+ top: 12,
96
+ right: 12,
97
+ color: _tokens.COLORS.white
98
+ },
99
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Close.default, {
100
+ fontSize: "small"
101
+ })
102
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Stack, {
103
+ alignItems: "center",
104
+ gap: 2.5,
105
+ children: [image && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
106
+ component: "img",
107
+ src: image,
108
+ alt: "",
109
+ sx: {
110
+ maxWidth: 64,
111
+ maxHeight: 64
112
+ }
113
+ }), title && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
114
+ sx: {
115
+ fontFamily: _tokens.FONTS.Raleway_600,
116
+ fontSize: 18,
117
+ lineHeight: 1.3
118
+ },
119
+ children: title
120
+ }), message && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
121
+ sx: {
122
+ fontFamily: _tokens.FONTS.Raleway,
123
+ fontSize: 16,
124
+ lineHeight: 1.4,
125
+ whiteSpace: "pre-wrap",
126
+ overflowWrap: "anywhere"
127
+ },
128
+ children: message
129
+ }), (buttons === null || buttons === void 0 ? void 0 : buttons.length) > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Stack, {
130
+ direction: {
131
+ xs: "column",
132
+ sm: "row"
133
+ },
134
+ justifyContent: "center",
135
+ gap: 2,
136
+ sx: {
137
+ mt: 1,
138
+ width: {
139
+ xs: "100%",
140
+ sm: "auto"
141
+ }
142
+ },
143
+ children: buttons.map(function (button, index) {
144
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
145
+ onClick: button.action,
146
+ sx: buttonSx(button.buttonType),
147
+ children: button.text
148
+ }, index);
149
+ })
150
+ })]
151
+ })]
152
+ });
153
+ };
154
+
155
+ exports.NoticeDialog = NoticeDialog;