@seamly/web-ui 21.0.1 → 21.0.2-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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seamly/web-ui",
3
- "version": "21.0.1",
3
+ "version": "21.0.2-beta.1",
4
4
  "main": "build/dist/lib/index.js",
5
5
  "types": "build/src/javascripts/index.d.ts",
6
6
  "module": "",
@@ -2,7 +2,6 @@ import AppOptions from 'ui/components/app-options'
2
2
  import ChatScrollProvider from 'ui/components/conversation/event/chat-scroll/chat-scroll-provider'
3
3
  import EntryContainer from 'ui/components/entry/entry-container'
4
4
  import CollapseButton from 'ui/components/view/window-view/collapse-button'
5
- import { useSeamlyLayoutMode } from 'ui/hooks/seamly-state-hooks'
6
5
  import { useInterrupt } from 'domains/interrupt/hooks'
7
6
  import TranslationStatus from 'domains/translations/components/translation-status'
8
7
  import { useVisibility } from 'domains/visibility/hooks'
@@ -10,8 +9,7 @@ import { className } from 'lib/css'
10
9
 
11
10
  function ChatFrame({ children, interruptComponent: InterruptComponent }) {
12
11
  const { hasInterrupt, meta } = useInterrupt()
13
- const { isOpen, closeChat } = useVisibility()
14
- const { isWindow } = useSeamlyLayoutMode()
12
+ const { isOpen } = useVisibility()
15
13
 
16
14
  if (hasInterrupt) {
17
15
  if (isOpen) {
@@ -25,7 +23,7 @@ function ChatFrame({ children, interruptComponent: InterruptComponent }) {
25
23
  <ChatScrollProvider>
26
24
  <div className={className('chat__container__header')}>
27
25
  <TranslationStatus />
28
- {isOpen && isWindow && <CollapseButton onClick={closeChat} />}
26
+ <CollapseButton />
29
27
  </div>
30
28
  {children}
31
29
  </ChatScrollProvider>
@@ -1,4 +1,5 @@
1
1
  import { useEffect } from 'preact/hooks'
2
+ import CollapseButton from 'ui/components/view/window-view/collapse-button'
2
3
  import {
3
4
  useGeneratedId,
4
5
  useLiveRegion,
@@ -46,6 +47,7 @@ const Interrupt = ({
46
47
 
47
48
  return !isExpiredError ? (
48
49
  <section className={className('interrupt')} aria-labelledby={headingId}>
50
+ <CollapseButton />
49
51
  <div className={className('interrupt__body')}>
50
52
  <h2 id={headingId} className={className('interrupt__title')}>
51
53
  {title}
@@ -1,20 +1,22 @@
1
- import { useCallback } from 'preact/hooks'
2
1
  import Icon from 'ui/components/layout/icon'
2
+ import { useSeamlyLayoutMode } from 'ui/hooks/seamly-state-hooks'
3
3
  import { useI18n } from 'domains/i18n/hooks'
4
+ import { useVisibility } from 'domains/visibility/hooks'
4
5
  import { className } from 'lib/css'
5
6
 
6
- const CollapseButton = ({ onClick }) => {
7
+ const CollapseButton = () => {
7
8
  const { t } = useI18n()
8
- const handleClick = useCallback(() => onClick(), [onClick])
9
- return (
9
+ const { isOpen, closeChat } = useVisibility()
10
+ const { isWindow } = useSeamlyLayoutMode()
11
+ return isOpen && isWindow ? (
10
12
  <button
11
13
  type="button"
12
14
  className={className('button', 'collapse-button')}
13
- onClick={handleClick}
15
+ onClick={closeChat}
14
16
  >
15
17
  <Icon name="chevronDown" size="32" alt={t('window.srCollapseButton')} />
16
18
  </button>
17
- )
19
+ ) : null
18
20
  }
19
21
 
20
22
  export default CollapseButton