@entur/tooltip 2.6.1 → 2.6.3

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/Popover.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { Placement } from '@popperjs/core';
3
3
  import './Popover.scss';
4
- export declare type PopoverProps = {
4
+ export type PopoverProps = {
5
5
  /** Innholdet i Popover */
6
6
  children: React.ReactNode;
7
7
  /** Plasseringen av Popover
@@ -14,17 +14,17 @@ export declare type PopoverProps = {
14
14
  setShowPopover?: React.Dispatch<React.SetStateAction<boolean>>;
15
15
  };
16
16
  export declare const Popover: React.FC<PopoverProps>;
17
- export declare type PopoverTriggerProps = {
17
+ export type PopoverTriggerProps = {
18
18
  /** Knapp som skal brukes for å åpne Popover */
19
19
  children: React.ReactElement;
20
20
  };
21
21
  export declare const PopoverTrigger: React.FC<PopoverTriggerProps>;
22
- export declare type PopoverCloseButtonProps = {
22
+ export type PopoverCloseButtonProps = {
23
23
  /** En valgfri knapp som kan legges inn for å lukke Popover */
24
24
  children: React.ReactElement;
25
25
  };
26
26
  export declare const PopoverCloseButton: React.FC<PopoverCloseButtonProps>;
27
- export declare type PopoverContentProps = {
27
+ export type PopoverContentProps = {
28
28
  /**Innholdet til Popover */
29
29
  children: React.ReactNode;
30
30
  };
package/dist/Tooltip.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import './Tooltip.scss';
3
- declare type Modifier = {
3
+ type Modifier = {
4
4
  name: string;
5
5
  enabled?: boolean;
6
6
  requires?: Array<string>;
@@ -9,7 +9,7 @@ declare type Modifier = {
9
9
  data?: Record<string, unknown>;
10
10
  [key: string]: any;
11
11
  };
12
- export declare type TooltipProps = {
12
+ export type TooltipProps = {
13
13
  /** Plassering av tooltip-en */
14
14
  placement: 'top' | 'top-left' | 'top-right' | 'left' | 'right' | 'bottom-left' | 'bottom' | 'bottom-right';
15
15
  /** Innholdet i tooltip-boksen */
package/dist/styles.css CHANGED
@@ -2,6 +2,25 @@
2
2
  --eds-tooltip: 1;
3
3
  }/* DO NOT CHANGE!*/
4
4
  /* This file is automatically generated from @entur/tokens! Changes will be overwritten. */
5
+ .eds-popover {
6
+ background: #181c56;
7
+ box-shadow: 0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.25);
8
+ border-radius: 0.0625rem;
9
+ border: 0.0625rem solid #d1d3d3;
10
+ font-family: inherit;
11
+ z-index: 20;
12
+ }
13
+ .eds-contrast .eds-popover {
14
+ background: #292b6a;
15
+ box-shadow: 0 0.0625rem 0.1875rem #393d79;
16
+ }
17
+ .eds-popover--hidden {
18
+ display: none;
19
+ }
20
+ .eds-popover:focus {
21
+ outline: 5px solid red;
22
+ }/* DO NOT CHANGE!*/
23
+ /* This file is automatically generated from @entur/tokens! Changes will be overwritten. */
5
24
  .eds-tooltip-wrapper {
6
25
  display: inline-block;
7
26
  position: relative;
@@ -117,23 +136,4 @@
117
136
  .eds-tooltip--bottom-end::after {
118
137
  bottom: calc(100% - 0.25rem);
119
138
  left: calc(100% - 1rem);
120
- }/* DO NOT CHANGE!*/
121
- /* This file is automatically generated from @entur/tokens! Changes will be overwritten. */
122
- .eds-popover {
123
- background: #181c56;
124
- box-shadow: 0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.25);
125
- border-radius: 0.0625rem;
126
- border: 0.0625rem solid #d1d3d3;
127
- font-family: inherit;
128
- z-index: 20;
129
- }
130
- .eds-contrast .eds-popover {
131
- background: #292b6a;
132
- box-shadow: 0 0.0625rem 0.1875rem #393d79;
133
- }
134
- .eds-popover--hidden {
135
- display: none;
136
- }
137
- .eds-popover:focus {
138
- outline: 5px solid red;
139
139
  }
@@ -16,80 +16,69 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
16
16
  var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
17
17
 
18
18
  function _extends() {
19
- _extends = Object.assign || function (target) {
19
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
20
20
  for (var i = 1; i < arguments.length; i++) {
21
21
  var source = arguments[i];
22
-
23
22
  for (var key in source) {
24
23
  if (Object.prototype.hasOwnProperty.call(source, key)) {
25
24
  target[key] = source[key];
26
25
  }
27
26
  }
28
27
  }
29
-
30
28
  return target;
31
29
  };
32
-
33
30
  return _extends.apply(this, arguments);
34
31
  }
35
-
36
32
  function _objectWithoutPropertiesLoose(source, excluded) {
37
33
  if (source == null) return {};
38
34
  var target = {};
39
35
  var sourceKeys = Object.keys(source);
40
36
  var key, i;
41
-
42
37
  for (i = 0; i < sourceKeys.length; i++) {
43
38
  key = sourceKeys[i];
44
39
  if (excluded.indexOf(key) >= 0) continue;
45
40
  target[key] = source[key];
46
41
  }
47
-
48
42
  return target;
49
43
  }
50
44
 
51
45
  var _excluded$1 = ["placement", "content", "children", "className", "isOpen", "disableHoverListener", "disableFocusListener", "showCloseButton", "variant", "popperModifiers"];
52
46
  var Tooltip = function Tooltip(_ref) {
53
47
  var placement = _ref.placement,
54
- content = _ref.content,
55
- children = _ref.children,
56
- className = _ref.className,
57
- _ref$isOpen = _ref.isOpen,
58
- isOpen = _ref$isOpen === void 0 ? false : _ref$isOpen,
59
- _ref$disableHoverList = _ref.disableHoverListener,
60
- disableHoverListener = _ref$disableHoverList === void 0 ? false : _ref$disableHoverList,
61
- _ref$disableFocusList = _ref.disableFocusListener,
62
- disableFocusListener = _ref$disableFocusList === void 0 ? false : _ref$disableFocusList,
63
- _ref$showCloseButton = _ref.showCloseButton,
64
- showCloseButton = _ref$showCloseButton === void 0 ? true : _ref$showCloseButton,
65
- variant = _ref.variant,
66
- _ref$popperModifiers = _ref.popperModifiers,
67
- popperModifiers = _ref$popperModifiers === void 0 ? [{
68
- name: 'offset',
69
- options: {
70
- offset: [0, 10]
71
- }
72
- }] : _ref$popperModifiers,
73
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
74
-
48
+ content = _ref.content,
49
+ children = _ref.children,
50
+ className = _ref.className,
51
+ _ref$isOpen = _ref.isOpen,
52
+ isOpen = _ref$isOpen === void 0 ? false : _ref$isOpen,
53
+ _ref$disableHoverList = _ref.disableHoverListener,
54
+ disableHoverListener = _ref$disableHoverList === void 0 ? false : _ref$disableHoverList,
55
+ _ref$disableFocusList = _ref.disableFocusListener,
56
+ disableFocusListener = _ref$disableFocusList === void 0 ? false : _ref$disableFocusList,
57
+ _ref$showCloseButton = _ref.showCloseButton,
58
+ showCloseButton = _ref$showCloseButton === void 0 ? true : _ref$showCloseButton,
59
+ variant = _ref.variant,
60
+ _ref$popperModifiers = _ref.popperModifiers,
61
+ popperModifiers = _ref$popperModifiers === void 0 ? [{
62
+ name: 'offset',
63
+ options: {
64
+ offset: [0, 10]
65
+ }
66
+ }] : _ref$popperModifiers,
67
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
75
68
  var _useState = React.useState(isOpen || false),
76
- showTooltip = _useState[0],
77
- setShowTooltip = _useState[1];
78
-
69
+ showTooltip = _useState[0],
70
+ setShowTooltip = _useState[1];
79
71
  var hoverTimer;
80
-
81
72
  var handleOpen = function handleOpen(event) {
82
73
  event.persist();
83
74
  hoverTimer = setTimeout(function () {
84
75
  setShowTooltip(true);
85
76
  }, 150);
86
77
  };
87
-
88
78
  var onMouseExit = function onMouseExit() {
89
79
  setShowTooltip(false);
90
80
  clearTimeout(hoverTimer);
91
81
  };
92
-
93
82
  React__default["default"].useEffect(function () {
94
83
  return function () {
95
84
  clearTimeout(hoverTimer);
@@ -105,40 +94,32 @@ var Tooltip = function Tooltip(_ref) {
105
94
  }
106
95
  }, [content]);
107
96
  var popperPlacement = placement;
108
-
109
97
  if (placement.includes('-')) {
110
98
  if (placement.includes('right')) {
111
99
  popperPlacement = placement.replace('right', 'end');
112
100
  }
113
-
114
101
  if (placement.includes('left')) {
115
102
  popperPlacement = placement.replace('left', 'start');
116
103
  }
117
104
  }
118
-
119
105
  var childProps = {};
120
106
  childProps['aria-describedby'] = tooltipId;
121
-
122
107
  if (!disableFocusListener) {
123
108
  childProps.onFocus = function () {
124
109
  return setShowTooltip(true);
125
110
  };
126
-
127
111
  childProps.onBlur = function () {
128
112
  return setShowTooltip(false);
129
113
  };
130
114
  }
131
-
132
115
  if (!disableHoverListener) {
133
116
  childProps.onMouseEnter = function (e) {
134
117
  return handleOpen(e);
135
118
  };
136
-
137
119
  childProps.onMouseLeave = function () {
138
120
  return onMouseExit();
139
121
  };
140
122
  }
141
-
142
123
  return React__default["default"].createElement(reactPopper.Manager, null, React__default["default"].createElement(reactPopper.Reference, null, function (_ref2) {
143
124
  var ref = _ref2.ref;
144
125
  return React.cloneElement(children, _extends({
@@ -152,8 +133,8 @@ var Tooltip = function Tooltip(_ref) {
152
133
  placement: popperPlacement
153
134
  }, function (_ref3) {
154
135
  var ref = _ref3.ref,
155
- style = _ref3.style,
156
- popperPlacement = _ref3.placement;
136
+ style = _ref3.style,
137
+ popperPlacement = _ref3.placement;
157
138
  return React__default["default"].createElement("div", _extends({
158
139
  className: classNames__default["default"]('eds-tooltip', className, "eds-tooltip--" + popperPlacement, {
159
140
  'eds-tooltip--error': variant === 'error'
@@ -174,58 +155,48 @@ var Tooltip = function Tooltip(_ref) {
174
155
 
175
156
  var _excluded = ["children"];
176
157
  var PopoverContext = /*#__PURE__*/React.createContext(undefined);
177
-
178
158
  var usePopoverContext = function usePopoverContext() {
179
159
  var context = React.useContext(PopoverContext);
180
-
181
160
  if (context == null) {
182
161
  throw Error('usePopoverContext must be used within <Popover/>');
183
162
  }
184
-
185
163
  return context;
186
164
  };
187
-
188
165
  var useCustomState = function useCustomState(state, setState) {
189
166
  var _React$useState = React__default["default"].useState(false),
190
- internalState = _React$useState[0],
191
- setInternalState = _React$useState[1];
192
-
167
+ internalState = _React$useState[0],
168
+ setInternalState = _React$useState[1];
193
169
  var controlled = state !== undefined && setState !== undefined;
194
170
  if (controlled) return [state, setState, controlled];
195
171
  return [internalState, setInternalState, controlled];
196
172
  };
197
-
198
173
  var Popover = function Popover(_ref) {
199
174
  var children = _ref.children,
200
- _ref$placement = _ref.placement,
201
- placement = _ref$placement === void 0 ? 'bottom-start' : _ref$placement,
202
- controlledState = _ref.showPopover,
203
- setControlledState = _ref.setShowPopover;
204
-
175
+ _ref$placement = _ref.placement,
176
+ placement = _ref$placement === void 0 ? 'bottom-start' : _ref$placement,
177
+ controlledState = _ref.showPopover,
178
+ setControlledState = _ref.setShowPopover;
205
179
  var _useCustomState = useCustomState(controlledState, setControlledState),
206
- showPopover = _useCustomState[0],
207
- setShowPopover = _useCustomState[1],
208
- controlled = _useCustomState[2];
209
-
180
+ showPopover = _useCustomState[0],
181
+ setShowPopover = _useCustomState[1],
182
+ controlled = _useCustomState[2];
210
183
  var triggerElement = React__default["default"].useRef(null);
211
184
  var contentElement = React__default["default"].useRef(null);
212
-
213
185
  var _usePopper = reactPopper.usePopper(triggerElement.current, contentElement.current, {
214
- modifiers: [{
215
- name: 'arrow',
216
- enabled: false
217
- }, {
218
- name: 'offset',
219
- options: {
220
- offset: [0, 8]
221
- }
222
- }],
223
- placement: placement
224
- }),
225
- styles = _usePopper.styles,
226
- attributes = _usePopper.attributes,
227
- forceUpdate = _usePopper.forceUpdate;
228
-
186
+ modifiers: [{
187
+ name: 'arrow',
188
+ enabled: false
189
+ }, {
190
+ name: 'offset',
191
+ options: {
192
+ offset: [0, 8]
193
+ }
194
+ }],
195
+ placement: placement
196
+ }),
197
+ styles = _usePopper.styles,
198
+ attributes = _usePopper.attributes,
199
+ forceUpdate = _usePopper.forceUpdate;
229
200
  React__default["default"].useEffect(function () {
230
201
  if (forceUpdate) {
231
202
  forceUpdate();
@@ -267,8 +238,8 @@ var Popover = function Popover(_ref) {
267
238
  }
268
239
  },
269
240
  onBlur: function onBlur(event) {
270
- var elementReceivingFocus = event.relatedTarget; // The check for 'tabindex=-1' is a special case for focus handling in Docz
271
-
241
+ var elementReceivingFocus = event.relatedTarget;
242
+ // The check for 'tabindex=-1' is a special case for focus handling in Docz
272
243
  if (!elementReceivingFocus || elementReceivingFocus.getAttribute('tabindex') === '-1') return;
273
244
  var focusElementIsPopover = elementContainsElement(contentElement.current, elementReceivingFocus);
274
245
  var focusElementIsTrigger = elementContainsElement(triggerElement.current, elementReceivingFocus);
@@ -294,31 +265,25 @@ var Popover = function Popover(_ref) {
294
265
  };
295
266
  var PopoverTrigger = function PopoverTrigger(_ref2) {
296
267
  var children = _ref2.children;
297
-
298
268
  var _usePopoverContext = usePopoverContext(),
299
- triggerProps = _usePopoverContext.triggerProps;
300
-
269
+ triggerProps = _usePopoverContext.triggerProps;
301
270
  var child = React__default["default"].Children.only(children);
302
271
  return React.cloneElement(child, triggerProps());
303
272
  };
304
273
  var PopoverCloseButton = function PopoverCloseButton(_ref3) {
305
274
  var children = _ref3.children,
306
- rest = _objectWithoutPropertiesLoose(_ref3, _excluded);
307
-
275
+ rest = _objectWithoutPropertiesLoose(_ref3, _excluded);
308
276
  var _usePopoverContext2 = usePopoverContext(),
309
- closeButtonProps = _usePopoverContext2.closeButtonProps;
310
-
277
+ closeButtonProps = _usePopoverContext2.closeButtonProps;
311
278
  return React.cloneElement(children, _extends({}, closeButtonProps, rest));
312
279
  };
313
280
  var PopoverContent = /*#__PURE__*/React__default["default"].forwardRef(function (_ref4, ref) {
314
281
  var children = _ref4.children;
315
-
316
282
  var _usePopoverContext3 = usePopoverContext(),
317
- showPopover = _usePopoverContext3.showPopover,
318
- attributes = _usePopoverContext3.attributes,
319
- styles = _usePopoverContext3.styles,
320
- popoverContentProps = _usePopoverContext3.popoverContentProps;
321
-
283
+ showPopover = _usePopoverContext3.showPopover,
284
+ attributes = _usePopoverContext3.attributes,
285
+ styles = _usePopoverContext3.styles,
286
+ popoverContentProps = _usePopoverContext3.popoverContentProps;
322
287
  var props = popoverContentProps({
323
288
  ref: ref
324
289
  });
@@ -330,7 +295,6 @@ var PopoverContent = /*#__PURE__*/React__default["default"].forwardRef(function
330
295
  "aria-hidden": !showPopover
331
296
  }, attributes.styles, props), children);
332
297
  });
333
-
334
298
  function elementContainsElement(parent, child) {
335
299
  if (!parent) return false;
336
300
  return parent === child || parent.contains(child);
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip.cjs.development.js","sources":["../src/Tooltip.tsx","../src/Popover.tsx","../src/index.tsx"],"sourcesContent":["import React, { cloneElement, useState } from 'react';\nimport { Manager, Reference, Popper } from 'react-popper';\nimport classNames from 'classnames';\nimport { useRandomId } from '@entur/utils';\nimport { Placement as PopperPlacementProps } from '@popperjs/core';\nimport { CloseIcon } from '@entur/icons';\nimport { IconButton } from '@entur/button';\nimport './Tooltip.scss';\n\ntype Modifier = {\n name: string;\n enabled?: boolean;\n requires?: Array<string>;\n requiresIfExists?: Array<string>;\n options?: Record<string, unknown>;\n data?: Record<string, unknown>;\n [key: string]: any;\n};\n\nexport type TooltipProps = {\n /** Plassering av tooltip-en */\n placement:\n | 'top'\n | 'top-left'\n | 'top-right'\n | 'left'\n | 'right'\n | 'bottom-left' // bottom-start\n | 'bottom'\n | 'bottom-right'; // bottom-end\n /** Innholdet i tooltip-boksen */\n content: React.ReactNode;\n /** Elementet som skal ha tooltip-funksjonalitet */\n children: React.ReactElement;\n /** Om tooltipen skal vises */\n isOpen?: boolean;\n /** Ekstra klassenavn for tooltip */\n className?: string;\n /** Åpner ikke tooltip ved hover-events\n * @default false\n */\n disableHoverListener?: boolean;\n /** Åpner ikke tooltip ved focus-events\n * @default false\n */\n disableFocusListener?: boolean;\n /** Viser en lukkeknapp om man kontrollerer åpningen av Tooltip vha `isOpen`\n * @default true\n */\n showCloseButton?: boolean;\n /** Valideringsvariant for Tooltip */\n variant?: 'error';\n /** En array av modifiers som sendes til Popper, rammeverket som brukes til plassering av Tooltip\n * @default [{ name: 'offset', options: { offset: [0, 10]} }]\n */\n popperModifiers?: Modifier[];\n [key: string]: any;\n};\n\nexport const Tooltip: React.FC<TooltipProps> = ({\n placement,\n content,\n children,\n className,\n isOpen = false,\n disableHoverListener = false,\n disableFocusListener = false,\n showCloseButton = true,\n variant,\n popperModifiers = [\n {\n name: 'offset',\n options: { offset: [0, 10] },\n },\n ],\n ...rest\n}) => {\n const [showTooltip, setShowTooltip] = useState(isOpen || false);\n let hoverTimer: ReturnType<typeof setTimeout>;\n\n const handleOpen: (event: React.MouseEvent) => void = event => {\n event.persist();\n hoverTimer = setTimeout(() => {\n setShowTooltip(true);\n }, 150);\n };\n const onMouseExit: () => void = () => {\n setShowTooltip(false);\n clearTimeout(hoverTimer);\n };\n React.useEffect(() => {\n return () => {\n clearTimeout(hoverTimer);\n };\n });\n\n const tooltipId = useRandomId('eds-tooltip');\n React.useEffect(() => {\n setShowTooltip(isOpen);\n }, [isOpen]);\n\n React.useEffect(() => {\n if (!content) {\n setShowTooltip(false);\n }\n }, [content]);\n\n let popperPlacement = placement as PopperPlacementProps;\n if (placement.includes('-')) {\n if (placement.includes('right')) {\n popperPlacement = placement.replace(\n 'right',\n 'end',\n ) as PopperPlacementProps;\n }\n if (placement.includes('left')) {\n popperPlacement = placement.replace(\n 'left',\n 'start',\n ) as PopperPlacementProps;\n }\n }\n\n const childProps: {\n 'aria-describedby'?: string;\n onFocus?: () => void;\n onBlur?: () => void;\n onMouseEnter?: (e: React.MouseEvent) => void;\n onMouseLeave?: () => void;\n } = {};\n childProps['aria-describedby'] = tooltipId;\n if (!disableFocusListener) {\n childProps.onFocus = () => setShowTooltip(true);\n childProps.onBlur = () => setShowTooltip(false);\n }\n if (!disableHoverListener) {\n childProps.onMouseEnter = e => handleOpen(e);\n childProps.onMouseLeave = () => onMouseExit();\n }\n\n return (\n <Manager>\n <Reference>\n {({ ref }) =>\n cloneElement(children, {\n ref: ref,\n ...childProps,\n })\n }\n </Reference>\n {showTooltip && (\n <Popper\n modifiers={[{ name: 'arrow', enabled: false }, ...popperModifiers]}\n placement={popperPlacement}\n >\n {({ ref, style, placement: popperPlacement }) => (\n <div\n className={classNames(\n 'eds-tooltip',\n className,\n `eds-tooltip--${popperPlacement}`,\n { 'eds-tooltip--error': variant === 'error' },\n )}\n ref={ref}\n style={style}\n role=\"tooltip\"\n id={tooltipId}\n data-placement={popperPlacement}\n {...rest}\n >\n {content}\n {isOpen && showCloseButton && (\n <IconButton\n className=\"eds-tooltip__close-button\"\n onClick={() => setShowTooltip(false)}\n >\n <CloseIcon />\n </IconButton>\n )}\n </div>\n )}\n </Popper>\n )}\n </Manager>\n );\n};\n","import React, { cloneElement, createContext, useContext } from 'react';\n\nimport { usePopper } from 'react-popper';\nimport { Placement } from '@popperjs/core';\nimport classNames from 'classnames';\n\nimport { Contrast } from '@entur/layout';\nimport { useOnClickOutside } from '@entur/utils';\n\nimport './Popover.scss';\n\ntype PopoverContentCallbackProps = {\n ref: React.Ref<HTMLDivElement>;\n};\n\ntype PopoverContextProps = {\n showPopover: boolean;\n triggerElement?: React.RefObject<HTMLButtonElement>;\n contentElement: React.RefObject<HTMLDivElement>;\n styles: { [key: string]: React.CSSProperties };\n attributes: { [key: string]: { [key: string]: string } | undefined };\n closeButtonProps: Record<string, unknown>;\n popoverContentProps: (\n e: PopoverContentCallbackProps,\n ) => Record<string, unknown>;\n triggerProps: () => Record<string, unknown>;\n [key: string]: any;\n};\n\nconst PopoverContext = createContext<PopoverContextProps | undefined>(\n undefined,\n);\nconst usePopoverContext = () => {\n const context = useContext(PopoverContext);\n if (context == null) {\n throw Error('usePopoverContext must be used within <Popover/>');\n }\n return context;\n};\n\nconst useCustomState = (\n state?: boolean,\n setState?: React.Dispatch<React.SetStateAction<boolean>>,\n): [boolean, React.Dispatch<React.SetStateAction<boolean>>, boolean] => {\n const [internalState, setInternalState] = React.useState<boolean>(false);\n const controlled = state !== undefined && setState !== undefined;\n if (controlled) return [state, setState, controlled];\n return [internalState, setInternalState, controlled];\n};\n\nexport type PopoverProps = {\n /** Innholdet i Popover */\n children: React.ReactNode;\n /** Plasseringen av Popover\n * @default \"bottom-start\"\n */\n placement?: Placement;\n /** Hvis du ønsker å styre state selv kan du sende inn state her */\n showPopover?: boolean;\n /** Hvis du ønsker å styre state selv kan du sende inn setState her */\n setShowPopover?: React.Dispatch<React.SetStateAction<boolean>>;\n};\n\nexport const Popover: React.FC<PopoverProps> = ({\n children,\n placement = 'bottom-start',\n showPopover: controlledState,\n setShowPopover: setControlledState,\n}) => {\n const [showPopover, setShowPopover, controlled] = useCustomState(\n controlledState,\n setControlledState,\n );\n const triggerElement = React.useRef(null);\n const contentElement = React.useRef(null);\n\n const { styles, attributes, forceUpdate } = usePopper(\n triggerElement.current,\n contentElement.current,\n {\n modifiers: [\n { name: 'arrow', enabled: false },\n {\n name: 'offset',\n options: {\n offset: [0, 8],\n },\n },\n ],\n placement: placement,\n },\n );\n\n React.useEffect(() => {\n if (forceUpdate) {\n forceUpdate();\n }\n }, [showPopover, forceUpdate]);\n\n const triggerProps = React.useCallback(() => {\n const buttonProps = {\n 'aria-haspopup': 'dialog',\n 'aria-expanded': showPopover,\n ref: triggerElement,\n };\n const buttonOnClick = {\n onClick: (e: React.MouseEvent) => {\n e.preventDefault();\n setShowPopover(prev => !prev);\n },\n };\n return controlled ? buttonProps : { ...buttonProps, ...buttonOnClick };\n }, [triggerElement, showPopover, setShowPopover, controlled]);\n\n useOnClickOutside([contentElement, triggerElement], () =>\n setShowPopover(false),\n );\n const closeButtonProps = {\n onClick: (e: React.MouseEvent) => {\n e.preventDefault();\n setShowPopover(false);\n },\n };\n const popoverContentProps = React.useCallback(() => {\n const contentProps = {\n role: 'dialog',\n 'aria-modal': 'false',\n ref: contentElement,\n onKeyDown: (event: React.KeyboardEvent) => {\n if (event.key === 'Escape') {\n showPopover && setShowPopover(false);\n }\n },\n onBlur: (event: React.FocusEvent) => {\n const elementReceivingFocus = event.relatedTarget as HTMLElement;\n // The check for 'tabindex=-1' is a special case for focus handling in Docz\n if (\n !elementReceivingFocus ||\n elementReceivingFocus.getAttribute('tabindex') === '-1'\n )\n return;\n const focusElementIsPopover = elementContainsElement(\n contentElement.current,\n elementReceivingFocus,\n );\n const focusElementIsTrigger = elementContainsElement(\n triggerElement.current,\n elementReceivingFocus,\n );\n const isValidBlur = !focusElementIsPopover && !focusElementIsTrigger;\n if (showPopover && isValidBlur) setShowPopover(false);\n },\n };\n return contentProps;\n }, [contentElement, showPopover, setShowPopover]);\n const contextValue: PopoverContextProps = {\n showPopover,\n triggerElement,\n contentElement,\n styles,\n attributes,\n popoverContentProps,\n closeButtonProps,\n triggerProps,\n };\n return (\n <PopoverContext.Provider value={contextValue}>\n {children}\n </PopoverContext.Provider>\n );\n};\n\nexport type PopoverTriggerProps = {\n /** Knapp som skal brukes for å åpne Popover */\n children: React.ReactElement;\n};\n\nexport const PopoverTrigger: React.FC<PopoverTriggerProps> = ({ children }) => {\n const { triggerProps } = usePopoverContext();\n const child = React.Children.only(children) as React.ReactElement<any>;\n return cloneElement(child, triggerProps());\n};\n\nexport type PopoverCloseButtonProps = {\n /** En valgfri knapp som kan legges inn for å lukke Popover */\n children: React.ReactElement;\n};\n\nexport const PopoverCloseButton: React.FC<PopoverCloseButtonProps> = ({\n children,\n ...rest\n}) => {\n const { closeButtonProps } = usePopoverContext();\n return cloneElement(children, { ...closeButtonProps, ...rest });\n};\n\nexport type PopoverContentProps = {\n /**Innholdet til Popover */\n children: React.ReactNode;\n};\n\nexport const PopoverContent = React.forwardRef<\n HTMLDivElement,\n PopoverContentProps\n>(({ children }, ref: React.Ref<HTMLDivElement>) => {\n const { showPopover, attributes, styles, popoverContentProps } =\n usePopoverContext();\n const props = popoverContentProps({ ref });\n return (\n <Contrast\n className={classNames(\n 'eds-popover',\n {\n 'eds-popover--hidden': !showPopover,\n },\n 'eds-contrast',\n )}\n style={styles.popper}\n aria-hidden={!showPopover}\n {...attributes.styles}\n {...props}\n >\n {children}\n </Contrast>\n );\n});\n\nfunction elementContainsElement(\n parent: HTMLElement | null,\n child: HTMLElement,\n) {\n if (!parent) return false;\n return parent === child || parent.contains(child);\n}\n","import { warnAboutMissingStyles } from '@entur/utils';\nimport './index.scss';\n\nwarnAboutMissingStyles('tooltip');\n\nexport * from './Tooltip';\nexport * from './Popover';\n"],"names":["Tooltip","placement","content","children","className","isOpen","disableHoverListener","disableFocusListener","showCloseButton","variant","popperModifiers","name","options","offset","rest","useState","showTooltip","setShowTooltip","hoverTimer","handleOpen","event","persist","setTimeout","onMouseExit","clearTimeout","React","useEffect","tooltipId","useRandomId","popperPlacement","includes","replace","childProps","onFocus","onBlur","onMouseEnter","e","onMouseLeave","Manager","Reference","ref","cloneElement","Popper","modifiers","enabled","style","classNames","role","id","IconButton","onClick","CloseIcon","PopoverContext","createContext","undefined","usePopoverContext","context","useContext","Error","useCustomState","state","setState","internalState","setInternalState","controlled","Popover","controlledState","showPopover","setControlledState","setShowPopover","triggerElement","useRef","contentElement","usePopper","current","styles","attributes","forceUpdate","triggerProps","useCallback","buttonProps","buttonOnClick","preventDefault","prev","useOnClickOutside","closeButtonProps","popoverContentProps","contentProps","onKeyDown","key","elementReceivingFocus","relatedTarget","getAttribute","focusElementIsPopover","elementContainsElement","focusElementIsTrigger","isValidBlur","contextValue","Provider","value","PopoverTrigger","child","Children","only","PopoverCloseButton","PopoverContent","forwardRef","props","Contrast","popper","parent","contains","warnAboutMissingStyles"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA2DaA,OAAO,GAA2B,SAAlCA,OAAkC;MAC7CC,iBAAAA;MACAC,eAAAA;MACAC,gBAAAA;MACAC,iBAAAA;yBACAC;MAAAA,kCAAS;mCACTC;MAAAA,0DAAuB;mCACvBC;MAAAA,0DAAuB;kCACvBC;MAAAA,oDAAkB;MAClBC,eAAAA;kCACAC;MAAAA,oDAAkB,CAChB;AACEC,IAAAA,IAAI,EAAE,QADR;AAEEC,IAAAA,OAAO,EAAE;AAAEC,MAAAA,MAAM,EAAE,CAAC,CAAD,EAAI,EAAJ;AAAV;AAFX,GADgB;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AAQY,WAAR,uBAAQA,WAAR;AAAA,MAAqBS,UAArB,uBAAqBA,UAArB;AAAA,MAAiCD,MAAjC,uBAAiCA,MAAjC;AAAA,MAAyCW,mBAAzC,uBAAyCA,mBAAzC;;AAEA,MAAMqB,KAAK,GAAGrB,mBAAmB,CAAC;AAAE9C,IAAAA,GAAG,EAAHA;AAAF,GAAD,CAAjC;AACA,SACEf,uCAAA,CAACmF,eAAD;AACExG,IAAAA,SAAS,EAAE0C,8BAAU,CACnB,aADmB,EAEnB;AACE,6BAAuB,CAACqB;AAD1B,KAFmB,EAKnB,cALmB,CADvB;AAQEtB,IAAAA,KAAK,EAAE8B,MAAM,CAACkC,MARhB;mBASe,CAAC1C;AAThB,KAUMS,UAAU,CAACD,MAVjB,EAWMgC,KAXN,GAaGxG,QAbH,CADF;AAiBD,CAxB6B;;AA0B9B,SAAS2F,sBAAT,CACEgB,MADF,EAEET,KAFF;AAIE,MAAI,CAACS,MAAL,EAAa,OAAO,KAAP;AACb,SAAOA,MAAM,KAAKT,KAAX,IAAoBS,MAAM,CAACC,QAAP,CAAgBV,KAAhB,CAA3B;AACD;;ACtODW,4BAAsB,CAAC,SAAD,CAAtB;;;;;;;;"}
1
+ {"version":3,"file":"tooltip.cjs.development.js","sources":["../src/Tooltip.tsx","../src/Popover.tsx","../src/index.tsx"],"sourcesContent":["import React, { cloneElement, useState } from 'react';\nimport { Manager, Reference, Popper } from 'react-popper';\nimport classNames from 'classnames';\nimport { useRandomId } from '@entur/utils';\nimport { Placement as PopperPlacementProps } from '@popperjs/core';\nimport { CloseIcon } from '@entur/icons';\nimport { IconButton } from '@entur/button';\nimport './Tooltip.scss';\n\ntype Modifier = {\n name: string;\n enabled?: boolean;\n requires?: Array<string>;\n requiresIfExists?: Array<string>;\n options?: Record<string, unknown>;\n data?: Record<string, unknown>;\n [key: string]: any;\n};\n\nexport type TooltipProps = {\n /** Plassering av tooltip-en */\n placement:\n | 'top'\n | 'top-left'\n | 'top-right'\n | 'left'\n | 'right'\n | 'bottom-left' // bottom-start\n | 'bottom'\n | 'bottom-right'; // bottom-end\n /** Innholdet i tooltip-boksen */\n content: React.ReactNode;\n /** Elementet som skal ha tooltip-funksjonalitet */\n children: React.ReactElement;\n /** Om tooltipen skal vises */\n isOpen?: boolean;\n /** Ekstra klassenavn for tooltip */\n className?: string;\n /** Åpner ikke tooltip ved hover-events\n * @default false\n */\n disableHoverListener?: boolean;\n /** Åpner ikke tooltip ved focus-events\n * @default false\n */\n disableFocusListener?: boolean;\n /** Viser en lukkeknapp om man kontrollerer åpningen av Tooltip vha `isOpen`\n * @default true\n */\n showCloseButton?: boolean;\n /** Valideringsvariant for Tooltip */\n variant?: 'error';\n /** En array av modifiers som sendes til Popper, rammeverket som brukes til plassering av Tooltip\n * @default [{ name: 'offset', options: { offset: [0, 10]} }]\n */\n popperModifiers?: Modifier[];\n [key: string]: any;\n};\n\nexport const Tooltip: React.FC<TooltipProps> = ({\n placement,\n content,\n children,\n className,\n isOpen = false,\n disableHoverListener = false,\n disableFocusListener = false,\n showCloseButton = true,\n variant,\n popperModifiers = [\n {\n name: 'offset',\n options: { offset: [0, 10] },\n },\n ],\n ...rest\n}) => {\n const [showTooltip, setShowTooltip] = useState(isOpen || false);\n let hoverTimer: ReturnType<typeof setTimeout>;\n\n const handleOpen: (event: React.MouseEvent) => void = event => {\n event.persist();\n hoverTimer = setTimeout(() => {\n setShowTooltip(true);\n }, 150);\n };\n const onMouseExit: () => void = () => {\n setShowTooltip(false);\n clearTimeout(hoverTimer);\n };\n React.useEffect(() => {\n return () => {\n clearTimeout(hoverTimer);\n };\n });\n\n const tooltipId = useRandomId('eds-tooltip');\n React.useEffect(() => {\n setShowTooltip(isOpen);\n }, [isOpen]);\n\n React.useEffect(() => {\n if (!content) {\n setShowTooltip(false);\n }\n }, [content]);\n\n let popperPlacement = placement as PopperPlacementProps;\n if (placement.includes('-')) {\n if (placement.includes('right')) {\n popperPlacement = placement.replace(\n 'right',\n 'end',\n ) as PopperPlacementProps;\n }\n if (placement.includes('left')) {\n popperPlacement = placement.replace(\n 'left',\n 'start',\n ) as PopperPlacementProps;\n }\n }\n\n const childProps: {\n 'aria-describedby'?: string;\n onFocus?: () => void;\n onBlur?: () => void;\n onMouseEnter?: (e: React.MouseEvent) => void;\n onMouseLeave?: () => void;\n } = {};\n childProps['aria-describedby'] = tooltipId;\n if (!disableFocusListener) {\n childProps.onFocus = () => setShowTooltip(true);\n childProps.onBlur = () => setShowTooltip(false);\n }\n if (!disableHoverListener) {\n childProps.onMouseEnter = e => handleOpen(e);\n childProps.onMouseLeave = () => onMouseExit();\n }\n\n return (\n <Manager>\n <Reference>\n {({ ref }) =>\n cloneElement(children, {\n ref: ref,\n ...childProps,\n })\n }\n </Reference>\n {showTooltip && (\n <Popper\n modifiers={[{ name: 'arrow', enabled: false }, ...popperModifiers]}\n placement={popperPlacement}\n >\n {({ ref, style, placement: popperPlacement }) => (\n <div\n className={classNames(\n 'eds-tooltip',\n className,\n `eds-tooltip--${popperPlacement}`,\n { 'eds-tooltip--error': variant === 'error' },\n )}\n ref={ref}\n style={style}\n role=\"tooltip\"\n id={tooltipId}\n data-placement={popperPlacement}\n {...rest}\n >\n {content}\n {isOpen && showCloseButton && (\n <IconButton\n className=\"eds-tooltip__close-button\"\n onClick={() => setShowTooltip(false)}\n >\n <CloseIcon />\n </IconButton>\n )}\n </div>\n )}\n </Popper>\n )}\n </Manager>\n );\n};\n","import React, { cloneElement, createContext, useContext } from 'react';\n\nimport { usePopper } from 'react-popper';\nimport { Placement } from '@popperjs/core';\nimport classNames from 'classnames';\n\nimport { Contrast } from '@entur/layout';\nimport { useOnClickOutside } from '@entur/utils';\n\nimport './Popover.scss';\n\ntype PopoverContentCallbackProps = {\n ref: React.Ref<HTMLDivElement>;\n};\n\ntype PopoverContextProps = {\n showPopover: boolean;\n triggerElement?: React.RefObject<HTMLButtonElement>;\n contentElement: React.RefObject<HTMLDivElement>;\n styles: { [key: string]: React.CSSProperties };\n attributes: { [key: string]: { [key: string]: string } | undefined };\n closeButtonProps: Record<string, unknown>;\n popoverContentProps: (\n e: PopoverContentCallbackProps,\n ) => Record<string, unknown>;\n triggerProps: () => Record<string, unknown>;\n [key: string]: any;\n};\n\nconst PopoverContext = createContext<PopoverContextProps | undefined>(\n undefined,\n);\nconst usePopoverContext = () => {\n const context = useContext(PopoverContext);\n if (context == null) {\n throw Error('usePopoverContext must be used within <Popover/>');\n }\n return context;\n};\n\nconst useCustomState = (\n state?: boolean,\n setState?: React.Dispatch<React.SetStateAction<boolean>>,\n): [boolean, React.Dispatch<React.SetStateAction<boolean>>, boolean] => {\n const [internalState, setInternalState] = React.useState<boolean>(false);\n const controlled = state !== undefined && setState !== undefined;\n if (controlled) return [state, setState, controlled];\n return [internalState, setInternalState, controlled];\n};\n\nexport type PopoverProps = {\n /** Innholdet i Popover */\n children: React.ReactNode;\n /** Plasseringen av Popover\n * @default \"bottom-start\"\n */\n placement?: Placement;\n /** Hvis du ønsker å styre state selv kan du sende inn state her */\n showPopover?: boolean;\n /** Hvis du ønsker å styre state selv kan du sende inn setState her */\n setShowPopover?: React.Dispatch<React.SetStateAction<boolean>>;\n};\n\nexport const Popover: React.FC<PopoverProps> = ({\n children,\n placement = 'bottom-start',\n showPopover: controlledState,\n setShowPopover: setControlledState,\n}) => {\n const [showPopover, setShowPopover, controlled] = useCustomState(\n controlledState,\n setControlledState,\n );\n const triggerElement = React.useRef(null);\n const contentElement = React.useRef(null);\n\n const { styles, attributes, forceUpdate } = usePopper(\n triggerElement.current,\n contentElement.current,\n {\n modifiers: [\n { name: 'arrow', enabled: false },\n {\n name: 'offset',\n options: {\n offset: [0, 8],\n },\n },\n ],\n placement: placement,\n },\n );\n\n React.useEffect(() => {\n if (forceUpdate) {\n forceUpdate();\n }\n }, [showPopover, forceUpdate]);\n\n const triggerProps = React.useCallback(() => {\n const buttonProps = {\n 'aria-haspopup': 'dialog',\n 'aria-expanded': showPopover,\n ref: triggerElement,\n };\n const buttonOnClick = {\n onClick: (e: React.MouseEvent) => {\n e.preventDefault();\n setShowPopover(prev => !prev);\n },\n };\n return controlled ? buttonProps : { ...buttonProps, ...buttonOnClick };\n }, [triggerElement, showPopover, setShowPopover, controlled]);\n\n useOnClickOutside([contentElement, triggerElement], () =>\n setShowPopover(false),\n );\n const closeButtonProps = {\n onClick: (e: React.MouseEvent) => {\n e.preventDefault();\n setShowPopover(false);\n },\n };\n const popoverContentProps = React.useCallback(() => {\n const contentProps = {\n role: 'dialog',\n 'aria-modal': 'false',\n ref: contentElement,\n onKeyDown: (event: React.KeyboardEvent) => {\n if (event.key === 'Escape') {\n showPopover && setShowPopover(false);\n }\n },\n onBlur: (event: React.FocusEvent) => {\n const elementReceivingFocus = event.relatedTarget as HTMLElement;\n // The check for 'tabindex=-1' is a special case for focus handling in Docz\n if (\n !elementReceivingFocus ||\n elementReceivingFocus.getAttribute('tabindex') === '-1'\n )\n return;\n const focusElementIsPopover = elementContainsElement(\n contentElement.current,\n elementReceivingFocus,\n );\n const focusElementIsTrigger = elementContainsElement(\n triggerElement.current,\n elementReceivingFocus,\n );\n const isValidBlur = !focusElementIsPopover && !focusElementIsTrigger;\n if (showPopover && isValidBlur) setShowPopover(false);\n },\n };\n return contentProps;\n }, [contentElement, showPopover, setShowPopover]);\n const contextValue: PopoverContextProps = {\n showPopover,\n triggerElement,\n contentElement,\n styles,\n attributes,\n popoverContentProps,\n closeButtonProps,\n triggerProps,\n };\n return (\n <PopoverContext.Provider value={contextValue}>\n {children}\n </PopoverContext.Provider>\n );\n};\n\nexport type PopoverTriggerProps = {\n /** Knapp som skal brukes for å åpne Popover */\n children: React.ReactElement;\n};\n\nexport const PopoverTrigger: React.FC<PopoverTriggerProps> = ({ children }) => {\n const { triggerProps } = usePopoverContext();\n const child = React.Children.only(children) as React.ReactElement<any>;\n return cloneElement(child, triggerProps());\n};\n\nexport type PopoverCloseButtonProps = {\n /** En valgfri knapp som kan legges inn for å lukke Popover */\n children: React.ReactElement;\n};\n\nexport const PopoverCloseButton: React.FC<PopoverCloseButtonProps> = ({\n children,\n ...rest\n}) => {\n const { closeButtonProps } = usePopoverContext();\n return cloneElement(children, { ...closeButtonProps, ...rest });\n};\n\nexport type PopoverContentProps = {\n /**Innholdet til Popover */\n children: React.ReactNode;\n};\n\nexport const PopoverContent = React.forwardRef<\n HTMLDivElement,\n PopoverContentProps\n>(({ children }, ref: React.Ref<HTMLDivElement>) => {\n const { showPopover, attributes, styles, popoverContentProps } =\n usePopoverContext();\n const props = popoverContentProps({ ref });\n return (\n <Contrast\n className={classNames(\n 'eds-popover',\n {\n 'eds-popover--hidden': !showPopover,\n },\n 'eds-contrast',\n )}\n style={styles.popper}\n aria-hidden={!showPopover}\n {...attributes.styles}\n {...props}\n >\n {children}\n </Contrast>\n );\n});\n\nfunction elementContainsElement(\n parent: HTMLElement | null,\n child: HTMLElement,\n) {\n if (!parent) return false;\n return parent === child || parent.contains(child);\n}\n","import { warnAboutMissingStyles } from '@entur/utils';\nimport './index.scss';\n\nwarnAboutMissingStyles('tooltip');\n\nexport * from './Tooltip';\nexport * from './Popover';\n"],"names":["Tooltip","placement","content","children","className","isOpen","disableHoverListener","disableFocusListener","showCloseButton","variant","popperModifiers","name","options","offset","rest","_excluded","useState","showTooltip","setShowTooltip","hoverTimer","handleOpen","event","persist","setTimeout","onMouseExit","clearTimeout","React","useEffect","tooltipId","useRandomId","popperPlacement","includes","replace","childProps","onFocus","onBlur","onMouseEnter","e","onMouseLeave","Manager","createElement","Reference","ref","cloneElement","Popper","modifiers","enabled","style","classNames","role","id","IconButton","onClick","CloseIcon","PopoverContext","createContext","undefined","usePopoverContext","context","useContext","Error","useCustomState","state","setState","internalState","setInternalState","controlled","Popover","controlledState","showPopover","setControlledState","setShowPopover","triggerElement","useRef","contentElement","usePopper","current","styles","attributes","forceUpdate","triggerProps","useCallback","buttonProps","buttonOnClick","preventDefault","prev","useOnClickOutside","closeButtonProps","popoverContentProps","contentProps","onKeyDown","key","elementReceivingFocus","relatedTarget","getAttribute","focusElementIsPopover","elementContainsElement","focusElementIsTrigger","isValidBlur","contextValue","Provider","value","PopoverTrigger","child","Children","only","PopoverCloseButton","PopoverContent","forwardRef","props","Contrast","popper","parent","contains","warnAboutMissingStyles"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2DaA,IAAAA,OAAO,GAA2B,SAAlCA,OAAO,CAiBf,IAAA,EAAA;EAAA,IAhBHC,SAAS,QAATA,SAAS;AACTC,IAAAA,OAAO,QAAPA,OAAO;AACPC,IAAAA,QAAQ,QAARA,QAAQ;AACRC,IAAAA,SAAS,QAATA,SAAS;AAAA,IAAA,WAAA,GAAA,IAAA,CACTC,MAAM;AAANA,IAAAA,MAAM,4BAAG,KAAK,GAAA,WAAA;AAAA,IAAA,qBAAA,GAAA,IAAA,CACdC,oBAAoB;AAApBA,IAAAA,oBAAoB,sCAAG,KAAK,GAAA,qBAAA;AAAA,IAAA,qBAAA,GAAA,IAAA,CAC5BC,oBAAoB;AAApBA,IAAAA,oBAAoB,sCAAG,KAAK,GAAA,qBAAA;AAAA,IAAA,oBAAA,GAAA,IAAA,CAC5BC,eAAe;AAAfA,IAAAA,eAAe,qCAAG,IAAI,GAAA,oBAAA;AACtBC,IAAAA,OAAO,QAAPA,OAAO;AAAA,IAAA,oBAAA,GAAA,IAAA,CACPC,eAAe;AAAfA,IAAAA,eAAe,qCAAG,CAChB;AACEC,MAAAA,IAAI,EAAE,QAAQ;AACdC,MAAAA,OAAO,EAAE;AAAEC,QAAAA,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAA;AAAG,OAAA;AAC7B,KAAA,CACF,GAAA,oBAAA;IACEC,IAAI,GAAA,6BAAA,CAAA,IAAA,EAAAC,WAAA,CAAA,CAAA;AAEP,EAAA,IAAA,SAAA,GAAsCC,cAAQ,CAACX,MAAM,IAAI,KAAK,CAAC;IAAxDY,WAAW,GAAA,SAAA,CAAA,CAAA,CAAA;IAAEC,cAAc,GAAA,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;AACxB,EAAA,OAAO5C,kBAAY,CAACxC,QAAQ,eAAOoF,gBAAgB,EAAKzE,IAAI,CAAG,CAAA,CAAA;AACjE,EAAC;AAOM,IAAM6F,cAAc,gBAAGjF,yBAAK,CAACkF,UAAU,CAG5C,UAAelE,KAAAA,EAAAA,GAA8B,EAAI;EAAA,IAA9CvC,QAAQ,SAARA,QAAQ,CAAA;AACX,EAAA,IAAA,mBAAA,GACEsD,iBAAiB,EAAE;AADbY,IAAAA,WAAW,uBAAXA,WAAW;AAAES,IAAAA,UAAU,uBAAVA,UAAU;AAAED,IAAAA,MAAM,uBAANA,MAAM;AAAEW,IAAAA,mBAAmB,uBAAnBA,mBAAmB,CAAA;EAE5D,IAAMqB,KAAK,GAAGrB,mBAAmB,CAAC;AAAE9C,IAAAA,GAAG,EAAHA,GAAAA;AAAG,GAAE,CAAC,CAAA;AAC1C,EAAA,OACEhB,wCAACoF,eAAQ,EAAA,QAAA,CAAA;AACP1G,IAAAA,SAAS,EAAE4C,8BAAU,CACnB,aAAa,EACb;AACE,MAAA,qBAAqB,EAAE,CAACqB,WAAAA;KACzB,EACD,cAAc,CACf;IACDtB,KAAK,EAAE8B,MAAM,CAACkC,MAAM;AACP,IAAA,aAAA,EAAA,CAAC1C,WAAAA;AAAW,GAAA,EACrBS,UAAU,CAACD,MAAM,EACjBgC,KAAK,CAAA,EAER1G,QAAQ,CACA,CAAA;AAEf,CAAC,EAAC;AAEF,SAAS6F,sBAAsB,CAC7BgB,MAA0B,EAC1BT,KAAkB,EAAA;AAElB,EAAA,IAAI,CAACS,MAAM,EAAE,OAAO,KAAK,CAAA;EACzB,OAAOA,MAAM,KAAKT,KAAK,IAAIS,MAAM,CAACC,QAAQ,CAACV,KAAK,CAAC,CAAA;AACnD;;ACtOAW,4BAAsB,CAAC,SAAS,CAAC;;;;;;;;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@entur/utils"),t=require("react"),r=require("react-popper"),n=require("classnames"),o=require("@entur/icons"),u=require("@entur/button"),a=require("@entur/layout");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=i(t),s=i(n);function c(){return c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},c.apply(this,arguments)}function f(e,t){if(null==e)return{};var r,n,o={},u=Object.keys(e);for(n=0;n<u.length;n++)t.indexOf(r=u[n])>=0||(o[r]=e[r]);return o}var d=["placement","content","children","className","isOpen","disableHoverListener","disableFocusListener","showCloseButton","variant","popperModifiers"],p=["children"],v=t.createContext(void 0),m=function(){var e=t.useContext(v);if(null==e)throw Error("usePopoverContext must be used within <Popover/>");return e},b=l.default.forwardRef((function(e,t){var r=e.children,n=m(),o=n.showPopover,u=n.attributes,i=n.styles,f=(0,n.popoverContentProps)({ref:t});return l.default.createElement(a.Contrast,c({className:s.default("eds-popover",{"eds-popover--hidden":!o},"eds-contrast"),style:i.popper,"aria-hidden":!o},u.styles,f),r)}));function h(e,t){return!!e&&(e===t||e.contains(t))}e.warnAboutMissingStyles("tooltip"),exports.Popover=function(t){var n=t.children,o=t.placement,u=void 0===o?"bottom-start":o,a=function(e,t){var r=l.default.useState(!1),n=void 0!==e&&void 0!==t;return n?[e,t,n]:[r[0],r[1],n]}(t.showPopover,t.setShowPopover),i=a[0],s=a[1],f=a[2],d=l.default.useRef(null),p=l.default.useRef(null),m=r.usePopper(d.current,p.current,{modifiers:[{name:"arrow",enabled:!1},{name:"offset",options:{offset:[0,8]}}],placement:u}),b=m.styles,P=m.attributes,E=m.forceUpdate;l.default.useEffect((function(){E&&E()}),[i,E]);var g=l.default.useCallback((function(){var e={"aria-haspopup":"dialog","aria-expanded":i,ref:d};return f?e:c({},e,{onClick:function(e){e.preventDefault(),s((function(e){return!e}))}})}),[d,i,s,f]);e.useOnClickOutside([p,d],(function(){return s(!1)}));var y={onClick:function(e){e.preventDefault(),s(!1)}},C=l.default.useCallback((function(){return{role:"dialog","aria-modal":"false",ref:p,onKeyDown:function(e){"Escape"===e.key&&i&&s(!1)},onBlur:function(e){var t=e.relatedTarget;if(t&&"-1"!==t.getAttribute("tabindex")){var r=h(p.current,t),n=h(d.current,t);i&&!r&&!n&&s(!1)}}}}),[p,i,s]);return l.default.createElement(v.Provider,{value:{showPopover:i,triggerElement:d,contentElement:p,styles:b,attributes:P,popoverContentProps:C,closeButtonProps:y,triggerProps:g}},n)},exports.PopoverCloseButton=function(e){var r=e.children,n=f(e,p),o=m();return t.cloneElement(r,c({},o.closeButtonProps,n))},exports.PopoverContent=b,exports.PopoverTrigger=function(e){var r=e.children,n=m().triggerProps,o=l.default.Children.only(r);return t.cloneElement(o,n())},exports.Tooltip=function(n){var a,i=n.placement,p=n.content,v=n.children,m=n.className,b=n.isOpen,h=void 0!==b&&b,P=n.disableHoverListener,E=void 0!==P&&P,g=n.disableFocusListener,y=void 0!==g&&g,C=n.showCloseButton,w=void 0===C||C,x=n.variant,O=n.popperModifiers,k=void 0===O?[{name:"offset",options:{offset:[0,10]}}]:O,B=f(n,d),q=t.useState(h||!1),M=q[0],T=q[1];l.default.useEffect((function(){return function(){clearTimeout(a)}}));var j=e.useRandomId("eds-tooltip");l.default.useEffect((function(){T(h)}),[h]),l.default.useEffect((function(){p||T(!1)}),[p]);var L=i;i.includes("-")&&(i.includes("right")&&(L=i.replace("right","end")),i.includes("left")&&(L=i.replace("left","start")));var N={};return N["aria-describedby"]=j,y||(N.onFocus=function(){return T(!0)},N.onBlur=function(){return T(!1)}),E||(N.onMouseEnter=function(e){return e.persist(),void(a=setTimeout((function(){T(!0)}),150))},N.onMouseLeave=function(){return T(!1),void clearTimeout(a)}),l.default.createElement(r.Manager,null,l.default.createElement(r.Reference,null,(function(e){return t.cloneElement(v,c({ref:e.ref},N))})),M&&l.default.createElement(r.Popper,{modifiers:[{name:"arrow",enabled:!1}].concat(k),placement:L},(function(e){var t=e.ref,r=e.style,n=e.placement;return l.default.createElement("div",c({className:s.default("eds-tooltip",m,"eds-tooltip--"+n,{"eds-tooltip--error":"error"===x}),ref:t,style:r,role:"tooltip",id:j,"data-placement":n},B),p,h&&w&&l.default.createElement(u.IconButton,{className:"eds-tooltip__close-button",onClick:function(){return T(!1)}},l.default.createElement(o.CloseIcon,null)))})))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@entur/utils"),t=require("react"),r=require("react-popper"),n=require("classnames"),o=require("@entur/icons"),u=require("@entur/button"),a=require("@entur/layout");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=i(t),s=i(n);function c(){return c=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},c.apply(this,arguments)}function f(e,t){if(null==e)return{};var r,n,o={},u=Object.keys(e);for(n=0;n<u.length;n++)t.indexOf(r=u[n])>=0||(o[r]=e[r]);return o}var d=["placement","content","children","className","isOpen","disableHoverListener","disableFocusListener","showCloseButton","variant","popperModifiers"],p=["children"],v=t.createContext(void 0),m=function(){var e=t.useContext(v);if(null==e)throw Error("usePopoverContext must be used within <Popover/>");return e},b=l.default.forwardRef((function(e,t){var r=e.children,n=m(),o=n.showPopover,u=n.attributes,i=n.styles,f=(0,n.popoverContentProps)({ref:t});return l.default.createElement(a.Contrast,c({className:s.default("eds-popover",{"eds-popover--hidden":!o},"eds-contrast"),style:i.popper,"aria-hidden":!o},u.styles,f),r)}));function h(e,t){return!!e&&(e===t||e.contains(t))}e.warnAboutMissingStyles("tooltip"),exports.Popover=function(t){var n=t.children,o=t.placement,u=void 0===o?"bottom-start":o,a=function(e,t){var r=l.default.useState(!1),n=void 0!==e&&void 0!==t;return n?[e,t,n]:[r[0],r[1],n]}(t.showPopover,t.setShowPopover),i=a[0],s=a[1],f=a[2],d=l.default.useRef(null),p=l.default.useRef(null),m=r.usePopper(d.current,p.current,{modifiers:[{name:"arrow",enabled:!1},{name:"offset",options:{offset:[0,8]}}],placement:u}),b=m.styles,P=m.attributes,g=m.forceUpdate;l.default.useEffect((function(){g&&g()}),[i,g]);var E=l.default.useCallback((function(){var e={"aria-haspopup":"dialog","aria-expanded":i,ref:d};return f?e:c({},e,{onClick:function(e){e.preventDefault(),s((function(e){return!e}))}})}),[d,i,s,f]);e.useOnClickOutside([p,d],(function(){return s(!1)}));var y={onClick:function(e){e.preventDefault(),s(!1)}},C=l.default.useCallback((function(){return{role:"dialog","aria-modal":"false",ref:p,onKeyDown:function(e){"Escape"===e.key&&i&&s(!1)},onBlur:function(e){var t=e.relatedTarget;if(t&&"-1"!==t.getAttribute("tabindex")){var r=h(p.current,t),n=h(d.current,t);i&&!r&&!n&&s(!1)}}}}),[p,i,s]);return l.default.createElement(v.Provider,{value:{showPopover:i,triggerElement:d,contentElement:p,styles:b,attributes:P,popoverContentProps:C,closeButtonProps:y,triggerProps:E}},n)},exports.PopoverCloseButton=function(e){var r=e.children,n=f(e,p),o=m();return t.cloneElement(r,c({},o.closeButtonProps,n))},exports.PopoverContent=b,exports.PopoverTrigger=function(e){var r=e.children,n=m().triggerProps,o=l.default.Children.only(r);return t.cloneElement(o,n())},exports.Tooltip=function(n){var a,i=n.placement,p=n.content,v=n.children,m=n.className,b=n.isOpen,h=void 0!==b&&b,P=n.disableHoverListener,g=void 0!==P&&P,E=n.disableFocusListener,y=void 0!==E&&E,C=n.showCloseButton,w=void 0===C||C,x=n.variant,O=n.popperModifiers,k=void 0===O?[{name:"offset",options:{offset:[0,10]}}]:O,B=f(n,d),q=t.useState(h||!1),M=q[0],j=q[1];l.default.useEffect((function(){return function(){clearTimeout(a)}}));var T=e.useRandomId("eds-tooltip");l.default.useEffect((function(){j(h)}),[h]),l.default.useEffect((function(){p||j(!1)}),[p]);var L=i;i.includes("-")&&(i.includes("right")&&(L=i.replace("right","end")),i.includes("left")&&(L=i.replace("left","start")));var N={};return N["aria-describedby"]=T,y||(N.onFocus=function(){return j(!0)},N.onBlur=function(){return j(!1)}),g||(N.onMouseEnter=function(e){return e.persist(),void(a=setTimeout((function(){j(!0)}),150))},N.onMouseLeave=function(){return j(!1),void clearTimeout(a)}),l.default.createElement(r.Manager,null,l.default.createElement(r.Reference,null,(function(e){return t.cloneElement(v,c({ref:e.ref},N))})),M&&l.default.createElement(r.Popper,{modifiers:[{name:"arrow",enabled:!1}].concat(k),placement:L},(function(e){var t=e.ref,r=e.style,n=e.placement;return l.default.createElement("div",c({className:s.default("eds-tooltip",m,"eds-tooltip--"+n,{"eds-tooltip--error":"error"===x}),ref:t,style:r,role:"tooltip",id:T,"data-placement":n},B),p,h&&w&&l.default.createElement(u.IconButton,{className:"eds-tooltip__close-button",onClick:function(){return j(!1)}},l.default.createElement(o.CloseIcon,null)))})))};
2
2
  //# sourceMappingURL=tooltip.cjs.production.min.js.map