@bbl-digital/snorre 3.0.28 → 3.0.31
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/bundle.js +18 -1
- package/esm/core/SearchSelect/index.js +1 -1
- package/esm/core/private/ButtonOrLink.js +18 -1
- package/lib/core/NoticeCard/utils.d.ts +0 -1
- package/lib/core/NoticeCard/utils.d.ts.map +1 -1
- package/lib/core/PieChart/ActiveShape/index.d.ts +0 -1
- package/lib/core/PieChart/ActiveShape/index.d.ts.map +1 -1
- package/lib/core/PieChart/renderTextContent/index.d.ts +0 -1
- package/lib/core/PieChart/renderTextContent/index.d.ts.map +1 -1
- package/lib/core/SearchSelect/index.d.ts.map +1 -1
- package/lib/core/SearchSelect/index.js +1 -1
- package/lib/core/private/ButtonOrLink.d.ts +9 -0
- package/lib/core/private/ButtonOrLink.d.ts.map +1 -1
- package/lib/core/private/ButtonOrLink.js +18 -1
- package/package.json +17 -17
package/dist/bundle.js
CHANGED
@@ -183,6 +183,9 @@
|
|
183
183
|
tabIndex,
|
184
184
|
onClick,
|
185
185
|
onMouseUp,
|
186
|
+
onEnterKeyPress,
|
187
|
+
onEscapeKeyPress,
|
188
|
+
onKeyPress,
|
186
189
|
...restProps
|
187
190
|
}) => {
|
188
191
|
// Intercept click to handle disabled state
|
@@ -203,6 +206,20 @@
|
|
203
206
|
}
|
204
207
|
};
|
205
208
|
|
209
|
+
const handleKeyPress = event => {
|
210
|
+
if (onEnterKeyPress && event.key === 'Enter') onEnterKeyPress(event);
|
211
|
+
if (onEscapeKeyPress && event.key === 'Escape') onEscapeKeyPress(event);
|
212
|
+
if (onKeyPress && event.key === onKeyPress.key) onKeyPress.action(event);
|
213
|
+
};
|
214
|
+
|
215
|
+
React.useEffect(() => {
|
216
|
+
const hasKeyPressEvents = onEnterKeyPress || onEscapeKeyPress || onKeyPress;
|
217
|
+
if (!hasKeyPressEvents) return;
|
218
|
+
window.addEventListener('keyup', handleKeyPress);
|
219
|
+
return () => {
|
220
|
+
if (hasKeyPressEvents) window.removeEventListener('keyup', handleKeyPress);
|
221
|
+
}; // eslint-disable-next-line react-hooks/exhaustive-deps
|
222
|
+
}, []);
|
206
223
|
const Tag = href ? 'a' : 'button';
|
207
224
|
const props = {}; // Determine props based on element type
|
208
225
|
|
@@ -24512,7 +24529,7 @@
|
|
24512
24529
|
children: values.map(item => jsxRuntime$1.jsx(Option, {
|
24513
24530
|
onChange: handleOnItemClick(item),
|
24514
24531
|
children: props.createLabelName?.(item) ?? item[props.labelName || 'label']
|
24515
|
-
}))
|
24532
|
+
}, item[item.keyName || 'id']))
|
24516
24533
|
})
|
24517
24534
|
})]
|
24518
24535
|
}) : null
|
@@ -93,7 +93,7 @@ const SelectSearch = props => {
|
|
93
93
|
children: values.map(item => _jsx(Option, {
|
94
94
|
onChange: handleOnItemClick(item),
|
95
95
|
children: props.createLabelName?.(item) ?? item[props.labelName || 'label']
|
96
|
-
}))
|
96
|
+
}, item[item.keyName || 'id']))
|
97
97
|
})
|
98
98
|
})]
|
99
99
|
}) : null
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import React from 'react';
|
1
|
+
import React, { useEffect } from 'react';
|
2
2
|
import removeFocusOnMouseUp from '../../utils/removeFocusOnMouseUp';
|
3
3
|
import { jsx as _jsx } from "react/jsx-runtime";
|
4
4
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
@@ -21,6 +21,9 @@ const ButtonOrLink = ({
|
|
21
21
|
tabIndex,
|
22
22
|
onClick,
|
23
23
|
onMouseUp,
|
24
|
+
onEnterKeyPress,
|
25
|
+
onEscapeKeyPress,
|
26
|
+
onKeyPress,
|
24
27
|
...restProps
|
25
28
|
}) => {
|
26
29
|
// Intercept click to handle disabled state
|
@@ -41,6 +44,20 @@ const ButtonOrLink = ({
|
|
41
44
|
}
|
42
45
|
};
|
43
46
|
|
47
|
+
const handleKeyPress = event => {
|
48
|
+
if (onEnterKeyPress && event.key === 'Enter') onEnterKeyPress(event);
|
49
|
+
if (onEscapeKeyPress && event.key === 'Escape') onEscapeKeyPress(event);
|
50
|
+
if (onKeyPress && event.key === onKeyPress.key) onKeyPress.action(event);
|
51
|
+
};
|
52
|
+
|
53
|
+
useEffect(() => {
|
54
|
+
const hasKeyPressEvents = onEnterKeyPress || onEscapeKeyPress || onKeyPress;
|
55
|
+
if (!hasKeyPressEvents) return;
|
56
|
+
window.addEventListener('keyup', handleKeyPress);
|
57
|
+
return () => {
|
58
|
+
if (hasKeyPressEvents) window.removeEventListener('keyup', handleKeyPress);
|
59
|
+
}; // eslint-disable-next-line react-hooks/exhaustive-deps
|
60
|
+
}, []);
|
44
61
|
const Tag = href ? 'a' : 'button';
|
45
62
|
const props = {}; // Determine props based on element type
|
46
63
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/packages/core/NoticeCard/utils.tsx"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/packages/core/NoticeCard/utils.tsx"],"names":[],"mappings":"AASA,eAAO,MAAM,2BAA2B,eAC1B,IAAI,YACN,IAAI,WAKf,CAAA;AAED,eAAO,MAAM,WAAW,SAAU,MAAM,gBAYvC,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/packages/core/PieChart/ActiveShape/index.tsx"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/packages/core/PieChart/ActiveShape/index.tsx"],"names":[],"mappings":"AAGA,0CAA0C;AAC1C,QAAA,MAAM,WAAW,UAAW,GAAG,gBAyB9B,CAAA;AAED,eAAe,WAAW,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/packages/core/PieChart/renderTextContent/index.tsx"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/packages/core/PieChart/renderTextContent/index.tsx"],"names":[],"mappings":"AAGA,2CAA2C;AAC3C,QAAA,MAAM,iBAAiB,QAAS,MAAM,yCAA6B,GAAG,gBAkCrE,CAAA;AAED,eAAe,iBAAiB,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/packages/core/SearchSelect/index.tsx"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,OAAO,KAA4B,MAAM,OAAO,CAAA;AAOhD,OAAO,EAAE,MAAM,EAAgB,MAAM,oBAAoB,CAAA;AASzD,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,MAAM,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/packages/core/SearchSelect/index.tsx"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,OAAO,KAA4B,MAAM,OAAO,CAAA;AAOhD,OAAO,EAAE,MAAM,EAAgB,MAAM,oBAAoB,CAAA;AASzD,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,MAAM,CA0GlC,CAAA;AAED,eAAe,YAAY,CAAA"}
|
@@ -93,7 +93,7 @@ const SelectSearch = props => {
|
|
93
93
|
children: values.map(item => _jsx(Option, {
|
94
94
|
onChange: handleOnItemClick(item),
|
95
95
|
children: props.createLabelName?.(item) ?? item[props.labelName || 'label']
|
96
|
-
}))
|
96
|
+
}, item[item.keyName || 'id']))
|
97
97
|
})
|
98
98
|
})]
|
99
99
|
}) : null
|
@@ -18,6 +18,15 @@ export declare type Props = {
|
|
18
18
|
onClick?: (event: React.MouseEvent<ButtonOrLinkTypes>) => void;
|
19
19
|
/** Callback fired when the element is released. */
|
20
20
|
onMouseUp?: (event: React.MouseEvent<ButtonOrLinkTypes>) => void;
|
21
|
+
/** Keypress handler, to handle any wanted eventlistener button clicks */
|
22
|
+
onKeyPress?: {
|
23
|
+
key: string;
|
24
|
+
action: (event: KeyboardEvent) => void;
|
25
|
+
};
|
26
|
+
/** Callback fired when the enter key is released. */
|
27
|
+
onEnterKeyPress?: (event: KeyboardEvent) => void;
|
28
|
+
/** Callback fired when the escape key is released. */
|
29
|
+
onEscapeKeyPress?: (event: KeyboardEvent) => void;
|
21
30
|
/** When a link, open the target in a new window. */
|
22
31
|
openInNewWindow?: boolean;
|
23
32
|
/** Rel attribute override for if the component has an href */
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ButtonOrLink.d.ts","sourceRoot":"","sources":["../../../src/packages/core/private/ButtonOrLink.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
1
|
+
{"version":3,"file":"ButtonOrLink.d.ts","sourceRoot":"","sources":["../../../src/packages/core/private/ButtonOrLink.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAA;AAGxC,oBAAY,iBAAiB,GAAG,iBAAiB,GAAG,iBAAiB,CAAA;AAErE,oBAAY,KAAK,GAAG;IAClB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAA;IACvB,8CAA8C;IAC9C,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC3B,gDAAgD;IAChD,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC5B,yCAAyC;IACzC,QAAQ,EAAE,WAAW,CAAC,KAAK,CAAC,SAAS,CAAC,CAAA;IACtC,uCAAuC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,2CAA2C;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,sCAAsC;IACtC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,kDAAkD;IAClD,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAA;IAC9D,mDAAmD;IACnD,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAA;IAChE,yEAAyE;IACzE,UAAU,CAAC,EAAE;QACX,GAAG,EAAE,MAAM,CAAA;QACX,MAAM,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAA;KACvC,CAAA;IACD,qDAAqD;IACrD,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAA;IAChD,uDAAuD;IACvD,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAA;IACjD,oDAAoD;IACpD,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,8DAA8D;IAC9D,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,2CAA2C;IAC3C,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,0CAA0C;IAC1C,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,yCAAyC;IACzC,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAA;IACpC,kBAAkB;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,GAAG,CAAA;IACd,mBAAmB;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAqGjC,CAAA;AAED,eAAe,YAAY,CAAA"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import React from 'react';
|
1
|
+
import React, { useEffect } from 'react';
|
2
2
|
import removeFocusOnMouseUp from '../../utils/removeFocusOnMouseUp';
|
3
3
|
import { jsx as _jsx } from "react/jsx-runtime";
|
4
4
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
@@ -21,6 +21,9 @@ const ButtonOrLink = ({
|
|
21
21
|
tabIndex,
|
22
22
|
onClick,
|
23
23
|
onMouseUp,
|
24
|
+
onEnterKeyPress,
|
25
|
+
onEscapeKeyPress,
|
26
|
+
onKeyPress,
|
24
27
|
...restProps
|
25
28
|
}) => {
|
26
29
|
// Intercept click to handle disabled state
|
@@ -41,6 +44,20 @@ const ButtonOrLink = ({
|
|
41
44
|
}
|
42
45
|
};
|
43
46
|
|
47
|
+
const handleKeyPress = event => {
|
48
|
+
if (onEnterKeyPress && event.key === 'Enter') onEnterKeyPress(event);
|
49
|
+
if (onEscapeKeyPress && event.key === 'Escape') onEscapeKeyPress(event);
|
50
|
+
if (onKeyPress && event.key === onKeyPress.key) onKeyPress.action(event);
|
51
|
+
};
|
52
|
+
|
53
|
+
useEffect(() => {
|
54
|
+
const hasKeyPressEvents = onEnterKeyPress || onEscapeKeyPress || onKeyPress;
|
55
|
+
if (!hasKeyPressEvents) return;
|
56
|
+
window.addEventListener('keyup', handleKeyPress);
|
57
|
+
return () => {
|
58
|
+
if (hasKeyPressEvents) window.removeEventListener('keyup', handleKeyPress);
|
59
|
+
}; // eslint-disable-next-line react-hooks/exhaustive-deps
|
60
|
+
}, []);
|
44
61
|
const Tag = href ? 'a' : 'button';
|
45
62
|
const props = {}; // Determine props based on element type
|
46
63
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@bbl-digital/snorre",
|
3
|
-
"version": "3.0.
|
3
|
+
"version": "3.0.31",
|
4
4
|
"description": "Design library for BBL Digital",
|
5
5
|
"license": "MIT",
|
6
6
|
"main": "./lib/index.js",
|
@@ -20,13 +20,13 @@
|
|
20
20
|
"author": "bbl-digital",
|
21
21
|
"dependencies": {
|
22
22
|
"@popperjs/core": "^2.11.5",
|
23
|
-
"@tinymce/tinymce-react": "^
|
23
|
+
"@tinymce/tinymce-react": "^4.2.0",
|
24
24
|
"@types/react-test-renderer": "^18.0.0",
|
25
|
-
"date-fns": "^2.
|
26
|
-
"focus-trap-react": "^
|
25
|
+
"date-fns": "^2.29.3",
|
26
|
+
"focus-trap-react": "^10.0.0",
|
27
27
|
"match-sorter": "^6.3.1",
|
28
28
|
"react-beautiful-dnd": "^13.1.0",
|
29
|
-
"react-day-picker": "^8.
|
29
|
+
"react-day-picker": "^8.3.4",
|
30
30
|
"react-test-renderer": "^18.2.0",
|
31
31
|
"recharts": "2.1.5"
|
32
32
|
},
|
@@ -63,21 +63,21 @@
|
|
63
63
|
"@emotion/react": "^11.9.3",
|
64
64
|
"@emotion/styled": "^11.9.3",
|
65
65
|
"@rollup/plugin-commonjs": "^20.0.0",
|
66
|
-
"@storybook/addon-a11y": "6.5.
|
67
|
-
"@storybook/addon-actions": "6.5.
|
68
|
-
"@storybook/addon-docs": "6.5.
|
69
|
-
"@storybook/addon-knobs": "^6.
|
70
|
-
"@storybook/addon-links": "6.5.
|
71
|
-
"@storybook/addons": "6.5.
|
66
|
+
"@storybook/addon-a11y": "6.5.12",
|
67
|
+
"@storybook/addon-actions": "6.5.12",
|
68
|
+
"@storybook/addon-docs": "6.5.12",
|
69
|
+
"@storybook/addon-knobs": "^6.4.0",
|
70
|
+
"@storybook/addon-links": "6.5.12",
|
71
|
+
"@storybook/addons": "6.5.12",
|
72
72
|
"@storybook/preset-create-react-app": "^3.2.0",
|
73
|
-
"@storybook/react": "6.5.
|
74
|
-
"@testing-library/jest-dom": "^5.16.
|
75
|
-
"@testing-library/react": "^13.
|
76
|
-
"@testing-library/user-event": "^14.3
|
73
|
+
"@storybook/react": "6.5.12",
|
74
|
+
"@testing-library/jest-dom": "^5.16.5",
|
75
|
+
"@testing-library/react": "^13.4.0",
|
76
|
+
"@testing-library/user-event": "^14.4.3",
|
77
77
|
"@types/body-scroll-lock": "^3.1.0",
|
78
78
|
"@types/jest": "^26.0.23",
|
79
|
-
"@types/node": "^18.
|
80
|
-
"@types/react": "^18.0.
|
79
|
+
"@types/node": "^18.8.3",
|
80
|
+
"@types/react": "^18.0.21",
|
81
81
|
"@types/react-beautiful-dnd": "^13.1.2",
|
82
82
|
"@types/react-dom": "^18.0.6",
|
83
83
|
"@types/react-transition-group": "^4.4.5",
|