@primer/react 37.32.0-rc.f8e94f384 → 38.0.0-rc.1

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.
Files changed (155) hide show
  1. package/CHANGELOG.md +36 -1
  2. package/dist/browser.esm.js +3 -3
  3. package/dist/browser.esm.js.map +1 -1
  4. package/dist/browser.umd.js +3 -3
  5. package/dist/browser.umd.js.map +1 -1
  6. package/dist/components.css +162 -125
  7. package/generated/components.json +87 -200
  8. package/lib/Autocomplete/AutocompleteMenu.js +7 -7
  9. package/lib/CircleOcticon/CircleOcticon.d.ts +3 -0
  10. package/lib/CircleOcticon/CircleOcticon.d.ts.map +1 -1
  11. package/lib/CircleOcticon/CircleOcticon.js +3 -0
  12. package/lib/ConfirmationDialog/ConfirmationDialog.d.ts +8 -0
  13. package/lib/ConfirmationDialog/ConfirmationDialog.d.ts.map +1 -1
  14. package/lib/ConfirmationDialog/ConfirmationDialog.js +6 -2
  15. package/lib/FilteredActionList/FilteredActionList-96b126d7.css +2 -0
  16. package/lib/FilteredActionList/FilteredActionList-96b126d7.css.map +1 -0
  17. package/lib/FilteredActionList/FilteredActionList.d.ts.map +1 -1
  18. package/lib/FilteredActionList/FilteredActionList.js +3 -6
  19. package/lib/FilteredActionList/FilteredActionList.module.css.js +2 -2
  20. package/lib/PointerBox/PointerBox.d.ts +1 -1
  21. package/lib/PointerBox/PointerBox.d.ts.map +1 -1
  22. package/lib/PointerBox/PointerBox.js +1 -1
  23. package/lib/ProgressBar/ProgressBar-a0957632.css +2 -0
  24. package/lib/ProgressBar/ProgressBar-a0957632.css.map +1 -0
  25. package/lib/ProgressBar/ProgressBar.d.ts.map +1 -1
  26. package/lib/ProgressBar/ProgressBar.js +53 -49
  27. package/lib/ProgressBar/ProgressBar.module.css.js +1 -1
  28. package/lib/Radio/{Radio-b2a92b7d.css → Radio-df9a5c02.css} +2 -2
  29. package/lib/Radio/{Radio-b2a92b7d.css.map → Radio-df9a5c02.css.map} +1 -1
  30. package/lib/Radio/Radio.module.css.js +1 -1
  31. package/lib/Select/Select.js +61 -53
  32. package/lib/SelectPanel/SelectPanel.js +2 -2
  33. package/lib/SplitPageLayout/SplitPageLayout.d.ts +1 -2
  34. package/lib/SplitPageLayout/SplitPageLayout.d.ts.map +1 -1
  35. package/lib/Stack/Stack.d.ts.map +1 -1
  36. package/lib/Stack/Stack.js +110 -111
  37. package/lib/StateLabel/StateLabel-cd27f475.css +2 -0
  38. package/lib/StateLabel/StateLabel-cd27f475.css.map +1 -0
  39. package/lib/StateLabel/StateLabel.d.ts +1 -2
  40. package/lib/StateLabel/StateLabel.d.ts.map +1 -1
  41. package/lib/StateLabel/StateLabel.js +3 -5
  42. package/lib/StateLabel/StateLabel.module.css.js +7 -0
  43. package/lib/SubNav/SubNav.d.ts +8 -16
  44. package/lib/SubNav/SubNav.d.ts.map +1 -1
  45. package/lib/SubNav/SubNav.js +3 -6
  46. package/lib/ToggleSwitch/ToggleSwitch-65936b4b.css +4 -0
  47. package/lib/ToggleSwitch/ToggleSwitch-65936b4b.css.map +1 -0
  48. package/lib/ToggleSwitch/ToggleSwitch.d.ts +1 -2
  49. package/lib/ToggleSwitch/ToggleSwitch.d.ts.map +1 -1
  50. package/lib/ToggleSwitch/ToggleSwitch.js +163 -213
  51. package/lib/ToggleSwitch/ToggleSwitch.module.css.js +7 -0
  52. package/lib/ToggleSwitch/ToggleSwitchStoryWrapper.d.ts.map +1 -1
  53. package/lib/Token/index.d.ts +0 -1
  54. package/lib/Token/index.d.ts.map +1 -1
  55. package/lib/TreeView/shared.js +2 -2
  56. package/lib/VisuallyHidden/VisuallyHidden.d.ts +1 -2
  57. package/lib/VisuallyHidden/VisuallyHidden.d.ts.map +1 -1
  58. package/lib/VisuallyHidden/VisuallyHidden.js +1 -3
  59. package/lib/deprecated/UnderlineNav/UnderlineNav.d.ts +2 -3
  60. package/lib/deprecated/UnderlineNav/UnderlineNav.d.ts.map +1 -1
  61. package/lib/deprecated/UnderlineNav/UnderlineNav.js +2 -3
  62. package/lib/deprecated/index.d.ts +0 -2
  63. package/lib/deprecated/index.d.ts.map +1 -1
  64. package/lib/deprecated/index.js +0 -2
  65. package/lib/hooks/useMnemonics.js +1 -2
  66. package/lib/index.d.ts +1 -5
  67. package/lib/index.d.ts.map +1 -1
  68. package/lib/index.js +0 -6
  69. package/lib/{Caret.d.ts → internal/components/Caret.d.ts} +1 -1
  70. package/lib/internal/components/Caret.d.ts.map +1 -0
  71. package/lib-esm/Autocomplete/AutocompleteMenu.js +1 -1
  72. package/lib-esm/CircleOcticon/CircleOcticon.d.ts +3 -0
  73. package/lib-esm/CircleOcticon/CircleOcticon.js +3 -0
  74. package/lib-esm/ConfirmationDialog/ConfirmationDialog.d.ts +8 -0
  75. package/lib-esm/ConfirmationDialog/ConfirmationDialog.js +6 -2
  76. package/lib-esm/FilteredActionList/FilteredActionList-96b126d7.css +2 -0
  77. package/lib-esm/FilteredActionList/FilteredActionList-96b126d7.css.map +1 -0
  78. package/lib-esm/FilteredActionList/FilteredActionList.js +3 -6
  79. package/lib-esm/FilteredActionList/FilteredActionList.module.css.js +2 -2
  80. package/lib-esm/PointerBox/PointerBox.d.ts +1 -1
  81. package/lib-esm/PointerBox/PointerBox.js +1 -1
  82. package/lib-esm/ProgressBar/ProgressBar-a0957632.css +2 -0
  83. package/lib-esm/ProgressBar/ProgressBar-a0957632.css.map +1 -0
  84. package/lib-esm/ProgressBar/ProgressBar.js +53 -49
  85. package/lib-esm/ProgressBar/ProgressBar.module.css.js +1 -1
  86. package/lib-esm/Radio/{Radio-b2a92b7d.css → Radio-df9a5c02.css} +2 -2
  87. package/lib-esm/Radio/{Radio-b2a92b7d.css.map → Radio-df9a5c02.css.map} +1 -1
  88. package/lib-esm/Radio/Radio.module.css.js +1 -1
  89. package/lib-esm/Select/Select.js +61 -53
  90. package/lib-esm/SelectPanel/SelectPanel.js +1 -1
  91. package/lib-esm/SplitPageLayout/SplitPageLayout.d.ts +1 -2
  92. package/lib-esm/Stack/Stack.js +110 -111
  93. package/lib-esm/StateLabel/StateLabel-cd27f475.css +2 -0
  94. package/lib-esm/StateLabel/StateLabel-cd27f475.css.map +1 -0
  95. package/lib-esm/StateLabel/StateLabel.d.ts +1 -2
  96. package/lib-esm/StateLabel/StateLabel.js +3 -5
  97. package/lib-esm/StateLabel/StateLabel.module.css.js +5 -0
  98. package/lib-esm/SubNav/SubNav.d.ts +8 -16
  99. package/lib-esm/SubNav/SubNav.js +3 -6
  100. package/lib-esm/ToggleSwitch/ToggleSwitch-65936b4b.css +4 -0
  101. package/lib-esm/ToggleSwitch/ToggleSwitch-65936b4b.css.map +1 -0
  102. package/lib-esm/ToggleSwitch/ToggleSwitch.d.ts +1 -2
  103. package/lib-esm/ToggleSwitch/ToggleSwitch.js +163 -213
  104. package/lib-esm/ToggleSwitch/ToggleSwitch.module.css.js +5 -0
  105. package/lib-esm/Token/index.d.ts +0 -1
  106. package/lib-esm/TreeView/shared.js +2 -2
  107. package/lib-esm/VisuallyHidden/VisuallyHidden.d.ts +1 -2
  108. package/lib-esm/VisuallyHidden/VisuallyHidden.js +1 -3
  109. package/lib-esm/deprecated/UnderlineNav/UnderlineNav.d.ts +2 -3
  110. package/lib-esm/deprecated/UnderlineNav/UnderlineNav.js +2 -3
  111. package/lib-esm/deprecated/index.d.ts +0 -2
  112. package/lib-esm/deprecated/index.js +0 -1
  113. package/lib-esm/hooks/useMnemonics.js +1 -2
  114. package/lib-esm/index.d.ts +1 -5
  115. package/lib-esm/index.js +0 -3
  116. package/lib-esm/{Caret.d.ts → internal/components/Caret.d.ts} +1 -1
  117. package/package.json +13 -14
  118. package/lib/Caret.d.ts.map +0 -1
  119. package/lib/FilteredActionList/FilteredActionList-d1d6d026.css +0 -2
  120. package/lib/FilteredActionList/FilteredActionList-d1d6d026.css.map +0 -1
  121. package/lib/ProgressBar/ProgressBar-430cdef7.css +0 -2
  122. package/lib/ProgressBar/ProgressBar-430cdef7.css.map +0 -1
  123. package/lib/Token/AvatarToken-ff45cc85.css +0 -2
  124. package/lib/Token/AvatarToken-ff45cc85.css.map +0 -1
  125. package/lib/Token/AvatarToken.d.ts +0 -8
  126. package/lib/Token/AvatarToken.d.ts.map +0 -1
  127. package/lib/Token/AvatarToken.js +0 -99
  128. package/lib/Token/AvatarToken.module.css.js +0 -7
  129. package/lib/deprecated/AvatarPair/AvatarPair-68990abe.css +0 -2
  130. package/lib/deprecated/AvatarPair/AvatarPair-68990abe.css.map +0 -1
  131. package/lib/deprecated/AvatarPair/AvatarPair.d.ts +0 -14
  132. package/lib/deprecated/AvatarPair/AvatarPair.d.ts.map +0 -1
  133. package/lib/deprecated/AvatarPair/AvatarPair.js +0 -95
  134. package/lib/deprecated/AvatarPair/AvatarPair.module.css.js +0 -7
  135. package/lib/deprecated/AvatarPair/index.d.ts +0 -3
  136. package/lib/deprecated/AvatarPair/index.d.ts.map +0 -1
  137. package/lib/node_modules/@github/mini-throttle/dist/index.js +0 -43
  138. package/lib-esm/FilteredActionList/FilteredActionList-d1d6d026.css +0 -2
  139. package/lib-esm/FilteredActionList/FilteredActionList-d1d6d026.css.map +0 -1
  140. package/lib-esm/ProgressBar/ProgressBar-430cdef7.css +0 -2
  141. package/lib-esm/ProgressBar/ProgressBar-430cdef7.css.map +0 -1
  142. package/lib-esm/Token/AvatarToken-ff45cc85.css +0 -2
  143. package/lib-esm/Token/AvatarToken-ff45cc85.css.map +0 -1
  144. package/lib-esm/Token/AvatarToken.d.ts +0 -8
  145. package/lib-esm/Token/AvatarToken.js +0 -97
  146. package/lib-esm/Token/AvatarToken.module.css.js +0 -5
  147. package/lib-esm/deprecated/AvatarPair/AvatarPair-68990abe.css +0 -2
  148. package/lib-esm/deprecated/AvatarPair/AvatarPair-68990abe.css.map +0 -1
  149. package/lib-esm/deprecated/AvatarPair/AvatarPair.d.ts +0 -14
  150. package/lib-esm/deprecated/AvatarPair/AvatarPair.js +0 -89
  151. package/lib-esm/deprecated/AvatarPair/AvatarPair.module.css.js +0 -5
  152. package/lib-esm/deprecated/AvatarPair/index.d.ts +0 -3
  153. package/lib-esm/node_modules/@github/mini-throttle/dist/index.js +0 -40
  154. /package/lib/{Caret.js → internal/components/Caret.js} +0 -0
  155. /package/lib-esm/{Caret.js → internal/components/Caret.js} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/ToggleSwitch/ToggleSwitch.module.css"],"names":[],"mappings":"AAAA,qCAEE,kBAAmB,CADnB,mBAAoB,CAEpB,0BACF,CAEA,uEACE,kBACF,CAEA,mCAIE,oDAA6B,CAE7B,cAAe,CADf,8CAAuC,CAJvC,oCAA+B,CAC/B,qCAAgC,CAChC,iBAIF,CAEA,oDACE,4CACF,CAEA,uDACE,gDAA2B,CAC3B,kBACF,CAEA,uCACE,gBACF,CAEA,yDAEE,QAAS,CADT,iBAEF,CAEA,sCAEE,kBAAmB,CADnB,YAAa,CAGb,WAAY,CACZ,eAAgB,CAFhB,UAGF,CAEA,gCAGE,cAAe,CAFf,WAAY,CACZ,aAAc,CAGd,aAAc,CAEd,wBAAyB,CADzB,6BAEF,CAEA,8CACE,oIAA2G,CAC3G,uBACF,CAEA,kEACE,2BACF,CAEA,kEACE;;GAIF,CAEA,+CACE,8GAA2F,CAC3F,0BACF,CAEA,mEACE,uBACF,CAEA,mEACE,sIACF","file":"ToggleSwitch-65936b4b.css","sourcesContent":[".ToggleSwitch {\n display: inline-flex;\n align-items: center;\n flex-direction: row-reverse;\n}\n\n.ToggleSwitch[data-status-label-position='start'] {\n flex-direction: row;\n}\n\n.StatusText {\n margin-left: var(--base-size-8);\n margin-right: var(--base-size-8);\n position: relative;\n color: var(--fgColor-default);\n font-size: var(--text-body-size-medium);\n cursor: pointer;\n}\n\n.StatusText[data-size='small'] {\n font-size: var(--text-body-size-small);\n}\n\n.StatusText[data-disabled='true'] {\n color: var(--fgColor-muted);\n cursor: not-allowed;\n}\n\n.StatusTextItem {\n text-align: right;\n}\n\n.StatusTextItem[data-hidden='true'] {\n visibility: hidden;\n height: 0;\n}\n\n.IconContainer {\n display: flex;\n align-items: center;\n width: 100%;\n height: 100%;\n overflow: hidden;\n}\n\n.IconBox {\n flex-grow: 1;\n flex-shrink: 0;\n flex-basis: 50%;\n /* stylelint-disable-next-line primer/typography */\n line-height: 0;\n transition-property: transform;\n transition-duration: 80ms;\n}\n\n.IconBox[data-type='on'] {\n color: var(--control-checked-fgColor-rest, var(--color-switch-track-checked-fg, var(--fgColor-onEmphasis)));\n transform: translateX(0);\n}\n\n.IconBox[data-type='on'][data-checked='false'] {\n transform: translateX(-100%);\n}\n\n.IconBox[data-type='on'][data-disabled='true'] {\n color: var(\n --control-checked-fgColor-disabled,\n var(--color-switch-track-checked-disabled-fg, var(--fgColor-onEmphasis))\n );\n}\n\n.IconBox[data-type='off'] {\n color: var(--controlTrack-fgColor-rest, var(--color-switch-track-fg, var(--fgColor-muted)));\n transform: translateX(100%);\n}\n\n.IconBox[data-type='off'][data-checked='false'] {\n transform: translateX(0);\n}\n\n.IconBox[data-type='off'][data-disabled='true'] {\n color: var(--controlTrack-fgColor-disabled, var(--color-switch-track-disabled-fg, var(--fgColor-onEmphasis)));\n}\n"]}
@@ -1,8 +1,7 @@
1
1
  import type { MouseEventHandler } from 'react';
2
2
  import React from 'react';
3
- import type { SxProp } from '../sx';
4
3
  import type { CellAlignment } from '../DataTable/column';
5
- export interface ToggleSwitchProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'>, SxProp {
4
+ export interface ToggleSwitchProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> {
6
5
  /** The id of the DOM node that labels the switch */
7
6
  ['aria-labelledby']: string;
8
7
  /** Uncontrolled - whether the switch is turned on */
@@ -2,18 +2,17 @@ import { c } from 'react-compiler-runtime';
2
2
  import React, { useEffect } from 'react';
3
3
  import styled, { css } from 'styled-components';
4
4
  import { variant } from 'styled-system';
5
+ import { clsx } from 'clsx';
5
6
  import { get } from '../constants.js';
6
- import sx from '../sx.js';
7
7
  import getGlobalFocusStyles from '../internal/utils/getGlobalFocusStyles.js';
8
8
  import VisuallyHidden from '../_VisuallyHidden.js';
9
9
  import useSafeTimeout from '../hooks/useSafeTimeout.js';
10
+ import classes from './ToggleSwitch.module.css.js';
10
11
  import { jsxs, jsx } from 'react/jsx-runtime';
11
12
  import { useProvidedStateOrCreate } from '../hooks/useProvidedStateOrCreate.js';
12
13
  import { useId } from '../hooks/useId.js';
13
- import Box from '../Box/Box.js';
14
14
  import { AriaStatus } from '../live-region/AriaStatus.js';
15
15
  import StyledSpinner from '../Spinner/Spinner.js';
16
- import Text from '../Text/Text.js';
17
16
 
18
17
  const TRANSITION_DURATION = '80ms';
19
18
  const EASE_OUT_QUAD_CURVE = 'cubic-bezier(0.5, 1, 0.89, 1)';
@@ -101,7 +100,7 @@ const LineIcon = t0 => {
101
100
  const SwitchButton = styled.button.withConfig({
102
101
  displayName: "ToggleSwitch__SwitchButton",
103
102
  componentId: "sc-e6gszy-0"
104
- })(["vertical-align:middle;cursor:pointer;user-select:none;appearance:none;text-decoration:none;padding:0;transition-property:background-color,border-color;transition-duration:", ";transition-timing-function:", ";border-radius:", ";border-style:solid;border-width:1px;display:block;height:32px;width:64px;position:relative;overflow:hidden;", ";@media (pointer:coarse){&:before{content:'';position:absolute;left:0;right:0;transform:translateY(-50%);top:50%;min-height:44px;}}@media (prefers-reduced-motion){transition:none;*{transition:none;}}&:hover:not(:disabled):not([aria-disabled='true']),&:focus:focus-visible{background-color:", ";}&:active,&:active:focus-visible{background-color:", ";}", " ", " ", ""], TRANSITION_DURATION, EASE_OUT_QUAD_CURVE, get('radii.2'), getGlobalFocusStyles('3px'), get('colors.switchTrack.hoverBg'), get('colors.switchTrack.activeBg'), props => {
103
+ })(["vertical-align:middle;cursor:pointer;user-select:none;appearance:none;text-decoration:none;padding:0;transition-property:background-color,border-color;transition-duration:", ";transition-timing-function:", ";border-radius:", ";border-style:solid;border-width:1px;display:block;height:32px;width:64px;position:relative;overflow:hidden;", ";@media (pointer:coarse){&:before{content:'';position:absolute;left:0;right:0;transform:translateY(-50%);top:50%;min-height:44px;}}@media (prefers-reduced-motion){transition:none;*{transition:none;}}&:hover:not(:disabled):not([aria-disabled='true']),&:focus:focus-visible{background-color:", ";}&:active,&:active:focus-visible{background-color:", ";}", " ", ""], TRANSITION_DURATION, EASE_OUT_QUAD_CURVE, get('radii.2'), getGlobalFocusStyles('3px'), get('colors.switchTrack.hoverBg'), get('colors.switchTrack.activeBg'), props => {
105
104
  if (props['aria-disabled']) {
106
105
  return css(["@media (forced-colors:active){border-color:GrayText;}background-color:", ";border-color:transparent;cursor:not-allowed;transition-property:none;"], get('colors.switchTrack.disabledBg'));
107
106
  }
@@ -110,7 +109,7 @@ const SwitchButton = styled.button.withConfig({
110
109
  } else {
111
110
  return css(["background-color:", ";border-color:var(--controlTrack-borderColor-rest,transparent);&:active{background-color:", ";}"], get('colors.switchTrack.bg'), get('colors.switchTrack.activeBg'));
112
111
  }
113
- }, sx, sizeVariants);
112
+ }, sizeVariants);
114
113
  const ToggleKnob = styled.div.withConfig({
115
114
  displayName: "ToggleSwitch__ToggleKnob",
116
115
  componentId: "sc-e6gszy-1"
@@ -122,22 +121,18 @@ const ToggleKnob = styled.div.withConfig({
122
121
  return css(["border-color:", ";"], get('colors.switchKnob.checked.border'));
123
122
  }
124
123
  });
125
- const hiddenTextStyles = {
126
- visibility: 'hidden',
127
- height: 0
128
- };
129
124
  const ToggleSwitch = /*#__PURE__*/React.forwardRef(function ToggleSwitch(props, ref) {
130
- const $ = c(94);
125
+ const $ = c(89);
131
126
  let ariaDescribedby;
132
127
  let ariaLabelledby;
133
128
  let checked;
129
+ let className;
134
130
  let defaultChecked;
135
131
  let disabled;
136
132
  let loading;
137
133
  let onChange;
138
134
  let onClick;
139
135
  let rest;
140
- let sxProp;
141
136
  let t0;
142
137
  let t1;
143
138
  let t2;
@@ -158,20 +153,20 @@ const ToggleSwitch = /*#__PURE__*/React.forwardRef(function ToggleSwitch(props,
158
153
  statusLabelPosition: t2,
159
154
  loadingLabelDelay: t3,
160
155
  loadingLabel: t4,
161
- sx: sxProp,
156
+ className,
162
157
  ...rest
163
158
  } = props);
164
159
  $[0] = props;
165
160
  $[1] = ariaDescribedby;
166
161
  $[2] = ariaLabelledby;
167
162
  $[3] = checked;
168
- $[4] = defaultChecked;
169
- $[5] = disabled;
170
- $[6] = loading;
171
- $[7] = onChange;
172
- $[8] = onClick;
173
- $[9] = rest;
174
- $[10] = sxProp;
163
+ $[4] = className;
164
+ $[5] = defaultChecked;
165
+ $[6] = disabled;
166
+ $[7] = loading;
167
+ $[8] = onChange;
168
+ $[9] = onClick;
169
+ $[10] = rest;
175
170
  $[11] = t0;
176
171
  $[12] = t1;
177
172
  $[13] = t2;
@@ -181,13 +176,13 @@ const ToggleSwitch = /*#__PURE__*/React.forwardRef(function ToggleSwitch(props,
181
176
  ariaDescribedby = $[1];
182
177
  ariaLabelledby = $[2];
183
178
  checked = $[3];
184
- defaultChecked = $[4];
185
- disabled = $[5];
186
- loading = $[6];
187
- onChange = $[7];
188
- onClick = $[8];
189
- rest = $[9];
190
- sxProp = $[10];
179
+ className = $[4];
180
+ defaultChecked = $[5];
181
+ disabled = $[6];
182
+ loading = $[7];
183
+ onChange = $[8];
184
+ onClick = $[9];
185
+ rest = $[10];
191
186
  t0 = $[11];
192
187
  t1 = $[12];
193
188
  t2 = $[13];
@@ -279,10 +274,17 @@ const ToggleSwitch = /*#__PURE__*/React.forwardRef(function ToggleSwitch(props,
279
274
  if (ariaDescribedby) {
280
275
  switchButtonDescribedBy = `${switchButtonDescribedBy} ${ariaDescribedby}`;
281
276
  }
282
- const t10 = statusLabelPosition === "start" ? "row" : "row-reverse";
277
+ let t10;
278
+ if ($[35] !== className) {
279
+ t10 = clsx(classes.ToggleSwitch, className);
280
+ $[35] = className;
281
+ $[36] = t10;
282
+ } else {
283
+ t10 = $[36];
284
+ }
283
285
  const t11 = isLoadingLabelVisible && loadingLabel;
284
286
  let t12;
285
- if ($[35] !== loadingLabelId || $[36] !== t11) {
287
+ if ($[37] !== loadingLabelId || $[38] !== t11) {
286
288
  t12 = /*#__PURE__*/jsx(VisuallyHidden, {
287
289
  children: /*#__PURE__*/jsx(AriaStatus, {
288
290
  announceOnShow: true,
@@ -290,251 +292,199 @@ const ToggleSwitch = /*#__PURE__*/React.forwardRef(function ToggleSwitch(props,
290
292
  children: t11
291
293
  })
292
294
  });
293
- $[35] = loadingLabelId;
294
- $[36] = t11;
295
- $[37] = t12;
295
+ $[37] = loadingLabelId;
296
+ $[38] = t11;
297
+ $[39] = t12;
296
298
  } else {
297
- t12 = $[37];
299
+ t12 = $[39];
298
300
  }
299
301
  let t13;
300
- if ($[38] !== loading) {
302
+ if ($[40] !== loading) {
301
303
  t13 = loading ? /*#__PURE__*/jsx(StyledSpinner, {
302
304
  size: "small",
303
305
  srText: null
304
306
  }) : null;
305
- $[38] = loading;
306
- $[39] = t13;
307
- } else {
308
- t13 = $[39];
309
- }
310
- const t14 = acceptsInteraction ? "fg.default" : "fg.muted";
311
- const t15 = size === "small" ? 0 : 1;
312
- const t16 = acceptsInteraction ? "pointer" : "not-allowed";
313
- let t17;
314
- if ($[40] !== t16) {
315
- t17 = {
316
- position: "relative",
317
- cursor: t16
318
- };
319
- $[40] = t16;
320
- $[41] = t17;
307
+ $[40] = loading;
308
+ $[41] = t13;
321
309
  } else {
322
- t17 = $[41];
310
+ t13 = $[41];
323
311
  }
324
- const t18 = isOn ? null : hiddenTextStyles;
325
- let t19;
326
- if ($[42] !== t18) {
327
- t19 = /*#__PURE__*/jsx(Box, {
328
- textAlign: "right",
329
- sx: t18,
312
+ const t14 = !acceptsInteraction;
313
+ const t15 = !isOn;
314
+ let t16;
315
+ if ($[42] !== t15) {
316
+ t16 = /*#__PURE__*/jsx("div", {
317
+ className: classes.StatusTextItem,
318
+ "data-hidden": t15,
330
319
  children: "On"
331
320
  });
332
- $[42] = t18;
333
- $[43] = t19;
321
+ $[42] = t15;
322
+ $[43] = t16;
334
323
  } else {
335
- t19 = $[43];
324
+ t16 = $[43];
336
325
  }
337
- const t20 = isOn ? hiddenTextStyles : null;
338
- let t21;
339
- if ($[44] !== t20) {
340
- t21 = /*#__PURE__*/jsx(Box, {
341
- textAlign: "right",
342
- sx: t20,
326
+ let t17;
327
+ if ($[44] !== isOn) {
328
+ t17 = /*#__PURE__*/jsx("div", {
329
+ className: classes.StatusTextItem,
330
+ "data-hidden": isOn,
343
331
  children: "Off"
344
332
  });
345
- $[44] = t20;
346
- $[45] = t21;
333
+ $[44] = isOn;
334
+ $[45] = t17;
347
335
  } else {
348
- t21 = $[45];
336
+ t17 = $[45];
349
337
  }
350
- let t22;
351
- if ($[46] !== handleToggleClick || $[47] !== t14 || $[48] !== t15 || $[49] !== t17 || $[50] !== t19 || $[51] !== t21) {
352
- t22 = /*#__PURE__*/jsxs(Text, {
353
- color: t14,
354
- fontSize: t15,
355
- mx: 2,
338
+ let t18;
339
+ if ($[46] !== handleToggleClick || $[47] !== size || $[48] !== t14 || $[49] !== t16 || $[50] !== t17) {
340
+ t18 = /*#__PURE__*/jsxs("span", {
341
+ className: classes.StatusText,
342
+ "data-size": size,
343
+ "data-disabled": t14,
356
344
  "aria-hidden": "true",
357
- sx: t17,
358
345
  onClick: handleToggleClick,
359
- children: [t19, t21]
346
+ children: [t16, t17]
360
347
  });
361
348
  $[46] = handleToggleClick;
362
- $[47] = t14;
363
- $[48] = t15;
364
- $[49] = t17;
365
- $[50] = t19;
366
- $[51] = t21;
367
- $[52] = t22;
368
- } else {
369
- t22 = $[52];
370
- }
371
- const t23 = isLoadingLabelVisible || ariaDescribedby ? switchButtonDescribedBy : undefined;
372
- const t24 = !acceptsInteraction;
373
- const t25 = acceptsInteraction ? "switchTrack.checked.fg" : "switchTrack.checked.disabledFg";
374
- const t26 = `translateX(${isOn ? "0" : "-100%"})`;
375
- let t27;
376
- if ($[53] !== t26) {
377
- t27 = {
378
- transform: t26,
379
- transitionProperty: "transform",
380
- transitionDuration: TRANSITION_DURATION
381
- };
382
- $[53] = t26;
383
- $[54] = t27;
349
+ $[47] = size;
350
+ $[48] = t14;
351
+ $[49] = t16;
352
+ $[50] = t17;
353
+ $[51] = t18;
384
354
  } else {
385
- t27 = $[54];
355
+ t18 = $[51];
386
356
  }
387
- let t28;
388
- if ($[55] !== size) {
389
- t28 = /*#__PURE__*/jsx(LineIcon, {
357
+ const t19 = isLoadingLabelVisible || ariaDescribedby ? switchButtonDescribedBy : undefined;
358
+ const t20 = !acceptsInteraction;
359
+ const t21 = !acceptsInteraction;
360
+ let t22;
361
+ if ($[52] !== size) {
362
+ t22 = /*#__PURE__*/jsx(LineIcon, {
390
363
  size: size
391
364
  });
392
- $[55] = size;
393
- $[56] = t28;
365
+ $[52] = size;
366
+ $[53] = t22;
394
367
  } else {
395
- t28 = $[56];
368
+ t22 = $[53];
396
369
  }
397
- let t29;
398
- if ($[57] !== t25 || $[58] !== t27 || $[59] !== t28) {
399
- t29 = /*#__PURE__*/jsx(Box, {
400
- flexGrow: 1,
401
- flexShrink: 0,
402
- flexBasis: "50%",
403
- color: t25,
404
- lineHeight: "0",
405
- sx: t27,
406
- children: t28
370
+ let t23;
371
+ if ($[54] !== isOn || $[55] !== t21 || $[56] !== t22) {
372
+ t23 = /*#__PURE__*/jsx("div", {
373
+ className: classes.IconBox,
374
+ "data-type": "on",
375
+ "data-checked": isOn,
376
+ "data-disabled": t21,
377
+ children: t22
407
378
  });
408
- $[57] = t25;
409
- $[58] = t27;
410
- $[59] = t28;
411
- $[60] = t29;
412
- } else {
413
- t29 = $[60];
414
- }
415
- const t30 = acceptsInteraction ? "switchTrack.fg" : "switchTrack.disabledFg";
416
- const t31 = `translateX(${isOn ? "100%" : "0"})`;
417
- let t32;
418
- if ($[61] !== t31) {
419
- t32 = {
420
- transform: t31,
421
- transitionProperty: "transform",
422
- transitionDuration: TRANSITION_DURATION
423
- };
424
- $[61] = t31;
425
- $[62] = t32;
379
+ $[54] = isOn;
380
+ $[55] = t21;
381
+ $[56] = t22;
382
+ $[57] = t23;
426
383
  } else {
427
- t32 = $[62];
384
+ t23 = $[57];
428
385
  }
429
- let t33;
430
- if ($[63] !== size) {
431
- t33 = /*#__PURE__*/jsx(CircleIcon, {
386
+ const t24 = !acceptsInteraction;
387
+ let t25;
388
+ if ($[58] !== size) {
389
+ t25 = /*#__PURE__*/jsx(CircleIcon, {
432
390
  size: size
433
391
  });
434
- $[63] = size;
435
- $[64] = t33;
392
+ $[58] = size;
393
+ $[59] = t25;
436
394
  } else {
437
- t33 = $[64];
395
+ t25 = $[59];
438
396
  }
439
- let t34;
440
- if ($[65] !== t30 || $[66] !== t32 || $[67] !== t33) {
441
- t34 = /*#__PURE__*/jsx(Box, {
442
- flexGrow: 1,
443
- flexShrink: 0,
444
- flexBasis: "50%",
445
- color: t30,
446
- lineHeight: "0",
447
- sx: t32,
448
- children: t33
397
+ let t26;
398
+ if ($[60] !== isOn || $[61] !== t24 || $[62] !== t25) {
399
+ t26 = /*#__PURE__*/jsx("div", {
400
+ className: classes.IconBox,
401
+ "data-type": "off",
402
+ "data-checked": isOn,
403
+ "data-disabled": t24,
404
+ children: t25
449
405
  });
450
- $[65] = t30;
451
- $[66] = t32;
452
- $[67] = t33;
453
- $[68] = t34;
406
+ $[60] = isOn;
407
+ $[61] = t24;
408
+ $[62] = t25;
409
+ $[63] = t26;
454
410
  } else {
455
- t34 = $[68];
411
+ t26 = $[63];
456
412
  }
457
- let t35;
458
- if ($[69] !== t29 || $[70] !== t34) {
459
- t35 = /*#__PURE__*/jsxs(Box, {
413
+ let t27;
414
+ if ($[64] !== t23 || $[65] !== t26) {
415
+ t27 = /*#__PURE__*/jsxs("div", {
460
416
  "aria-hidden": "true",
461
- display: "flex",
462
- alignItems: "center",
463
- width: "100%",
464
- height: "100%",
465
- overflow: "hidden",
466
- children: [t29, t34]
417
+ className: classes.IconContainer,
418
+ children: [t23, t26]
467
419
  });
468
- $[69] = t29;
469
- $[70] = t34;
470
- $[71] = t35;
420
+ $[64] = t23;
421
+ $[65] = t26;
422
+ $[66] = t27;
471
423
  } else {
472
- t35 = $[71];
424
+ t27 = $[66];
473
425
  }
474
- const t36 = !acceptsInteraction;
475
- let t37;
476
- if ($[72] !== isOn || $[73] !== t36) {
477
- t37 = /*#__PURE__*/jsx(ToggleKnob, {
426
+ const t28 = !acceptsInteraction;
427
+ let t29;
428
+ if ($[67] !== isOn || $[68] !== t28) {
429
+ t29 = /*#__PURE__*/jsx(ToggleKnob, {
478
430
  "aria-hidden": "true",
479
- "aria-disabled": t36,
431
+ "aria-disabled": t28,
480
432
  checked: isOn
481
433
  });
482
- $[72] = isOn;
483
- $[73] = t36;
484
- $[74] = t37;
434
+ $[67] = isOn;
435
+ $[68] = t28;
436
+ $[69] = t29;
485
437
  } else {
486
- t37 = $[74];
438
+ t29 = $[69];
487
439
  }
488
- let t38;
489
- if ($[75] !== ariaLabelledby || $[76] !== buttonType || $[77] !== handleToggleClick || $[78] !== isOn || $[79] !== ref || $[80] !== size || $[81] !== t23 || $[82] !== t24 || $[83] !== t35 || $[84] !== t37) {
490
- t38 = /*#__PURE__*/jsxs(SwitchButton, {
440
+ let t30;
441
+ if ($[70] !== ariaLabelledby || $[71] !== buttonType || $[72] !== handleToggleClick || $[73] !== isOn || $[74] !== ref || $[75] !== size || $[76] !== t19 || $[77] !== t20 || $[78] !== t27 || $[79] !== t29) {
442
+ t30 = /*#__PURE__*/jsxs(SwitchButton, {
491
443
  ref: ref,
492
444
  type: buttonType,
493
445
  onClick: handleToggleClick,
494
446
  "aria-labelledby": ariaLabelledby,
495
- "aria-describedby": t23,
447
+ "aria-describedby": t19,
496
448
  "aria-pressed": isOn,
497
449
  checked: isOn,
498
450
  size: size,
499
- "aria-disabled": t24,
500
- children: [t35, t37]
451
+ "aria-disabled": t20,
452
+ children: [t27, t29]
501
453
  });
502
- $[75] = ariaLabelledby;
503
- $[76] = buttonType;
504
- $[77] = handleToggleClick;
505
- $[78] = isOn;
506
- $[79] = ref;
507
- $[80] = size;
508
- $[81] = t23;
509
- $[82] = t24;
510
- $[83] = t35;
511
- $[84] = t37;
512
- $[85] = t38;
454
+ $[70] = ariaLabelledby;
455
+ $[71] = buttonType;
456
+ $[72] = handleToggleClick;
457
+ $[73] = isOn;
458
+ $[74] = ref;
459
+ $[75] = size;
460
+ $[76] = t19;
461
+ $[77] = t20;
462
+ $[78] = t27;
463
+ $[79] = t29;
464
+ $[80] = t30;
513
465
  } else {
514
- t38 = $[85];
466
+ t30 = $[80];
515
467
  }
516
- let t39;
517
- if ($[86] !== rest || $[87] !== sxProp || $[88] !== t10 || $[89] !== t12 || $[90] !== t13 || $[91] !== t22 || $[92] !== t38) {
518
- t39 = /*#__PURE__*/jsxs(Box, {
519
- display: "inline-flex",
520
- alignItems: "center",
521
- flexDirection: t10,
522
- sx: sxProp,
468
+ let t31;
469
+ if ($[81] !== rest || $[82] !== statusLabelPosition || $[83] !== t10 || $[84] !== t12 || $[85] !== t13 || $[86] !== t18 || $[87] !== t30) {
470
+ t31 = /*#__PURE__*/jsxs("div", {
471
+ className: t10,
472
+ "data-status-label-position": statusLabelPosition,
523
473
  ...rest,
524
- children: [t12, t13, t22, t38]
474
+ children: [t12, t13, t18, t30]
525
475
  });
526
- $[86] = rest;
527
- $[87] = sxProp;
528
- $[88] = t10;
529
- $[89] = t12;
530
- $[90] = t13;
531
- $[91] = t22;
532
- $[92] = t38;
533
- $[93] = t39;
476
+ $[81] = rest;
477
+ $[82] = statusLabelPosition;
478
+ $[83] = t10;
479
+ $[84] = t12;
480
+ $[85] = t13;
481
+ $[86] = t18;
482
+ $[87] = t30;
483
+ $[88] = t31;
534
484
  } else {
535
- t39 = $[93];
485
+ t31 = $[88];
536
486
  }
537
- return t39;
487
+ return t31;
538
488
  });
539
489
  if (process.env.NODE_ENV !== "production") {
540
490
  ToggleSwitch.displayName = 'ToggleSwitch';
@@ -0,0 +1,5 @@
1
+ import './ToggleSwitch-65936b4b.css';
2
+
3
+ var classes = {"ToggleSwitch":"prc-ToggleSwitch-ToggleSwitch-E4lp0","StatusText":"prc-ToggleSwitch-StatusText-hWpj2","StatusTextItem":"prc-ToggleSwitch-StatusTextItem-fvvXa","IconContainer":"prc-ToggleSwitch-IconContainer-zLC02","IconBox":"prc-ToggleSwitch-IconBox-NNOYG"};
4
+
5
+ export { classes as default };
@@ -3,5 +3,4 @@ export { default } from './Token';
3
3
  export type { TokenProps } from './Token';
4
4
  export { default as IssueLabelToken } from './IssueLabelToken';
5
5
  export type { IssueLabelTokenProps } from './IssueLabelToken';
6
- export { default as AvatarToken } from './AvatarToken';
7
6
  //# sourceMappingURL=index.d.ts.map
@@ -2,12 +2,12 @@
2
2
  * Returns the accessible name of an element
3
3
  */
4
4
  function getAccessibleName(element) {
5
- var _document$getElementB, _document$getElementB2, _element$textContent;
5
+ var _document$getElementB, _document$getElementB2;
6
6
  const label = element.getAttribute('aria-label');
7
7
  const labelledby = element.getAttribute('aria-labelledby');
8
8
  if (label) return label;
9
9
  if (labelledby) return (_document$getElementB = (_document$getElementB2 = document.getElementById(labelledby)) === null || _document$getElementB2 === void 0 ? void 0 : _document$getElementB2.textContent) !== null && _document$getElementB !== void 0 ? _document$getElementB : '';
10
- return (_element$textContent = element.textContent) !== null && _element$textContent !== void 0 ? _element$textContent : '';
10
+ return element.textContent;
11
11
  }
12
12
 
13
13
  export { getAccessibleName };
@@ -1,4 +1,3 @@
1
- import type { SxProp } from '../sx';
2
1
  import type React from 'react';
3
2
  import { type HTMLAttributes } from 'react';
4
3
  /**
@@ -14,5 +13,5 @@ import { type HTMLAttributes } from 'react';
14
13
  export declare const VisuallyHidden: ({ className, children, ...rest }: VisuallyHiddenProps) => React.JSX.Element;
15
14
  export type VisuallyHiddenProps = React.PropsWithChildren<HTMLAttributes<HTMLSpanElement> & {
16
15
  className?: string;
17
- } & SxProp>;
16
+ }>;
18
17
  //# sourceMappingURL=VisuallyHidden.d.ts.map
@@ -1,7 +1,6 @@
1
1
  import { c } from 'react-compiler-runtime';
2
2
  import { clsx } from 'clsx';
3
3
  import classes from './VisuallyHidden.module.css.js';
4
- import { BoxWithFallback } from '../internal/components/BoxWithFallback.js';
5
4
  import { jsx } from 'react/jsx-runtime';
6
5
 
7
6
  const VisuallyHidden = t0 => {
@@ -34,8 +33,7 @@ const VisuallyHidden = t0 => {
34
33
  }
35
34
  let t2;
36
35
  if ($[6] !== children || $[7] !== rest || $[8] !== t1) {
37
- t2 = /*#__PURE__*/jsx(BoxWithFallback, {
38
- as: "span",
36
+ t2 = /*#__PURE__*/jsx("span", {
39
37
  className: t1,
40
38
  ...rest,
41
39
  children: children
@@ -1,8 +1,7 @@
1
1
  import type { To } from 'history';
2
2
  import type React from 'react';
3
- import type { SxProp } from '../../sx';
4
3
  import type { ComponentProps } from '../../utils/types';
5
- declare const UnderlineNavBase: import("styled-components").StyledComponent<"nav", any, SxProp, never>;
4
+ declare const UnderlineNavBase: import("styled-components").StyledComponent<"nav", any, {}, never>;
6
5
  export type UnderlineNavProps = {
7
6
  actions?: React.ReactNode;
8
7
  align?: 'right';
@@ -13,7 +12,7 @@ declare function UnderlineNav({ actions, className, align, children, full, label
13
12
  type StyledUnderlineNavLinkProps = {
14
13
  to?: To;
15
14
  selected?: boolean;
16
- } & SxProp;
15
+ };
17
16
  declare const UnderlineNavLink: import("styled-components").StyledComponent<"a", any, StyledUnderlineNavLinkProps, never>;
18
17
  export type UnderlineNavLinkProps = ComponentProps<typeof UnderlineNavLink>;
19
18
  /**
@@ -2,7 +2,6 @@ import { c } from 'react-compiler-runtime';
2
2
  import { clsx } from 'clsx';
3
3
  import styled from 'styled-components';
4
4
  import { get } from '../../constants.js';
5
- import sx from '../../sx.js';
6
5
  import getGlobalFocusStyles from '../../internal/utils/getGlobalFocusStyles.js';
7
6
  import { jsxs, jsx } from 'react/jsx-runtime';
8
7
 
@@ -11,7 +10,7 @@ const SELECTED_CLASS = 'PRC-selected';
11
10
  const UnderlineNavBase = styled.nav.withConfig({
12
11
  displayName: "UnderlineNav__UnderlineNavBase",
13
12
  componentId: "sc-11ejk33-0"
14
- })(["display:flex;justify-content:space-between;border-bottom:1px solid ", ";&.PRC-UnderlineNav--right{justify-content:flex-end;.PRC-UnderlineNav-item{margin-right:0;margin-left:", ";}.PRC-UnderlineNav-actions{flex:1 1 auto;}}&.PRC-UnderlineNav--full{display:block;}.PRC-UnderlineNav-body{display:flex;margin-bottom:-1px;}.PRC-UnderlineNav-actions{align-self:center;}", ";"], get('colors.border.muted'), get('space.3'), sx);
13
+ })(["display:flex;justify-content:space-between;border-bottom:1px solid ", ";&.PRC-UnderlineNav--right{justify-content:flex-end;.PRC-UnderlineNav-item{margin-right:0;margin-left:", ";}.PRC-UnderlineNav-actions{flex:1 1 auto;}}&.PRC-UnderlineNav--full{display:block;}.PRC-UnderlineNav-body{display:flex;margin-bottom:-1px;}.PRC-UnderlineNav-actions{align-self:center;}"], get('colors.border.muted'), get('space.3'));
15
14
  function UnderlineNav(t0) {
16
15
  const $ = c(24);
17
16
  let actions;
@@ -113,7 +112,7 @@ const UnderlineNavLink = styled.a.attrs(props => ({
113
112
  })).withConfig({
114
113
  displayName: "UnderlineNav__UnderlineNavLink",
115
114
  componentId: "sc-11ejk33-1"
116
- })(["padding:", " ", ";margin-right:", ";font-size:", ";line-height:", ";color:", ";text-align:center;border-bottom:2px solid transparent;text-decoration:none;&:hover,&:focus{color:", ";text-decoration:none;border-bottom-color:", ";transition:border-bottom-color 0.2s ease;.PRC-UnderlineNav-octicon{color:", ";}}&.PRC-selected{color:", ";border-bottom-color:", ";.PRC-UnderlineNav-octicon{color:", ";}}", ";", ";"], get('space.3'), get('space.2'), get('space.3'), get('fontSizes.1'), get('lineHeights.default'), get('colors.fg.default'), get('colors.fg.default'), get('colors.neutral.muted'), get('colors.fg.muted'), get('colors.fg.default'), get('colors.primer.border.active'), get('colors.fg.default'), getGlobalFocusStyles('-8px'), sx);
115
+ })(["padding:", " ", ";margin-right:", ";font-size:", ";line-height:", ";color:", ";text-align:center;border-bottom:2px solid transparent;text-decoration:none;&:hover,&:focus{color:", ";text-decoration:none;border-bottom-color:", ";transition:border-bottom-color 0.2s ease;.PRC-UnderlineNav-octicon{color:", ";}}&.PRC-selected{color:", ";border-bottom-color:", ";.PRC-UnderlineNav-octicon{color:", ";}}", ";"], get('space.3'), get('space.2'), get('space.3'), get('fontSizes.1'), get('lineHeights.default'), get('colors.fg.default'), get('colors.fg.default'), get('colors.neutral.muted'), get('colors.fg.muted'), get('colors.fg.default'), get('colors.primer.border.active'), get('colors.fg.default'), getGlobalFocusStyles('-8px'));
117
116
  UnderlineNavLink.displayName = 'UnderlineNav.Link';
118
117
  /**
119
118
  * @deprecated UnderlineNav is deprecated and will be replaced by the draft `UnderlineNav` in the next major release. See https://primer.style/react/drafts/UnderlineNav2 for more details.
@@ -23,6 +23,4 @@ export { default as TabNav } from '../TabNav';
23
23
  export type { TabNavProps, TabNavLinkProps } from '../TabNav';
24
24
  export { default as Tooltip } from '../Tooltip/Tooltip';
25
25
  export type { TooltipProps } from '../Tooltip/Tooltip';
26
- export { default as AvatarPair } from './AvatarPair';
27
- export type { AvatarPairProps } from './AvatarPair';
28
26
  //# sourceMappingURL=index.d.ts.map