@lumx/react 4.24.0-next.1 → 4.24.0-next.2

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 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
@@ -19292,6 +19292,7 @@ const SideNavigationItem = forwardRef((props, ref) => {
19292
19292
  icon,
19293
19293
  isOpen,
19294
19294
  isSelected,
19295
+ isCurrentPage,
19295
19296
  label,
19296
19297
  linkAs,
19297
19298
  linkProps,
@@ -19305,6 +19306,9 @@ const SideNavigationItem = forwardRef((props, ref) => {
19305
19306
  const hasContent = !isEmpty(content);
19306
19307
  const shouldSplitActions = Boolean(onActionClick);
19307
19308
  const showChildren = hasContent && isOpen;
19309
+
19310
+ // Mark the link as the current page. A link component set in `linkAs` can also set it by itself.
19311
+ const ariaCurrent = isCurrentPage ? 'page' : undefined;
19308
19312
  const contentId = useId();
19309
19313
  const ariaProps = {};
19310
19314
  if (hasContent) {
@@ -19324,6 +19328,7 @@ const SideNavigationItem = forwardRef((props, ref) => {
19324
19328
  className: element$a('wrapper'),
19325
19329
  children: [RawClickable({
19326
19330
  as: linkAs || (linkProps?.href ? 'a' : 'button'),
19331
+ 'aria-current': ariaCurrent,
19327
19332
  ...linkProps,
19328
19333
  className: element$a('link'),
19329
19334
  handleClick: onClick,
@@ -19348,6 +19353,7 @@ const SideNavigationItem = forwardRef((props, ref) => {
19348
19353
  })]
19349
19354
  }) : RawClickable({
19350
19355
  as: linkAs || (linkProps?.href ? 'a' : 'button'),
19356
+ 'aria-current': ariaCurrent,
19351
19357
  ...linkProps,
19352
19358
  className: element$a('link'),
19353
19359
  handleClick: onClick,