@primer/styled-react 0.0.0-20251008034312 → 0.0.0-20251008035349

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":"Label.d.ts","sourceRoot":"","sources":["../../src/components/Label.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,UAAU,IAAI,gBAAgB,EAAuB,MAAM,eAAe,CAAA;AACvF,OAAO,EAAK,KAAK,MAAM,EAAC,MAAM,OAAO,CAAA;AAErC,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,gBAAgB,CAAA;AAGvD,KAAK,UAAU,GAAG,gBAAgB,GAAG,MAAM,GAAG;IAAC,EAAE,CAAC,EAAE,KAAK,CAAC,WAAW,CAAA;CAAC,CAAA;AAQtE,QAAA,MAAM,KAAK,EAEL,mBAAmB,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;AAE7C,OAAO,EAAC,KAAK,EAAE,KAAK,UAAU,EAAC,CAAA"}
1
+ {"version":3,"file":"Label.d.ts","sourceRoot":"","sources":["../../src/components/Label.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,UAAU,IAAI,gBAAgB,EAA4B,MAAM,eAAe,CAAA;AAC5F,OAAO,EAAC,KAAK,MAAM,EAAC,MAAM,OAAO,CAAA;AAEjC,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,gBAAgB,CAAA;AAEvD,KAAK,UAAU,GAAG,gBAAgB,GAAG,MAAM,GAAG;IAAC,EAAE,CAAC,EAAE,KAAK,CAAC,WAAW,CAAA;CAAC,CAAA;AAMtE,QAAA,MAAM,KAAK,EAEL,mBAAmB,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;AAE7C,OAAO,EAAC,KAAK,EAAE,KAAK,UAAU,EAAC,CAAA"}
@@ -1,5 +1,6 @@
1
- import { Spinner as PrimerSpinner, type SpinnerProps as PrimerSpinnerProps } from '@primer/react';
2
- import { type SxProp } from '../sx';
1
+ import { type SpinnerProps as PrimerSpinnerProps } from '@primer/react';
2
+ import React from 'react';
3
+ import type { SxProp } from '../sx';
3
4
  export type SpinnerProps = PrimerSpinnerProps & SxProp;
4
- export declare const Spinner: import("styled-components").StyledComponent<typeof PrimerSpinner, any, SpinnerProps, never>;
5
+ export declare function Spinner(props: SpinnerProps): React.JSX.Element;
5
6
  //# sourceMappingURL=Spinner.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Spinner.d.ts","sourceRoot":"","sources":["../../src/components/Spinner.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,IAAI,aAAa,EAAE,KAAK,YAAY,IAAI,kBAAkB,EAAC,MAAM,eAAe,CAAA;AAC/F,OAAO,EAAK,KAAK,MAAM,EAAC,MAAM,OAAO,CAAA;AAGrC,MAAM,MAAM,YAAY,GAAG,kBAAkB,GAAG,MAAM,CAAA;AAEtD,eAAO,MAAM,OAAO,6FAInB,CAAA"}
1
+ {"version":3,"file":"Spinner.d.ts","sourceRoot":"","sources":["../../src/components/Spinner.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAgC,KAAK,YAAY,IAAI,kBAAkB,EAAC,MAAM,eAAe,CAAA;AACpG,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,OAAO,CAAA;AAEjC,MAAM,MAAM,YAAY,GAAG,kBAAkB,GAAG,MAAM,CAAA;AAEtD,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,qBAE1C"}
@@ -1,8 +1,7 @@
1
- import { type TokenProps as PrimerTokenProps } from '@primer/react';
2
- import { type SxProp } from '../sx';
1
+ import { type TokenProps as PrimerTokenProps, type SxProp } from '@primer/react';
3
2
  import type { ForwardRefComponent } from '../polymorphic';
4
3
  import type { PropsWithChildren } from 'react';
5
4
  type TokenProps = PropsWithChildren<PrimerTokenProps> & SxProp;
6
- declare const Token: ForwardRefComponent<"a" | "button" | "span", TokenProps>;
5
+ declare const Token: ForwardRefComponent<'a' | 'button' | 'span', TokenProps>;
7
6
  export { Token, type TokenProps };
8
7
  //# sourceMappingURL=Token.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Token.d.ts","sourceRoot":"","sources":["../../src/components/Token.tsx"],"names":[],"mappings":"AACA,OAAO,EAAC,KAAK,UAAU,IAAI,gBAAgB,EAAuB,MAAM,eAAe,CAAA;AACvF,OAAO,EAAK,KAAK,MAAM,EAAC,MAAM,OAAO,CAAA;AACrC,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,gBAAgB,CAAA;AACvD,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,OAAO,CAAA;AAG5C,KAAK,UAAU,GAAG,iBAAiB,CAAC,gBAAgB,CAAC,GAAG,MAAM,CAAA;AAQ9D,QAAA,MAAM,KAAK,EAEL,mBAAmB,CAAC,GAAG,GAAG,QAAQ,GAAG,MAAM,EAAE,UAAU,CAAC,CAAA;AAE9D,OAAO,EAAC,KAAK,EAAE,KAAK,UAAU,EAAC,CAAA"}
1
+ {"version":3,"file":"Token.d.ts","sourceRoot":"","sources":["../../src/components/Token.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,UAAU,IAAI,gBAAgB,EACnC,KAAK,MAAM,EAIZ,MAAM,eAAe,CAAA;AAEtB,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,gBAAgB,CAAA;AACvD,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,OAAO,CAAA;AAE5C,KAAK,UAAU,GAAG,iBAAiB,CAAC,gBAAgB,CAAC,GAAG,MAAM,CAAA;AAE9D,QAAA,MAAM,KAAK,EAAE,mBAAmB,CAAC,GAAG,GAAG,QAAQ,GAAG,MAAM,EAAE,UAAU,CAgBP,CAAA;AAE7D,OAAO,EAAC,KAAK,EAAE,KAAK,UAAU,EAAC,CAAA"}
package/dist/index.js CHANGED
@@ -1,9 +1,10 @@
1
- import { ActionList as ActionList$1, sx, ActionMenu as ActionMenu$1, Autocomplete as Autocomplete$1, Box, Avatar as Avatar$1, Breadcrumbs as Breadcrumbs$1, Checkbox as Checkbox$1, CheckboxGroup as CheckboxGroup$1, CircleBadge as CircleBadge$1, CounterLabel as CounterLabel$1, Flash as Flash$1, Header as Header$1, Heading as Heading$1, Label as Label$1, Link as Link$1, LinkButton as LinkButton$1, NavList as NavList$1, Overlay as Overlay$1, PageLayout as PageLayout$1, RadioGroup as RadioGroup$1, RelativeTime as RelativeTime$1, SegmentedControl as SegmentedControl$1, Spinner as Spinner$1, StateLabel as StateLabel$1, SubNav as SubNav$1, Text as Text$1, Timeline as Timeline$1, ToggleSwitch as ToggleSwitch$1, Token as Token$1, Truncate as Truncate$1, UnderlineNav as UnderlineNav$1 } from '@primer/react';
1
+ import { ActionList as ActionList$1, sx, ActionMenu as ActionMenu$1, Autocomplete as Autocomplete$1, Box, Avatar as Avatar$1, Breadcrumbs as Breadcrumbs$1, Checkbox as Checkbox$1, CheckboxGroup as CheckboxGroup$1, CircleBadge as CircleBadge$1, CounterLabel as CounterLabel$1, Flash as Flash$1, Header as Header$1, Heading as Heading$1, Label as Label$1, Link as Link$1, LinkButton as LinkButton$1, NavList as NavList$1, Overlay as Overlay$1, PageLayout as PageLayout$1, RadioGroup as RadioGroup$1, RelativeTime as RelativeTime$1, SegmentedControl as SegmentedControl$1, Spinner as Spinner$1, StateLabel as StateLabel$1, SubNav as SubNav$1, Text as Text$1, Timeline as Timeline$1, ToggleSwitch as ToggleSwitch$1, useTheme, theme, Token as Token$1, Truncate as Truncate$1, UnderlineNav as UnderlineNav$1 } from '@primer/react';
2
2
  export { Box, Button, Details, FormControl, IconButton, ProgressBar, Select, TextInput, Textarea, ThemeProvider, merge, sx, theme, themeGet, useColorSchemeVar, useTheme } from '@primer/react';
3
3
  import React, { forwardRef } from 'react';
4
4
  import styled from 'styled-components';
5
5
  import { jsx } from 'react/jsx-runtime';
6
6
  export { D as Dialog, P as PageHeader, T as Tooltip } from './Tooltip-DIHgr01r.js';
7
+ import css from '@styled-system/css';
7
8
 
8
9
  const StyledActionList = styled(ActionList$1).withConfig({
9
10
  shouldForwardProp: prop => prop !== 'sx'
@@ -285,12 +286,13 @@ const Heading = styled(Heading$1).withConfig({
285
286
  componentId: "sc-1vc165i-0"
286
287
  })(["", ""], sx);
287
288
 
288
- const StyledLabel = styled(Label$1).withConfig({
289
- shouldForwardProp: prop => prop !== 'sx'
290
- }).withConfig({
291
- displayName: "Label__StyledLabel",
292
- componentId: "sc-1cpass9-0"
293
- })(["", ""], sx);
289
+ const StyledLabel = /*#__PURE__*/forwardRef(function Label(props, ref) {
290
+ return /*#__PURE__*/jsx(Box, {
291
+ as: Label$1,
292
+ ref: ref,
293
+ ...props
294
+ });
295
+ });
294
296
  const Label = /*#__PURE__*/forwardRef(({
295
297
  as,
296
298
  ...props
@@ -485,12 +487,12 @@ const SegmentedControl = Object.assign(SegmentedControlImpl, {
485
487
  IconButton: SegmentedControlIconButton
486
488
  });
487
489
 
488
- const Spinner = styled(Spinner$1).withConfig({
489
- shouldForwardProp: prop => prop !== 'sx'
490
- }).withConfig({
491
- displayName: "Spinner",
492
- componentId: "sc-jbw2a0-0"
493
- })(["", ""], sx);
490
+ function Spinner(props) {
491
+ return /*#__PURE__*/jsx(Box, {
492
+ as: Spinner$1,
493
+ ...props
494
+ });
495
+ }
494
496
 
495
497
  const StateLabel = /*#__PURE__*/forwardRef(function StateLabel(props, ref) {
496
498
  return /*#__PURE__*/jsx(Box, {
@@ -587,21 +589,32 @@ const ToggleSwitch = /*#__PURE__*/forwardRef(function ToggleSwitch(props, ref) {
587
589
  });
588
590
  });
589
591
 
590
- const StyledToken = styled(Token$1).withConfig({
591
- shouldForwardProp: prop => prop !== 'sx'
592
- }).withConfig({
593
- displayName: "Token__StyledToken",
594
- componentId: "sc-ldn0r8-0"
595
- })(["", ""], sx);
596
- const Token = /*#__PURE__*/forwardRef(({
597
- as,
598
- ...props
592
+ const Token = /*#__PURE__*/React.forwardRef(({
593
+ sx: sxProp,
594
+ style,
595
+ ...rest
599
596
  }, ref) => {
600
- return /*#__PURE__*/jsx(StyledToken, {
601
- ...props,
602
- ...(as ? {
603
- forwardedAs: as
604
- } : {}),
597
+ const contextTheme = useTheme();
598
+ const theme$1 = contextTheme.theme || theme;
599
+
600
+ // If no sx prop is provided, just return PrimerToken directly
601
+ if (!sxProp) {
602
+ return /*#__PURE__*/jsx(Token$1, {
603
+ ...rest,
604
+ style: style,
605
+ ref: ref
606
+ });
607
+ }
608
+
609
+ // Convert sx to CSS styles using the theme context
610
+ const sxStyles = css(sxProp)(theme$1);
611
+ const mergedStyle = {
612
+ ...sxStyles,
613
+ ...style
614
+ };
615
+ return /*#__PURE__*/jsx(Token$1, {
616
+ ...rest,
617
+ style: mergedStyle,
605
618
  ref: ref
606
619
  });
607
620
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primer/styled-react",
3
- "version": "0.0.0-20251008034312",
3
+ "version": "0.0.0-20251008035349",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -30,7 +30,7 @@
30
30
  "devDependencies": {
31
31
  "@babel/preset-react": "^7.27.1",
32
32
  "@babel/preset-typescript": "^7.27.1",
33
- "@primer/react": "0.0.0-20251008034312",
33
+ "@primer/react": "0.0.0-20251008035349",
34
34
  "@rollup/plugin-babel": "^6.0.4",
35
35
  "@types/react": "18.3.11",
36
36
  "@types/react-dom": "18.3.1",
@@ -46,7 +46,7 @@
46
46
  "typescript": "^5.9.2"
47
47
  },
48
48
  "peerDependencies": {
49
- "@primer/react": "0.0.0-20251008034312",
49
+ "@primer/react": "0.0.0-20251008035349",
50
50
  "@types/react": "18.x || 19.x",
51
51
  "@types/react-dom": "18.x || 19.x",
52
52
  "@types/react-is": "18.x || 19.x",