@primer/styled-react 0.0.0-20250925010613 → 0.0.0-20250925033227
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/README.md +0 -18
- package/dist/deprecated.d.ts +1 -1
- package/dist/deprecated.d.ts.map +1 -1
- package/dist/experimental.d.ts +1 -2
- package/dist/experimental.d.ts.map +1 -1
- package/dist/experimental.js +1 -5
- package/dist/index.d.ts +24 -52
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +34 -332
- package/package.json +4 -6
- package/dist/PageHeader-Bvki2mbE.js +0 -87
- package/dist/components/ActionMenu.d.ts +0 -17
- package/dist/components/ActionMenu.d.ts.map +0 -1
- package/dist/components/Box.d.ts +0 -2
- package/dist/components/Box.d.ts.map +0 -1
- package/dist/components/Button.d.ts +0 -13
- package/dist/components/Button.d.ts.map +0 -1
- package/dist/components/Checkbox.d.ts +0 -5
- package/dist/components/Checkbox.d.ts.map +0 -1
- package/dist/components/CounterLabel.d.ts +0 -10
- package/dist/components/CounterLabel.d.ts.map +0 -1
- package/dist/components/Flash.d.ts +0 -8
- package/dist/components/Flash.d.ts.map +0 -1
- package/dist/components/Header.d.ts +0 -11
- package/dist/components/Header.d.ts.map +0 -1
- package/dist/components/IconButton.d.ts +0 -7
- package/dist/components/IconButton.d.ts.map +0 -1
- package/dist/components/LinkButton.d.ts +0 -7
- package/dist/components/LinkButton.d.ts.map +0 -1
- package/dist/components/PageHeader.d.ts +0 -30
- package/dist/components/PageHeader.d.ts.map +0 -1
- package/dist/components/RadioGroup.d.ts +0 -22
- package/dist/components/RadioGroup.d.ts.map +0 -1
- package/dist/components/RelativeTime.d.ts +0 -6
- package/dist/components/RelativeTime.d.ts.map +0 -1
- package/dist/components/SegmentedControl.d.ts +0 -12
- package/dist/components/SegmentedControl.d.ts.map +0 -1
- package/dist/components/Spinner.d.ts +0 -6
- package/dist/components/Spinner.d.ts.map +0 -1
- package/dist/components/StateLabel.d.ts +0 -9
- package/dist/components/StateLabel.d.ts.map +0 -1
- package/dist/components/StateLabelProps.d.ts +0 -8
- package/dist/components/StateLabelProps.d.ts.map +0 -1
- package/dist/components/SubNav.d.ts +0 -9
- package/dist/components/SubNav.d.ts.map +0 -1
- package/dist/components/Timeline.d.ts +0 -26
- package/dist/components/Timeline.d.ts.map +0 -1
- package/dist/components/ToggleSwitch.d.ts +0 -6
- package/dist/components/ToggleSwitch.d.ts.map +0 -1
- package/dist/components/Truncate.d.ts +0 -7
- package/dist/components/Truncate.d.ts.map +0 -1
- package/dist/components/UnderlineNav.d.ts +0 -9
- package/dist/components/UnderlineNav.d.ts.map +0 -1
- package/dist/components.json +0 -95
- package/dist/polymorphic.d.ts +0 -38
- package/dist/polymorphic.d.ts.map +0 -1
- package/dist/styled-props.d.ts +0 -5
- package/dist/styled-props.d.ts.map +0 -1
- package/dist/sx.d.ts +0 -5
- package/dist/sx.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -28,24 +28,6 @@ to an alternative styling solution, such as CSS Modules.
|
|
|
28
28
|
|
|
29
29
|
The documentation for `@primer/react` lives at [primer.style](https://primer.style). There, you'll find detailed documentation on getting started, all of the components, our theme, our principles, and more.
|
|
30
30
|
|
|
31
|
-
## Components List
|
|
32
|
-
|
|
33
|
-
A machine-readable list of all exported components, utilities, and types is available at build time:
|
|
34
|
-
|
|
35
|
-
```javascript
|
|
36
|
-
import componentsData from '@primer/styled-react/components.json' with {type: 'json'}
|
|
37
|
-
|
|
38
|
-
console.log(componentsData.components) // Array of component names
|
|
39
|
-
console.log(componentsData.utilities) // Array of utility names
|
|
40
|
-
console.log(componentsData.types) // Array of type names
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
This JSON file is automatically generated during the build process and includes:
|
|
44
|
-
|
|
45
|
-
- `components`: All React components exported by the package
|
|
46
|
-
- `utilities`: Theme utilities and helper functions
|
|
47
|
-
- `types`: TypeScript type definitions
|
|
48
|
-
|
|
49
31
|
## 🙌 Contributing
|
|
50
32
|
|
|
51
33
|
We love collaborating with folks inside and outside of GitHub and welcome contributions! If you're interested, check out our [contributing docs](contributor-docs/CONTRIBUTING.md) for more info on how to get started.
|
package/dist/deprecated.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Dialog, Octicon, TabNav, Tooltip
|
|
1
|
+
export { Dialog, Octicon, TabNav, Tooltip } from '@primer/react/deprecated';
|
|
2
2
|
//# sourceMappingURL=deprecated.d.ts.map
|
package/dist/deprecated.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deprecated.d.ts","sourceRoot":"","sources":["../src/deprecated.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"deprecated.d.ts","sourceRoot":"","sources":["../src/deprecated.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAC,MAAM,0BAA0B,CAAA"}
|
package/dist/experimental.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
export { PageHeader,
|
|
2
|
-
export { Dialog, Table, Tooltip, UnderlinePanels } from '@primer/react/experimental';
|
|
1
|
+
export { Dialog, PageHeader, Table, Tooltip, UnderlinePanels } from '@primer/react/experimental';
|
|
3
2
|
//# sourceMappingURL=experimental.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"experimental.d.ts","sourceRoot":"","sources":["../src/experimental.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"experimental.d.ts","sourceRoot":"","sources":["../src/experimental.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,eAAe,EAAC,MAAM,4BAA4B,CAAA"}
|
package/dist/experimental.js
CHANGED
|
@@ -1,5 +1 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { Dialog, Table, Tooltip, UnderlinePanels } from '@primer/react/experimental';
|
|
3
|
-
import '@primer/react';
|
|
4
|
-
import 'styled-components';
|
|
5
|
-
import 'react/jsx-runtime';
|
|
1
|
+
export { Dialog, PageHeader, Table, Tooltip, UnderlinePanels } from '@primer/react/experimental';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,53 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
export {
|
|
23
|
-
export { Tooltip } from '@primer/react';
|
|
24
|
-
export {
|
|
25
|
-
export { type TokenProps } from '@primer/react';
|
|
26
|
-
export { ThemeProvider } from '@primer/react';
|
|
27
|
-
export { merge } from '@primer/react';
|
|
28
|
-
export { theme } from '@primer/react';
|
|
29
|
-
export { themeGet } from '@primer/react';
|
|
30
|
-
export { useColorSchemeVar } from '@primer/react';
|
|
31
|
-
export { useTheme } from '@primer/react';
|
|
32
|
-
export { ActionMenu, type ActionMenuProps } from './components/ActionMenu';
|
|
33
|
-
export { ButtonComponent as Button, type ButtonComponentProps as ButtonProps } from './components/Button';
|
|
34
|
-
export { Checkbox, type CheckboxProps } from './components/Checkbox';
|
|
35
|
-
export { CounterLabel, type CounterLabelProps } from './components/CounterLabel';
|
|
36
|
-
export { Flash } from './components/Flash';
|
|
37
|
-
export { Header, type HeaderProps } from './components/Header';
|
|
38
|
-
export { IconButton, type IconButtonProps } from './components/IconButton';
|
|
39
|
-
export { LinkButton, type LinkButtonProps } from './components/LinkButton';
|
|
40
|
-
export { PageHeader, type PageHeaderProps, type PageHeaderActionsProps, type PageHeaderTitleProps, } from './components/PageHeader';
|
|
41
|
-
export { RadioGroup, type RadioGroupProps } from './components/RadioGroup';
|
|
42
|
-
export { RelativeTime, type RelativeTimeProps } from './components/RelativeTime';
|
|
43
|
-
export { SegmentedControl, type SegmentedControlProps, type SegmentedControlButtonProps, type SegmentedControlIconButtonProps, } from './components/SegmentedControl';
|
|
44
|
-
export { Spinner, type SpinnerProps } from './components/Spinner';
|
|
45
|
-
export { StateLabel, type StateLabelProps } from './components/StateLabel';
|
|
46
|
-
export { SubNav, type SubNavProps, type SubNavLinkProps } from './components/SubNav';
|
|
47
|
-
export { Timeline, type TimelineProps, type TimelineItemProps, type TimelineBadgeProps, type TimelineBodyProps, type TimelineBreakProps, } from './components/Timeline';
|
|
48
|
-
export { ToggleSwitch, type ToggleSwitchProps } from './components/ToggleSwitch';
|
|
49
|
-
export { Truncate, type TruncateProps } from './components/Truncate';
|
|
50
|
-
export { UnderlineNav, type UnderlineNavProps, type UnderlineNavItemProps } from './components/UnderlineNav';
|
|
51
|
-
export { sx, type SxProp } from './sx';
|
|
52
|
-
export type { BetterSystemStyleObject } from './styled-props';
|
|
1
|
+
import { type BetterSystemStyleObject, type BoxProps, type SxProp, type SubNavProps as PrimerSubNavProps, type SubNavLinkProps as PrimerSubNavLinkProps, type ToggleSwitchProps as PrimerToggleSwitchProps, type SegmentedControlProps as PrimerSegmentedControlProps, type SegmentedControlButtonProps as PrimerSegmentedControlButtonProps, type SegmentedControlIconButtonProps as PrimerSegmentedControlIconButtonProps } from '@primer/react';
|
|
2
|
+
import React, { type PropsWithChildren } from 'react';
|
|
3
|
+
import type { BackgroundProps, BorderProps, ColorProps, FlexboxProps, GridProps, LayoutProps, PositionProps, ShadowProps, SpaceProps, TypographyProps } from 'styled-system';
|
|
4
|
+
type StyledProps = SxProp & SpaceProps & ColorProps & TypographyProps & LayoutProps & FlexboxProps & GridProps & BackgroundProps & BorderProps & PositionProps & ShadowProps;
|
|
5
|
+
type SegmentedControlProps = PropsWithChildren<PrimerSegmentedControlProps> & SxProp;
|
|
6
|
+
type SegmentedControlButtonProps = PropsWithChildren<PrimerSegmentedControlButtonProps> & SxProp;
|
|
7
|
+
type SegmentedControlIconButtonProps = PropsWithChildren<PrimerSegmentedControlIconButtonProps> & SxProp;
|
|
8
|
+
declare const SegmentedControl: ((props: SegmentedControlProps) => React.JSX.Element) & {
|
|
9
|
+
Button: (props: SegmentedControlButtonProps) => React.JSX.Element;
|
|
10
|
+
IconButton: (props: SegmentedControlIconButtonProps) => React.JSX.Element;
|
|
11
|
+
};
|
|
12
|
+
declare const StateLabel: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLSpanElement> & {
|
|
13
|
+
variant?: "small" | "normal";
|
|
14
|
+
status: "open" | "issueOpened" | "pullOpened" | "issueClosed" | "issueClosedNotPlanned" | "pullClosed" | "pullMerged" | "draft" | "issueDraft" | "pullQueued" | "unavailable" | "closed";
|
|
15
|
+
} & SxProp & React.RefAttributes<HTMLSpanElement>>;
|
|
16
|
+
type SubNavProps = PrimerSubNavProps & SxProp;
|
|
17
|
+
type SubNavLinkProps = PrimerSubNavLinkProps & SxProp;
|
|
18
|
+
declare const SubNav: React.ForwardRefExoticComponent<Omit<SubNavProps, "ref"> & React.RefAttributes<HTMLElement>> & {
|
|
19
|
+
Link: React.ForwardRefExoticComponent<Omit<SubNavLinkProps, "ref"> & React.RefAttributes<HTMLAnchorElement>>;
|
|
20
|
+
};
|
|
21
|
+
declare const ToggleSwitch: React.ForwardRefExoticComponent<PrimerToggleSwitchProps & Omit<StyledProps, keyof PrimerToggleSwitchProps> & React.RefAttributes<HTMLButtonElement>>;
|
|
22
|
+
export { SegmentedControl, StateLabel, SubNav, ToggleSwitch };
|
|
23
|
+
export { ActionList, ActionMenu, Autocomplete, Avatar, Breadcrumbs, Button, Checkbox, CheckboxGroup, CircleBadge, CounterLabel, Details, Dialog, Flash, FormControl, Header, Heading, IconButton, Label, Link, LinkButton, NavList, Overlay, PageHeader, PageLayout, ProgressBar, RadioGroup, RelativeTime, Select, Spinner, Text, Textarea, TextInput, Timeline, Token, Tooltip, Truncate, UnderlineNav, Box, sx, ThemeProvider, merge, theme, themeGet, useColorSchemeVar, useTheme, } from '@primer/react';
|
|
24
|
+
export type { BoxProps, SxProp, BetterSystemStyleObject };
|
|
53
25
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,uBAAuB,EAE5B,KAAK,QAAQ,EACb,KAAK,MAAM,EAIX,KAAK,WAAW,IAAI,iBAAiB,EACrC,KAAK,eAAe,IAAI,qBAAqB,EAE7C,KAAK,iBAAiB,IAAI,uBAAuB,EACjD,KAAK,qBAAqB,IAAI,2BAA2B,EAEzD,KAAK,2BAA2B,IAAI,iCAAiC,EACrE,KAAK,+BAA+B,IAAI,qCAAqC,EAC9E,MAAM,eAAe,CAAA;AACtB,OAAO,KAAK,EAAE,EAAa,KAAK,iBAAiB,EAAC,MAAM,OAAO,CAAA;AAC/D,OAAO,KAAK,EACV,eAAe,EACf,WAAW,EACX,UAAU,EACV,YAAY,EACZ,SAAS,EACT,WAAW,EACX,aAAa,EACb,WAAW,EACX,UAAU,EACV,eAAe,EAChB,MAAM,eAAe,CAAA;AAEtB,KAAK,WAAW,GAAG,MAAM,GACvB,UAAU,GACV,UAAU,GACV,eAAe,GACf,WAAW,GACX,YAAY,GACZ,SAAS,GACT,eAAe,GACf,WAAW,GACX,aAAa,GACb,WAAW,CAAA;AAEb,KAAK,qBAAqB,GAAG,iBAAiB,CAAC,2BAA2B,CAAC,GAAG,MAAM,CAAA;AACpF,KAAK,2BAA2B,GAAG,iBAAiB,CAAC,iCAAiC,CAAC,GAAG,MAAM,CAAA;AAChG,KAAK,+BAA+B,GAAG,iBAAiB,CAAC,qCAAqC,CAAC,GAAG,MAAM,CAAA;AAcxG,QAAA,MAAM,gBAAgB,WAJe,qBAAqB;oBARnB,2BAA2B;wBAIvB,+BAA+B;CAWxE,CAAA;AAIF,QAAA,MAAM,UAAU;;;kDAEd,CAAA;AAEF,KAAK,WAAW,GAAG,iBAAiB,GAAG,MAAM,CAAA;AAM7C,KAAK,eAAe,GAAG,qBAAqB,GAAG,MAAM,CAAA;AAMrD,QAAA,MAAM,MAAM;;CAEV,CAAA;AAIF,QAAA,MAAM,YAAY,sJAEhB,CAAA;AAEF,OAAO,EAAC,gBAAgB,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,EAAC,CAAA;AAE3D,OAAO,EACL,UAAU,EACV,UAAU,EACV,YAAY,EACZ,MAAM,EACN,WAAW,EACX,MAAM,EACN,QAAQ,EACR,aAAa,EACb,WAAW,EACX,YAAY,EACZ,OAAO,EACP,MAAM,EACN,KAAK,EACL,WAAW,EACX,MAAM,EACN,OAAO,EACP,UAAU,EACV,KAAK,EACL,IAAI,EACJ,UAAU,EACV,OAAO,EACP,OAAO,EACP,UAAU,EACV,UAAU,EACV,WAAW,EACX,UAAU,EACV,YAAY,EACZ,MAAM,EACN,OAAO,EACP,IAAI,EACJ,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,KAAK,EACL,OAAO,EACP,QAAQ,EACR,YAAY,EAGZ,GAAG,EACH,EAAE,EAGF,aAAa,EACb,KAAK,EACL,KAAK,EACL,QAAQ,EACR,iBAAiB,EACjB,QAAQ,GACT,MAAM,eAAe,CAAA;AACtB,YAAY,EAAC,QAAQ,EAAE,MAAM,EAAE,uBAAuB,EAAC,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,360 +1,62 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { ActionList, Autocomplete, Avatar, Box, Breadcrumbs, CheckboxGroup, CircleBadge, Details, Dialog, FormControl, Heading, Label, Link, NavList, Overlay, PageLayout, ProgressBar, Select, Text, TextInput, Textarea, ThemeProvider, Token, Tooltip, merge, sx, theme, themeGet, useColorSchemeVar, useTheme } from '@primer/react';
|
|
3
|
-
import { forwardRef } from 'react';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
});
|
|
14
|
-
});
|
|
15
|
-
const ActionMenuImpl = props => /*#__PURE__*/jsx(Box, {
|
|
16
|
-
as: ActionMenu$1,
|
|
17
|
-
...props
|
|
18
|
-
});
|
|
19
|
-
const ActionMenuOverlay = props => {
|
|
20
|
-
return /*#__PURE__*/jsx(Box, {
|
|
21
|
-
as: ActionMenu$1.Overlay,
|
|
22
|
-
...props
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
const ActionMenu = Object.assign(ActionMenuImpl, {
|
|
26
|
-
Button: ActionMenuButton,
|
|
27
|
-
Anchor: ActionMenu$1.Anchor,
|
|
28
|
-
Overlay: ActionMenuOverlay,
|
|
29
|
-
Divider: ActionMenu$1.Divider
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
const ButtonComponent = ({
|
|
33
|
-
sx,
|
|
34
|
-
...rest
|
|
35
|
-
}) => {
|
|
36
|
-
const {
|
|
37
|
-
block,
|
|
38
|
-
size = 'medium',
|
|
39
|
-
leadingVisual,
|
|
40
|
-
trailingVisual,
|
|
41
|
-
trailingAction
|
|
42
|
-
} = rest;
|
|
43
|
-
let sxStyles = {};
|
|
44
|
-
const style = {};
|
|
45
|
-
if (sx !== null && Object.keys(sx || {}).length > 0) {
|
|
46
|
-
sxStyles = generateCustomSxProp({
|
|
47
|
-
block,
|
|
48
|
-
size,
|
|
49
|
-
leadingVisual,
|
|
50
|
-
trailingVisual,
|
|
51
|
-
trailingAction
|
|
52
|
-
}, sx);
|
|
53
|
-
|
|
54
|
-
// @ts-ignore sx can have color attribute
|
|
55
|
-
const {
|
|
56
|
-
color
|
|
57
|
-
} = sx;
|
|
58
|
-
if (color) style['--button-color'] = color;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// @ts-expect-error type mismatch between Box usage here and PrimerButton
|
|
62
|
-
return /*#__PURE__*/jsx(Box, {
|
|
63
|
-
...rest,
|
|
64
|
-
as: Button,
|
|
65
|
-
style: style,
|
|
66
|
-
sx: sxStyles
|
|
67
|
-
});
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
// This function is used to generate a custom cssSelector for the sxProp
|
|
71
|
-
|
|
72
|
-
// The usual sx prop can like this:
|
|
73
|
-
// sx={{
|
|
74
|
-
// [`@media (max-width: 768px)`]: {
|
|
75
|
-
// '& > ul': {
|
|
76
|
-
// backgroundColor: 'deeppink',
|
|
77
|
-
// },
|
|
78
|
-
// '&:hover': {
|
|
79
|
-
// backgroundColor: 'yellow',
|
|
80
|
-
// },
|
|
81
|
-
// },
|
|
82
|
-
// '&:hover': {
|
|
83
|
-
// backgroundColor: 'yellow',
|
|
84
|
-
// },
|
|
85
|
-
// '&': {
|
|
86
|
-
// width : 320px
|
|
87
|
-
// }
|
|
88
|
-
// }}
|
|
89
|
-
//*
|
|
90
|
-
/* What we want for Button styles is this:
|
|
91
|
-
sx={{
|
|
92
|
-
// [`@media (max-width: 768px)`]: {
|
|
93
|
-
// '&[data-attribute="something"] > ul': {
|
|
94
|
-
// backgroundColor: 'deeppink',
|
|
95
|
-
// },
|
|
96
|
-
// '&[data-attribute="something"]:hover': {
|
|
97
|
-
// backgroundColor: 'yellow',
|
|
98
|
-
// },
|
|
99
|
-
// },
|
|
100
|
-
// '&[data-attribute="something"]:hover': {
|
|
101
|
-
// backgroundColor: 'yellow',
|
|
102
|
-
// },
|
|
103
|
-
// '&[data-attribute="something"]': {
|
|
104
|
-
// width : 320px
|
|
105
|
-
// }
|
|
106
|
-
// }}
|
|
107
|
-
|
|
108
|
-
// We need to make sure we append the customCSSSelector to the original class selector. i.e & - > &[data-attribute="Icon"][data-size="small"]
|
|
109
|
-
*/
|
|
110
|
-
function generateCustomSxProp(props, providedSx) {
|
|
111
|
-
// Possible data attributes: data-size, data-block, data-no-visuals
|
|
112
|
-
const size = `[data-size="${props.size}"]`;
|
|
113
|
-
const block = props.block ? `[data-block="block"]` : '';
|
|
114
|
-
const noVisuals = props.leadingVisual || props.trailingVisual || props.trailingAction ? '' : '[data-no-visuals]';
|
|
115
|
-
|
|
116
|
-
// this is a custom selector. We need to make sure we add the data attributes to the base css class (& -> &[data-attributename="value"]])
|
|
117
|
-
const cssSelector = `&${size}${block}${noVisuals}`; // &[data-size="small"][data-block="block"][data-no-visuals]
|
|
118
|
-
|
|
119
|
-
const customSxProp = {};
|
|
120
|
-
if (!providedSx) return customSxProp;else {
|
|
121
|
-
customSxProp[cssSelector] = providedSx;
|
|
122
|
-
return customSxProp;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
ButtonComponent.displayName = 'Button';
|
|
126
|
-
|
|
127
|
-
const Checkbox = /*#__PURE__*/forwardRef(function Checkbox(props, ref) {
|
|
128
|
-
return /*#__PURE__*/jsx(Box, {
|
|
129
|
-
as: Checkbox$1,
|
|
130
|
-
ref: ref,
|
|
131
|
-
...props
|
|
132
|
-
});
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
const CounterLabel = /*#__PURE__*/forwardRef(function CounterLabel(props, ref) {
|
|
136
|
-
return /*#__PURE__*/jsx(Box, {
|
|
137
|
-
as: CounterLabel$1,
|
|
138
|
-
ref: ref,
|
|
139
|
-
...props
|
|
140
|
-
});
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
const Flash = styled(Flash$1).withConfig({
|
|
144
|
-
shouldForwardProp: prop => prop !== 'sx'
|
|
145
|
-
}).withConfig({
|
|
146
|
-
displayName: "Flash",
|
|
147
|
-
componentId: "sc-413izo-0"
|
|
148
|
-
})(["", ""], sx);
|
|
149
|
-
|
|
150
|
-
const HeaderImpl = /*#__PURE__*/forwardRef(function Header(props, ref) {
|
|
151
|
-
return /*#__PURE__*/jsx(Box, {
|
|
152
|
-
as: Header$1,
|
|
153
|
-
ref: ref,
|
|
154
|
-
...props
|
|
155
|
-
});
|
|
156
|
-
});
|
|
157
|
-
const HeaderItem = /*#__PURE__*/forwardRef(function HeaderItem(props, ref) {
|
|
158
|
-
return /*#__PURE__*/jsx(Box, {
|
|
159
|
-
as: Header$1.Item,
|
|
160
|
-
ref: ref,
|
|
161
|
-
...props
|
|
162
|
-
});
|
|
163
|
-
});
|
|
164
|
-
const HeaderLink = /*#__PURE__*/forwardRef(function HeaderLink(props, ref) {
|
|
165
|
-
return /*#__PURE__*/jsx(Box, {
|
|
166
|
-
as: Header$1.Link,
|
|
167
|
-
ref: ref,
|
|
168
|
-
...props
|
|
169
|
-
});
|
|
170
|
-
});
|
|
171
|
-
const Header = Object.assign(HeaderImpl, {
|
|
172
|
-
Item: HeaderItem,
|
|
173
|
-
Link: HeaderLink
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
const IconButton = styled(IconButton$1).withConfig({
|
|
177
|
-
shouldForwardProp: prop => prop !== 'sx'
|
|
178
|
-
}).withConfig({
|
|
179
|
-
displayName: "IconButton",
|
|
180
|
-
componentId: "sc-i53dt6-0"
|
|
181
|
-
})(["", ""], sx);
|
|
182
|
-
|
|
183
|
-
const LinkButton = styled(LinkButton$1).withConfig({
|
|
184
|
-
shouldForwardProp: prop => prop !== 'sx'
|
|
185
|
-
}).withConfig({
|
|
186
|
-
displayName: "LinkButton",
|
|
187
|
-
componentId: "sc-1v6zkmg-0"
|
|
188
|
-
})(["", ""], sx);
|
|
189
|
-
|
|
190
|
-
const RadioGroupImpl = props => {
|
|
191
|
-
return /*#__PURE__*/jsx(Box, {
|
|
192
|
-
as: RadioGroup$1,
|
|
193
|
-
...props
|
|
194
|
-
});
|
|
195
|
-
};
|
|
196
|
-
|
|
197
|
-
// Define local types based on the internal component props
|
|
198
|
-
|
|
199
|
-
const CheckboxOrRadioGroupLabel = props => {
|
|
200
|
-
return /*#__PURE__*/jsx(Box, {
|
|
201
|
-
as: RadioGroup$1.Label,
|
|
202
|
-
...props
|
|
203
|
-
});
|
|
204
|
-
};
|
|
205
|
-
const CheckboxOrRadioGroupCaption = props => {
|
|
206
|
-
return /*#__PURE__*/jsx(Box, {
|
|
207
|
-
as: RadioGroup$1.Caption,
|
|
208
|
-
...props
|
|
209
|
-
});
|
|
210
|
-
};
|
|
211
|
-
const CheckboxOrRadioGroupValidation = props => {
|
|
212
|
-
return /*#__PURE__*/jsx(Box, {
|
|
213
|
-
as: RadioGroup$1.Validation,
|
|
214
|
-
...props
|
|
215
|
-
});
|
|
216
|
-
};
|
|
217
|
-
const RadioGroup = Object.assign(RadioGroupImpl, {
|
|
218
|
-
Label: CheckboxOrRadioGroupLabel,
|
|
219
|
-
Caption: CheckboxOrRadioGroupCaption,
|
|
220
|
-
Validation: CheckboxOrRadioGroupValidation
|
|
221
|
-
});
|
|
222
|
-
|
|
223
|
-
function RelativeTime(props) {
|
|
224
|
-
// @ts-expect-error the types for Box are not correctly inferred here
|
|
225
|
-
return /*#__PURE__*/jsx(Box, {
|
|
226
|
-
as: RelativeTime$1,
|
|
227
|
-
...props
|
|
228
|
-
});
|
|
1
|
+
import { Box, SegmentedControl as SegmentedControl$1, SubNav as SubNav$1, StateLabel as StateLabel$1, ToggleSwitch as ToggleSwitch$1 } from '@primer/react';
|
|
2
|
+
export { ActionList, ActionMenu, Autocomplete, Avatar, Box, Breadcrumbs, Button, Checkbox, CheckboxGroup, CircleBadge, CounterLabel, Details, Dialog, Flash, FormControl, Header, Heading, IconButton, Label, Link, LinkButton, NavList, Overlay, PageHeader, PageLayout, ProgressBar, RadioGroup, RelativeTime, Select, Spinner, Text, TextInput, Textarea, ThemeProvider, Timeline, Token, Tooltip, Truncate, UnderlineNav, merge, sx, theme, themeGet, useColorSchemeVar, useTheme } from '@primer/react';
|
|
3
|
+
import React, { forwardRef } from 'react';
|
|
4
|
+
|
|
5
|
+
function _extends() {
|
|
6
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
7
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
8
|
+
var t = arguments[e];
|
|
9
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
10
|
+
}
|
|
11
|
+
return n;
|
|
12
|
+
}, _extends.apply(null, arguments);
|
|
229
13
|
}
|
|
230
14
|
|
|
231
15
|
const SegmentedControlButton = props => {
|
|
232
|
-
return /*#__PURE__*/
|
|
233
|
-
as: SegmentedControl$1.Button
|
|
234
|
-
|
|
235
|
-
});
|
|
16
|
+
return /*#__PURE__*/React.createElement(Box, _extends({
|
|
17
|
+
as: SegmentedControl$1.Button
|
|
18
|
+
}, props));
|
|
236
19
|
};
|
|
237
20
|
const SegmentedControlIconButton = props => {
|
|
238
|
-
return /*#__PURE__*/
|
|
239
|
-
as: SegmentedControl$1.IconButton
|
|
240
|
-
|
|
241
|
-
});
|
|
21
|
+
return /*#__PURE__*/React.createElement(Box, _extends({
|
|
22
|
+
as: SegmentedControl$1.IconButton
|
|
23
|
+
}, props));
|
|
242
24
|
};
|
|
243
25
|
const SegmentedControlImpl = props => {
|
|
244
|
-
return /*#__PURE__*/
|
|
245
|
-
as: SegmentedControl$1
|
|
246
|
-
|
|
247
|
-
});
|
|
26
|
+
return /*#__PURE__*/React.createElement(Box, _extends({
|
|
27
|
+
as: SegmentedControl$1
|
|
28
|
+
}, props));
|
|
248
29
|
};
|
|
249
30
|
const SegmentedControl = Object.assign(SegmentedControlImpl, {
|
|
250
31
|
Button: SegmentedControlButton,
|
|
251
32
|
IconButton: SegmentedControlIconButton
|
|
252
33
|
});
|
|
253
|
-
|
|
254
|
-
function Spinner(props) {
|
|
255
|
-
return /*#__PURE__*/jsx(Box, {
|
|
256
|
-
as: Spinner$1,
|
|
257
|
-
...props
|
|
258
|
-
});
|
|
259
|
-
}
|
|
260
|
-
|
|
261
34
|
const StateLabel = /*#__PURE__*/forwardRef(function StateLabel(props, ref) {
|
|
262
|
-
return /*#__PURE__*/
|
|
35
|
+
return /*#__PURE__*/React.createElement(Box, _extends({
|
|
263
36
|
as: StateLabel$1,
|
|
264
|
-
ref: ref
|
|
265
|
-
|
|
266
|
-
});
|
|
37
|
+
ref: ref
|
|
38
|
+
}, props));
|
|
267
39
|
});
|
|
268
|
-
|
|
269
40
|
const SubNavImpl = /*#__PURE__*/forwardRef(function SubNav(props, ref) {
|
|
270
|
-
return /*#__PURE__*/
|
|
41
|
+
return /*#__PURE__*/React.createElement(Box, _extends({
|
|
271
42
|
as: SubNav$1,
|
|
272
|
-
ref: ref
|
|
273
|
-
|
|
274
|
-
});
|
|
43
|
+
ref: ref
|
|
44
|
+
}, props));
|
|
275
45
|
});
|
|
276
46
|
const SubNavLink = /*#__PURE__*/forwardRef(function SubNavLink(props, ref) {
|
|
277
|
-
return /*#__PURE__*/
|
|
47
|
+
return /*#__PURE__*/React.createElement(Box, _extends({
|
|
278
48
|
as: SubNav$1.Link,
|
|
279
|
-
ref: ref
|
|
280
|
-
|
|
281
|
-
});
|
|
49
|
+
ref: ref
|
|
50
|
+
}, props));
|
|
282
51
|
});
|
|
283
52
|
const SubNav = Object.assign(SubNavImpl, {
|
|
284
53
|
Link: SubNavLink
|
|
285
54
|
});
|
|
286
|
-
|
|
287
|
-
const TimelineImpl = /*#__PURE__*/forwardRef(function Timeline(props, ref) {
|
|
288
|
-
return /*#__PURE__*/jsx(Box, {
|
|
289
|
-
as: Timeline$1,
|
|
290
|
-
ref: ref,
|
|
291
|
-
...props
|
|
292
|
-
});
|
|
293
|
-
});
|
|
294
|
-
const TimelineItem = /*#__PURE__*/forwardRef(function TimelineItem(props, ref) {
|
|
295
|
-
return /*#__PURE__*/jsx(Box, {
|
|
296
|
-
as: Timeline$1.Item,
|
|
297
|
-
ref: ref,
|
|
298
|
-
...props
|
|
299
|
-
});
|
|
300
|
-
});
|
|
301
|
-
function TimelineBadge(props) {
|
|
302
|
-
return /*#__PURE__*/jsx(Box, {
|
|
303
|
-
as: Timeline$1.Badge,
|
|
304
|
-
...props
|
|
305
|
-
});
|
|
306
|
-
}
|
|
307
|
-
const TimelineBody = /*#__PURE__*/forwardRef(function TimelineBody(props, ref) {
|
|
308
|
-
return /*#__PURE__*/jsx(Box, {
|
|
309
|
-
as: Timeline$1.Body,
|
|
310
|
-
ref: ref,
|
|
311
|
-
...props
|
|
312
|
-
});
|
|
313
|
-
});
|
|
314
|
-
const TimelineBreak = /*#__PURE__*/forwardRef(function TimelineBreak(props, ref) {
|
|
315
|
-
return /*#__PURE__*/jsx(Box, {
|
|
316
|
-
as: Timeline$1.Break,
|
|
317
|
-
ref: ref,
|
|
318
|
-
...props
|
|
319
|
-
});
|
|
320
|
-
});
|
|
321
|
-
const Timeline = Object.assign(TimelineImpl, {
|
|
322
|
-
Item: TimelineItem,
|
|
323
|
-
Badge: TimelineBadge,
|
|
324
|
-
Body: TimelineBody,
|
|
325
|
-
Break: TimelineBreak
|
|
326
|
-
});
|
|
327
|
-
|
|
328
55
|
const ToggleSwitch = /*#__PURE__*/forwardRef(function ToggleSwitch(props, ref) {
|
|
329
|
-
return /*#__PURE__*/
|
|
56
|
+
return /*#__PURE__*/React.createElement(Box, _extends({
|
|
330
57
|
as: ToggleSwitch$1,
|
|
331
|
-
ref: ref
|
|
332
|
-
|
|
333
|
-
});
|
|
334
|
-
});
|
|
335
|
-
|
|
336
|
-
const Truncate = styled(Truncate$1).withConfig({
|
|
337
|
-
shouldForwardProp: prop => prop !== 'sx'
|
|
338
|
-
}).withConfig({
|
|
339
|
-
displayName: "Truncate",
|
|
340
|
-
componentId: "sc-x3i4it-0"
|
|
341
|
-
})(["", ""], sx);
|
|
342
|
-
|
|
343
|
-
const UnderlineNavImpl = /*#__PURE__*/forwardRef(function UnderlineNav(props, ref) {
|
|
344
|
-
return /*#__PURE__*/jsx(Box, {
|
|
345
|
-
as: UnderlineNav$1,
|
|
346
|
-
ref: ref,
|
|
347
|
-
...props
|
|
348
|
-
});
|
|
349
|
-
});
|
|
350
|
-
const UnderlineNavItem = styled(UnderlineNav$1.Item).withConfig({
|
|
351
|
-
shouldForwardProp: prop => prop !== 'sx'
|
|
352
|
-
}).withConfig({
|
|
353
|
-
displayName: "UnderlineNav__UnderlineNavItem",
|
|
354
|
-
componentId: "sc-dx6br2-0"
|
|
355
|
-
})(["", ""], sx);
|
|
356
|
-
const UnderlineNav = Object.assign(UnderlineNavImpl, {
|
|
357
|
-
Item: UnderlineNavItem
|
|
58
|
+
ref: ref
|
|
59
|
+
}, props));
|
|
358
60
|
});
|
|
359
61
|
|
|
360
|
-
export {
|
|
62
|
+
export { SegmentedControl, StateLabel, SubNav, ToggleSwitch };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@primer/styled-react",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-20250925033227",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -14,8 +14,7 @@
|
|
|
14
14
|
"./experimental": {
|
|
15
15
|
"types": "./dist/experimental.d.ts",
|
|
16
16
|
"default": "./dist/experimental.js"
|
|
17
|
-
}
|
|
18
|
-
"./components.json": "./dist/components.json"
|
|
17
|
+
}
|
|
19
18
|
},
|
|
20
19
|
"files": [
|
|
21
20
|
"README.md",
|
|
@@ -30,12 +29,11 @@
|
|
|
30
29
|
"devDependencies": {
|
|
31
30
|
"@babel/preset-react": "^7.27.1",
|
|
32
31
|
"@babel/preset-typescript": "^7.27.1",
|
|
33
|
-
"@primer/react": "0.0.0-
|
|
32
|
+
"@primer/react": "0.0.0-20250925033227",
|
|
34
33
|
"@rollup/plugin-babel": "^6.0.4",
|
|
35
34
|
"@types/react": "18.3.11",
|
|
36
35
|
"@types/react-dom": "18.3.1",
|
|
37
36
|
"@vitejs/plugin-react": "^4.3.3",
|
|
38
|
-
"babel-plugin-styled-components": "2.1.4",
|
|
39
37
|
"publint": "^0.3.12",
|
|
40
38
|
"react": "18.3.1",
|
|
41
39
|
"react-dom": "18.3.1",
|
|
@@ -46,7 +44,7 @@
|
|
|
46
44
|
"typescript": "^5.9.2"
|
|
47
45
|
},
|
|
48
46
|
"peerDependencies": {
|
|
49
|
-
"@primer/react": "0.0.0-
|
|
47
|
+
"@primer/react": "0.0.0-20250925033227",
|
|
50
48
|
"@types/react": "18.x || 19.x",
|
|
51
49
|
"@types/react-dom": "18.x || 19.x",
|
|
52
50
|
"@types/react-is": "18.x || 19.x",
|