@seamly/web-ui 19.1.1 → 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/build/dist/lib/index.debug.js +8 -8
- package/build/dist/lib/index.debug.min.js +1 -1
- package/build/dist/lib/index.js +40 -12
- package/build/dist/lib/index.min.js +1 -1
- package/build/dist/lib/standalone.js +43 -15
- package/build/dist/lib/standalone.min.js +1 -1
- package/build/dist/lib/style-guide.js +38 -2
- package/build/dist/lib/style-guide.min.js +1 -1
- package/package.json +1 -1
- package/src/javascripts/api/errors/seamly-base-error.js +7 -0
- package/src/javascripts/api/producer.js +5 -1
- package/src/javascripts/domains/errors/index.js +5 -4
- package/src/javascripts/lib/external-api/index.js +5 -0
- package/src/javascripts/style-guide/components/static-core.js +9 -1
- package/src/javascripts/ui/components/conversation/event/carousel-component/index.js +8 -1
- package/src/javascripts/ui/components/conversation/event/carousel-message/components/slide.js +2 -3
- package/src/javascripts/ui/components/conversation/event/carousel-message/index.js +3 -1
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { useMemo, useRef } from 'preact/hooks'
|
|
2
|
+
import thunkMiddleware from 'redux-thunk'
|
|
3
|
+
|
|
2
4
|
import {
|
|
3
5
|
SeamlyEventBusContext,
|
|
4
6
|
SeamlyApiContext,
|
|
@@ -6,7 +8,6 @@ import {
|
|
|
6
8
|
StoreProvider,
|
|
7
9
|
createReduxStore,
|
|
8
10
|
} from '@seamly/web-ui'
|
|
9
|
-
|
|
10
11
|
import stateReducer from '../../domains/store/state-reducer'
|
|
11
12
|
import { Reducer as formReducer } from '../../domains/forms'
|
|
12
13
|
import { Reducer as translationsReducer } from '../../domains/translations'
|
|
@@ -28,6 +29,7 @@ const bareApi = {
|
|
|
28
29
|
return Promise.resolve({})
|
|
29
30
|
},
|
|
30
31
|
store: { get: () => {}, set: () => {} },
|
|
32
|
+
hasConversation: () => false,
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
const SeamlyTestCore = ({ state, translations, children }) => {
|
|
@@ -59,6 +61,12 @@ const SeamlyTestCore = ({ state, translations, children }) => {
|
|
|
59
61
|
[String(interruptReducer)]: interruptSlice,
|
|
60
62
|
[String(visibilityReducer)]: visibilitySlice,
|
|
61
63
|
},
|
|
64
|
+
middlewares: [
|
|
65
|
+
thunkMiddleware.withExtraArgument({
|
|
66
|
+
api: bareApi,
|
|
67
|
+
eventBus: eventBusRef.current,
|
|
68
|
+
}),
|
|
69
|
+
],
|
|
62
70
|
})
|
|
63
71
|
newStore.dispatch(ConfigActions.initialize(configSlice || {}))
|
|
64
72
|
newStore.dispatch(I18nActions.setLocale.fulfilled('en-GB', translations))
|
|
@@ -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
|
|
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>
|
package/src/javascripts/ui/components/conversation/event/carousel-message/components/slide.js
CHANGED
|
@@ -5,18 +5,17 @@ import CardComponent from '../../card-component'
|
|
|
5
5
|
export default function CarouselMessageSlide({
|
|
6
6
|
item: slide,
|
|
7
7
|
items,
|
|
8
|
-
|
|
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:
|
|
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
|
|
9
|
+
const [body] = useTranslatedEventData(event)
|
|
10
|
+
const slides = body.cards
|
|
9
11
|
|
|
10
12
|
return (
|
|
11
13
|
<MessageContainer event={event} modifiers={'type-carousel'}>
|