@entur/menu 5.0.0-alpha.0 → 5.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/OverflowMenu.d.ts +36 -24
- package/dist/Pagination.d.ts +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/menu.cjs.development.js +388 -294
- package/dist/menu.cjs.development.js.map +1 -1
- package/dist/menu.cjs.production.min.js +1 -1
- package/dist/menu.cjs.production.min.js.map +1 -1
- package/dist/menu.esm.js +391 -297
- package/dist/menu.esm.js.map +1 -1
- package/dist/styles.css +697 -329
- package/package.json +12 -12
package/dist/menu.esm.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { useRandomId, warnAboutMissingStyles } from '@entur/utils';
|
|
2
|
-
import React, { useState, useEffect, cloneElement } from 'react';
|
|
1
|
+
import { useOnClickOutside, useOnEscape, getNodeText, useRandomId, warnAboutMissingStyles } from '@entur/utils';
|
|
2
|
+
import React, { useState, useEffect, useRef, cloneElement, useContext } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
-
import { RightArrowIcon, MenuIcon, LeftArrowIcon, VerticalDotsIcon,
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { RightArrowIcon, MenuIcon, LeftArrowIcon, VerticalDotsIcon, DownArrowIcon } from '@entur/icons';
|
|
5
|
+
import { useFloating, autoUpdate, offset, flip, shift, useListNavigation, useTypeahead, useRole, useInteractions, FloatingList, useListItem } from '@floating-ui/react';
|
|
6
|
+
import { IconButton } from '@entur/button';
|
|
7
|
+
import { standardisePlacement } from '@entur/tooltip';
|
|
8
|
+
import { space } from '@entur/tokens';
|
|
7
9
|
import { VisuallyHidden } from '@entur/a11y';
|
|
8
|
-
import { useContrast, Contrast } from '@entur/layout';
|
|
9
10
|
import { Label } from '@entur/typography';
|
|
10
|
-
import {
|
|
11
|
+
import { ExpandArrow, BaseExpand } from '@entur/expand';
|
|
11
12
|
|
|
12
13
|
var BreadcrumbNavigation = function BreadcrumbNavigation(_ref) {
|
|
13
14
|
var _ref$ariaLabel = _ref['aria-label'],
|
|
@@ -74,25 +75,6 @@ var BreadcrumbItem = function BreadcrumbItem(_ref) {
|
|
|
74
75
|
}));
|
|
75
76
|
};
|
|
76
77
|
|
|
77
|
-
var _excluded$7 = ["className", "children", "size"];
|
|
78
|
-
var SideNavigation = function SideNavigation(_ref) {
|
|
79
|
-
var className = _ref.className,
|
|
80
|
-
children = _ref.children,
|
|
81
|
-
_ref$size = _ref.size,
|
|
82
|
-
size = _ref$size === void 0 ? 'medium' : _ref$size,
|
|
83
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$7);
|
|
84
|
-
if (!children || !React.Children.count(children)) {
|
|
85
|
-
return null;
|
|
86
|
-
}
|
|
87
|
-
return React.createElement("ul", _extends({
|
|
88
|
-
className: classNames('eds-side-navigation', {
|
|
89
|
-
'eds-side-navigation--small': size === 'small'
|
|
90
|
-
}, className)
|
|
91
|
-
}, rest), children);
|
|
92
|
-
};
|
|
93
|
-
/** This is required to check that the Menu */
|
|
94
|
-
SideNavigation.__IS_ENTUR_MENU__ = true;
|
|
95
|
-
|
|
96
78
|
function useControllableProp(_ref) {
|
|
97
79
|
var prop = _ref.prop,
|
|
98
80
|
_ref$updater = _ref.updater,
|
|
@@ -111,7 +93,7 @@ function useControllableProp(_ref) {
|
|
|
111
93
|
return prop === undefined ? [internalState, setInternalState] : [prop, updater];
|
|
112
94
|
}
|
|
113
95
|
|
|
114
|
-
var _excluded$
|
|
96
|
+
var _excluded$7 = ["className", "children", "size", "collapsed", "onCollapseToggle", "collapsibleButtonPosition", "openSideMenuAriaLabel", "closeSideMenuAriaLabel"];
|
|
115
97
|
var CollapsibleSideNavigation = function CollapsibleSideNavigation(_ref) {
|
|
116
98
|
var className = _ref.className,
|
|
117
99
|
children = _ref.children,
|
|
@@ -124,7 +106,7 @@ var CollapsibleSideNavigation = function CollapsibleSideNavigation(_ref) {
|
|
|
124
106
|
openSideMenuAriaLabel = _ref$openSideMenuAria === void 0 ? 'Åpne sidemeny' : _ref$openSideMenuAria,
|
|
125
107
|
_ref$closeSideMenuAri = _ref.closeSideMenuAriaLabel,
|
|
126
108
|
closeSideMenuAriaLabel = _ref$closeSideMenuAri === void 0 ? 'Lukk sidemeny' : _ref$closeSideMenuAri,
|
|
127
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
109
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$7);
|
|
128
110
|
var _useControllableProp = useControllableProp({
|
|
129
111
|
prop: collapsible,
|
|
130
112
|
defaultValue: false,
|
|
@@ -167,180 +149,155 @@ var useSideNavigationContext = function useSideNavigationContext() {
|
|
|
167
149
|
return context;
|
|
168
150
|
};
|
|
169
151
|
|
|
170
|
-
var
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
var
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
return true;
|
|
203
|
-
}
|
|
204
|
-
if (!child.props.children) {
|
|
205
|
-
return false;
|
|
206
|
-
}
|
|
207
|
-
return React.Children.toArray(child.props.children).some(function (child) {
|
|
208
|
-
return isActiveRecursively(child);
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
var defaultElementBaseItem = 'a';
|
|
212
|
-
var BaseSideNavigationItem = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
213
|
-
var className = _ref.className,
|
|
214
|
-
_ref$active = _ref.active,
|
|
215
|
-
active = _ref$active === void 0 ? false : _ref$active,
|
|
216
|
-
subMenu = _ref.subMenu,
|
|
217
|
-
icon = _ref.icon,
|
|
218
|
-
children = _ref.children,
|
|
219
|
-
as = _ref.as,
|
|
220
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$5);
|
|
221
|
-
var Element = as || defaultElementBaseItem;
|
|
222
|
-
var _useSideNavigationCon = useSideNavigationContext(),
|
|
223
|
-
isCollapsed = _useSideNavigationCon.isCollapsed;
|
|
224
|
-
var _useShowDelayedLabel = useShowDelayedLabel(isCollapsed),
|
|
225
|
-
showLabel = _useShowDelayedLabel[0];
|
|
226
|
-
return React.createElement("li", {
|
|
227
|
-
className: classNames('eds-side-navigation__item', className)
|
|
228
|
-
}, React.createElement(Element, _extends({
|
|
229
|
-
className: classNames('eds-side-navigation__click-target', {
|
|
230
|
-
'eds-side-navigation__click-target--active': active
|
|
152
|
+
var _excluded$6 = ["children", "className", "button", "buttonIcon", "placement", "aria-label"],
|
|
153
|
+
_excluded2$1 = ["children", "className", "onSelect", "href", "disabled"],
|
|
154
|
+
_excluded3$1 = ["href"];
|
|
155
|
+
var SelectContext = /*#__PURE__*/React.createContext({});
|
|
156
|
+
var OverflowMenu = function OverflowMenu(_ref) {
|
|
157
|
+
var children = _ref.children,
|
|
158
|
+
className = _ref.className,
|
|
159
|
+
button = _ref.button,
|
|
160
|
+
buttonIcon = _ref.buttonIcon,
|
|
161
|
+
_ref$placement = _ref.placement,
|
|
162
|
+
placement = _ref$placement === void 0 ? 'bottom-start' : _ref$placement,
|
|
163
|
+
_ref$ariaLabel = _ref['aria-label'],
|
|
164
|
+
ariaLabel = _ref$ariaLabel === void 0 ? 'åpne valgmeny' : _ref$ariaLabel,
|
|
165
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$6);
|
|
166
|
+
var _useState = useState(false),
|
|
167
|
+
isOpen = _useState[0],
|
|
168
|
+
setIsOpen = _useState[1];
|
|
169
|
+
var _useState2 = useState(null),
|
|
170
|
+
activeIndex = _useState2[0],
|
|
171
|
+
setActiveIndex = _useState2[1];
|
|
172
|
+
var listRef = useRef([]);
|
|
173
|
+
var labelsRef = useRef([]);
|
|
174
|
+
var _useFloating = useFloating({
|
|
175
|
+
whileElementsMounted: autoUpdate,
|
|
176
|
+
placement: standardisePlacement(
|
|
177
|
+
// check for left is added for backwards compatibility
|
|
178
|
+
rest.position === 'left' ? 'bottom-end' : placement),
|
|
179
|
+
open: isOpen,
|
|
180
|
+
onOpenChange: setIsOpen,
|
|
181
|
+
middleware: [offset(space.extraSmall2), flip(), shift({
|
|
182
|
+
padding: space.extraSmall
|
|
183
|
+
})]
|
|
231
184
|
}),
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
rest = _objectWithoutPropertiesLoose(_ref2, _excluded2$1);
|
|
240
|
-
return React.createElement(BaseSideNavigationItem, _extends({
|
|
241
|
-
as: "button",
|
|
242
|
-
disabled: true,
|
|
243
|
-
"aria-disabled": true,
|
|
244
|
-
ref: ref
|
|
245
|
-
}, rest), children);
|
|
246
|
-
});
|
|
247
|
-
var defaultElementItem = 'a';
|
|
248
|
-
var SideNavigationItem = /*#__PURE__*/React.forwardRef(function (_ref3, ref) {
|
|
249
|
-
var active = _ref3.active,
|
|
250
|
-
disabled = _ref3.disabled,
|
|
251
|
-
children = _ref3.children,
|
|
252
|
-
forceExpandSubMenus = _ref3.forceExpandSubMenus,
|
|
253
|
-
as = _ref3.as,
|
|
254
|
-
rest = _objectWithoutPropertiesLoose(_ref3, _excluded3$1);
|
|
255
|
-
var Element = as || defaultElementItem;
|
|
256
|
-
var childrenArray = React.Children.toArray(children);
|
|
257
|
-
var subMenu = childrenArray.find(function (child) {
|
|
258
|
-
return child && child.type && child.type.__IS_ENTUR_MENU__;
|
|
185
|
+
refs = _useFloating.refs,
|
|
186
|
+
floatingStyles = _useFloating.floatingStyles,
|
|
187
|
+
context = _useFloating.context;
|
|
188
|
+
var listNav = useListNavigation(context, {
|
|
189
|
+
listRef: listRef,
|
|
190
|
+
activeIndex: activeIndex,
|
|
191
|
+
onNavigate: setActiveIndex
|
|
259
192
|
});
|
|
260
|
-
var
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
ref: ref
|
|
266
|
-
}, rest), label);
|
|
267
|
-
}
|
|
268
|
-
if (!subMenu) {
|
|
269
|
-
return React.createElement(BaseSideNavigationItem, _extends({
|
|
270
|
-
as: Element,
|
|
271
|
-
active: active,
|
|
272
|
-
ref: ref
|
|
273
|
-
}, rest), label);
|
|
274
|
-
}
|
|
275
|
-
var isExpanded = forceExpandSubMenus || isActiveRecursively({
|
|
276
|
-
props: {
|
|
277
|
-
children: children,
|
|
278
|
-
active: active
|
|
193
|
+
var typeahead = useTypeahead(context, {
|
|
194
|
+
listRef: labelsRef,
|
|
195
|
+
activeIndex: activeIndex,
|
|
196
|
+
onMatch: function onMatch(index) {
|
|
197
|
+
return isOpen && setActiveIndex(index);
|
|
279
198
|
}
|
|
280
199
|
});
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
var _useShowDelayedLabel = useShowDelayedLabel(isCollapsed),
|
|
311
|
-
showLabel = _useShowDelayedLabel[0];
|
|
312
|
-
return React.createElement("div", _extends({
|
|
313
|
-
className: classNames('eds-side-navigation-group', className)
|
|
314
|
-
}, rest), React.createElement("button", {
|
|
200
|
+
var role = useRole(context, {
|
|
201
|
+
role: 'menu'
|
|
202
|
+
});
|
|
203
|
+
var _useInteractions = useInteractions([listNav, typeahead, role]),
|
|
204
|
+
getReferenceProps = _useInteractions.getReferenceProps,
|
|
205
|
+
getFloatingProps = _useInteractions.getFloatingProps,
|
|
206
|
+
getItemProps = _useInteractions.getItemProps;
|
|
207
|
+
var closeMenuAndReturnFocus = function closeMenuAndReturnFocus() {
|
|
208
|
+
var _refs$reference$curre;
|
|
209
|
+
setIsOpen(false);
|
|
210
|
+
// @ts-expect-error the reference element is actually focusable
|
|
211
|
+
(_refs$reference$curre = refs.reference.current) == null ? void 0 : _refs$reference$curre.focus == null ? void 0 : _refs$reference$curre.focus();
|
|
212
|
+
};
|
|
213
|
+
useOnClickOutside([refs.floating, refs.reference], function () {
|
|
214
|
+
return setIsOpen(false);
|
|
215
|
+
});
|
|
216
|
+
useOnEscape(refs.floating, closeMenuAndReturnFocus);
|
|
217
|
+
useOnEscape(refs.reference, closeMenuAndReturnFocus);
|
|
218
|
+
var selectContext = React.useMemo(function () {
|
|
219
|
+
return {
|
|
220
|
+
activeIndex: activeIndex,
|
|
221
|
+
getItemProps: getItemProps,
|
|
222
|
+
closeMenuAndReturnFocus: closeMenuAndReturnFocus
|
|
223
|
+
};
|
|
224
|
+
}, [activeIndex, getItemProps, closeMenuAndReturnFocus]);
|
|
225
|
+
var _buttonIcon = buttonIcon != null ? buttonIcon : React.createElement(VerticalDotsIcon, null);
|
|
226
|
+
return React.createElement(React.Fragment, null, !button ? React.createElement(IconButton, _extends({
|
|
227
|
+
ref: refs.setReference
|
|
228
|
+
}, getReferenceProps({
|
|
315
229
|
onClick: function onClick() {
|
|
316
|
-
return
|
|
230
|
+
return setIsOpen(!isOpen);
|
|
317
231
|
},
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
},
|
|
232
|
+
className: className,
|
|
233
|
+
'aria-label': ariaLabel
|
|
234
|
+
}), rest), _buttonIcon) : cloneElement(button, _extends({
|
|
235
|
+
ref: refs.setReference
|
|
236
|
+
}, getReferenceProps({
|
|
237
|
+
onClick: function onClick() {
|
|
238
|
+
return setIsOpen(!isOpen);
|
|
239
|
+
},
|
|
240
|
+
className: className,
|
|
241
|
+
'aria-label': ariaLabel
|
|
242
|
+
}), rest)), React.createElement(SelectContext.Provider, {
|
|
243
|
+
value: selectContext
|
|
244
|
+
}, React.createElement("div", _extends({
|
|
245
|
+
ref: refs.setFloating,
|
|
246
|
+
style: _extends({}, floatingStyles, {
|
|
247
|
+
display: isOpen ? 'initial' : 'none'
|
|
248
|
+
})
|
|
249
|
+
}, getFloatingProps({
|
|
250
|
+
className: 'eds-overflow-menu__menu-list'
|
|
251
|
+
})), React.createElement(FloatingList, {
|
|
252
|
+
elementsRef: listRef,
|
|
253
|
+
labelsRef: labelsRef
|
|
254
|
+
}, children))));
|
|
329
255
|
};
|
|
330
|
-
|
|
331
|
-
var
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
256
|
+
var OverflowMenuItem = function OverflowMenuItem(_ref2) {
|
|
257
|
+
var children = _ref2.children,
|
|
258
|
+
className = _ref2.className,
|
|
259
|
+
_ref2$onSelect = _ref2.onSelect,
|
|
260
|
+
onSelect = _ref2$onSelect === void 0 ? function () {
|
|
261
|
+
return undefined;
|
|
262
|
+
} : _ref2$onSelect,
|
|
263
|
+
href = _ref2.href,
|
|
264
|
+
disabled = _ref2.disabled,
|
|
265
|
+
rest = _objectWithoutPropertiesLoose(_ref2, _excluded2$1);
|
|
266
|
+
var _useContext = useContext(SelectContext),
|
|
267
|
+
activeIndex = _useContext.activeIndex,
|
|
268
|
+
getItemProps = _useContext.getItemProps,
|
|
269
|
+
closeMenuAndReturnFocus = _useContext.closeMenuAndReturnFocus;
|
|
270
|
+
var _useListItem = useListItem({
|
|
271
|
+
label: !disabled ? getNodeText(children) : null
|
|
272
|
+
}),
|
|
273
|
+
listItemRef = _useListItem.ref,
|
|
274
|
+
index = _useListItem.index;
|
|
275
|
+
var isHighlighted = activeIndex === index;
|
|
276
|
+
var isLink = href !== undefined;
|
|
277
|
+
var Element = isLink ? 'a' : 'button';
|
|
340
278
|
return React.createElement(Element, _extends({
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
279
|
+
ref: listItemRef,
|
|
280
|
+
className: classNames('eds-overflow-menu__item', {
|
|
281
|
+
'eds-overflow-menu__item--disabled': disabled,
|
|
282
|
+
'eds-overflow-menu__item--highlighted': isHighlighted
|
|
283
|
+
}, className),
|
|
284
|
+
role: "menuitem",
|
|
285
|
+
"aria-disabled": disabled,
|
|
286
|
+
"aria-selected": isHighlighted
|
|
287
|
+
}, getItemProps({
|
|
288
|
+
onClick: isLink || disabled ? undefined : function () {
|
|
289
|
+
onSelect();
|
|
290
|
+
closeMenuAndReturnFocus();
|
|
291
|
+
},
|
|
292
|
+
href: disabled ? undefined : href,
|
|
293
|
+
tabIndex: isHighlighted ? 0 : -1
|
|
294
|
+
}), rest), children);
|
|
295
|
+
};
|
|
296
|
+
var OverflowMenuLink = function OverflowMenuLink(_ref3) {
|
|
297
|
+
var href = _ref3.href,
|
|
298
|
+
rest = _objectWithoutPropertiesLoose(_ref3, _excluded3$1);
|
|
299
|
+
return React.createElement(OverflowMenuItem, _extends({
|
|
300
|
+
href: href
|
|
344
301
|
}, rest));
|
|
345
302
|
};
|
|
346
303
|
|
|
@@ -353,10 +310,10 @@ var PaginationPage = function PaginationPage(_ref) {
|
|
|
353
310
|
ariaLabel = _ref['aria-label'],
|
|
354
311
|
ariaDescribedby = _ref['aria-describedby'];
|
|
355
312
|
return React.createElement("button", {
|
|
356
|
-
className: classNames('eds-
|
|
357
|
-
'eds-
|
|
313
|
+
className: classNames('eds-pagination__controls__page', {
|
|
314
|
+
'eds-pagination__controls__page--selected': selected
|
|
358
315
|
}, {
|
|
359
|
-
'eds-
|
|
316
|
+
'eds-pagination__controls__page--disabled': disabled
|
|
360
317
|
}, className),
|
|
361
318
|
disabled: selected || disabled,
|
|
362
319
|
type: "button",
|
|
@@ -409,83 +366,19 @@ var PaginationInput = function PaginationInput(_ref) {
|
|
|
409
366
|
noValidate: true,
|
|
410
367
|
"aria-label": "form"
|
|
411
368
|
}, React.createElement("label", {
|
|
412
|
-
className: "eds-
|
|
369
|
+
className: "eds-pagination__controls__input__wrapper"
|
|
413
370
|
}, React.createElement("span", {
|
|
414
|
-
className: "eds-
|
|
371
|
+
className: "eds-pagination__controls__input__label"
|
|
415
372
|
}, label), React.createElement("input", {
|
|
416
373
|
type: "number",
|
|
417
374
|
max: pageCount,
|
|
418
|
-
className: "eds-
|
|
375
|
+
className: "eds-pagination__controls__input__field",
|
|
419
376
|
value: input,
|
|
420
377
|
onChange: handleChange
|
|
421
378
|
})));
|
|
422
379
|
};
|
|
423
380
|
|
|
424
|
-
var _excluded$
|
|
425
|
-
_excluded2 = ["children", "className", "onSelect", "disabled", "as"],
|
|
426
|
-
_excluded3 = ["children", "as", "className", "onSelect", "disabled"];
|
|
427
|
-
var OverflowMenu = function OverflowMenu(_ref) {
|
|
428
|
-
var children = _ref.children,
|
|
429
|
-
className = _ref.className,
|
|
430
|
-
button = _ref.button,
|
|
431
|
-
_ref$position = _ref.position,
|
|
432
|
-
position = _ref$position === void 0 ? 'right' : _ref$position,
|
|
433
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
|
434
|
-
return React.createElement("div", null, React.createElement(Menu, null, !button ? React.createElement(IconButton, _extends({
|
|
435
|
-
as: MenuButton,
|
|
436
|
-
className: classNames(className, 'eds-overflow-menu__menu-button')
|
|
437
|
-
}, rest), React.createElement(VerticalDotsIcon, null)) : cloneElement(button, _extends({
|
|
438
|
-
as: MenuButton,
|
|
439
|
-
className: classNames(className, 'eds-overflow-menu__menu-button')
|
|
440
|
-
}, rest)), useContrast() ? React.createElement(Contrast, {
|
|
441
|
-
className: classNames('eds-overflow-menu__menu-list'),
|
|
442
|
-
as: MenuList,
|
|
443
|
-
portal: false
|
|
444
|
-
}, [children]) : React.createElement(MenuList, {
|
|
445
|
-
className: classNames('eds-overflow-menu__menu-list', {
|
|
446
|
-
'eds-overflow-menu__menu-list--left': position === 'left'
|
|
447
|
-
}),
|
|
448
|
-
portal: false
|
|
449
|
-
}, [children])));
|
|
450
|
-
};
|
|
451
|
-
var OverflowMenuItem = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
|
|
452
|
-
var children = _ref2.children,
|
|
453
|
-
className = _ref2.className,
|
|
454
|
-
onSelect = _ref2.onSelect,
|
|
455
|
-
disabled = _ref2.disabled,
|
|
456
|
-
_ref2$as = _ref2.as,
|
|
457
|
-
as = _ref2$as === void 0 ? 'div' : _ref2$as,
|
|
458
|
-
rest = _objectWithoutPropertiesLoose(_ref2, _excluded2);
|
|
459
|
-
return React.createElement(MenuItem, _extends({
|
|
460
|
-
className: classNames('eds-overflow-menu__item', {
|
|
461
|
-
'eds-overflow-menu__item--disabled': disabled
|
|
462
|
-
}, className),
|
|
463
|
-
onSelect: onSelect,
|
|
464
|
-
disabled: disabled,
|
|
465
|
-
ref: ref,
|
|
466
|
-
as: as
|
|
467
|
-
}, rest), children);
|
|
468
|
-
});
|
|
469
|
-
var OverflowMenuLink = /*#__PURE__*/React.forwardRef(function (_ref3, ref) {
|
|
470
|
-
var children = _ref3.children,
|
|
471
|
-
_ref3$as = _ref3.as,
|
|
472
|
-
as = _ref3$as === void 0 ? 'a' : _ref3$as,
|
|
473
|
-
className = _ref3.className,
|
|
474
|
-
onSelect = _ref3.onSelect,
|
|
475
|
-
disabled = _ref3.disabled,
|
|
476
|
-
rest = _objectWithoutPropertiesLoose(_ref3, _excluded3);
|
|
477
|
-
return React.createElement(MenuLink, _extends({
|
|
478
|
-
as: as,
|
|
479
|
-
className: classNames('eds-overflow-menu__item', {
|
|
480
|
-
'eds-overflow-menu__item--disabled': disabled
|
|
481
|
-
}, className),
|
|
482
|
-
onSelect: onSelect,
|
|
483
|
-
disabled: disabled,
|
|
484
|
-
ref: ref
|
|
485
|
-
}, rest), children);
|
|
486
|
-
});
|
|
487
|
-
|
|
488
|
-
var _excluded$1 = ["className", "currentPage", "inputLabel", "onPageChange", "pageCount", "pageLabel", "previousPageLabel", "currentPageLabelForScreenreader", "lastPageLabelForScreenreader", "showInput", "numberOfResults", "resultsPerPage", "resultsPerPageOptions", "onResultsPerPageChange", "showNumberOfResultsLabel", "nextPageLabel", "showingResultsLabel", "hideNextButton", "hidePrevButton"];
|
|
381
|
+
var _excluded$5 = ["className", "currentPage", "inputLabel", "onPageChange", "pageCount", "pageLabel", "previousPageLabel", "currentPageLabelForScreenreader", "lastPageLabelForScreenreader", "showInput", "numberOfResults", "resultsPerPage", "resultsPerPageOptions", "onResultsPerPageChange", "showNumberOfResultsLabel", "nextPageLabel", "showingResultsLabel", "changeNumberOfResultsLabelForScreenreader", "hideNextButton", "hidePrevButton"];
|
|
489
382
|
var Pagination = function Pagination(_ref) {
|
|
490
383
|
var className = _ref.className,
|
|
491
384
|
currentPage = _ref.currentPage,
|
|
@@ -516,12 +409,13 @@ var Pagination = function Pagination(_ref) {
|
|
|
516
409
|
showingResultsLabel = _ref$showingResultsLa === void 0 ? function (minPage, maxPage, pageCount) {
|
|
517
410
|
return "Viser resultat " + minPage + "\u2013" + maxPage + " av " + pageCount;
|
|
518
411
|
} : _ref$showingResultsLa,
|
|
412
|
+
_ref$changeNumberOfRe = _ref.changeNumberOfResultsLabelForScreenreader,
|
|
413
|
+
changeNumberOfResultsLabelForScreenreader = _ref$changeNumberOfRe === void 0 ? "Viser " + resultsPerPage + " resultater. Trykk for \xE5 endre antall. \xC5pner en flervalgsmeny." : _ref$changeNumberOfRe,
|
|
519
414
|
_ref$hideNextButton = _ref.hideNextButton,
|
|
520
415
|
hideNextButton = _ref$hideNextButton === void 0 ? false : _ref$hideNextButton,
|
|
521
416
|
_ref$hidePrevButton = _ref.hidePrevButton,
|
|
522
417
|
hidePrevButton = _ref$hidePrevButton === void 0 ? false : _ref$hidePrevButton,
|
|
523
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
524
|
-
var isContrast = useContrast();
|
|
418
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$5);
|
|
525
419
|
var _useState = useState([]),
|
|
526
420
|
listedEntries = _useState[0],
|
|
527
421
|
setListedEntries = _useState[1];
|
|
@@ -554,30 +448,26 @@ var Pagination = function Pagination(_ref) {
|
|
|
554
448
|
"aria-label": "Paginering"
|
|
555
449
|
}, rest), resultsPerPage && numberOfResults && React.createElement("div", {
|
|
556
450
|
className: "eds-pagination__results"
|
|
557
|
-
}, onResultsPerPageChange && React.createElement(
|
|
558
|
-
var isOpen = _ref2.isOpen;
|
|
559
|
-
return React.createElement(React.Fragment, null, React.createElement(Label, {
|
|
560
|
-
as: "p",
|
|
561
|
-
"aria-hidden": "true"
|
|
562
|
-
}, showNumberOfResultsLabel), React.createElement(MenuButton, {
|
|
563
|
-
className: classNames('eds-pagination-menu__menu-button', {
|
|
564
|
-
'eds-pagination-menu__menu-button--open': isOpen
|
|
565
|
-
})
|
|
566
|
-
}, React.createElement(VisuallyHidden, null, showNumberOfResultsLabel, " "), resultsPerPage, isOpen ? React.createElement(UpArrowIcon, null) : React.createElement(DownArrowIcon, null)), React.createElement(MenuList, {
|
|
567
|
-
className: classNames('eds-pagination-menu__menu-list', 'eds-overflow-menu__menu-list', {
|
|
568
|
-
'eds-contrast': isContrast
|
|
569
|
-
})
|
|
570
|
-
}, resultsPerPageOptions.map(function (option, key) {
|
|
571
|
-
return React.createElement(OverflowMenuItem, {
|
|
572
|
-
key: key,
|
|
573
|
-
onSelect: function onSelect() {
|
|
574
|
-
return onResultsPerPageChange(option);
|
|
575
|
-
}
|
|
576
|
-
}, option);
|
|
577
|
-
})));
|
|
578
|
-
}), React.createElement(Label, {
|
|
451
|
+
}, onResultsPerPageChange && React.createElement(React.Fragment, null, React.createElement(Label, {
|
|
579
452
|
as: "p",
|
|
580
|
-
|
|
453
|
+
"aria-hidden": "true"
|
|
454
|
+
}, showNumberOfResultsLabel), React.createElement(OverflowMenu, {
|
|
455
|
+
className: "eds-pagination__results__change-number-of-results",
|
|
456
|
+
buttonIcon: React.createElement(React.Fragment, null, resultsPerPage, ' ', React.createElement(DownArrowIcon, {
|
|
457
|
+
className: "eds-pagination__results__change-number-of-results__arrow",
|
|
458
|
+
"aria-hidden": "true"
|
|
459
|
+
})),
|
|
460
|
+
"aria-label": changeNumberOfResultsLabelForScreenreader,
|
|
461
|
+
placement: "bottom-end"
|
|
462
|
+
}, resultsPerPageOptions.map(function (option, key) {
|
|
463
|
+
return React.createElement(OverflowMenuItem, {
|
|
464
|
+
key: key,
|
|
465
|
+
onSelect: function onSelect() {
|
|
466
|
+
return onResultsPerPageChange(option);
|
|
467
|
+
}
|
|
468
|
+
}, option);
|
|
469
|
+
}))), React.createElement(Label, {
|
|
470
|
+
as: "p"
|
|
581
471
|
}, showingResultsLabel((currentPage - 1) * resultsPerPage + 1, currentPage * resultsPerPage > numberOfResults ? numberOfResults : currentPage * resultsPerPage, numberOfResults))), React.createElement("div", {
|
|
582
472
|
className: "eds-pagination__controls"
|
|
583
473
|
}, !hidePrevButton && React.createElement(PaginationPage, {
|
|
@@ -587,7 +477,9 @@ var Pagination = function Pagination(_ref) {
|
|
|
587
477
|
"aria-label": previousPageLabel,
|
|
588
478
|
"aria-describedby": paginationId,
|
|
589
479
|
disabled: isFirstPostSelected
|
|
590
|
-
}, React.createElement(LeftArrowIcon,
|
|
480
|
+
}, React.createElement(LeftArrowIcon, {
|
|
481
|
+
"aria-hidden": "true"
|
|
482
|
+
})), listedEntries.map(function (entry, index) {
|
|
591
483
|
return entry === '…' ? React.createElement(Ellipsis, {
|
|
592
484
|
key: "ellipsis-" + index
|
|
593
485
|
}) : React.createElement(PaginationPage, {
|
|
@@ -606,7 +498,9 @@ var Pagination = function Pagination(_ref) {
|
|
|
606
498
|
"aria-label": nextPageLabel,
|
|
607
499
|
"aria-describedby": paginationId,
|
|
608
500
|
disabled: isLastPostSelected
|
|
609
|
-
}, React.createElement(RightArrowIcon,
|
|
501
|
+
}, React.createElement(RightArrowIcon, {
|
|
502
|
+
"aria-hidden": "true"
|
|
503
|
+
})), showInput && React.createElement(PaginationInput, {
|
|
610
504
|
pageCount: pageCount,
|
|
611
505
|
currentPage: currentPage,
|
|
612
506
|
onPageChange: onPageChange,
|
|
@@ -617,12 +511,194 @@ var Pagination = function Pagination(_ref) {
|
|
|
617
511
|
};
|
|
618
512
|
var Ellipsis = function Ellipsis() {
|
|
619
513
|
return React.createElement("span", {
|
|
620
|
-
className: "eds-
|
|
514
|
+
className: "eds-pagination__controls__page__ellipsis",
|
|
621
515
|
"aria-hidden": "true"
|
|
622
516
|
}, "\u2026");
|
|
623
517
|
};
|
|
624
518
|
|
|
625
|
-
var _excluded = ["
|
|
519
|
+
var _excluded$4 = ["className", "children", "size"];
|
|
520
|
+
var SideNavigation = function SideNavigation(_ref) {
|
|
521
|
+
var className = _ref.className,
|
|
522
|
+
children = _ref.children,
|
|
523
|
+
_ref$size = _ref.size,
|
|
524
|
+
size = _ref$size === void 0 ? 'medium' : _ref$size,
|
|
525
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$4);
|
|
526
|
+
if (!children || !React.Children.count(children)) {
|
|
527
|
+
return null;
|
|
528
|
+
}
|
|
529
|
+
return React.createElement("ul", _extends({
|
|
530
|
+
className: classNames('eds-side-navigation', {
|
|
531
|
+
'eds-side-navigation--small': size === 'small'
|
|
532
|
+
}, className)
|
|
533
|
+
}, rest), children);
|
|
534
|
+
};
|
|
535
|
+
/** This is required to check that the Menu */
|
|
536
|
+
SideNavigation.__IS_ENTUR_MENU__ = true;
|
|
537
|
+
|
|
538
|
+
var useShowDelayedLabel = function useShowDelayedLabel(isCollapsed) {
|
|
539
|
+
var _useState = useState(true),
|
|
540
|
+
showLabel = _useState[0],
|
|
541
|
+
setShowLabel = _useState[1];
|
|
542
|
+
var hideDelay = 50;
|
|
543
|
+
var showDelay = 200;
|
|
544
|
+
useEffect(function () {
|
|
545
|
+
if (isCollapsed) {
|
|
546
|
+
setTimeout(function () {
|
|
547
|
+
setShowLabel(false);
|
|
548
|
+
}, hideDelay);
|
|
549
|
+
}
|
|
550
|
+
if (!isCollapsed) {
|
|
551
|
+
setTimeout(function () {
|
|
552
|
+
setShowLabel(true);
|
|
553
|
+
}, showDelay);
|
|
554
|
+
}
|
|
555
|
+
return function () {
|
|
556
|
+
return undefined;
|
|
557
|
+
};
|
|
558
|
+
}, [isCollapsed]);
|
|
559
|
+
return [showLabel];
|
|
560
|
+
};
|
|
561
|
+
|
|
562
|
+
var _excluded$3 = ["className", "active", "subMenu", "icon", "children", "as"],
|
|
563
|
+
_excluded2 = ["children"],
|
|
564
|
+
_excluded3 = ["active", "disabled", "children", "forceExpandSubMenus", "as"];
|
|
565
|
+
function isActiveRecursively(child) {
|
|
566
|
+
if (!child.props) {
|
|
567
|
+
return false;
|
|
568
|
+
}
|
|
569
|
+
if (child.props.active) {
|
|
570
|
+
return true;
|
|
571
|
+
}
|
|
572
|
+
if (!child.props.children) {
|
|
573
|
+
return false;
|
|
574
|
+
}
|
|
575
|
+
return React.Children.toArray(child.props.children).some(function (child) {
|
|
576
|
+
return isActiveRecursively(child);
|
|
577
|
+
});
|
|
578
|
+
}
|
|
579
|
+
var defaultElementBaseItem = 'a';
|
|
580
|
+
var BaseSideNavigationItem = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
581
|
+
var className = _ref.className,
|
|
582
|
+
_ref$active = _ref.active,
|
|
583
|
+
active = _ref$active === void 0 ? false : _ref$active,
|
|
584
|
+
subMenu = _ref.subMenu,
|
|
585
|
+
icon = _ref.icon,
|
|
586
|
+
children = _ref.children,
|
|
587
|
+
as = _ref.as,
|
|
588
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
|
|
589
|
+
var Element = as || defaultElementBaseItem;
|
|
590
|
+
var _useSideNavigationCon = useSideNavigationContext(),
|
|
591
|
+
isCollapsed = _useSideNavigationCon.isCollapsed;
|
|
592
|
+
var _useShowDelayedLabel = useShowDelayedLabel(isCollapsed),
|
|
593
|
+
showLabel = _useShowDelayedLabel[0];
|
|
594
|
+
return React.createElement("li", {
|
|
595
|
+
className: classNames('eds-side-navigation__item', className)
|
|
596
|
+
}, React.createElement(Element, _extends({
|
|
597
|
+
className: classNames('eds-side-navigation__click-target', {
|
|
598
|
+
'eds-side-navigation__click-target--active': active
|
|
599
|
+
}),
|
|
600
|
+
"aria-label": isCollapsed ? children : undefined,
|
|
601
|
+
"aria-current": active ? 'page' : undefined,
|
|
602
|
+
ref: ref
|
|
603
|
+
}, rest), icon, showLabel && children), subMenu);
|
|
604
|
+
});
|
|
605
|
+
var DisabledSideNavigationItem = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
|
|
606
|
+
var children = _ref2.children,
|
|
607
|
+
rest = _objectWithoutPropertiesLoose(_ref2, _excluded2);
|
|
608
|
+
return React.createElement(BaseSideNavigationItem, _extends({
|
|
609
|
+
as: "button",
|
|
610
|
+
disabled: true,
|
|
611
|
+
"aria-disabled": true,
|
|
612
|
+
ref: ref,
|
|
613
|
+
type: "button"
|
|
614
|
+
}, rest), children);
|
|
615
|
+
});
|
|
616
|
+
var defaultElementItem = 'a';
|
|
617
|
+
var SideNavigationItem = /*#__PURE__*/React.forwardRef(function (_ref3, ref) {
|
|
618
|
+
var active = _ref3.active,
|
|
619
|
+
disabled = _ref3.disabled,
|
|
620
|
+
children = _ref3.children,
|
|
621
|
+
forceExpandSubMenus = _ref3.forceExpandSubMenus,
|
|
622
|
+
as = _ref3.as,
|
|
623
|
+
rest = _objectWithoutPropertiesLoose(_ref3, _excluded3);
|
|
624
|
+
var Element = as || defaultElementItem;
|
|
625
|
+
var childrenArray = React.Children.toArray(children);
|
|
626
|
+
var subMenu = childrenArray.find(function (child) {
|
|
627
|
+
return child && child.type && child.type.__IS_ENTUR_MENU__;
|
|
628
|
+
});
|
|
629
|
+
var label = subMenu ? childrenArray.filter(function (child) {
|
|
630
|
+
return child !== subMenu;
|
|
631
|
+
}) : children;
|
|
632
|
+
if (disabled) {
|
|
633
|
+
return React.createElement(DisabledSideNavigationItem, _extends({
|
|
634
|
+
ref: ref
|
|
635
|
+
}, rest), label);
|
|
636
|
+
}
|
|
637
|
+
if (!subMenu) {
|
|
638
|
+
return React.createElement(BaseSideNavigationItem, _extends({
|
|
639
|
+
as: Element,
|
|
640
|
+
active: active,
|
|
641
|
+
ref: ref
|
|
642
|
+
}, rest), label);
|
|
643
|
+
}
|
|
644
|
+
var isExpanded = forceExpandSubMenus || isActiveRecursively({
|
|
645
|
+
props: {
|
|
646
|
+
children: children,
|
|
647
|
+
active: active
|
|
648
|
+
}
|
|
649
|
+
});
|
|
650
|
+
return React.createElement(BaseSideNavigationItem, _extends({
|
|
651
|
+
active: active,
|
|
652
|
+
subMenu: isExpanded && subMenu,
|
|
653
|
+
"aria-expanded": isExpanded,
|
|
654
|
+
as: Element,
|
|
655
|
+
ref: ref
|
|
656
|
+
}, rest), label);
|
|
657
|
+
});
|
|
658
|
+
|
|
659
|
+
var _excluded$2 = ["defaultOpen", "open", "onToggle", "className", "children", "title", "icon"];
|
|
660
|
+
var SideNavigationGroup = function SideNavigationGroup(_ref) {
|
|
661
|
+
var _ref$defaultOpen = _ref.defaultOpen,
|
|
662
|
+
defaultOpen = _ref$defaultOpen === void 0 ? false : _ref$defaultOpen,
|
|
663
|
+
open = _ref.open,
|
|
664
|
+
onToggle = _ref.onToggle,
|
|
665
|
+
className = _ref.className,
|
|
666
|
+
children = _ref.children,
|
|
667
|
+
title = _ref.title,
|
|
668
|
+
icon = _ref.icon,
|
|
669
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
|
670
|
+
var _useControllableProp = useControllableProp({
|
|
671
|
+
prop: open,
|
|
672
|
+
updater: onToggle,
|
|
673
|
+
defaultValue: defaultOpen
|
|
674
|
+
}),
|
|
675
|
+
isOpen = _useControllableProp[0],
|
|
676
|
+
setOpen = _useControllableProp[1];
|
|
677
|
+
var _useSideNavigationCon = useSideNavigationContext(),
|
|
678
|
+
isCollapsed = _useSideNavigationCon.isCollapsed;
|
|
679
|
+
var _useShowDelayedLabel = useShowDelayedLabel(isCollapsed),
|
|
680
|
+
showLabel = _useShowDelayedLabel[0];
|
|
681
|
+
return React.createElement("div", _extends({
|
|
682
|
+
className: classNames('eds-side-navigation-group', className)
|
|
683
|
+
}, rest), React.createElement("button", {
|
|
684
|
+
onClick: function onClick() {
|
|
685
|
+
return setOpen(!isOpen);
|
|
686
|
+
},
|
|
687
|
+
type: "button",
|
|
688
|
+
className: "eds-side-navigation-group__trigger",
|
|
689
|
+
"aria-label": title + ", utvidbar meny, " + (isOpen ? 'åpen' : 'lukket')
|
|
690
|
+
}, React.createElement("span", null, icon && React.createElement("span", {
|
|
691
|
+
className: "eds-side-navigation-group__trigger-icon"
|
|
692
|
+
}, icon), showLabel && title), showLabel && React.createElement(ExpandArrow, {
|
|
693
|
+
open: isOpen,
|
|
694
|
+
className: "eds-side-navigation-group__expand-icon"
|
|
695
|
+
})), React.createElement(BaseExpand, {
|
|
696
|
+
className: "eds-side-navigation-group__expand-content",
|
|
697
|
+
open: isOpen
|
|
698
|
+
}, children));
|
|
699
|
+
};
|
|
700
|
+
|
|
701
|
+
var _excluded$1 = ["activeIndex", "className", "interactive", "onStepClick", "showStepperIndex", "steps", "ariaLabelStep", "ariaLabelOf", "ariaLabelCompleted", "ariaLabelSummary"];
|
|
626
702
|
var Stepper = function Stepper(_ref) {
|
|
627
703
|
var activeIndex = _ref.activeIndex,
|
|
628
704
|
className = _ref.className,
|
|
@@ -640,7 +716,7 @@ var Stepper = function Stepper(_ref) {
|
|
|
640
716
|
ariaLabelCompleted = _ref$ariaLabelComplet === void 0 ? 'fullført' : _ref$ariaLabelComplet,
|
|
641
717
|
_ref$ariaLabelSummary = _ref.ariaLabelSummary,
|
|
642
718
|
ariaLabelSummary = _ref$ariaLabelSummary === void 0 ? "Stegindikator med " + steps.length + " steg, du er p\xE5 steg " + (activeIndex + 1) + " " + steps[activeIndex] + "," : _ref$ariaLabelSummary,
|
|
643
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
719
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
644
720
|
return React.createElement("ol", _extends({
|
|
645
721
|
className: classNames('eds-stepper', className),
|
|
646
722
|
"aria-label": ariaLabelSummary
|
|
@@ -656,7 +732,8 @@ var Stepper = function Stepper(_ref) {
|
|
|
656
732
|
}
|
|
657
733
|
} : {};
|
|
658
734
|
return React.createElement("li", {
|
|
659
|
-
key: step
|
|
735
|
+
key: step,
|
|
736
|
+
className: "eds-stepper__step__wrapper"
|
|
660
737
|
}, React.createElement(Element, _extends({
|
|
661
738
|
className: classNames('eds-stepper__step', {
|
|
662
739
|
'eds-stepper__step--active': isCurrent
|
|
@@ -665,7 +742,8 @@ var Stepper = function Stepper(_ref) {
|
|
|
665
742
|
}, {
|
|
666
743
|
'eds-stepper__step--interactive': isInteractive
|
|
667
744
|
}),
|
|
668
|
-
"aria-current": isCurrent ? 'step' : undefined
|
|
745
|
+
"aria-current": isCurrent ? 'step' : undefined,
|
|
746
|
+
type: Element === 'button' ? 'button' : undefined
|
|
669
747
|
}, props), React.createElement("div", {
|
|
670
748
|
className: "eds-stepper__step__line",
|
|
671
749
|
"aria-hidden": true
|
|
@@ -676,6 +754,22 @@ var Stepper = function Stepper(_ref) {
|
|
|
676
754
|
}));
|
|
677
755
|
};
|
|
678
756
|
|
|
757
|
+
var _excluded = ["active", "className", "as"];
|
|
758
|
+
var defaultElement = 'a';
|
|
759
|
+
var TopNavigationItem = function TopNavigationItem(_ref) {
|
|
760
|
+
var _ref$active = _ref.active,
|
|
761
|
+
active = _ref$active === void 0 ? false : _ref$active,
|
|
762
|
+
className = _ref.className,
|
|
763
|
+
as = _ref.as,
|
|
764
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
765
|
+
var Element = as || defaultElement;
|
|
766
|
+
return React.createElement(Element, _extends({
|
|
767
|
+
className: classNames(['eds-top-navigation-item', className, {
|
|
768
|
+
'eds-top-navigation-item--active': active
|
|
769
|
+
}])
|
|
770
|
+
}, rest));
|
|
771
|
+
};
|
|
772
|
+
|
|
679
773
|
warnAboutMissingStyles('menu', 'expand', 'icons', 'typography', 'button', 'layout', 'a11y');
|
|
680
774
|
|
|
681
775
|
export { BreadcrumbItem, BreadcrumbNavigation, CollapsibleSideNavigation, OverflowMenu, OverflowMenuItem, OverflowMenuLink, Pagination, SideNavigation, SideNavigationGroup, SideNavigationItem, Stepper, TopNavigationItem, useSideNavigationContext };
|