@entur/modal 1.7.71 → 1.7.73-beta.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.
package/dist/styles.css CHANGED
@@ -1,113 +1,5 @@
1
1
  /* DO NOT CHANGE!*/
2
2
  /* This file is automatically generated from @entur/tokens! Changes will be overwritten. */
3
- :root {
4
- --reach-dialog: 1;
5
- }
6
-
7
- .eds-modal__overlay {
8
- background: rgba(0, 0, 0, 0.5);
9
- bottom: 0;
10
- display: flex;
11
- left: 0;
12
- overflow: hidden;
13
- position: fixed;
14
- right: 0;
15
- top: 0;
16
- z-index: 30;
17
- animation: fadeInOverlay;
18
- animation-duration: 0.2s;
19
- animation-timing-function: ease-in-out;
20
- }
21
- .eds-modal__content {
22
- background: var(--components-modal-modal-standard-fill);
23
- border: 1px solid var(--components-modal-modal-standard-border);
24
- border-radius: 0.75rem;
25
- color: var(--components-modal-modal-standard-text);
26
- margin: auto;
27
- padding: 1.5rem;
28
- position: relative;
29
- width: 100%;
30
- max-height: 90vh;
31
- overflow: auto;
32
- z-index: 40;
33
- animation: slideInContent;
34
- animation-duration: 0.2s;
35
- animation-timing-function: ease-in-out;
36
- }
37
- .eds-modal__content--align-center {
38
- display: flex;
39
- flex-direction: column;
40
- align-items: center;
41
- text-align: center;
42
- }
43
- .eds-modal__content--align-end {
44
- display: flex;
45
- flex-direction: column;
46
- align-items: flex-end;
47
- }
48
- .eds-modal__content--size-extraSmall {
49
- max-width: 21rem;
50
- padding: 1.5rem;
51
- }
52
- .eds-modal__content--size-small {
53
- max-width: 28.125rem;
54
- padding: 2.5rem;
55
- }
56
- .eds-modal__content--size-medium {
57
- max-width: 45rem;
58
- padding: 3rem;
59
- }
60
- .eds-modal__content--size-large {
61
- max-width: 56.25rem;
62
- padding: 3rem;
63
- }
64
- .eds-modal__content--size-extraLarge {
65
- max-width: 78.75rem;
66
- padding: 3rem;
67
- }
68
- .eds-modal__content::-webkit-scrollbar {
69
- width: 16px;
70
- }
71
- .eds-modal__content::-webkit-scrollbar-track {
72
- margin-top: 0.5rem;
73
- margin-bottom: 0.5rem;
74
- }
75
- .eds-modal__content::-webkit-scrollbar-thumb {
76
- background-color: lightgrey;
77
- border: 4px solid transparent;
78
- border-radius: 8px;
79
- background-clip: padding-box;
80
- }
81
- .eds-modal__content::-webkit-scrollbar-thumb:hover {
82
- background-color: grey;
83
- }
84
- .eds-modal__close {
85
- position: absolute;
86
- top: 1rem;
87
- right: 1rem;
88
- color: var(--components-modal-modal-standard-icon);
89
- }
90
-
91
- @keyframes fadeInOverlay {
92
- from {
93
- opacity: 0;
94
- }
95
- to {
96
- opacity: 1;
97
- }
98
- }
99
- @keyframes slideInContent {
100
- from {
101
- top: 5rem;
102
- opacity: 0;
103
- }
104
- to {
105
- top: 0%;
106
- opacity: 1;
107
- }
108
- }
109
- /* DO NOT CHANGE!*/
110
- /* This file is automatically generated from @entur/tokens! Changes will be overwritten. */
111
3
  /* DO NOT CHANGE!*/
112
4
  /* This file is automatically generated from @entur/tokens! Changes will be overwritten. */
113
5
  /* DO NOT CHANGE!*/
@@ -282,8 +174,113 @@
282
174
 
283
175
  :root {
284
176
  --eds-modal: 1;
177
+ }/* DO NOT CHANGE!*/
178
+ /* This file is automatically generated from @entur/tokens! Changes will be overwritten. */
179
+ :root {
180
+ --reach-dialog: 1;
285
181
  }
286
- /* DO NOT CHANGE!*/
182
+
183
+ .eds-modal__overlay {
184
+ background: rgba(0, 0, 0, 0.5);
185
+ bottom: 0;
186
+ display: flex;
187
+ left: 0;
188
+ overflow: hidden;
189
+ position: fixed;
190
+ right: 0;
191
+ top: 0;
192
+ z-index: 30;
193
+ animation: fadeInOverlay;
194
+ animation-duration: 0.2s;
195
+ animation-timing-function: ease-in-out;
196
+ }
197
+ .eds-modal__content {
198
+ background: var(--components-modal-modal-standard-fill);
199
+ border: 1px solid var(--components-modal-modal-standard-border);
200
+ border-radius: 0.75rem;
201
+ color: var(--components-modal-modal-standard-text);
202
+ margin: auto;
203
+ padding: 1.5rem;
204
+ position: relative;
205
+ width: 100%;
206
+ max-height: 90vh;
207
+ overflow: auto;
208
+ z-index: 40;
209
+ animation: slideInContent;
210
+ animation-duration: 0.2s;
211
+ animation-timing-function: ease-in-out;
212
+ }
213
+ .eds-modal__content--align-center {
214
+ display: flex;
215
+ flex-direction: column;
216
+ align-items: center;
217
+ text-align: center;
218
+ }
219
+ .eds-modal__content--align-end {
220
+ display: flex;
221
+ flex-direction: column;
222
+ align-items: flex-end;
223
+ }
224
+ .eds-modal__content--size-extraSmall {
225
+ max-width: 21rem;
226
+ padding: 1.5rem;
227
+ }
228
+ .eds-modal__content--size-small {
229
+ max-width: 28.125rem;
230
+ padding: 2.5rem;
231
+ }
232
+ .eds-modal__content--size-medium {
233
+ max-width: 45rem;
234
+ padding: 3rem;
235
+ }
236
+ .eds-modal__content--size-large {
237
+ max-width: 56.25rem;
238
+ padding: 3rem;
239
+ }
240
+ .eds-modal__content--size-extraLarge {
241
+ max-width: 78.75rem;
242
+ padding: 3rem;
243
+ }
244
+ .eds-modal__content::-webkit-scrollbar {
245
+ width: 16px;
246
+ }
247
+ .eds-modal__content::-webkit-scrollbar-track {
248
+ margin-block: 0.5rem;
249
+ }
250
+ .eds-modal__content::-webkit-scrollbar-thumb {
251
+ background-color: lightgrey;
252
+ border: 4px solid transparent;
253
+ border-radius: 8px;
254
+ background-clip: padding-box;
255
+ }
256
+ .eds-modal__content::-webkit-scrollbar-thumb:hover {
257
+ background-color: grey;
258
+ }
259
+ .eds-modal__close {
260
+ position: absolute;
261
+ top: 1rem;
262
+ right: 1rem;
263
+ color: var(--components-modal-modal-standard-icon);
264
+ }
265
+
266
+ @keyframes fadeInOverlay {
267
+ from {
268
+ opacity: 0;
269
+ }
270
+ to {
271
+ opacity: 1;
272
+ }
273
+ }
274
+ @keyframes slideInContent {
275
+ from {
276
+ top: 5rem;
277
+ opacity: 0;
278
+ }
279
+ to {
280
+ top: 0%;
281
+ opacity: 1;
282
+ }
283
+ }/* DO NOT CHANGE!*/
287
284
  /* This file is automatically generated from @entur/tokens! Changes will be overwritten. */
288
285
  .eds-drawer {
289
286
  animation: slideFromRight forwards ease-out 0.1s;
@@ -320,4 +317,4 @@
320
317
  box-shadow: 0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.25);
321
318
  transform: 0;
322
319
  }
323
- }
320
+ }
package/package.json CHANGED
@@ -1,10 +1,18 @@
1
1
  {
2
2
  "name": "@entur/modal",
3
- "version": "1.7.71",
3
+ "version": "1.7.73-beta.0",
4
4
  "license": "EUPL-1.2",
5
- "main": "dist/index.js",
5
+ "main": "dist/modal.cjs.js",
6
6
  "module": "dist/modal.esm.js",
7
- "typings": "dist/index.d.ts",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/modal.esm.js",
12
+ "require": "./dist/modal.cjs.js"
13
+ },
14
+ "./dist/*": "./dist/*"
15
+ },
8
16
  "files": [
9
17
  "dist"
10
18
  ],
@@ -17,29 +25,39 @@
17
25
  "access": "public"
18
26
  },
19
27
  "scripts": {
20
- "start": "dts watch --noClean",
21
- "build": "dts build",
22
- "test": "dts test",
23
- "lint": "dts lint src"
28
+ "start": "vite build --watch",
29
+ "build": "vite build",
30
+ "test": "jest",
31
+ "lint": "eslint src"
24
32
  },
25
33
  "peerDependencies": {
26
34
  "react": ">=16.8.0",
27
35
  "react-dom": ">=16.8.0"
28
36
  },
29
37
  "dependencies": {
30
- "@entur/a11y": "^0.2.99",
31
- "@entur/button": "^3.3.11",
32
- "@entur/icons": "^7.14.0",
33
- "@entur/layout": "^3.1.7",
34
- "@entur/tokens": "^3.19.1",
35
- "@entur/typography": "^1.9.11",
36
- "@entur/utils": "^0.12.3",
37
- "@reach/dialog": "^0.16.0",
38
- "classnames": "^2.3.1",
39
- "react-focus-lock": "^2.9.1"
38
+ "@entur/a11y": "^0.2.100-beta.0",
39
+ "@entur/button": "^3.3.13-beta.0",
40
+ "@entur/icons": "^8.0.1-beta.0",
41
+ "@entur/layout": "^3.1.9-beta.0",
42
+ "@entur/tokens": "^3.19.2-beta.0",
43
+ "@entur/typography": "^1.9.13-beta.0",
44
+ "@entur/utils": "^0.12.4-beta.0",
45
+ "@reach/dialog": "^0.16.2",
46
+ "classnames": "^2.5.1",
47
+ "react-focus-lock": "^2.13.6"
40
48
  },
41
49
  "devDependencies": {
42
- "dts-cli": "2.0.5"
50
+ "@testing-library/jest-dom": "^5.17.0",
51
+ "@testing-library/react": "^10.4.9",
52
+ "@testing-library/user-event": "14.6.1",
53
+ "@vitejs/plugin-react": "^5.0.1",
54
+ "eslint": "^7.32.0",
55
+ "jest": "^29.0.0",
56
+ "jest-environment-jsdom": "^29.0.0",
57
+ "ts-jest": "^29.0.0",
58
+ "typescript": "^5.9.2",
59
+ "vite": "^7.1.3",
60
+ "vite-plugin-dts": "^4.5.4"
43
61
  },
44
- "gitHead": "c029bee6d513246d1576ab72b62c410a1afdebd4"
62
+ "gitHead": "414181fa2084722438238256a9aa32e304896b9d"
45
63
  }
package/dist/Drawer.d.ts DELETED
@@ -1,29 +0,0 @@
1
- import React from 'react';
2
- import './Drawer.scss';
3
- export type DrawerProps = {
4
- /** Innholdet. Typisk tekst, lenker eller knapper */
5
- children: React.ReactNode;
6
- /** Ekstra klassenavn */
7
- className?: string;
8
- /** Tekst som beskriver lukkeknappen for skjermlesere
9
- * @default 'Lukk skuff'
10
- */
11
- closeLabel?: string;
12
- /** Om draweren skal vises i mørk variant
13
- * @default false
14
- */
15
- contrast?: boolean;
16
- /** Callback som kalles når brukeren ønsker å lukke draweren */
17
- onDismiss: () => void;
18
- /** Om draweren er åpen eller ikke
19
- * @default true
20
- */
21
- open?: boolean;
22
- /** Tittel på toppen av draweren */
23
- title: string;
24
- /** Styling som sendes til Drawer */
25
- style?: React.CSSProperties;
26
- /** Legger på et overlay over resten av siden */
27
- overlay?: boolean;
28
- };
29
- export declare const Drawer: React.FC<DrawerProps>;
package/dist/Modal.d.ts DELETED
@@ -1,28 +0,0 @@
1
- import React from 'react';
2
- import './Modal.scss';
3
- export type ModalProps = {
4
- /** Innholdet i modalen */
5
- children: React.ReactNode;
6
- /** Skjermleser-label til lukk-knappen */
7
- closeLabel?: string;
8
- /** En ref til elementet som skal være fokusert når modalen åpnes. Defaulter til lukkeknappen */
9
- initialFocusRef?: React.RefObject<HTMLElement>;
10
- /** Flagg som sier om modalen er åpen */
11
- open?: boolean;
12
- /** Callback som kalles når brukeren ber om å lukke modalen */
13
- onDismiss?: () => void;
14
- /** Størrelsen på modalen */
15
- size: 'extraSmall' | 'small' | 'medium' | 'large' | 'extraLarge';
16
- /** Hvordan innholdet skal plasseres i modalen
17
- * @default 'start'
18
- */
19
- align?: 'start' | 'center' | 'end';
20
- /** Tittelen som vises i modalen */
21
- title?: React.ReactNode;
22
- /** Om modalen skal lukkes når man klikker på utsiden av den
23
- * @default true
24
- */
25
- closeOnClickOutside?: boolean;
26
- [key: string]: any;
27
- };
28
- export declare const Modal: React.FC<ModalProps>;
@@ -1,24 +0,0 @@
1
- import React from 'react';
2
- export type ModalContentProps = {
3
- /** Innholdet i modalen */
4
- children: React.ReactNode;
5
- /** Ekstra klassenavn */
6
- className?: string;
7
- /** Størrelsen på modalen */
8
- size: 'extraSmall' | 'small' | 'medium' | 'large' | 'extraLarge';
9
- /** Tittelen som vises i modalen */
10
- title?: React.ReactNode;
11
- /** Hvordan innholdet skal plasseres i modalen
12
- * @default 'start'
13
- */
14
- align?: 'start' | 'center' | 'end';
15
- [key: string]: any;
16
- };
17
- export declare const headingsMap: {
18
- extraSmall: <E extends React.ElementType = "h4">({ margin, children, as, ...rest }: import("@entur/typography").Heading4Props<E>) => JSX.Element;
19
- small: <E extends React.ElementType = "h3">({ margin, children, as, ...rest }: import("@entur/typography").Heading3Props<E>) => JSX.Element;
20
- medium: <E extends React.ElementType = "h2">({ margin, children, as, ...rest }: import("@entur/typography").Heading2Props<E>) => JSX.Element;
21
- large: <E extends React.ElementType = "h2">({ margin, children, as, ...rest }: import("@entur/typography").Heading2Props<E>) => JSX.Element;
22
- extraLarge: <E extends React.ElementType = "h2">({ margin, children, as, ...rest }: import("@entur/typography").Heading2Props<E>) => JSX.Element;
23
- };
24
- export declare const ModalContent: React.FC<ModalContentProps>;
@@ -1,15 +0,0 @@
1
- import React from 'react';
2
- export type ModalOverlayProps = {
3
- /** Flagg som sier om modalen er åpen */
4
- open?: boolean;
5
- /** Callback som kalles når brukeren ber om å lukke modalen */
6
- onDismiss?: () => void;
7
- /** Innholdet i modalen */
8
- children: React.ReactNode;
9
- /** Ekstra klassenavn */
10
- className?: string;
11
- /** En ref til elementet som skal være fokusert når modalen åpnes. Defaulter til lukkeknappen */
12
- initialFocusRef?: React.RefObject<HTMLElement>;
13
- [key: string]: any;
14
- };
15
- export declare const ModalOverlay: React.FC<ModalOverlayProps>;
package/dist/index.js DELETED
@@ -1,8 +0,0 @@
1
-
2
- 'use strict'
3
-
4
- if (process.env.NODE_ENV === 'production') {
5
- module.exports = require('./modal.cjs.production.min.js')
6
- } else {
7
- module.exports = require('./modal.cjs.development.js')
8
- }
@@ -1,181 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var utils = require('@entur/utils');
6
- var React = require('react');
7
- var icons = require('@entur/icons');
8
- var button = require('@entur/button');
9
- var typography = require('@entur/typography');
10
- var classNames = require('classnames');
11
- var dialog = require('@reach/dialog');
12
- var reactFocusLock = require('react-focus-lock');
13
- var layout = require('@entur/layout');
14
-
15
- function _extends() {
16
- return _extends = Object.assign ? Object.assign.bind() : function (n) {
17
- for (var e = 1; e < arguments.length; e++) {
18
- var t = arguments[e];
19
- for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
20
- }
21
- return n;
22
- }, _extends.apply(null, arguments);
23
- }
24
- function _objectWithoutPropertiesLoose(r, e) {
25
- if (null == r) return {};
26
- var t = {};
27
- for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
28
- if (e.includes(n)) continue;
29
- t[n] = r[n];
30
- }
31
- return t;
32
- }
33
-
34
- var _excluded$2 = ["className", "open"];
35
- var ModalOverlay = function ModalOverlay(_ref) {
36
- var className = _ref.className,
37
- open = _ref.open,
38
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
39
- return React.createElement(dialog.DialogOverlay, _extends({
40
- className: classNames('eds-modal__overlay', className),
41
- isOpen: open
42
- }, rest));
43
- };
44
-
45
- var _excluded$1 = ["children", "className", "size", "title", "align"];
46
- var headingsMap = {
47
- extraSmall: typography.Heading4,
48
- small: typography.Heading3,
49
- medium: typography.Heading2,
50
- large: typography.Heading2,
51
- extraLarge: typography.Heading2
52
- };
53
- var ModalContent = function ModalContent(_ref) {
54
- var children = _ref.children,
55
- className = _ref.className,
56
- size = _ref.size,
57
- title = _ref.title,
58
- _ref$align = _ref.align,
59
- align = _ref$align === void 0 ? 'start' : _ref$align,
60
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
61
- var Heading = headingsMap[size] || typography.Heading2;
62
- var randomId = utils.useRandomId('eds-modal');
63
- return React.createElement(dialog.DialogContent, _extends({
64
- className: classNames('eds-modal__content', "eds-modal__content--size-" + size, "eds-modal__content--align-" + align, className),
65
- "aria-labelledby": randomId
66
- }, rest), title && React.createElement(Heading, {
67
- margin: "bottom",
68
- as: "h2",
69
- id: randomId
70
- }, title), children);
71
- };
72
-
73
- var _excluded = ["children", "closeLabel", "initialFocusRef", "open", "onDismiss", "size", "align", "title", "closeOnClickOutside"];
74
- var Modal = function Modal(_ref) {
75
- var children = _ref.children,
76
- _ref$closeLabel = _ref.closeLabel,
77
- closeLabel = _ref$closeLabel === void 0 ? 'Lukk' : _ref$closeLabel,
78
- initialFocusRef = _ref.initialFocusRef,
79
- open = _ref.open,
80
- onDismiss = _ref.onDismiss,
81
- size = _ref.size,
82
- _ref$align = _ref.align,
83
- align = _ref$align === void 0 ? 'start' : _ref$align,
84
- title = _ref.title,
85
- _ref$closeOnClickOuts = _ref.closeOnClickOutside,
86
- closeOnClickOutside = _ref$closeOnClickOuts === void 0 ? true : _ref$closeOnClickOuts,
87
- rest = _objectWithoutPropertiesLoose(_ref, _excluded);
88
- var randomId = utils.useRandomId('eds-modal');
89
- var Heading = headingsMap[size] || typography.Heading2;
90
- var showCloseButton = ['medium', 'large', 'extraLarge'].includes(size);
91
- var handleOnDismiss;
92
- if (onDismiss && closeOnClickOutside) {
93
- handleOnDismiss = onDismiss;
94
- }
95
- return React.createElement(ModalOverlay, {
96
- open: open,
97
- onDismiss: handleOnDismiss,
98
- initialFocusRef: initialFocusRef
99
- }, React.createElement(ModalContent, _extends({
100
- size: size,
101
- align: align
102
- }, rest), showCloseButton && React.createElement(button.IconButton, {
103
- className: "eds-modal__close",
104
- "aria-label": closeLabel,
105
- onClick: onDismiss,
106
- type: "button"
107
- }, React.createElement(icons.CloseIcon, null)), title && React.createElement(Heading, {
108
- margin: "bottom",
109
- as: "h2",
110
- id: randomId
111
- }, title), children));
112
- };
113
-
114
- var Drawer = function Drawer(_ref) {
115
- var children = _ref.children,
116
- className = _ref.className,
117
- _ref$closeLabel = _ref.closeLabel,
118
- closeLabel = _ref$closeLabel === void 0 ? 'Lukk skuff' : _ref$closeLabel,
119
- _ref$contrast = _ref.contrast,
120
- contrast = _ref$contrast === void 0 ? false : _ref$contrast,
121
- _ref$open = _ref.open,
122
- open = _ref$open === void 0 ? true : _ref$open,
123
- onDismiss = _ref.onDismiss,
124
- title = _ref.title,
125
- style = _ref.style,
126
- _ref$overlay = _ref.overlay,
127
- overlay = _ref$overlay === void 0 ? false : _ref$overlay;
128
- var titleId = utils.useRandomId('eds-drawer');
129
- if (!open) {
130
- return null;
131
- }
132
- var handleKeyDown = function handleKeyDown(e) {
133
- if (e.key === 'Escape') {
134
- e.stopPropagation();
135
- onDismiss();
136
- }
137
- };
138
- var Wrapper = contrast ? layout.Contrast : React.Fragment;
139
- var ContentContainer = overlay ? dialog.DialogContent : 'div';
140
- return React.createElement(ConditionalWrapper, {
141
- condition: overlay,
142
- wrapper: function wrapper(children) {
143
- return React.createElement(ModalOverlay, {
144
- open: open,
145
- onDismiss: onDismiss
146
- }, children);
147
- }
148
- }, React.createElement(Wrapper, null, React.createElement(ContentContainer, {
149
- "aria-labelledby": titleId,
150
- className: classNames('eds-drawer', className),
151
- onKeyDown: handleKeyDown,
152
- style: style
153
- }, React.createElement(reactFocusLock.MoveFocusInside, null, React.createElement(button.IconButton, {
154
- className: "eds-drawer__close-button",
155
- onClick: onDismiss,
156
- type: "button",
157
- "aria-label": closeLabel
158
- }, React.createElement(icons.CloseIcon, {
159
- "aria-hidden": true
160
- })), React.createElement("div", {
161
- className: "eds-drawer__content"
162
- }, React.createElement(typography.Heading3, {
163
- as: "h2",
164
- id: titleId
165
- }, title), children)))));
166
- };
167
- var ConditionalWrapper = function ConditionalWrapper(_ref2) {
168
- var condition = _ref2.condition,
169
- wrapper = _ref2.wrapper,
170
- children = _ref2.children;
171
- return condition ? wrapper(children) : children;
172
- };
173
-
174
- utils.warnAboutMissingStyles('modal', 'icons', 'typography', 'a11y', 'button');
175
-
176
- exports.Drawer = Drawer;
177
- exports.Modal = Modal;
178
- exports.ModalContent = ModalContent;
179
- exports.ModalOverlay = ModalOverlay;
180
- exports.headingsMap = headingsMap;
181
- //# sourceMappingURL=modal.cjs.development.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"modal.cjs.development.js","sources":["../src/ModalOverlay.tsx","../src/ModalContent.tsx","../src/Modal.tsx","../src/Drawer.tsx","../src/index.tsx"],"sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\nimport { DialogOverlay } from '@reach/dialog';\n\nexport type ModalOverlayProps = {\n /** Flagg som sier om modalen er åpen */\n open?: boolean;\n /** Callback som kalles når brukeren ber om å lukke modalen */\n onDismiss?: () => void;\n /** Innholdet i modalen */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** En ref til elementet som skal være fokusert når modalen åpnes. Defaulter til lukkeknappen */\n initialFocusRef?: React.RefObject<HTMLElement>;\n [key: string]: any;\n};\n\nexport const ModalOverlay: React.FC<ModalOverlayProps> = ({\n className,\n open,\n ...rest\n}) => (\n <DialogOverlay\n className={classNames('eds-modal__overlay', className)}\n isOpen={open}\n {...rest}\n />\n);\n","import React from 'react';\nimport classNames from 'classnames';\nimport { DialogContent } from '@reach/dialog';\nimport { Heading4, Heading3, Heading2 } from '@entur/typography';\nimport { useRandomId } from '@entur/utils';\n\nexport type ModalContentProps = {\n /** Innholdet i modalen */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Størrelsen på modalen */\n size: 'extraSmall' | 'small' | 'medium' | 'large' | 'extraLarge';\n /** Tittelen som vises i modalen */\n title?: React.ReactNode;\n /** Hvordan innholdet skal plasseres i modalen\n * @default 'start'\n */\n align?: 'start' | 'center' | 'end';\n [key: string]: any;\n};\n\nexport const headingsMap = {\n extraSmall: Heading4,\n small: Heading3,\n medium: Heading2,\n large: Heading2,\n extraLarge: Heading2,\n};\n\nexport const ModalContent: React.FC<ModalContentProps> = ({\n children,\n className,\n size,\n title,\n align = 'start',\n ...rest\n}) => {\n const Heading: React.ElementType = headingsMap[size] || Heading2;\n const randomId = useRandomId('eds-modal');\n return (\n <DialogContent\n className={classNames(\n 'eds-modal__content',\n `eds-modal__content--size-${size}`,\n `eds-modal__content--align-${align}`,\n className,\n )}\n aria-labelledby={randomId}\n {...rest}\n >\n {title && (\n <Heading margin=\"bottom\" as=\"h2\" id={randomId}>\n {title}\n </Heading>\n )}\n {children}\n </DialogContent>\n );\n};\n","import React from 'react';\n\nimport { CloseIcon } from '@entur/icons';\nimport { IconButton } from '@entur/button';\nimport { Heading2 } from '@entur/typography';\nimport { useRandomId } from '@entur/utils';\n\nimport { ModalOverlay } from './ModalOverlay';\nimport { ModalContent, headingsMap } from './ModalContent';\n\nimport './Modal.scss';\n\nexport type ModalProps = {\n /** Innholdet i modalen */\n children: React.ReactNode;\n /** Skjermleser-label til lukk-knappen */\n closeLabel?: string;\n /** En ref til elementet som skal være fokusert når modalen åpnes. Defaulter til lukkeknappen */\n initialFocusRef?: React.RefObject<HTMLElement>;\n /** Flagg som sier om modalen er åpen */\n open?: boolean;\n /** Callback som kalles når brukeren ber om å lukke modalen */\n onDismiss?: () => void;\n /** Størrelsen på modalen */\n size: 'extraSmall' | 'small' | 'medium' | 'large' | 'extraLarge';\n /** Hvordan innholdet skal plasseres i modalen\n * @default 'start'\n */\n align?: 'start' | 'center' | 'end';\n /** Tittelen som vises i modalen */\n title?: React.ReactNode;\n /** Om modalen skal lukkes når man klikker på utsiden av den\n * @default true\n */\n closeOnClickOutside?: boolean;\n [key: string]: any;\n};\n\nexport const Modal: React.FC<ModalProps> = ({\n children,\n closeLabel = 'Lukk',\n initialFocusRef,\n open,\n onDismiss,\n size,\n align = 'start',\n title,\n closeOnClickOutside = true,\n ...rest\n}) => {\n const randomId = useRandomId('eds-modal');\n const Heading: React.ElementType = headingsMap[size] || Heading2;\n const showCloseButton = ['medium', 'large', 'extraLarge'].includes(size);\n\n let handleOnDismiss;\n if (onDismiss && closeOnClickOutside) {\n handleOnDismiss = onDismiss;\n }\n return (\n <ModalOverlay\n open={open}\n onDismiss={handleOnDismiss}\n initialFocusRef={initialFocusRef}\n >\n <ModalContent size={size} align={align} {...rest}>\n {showCloseButton && (\n <IconButton\n className=\"eds-modal__close\"\n aria-label={closeLabel}\n onClick={onDismiss}\n type=\"button\"\n >\n <CloseIcon />\n </IconButton>\n )}\n {title && (\n <Heading margin=\"bottom\" as=\"h2\" id={randomId}>\n {title}\n </Heading>\n )}\n {children}\n </ModalContent>\n </ModalOverlay>\n );\n};\n","import React from 'react';\nimport classNames from 'classnames';\nimport { MoveFocusInside } from 'react-focus-lock';\nimport { Contrast } from '@entur/layout';\nimport { CloseIcon } from '@entur/icons';\nimport { Heading3 } from '@entur/typography';\nimport { useRandomId } from '@entur/utils';\nimport { IconButton } from '@entur/button';\n\nimport './Drawer.scss';\nimport { ModalOverlay } from './ModalOverlay';\nimport { DialogContent } from '@reach/dialog';\n\nexport type DrawerProps = {\n /** Innholdet. Typisk tekst, lenker eller knapper */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Tekst som beskriver lukkeknappen for skjermlesere\n * @default 'Lukk skuff'\n */\n closeLabel?: string;\n /** Om draweren skal vises i mørk variant\n * @default false\n */\n contrast?: boolean;\n /** Callback som kalles når brukeren ønsker å lukke draweren */\n onDismiss: () => void;\n /** Om draweren er åpen eller ikke\n * @default true\n */\n open?: boolean;\n /** Tittel på toppen av draweren */\n title: string;\n /** Styling som sendes til Drawer */\n style?: React.CSSProperties;\n /** Legger på et overlay over resten av siden */\n overlay?: boolean;\n};\n\nexport const Drawer: React.FC<DrawerProps> = ({\n children,\n className,\n closeLabel = 'Lukk skuff',\n contrast = false,\n open = true,\n onDismiss,\n title,\n style,\n overlay = false,\n}) => {\n const titleId = useRandomId('eds-drawer');\n\n if (!open) {\n return null;\n }\n\n const handleKeyDown = (e: React.KeyboardEvent) => {\n if (e.key === 'Escape') {\n e.stopPropagation();\n onDismiss();\n }\n };\n\n const Wrapper = contrast ? Contrast : React.Fragment;\n const ContentContainer = overlay ? DialogContent : 'div';\n return (\n <ConditionalWrapper\n condition={overlay}\n wrapper={(children: React.ReactNode) => (\n <ModalOverlay open={open} onDismiss={onDismiss}>\n {children}\n </ModalOverlay>\n )}\n >\n <Wrapper>\n <ContentContainer\n aria-labelledby={titleId}\n className={classNames('eds-drawer', className)}\n onKeyDown={handleKeyDown}\n style={style}\n >\n <MoveFocusInside>\n <IconButton\n className=\"eds-drawer__close-button\"\n onClick={onDismiss}\n type=\"button\"\n aria-label={closeLabel}\n >\n <CloseIcon aria-hidden />\n </IconButton>\n <div className=\"eds-drawer__content\">\n <Heading3 as=\"h2\" id={titleId}>\n {title}\n </Heading3>\n {children}\n </div>\n </MoveFocusInside>\n </ContentContainer>\n </Wrapper>\n </ConditionalWrapper>\n );\n};\n\nconst ConditionalWrapper: React.FC<{\n condition: boolean;\n wrapper: (child: JSX.Element) => JSX.Element;\n children: React.ReactElement;\n}> = ({ condition, wrapper, children }) =>\n condition ? wrapper(children) : children;\n","import { warnAboutMissingStyles } from '@entur/utils';\nimport './index.scss';\n\nwarnAboutMissingStyles('modal', 'icons', 'typography', 'a11y', 'button');\n\nexport * from './Modal';\nexport * from './ModalOverlay';\nexport * from './ModalContent';\nexport * from './Drawer';\n"],"names":["ModalOverlay","_ref","className","open","rest","_objectWithoutPropertiesLoose","_excluded","React","createElement","DialogOverlay","_extends","classNames","isOpen","headingsMap","extraSmall","Heading4","small","Heading3","medium","Heading2","large","extraLarge","ModalContent","children","size","title","_ref$align","align","Heading","randomId","useRandomId","DialogContent","margin","as","id","Modal","_ref$closeLabel","closeLabel","initialFocusRef","onDismiss","_ref$closeOnClickOuts","closeOnClickOutside","showCloseButton","includes","handleOnDismiss","IconButton","onClick","type","CloseIcon","Drawer","_ref$contrast","contrast","_ref$open","style","_ref$overlay","overlay","titleId","handleKeyDown","e","key","stopPropagation","Wrapper","Contrast","Fragment","ContentContainer","ConditionalWrapper","condition","wrapper","onKeyDown","MoveFocusInside","_ref2","warnAboutMissingStyles"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAkBaA,YAAY,GAAgC,SAA5CA,YAAYA,CAAAC,IAAA,EAAA;AAAA,EAAA,IACvBC,SAAS,GAAAD,IAAA,CAATC,SAAS;IACTC,IAAI,GAAAF,IAAA,CAAJE,IAAI;AACDC,IAAAA,IAAI,GAAAC,6BAAA,CAAAJ,IAAA,EAAAK,WAAA,CAAA,CAAA;AAAA,EAAA,OAEPC,KAAA,CAAAC,aAAA,CAACC,oBAAa,EAAAC,QAAA,CAAA;AACZR,IAAAA,SAAS,EAAES,UAAU,CAAC,oBAAoB,EAAET,SAAS,CAAC;AACtDU,IAAAA,MAAM,EAAET,IAAAA;GACJC,EAAAA,IAAI,CAAA,CACR,CAAA;AAAA;;;ACLG,IAAM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,SAAS,EAAES,UAAU,CAAC,YAAY,EAAET,SAAS,CAAC;AAC9CkE,IAAAA,SAAS,EAAEX,aAAa;AACxBJ,IAAAA,KAAK,EAAEA,KAAAA;AAAK,GAAA,EAEZ9C,KAAA,CAAAC,aAAA,CAAC6D,8BAAe,EAAA,IAAA,EACd9D,KAAA,CAAAC,aAAA,CAACqC,iBAAU,EAAA;AACT3C,IAAAA,SAAS,EAAC,0BAA0B;AACpC4C,IAAAA,OAAO,EAAEP,SAAS;AAClBQ,IAAAA,IAAI,EAAC,QAAQ;kBACDV,UAAAA;AAAU,GAAA,EAEtB9B,KAAC,CAAAC,aAAA,CAAAwC,eAAS;;IAAe,CACd,EACbzC,KAAK,CAAAC,aAAA,CAAA,KAAA,EAAA;AAAAN,IAAAA,SAAS,EAAC,qBAAA;AAAqB,GAAA,EAClCK,KAAC,CAAAC,aAAA,CAAAS,mBAAQ,EAAC;AAAAgB,IAAAA,EAAE,EAAC,IAAI;AAACC,IAAAA,EAAE,EAAEsB,OAAAA;GACnB,EAAA/B,KAAK,CACG,EACVF,QAAQ,CACL,CACU,CACD,CACX,CACS,CAAA;AAEzB,EAAC;AAED,IAAM0C,kBAAkB,GAInB,SAJCA,kBAAkBA,CAAAK,KAAA,EAAA;AAAA,EAAA,IAIhBJ,SAAS,GAAAI,KAAA,CAATJ,SAAS;IAAEC,OAAO,GAAAG,KAAA,CAAPH,OAAO;IAAE5C,QAAQ,GAAA+C,KAAA,CAAR/C,QAAQ,CAAA;AAAA,EAAA,OAClC2C,SAAS,GAAGC,OAAO,CAAC5C,QAAQ,CAAC,GAAGA,QAAQ,CAAA;AAAA,CAAA;;AC1G1CgD,4BAAsB,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,CAAC;;;;;;;;"}
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@entur/utils"),n=require("react"),a=require("@entur/icons"),t=require("@entur/button"),r=require("@entur/typography"),i=require("classnames"),l=require("@reach/dialog"),o=require("react-focus-lock"),s=require("@entur/layout");function c(){return c=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var a=arguments[n];for(var t in a)({}).hasOwnProperty.call(a,t)&&(e[t]=a[t])}return e},c.apply(null,arguments)}function d(e,n){if(null==e)return{};var a={};for(var t in e)if({}.hasOwnProperty.call(e,t)){if(n.includes(t))continue;a[t]=e[t]}return a}var u=["className","open"],m=function(e){var a=e.className,t=e.open,r=d(e,u);return n.createElement(l.DialogOverlay,c({className:i("eds-modal__overlay",a),isOpen:t},r))},g=["children","className","size","title","align"],p={extraSmall:r.Heading4,small:r.Heading3,medium:r.Heading2,large:r.Heading2,extraLarge:r.Heading2},v=function(a){var t=a.children,o=a.className,s=a.size,u=a.title,m=a.align,v=void 0===m?"start":m,f=d(a,g),y=p[s]||r.Heading2,b=e.useRandomId("eds-modal");return n.createElement(l.DialogContent,c({className:i("eds-modal__content","eds-modal__content--size-"+s,"eds-modal__content--align-"+v,o),"aria-labelledby":b},f),u&&n.createElement(y,{margin:"bottom",as:"h2",id:b},u),t)},f=["children","closeLabel","initialFocusRef","open","onDismiss","size","align","title","closeOnClickOutside"],y=function(e){var n=e.children;return e.condition?(0,e.wrapper)(n):n};e.warnAboutMissingStyles("modal","icons","typography","a11y","button"),exports.Drawer=function(c){var d=c.children,u=c.className,g=c.closeLabel,p=void 0===g?"Lukk skuff":g,v=c.contrast,f=void 0!==v&&v,b=c.open,E=void 0===b||b,h=c.onDismiss,_=c.title,O=c.style,k=c.overlay,w=void 0!==k&&k,N=e.useRandomId("eds-drawer");return E?n.createElement(y,{condition:w,wrapper:function(e){return n.createElement(m,{open:E,onDismiss:h},e)}},n.createElement(f?s.Contrast:n.Fragment,null,n.createElement(w?l.DialogContent:"div",{"aria-labelledby":N,className:i("eds-drawer",u),onKeyDown:function(e){"Escape"===e.key&&(e.stopPropagation(),h())},style:O},n.createElement(o.MoveFocusInside,null,n.createElement(t.IconButton,{className:"eds-drawer__close-button",onClick:h,type:"button","aria-label":p},n.createElement(a.CloseIcon,{"aria-hidden":!0})),n.createElement("div",{className:"eds-drawer__content"},n.createElement(r.Heading3,{as:"h2",id:N},_),d))))):null},exports.Modal=function(i){var l,o=i.children,s=i.closeLabel,u=void 0===s?"Lukk":s,g=i.initialFocusRef,y=i.open,b=i.onDismiss,E=i.size,h=i.align,_=void 0===h?"start":h,O=i.title,k=i.closeOnClickOutside,w=void 0===k||k,N=d(i,f),C=e.useRandomId("eds-modal"),D=p[E]||r.Heading2,q=["medium","large","extraLarge"].includes(E);return b&&w&&(l=b),n.createElement(m,{open:y,onDismiss:l,initialFocusRef:g},n.createElement(v,c({size:E,align:_},N),q&&n.createElement(t.IconButton,{className:"eds-modal__close","aria-label":u,onClick:b,type:"button"},n.createElement(a.CloseIcon,null)),O&&n.createElement(D,{margin:"bottom",as:"h2",id:C},O),o))},exports.ModalContent=v,exports.ModalOverlay=m,exports.headingsMap=p;
2
- //# sourceMappingURL=modal.cjs.production.min.js.map