@seamly/web-ui 21.0.2-beta.3 → 21.0.2-beta.5

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 (30) hide show
  1. package/build/dist/lib/components.js +119 -186
  2. package/build/dist/lib/components.min.js +1 -1
  3. package/build/dist/lib/components.min.js.LICENSE.txt +1 -1
  4. package/build/dist/lib/hooks.js +27 -27
  5. package/build/dist/lib/hooks.min.js +1 -1
  6. package/build/dist/lib/index.debug.js +7 -7
  7. package/build/dist/lib/index.debug.min.js +1 -1
  8. package/build/dist/lib/index.js +135 -190
  9. package/build/dist/lib/index.min.js +1 -1
  10. package/build/dist/lib/index.min.js.LICENSE.txt +1 -1
  11. package/build/dist/lib/standalone.js +166 -220
  12. package/build/dist/lib/standalone.min.js +1 -1
  13. package/build/dist/lib/standalone.min.js.LICENSE.txt +1 -1
  14. package/build/dist/lib/style-guide.js +142 -203
  15. package/build/dist/lib/style-guide.min.js +1 -1
  16. package/build/dist/lib/style-guide.min.js.LICENSE.txt +1 -1
  17. package/build/dist/lib/styles-default-implementation.js +1 -1
  18. package/build/dist/lib/styles.js +1 -1
  19. package/build/dist/lib/utils.js +133 -190
  20. package/build/dist/lib/utils.min.js +1 -1
  21. package/build/dist/lib/utils.min.js.LICENSE.txt +1 -1
  22. package/package.json +7 -6
  23. package/src/javascripts/domains/translations/components/options-dialog/translation-option.tsx +20 -19
  24. package/src/javascripts/domains/translations/components/options-dialog/translation-options.tsx +2 -0
  25. package/src/javascripts/index.ts +1 -0
  26. package/src/javascripts/lib/external-api/index.js +17 -4
  27. package/src/javascripts/style-guide/components/static-core.js +8 -11
  28. package/src/javascripts/style-guide/components/view.js +2 -2
  29. package/src/stylesheets/5-components/_translation-options.scss +23 -35
  30. package/src/stylesheets/6-default-implementation/_hover.scss +4 -0
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * focus-trap 7.0.0
2
+ * focus-trap 7.1.0
3
3
  * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
4
4
  */
5
5
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seamly/web-ui",
3
- "version": "21.0.2-beta.3",
3
+ "version": "21.0.2-beta.5",
4
4
  "main": "build/dist/lib/index.js",
5
5
  "types": "build/src/javascripts/index.d.ts",
6
6
  "module": "",
@@ -58,22 +58,23 @@
58
58
  "babel-loader": "^9.0.1",
59
59
  "babel-plugin-react-remove-properties": "^0.3.0",
60
60
  "copy-webpack-plugin": "^11.0.0",
61
+ "cypress": "^10.11.0",
61
62
  "cypress-file-upload": "^5.0.8",
63
+ "cypress-plugin-tab": "^1.0.5",
62
64
  "cypress-wait-until": "^1.7.2",
63
- "cypress": "^10.11.0",
64
65
  "debug": "^4.3.4",
66
+ "eslint": "^8.27.0",
65
67
  "eslint-import-resolver-alias": "^1.1.2",
66
68
  "eslint-import-resolver-typescript": "^3.5.2",
67
69
  "eslint-plugin-cypress": "^2.12.1",
68
70
  "eslint-plugin-import": "^2.26.0",
69
71
  "eslint-plugin-jest": "^27.1.3",
70
- "eslint": "^8.27.0",
71
72
  "file-loader": "^6.2.0",
72
73
  "glob": "^8.0.3",
73
74
  "husky": "^8.0.1",
74
75
  "ignore-loader": "^0.1.2",
75
- "jest-environment-jsdom": "^27.5.1",
76
76
  "jest": "^27.5.1",
77
+ "jest-environment-jsdom": "^27.5.1",
77
78
  "mini-css-extract-plugin": "^2.6.1",
78
79
  "postcss": "8",
79
80
  "preact": "^10.11.2",
@@ -86,11 +87,11 @@
86
87
  "ts-loader": "^9.4.1",
87
88
  "typescript": "^4.8.4",
88
89
  "url-loader": "^4.1.1",
90
+ "webpack": "^5.74.0",
89
91
  "webpack-bundle-analyzer": "^4.7.0",
90
92
  "webpack-cli": "^4.10.0",
91
93
  "webpack-dev-server": "^4.11.1",
92
- "webpack-merge": "^5.8.0",
93
- "webpack": "^5.74.0"
94
+ "webpack-merge": "^5.8.0"
94
95
  },
95
96
  "peerDependencies": {
96
97
  "preact": "^10.11.2"
@@ -16,27 +16,28 @@ const TranslationOption: FC<TranslationOptionProps> = ({
16
16
  description,
17
17
  onChange,
18
18
  id,
19
- }) => (
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
- />
19
+ }) => {
20
+ const onKeyDown = (e: KeyboardEvent) => {
21
+ if (e.code === 'Space' || e.code === 'Enter') {
22
+ e.preventDefault()
23
+ onChange()
24
+ }
25
+ }
34
26
 
35
- <label htmlFor={id}>
27
+ return (
28
+ <li
29
+ className={className('translation-options__item')}
30
+ aria-selected={checked}
31
+ role="option"
32
+ tabIndex={0}
33
+ onClick={onChange}
34
+ onKeyDown={onKeyDown}
35
+ id={id}
36
+ >
36
37
  <Icon alt="" name="check" size="16" />
37
38
  {label} {description && <span>({description})</span>}
38
- </label>
39
- </li>
40
- )
39
+ </li>
40
+ )
41
+ }
41
42
 
42
43
  export default TranslationOption
@@ -55,6 +55,8 @@ const TranslationOptions: FC<TranslationOptionsProps> = ({
55
55
  return (
56
56
  <ul
57
57
  aria-describedby={describedById}
58
+ role="listbox"
59
+ tabIndex={-1}
58
60
  className={className('translation-options')}
59
61
  >
60
62
  {sortedLanguages.map((language, idx) => {
@@ -20,6 +20,7 @@ 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'
23
24
  export { default as ComponentFilter } from 'ui/components/conversation/component-filter'
24
25
  // Used by: Client
25
26
  export { default as Conversation } from 'ui/components/conversation/conversation'
@@ -51,7 +51,20 @@ class ExternalApi {
51
51
  })
52
52
  }
53
53
 
54
+ instanceInitializing(namespace) {
55
+ const instances = Object.keys(this._instances)
56
+
57
+ return (!namespace && instances.length > 0) || instances.includes(namespace)
58
+ }
59
+
54
60
  setContext(action, args) {
61
+ const { instance: namespace } = args
62
+ // Do not set this action in context if we are already initializing.
63
+ // If we do, it will not be sent to the server anymore (because it gets marked as 'handled').
64
+ if (this.instanceInitializing(namespace)) {
65
+ return false
66
+ }
67
+
55
68
  switch (action) {
56
69
  case 'setTopic':
57
70
  const { name } = args
@@ -118,11 +131,11 @@ class ExternalApi {
118
131
 
119
132
  // results will be an array containing the results of wether an instance has
120
133
  // handled the action or not
121
- const results = instances.map((instance) => {
122
- return !namespace || instance.namespace === namespace
134
+ const results = instances.map((instance) =>
135
+ !namespace || instance.namespace === namespace
123
136
  ? instance.execFunction(action, ...args)
124
- : false
125
- })
137
+ : false,
138
+ )
126
139
 
127
140
  // test if any of the instances has handled the action
128
141
  return results.some(Boolean)
@@ -1,13 +1,12 @@
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'
5
2
  import {
3
+ ComponentFilter,
6
4
  SeamlyApiContext,
7
5
  SeamlyEventBusContext,
8
- } from 'ui/components/core/seamly-api-context'
9
- import SeamlyChat from 'ui/components/core/seamly-chat'
10
- import { SeamlyLiveRegionContext } from 'ui/components/core/seamly-live-region-context'
6
+ SeamlyLiveRegionContext,
7
+ SeamlyStoreProvider,
8
+ } from '@seamly/web-ui'
9
+ import { useMemo, useRef } from 'preact/hooks'
11
10
  import appReducer from 'domains/app/slice'
12
11
  import configReducer, {
13
12
  setConfig,
@@ -120,17 +119,15 @@ const SeamlyStaticCore = ({
120
119
 
121
120
  return (
122
121
  state && (
123
- <Provider store={store}>
122
+ <SeamlyStoreProvider store={store}>
124
123
  <SeamlyEventBusContext.Provider value={eventBusRef.current}>
125
124
  <SeamlyLiveRegionContext.Provider value={liveMsgRef.current}>
126
125
  <SeamlyApiContext.Provider value={bareApi}>
127
- <SeamlyChat>
128
- <ComponentFilter>{children}</ComponentFilter>
129
- </SeamlyChat>
126
+ <ComponentFilter>{children}</ComponentFilter>
130
127
  </SeamlyApiContext.Provider>
131
128
  </SeamlyLiveRegionContext.Provider>
132
129
  </SeamlyEventBusContext.Provider>
133
- </Provider>
130
+ </SeamlyStoreProvider>
134
131
  )
135
132
  )
136
133
  }
@@ -1,7 +1,7 @@
1
+ import { View } from '@seamly/web-ui'
1
2
  import { useEffect, useState } from 'preact/hooks'
2
- import View from 'ui/components/view'
3
3
  import { timeout } from 'ui/hooks/focus-helper-hooks'
4
- import StyleGuideStaticCore from './static-core'
4
+ import StyleGuideStaticCore from 'style-guide/components/static-core'
5
5
 
6
6
  const StyleGuideView = ({
7
7
  state,
@@ -2,44 +2,27 @@
2
2
  width: 100%;
3
3
  margin: 0;
4
4
 
5
- // 1px needed for the outline focus ring
6
- padding: 1px 0 0;
5
+ // Top padding needed for the outline focus ring
6
+ padding: $spacer * 0.05 0 0;
7
7
  list-style: none;
8
+ }
8
9
 
9
- &__item {
10
- color: $brand3;
11
- font-size: $fontsize-small;
12
-
13
- > label {
14
- display: flex;
15
- align-items: center;
16
- width: 100%;
17
- padding: calc($spacer * 0.25) 0;
18
- font-weight: $fontweight-bold;
19
-
20
- &:hover {
21
- cursor: pointer;
22
- }
23
-
24
- // Only show a ring when we have focused via keyboard
25
- &:focus-within:has(input:focus-visible) {
26
- outline: -webkit-focus-ring-color auto 1px;
27
- }
28
-
29
- > span {
30
- margin-left: 0.5em;
31
- }
32
- }
33
-
34
- .#{$n}-icon {
35
- opacity: 0;
36
- }
10
+ .#{$n}-translation-options__item {
11
+ display: flex;
12
+ align-items: center;
13
+ width: 100%;
14
+ padding: calc($spacer * 0.25) 0;
15
+ color: $brand3;
16
+ font-size: $fontsize-small;
17
+ font-weight: $fontweight-bold;
18
+ cursor: pointer;
19
+
20
+ &:focus-visible {
21
+ outline: -webkit-focus-ring-color auto 1px;
22
+ }
37
23
 
38
- &--checked {
39
- .#{$n}-icon {
40
- opacity: 1;
41
- }
42
- }
24
+ > span {
25
+ margin-left: 0.5em;
43
26
  }
44
27
 
45
28
  .#{$n}-icon {
@@ -47,5 +30,10 @@
47
30
  width: $iconsize-small;
48
31
  height: $iconsize-small;
49
32
  margin-right: calc($spacer / 2);
33
+ opacity: 0;
34
+ }
35
+
36
+ &[aria-selected='true'] .#{$n}-icon {
37
+ opacity: 1;
50
38
  }
51
39
  }
@@ -161,5 +161,9 @@
161
161
  border-color: $interaction-dark;
162
162
  }
163
163
  }
164
+
165
+ .#{$n}-translation-options__item:hover {
166
+ color: $interaction-dark;
167
+ }
164
168
  }
165
169
  }