contentoh-components-library 21.6.54 → 21.6.56
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.
- package/.claude/launch.json +14 -0
- package/.env.test +1 -0
- package/dist/components/atoms/IconFile/index.js +85 -2
- package/dist/components/atoms/IconFile/styles.js +1 -1
- package/dist/components/atoms/ProductImage/ProductImage.stories.js +70 -2
- package/dist/components/atoms/ProductImage/index.js +100 -27
- package/dist/components/atoms/ProductImage/styles.js +3 -1
- package/dist/components/molecules/EditionActiveImage/index.js +4 -2
- package/dist/components/molecules/GalleryElement/index.js +13 -4
- package/dist/components/molecules/GalleryHeader/index.js +96 -24
- package/dist/components/molecules/GalleryHeader/styles.js +4 -1
- package/dist/components/molecules/ImageSelector/index.js +1 -0
- package/dist/components/organisms/ImagePreviewer/index.js +1 -0
- package/dist/components/organisms/ProductImageModal/index.js +3 -2
- package/dist/components/pages/RetailerProductEdition/context/provider-product-edition.context.js +330 -15
- package/dist/components/pages/RetailerProductEdition/context/provider-product-edition.reducer.js +12 -2
- package/dist/components/pages/RetailerProductEdition/index.js +628 -428
- package/dist/components/pages/RetailerProductEdition/stories/ImageEditor.stories.js +1 -0
- package/dist/components/pages/RetailerProductEdition/utils.js +48 -1
- package/dist/global-files/data.js +16 -3
- package/dist/index.js +142 -90
- package/docs/activos-digitales.md +273 -0
- package/package.json +1 -1
- package/src/components/atoms/AssetPreview/AssetPreview.stories.js +78 -0
- package/src/components/atoms/AssetPreview/index.js +119 -0
- package/src/components/atoms/AssetPreview/styles.js +190 -0
- package/src/components/atoms/IconFile/index.js +28 -1
- package/src/components/atoms/IconFile/styles.js +8 -0
- package/src/components/atoms/ProductImage/ProductImage.stories.js +38 -0
- package/src/components/atoms/ProductImage/index.js +95 -20
- package/src/components/atoms/ProductImage/styles.js +92 -7
- package/src/components/molecules/EditionActiveImage/index.js +2 -2
- package/src/components/molecules/GalleryAssetElement/GalleryAssetElement.stories.js +102 -0
- package/src/components/molecules/GalleryAssetElement/index.js +162 -0
- package/src/components/molecules/GalleryAssetElement/styles.js +159 -0
- package/src/components/molecules/GalleryElement/index.js +9 -0
- package/src/components/molecules/GalleryHeader/index.js +65 -13
- package/src/components/molecules/GalleryHeader/styles.js +2 -1
- package/src/components/molecules/GalleryTrayTabs/GalleryTrayTabs.stories.js +32 -0
- package/src/components/molecules/GalleryTrayTabs/index.js +41 -0
- package/src/components/molecules/GalleryTrayTabs/styles.js +52 -0
- package/src/components/molecules/ImageSelector/index.js +1 -0
- package/src/components/organisms/DigitalAssetsTray/DigitalAssetsTray.stories.js +101 -0
- package/src/components/organisms/DigitalAssetsTray/index.js +189 -0
- package/src/components/organisms/DigitalAssetsTray/styles.js +183 -0
- package/src/components/organisms/ImagePreviewer/index.js +1 -0
- package/src/components/organisms/ProductImageModal/index.js +1 -0
- package/src/components/pages/RetailerProductEdition/context/provider-product-edition.context.jsx +201 -0
- package/src/components/pages/RetailerProductEdition/context/provider-product-edition.reducer.js +12 -0
- package/src/components/pages/RetailerProductEdition/index.js +379 -142
- package/src/components/pages/RetailerProductEdition/stories/ImageEditor.stories.js +1 -0
- package/src/components/pages/RetailerProductEdition/utils.js +34 -0
- package/src/global-files/data.js +17 -2
- package/src/global-files/digital-assets/assetTypes.js +419 -0
- package/src/global-files/digital-assets/assets.actions.js +50 -0
- package/src/global-files/digital-assets/assets.adapter.js +229 -0
- package/src/global-files/digital-assets/assets.mock.js +122 -0
- package/src/global-files/digital-assets/assets.reducer.js +197 -0
- package/src/global-files/digital-assets/uploadAssets.js +109 -0
- package/src/global-files/digital-assets/useDigitalAssets.js +329 -0
- package/src/index.js +4 -0
package/.env.test
CHANGED
|
@@ -75,3 +75,4 @@ REACT_APP_ENVIRONMENT=test
|
|
|
75
75
|
REACT_APP_REGION=us-east-1
|
|
76
76
|
REACT_APP_VARIANTS_ENDPOINT=https://7o2hp8msfl.execute-api.us-east-1.amazonaws.com/test/variants
|
|
77
77
|
REACT_APP_NEW_ARTICLES_ENDPOINT=https://7o2hp8msfl.execute-api.us-east-1.amazonaws.com/test/new-articles
|
|
78
|
+
REACT_APP_ASSETS_PRESIGN_ENDPOINT=https://7o2hp8msfl.execute-api.us-east-1.amazonaws.com/test/articles-assets/presign
|
|
@@ -69,14 +69,85 @@ var IconFile = function IconFile(props) {
|
|
|
69
69
|
type: "csv"
|
|
70
70
|
},
|
|
71
71
|
// file image
|
|
72
|
-
|
|
72
|
+
gif: {
|
|
73
73
|
icon: _freeSolidSvgIcons.faFileImage,
|
|
74
74
|
type: "image"
|
|
75
75
|
},
|
|
76
|
-
|
|
76
|
+
jpg: {
|
|
77
|
+
icon: _freeSolidSvgIcons.faFileImage,
|
|
78
|
+
type: "image"
|
|
79
|
+
},
|
|
80
|
+
jpeg: {
|
|
81
|
+
icon: _freeSolidSvgIcons.faFileImage,
|
|
82
|
+
type: "image"
|
|
83
|
+
},
|
|
84
|
+
png: {
|
|
77
85
|
icon: _freeSolidSvgIcons.faFileImage,
|
|
78
86
|
type: "image"
|
|
79
87
|
},
|
|
88
|
+
webp: {
|
|
89
|
+
icon: _freeSolidSvgIcons.faFileImage,
|
|
90
|
+
type: "image"
|
|
91
|
+
},
|
|
92
|
+
// archivos de diseño editables: no se pueden previsualizar en el navegador,
|
|
93
|
+
// así que el icono es lo único que distingue uno de otro en la bandeja.
|
|
94
|
+
psd: {
|
|
95
|
+
icon: _freeSolidSvgIcons.faSwatchbook,
|
|
96
|
+
type: "design"
|
|
97
|
+
},
|
|
98
|
+
psb: {
|
|
99
|
+
icon: _freeSolidSvgIcons.faSwatchbook,
|
|
100
|
+
type: "design"
|
|
101
|
+
},
|
|
102
|
+
ai: {
|
|
103
|
+
icon: _freeSolidSvgIcons.faSwatchbook,
|
|
104
|
+
type: "design"
|
|
105
|
+
},
|
|
106
|
+
eps: {
|
|
107
|
+
icon: _freeSolidSvgIcons.faSwatchbook,
|
|
108
|
+
type: "design"
|
|
109
|
+
},
|
|
110
|
+
indd: {
|
|
111
|
+
icon: _freeSolidSvgIcons.faSwatchbook,
|
|
112
|
+
type: "design"
|
|
113
|
+
},
|
|
114
|
+
idml: {
|
|
115
|
+
icon: _freeSolidSvgIcons.faSwatchbook,
|
|
116
|
+
type: "design"
|
|
117
|
+
},
|
|
118
|
+
sketch: {
|
|
119
|
+
icon: _freeSolidSvgIcons.faSwatchbook,
|
|
120
|
+
type: "design"
|
|
121
|
+
},
|
|
122
|
+
fig: {
|
|
123
|
+
icon: _freeSolidSvgIcons.faSwatchbook,
|
|
124
|
+
type: "design"
|
|
125
|
+
},
|
|
126
|
+
xd: {
|
|
127
|
+
icon: _freeSolidSvgIcons.faSwatchbook,
|
|
128
|
+
type: "design"
|
|
129
|
+
},
|
|
130
|
+
afphoto: {
|
|
131
|
+
icon: _freeSolidSvgIcons.faSwatchbook,
|
|
132
|
+
type: "design"
|
|
133
|
+
},
|
|
134
|
+
afdesign: {
|
|
135
|
+
icon: _freeSolidSvgIcons.faSwatchbook,
|
|
136
|
+
type: "design"
|
|
137
|
+
},
|
|
138
|
+
svg: {
|
|
139
|
+
icon: _freeSolidSvgIcons.faSwatchbook,
|
|
140
|
+
type: "design"
|
|
141
|
+
},
|
|
142
|
+
// proyectos de animación y edición de video
|
|
143
|
+
aep: {
|
|
144
|
+
icon: _freeSolidSvgIcons.faFilm,
|
|
145
|
+
type: "motion"
|
|
146
|
+
},
|
|
147
|
+
prproj: {
|
|
148
|
+
icon: _freeSolidSvgIcons.faFilm,
|
|
149
|
+
type: "motion"
|
|
150
|
+
},
|
|
80
151
|
// file pdf
|
|
81
152
|
pdf: {
|
|
82
153
|
icon: _freeSolidSvgIcons.faFilePdf,
|
|
@@ -132,6 +203,10 @@ var IconFile = function IconFile(props) {
|
|
|
132
203
|
icon: _freeSolidSvgIcons.faFileZipper,
|
|
133
204
|
type: "zip"
|
|
134
205
|
},
|
|
206
|
+
"7z": {
|
|
207
|
+
icon: _freeSolidSvgIcons.faFileZipper,
|
|
208
|
+
type: "zip"
|
|
209
|
+
},
|
|
135
210
|
// file code
|
|
136
211
|
xml: {
|
|
137
212
|
icon: _freeSolidSvgIcons.faFileCode,
|
|
@@ -198,6 +273,14 @@ var IconFile = function IconFile(props) {
|
|
|
198
273
|
icon: _freeSolidSvgIcons.faFileVideo,
|
|
199
274
|
type: "video"
|
|
200
275
|
},
|
|
276
|
+
mov: {
|
|
277
|
+
icon: _freeSolidSvgIcons.faFileVideo,
|
|
278
|
+
type: "video"
|
|
279
|
+
},
|
|
280
|
+
webm: {
|
|
281
|
+
icon: _freeSolidSvgIcons.faFileVideo,
|
|
282
|
+
type: "video"
|
|
283
|
+
},
|
|
201
284
|
mpeg: {
|
|
202
285
|
icon: _freeSolidSvgIcons.faFileVideo,
|
|
203
286
|
type: "video"
|
|
@@ -15,7 +15,7 @@ var _variables = require("../../../global-files/variables");
|
|
|
15
15
|
|
|
16
16
|
var _templateObject;
|
|
17
17
|
|
|
18
|
-
var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n width: fit-content;\n min-width: min-content;\n min-height: min-content;\n overflow: hidden;\n cursor: default;\n display: grid;\n place-items: center;\n padding: 0px;\n border-radius: ", ";\n border: none;\n\n // colores de acuerdo al tipo de icono\n &.icon-word .icon {\n color: #1f3780;\n border-color: #1f3780;\n }\n &.icon-excel .icon {\n color: #2d5639;\n border-color: #2d5639;\n }\n &.icon-csv .icon {\n color: #6b8e73;\n border-color: #6b8e73;\n }\n &.icon-image .icon {\n color: #ca7f4d;\n border-color: #ca7f4d;\n }\n &.icon-pdf .icon {\n color: #951a1a;\n border-color: #951a1a;\n }\n &.icon-powerPoint .icon {\n color: #ba4f19;\n border-color: #ba4f19;\n }\n &.icon-zip .icon {\n color: #b8950c;\n border-color: #b8950c;\n }\n &.icon-code .icon {\n color: #1c778e;\n border-color: #1c778e;\n }\n &.icon-video .icon {\n color: #a15bb1;\n border-color: #a15bb1;\n }\n &.icon-audio .icon {\n color: #3090e9;\n border-color: #3090e9;\n }\n &.icon-default .icon {\n color: #5e6265;\n border-color: #5e6265;\n }\n"])), function (_ref) {
|
|
18
|
+
var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n width: fit-content;\n min-width: min-content;\n min-height: min-content;\n overflow: hidden;\n cursor: default;\n display: grid;\n place-items: center;\n padding: 0px;\n border-radius: ", ";\n border: none;\n\n // colores de acuerdo al tipo de icono\n &.icon-word .icon {\n color: #1f3780;\n border-color: #1f3780;\n }\n &.icon-excel .icon {\n color: #2d5639;\n border-color: #2d5639;\n }\n &.icon-csv .icon {\n color: #6b8e73;\n border-color: #6b8e73;\n }\n &.icon-image .icon {\n color: #ca7f4d;\n border-color: #ca7f4d;\n }\n &.icon-pdf .icon {\n color: #951a1a;\n border-color: #951a1a;\n }\n &.icon-powerPoint .icon {\n color: #ba4f19;\n border-color: #ba4f19;\n }\n &.icon-zip .icon {\n color: #b8950c;\n border-color: #b8950c;\n }\n &.icon-code .icon {\n color: #1c778e;\n border-color: #1c778e;\n }\n &.icon-design .icon {\n color: #2a5cb8;\n border-color: #2a5cb8;\n }\n &.icon-motion .icon {\n color: #6d3fc0;\n border-color: #6d3fc0;\n }\n &.icon-video .icon {\n color: #a15bb1;\n border-color: #a15bb1;\n }\n &.icon-audio .icon {\n color: #3090e9;\n border-color: #3090e9;\n }\n &.icon-default .icon {\n color: #5e6265;\n border-color: #5e6265;\n }\n"])), function (_ref) {
|
|
19
19
|
var borderType = _ref.borderType;
|
|
20
20
|
return (borderType === null || borderType === void 0 ? void 0 : borderType.toLowerCase()) === "rectangle" ? "6px" : (borderType === null || borderType === void 0 ? void 0 : borderType.toLowerCase()) === "circle" ? "50%" : "0px";
|
|
21
21
|
});
|
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.default = exports.Template = void 0;
|
|
8
|
+
exports.default = exports.VideoReproductor = exports.VideoMiniaturas = exports.Template = void 0;
|
|
9
9
|
|
|
10
10
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
11
11
|
|
|
@@ -36,4 +36,72 @@ var ProductImageDefault = Template.bind({});
|
|
|
36
36
|
ProductImageDefault.args = {
|
|
37
37
|
imageType: "main-image",
|
|
38
38
|
altText: "default image"
|
|
39
|
-
};
|
|
39
|
+
};
|
|
40
|
+
/*
|
|
41
|
+
Las escalas de video, lado a lado. Las cuatro primeras son miniaturas: sin
|
|
42
|
+
controles, con su duración y un botón de play, y todo el recuadro clicable.
|
|
43
|
+
Las dos últimas son reproductores de verdad.
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
var VIDEO = "https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4";
|
|
47
|
+
|
|
48
|
+
var Escala = function Escala(_ref) {
|
|
49
|
+
var imageType = _ref.imageType;
|
|
50
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("figure", {
|
|
51
|
+
style: {
|
|
52
|
+
margin: 0
|
|
53
|
+
},
|
|
54
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_.ProductImage, {
|
|
55
|
+
img: VIDEO,
|
|
56
|
+
ext: "mp4",
|
|
57
|
+
imageType: imageType,
|
|
58
|
+
altText: "video de producto",
|
|
59
|
+
onClick: function onClick() {
|
|
60
|
+
return console.log("clic en", imageType);
|
|
61
|
+
}
|
|
62
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("figcaption", {
|
|
63
|
+
style: {
|
|
64
|
+
fontFamily: "Lato",
|
|
65
|
+
fontSize: 11,
|
|
66
|
+
marginTop: 4
|
|
67
|
+
},
|
|
68
|
+
children: imageType
|
|
69
|
+
})]
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
var VideoMiniaturas = function VideoMiniaturas() {
|
|
74
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
75
|
+
style: {
|
|
76
|
+
display: "flex",
|
|
77
|
+
gap: 24,
|
|
78
|
+
alignItems: "flex-start"
|
|
79
|
+
},
|
|
80
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Escala, {
|
|
81
|
+
imageType: "carousel-image"
|
|
82
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(Escala, {
|
|
83
|
+
imageType: "catalogue-image-small-size"
|
|
84
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(Escala, {
|
|
85
|
+
imageType: "catalogue-modal-image"
|
|
86
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(Escala, {
|
|
87
|
+
imageType: "catalogue-image-big-size"
|
|
88
|
+
})]
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
exports.VideoMiniaturas = VideoMiniaturas;
|
|
93
|
+
|
|
94
|
+
var VideoReproductor = function VideoReproductor() {
|
|
95
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
96
|
+
style: {
|
|
97
|
+
display: "flex",
|
|
98
|
+
gap: 24,
|
|
99
|
+
alignItems: "flex-start"
|
|
100
|
+
},
|
|
101
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Escala, {
|
|
102
|
+
imageType: "main-image"
|
|
103
|
+
})
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
exports.VideoReproductor = VideoReproductor;
|
|
@@ -7,46 +7,119 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.ProductImage = void 0;
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
11
|
+
|
|
12
|
+
var _react = require("react");
|
|
11
13
|
|
|
12
14
|
var _reactImageFallback = _interopRequireDefault(require("react-image-fallback"));
|
|
13
15
|
|
|
16
|
+
var _styles = require("./styles");
|
|
17
|
+
|
|
18
|
+
var _assetTypes = require("../../../global-files/digital-assets/assetTypes");
|
|
19
|
+
|
|
14
20
|
var _defaultProductImage = _interopRequireDefault(require("../../../assets/images/defaultImages/defaultProductImage.png"));
|
|
15
21
|
|
|
16
22
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
23
|
|
|
24
|
+
/*
|
|
25
|
+
Tamaños en los que un video se muestra como miniatura y no como reproductor.
|
|
26
|
+
|
|
27
|
+
Los controles nativos del navegador necesitan alrededor de 150px de ancho
|
|
28
|
+
para ser usables; en un recuadro de 60 o de 85 se pintan encimados y no se
|
|
29
|
+
puede ni dar play. Peor aún, un <video> con controles se traga el clic, así
|
|
30
|
+
que un video en el carrusel no se podía ni seleccionar: `onClick` nunca
|
|
31
|
+
llegaba a correr.
|
|
32
|
+
|
|
33
|
+
En estos tamaños se muestra el primer fotograma con su duración y un botón de
|
|
34
|
+
play, y el recuadro completo lleva al visor grande, que es donde el video sí
|
|
35
|
+
se ve y se controla.
|
|
36
|
+
*/
|
|
37
|
+
var THUMBNAIL_TYPES = ["carousel-image", "catalogue-image-small-size", "catalogue-image-big-size", "catalogue-modal-image"];
|
|
38
|
+
|
|
39
|
+
var PlayBadge = function PlayBadge() {
|
|
40
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
41
|
+
className: "play-badge",
|
|
42
|
+
"aria-hidden": "true",
|
|
43
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("svg", {
|
|
44
|
+
viewBox: "0 0 24 24",
|
|
45
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("circle", {
|
|
46
|
+
cx: "12",
|
|
47
|
+
cy: "12",
|
|
48
|
+
r: "11"
|
|
49
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("polygon", {
|
|
50
|
+
points: "9.5,7.5 17,12 9.5,16.5"
|
|
51
|
+
})]
|
|
52
|
+
})
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Imagen —o video— de producto.
|
|
57
|
+
*
|
|
58
|
+
* El tipo de archivo se decide por `ext`/`mime` cuando quien llama los conoce.
|
|
59
|
+
* Antes se comprobaba con `/\.mp4$/` sobre la URL, y nunca acertaba: la URL
|
|
60
|
+
* guardada apunta al redimensionador de CloudFront y no conserva la extensión.
|
|
61
|
+
* El regex queda solo como respaldo para los llamadores que aún mandan `img`
|
|
62
|
+
* a secas.
|
|
63
|
+
*/
|
|
64
|
+
|
|
65
|
+
|
|
18
66
|
var ProductImage = function ProductImage(_ref) {
|
|
19
67
|
var img = _ref.img,
|
|
20
68
|
imageType = _ref.imageType,
|
|
21
69
|
altText = _ref.altText,
|
|
22
|
-
onClick = _ref.onClick
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
70
|
+
onClick = _ref.onClick,
|
|
71
|
+
ext = _ref.ext,
|
|
72
|
+
mime = _ref.mime,
|
|
73
|
+
poster = _ref.poster;
|
|
74
|
+
|
|
75
|
+
// La duración no está en la base: se toma de los metadatos, que el navegador
|
|
76
|
+
// ya descarga por el `preload="metadata"`. No cuesta una petición extra.
|
|
77
|
+
var _useState = (0, _react.useState)(null),
|
|
78
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
79
|
+
duration = _useState2[0],
|
|
80
|
+
setDuration = _useState2[1];
|
|
81
|
+
|
|
82
|
+
var kind = ext || mime ? (0, _assetTypes.resolvePreviewKind)({
|
|
83
|
+
ext: ext,
|
|
84
|
+
mime: mime
|
|
85
|
+
}) : /\.mp4($|[?#])/i.test(img || "") ? _assetTypes.ASSET_PREVIEW.VIDEO : _assetTypes.ASSET_PREVIEW.IMAGE;
|
|
86
|
+
|
|
87
|
+
if (kind === _assetTypes.ASSET_PREVIEW.VIDEO) {
|
|
88
|
+
var isThumbnail = THUMBNAIL_TYPES.includes(imageType);
|
|
89
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
|
|
90
|
+
className: "".concat(imageType, " ").concat(isThumbnail ? "video-thumbnail" : "video-player"),
|
|
91
|
+
onClick: isThumbnail ? onClick : undefined,
|
|
92
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("video", {
|
|
93
|
+
// `#t=0.5` hace que el navegador muestre el fotograma del medio
|
|
94
|
+
// segundo en lugar de un cuadro negro, sin descargar el archivo
|
|
95
|
+
// completo.
|
|
96
|
+
src: poster ? img : "".concat(img, "#t=0.5"),
|
|
97
|
+
poster: poster || undefined,
|
|
98
|
+
controls: !isThumbnail,
|
|
99
|
+
muted: isThumbnail,
|
|
100
|
+
playsInline: true,
|
|
101
|
+
preload: "metadata",
|
|
102
|
+
onLoadedMetadata: function onLoadedMetadata(e) {
|
|
103
|
+
return setDuration(e.target.duration);
|
|
104
|
+
}
|
|
105
|
+
}), isThumbnail && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
106
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(PlayBadge, {}), duration ? /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
107
|
+
className: "video-duration",
|
|
108
|
+
children: (0, _assetTypes.formatDuration)(duration)
|
|
109
|
+
}) : null]
|
|
110
|
+
})]
|
|
48
111
|
});
|
|
49
112
|
}
|
|
113
|
+
|
|
114
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Container, {
|
|
115
|
+
className: imageType,
|
|
116
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactImageFallback.default, {
|
|
117
|
+
src: img,
|
|
118
|
+
fallbackImage: _defaultProductImage.default,
|
|
119
|
+
alt: altText,
|
|
120
|
+
onClick: onClick
|
|
121
|
+
})
|
|
122
|
+
});
|
|
50
123
|
};
|
|
51
124
|
|
|
52
125
|
exports.ProductImage = ProductImage;
|
|
@@ -11,8 +11,10 @@ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/hel
|
|
|
11
11
|
|
|
12
12
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
13
13
|
|
|
14
|
+
var _variables = require("../../../global-files/variables");
|
|
15
|
+
|
|
14
16
|
var _templateObject;
|
|
15
17
|
|
|
16
|
-
var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n width: fit-content;\n\n img {\n object-fit: contain;\n }\n\n &.carousel-image {\n img {\n width: 85px;\n height: 55px;\n cursor: pointer;\n }\n\n & + * {\n margin-left: 1px;\n }\n }\n\n &.main-image {\n img {\n width: 340px;\n height: 295px;\n }\n }\n\n &.catalogue-image-big-size {\n display: flex; \n justify-content: center; \n align-items: center; \n img {\n width: 179px;\n height: 179px;\n }\n }\n\n &.catalogue-image-small-size {\n img {\n width: 60px;\n height: 60px;\n }\n }\n\n &.catalogue-modal-image {\n flex: 1 0 50%;\n cursor: pointer;\n\n img {\n width: 168px;\n height: 108px;\n }\n }\n\n &.expanded-modal-image {\n width: 710px;\n height: 710px;\n display: flex; \n justify-content: center; \n align-items: center; \n\n img {\n width: 710px;\n height: 710px;\n }\n }\n"])));
|
|
18
|
+
var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n width: fit-content;\n\n img,\n video {\n object-fit: contain;\n }\n\n /*\n Miniatura de video: fotograma quieto, con su duraci\xF3n y un bot\xF3n de play.\n El clic lo recibe el contenedor, no el <video>, para que lleve al visor\n grande en vez de quedarse peleando con los controles.\n */\n &.video-thumbnail {\n position: relative;\n cursor: pointer;\n\n video {\n pointer-events: none;\n background: #000;\n }\n\n .play-badge {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n width: 32px;\n height: 32px;\n pointer-events: none;\n\n svg {\n width: 100%;\n height: 100%;\n display: block;\n }\n\n circle {\n fill: rgba(0, 0, 0, 0.55);\n }\n\n polygon {\n fill: #ffffff;\n }\n }\n\n &:hover .play-badge circle {\n fill: rgba(0, 0, 0, 0.75);\n }\n\n .video-duration {\n position: absolute;\n right: 4px;\n bottom: 4px;\n padding: 0 4px;\n border-radius: 3px;\n background: rgba(0, 0, 0, 0.75);\n color: #ffffff;\n font-family: ", ";\n font-size: 10px;\n line-height: 15px;\n pointer-events: none;\n }\n }\n\n /* En 60px un badge de 32 tapa el fotograma completo. */\n &.catalogue-image-small-size.video-thumbnail .play-badge {\n width: 20px;\n height: 20px;\n }\n\n &.carousel-image.video-thumbnail {\n .play-badge {\n width: 22px;\n height: 22px;\n }\n\n .video-duration {\n font-size: 9px;\n line-height: 13px;\n }\n }\n\n &.carousel-image {\n img,\n video {\n width: 85px;\n height: 55px;\n cursor: pointer;\n }\n\n & + * {\n margin-left: 1px;\n }\n }\n\n &.main-image {\n img,\n video {\n width: 340px;\n height: 295px;\n }\n }\n\n &.catalogue-image-big-size {\n display: flex; \n justify-content: center; \n align-items: center; \n img,\n video {\n width: 179px;\n height: 179px;\n }\n }\n\n &.catalogue-image-small-size {\n img,\n video {\n width: 60px;\n height: 60px;\n }\n }\n\n &.catalogue-modal-image {\n flex: 1 0 50%;\n cursor: pointer;\n\n img,\n\n video {\n width: 168px;\n height: 108px;\n }\n }\n\n &.expanded-modal-image {\n width: 710px;\n height: 710px;\n display: flex; \n justify-content: center; \n align-items: center; \n\n img,\n\n video {\n width: 710px;\n height: 710px;\n }\n }\n"])), _variables.FontFamily.Lato);
|
|
17
19
|
|
|
18
20
|
exports.Container = Container;
|
|
@@ -16,12 +16,14 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
16
16
|
var EditionActiveImage = function EditionActiveImage(_ref) {
|
|
17
17
|
var img = _ref.img,
|
|
18
18
|
altText = _ref.altText,
|
|
19
|
-
setShowModal = _ref.setShowModal
|
|
19
|
+
setShowModal = _ref.setShowModal,
|
|
20
|
+
ext = _ref.ext;
|
|
20
21
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
|
|
21
22
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_index.ProductImage, {
|
|
22
23
|
img: img,
|
|
23
24
|
imageType: "main-image",
|
|
24
|
-
altText: altText
|
|
25
|
+
altText: altText,
|
|
26
|
+
ext: ext
|
|
25
27
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.Button, {
|
|
26
28
|
buttonType: "open-modal-button",
|
|
27
29
|
onClick: function onClick() {
|
|
@@ -36,7 +36,7 @@ var _Tooltip = require("../../atoms/Tooltip");
|
|
|
36
36
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
37
37
|
|
|
38
38
|
var GalleryElement = function GalleryElement(_ref) {
|
|
39
|
-
var _auditImages$values$n, _auditImages$values$n2;
|
|
39
|
+
var _auditImages$values$n, _auditImages$values$n2, _auditImages$values$n3;
|
|
40
40
|
|
|
41
41
|
var image = _ref.image,
|
|
42
42
|
_ref$gridLayout = _ref.gridLayout,
|
|
@@ -54,7 +54,8 @@ var GalleryElement = function GalleryElement(_ref) {
|
|
|
54
54
|
setCheckAll = _ref.setCheckAll,
|
|
55
55
|
auditImages = _ref.auditImages,
|
|
56
56
|
compare = _ref.compare,
|
|
57
|
-
updateApprovedInputsImages = _ref.updateApprovedInputsImages
|
|
57
|
+
updateApprovedInputsImages = _ref.updateApprovedInputsImages,
|
|
58
|
+
onSelect = _ref.onSelect;
|
|
58
59
|
|
|
59
60
|
var _useState = (0, _react.useState)(false),
|
|
60
61
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
@@ -133,8 +134,16 @@ var GalleryElement = function GalleryElement(_ref) {
|
|
|
133
134
|
className: "image-container",
|
|
134
135
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ProductImage.ProductImage, {
|
|
135
136
|
img: compare ? auditImages === null || auditImages === void 0 ? void 0 : (_auditImages$values$n2 = auditImages.values[number]) === null || _auditImages$values$n2 === void 0 ? void 0 : _auditImages$values$n2.src : image === null || image === void 0 ? void 0 : image.src,
|
|
136
|
-
altText: image === null || image === void 0 ? void 0 : image.altText
|
|
137
|
-
|
|
137
|
+
altText: image === null || image === void 0 ? void 0 : image.altText // Sin `ext`, un video se pinta como <img> rota: la URL guardada no
|
|
138
|
+
// conserva la extensión del archivo.
|
|
139
|
+
,
|
|
140
|
+
ext: compare ? auditImages === null || auditImages === void 0 ? void 0 : (_auditImages$values$n3 = auditImages.values[number]) === null || _auditImages$values$n3 === void 0 ? void 0 : _auditImages$values$n3.ext : image === null || image === void 0 ? void 0 : image.ext,
|
|
141
|
+
imageType: "catalogue-image-".concat(gridLayout ? "big" : "small", "-size") // La miniatura de un video ya no lleva controles, así que el clic es
|
|
142
|
+
// la única forma de llegar al visor grande. Se aplica también a las
|
|
143
|
+
// imágenes: dos recuadros idénticos donde solo uno responde al clic
|
|
144
|
+
// sería peor que no responder ninguno.
|
|
145
|
+
,
|
|
146
|
+
onClick: onSelect
|
|
138
147
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
139
148
|
className: "information-container",
|
|
140
149
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.GalleryHeader = void 0;
|
|
6
|
+
exports.GalleryHeader = exports.GALLERY_COLUMNS = void 0;
|
|
7
7
|
|
|
8
8
|
var _styles = require("./styles");
|
|
9
9
|
|
|
@@ -11,13 +11,97 @@ var _CheckBox = require("../../atoms/CheckBox");
|
|
|
11
11
|
|
|
12
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
13
|
|
|
14
|
+
/*
|
|
15
|
+
Las columnas de la bandeja dependen de qué se está listando: un PDF no tiene
|
|
16
|
+
"tipo de toma" ni alto por ancho, y una foto no tiene "tipo de activo".
|
|
17
|
+
Estaban escritas a mano en el marcado, así que la única forma de cambiarlas
|
|
18
|
+
era duplicar el componente.
|
|
19
|
+
|
|
20
|
+
El preset `image` reproduce exactamente las columnas y clases de antes, para
|
|
21
|
+
que la bandeja de imágenes se vea idéntica sin que nadie tenga que pasar nada.
|
|
22
|
+
*/
|
|
23
|
+
var GALLERY_COLUMNS = {
|
|
24
|
+
image: {
|
|
25
|
+
template: "0.1fr 1fr 1fr 1fr 1fr 1fr",
|
|
26
|
+
columns: [{
|
|
27
|
+
key: "preview",
|
|
28
|
+
label: "Imagen",
|
|
29
|
+
className: "image-header"
|
|
30
|
+
}, {
|
|
31
|
+
key: "name",
|
|
32
|
+
label: "Nombre",
|
|
33
|
+
className: "image-name"
|
|
34
|
+
}, {
|
|
35
|
+
key: "size",
|
|
36
|
+
label: "Tamaño",
|
|
37
|
+
className: "image-size"
|
|
38
|
+
}, {
|
|
39
|
+
key: "format",
|
|
40
|
+
label: "Formato",
|
|
41
|
+
className: "image-format"
|
|
42
|
+
}, {
|
|
43
|
+
key: "legend",
|
|
44
|
+
label: "¿Tiene leyenda?",
|
|
45
|
+
className: "image-description"
|
|
46
|
+
}, {
|
|
47
|
+
key: "shotType",
|
|
48
|
+
label: "Tipo de toma",
|
|
49
|
+
className: "shoot-type"
|
|
50
|
+
}]
|
|
51
|
+
},
|
|
52
|
+
asset: {
|
|
53
|
+
template: "0.1fr 1fr 1fr 1fr 1fr",
|
|
54
|
+
columns: [{
|
|
55
|
+
key: "preview",
|
|
56
|
+
label: "Activo",
|
|
57
|
+
className: "asset-header"
|
|
58
|
+
}, {
|
|
59
|
+
key: "name",
|
|
60
|
+
label: "Nombre",
|
|
61
|
+
className: "asset-name"
|
|
62
|
+
}, {
|
|
63
|
+
key: "weight",
|
|
64
|
+
label: "Peso",
|
|
65
|
+
className: "asset-weight"
|
|
66
|
+
}, {
|
|
67
|
+
key: "format",
|
|
68
|
+
label: "Formato",
|
|
69
|
+
className: "asset-format"
|
|
70
|
+
}, {
|
|
71
|
+
key: "assetType",
|
|
72
|
+
label: "Tipo de activo",
|
|
73
|
+
className: "asset-type"
|
|
74
|
+
}]
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Encabezado de la bandeja, con su casilla de "seleccionar todo".
|
|
79
|
+
*
|
|
80
|
+
* `checkAllId` e `itemSelector` se pueden cambiar porque imágenes y activos
|
|
81
|
+
* conviven en la misma pestaña: si las dos listas compartieran el id de la
|
|
82
|
+
* casilla global, marcar todas las imágenes marcaría también los activos.
|
|
83
|
+
*/
|
|
84
|
+
|
|
85
|
+
exports.GALLERY_COLUMNS = GALLERY_COLUMNS;
|
|
86
|
+
|
|
14
87
|
var GalleryHeader = function GalleryHeader(_ref) {
|
|
88
|
+
var _GALLERY_COLUMNS$vari;
|
|
89
|
+
|
|
15
90
|
var setCheckAll = _ref.setCheckAll,
|
|
16
91
|
setSelectedImages = _ref.setSelectedImages,
|
|
17
|
-
shotThd = _ref.shotThd
|
|
92
|
+
shotThd = _ref.shotThd,
|
|
93
|
+
_ref$variant = _ref.variant,
|
|
94
|
+
variant = _ref$variant === void 0 ? "image" : _ref$variant,
|
|
95
|
+
columns = _ref.columns,
|
|
96
|
+
_ref$checkAllId = _ref.checkAllId,
|
|
97
|
+
checkAllId = _ref$checkAllId === void 0 ? "check-all-images" : _ref$checkAllId,
|
|
98
|
+
_ref$itemSelector = _ref.itemSelector,
|
|
99
|
+
itemSelector = _ref$itemSelector === void 0 ? "[id^='gallery-element-']" : _ref$itemSelector;
|
|
100
|
+
var preset = (_GALLERY_COLUMNS$vari = GALLERY_COLUMNS[variant]) !== null && _GALLERY_COLUMNS$vari !== void 0 ? _GALLERY_COLUMNS$vari : GALLERY_COLUMNS.image;
|
|
101
|
+
var visibleColumns = columns !== null && columns !== void 0 ? columns : preset.columns;
|
|
18
102
|
|
|
19
103
|
var checkAll = function checkAll(e) {
|
|
20
|
-
var checkboxList = document.querySelectorAll(
|
|
104
|
+
var checkboxList = document.querySelectorAll(itemSelector);
|
|
21
105
|
checkboxList.forEach(function (chk) {
|
|
22
106
|
return chk.checked = e.target.checked;
|
|
23
107
|
});
|
|
@@ -26,35 +110,23 @@ var GalleryHeader = function GalleryHeader(_ref) {
|
|
|
26
110
|
};
|
|
27
111
|
|
|
28
112
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
|
|
113
|
+
template: preset.template,
|
|
29
114
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
30
115
|
className: "checkbox",
|
|
31
116
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CheckBox.CheckBox, {
|
|
32
|
-
id:
|
|
117
|
+
id: checkAllId,
|
|
33
118
|
onChange: function onChange(e) {
|
|
34
119
|
return checkAll(e);
|
|
35
120
|
}
|
|
36
121
|
})
|
|
37
|
-
}), /*#__PURE__*/(0, _jsxRuntime.
|
|
122
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
38
123
|
className: "information",
|
|
39
|
-
children:
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
46
|
-
className: "image-size",
|
|
47
|
-
children: "Tama\xF1o"
|
|
48
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
49
|
-
className: "image-format",
|
|
50
|
-
children: "Formato"
|
|
51
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
52
|
-
className: "image-description",
|
|
53
|
-
children: "\xBFTiene leyenda?"
|
|
54
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
55
|
-
className: "shoot-type",
|
|
56
|
-
children: "Tipo de toma"
|
|
57
|
-
})]
|
|
124
|
+
children: visibleColumns.map(function (column) {
|
|
125
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
126
|
+
className: column.className,
|
|
127
|
+
children: column.label
|
|
128
|
+
}, column.key);
|
|
129
|
+
})
|
|
58
130
|
})]
|
|
59
131
|
});
|
|
60
132
|
};
|
|
@@ -15,6 +15,9 @@ var _variables = require("../../../global-files/variables");
|
|
|
15
15
|
|
|
16
16
|
var _templateObject;
|
|
17
17
|
|
|
18
|
-
var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n width: 100%;\n padding: 10px;\n padding-left: 0;\n align-items: center;\n\n .checkbox{\n width: 5.25%;\n }\n\n .information{\n width: 90%;\n display: grid;\n grid-template-columns:
|
|
18
|
+
var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n width: 100%;\n padding: 10px;\n padding-left: 0;\n align-items: center;\n\n .checkbox{\n width: 5.25%;\n }\n\n .information{\n width: 90%;\n display: grid;\n /* Lo define el preset de columnas; el valor por defecto es el de im\xE1genes. */\n grid-template-columns: ", ";\n }\n .image-header{\n\n }\n\n .image-name{\n padding-left: 1.75rem;\n }\n\n .image-size{\n padding-left: 2.75rem;\n\n }\n\n .image-format{\n padding-left: 4.5rem;\n\n }\n\n .image-description{\n margin-left: -1rem;\n }\n\n .shoot-type{\n }\n\n p {\n font-family: ", ";\n font-style: normal;\n font-weight: 600;\n font-size: 14px;\n line-height: 21px;\n letter-spacing: -0.015em;\n color: ", ";\n flex: 1;\n text-align: center;\n\n /*&.value-header {\n max-width: 60px;\n }\n\n &.image-header {\n max-width: 60px;\n }\n\n &.image-name {\n min-width: 20%;\n }\n\n &.image-format {\n max-width: 60px;\n }\n\n &.image-size {\n max-width: 90px;\n }\n\n &.image-identifier {\n max-width: 80px;\n }\n\n &.image-description {\n max-width: 120px;\n }*/\n }\n"])), function (_ref) {
|
|
19
|
+
var template = _ref.template;
|
|
20
|
+
return template || "0.1fr 1fr 1fr 1fr 1fr 1fr";
|
|
21
|
+
}, _variables.FontFamily.AvenirNext, _variables.GlobalColors.s5);
|
|
19
22
|
|
|
20
23
|
exports.Container = Container;
|
|
@@ -24,6 +24,7 @@ var ImageSelector = function ImageSelector(_ref) {
|
|
|
24
24
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.ProductImage, {
|
|
25
25
|
img: image.src,
|
|
26
26
|
altText: image.altText,
|
|
27
|
+
ext: image.ext,
|
|
27
28
|
imageType: modalSelector ? "catalogue-modal-image" : "carousel-image",
|
|
28
29
|
onClick: function onClick() {
|
|
29
30
|
return setActiveImage(index);
|
|
@@ -23,6 +23,7 @@ var ImagePreviewer = function ImagePreviewer(_ref) {
|
|
|
23
23
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_EditionActiveImage.EditionActiveImage, {
|
|
24
24
|
img: activeImage === null || activeImage === void 0 ? void 0 : activeImage.src,
|
|
25
25
|
altText: activeImage === null || activeImage === void 0 ? void 0 : activeImage.name,
|
|
26
|
+
ext: activeImage === null || activeImage === void 0 ? void 0 : activeImage.ext,
|
|
26
27
|
setShowModal: setShowModal
|
|
27
28
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ImageSelector.ImageSelector, {
|
|
28
29
|
images: imagesArray,
|