@seamly/web-ui 19.1.3 → 19.1.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seamly/web-ui",
3
- "version": "19.1.3",
3
+ "version": "19.1.4",
4
4
  "main": "build/dist/lib/index.js",
5
5
  "module": "",
6
6
  "exports": {
package/src/.DS_Store ADDED
Binary file
@@ -124,6 +124,10 @@ class ExternalApi {
124
124
  if (typeof this.appConfig === 'function') {
125
125
  return this.appConfig(userConfig)
126
126
  }
127
+ const defaults = {
128
+ ...this.appConfig.defaults,
129
+ ...userConfig.defaults,
130
+ }
127
131
  return {
128
132
  ...this.appConfig,
129
133
  ...userConfig,
@@ -131,6 +135,7 @@ class ExternalApi {
131
135
  ...this.appConfig.api,
132
136
  ...userConfig.api,
133
137
  },
138
+ defaults: Object.keys(defaults).length ? defaults : undefined,
134
139
  }
135
140
  }
136
141
  }
@@ -8,6 +8,9 @@ import CarouselMessageSlide from '../carousel-message/components/slide'
8
8
 
9
9
  const defaultGetItemKey = (item, idx, prefix) => `${prefix}${idx}`
10
10
  const defaultGetItemLabel = (item) => item.label
11
+ const preventScroll = ({ target }) => {
12
+ target.scrollLeft = 0
13
+ }
11
14
 
12
15
  export default function CarouselComponent({
13
16
  currentIndex: originalIndex,
@@ -51,7 +54,10 @@ export default function CarouselComponent({
51
54
  role="group"
52
55
  aria-roledescription="carousel"
53
56
  >
54
- <div className={className('carousel__slides-wrapper')}>
57
+ <div
58
+ className={className('carousel__slides-wrapper')}
59
+ onScroll={preventScroll}
60
+ >
55
61
  <div
56
62
  id={carouselItemsId}
57
63
  className={className('carousel__slides')}
@@ -78,6 +84,7 @@ export default function CarouselComponent({
78
84
  item={item}
79
85
  items={items}
80
86
  currentIndex={currentIndex}
87
+ index={idx}
81
88
  isActive={isActive}
82
89
  />
83
90
  </div>
@@ -5,18 +5,17 @@ import CardComponent from '../../card-component'
5
5
  export default function CarouselMessageSlide({
6
6
  item: slide,
7
7
  items,
8
- currentIndex,
8
+ index,
9
9
  isActive,
10
10
  }) {
11
11
  const { t } = useI18n()
12
-
13
12
  return (
14
13
  <div
15
14
  className={className('carousel-item', `carousel-item--${slide.type}`)}
16
15
  role="group"
17
16
  aria-roledescription="slide"
18
17
  aria-label={t('carousel.slide.label', {
19
- index: currentIndex + 1,
18
+ index: index + 1,
20
19
  total: items.length,
21
20
  })}
22
21
  >
@@ -1,11 +1,13 @@
1
1
  import MessageContainer from '../../message-container'
2
2
  import CarouselComponent from '../carousel-component'
3
+ import { useTranslatedEventData } from '../../../../../domains/translations'
3
4
  import CarouselMessageSlide from './components/slide'
4
5
 
5
6
  const getItemKey = (item, idx, prefix = '') => `${prefix}${item.title}:${idx}`
6
7
  const getItemLabel = (item) => item.title
7
8
  const CarouselMessage = ({ event }) => {
8
- const slides = event.payload.body.cards
9
+ const [body] = useTranslatedEventData(event)
10
+ const slides = body.cards
9
11
 
10
12
  return (
11
13
  <MessageContainer event={event} modifiers={'type-carousel'}>