@websolutespa/bom-mixer-ui 1.9.16 → 1.9.17

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @websolutespa/bom-mixer-ui
2
2
 
3
+ ## 1.9.17
4
+
5
+ ### Patch Changes
6
+
7
+ - Added: informative prop to Media
8
+
3
9
  ## 1.9.16
4
10
 
5
11
  ### Patch Changes
package/dist/cjs/index.js CHANGED
@@ -4842,7 +4842,8 @@ const MediaImage_ = _a => {
4842
4842
  }, canLoad ? imageProps : undefined, {
4843
4843
  className: classNames,
4844
4844
  loading: loading,
4845
- draggable: false
4845
+ draggable: false,
4846
+ "aria-hidden": !props.informative
4846
4847
  }));
4847
4848
  };
4848
4849
  const MediaImage = /*#__PURE__*/React.memo(MediaImage_);
@@ -5052,8 +5053,8 @@ function getMediaItemProps(mediaItem, options) {
5052
5053
  const media = __rest(mediaItem, ["width", "height", "sizes"]);
5053
5054
  const title = media.title || options.title;
5054
5055
  // console.log('getMediaItemProps', media.alt, options.alt);
5055
- // const alt: string | undefined = (media.alt || options.alt) as string | undefined;
5056
- const alt = options.alt || '';
5056
+ const alt = media.alt || options.alt;
5057
+ // const alt: string = (options.alt || '');
5057
5058
  const src = media.src || media.url || '';
5058
5059
  const mediaItemProps = {
5059
5060
  src,
@@ -5088,6 +5089,7 @@ function getMediaItemProps(mediaItem, options) {
5088
5089
  mediaItemProps.aspectRatioMd = options.aspectRatioMd;
5089
5090
  mediaItemProps.aspectRatioLg = options.aspectRatioLg;
5090
5091
  mediaItemProps.aspectRatioXl = options.aspectRatioXl;
5092
+ mediaItemProps.informative = options.informative;
5091
5093
  if (options.eager) {
5092
5094
  mediaItemProps.loading = 'eager';
5093
5095
  }
@@ -5214,12 +5216,13 @@ const MediaBase = /*#__PURE__*/React.forwardRef((_a, ref) => {
5214
5216
  eager,
5215
5217
  alt,
5216
5218
  title,
5219
+ informative,
5217
5220
  onClick,
5218
5221
  onLoaded,
5219
5222
  canLoad,
5220
5223
  as = 'div'
5221
5224
  } = _a,
5222
- props = __rest(_a, ["children", "item", "className", "width", "height", "size", "eager", "alt", "title", "onClick", "onLoaded", "canLoad", "as"]);
5225
+ props = __rest(_a, ["children", "item", "className", "width", "height", "size", "eager", "alt", "title", "informative", "onClick", "onLoaded", "canLoad", "as"]);
5223
5226
  const {
5224
5227
  id,
5225
5228
  open
@@ -5254,6 +5257,7 @@ const MediaBase = /*#__PURE__*/React.forwardRef((_a, ref) => {
5254
5257
  eager,
5255
5258
  alt,
5256
5259
  title,
5260
+ informative,
5257
5261
  open,
5258
5262
  onLoaded,
5259
5263
  canLoad
@@ -6142,8 +6146,36 @@ function Meta(_a) {
6142
6146
  brand
6143
6147
  } = _a,
6144
6148
  props = __rest(_a, ["children", "structuredDataCollections", "brand"]);
6149
+ const layout = bomMixerHooks.useLayout();
6145
6150
  const page = bomMixerHooks.usePage();
6146
6151
  const extra = bomMixerHooks.useExtra();
6152
+ // alternates
6153
+ const alternates = React.useMemo(() => {
6154
+ const alternates = [];
6155
+ page.alternates.forEach(alternate => {
6156
+ const market = layout.markets.find(x => x.id === alternate.market);
6157
+ if (market) {
6158
+ if (market.countries && market.countries.length > 0) {
6159
+ market.countries.forEach(country => {
6160
+ // country: string | { alpha2Code: string };
6161
+ const alpha2Code = typeof country === 'string' ? country : country.alpha2Code;
6162
+ alternates.push({
6163
+ id: `${alternate.market}-${alternate.locale}-${alpha2Code}`,
6164
+ href: bomMixerModels.resolveHref(alternate.id),
6165
+ hrefLang: `${alternate.locale}-${alpha2Code}`
6166
+ });
6167
+ });
6168
+ } else {
6169
+ alternates.push({
6170
+ id: `${alternate.market}-${alternate.locale}`,
6171
+ href: bomMixerModels.resolveHref(alternate.id),
6172
+ hrefLang: alternate.locale
6173
+ });
6174
+ }
6175
+ }
6176
+ });
6177
+ return alternates;
6178
+ }, [layout, page]);
6147
6179
  // title
6148
6180
  let title = ((_b = page.meta) === null || _b === void 0 ? void 0 : _b.title) || page.title;
6149
6181
  // description
@@ -6211,11 +6243,11 @@ function Meta(_a) {
6211
6243
  }), relNext && jsxRuntime.jsx("link", {
6212
6244
  rel: "next",
6213
6245
  href: bomMixerModels.resolveHref(relNext)
6214
- }), page.alternates && page.alternates.map(alternate => jsxRuntime.jsx("link", {
6246
+ }), alternates.map(alternate => jsxRuntime.jsx("link", {
6215
6247
  rel: "alternate",
6216
- href: bomMixerModels.resolveHref(alternate.id),
6217
- hrefLang: alternate.locale
6218
- }, `${alternate.locale}-${alternate.market}`)), image && jsxRuntime.jsx("meta", {
6248
+ href: alternate.href,
6249
+ hrefLang: alternate.hrefLang
6250
+ }, alternate.id)), image && jsxRuntime.jsx("meta", {
6219
6251
  property: "og:image",
6220
6252
  content: bomMixerModels.resolveHref(image)
6221
6253
  }), false , structuredData && jsxRuntime.jsx("script", {