@primer/styled-react 0.0.0-20251030203243 → 0.0.0-20251030203715

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,16 +1,27 @@
1
1
  import type { DialogProps as PrimerDialogProps } from '@primer/react';
2
2
  import type { SxProp } from '../sx';
3
3
  import { type PropsWithChildren } from 'react';
4
- type DialogProps = PropsWithChildren<PrimerDialogProps> & SxProp;
5
- type StyledBodyProps = React.ComponentProps<'div'> & SxProp;
6
- type StyledFooterProps = React.ComponentProps<'div'> & SxProp;
4
+ type DialogProps = PropsWithChildren<PrimerDialogProps> & SxProp & {
5
+ as?: React.ElementType;
6
+ };
7
+ type StyledBodyProps = React.ComponentProps<'div'> & SxProp & {
8
+ as?: React.ElementType;
9
+ };
10
+ type StyledFooterProps = React.ComponentProps<'div'> & SxProp & {
11
+ as?: React.ElementType;
12
+ };
7
13
  declare const Dialog: import("react").ForwardRefExoticComponent<PrimerDialogProps & {
8
14
  children?: import("react").ReactNode | undefined;
9
- } & SxProp & import("react").RefAttributes<HTMLDivElement>> & {
15
+ } & SxProp & {
16
+ as?: React.ElementType;
17
+ } & import("react").RefAttributes<HTMLDivElement>> & {
18
+ __SLOT__: symbol;
10
19
  Buttons: import("react").FC<PropsWithChildren<{
11
20
  buttons: import("@primer/react").DialogButtonProps[];
12
21
  }>>;
13
- Header: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & SxProp & import("react").RefAttributes<HTMLDivElement>>;
22
+ Header: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & SxProp & {
23
+ as?: React.ElementType;
24
+ } & import("react").RefAttributes<HTMLDivElement>>;
14
25
  Body: import("react").ForwardRefExoticComponent<Omit<StyledBodyProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
15
26
  Footer: import("react").ForwardRefExoticComponent<Omit<StyledFooterProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
16
27
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../src/components/Dialog.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,WAAW,IAAI,iBAAiB,EAAC,MAAM,eAAe,CAAA;AAEnE,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,OAAO,CAAA;AACjC,OAAO,EAA4C,KAAK,iBAAiB,EAAC,MAAM,OAAO,CAAA;AAEvF,KAAK,WAAW,GAAG,iBAAiB,CAAC,iBAAiB,CAAC,GAAG,MAAM,CAAA;AAahE,KAAK,eAAe,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG,MAAM,CAAA;AAO3D,KAAK,iBAAiB,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG,MAAM,CAAA;AAM7D,QAAA,MAAM,MAAM;;;;;;;;;CAKV,CAAA;AAEF,OAAO,EAAC,MAAM,EAAC,CAAA;AACf,YAAY,EAAC,WAAW,EAAC,CAAA"}
1
+ {"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../src/components/Dialog.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,WAAW,IAAI,iBAAiB,EAAa,MAAM,eAAe,CAAA;AAC/E,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,OAAO,CAAA;AAGjC,OAAO,EAA4C,KAAK,iBAAiB,EAAC,MAAM,OAAO,CAAA;AAEvF,KAAK,WAAW,GAAG,iBAAiB,CAAC,iBAAiB,CAAC,GAAG,MAAM,GAAG;IAAC,EAAE,CAAC,EAAE,KAAK,CAAC,WAAW,CAAA;CAAC,CAAA;AAwB3F,KAAK,eAAe,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG,MAAM,GAAG;IAAC,EAAE,CAAC,EAAE,KAAK,CAAC,WAAW,CAAA;CAAC,CAAA;AAYtF,KAAK,iBAAiB,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG,MAAM,GAAG;IAAC,EAAE,CAAC,EAAE,KAAK,CAAC,WAAW,CAAA;CAAC,CAAA;AAgBxF,QAAA,MAAM,MAAM;;;SApD6D,KAAK,CAAC,WAAW;;;;;;;aAYhB,KAAK,CAAC,WAAW;;;;CA8CzF,CAAA;AAEF,OAAO,EAAC,MAAM,EAAC,CAAA;AACf,YAAY,EAAC,WAAW,EAAC,CAAA"}
@@ -1,39 +1,86 @@
1
1
  import { Dialog as Dialog$1 } from '@primer/react';
2
- import Box from './Box.js';
2
+ import sx from '../sx.js';
3
+ import styled from 'styled-components';
3
4
  import { forwardRef } from 'react';
4
5
  import { jsx } from 'react/jsx-runtime';
5
6
 
6
- const DialogImpl = /*#__PURE__*/forwardRef(function Dialog(props, ref) {
7
- // @ts-expect-error - PrimerDialog is not recognized as a valid component type
8
- return /*#__PURE__*/jsx(Box, {
9
- as: Dialog$1,
7
+ const StyledDialog = styled(Dialog$1).withConfig({
8
+ shouldForwardProp: prop => prop !== 'sx'
9
+ }).withConfig({
10
+ displayName: "Dialog__StyledDialog",
11
+ componentId: "sc-19zph8h-0"
12
+ })(["", ""], sx);
13
+ const DialogImpl = /*#__PURE__*/forwardRef(function Dialog({
14
+ as,
15
+ ...props
16
+ }, ref) {
17
+ return /*#__PURE__*/jsx(StyledDialog, {
10
18
  ref: ref,
19
+ ...(as ? {
20
+ forwardedAs: as
21
+ } : {}),
11
22
  ...props
12
23
  });
13
24
  });
14
- const DialogHeader = /*#__PURE__*/forwardRef(function DialogHeader(props, ref) {
15
- return /*#__PURE__*/jsx(Box, {
16
- as: Dialog$1.Header,
25
+ const StyledDialogHeader = styled(Dialog$1.Header).withConfig({
26
+ shouldForwardProp: prop => prop !== 'sx'
27
+ }).withConfig({
28
+ displayName: "Dialog__StyledDialogHeader",
29
+ componentId: "sc-19zph8h-1"
30
+ })(["", ""], sx);
31
+ const DialogHeader = /*#__PURE__*/forwardRef(function DialogHeader({
32
+ as,
33
+ ...props
34
+ }, ref) {
35
+ return /*#__PURE__*/jsx(StyledDialogHeader, {
17
36
  ref: ref,
37
+ ...(as ? {
38
+ forwardedAs: as
39
+ } : {}),
18
40
  ...props
19
41
  });
20
42
  });
21
- const DialogBody = /*#__PURE__*/forwardRef(function DialogBody(props, ref) {
22
- // @ts-expect-error - PrimerDialog.Body is not recognized as a valid component type
23
- return /*#__PURE__*/jsx(Box, {
24
- as: Dialog$1.Body,
43
+ const StyledDialogBody = styled(Dialog$1.Body).withConfig({
44
+ shouldForwardProp: prop => prop !== 'sx'
45
+ }).withConfig({
46
+ displayName: "Dialog__StyledDialogBody",
47
+ componentId: "sc-19zph8h-2"
48
+ })(["", ""], sx);
49
+ const DialogBody = /*#__PURE__*/forwardRef(function DialogBody({
50
+ as,
51
+ ...props
52
+ }, ref) {
53
+ return /*#__PURE__*/jsx(StyledDialogBody, {
25
54
  ref: ref,
55
+ ...(as ? {
56
+ forwardedAs: as
57
+ } : {}),
26
58
  ...props
27
59
  });
28
60
  });
29
- const DialogFooter = /*#__PURE__*/forwardRef(function DialogFooter(props, ref) {
30
- return /*#__PURE__*/jsx(Box, {
31
- as: Dialog$1.Footer,
61
+ const StyledDialogFooter = styled(Dialog$1.Footer).withConfig({
62
+ shouldForwardProp: prop => prop !== 'sx'
63
+ }).withConfig({
64
+ displayName: "Dialog__StyledDialogFooter",
65
+ componentId: "sc-19zph8h-3"
66
+ })(["", ""], sx);
67
+ const DialogFooter = /*#__PURE__*/forwardRef(function DialogFooter({
68
+ as,
69
+ ...props
70
+ }, ref) {
71
+ return /*#__PURE__*/jsx(StyledDialogFooter, {
32
72
  ref: ref,
73
+ ...(as ? {
74
+ forwardedAs: as
75
+ } : {}),
33
76
  ...props
34
77
  });
35
78
  });
79
+ DialogHeader.__SLOT__ = Dialog$1.Header.__SLOT__;
80
+ DialogBody.__SLOT__ = Dialog$1.Body.__SLOT__;
81
+ DialogFooter.__SLOT__ = Dialog$1.Footer.__SLOT__;
36
82
  const Dialog = Object.assign(DialogImpl, {
83
+ __SLOT__: Dialog$1['__SLOT__'],
37
84
  Buttons: Dialog$1.Buttons,
38
85
  Header: DialogHeader,
39
86
  Body: DialogBody,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primer/styled-react",
3
- "version": "0.0.0-20251030203243",
3
+ "version": "0.0.0-20251030203715",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -21,6 +21,10 @@
21
21
  "README.md",
22
22
  "dist"
23
23
  ],
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "git+https://github.com/primer/react.git"
27
+ },
24
28
  "scripts": {
25
29
  "build": "script/build",
26
30
  "clean": "rimraf dist",
@@ -39,7 +43,7 @@
39
43
  "devDependencies": {
40
44
  "@babel/preset-react": "^7.27.1",
41
45
  "@babel/preset-typescript": "^7.27.1",
42
- "@primer/react": "0.0.0-20251030203243",
46
+ "@primer/react": "0.0.0-20251030203715",
43
47
  "@rollup/plugin-babel": "^6.1.0",
44
48
  "@types/react": "18.3.11",
45
49
  "@types/react-dom": "18.3.1",
@@ -56,7 +60,7 @@
56
60
  "typescript": "^5.9.2"
57
61
  },
58
62
  "peerDependencies": {
59
- "@primer/react": "0.0.0-20251030203243",
63
+ "@primer/react": "0.0.0-20251030203715",
60
64
  "@types/react": "18.x || 19.x",
61
65
  "@types/react-dom": "18.x || 19.x",
62
66
  "@types/react-is": "18.x || 19.x",