@seamly/web-ui 21.0.2-beta.4 → 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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seamly/web-ui",
3
- "version": "21.0.2-beta.4",
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) => {
@@ -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
  }