@bbl-digital/snorre 2.3.27 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
package/dist/bundle.js CHANGED
@@ -1,13 +1,14 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@emotion/styled/base'), require('react'), require('@emotion/react'), require('react/jsx-runtime'), require('@emotion/react/jsx-runtime'), require('react-transition-group'), require('body-scroll-lock'), require('recharts'), require('react-day-picker/DayPickerInput'), require('react-day-picker'), require('@tinymce/tinymce-react')) :
3
- typeof define === 'function' && define.amd ? define(['exports', '@emotion/styled/base', 'react', '@emotion/react', 'react/jsx-runtime', '@emotion/react/jsx-runtime', 'react-transition-group', 'body-scroll-lock', 'recharts', 'react-day-picker/DayPickerInput', 'react-day-picker', '@tinymce/tinymce-react'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Snorre = {}, global._styled, global.React, global.react, global.jsxRuntime, global.jsxRuntime$1, global.reactTransitionGroup, global.bodyScrollLock, global.recharts, global.DayPickerInput, global.DayPicker, global.tinymceReact));
5
- }(this, (function (exports, _styled, React, react, jsxRuntime, jsxRuntime$1, reactTransitionGroup, bodyScrollLock, recharts, DayPickerInput, DayPicker, tinymceReact) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@emotion/styled/base'), require('react'), require('@emotion/react'), require('react/jsx-runtime'), require('@emotion/react/jsx-runtime'), require('react-transition-group'), require('body-scroll-lock'), require('focus-trap-react'), require('recharts'), require('react-day-picker/DayPickerInput'), require('react-day-picker'), require('@tinymce/tinymce-react')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', '@emotion/styled/base', 'react', '@emotion/react', 'react/jsx-runtime', '@emotion/react/jsx-runtime', 'react-transition-group', 'body-scroll-lock', 'focus-trap-react', 'recharts', 'react-day-picker/DayPickerInput', 'react-day-picker', '@tinymce/tinymce-react'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Snorre = {}, global._styled, global.React, global.react, global.jsxRuntime, global.jsxRuntime$1, global.reactTransitionGroup, global.bodyScrollLock, global.FocusTrap, global.recharts, global.DayPickerInput, global.DayPicker, global.tinymceReact));
5
+ }(this, (function (exports, _styled, React, react, jsxRuntime, jsxRuntime$1, reactTransitionGroup, bodyScrollLock, FocusTrap, recharts, DayPickerInput, DayPicker, tinymceReact) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
9
9
  var _styled__default = /*#__PURE__*/_interopDefaultLegacy(_styled);
10
10
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
11
+ var FocusTrap__default = /*#__PURE__*/_interopDefaultLegacy(FocusTrap);
11
12
  var DayPickerInput__default = /*#__PURE__*/_interopDefaultLegacy(DayPickerInput);
12
13
  var DayPicker__default = /*#__PURE__*/_interopDefaultLegacy(DayPicker);
13
14
 
@@ -24441,52 +24442,57 @@
24441
24442
  classNames: "overlay",
24442
24443
  children: jsxRuntime$1.jsx(Overlay, {
24443
24444
  onClick: onOutsideClick,
24444
- children: jsxRuntime$1.jsxs(Content$3, {
24445
- width: width,
24446
- isFullscreen: isFullscreen,
24447
- canToggleFullscreen: !!toggleFullscreen,
24448
- onClick: e => e.stopPropagation(),
24449
- children: [(!hideCloseButton || hasCollapse || toggleFullscreen) && jsxRuntime$1.jsxs(CloseWrapper, {
24450
- children: [hasCollapse && jsxRuntime$1.jsx(Button, {
24451
- nostyle: true,
24452
- onClick: onCollapse,
24453
- focusable: true,
24454
- children: jsxRuntime$1.jsx(IconMinus$1, {})
24455
- }), toggleFullscreen && jsxRuntime$1.jsx(Button, {
24456
- nostyle: true,
24457
- onClick: () => setIsFullscreen(!isFullscreen),
24458
- focusable: true,
24459
- children: isFullscreen ? jsxRuntime$1.jsx(IconFullscreenClose$1, {
24460
- size: "20px"
24461
- }) : jsxRuntime$1.jsx(IconFullscreenOpen$1, {
24462
- size: "20px"
24445
+ children: jsxRuntime$1.jsx(FocusTrap__default['default'], {
24446
+ focusTrapOptions: {
24447
+ allowOutsideClick: true
24448
+ },
24449
+ children: jsxRuntime$1.jsxs(Content$3, {
24450
+ width: width,
24451
+ isFullscreen: isFullscreen,
24452
+ canToggleFullscreen: !!toggleFullscreen,
24453
+ onClick: e => e.stopPropagation(),
24454
+ children: [(!hideCloseButton || hasCollapse || toggleFullscreen) && jsxRuntime$1.jsxs(CloseWrapper, {
24455
+ children: [hasCollapse && jsxRuntime$1.jsx(Button, {
24456
+ nostyle: true,
24457
+ onClick: onCollapse,
24458
+ focusable: true,
24459
+ children: jsxRuntime$1.jsx(IconMinus$1, {})
24460
+ }), toggleFullscreen && jsxRuntime$1.jsx(Button, {
24461
+ nostyle: true,
24462
+ onClick: () => setIsFullscreen(!isFullscreen),
24463
+ focusable: true,
24464
+ children: isFullscreen ? jsxRuntime$1.jsx(IconFullscreenClose$1, {
24465
+ size: "20px"
24466
+ }) : jsxRuntime$1.jsx(IconFullscreenOpen$1, {
24467
+ size: "20px"
24468
+ })
24469
+ }), !hideCloseButton && jsxRuntime$1.jsx(Button, {
24470
+ nostyle: true,
24471
+ onClick: setClose,
24472
+ focusable: true,
24473
+ children: jsxRuntime$1.jsx(IconClose$1, {})
24474
+ })]
24475
+ }), jsxRuntime$1.jsx(HeaderWrapper$2, {
24476
+ css: headerCss,
24477
+ withCollapse: hasCollapse,
24478
+ ref: handleHeaderRef,
24479
+ children: header && header
24480
+ }), jsxRuntime$1.jsx(ModalContent, {
24481
+ css: contentCss,
24482
+ scrollable: !disableScrollableContent,
24483
+ ref: disableScrollableContent ? modalRef : undefined,
24484
+ children: disableScrollableContent ? children : jsxRuntime$1.jsx(ScrollableDiv, {
24485
+ ref: modalRef,
24486
+ hasActionButton: !!actionButton,
24487
+ isFullscreen: isFullscreen,
24488
+ windowHeight: window.innerHeight,
24489
+ headerHeight: headerHeight,
24490
+ children: children
24463
24491
  })
24464
- }), !hideCloseButton && jsxRuntime$1.jsx(Button, {
24465
- nostyle: true,
24466
- onClick: setClose,
24467
- focusable: true,
24468
- children: jsxRuntime$1.jsx(IconClose$1, {})
24492
+ }), actionButton && jsxRuntime$1.jsx(ActionButtonWrapper, {
24493
+ children: actionButton
24469
24494
  })]
24470
- }), jsxRuntime$1.jsx(HeaderWrapper$2, {
24471
- css: headerCss,
24472
- withCollapse: hasCollapse,
24473
- ref: handleHeaderRef,
24474
- children: header && header
24475
- }), jsxRuntime$1.jsx(ModalContent, {
24476
- css: contentCss,
24477
- scrollable: !disableScrollableContent,
24478
- ref: disableScrollableContent ? modalRef : undefined,
24479
- children: disableScrollableContent ? children : jsxRuntime$1.jsx(ScrollableDiv, {
24480
- ref: modalRef,
24481
- hasActionButton: !!actionButton,
24482
- isFullscreen: isFullscreen,
24483
- windowHeight: window.innerHeight,
24484
- headerHeight: headerHeight,
24485
- children: children
24486
- })
24487
- }), actionButton && jsxRuntime$1.jsx(ActionButtonWrapper, {
24488
- children: actionButton
24489
- })]
24495
+ })
24490
24496
  })
24491
24497
  })
24492
24498
  });
@@ -7,6 +7,7 @@ import IconClose from '../../icons/General/IconClose';
7
7
  import { Button, IconFullscreenClose } from '../..';
8
8
  import IconMinus from '../../icons/General/IconMinus';
9
9
  import IconFullscreenOpen from '../../icons/General/IconFullscreenOpen';
10
+ import FocusTrap from 'focus-trap-react';
10
11
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
11
12
  import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
12
13
 
@@ -82,52 +83,57 @@ const Modal = ({
82
83
  classNames: "overlay",
83
84
  children: _jsx(Overlay, {
84
85
  onClick: onOutsideClick,
85
- children: _jsxs(Content, {
86
- width: width,
87
- isFullscreen: isFullscreen,
88
- canToggleFullscreen: !!toggleFullscreen,
89
- onClick: e => e.stopPropagation(),
90
- children: [(!hideCloseButton || hasCollapse || toggleFullscreen) && _jsxs(CloseWrapper, {
91
- children: [hasCollapse && _jsx(Button, {
92
- nostyle: true,
93
- onClick: onCollapse,
94
- focusable: true,
95
- children: _jsx(IconMinus, {})
96
- }), toggleFullscreen && _jsx(Button, {
97
- nostyle: true,
98
- onClick: () => setIsFullscreen(!isFullscreen),
99
- focusable: true,
100
- children: isFullscreen ? _jsx(IconFullscreenClose, {
101
- size: "20px"
102
- }) : _jsx(IconFullscreenOpen, {
103
- size: "20px"
86
+ children: _jsx(FocusTrap, {
87
+ focusTrapOptions: {
88
+ allowOutsideClick: true
89
+ },
90
+ children: _jsxs(Content, {
91
+ width: width,
92
+ isFullscreen: isFullscreen,
93
+ canToggleFullscreen: !!toggleFullscreen,
94
+ onClick: e => e.stopPropagation(),
95
+ children: [(!hideCloseButton || hasCollapse || toggleFullscreen) && _jsxs(CloseWrapper, {
96
+ children: [hasCollapse && _jsx(Button, {
97
+ nostyle: true,
98
+ onClick: onCollapse,
99
+ focusable: true,
100
+ children: _jsx(IconMinus, {})
101
+ }), toggleFullscreen && _jsx(Button, {
102
+ nostyle: true,
103
+ onClick: () => setIsFullscreen(!isFullscreen),
104
+ focusable: true,
105
+ children: isFullscreen ? _jsx(IconFullscreenClose, {
106
+ size: "20px"
107
+ }) : _jsx(IconFullscreenOpen, {
108
+ size: "20px"
109
+ })
110
+ }), !hideCloseButton && _jsx(Button, {
111
+ nostyle: true,
112
+ onClick: setClose,
113
+ focusable: true,
114
+ children: _jsx(IconClose, {})
115
+ })]
116
+ }), _jsx(HeaderWrapper, {
117
+ css: headerCss,
118
+ withCollapse: hasCollapse,
119
+ ref: handleHeaderRef,
120
+ children: header && header
121
+ }), _jsx(ModalContent, {
122
+ css: contentCss,
123
+ scrollable: !disableScrollableContent,
124
+ ref: disableScrollableContent ? modalRef : undefined,
125
+ children: disableScrollableContent ? children : _jsx(ScrollableDiv, {
126
+ ref: modalRef,
127
+ hasActionButton: !!actionButton,
128
+ isFullscreen: isFullscreen,
129
+ windowHeight: window.innerHeight,
130
+ headerHeight: headerHeight,
131
+ children: children
104
132
  })
105
- }), !hideCloseButton && _jsx(Button, {
106
- nostyle: true,
107
- onClick: setClose,
108
- focusable: true,
109
- children: _jsx(IconClose, {})
133
+ }), actionButton && _jsx(ActionButtonWrapper, {
134
+ children: actionButton
110
135
  })]
111
- }), _jsx(HeaderWrapper, {
112
- css: headerCss,
113
- withCollapse: hasCollapse,
114
- ref: handleHeaderRef,
115
- children: header && header
116
- }), _jsx(ModalContent, {
117
- css: contentCss,
118
- scrollable: !disableScrollableContent,
119
- ref: disableScrollableContent ? modalRef : undefined,
120
- children: disableScrollableContent ? children : _jsx(ScrollableDiv, {
121
- ref: modalRef,
122
- hasActionButton: !!actionButton,
123
- isFullscreen: isFullscreen,
124
- windowHeight: window.innerHeight,
125
- headerHeight: headerHeight,
126
- children: children
127
- })
128
- }), actionButton && _jsx(ActionButtonWrapper, {
129
- children: actionButton
130
- })]
136
+ })
131
137
  })
132
138
  })
133
139
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/packages/core/Modal/index.tsx"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,OAAO,KAAsD,MAAM,OAAO,CAAA;AAkB1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAIjD,UAAU,MAAM;IACd,8BAA8B;IAC9B,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,sCAAsC;IACtC,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACxB,oCAAoC;IACpC,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC9B,kBAAkB;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,qCAAqC;IACrC,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,wBAAwB;IACxB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,kCAAkC;IAClC,UAAU,CAAC,EAAE,GAAG,EAAE,CAAA;IAClB,6CAA6C;IAC7C,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,8HAA8H;IAC9H,wBAAwB,CAAC,EAAE,O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AAC,EAAE,gBAAgB,CAAA;IAC7B,0BAA0B;IAC1B,SAAS,CAAC,EAAE,gBAAgB,CAAA;IAC5B,wCAAwC;IACxC,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,+CAA+C;IAC/C,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,0CAA0C;IAC1C,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,mCAAmC;IACnC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,4CAA4C;IAC5C,UAAU,CAAC,EAAE,MAAM,IAAI,CAAA;CACxB;AAED,QAAA,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,MAAM,CA+I3B,CAAA;AAED,eAAe,KAAK,CAAA"}
@@ -7,6 +7,7 @@ import IconClose from '../../icons/General/IconClose';
7
7
  import { Button, IconFullscreenClose } from '../..';
8
8
  import IconMinus from '../../icons/General/IconMinus';
9
9
  import IconFullscreenOpen from '../../icons/General/IconFullscreenOpen';
10
+ import FocusTrap from 'focus-trap-react';
10
11
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
11
12
  import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
12
13
 
@@ -82,52 +83,57 @@ const Modal = ({
82
83
  classNames: "overlay",
83
84
  children: _jsx(Overlay, {
84
85
  onClick: onOutsideClick,
85
- children: _jsxs(Content, {
86
- width: width,
87
- isFullscreen: isFullscreen,
88
- canToggleFullscreen: !!toggleFullscreen,
89
- onClick: e => e.stopPropagation(),
90
- children: [(!hideCloseButton || hasCollapse || toggleFullscreen) && _jsxs(CloseWrapper, {
91
- children: [hasCollapse && _jsx(Button, {
92
- nostyle: true,
93
- onClick: onCollapse,
94
- focusable: true,
95
- children: _jsx(IconMinus, {})
96
- }), toggleFullscreen && _jsx(Button, {
97
- nostyle: true,
98
- onClick: () => setIsFullscreen(!isFullscreen),
99
- focusable: true,
100
- children: isFullscreen ? _jsx(IconFullscreenClose, {
101
- size: "20px"
102
- }) : _jsx(IconFullscreenOpen, {
103
- size: "20px"
86
+ children: _jsx(FocusTrap, {
87
+ focusTrapOptions: {
88
+ allowOutsideClick: true
89
+ },
90
+ children: _jsxs(Content, {
91
+ width: width,
92
+ isFullscreen: isFullscreen,
93
+ canToggleFullscreen: !!toggleFullscreen,
94
+ onClick: e => e.stopPropagation(),
95
+ children: [(!hideCloseButton || hasCollapse || toggleFullscreen) && _jsxs(CloseWrapper, {
96
+ children: [hasCollapse && _jsx(Button, {
97
+ nostyle: true,
98
+ onClick: onCollapse,
99
+ focusable: true,
100
+ children: _jsx(IconMinus, {})
101
+ }), toggleFullscreen && _jsx(Button, {
102
+ nostyle: true,
103
+ onClick: () => setIsFullscreen(!isFullscreen),
104
+ focusable: true,
105
+ children: isFullscreen ? _jsx(IconFullscreenClose, {
106
+ size: "20px"
107
+ }) : _jsx(IconFullscreenOpen, {
108
+ size: "20px"
109
+ })
110
+ }), !hideCloseButton && _jsx(Button, {
111
+ nostyle: true,
112
+ onClick: setClose,
113
+ focusable: true,
114
+ children: _jsx(IconClose, {})
115
+ })]
116
+ }), _jsx(HeaderWrapper, {
117
+ css: headerCss,
118
+ withCollapse: hasCollapse,
119
+ ref: handleHeaderRef,
120
+ children: header && header
121
+ }), _jsx(ModalContent, {
122
+ css: contentCss,
123
+ scrollable: !disableScrollableContent,
124
+ ref: disableScrollableContent ? modalRef : undefined,
125
+ children: disableScrollableContent ? children : _jsx(ScrollableDiv, {
126
+ ref: modalRef,
127
+ hasActionButton: !!actionButton,
128
+ isFullscreen: isFullscreen,
129
+ windowHeight: window.innerHeight,
130
+ headerHeight: headerHeight,
131
+ children: children
104
132
  })
105
- }), !hideCloseButton && _jsx(Button, {
106
- nostyle: true,
107
- onClick: setClose,
108
- focusable: true,
109
- children: _jsx(IconClose, {})
133
+ }), actionButton && _jsx(ActionButtonWrapper, {
134
+ children: actionButton
110
135
  })]
111
- }), _jsx(HeaderWrapper, {
112
- css: headerCss,
113
- withCollapse: hasCollapse,
114
- ref: handleHeaderRef,
115
- children: header && header
116
- }), _jsx(ModalContent, {
117
- css: contentCss,
118
- scrollable: !disableScrollableContent,
119
- ref: disableScrollableContent ? modalRef : undefined,
120
- children: disableScrollableContent ? children : _jsx(ScrollableDiv, {
121
- ref: modalRef,
122
- hasActionButton: !!actionButton,
123
- isFullscreen: isFullscreen,
124
- windowHeight: window.innerHeight,
125
- headerHeight: headerHeight,
126
- children: children
127
- })
128
- }), actionButton && _jsx(ActionButtonWrapper, {
129
- children: actionButton
130
- })]
136
+ })
131
137
  })
132
138
  })
133
139
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbl-digital/snorre",
3
- "version": "2.3.27",
3
+ "version": "2.4.0",
4
4
  "description": "Design library for BBL Digital",
5
5
  "license": "MIT",
6
6
  "main": "./lib/index.js",
@@ -20,6 +20,7 @@
20
20
  "author": "bbl-digital",
21
21
  "dependencies": {
22
22
  "@tinymce/tinymce-react": "^3.13.1",
23
+ "focus-trap-react": "^9.0.1",
23
24
  "react-day-picker": "^7.4.8",
24
25
  "recharts": "^2.1.5"
25
26
  },
@@ -42,7 +43,8 @@
42
43
  "build:umd": "rollup --config",
43
44
  "test": "jest",
44
45
  "test:watch": "jest --watch",
45
- "npm-publish": "npm version patch && yarn run build && yarn run build:tsc && npm publish"
46
+ "npm-publish": "npm version patch && yarn run build && yarn run build:tsc && npm publish",
47
+ "npm-publish-minor": "npm version minor && yarn run build && yarn run build:tsc && npm publish"
46
48
  },
47
49
  "devDependencies": {
48
50
  "@babel/cli": "^7.14.5",