@vodafone_de/brix-components 7.0.4 → 7.0.6

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/dist/{FontWeight-CR22KTex.js → FontWeight-DEBGHbtO.js} +2 -2
  2. package/dist/components/Accordion/index.js +1 -1
  3. package/dist/components/Badge/index.js +1 -1
  4. package/dist/components/Body/index.js +1 -1
  5. package/dist/components/Button/index.js +2 -2
  6. package/dist/components/ButtonAsLink/index.js +1 -1
  7. package/dist/components/Carousel/components/CarouselContext.d.ts +2 -3
  8. package/dist/components/Carousel/index.js +52 -41
  9. package/dist/components/ConsentMessage/index.js +1 -1
  10. package/dist/components/DemoBox/index.js +1 -1
  11. package/dist/components/Dialog/index.js +1 -1
  12. package/dist/components/DiscoveryCard/index.js +5 -5
  13. package/dist/components/DiscoveryCardGroup/index.js +1 -1
  14. package/dist/components/Heading/index.js +1 -1
  15. package/dist/components/IconButton/index.js +1 -1
  16. package/dist/components/IconSnippet/index.js +4 -3
  17. package/dist/components/IconSnippet/props.d.ts +2 -2
  18. package/dist/components/ImageHeader/index.js +4 -4
  19. package/dist/components/Legend/index.js +1 -1
  20. package/dist/components/Link/index.js +1 -1
  21. package/dist/components/LinkAsButton/index.js +1 -1
  22. package/dist/components/LinkListItem/index.js +1 -1
  23. package/dist/components/MediaText/index.d.ts +5 -0
  24. package/dist/components/MediaText/index.js +121 -0
  25. package/dist/components/MediaText/props.d.ts +42 -0
  26. package/dist/components/MediaText/styled.d.ts +4 -0
  27. package/dist/components/Notification/index.js +1 -1
  28. package/dist/components/PickerGroup/index.js +2 -2
  29. package/dist/components/Price/index.js +1 -1
  30. package/dist/components/ProductCard/index.js +3 -3
  31. package/dist/components/Rating/assets/StarSVG.d.ts +2 -2
  32. package/dist/components/Rating/index.js +23 -24
  33. package/dist/components/Rating/props.d.ts +2 -2
  34. package/dist/components/RichText/index.js +1 -1
  35. package/dist/components/SearchInput/index.js +1 -1
  36. package/dist/components/Stepper/index.js +1 -1
  37. package/dist/components/TabularPrice/index.js +1 -1
  38. package/dist/components/TextList/index.js +1 -1
  39. package/dist/components/Tray/index.js +1 -1
  40. package/dist/{index-C7meHOM4.js → index-57IF0yrd.js} +2 -2
  41. package/dist/{index-BeSd-V81.js → index-BRs8j3Vq.js} +1 -1
  42. package/dist/{index-ZHkR70j3.js → index-CKvLGUdD.js} +1 -1
  43. package/dist/{index-C5GzK6_0.js → index-DrySIh-D.js} +1 -1
  44. package/dist/{index-aUJfXBUI.js → index-WLBo71sp.js} +1 -1
  45. package/dist/index.d.ts +2 -0
  46. package/dist/index.js +112 -107
  47. package/dist/{styled-BSqC5P9h.js → styled-DLS1p_AJ.js} +1 -1
  48. package/package.json +1 -1
  49. package/dist/components/Carousel/utils/useScrollSpy.d.ts +0 -2
@@ -2,7 +2,7 @@ const fontWeightLight = "light";
2
2
  const fontWeightRegular = "regular";
3
3
  const fontWeightBold = "bold";
4
4
  export {
5
- fontWeightLight as a,
6
- fontWeightRegular as b,
5
+ fontWeightRegular as a,
6
+ fontWeightLight as b,
7
7
  fontWeightBold as f
8
8
  };
@@ -16,7 +16,7 @@ import { getSpacing } from "../../foundations/token/getSpacing/index.js";
16
16
  import { getTextColor } from "../../foundations/token/getTextColor/index.js";
17
17
  import { j as colorBorderSubtle, c as colorBorderFocus } from "../../BorderColor-BummoQ1-.js";
18
18
  import { f as borderWidthNone, b as borderWidthUnselected, a as borderWidthFocus } from "../../BorderWidth-DfOlyKK7.js";
19
- import { b as fontWeightRegular, f as fontWeightBold } from "../../FontWeight-CR22KTex.js";
19
+ import { a as fontWeightRegular, f as fontWeightBold } from "../../FontWeight-DEBGHbtO.js";
20
20
  import { s as spacingMd, b as spacingNone, a as spacingXs } from "../../Spacing-D0HQH9YJ.js";
21
21
  import { a as colorTextNeutral, f as colorTextBrand } from "../../TextColor-DsntmDNw.js";
22
22
  import { f as filterProps } from "../../filterProps-Cewck8OH.js";
@@ -4,7 +4,7 @@ import "../../index-Cbojl4_Q.js";
4
4
  import "../../Spacing-D0HQH9YJ.js";
5
5
  import "../../SizeTypes-Ck_RdzIf.js";
6
6
  import "../../renderInlineRichTextFromOpenText-RvOG3QbI.js";
7
- import { a, B } from "../../index-ZHkR70j3.js";
7
+ import { a, B } from "../../index-CKvLGUdD.js";
8
8
  export {
9
9
  a as BadgeAppearanceColor,
10
10
  B as default
@@ -8,7 +8,7 @@ import { getBodySize } from "../../foundations/token/getBodySize/index.js";
8
8
  import { getBottomSpacing } from "../../foundations/token/getBottomSpacing/index.js";
9
9
  import { getFontWeight } from "../../foundations/token/getFontWeight/index.js";
10
10
  import { getTextColor } from "../../foundations/token/getTextColor/index.js";
11
- import { f as fontWeightBold } from "../../FontWeight-CR22KTex.js";
11
+ import { f as fontWeightBold } from "../../FontWeight-DEBGHbtO.js";
12
12
  import { a as colorTextNeutral } from "../../TextColor-DsntmDNw.js";
13
13
  import { f as filterProps } from "../../filterProps-Cewck8OH.js";
14
14
  const BodyStyled = styled.p.withConfig({
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import { r as renderInlineRichTextFromOpenText } from "../../renderInlineRichTextFromOpenText-RvOG3QbI.js";
4
- import { B as ButtonAsLink, g as getButtonIcon } from "../../index-C7meHOM4.js";
5
- import { B as ButtonStyled } from "../../styled-BSqC5P9h.js";
4
+ import { B as ButtonAsLink, g as getButtonIcon } from "../../index-57IF0yrd.js";
5
+ import { B as ButtonStyled } from "../../styled-DLS1p_AJ.js";
6
6
  const buttonFullWidth = "full";
7
7
  const buttonAutoWidth = "auto";
8
8
  const isButtonAsLinkProp = (props) => {
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import "react/jsx-runtime";
3
- import { B } from "../../index-C7meHOM4.js";
3
+ import { B } from "../../index-57IF0yrd.js";
4
4
  import "../../renderInlineRichTextFromOpenText-RvOG3QbI.js";
5
5
  export {
6
6
  B as default
@@ -1,4 +1,4 @@
1
- import { FC, MutableRefObject } from 'react';
1
+ import { FC, RefObject } from 'react';
2
2
  import { CarouselRuntimeProps } from '../props';
3
3
  /**
4
4
  * Can either be false to indicate that no button should be rendered
@@ -6,8 +6,7 @@ import { CarouselRuntimeProps } from '../props';
6
6
  */
7
7
  export type CarouselButton = (() => void) | false;
8
8
  export type CarouselState = {
9
- ref: MutableRefObject<HTMLDivElement> | undefined;
10
- visibleItems: number;
9
+ ref: RefObject<HTMLDivElement> | undefined;
11
10
  interactive: number[];
12
11
  goPrev: CarouselButton;
13
12
  goNext: CarouselButton;
@@ -78,7 +78,6 @@ const scrollTo = (element, left, behavior = "smooth") => {
78
78
  };
79
79
  const initialState = {
80
80
  ref: void 0,
81
- visibleItems: 1,
82
81
  interactive: [0],
83
82
  goPrev: false,
84
83
  goNext: false,
@@ -99,56 +98,57 @@ const CarouselProvider = ({
99
98
  const [scrollSpyIndex, setScrollSpyIndex] = useState(void 0);
100
99
  const [interactive, setInteractive] = useState([]);
101
100
  const [needsFirstPosition, setNeedsFirstPosition] = useState(activeIndex !== 0);
102
- const [itemWidth, setItemWidth] = useState(0);
103
- const [visibleItems, setVisibleItems] = useState(1);
101
+ const [carouselLayoutedAttributes, setCarouselLayoutedAttributes] = useState(void 0);
104
102
  const [goPrev, setGoPrev] = useState(false);
105
103
  const [goNext, setGoNext] = useState(false);
106
104
  const [numberOfIndicators, setNumberOfIndicators] = useState(0);
107
105
  const [activeIndicator, setActiveIndicator] = useState(props.items[props.activeIndex].index);
106
+ const getCarouselLayoutedAttributes = () => {
107
+ const carouselElement = ref.current;
108
+ if (!carouselElement) {
109
+ return;
110
+ }
111
+ const itemWidth = carouselElement.querySelector("[data-carousel-item]").offsetWidth;
112
+ const track = carouselElement.offsetWidth;
113
+ const numberOfItemsThatFitOnTrack = Math.floor(track / itemWidth);
114
+ const visibleItems = Math.min(numberOfItemsThatFitOnTrack, props.items.length);
115
+ if ((carouselLayoutedAttributes == null ? void 0 : carouselLayoutedAttributes.itemWidth) !== itemWidth || (carouselLayoutedAttributes == null ? void 0 : carouselLayoutedAttributes.visibleItems) !== visibleItems) {
116
+ setCarouselLayoutedAttributes({
117
+ itemWidth,
118
+ visibleItems
119
+ });
120
+ }
121
+ };
108
122
  useEffect(() => {
123
+ if (!carouselLayoutedAttributes) {
124
+ return;
125
+ }
109
126
  if (loop) {
110
127
  const update = props.items.filter((item) => !item.ghost).length;
111
128
  setNumberOfIndicators(update);
112
129
  } else {
113
- const update = props.items.filter((item) => !item.ghost).length - visibleItems + 1;
130
+ const update = props.items.filter((item) => !item.ghost).length - carouselLayoutedAttributes.visibleItems + 1;
114
131
  setNumberOfIndicators(update);
115
132
  }
116
- }, [loop, visibleItems, props.items]);
133
+ }, [loop, carouselLayoutedAttributes, props.items]);
117
134
  useEffect(() => {
118
- if (!(ref == null ? void 0 : ref.current)) {
119
- return;
120
- }
121
- if (!itemWidth) {
135
+ if (!carouselLayoutedAttributes) {
122
136
  return;
123
137
  }
124
- const track = ref == null ? void 0 : ref.current.offsetWidth;
125
- setVisibleItems(Math.floor(track / itemWidth));
126
- }, [itemWidth]);
127
- useEffect(() => {
128
- let updateInteractive = [...Array(visibleItems).keys()].map((i) => activeIndex + i);
138
+ let updateInteractive = [...Array(carouselLayoutedAttributes.visibleItems).keys()].map((i) => activeIndex + i);
129
139
  if (focus) {
130
140
  updateInteractive = [...Array(props.items.length).keys()];
131
141
  }
132
142
  setInteractive(updateInteractive);
133
- }, [focus, activeIndex, visibleItems, props.items]);
143
+ }, [focus, activeIndex, carouselLayoutedAttributes, props.items]);
134
144
  useEffect(() => {
135
145
  if (!(ref == null ? void 0 : ref.current)) {
136
146
  return;
137
147
  }
138
- const handleResize = () => {
139
- if (!window) {
140
- return;
141
- }
142
- if (!(ref == null ? void 0 : ref.current)) {
143
- return;
144
- }
145
- const itemWidth2 = ref.current.querySelector("[data-carousel-item]").offsetWidth;
146
- setItemWidth(itemWidth2);
147
- };
148
- window.addEventListener("resize", handleResize);
149
- handleResize();
148
+ window.addEventListener("resize", getCarouselLayoutedAttributes);
149
+ getCarouselLayoutedAttributes();
150
150
  return () => {
151
- window.removeEventListener("resize", handleResize);
151
+ window.removeEventListener("resize", getCarouselLayoutedAttributes);
152
152
  };
153
153
  }, [ref.current]);
154
154
  useEffect(() => {
@@ -156,25 +156,31 @@ const CarouselProvider = ({
156
156
  if (!(ref == null ? void 0 : ref.current)) {
157
157
  return;
158
158
  }
159
- if (!itemWidth) {
159
+ if (!carouselLayoutedAttributes) {
160
160
  return;
161
161
  }
162
162
  const handleScroll = (event) => {
163
+ if (!carouselLayoutedAttributes) {
164
+ return;
165
+ }
163
166
  const left = event.target.scrollLeft;
164
- const ucurrent = getItemByScroll(left - itemWidth / 2, itemWidth, props.items);
167
+ const ucurrent = getItemByScroll(left - carouselLayoutedAttributes.itemWidth / 2, carouselLayoutedAttributes.itemWidth, props.items);
165
168
  setScrollSpyIndex(ucurrent);
166
169
  };
167
170
  const handleScrollend = (event) => {
171
+ if (!carouselLayoutedAttributes) {
172
+ return;
173
+ }
168
174
  const left = event.target.scrollLeft;
169
- let updateActiveIndex = getItemByScroll(left - itemWidth / 2, itemWidth, props.items);
175
+ let updateActiveIndex = getItemByScroll(left - carouselLayoutedAttributes.itemWidth / 2, carouselLayoutedAttributes.itemWidth, props.items);
170
176
  if (loop) {
171
177
  const ghosts = [];
172
- for (let i = 0, x = visibleItems; i < x; i += 1) {
178
+ for (let i = 0, x = carouselLayoutedAttributes.visibleItems; i < x; i += 1) {
173
179
  ghosts.push(props.items[i + updateActiveIndex].ghost);
174
180
  }
175
181
  if (!ghosts.includes(false)) {
176
182
  updateActiveIndex = props.items.findIndex((item) => item.index === props.items[updateActiveIndex].index && !item.ghost);
177
- const left2 = updateActiveIndex * itemWidth;
183
+ const left2 = updateActiveIndex * carouselLayoutedAttributes.itemWidth;
178
184
  const behavior = "instant";
179
185
  scrollTo(ref.current, left2, behavior);
180
186
  }
@@ -192,31 +198,34 @@ const CarouselProvider = ({
192
198
  (_a2 = ref.current) == null ? void 0 : _a2.removeEventListener("scroll", handleScroll);
193
199
  (_b2 = ref.current) == null ? void 0 : _b2.removeEventListener("scrollend", handleScrollend);
194
200
  };
195
- }, [ref.current, itemWidth, visibleItems, props.items]);
201
+ }, [ref.current, carouselLayoutedAttributes, props.items]);
196
202
  useEffect(() => {
197
203
  if (!ref.current) {
198
204
  return;
199
205
  }
206
+ if (!carouselLayoutedAttributes) {
207
+ return;
208
+ }
200
209
  if (scrollSpyIndex) {
201
210
  return;
202
211
  }
203
212
  if (activeIndex === scrollSpyIndex) {
204
213
  return;
205
214
  }
206
- const left = activeIndex * itemWidth;
215
+ const left = activeIndex * carouselLayoutedAttributes.itemWidth;
207
216
  const behavior = needsFirstPosition ? "instant" : "smooth";
208
217
  scrollTo(ref.current, left, behavior);
209
- }, [activeIndex, scrollSpyIndex, ref.current, itemWidth]);
218
+ }, [activeIndex, scrollSpyIndex, ref.current, carouselLayoutedAttributes]);
210
219
  useEffect(() => {
211
- if (!props.onUpdate) {
220
+ if (!props.onUpdate || !carouselLayoutedAttributes) {
212
221
  return;
213
222
  }
214
223
  const visibleIndexes = [];
215
- for (let i = 0, x = visibleItems; i < x; i += 1) {
224
+ for (let i = 0, x = carouselLayoutedAttributes.visibleItems; i < x; i += 1) {
216
225
  visibleIndexes.push(props.items[i + activeIndex].index);
217
226
  }
218
227
  props.onUpdate(visibleIndexes);
219
- }, [activeIndex]);
228
+ }, [activeIndex, carouselLayoutedAttributes]);
220
229
  const movePrev = () => {
221
230
  const prev = activeIndex > 0 ? activeIndex - 1 : props.items.length - 1;
222
231
  setActiveIndex(prev);
@@ -241,7 +250,6 @@ const CarouselProvider = ({
241
250
  return /* @__PURE__ */ jsx(CarouselContext.Provider, { value: {
242
251
  state: {
243
252
  ref,
244
- visibleItems,
245
253
  interactive,
246
254
  goPrev,
247
255
  goNext,
@@ -403,7 +411,7 @@ const CarouselIndicator = () => {
403
411
  activeIndicator
404
412
  }
405
413
  } = useContext(CarouselContext);
406
- if (!numberOfIndicators) {
414
+ if (!numberOfIndicators || 1 >= numberOfIndicators) {
407
415
  return null;
408
416
  }
409
417
  const indicators = [...Array(numberOfIndicators).keys()];
@@ -487,6 +495,9 @@ const Carousel = ({
487
495
  gridConfig = carouselDefaultGridConfig,
488
496
  ...props
489
497
  }) => {
498
+ if (0 === items.length) {
499
+ return null;
500
+ }
490
501
  activeIndex = activeIndex ? activeIndex : 0;
491
502
  activeIndex = loop ? activeIndex + items.length : activeIndex;
492
503
  const loopableItems = getItems(items, loop);
@@ -4,7 +4,7 @@ import { useState, useEffect } from "react";
4
4
  import Body, { bodyAlignCenter } from "../Body/index.js";
5
5
  import Button, { buttonAutoWidth } from "../Button/index.js";
6
6
  import styled from "styled-components";
7
- import { B as ButtonStyled, t as tertiaryAppearance } from "../../styled-BSqC5P9h.js";
7
+ import { B as ButtonStyled, t as tertiaryAppearance } from "../../styled-DLS1p_AJ.js";
8
8
  import { v as viewport } from "../../index-Ck2bCrhT.js";
9
9
  import { getBackgroundColor } from "../../foundations/token/getBackgroundColor/index.js";
10
10
  import { getSpacing } from "../../foundations/token/getSpacing/index.js";
@@ -2,7 +2,7 @@
2
2
  import { jsx } from "react/jsx-runtime";
3
3
  import IconSnippet from "../IconSnippet/index.js";
4
4
  import { t as textHeadingXs } from "../../HeadingSize-CfCRn3Lh.js";
5
- import { g as getUid } from "../../index-BeSd-V81.js";
5
+ import { g as getUid } from "../../index-BRs8j3Vq.js";
6
6
  import { D as DemoBoxStyled } from "../../styled-ODPFCF1a.js";
7
7
  const heading = {
8
8
  component: "Heading",
@@ -2,7 +2,7 @@
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import { useState, useRef, useEffect } from "react";
4
4
  import { createPortal } from "react-dom";
5
- import { f as fontWeightBold } from "../../FontWeight-CR22KTex.js";
5
+ import { f as fontWeightBold } from "../../FontWeight-DEBGHbtO.js";
6
6
  import { a as textHeadingMd } from "../../HeadingSize-CfCRn3Lh.js";
7
7
  import { s as spacingMd, b as spacingNone } from "../../Spacing-D0HQH9YJ.js";
8
8
  import Heading from "../Heading/index.js";
@@ -1,16 +1,16 @@
1
1
  "use client";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import { Fragment } from "react";
4
- import { R as RichText } from "../../index-BeSd-V81.js";
5
- import { f as fontWeightBold } from "../../FontWeight-CR22KTex.js";
4
+ import { R as RichText } from "../../index-BRs8j3Vq.js";
5
+ import { f as fontWeightBold } from "../../FontWeight-DEBGHbtO.js";
6
6
  import { b as textHeadingSm } from "../../HeadingSize-CfCRn3Lh.js";
7
7
  import { s as spacingMd, b as spacingNone, a as spacingXs, c as spacingSm } from "../../Spacing-D0HQH9YJ.js";
8
8
  import { s as smallSize } from "../../SizeTypes-Ck_RdzIf.js";
9
- import { b as BadgeStyled, B as Badge } from "../../index-ZHkR70j3.js";
9
+ import { b as BadgeStyled, B as Badge } from "../../index-CKvLGUdD.js";
10
10
  import Body, { bodyAlignLeft, bodyAlignCenter } from "../Body/index.js";
11
11
  import Heading from "../Heading/index.js";
12
12
  import Link from "../Link/index.js";
13
- import { P as Price, b as priceSizeSm, f as priceAlignLeft, g as priceAlignCenter, a as priceOrientationVertical } from "../../index-aUJfXBUI.js";
13
+ import { P as Price, b as priceSizeSm, f as priceAlignLeft, g as priceAlignCenter, a as priceOrientationVertical } from "../../index-WLBo71sp.js";
14
14
  import Image, { aspectRatio16_9, aspectRatio1_1 } from "../Image/index.js";
15
15
  import { a as cornerRounded } from "../../CornerStyle-JEbGNArR.js";
16
16
  import styled from "styled-components";
@@ -18,7 +18,7 @@ import { getBottomSpacing } from "../../foundations/token/getBottomSpacing/index
18
18
  import { getSpacing } from "../../foundations/token/getSpacing/index.js";
19
19
  import { f as filterProps } from "../../filterProps-Cewck8OH.js";
20
20
  import Card from "../Card/index.js";
21
- import { a as LinkStyled } from "../../index-C5GzK6_0.js";
21
+ import { a as LinkStyled } from "../../index-DrySIh-D.js";
22
22
  const discoveryCardOrientationVertical = "vertical";
23
23
  const discoveryCardOrientationHorizontal = "horizontal";
24
24
  const DiscoveryCardStyled = styled(Card).withConfig({
@@ -6,7 +6,7 @@ import Grid from "../Grid/index.js";
6
6
  import GridItem from "../GridItem/index.js";
7
7
  import { getSpacing } from "../../foundations/token/getSpacing/index.js";
8
8
  import { s as spacingMd } from "../../Spacing-D0HQH9YJ.js";
9
- import { a as LinkStyled } from "../../index-C5GzK6_0.js";
9
+ import { a as LinkStyled } from "../../index-DrySIh-D.js";
10
10
  const DiscoveryCardGroupGridStyled = styled(Grid).withConfig({
11
11
  displayName: "DiscoveryCardGroupGridStyled",
12
12
  componentId: "sc-6axszn-0"
@@ -9,7 +9,7 @@ import { getBottomSpacing } from "../../foundations/token/getBottomSpacing/index
9
9
  import { getFontWeight } from "../../foundations/token/getFontWeight/index.js";
10
10
  import { getHeadingSize } from "../../foundations/token/getHeadingSize/index.js";
11
11
  import { getTextColor } from "../../foundations/token/getTextColor/index.js";
12
- import { f as fontWeightBold, a as fontWeightLight } from "../../FontWeight-CR22KTex.js";
12
+ import { f as fontWeightBold, b as fontWeightLight } from "../../FontWeight-DEBGHbtO.js";
13
13
  import { a as colorTextNeutral } from "../../TextColor-DsntmDNw.js";
14
14
  import { f as filterProps } from "../../filterProps-Cewck8OH.js";
15
15
  const headingAlignLeft = "left";
@@ -13,7 +13,7 @@ import { b as borderRadiusMd, c as borderRadiusFull } from "../../BorderRadius-C
13
13
  import { d as borderWidthSelected } from "../../BorderWidth-DfOlyKK7.js";
14
14
  import { a as opacityDisabled } from "../../Opacity-smkGiwsf.js";
15
15
  import { a as spacingXs, s as spacingMd } from "../../Spacing-D0HQH9YJ.js";
16
- import { b as buttonHeight, g as getButtonAppearance, p as primaryAppearance, a as ButtonAppearanceColor } from "../../styled-BSqC5P9h.js";
16
+ import { b as buttonHeight, g as getButtonAppearance, p as primaryAppearance, a as ButtonAppearanceColor } from "../../styled-DLS1p_AJ.js";
17
17
  import { f as filterProps } from "../../filterProps-Cewck8OH.js";
18
18
  import { g as getCssVar } from "../../getCssVar-BP6T9pFM.js";
19
19
  const iconButtonShapeSquare = "square";
@@ -4,9 +4,9 @@ import { df as IconLoader, it as iconSizeLg, iq as iconSize3xl, iv as iconSizeSm
4
4
  import Body from "../Body/index.js";
5
5
  import Heading from "../Heading/index.js";
6
6
  import InlineLink from "../InlineLink/index.js";
7
- import { R as RichText } from "../../index-BeSd-V81.js";
7
+ import { R as RichText } from "../../index-BRs8j3Vq.js";
8
8
  import { d as divTagName } from "../../tags-DI6H1biK.js";
9
- import { a as spacingXs, s as spacingMd } from "../../Spacing-D0HQH9YJ.js";
9
+ import { a as spacingXs, s as spacingMd, b as spacingNone } from "../../Spacing-D0HQH9YJ.js";
10
10
  import Link from "../Link/index.js";
11
11
  import styled from "styled-components";
12
12
  import { getBottomSpacing } from "../../foundations/token/getBottomSpacing/index.js";
@@ -95,10 +95,11 @@ const IconSnippet = ({
95
95
  iconPosition = iconSnippetPositionLeft,
96
96
  iconAlign = iconSnippetAlignTop,
97
97
  tag = divTagName,
98
+ icon,
98
99
  ...props
99
100
  }) => {
100
101
  return /* @__PURE__ */ jsxs(IconSnippetStyled, { ...props, iconPosition, iconAlign, as: tag, children: [
101
- /* @__PURE__ */ jsx(IconLoaderStyled, { size: size === iconSnippetSizeLarge ? iconSizeLg : size === iconSnippetSize3Xl ? iconSize3xl : iconSizeSm, name: props.icon }),
102
+ /* @__PURE__ */ jsx(IconLoaderStyled, { ...icon, bottomSpacing: spacingNone, size: size === iconSnippetSizeLarge ? iconSizeLg : size === iconSnippetSize3Xl ? iconSize3xl : iconSizeSm }),
102
103
  /* @__PURE__ */ jsx(IconSnippetContentStyled, { as: tag, iconPosition, children: getContents(contents) })
103
104
  ] });
104
105
  };
@@ -1,4 +1,4 @@
1
- import { IconName } from '@vfde-react/inline-icon-library';
1
+ import { IconLoaderProps } from '@vfde-react/inline-icon-library';
2
2
  import { HTMLAttributes } from 'react';
3
3
  import { BodyProps } from '../Body';
4
4
  import { HeadingProps } from '../Heading';
@@ -28,7 +28,7 @@ export interface IconSnippetProps extends PatternProps, HTMLAttributes<HTMLDivEl
28
28
  /**
29
29
  * Icon
30
30
  */
31
- icon: IconName;
31
+ icon: Omit<IconLoaderProps, 'size' | 'bottomSpacing'>;
32
32
  /**
33
33
  * contents must be an array containing any combination of HeadingProps, BodyProps, RichTextProps and/or InlineLinkProps;
34
34
  */
@@ -1,16 +1,16 @@
1
1
  "use client";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import Body from "../Body/index.js";
4
- import { a as fontWeightLight } from "../../FontWeight-CR22KTex.js";
4
+ import { b as fontWeightLight } from "../../FontWeight-DEBGHbtO.js";
5
5
  import { s as spacingMd, c as spacingSm, d as spacingXl, a as spacingXs, e as spacing2Xs, b as spacingNone } from "../../Spacing-D0HQH9YJ.js";
6
6
  import { m as mediumSize } from "../../SizeTypes-Ck_RdzIf.js";
7
- import { g as getUid, R as RichText } from "../../index-BeSd-V81.js";
7
+ import { g as getUid, R as RichText } from "../../index-BRs8j3Vq.js";
8
8
  import Button from "../Button/index.js";
9
9
  import Container from "../Container/index.js";
10
10
  import Heading, { headingAlignCenter } from "../Heading/index.js";
11
- import { P as Price, b as priceSizeSm } from "../../index-aUJfXBUI.js";
11
+ import { P as Price, b as priceSizeSm } from "../../index-WLBo71sp.js";
12
12
  import styled from "styled-components";
13
- import { B as Badge } from "../../index-ZHkR70j3.js";
13
+ import { B as Badge } from "../../index-CKvLGUdD.js";
14
14
  import ButtonGroup from "../ButtonGroup/index.js";
15
15
  import Grid from "../Grid/index.js";
16
16
  import GridItem from "../GridItem/index.js";
@@ -3,7 +3,7 @@ import { jsx, Fragment } from "react/jsx-runtime";
3
3
  import Body from "../Body/index.js";
4
4
  import Heading from "../Heading/index.js";
5
5
  import IconSnippet, { iconSnippetAlignCenter } from "../IconSnippet/index.js";
6
- import { R as RichText } from "../../index-BeSd-V81.js";
6
+ import { R as RichText } from "../../index-BRs8j3Vq.js";
7
7
  import styled from "styled-components";
8
8
  const LegendStyled = styled.legend.withConfig({
9
9
  displayName: "LegendStyled",
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
- import { L as LinkAsButton, a as LinkStyled, g as getLinkIcon } from "../../index-C5GzK6_0.js";
3
+ import { L as LinkAsButton, a as LinkStyled, g as getLinkIcon } from "../../index-DrySIh-D.js";
4
4
  import { r as renderInlineRichTextFromOpenText } from "../../renderInlineRichTextFromOpenText-RvOG3QbI.js";
5
5
  const isLinkAsButtonProp = (props) => {
6
6
  return props.href === void 0;
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import "react/jsx-runtime";
3
- import { L } from "../../index-C5GzK6_0.js";
3
+ import { L } from "../../index-DrySIh-D.js";
4
4
  import "../../renderInlineRichTextFromOpenText-RvOG3QbI.js";
5
5
  export {
6
6
  L as default
@@ -4,7 +4,7 @@ import { iu as iconSizeMd, df as IconLoader } from "../../index-Cbojl4_Q.js";
4
4
  import { s as spanTagName } from "../../tags-DI6H1biK.js";
5
5
  import { s as spacingMd, a as spacingXs, b as spacingNone } from "../../Spacing-D0HQH9YJ.js";
6
6
  import { s as smallSize } from "../../SizeTypes-Ck_RdzIf.js";
7
- import { B as Badge } from "../../index-ZHkR70j3.js";
7
+ import { B as Badge } from "../../index-CKvLGUdD.js";
8
8
  import styled from "styled-components";
9
9
  import forcedColors from "../../foundations/media-query/forcedColors/index.js";
10
10
  import { e as ease_in_sine } from "../../easing-Dm-pO8SY.js";
@@ -0,0 +1,5 @@
1
+ import { FC } from 'react';
2
+ import { MediaTextProps } from './props';
3
+ declare const MediaText: FC<MediaTextProps>;
4
+ export default MediaText;
5
+ export * from './props';
@@ -0,0 +1,121 @@
1
+ "use client";
2
+ import { jsxs, jsx } from "react/jsx-runtime";
3
+ import { useMemo } from "react";
4
+ import Flex from "../Flex/index.js";
5
+ import FlexItem from "../FlexItem/index.js";
6
+ import Heading, { headingAlignLeft } from "../Heading/index.js";
7
+ import Image, { aspectRatio16_9 } from "../Image/index.js";
8
+ import Link from "../Link/index.js";
9
+ import { g as getUid, R as RichText } from "../../index-BRs8j3Vq.js";
10
+ import YoutubeVideo from "../YoutubeVideo/index.js";
11
+ import { u as ulTagName, d as divTagName, l as liTagName } from "../../tags-DI6H1biK.js";
12
+ import { a as fontWeightRegular } from "../../FontWeight-DEBGHbtO.js";
13
+ import { b as textHeadingSm, t as textHeadingXs } from "../../HeadingSize-CfCRn3Lh.js";
14
+ import { s as spacingMd, e as spacing2Xs, c as spacingSm, b as spacingNone } from "../../Spacing-D0HQH9YJ.js";
15
+ import { u as useViewport } from "../../index-Cs0Hw0dj.js";
16
+ import styled from "styled-components";
17
+ import { v as viewport } from "../../index-Ck2bCrhT.js";
18
+ import { getBottomSpacing } from "../../foundations/token/getBottomSpacing/index.js";
19
+ import { getSpacing } from "../../foundations/token/getSpacing/index.js";
20
+ import { f as filterProps } from "../../filterProps-Cewck8OH.js";
21
+ import { a as flexOrientationVertical, f as flexOrientationHorizontal, b as flexJustifyStart } from "../../styled-B0YKfXTz.js";
22
+ const mediaTextOrientationTop = "top";
23
+ const mediaTextOrientationLeft = "left";
24
+ const mediaTextOrientationRight = "right";
25
+ const MediaTextStyled = styled.div.withConfig({
26
+ shouldForwardProp: filterProps(),
27
+ displayName: "MediaTextStyled",
28
+ componentId: "sc-zs2pry-0"
29
+ })(({
30
+ orientation,
31
+ bottomSpacing = spacingMd
32
+ }) => ({
33
+ display: "flex",
34
+ flexDirection: "column",
35
+ ...viewport.md({
36
+ flexDirection: orientation === "top" ? "column" : orientation === "left" ? "row" : "row-reverse"
37
+ }),
38
+ ...getBottomSpacing({
39
+ bottomSpacing
40
+ })
41
+ }));
42
+ const MediaTextMediaStyled = styled.div.withConfig({
43
+ shouldForwardProp: filterProps(),
44
+ displayName: "MediaTextMediaStyled",
45
+ componentId: "sc-zs2pry-1"
46
+ })(({
47
+ orientation,
48
+ bottomSpacing = spacingMd
49
+ }) => ({
50
+ flex: 1,
51
+ ...getBottomSpacing({
52
+ bottomSpacing
53
+ }),
54
+ ...viewport.md({
55
+ ...orientation != mediaTextOrientationTop ? {
56
+ marginBottom: 0
57
+ } : {}
58
+ })
59
+ }));
60
+ const MediaTextContentStyled = styled.div.withConfig({
61
+ shouldForwardProp: filterProps(),
62
+ displayName: "MediaTextContentStyled",
63
+ componentId: "sc-zs2pry-2"
64
+ })(({
65
+ orientation
66
+ }) => ({
67
+ flex: 1,
68
+ ...viewport.md({
69
+ ...orientation === "left" && {
70
+ paddingLeft: getSpacing(spacingMd)
71
+ },
72
+ ...orientation === "right" && {
73
+ paddingRight: getSpacing(spacingMd)
74
+ }
75
+ })
76
+ }));
77
+ const MediaText = ({
78
+ media,
79
+ orientation = mediaTextOrientationLeft,
80
+ heading,
81
+ subline,
82
+ richText,
83
+ action,
84
+ ...props
85
+ }) => {
86
+ const headingId = `heading-${getUid()}`;
87
+ const sublineId = `subline-${getUid()}`;
88
+ const viewport2 = useViewport();
89
+ const headingSpacing = subline ? spacing2Xs : spacingMd;
90
+ const hasMultipleActions = Array.isArray(action) && action.length > 1;
91
+ const actionFlexAs = hasMultipleActions ? ulTagName : divTagName;
92
+ const linkFlexItemAs = hasMultipleActions ? liTagName : divTagName;
93
+ const renderMedia = (media2) => {
94
+ if (!media2) return null;
95
+ switch (media2.component) {
96
+ case "Image":
97
+ return /* @__PURE__ */ jsx(Image, { ...media2, aspectRatio: aspectRatio16_9, bottomSpacing: spacingNone });
98
+ case "YoutubeVideo":
99
+ return /* @__PURE__ */ jsx(YoutubeVideo, { ...media2, bottomSpacing: spacingNone });
100
+ default:
101
+ console.warn(`Unsupported media component: ${media2.component}`);
102
+ return null;
103
+ }
104
+ };
105
+ const mediaContent = useMemo(() => renderMedia(media), [media]);
106
+ return /* @__PURE__ */ jsxs(MediaTextStyled, { orientation, ...props, children: [
107
+ /* @__PURE__ */ jsx(MediaTextMediaStyled, { orientation, children: mediaContent }),
108
+ /* @__PURE__ */ jsxs(MediaTextContentStyled, { orientation, children: [
109
+ /* @__PURE__ */ jsx(Heading, { ...heading, id: headingId, align: headingAlignLeft, size: textHeadingSm, bottomSpacing: headingSpacing }),
110
+ subline && /* @__PURE__ */ jsx(Heading, { ...subline, id: sublineId, align: headingAlignLeft, size: textHeadingXs, weight: fontWeightRegular, bottomSpacing: spacingMd }),
111
+ /* @__PURE__ */ jsx(RichText, { ...richText, bottomSpacing: spacingMd }),
112
+ /* @__PURE__ */ jsx(Flex, { bottomSpacing: spacingMd, gapSpacing: spacingSm, justify: flexJustifyStart, orientation: "sm" === viewport2 ? flexOrientationVertical : flexOrientationHorizontal, as: actionFlexAs, children: action && action.map((action2) => /* @__PURE__ */ jsx(FlexItem, { as: linkFlexItemAs, bottomSpacing: spacingNone, children: /* @__PURE__ */ jsx(Link, { ...action2 }) }, action2.uid)) })
113
+ ] })
114
+ ] });
115
+ };
116
+ export {
117
+ MediaText as default,
118
+ mediaTextOrientationLeft,
119
+ mediaTextOrientationRight,
120
+ mediaTextOrientationTop
121
+ };
@@ -0,0 +1,42 @@
1
+ import { HTMLAttributes } from 'react';
2
+ import { HeadingProps } from '../Heading/props';
3
+ import { ImageProps } from '../Image';
4
+ import { LinkProps } from '../Link';
5
+ import { RichTextProps } from '../RichText';
6
+ import { YoutubeVideoProps } from '../YoutubeVideo';
7
+ import { PatternProps } from '../../foundations/PatternProps';
8
+ export declare const mediaTextOrientationTop = "top";
9
+ export declare const mediaTextOrientationLeft = "left";
10
+ export declare const mediaTextOrientationRight = "right";
11
+ export type MediaTextOrientation = typeof mediaTextOrientationTop | typeof mediaTextOrientationLeft | typeof mediaTextOrientationRight;
12
+ export interface MediaTextProps extends PatternProps, HTMLAttributes<HTMLDivElement> {
13
+ /**
14
+ * Pin component's name from string to the concrete name
15
+ */
16
+ component?: 'MediaText';
17
+ /**
18
+ * media prop can be either an Image or a YoutubeVideo
19
+ * The aspect ratio is always 16 to 1. This must be taken into account when selecting the asset.
20
+ */
21
+ media: Omit<ImageProps, 'bottomSpacing'> | Omit<YoutubeVideoProps, 'bottomSpacing'>;
22
+ /**
23
+ * MediaText media can be orientated top, left or right.
24
+ */
25
+ orientation?: MediaTextOrientation;
26
+ /**
27
+ * Heading
28
+ */
29
+ heading: Omit<HeadingProps, 'size' | 'weight' | 'bottomSpacing'>;
30
+ /**
31
+ * Subline
32
+ */
33
+ subline?: Omit<HeadingProps, 'size' | 'weight' | 'bottomSpacing'>;
34
+ /**
35
+ * Body
36
+ */
37
+ richText: Omit<RichTextProps, 'bottomSpacing'>;
38
+ /**
39
+ * Action, list of links
40
+ */
41
+ action?: LinkProps[];
42
+ }