@websolutespa/bom-mixer-ui 0.0.1

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 (110) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +11 -0
  3. package/dist/carousel-1-DVCEK6QW.mjs +13 -0
  4. package/dist/carousel-1-DXYGMXKJ.mjs +14 -0
  5. package/dist/chunk-2NOCZCBX.mjs +494 -0
  6. package/dist/chunk-2QPVBWSO.mjs +27 -0
  7. package/dist/chunk-3O6XPTXR.mjs +54 -0
  8. package/dist/chunk-4G2V76JL.mjs +87 -0
  9. package/dist/chunk-4GP5DTTM.mjs +1101 -0
  10. package/dist/chunk-56QPQUHL.mjs +87 -0
  11. package/dist/chunk-5HED55DH.mjs +89 -0
  12. package/dist/chunk-5JVP5WNM.mjs +109 -0
  13. package/dist/chunk-5OIM36YU.mjs +43 -0
  14. package/dist/chunk-6HX6MNJA.mjs +808 -0
  15. package/dist/chunk-6RQBZFNK.mjs +13 -0
  16. package/dist/chunk-74GX2GU5.mjs +84 -0
  17. package/dist/chunk-A5PJ35ED.mjs +30 -0
  18. package/dist/chunk-A7SAZJPB.mjs +54 -0
  19. package/dist/chunk-AWRVGAMB.mjs +34 -0
  20. package/dist/chunk-B5WDQW62.mjs +469 -0
  21. package/dist/chunk-CCBJBAAA.mjs +47 -0
  22. package/dist/chunk-DANHURV6.mjs +84 -0
  23. package/dist/chunk-DBOW5IIN.mjs +5138 -0
  24. package/dist/chunk-DC3AZYXP.mjs +48 -0
  25. package/dist/chunk-DV6WR2TC.mjs +51 -0
  26. package/dist/chunk-G4IKIC5S.mjs +36 -0
  27. package/dist/chunk-GDCL5WRV.mjs +47 -0
  28. package/dist/chunk-GGXSEAD2.mjs +494 -0
  29. package/dist/chunk-GNG6WR62.mjs +220 -0
  30. package/dist/chunk-GZ4XU7KO.mjs +84 -0
  31. package/dist/chunk-HCSER4UQ.mjs +31 -0
  32. package/dist/chunk-IF5CE4SD.mjs +89 -0
  33. package/dist/chunk-IG66RP7S.mjs +54 -0
  34. package/dist/chunk-IK736OHT.mjs +31 -0
  35. package/dist/chunk-IZQZVLFR.mjs +84 -0
  36. package/dist/chunk-J7LSTFGB.mjs +51 -0
  37. package/dist/chunk-JQPC4MHB.mjs +40 -0
  38. package/dist/chunk-JTGZNI2A.mjs +92 -0
  39. package/dist/chunk-JYFB4EY7.mjs +26 -0
  40. package/dist/chunk-KJAR4KTH.mjs +114 -0
  41. package/dist/chunk-LEHIZSHR.mjs +122 -0
  42. package/dist/chunk-LSXKWZBB.mjs +808 -0
  43. package/dist/chunk-LV3AK64L.mjs +37 -0
  44. package/dist/chunk-MU4CJBV7.mjs +82 -0
  45. package/dist/chunk-MW5M3AIG.mjs +29 -0
  46. package/dist/chunk-MZ764V34.mjs +33 -0
  47. package/dist/chunk-N5J24WJE.mjs +22 -0
  48. package/dist/chunk-NLXIPXSN.mjs +44 -0
  49. package/dist/chunk-NM3CSEJ3.mjs +33 -0
  50. package/dist/chunk-NWHJ5ZAA.mjs +27 -0
  51. package/dist/chunk-OAAW3SV6.mjs +199 -0
  52. package/dist/chunk-OAVF6LFH.mjs +58 -0
  53. package/dist/chunk-PFPUP4FL.mjs +807 -0
  54. package/dist/chunk-QSN3F243.mjs +33 -0
  55. package/dist/chunk-QXUK3J2W.mjs +199 -0
  56. package/dist/chunk-RU2KB7XM.mjs +51 -0
  57. package/dist/chunk-SBQY6FWU.mjs +77 -0
  58. package/dist/chunk-TNJCCH5V.mjs +220 -0
  59. package/dist/chunk-U4CLZOPI.mjs +232 -0
  60. package/dist/chunk-UGZQFVRQ.mjs +29 -0
  61. package/dist/chunk-VTNTTQXM.mjs +54 -0
  62. package/dist/chunk-W346ZVLC.mjs +13 -0
  63. package/dist/chunk-XAXJC3FV.mjs +36 -0
  64. package/dist/chunk-Y2QTR7KM.mjs +55 -0
  65. package/dist/chunk-ZBPDMEV4.mjs +122 -0
  66. package/dist/chunk-ZFNJUDPN.mjs +43 -0
  67. package/dist/download-1-FRTTCFSC.mjs +14 -0
  68. package/dist/download-1-HFDPW6PG.mjs +13 -0
  69. package/dist/index.d.ts +2548 -0
  70. package/dist/index.js +15611 -0
  71. package/dist/index.mjs +11555 -0
  72. package/dist/magazine-related-D3WTHTLF.mjs +14 -0
  73. package/dist/magazine-related-JCGUUCUP.mjs +15 -0
  74. package/dist/media-full-1-BDODTFLB.mjs +10 -0
  75. package/dist/media-full-1-EBZLR4NY.mjs +10 -0
  76. package/dist/media-full-2-2PO7MSS6.mjs +11 -0
  77. package/dist/media-full-2-M4O7HRCV.mjs +11 -0
  78. package/dist/media-media-1-ET3G2SWF.mjs +12 -0
  79. package/dist/media-media-1-HIJUPGM7.mjs +12 -0
  80. package/dist/media-media-1-V6ZQ6RZG.mjs +12 -0
  81. package/dist/not-found-JWIKAAPV.mjs +10 -0
  82. package/dist/not-found-YT633IOF.mjs +10 -0
  83. package/dist/products-detail-download-4FB5IJ3Q.mjs +13 -0
  84. package/dist/products-detail-download-7G2TYM3Q.mjs +14 -0
  85. package/dist/products-detail-related-2PVSOSDY.mjs +16 -0
  86. package/dist/products-detail-related-EVYW6HQA.mjs +15 -0
  87. package/dist/products-detail-related-YIFMTUCQ.mjs +15 -0
  88. package/dist/products-detail-size-color-AKSUWV6K.mjs +15 -0
  89. package/dist/products-detail-size-color-DN3E6KET.mjs +15 -0
  90. package/dist/products-detail-size-color-YLQ352FR.mjs +15 -0
  91. package/dist/related-1-27HY3JEE.mjs +16 -0
  92. package/dist/related-1-RW2MS6XN.mjs +15 -0
  93. package/dist/related-1-XXICN6PY.mjs +15 -0
  94. package/dist/shop-detail-related-AW5RTFOH.mjs +15 -0
  95. package/dist/shop-detail-related-OS5YUH6Y.mjs +15 -0
  96. package/dist/shop-detail-related-SQ5MBIA2.mjs +16 -0
  97. package/dist/sizes-colors-1-IPWE45PQ.mjs +15 -0
  98. package/dist/sizes-colors-1-JSJSGDQB.mjs +15 -0
  99. package/dist/sizes-colors-1-R36L2GI3.mjs +15 -0
  100. package/dist/text-1-265D6JDN.mjs +11 -0
  101. package/dist/text-1-4LCCLSTO.mjs +11 -0
  102. package/dist/text-aside-1-5COCRCVM.mjs +12 -0
  103. package/dist/text-aside-1-H56SUGSM.mjs +12 -0
  104. package/dist/text-aside-1-YIXPMUBS.mjs +12 -0
  105. package/dist/text-media-1-FTVDNKGV.mjs +13 -0
  106. package/dist/text-media-1-QQY7WNS2.mjs +13 -0
  107. package/dist/text-media-1-ZGI6ITM6.mjs +13 -0
  108. package/dist/text-text-1-KCRMHXGX.mjs +11 -0
  109. package/dist/text-text-1-NOFPMB5T.mjs +11 -0
  110. package/package.json +79 -0
@@ -0,0 +1,33 @@
1
+ import {
2
+ Container,
3
+ Section,
4
+ Text
5
+ } from "./chunk-2NOCZCBX.mjs";
6
+ import {
7
+ __toESM,
8
+ require_dynamic
9
+ } from "./chunk-4GP5DTTM.mjs";
10
+
11
+ // src/lazy/not-found/not-found.tsx
12
+ var import_dynamic = __toESM(require_dynamic());
13
+ import { jsx, jsxs } from "react/jsx-runtime";
14
+ var NotFound = ({ item }) => {
15
+ return /* @__PURE__ */ jsx(Section, { borderBottom: "1px solid var(--color-neutral-300)", children: /* @__PURE__ */ jsxs(Container, { textAlign: "center", children: [
16
+ /* @__PURE__ */ jsxs(Text, { size: "5", marginBottom: "1rem", children: [
17
+ "not found ",
18
+ item.schema
19
+ ] }),
20
+ item.title && /* @__PURE__ */ jsx(Text, { size: "3", marginBottom: "1rem", children: item.title }),
21
+ /* @__PURE__ */ jsx("code", { children: JSON.stringify(item, null, 2) })
22
+ ] }) });
23
+ };
24
+ var NotFoundExport = {
25
+ "not-found": (0, import_dynamic.default)(() => Promise.resolve().then(() => require_not_found()).then(
26
+ (module) => module.NotFound
27
+ ))
28
+ };
29
+
30
+ export {
31
+ NotFound,
32
+ NotFoundExport
33
+ };
@@ -0,0 +1,199 @@
1
+ import {
2
+ __objRest,
3
+ __spreadProps,
4
+ __spreadValues,
5
+ getCssResponsive
6
+ } from "./chunk-4GP5DTTM.mjs";
7
+
8
+ // src/components/flex/flex-row.tsx
9
+ import styled from "styled-components";
10
+ var FlexRow = styled.div`
11
+ display: flex;
12
+ align-items: center;
13
+ // width: 100%;
14
+ // flex-wrap: wrap;
15
+ // margin: 0 auto;
16
+ gap: 0.5rem;
17
+ ${(props) => getCssResponsive(props)}
18
+ `;
19
+
20
+ // src/components/flex/flex.tsx
21
+ import { withSchema } from "@websolutespa/bom-mixer-core";
22
+ import styled5 from "styled-components";
23
+
24
+ // src/components/flex/flex-col.tsx
25
+ import styled2 from "styled-components";
26
+ var FlexCol = styled2.div`
27
+ display: flex;
28
+ flex-direction: column;
29
+ width: 100%;
30
+ // margin: 0 auto;
31
+ ${(props) => getCssResponsive(props)}
32
+ `;
33
+
34
+ // src/components/flex/flex-flow.tsx
35
+ import { getClassNames } from "@websolutespa/bom-mixer-core";
36
+ import React, { forwardRef, useEffect, useImperativeHandle } from "react";
37
+ import styled3, { css } from "styled-components";
38
+ import { jsx } from "react/jsx-runtime";
39
+ function getFlexColumn(columns = 2) {
40
+ const cols = parseInt(columns.toString());
41
+ if (cols === 1) {
42
+ return "width: 100%;";
43
+ }
44
+ const calc = `calc(${100 / cols}% - (var(--grid-column-gap) * ${cols - 1} / ${cols}))`;
45
+ return `
46
+ flex: 1 0 ${calc};
47
+ max-width: ${calc};
48
+ `;
49
+ }
50
+ function getCssResponsiveColumn(props, defaultValue = {}) {
51
+ props = __spreadValues(__spreadValues({}, defaultValue), props);
52
+ const columnsProps = ["columns", "columnsSm", "columnsMd", "columnsLg", "columnsXl"];
53
+ let rules = "";
54
+ for (const [key, value] of Object.entries(props)) {
55
+ const rule = key.replace(/(.+?)(Sm|Md|Lg|Xl)?$/, function(m, g1, g2) {
56
+ const prop = g1;
57
+ if (columnsProps.includes(key)) {
58
+ const rule2 = getFlexColumn(value);
59
+ if (g2) {
60
+ const size = g2.toLowerCase();
61
+ return `@media(min-width: ${props.theme.mediaQuery[size]}px) {
62
+ ${rule2}
63
+ }`;
64
+ } else {
65
+ return rule2;
66
+ }
67
+ } else {
68
+ return "";
69
+ }
70
+ });
71
+ rules += rule + "\n";
72
+ }
73
+ return rules;
74
+ }
75
+ var StyledFlexFlow = styled3.div`
76
+ display: flex;
77
+ flex-direction: row;
78
+ flex-wrap: wrap;
79
+ align-items: flex-start;
80
+ gap: var(--grid-column-gap);
81
+ ${(props) => css`
82
+ &>div {
83
+ position: relative;
84
+ ${getCssResponsiveColumn(props)}
85
+ }
86
+ ${getCssResponsive(props)}
87
+ `}
88
+ `;
89
+ var FlexFlow = forwardRef((_a, ref) => {
90
+ var _b = _a, { children, className, as = "div" } = _b, props = __objRest(_b, ["children", "className", "as"]);
91
+ const innerRef = React.createRef();
92
+ useImperativeHandle(ref, () => innerRef.current);
93
+ useEffect(() => {
94
+ if (!(window && window.addEventListener)) {
95
+ return;
96
+ }
97
+ if (!innerRef.current) {
98
+ return;
99
+ }
100
+ const element = innerRef.current;
101
+ const imagesLoaded = Array.from(element.querySelectorAll("img"));
102
+ if (imagesLoaded.length === 0) {
103
+ return;
104
+ }
105
+ imagesLoaded.forEach((image) => {
106
+ image.addEventListener("load", () => reposChildElements(element), {
107
+ once: true
108
+ });
109
+ image.addEventListener("error", () => reposChildElements(element), {
110
+ once: true
111
+ });
112
+ });
113
+ reposChildElements(element);
114
+ const onResize = () => {
115
+ reposChildElements(element);
116
+ };
117
+ window.addEventListener("resize", onResize);
118
+ return () => {
119
+ window.removeEventListener("resize", onResize);
120
+ };
121
+ }, [children]);
122
+ const classNames = getClassNames("flex-flow", className);
123
+ return /* @__PURE__ */ jsx(StyledFlexFlow, __spreadProps(__spreadValues({ className: classNames, ref: innerRef, as }, props), { children }));
124
+ });
125
+ FlexFlow.displayName = "FlexFlow";
126
+ function reposChildElements(node) {
127
+ node.style.height = "";
128
+ const nodeRect = node.getBoundingClientRect();
129
+ const items = Array.prototype.slice.call(node.children);
130
+ items.forEach((x) => x.style.top = null);
131
+ const itemStyles = items.map((item) => getComputedStyle(item));
132
+ let itemRect = items[0].getBoundingClientRect();
133
+ let itemStyle = itemStyles[0];
134
+ const itemOuterWidth = itemRect.width + parseFloat(itemStyle.marginLeft) + parseFloat(itemStyle.marginRight);
135
+ const cols = Math.round(1 / (itemOuterWidth / nodeRect.width));
136
+ const heights = {};
137
+ items.forEach((item, i) => {
138
+ itemRect = item.getBoundingClientRect();
139
+ itemStyle = itemStyles[i];
140
+ const c = i % cols;
141
+ if (typeof heights[c] == "undefined") {
142
+ heights[c] = 0;
143
+ }
144
+ heights[c] += itemRect.height + parseFloat(itemStyle.marginBottom);
145
+ if (i - cols >= 0) {
146
+ const previousIndex = i - cols;
147
+ const previousItem = items[previousIndex];
148
+ const previousRect = previousItem.getBoundingClientRect();
149
+ const previousBottom = previousRect.bottom;
150
+ const top = itemRect.top - parseFloat(itemStyle.marginBottom);
151
+ item.style.top = `-${top - previousBottom}px`;
152
+ }
153
+ });
154
+ const maxHeight = Math.max(...Object.values(heights));
155
+ node.style.height = `${maxHeight}px`;
156
+ }
157
+
158
+ // src/components/flex/flex-responsive.tsx
159
+ import styled4 from "styled-components";
160
+ var FlexResponsive = styled4.div`
161
+ display: flex;
162
+ width: 100%;
163
+ margin: 0 auto;
164
+ gap: 0.5rem;
165
+
166
+ @media (max-width: 399.9px) {
167
+ flex-direction: column;
168
+ justify-content: stretch;
169
+ }
170
+
171
+ @media (min-width: 400px) {
172
+ flex-direction: row;
173
+ align-items: center;
174
+ flex-wrap: wrap;
175
+ }
176
+
177
+ ${(props) => getCssResponsive(props)}
178
+ `;
179
+
180
+ // src/components/flex/flex.tsx
181
+ var FlexBase = styled5.div`
182
+ display: flex;
183
+ // flex-direction: column;
184
+ // justify-content: center;
185
+ align-items: center;
186
+ ${(props) => getCssResponsive(props)}
187
+ `;
188
+ var Flex = withSchema(FlexBase, {
189
+ Row: FlexRow,
190
+ Col: FlexCol,
191
+ Responsive: FlexResponsive,
192
+ Flow: FlexFlow,
193
+ displayName: "Flex"
194
+ });
195
+
196
+ export {
197
+ FlexRow,
198
+ Flex
199
+ };
@@ -0,0 +1,51 @@
1
+ import {
2
+ NavLink
3
+ } from "./chunk-U4CLZOPI.mjs";
4
+ import {
5
+ Flex
6
+ } from "./chunk-QXUK3J2W.mjs";
7
+ import {
8
+ Button
9
+ } from "./chunk-VTNTTQXM.mjs";
10
+ import {
11
+ Container,
12
+ Section,
13
+ Text
14
+ } from "./chunk-2NOCZCBX.mjs";
15
+ import {
16
+ __toESM,
17
+ require_dynamic
18
+ } from "./chunk-4GP5DTTM.mjs";
19
+
20
+ // src/sections/products-detail-download/products-detail-download.tsx
21
+ var import_dynamic = __toESM(require_dynamic());
22
+ import { getClassNames } from "@websolutespa/bom-mixer-core";
23
+ import { Lock } from "@websolutespa/bom-mixer-icons";
24
+ import { jsx, jsxs } from "react/jsx-runtime";
25
+ var ProductsDetailDownload = ({ id, item }) => {
26
+ const classNames = getClassNames(item.schema);
27
+ if (!item) {
28
+ return null;
29
+ }
30
+ return /* @__PURE__ */ jsx(Section, { id, className: classNames, padding: "6rem 0", children: /* @__PURE__ */ jsx(Container, { children: /* @__PURE__ */ jsxs(Flex.Col, { children: [
31
+ item.title && /* @__PURE__ */ jsx(Text, { size: "3", marginBottom: "3rem", textAlign: "center", children: item.title }),
32
+ item.links && item.links.map((link, l) => /* @__PURE__ */ jsx(NavLink, { href: link.href, passHref: true, children: /* @__PURE__ */ jsx(Button, { as: "a", variant: "secondary", children: /* @__PURE__ */ jsxs(Flex.Row, { width: "100%", children: [
33
+ link.secure && /* @__PURE__ */ jsx(Lock, {}),
34
+ /* @__PURE__ */ jsx(Text, { flexGrow: 1, children: link.title }),
35
+ /* @__PURE__ */ jsxs(Text, { flexBasis: "20%", children: [
36
+ "Download ",
37
+ link.type
38
+ ] })
39
+ ] }) }) }, l))
40
+ ] }) }) });
41
+ };
42
+ var ProductsDetailDownloadExport = {
43
+ "products-detail-download": (0, import_dynamic.default)(() => Promise.resolve().then(() => require_products_detail_download()).then(
44
+ (module) => module.ProductsDetailDownload
45
+ ))
46
+ };
47
+
48
+ export {
49
+ ProductsDetailDownload,
50
+ ProductsDetailDownloadExport
51
+ };
@@ -0,0 +1,77 @@
1
+ import {
2
+ Card
3
+ } from "./chunk-LEHIZSHR.mjs";
4
+ import {
5
+ Button
6
+ } from "./chunk-A7SAZJPB.mjs";
7
+ import {
8
+ Media
9
+ } from "./chunk-GNG6WR62.mjs";
10
+ import {
11
+ Container,
12
+ Section,
13
+ Text
14
+ } from "./chunk-GGXSEAD2.mjs";
15
+ import {
16
+ __objRest,
17
+ __spreadProps,
18
+ __spreadValues
19
+ } from "./chunk-B5WDQW62.mjs";
20
+
21
+ // src/lazy/carousel-1/carousel-1.tsx
22
+ import { getClassNames } from "@websolutespa/bom-mixer-core";
23
+ import dynamic from "next/dynamic";
24
+ import Link from "next/link";
25
+ import styled from "styled-components";
26
+ import { Swiper, SwiperSlide } from "swiper/react";
27
+ import { jsx, jsxs } from "react/jsx-runtime";
28
+ var StyledSection = styled(Section)`
29
+ .swiper-slide {
30
+ width: 60vw;
31
+ overflow: hidden;
32
+ }
33
+ `;
34
+ var StyledCard = styled(Card)`
35
+ .media>.image {
36
+ transform: scale(1.1);
37
+ transition: all ease-in-out 350ms 200ms;
38
+ }
39
+ .button {
40
+ opacity: 0;
41
+ transform: translateY(30%);
42
+ }
43
+ .button {
44
+ transition: all ease-out 350ms 200ms;
45
+ }
46
+ .swiper-slide-active & {
47
+ .media>.image {
48
+ transform: scale(1);
49
+ }
50
+ .button {
51
+ opacity: 1;
52
+ transform: translateY(0);
53
+ }
54
+ }
55
+ `;
56
+ var Carousel1 = (_a) => {
57
+ var _b = _a, { item } = _b, props = __objRest(_b, ["item"]);
58
+ const items = item.items;
59
+ const classNames = getClassNames(item.schema);
60
+ return /* @__PURE__ */ jsxs(StyledSection, { className: classNames, padding: "7rem 0", children: [
61
+ /* @__PURE__ */ jsx(Container, { textAlign: "center", children: item.title && /* @__PURE__ */ jsx(Text, { size: "2", marginBottom: "4rem", children: item.title }) }),
62
+ items && /* @__PURE__ */ jsx(Swiper, __spreadProps(__spreadValues({}, props), { spaceBetween: 60, slidesPerView: "auto", centeredSlides: true, style: { width: "100%" }, children: items.map((item2, i) => /* @__PURE__ */ jsx(SwiperSlide, { virtualIndex: i, style: { width: "60vw" }, children: /* @__PURE__ */ jsxs(StyledCard, { width: "60vw", hoverable: true, children: [
63
+ /* @__PURE__ */ jsx(Link, { href: item2.href, passHref: true, children: /* @__PURE__ */ jsx(Media, { as: "a", aspectRatio: 16 / 9, item: item2.media }) }),
64
+ item2.title && /* @__PURE__ */ jsx(Card.Content, { children: /* @__PURE__ */ jsx(Button, { variant: "nav", children: /* @__PURE__ */ jsx(Text, { size: "8", marginTop: "1rem", dangerouslySetInnerHTML: { __html: item2.title } }) }) })
65
+ ] }) }, i)) }))
66
+ ] });
67
+ };
68
+ var Carousel1Export = {
69
+ "carousel-1": dynamic(() => Promise.resolve().then(() => require_carousel_1()).then(
70
+ (module) => module.Carousel1
71
+ ))
72
+ };
73
+
74
+ export {
75
+ Carousel1,
76
+ Carousel1Export
77
+ };
@@ -0,0 +1,220 @@
1
+ import {
2
+ __objRest,
3
+ __spreadProps,
4
+ __spreadValues,
5
+ getAspectResponsive,
6
+ getCssResponsive
7
+ } from "./chunk-4GP5DTTM.mjs";
8
+
9
+ // src/components/media/media-image.tsx
10
+ import { getClassNames } from "@websolutespa/bom-mixer-core";
11
+ import styled from "styled-components";
12
+ import { jsx } from "react/jsx-runtime";
13
+ var StyledMediaImage = styled.img`
14
+ max-width: 100%;
15
+ // height: auto;
16
+ user-select: none;
17
+ `;
18
+ var MediaImage = (_a) => {
19
+ var _b = _a, { alt = "", className, type } = _b, props = __objRest(_b, ["alt", "className", "type"]);
20
+ const classNames = getClassNames(className, "image", { "image-svg": isSVG(props.src) });
21
+ const imageProps = getImageProps(props);
22
+ return /* @__PURE__ */ jsx(StyledMediaImage, __spreadValues({ className: classNames, alt, loading: "lazy" }, imageProps));
23
+ };
24
+ function getImageProps(_a) {
25
+ var _b = _a, { src } = _b, props = __objRest(_b, ["src"]);
26
+ const ratio = props.width && props.height ? parseInt(props.width.toString()) / parseInt(props.height.toString()) : 0;
27
+ const sizes = [640, 828, 1080, 1200, 1920];
28
+ return __spreadValues({
29
+ src: getImageSrc(src, ratio, sizes[0]),
30
+ srcSet: getImageSrcset(src, ratio, sizes),
31
+ sizes: ratio !== 0 ? getImageSizes(sizes) : "100vw"
32
+ }, props);
33
+ }
34
+ function getImageSrc(src, ratio, width, quality = 75) {
35
+ if (isSVG(src)) {
36
+ return src;
37
+ }
38
+ return ratio !== 0 ? `/_next/image?url=${encodeURIComponent(src)}&w=${width}&h=${width / ratio}&q=${quality}` : `/_next/image?url=${encodeURIComponent(src)}&w=${width}&q=${quality}`;
39
+ }
40
+ function getImageSrcset(src, ratio, widths, quality = 75) {
41
+ if (isSVG(src)) {
42
+ return void 0;
43
+ }
44
+ return widths.map((width) => getImageSrc(src, ratio, width, quality) + ` ${width}w`).join(", ");
45
+ }
46
+ function getImageSizes(widths) {
47
+ return widths.map((width, i) => `${i < widths.length - 1 ? `(max-width: ${width}px) ` : ""}${width}px`).join(", ");
48
+ }
49
+ function isSVG(src) {
50
+ return src.indexOf(".svg") !== -1;
51
+ }
52
+
53
+ // src/components/media/media.tsx
54
+ import { getClassNames as getClassNames2, withSchema } from "@websolutespa/bom-mixer-core";
55
+ import { forwardRef } from "react";
56
+ import styled2, { css } from "styled-components";
57
+
58
+ // src/components/media-gallery/media-gallery-context.tsx
59
+ import { createContext, useContext } from "react";
60
+ var MediaGalleryContext = createContext({});
61
+ function useMediaGalleryContext() {
62
+ return useContext(MediaGalleryContext);
63
+ }
64
+
65
+ // src/components/media/media.tsx
66
+ import { jsx as jsx2 } from "react/jsx-runtime";
67
+ var StyledMediaInfo = styled2.div`
68
+ position: absolute;
69
+ display: flex;
70
+ flex-direction: column;
71
+ top: 0;
72
+ left: 0;
73
+ width: 100%;
74
+ height: 100%;
75
+ z-index: 1;
76
+ color: var(--color-neutral-100);
77
+
78
+ ${(props) => getCssResponsive(props)}
79
+ `;
80
+ var MediaInfo = (_a) => {
81
+ var _b = _a, { children, className } = _b, props = __objRest(_b, ["children", "className"]);
82
+ const classNames = getClassNames2(className, "media-info");
83
+ return /* @__PURE__ */ jsx2(StyledMediaInfo, __spreadProps(__spreadValues({ className: classNames }, props), { children }));
84
+ };
85
+ var StyledMedia = styled2.div`
86
+ position: relative;
87
+ display: flex;
88
+ flex-direction: column;
89
+ justify-content: center;
90
+ align-items: center;
91
+ // color: var(--color-neutral-100);
92
+
93
+ ${(props) => getCssResponsive(props)}
94
+
95
+ &>:not(.media-info) {
96
+ width: 100%;
97
+ height: 100%;
98
+ }
99
+
100
+ &>.image:not(.image-svg),
101
+ &>video,
102
+ &>.video {
103
+ object-fit: cover;
104
+ background: var(--color-neutral-200);
105
+ }
106
+
107
+ &>svg {
108
+ height: 100%;
109
+ }
110
+
111
+ &.media--gallery {
112
+ display: flex;
113
+ justify-content: center;
114
+ align-items: center;
115
+ overflow: hidden;
116
+ cursor: pointer;
117
+
118
+ &>:not(.media-info) {
119
+ transition: ease-in-out 200ms;
120
+ transition-property: transform, opacity;
121
+ }
122
+
123
+ &:hover {
124
+ &>:not(.media-info) {
125
+ transform: scale(1.05);
126
+ }
127
+ }
128
+ }
129
+
130
+ ${(props) => props.circle ? css`
131
+ aspect-ratio: 1;
132
+ overflow: hidden;
133
+ border-radius: 50%;
134
+ &>* {
135
+ top: 0;
136
+ left: 0;
137
+ height: 100%;
138
+ }
139
+ ` : ""};
140
+
141
+ ${(props) => props.rounded ? css`
142
+ overflow: hidden;
143
+ border-radius: var(--border-radius);
144
+ ` : ""};
145
+
146
+ ${(props) => getAspectResponsive(props, props.circle ? { aspectRatio: 1 } : void 0)};
147
+
148
+ ${(props) => props.overlay ? css`
149
+ position: relative;
150
+
151
+ &:after {
152
+ content: '';
153
+ position: absolute;
154
+ top: 0;
155
+ left: 0;
156
+ width: 100%;
157
+ height: 100%;
158
+ ${typeof props.overlay === "number" ? css`background: rgba(0,0,0,${props.overlay})` : css`background-image: linear-gradient(180deg, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.1) 15.9%, rgba(0, 0, 0, 0) 41.67%, rgba(0, 0, 0, 0.1) 61.79%, rgba(0, 0, 0, 0.6) 100%)`};
159
+ }
160
+ ` : ""}
161
+ `;
162
+ var MediaBase = forwardRef((_a, ref) => {
163
+ var _b = _a, { children, item, onClick, className, as = "div" } = _b, props = __objRest(_b, ["children", "item", "onClick", "className", "as"]);
164
+ const { id, open } = useMediaGalleryContext();
165
+ const classNames = getClassNames2(className, "media", { "media--gallery": id });
166
+ const mediaChildren = item && !children ? getMediaItems(item, {
167
+ aspectRatio: props.aspectRatio,
168
+ eager: props.eager,
169
+ galleryId: id,
170
+ open
171
+ }) : children;
172
+ return /* @__PURE__ */ jsx2(StyledMedia, __spreadProps(__spreadValues({ className: classNames, ref, as }, props), { children: mediaChildren }));
173
+ });
174
+ MediaBase.displayName = "Media";
175
+ var Media = withSchema(MediaBase, {
176
+ Info: MediaInfo
177
+ });
178
+ function getMediaItems(itemOrItems, options = {}) {
179
+ const items = (Array.isArray(itemOrItems) ? itemOrItems : [itemOrItems]).map((x) => {
180
+ if (typeof x["media"] === "object") {
181
+ x = x["media"];
182
+ }
183
+ if (typeof x.url === "string") {
184
+ x.src = x.url;
185
+ }
186
+ return x;
187
+ });
188
+ const hasGallery = options.galleryId != null && typeof options.open === "function";
189
+ const getMediaItemProps = (media) => {
190
+ const props = {};
191
+ if (hasGallery) {
192
+ props["data-gallery"] = JSON.stringify({ galleryId: options.galleryId, media });
193
+ props.onClick = (event) => {
194
+ if (options.open) {
195
+ options.open(media);
196
+ }
197
+ };
198
+ }
199
+ if (media.type === "image") {
200
+ const aspectRatio = typeof options.aspectRatio === "string" ? parseFloat(options.aspectRatio) : options.aspectRatio;
201
+ if (aspectRatio != null) {
202
+ props.width = 800;
203
+ props.height = 800 / aspectRatio;
204
+ }
205
+ if (options.eager) {
206
+ props.loading = "eager";
207
+ }
208
+ }
209
+ return props;
210
+ };
211
+ return items.map(
212
+ (media, m) => media.type === "video" ? /* @__PURE__ */ jsx2("video", __spreadProps(__spreadValues({ playsInline: true, autoPlay: true, muted: true, loop: true }, getMediaItemProps(media)), { children: /* @__PURE__ */ jsx2("source", { src: media.src, type: "video/mp4" }) }), m) : /* @__PURE__ */ jsx2(MediaImage, __spreadValues(__spreadProps(__spreadValues({}, media), { alt: media.alt, draggable: false }), getMediaItemProps(media)), m)
213
+ );
214
+ }
215
+
216
+ export {
217
+ MediaGalleryContext,
218
+ MediaImage,
219
+ Media
220
+ };