@scm-manager/ui-components 2.30.2-20220116-101546 → 2.31.0

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": "@scm-manager/ui-components",
3
- "version": "2.30.2-20220116-101546",
3
+ "version": "2.31.0",
4
4
  "description": "UI Components for SCM-Manager and its plugins",
5
5
  "main": "src/index.ts",
6
6
  "files": [
@@ -25,7 +25,7 @@
25
25
  "@scm-manager/jest-preset": "^2.13.0",
26
26
  "@scm-manager/prettier-config": "^2.10.1",
27
27
  "@scm-manager/tsconfig": "^2.12.0",
28
- "@scm-manager/ui-tests": "^2.30.2-20220116-101546",
28
+ "@scm-manager/ui-tests": "^2.31.0",
29
29
  "@storybook/addon-actions": "^6.3.12",
30
30
  "@storybook/addon-storyshots": "^6.3.12",
31
31
  "@storybook/builder-webpack5": "^6.3.12",
@@ -66,9 +66,9 @@
66
66
  },
67
67
  "dependencies": {
68
68
  "@headlessui/react": "^1.4.3",
69
- "@scm-manager/ui-api": "^2.30.2-20220116-101546",
70
- "@scm-manager/ui-extensions": "^2.30.2-20220116-101546",
71
- "@scm-manager/ui-types": "^2.30.2-20220116-101546",
69
+ "@scm-manager/ui-api": "^2.31.0",
70
+ "@scm-manager/ui-extensions": "^2.31.0",
71
+ "@scm-manager/ui-types": "^2.31.0",
72
72
  "classnames": "^2.2.6",
73
73
  "date-fns": "^2.4.1",
74
74
  "deepmerge": "^4.2.2",
@@ -37,6 +37,7 @@ type Props = {
37
37
  label?: string;
38
38
  testId?: string;
39
39
  searchPlaceholder?: string;
40
+ groupAriaLabelledby?: string;
40
41
  };
41
42
 
42
43
  const createAbsoluteLink = (url: string) => {
@@ -52,7 +53,8 @@ const OverviewPageActions: FC<Props> = ({
52
53
  groupSelected,
53
54
  label,
54
55
  testId,
55
- searchPlaceholder
56
+ searchPlaceholder,
57
+ groupAriaLabelledby
56
58
  }) => {
57
59
  const history = useHistory();
58
60
  const location = useLocation();
@@ -62,6 +64,7 @@ const OverviewPageActions: FC<Props> = ({
62
64
  const groupSelector = groups && (
63
65
  <div className="column is-flex">
64
66
  <Select
67
+ ariaLabelledby={groupAriaLabelledby}
65
68
  className="is-fullwidth"
66
69
  options={groups.map(g => ({ value: g, label: g }))}
67
70
  value={currentGroup}
package/src/Tag.tsx CHANGED
@@ -24,6 +24,7 @@
24
24
  import React, { FC } from "react";
25
25
  import classNames from "classnames";
26
26
  import { Color, Size } from "./styleConstants";
27
+ import { useTranslation } from "react-i18next";
27
28
 
28
29
  type Props = {
29
30
  className?: string;
@@ -51,8 +52,10 @@ const Tag: FC<Props> = ({
51
52
  title,
52
53
  onClick,
53
54
  onRemove,
54
- children,
55
+ children
55
56
  }) => {
57
+ const [t] = useTranslation("commons");
58
+
56
59
  let showIcon = null;
57
60
  if (icon) {
58
61
  showIcon = (
@@ -64,7 +67,7 @@ const Tag: FC<Props> = ({
64
67
  }
65
68
  let showDelete = null;
66
69
  if (onRemove) {
67
- showDelete = <button className="tag is-delete" onClick={onRemove} />;
70
+ showDelete = <button className="tag is-delete" onClick={onRemove} aria-label={t("tag.delete")} />;
68
71
  }
69
72
 
70
73
  return (
@@ -78,7 +81,7 @@ const Tag: FC<Props> = ({
78
81
  {
79
82
  "is-outlined": outlined,
80
83
  "is-rounded": rounded,
81
- "is-clickable": onClick,
84
+ "is-clickable": onClick
82
85
  },
83
86
  size === "small" && smallClassNames
84
87
  )}
@@ -34,6 +34,7 @@ exports[`Storyshots BranchSelector Default 1`] = `
34
34
  className="control select is-fullwidth"
35
35
  >
36
36
  <select
37
+ aria-labelledby="branch-select_0"
37
38
  disabled={false}
38
39
  onBlur={[Function]}
39
40
  onChange={[Function]}
@@ -3048,7 +3049,6 @@ exports[`Storyshots Forms/Radio Default 1`] = `
3048
3049
  className="radio mr-2"
3049
3050
  >
3050
3051
  <input
3051
- aria-describedby="radio_56"
3052
3052
  aria-labelledby="radio_55"
3053
3053
  checked={false}
3054
3054
  onBlur={[Function]}
@@ -3070,7 +3070,6 @@ exports[`Storyshots Forms/Radio Default 1`] = `
3070
3070
  className="radio mr-2"
3071
3071
  >
3072
3072
  <input
3073
- aria-describedby="radio_58"
3074
3073
  aria-labelledby="radio_57"
3075
3074
  checked={true}
3076
3075
  onBlur={[Function]}
@@ -3100,7 +3099,6 @@ exports[`Storyshots Forms/Radio Disabled 1`] = `
3100
3099
  disabled={true}
3101
3100
  >
3102
3101
  <input
3103
- aria-describedby="radio_60"
3104
3102
  aria-labelledby="radio_59"
3105
3103
  checked={true}
3106
3104
  disabled={true}
@@ -3128,7 +3126,6 @@ Array [
3128
3126
  className="radio mr-2"
3129
3127
  >
3130
3128
  <input
3131
- aria-describedby="radio_68"
3132
3129
  aria-labelledby="radio_67"
3133
3130
  checked={false}
3134
3131
  onBlur={[Function]}
@@ -3160,7 +3157,6 @@ exports[`Storyshots Forms/Radio ReactHookForm 1`] = `
3160
3157
  className="radio mr-2"
3161
3158
  >
3162
3159
  <input
3163
- aria-describedby="radio_70"
3164
3160
  aria-labelledby="radio_69"
3165
3161
  defaultChecked={true}
3166
3162
  name="rememberMe"
@@ -3184,7 +3180,6 @@ exports[`Storyshots Forms/Radio ReactHookForm 1`] = `
3184
3180
  className="radio mr-2"
3185
3181
  >
3186
3182
  <input
3187
- aria-describedby="radio_72"
3188
3183
  aria-labelledby="radio_71"
3189
3184
  name="rememberMe"
3190
3185
  onBlur={[Function]}
@@ -3208,7 +3203,6 @@ exports[`Storyshots Forms/Radio ReactHookForm 1`] = `
3208
3203
  className="radio mr-2 ml-2"
3209
3204
  >
3210
3205
  <input
3211
- aria-describedby="radio_74"
3212
3206
  aria-labelledby="radio_73"
3213
3207
  name="scramblePassword"
3214
3208
  onBlur={[Function]}
@@ -3232,7 +3226,6 @@ exports[`Storyshots Forms/Radio ReactHookForm 1`] = `
3232
3226
  disabled={true}
3233
3227
  >
3234
3228
  <input
3235
- aria-describedby="radio_76"
3236
3229
  aria-labelledby="radio_75"
3237
3230
  disabled={true}
3238
3231
  name="disabled"
@@ -3256,7 +3249,6 @@ exports[`Storyshots Forms/Radio ReactHookForm 1`] = `
3256
3249
  className="radio mr-2"
3257
3250
  >
3258
3251
  <input
3259
- aria-describedby="radio_78"
3260
3252
  aria-labelledby="radio_77"
3261
3253
  name="readonly"
3262
3254
  onBlur={[Function]}
@@ -3298,7 +3290,6 @@ Array [
3298
3290
  className="radio mr-2"
3299
3291
  >
3300
3292
  <input
3301
- aria-describedby="radio_66"
3302
3293
  aria-labelledby="radio_65"
3303
3294
  checked={false}
3304
3295
  onBlur={[Function]}
@@ -21,7 +21,7 @@
21
21
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  * SOFTWARE.
23
23
  */
24
- import React, { ChangeEvent, FC, FocusEvent } from "react";
24
+ import React, { ChangeEvent, FC, FocusEvent, useMemo } from "react";
25
25
  import classNames from "classnames";
26
26
  import { Help } from "../index";
27
27
  import { createFormFieldWrapper, FieldProps, FieldType, isLegacy, isUsingRef } from "./FormFieldTypes";
@@ -47,8 +47,8 @@ const InnerRadio: FC<FieldProps<BaseProps, HTMLInputElement, boolean>> = ({
47
47
  ariaLabelledby,
48
48
  ...props
49
49
  }) => {
50
- const id = ariaLabelledby || createA11yId("radio");
51
- const helpId = createA11yId("radio");
50
+ const id = useMemo(() => ariaLabelledby || createA11yId("radio"), [ariaLabelledby]);
51
+ const helpId = useMemo(() => createA11yId("radio"), []);
52
52
 
53
53
  const renderHelp = () => {
54
54
  const helpText = props.helpText;
@@ -77,7 +77,7 @@ const InnerRadio: FC<FieldProps<BaseProps, HTMLInputElement, boolean>> = ({
77
77
  }
78
78
  };
79
79
 
80
- const labelElement = props.label ? (<span id={id}>{props.label}</span>) : null;
80
+ const labelElement = props.label ? <span id={id}>{props.label}</span> : null;
81
81
 
82
82
  return (
83
83
  <fieldset className="is-inline-block" disabled={readOnly}>
@@ -98,7 +98,7 @@ const InnerRadio: FC<FieldProps<BaseProps, HTMLInputElement, boolean>> = ({
98
98
  ref={props.innerRef}
99
99
  defaultChecked={defaultChecked}
100
100
  aria-labelledby={id}
101
- aria-describedby={helpId}
101
+ aria-describedby={props.helpText ? helpId : undefined}
102
102
  />{" "}
103
103
  {labelElement}
104
104
  {renderHelp()}
@@ -124,7 +124,7 @@ const InnerSelect: FC<FieldProps<BaseProps, HTMLSelectElement, string>> = ({
124
124
  onChange={handleInput}
125
125
  onBlur={handleBlur}
126
126
  disabled={disabled}
127
- aria-labelledby={label ? a11yId : undefined}
127
+ aria-labelledby={ariaLabelledby || (label ? a11yId : undefined)}
128
128
  aria-describedby={helpText ? helpId : undefined}
129
129
  {...createAttributesForTesting(testId)}
130
130
  >