@uncinc/uncinc-react-kitchen-sink 2.16.7 → 2.16.9

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.
@@ -55,7 +55,8 @@ var AccordionItem = function AccordionItem(props) {
55
55
  type: "button",
56
56
  onClick: function onClick() {
57
57
  return setCollapsed(!collapsed);
58
- }
58
+ },
59
+ "aria-expanded": !collapsed
59
60
  }, materialIconName ? /*#__PURE__*/React.createElement(Icon, {
60
61
  name: materialIconName,
61
62
  flair: "outlined",
@@ -67,7 +68,8 @@ var AccordionItem = function AccordionItem(props) {
67
68
  easing: easing,
68
69
  height: collapsed ? 0 : 'auto'
69
70
  }, /*#__PURE__*/React.createElement("div", {
70
- className: "Accordion__item__content"
71
+ className: "Accordion__item__content",
72
+ "aria-hidden": collapsed
71
73
  }, /*#__PURE__*/React.createElement(ContentParsed, null, content))));
72
74
  };
73
75
  AccordionItem.defaultProps = {
@@ -1,17 +1,17 @@
1
- import React from 'react';
1
+ import React, { RefObject } from 'react';
2
2
  import './style.scss';
3
3
  export type SkipNavProps = {
4
4
  className?: string;
5
5
  linkClassName?: string;
6
6
  skipToSearch?: boolean;
7
7
  mainContentId?: string;
8
- searchId?: string;
9
8
  skipToContentText?: string;
10
9
  skipToSearchText?: string;
11
10
  customLinks?: {
12
11
  href: string;
13
12
  text: string;
14
13
  }[];
14
+ searchRef?: RefObject<HTMLInputElement>;
15
15
  };
16
16
  declare const SkipNav: React.FC<SkipNavProps>;
17
17
  export default SkipNav;
@@ -6,32 +6,41 @@ var SkipNav = function SkipNav(_ref) {
6
6
  var className = _ref.className,
7
7
  linkClassName = _ref.linkClassName,
8
8
  _ref$skipToSearch = _ref.skipToSearch,
9
- skipToSearch = _ref$skipToSearch === void 0 ? false : _ref$skipToSearch,
9
+ skipToSearch = _ref$skipToSearch === void 0 ? true : _ref$skipToSearch,
10
10
  _ref$mainContentId = _ref.mainContentId,
11
11
  mainContentId = _ref$mainContentId === void 0 ? 'main-content' : _ref$mainContentId,
12
- _ref$searchId = _ref.searchId,
13
- searchId = _ref$searchId === void 0 ? 'search' : _ref$searchId,
14
12
  skipToContentText = _ref.skipToContentText,
15
13
  skipToSearchText = _ref.skipToSearchText,
16
14
  _ref$customLinks = _ref.customLinks,
17
- customLinks = _ref$customLinks === void 0 ? [] : _ref$customLinks;
15
+ customLinks = _ref$customLinks === void 0 ? [] : _ref$customLinks,
16
+ searchRef = _ref.searchRef;
18
17
  var classes = c('SkipNav', className);
19
18
  var linkClasses = c('focusable skip-link', linkClassName);
20
19
  var _useTranslation = useTranslation(),
21
20
  t = _useTranslation.t;
22
- var defaultContentText = skipToContentText || t('atoms.skip_nav.skipto_content');
23
- var defaultSearchText = skipToSearchText || t('atoms.skip_nav.skipto_search');
21
+ var defaultContentText = skipToContentText || t('atoms.skip_nav.skip_to_content');
22
+ var defaultSearchText = skipToSearchText || t('atoms.skip_nav.skip_to_search');
23
+ var main = document.getElementById(mainContentId);
24
24
  var links = useMemo(function () {
25
25
  var generatedLinks = [];
26
- generatedLinks.push( /*#__PURE__*/React.createElement("a", {
27
- key: "skip-to".concat(mainContentId),
28
- href: "#".concat(mainContentId),
29
- className: linkClasses
30
- }, defaultContentText));
31
- if (skipToSearch) {
32
- generatedLinks.push( /*#__PURE__*/React.createElement("a", {
26
+ if (main) {
27
+ generatedLinks.push( /*#__PURE__*/React.createElement("button", {
28
+ onClick: function onClick() {
29
+ return main.focus();
30
+ },
31
+ type: "button",
32
+ key: "skip-to".concat(mainContentId),
33
+ className: linkClasses
34
+ }, defaultContentText));
35
+ }
36
+ if (skipToSearch && searchRef && 'current' in searchRef && searchRef.current) {
37
+ generatedLinks.push( /*#__PURE__*/React.createElement("button", {
38
+ onClick: function onClick() {
39
+ var _searchRef$current;
40
+ return (_searchRef$current = searchRef.current) === null || _searchRef$current === void 0 ? void 0 : _searchRef$current.focus();
41
+ },
42
+ type: "button",
33
43
  key: "skip-to-search",
34
- href: "#".concat(searchId),
35
44
  className: linkClasses
36
45
  }, defaultSearchText));
37
46
  }
@@ -46,7 +55,7 @@ var SkipNav = function SkipNav(_ref) {
46
55
  });
47
56
  }
48
57
  return generatedLinks;
49
- }, [mainContentId, skipToSearch, searchId, defaultContentText, defaultSearchText, customLinks, linkClasses]);
58
+ }, [mainContentId, main, skipToSearch, searchRef, defaultContentText, defaultSearchText, customLinks, linkClasses]);
50
59
  return /*#__PURE__*/React.createElement("div", {
51
60
  className: classes
52
61
  }, links);
@@ -66,8 +66,8 @@
66
66
  "delete": "Verwijder tag"
67
67
  },
68
68
  "skip_nav": {
69
- "skipto_content": "Overslaan en naar de inhoud gaan",
70
- "skipto_search": "Naar zoekfunctie"
69
+ "skip_to_content": "Overslaan en naar de inhoud gaan",
70
+ "skip_to_search": "Naar zoekfunctie"
71
71
  }
72
72
  },
73
73
  "organisms": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uncinc/uncinc-react-kitchen-sink",
3
- "version": "2.16.7",
3
+ "version": "2.16.9",
4
4
  "description": "Default React components that are easily extended.",
5
5
  "author": "uncinc",
6
6
  "license": "MIT",