@lumx/react 4.24.0-next.1 → 4.24.0-next.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/index.d.ts +7 -0
- package/index.js +9 -5
- package/index.js.map +1 -1
- package/package.json +3 -3
package/index.d.ts
CHANGED
|
@@ -4762,6 +4762,13 @@ interface SideNavigationItemProps extends GenericProps$1, HasCloseMode$1 {
|
|
|
4762
4762
|
isOpen?: boolean;
|
|
4763
4763
|
/** Whether the component is selected or not. */
|
|
4764
4764
|
isSelected?: boolean;
|
|
4765
|
+
/**
|
|
4766
|
+
* Whether the link points to the current page or not.
|
|
4767
|
+
* Sets `aria-current="page"` on the link, which produces the selected style.
|
|
4768
|
+
* This does not set the `--is-selected` modifier class: a link component set in `linkAs` can set the
|
|
4769
|
+
* attribute by itself, and React never sees it, so the attribute is the only reliable signal.
|
|
4770
|
+
*/
|
|
4771
|
+
isCurrentPage?: boolean;
|
|
4765
4772
|
/** Custom react component for the link (can be used to inject react router Link). */
|
|
4766
4773
|
linkAs?: 'a' | any;
|
|
4767
4774
|
/** Props to pass to the link (minus those already set by the SideNavigationItem props). */
|
package/index.js
CHANGED
|
@@ -19244,12 +19244,11 @@ const SideNavigation = forwardRef((props, ref) => {
|
|
|
19244
19244
|
theme = defaultTheme,
|
|
19245
19245
|
...forwardedProps
|
|
19246
19246
|
} = props;
|
|
19247
|
-
const content = Children.toArray(children).filter(isComponent(SideNavigationItem));
|
|
19248
19247
|
return /*#__PURE__*/jsx("ul", {
|
|
19249
19248
|
ref: ref,
|
|
19250
19249
|
...forwardedProps,
|
|
19251
19250
|
className: classNames.join(className, theme === Theme$1.dark && 'lumx-color-font-light-N', CLASSNAME$l),
|
|
19252
|
-
children:
|
|
19251
|
+
children: children
|
|
19253
19252
|
});
|
|
19254
19253
|
});
|
|
19255
19254
|
SideNavigation.displayName = COMPONENT_NAME$m;
|
|
@@ -19292,6 +19291,7 @@ const SideNavigationItem = forwardRef((props, ref) => {
|
|
|
19292
19291
|
icon,
|
|
19293
19292
|
isOpen,
|
|
19294
19293
|
isSelected,
|
|
19294
|
+
isCurrentPage,
|
|
19295
19295
|
label,
|
|
19296
19296
|
linkAs,
|
|
19297
19297
|
linkProps,
|
|
@@ -19301,10 +19301,12 @@ const SideNavigationItem = forwardRef((props, ref) => {
|
|
|
19301
19301
|
closeMode = DEFAULT_PROPS$n.closeMode,
|
|
19302
19302
|
...forwardedProps
|
|
19303
19303
|
} = props;
|
|
19304
|
-
const
|
|
19305
|
-
const hasContent = !isEmpty(content);
|
|
19304
|
+
const hasContent = !isEmpty(Children.toArray(children));
|
|
19306
19305
|
const shouldSplitActions = Boolean(onActionClick);
|
|
19307
19306
|
const showChildren = hasContent && isOpen;
|
|
19307
|
+
|
|
19308
|
+
// Mark the link as the current page. A link component set in `linkAs` can also set it by itself.
|
|
19309
|
+
const ariaCurrent = isCurrentPage ? 'page' : undefined;
|
|
19308
19310
|
const contentId = useId();
|
|
19309
19311
|
const ariaProps = {};
|
|
19310
19312
|
if (hasContent) {
|
|
@@ -19324,6 +19326,7 @@ const SideNavigationItem = forwardRef((props, ref) => {
|
|
|
19324
19326
|
className: element$a('wrapper'),
|
|
19325
19327
|
children: [RawClickable({
|
|
19326
19328
|
as: linkAs || (linkProps?.href ? 'a' : 'button'),
|
|
19329
|
+
'aria-current': ariaCurrent,
|
|
19327
19330
|
...linkProps,
|
|
19328
19331
|
className: element$a('link'),
|
|
19329
19332
|
handleClick: onClick,
|
|
@@ -19348,6 +19351,7 @@ const SideNavigationItem = forwardRef((props, ref) => {
|
|
|
19348
19351
|
})]
|
|
19349
19352
|
}) : RawClickable({
|
|
19350
19353
|
as: linkAs || (linkProps?.href ? 'a' : 'button'),
|
|
19354
|
+
'aria-current': ariaCurrent,
|
|
19351
19355
|
...linkProps,
|
|
19352
19356
|
className: element$a('link'),
|
|
19353
19357
|
handleClick: onClick,
|
|
@@ -19369,7 +19373,7 @@ const SideNavigationItem = forwardRef((props, ref) => {
|
|
|
19369
19373
|
}), (closeMode === 'hide' || showChildren) && /*#__PURE__*/jsx("ul", {
|
|
19370
19374
|
className: element$a('children'),
|
|
19371
19375
|
id: contentId,
|
|
19372
|
-
children:
|
|
19376
|
+
children: children
|
|
19373
19377
|
})]
|
|
19374
19378
|
});
|
|
19375
19379
|
});
|