@primer/react 38.44.0 → 38.44.1-rc.f98981f35
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 +6 -0
- package/dist/ActionList/index.d.ts +4 -17
- package/dist/BranchName/BranchName.d.ts +1 -1
- package/dist/Breadcrumbs/Breadcrumbs.d.ts +2 -2
- package/dist/Card/index.d.ts +1 -1
- package/dist/Link/Link.d.ts +1 -1
- package/dist/NavList/NavList.d.ts +1 -1
- package/dist/Text/Text.d.ts +1 -1
- package/dist/Truncate/Truncate.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/utils/modern-polymorphic.d.ts +2 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @primer/react
|
|
2
2
|
|
|
3
|
+
## 38.44.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#8638](https://github.com/primer/react/pull/8638) [`4b1cc1d`](https://github.com/primer/react/commit/4b1cc1d863209aa9aaf9f6ab47ae25b86de5c1e1) Thanks [@joshblack](https://github.com/joshblack)! - Polymorphic components: Fix TypeScript inference for component-specific props while preserving `as` support.
|
|
8
|
+
|
|
3
9
|
## 38.44.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
|
@@ -7,15 +7,15 @@ import { ActionListGroupHeadingTrailingActionProps } from "./GroupHeadingTrailin
|
|
|
7
7
|
import { ActionListItemProps, ActionListProps } from "./shared.js";
|
|
8
8
|
import { ActionListHeadingProps } from "./Heading.js";
|
|
9
9
|
import { ActionListGroupHeadingProps, ActionListGroupProps } from "./Group.js";
|
|
10
|
+
import { ActionListLinkItemProps } from "./LinkItem.js";
|
|
10
11
|
import { ActionListDividerProps } from "./Divider.js";
|
|
11
12
|
import { ActionListDescriptionProps } from "./Description.js";
|
|
12
13
|
import { ActionListLeadingVisualProps, ActionListTrailingVisualProps, VisualProps } from "./Visuals.js";
|
|
13
|
-
import { ActionListLinkItemProps } from "./LinkItem.js";
|
|
14
14
|
//#region src/ActionList/index.d.ts
|
|
15
15
|
/**
|
|
16
16
|
* Collection of list-related components.
|
|
17
17
|
*/
|
|
18
|
-
declare const ActionList: (<As extends React.ElementType = "ul">(props: DistributiveOmit<import("react").ComponentPropsWithRef<import("react").ElementType extends As ? "ul" : As> & {
|
|
18
|
+
declare const ActionList: (<As extends React.ElementType = "ul">(props: DistributiveOmit<import("react").ComponentPropsWithRef<import("react").ElementType extends As ? "ul" : As>, "as"> & Omit<import("react").PropsWithChildren<{
|
|
19
19
|
variant?: "inset" | "horizontal-inset" | "full";
|
|
20
20
|
selectionVariant?: "single" | "radio" | "multiple";
|
|
21
21
|
showDividers?: boolean;
|
|
@@ -23,9 +23,7 @@ declare const ActionList: (<As extends React.ElementType = "ul">(props: Distribu
|
|
|
23
23
|
disableFocusZone?: boolean;
|
|
24
24
|
className?: string;
|
|
25
25
|
disableItemGap?: boolean;
|
|
26
|
-
} & {
|
|
27
|
-
children?: import("react").ReactNode | undefined;
|
|
28
|
-
}, "as"> & {
|
|
26
|
+
}>, "as"> & {
|
|
29
27
|
as?: As | undefined;
|
|
30
28
|
} & import("react").RefAttributes<unknown>) => React.ReactNode) & {
|
|
31
29
|
/** Context for the `ActionList` container. */ContainerContext: import("react").Context<{
|
|
@@ -89,18 +87,7 @@ declare const ActionList: (<As extends React.ElementType = "ul">(props: Distribu
|
|
|
89
87
|
displayName: string;
|
|
90
88
|
__SLOT__: symbol;
|
|
91
89
|
}; /** A `Item` that renders a full-size anchor inside ListItem */
|
|
92
|
-
LinkItem: WithSlotMarker<(<As extends React.ElementType = "a">(props: DistributiveOmit<import("react").ComponentPropsWithRef<import("react").ElementType extends As ? "a" : As> &
|
|
93
|
-
download?: string;
|
|
94
|
-
href?: string;
|
|
95
|
-
hrefLang?: string;
|
|
96
|
-
media?: string;
|
|
97
|
-
ping?: string;
|
|
98
|
-
rel?: string;
|
|
99
|
-
target?: string;
|
|
100
|
-
type?: string;
|
|
101
|
-
referrerPolicy?: React.AnchorHTMLAttributes<HTMLAnchorElement>["referrerPolicy"];
|
|
102
|
-
className?: string;
|
|
103
|
-
}, "as"> & {
|
|
90
|
+
LinkItem: WithSlotMarker<(<As extends React.ElementType = "a">(props: DistributiveOmit<import("react").ComponentPropsWithRef<import("react").ElementType extends As ? "a" : As>, "as"> & Omit<ActionListLinkItemProps, "as"> & {
|
|
104
91
|
as?: As | undefined;
|
|
105
92
|
} & {
|
|
106
93
|
_PrivateTooltipText?: string;
|
|
@@ -5,7 +5,7 @@ import React from "react";
|
|
|
5
5
|
type BranchNameProps<As extends React.ElementType> = PolymorphicProps<As, 'a', {
|
|
6
6
|
className?: string;
|
|
7
7
|
}>;
|
|
8
|
-
declare const _default: <As extends React.ElementType>(props: DistributiveOmit<React.ComponentPropsWithRef<React.ElementType extends As ? "a" : As> & {
|
|
8
|
+
declare const _default: <As extends React.ElementType>(props: DistributiveOmit<React.ComponentPropsWithRef<React.ElementType extends As ? "a" : As>, "as"> & Omit<{
|
|
9
9
|
className?: string;
|
|
10
10
|
}, "as"> & {
|
|
11
11
|
as?: As | undefined;
|
|
@@ -42,7 +42,7 @@ type StyledBreadcrumbsItemProps<As extends React.ElementType = 'a'> = Polymorphi
|
|
|
42
42
|
}>;
|
|
43
43
|
type BreadcrumbsItemProps<As extends React.ElementType = 'a'> = StyledBreadcrumbsItemProps<As>;
|
|
44
44
|
declare const _default: typeof Breadcrumbs & {
|
|
45
|
-
Item: (<As extends React.ElementType = "a">(props: DistributiveOmit<React.ComponentPropsWithRef<React.ElementType extends As ? "a" : As> & {
|
|
45
|
+
Item: (<As extends React.ElementType = "a">(props: DistributiveOmit<React.ComponentPropsWithRef<React.ElementType extends As ? "a" : As>, "as"> & Omit<{
|
|
46
46
|
to?: To;
|
|
47
47
|
selected?: boolean;
|
|
48
48
|
}, "as"> & {
|
|
@@ -55,7 +55,7 @@ declare const _default: typeof Breadcrumbs & {
|
|
|
55
55
|
* @deprecated Use the `Breadcrumbs` component instead (i.e. `<Breadcrumb>` → `<Breadcrumbs>`)
|
|
56
56
|
*/
|
|
57
57
|
declare const Breadcrumb: typeof Breadcrumbs & {
|
|
58
|
-
Item: <As extends React.ElementType = "a">(props: DistributiveOmit<React.ComponentPropsWithRef<React.ElementType extends As ? "a" : As> & {
|
|
58
|
+
Item: <As extends React.ElementType = "a">(props: DistributiveOmit<React.ComponentPropsWithRef<React.ElementType extends As ? "a" : As>, "as"> & Omit<{
|
|
59
59
|
to?: To;
|
|
60
60
|
selected?: boolean;
|
|
61
61
|
}, "as"> & {
|
package/dist/Card/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { DistributiveOmit } from "../utils/modern-polymorphic.js";
|
|
|
2
2
|
import { CardAction, CardActionProps as ActionProps, CardDescriptionProps as DescriptionProps, CardHeadingProps as HeadingProps, CardIcon, CardIconProps as IconProps, CardImage, CardImageProps as ImageProps, CardMetadataProps as MetadataProps, CardProps } from "./Card.js";
|
|
3
3
|
|
|
4
4
|
//#region src/Card/index.d.ts
|
|
5
|
-
declare const Card: (<As extends "div" | "section">(props: DistributiveOmit<import("react").ComponentPropsWithRef<import("react").ElementType extends As ? "div" : As> & {
|
|
5
|
+
declare const Card: (<As extends "div" | "section">(props: DistributiveOmit<import("react").ComponentPropsWithRef<import("react").ElementType extends As ? "div" : As>, "as"> & Omit<{
|
|
6
6
|
className?: string;
|
|
7
7
|
padding?: "none" | "condensed" | "normal";
|
|
8
8
|
borderRadius?: "medium" | "large";
|
package/dist/Link/Link.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ type StyledLinkProps<As extends React.ElementType = 'a'> = {
|
|
|
9
9
|
muted?: boolean;
|
|
10
10
|
inline?: boolean;
|
|
11
11
|
};
|
|
12
|
-
declare const Link: (<As extends React.ElementType = "a">(props: DistributiveOmit<React.ComponentPropsWithRef<React.ElementType extends As ? "a" : As> & StyledLinkProps<"a">, "as"> & {
|
|
12
|
+
declare const Link: (<As extends React.ElementType = "a">(props: DistributiveOmit<React.ComponentPropsWithRef<React.ElementType extends As ? "a" : As>, "as"> & Omit<StyledLinkProps<"a">, "as"> & {
|
|
13
13
|
as?: As | undefined;
|
|
14
14
|
} & React.RefAttributes<unknown>) => React.ReactNode) & {
|
|
15
15
|
displayName: string;
|
|
@@ -55,7 +55,7 @@ type NavListGroupHeadingProps = ActionListGroupHeadingProps;
|
|
|
55
55
|
declare const NavList: React.ForwardRefExoticComponent<Omit<NavListProps, "ref"> & React.RefAttributes<HTMLElement>> & {
|
|
56
56
|
Description: FCWithSlotMarker<React.PropsWithChildren<ActionListDescriptionProps>>;
|
|
57
57
|
Heading: FCWithSlotMarker<NavListHeadingProps>;
|
|
58
|
-
Item: (<As extends React.ElementType = "a">(props: DistributiveOmit<React.ComponentPropsWithRef<React.ElementType extends As ? "a" : As> & {
|
|
58
|
+
Item: (<As extends React.ElementType = "a">(props: DistributiveOmit<React.ComponentPropsWithRef<React.ElementType extends As ? "a" : As>, "as"> & Omit<{
|
|
59
59
|
children: React.ReactNode;
|
|
60
60
|
defaultOpen?: boolean;
|
|
61
61
|
href?: string;
|
package/dist/Text/Text.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ type TextProps<As extends React.ElementType = 'span'> = PolymorphicProps<As, 'sp
|
|
|
8
8
|
whiteSpace?: 'pre' | 'normal' | 'nowrap' | 'pre-wrap' | 'pre-line';
|
|
9
9
|
className?: string;
|
|
10
10
|
}>;
|
|
11
|
-
declare const _default: <As extends React.ElementType>(props: DistributiveOmit<React.ComponentPropsWithRef<React.ElementType extends As ? "span" : As> & {
|
|
11
|
+
declare const _default: <As extends React.ElementType>(props: DistributiveOmit<React.ComponentPropsWithRef<React.ElementType extends As ? "span" : As>, "as"> & Omit<{
|
|
12
12
|
size?: "large" | "medium" | "small";
|
|
13
13
|
weight?: "light" | "normal" | "medium" | "semibold";
|
|
14
14
|
whiteSpace?: "pre" | "normal" | "nowrap" | "pre-wrap" | "pre-line";
|
|
@@ -11,7 +11,7 @@ type TruncateOwnProps = {
|
|
|
11
11
|
style?: React.CSSProperties;
|
|
12
12
|
};
|
|
13
13
|
type TruncateProps<As extends React.ElementType = 'div'> = PolymorphicProps<As, 'div', TruncateOwnProps>;
|
|
14
|
-
declare const _default: <As extends React.ElementType = "div">(props: DistributiveOmit<React.ComponentPropsWithRef<React.ElementType extends As ? "div" : As> & TruncateOwnProps, "as"> & {
|
|
14
|
+
declare const _default: <As extends React.ElementType = "div">(props: DistributiveOmit<React.ComponentPropsWithRef<React.ElementType extends As ? "div" : As>, "as"> & Omit<TruncateOwnProps, "as"> & {
|
|
15
15
|
as?: As | undefined;
|
|
16
16
|
} & React.RefAttributes<any>) => React.ReactNode;
|
|
17
17
|
//#endregion
|
package/dist/index.d.ts
CHANGED
|
@@ -44,10 +44,10 @@ import { ActionListTrailingActionProps } from "./ActionList/TrailingAction.js";
|
|
|
44
44
|
import { ActionListGroupHeadingTrailingActionProps } from "./ActionList/GroupHeadingTrailingAction.js";
|
|
45
45
|
import { ActionListItemProps, ActionListProps } from "./ActionList/shared.js";
|
|
46
46
|
import { ActionListGroupHeadingProps, ActionListGroupProps } from "./ActionList/Group.js";
|
|
47
|
+
import { ActionListLinkItemProps } from "./ActionList/LinkItem.js";
|
|
47
48
|
import { ActionListDividerProps } from "./ActionList/Divider.js";
|
|
48
49
|
import { ActionListDescriptionProps } from "./ActionList/Description.js";
|
|
49
50
|
import { ActionListLeadingVisualProps, ActionListTrailingVisualProps } from "./ActionList/Visuals.js";
|
|
50
|
-
import { ActionListLinkItemProps } from "./ActionList/LinkItem.js";
|
|
51
51
|
import { ActionList } from "./ActionList/index.js";
|
|
52
52
|
import { AnchoredOverlay, AnchoredOverlayProps } from "./AnchoredOverlay/AnchoredOverlay.js";
|
|
53
53
|
import { AutocompleteMenuProps } from "./Autocomplete/AutocompleteMenu.js";
|
|
@@ -8,8 +8,9 @@ type DistributiveOmit<T, TOmitted extends PropertyKey> = T extends unknown ? Omi
|
|
|
8
8
|
/**
|
|
9
9
|
* Simplified polymorphic props type that handles the common pattern of
|
|
10
10
|
* `DistributiveOmit<ComponentPropsWithRef<ElementType extends As ? DefaultElement : As>, 'as'>`
|
|
11
|
+
* Keep own props separate so their types remain available in generic components.
|
|
11
12
|
*/
|
|
12
|
-
type PolymorphicProps<TAs extends ElementType, TDefaultElement extends ElementType = 'div', Props = object> = DistributiveOmit<ComponentPropsWithRef<ElementType extends TAs ? TDefaultElement : TAs> & Props, 'as'> & {
|
|
13
|
+
type PolymorphicProps<TAs extends ElementType, TDefaultElement extends ElementType = 'div', Props = object> = DistributiveOmit<ComponentPropsWithRef<ElementType extends TAs ? TDefaultElement : TAs>, 'as'> & DistributiveOmit<Props, 'as'> & {
|
|
13
14
|
as?: TAs;
|
|
14
15
|
};
|
|
15
16
|
//#endregion
|
package/package.json
CHANGED