@bbl-digital/snorre 4.0.21 → 4.0.23

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 (151) hide show
  1. package/dist/bundle.js +117 -31
  2. package/esm/core/BoxedTable/TableBody/index.js +10 -0
  3. package/esm/core/BoxedTable/TableBody/styles.js +16 -0
  4. package/esm/core/Button/Button.stories.js +51 -49
  5. package/esm/core/Card/index.js +4 -3
  6. package/esm/core/Checkbox/index.js +32 -9
  7. package/esm/core/CollapseList/Item.js +4 -3
  8. package/esm/core/CollapseList/index.js +4 -3
  9. package/esm/core/Datepicker/Datepicker.stories.js +7 -6
  10. package/esm/core/DatepickerRange/DatepickerRange.stories.js +4 -3
  11. package/esm/core/Dropdown/index.js +0 -1
  12. package/esm/core/DropdownMenu/DropdownMenu.stories.js +34 -26
  13. package/esm/core/DropdownMenu/DropdownMenuOption.js +2 -0
  14. package/esm/core/DropdownMenu/index.js +16 -0
  15. package/esm/core/Editor/Editor.stories.js +31 -30
  16. package/esm/core/FileInput/index.js +7 -1
  17. package/esm/core/GoogleButton/GoogleButton.stories.js +4 -4
  18. package/esm/core/Header/Header.stories.js +42 -45
  19. package/esm/core/HighlightText/HighlightText.stories.js +11 -11
  20. package/esm/core/Image/index.js +19 -4
  21. package/esm/core/ImagePicker/ImagePicker.stories.js +2 -1
  22. package/esm/core/ImagePicker/index.js +4 -0
  23. package/esm/core/ImageViewer/index.js +15 -5
  24. package/esm/core/InfoButton/InfoButton.stories.js +23 -22
  25. package/esm/core/InfoButton/index.js +4 -0
  26. package/esm/core/Input/index.js +4 -0
  27. package/esm/core/private/ButtonOrLink.js +4 -3
  28. package/lib/core/Autocomplete/styles.d.ts +39 -1
  29. package/lib/core/Autocomplete/styles.d.ts.map +1 -1
  30. package/lib/core/Box/styles.d.ts +39 -1
  31. package/lib/core/Box/styles.d.ts.map +1 -1
  32. package/lib/core/BoxedTable/TableBody/index.d.ts +7 -0
  33. package/lib/core/BoxedTable/TableBody/index.d.ts.map +1 -0
  34. package/lib/core/BoxedTable/TableBody/index.js +10 -0
  35. package/lib/core/BoxedTable/TableBody/styles.d.ts +6 -0
  36. package/lib/core/BoxedTable/TableBody/styles.d.ts.map +1 -0
  37. package/lib/core/BoxedTable/TableBody/styles.js +16 -0
  38. package/lib/core/Button/Button.stories.d.ts +20 -63
  39. package/lib/core/Button/Button.stories.d.ts.map +1 -1
  40. package/lib/core/Button/Button.stories.js +51 -49
  41. package/lib/core/Button/index.d.ts +54 -3
  42. package/lib/core/Button/index.d.ts.map +1 -1
  43. package/lib/core/Card/index.d.ts +14 -15
  44. package/lib/core/Card/index.d.ts.map +1 -1
  45. package/lib/core/Card/index.js +4 -3
  46. package/lib/core/Checkbox/index.d.ts +3 -3
  47. package/lib/core/Checkbox/index.d.ts.map +1 -1
  48. package/lib/core/Checkbox/index.js +32 -9
  49. package/lib/core/CollapseList/Item.d.ts +1 -1
  50. package/lib/core/CollapseList/Item.d.ts.map +1 -1
  51. package/lib/core/CollapseList/Item.js +4 -3
  52. package/lib/core/CollapseList/index.d.ts +1 -1
  53. package/lib/core/CollapseList/index.d.ts.map +1 -1
  54. package/lib/core/CollapseList/index.js +4 -3
  55. package/lib/core/CollapseList/styles.d.ts +39 -1
  56. package/lib/core/CollapseList/styles.d.ts.map +1 -1
  57. package/lib/core/Datepicker/Datepicker.stories.d.ts +6 -6
  58. package/lib/core/Datepicker/Datepicker.stories.d.ts.map +1 -1
  59. package/lib/core/Datepicker/Datepicker.stories.js +7 -6
  60. package/lib/core/DatepickerRange/DatepickerRange.stories.d.ts +6 -7
  61. package/lib/core/DatepickerRange/DatepickerRange.stories.d.ts.map +1 -1
  62. package/lib/core/DatepickerRange/DatepickerRange.stories.js +4 -3
  63. package/lib/core/Dropdown/index.d.ts.map +1 -1
  64. package/lib/core/Dropdown/index.js +0 -1
  65. package/lib/core/DropdownMenu/DropdownMenu.stories.d.ts +8 -15
  66. package/lib/core/DropdownMenu/DropdownMenu.stories.d.ts.map +1 -1
  67. package/lib/core/DropdownMenu/DropdownMenu.stories.js +34 -26
  68. package/lib/core/DropdownMenu/DropdownMenuOption.d.ts.map +1 -1
  69. package/lib/core/DropdownMenu/DropdownMenuOption.js +2 -0
  70. package/lib/core/DropdownMenu/index.d.ts.map +1 -1
  71. package/lib/core/DropdownMenu/index.js +16 -0
  72. package/lib/core/Editor/Editor.stories.d.ts +10 -23
  73. package/lib/core/Editor/Editor.stories.d.ts.map +1 -1
  74. package/lib/core/Editor/Editor.stories.js +31 -30
  75. package/lib/core/FileInput/index.d.ts +3 -1
  76. package/lib/core/FileInput/index.d.ts.map +1 -1
  77. package/lib/core/FileInput/index.js +7 -1
  78. package/lib/core/FileInput/styles.d.ts +39 -1
  79. package/lib/core/FileInput/styles.d.ts.map +1 -1
  80. package/lib/core/GoogleButton/GoogleButton.stories.d.ts +6 -7
  81. package/lib/core/GoogleButton/GoogleButton.stories.d.ts.map +1 -1
  82. package/lib/core/GoogleButton/GoogleButton.stories.js +4 -4
  83. package/lib/core/Header/Header.stories.d.ts +13 -35
  84. package/lib/core/Header/Header.stories.d.ts.map +1 -1
  85. package/lib/core/Header/Header.stories.js +42 -45
  86. package/lib/core/HighlightText/HighlightText.stories.d.ts +7 -11
  87. package/lib/core/HighlightText/HighlightText.stories.d.ts.map +1 -1
  88. package/lib/core/HighlightText/HighlightText.stories.js +11 -11
  89. package/lib/core/Image/index.d.ts +1 -0
  90. package/lib/core/Image/index.d.ts.map +1 -1
  91. package/lib/core/Image/index.js +19 -4
  92. package/lib/core/ImagePicker/ImagePicker.stories.d.ts +6 -17
  93. package/lib/core/ImagePicker/ImagePicker.stories.d.ts.map +1 -1
  94. package/lib/core/ImagePicker/ImagePicker.stories.js +2 -1
  95. package/lib/core/ImagePicker/index.d.ts.map +1 -1
  96. package/lib/core/ImagePicker/index.js +4 -0
  97. package/lib/core/ImageViewer/index.d.ts.map +1 -1
  98. package/lib/core/ImageViewer/index.js +15 -5
  99. package/lib/core/InfoButton/InfoButton.stories.d.ts +10 -23
  100. package/lib/core/InfoButton/InfoButton.stories.d.ts.map +1 -1
  101. package/lib/core/InfoButton/InfoButton.stories.js +23 -22
  102. package/lib/core/InfoButton/index.d.ts.map +1 -1
  103. package/lib/core/InfoButton/index.js +4 -0
  104. package/lib/core/InfoButton/styles.d.ts +39 -1
  105. package/lib/core/InfoButton/styles.d.ts.map +1 -1
  106. package/lib/core/Input/index.d.ts +1 -1
  107. package/lib/core/Input/index.d.ts.map +1 -1
  108. package/lib/core/Input/index.js +4 -0
  109. package/lib/core/private/ButtonOrLink.d.ts +46 -3
  110. package/lib/core/private/ButtonOrLink.d.ts.map +1 -1
  111. package/lib/core/private/ButtonOrLink.js +4 -3
  112. package/lib/layout/Footer/FooterButton/styles.d.ts +3 -3
  113. package/lib/layout/Footer/FooterLink/styles.d.ts +3 -3
  114. package/lib/layout/Menu/MenuTop/styles.d.ts +3 -3
  115. package/package.json +1 -1
  116. package/esm/core/Autocomplete/utils/useHandleOptionsHeight.js +0 -16
  117. package/esm/core/CheckboxController/index.js +0 -22
  118. package/esm/core/Datepicker/yearMonthForm.js +0 -56
  119. package/esm/core/EditorOld/config.js +0 -69
  120. package/esm/core/EditorOld/index.js +0 -147
  121. package/esm/core/EditorOld/styles.js +0 -65
  122. package/esm/core/ImageCarousel/index.js +0 -70
  123. package/esm/core/ImageCarousel/styles.js +0 -58
  124. package/esm/enums/ModifierKey.js +0 -13
  125. package/lib/core/Autocomplete/utils/useHandleOptionsHeight.d.ts +0 -7
  126. package/lib/core/Autocomplete/utils/useHandleOptionsHeight.d.ts.map +0 -1
  127. package/lib/core/Autocomplete/utils/useHandleOptionsHeight.js +0 -16
  128. package/lib/core/CheckboxController/index.d.ts +0 -1
  129. package/lib/core/CheckboxController/index.d.ts.map +0 -1
  130. package/lib/core/CheckboxController/index.js +0 -22
  131. package/lib/core/Datepicker/yearMonthForm.d.ts +0 -10
  132. package/lib/core/Datepicker/yearMonthForm.d.ts.map +0 -1
  133. package/lib/core/Datepicker/yearMonthForm.js +0 -56
  134. package/lib/core/EditorOld/config.d.ts +0 -56
  135. package/lib/core/EditorOld/config.d.ts.map +0 -1
  136. package/lib/core/EditorOld/config.js +0 -69
  137. package/lib/core/EditorOld/index.d.ts +0 -39
  138. package/lib/core/EditorOld/index.d.ts.map +0 -1
  139. package/lib/core/EditorOld/index.js +0 -147
  140. package/lib/core/EditorOld/styles.d.ts +0 -23
  141. package/lib/core/EditorOld/styles.d.ts.map +0 -1
  142. package/lib/core/EditorOld/styles.js +0 -65
  143. package/lib/core/ImageCarousel/index.d.ts +0 -11
  144. package/lib/core/ImageCarousel/index.d.ts.map +0 -1
  145. package/lib/core/ImageCarousel/index.js +0 -70
  146. package/lib/core/ImageCarousel/styles.d.ts +0 -26
  147. package/lib/core/ImageCarousel/styles.d.ts.map +0 -1
  148. package/lib/core/ImageCarousel/styles.js +0 -58
  149. package/lib/enums/ModifierKey.d.ts +0 -12
  150. package/lib/enums/ModifierKey.d.ts.map +0 -1
  151. package/lib/enums/ModifierKey.js +0 -13
@@ -3,10 +3,10 @@ import React from 'react';
3
3
  import { styles } from './styles';
4
4
  import { Key } from '../../enums/Keyboard';
5
5
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
6
- const Card = ({
6
+ const Card = /*#__PURE__*/React.forwardRef(({
7
7
  className,
8
8
  ...props
9
- }) => {
9
+ }, ref) => {
10
10
  const handleOnKeyPress = e => {
11
11
  if (e.key === Key.enter || e.key === Key.space) {
12
12
  if (props.onClick) {
@@ -15,6 +15,7 @@ const Card = ({
15
15
  }
16
16
  };
17
17
  return _jsx("div", {
18
+ ref: ref,
18
19
  css: theme => [styles.default(theme), props.shadow && styles.shadow(theme), props.withhover && styles.withHover(theme), props.primary && styles.primary(theme), props.gray && styles.gray, props.noPadding && styles.noPadding, props.height && styles.height(props.height), props.nobackground && styles.nobackground, props.largePadding && styles.largePadding, props.overflowvisible && styles.overflowvisible, props.css && props.css],
19
20
  tabIndex: props.onClick ? 0 : undefined,
20
21
  onClick: props.onClick,
@@ -23,5 +24,5 @@ const Card = ({
23
24
  ...props,
24
25
  children: props.children
25
26
  });
26
- };
27
+ });
27
28
  export default Card;
@@ -3,8 +3,25 @@ import React, { useEffect, useState } from 'react';
3
3
  import { styles } from './styles';
4
4
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
5
5
  import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
6
- const Checkbox = props => {
6
+ const Checkbox = /*#__PURE__*/React.forwardRef(({
7
+ ...props
8
+ }, ref) => {
7
9
  const [value, setValue] = useState(props.checked ? true : false);
10
+ const {
11
+ checked,
12
+ disabled,
13
+ className,
14
+ disabledHoverState,
15
+ nomargin,
16
+ child,
17
+ type,
18
+ name,
19
+ onChange,
20
+ onClick,
21
+ id,
22
+ children,
23
+ ...restProps
24
+ } = props;
8
25
  useEffect(() => {
9
26
  setValue(props.checked ? true : false);
10
27
  }, [props.checked]);
@@ -15,18 +32,24 @@ const Checkbox = props => {
15
32
  };
16
33
  return _jsxs("label", {
17
34
  "aria-label": props['aria-label'],
18
- className: props.className,
19
- css: theme => [styles.default(theme), props.disabled && styles.disabled(theme, props.disabledHoverState), props.nomargin && styles.nomargin, props.child && styles.child, props.type === 'subtle' && styles.subtle(theme)],
35
+ htmlFor: id,
36
+ className: className,
37
+ css: theme => [styles.default(theme), disabled && styles.disabled(theme, disabledHoverState), nomargin && styles.nomargin, child && styles.child, type === 'subtle' && styles.subtle(theme)],
20
38
  onClick: e => e.stopPropagation(),
21
39
  children: [_jsx("input", {
40
+ ref: ref,
22
41
  type: "checkbox",
42
+ role: "checkbox",
43
+ "aria-checked": value,
23
44
  checked: value,
24
45
  value: props.value,
25
- name: props.name,
26
- disabled: props.disabled,
27
- onClick: props.onClick,
28
- onChange: handleChange
29
- }), _jsx("span", {}), props.children]
46
+ name: name,
47
+ id: id,
48
+ disabled: disabled,
49
+ onClick: onClick,
50
+ onChange: handleChange,
51
+ ...restProps
52
+ }), _jsx("span", {}), children]
30
53
  });
31
- };
54
+ });
32
55
  export default Checkbox;
@@ -4,12 +4,12 @@ import { IconChevronDown } from '../..';
4
4
  import { jsx as _jsx } from "react/jsx-runtime";
5
5
  import { jsxs as _jsxs } from "react/jsx-runtime";
6
6
  const headerTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'Header'];
7
- const CollapseListItem = ({
7
+ const CollapseListItem = /*#__PURE__*/React.forwardRef(({
8
8
  header,
9
9
  content,
10
10
  initialOpen,
11
11
  ...restProps
12
- }) => {
12
+ }, ref) => {
13
13
  const [open, setOpen] = useState(initialOpen ? true : false);
14
14
  const contentRef = useRef(null);
15
15
  const contentId = `content-${Math.random().toString(36).substring(2, 9)}`;
@@ -34,6 +34,7 @@ const CollapseListItem = ({
34
34
  };
35
35
 
36
36
  return /*#__PURE__*/_jsxs("div", {
37
+ ref: ref,
37
38
  className: "item",
38
39
  ...restProps,
39
40
  role: restProps['role'] || 'listitem',
@@ -63,5 +64,5 @@ const CollapseListItem = ({
63
64
  children: content
64
65
  })]
65
66
  });
66
- };
67
+ });
67
68
  export default CollapseListItem;
@@ -2,14 +2,15 @@
2
2
  import React from 'react';
3
3
  import { styles } from './styles';
4
4
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
5
- const CollapseList = ({
5
+ const CollapseList = /*#__PURE__*/React.forwardRef(({
6
6
  children,
7
7
  ...restProps
8
- }) => {
8
+ }, ref) => {
9
9
  return _jsx("div", {
10
+ ref: ref,
10
11
  css: theme => [styles.default(theme)],
11
12
  ...restProps,
12
13
  children: children
13
14
  });
14
- };
15
+ });
15
16
  export default CollapseList;
@@ -1,16 +1,17 @@
1
1
  import Datepicker from '.';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- export default {
3
+ const meta = {
4
4
  title: 'Core/Datepicker',
5
5
  component: Datepicker
6
6
  };
7
- export const DatepickerDefault = {
8
- render: () => /*#__PURE__*/_jsx(Datepicker, {
7
+ export default meta;
8
+ export const Default = {
9
+ args: {
9
10
  onChange: e => console.log(e),
10
11
  onBlur: () => console.log('blur'),
11
- label: "Date"
12
- }),
13
- name: 'Datepicker'
12
+ label: 'Date'
13
+ },
14
+ name: 'Default'
14
15
  };
15
16
  export const WithError = {
16
17
  render: () => /*#__PURE__*/_jsx(Datepicker, {
@@ -1,10 +1,11 @@
1
1
  import DatepickerRange from '.';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- export default {
3
+ const meta = {
4
4
  title: 'Core/DatepickerRange',
5
5
  component: DatepickerRange
6
6
  };
7
- export const DatepickerRangeDefault = {
7
+ export default meta;
8
+ export const Default = {
8
9
  render: () => /*#__PURE__*/_jsx("div", {
9
10
  style: {
10
11
  height: '600px'
@@ -17,5 +18,5 @@ export const DatepickerRangeDefault = {
17
18
  }
18
19
  })
19
20
  }),
20
- name: 'DatepickerRange'
21
+ name: 'Default'
21
22
  };
@@ -85,7 +85,6 @@ const Dropdown = ({
85
85
  onClick: onClick,
86
86
  css: css,
87
87
  className: className,
88
- ...restProps,
89
88
  children: label ? label : '- Velg'
90
89
  }), open && _jsx("div", {
91
90
  css: theme => styles.default(theme),
@@ -2,46 +2,54 @@ import DropdownMenu from '.';
2
2
  import DropdownMenuOption from './DropdownMenuOption';
3
3
  import IconMail from '../../icons/General/IconMail';
4
4
  import { jsx as _jsx } from "react/jsx-runtime";
5
+ import { Fragment as _Fragment } from "react/jsx-runtime";
5
6
  import { jsxs as _jsxs } from "react/jsx-runtime";
6
- export default {
7
+ const meta = {
7
8
  title: 'Core/DropdownMenu',
8
9
  component: DropdownMenu
9
10
  };
11
+ export default meta;
10
12
  export const Default = {
11
- render: () => /*#__PURE__*/_jsxs(DropdownMenu, {
13
+ args: {
12
14
  icon: /*#__PURE__*/_jsx(IconMail, {}),
13
- children: [/*#__PURE__*/_jsx(DropdownMenuOption, {
14
- onClick: () => console.log('Option 1 clicked'),
15
- children: "Option 1"
16
- }), /*#__PURE__*/_jsx(DropdownMenuOption, {
17
- onClick: () => console.log('Option 2 clicked'),
18
- children: "Option 2"
19
- })]
20
- }),
15
+ children: /*#__PURE__*/_jsxs(_Fragment, {
16
+ children: [/*#__PURE__*/_jsx(DropdownMenuOption, {
17
+ onClick: () => console.log('Option 1 clicked'),
18
+ children: "Option 1"
19
+ }), /*#__PURE__*/_jsx(DropdownMenuOption, {
20
+ onClick: () => console.log('Option 2 clicked'),
21
+ children: "Option 2"
22
+ })]
23
+ })
24
+ },
21
25
  name: 'Default'
22
26
  };
23
27
  export const WithCounterProp = {
24
- render: () => /*#__PURE__*/_jsxs(DropdownMenu, {
28
+ args: {
25
29
  icon: /*#__PURE__*/_jsx(IconMail, {}),
26
- children: [/*#__PURE__*/_jsx(DropdownMenuOption, {
27
- onClick: () => console.log('Option 1 clicked'),
28
- counter: 3,
29
- children: "With counter"
30
- }), /*#__PURE__*/_jsx(DropdownMenuOption, {
31
- onClick: () => console.log('Option 2 clicked'),
32
- children: "Option 2"
33
- })]
34
- }),
30
+ children: /*#__PURE__*/_jsxs(_Fragment, {
31
+ children: [/*#__PURE__*/_jsx(DropdownMenuOption, {
32
+ onClick: () => console.log('Option 1 clicked'),
33
+ counter: 3,
34
+ children: "With counter"
35
+ }), /*#__PURE__*/_jsx(DropdownMenuOption, {
36
+ onClick: () => console.log('Option 2 clicked'),
37
+ children: "Option 2"
38
+ })]
39
+ })
40
+ },
35
41
  name: 'With counter prop'
36
42
  };
37
43
  export const WithClassname = {
38
- render: () => /*#__PURE__*/_jsx(DropdownMenu, {
44
+ args: {
39
45
  icon: /*#__PURE__*/_jsx(IconMail, {}),
40
- className: "my-class",
41
- children: /*#__PURE__*/_jsx(DropdownMenuOption, {
42
- onClick: () => console.log('Option 1 clicked'),
43
- children: "This menu has a classname"
46
+ className: 'my-class',
47
+ children: /*#__PURE__*/_jsx(_Fragment, {
48
+ children: /*#__PURE__*/_jsx(DropdownMenuOption, {
49
+ onClick: () => console.log('Option 1 clicked'),
50
+ children: "This menu has a classname"
51
+ })
44
52
  })
45
- }),
53
+ },
46
54
  name: 'With classname'
47
55
  };
@@ -9,12 +9,14 @@ const DropdownMenuOption = ({
9
9
  children
10
10
  }) => {
11
11
  return _jsxs(Link, {
12
+ role: "menuitem",
12
13
  trackingName: "Topbar",
13
14
  trackingEvent: 'DropdownMenu click: ' + (children ? children : ''),
14
15
  css: theme => [dropdownMenuOption(theme)],
15
16
  onClick: onClick,
16
17
  removeUnderline: true,
17
18
  small: true,
19
+ "aria-label": children ? `Option: ${children}${counter ? `, ${counter} notifications` : ''}` : '',
18
20
  children: [children ? children : '', counter ? ` (${counter})` : '']
19
21
  });
20
22
  };
@@ -9,6 +9,7 @@ const DropdownMenu = ({
9
9
  children
10
10
  }) => {
11
11
  const [open, setOpen] = useState(false);
12
+ const dropdownRef = React.useRef(null);
12
13
  useEffect(() => {
13
14
  const handleClickOutside = e => {
14
15
  setTimeout(() => {
@@ -24,9 +25,22 @@ const DropdownMenu = ({
24
25
  document.removeEventListener('mousedown', handleClickOutside);
25
26
  };
26
27
  }, [open]);
28
+ useEffect(() => {
29
+ if (!dropdownRef?.current) return;
30
+ if (open) {
31
+ // Focus the first focusable element in the dropdown when it opens
32
+ const focusableElements = dropdownRef.current.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');
33
+ if (focusableElements.length) {
34
+ const element = focusableElements[0];
35
+ element.focus();
36
+ }
37
+ }
38
+ }, [open]);
27
39
  return /*#__PURE__*/_jsxs(Wrapper, {
28
40
  className: className,
29
41
  children: [/*#__PURE__*/_jsx(Button, {
42
+ "aria-haspopup": true,
43
+ "aria-expanded": open,
30
44
  nostyle: true,
31
45
  focusable: true,
32
46
  onClick: () => setOpen(!open),
@@ -34,6 +48,8 @@ const DropdownMenu = ({
34
48
  trackingName: "Topbar",
35
49
  children: icon ? icon : ''
36
50
  }), open && /*#__PURE__*/_jsx(Content, {
51
+ ref: dropdownRef,
52
+ role: "menu",
37
53
  children: children
38
54
  })]
39
55
  });
@@ -1,54 +1,55 @@
1
1
  import Editor from '.';
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- export default {
2
+ const meta = {
4
3
  title: 'Core/Editor',
5
4
  component: Editor
6
5
  };
6
+ export default meta;
7
7
  export const Default = {
8
- render: () => /*#__PURE__*/_jsx(Editor, {
9
- onChange: e => console.log(e),
10
- label: "Editor-label"
11
- }),
8
+ args: {
9
+ label: 'Editor-label',
10
+ onChange: e => console.log(e)
11
+ },
12
12
  name: 'Default'
13
13
  };
14
14
  export const Rich = {
15
- render: () => /*#__PURE__*/_jsx(Editor, {
15
+ args: {
16
+ label: 'Editor-label',
16
17
  onChange: e => console.log(e),
17
- label: "Editor-label",
18
- type: "rich",
18
+ type: 'rich',
19
19
  allowImages: true
20
- }),
20
+ },
21
21
  name: 'Rich'
22
22
  };
23
23
  export const ValidElements = {
24
- render: () => /*#__PURE__*/_jsx(Editor, {
24
+ args: {
25
+ label: 'Editor-label',
25
26
  onChange: e => console.log(e),
26
- validElements: "strong,p,span,em",
27
- type: "custom",
28
- customToolbar: "bold italic underline"
29
- }),
27
+ type: 'custom',
28
+ customToolbar: 'bold italic underline',
29
+ validElements: 'strong,p,span,em'
30
+ },
30
31
  name: 'Valid elements'
31
32
  };
32
33
  export const InvalidElements = {
33
- render: () => /*#__PURE__*/_jsx(Editor, {
34
+ args: {
35
+ label: 'Editor-label',
34
36
  onChange: e => console.log(e),
35
- pasteAsText: false,
36
- invalidElements: "button,a,h1,h2,h3,h4,h5,h6"
37
- }),
37
+ type: 'custom',
38
+ customToolbar: 'bold italic underline',
39
+ invalidElements: 'button,a,h1,h2,h3,h4,h5,h6'
40
+ },
38
41
  name: 'Invalid elements'
39
42
  };
40
43
  export const AllProps = {
41
- render: () => /*#__PURE__*/_jsx(Editor, {
42
- label: "Label",
43
- type: "rich",
44
- initialValue: '<p><img src="https://i.ytimg.com/vi/CZFKWt3S2Ys/maxresdefault.jpg" alt="testimage" width="444" height="250" /></p><br/><p>"wow" - Owen Wilson</p>',
44
+ args: {
45
+ label: 'Editor-label',
46
+ onChange: e => console.log(e),
47
+ type: 'rich',
45
48
  allowImages: true,
46
- invalidElements: "",
47
- invalidMessage: "Memes are not allowed",
49
+ invalidElements: 'button,a,h1,h2,h3,h4,h5,h6',
50
+ invalidMessage: 'Memes are not allowed',
48
51
  height: 400,
49
- maxHeight: 600,
50
- onChange: (e, length) => console.log(e, length),
51
- onBlur: () => console.log('blur')
52
- }),
53
- name: 'Props'
52
+ maxHeight: 600
53
+ },
54
+ name: 'All props'
54
55
  };
@@ -22,6 +22,7 @@ const FileInput = ({
22
22
  rotateIcon,
23
23
  isControlledState,
24
24
  controlledFiles,
25
+ id = 'file-input',
25
26
  onChange
26
27
  }) => {
27
28
  const [uncontrolledFiles, setUncontrolledFiles] = useState(initialFiles);
@@ -30,6 +31,7 @@ const FileInput = ({
30
31
  const files = isControlledState ? controlledFiles || [] : uncontrolledFiles;
31
32
  const hiddenFileInput = useRef(null);
32
33
  const handleClick = () => {
34
+ if (!hiddenFileInput.current) return;
33
35
  const node = hiddenFileInput.current;
34
36
  node.click();
35
37
  };
@@ -76,6 +78,7 @@ const FileInput = ({
76
78
  };
77
79
  return /*#__PURE__*/_jsxs(Wrapper, {
78
80
  children: [label && /*#__PURE__*/_jsx(Label, {
81
+ id: id,
79
82
  children: label
80
83
  }), /*#__PURE__*/_jsxs(FileWrapper, {
81
84
  children: [files.length > 0 && !hideFileList && /*#__PURE__*/_jsx(DocumentList, {
@@ -102,6 +105,7 @@ const FileInput = ({
102
105
  width: width,
103
106
  type: "button",
104
107
  nostyle: nostyle,
108
+ "aria-labelledby": "fileInputLabel",
105
109
  children: !nostyle ? /*#__PURE__*/_jsxs(ButtonContent, {
106
110
  children: [text, /*#__PURE__*/_jsx(Icon, {
107
111
  rotated: rotateIcon ? 1 : 0,
@@ -116,7 +120,8 @@ const FileInput = ({
116
120
  onChange: handleChange,
117
121
  multiple: multiple,
118
122
  accept: accept,
119
- ref: hiddenFileInput
123
+ ref: hiddenFileInput,
124
+ "aria-hidden": "true"
120
125
  })]
121
126
  })]
122
127
  }), invalidMessage && /*#__PURE__*/_jsx(ErrorMessage, {
@@ -124,6 +129,7 @@ const FileInput = ({
124
129
  }), sizeError && /*#__PURE__*/_jsxs(Alert, {
125
130
  danger: true,
126
131
  onClose: () => setSizeError(false),
132
+ "aria-live": "assertive",
127
133
  children: ["Fil kan ikke overstige ", formatBytes(fileMaxsixe)]
128
134
  })]
129
135
  });
@@ -1,12 +1,12 @@
1
1
  import GoogleButtonComponent from '.';
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- export default {
2
+ const meta = {
4
3
  title: 'Core/GoogleButton',
5
4
  component: GoogleButtonComponent
6
5
  };
6
+ export default meta;
7
7
  export const GoogleButton = {
8
- render: () => /*#__PURE__*/_jsx(GoogleButtonComponent, {
8
+ args: {
9
9
  onClick: () => console.log('clicking button')
10
- }),
10
+ },
11
11
  name: 'Google button'
12
12
  };
@@ -1,65 +1,62 @@
1
1
  import Header from '.';
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- export default {
2
+ const meta = {
4
3
  title: 'Core/Header',
5
4
  component: Header
6
5
  };
6
+ export default meta;
7
7
  export const Header1 = {
8
- render: () => /*#__PURE__*/_jsx(Header, {
9
- level: 1,
10
- children: "Header 1"
11
- }),
12
- name: 'Header 1'
8
+ args: {
9
+ children: 'Header',
10
+ level: 1
11
+ },
12
+ name: 'Header level 1'
13
13
  };
14
14
  export const Header2 = {
15
- render: () => /*#__PURE__*/_jsx(Header, {
16
- level: 2,
17
- children: "Header 2"
18
- }),
19
- name: 'Header 2'
15
+ args: {
16
+ children: 'Header 2',
17
+ level: 2
18
+ },
19
+ name: 'Header level 2'
20
20
  };
21
21
  export const Header3 = {
22
- render: () => /*#__PURE__*/_jsx(Header, {
23
- level: 3,
24
- children: "Header 3"
25
- }),
26
- name: 'Header 3'
22
+ args: {
23
+ children: 'Header 3',
24
+ level: 3
25
+ },
26
+ name: 'Header level 3'
27
27
  };
28
28
  export const Header4 = {
29
- render: () => /*#__PURE__*/_jsx(Header, {
30
- level: 4,
31
- children: "Header 4"
32
- }),
33
- name: 'Header 4'
29
+ args: {
30
+ children: 'Header 4',
31
+ level: 4
32
+ },
33
+ name: 'Header level 4'
34
34
  };
35
35
  export const Header5 = {
36
- render: () => /*#__PURE__*/_jsx(Header, {
37
- level: 5,
38
- children: "Header 5"
39
- }),
40
- name: 'Header 5'
36
+ args: {
37
+ children: 'Header 5',
38
+ level: 5
39
+ },
40
+ name: 'Header level 5'
41
41
  };
42
- export const HeaderCustomColor = {
43
- render: () => /*#__PURE__*/_jsx(Header, {
44
- level: 3,
45
- color: "green",
46
- children: "Header 3 custom color"
47
- }),
42
+ export const HeaderSecondaryColor = {
43
+ args: {
44
+ children: 'Header 3 custom color',
45
+ secondary: true
46
+ },
48
47
  name: 'Header custom color'
49
48
  };
50
49
  export const HeaderPrimaryColor = {
51
- render: () => /*#__PURE__*/_jsx(Header, {
52
- level: 3,
53
- primary: true,
54
- children: "Header 3 primary color"
55
- }),
50
+ args: {
51
+ children: 'Header 3 primary color',
52
+ primary: true
53
+ },
56
54
  name: 'Header primary color'
57
55
  };
58
- export const HeaderSecondaryColor = {
59
- render: () => /*#__PURE__*/_jsx(Header, {
60
- level: 3,
61
- secondary: true,
62
- children: "Header 3 secondary color"
63
- }),
64
- name: 'Header secondary color'
56
+ export const HeaderCustomColor = {
57
+ args: {
58
+ children: 'Header 3 custom color',
59
+ color: 'red'
60
+ },
61
+ name: 'Header custom color'
65
62
  };
@@ -1,22 +1,22 @@
1
1
  import HighlightText from '.';
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- export default {
2
+ const meta = {
4
3
  title: 'Core/HighlightText',
5
4
  component: HighlightText
6
5
  };
6
+ export default meta;
7
7
  export const Highlight = {
8
- render: () => /*#__PURE__*/_jsx(HighlightText, {
9
- text: "This is a text with a highlighted part",
10
- highlight: "highlighted part"
11
- }),
8
+ args: {
9
+ text: 'This is a text with a highlighted part',
10
+ highlight: 'highlighted part'
11
+ },
12
12
  name: 'Highlight'
13
13
  };
14
14
  export const AllProps = {
15
- render: () => /*#__PURE__*/_jsx(HighlightText, {
16
- text: "This is a text with a highlighted part",
17
- highlight: "highlighted part",
18
- size: "14px",
15
+ args: {
16
+ text: 'This is a text with a highlighted part',
17
+ highlight: 'highlighted part',
18
+ size: '14px',
19
19
  semibold: true
20
- }),
20
+ },
21
21
  name: 'All props'
22
22
  };