@primer/react 0.0.0-20260619191426 → 0.0.0-20260619195604
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/CHANGELOG.md +1 -1
- package/dist/UnderlineNav/UnderlineNav.js +1 -1
- package/dist/UnderlineNav/UnderlineNavItem.d.ts +1 -38
- package/dist/UnderlineNav/UnderlineNavItem.d.ts.map +1 -1
- package/dist/UnderlineNav/UnderlineNavItem.js +2 -4
- package/dist/UnderlineNav/UnderlineNavItemsRegistry.d.ts +40 -0
- package/dist/UnderlineNav/UnderlineNavItemsRegistry.d.ts.map +1 -0
- package/dist/UnderlineNav/UnderlineNavItemsRegistry.js +6 -0
- package/dist/UnderlineNav/index.d.ts +1 -1
- package/dist/UnderlineNav/index.d.ts.map +1 -1
- package/dist/UnderlineNav/utils.d.ts +1 -1
- package/dist/UnderlineNav/utils.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/UnderlineNav/types.d.ts +0 -10
- package/dist/UnderlineNav/types.d.ts.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,7 +5,7 @@ import { UnderlineWrapper, UnderlineItemList, LoadingCounter } from '../internal
|
|
|
5
5
|
import { invariant } from '../utils/invariant.js';
|
|
6
6
|
import classes from './UnderlineNav.module.css.js';
|
|
7
7
|
import { UnderlineNavContext } from './UnderlineNavContext.js';
|
|
8
|
-
import { UnderlineNavItemsRegistry } from './
|
|
8
|
+
import { UnderlineNavItemsRegistry } from './UnderlineNavItemsRegistry.js';
|
|
9
9
|
import { clsx } from 'clsx';
|
|
10
10
|
import { useDevOnlyEffect } from '../internal/hooks/useDevOnlyEffect.js';
|
|
11
11
|
import { isCurrent, getValidChildren } from './utils.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { IconProps } from '@primer/octicons-react';
|
|
3
2
|
import type { ForwardRefComponent as PolymorphicForwardRefComponent } from '../utils/polymorphic';
|
|
3
|
+
import { type UnderlineNavItemProps } from './UnderlineNavItemsRegistry';
|
|
4
4
|
export type LinkProps = {
|
|
5
5
|
download?: string;
|
|
6
6
|
href?: string;
|
|
@@ -12,42 +12,5 @@ export type LinkProps = {
|
|
|
12
12
|
type?: string;
|
|
13
13
|
referrerPolicy?: React.AnchorHTMLAttributes<HTMLAnchorElement>['referrerPolicy'];
|
|
14
14
|
};
|
|
15
|
-
export type UnderlineNavItemProps = {
|
|
16
|
-
/**
|
|
17
|
-
* Primary content for an UnderlineNav
|
|
18
|
-
*/
|
|
19
|
-
children?: React.ReactNode;
|
|
20
|
-
/**
|
|
21
|
-
* Callback that will trigger both on click selection and keyboard selection.
|
|
22
|
-
*/
|
|
23
|
-
onSelect?: (event: React.MouseEvent<HTMLAnchorElement> | React.KeyboardEvent<HTMLAnchorElement>) => void;
|
|
24
|
-
/**
|
|
25
|
-
* Is `UnderlineNav.Item` current page?
|
|
26
|
-
*/
|
|
27
|
-
'aria-current'?: 'page' | 'step' | 'location' | 'date' | 'time' | 'true' | 'false' | boolean;
|
|
28
|
-
/**
|
|
29
|
-
* Icon before the text
|
|
30
|
-
* @deprecated Use the `leadingVisual` prop instead
|
|
31
|
-
*/
|
|
32
|
-
icon?: React.FunctionComponent<IconProps> | React.ReactElement<any>;
|
|
33
|
-
/**
|
|
34
|
-
* Render a visual before the text
|
|
35
|
-
*/
|
|
36
|
-
leadingVisual?: React.ReactElement;
|
|
37
|
-
/**
|
|
38
|
-
* Renders `UnderlineNav.Item` as given component i.e. react-router's Link
|
|
39
|
-
**/
|
|
40
|
-
as?: React.ElementType | 'a';
|
|
41
|
-
/**
|
|
42
|
-
* Counter
|
|
43
|
-
*/
|
|
44
|
-
counter?: number | string;
|
|
45
|
-
} & LinkProps;
|
|
46
|
-
/** Registry of currently-overflowing underline items. If an item is not overflowing, its value will be `null`. */
|
|
47
|
-
export declare const UnderlineNavItemsRegistry: {
|
|
48
|
-
Provider: ({ children, setRegistry }: import("../utils/descendant-registry").ProviderProps<UnderlineNavItemProps | null>) => React.JSX.Element;
|
|
49
|
-
useRegistryState: () => [ReadonlyMap<string, UnderlineNavItemProps | null> | undefined, React.Dispatch<React.SetStateAction<ReadonlyMap<string, UnderlineNavItemProps | null> | undefined>>];
|
|
50
|
-
useRegisterDescendant: (value: UnderlineNavItemProps | null) => string;
|
|
51
|
-
};
|
|
52
15
|
export declare const UnderlineNavItem: PolymorphicForwardRefComponent<"a", UnderlineNavItemProps>;
|
|
53
16
|
//# sourceMappingURL=UnderlineNavItem.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnderlineNavItem.d.ts","sourceRoot":"","sources":["../../src/UnderlineNav/UnderlineNavItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0E,MAAM,OAAO,CAAA;AAC9F,OAAO,KAAK,EAAC,
|
|
1
|
+
{"version":3,"file":"UnderlineNavItem.d.ts","sourceRoot":"","sources":["../../src/UnderlineNav/UnderlineNavItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0E,MAAM,OAAO,CAAA;AAC9F,OAAO,KAAK,EAAC,mBAAmB,IAAI,8BAA8B,EAAC,MAAM,sBAAsB,CAAA;AAI/F,OAAO,EAAC,KAAK,qBAAqB,EAA4B,MAAM,6BAA6B,CAAA;AAGjG,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,cAAc,CAAC,EAAE,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAC,gBAAgB,CAAC,CAAA;CACjF,CAAA;AAED,eAAO,MAAM,gBAAgB,EA0EvB,8BAA8B,CAAC,GAAG,EAAE,qBAAqB,CAAC,CAAA"}
|
|
@@ -2,11 +2,9 @@ import React, { forwardRef, useRef, useContext, useSyncExternalStore, useCallbac
|
|
|
2
2
|
import { UnderlineNavContext } from './UnderlineNavContext.js';
|
|
3
3
|
import { UnderlineItem } from '../internal/components/UnderlineTabbedInterface.js';
|
|
4
4
|
import classes from './UnderlineNavItem.module.css.js';
|
|
5
|
-
import {
|
|
5
|
+
import { UnderlineNavItemsRegistry } from './UnderlineNavItemsRegistry.js';
|
|
6
6
|
import { jsx } from 'react/jsx-runtime';
|
|
7
7
|
|
|
8
|
-
/** Registry of currently-overflowing underline items. If an item is not overflowing, its value will be `null`. */
|
|
9
|
-
const UnderlineNavItemsRegistry = createDescendantRegistry();
|
|
10
8
|
const UnderlineNavItem = /*#__PURE__*/forwardRef((allProps, forwardedRef) => {
|
|
11
9
|
const {
|
|
12
10
|
as: Component = 'a',
|
|
@@ -68,4 +66,4 @@ const UnderlineNavItem = /*#__PURE__*/forwardRef((allProps, forwardedRef) => {
|
|
|
68
66
|
});
|
|
69
67
|
UnderlineNavItem.displayName = 'UnderlineNavItem';
|
|
70
68
|
|
|
71
|
-
export { UnderlineNavItem
|
|
69
|
+
export { UnderlineNavItem };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { IconProps } from '@primer/octicons-react';
|
|
2
|
+
import type { LinkProps } from '../Link';
|
|
3
|
+
export type UnderlineNavItemProps = {
|
|
4
|
+
/**
|
|
5
|
+
* Primary content for an UnderlineNav
|
|
6
|
+
*/
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Callback that will trigger both on click selection and keyboard selection.
|
|
10
|
+
*/
|
|
11
|
+
onSelect?: (event: React.MouseEvent<HTMLAnchorElement> | React.KeyboardEvent<HTMLAnchorElement>) => void;
|
|
12
|
+
/**
|
|
13
|
+
* Is `UnderlineNav.Item` current page?
|
|
14
|
+
*/
|
|
15
|
+
'aria-current'?: 'page' | 'step' | 'location' | 'date' | 'time' | 'true' | 'false' | boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Icon before the text
|
|
18
|
+
* @deprecated Use the `leadingVisual` prop instead
|
|
19
|
+
*/
|
|
20
|
+
icon?: React.FunctionComponent<IconProps> | React.ReactElement<any>;
|
|
21
|
+
/**
|
|
22
|
+
* Render a visual before the text
|
|
23
|
+
*/
|
|
24
|
+
leadingVisual?: React.ReactElement;
|
|
25
|
+
/**
|
|
26
|
+
* Renders `UnderlineNav.Item` as given component i.e. react-router's Link
|
|
27
|
+
**/
|
|
28
|
+
as?: React.ElementType | 'a';
|
|
29
|
+
/**
|
|
30
|
+
* Counter
|
|
31
|
+
*/
|
|
32
|
+
counter?: number | string;
|
|
33
|
+
} & LinkProps;
|
|
34
|
+
/** Registry of currently-overflowing underline items. If an item is not overflowing, its value will be `null`. */
|
|
35
|
+
export declare const UnderlineNavItemsRegistry: {
|
|
36
|
+
Provider: ({ children, setRegistry }: import("../utils/descendant-registry").ProviderProps<UnderlineNavItemProps | null>) => import("react").JSX.Element;
|
|
37
|
+
useRegistryState: () => [ReadonlyMap<string, UnderlineNavItemProps | null> | undefined, import("react").Dispatch<import("react").SetStateAction<ReadonlyMap<string, UnderlineNavItemProps | null> | undefined>>];
|
|
38
|
+
useRegisterDescendant: (value: UnderlineNavItemProps | null) => string;
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=UnderlineNavItemsRegistry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnderlineNavItemsRegistry.d.ts","sourceRoot":"","sources":["../../src/UnderlineNav/UnderlineNavItemsRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,wBAAwB,CAAA;AAErD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,SAAS,CAAA;AAEtC,MAAM,MAAM,qBAAqB,GAAG;IAClC;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAE1B;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAA;IAExG;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAA;IAE5F;;;OAGG;IAEH,IAAI,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAA;IAEnE;;OAEG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC,YAAY,CAAA;IAElC;;QAEI;IACJ,EAAE,CAAC,EAAE,KAAK,CAAC,WAAW,GAAG,GAAG,CAAA;IAE5B;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CAC1B,GAAG,SAAS,CAAA;AAEb,kHAAkH;AAClH,eAAO,MAAM,yBAAyB;;;;CAA2D,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { createDescendantRegistry } from '../utils/descendant-registry.js';
|
|
2
|
+
|
|
3
|
+
/** Registry of currently-overflowing underline items. If an item is not overflowing, its value will be `null`. */
|
|
4
|
+
const UnderlineNavItemsRegistry = createDescendantRegistry();
|
|
5
|
+
|
|
6
|
+
export { UnderlineNavItemsRegistry };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { UnderlineNavProps } from './UnderlineNav';
|
|
2
|
-
import type { UnderlineNavItemProps } from './
|
|
2
|
+
import type { UnderlineNavItemProps } from './UnderlineNavItemsRegistry';
|
|
3
3
|
declare const UnderlineNav: import("react").ForwardRefExoticComponent<UnderlineNavProps & import("react").RefAttributes<unknown>> & {
|
|
4
4
|
Item: import("../utils/polymorphic").ForwardRefComponent<"a", UnderlineNavItemProps>;
|
|
5
5
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/UnderlineNav/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,gBAAgB,CAAA;AAErD,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/UnderlineNav/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,gBAAgB,CAAA;AAErD,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,6BAA6B,CAAA;AAGtE,QAAA,MAAM,YAAY;;CAEhB,CAAA;AAEF,OAAO,EAAC,YAAY,EAAC,CAAA;AACrB,YAAY,EAAC,iBAAiB,EAAE,qBAAqB,EAAC,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { UnderlineNavItemProps } from './
|
|
2
|
+
import type { UnderlineNavItemProps } from './UnderlineNavItemsRegistry';
|
|
3
3
|
export declare const getValidChildren: (children: React.ReactNode) => React.ReactElement<any>[];
|
|
4
4
|
export declare const isCurrent: (props: UnderlineNavItemProps) => boolean;
|
|
5
5
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/UnderlineNav/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/UnderlineNav/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,6BAA6B,CAAA;AAEtE,eAAO,MAAM,gBAAgB,GAAI,UAAU,KAAK,CAAC,SAAS,KAEgC,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,EAChH,CAAA;AAED,eAAO,MAAM,SAAS,GAAI,OAAO,qBAAqB,YACuD,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export type ChildSize = {
|
|
2
|
-
text: string;
|
|
3
|
-
width: number;
|
|
4
|
-
};
|
|
5
|
-
export type ChildWidthArray = Array<ChildSize>;
|
|
6
|
-
export type ResponsiveProps = {
|
|
7
|
-
items: Array<React.ReactElement<any>>;
|
|
8
|
-
menuItems: Array<React.ReactElement<any>>;
|
|
9
|
-
};
|
|
10
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/UnderlineNav/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AACD,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,SAAS,CAAC,CAAA;AAC9C,MAAM,MAAM,eAAe,GAAG;IAE5B,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAA;IAErC,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAA;CAC1C,CAAA"}
|