@astryxdesign/core 0.7.2-canary.38f84f6 → 0.7.2-canary.3c1d32d

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.
@@ -1 +1 @@
1
- {"version":3,"file":"SideNavItem.d.ts","sourceRoot":"","sources":["../../src/SideNav/SideNavItem.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAQL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAYf,OAAO,EAAuB,KAAK,QAAQ,EAAC,MAAM,SAAS,CAAC;AAE5D,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAIrD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAgB,KAAK,WAAW,EAAC,MAAM,iCAAiC,CAAC;AA4ShF,MAAM,WAAW,gBAAiB,SAAQ,SAAS,CAAC,WAAW,CAAC;IAC9D,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAC7B;;;;OAIG;IACH,EAAE,CAAC,EAAE,iBAAiB,CAAC;IACvB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC5B;;OAEG;IACH,YAAY,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IACpC;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IACxC;;;;OAIG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB;;;;;;;;;;;OAWG;IAC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,WAAW"}
@@ -405,7 +405,9 @@ export function SideNavItem({
405
405
  size,
406
406
  selected: isSelected ? 'selected' : null,
407
407
  disabled: isDisabled ? 'disabled' : null
408
- }), focusOutlineProps.focusVisible(navItemStyles.item, interactionOverlayStyles.backgroundColor, navItemStyles[size], styles.itemCollapsed, size === 'sm' && styles.itemCollapsedSm, size === 'lg' && styles.itemCollapsedLg, isSelected && navItemStyles.selected, isDisabled && navItemStyles.disabled)),
408
+ }), focusOutlineProps.focusVisible(navItemStyles.item, interactionOverlayStyles.backgroundColor, navItemStyles[size], styles.itemCollapsed, size === 'sm' && styles.itemCollapsedSm, size === 'lg' && styles.itemCollapsedLg, isSelected && navItemStyles.selected, isDisabled && navItemStyles.disabled),
409
+ // Spread after `rest`, so keep the caller's class beside these.
410
+ rest.className),
409
411
  ...pressable
410
412
  };
411
413
  const collapsedAccessibleLabel = rest['aria-label'] != null && rest['aria-label'].trim() !== '' ? rest['aria-label'] : label;
@@ -512,8 +514,10 @@ export function SideNavItem({
512
514
 
513
515
  // The indent is a runtime value, so it reaches the element as an inline
514
516
  // style. These props are spread after `rest`, so fold the caller's `style`
515
- // back in (caller wins) rather than letting the indent replace it.
517
+ // back in (caller wins) rather than letting the indent replace it, and the
518
+ // caller's `className` beside the row's own classes.
516
519
  const callerStyle = {
520
+ className: rest.className,
517
521
  style: rest.style
518
522
  };
519
523
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astryxdesign/core",
3
- "version": "0.7.2-canary.38f84f6",
3
+ "version": "0.7.2-canary.3c1d32d",
4
4
  "displayName": "Astryx Core",
5
5
  "description": "The component library. Accessible, themeable React components with built-in spacing, dark mode, and StyleX styling.",
6
6
  "author": "Meta Open Source",
@@ -792,8 +792,8 @@
792
792
  "react-dom": ">=19.0.0"
793
793
  },
794
794
  "devDependencies": {
795
- "@astryxdesign/a11y-spec": "0.7.2-canary.38f84f6",
796
- "@astryxdesign/cli": "0.7.2-canary.38f84f6",
795
+ "@astryxdesign/a11y-spec": "0.7.2-canary.3c1d32d",
796
+ "@astryxdesign/cli": "0.7.2-canary.3c1d32d",
797
797
  "@babel/cli": "^7.29.7",
798
798
  "@babel/core": "^7.29.7",
799
799
  "@babel/preset-react": "^7.29.7",
@@ -928,6 +928,47 @@ describe('SideNavItem', () => {
928
928
  expect(indentOf(security)).toBe('calc(1 * var(--spacing-6))');
929
929
  });
930
930
 
931
+ it("keeps a caller's className on the row element", () => {
932
+ render(
933
+ <SideNavItem label="Settings">
934
+ <SideNavItem
935
+ label="General"
936
+ href="/settings/general"
937
+ className="caller-row"
938
+ />
939
+ <SideNavItem
940
+ label="Security"
941
+ href="/settings/security"
942
+ className="caller-row">
943
+ <SideNavItem label="Keys" href="/settings/security/keys" />
944
+ </SideNavItem>
945
+ </SideNavItem>,
946
+ );
947
+ // Ordinary row: the link is the row, and the caller's class sits beside
948
+ // the row's own classes instead of being replaced by them.
949
+ const general = screen.getByRole('link', {name: 'General'});
950
+ expect(general).toHaveClass('caller-row');
951
+ expect(general).toHaveClass('astryx-side-nav-item');
952
+ // Split row: the class lands on the primary link, as `style` does.
953
+ expect(screen.getByRole('link', {name: 'Security'})).toHaveClass(
954
+ 'caller-row',
955
+ );
956
+ });
957
+
958
+ it("keeps a caller's className on a collapsed rail item", () => {
959
+ render(
960
+ <SideNav collapsible={{isCollapsed: true, hasButton: false}}>
961
+ <SideNavItem
962
+ label="Home"
963
+ href="/"
964
+ icon="calendar"
965
+ className="caller-row"
966
+ />
967
+ </SideNav>,
968
+ );
969
+ expect(screen.getByRole('link', {name: 'Home'})).toHaveClass('caller-row');
970
+ });
971
+
931
972
  it("lets a caller's inline-start padding replace the indent", () => {
932
973
  // The caller's `style` composes after the indent: a caller-set
933
974
  // inline-start padding is an inline declaration, so it wins over the
@@ -634,6 +634,8 @@ export function SideNavItem({
634
634
  isSelected && navItemStyles.selected,
635
635
  isDisabled && navItemStyles.disabled,
636
636
  ),
637
+ // Spread after `rest`, so keep the caller's class beside these.
638
+ rest.className,
637
639
  ),
638
640
  ...pressable,
639
641
  };
@@ -752,8 +754,9 @@ export function SideNavItem({
752
754
 
753
755
  // The indent is a runtime value, so it reaches the element as an inline
754
756
  // style. These props are spread after `rest`, so fold the caller's `style`
755
- // back in (caller wins) rather than letting the indent replace it.
756
- const callerStyle = {style: rest.style};
757
+ // back in (caller wins) rather than letting the indent replace it, and the
758
+ // caller's `className` beside the row's own classes.
759
+ const callerStyle = {className: rest.className, style: rest.style};
757
760
 
758
761
  // Three shapes of the same row appearance:
759
762
  // - `rowProps` — split-action path (toggle, no actions): presentational