@entur/menu 5.2.1-beta.1 → 5.2.1-beta.4
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/BreadcrumbItem.d.ts +19 -0
- package/dist/BreadcrumbNavigation.d.ts +11 -0
- package/dist/CollapsibleSideNavigation.d.ts +27 -0
- package/dist/OverflowMenu.d.ts +55 -0
- package/dist/Pagination.d.ts +69 -0
- package/dist/PaginationInput.d.ts +8 -0
- package/dist/PaginationPage.d.ts +17 -0
- package/dist/SideNavigation.d.ts +16 -0
- package/dist/SideNavigationGroup.d.ts +20 -0
- package/dist/SideNavigationItem.d.ts +33 -0
- package/dist/Stepper.d.ts +39 -0
- package/dist/TopNavigationItem.d.ts +21 -0
- package/dist/index.d.ts +11 -352
- package/dist/index.js +8 -0
- package/dist/menu.cjs.development.js +793 -0
- package/dist/menu.cjs.development.js.map +1 -0
- package/dist/menu.cjs.production.min.js +2 -0
- package/dist/menu.cjs.production.min.js.map +1 -0
- package/dist/menu.esm.js +669 -712
- package/dist/menu.esm.js.map +1 -1
- package/dist/styles.css +667 -638
- package/dist/useControllableProp.d.ts +6 -0
- package/dist/useShowDelayedLabel.d.ts +1 -0
- package/package.json +20 -38
- package/dist/menu.cjs.js +0 -820
- package/dist/menu.cjs.js.map +0 -1
|
@@ -0,0 +1,793 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var utils = require('@entur/utils');
|
|
6
|
+
var React = require('react');
|
|
7
|
+
var classNames = require('classnames');
|
|
8
|
+
var icons = require('@entur/icons');
|
|
9
|
+
var react = require('@floating-ui/react');
|
|
10
|
+
var button = require('@entur/button');
|
|
11
|
+
var tooltip = require('@entur/tooltip');
|
|
12
|
+
var tokens = require('@entur/tokens');
|
|
13
|
+
var a11y = require('@entur/a11y');
|
|
14
|
+
var typography = require('@entur/typography');
|
|
15
|
+
var expand = require('@entur/expand');
|
|
16
|
+
|
|
17
|
+
var BreadcrumbNavigation = function BreadcrumbNavigation(_ref) {
|
|
18
|
+
var _ref$ariaLabel = _ref['aria-label'],
|
|
19
|
+
ariaLabel = _ref$ariaLabel === void 0 ? 'Brødsmulesti' : _ref$ariaLabel,
|
|
20
|
+
children = _ref.children;
|
|
21
|
+
return React.createElement("nav", {
|
|
22
|
+
"aria-label": ariaLabel
|
|
23
|
+
}, React.createElement("ol", {
|
|
24
|
+
className: "eds-breadcrumbs"
|
|
25
|
+
}, React.Children.map(children, function (child, index) {
|
|
26
|
+
// @ts-expect-error should check if children are correct but for now it is only mentioned in the documentation
|
|
27
|
+
return React.cloneElement(child, {
|
|
28
|
+
isCurrent: index + 1 === React.Children.count(children)
|
|
29
|
+
});
|
|
30
|
+
})));
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
function _extends() {
|
|
34
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
35
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
36
|
+
var t = arguments[e];
|
|
37
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
38
|
+
}
|
|
39
|
+
return n;
|
|
40
|
+
}, _extends.apply(null, arguments);
|
|
41
|
+
}
|
|
42
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
43
|
+
if (null == r) return {};
|
|
44
|
+
var t = {};
|
|
45
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
46
|
+
if (-1 !== e.indexOf(n)) continue;
|
|
47
|
+
t[n] = r[n];
|
|
48
|
+
}
|
|
49
|
+
return t;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
var _excluded$8 = ["className", "isCurrent", "as"];
|
|
53
|
+
var defaultElement$1 = 'a';
|
|
54
|
+
var BreadcrumbItem = function BreadcrumbItem(_ref) {
|
|
55
|
+
var className = _ref.className,
|
|
56
|
+
isCurrent = _ref.isCurrent,
|
|
57
|
+
as = _ref.as,
|
|
58
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$8);
|
|
59
|
+
var Element = as || defaultElement$1;
|
|
60
|
+
return React.createElement(React.Fragment, null, React.createElement("li", {
|
|
61
|
+
className: classNames('eds-breadcrumb__item', className)
|
|
62
|
+
}, React.createElement(Element, _extends({
|
|
63
|
+
"aria-current": isCurrent ? 'page' : undefined,
|
|
64
|
+
className: classNames('eds-breadcrumb__link', {
|
|
65
|
+
'eds-breadcrumb__link--current': isCurrent
|
|
66
|
+
})
|
|
67
|
+
}, rest))), !isCurrent && React.createElement(icons.RightArrowIcon, {
|
|
68
|
+
className: "eds-breadcrumb__separator",
|
|
69
|
+
inline: true,
|
|
70
|
+
role: "presentation"
|
|
71
|
+
}));
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
function useControllableProp(_ref) {
|
|
75
|
+
var prop = _ref.prop,
|
|
76
|
+
_ref$updater = _ref.updater,
|
|
77
|
+
updater = _ref$updater === void 0 ? function () {
|
|
78
|
+
return undefined;
|
|
79
|
+
} : _ref$updater,
|
|
80
|
+
defaultValue = _ref.defaultValue;
|
|
81
|
+
var _useState = React.useState(defaultValue),
|
|
82
|
+
internalState = _useState[0],
|
|
83
|
+
setInternalState = _useState[1];
|
|
84
|
+
React.useEffect(function () {
|
|
85
|
+
if (prop !== undefined) {
|
|
86
|
+
setInternalState(prop);
|
|
87
|
+
}
|
|
88
|
+
}, [prop]);
|
|
89
|
+
return prop === undefined ? [internalState, setInternalState] : [prop, updater];
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
var _excluded$7 = ["className", "children", "size", "collapsed", "onCollapseToggle", "collapsibleButtonPosition", "openSideMenuAriaLabel", "closeSideMenuAriaLabel"];
|
|
93
|
+
var CollapsibleSideNavigation = function CollapsibleSideNavigation(_ref) {
|
|
94
|
+
var className = _ref.className,
|
|
95
|
+
children = _ref.children,
|
|
96
|
+
size = _ref.size,
|
|
97
|
+
collapsible = _ref.collapsed,
|
|
98
|
+
onCollapseToggle = _ref.onCollapseToggle,
|
|
99
|
+
_ref$collapsibleButto = _ref.collapsibleButtonPosition,
|
|
100
|
+
collapsibleButtonPosition = _ref$collapsibleButto === void 0 ? '50%' : _ref$collapsibleButto,
|
|
101
|
+
_ref$openSideMenuAria = _ref.openSideMenuAriaLabel,
|
|
102
|
+
openSideMenuAriaLabel = _ref$openSideMenuAria === void 0 ? 'Åpne sidemeny' : _ref$openSideMenuAria,
|
|
103
|
+
_ref$closeSideMenuAri = _ref.closeSideMenuAriaLabel,
|
|
104
|
+
closeSideMenuAriaLabel = _ref$closeSideMenuAri === void 0 ? 'Lukk sidemeny' : _ref$closeSideMenuAri,
|
|
105
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$7);
|
|
106
|
+
var _useControllableProp = useControllableProp({
|
|
107
|
+
prop: collapsible,
|
|
108
|
+
defaultValue: false,
|
|
109
|
+
updater: onCollapseToggle
|
|
110
|
+
}),
|
|
111
|
+
collapsedMenu = _useControllableProp[0],
|
|
112
|
+
setCollapsedMenu = _useControllableProp[1];
|
|
113
|
+
return React.createElement(SideNavigationContext.Provider, {
|
|
114
|
+
value: {
|
|
115
|
+
isCollapsed: collapsedMenu
|
|
116
|
+
}
|
|
117
|
+
}, React.createElement("ul", _extends({
|
|
118
|
+
className: classNames('eds-side-navigation', {
|
|
119
|
+
'eds-side-navigation--small': size === 'small'
|
|
120
|
+
}, {
|
|
121
|
+
'eds-side-navigation--collapsed': collapsedMenu
|
|
122
|
+
}, className)
|
|
123
|
+
}, rest), children, React.createElement("button", {
|
|
124
|
+
className: "eds-side-navigation__collapse-button",
|
|
125
|
+
onClick: function onClick() {
|
|
126
|
+
return setCollapsedMenu(!collapsedMenu);
|
|
127
|
+
},
|
|
128
|
+
style: {
|
|
129
|
+
top: "" + collapsibleButtonPosition
|
|
130
|
+
}
|
|
131
|
+
}, collapsedMenu ? React.createElement(icons.MenuIcon, {
|
|
132
|
+
"aria-label": openSideMenuAriaLabel
|
|
133
|
+
}) : React.createElement(icons.LeftArrowIcon, {
|
|
134
|
+
"aria-label": closeSideMenuAriaLabel
|
|
135
|
+
}))));
|
|
136
|
+
};
|
|
137
|
+
var SideNavigationContext = /*#__PURE__*/React.createContext({
|
|
138
|
+
isCollapsed: false
|
|
139
|
+
});
|
|
140
|
+
var useSideNavigationContext = function useSideNavigationContext() {
|
|
141
|
+
var context = React.useContext(SideNavigationContext);
|
|
142
|
+
if (!context) {
|
|
143
|
+
console.error('Error reading SideNavigationContext. Please contact maintainer of @entur/menu');
|
|
144
|
+
}
|
|
145
|
+
return context;
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
var _excluded$6 = ["children", "className", "button", "buttonIcon", "placement", "aria-label"],
|
|
149
|
+
_excluded2$1 = ["children", "className", "onSelect", "href", "disabled", "as"];
|
|
150
|
+
var SelectContext = /*#__PURE__*/React.createContext({});
|
|
151
|
+
var OverflowMenu = function OverflowMenu(_ref) {
|
|
152
|
+
var children = _ref.children,
|
|
153
|
+
className = _ref.className,
|
|
154
|
+
button$1 = _ref.button,
|
|
155
|
+
buttonIcon = _ref.buttonIcon,
|
|
156
|
+
_ref$placement = _ref.placement,
|
|
157
|
+
placement = _ref$placement === void 0 ? 'bottom-start' : _ref$placement,
|
|
158
|
+
_ref$ariaLabel = _ref['aria-label'],
|
|
159
|
+
ariaLabel = _ref$ariaLabel === void 0 ? 'åpne valgmeny' : _ref$ariaLabel,
|
|
160
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$6);
|
|
161
|
+
var _useState = React.useState(false),
|
|
162
|
+
isOpen = _useState[0],
|
|
163
|
+
setIsOpen = _useState[1];
|
|
164
|
+
var _useState2 = React.useState(null),
|
|
165
|
+
activeIndex = _useState2[0],
|
|
166
|
+
setActiveIndex = _useState2[1];
|
|
167
|
+
var listRef = React.useRef([]);
|
|
168
|
+
var labelsRef = React.useRef([]);
|
|
169
|
+
var _useFloating = react.useFloating({
|
|
170
|
+
placement: tooltip.standardisePlacement(
|
|
171
|
+
// check for left is added for backwards compatibility
|
|
172
|
+
rest.position === 'left' ? 'bottom-end' : placement),
|
|
173
|
+
open: isOpen,
|
|
174
|
+
onOpenChange: setIsOpen,
|
|
175
|
+
middleware: [react.offset(tokens.space.extraSmall2), react.flip(), react.shift({
|
|
176
|
+
padding: tokens.space.extraSmall
|
|
177
|
+
})]
|
|
178
|
+
}),
|
|
179
|
+
refs = _useFloating.refs,
|
|
180
|
+
floatingStyles = _useFloating.floatingStyles,
|
|
181
|
+
context = _useFloating.context,
|
|
182
|
+
elements = _useFloating.elements,
|
|
183
|
+
update = _useFloating.update;
|
|
184
|
+
// Since we use CSS instead of conditional rendering when hiding dropdownlist
|
|
185
|
+
// we can't use the whileElementsMounted option and need to handle
|
|
186
|
+
// cleanup ourselves. See https://floating-ui.com/docs/autoupdate
|
|
187
|
+
React.useEffect(function () {
|
|
188
|
+
if (isOpen && elements.reference && elements.floating) {
|
|
189
|
+
var cleanup = react.autoUpdate(elements.reference, elements.floating, update);
|
|
190
|
+
return cleanup;
|
|
191
|
+
}
|
|
192
|
+
}, [isOpen, elements, update]);
|
|
193
|
+
var listNav = react.useListNavigation(context, {
|
|
194
|
+
listRef: listRef,
|
|
195
|
+
activeIndex: activeIndex,
|
|
196
|
+
onNavigate: setActiveIndex
|
|
197
|
+
});
|
|
198
|
+
var typeahead = react.useTypeahead(context, {
|
|
199
|
+
listRef: labelsRef,
|
|
200
|
+
activeIndex: activeIndex,
|
|
201
|
+
onMatch: function onMatch(index) {
|
|
202
|
+
return isOpen && setActiveIndex(index);
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
var role = react.useRole(context, {
|
|
206
|
+
role: 'menu'
|
|
207
|
+
});
|
|
208
|
+
var _useInteractions = react.useInteractions([listNav, typeahead, role]),
|
|
209
|
+
getReferenceProps = _useInteractions.getReferenceProps,
|
|
210
|
+
getFloatingProps = _useInteractions.getFloatingProps,
|
|
211
|
+
getItemProps = _useInteractions.getItemProps;
|
|
212
|
+
var closeMenuAndReturnFocus = function closeMenuAndReturnFocus() {
|
|
213
|
+
var _refs$reference$curre;
|
|
214
|
+
setIsOpen(false);
|
|
215
|
+
// @ts-expect-error the reference element is actually focusable
|
|
216
|
+
(_refs$reference$curre = refs.reference.current) == null || _refs$reference$curre.focus == null || _refs$reference$curre.focus();
|
|
217
|
+
};
|
|
218
|
+
utils.useOnClickOutside([refs.floating, refs.reference], function () {
|
|
219
|
+
return setIsOpen(false);
|
|
220
|
+
});
|
|
221
|
+
utils.useOnEscape(refs.floating, closeMenuAndReturnFocus);
|
|
222
|
+
utils.useOnEscape(refs.reference, closeMenuAndReturnFocus);
|
|
223
|
+
var selectContext = React.useMemo(function () {
|
|
224
|
+
return {
|
|
225
|
+
activeIndex: activeIndex,
|
|
226
|
+
getItemProps: getItemProps,
|
|
227
|
+
closeMenuAndReturnFocus: closeMenuAndReturnFocus
|
|
228
|
+
};
|
|
229
|
+
}, [activeIndex, getItemProps, closeMenuAndReturnFocus]);
|
|
230
|
+
var _buttonIcon = buttonIcon != null ? buttonIcon : React.createElement(icons.VerticalDotsIcon, null);
|
|
231
|
+
return React.createElement(React.Fragment, null, !button$1 ? React.createElement(button.IconButton, _extends({
|
|
232
|
+
ref: refs.setReference
|
|
233
|
+
}, getReferenceProps({
|
|
234
|
+
onClick: function onClick() {
|
|
235
|
+
return setIsOpen(!isOpen);
|
|
236
|
+
},
|
|
237
|
+
className: className,
|
|
238
|
+
'aria-label': ariaLabel,
|
|
239
|
+
type: 'button'
|
|
240
|
+
}), rest), _buttonIcon) : React.cloneElement(button$1, _extends({
|
|
241
|
+
ref: refs.setReference
|
|
242
|
+
}, getReferenceProps({
|
|
243
|
+
onClick: function onClick() {
|
|
244
|
+
return setIsOpen(!isOpen);
|
|
245
|
+
},
|
|
246
|
+
className: className,
|
|
247
|
+
'aria-label': ariaLabel,
|
|
248
|
+
type: 'button'
|
|
249
|
+
}), rest)), React.createElement(SelectContext.Provider, {
|
|
250
|
+
value: selectContext
|
|
251
|
+
}, React.createElement("div", _extends({
|
|
252
|
+
ref: refs.setFloating,
|
|
253
|
+
style: _extends({}, floatingStyles, {
|
|
254
|
+
display: isOpen ? 'initial' : 'none'
|
|
255
|
+
})
|
|
256
|
+
}, getFloatingProps({
|
|
257
|
+
className: 'eds-overflow-menu__menu-list'
|
|
258
|
+
})), React.createElement(react.FloatingList, {
|
|
259
|
+
elementsRef: listRef,
|
|
260
|
+
labelsRef: labelsRef
|
|
261
|
+
}, children))));
|
|
262
|
+
};
|
|
263
|
+
var OverflowMenuItem = function OverflowMenuItem(_ref2) {
|
|
264
|
+
var children = _ref2.children,
|
|
265
|
+
className = _ref2.className,
|
|
266
|
+
_ref2$onSelect = _ref2.onSelect,
|
|
267
|
+
onSelect = _ref2$onSelect === void 0 ? function () {
|
|
268
|
+
return undefined;
|
|
269
|
+
} : _ref2$onSelect,
|
|
270
|
+
href = _ref2.href,
|
|
271
|
+
disabled = _ref2.disabled,
|
|
272
|
+
as = _ref2.as,
|
|
273
|
+
rest = _objectWithoutPropertiesLoose(_ref2, _excluded2$1);
|
|
274
|
+
var _useContext = React.useContext(SelectContext),
|
|
275
|
+
activeIndex = _useContext.activeIndex,
|
|
276
|
+
getItemProps = _useContext.getItemProps,
|
|
277
|
+
closeMenuAndReturnFocus = _useContext.closeMenuAndReturnFocus;
|
|
278
|
+
var _useListItem = react.useListItem({
|
|
279
|
+
label: !disabled ? utils.getNodeText(children) : null
|
|
280
|
+
}),
|
|
281
|
+
listItemRef = _useListItem.ref,
|
|
282
|
+
index = _useListItem.index;
|
|
283
|
+
var isHighlighted = activeIndex === index;
|
|
284
|
+
var isLink = href !== undefined;
|
|
285
|
+
var Element = as != null ? as : isLink ? 'a' : 'button';
|
|
286
|
+
return React.createElement(Element, _extends({
|
|
287
|
+
ref: listItemRef,
|
|
288
|
+
className: classNames('eds-overflow-menu__item', {
|
|
289
|
+
'eds-overflow-menu__item--disabled': disabled,
|
|
290
|
+
'eds-overflow-menu__item--highlighted': isHighlighted
|
|
291
|
+
}, className),
|
|
292
|
+
role: "menuitem",
|
|
293
|
+
type: Element === 'button' ? 'button' : undefined,
|
|
294
|
+
"aria-disabled": disabled,
|
|
295
|
+
"aria-selected": isHighlighted
|
|
296
|
+
}, getItemProps({
|
|
297
|
+
onClick: isLink || disabled ? undefined : function () {
|
|
298
|
+
onSelect();
|
|
299
|
+
closeMenuAndReturnFocus();
|
|
300
|
+
},
|
|
301
|
+
href: disabled ? undefined : href,
|
|
302
|
+
tabIndex: isHighlighted ? 0 : -1
|
|
303
|
+
}), rest), children);
|
|
304
|
+
};
|
|
305
|
+
var OverflowMenuLink = function OverflowMenuLink(props) {
|
|
306
|
+
return React.createElement(OverflowMenuItem, _extends({}, props));
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
var PaginationPage = function PaginationPage(_ref) {
|
|
310
|
+
var children = _ref.children,
|
|
311
|
+
className = _ref.className,
|
|
312
|
+
selected = _ref.selected,
|
|
313
|
+
disabled = _ref.disabled,
|
|
314
|
+
onClick = _ref.onClick,
|
|
315
|
+
ariaLabel = _ref['aria-label'],
|
|
316
|
+
ariaDescribedby = _ref['aria-describedby'];
|
|
317
|
+
return React.createElement("button", {
|
|
318
|
+
className: classNames('eds-pagination__controls__page', {
|
|
319
|
+
'eds-pagination__controls__page--selected': selected
|
|
320
|
+
}, {
|
|
321
|
+
'eds-pagination__controls__page--disabled': disabled
|
|
322
|
+
}, className),
|
|
323
|
+
disabled: selected || disabled,
|
|
324
|
+
type: "button",
|
|
325
|
+
onClick: onClick,
|
|
326
|
+
"aria-label": ariaLabel,
|
|
327
|
+
"aria-describedby": ariaDescribedby,
|
|
328
|
+
"aria-current": selected ? 'page' : false
|
|
329
|
+
}, children);
|
|
330
|
+
};
|
|
331
|
+
|
|
332
|
+
var PaginationInput = function PaginationInput(_ref) {
|
|
333
|
+
var currentPage = _ref.currentPage,
|
|
334
|
+
pageCount = _ref.pageCount,
|
|
335
|
+
_ref$label = _ref.label,
|
|
336
|
+
label = _ref$label === void 0 ? 'Gå til side' : _ref$label,
|
|
337
|
+
onPageChange = _ref.onPageChange;
|
|
338
|
+
var _React$useState = React.useState(String(currentPage)),
|
|
339
|
+
input = _React$useState[0],
|
|
340
|
+
setInput = _React$useState[1];
|
|
341
|
+
// If the currentPage prop changes, we want to reset the input field
|
|
342
|
+
React.useEffect(function () {
|
|
343
|
+
setInput(String(currentPage));
|
|
344
|
+
}, [currentPage]);
|
|
345
|
+
var handleSubmit = function handleSubmit(e) {
|
|
346
|
+
e.preventDefault();
|
|
347
|
+
e.stopPropagation();
|
|
348
|
+
var pageNumber = Number(input);
|
|
349
|
+
if (pageNumber === currentPage) {
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
if (Number.isNaN(pageNumber)) {
|
|
353
|
+
pageNumber = currentPage;
|
|
354
|
+
setInput(String(currentPage));
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
if (pageNumber > pageCount) {
|
|
358
|
+
pageNumber = pageCount;
|
|
359
|
+
setInput(String(pageCount));
|
|
360
|
+
} else if (pageNumber < 1) {
|
|
361
|
+
pageNumber = 1;
|
|
362
|
+
setInput(String(1));
|
|
363
|
+
}
|
|
364
|
+
onPageChange(pageNumber);
|
|
365
|
+
};
|
|
366
|
+
var handleChange = function handleChange(e) {
|
|
367
|
+
setInput(e.target.value);
|
|
368
|
+
};
|
|
369
|
+
return React.createElement("form", {
|
|
370
|
+
onSubmit: handleSubmit,
|
|
371
|
+
noValidate: true,
|
|
372
|
+
"aria-label": "form"
|
|
373
|
+
}, React.createElement("label", {
|
|
374
|
+
className: "eds-pagination__controls__input__wrapper"
|
|
375
|
+
}, React.createElement("span", {
|
|
376
|
+
className: "eds-pagination__controls__input__label"
|
|
377
|
+
}, label), React.createElement("input", {
|
|
378
|
+
type: "number",
|
|
379
|
+
max: pageCount,
|
|
380
|
+
className: "eds-pagination__controls__input__field",
|
|
381
|
+
value: input,
|
|
382
|
+
onChange: handleChange
|
|
383
|
+
})));
|
|
384
|
+
};
|
|
385
|
+
|
|
386
|
+
var _excluded$5 = ["className", "currentPage", "inputLabel", "onPageChange", "pageCount", "pageLabel", "previousPageLabel", "currentPageLabelForScreenreader", "lastPageLabelForScreenreader", "showInput", "numberOfResults", "resultsPerPage", "resultsPerPageOptions", "onResultsPerPageChange", "showNumberOfResultsLabel", "nextPageLabel", "showingResultsLabel", "changeNumberOfResultsLabelForScreenreader", "hideNextButton", "hidePrevButton"];
|
|
387
|
+
var Pagination = function Pagination(_ref) {
|
|
388
|
+
var className = _ref.className,
|
|
389
|
+
currentPage = _ref.currentPage,
|
|
390
|
+
inputLabel = _ref.inputLabel,
|
|
391
|
+
onPageChange = _ref.onPageChange,
|
|
392
|
+
pageCount = _ref.pageCount,
|
|
393
|
+
_ref$pageLabel = _ref.pageLabel,
|
|
394
|
+
pageLabel = _ref$pageLabel === void 0 ? function (pageNumber) {
|
|
395
|
+
return "G\xE5 til side " + pageNumber;
|
|
396
|
+
} : _ref$pageLabel,
|
|
397
|
+
_ref$previousPageLabe = _ref.previousPageLabel,
|
|
398
|
+
previousPageLabel = _ref$previousPageLabe === void 0 ? 'Gå til forrige side' : _ref$previousPageLabe,
|
|
399
|
+
_ref$currentPageLabel = _ref.currentPageLabelForScreenreader,
|
|
400
|
+
currentPageLabelForScreenreader = _ref$currentPageLabel === void 0 ? 'Nåværende side:' : _ref$currentPageLabel,
|
|
401
|
+
_ref$lastPageLabelFor = _ref.lastPageLabelForScreenreader,
|
|
402
|
+
lastPageLabelForScreenreader = _ref$lastPageLabelFor === void 0 ? ', siste side' : _ref$lastPageLabelFor,
|
|
403
|
+
showInput = _ref.showInput,
|
|
404
|
+
numberOfResults = _ref.numberOfResults,
|
|
405
|
+
resultsPerPage = _ref.resultsPerPage,
|
|
406
|
+
_ref$resultsPerPageOp = _ref.resultsPerPageOptions,
|
|
407
|
+
resultsPerPageOptions = _ref$resultsPerPageOp === void 0 ? [10, 25, 50] : _ref$resultsPerPageOp,
|
|
408
|
+
onResultsPerPageChange = _ref.onResultsPerPageChange,
|
|
409
|
+
_ref$showNumberOfResu = _ref.showNumberOfResultsLabel,
|
|
410
|
+
showNumberOfResultsLabel = _ref$showNumberOfResu === void 0 ? 'Vis' : _ref$showNumberOfResu,
|
|
411
|
+
_ref$nextPageLabel = _ref.nextPageLabel,
|
|
412
|
+
nextPageLabel = _ref$nextPageLabel === void 0 ? 'Gå til neste side' : _ref$nextPageLabel,
|
|
413
|
+
_ref$showingResultsLa = _ref.showingResultsLabel,
|
|
414
|
+
showingResultsLabel = _ref$showingResultsLa === void 0 ? function (minPage, maxPage, pageCount) {
|
|
415
|
+
return "Viser resultat " + minPage + "\u2013" + maxPage + " av " + pageCount;
|
|
416
|
+
} : _ref$showingResultsLa,
|
|
417
|
+
_ref$changeNumberOfRe = _ref.changeNumberOfResultsLabelForScreenreader,
|
|
418
|
+
changeNumberOfResultsLabelForScreenreader = _ref$changeNumberOfRe === void 0 ? "Viser " + resultsPerPage + " resultater. Trykk for \xE5 endre antall. \xC5pner en flervalgsmeny." : _ref$changeNumberOfRe,
|
|
419
|
+
_ref$hideNextButton = _ref.hideNextButton,
|
|
420
|
+
hideNextButton = _ref$hideNextButton === void 0 ? false : _ref$hideNextButton,
|
|
421
|
+
_ref$hidePrevButton = _ref.hidePrevButton,
|
|
422
|
+
hidePrevButton = _ref$hidePrevButton === void 0 ? false : _ref$hidePrevButton,
|
|
423
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$5);
|
|
424
|
+
var _useState = React.useState([]),
|
|
425
|
+
listedEntries = _useState[0],
|
|
426
|
+
setListedEntries = _useState[1];
|
|
427
|
+
var paginationId = utils.useRandomId('eds-pagination');
|
|
428
|
+
var isFirstPostSelected = currentPage === 1;
|
|
429
|
+
var isLastPostSelected = currentPage === pageCount;
|
|
430
|
+
var noEllipsis = pageCount <= 7;
|
|
431
|
+
var onlyLeadingEllipsis = !noEllipsis && currentPage < 5;
|
|
432
|
+
var onlyTrailingEllipsis = !noEllipsis && pageCount - currentPage <= 3;
|
|
433
|
+
React.useEffect(function () {
|
|
434
|
+
if (pageCount < 1) return;
|
|
435
|
+
if (noEllipsis) {
|
|
436
|
+
setListedEntries(Array(pageCount).fill(null).map(function (_, i) {
|
|
437
|
+
return i + 1;
|
|
438
|
+
}));
|
|
439
|
+
} else if (onlyLeadingEllipsis) {
|
|
440
|
+
setListedEntries([1, 2, 3, 4, 5, '…', pageCount]);
|
|
441
|
+
} else if (onlyTrailingEllipsis) {
|
|
442
|
+
setListedEntries([1, '…', pageCount - 4, pageCount - 3, pageCount - 2, pageCount - 1, pageCount]);
|
|
443
|
+
} else {
|
|
444
|
+
// leading and trailing ellipsis
|
|
445
|
+
setListedEntries([1, '…', currentPage - 1, currentPage, currentPage + 1, '…', pageCount]);
|
|
446
|
+
}
|
|
447
|
+
}, [noEllipsis, onlyLeadingEllipsis, onlyTrailingEllipsis, currentPage, pageCount]);
|
|
448
|
+
if (pageCount < 1) {
|
|
449
|
+
return null;
|
|
450
|
+
}
|
|
451
|
+
return React.createElement("nav", _extends({
|
|
452
|
+
className: classNames('eds-pagination', className),
|
|
453
|
+
"aria-label": "Paginering"
|
|
454
|
+
}, rest), resultsPerPage && numberOfResults && React.createElement("div", {
|
|
455
|
+
className: "eds-pagination__results"
|
|
456
|
+
}, onResultsPerPageChange && React.createElement(React.Fragment, null, React.createElement(typography.Label, {
|
|
457
|
+
as: "p",
|
|
458
|
+
"aria-hidden": "true"
|
|
459
|
+
}, showNumberOfResultsLabel), React.createElement(OverflowMenu, {
|
|
460
|
+
className: "eds-pagination__results__change-number-of-results",
|
|
461
|
+
buttonIcon: React.createElement(React.Fragment, null, resultsPerPage, ' ', React.createElement(icons.DownArrowIcon, {
|
|
462
|
+
className: "eds-pagination__results__change-number-of-results__arrow",
|
|
463
|
+
"aria-hidden": "true"
|
|
464
|
+
})),
|
|
465
|
+
"aria-label": changeNumberOfResultsLabelForScreenreader,
|
|
466
|
+
placement: "bottom-end"
|
|
467
|
+
}, resultsPerPageOptions.map(function (option, key) {
|
|
468
|
+
return React.createElement(OverflowMenuItem, {
|
|
469
|
+
key: key,
|
|
470
|
+
onSelect: function onSelect() {
|
|
471
|
+
return onResultsPerPageChange(option);
|
|
472
|
+
}
|
|
473
|
+
}, option);
|
|
474
|
+
}))), React.createElement(typography.Label, {
|
|
475
|
+
as: "p"
|
|
476
|
+
}, showingResultsLabel((currentPage - 1) * resultsPerPage + 1, currentPage * resultsPerPage > numberOfResults ? numberOfResults : currentPage * resultsPerPage, numberOfResults))), React.createElement("div", {
|
|
477
|
+
className: "eds-pagination__controls"
|
|
478
|
+
}, !hidePrevButton && React.createElement(PaginationPage, {
|
|
479
|
+
onClick: function onClick() {
|
|
480
|
+
return onPageChange(currentPage - 1);
|
|
481
|
+
},
|
|
482
|
+
"aria-label": previousPageLabel,
|
|
483
|
+
"aria-describedby": paginationId,
|
|
484
|
+
disabled: isFirstPostSelected
|
|
485
|
+
}, React.createElement(icons.LeftArrowIcon, {
|
|
486
|
+
"aria-hidden": "true"
|
|
487
|
+
})), listedEntries.map(function (entry, index) {
|
|
488
|
+
return entry === '…' ? React.createElement(Ellipsis, {
|
|
489
|
+
key: "ellipsis-" + index
|
|
490
|
+
}) : React.createElement(PaginationPage, {
|
|
491
|
+
selected: entry === currentPage,
|
|
492
|
+
onClick: function onClick() {
|
|
493
|
+
return onPageChange(entry);
|
|
494
|
+
},
|
|
495
|
+
"aria-label": "" + pageLabel(entry) + (entry === pageCount ? lastPageLabelForScreenreader : ''),
|
|
496
|
+
"aria-describedby": entry !== currentPage ? paginationId : undefined,
|
|
497
|
+
key: entry
|
|
498
|
+
}, entry);
|
|
499
|
+
}), !hideNextButton && React.createElement(PaginationPage, {
|
|
500
|
+
onClick: function onClick() {
|
|
501
|
+
return onPageChange(currentPage + 1);
|
|
502
|
+
},
|
|
503
|
+
"aria-label": nextPageLabel,
|
|
504
|
+
"aria-describedby": paginationId,
|
|
505
|
+
disabled: isLastPostSelected
|
|
506
|
+
}, React.createElement(icons.RightArrowIcon, {
|
|
507
|
+
"aria-hidden": "true"
|
|
508
|
+
})), showInput && React.createElement(PaginationInput, {
|
|
509
|
+
pageCount: pageCount,
|
|
510
|
+
currentPage: currentPage,
|
|
511
|
+
onPageChange: onPageChange,
|
|
512
|
+
label: inputLabel
|
|
513
|
+
})), React.createElement(a11y.VisuallyHidden, {
|
|
514
|
+
id: paginationId
|
|
515
|
+
}, currentPageLabelForScreenreader, " ", currentPage));
|
|
516
|
+
};
|
|
517
|
+
var Ellipsis = function Ellipsis() {
|
|
518
|
+
return React.createElement("span", {
|
|
519
|
+
className: "eds-pagination__controls__page__ellipsis",
|
|
520
|
+
"aria-hidden": "true"
|
|
521
|
+
}, "\u2026");
|
|
522
|
+
};
|
|
523
|
+
|
|
524
|
+
var _excluded$4 = ["className", "children", "size"];
|
|
525
|
+
var SideNavigation = function SideNavigation(_ref) {
|
|
526
|
+
var className = _ref.className,
|
|
527
|
+
children = _ref.children,
|
|
528
|
+
_ref$size = _ref.size,
|
|
529
|
+
size = _ref$size === void 0 ? 'medium' : _ref$size,
|
|
530
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$4);
|
|
531
|
+
if (!children || !React.Children.count(children)) {
|
|
532
|
+
return null;
|
|
533
|
+
}
|
|
534
|
+
return React.createElement("ul", _extends({
|
|
535
|
+
className: classNames('eds-side-navigation', {
|
|
536
|
+
'eds-side-navigation--small': size === 'small'
|
|
537
|
+
}, className)
|
|
538
|
+
}, rest), children);
|
|
539
|
+
};
|
|
540
|
+
/** This is required to check that the Menu */
|
|
541
|
+
SideNavigation.__IS_ENTUR_MENU__ = true;
|
|
542
|
+
|
|
543
|
+
var useShowDelayedLabel = function useShowDelayedLabel(isCollapsed) {
|
|
544
|
+
var _useState = React.useState(true),
|
|
545
|
+
showLabel = _useState[0],
|
|
546
|
+
setShowLabel = _useState[1];
|
|
547
|
+
var hideDelay = 50;
|
|
548
|
+
var showDelay = 200;
|
|
549
|
+
React.useEffect(function () {
|
|
550
|
+
if (isCollapsed) {
|
|
551
|
+
setTimeout(function () {
|
|
552
|
+
setShowLabel(false);
|
|
553
|
+
}, hideDelay);
|
|
554
|
+
}
|
|
555
|
+
if (!isCollapsed) {
|
|
556
|
+
setTimeout(function () {
|
|
557
|
+
setShowLabel(true);
|
|
558
|
+
}, showDelay);
|
|
559
|
+
}
|
|
560
|
+
return function () {
|
|
561
|
+
return undefined;
|
|
562
|
+
};
|
|
563
|
+
}, [isCollapsed]);
|
|
564
|
+
return [showLabel];
|
|
565
|
+
};
|
|
566
|
+
|
|
567
|
+
var _excluded$3 = ["className", "active", "subMenu", "icon", "children", "as"],
|
|
568
|
+
_excluded2 = ["children"],
|
|
569
|
+
_excluded3 = ["active", "disabled", "children", "forceExpandSubMenus", "as"];
|
|
570
|
+
function isActiveRecursively(child) {
|
|
571
|
+
if (!child.props) {
|
|
572
|
+
return false;
|
|
573
|
+
}
|
|
574
|
+
if (child.props.active) {
|
|
575
|
+
return true;
|
|
576
|
+
}
|
|
577
|
+
if (!child.props.children) {
|
|
578
|
+
return false;
|
|
579
|
+
}
|
|
580
|
+
return React.Children.toArray(child.props.children).some(function (child) {
|
|
581
|
+
return isActiveRecursively(child);
|
|
582
|
+
});
|
|
583
|
+
}
|
|
584
|
+
var defaultElementBaseItem = 'a';
|
|
585
|
+
var BaseSideNavigationItem = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
586
|
+
var className = _ref.className,
|
|
587
|
+
_ref$active = _ref.active,
|
|
588
|
+
active = _ref$active === void 0 ? false : _ref$active,
|
|
589
|
+
subMenu = _ref.subMenu,
|
|
590
|
+
icon = _ref.icon,
|
|
591
|
+
children = _ref.children,
|
|
592
|
+
as = _ref.as,
|
|
593
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
|
|
594
|
+
var Element = as || defaultElementBaseItem;
|
|
595
|
+
var _useSideNavigationCon = useSideNavigationContext(),
|
|
596
|
+
isCollapsed = _useSideNavigationCon.isCollapsed;
|
|
597
|
+
var _useShowDelayedLabel = useShowDelayedLabel(isCollapsed),
|
|
598
|
+
showLabel = _useShowDelayedLabel[0];
|
|
599
|
+
return React.createElement("li", {
|
|
600
|
+
className: classNames('eds-side-navigation__item', className)
|
|
601
|
+
}, React.createElement(Element, _extends({
|
|
602
|
+
className: classNames('eds-side-navigation__click-target', {
|
|
603
|
+
'eds-side-navigation__click-target--active': active
|
|
604
|
+
}),
|
|
605
|
+
"aria-label": isCollapsed ? children : undefined,
|
|
606
|
+
"aria-current": active ? 'page' : undefined,
|
|
607
|
+
ref: ref
|
|
608
|
+
}, rest), icon, showLabel && children), subMenu);
|
|
609
|
+
});
|
|
610
|
+
var DisabledSideNavigationItem = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
|
|
611
|
+
var children = _ref2.children,
|
|
612
|
+
rest = _objectWithoutPropertiesLoose(_ref2, _excluded2);
|
|
613
|
+
return React.createElement(BaseSideNavigationItem, _extends({
|
|
614
|
+
as: "button",
|
|
615
|
+
disabled: true,
|
|
616
|
+
"aria-disabled": true,
|
|
617
|
+
ref: ref,
|
|
618
|
+
type: "button"
|
|
619
|
+
}, rest), children);
|
|
620
|
+
});
|
|
621
|
+
var defaultElementItem = 'a';
|
|
622
|
+
var SideNavigationItem = /*#__PURE__*/React.forwardRef(function (_ref3, ref) {
|
|
623
|
+
var active = _ref3.active,
|
|
624
|
+
disabled = _ref3.disabled,
|
|
625
|
+
children = _ref3.children,
|
|
626
|
+
forceExpandSubMenus = _ref3.forceExpandSubMenus,
|
|
627
|
+
as = _ref3.as,
|
|
628
|
+
rest = _objectWithoutPropertiesLoose(_ref3, _excluded3);
|
|
629
|
+
var Element = as || defaultElementItem;
|
|
630
|
+
var childrenArray = React.Children.toArray(children);
|
|
631
|
+
var subMenu = childrenArray.find(function (child) {
|
|
632
|
+
return child && child.type && child.type.__IS_ENTUR_MENU__;
|
|
633
|
+
});
|
|
634
|
+
var label = subMenu ? childrenArray.filter(function (child) {
|
|
635
|
+
return child !== subMenu;
|
|
636
|
+
}) : children;
|
|
637
|
+
if (disabled) {
|
|
638
|
+
return React.createElement(DisabledSideNavigationItem, _extends({
|
|
639
|
+
ref: ref
|
|
640
|
+
}, rest), label);
|
|
641
|
+
}
|
|
642
|
+
if (!subMenu) {
|
|
643
|
+
return React.createElement(BaseSideNavigationItem, _extends({
|
|
644
|
+
as: Element,
|
|
645
|
+
active: active,
|
|
646
|
+
ref: ref
|
|
647
|
+
}, rest), label);
|
|
648
|
+
}
|
|
649
|
+
var isExpanded = forceExpandSubMenus || isActiveRecursively({
|
|
650
|
+
props: {
|
|
651
|
+
children: children,
|
|
652
|
+
active: active
|
|
653
|
+
}
|
|
654
|
+
});
|
|
655
|
+
return React.createElement(BaseSideNavigationItem, _extends({
|
|
656
|
+
active: active,
|
|
657
|
+
subMenu: isExpanded && subMenu,
|
|
658
|
+
"aria-expanded": isExpanded,
|
|
659
|
+
as: Element,
|
|
660
|
+
ref: ref
|
|
661
|
+
}, rest), label);
|
|
662
|
+
});
|
|
663
|
+
|
|
664
|
+
var _excluded$2 = ["defaultOpen", "open", "onToggle", "className", "children", "title", "icon"];
|
|
665
|
+
var SideNavigationGroup = function SideNavigationGroup(_ref) {
|
|
666
|
+
var _ref$defaultOpen = _ref.defaultOpen,
|
|
667
|
+
defaultOpen = _ref$defaultOpen === void 0 ? false : _ref$defaultOpen,
|
|
668
|
+
open = _ref.open,
|
|
669
|
+
onToggle = _ref.onToggle,
|
|
670
|
+
className = _ref.className,
|
|
671
|
+
children = _ref.children,
|
|
672
|
+
title = _ref.title,
|
|
673
|
+
icon = _ref.icon,
|
|
674
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
|
675
|
+
var _useControllableProp = useControllableProp({
|
|
676
|
+
prop: open,
|
|
677
|
+
updater: onToggle,
|
|
678
|
+
defaultValue: defaultOpen
|
|
679
|
+
}),
|
|
680
|
+
isOpen = _useControllableProp[0],
|
|
681
|
+
setOpen = _useControllableProp[1];
|
|
682
|
+
var _useSideNavigationCon = useSideNavigationContext(),
|
|
683
|
+
isCollapsed = _useSideNavigationCon.isCollapsed;
|
|
684
|
+
var _useShowDelayedLabel = useShowDelayedLabel(isCollapsed),
|
|
685
|
+
showLabel = _useShowDelayedLabel[0];
|
|
686
|
+
return React.createElement("div", _extends({
|
|
687
|
+
className: classNames('eds-side-navigation-group', className)
|
|
688
|
+
}, rest), React.createElement("button", {
|
|
689
|
+
onClick: function onClick() {
|
|
690
|
+
return setOpen(!isOpen);
|
|
691
|
+
},
|
|
692
|
+
type: "button",
|
|
693
|
+
className: "eds-side-navigation-group__trigger",
|
|
694
|
+
"aria-label": title + ", utvidbar meny, " + (isOpen ? 'åpen' : 'lukket')
|
|
695
|
+
}, React.createElement("span", null, icon && React.createElement("span", {
|
|
696
|
+
className: "eds-side-navigation-group__trigger-icon"
|
|
697
|
+
}, icon), showLabel && title), showLabel && React.createElement(expand.ExpandArrow, {
|
|
698
|
+
open: isOpen,
|
|
699
|
+
className: "eds-side-navigation-group__expand-icon"
|
|
700
|
+
})), React.createElement(expand.BaseExpand, {
|
|
701
|
+
className: "eds-side-navigation-group__expand-content",
|
|
702
|
+
open: isOpen
|
|
703
|
+
}, children));
|
|
704
|
+
};
|
|
705
|
+
|
|
706
|
+
var _excluded$1 = ["activeIndex", "className", "interactive", "onStepClick", "showStepperIndex", "steps", "ariaLabelStep", "ariaLabelOf", "ariaLabelCompleted", "ariaLabelSummary"];
|
|
707
|
+
var Stepper = function Stepper(_ref) {
|
|
708
|
+
var activeIndex = _ref.activeIndex,
|
|
709
|
+
className = _ref.className,
|
|
710
|
+
_ref$interactive = _ref.interactive,
|
|
711
|
+
interactive = _ref$interactive === void 0 ? false : _ref$interactive,
|
|
712
|
+
onStepClick = _ref.onStepClick,
|
|
713
|
+
_ref$showStepperIndex = _ref.showStepperIndex,
|
|
714
|
+
showStepperIndex = _ref$showStepperIndex === void 0 ? true : _ref$showStepperIndex,
|
|
715
|
+
steps = _ref.steps,
|
|
716
|
+
_ref$ariaLabelStep = _ref.ariaLabelStep,
|
|
717
|
+
ariaLabelStep = _ref$ariaLabelStep === void 0 ? 'Steg' : _ref$ariaLabelStep,
|
|
718
|
+
_ref$ariaLabelOf = _ref.ariaLabelOf,
|
|
719
|
+
ariaLabelOf = _ref$ariaLabelOf === void 0 ? 'av' : _ref$ariaLabelOf,
|
|
720
|
+
_ref$ariaLabelComplet = _ref.ariaLabelCompleted,
|
|
721
|
+
ariaLabelCompleted = _ref$ariaLabelComplet === void 0 ? 'fullført' : _ref$ariaLabelComplet,
|
|
722
|
+
_ref$ariaLabelSummary = _ref.ariaLabelSummary,
|
|
723
|
+
ariaLabelSummary = _ref$ariaLabelSummary === void 0 ? "Stegindikator med " + steps.length + " steg, du er p\xE5 steg " + (activeIndex + 1) + " " + steps[activeIndex] + "," : _ref$ariaLabelSummary,
|
|
724
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
725
|
+
return React.createElement("ol", _extends({
|
|
726
|
+
className: classNames('eds-stepper', className),
|
|
727
|
+
"aria-label": ariaLabelSummary
|
|
728
|
+
}, rest), steps.map(function (step, i) {
|
|
729
|
+
var isCurrent = i === activeIndex;
|
|
730
|
+
var isInteractive = interactive && activeIndex > i;
|
|
731
|
+
var Element = isInteractive ? 'button' : 'div';
|
|
732
|
+
var isCompleted = activeIndex > i;
|
|
733
|
+
var currentStepSummary = ariaLabelStep + " " + (i + 1) + " " + ariaLabelOf + " " + steps.length + ", " + step + " " + (isCompleted ? ", " + ariaLabelCompleted : '');
|
|
734
|
+
var props = isInteractive ? {
|
|
735
|
+
onClick: function onClick() {
|
|
736
|
+
return onStepClick == null ? void 0 : onStepClick(i);
|
|
737
|
+
}
|
|
738
|
+
} : {};
|
|
739
|
+
return React.createElement("li", {
|
|
740
|
+
key: step,
|
|
741
|
+
className: "eds-stepper__step__wrapper"
|
|
742
|
+
}, React.createElement(Element, _extends({
|
|
743
|
+
className: classNames('eds-stepper__step', {
|
|
744
|
+
'eds-stepper__step--active': isCurrent
|
|
745
|
+
}, {
|
|
746
|
+
'eds-stepper__step--completed': isCompleted
|
|
747
|
+
}, {
|
|
748
|
+
'eds-stepper__step--interactive': isInteractive
|
|
749
|
+
}),
|
|
750
|
+
"aria-current": isCurrent ? 'step' : undefined,
|
|
751
|
+
type: Element === 'button' ? 'button' : undefined
|
|
752
|
+
}, props), React.createElement("div", {
|
|
753
|
+
className: "eds-stepper__step__line",
|
|
754
|
+
"aria-hidden": true
|
|
755
|
+
}), React.createElement("span", {
|
|
756
|
+
className: "eds-stepper__step__label",
|
|
757
|
+
"aria-hidden": true
|
|
758
|
+
}, showStepperIndex && i + 1 + '.', " ", step), React.createElement(a11y.VisuallyHidden, null, currentStepSummary)));
|
|
759
|
+
}));
|
|
760
|
+
};
|
|
761
|
+
|
|
762
|
+
var _excluded = ["active", "className", "as"];
|
|
763
|
+
var defaultElement = 'a';
|
|
764
|
+
var TopNavigationItem = function TopNavigationItem(_ref) {
|
|
765
|
+
var _ref$active = _ref.active,
|
|
766
|
+
active = _ref$active === void 0 ? false : _ref$active,
|
|
767
|
+
className = _ref.className,
|
|
768
|
+
as = _ref.as,
|
|
769
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
770
|
+
var Element = as || defaultElement;
|
|
771
|
+
return React.createElement(Element, _extends({
|
|
772
|
+
className: classNames(['eds-top-navigation-item', className, {
|
|
773
|
+
'eds-top-navigation-item--active': active
|
|
774
|
+
}])
|
|
775
|
+
}, rest));
|
|
776
|
+
};
|
|
777
|
+
|
|
778
|
+
utils.warnAboutMissingStyles('menu', 'expand', 'icons', 'typography', 'button', 'layout', 'a11y');
|
|
779
|
+
|
|
780
|
+
exports.BreadcrumbItem = BreadcrumbItem;
|
|
781
|
+
exports.BreadcrumbNavigation = BreadcrumbNavigation;
|
|
782
|
+
exports.CollapsibleSideNavigation = CollapsibleSideNavigation;
|
|
783
|
+
exports.OverflowMenu = OverflowMenu;
|
|
784
|
+
exports.OverflowMenuItem = OverflowMenuItem;
|
|
785
|
+
exports.OverflowMenuLink = OverflowMenuLink;
|
|
786
|
+
exports.Pagination = Pagination;
|
|
787
|
+
exports.SideNavigation = SideNavigation;
|
|
788
|
+
exports.SideNavigationGroup = SideNavigationGroup;
|
|
789
|
+
exports.SideNavigationItem = SideNavigationItem;
|
|
790
|
+
exports.Stepper = Stepper;
|
|
791
|
+
exports.TopNavigationItem = TopNavigationItem;
|
|
792
|
+
exports.useSideNavigationContext = useSideNavigationContext;
|
|
793
|
+
//# sourceMappingURL=menu.cjs.development.js.map
|