@uncinc/uncinc-react-kitchen-sink 2.14.3 → 2.15.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.
@@ -291,7 +291,9 @@ var CookieCompliancePopup = function CookieCompliancePopup(props) {
291
291
  }));
292
292
  };
293
293
  return /*#__PURE__*/React.createElement("div", {
294
- className: classes
294
+ className: classes,
295
+ role: "region",
296
+ "aria-label": t('cookie.banner_label')
295
297
  }, /*#__PURE__*/React.createElement(Container, null, /*#__PURE__*/React.createElement("div", {
296
298
  className: "GoogleConsentCookieBanner__content ".concat(manualChoiceVisible ? 'GoogleConsentCookieBanner__content--full-height' : '')
297
299
  }, /*#__PURE__*/React.createElement("div", {
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import './style.scss';
3
+ export type SkipNavProps = {
4
+ className?: string;
5
+ linkClassName?: string;
6
+ skipToSearch?: boolean;
7
+ mainContentId?: string;
8
+ searchId?: string;
9
+ skipToContentText?: string;
10
+ skipToSearchText?: string;
11
+ customLinks?: {
12
+ href: string;
13
+ text: string;
14
+ }[];
15
+ };
16
+ declare const SkipNav: React.FC<SkipNavProps>;
17
+ export default SkipNav;
@@ -0,0 +1,54 @@
1
+ import React, { useMemo } from 'react';
2
+ import c from 'classnames';
3
+ import { useTranslation } from 'react-i18next';
4
+ import './style.scss';
5
+ var SkipNav = function SkipNav(_ref) {
6
+ var className = _ref.className,
7
+ linkClassName = _ref.linkClassName,
8
+ _ref$skipToSearch = _ref.skipToSearch,
9
+ skipToSearch = _ref$skipToSearch === void 0 ? false : _ref$skipToSearch,
10
+ _ref$mainContentId = _ref.mainContentId,
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
+ skipToContentText = _ref.skipToContentText,
15
+ skipToSearchText = _ref.skipToSearchText,
16
+ _ref$customLinks = _ref.customLinks,
17
+ customLinks = _ref$customLinks === void 0 ? [] : _ref$customLinks;
18
+ var classes = c('SkipNav', className);
19
+ var linkClasses = c('focusable skip-link', linkClassName);
20
+ var _useTranslation = useTranslation(),
21
+ t = _useTranslation.t;
22
+ var defaultContentText = skipToContentText || t('atoms.skip_nav.skipto_content');
23
+ var defaultSearchText = skipToSearchText || t('atoms.skip_nav.skipto_search');
24
+ var links = useMemo(function () {
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", {
33
+ key: "skip-to-search",
34
+ href: "#".concat(searchId),
35
+ className: linkClasses
36
+ }, defaultSearchText));
37
+ }
38
+ if (customLinks.length > 0) {
39
+ customLinks.forEach(function (link) {
40
+ var key = "".concat(link.href, "-").concat(link.text);
41
+ generatedLinks.push( /*#__PURE__*/React.createElement("a", {
42
+ key: key,
43
+ href: link.href,
44
+ className: linkClasses
45
+ }, link.text));
46
+ });
47
+ }
48
+ return generatedLinks;
49
+ }, [mainContentId, skipToSearch, searchId, defaultContentText, defaultSearchText, customLinks, linkClasses]);
50
+ return /*#__PURE__*/React.createElement("div", {
51
+ className: classes
52
+ }, links);
53
+ };
54
+ export default SkipNav;
@@ -0,0 +1,17 @@
1
+ @import '../../styles/assets/mixins';
2
+ @import '../../styles/assets/variables';
3
+
4
+ .SkipNav {
5
+ .skip-link {
6
+ position: absolute;
7
+ overflow: hidden;
8
+ opacity: 0;
9
+ }
10
+
11
+ &:focus-within {
12
+ .skip-link {
13
+ position: static;
14
+ opacity: 1;
15
+ }
16
+ }
17
+ }
@@ -27,6 +27,7 @@
27
27
  "acceptOnlyNecessary": "Alleen noodzakelijke",
28
28
  "showDetails": "Show details",
29
29
  "hideDetails": "Verberg details",
30
+ "banner_label": "Cookiebanner",
30
31
  "contents": {
31
32
  "partner": "Partner",
32
33
  "description": "Beschrijving",
@@ -62,6 +63,10 @@
62
63
  "atoms": {
63
64
  "tag": {
64
65
  "delete": "Verwijder tag"
66
+ },
67
+ "skip_nav": {
68
+ "skipto_content": "Overslaan en naar de inhoud gaan",
69
+ "skipto_search": "Naar zoekfunctie"
65
70
  }
66
71
  },
67
72
  "organisms": {
@@ -1,6 +1,6 @@
1
- import { MutableRefObject } from 'react';
1
+ import { type RefObject } from 'react';
2
2
  interface UseClickOutsideOptions {
3
- refs: MutableRefObject<HTMLElement>[] | MutableRefObject<HTMLElement>;
3
+ refs: RefObject<HTMLElement>[] | RefObject<HTMLElement>;
4
4
  unless?: boolean | ((e: globalThis.MouseEvent) => boolean);
5
5
  onClick: (e: globalThis.MouseEvent) => void;
6
6
  }
@@ -15,7 +15,8 @@ export default function useClickOutside(_ref) {
15
15
  return;
16
16
  }
17
17
  var isOutsideClick = refsAsArray.every(function (ref) {
18
- return !ref.current.contains(e.target);
18
+ var _ref$current;
19
+ return !((_ref$current = ref.current) !== null && _ref$current !== void 0 && _ref$current.contains(e.target));
19
20
  });
20
21
  if (isOutsideClick) {
21
22
  onClick(e);
@@ -1,7 +1,7 @@
1
- import { MutableRefObject } from 'react';
1
+ import { type RefObject } from 'react';
2
2
  export interface UseDialogHelpersOptions<T extends HTMLElement> {
3
3
  id?: string;
4
- wrapperElement: MutableRefObject<T>;
4
+ wrapperElement: RefObject<T>;
5
5
  closeFunction: () => void;
6
6
  isOpen: boolean;
7
7
  disableClosers: boolean;
package/dist/index.d.ts CHANGED
@@ -9,6 +9,7 @@ export { default as Icon } from "./components/Icon";
9
9
  export { default as ImageBackground } from "./components/Image/Background";
10
10
  export { default as Lottie } from "./components/Lottie";
11
11
  export { default as LottieAnimationWithMousePosition } from "./components/Lottie/LottieAnimationWithMousePosition";
12
+ export { default as SkipNav } from "./components/SkipNav";
12
13
  export { default as Tag } from "./components/Tag";
13
14
  export { default as WysiwygField } from "./components/WysiwygField";
14
15
  export { default as CallToAction } from "./components/CallToAction";
package/dist/index.js CHANGED
@@ -10,6 +10,7 @@ export { default as Icon } from './components/Icon';
10
10
  export { default as ImageBackground } from './components/Image/Background';
11
11
  export { default as Lottie } from './components/Lottie';
12
12
  export { default as LottieAnimationWithMousePosition } from './components/Lottie/LottieAnimationWithMousePosition';
13
+ export { default as SkipNav } from './components/SkipNav';
13
14
  export { default as Tag } from './components/Tag';
14
15
  export { default as WysiwygField } from './components/WysiwygField';
15
16
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uncinc/uncinc-react-kitchen-sink",
3
- "version": "2.14.3",
3
+ "version": "2.15.0",
4
4
  "description": "Default React components that are easily extended.",
5
5
  "author": "uncinc",
6
6
  "license": "MIT",
@@ -110,6 +110,7 @@
110
110
  "@commitlint/cli": "^17.7.1",
111
111
  "@commitlint/config-conventional": "^17.7.0",
112
112
  "@material-design-icons/svg": "^0.14.11",
113
+ "@storybook/addon-a11y": "^7.0.18",
113
114
  "@storybook/addon-actions": "^7.0.18",
114
115
  "@storybook/addon-essentials": "^7.0.18",
115
116
  "@storybook/addon-interactions": "^7.0.18",