@seamly/web-ui 21.0.0 → 21.0.1-beta.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 (46) hide show
  1. package/build/dist/lib/components.js +14855 -20
  2. package/build/dist/lib/components.min.js +2 -1
  3. package/build/dist/lib/components.min.js.LICENSE.txt +48 -0
  4. package/build/dist/lib/config.js +9 -3
  5. package/build/dist/lib/config.min.js +1 -1
  6. package/build/dist/lib/contexts.js +14 -5
  7. package/build/dist/lib/contexts.min.js +1 -1
  8. package/build/dist/lib/deprecated-view.js +1 -1
  9. package/build/dist/lib/hooks.js +8446 -20
  10. package/build/dist/lib/hooks.min.js +2 -1
  11. package/build/dist/lib/hooks.min.js.LICENSE.txt +38 -0
  12. package/build/dist/lib/index.debug.js +5 -5
  13. package/build/dist/lib/index.debug.min.js +1 -1
  14. package/build/dist/lib/index.js +3424 -3427
  15. package/build/dist/lib/index.min.js +1 -1
  16. package/build/dist/lib/standalone.js +3801 -3804
  17. package/build/dist/lib/standalone.min.js +1 -1
  18. package/build/dist/lib/style-guide.js +21877 -7307
  19. package/build/dist/lib/style-guide.min.js +1 -1
  20. package/build/dist/lib/style-guide.min.js.LICENSE.txt +10 -0
  21. package/build/dist/lib/styles.js +1 -1
  22. package/build/dist/lib/utils.js +22066 -16
  23. package/build/dist/lib/utils.min.js +2 -1
  24. package/build/dist/lib/utils.min.js.LICENSE.txt +48 -0
  25. package/package.json +1 -1
  26. package/src/javascripts/domains/translations/components/options-dialog/translation-option.tsx +20 -15
  27. package/src/javascripts/domains/translations/components/options-dialog/translation-options.tsx +2 -6
  28. package/src/javascripts/index.ts +0 -2
  29. package/src/javascripts/package/components.js +15 -1
  30. package/src/javascripts/package/config.js +1 -1
  31. package/src/javascripts/package/contexts.js +5 -3
  32. package/src/javascripts/package/hooks.js +19 -1
  33. package/src/javascripts/package/utils.js +13 -6
  34. package/src/javascripts/style-guide/components/app.js +1 -1
  35. package/src/javascripts/style-guide/components/static-core.js +9 -7
  36. package/src/javascripts/style-guide/components/view.js +1 -1
  37. package/src/javascripts/style-guide/states.js +4 -6
  38. package/src/javascripts/style-guide/style-guide-engine.js +2 -1
  39. package/src/javascripts/style-guide/style-guide-external-api.js +1 -1
  40. package/src/javascripts/ui/components/conversation/event/chat-scroll/unread-messages-button.tsx +4 -1
  41. package/src/javascripts/ui/hooks/use-seamly-chat.js +1 -1
  42. package/src/stylesheets/3-chat/_chat.scss +2 -5
  43. package/src/stylesheets/5-components/_options.scss +0 -4
  44. package/src/stylesheets/5-components/_translation-options.scss +17 -5
  45. package/src/stylesheets/7-deprecated/5-components/_options.scss +0 -4
  46. package/src/stylesheets/7-deprecated/5-components/_translation-options.scss +16 -6
@@ -0,0 +1,48 @@
1
+ /*!
2
+ * focus-trap 7.1.0
3
+ * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
4
+ */
5
+
6
+ /*!
7
+ * tabbable 6.0.1
8
+ * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
9
+ */
10
+
11
+ /**
12
+ * @license React
13
+ * react-is.production.min.js
14
+ *
15
+ * Copyright (c) Facebook, Inc. and its affiliates.
16
+ *
17
+ * This source code is licensed under the MIT license found in the
18
+ * LICENSE file in the root directory of this source tree.
19
+ */
20
+
21
+ /**
22
+ * @license React
23
+ * use-sync-external-store-shim.production.min.js
24
+ *
25
+ * Copyright (c) Facebook, Inc. and its affiliates.
26
+ *
27
+ * This source code is licensed under the MIT license found in the
28
+ * LICENSE file in the root directory of this source tree.
29
+ */
30
+
31
+ /**
32
+ * @license React
33
+ * use-sync-external-store-shim/with-selector.production.min.js
34
+ *
35
+ * Copyright (c) Facebook, Inc. and its affiliates.
36
+ *
37
+ * This source code is licensed under the MIT license found in the
38
+ * LICENSE file in the root directory of this source tree.
39
+ */
40
+
41
+ /** @license React v16.13.1
42
+ * react-is.production.min.js
43
+ *
44
+ * Copyright (c) Facebook, Inc. and its affiliates.
45
+ *
46
+ * This source code is licensed under the MIT license found in the
47
+ * LICENSE file in the root directory of this source tree.
48
+ */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seamly/web-ui",
3
- "version": "21.0.0",
3
+ "version": "21.0.1-beta.1",
4
4
  "main": "build/dist/lib/index.js",
5
5
  "types": "build/src/javascripts/index.d.ts",
6
6
  "module": "",
@@ -5,6 +5,7 @@ import { className } from 'lib/css'
5
5
  type TranslationOptionProps = {
6
6
  label: string
7
7
  checked: boolean
8
+ description?: string
8
9
  onChange: () => void
9
10
  id: string
10
11
  }
@@ -12,24 +13,28 @@ type TranslationOptionProps = {
12
13
  const TranslationOption: FC<TranslationOptionProps> = ({
13
14
  label,
14
15
  checked,
16
+ description,
15
17
  onChange,
16
18
  id,
17
19
  }) => (
18
- <li className={className('translation-options--item')}>
19
- <label>
20
- <input
21
- id={id}
22
- type="checkbox"
23
- value={label}
24
- checked={checked}
25
- className={className('visually-hidden')}
26
- onChange={onChange}
27
- name="language"
28
- />
29
- <span className={className('translation-options--icon-container')}>
30
- {checked ? <Icon alt={label} name="check" size="16" /> : null}
31
- </span>
32
- {label}
20
+ <li
21
+ className={className('translation-options__item', {
22
+ 'translation-options__item--checked': checked,
23
+ })}
24
+ >
25
+ <input
26
+ id={id}
27
+ type="radio"
28
+ value={label}
29
+ checked={checked}
30
+ className={className('visually-hidden')}
31
+ onChange={onChange}
32
+ name="language"
33
+ />
34
+
35
+ <label htmlFor={id}>
36
+ <Icon alt="" name="check" size="16" />
37
+ {label} {description && <span>({description})</span>}
33
38
  </label>
34
39
  </li>
35
40
  )
@@ -60,11 +60,6 @@ const TranslationOptions: FC<TranslationOptionsProps> = ({
60
60
  {sortedLanguages.map((language, idx) => {
61
61
  const isOriginal = idx === 0
62
62
 
63
- const originalLabel = isOriginal
64
- ? ` (${t('translations.settings.original')})`
65
- : ''
66
- const label = `${language.nativeName}${originalLabel}`
67
-
68
63
  const checked =
69
64
  currentLocale === language.locale || (!currentLocale && isOriginal)
70
65
 
@@ -72,8 +67,9 @@ const TranslationOptions: FC<TranslationOptionsProps> = ({
72
67
  <TranslationOption
73
68
  key={language.locale}
74
69
  id={language.locale}
75
- label={label}
70
+ label={language.nativeName}
76
71
  checked={checked}
72
+ description={isOriginal && t('translations.settings.original')}
77
73
  onChange={handleChange(language)}
78
74
  />
79
75
  )
@@ -20,8 +20,6 @@ export { visibilityStates } from 'domains/visibility/constants'
20
20
  export { useVisibility as useSeamlyVisibility } from 'domains/visibility/hooks'
21
21
  export { calculateVisibility } from 'domains/visibility/utils'
22
22
  // Used by: StyleGuide
23
- export { Provider as SeamlyStoreProvider } from 'react-redux'
24
- // Used by: StyleGuide
25
23
  export { default as ComponentFilter } from 'ui/components/conversation/component-filter'
26
24
  // Used by: Client
27
25
  export { default as Conversation } from 'ui/components/conversation/conversation'
@@ -1,3 +1,17 @@
1
+ import Conversation from 'ui/components/conversation/conversation'
2
+ import EventParticipant from 'ui/components/conversation/event/event-participant'
3
+ import Text from 'ui/components/conversation/event/text'
4
+ import MessageContainer from 'ui/components/conversation/message-container'
5
+ import DeprecatedToggleButton from 'ui/components/entry/deprecated-toggle-button'
6
+ import EntryContainer from 'ui/components/entry/entry-container'
7
+ import AgentInfo from 'ui/components/layout/agent-info'
8
+ import Chat from 'ui/components/layout/chat'
9
+ import ChatFrame from 'ui/components/layout/chat-frame'
10
+ import Header from 'ui/components/layout/header'
11
+ import Icon from 'ui/components/layout/icon'
12
+ import View from 'ui/components/view'
13
+ import DeprecatedView from 'ui/components/view/deprecated-view'
14
+
1
15
  export {
2
16
  AgentInfo,
3
17
  Chat,
@@ -12,4 +26,4 @@ export {
12
26
  DeprecatedToggleButton,
13
27
  DeprecatedView,
14
28
  View,
15
- } from '@seamly/web-ui'
29
+ }
@@ -1 +1 @@
1
- export { visibilityStates } from '@seamly/web-ui'
1
+ export { visibilityStates } from 'domains/visibility/constants'
@@ -1,5 +1,7 @@
1
- export {
1
+ import {
2
2
  SeamlyApiContext,
3
3
  SeamlyEventBusContext,
4
- SeamlyLiveRegionContext,
5
- } from '@seamly/web-ui'
4
+ } from 'ui/components/core/seamly-api-context'
5
+ import { SeamlyLiveRegionContext } from 'ui/components/core/seamly-live-region-context'
6
+
7
+ export { SeamlyApiContext, SeamlyEventBusContext, SeamlyLiveRegionContext }
@@ -1,3 +1,21 @@
1
+ import { useChoicePrompt } from 'ui/components/conversation/event/choice-prompt'
2
+ import {
3
+ useSeamlyEventStream,
4
+ useSeamlyIdleDetachCountdown,
5
+ useSeamlyMessageContainerClassNames,
6
+ useSeamlyOptions,
7
+ } from 'ui/hooks/seamly-hooks'
8
+ import { useEvents } from 'ui/hooks/seamly-state-hooks'
9
+ import useSeamlyChat from 'ui/hooks/use-seamly-chat'
10
+ import useSeamlyCommands from 'ui/hooks/use-seamly-commands'
11
+ import { useGeneratedId } from 'ui/hooks/utility-hooks'
12
+ import { useI18n } from 'domains/i18n/hooks'
13
+ import {
14
+ useTranslatedEventData,
15
+ useTranslations,
16
+ useTranslationsContainer,
17
+ } from 'domains/translations/hooks'
18
+
1
19
  export {
2
20
  useChoicePrompt,
3
21
  useEvents,
@@ -12,4 +30,4 @@ export {
12
30
  useTranslatedEventData,
13
31
  useTranslations,
14
32
  useTranslationsContainer,
15
- } from '@seamly/web-ui'
33
+ }
@@ -1,3 +1,15 @@
1
+ import { eventTypes } from 'ui/utils/seamly-utils'
2
+ import { calculateVisibility } from 'domains/visibility/utils'
3
+ import { className } from 'lib/css'
4
+ import Engine from 'lib/engine'
5
+ import ExternalApi from 'lib/external-api'
6
+ import { randomId } from 'lib/id'
7
+
8
+ export {
9
+ getSearchParamsByKeys,
10
+ initResetSearchParams,
11
+ replaceSearchParams,
12
+ } from 'lib/url-helpers'
1
13
  export {
2
14
  calculateVisibility,
3
15
  className,
@@ -5,9 +17,4 @@ export {
5
17
  eventTypes,
6
18
  ExternalApi,
7
19
  randomId,
8
- } from '@seamly/web-ui'
9
- export {
10
- getSearchParamsByKeys,
11
- initResetSearchParams,
12
- replaceSearchParams,
13
- } from 'lib/url-helpers'
20
+ }
@@ -1,5 +1,5 @@
1
- import { randomId } from '@seamly/web-ui'
2
1
  import { useCallback, useEffect, useState } from 'preact/hooks'
2
+ import { randomId } from 'lib/id'
3
3
  import { getSearchParamsByKeys, getUrlSearchParams } from 'lib/url-helpers'
4
4
  import StyleGuideLinks from 'style-guide/components/links'
5
5
  import StyleGuideView from 'style-guide/components/view'
@@ -1,13 +1,13 @@
1
1
  import { configureStore } from '@reduxjs/toolkit'
2
+ import { useMemo, useRef } from 'preact/hooks'
3
+ import { Provider } from 'react-redux'
4
+ import ComponentFilter from 'ui/components/conversation/component-filter'
2
5
  import {
3
- ComponentFilter,
4
6
  SeamlyApiContext,
5
7
  SeamlyEventBusContext,
6
- SeamlyLiveRegionContext,
7
- SeamlyStoreProvider,
8
- } from '@seamly/web-ui'
9
- import { useMemo, useRef } from 'preact/hooks'
8
+ } from 'ui/components/core/seamly-api-context'
10
9
  import SeamlyChat from 'ui/components/core/seamly-chat'
10
+ import { SeamlyLiveRegionContext } from 'ui/components/core/seamly-live-region-context'
11
11
  import appReducer from 'domains/app/slice'
12
12
  import configReducer, {
13
13
  setConfig,
@@ -39,6 +39,8 @@ const bareApi = {
39
39
  },
40
40
  },
41
41
  hasConversation: () => false,
42
+ connected: false,
43
+ ready: false,
42
44
  }
43
45
 
44
46
  const SeamlyStaticCore = ({
@@ -118,7 +120,7 @@ const SeamlyStaticCore = ({
118
120
 
119
121
  return (
120
122
  state && (
121
- <SeamlyStoreProvider store={store}>
123
+ <Provider store={store}>
122
124
  <SeamlyEventBusContext.Provider value={eventBusRef.current}>
123
125
  <SeamlyLiveRegionContext.Provider value={liveMsgRef.current}>
124
126
  <SeamlyApiContext.Provider value={bareApi}>
@@ -128,7 +130,7 @@ const SeamlyStaticCore = ({
128
130
  </SeamlyApiContext.Provider>
129
131
  </SeamlyLiveRegionContext.Provider>
130
132
  </SeamlyEventBusContext.Provider>
131
- </SeamlyStoreProvider>
133
+ </Provider>
132
134
  )
133
135
  )
134
136
  }
@@ -1,5 +1,5 @@
1
- import { View } from '@seamly/web-ui'
2
1
  import { useEffect, useState } from 'preact/hooks'
2
+ import View from 'ui/components/view'
3
3
  import { timeout } from 'ui/hooks/focus-helper-hooks'
4
4
  import StyleGuideStaticCore from './static-core'
5
5
 
@@ -1,9 +1,7 @@
1
- import {
2
- SeamlyGeneralError,
3
- SeamlyOfflineError,
4
- randomId,
5
- visibilityStates,
6
- } from '@seamly/web-ui'
1
+ import SeamlyGeneralError from 'api/errors/seamly-general-error'
2
+ import SeamlyOfflineError from 'api/errors/seamly-offline-error'
3
+ import { visibilityStates } from 'domains/visibility/constants'
4
+ import { randomId } from 'lib/id'
7
5
  import { addTranslationData } from './state-helpers'
8
6
 
9
7
  const baseState = {
@@ -1,5 +1,6 @@
1
- import { API, Engine } from '@seamly/web-ui'
1
+ import { API } from 'api'
2
2
  import { render } from 'preact'
3
+ import Engine from 'lib/engine'
3
4
  import StyleGuideApp from './components/app'
4
5
 
5
6
  class SeamlyStyleGuideInstance extends Engine {
@@ -1,4 +1,4 @@
1
- import { ExternalApi } from '@seamly/web-ui'
1
+ import ExternalApi from 'lib/external-api'
2
2
  import StyleGuideEngine from './style-guide-engine'
3
3
 
4
4
  class StyleGuideExternalApi extends ExternalApi {
@@ -3,13 +3,16 @@ import ChatScrollContext from 'ui/components/conversation/event/chat-scroll/chat
3
3
  import Icon from 'ui/components/layout/icon'
4
4
  import InOutTransition from 'ui/components/widgets/in-out-transition'
5
5
  import { useI18n } from 'domains/i18n/hooks'
6
+ import { useVisibility } from 'domains/visibility/hooks'
6
7
  import { className } from 'lib/css'
7
8
 
8
9
  const UnreadMessagesButton = () => {
9
10
  const { scrollToRef, unreadIds } = useContext(ChatScrollContext)
11
+ const { isMinimized } = useVisibility()
10
12
  const { t } = useI18n()
13
+
11
14
  return (
12
- <InOutTransition isActive={!!unreadIds.length}>
15
+ <InOutTransition isActive={!!unreadIds.length && !isMinimized}>
13
16
  <div className={className('unread-messages')}>
14
17
  <button
15
18
  type="button"
@@ -1,5 +1,6 @@
1
1
  import { useCallback, useEffect, useRef } from 'preact/hooks'
2
2
  import { useDispatch, useSelector } from 'react-redux'
3
+ import useSeamlyCommands from 'ui/hooks/use-seamly-commands'
3
4
  import { useI18n } from 'domains/i18n/hooks'
4
5
  import { setIsLoading } from 'domains/store/slice'
5
6
  import { useVisibility } from 'domains/visibility/hooks'
@@ -7,7 +8,6 @@ import { selectShowInlineView } from '../../domains/visibility/selectors'
7
8
  import { useLiveRegion } from './live-region-hooks'
8
9
  import { useSeamlyHasConversation } from './seamly-api-hooks'
9
10
  import { useEvents, useSeamlyLayoutMode } from './seamly-state-hooks'
10
- import useSeamlyCommands from './use-seamly-commands'
11
11
 
12
12
  const useSeamlyChat = () => {
13
13
  const events = useEvents()
@@ -112,6 +112,7 @@
112
112
  justify-content: center;
113
113
 
114
114
  &__scroll-area {
115
+ overscroll-behavior: contain;
115
116
  display: flex;
116
117
  position: relative;
117
118
  flex-direction: column;
@@ -119,7 +120,7 @@
119
120
  width: 100%;
120
121
  height: 100%;
121
122
  overflow-y: auto;
122
- will-change: transform;
123
+ will-change: scroll-position;
123
124
  }
124
125
 
125
126
  &__header {
@@ -137,10 +138,6 @@
137
138
  padding: 0;
138
139
  }
139
140
 
140
- .#{$n}-chat--layout-window .#{$n}-chat__body {
141
- overscroll-behavior: contain;
142
- }
143
-
144
141
  .#{$n}-chat__entry {
145
142
  position: relative;
146
143
  flex: 0 0 auto;
@@ -214,10 +214,6 @@
214
214
  }
215
215
  }
216
216
 
217
- .#{$n}-options__body div {
218
- width: 100%;
219
- }
220
-
221
217
  .#{$n}-options__wrapper h3 {
222
218
  margin: 0;
223
219
  color: $brand2;
@@ -6,7 +6,7 @@
6
6
  padding: 1px 0 0;
7
7
  list-style: none;
8
8
 
9
- &--item {
9
+ &__item {
10
10
  color: $brand3;
11
11
  font-size: $fontsize-small;
12
12
 
@@ -25,15 +25,27 @@
25
25
  &:focus-within:has(input:focus-visible) {
26
26
  outline: -webkit-focus-ring-color auto 1px;
27
27
  }
28
+
29
+ > span {
30
+ margin-left: 0.5em;
31
+ }
32
+ }
33
+
34
+ .#{$n}-icon {
35
+ opacity: 0;
36
+ }
37
+
38
+ &--checked {
39
+ .#{$n}-icon {
40
+ opacity: 1;
41
+ }
28
42
  }
29
43
  }
30
44
 
31
- &--icon-container {
45
+ .#{$n}-icon {
46
+ display: flex;
32
47
  width: $iconsize-small;
33
48
  height: $iconsize-small;
34
49
  margin-right: calc($spacer / 2);
35
- .#{$n}-icon {
36
- height: $iconsize-small;
37
- }
38
50
  }
39
51
  }
@@ -219,10 +219,6 @@
219
219
  }
220
220
  }
221
221
 
222
- .#{$n}-options__body div {
223
- width: 100%;
224
- }
225
-
226
222
  .#{$n}-options__wrapper h3 {
227
223
  margin: 0;
228
224
  color: $brand2;
@@ -10,6 +10,16 @@
10
10
  color: $brand3;
11
11
  font-size: $fontsize-small;
12
12
 
13
+ > input[type='radio'] {
14
+ + label svg {
15
+ opacity: 0;
16
+ }
17
+
18
+ &:checked + label svg {
19
+ opacity: 1;
20
+ }
21
+ }
22
+
13
23
  > label {
14
24
  display: flex;
15
25
  align-items: center;
@@ -25,15 +35,15 @@
25
35
  &:focus-within:has(input:focus-visible) {
26
36
  outline: -webkit-focus-ring-color auto 1px;
27
37
  }
38
+
39
+ > span {
40
+ margin-left: 0.5em;
41
+ }
28
42
  }
29
43
  }
30
44
 
31
- &--icon-container {
32
- width: 16px;
33
- height: 16px;
45
+ &--icon {
46
+ display: flex;
34
47
  margin-right: calc($spacer / 2);
35
- .#{$n}-icon {
36
- height: 16px;
37
- }
38
48
  }
39
49
  }