@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.
- package/dist/bundle.js +117 -31
- package/esm/core/BoxedTable/TableBody/index.js +10 -0
- package/esm/core/BoxedTable/TableBody/styles.js +16 -0
- package/esm/core/Button/Button.stories.js +51 -49
- package/esm/core/Card/index.js +4 -3
- package/esm/core/Checkbox/index.js +32 -9
- package/esm/core/CollapseList/Item.js +4 -3
- package/esm/core/CollapseList/index.js +4 -3
- package/esm/core/Datepicker/Datepicker.stories.js +7 -6
- package/esm/core/DatepickerRange/DatepickerRange.stories.js +4 -3
- package/esm/core/Dropdown/index.js +0 -1
- package/esm/core/DropdownMenu/DropdownMenu.stories.js +34 -26
- package/esm/core/DropdownMenu/DropdownMenuOption.js +2 -0
- package/esm/core/DropdownMenu/index.js +16 -0
- package/esm/core/Editor/Editor.stories.js +31 -30
- package/esm/core/FileInput/index.js +7 -1
- package/esm/core/GoogleButton/GoogleButton.stories.js +4 -4
- package/esm/core/Header/Header.stories.js +42 -45
- package/esm/core/HighlightText/HighlightText.stories.js +11 -11
- package/esm/core/Image/index.js +19 -4
- package/esm/core/ImagePicker/ImagePicker.stories.js +2 -1
- package/esm/core/ImagePicker/index.js +4 -0
- package/esm/core/ImageViewer/index.js +15 -5
- package/esm/core/InfoButton/InfoButton.stories.js +23 -22
- package/esm/core/InfoButton/index.js +4 -0
- package/esm/core/Input/index.js +4 -0
- package/esm/core/private/ButtonOrLink.js +4 -3
- package/lib/core/Autocomplete/styles.d.ts +39 -1
- package/lib/core/Autocomplete/styles.d.ts.map +1 -1
- package/lib/core/Box/styles.d.ts +39 -1
- package/lib/core/Box/styles.d.ts.map +1 -1
- package/lib/core/BoxedTable/TableBody/index.d.ts +7 -0
- package/lib/core/BoxedTable/TableBody/index.d.ts.map +1 -0
- package/lib/core/BoxedTable/TableBody/index.js +10 -0
- package/lib/core/BoxedTable/TableBody/styles.d.ts +6 -0
- package/lib/core/BoxedTable/TableBody/styles.d.ts.map +1 -0
- package/lib/core/BoxedTable/TableBody/styles.js +16 -0
- package/lib/core/Button/Button.stories.d.ts +20 -63
- package/lib/core/Button/Button.stories.d.ts.map +1 -1
- package/lib/core/Button/Button.stories.js +51 -49
- package/lib/core/Button/index.d.ts +54 -3
- package/lib/core/Button/index.d.ts.map +1 -1
- package/lib/core/Card/index.d.ts +14 -15
- package/lib/core/Card/index.d.ts.map +1 -1
- package/lib/core/Card/index.js +4 -3
- package/lib/core/Checkbox/index.d.ts +3 -3
- package/lib/core/Checkbox/index.d.ts.map +1 -1
- package/lib/core/Checkbox/index.js +32 -9
- package/lib/core/CollapseList/Item.d.ts +1 -1
- package/lib/core/CollapseList/Item.d.ts.map +1 -1
- package/lib/core/CollapseList/Item.js +4 -3
- package/lib/core/CollapseList/index.d.ts +1 -1
- package/lib/core/CollapseList/index.d.ts.map +1 -1
- package/lib/core/CollapseList/index.js +4 -3
- package/lib/core/CollapseList/styles.d.ts +39 -1
- package/lib/core/CollapseList/styles.d.ts.map +1 -1
- package/lib/core/Datepicker/Datepicker.stories.d.ts +6 -6
- package/lib/core/Datepicker/Datepicker.stories.d.ts.map +1 -1
- package/lib/core/Datepicker/Datepicker.stories.js +7 -6
- package/lib/core/DatepickerRange/DatepickerRange.stories.d.ts +6 -7
- package/lib/core/DatepickerRange/DatepickerRange.stories.d.ts.map +1 -1
- package/lib/core/DatepickerRange/DatepickerRange.stories.js +4 -3
- package/lib/core/Dropdown/index.d.ts.map +1 -1
- package/lib/core/Dropdown/index.js +0 -1
- package/lib/core/DropdownMenu/DropdownMenu.stories.d.ts +8 -15
- package/lib/core/DropdownMenu/DropdownMenu.stories.d.ts.map +1 -1
- package/lib/core/DropdownMenu/DropdownMenu.stories.js +34 -26
- package/lib/core/DropdownMenu/DropdownMenuOption.d.ts.map +1 -1
- package/lib/core/DropdownMenu/DropdownMenuOption.js +2 -0
- package/lib/core/DropdownMenu/index.d.ts.map +1 -1
- package/lib/core/DropdownMenu/index.js +16 -0
- package/lib/core/Editor/Editor.stories.d.ts +10 -23
- package/lib/core/Editor/Editor.stories.d.ts.map +1 -1
- package/lib/core/Editor/Editor.stories.js +31 -30
- package/lib/core/FileInput/index.d.ts +3 -1
- package/lib/core/FileInput/index.d.ts.map +1 -1
- package/lib/core/FileInput/index.js +7 -1
- package/lib/core/FileInput/styles.d.ts +39 -1
- package/lib/core/FileInput/styles.d.ts.map +1 -1
- package/lib/core/GoogleButton/GoogleButton.stories.d.ts +6 -7
- package/lib/core/GoogleButton/GoogleButton.stories.d.ts.map +1 -1
- package/lib/core/GoogleButton/GoogleButton.stories.js +4 -4
- package/lib/core/Header/Header.stories.d.ts +13 -35
- package/lib/core/Header/Header.stories.d.ts.map +1 -1
- package/lib/core/Header/Header.stories.js +42 -45
- package/lib/core/HighlightText/HighlightText.stories.d.ts +7 -11
- package/lib/core/HighlightText/HighlightText.stories.d.ts.map +1 -1
- package/lib/core/HighlightText/HighlightText.stories.js +11 -11
- package/lib/core/Image/index.d.ts +1 -0
- package/lib/core/Image/index.d.ts.map +1 -1
- package/lib/core/Image/index.js +19 -4
- package/lib/core/ImagePicker/ImagePicker.stories.d.ts +6 -17
- package/lib/core/ImagePicker/ImagePicker.stories.d.ts.map +1 -1
- package/lib/core/ImagePicker/ImagePicker.stories.js +2 -1
- package/lib/core/ImagePicker/index.d.ts.map +1 -1
- package/lib/core/ImagePicker/index.js +4 -0
- package/lib/core/ImageViewer/index.d.ts.map +1 -1
- package/lib/core/ImageViewer/index.js +15 -5
- package/lib/core/InfoButton/InfoButton.stories.d.ts +10 -23
- package/lib/core/InfoButton/InfoButton.stories.d.ts.map +1 -1
- package/lib/core/InfoButton/InfoButton.stories.js +23 -22
- package/lib/core/InfoButton/index.d.ts.map +1 -1
- package/lib/core/InfoButton/index.js +4 -0
- package/lib/core/InfoButton/styles.d.ts +39 -1
- package/lib/core/InfoButton/styles.d.ts.map +1 -1
- package/lib/core/Input/index.d.ts +1 -1
- package/lib/core/Input/index.d.ts.map +1 -1
- package/lib/core/Input/index.js +4 -0
- package/lib/core/private/ButtonOrLink.d.ts +46 -3
- package/lib/core/private/ButtonOrLink.d.ts.map +1 -1
- package/lib/core/private/ButtonOrLink.js +4 -3
- package/lib/layout/Footer/FooterButton/styles.d.ts +3 -3
- package/lib/layout/Footer/FooterLink/styles.d.ts +3 -3
- package/lib/layout/Menu/MenuTop/styles.d.ts +3 -3
- package/package.json +1 -1
- package/esm/core/Autocomplete/utils/useHandleOptionsHeight.js +0 -16
- package/esm/core/CheckboxController/index.js +0 -22
- package/esm/core/Datepicker/yearMonthForm.js +0 -56
- package/esm/core/EditorOld/config.js +0 -69
- package/esm/core/EditorOld/index.js +0 -147
- package/esm/core/EditorOld/styles.js +0 -65
- package/esm/core/ImageCarousel/index.js +0 -70
- package/esm/core/ImageCarousel/styles.js +0 -58
- package/esm/enums/ModifierKey.js +0 -13
- package/lib/core/Autocomplete/utils/useHandleOptionsHeight.d.ts +0 -7
- package/lib/core/Autocomplete/utils/useHandleOptionsHeight.d.ts.map +0 -1
- package/lib/core/Autocomplete/utils/useHandleOptionsHeight.js +0 -16
- package/lib/core/CheckboxController/index.d.ts +0 -1
- package/lib/core/CheckboxController/index.d.ts.map +0 -1
- package/lib/core/CheckboxController/index.js +0 -22
- package/lib/core/Datepicker/yearMonthForm.d.ts +0 -10
- package/lib/core/Datepicker/yearMonthForm.d.ts.map +0 -1
- package/lib/core/Datepicker/yearMonthForm.js +0 -56
- package/lib/core/EditorOld/config.d.ts +0 -56
- package/lib/core/EditorOld/config.d.ts.map +0 -1
- package/lib/core/EditorOld/config.js +0 -69
- package/lib/core/EditorOld/index.d.ts +0 -39
- package/lib/core/EditorOld/index.d.ts.map +0 -1
- package/lib/core/EditorOld/index.js +0 -147
- package/lib/core/EditorOld/styles.d.ts +0 -23
- package/lib/core/EditorOld/styles.d.ts.map +0 -1
- package/lib/core/EditorOld/styles.js +0 -65
- package/lib/core/ImageCarousel/index.d.ts +0 -11
- package/lib/core/ImageCarousel/index.d.ts.map +0 -1
- package/lib/core/ImageCarousel/index.js +0 -70
- package/lib/core/ImageCarousel/styles.d.ts +0 -26
- package/lib/core/ImageCarousel/styles.d.ts.map +0 -1
- package/lib/core/ImageCarousel/styles.js +0 -58
- package/lib/enums/ModifierKey.d.ts +0 -12
- package/lib/enums/ModifierKey.d.ts.map +0 -1
- package/lib/enums/ModifierKey.js +0 -13
package/esm/core/Card/index.js
CHANGED
|
@@ -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 =
|
|
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
|
-
|
|
19
|
-
|
|
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:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
-
|
|
3
|
+
const meta = {
|
|
4
4
|
title: 'Core/Datepicker',
|
|
5
5
|
component: Datepicker
|
|
6
6
|
};
|
|
7
|
-
export
|
|
8
|
-
|
|
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:
|
|
12
|
-
}
|
|
13
|
-
name: '
|
|
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
|
-
|
|
3
|
+
const meta = {
|
|
4
4
|
title: 'Core/DatepickerRange',
|
|
5
5
|
component: DatepickerRange
|
|
6
6
|
};
|
|
7
|
-
export
|
|
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: '
|
|
21
|
+
name: 'Default'
|
|
21
22
|
};
|
|
@@ -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
|
-
|
|
7
|
+
const meta = {
|
|
7
8
|
title: 'Core/DropdownMenu',
|
|
8
9
|
component: DropdownMenu
|
|
9
10
|
};
|
|
11
|
+
export default meta;
|
|
10
12
|
export const Default = {
|
|
11
|
-
|
|
13
|
+
args: {
|
|
12
14
|
icon: /*#__PURE__*/_jsx(IconMail, {}),
|
|
13
|
-
children:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
|
|
28
|
+
args: {
|
|
25
29
|
icon: /*#__PURE__*/_jsx(IconMail, {}),
|
|
26
|
-
children:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
-
|
|
44
|
+
args: {
|
|
39
45
|
icon: /*#__PURE__*/_jsx(IconMail, {}),
|
|
40
|
-
className:
|
|
41
|
-
children: /*#__PURE__*/_jsx(
|
|
42
|
-
|
|
43
|
-
|
|
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
|
-
|
|
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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
-
|
|
15
|
+
args: {
|
|
16
|
+
label: 'Editor-label',
|
|
16
17
|
onChange: e => console.log(e),
|
|
17
|
-
|
|
18
|
-
type: "rich",
|
|
18
|
+
type: 'rich',
|
|
19
19
|
allowImages: true
|
|
20
|
-
}
|
|
20
|
+
},
|
|
21
21
|
name: 'Rich'
|
|
22
22
|
};
|
|
23
23
|
export const ValidElements = {
|
|
24
|
-
|
|
24
|
+
args: {
|
|
25
|
+
label: 'Editor-label',
|
|
25
26
|
onChange: e => console.log(e),
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
-
|
|
34
|
+
args: {
|
|
35
|
+
label: 'Editor-label',
|
|
34
36
|
onChange: e => console.log(e),
|
|
35
|
-
|
|
36
|
-
|
|
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
|
-
|
|
42
|
-
label:
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
args: {
|
|
45
|
+
label: 'Editor-label',
|
|
46
|
+
onChange: e => console.log(e),
|
|
47
|
+
type: 'rich',
|
|
45
48
|
allowImages: true,
|
|
46
|
-
invalidElements:
|
|
47
|
-
invalidMessage:
|
|
49
|
+
invalidElements: 'button,a,h1,h2,h3,h4,h5,h6',
|
|
50
|
+
invalidMessage: 'Memes are not allowed',
|
|
48
51
|
height: 400,
|
|
49
|
-
maxHeight: 600
|
|
50
|
-
|
|
51
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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
|
-
|
|
52
|
-
|
|
53
|
-
primary: true
|
|
54
|
-
|
|
55
|
-
}),
|
|
50
|
+
args: {
|
|
51
|
+
children: 'Header 3 primary color',
|
|
52
|
+
primary: true
|
|
53
|
+
},
|
|
56
54
|
name: 'Header primary color'
|
|
57
55
|
};
|
|
58
|
-
export const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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
|
-
|
|
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
|
-
|
|
9
|
-
text:
|
|
10
|
-
highlight:
|
|
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
|
-
|
|
16
|
-
text:
|
|
17
|
-
highlight:
|
|
18
|
-
size:
|
|
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
|
};
|