@entur/modal 1.6.19 → 1.6.21

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/LICENSE.md CHANGED
@@ -208,74 +208,3 @@ The European Commission may update this Appendix to later versions of the above
208
208
  a new version of the EUPL, as long as they provide the rights granted in Article 2 of this Licence and protect the
209
209
  covered Source Code from exclusive appropriation.
210
210
  All other changes or additions to this Appendix require the production of a new EUPL version.
211
-
212
- # Standard Nucleo License
213
-
214
- - Last updated: July 2, 2018
215
- - [Github repo](https://github.com/NucleoApp/license-standard)
216
-
217
- By purchasing the Nucleo icons, you have the right to:
218
-
219
- - Use the Nucleo icons in unlimited personal and commercial projects, for yourself or a client, with no limitation to the number of impressions for your end product.
220
- - Use the Nucleo icons in applications, software, UI/UX design, print, and logo design.
221
- - Modify the Nucleo icons to create your icon variations.
222
-
223
- You don't have the right to:
224
-
225
- - Sublicense, resell, share, transfer, or otherwise redistribute the Nucleo icons (even for free or within a more complex downloadable file).
226
- - Use the Nucleo icons in a product that is directly competitive with Nucleo.
227
-
228
- ## Limitations & Extended license
229
-
230
- - **For each project, you can use a maximum of 250 Nucleo icons** (intended per unique style: for example, if you're using the same icon in both the outline and glyph styles, or in 2 different sizes, you're using 2 icons). You can lift this limit by purchasing an Extended License.
231
- - If you're using Nucleo icons in templates, themes or plugins offered for sale, you can use a maximum of 100 Nucleo icons. You can lift this limit by purchasing an Extended License.
232
- - If you're using the Nucleo icons in open source projects, you can use a maximum of 100 Nucleo icons.
233
- - If you're interested in using the Nucleo icons in items offered for sale (or for free) where the Nucleo icons contribute to the core value of the product being sold/shared, you will need an Extended License (e.g., a CMS where users can browse the Nucleo icons and pick the ones to include in their design).
234
-
235
- [Learn more about the Extended License](https://nucleoapp.com/extended-license)
236
-
237
- ## Freelance Projects & Contracted work
238
-
239
- If you're working on a project for a client, you can share with your client a maximum of 250 Nucleo icons per project. You can't share the Nucleo source files unless the client purchases a license.
240
-
241
- If the Nucleo icons contribute to the core value of the product being sold/shared, or if you (or your client) wish to include more than 250 icons in the project, the [Extended License](https://nucleoapp.com/extended-license) is required.
242
-
243
- ## Templates, Themes, UI Kits & Plugins
244
-
245
- If you're using Nucleo icons in templates, themes or plugins offered for sale (e.g., UI kits, Wordpress Themes, HTML/CSS Templates), **you can include up to 100 icons in the downloadable source files**. This limitation applies to the icon fonts as well.
246
-
247
- The downloadable source file has to include the [Nucleo Copyright Notice](https://nucleoapp.com/copyright-notice).
248
-
249
- If the Nucleo icons contribute to the core value of the template, theme or plugin sold (e.g., a theme builder where users can browse Nucleo icons and pick the ones to include in their design), or if you wish to use more than 100 Nucleo icons, you will need an [Extended License](https://nucleoapp.com/extended-license).
250
-
251
- It's not possible to purchase an Extended License if the template, theme or plugin is distributed for free.
252
-
253
- If you're offering a free and pro version of your product, the free version cannot include more than 100 icons even if you purchased an Extended License to lift the limit. The Extended License applies only to the pro version of your product.
254
-
255
- ## Open source projects
256
-
257
- If you're using the Nucleo icons in open source projects, **you can include up to 100 icons in the downloadable source files**. This limitation applies to the icon fonts as well.
258
-
259
- The downloadable source file has to include the [Nucleo Copyright Notice](https://nucleoapp.com/copyright-notice).
260
-
261
- It's not possible to purchase an Extended License for open source projects.
262
-
263
- ## Sharing Nucleo icons with team members
264
-
265
- If you're the sole owner of a Nucleo license, you can share with your team members only the icons used in your work, with a maximum of 250 icons (e.g., if you're a designer, you can share with the developers of your team only the Nucleo icons used in your design files).
266
-
267
- Your team members cannot reuse the Nucleo icons in other projects unless they purchase a license.
268
-
269
- If more than one team member needs access to the Nucleo icons, you can consider purchasing a [team license](https://nucleoapp.com/pricing).
270
-
271
- ## Design systems
272
-
273
- If you wish to include the Nucleo icons in a design system available on a public server, you can use a maximum of 250 Nucleo icons, even if your team purchased a Nucleo team license.
274
-
275
- If the design system is accessible only by the members of your organization (e.g., is hosted on a password protected server), but you're the sole owner of a Nucleo license, you can share with your colleagues a maximum of 250 Nucleo icons.
276
-
277
- If the design system is on a public server, you can lift the 250 icons limit by buying an [Extended License](https://nucleoapp.com/extended-license). However, please keep in mind you can't provide a link/button to download all the icons.
278
-
279
- If your team purchased a Nucleo team license that covers all the users with access to the design system, and the design system is not public (e.g., is hosted on a password protected server), then there's no limitation to the number of icons that can be included.
280
-
281
- If you're still unclear about what is or isn't allowed under this license, please contact us at info@nucleoapp.com.
package/dist/Drawer.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import './Drawer.scss';
3
- export declare type DrawerProps = {
3
+ export type DrawerProps = {
4
4
  /** Innholdet. Typisk tekst, lenker eller knapper */
5
5
  children: React.ReactNode;
6
6
  /** Ekstra klassenavn */
package/dist/Modal.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import './Modal.scss';
3
- export declare type ModalProps = {
3
+ export type ModalProps = {
4
4
  /** Innholdet i modalen */
5
5
  children: React.ReactNode;
6
6
  /** Skjermleser-label til lukk-knappen */
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- export declare type ModalContentProps = {
2
+ export type ModalContentProps = {
3
3
  /** Innholdet i modalen */
4
4
  children: React.ReactNode;
5
5
  /** Ekstra klassenavn */
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- export declare type ModalOverlayProps = {
2
+ export type ModalOverlayProps = {
3
3
  /** Flagg som sier om modalen er åpen */
4
4
  open?: boolean;
5
5
  /** Callback som kalles når brukeren ber om å lukke modalen */
@@ -19,44 +19,37 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
19
19
  var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
20
20
 
21
21
  function _extends() {
22
- _extends = Object.assign || function (target) {
22
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
23
23
  for (var i = 1; i < arguments.length; i++) {
24
24
  var source = arguments[i];
25
-
26
25
  for (var key in source) {
27
26
  if (Object.prototype.hasOwnProperty.call(source, key)) {
28
27
  target[key] = source[key];
29
28
  }
30
29
  }
31
30
  }
32
-
33
31
  return target;
34
32
  };
35
-
36
33
  return _extends.apply(this, arguments);
37
34
  }
38
-
39
35
  function _objectWithoutPropertiesLoose(source, excluded) {
40
36
  if (source == null) return {};
41
37
  var target = {};
42
38
  var sourceKeys = Object.keys(source);
43
39
  var key, i;
44
-
45
40
  for (i = 0; i < sourceKeys.length; i++) {
46
41
  key = sourceKeys[i];
47
42
  if (excluded.indexOf(key) >= 0) continue;
48
43
  target[key] = source[key];
49
44
  }
50
-
51
45
  return target;
52
46
  }
53
47
 
54
48
  var _excluded$2 = ["className", "open"];
55
49
  var ModalOverlay = function ModalOverlay(_ref) {
56
50
  var className = _ref.className,
57
- open = _ref.open,
58
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
59
-
51
+ open = _ref.open,
52
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
60
53
  return React__default["default"].createElement(dialog.DialogOverlay, _extends({
61
54
  className: classNames__default["default"]('eds-modal__overlay', className),
62
55
  isOpen: open
@@ -73,11 +66,10 @@ var headingsMap = {
73
66
  };
74
67
  var ModalContent = function ModalContent(_ref) {
75
68
  var children = _ref.children,
76
- className = _ref.className,
77
- size = _ref.size,
78
- title = _ref.title,
79
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
80
-
69
+ className = _ref.className,
70
+ size = _ref.size,
71
+ title = _ref.title,
72
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
81
73
  var Heading = headingsMap[size] || typography.Heading2;
82
74
  var randomId = utils.useRandomId('eds-modal');
83
75
  return React__default["default"].createElement(dialog.DialogContent, _extends({
@@ -93,23 +85,20 @@ var ModalContent = function ModalContent(_ref) {
93
85
  var _excluded = ["children", "closeLabel", "initialFocusRef", "open", "onDismiss", "size", "closeOnClickOutside"];
94
86
  var Modal = function Modal(_ref) {
95
87
  var children = _ref.children,
96
- _ref$closeLabel = _ref.closeLabel,
97
- closeLabel = _ref$closeLabel === void 0 ? 'Lukk' : _ref$closeLabel,
98
- initialFocusRef = _ref.initialFocusRef,
99
- open = _ref.open,
100
- onDismiss = _ref.onDismiss,
101
- size = _ref.size,
102
- _ref$closeOnClickOuts = _ref.closeOnClickOutside,
103
- closeOnClickOutside = _ref$closeOnClickOuts === void 0 ? true : _ref$closeOnClickOuts,
104
- rest = _objectWithoutPropertiesLoose(_ref, _excluded);
105
-
88
+ _ref$closeLabel = _ref.closeLabel,
89
+ closeLabel = _ref$closeLabel === void 0 ? 'Lukk' : _ref$closeLabel,
90
+ initialFocusRef = _ref.initialFocusRef,
91
+ open = _ref.open,
92
+ onDismiss = _ref.onDismiss,
93
+ size = _ref.size,
94
+ _ref$closeOnClickOuts = _ref.closeOnClickOutside,
95
+ closeOnClickOutside = _ref$closeOnClickOuts === void 0 ? true : _ref$closeOnClickOuts,
96
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded);
106
97
  var showCloseButton = ['medium', 'large', 'extraLarge'].includes(size);
107
98
  var handleOnDismiss;
108
-
109
99
  if (onDismiss && closeOnClickOutside) {
110
100
  handleOnDismiss = onDismiss;
111
101
  }
112
-
113
102
  return React__default["default"].createElement(ModalOverlay, {
114
103
  open: open,
115
104
  onDismiss: handleOnDismiss,
@@ -125,31 +114,28 @@ var Modal = function Modal(_ref) {
125
114
 
126
115
  var Drawer = function Drawer(_ref) {
127
116
  var children = _ref.children,
128
- className = _ref.className,
129
- _ref$closeLabel = _ref.closeLabel,
130
- closeLabel = _ref$closeLabel === void 0 ? 'Lukk skuff' : _ref$closeLabel,
131
- _ref$contrast = _ref.contrast,
132
- contrast = _ref$contrast === void 0 ? false : _ref$contrast,
133
- _ref$open = _ref.open,
134
- open = _ref$open === void 0 ? true : _ref$open,
135
- onDismiss = _ref.onDismiss,
136
- title = _ref.title,
137
- style = _ref.style,
138
- _ref$overlay = _ref.overlay,
139
- overlay = _ref$overlay === void 0 ? false : _ref$overlay;
117
+ className = _ref.className,
118
+ _ref$closeLabel = _ref.closeLabel,
119
+ closeLabel = _ref$closeLabel === void 0 ? 'Lukk skuff' : _ref$closeLabel,
120
+ _ref$contrast = _ref.contrast,
121
+ contrast = _ref$contrast === void 0 ? false : _ref$contrast,
122
+ _ref$open = _ref.open,
123
+ open = _ref$open === void 0 ? true : _ref$open,
124
+ onDismiss = _ref.onDismiss,
125
+ title = _ref.title,
126
+ style = _ref.style,
127
+ _ref$overlay = _ref.overlay,
128
+ overlay = _ref$overlay === void 0 ? false : _ref$overlay;
140
129
  var titleId = utils.useRandomId('eds-drawer');
141
-
142
130
  if (!open) {
143
131
  return null;
144
132
  }
145
-
146
133
  var handleKeyDown = function handleKeyDown(e) {
147
134
  if (e.key === 'Escape') {
148
135
  e.stopPropagation();
149
136
  onDismiss();
150
137
  }
151
138
  };
152
-
153
139
  var Wrapper = contrast ? layout.Contrast : React__default["default"].Fragment;
154
140
  var ContentContainer = overlay ? dialog.DialogContent : 'div';
155
141
  return React__default["default"].createElement(ConditionalWrapper, {
@@ -178,11 +164,10 @@ var Drawer = function Drawer(_ref) {
178
164
  "aria-hidden": true
179
165
  }), React__default["default"].createElement(a11y.VisuallyHidden, null, closeLabel))))));
180
166
  };
181
-
182
167
  var ConditionalWrapper = function ConditionalWrapper(_ref2) {
183
168
  var condition = _ref2.condition,
184
- wrapper = _ref2.wrapper,
185
- children = _ref2.children;
169
+ wrapper = _ref2.wrapper,
170
+ children = _ref2.children;
186
171
  return condition ? wrapper(children) : children;
187
172
  };
188
173
 
@@ -1 +1 @@
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?: string;\n [key: string]: any;\n};\n\nconst 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 ...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 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';\nimport { CloseIcon } from '@entur/icons';\nimport { ModalOverlay } from './ModalOverlay';\nimport { ModalContent } from './ModalContent';\nimport { IconButton } from '@entur/button';\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 /** Tittelen som vises i modalen */\n title: string;\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 closeOnClickOutside = true,\n ...rest\n}) => {\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} {...rest}>\n {showCloseButton && (\n <IconButton\n className=\"eds-modal__close\"\n aria-label={closeLabel}\n onClick={onDismiss}\n >\n <CloseIcon />\n </IconButton>\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 { VisuallyHidden } from '@entur/a11y';\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 <div className=\"eds-drawer__content\">\n <Heading3 as=\"h2\" id={titleId}>\n {title}\n </Heading3>\n {children}\n </div>\n <IconButton\n className=\"eds-drawer__close-button\"\n onClick={onDismiss}\n type=\"button\"\n >\n <CloseIcon aria-hidden />\n <VisuallyHidden>{closeLabel}</VisuallyHidden>\n </IconButton>\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","className","open","rest","React","DialogOverlay","classNames","isOpen","headingsMap","extraSmall","Heading4","small","Heading3","medium","Heading2","large","extraLarge","ModalContent","children","size","title","Heading","randomId","useRandomId","DialogContent","margin","as","id","Modal","closeLabel","initialFocusRef","onDismiss","closeOnClickOutside","showCloseButton","includes","handleOnDismiss","IconButton","onClick","CloseIcon","Drawer","contrast","style","overlay","titleId","handleKeyDown","e","key","stopPropagation","Wrapper","Contrast","Fragment","ContentContainer","ConditionalWrapper","condition","wrapper","onKeyDown","MoveFocusInside","type","VisuallyHidden","warnAboutMissingStyles"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAkBaA,YAAY,GAAgC,SAA5CA,YAA4C;AAAA,MACvDC,SADuD,QACvDA,SADuD;AAAA,MAEvDC,IAFuD,QAEvDA,IAFuD;AAAA,MAGpDC,IAHoD;;AAAA,SAKvDC,uCAAA,CAACC,oBAAD;AACEJ,IAAAA,SAAS,EAAEK,8BAAU,CAAC,oBAAD,EAAuBL,SAAvB,CADvB;AAEEM,IAAAA,MAAM,EAAEL;AAFV,KAGMC,IAHN,EALuD;AAAA;;;ACAzD,IAAMK,WAAW,GAAG;AAClBC,EAAAA,UAAU,EAAEC,mBADM;AAElBC,EAAAA,KAAK,EAAEC,mBAFW;AAGlBC,EAAAA,MAAM,EAAEC,mBAHU;AAIlBC,EAAAA,KAAK,EAAED,mBAJW;AAKlBE,EAAAA,UAAU,EAAEF;AALM,CAApB;IAQaG,YAAY,GAAgC,SAA5CA,YAA4C;MACvDC,gBAAAA;MACAjB,iBAAAA;MACAkB,YAAAA;MACAC,aAAAA;MACGjB;;AAEH,MAAMkB,OAAO,GAAsBb,WAAW,CAACW,IAAD,CAAX,IAAqBL,mBAAxD;AACA,MAAMQ,QAAQ,GAAGC,iBAAW,CAAC,WAAD,CAA5B;AACA,SACEnB,uCAAA,CAACoB,oBAAD;AACEvB,IAAAA,SAAS,EAAEK,8BAAU,CACnB,oBADmB,gCAESa,IAFT,EAGnBlB,SAHmB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ARF,CADF;AAoCD;;AAED,IAAMuB,kBAAkB,GAInB,SAJCA,kBAID;AAAA,MAAGC,SAAH,SAAGA,SAAH;AAAA,MAAcC,OAAd,SAAcA,OAAd;AAAA,MAAuBpC,QAAvB,SAAuBA,QAAvB;AAAA,SACHmC,SAAS,GAAGC,OAAO,CAACpC,QAAD,CAAV,GAAuBA,QAD7B;AAAA,CAJL;;ACtGAyC,4BAAsB,CAAC,OAAD,EAAU,OAAV,EAAmB,YAAnB,EAAiC,MAAjC,EAAyC,QAAzC,CAAtB;;;;;;;"}
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?: string;\n [key: string]: any;\n};\n\nconst 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 ...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 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';\nimport { CloseIcon } from '@entur/icons';\nimport { ModalOverlay } from './ModalOverlay';\nimport { ModalContent } from './ModalContent';\nimport { IconButton } from '@entur/button';\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 /** Tittelen som vises i modalen */\n title: string;\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 closeOnClickOutside = true,\n ...rest\n}) => {\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} {...rest}>\n {showCloseButton && (\n <IconButton\n className=\"eds-modal__close\"\n aria-label={closeLabel}\n onClick={onDismiss}\n >\n <CloseIcon />\n </IconButton>\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 { VisuallyHidden } from '@entur/a11y';\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 <div className=\"eds-drawer__content\">\n <Heading3 as=\"h2\" id={titleId}>\n {title}\n </Heading3>\n {children}\n </div>\n <IconButton\n className=\"eds-drawer__close-button\"\n onClick={onDismiss}\n type=\"button\"\n >\n <CloseIcon aria-hidden />\n <VisuallyHidden>{closeLabel}</VisuallyHidden>\n </IconButton>\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","className","open","rest","_excluded","React","createElement","DialogOverlay","classNames","isOpen","headingsMap","extraSmall","Heading4","small","Heading3","medium","Heading2","large","extraLarge","ModalContent","children","size","title","Heading","randomId","useRandomId","DialogContent","margin","as","id","Modal","closeLabel","initialFocusRef","onDismiss","closeOnClickOutside","showCloseButton","includes","handleOnDismiss","IconButton","onClick","CloseIcon","Drawer","contrast","style","overlay","titleId","handleKeyDown","e","key","stopPropagation","Wrapper","Contrast","Fragment","ContentContainer","ConditionalWrapper","condition","wrapper","onKeyDown","MoveFocusInside","type","VisuallyHidden","warnAboutMissingStyles"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBaA,IAAAA,YAAY,GAAgC,SAA5CA,YAAY,CAAA,IAAA,EAAA;EAAA,IACvBC,SAAS,QAATA,SAAS;AACTC,IAAAA,IAAI,QAAJA,IAAI;IACDC,IAAI,G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AAc,EAAE,IAAA,EAAA7B,UAAU,CAAkB,CAClC,CACG,CACD,CACX,CACS,CAAA;AAEzB,EAAC;AAED,IAAMuB,kBAAkB,GAInB,SAJCA,kBAAkB,CAAA,KAAA,EAAA;EAAA,IAIhBC,SAAS,SAATA,SAAS;AAAEC,IAAAA,OAAO,SAAPA,OAAO;AAAEpC,IAAAA,QAAQ,SAARA,QAAQ,CAAA;AAAA,EAAA,OAClCmC,SAAS,GAAGC,OAAO,CAACpC,QAAQ,CAAC,GAAGA,QAAQ,CAAA;AAAA,CAAA;;AC3G1CyC,4BAAsB,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,CAAC;;;;;;;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@entur/utils"),t=require("react"),a=require("@entur/icons"),n=require("classnames"),l=require("@reach/dialog"),r=require("@entur/typography"),o=require("@entur/button"),i=require("react-focus-lock"),s=require("@entur/a11y"),u=require("@entur/layout");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=d(t),m=d(n);function f(){return f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},f.apply(this,arguments)}function p(e,t){if(null==e)return{};var a,n,l={},r=Object.keys(e);for(n=0;n<r.length;n++)t.indexOf(a=r[n])>=0||(l[a]=e[a]);return l}var v=["className","open"],y=function(e){var t=e.className,a=e.open,n=p(e,v);return c.default.createElement(l.DialogOverlay,f({className:m.default("eds-modal__overlay",t),isOpen:a},n))},g=["children","className","size","title"],b={extraSmall:r.Heading4,small:r.Heading3,medium:r.Heading2,large:r.Heading2,extraLarge:r.Heading2},E=function(t){var a=t.children,n=t.className,o=t.size,i=t.title,s=p(t,g),u=b[o]||r.Heading2,d=e.useRandomId("eds-modal");return c.default.createElement(l.DialogContent,f({className:m.default("eds-modal__content","eds-modal__content--size-"+o,n),"aria-labelledby":d},s),i&&c.default.createElement(u,{margin:"bottom",as:"h2",id:d},i),a)},h=["children","closeLabel","initialFocusRef","open","onDismiss","size","closeOnClickOutside"],_=function(e){var t=e.children;return e.condition?(0,e.wrapper)(t):t};e.warnAboutMissingStyles("modal","icons","typography","a11y","button"),exports.Drawer=function(t){var n=t.children,d=t.className,f=t.closeLabel,p=void 0===f?"Lukk skuff":f,v=t.contrast,g=void 0!==v&&v,b=t.open,E=void 0===b||b,h=t.onDismiss,O=t.title,k=t.style,N=t.overlay,q=void 0!==N&&N,w=e.useRandomId("eds-drawer");return E?c.default.createElement(_,{condition:q,wrapper:function(e){return c.default.createElement(y,{open:E,onDismiss:h},e)}},c.default.createElement(g?u.Contrast:c.default.Fragment,null,c.default.createElement(q?l.DialogContent:"div",{"aria-labelledby":w,className:m.default("eds-drawer",d),onKeyDown:function(e){"Escape"===e.key&&(e.stopPropagation(),h())},style:k},c.default.createElement(i.MoveFocusInside,null,c.default.createElement("div",{className:"eds-drawer__content"},c.default.createElement(r.Heading3,{as:"h2",id:w},O),n),c.default.createElement(o.IconButton,{className:"eds-drawer__close-button",onClick:h,type:"button"},c.default.createElement(a.CloseIcon,{"aria-hidden":!0}),c.default.createElement(s.VisuallyHidden,null,p)))))):null},exports.Modal=function(e){var t,n=e.children,l=e.closeLabel,r=void 0===l?"Lukk":l,i=e.initialFocusRef,s=e.open,u=e.onDismiss,d=e.size,m=e.closeOnClickOutside,v=void 0===m||m,g=p(e,h),b=["medium","large","extraLarge"].includes(d);return u&&v&&(t=u),c.default.createElement(y,{open:s,onDismiss:t,initialFocusRef:i},c.default.createElement(E,f({size:d},g),b&&c.default.createElement(o.IconButton,{className:"eds-modal__close","aria-label":r,onClick:u},c.default.createElement(a.CloseIcon,null)),n))},exports.ModalContent=E,exports.ModalOverlay=y;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@entur/utils"),t=require("react"),a=require("@entur/icons"),n=require("classnames"),l=require("@reach/dialog"),r=require("@entur/typography"),i=require("@entur/button"),o=require("react-focus-lock"),s=require("@entur/a11y"),u=require("@entur/layout");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=d(t),m=d(n);function f(){return f=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},f.apply(this,arguments)}function p(e,t){if(null==e)return{};var a,n,l={},r=Object.keys(e);for(n=0;n<r.length;n++)t.indexOf(a=r[n])>=0||(l[a]=e[a]);return l}var v=["className","open"],y=function(e){var t=e.className,a=e.open,n=p(e,v);return c.default.createElement(l.DialogOverlay,f({className:m.default("eds-modal__overlay",t),isOpen:a},n))},g=["children","className","size","title"],b={extraSmall:r.Heading4,small:r.Heading3,medium:r.Heading2,large:r.Heading2,extraLarge:r.Heading2},E=function(t){var a=t.children,n=t.className,i=t.size,o=t.title,s=p(t,g),u=b[i]||r.Heading2,d=e.useRandomId("eds-modal");return c.default.createElement(l.DialogContent,f({className:m.default("eds-modal__content","eds-modal__content--size-"+i,n),"aria-labelledby":d},s),o&&c.default.createElement(u,{margin:"bottom",as:"h2",id:d},o),a)},h=["children","closeLabel","initialFocusRef","open","onDismiss","size","closeOnClickOutside"],O=function(e){var t=e.children;return e.condition?(0,e.wrapper)(t):t};e.warnAboutMissingStyles("modal","icons","typography","a11y","button"),exports.Drawer=function(t){var n=t.children,d=t.className,f=t.closeLabel,p=void 0===f?"Lukk skuff":f,v=t.contrast,g=void 0!==v&&v,b=t.open,E=void 0===b||b,h=t.onDismiss,_=t.title,k=t.style,N=t.overlay,q=void 0!==N&&N,w=e.useRandomId("eds-drawer");return E?c.default.createElement(O,{condition:q,wrapper:function(e){return c.default.createElement(y,{open:E,onDismiss:h},e)}},c.default.createElement(g?u.Contrast:c.default.Fragment,null,c.default.createElement(q?l.DialogContent:"div",{"aria-labelledby":w,className:m.default("eds-drawer",d),onKeyDown:function(e){"Escape"===e.key&&(e.stopPropagation(),h())},style:k},c.default.createElement(o.MoveFocusInside,null,c.default.createElement("div",{className:"eds-drawer__content"},c.default.createElement(r.Heading3,{as:"h2",id:w},_),n),c.default.createElement(i.IconButton,{className:"eds-drawer__close-button",onClick:h,type:"button"},c.default.createElement(a.CloseIcon,{"aria-hidden":!0}),c.default.createElement(s.VisuallyHidden,null,p)))))):null},exports.Modal=function(e){var t,n=e.children,l=e.closeLabel,r=void 0===l?"Lukk":l,o=e.initialFocusRef,s=e.open,u=e.onDismiss,d=e.size,m=e.closeOnClickOutside,v=void 0===m||m,g=p(e,h),b=["medium","large","extraLarge"].includes(d);return u&&v&&(t=u),c.default.createElement(y,{open:s,onDismiss:t,initialFocusRef:o},c.default.createElement(E,f({size:d},g),b&&c.default.createElement(i.IconButton,{className:"eds-modal__close","aria-label":r,onClick:u},c.default.createElement(a.CloseIcon,null)),n))},exports.ModalContent=E,exports.ModalOverlay=y;
2
2
  //# sourceMappingURL=modal.cjs.production.min.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"modal.cjs.production.min.js","sources":["../src/ModalOverlay.tsx","../src/ModalContent.tsx","../src/Drawer.tsx","../src/index.tsx","../src/Modal.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?: string;\n [key: string]: any;\n};\n\nconst 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 ...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 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';\nimport classNames from 'classnames';\nimport { MoveFocusInside } from 'react-focus-lock';\nimport { VisuallyHidden } from '@entur/a11y';\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 <div className=\"eds-drawer__content\">\n <Heading3 as=\"h2\" id={titleId}>\n {title}\n </Heading3>\n {children}\n </div>\n <IconButton\n className=\"eds-drawer__close-button\"\n onClick={onDismiss}\n type=\"button\"\n >\n <CloseIcon aria-hidden />\n <VisuallyHidden>{closeLabel}</VisuallyHidden>\n </IconButton>\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","import React from 'react';\nimport { CloseIcon } from '@entur/icons';\nimport { ModalOverlay } from './ModalOverlay';\nimport { ModalContent } from './ModalContent';\nimport { IconButton } from '@entur/button';\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 /** Tittelen som vises i modalen */\n title: string;\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 closeOnClickOutside = true,\n ...rest\n}) => {\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} {...rest}>\n {showCloseButton && (\n <IconButton\n className=\"eds-modal__close\"\n aria-label={closeLabel}\n onClick={onDismiss}\n >\n <CloseIcon />\n </IconButton>\n )}\n {children}\n </ModalContent>\n </ModalOverlay>\n );\n};\n"],"names":["ModalOverlay","className","open","rest","React","DialogOverlay","classNames","isOpen","headingsMap","extraSmall","Heading4","small","Heading3","medium","Heading2","large","extraLarge","ModalContent","children","size","title","Heading","randomId","useRandomId","DialogContent","margin","as","id","ConditionalWrapper","condition","wrapper","warnAboutMissingStyles","closeLabel","contrast","onDismiss","style","overlay","titleId","Contrast","Fragment","onKeyDown","e","key","stopPropagation","MoveFocusInside","IconButton","onClick","type","CloseIcon","VisuallyHidden","handleOnD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cACC5C,UAAU,2BACV6C,QAASZ,EACTa,KAAK,UAEL3C,wBAAC4C,gCACD5C,wBAAC6C,sBAAgBjB,QAzCpB,oBE1BgC,gBAYrCkB,EAXJhC,IAAAA,aACAc,WAAAA,aAAa,SACbmB,IAAAA,gBACAjD,IAAAA,KACAgC,IAAAA,UACAf,IAAAA,SACAiC,oBAAAA,gBACGjD,SAEGkD,EAAkB,CAAC,SAAU,QAAS,cAAcC,SAASnC,UAG/De,GAAakB,IACfF,EAAkBhB,GAGlB9B,wBAACJ,GACCE,KAAMA,EACNgC,UAAWgB,EACXC,gBAAiBA,GAEjB/C,wBAACa,KAAaE,KAAMA,GAAUhB,GAC3BkD,GACCjD,wBAACyC,cACC5C,UAAU,gCACE+B,EACZc,QAASZ,GAET9B,wBAAC4C,mBAGJ9B"}
1
+ {"version":3,"file":"modal.cjs.production.min.js","sources":["../src/ModalOverlay.tsx","../src/ModalContent.tsx","../src/Drawer.tsx","../src/index.tsx","../src/Modal.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?: string;\n [key: string]: any;\n};\n\nconst 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 ...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 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';\nimport classNames from 'classnames';\nimport { MoveFocusInside } from 'react-focus-lock';\nimport { VisuallyHidden } from '@entur/a11y';\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 <div className=\"eds-drawer__content\">\n <Heading3 as=\"h2\" id={titleId}>\n {title}\n </Heading3>\n {children}\n </div>\n <IconButton\n className=\"eds-drawer__close-button\"\n onClick={onDismiss}\n type=\"button\"\n >\n <CloseIcon aria-hidden />\n <VisuallyHidden>{closeLabel}</VisuallyHidden>\n </IconButton>\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","import React from 'react';\nimport { CloseIcon } from '@entur/icons';\nimport { ModalOverlay } from './ModalOverlay';\nimport { ModalContent } from './ModalContent';\nimport { IconButton } from '@entur/button';\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 /** Tittelen som vises i modalen */\n title: string;\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 closeOnClickOutside = true,\n ...rest\n}) => {\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} {...rest}>\n {showCloseButton && (\n <IconButton\n className=\"eds-modal__close\"\n aria-label={closeLabel}\n onClick={onDismiss}\n >\n <CloseIcon />\n </IconButton>\n )}\n {children}\n </ModalContent>\n </ModalOverlay>\n );\n};\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","Heading","randomId","useRandomId","DialogContent","margin","as","id","ConditionalWrapper","_ref2","condition","wrapper","warnAboutMissingStyles","_ref$closeLabel","closeLabel","_ref$contrast","contrast","_ref$open","onDismiss","style","_ref$overlay","overlay","titleId","Contrast","Fragment","onKeyDown","e","key","stopPropagation","MoveFocusInside","IconButton","onClick","type","CloseIcon","VisuallyHidden","handleOnDismiss","initialFocusRef","_ref$closeOnClickOuts","closeOnClickOutside","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AACC,cAAAkD,EAASA,UAAG,OAGhBnC"}
package/dist/modal.esm.js CHANGED
@@ -10,44 +10,37 @@ import { VisuallyHidden } from '@entur/a11y';
10
10
  import { Contrast } from '@entur/layout';
11
11
 
12
12
  function _extends() {
13
- _extends = Object.assign || function (target) {
13
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
14
14
  for (var i = 1; i < arguments.length; i++) {
15
15
  var source = arguments[i];
16
-
17
16
  for (var key in source) {
18
17
  if (Object.prototype.hasOwnProperty.call(source, key)) {
19
18
  target[key] = source[key];
20
19
  }
21
20
  }
22
21
  }
23
-
24
22
  return target;
25
23
  };
26
-
27
24
  return _extends.apply(this, arguments);
28
25
  }
29
-
30
26
  function _objectWithoutPropertiesLoose(source, excluded) {
31
27
  if (source == null) return {};
32
28
  var target = {};
33
29
  var sourceKeys = Object.keys(source);
34
30
  var key, i;
35
-
36
31
  for (i = 0; i < sourceKeys.length; i++) {
37
32
  key = sourceKeys[i];
38
33
  if (excluded.indexOf(key) >= 0) continue;
39
34
  target[key] = source[key];
40
35
  }
41
-
42
36
  return target;
43
37
  }
44
38
 
45
39
  var _excluded$2 = ["className", "open"];
46
40
  var ModalOverlay = function ModalOverlay(_ref) {
47
41
  var className = _ref.className,
48
- open = _ref.open,
49
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
50
-
42
+ open = _ref.open,
43
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
51
44
  return React.createElement(DialogOverlay, _extends({
52
45
  className: classNames('eds-modal__overlay', className),
53
46
  isOpen: open
@@ -64,11 +57,10 @@ var headingsMap = {
64
57
  };
65
58
  var ModalContent = function ModalContent(_ref) {
66
59
  var children = _ref.children,
67
- className = _ref.className,
68
- size = _ref.size,
69
- title = _ref.title,
70
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
71
-
60
+ className = _ref.className,
61
+ size = _ref.size,
62
+ title = _ref.title,
63
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
72
64
  var Heading = headingsMap[size] || Heading2;
73
65
  var randomId = useRandomId('eds-modal');
74
66
  return React.createElement(DialogContent, _extends({
@@ -84,23 +76,20 @@ var ModalContent = function ModalContent(_ref) {
84
76
  var _excluded = ["children", "closeLabel", "initialFocusRef", "open", "onDismiss", "size", "closeOnClickOutside"];
85
77
  var Modal = function Modal(_ref) {
86
78
  var children = _ref.children,
87
- _ref$closeLabel = _ref.closeLabel,
88
- closeLabel = _ref$closeLabel === void 0 ? 'Lukk' : _ref$closeLabel,
89
- initialFocusRef = _ref.initialFocusRef,
90
- open = _ref.open,
91
- onDismiss = _ref.onDismiss,
92
- size = _ref.size,
93
- _ref$closeOnClickOuts = _ref.closeOnClickOutside,
94
- closeOnClickOutside = _ref$closeOnClickOuts === void 0 ? true : _ref$closeOnClickOuts,
95
- rest = _objectWithoutPropertiesLoose(_ref, _excluded);
96
-
79
+ _ref$closeLabel = _ref.closeLabel,
80
+ closeLabel = _ref$closeLabel === void 0 ? 'Lukk' : _ref$closeLabel,
81
+ initialFocusRef = _ref.initialFocusRef,
82
+ open = _ref.open,
83
+ onDismiss = _ref.onDismiss,
84
+ size = _ref.size,
85
+ _ref$closeOnClickOuts = _ref.closeOnClickOutside,
86
+ closeOnClickOutside = _ref$closeOnClickOuts === void 0 ? true : _ref$closeOnClickOuts,
87
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded);
97
88
  var showCloseButton = ['medium', 'large', 'extraLarge'].includes(size);
98
89
  var handleOnDismiss;
99
-
100
90
  if (onDismiss && closeOnClickOutside) {
101
91
  handleOnDismiss = onDismiss;
102
92
  }
103
-
104
93
  return React.createElement(ModalOverlay, {
105
94
  open: open,
106
95
  onDismiss: handleOnDismiss,
@@ -116,31 +105,28 @@ var Modal = function Modal(_ref) {
116
105
 
117
106
  var Drawer = function Drawer(_ref) {
118
107
  var children = _ref.children,
119
- className = _ref.className,
120
- _ref$closeLabel = _ref.closeLabel,
121
- closeLabel = _ref$closeLabel === void 0 ? 'Lukk skuff' : _ref$closeLabel,
122
- _ref$contrast = _ref.contrast,
123
- contrast = _ref$contrast === void 0 ? false : _ref$contrast,
124
- _ref$open = _ref.open,
125
- open = _ref$open === void 0 ? true : _ref$open,
126
- onDismiss = _ref.onDismiss,
127
- title = _ref.title,
128
- style = _ref.style,
129
- _ref$overlay = _ref.overlay,
130
- overlay = _ref$overlay === void 0 ? false : _ref$overlay;
108
+ className = _ref.className,
109
+ _ref$closeLabel = _ref.closeLabel,
110
+ closeLabel = _ref$closeLabel === void 0 ? 'Lukk skuff' : _ref$closeLabel,
111
+ _ref$contrast = _ref.contrast,
112
+ contrast = _ref$contrast === void 0 ? false : _ref$contrast,
113
+ _ref$open = _ref.open,
114
+ open = _ref$open === void 0 ? true : _ref$open,
115
+ onDismiss = _ref.onDismiss,
116
+ title = _ref.title,
117
+ style = _ref.style,
118
+ _ref$overlay = _ref.overlay,
119
+ overlay = _ref$overlay === void 0 ? false : _ref$overlay;
131
120
  var titleId = useRandomId('eds-drawer');
132
-
133
121
  if (!open) {
134
122
  return null;
135
123
  }
136
-
137
124
  var handleKeyDown = function handleKeyDown(e) {
138
125
  if (e.key === 'Escape') {
139
126
  e.stopPropagation();
140
127
  onDismiss();
141
128
  }
142
129
  };
143
-
144
130
  var Wrapper = contrast ? Contrast : React.Fragment;
145
131
  var ContentContainer = overlay ? DialogContent : 'div';
146
132
  return React.createElement(ConditionalWrapper, {
@@ -169,11 +155,10 @@ var Drawer = function Drawer(_ref) {
169
155
  "aria-hidden": true
170
156
  }), React.createElement(VisuallyHidden, null, closeLabel))))));
171
157
  };
172
-
173
158
  var ConditionalWrapper = function ConditionalWrapper(_ref2) {
174
159
  var condition = _ref2.condition,
175
- wrapper = _ref2.wrapper,
176
- children = _ref2.children;
160
+ wrapper = _ref2.wrapper,
161
+ children = _ref2.children;
177
162
  return condition ? wrapper(children) : children;
178
163
  };
179
164
 
@@ -1 +1 @@
1
- {"version":3,"file":"modal.esm.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?: string;\n [key: string]: any;\n};\n\nconst 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 ...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 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';\nimport { CloseIcon } from '@entur/icons';\nimport { ModalOverlay } from './ModalOverlay';\nimport { ModalContent } from './ModalContent';\nimport { IconButton } from '@entur/button';\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 /** Tittelen som vises i modalen */\n title: string;\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 closeOnClickOutside = true,\n ...rest\n}) => {\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} {...rest}>\n {showCloseButton && (\n <IconButton\n className=\"eds-modal__close\"\n aria-label={closeLabel}\n onClick={onDismiss}\n >\n <CloseIcon />\n </IconButton>\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 { VisuallyHidden } from '@entur/a11y';\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 <div className=\"eds-drawer__content\">\n <Heading3 as=\"h2\" id={titleId}>\n {title}\n </Heading3>\n {children}\n </div>\n <IconButton\n className=\"eds-drawer__close-button\"\n onClick={onDismiss}\n type=\"button\"\n >\n <CloseIcon aria-hidden />\n <VisuallyHidden>{closeLabel}</VisuallyHidden>\n </IconButton>\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","className","open","rest","React","DialogOverlay","classNames","isOpen","headingsMap","extraSmall","Heading4","small","Heading3","medium","Heading2","large","extraLarge","ModalContent","children","size","title","Heading","randomId","useRandomId","DialogContent","margin","as","id","Modal","closeLabel","initialFocusRef","onDismiss","closeOnClickOutside","showCloseButton","includes","handleOnDismiss","IconButton","onClick","CloseIcon","Drawer","contrast","style","overlay","titleId","handleKeyDown","e","key","stopPropagation","Wrapper","Contrast","Fragment","ContentContainer","ConditionalWrapper","condition","wrapper","onKeyDown","MoveFocusInside","type","VisuallyHidden","warnAboutMissingStyles"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAkBaA,YAAY,GAAgC,SAA5CA,YAA4C;AAAA,MACvDC,SADuD,QACvDA,SADuD;AAAA,MAEvDC,IAFuD,QAEvDA,IAFuD;AAAA,MAGpDC,IAHoD;;AAAA,SAKvDC,mBAAA,CAACC,aAAD;AACEJ,IAAAA,SAAS,EAAEK,UAAU,CAAC,oBAAD,EAAuBL,SAAvB,CADvB;AAEEM,IAAAA,MAAM,EAAEL;AAFV,KAGMC,IAHN,EALuD;AAAA;;;ACAzD,IAAMK,WAAW,GAAG;AAClBC,EAAAA,UAAU,EAAEC,QADM;AAElBC,EAAAA,KAAK,EAAEC,QAFW;AAGlBC,EAAAA,MAAM,EAAEC,QAHU;AAIlBC,EAAAA,KAAK,EAAED,QAJW;AAKlBE,EAAAA,UAAU,EAAEF;AALM,CAApB;IAQaG,YAAY,GAAgC,SAA5CA,YAA4C;MACvDC,gBAAAA;MACAjB,iBAAAA;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,KADH,CADF,EAIGF,QAJH,CADF,EAOEd,mBAAA,CAACgC,UAAD;AACEnC,IAAAA,SAAS,EAAC;AACVoC,IAAAA,OAAO,EAAEN;AACT0B,IAAAA,IAAI,EAAC;GAHP,EAKErD,mBAAA,CAACkC,SAAD;;GAAA,CALF,EAMElC,mBAAA,CAACsD,cAAD,MAAA,EAAiB7B,UAAjB,CANF,CAPF,CANF,CADF,CARF,CADF;AAoCD;;AAED,IAAMuB,kBAAkB,GAInB,SAJCA,kBAID;AAAA,MAAGC,SAAH,SAAGA,SAAH;AAAA,MAAcC,OAAd,SAAcA,OAAd;AAAA,MAAuBpC,QAAvB,SAAuBA,QAAvB;AAAA,SACHmC,SAAS,GAAGC,OAAO,CAACpC,QAAD,CAAV,GAAuBA,QAD7B;AAAA,CAJL;;ACtGAyC,sBAAsB,CAAC,OAAD,EAAU,OAAV,EAAmB,YAAnB,EAAiC,MAAjC,EAAyC,QAAzC,CAAtB;;;;"}
1
+ {"version":3,"file":"modal.esm.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?: string;\n [key: string]: any;\n};\n\nconst 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 ...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 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';\nimport { CloseIcon } from '@entur/icons';\nimport { ModalOverlay } from './ModalOverlay';\nimport { ModalContent } from './ModalContent';\nimport { IconButton } from '@entur/button';\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 /** Tittelen som vises i modalen */\n title: string;\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 closeOnClickOutside = true,\n ...rest\n}) => {\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} {...rest}>\n {showCloseButton && (\n <IconButton\n className=\"eds-modal__close\"\n aria-label={closeLabel}\n onClick={onDismiss}\n >\n <CloseIcon />\n </IconButton>\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 { VisuallyHidden } from '@entur/a11y';\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 <div className=\"eds-drawer__content\">\n <Heading3 as=\"h2\" id={titleId}>\n {title}\n </Heading3>\n {children}\n </div>\n <IconButton\n className=\"eds-drawer__close-button\"\n onClick={onDismiss}\n type=\"button\"\n >\n <CloseIcon aria-hidden />\n <VisuallyHidden>{closeLabel}</VisuallyHidden>\n </IconButton>\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","className","open","rest","_excluded","React","createElement","DialogOverlay","classNames","isOpen","headingsMap","extraSmall","Heading4","small","Heading3","medium","Heading2","large","extraLarge","ModalContent","children","size","title","Heading","randomId","useRandomId","DialogContent","margin","as","id","Modal","closeLabel","initialFocusRef","onDismiss","closeOnClickOutside","showCloseButton","includes","handleOnDismiss","IconButton","onClick","CloseIcon","Drawer","contrast","style","overlay","titleId","handleKeyDown","e","key","stopPropagation","Wrapper","Contrast","Fragment","ContentContainer","ConditionalWrapper","condition","wrapper","onK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EAAEN,SAAS;AAClB0B,IAAAA,IAAI,EAAC,QAAA;AAAQ,GAAA,EAEbtD,KAAA,CAAAC,aAAA,CAACkC,SAAS,EAAe;AAAA,IAAA,aAAA,EAAA,IAAA;AAAA,GAAA,CAAA,EACzBnC,KAAC,CAAAC,aAAA,CAAAsD,cAAc,EAAE,IAAA,EAAA7B,UAAU,CAAkB,CAClC,CACG,CACD,CACX,CACS,CAAA;AAEzB,EAAC;AAED,IAAMuB,kBAAkB,GAInB,SAJCA,kBAAkB,CAAA,KAAA,EAAA;EAAA,IAIhBC,SAAS,SAATA,SAAS;AAAEC,IAAAA,OAAO,SAAPA,OAAO;AAAEpC,IAAAA,QAAQ,SAARA,QAAQ,CAAA;AAAA,EAAA,OAClCmC,SAAS,GAAGC,OAAO,CAACpC,QAAQ,CAAC,GAAGA,QAAQ,CAAA;AAAA,CAAA;;AC3G1CyC,sBAAsB,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,CAAC;;;;"}
package/dist/styles.css CHANGED
@@ -16,12 +16,9 @@
16
16
  right: 0;
17
17
  top: 0;
18
18
  z-index: 30;
19
- -webkit-animation: fadeInOverlay;
20
- animation: fadeInOverlay;
21
- -webkit-animation-duration: 0.2s;
22
- animation-duration: 0.2s;
23
- -webkit-animation-timing-function: ease-in-out;
24
- animation-timing-function: ease-in-out;
19
+ animation: fadeInOverlay;
20
+ animation-duration: 0.2s;
21
+ animation-timing-function: ease-in-out;
25
22
  }
26
23
 
27
24
  .eds-modal__content {
@@ -36,12 +33,9 @@
36
33
  max-height: 90vh;
37
34
  overflow: auto;
38
35
  z-index: 40;
39
- -webkit-animation: slideInContent;
40
- animation: slideInContent;
41
- -webkit-animation-duration: 0.2s;
42
- animation-duration: 0.2s;
43
- -webkit-animation-timing-function: ease-in-out;
44
- animation-timing-function: ease-in-out;
36
+ animation: slideInContent;
37
+ animation-duration: 0.2s;
38
+ animation-timing-function: ease-in-out;
45
39
  }
46
40
  .eds-modal__content--size-extraSmall {
47
41
  max-width: 21rem;
@@ -101,15 +95,6 @@
101
95
  box-shadow: 0 0 0 0.125rem #ffffff, 0 0 0 0.25rem #181c56;
102
96
  }
103
97
 
104
- @-webkit-keyframes fadeInOverlay {
105
- from {
106
- opacity: 0;
107
- }
108
- to {
109
- opacity: 1;
110
- }
111
- }
112
-
113
98
  @keyframes fadeInOverlay {
114
99
  from {
115
100
  opacity: 0;
@@ -118,16 +103,6 @@
118
103
  opacity: 1;
119
104
  }
120
105
  }
121
- @-webkit-keyframes slideInContent {
122
- from {
123
- top: 5rem;
124
- opacity: 0;
125
- }
126
- to {
127
- top: 0%;
128
- opacity: 1;
129
- }
130
- }
131
106
  @keyframes slideInContent {
132
107
  from {
133
108
  top: 5rem;
@@ -139,16 +114,6 @@
139
114
  }
140
115
  }/* DO NOT CHANGE!*/
141
116
  /* This file is automatically generated from @entur/tokens! Changes will be overwritten. */
142
- @-webkit-keyframes slideFromRight {
143
- from {
144
- box-shadow: none;
145
- transform: translateX(100%);
146
- }
147
- to {
148
- box-shadow: 0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.25);
149
- transform: 0;
150
- }
151
- }
152
117
  @keyframes slideFromRight {
153
118
  from {
154
119
  box-shadow: none;
@@ -160,8 +125,7 @@
160
125
  }
161
126
  }
162
127
  .eds-drawer {
163
- -webkit-animation: slideFromRight forwards ease-out 0.1s;
164
- animation: slideFromRight forwards ease-out 0.1s;
128
+ animation: slideFromRight forwards ease-out 0.1s;
165
129
  background: #ebebf1;
166
130
  bottom: 0;
167
131
  padding: 1.5rem;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@entur/modal",
3
- "version": "1.6.19",
3
+ "version": "1.6.21",
4
4
  "license": "EUPL-1.2",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/modal.esm.js",
@@ -20,23 +20,23 @@
20
20
  "start": "dts watch --noClean",
21
21
  "build": "dts build",
22
22
  "test": "dts test",
23
- "lint": "dts lint"
23
+ "lint": "dts lint src"
24
24
  },
25
25
  "peerDependencies": {
26
26
  "react": ">=16.8.0",
27
27
  "react-dom": ">=16.8.0"
28
28
  },
29
29
  "dependencies": {
30
- "@entur/a11y": "^0.2.54",
31
- "@entur/button": "^2.10.9",
32
- "@entur/icons": "^5.4.2",
33
- "@entur/layout": "^2.1.16",
34
- "@entur/tokens": "^3.4.4",
35
- "@entur/typography": "^1.7.5",
36
- "@entur/utils": "^0.5.0",
30
+ "@entur/a11y": "^0.2.56",
31
+ "@entur/button": "^2.10.11",
32
+ "@entur/icons": "^5.5.0",
33
+ "@entur/layout": "^2.1.18",
34
+ "@entur/tokens": "^3.5.0",
35
+ "@entur/typography": "^1.7.7",
36
+ "@entur/utils": "^0.5.2",
37
37
  "@reach/dialog": "^0.16.0",
38
38
  "classnames": "^2.3.1",
39
39
  "react-focus-lock": "^2.9.1"
40
40
  },
41
- "gitHead": "36772ae4f2d8375622acff19736c07d15435cb95"
41
+ "gitHead": "30b38034aaafba9fb308fb3d8c8bfaab9608d720"
42
42
  }
package/CHANGELOG.md DELETED
@@ -1,468 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file.
4
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
-
6
- ## [1.6.18](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.6.17...@entur/modal@1.6.18) (2023-01-19)
7
-
8
- **Note:** Version bump only for package @entur/modal
9
-
10
- ## [1.6.17](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.6.14...@entur/modal@1.6.17) (2022-12-09)
11
-
12
- ### Bug Fixes
13
-
14
- - **modal:** make title prop optional ([0892b90](https://bitbucket.org/enturas/design-system/commits/0892b90ff702c3479b72c9435f972a3fd6022c03))
15
-
16
- ## [1.6.16](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.6.15...@entur/modal@1.6.16) (2022-11-24)
17
-
18
- **Note:** Version bump only for package @entur/modal
19
-
20
- ## [1.6.15](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.6.14...@entur/modal@1.6.15) (2022-10-31)
21
-
22
- **Note:** Version bump only for package @entur/modal
23
-
24
- ## [1.6.14](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.6.13...@entur/modal@1.6.14) (2022-10-31)
25
-
26
- **Note:** Version bump only for package @entur/modal
27
-
28
- ## [1.6.13](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.6.12...@entur/modal@1.6.13) (2022-10-31)
29
-
30
- **Note:** Version bump only for package @entur/modal
31
-
32
- ## [1.6.12](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.6.11...@entur/modal@1.6.12) (2022-10-20)
33
-
34
- ### Performance Improvements
35
-
36
- - **react-focus-lock:** update react-focus-lock package to newest version ([a827d1b](https://bitbucket.org/enturas/design-system/commits/a827d1b79872ea648ac794675cb5602df2cec56a))
37
-
38
- ## [1.6.10](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.6.9...@entur/modal@1.6.10) (2022-10-12)
39
-
40
- **Note:** Version bump only for package @entur/modal
41
-
42
- ## [1.6.8](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.6.7...@entur/modal@1.6.8) (2022-08-31)
43
-
44
- **Note:** Version bump only for package @entur/modal
45
-
46
- ## [1.6.7](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.6.6...@entur/modal@1.6.7) (2022-08-24)
47
-
48
- **Note:** Version bump only for package @entur/modal
49
-
50
- ## [1.6.6](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.6.5...@entur/modal@1.6.6) (2022-08-09)
51
-
52
- **Note:** Version bump only for package @entur/modal
53
-
54
- ## [1.6.5](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.6.4...@entur/modal@1.6.5) (2022-07-05)
55
-
56
- **Note:** Version bump only for package @entur/modal
57
-
58
- ## [1.6.4](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.6.3...@entur/modal@1.6.4) (2022-06-28)
59
-
60
- **Note:** Version bump only for package @entur/modal
61
-
62
- ## [1.6.3](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.6.2...@entur/modal@1.6.3) (2022-06-24)
63
-
64
- **Note:** Version bump only for package @entur/modal
65
-
66
- ## [1.6.2](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.6.1...@entur/modal@1.6.2) (2022-06-02)
67
-
68
- **Note:** Version bump only for package @entur/modal
69
-
70
- ## [1.6.1](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.6.0...@entur/modal@1.6.1) (2022-05-13)
71
-
72
- **Note:** Version bump only for package @entur/modal
73
-
74
- # [1.6.0](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.5.13...@entur/modal@1.6.0) (2022-05-04)
75
-
76
- ### Features
77
-
78
- - **modal:** add custom scrollbar to modal to preserve rounded corners ([22f967f](https://bitbucket.org/enturas/design-system/commits/22f967faed103dda79491dd0ffa7fbad1039dd56))
79
-
80
- ## [1.5.13](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.5.12...@entur/modal@1.5.13) (2022-04-27)
81
-
82
- **Note:** Version bump only for package @entur/modal
83
-
84
- ## [1.5.12](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.5.11...@entur/modal@1.5.12) (2022-04-20)
85
-
86
- **Note:** Version bump only for package @entur/modal
87
-
88
- ## [1.5.11](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.5.10...@entur/modal@1.5.11) (2022-04-19)
89
-
90
- **Note:** Version bump only for package @entur/modal
91
-
92
- ## [1.5.10](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.5.9...@entur/modal@1.5.10) (2022-03-01)
93
-
94
- **Note:** Version bump only for package @entur/modal
95
-
96
- ## [1.5.9](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.5.8...@entur/modal@1.5.9) (2022-02-09)
97
-
98
- **Note:** Version bump only for package @entur/modal
99
-
100
- ## [1.5.8](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.5.7...@entur/modal@1.5.8) (2021-11-17)
101
-
102
- **Note:** Version bump only for package @entur/modal
103
-
104
- ## [1.5.7](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.5.6...@entur/modal@1.5.7) (2021-09-23)
105
-
106
- **Note:** Version bump only for package @entur/modal
107
-
108
- ## [1.5.6](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.5.5...@entur/modal@1.5.6) (2021-09-13)
109
-
110
- ### Bug Fixes
111
-
112
- - **modal:** increase border radius on modals ([8d321aa](https://bitbucket.org/enturas/design-system/commits/8d321aa3e0e83a410a285763182db22c7b1c96be))
113
-
114
- ## [1.5.5](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.5.4...@entur/modal@1.5.5) (2021-09-07)
115
-
116
- ### Bug Fixes
117
-
118
- - update dependencies ([c76a03c](https://bitbucket.org/enturas/design-system/commits/c76a03ca6e15951c40b032f618617380dc8f15d1))
119
- - utilize reworked focus token ([586758f](https://bitbucket.org/enturas/design-system/commits/586758fc86eb5aa52116c63c14ef033eb2e8b12f))
120
-
121
- ## [1.5.4](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.5.3...@entur/modal@1.5.4) (2021-08-13)
122
-
123
- **Note:** Version bump only for package @entur/modal
124
-
125
- ## [1.5.3](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.5.2...@entur/modal@1.5.3) (2021-07-16)
126
-
127
- **Note:** Version bump only for package @entur/modal
128
-
129
- ## [1.5.2](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.5.1...@entur/modal@1.5.2) (2021-06-25)
130
-
131
- ### Bug Fixes
132
-
133
- - update dependencies ([85395ed](https://bitbucket.org/enturas/design-system/commits/85395ed69004335bb173770dfaa634ad542de771))
134
-
135
- ## [1.5.1](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.5.0...@entur/modal@1.5.1) (2021-06-04)
136
-
137
- **Note:** Version bump only for package @entur/modal
138
-
139
- # [1.5.0](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.4.0...@entur/modal@1.5.0) (2021-05-19)
140
-
141
- ### Features
142
-
143
- - **modal:** add animation on modal entry ([f0f0701](https://bitbucket.org/enturas/design-system/commits/f0f07019a9324b8a697165e5d902fee9cfb21815))
144
-
145
- # [1.4.0](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.3.16...@entur/modal@1.4.0) (2021-05-05)
146
-
147
- ### Features
148
-
149
- - **modal:** add closeonclickoutside prop ([7fba612](https://bitbucket.org/enturas/design-system/commits/7fba612263e8c66f732c84447cf3bbf99766073c))
150
-
151
- ## [1.3.16](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.3.15...@entur/modal@1.3.16) (2021-04-23)
152
-
153
- ### Bug Fixes
154
-
155
- - utilize new focus tokens ([17113ef](https://bitbucket.org/enturas/design-system/commits/17113ef3f791c86fa6e19e71680fd5acdbae4990))
156
-
157
- ## [1.3.15](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.3.14...@entur/modal@1.3.15) (2021-04-09)
158
-
159
- **Note:** Version bump only for package @entur/modal
160
-
161
- ## [1.3.14](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.3.13...@entur/modal@1.3.14) (2021-03-02)
162
-
163
- **Note:** Version bump only for package @entur/modal
164
-
165
- ## [1.3.13](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.3.12...@entur/modal@1.3.13) (2021-02-17)
166
-
167
- ### Bug Fixes
168
-
169
- - **modal:** add border radius for modal windows ([8ed7468](https://bitbucket.org/enturas/design-system/commits/8ed7468ce9c2544f11ea7113415366236f12041e))
170
-
171
- ## [1.3.12](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.3.11...@entur/modal@1.3.12) (2021-01-29)
172
-
173
- **Note:** Version bump only for package @entur/modal
174
-
175
- ## [1.3.11](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.3.10...@entur/modal@1.3.11) (2021-01-20)
176
-
177
- **Note:** Version bump only for package @entur/modal
178
-
179
- ## [1.3.10](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.3.9...@entur/modal@1.3.10) (2021-01-13)
180
-
181
- ### Bug Fixes
182
-
183
- - update dependency ([40fd77e](https://bitbucket.org/enturas/design-system/commits/40fd77ebca7fa8a3d0e82409561e3e3cd63c441d))
184
-
185
- ## [1.3.9](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.3.8...@entur/modal@1.3.9) (2021-01-05)
186
-
187
- **Note:** Version bump only for package @entur/modal
188
-
189
- ## [1.3.8](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.3.7...@entur/modal@1.3.8) (2020-12-04)
190
-
191
- ### Bug Fixes
192
-
193
- - **modal:** fix typings of heading ([720abb7](https://bitbucket.org/enturas/design-system/commits/720abb75c6aec3655fa81abf01abe4d4d40e6b61))
194
-
195
- ## [1.3.7](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.3.6...@entur/modal@1.3.7) (2020-11-10)
196
-
197
- **Note:** Version bump only for package @entur/modal
198
-
199
- ## [1.3.6](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.3.5...@entur/modal@1.3.6) (2020-11-05)
200
-
201
- **Note:** Version bump only for package @entur/modal
202
-
203
- ## [1.3.5](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.3.4...@entur/modal@1.3.5) (2020-10-28)
204
-
205
- **Note:** Version bump only for package @entur/modal
206
-
207
- ## [1.3.4](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.3.3...@entur/modal@1.3.4) (2020-10-23)
208
-
209
- **Note:** Version bump only for package @entur/modal
210
-
211
- ## [1.3.3](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.3.2...@entur/modal@1.3.3) (2020-10-16)
212
-
213
- **Note:** Version bump only for package @entur/modal
214
-
215
- ## [1.3.2](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.3.1...@entur/modal@1.3.2) (2020-10-09)
216
-
217
- **Note:** Version bump only for package @entur/modal
218
-
219
- ## [1.3.1](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.3.0...@entur/modal@1.3.1) (2020-09-25)
220
-
221
- **Note:** Version bump only for package @entur/modal
222
-
223
- # [1.3.0](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.2.0...@entur/modal@1.3.0) (2020-09-14)
224
-
225
- ### Bug Fixes
226
-
227
- - **drawer:** improve automatic focus within in drawer ([f4efa2f](https://bitbucket.org/enturas/design-system/commits/f4efa2f2ad3d09cf7806d26e0d0526041ac463f7))
228
-
229
- ### Features
230
-
231
- - **drawer:** add overlay prop, for optional overlay ([8577478](https://bitbucket.org/enturas/design-system/commits/85774782d653138073af2ad73c0924347d80e1aa))
232
-
233
- # [1.2.0](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.1.29...@entur/modal@1.2.0) (2020-09-10)
234
-
235
- ### Bug Fixes
236
-
237
- - **drawer:** add overflow-y:auto for drawer ([687cea7](https://bitbucket.org/enturas/design-system/commits/687cea7ac5f3451951930a5a882ffbb3ad3a8615))
238
-
239
- ### Features
240
-
241
- - **drawer:** add style prop support ([77fbf0d](https://bitbucket.org/enturas/design-system/commits/77fbf0d74450930ca9359b51ca1c09dbe1070fc0))
242
-
243
- ## [1.1.29](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.1.28...@entur/modal@1.1.29) (2020-09-02)
244
-
245
- ### Bug Fixes
246
-
247
- - **modal:** adjust modal backdrop color ([ba08fdc](https://bitbucket.org/enturas/design-system/commits/ba08fdca717b88a588023e0467d14a8220ef9d5b))
248
-
249
- ## [1.1.28](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.1.27...@entur/modal@1.1.28) (2020-08-26)
250
-
251
- **Note:** Version bump only for package @entur/modal
252
-
253
- ## [1.1.27](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.1.26...@entur/modal@1.1.27) (2020-08-19)
254
-
255
- **Note:** Version bump only for package @entur/modal
256
-
257
- ## [1.1.26](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.1.25...@entur/modal@1.1.26) (2020-08-11)
258
-
259
- **Note:** Version bump only for package @entur/modal
260
-
261
- ## [1.1.25](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.1.24...@entur/modal@1.1.25) (2020-07-24)
262
-
263
- **Note:** Version bump only for package @entur/modal
264
-
265
- ## [1.1.24](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.1.23...@entur/modal@1.1.24) (2020-07-22)
266
-
267
- **Note:** Version bump only for package @entur/modal
268
-
269
- ## [1.1.23](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.1.22...@entur/modal@1.1.23) (2020-07-16)
270
-
271
- ### Bug Fixes
272
-
273
- - update modal dependency ([bab3f74](https://bitbucket.org/enturas/design-system/commits/bab3f74d5b379a801eaa057bad2880006e1d32eb))
274
-
275
- ## [1.1.22](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.1.21...@entur/modal@1.1.22) (2020-07-13)
276
-
277
- **Note:** Version bump only for package @entur/modal
278
-
279
- ## [1.1.21](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.1.20...@entur/modal@1.1.21) (2020-07-09)
280
-
281
- **Note:** Version bump only for package @entur/modal
282
-
283
- ## [1.1.20](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.1.19...@entur/modal@1.1.20) (2020-07-03)
284
-
285
- **Note:** Version bump only for package @entur/modal
286
-
287
- ## [1.1.19](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.1.18...@entur/modal@1.1.19) (2020-06-17)
288
-
289
- ### Bug Fixes
290
-
291
- - use iconbutton in modal window ([0ec8929](https://bitbucket.org/enturas/design-system/commits/0ec8929a339d76fcbb6c1af6d6b39796b0554d11))
292
-
293
- ## [1.1.18](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.1.17...@entur/modal@1.1.18) (2020-05-27)
294
-
295
- **Note:** Version bump only for package @entur/modal
296
-
297
- ## [1.1.17](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.1.16...@entur/modal@1.1.17) (2020-05-26)
298
-
299
- ### Bug Fixes
300
-
301
- - fix extraSmall prop for modal ([1aeba26](https://bitbucket.org/enturas/design-system/commits/1aeba2662d6fcd179b6f959676b6370e6cd4ef63))
302
- - fix size=extraLarge not rendering properly for modal ([1ce2056](https://bitbucket.org/enturas/design-system/commits/1ce2056438dcb9c80f3357ddf1289a7523e5b51c))
303
- - use iconbutton directly in drawer ([adcab79](https://bitbucket.org/enturas/design-system/commits/adcab79fd967741467ed5956a4463fbf199c2ed8))
304
-
305
- ## [1.1.16](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.1.15...@entur/modal@1.1.16) (2020-05-20)
306
-
307
- **Note:** Version bump only for package @entur/modal
308
-
309
- ## [1.1.15](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.1.14...@entur/modal@1.1.15) (2020-04-27)
310
-
311
- **Note:** Version bump only for package @entur/modal
312
-
313
- ## [1.1.14](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.1.13...@entur/modal@1.1.14) (2020-04-23)
314
-
315
- ### Bug Fixes
316
-
317
- - updated to use new focus styling where applicable ([d0a52c0](https://bitbucket.org/enturas/design-system/commits/d0a52c096b673c6647070a90dd79bef9003ee0ad))
318
-
319
- ## [1.1.13](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.1.12...@entur/modal@1.1.13) (2020-04-08)
320
-
321
- **Note:** Version bump only for package @entur/modal
322
-
323
- ## [1.1.12](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.1.10...@entur/modal@1.1.12) (2020-03-25)
324
-
325
- **Note:** Version bump only for package @entur/modal
326
-
327
- ## [1.1.11](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.1.10...@entur/modal@1.1.11) (2020-03-25)
328
-
329
- **Note:** Version bump only for package @entur/modal
330
-
331
- ## [1.1.10](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.1.9...@entur/modal@1.1.10) (2020-03-20)
332
-
333
- **Note:** Version bump only for package @entur/modal
334
-
335
- ## [1.1.9](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.1.8...@entur/modal@1.1.9) (2020-03-18)
336
-
337
- **Note:** Version bump only for package @entur/modal
338
-
339
- ## [1.1.8](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.1.7...@entur/modal@1.1.8) (2020-03-05)
340
-
341
- **Note:** Version bump only for package @entur/modal
342
-
343
- ## [1.1.7](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.1.6...@entur/modal@1.1.7) (2020-02-26)
344
-
345
- **Note:** Version bump only for package @entur/modal
346
-
347
- ## [1.1.6](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.1.5...@entur/modal@1.1.6) (2020-02-20)
348
-
349
- **Note:** Version bump only for package @entur/modal
350
-
351
- ## [1.1.5](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.1.4...@entur/modal@1.1.5) (2020-02-14)
352
-
353
- **Note:** Version bump only for package @entur/modal
354
-
355
- ## [1.1.4](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.1.3...@entur/modal@1.1.4) (2020-02-12)
356
-
357
- ### Bug Fixes
358
-
359
- - fix missing type for spreading of props ([0e5beba](https://bitbucket.org/enturas/design-system/commits/0e5beba82ea7dde39915cd626e665aa6c15dafbf))
360
-
361
- ## [1.1.3](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.1.2...@entur/modal@1.1.3) (2020-02-10)
362
-
363
- **Note:** Version bump only for package @entur/modal
364
-
365
- ## [1.1.2](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.1.1...@entur/modal@1.1.2) (2020-02-05)
366
-
367
- **Note:** Version bump only for package @entur/modal
368
-
369
- ## [1.1.1](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.1.0...@entur/modal@1.1.1) (2020-02-05)
370
-
371
- ### Bug Fixes
372
-
373
- - remove test-files from build process ([e0b24af](https://bitbucket.org/enturas/design-system/commits/e0b24af05d5c2ad8de4ae587d83c389495235890))
374
-
375
- # [1.1.0](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.0.7...@entur/modal@1.1.0) (2020-01-28)
376
-
377
- ### Features
378
-
379
- - **Drawer:** add new component - Drawer ([e869df0](https://bitbucket.org/enturas/design-system/commits/e869df0946bdc81c177df4b25f3cfe5dee0a7eb5))
380
-
381
- ## [1.0.7](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.0.6...@entur/modal@1.0.7) (2020-01-27)
382
-
383
- ### Bug Fixes
384
-
385
- - **types:** place types in the correct place ([acace09](https://bitbucket.org/enturas/design-system/commits/acace09ec0e258c5cff3a65e13ab29d6603780d9))
386
-
387
- ## [1.0.6](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.0.5...@entur/modal@1.0.6) (2020-01-20)
388
-
389
- **Note:** Version bump only for package @entur/modal
390
-
391
- ## [1.0.5](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.0.4...@entur/modal@1.0.5) (2020-01-14)
392
-
393
- **Note:** Version bump only for package @entur/modal
394
-
395
- ## [1.0.4](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.0.3...@entur/modal@1.0.4) (2020-01-13)
396
-
397
- ### Bug Fixes
398
-
399
- - fix focus styling for close button in modal window ([8d4b02f](https://bitbucket.org/enturas/design-system/commits/8d4b02f77500200c9a5281c9bb07a629fc3134b1))
400
-
401
- ## [1.0.3](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.0.2...@entur/modal@1.0.3) (2020-01-10)
402
-
403
- ### Bug Fixes
404
-
405
- - **modal:** added a max height to the modal as well as overflow handling. ([32e78d9](https://bitbucket.org/enturas/design-system/commits/32e78d91b51599591c3cafc35f4adeffce966617))
406
-
407
- ## [1.0.2](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.0.1...@entur/modal@1.0.2) (2020-01-08)
408
-
409
- ### Bug Fixes
410
-
411
- - warn in development if the developer have forgotten the CSS ([e5c30fc](https://bitbucket.org/enturas/design-system/commits/e5c30fc08624ef22c02773892778abd92205c6b0))
412
-
413
- ## [1.0.1](https://bitbucket.org/enturas/design-system/compare/@entur/modal@1.0.0...@entur/modal@1.0.1) (2020-01-06)
414
-
415
- **Note:** Version bump only for package @entur/modal
416
-
417
- # [1.0.0](https://bitbucket.org/enturas/design-system/compare/@entur/modal@0.3.1...@entur/modal@1.0.0) (2019-11-29)
418
-
419
- ### Bug Fixes
420
-
421
- - **Modal, ModalOverlay:** rename isOpen to open ([c910829](https://bitbucket.org/enturas/design-system/commits/c910829527f3352e73c30ee4a2ae2c79c0d35070))
422
- - **ModalContent:** add aria-labelledby to use the title as label ([400117c](https://bitbucket.org/enturas/design-system/commits/400117c93b03c693d088d579afa68c4702871330))
423
-
424
- ### Features
425
-
426
- - **Heading1-6:** add margin prop to all headings ([a167485](https://bitbucket.org/enturas/design-system/commits/a1674852143e8a99bff7c2dbebf20ff09aeea977))
427
- - **Modal, ModalContent:** add support for title and sizes ([5190a2f](https://bitbucket.org/enturas/design-system/commits/5190a2f29ba410870f8d21621066e3647ccf5e3a))
428
-
429
- ### BREAKING CHANGES
430
-
431
- - **Modal, ModalOverlay:** Rename isOpen to open for the Modal and ModalOverlay components
432
- - **Modal, ModalContent:** The title prop is now required. Remove any top level heading, and use the title prop instead. The
433
- size prop is now required, too.
434
-
435
- ## [0.3.1](https://bitbucket.org/enturas/design-system/compare/@entur/modal@0.3.0...@entur/modal@0.3.1) (2019-11-27)
436
-
437
- ### Bug Fixes
438
-
439
- - **types:** simplify the types to avoid extraneous props ([571ac56](https://bitbucket.org/enturas/design-system/commits/571ac568abb5a6b2c353d5711418d1058b51a91b))
440
-
441
- # [0.3.0](https://bitbucket.org/enturas/design-system/compare/@entur/modal@0.2.1...@entur/modal@0.3.0) (2019-11-22)
442
-
443
- ### Bug Fixes
444
-
445
- - fixing potential duplication of props naming ([6efd896](https://bitbucket.org/enturas/design-system/commits/6efd896d381bca09bc047dbdaec6d2629a9571db))
446
-
447
- ### Features
448
-
449
- - **types:** exporting all public types for public components ([4a277ab](https://bitbucket.org/enturas/design-system/commits/4a277ab266fdb32a6760821a07b1c6cc716bac85))
450
-
451
- ## [0.2.1](https://bitbucket.org/enturas/design-system/compare/@entur/modal@0.2.0...@entur/modal@0.2.1) (2019-11-14)
452
-
453
- ### Bug Fixes
454
-
455
- - **css classnames:** fixing naming collisions with CSS classes ([a93ca43](https://bitbucket.org/enturas/design-system/commits/a93ca435d3a01d61d8f02694a672686b9e943a66))
456
-
457
- # 0.2.0 (2019-10-30)
458
-
459
- ### Bug Fixes
460
-
461
- - **modal:** add missing dependencies ([c1065c0](https://bitbucket.org/enturas/design-system/commits/c1065c00e746a99148e2ec0578f50e79c135ac8a))
462
- - update all packages to use new tokens ([4847835](https://bitbucket.org/enturas/design-system/commits/48478359b0e562ba828e06d9b5c57239316805c2))
463
- - **modal:** center modals on screen ([3525d8c](https://bitbucket.org/enturas/design-system/commits/3525d8c572431878582edc7e8bbbbfb2b1276ed3))
464
- - **style:** set a minimum width for all modals ([a4f208f](https://bitbucket.org/enturas/design-system/commits/a4f208f7a98a8cb671dc8532b360e73d3ce864d1))
465
-
466
- ### Features
467
-
468
- - **modal:** add new package @entur/modal ([642e78c](https://bitbucket.org/enturas/design-system/commits/642e78cac1f4db4e63ac3c202405c9876b68ff4a))