@primer/styled-react 1.0.0-rc.3 → 1.0.0-rc.5
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 +18 -0
- package/dist/PageHeader-DCDIR2C1.js +144 -0
- package/dist/Tooltip-YuSlJ5b_.js +20 -0
- package/dist/components/ActionMenu.d.ts +12 -0
- package/dist/components/ActionMenu.d.ts.map +1 -0
- package/dist/components/Autocomplete.d.ts +15 -0
- package/dist/components/Autocomplete.d.ts.map +1 -0
- package/dist/components/Avatar.d.ts +13 -0
- package/dist/components/Avatar.d.ts.map +1 -0
- package/dist/components/Box.d.ts +2 -0
- package/dist/components/Box.d.ts.map +1 -0
- package/dist/components/Breadcrumbs.d.ts +18 -0
- package/dist/components/Breadcrumbs.d.ts.map +1 -0
- package/dist/components/Checkbox.d.ts +5 -0
- package/dist/components/Checkbox.d.ts.map +1 -0
- package/dist/components/CheckboxGroup.d.ts +22 -0
- package/dist/components/CheckboxGroup.d.ts.map +1 -0
- package/dist/components/CircleBadge.d.ts +7 -0
- package/dist/components/CircleBadge.d.ts.map +1 -0
- package/dist/components/CounterLabel.d.ts +10 -0
- package/dist/components/CounterLabel.d.ts.map +1 -0
- package/dist/components/Dialog.d.ts +19 -0
- package/dist/components/Dialog.d.ts.map +1 -0
- package/dist/components/DialogV1.d.ts +11 -0
- package/dist/components/DialogV1.d.ts.map +1 -0
- package/dist/components/Flash.d.ts +8 -0
- package/dist/components/Flash.d.ts.map +1 -0
- package/dist/components/Header.d.ts +11 -0
- package/dist/components/Header.d.ts.map +1 -0
- package/dist/components/Heading.d.ts +8 -0
- package/dist/components/Heading.d.ts.map +1 -0
- package/dist/components/Label.d.ts +9 -0
- package/dist/components/Label.d.ts.map +1 -0
- package/dist/components/Link.d.ts +7 -0
- package/dist/components/Link.d.ts.map +1 -0
- package/dist/components/LinkButton.d.ts +7 -0
- package/dist/components/LinkButton.d.ts.map +1 -0
- package/dist/components/NavList.d.ts +25 -0
- package/dist/components/NavList.d.ts.map +1 -0
- package/dist/components/Overlay.d.ts +7 -0
- package/dist/components/Overlay.d.ts.map +1 -0
- package/dist/components/PageHeader.d.ts +31 -0
- package/dist/components/PageHeader.d.ts.map +1 -0
- package/dist/components/RadioGroup.d.ts +22 -0
- package/dist/components/RadioGroup.d.ts.map +1 -0
- package/dist/components/RelativeTime.d.ts +6 -0
- package/dist/components/RelativeTime.d.ts.map +1 -0
- package/dist/components/SegmentedControl.d.ts +12 -0
- package/dist/components/SegmentedControl.d.ts.map +1 -0
- package/dist/components/Spinner.d.ts +6 -0
- package/dist/components/Spinner.d.ts.map +1 -0
- package/dist/components/StateLabel.d.ts +9 -0
- package/dist/components/StateLabel.d.ts.map +1 -0
- package/dist/components/SubNav.d.ts +9 -0
- package/dist/components/SubNav.d.ts.map +1 -0
- package/dist/components/TabNav.d.ts +9 -0
- package/dist/components/TabNav.d.ts.map +1 -0
- package/dist/components/Text.d.ts +7 -0
- package/dist/components/Text.d.ts.map +1 -0
- package/dist/components/Timeline.d.ts +26 -0
- package/dist/components/Timeline.d.ts.map +1 -0
- package/dist/components/ToggleSwitch.d.ts +6 -0
- package/dist/components/ToggleSwitch.d.ts.map +1 -0
- package/dist/components/Token.d.ts +7 -0
- package/dist/components/Token.d.ts.map +1 -0
- package/dist/components/Tooltip.d.ts +10 -0
- package/dist/components/Tooltip.d.ts.map +1 -0
- package/dist/components/Truncate.d.ts +7 -0
- package/dist/components/Truncate.d.ts.map +1 -0
- package/dist/components/UnderlineNav.d.ts +11 -0
- package/dist/components/UnderlineNav.d.ts.map +1 -0
- package/dist/components/UnderlinePanels.d.ts +12 -0
- package/dist/components/UnderlinePanels.d.ts.map +1 -0
- package/dist/components.json +109 -0
- package/dist/deprecated.d.ts +4 -1
- package/dist/deprecated.d.ts.map +1 -1
- package/dist/deprecated.js +84 -1
- package/dist/experimental.d.ts +5 -1
- package/dist/experimental.d.ts.map +1 -1
- package/dist/experimental.js +32 -1
- package/dist/index.d.ts +51 -24
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +493 -31
- package/dist/polymorphic.d.ts +38 -0
- package/dist/polymorphic.d.ts.map +1 -0
- package/dist/styled-props.d.ts +5 -0
- package/dist/styled-props.d.ts.map +1 -0
- package/dist/sx.d.ts +2 -0
- package/dist/sx.d.ts.map +1 -0
- package/package.json +6 -4
package/dist/index.js
CHANGED
|
@@ -1,62 +1,524 @@
|
|
|
1
|
-
import { Box, SegmentedControl as SegmentedControl$1,
|
|
2
|
-
export { ActionList,
|
|
1
|
+
import { ActionMenu as ActionMenu$1, sx, 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, 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
|
+
export { ActionList, Box, Button, Details, FormControl, IconButton, PageLayout, ProgressBar, Select, TextInput, Textarea, ThemeProvider, merge, sx, theme, themeGet, useColorSchemeVar, useTheme } from '@primer/react';
|
|
3
|
+
import styled from 'styled-components';
|
|
3
4
|
import React, { forwardRef } from 'react';
|
|
5
|
+
import { jsx } from 'react/jsx-runtime';
|
|
6
|
+
export { D as Dialog, P as PageHeader } from './PageHeader-DCDIR2C1.js';
|
|
7
|
+
export { T as Tooltip } from './Tooltip-YuSlJ5b_.js';
|
|
8
|
+
import css from '@styled-system/css';
|
|
9
|
+
import '@primer/react/deprecated';
|
|
4
10
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
const ActionMenuOverlay = styled(ActionMenu$1.Overlay).withConfig({
|
|
12
|
+
shouldForwardProp: prop => prop !== 'sx'
|
|
13
|
+
}).withConfig({
|
|
14
|
+
displayName: "ActionMenu__ActionMenuOverlay",
|
|
15
|
+
componentId: "sc-w5s60e-0"
|
|
16
|
+
})(["", ""], sx);
|
|
17
|
+
const ActionMenu = Object.assign(ActionMenu$1, {
|
|
18
|
+
Button: ActionMenu$1.Button,
|
|
19
|
+
Anchor: ActionMenu$1.Anchor,
|
|
20
|
+
Overlay: ActionMenuOverlay,
|
|
21
|
+
Divider: ActionMenu$1.Divider
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const AutocompleteOverlay = styled(Autocomplete$1.Overlay).withConfig({
|
|
25
|
+
shouldForwardProp: prop => prop !== 'sx'
|
|
26
|
+
}).withConfig({
|
|
27
|
+
displayName: "Autocomplete__AutocompleteOverlay",
|
|
28
|
+
componentId: "sc-j8ax2e-0"
|
|
29
|
+
})(["", ""], sx);
|
|
30
|
+
const Autocomplete = Object.assign(Autocomplete$1, {
|
|
31
|
+
Context: Autocomplete$1.Context,
|
|
32
|
+
Input: Autocomplete$1.Input,
|
|
33
|
+
Menu: Autocomplete$1.Menu,
|
|
34
|
+
Overlay: AutocompleteOverlay
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const Avatar = /*#__PURE__*/forwardRef(function Avatar(props, ref) {
|
|
38
|
+
return /*#__PURE__*/jsx(Box, {
|
|
39
|
+
as: Avatar$1,
|
|
40
|
+
ref: ref,
|
|
41
|
+
...props
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const BreadcrumbsImpl = styled(Breadcrumbs$1).withConfig({
|
|
46
|
+
shouldForwardProp: prop => prop !== 'sx'
|
|
47
|
+
}).withConfig({
|
|
48
|
+
displayName: "Breadcrumbs__BreadcrumbsImpl",
|
|
49
|
+
componentId: "sc-1qj8pw-0"
|
|
50
|
+
})(["", ""], sx);
|
|
51
|
+
const StyledBreadcrumbsItem = styled(Breadcrumbs$1.Item).withConfig({
|
|
52
|
+
shouldForwardProp: prop => prop !== 'sx'
|
|
53
|
+
}).withConfig({
|
|
54
|
+
displayName: "Breadcrumbs__StyledBreadcrumbsItem",
|
|
55
|
+
componentId: "sc-1qj8pw-1"
|
|
56
|
+
})(["", ""], sx);
|
|
57
|
+
function BreadcrumbsItem({
|
|
58
|
+
as,
|
|
59
|
+
...props
|
|
60
|
+
}) {
|
|
61
|
+
return /*#__PURE__*/jsx(StyledBreadcrumbsItem, {
|
|
62
|
+
...props,
|
|
63
|
+
...(as ? {
|
|
64
|
+
forwardedAs: as
|
|
65
|
+
} : {})
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
const Breadcrumbs = Object.assign(BreadcrumbsImpl, {
|
|
69
|
+
Item: BreadcrumbsItem
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* @deprecated Use the `Breadcrumbs` component instead (i.e. `<Breadcrumb>` → `<Breadcrumbs>`)
|
|
74
|
+
*/
|
|
75
|
+
const Breadcrumb = Breadcrumbs;
|
|
76
|
+
|
|
77
|
+
const Checkbox = /*#__PURE__*/forwardRef(function Checkbox(props, ref) {
|
|
78
|
+
return /*#__PURE__*/jsx(Box, {
|
|
79
|
+
as: Checkbox$1,
|
|
80
|
+
ref: ref,
|
|
81
|
+
...props
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
const CheckboxGroupImpl = props => {
|
|
86
|
+
return /*#__PURE__*/jsx(Box, {
|
|
87
|
+
as: CheckboxGroup$1,
|
|
88
|
+
...props
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
// Define local types based on the internal component props
|
|
93
|
+
|
|
94
|
+
const CheckboxOrRadioGroupLabel$1 = props => {
|
|
95
|
+
return /*#__PURE__*/jsx(Box, {
|
|
96
|
+
as: CheckboxGroup$1.Label,
|
|
97
|
+
...props
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
const CheckboxOrRadioGroupCaption$1 = props => {
|
|
101
|
+
return /*#__PURE__*/jsx(Box, {
|
|
102
|
+
as: CheckboxGroup$1.Caption,
|
|
103
|
+
...props
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
const CheckboxOrRadioGroupValidation$1 = props => {
|
|
107
|
+
return /*#__PURE__*/jsx(Box, {
|
|
108
|
+
as: CheckboxGroup$1.Validation,
|
|
109
|
+
...props
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
const CheckboxGroup = Object.assign(CheckboxGroupImpl, {
|
|
113
|
+
Label: CheckboxOrRadioGroupLabel$1,
|
|
114
|
+
Caption: CheckboxOrRadioGroupCaption$1,
|
|
115
|
+
Validation: CheckboxOrRadioGroupValidation$1
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
const CircleBadge = styled(CircleBadge$1).withConfig({
|
|
119
|
+
shouldForwardProp: prop => prop !== 'sx'
|
|
120
|
+
}).withConfig({
|
|
121
|
+
displayName: "CircleBadge",
|
|
122
|
+
componentId: "sc-1u7lp3v-0"
|
|
123
|
+
})(["", ""], sx);
|
|
124
|
+
|
|
125
|
+
const CounterLabel = /*#__PURE__*/forwardRef(function CounterLabel(props, ref) {
|
|
126
|
+
return /*#__PURE__*/jsx(Box, {
|
|
127
|
+
as: CounterLabel$1,
|
|
128
|
+
ref: ref,
|
|
129
|
+
...props
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
const Flash = styled(Flash$1).withConfig({
|
|
134
|
+
shouldForwardProp: prop => prop !== 'sx'
|
|
135
|
+
}).withConfig({
|
|
136
|
+
displayName: "Flash",
|
|
137
|
+
componentId: "sc-413izo-0"
|
|
138
|
+
})(["", ""], sx);
|
|
139
|
+
|
|
140
|
+
const StyledHeader = /*#__PURE__*/forwardRef(function Header(props, ref) {
|
|
141
|
+
return /*#__PURE__*/jsx(Box, {
|
|
142
|
+
as: Header$1,
|
|
143
|
+
ref: ref,
|
|
144
|
+
...props
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
const HeaderImpl = /*#__PURE__*/forwardRef(({
|
|
148
|
+
as,
|
|
149
|
+
...props
|
|
150
|
+
}, ref) => /*#__PURE__*/jsx(StyledHeader, {
|
|
151
|
+
...props,
|
|
152
|
+
...(as ? {
|
|
153
|
+
forwardedAs: as
|
|
154
|
+
} : {}),
|
|
155
|
+
ref: ref
|
|
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 StyledHeaderLink = /*#__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 HeaderLink = /*#__PURE__*/forwardRef(({
|
|
172
|
+
as,
|
|
173
|
+
...props
|
|
174
|
+
}, ref) => /*#__PURE__*/jsx(StyledHeaderLink, {
|
|
175
|
+
...props,
|
|
176
|
+
...(as ? {
|
|
177
|
+
forwardedAs: as
|
|
178
|
+
} : {}),
|
|
179
|
+
ref: ref
|
|
180
|
+
}));
|
|
181
|
+
const Header = Object.assign(HeaderImpl, {
|
|
182
|
+
Item: HeaderItem,
|
|
183
|
+
Link: HeaderLink
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
const Heading = styled(Heading$1).withConfig({
|
|
187
|
+
shouldForwardProp: prop => prop !== 'sx'
|
|
188
|
+
}).withConfig({
|
|
189
|
+
displayName: "Heading",
|
|
190
|
+
componentId: "sc-1vc165i-0"
|
|
191
|
+
})(["", ""], sx);
|
|
192
|
+
|
|
193
|
+
const StyledLabel = /*#__PURE__*/forwardRef(function Label(props, ref) {
|
|
194
|
+
return /*#__PURE__*/jsx(Box, {
|
|
195
|
+
as: Label$1,
|
|
196
|
+
ref: ref,
|
|
197
|
+
...props
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
const Label = /*#__PURE__*/forwardRef(({
|
|
201
|
+
as,
|
|
202
|
+
...props
|
|
203
|
+
}, ref) => {
|
|
204
|
+
return /*#__PURE__*/jsx(StyledLabel, {
|
|
205
|
+
...props,
|
|
206
|
+
...(as ? {
|
|
207
|
+
forwardedAs: as
|
|
208
|
+
} : {}),
|
|
209
|
+
ref: ref
|
|
210
|
+
});
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
const StyledLink = styled(Link$1).withConfig({
|
|
214
|
+
shouldForwardProp: prop => prop !== 'sx'
|
|
215
|
+
}).withConfig({
|
|
216
|
+
displayName: "Link__StyledLink",
|
|
217
|
+
componentId: "sc-1syctfj-0"
|
|
218
|
+
})(["", ""], sx);
|
|
219
|
+
const Link = /*#__PURE__*/forwardRef(({
|
|
220
|
+
as,
|
|
221
|
+
...props
|
|
222
|
+
}, ref) => {
|
|
223
|
+
return /*#__PURE__*/jsx(StyledLink, {
|
|
224
|
+
...props,
|
|
225
|
+
...(as ? {
|
|
226
|
+
forwardedAs: as
|
|
227
|
+
} : {}),
|
|
228
|
+
ref: ref
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
const LinkButton = styled(LinkButton$1).withConfig({
|
|
233
|
+
shouldForwardProp: prop => prop !== 'sx'
|
|
234
|
+
}).withConfig({
|
|
235
|
+
displayName: "LinkButton",
|
|
236
|
+
componentId: "sc-1v6zkmg-0"
|
|
237
|
+
})(["", ""], sx);
|
|
238
|
+
|
|
239
|
+
const NavListImpl = /*#__PURE__*/forwardRef(function NavList(props, ref) {
|
|
240
|
+
return /*#__PURE__*/jsx(Box, {
|
|
241
|
+
as: NavList$1,
|
|
242
|
+
ref: ref,
|
|
243
|
+
...props
|
|
244
|
+
});
|
|
245
|
+
});
|
|
246
|
+
const NavListItem = /*#__PURE__*/forwardRef(function NavListItem(props, ref) {
|
|
247
|
+
// @ts-expect-error - PrimerNavList.Item is not recognized as a valid component type
|
|
248
|
+
return /*#__PURE__*/jsx(Box, {
|
|
249
|
+
as: NavList$1.Item,
|
|
250
|
+
ref: ref,
|
|
251
|
+
...props
|
|
252
|
+
});
|
|
253
|
+
});
|
|
254
|
+
const NavListGroup = /*#__PURE__*/forwardRef(function NavListGroup(props, ref) {
|
|
255
|
+
// @ts-expect-error - PrimerNavList.Group is not recognized as a valid component type
|
|
256
|
+
return /*#__PURE__*/jsx(Box, {
|
|
257
|
+
as: NavList$1.Group,
|
|
258
|
+
ref: ref,
|
|
259
|
+
...props
|
|
260
|
+
});
|
|
261
|
+
});
|
|
262
|
+
const NavList = Object.assign(NavListImpl, {
|
|
263
|
+
// Wrapped components that need sx support added back in
|
|
264
|
+
Item: NavListItem,
|
|
265
|
+
Group: NavListGroup,
|
|
266
|
+
// Re-exporting others directly
|
|
267
|
+
// TODO: try to remove typecasts to work around "non-portable types" TS error
|
|
268
|
+
SubNav: NavList$1.SubNav,
|
|
269
|
+
Divider: NavList$1.Divider,
|
|
270
|
+
LeadingVisual: NavList$1.LeadingVisual,
|
|
271
|
+
TrailingVisual: NavList$1.TrailingVisual,
|
|
272
|
+
TrailingAction: NavList$1.TrailingAction,
|
|
273
|
+
GroupHeading: NavList$1.GroupHeading,
|
|
274
|
+
GroupExpand: NavList$1.GroupExpand
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
const Overlay = styled(Overlay$1).withConfig({
|
|
278
|
+
shouldForwardProp: prop => prop !== 'sx'
|
|
279
|
+
}).withConfig({
|
|
280
|
+
displayName: "Overlay",
|
|
281
|
+
componentId: "sc-tjbd74-0"
|
|
282
|
+
})(["", ""], sx);
|
|
283
|
+
|
|
284
|
+
const RadioGroupImpl = props => {
|
|
285
|
+
return /*#__PURE__*/jsx(Box, {
|
|
286
|
+
as: RadioGroup$1,
|
|
287
|
+
...props
|
|
288
|
+
});
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
// Define local types based on the internal component props
|
|
292
|
+
|
|
293
|
+
const CheckboxOrRadioGroupLabel = props => {
|
|
294
|
+
return /*#__PURE__*/jsx(Box, {
|
|
295
|
+
as: RadioGroup$1.Label,
|
|
296
|
+
...props
|
|
297
|
+
});
|
|
298
|
+
};
|
|
299
|
+
const CheckboxOrRadioGroupCaption = props => {
|
|
300
|
+
return /*#__PURE__*/jsx(Box, {
|
|
301
|
+
as: RadioGroup$1.Caption,
|
|
302
|
+
...props
|
|
303
|
+
});
|
|
304
|
+
};
|
|
305
|
+
const CheckboxOrRadioGroupValidation = props => {
|
|
306
|
+
return /*#__PURE__*/jsx(Box, {
|
|
307
|
+
as: RadioGroup$1.Validation,
|
|
308
|
+
...props
|
|
309
|
+
});
|
|
310
|
+
};
|
|
311
|
+
const RadioGroup = Object.assign(RadioGroupImpl, {
|
|
312
|
+
Label: CheckboxOrRadioGroupLabel,
|
|
313
|
+
Caption: CheckboxOrRadioGroupCaption,
|
|
314
|
+
Validation: CheckboxOrRadioGroupValidation
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
function RelativeTime(props) {
|
|
318
|
+
// @ts-expect-error the types for Box are not correctly inferred here
|
|
319
|
+
return /*#__PURE__*/jsx(Box, {
|
|
320
|
+
as: RelativeTime$1,
|
|
321
|
+
...props
|
|
322
|
+
});
|
|
13
323
|
}
|
|
14
324
|
|
|
15
325
|
const SegmentedControlButton = props => {
|
|
16
|
-
return /*#__PURE__*/
|
|
17
|
-
as: SegmentedControl$1.Button
|
|
18
|
-
|
|
326
|
+
return /*#__PURE__*/jsx(Box, {
|
|
327
|
+
as: SegmentedControl$1.Button,
|
|
328
|
+
...props
|
|
329
|
+
});
|
|
19
330
|
};
|
|
20
331
|
const SegmentedControlIconButton = props => {
|
|
21
|
-
return /*#__PURE__*/
|
|
22
|
-
as: SegmentedControl$1.IconButton
|
|
23
|
-
|
|
332
|
+
return /*#__PURE__*/jsx(Box, {
|
|
333
|
+
as: SegmentedControl$1.IconButton,
|
|
334
|
+
...props
|
|
335
|
+
});
|
|
24
336
|
};
|
|
25
337
|
const SegmentedControlImpl = props => {
|
|
26
|
-
return /*#__PURE__*/
|
|
27
|
-
as: SegmentedControl$1
|
|
28
|
-
|
|
338
|
+
return /*#__PURE__*/jsx(Box, {
|
|
339
|
+
as: SegmentedControl$1,
|
|
340
|
+
...props
|
|
341
|
+
});
|
|
29
342
|
};
|
|
30
343
|
const SegmentedControl = Object.assign(SegmentedControlImpl, {
|
|
31
344
|
Button: SegmentedControlButton,
|
|
32
345
|
IconButton: SegmentedControlIconButton
|
|
33
346
|
});
|
|
347
|
+
|
|
348
|
+
function Spinner(props) {
|
|
349
|
+
return /*#__PURE__*/jsx(Box, {
|
|
350
|
+
as: Spinner$1,
|
|
351
|
+
...props
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
|
|
34
355
|
const StateLabel = /*#__PURE__*/forwardRef(function StateLabel(props, ref) {
|
|
35
|
-
return /*#__PURE__*/
|
|
356
|
+
return /*#__PURE__*/jsx(Box, {
|
|
36
357
|
as: StateLabel$1,
|
|
37
|
-
ref: ref
|
|
38
|
-
|
|
358
|
+
ref: ref,
|
|
359
|
+
...props
|
|
360
|
+
});
|
|
39
361
|
});
|
|
362
|
+
|
|
40
363
|
const SubNavImpl = /*#__PURE__*/forwardRef(function SubNav(props, ref) {
|
|
41
|
-
return /*#__PURE__*/
|
|
364
|
+
return /*#__PURE__*/jsx(Box, {
|
|
42
365
|
as: SubNav$1,
|
|
43
|
-
ref: ref
|
|
44
|
-
|
|
366
|
+
ref: ref,
|
|
367
|
+
...props
|
|
368
|
+
});
|
|
45
369
|
});
|
|
46
370
|
const SubNavLink = /*#__PURE__*/forwardRef(function SubNavLink(props, ref) {
|
|
47
|
-
return /*#__PURE__*/
|
|
371
|
+
return /*#__PURE__*/jsx(Box, {
|
|
48
372
|
as: SubNav$1.Link,
|
|
49
|
-
ref: ref
|
|
50
|
-
|
|
373
|
+
ref: ref,
|
|
374
|
+
...props
|
|
375
|
+
});
|
|
51
376
|
});
|
|
52
377
|
const SubNav = Object.assign(SubNavImpl, {
|
|
53
378
|
Link: SubNavLink
|
|
54
379
|
});
|
|
380
|
+
|
|
381
|
+
const StyledText = styled(Text$1).withConfig({
|
|
382
|
+
shouldForwardProp: prop => prop !== 'sx'
|
|
383
|
+
}).withConfig({
|
|
384
|
+
displayName: "Text__StyledText",
|
|
385
|
+
componentId: "sc-1klmep6-0"
|
|
386
|
+
})(["", ""], sx);
|
|
387
|
+
const Text = /*#__PURE__*/forwardRef(({
|
|
388
|
+
as,
|
|
389
|
+
...props
|
|
390
|
+
}, ref) => {
|
|
391
|
+
return /*#__PURE__*/jsx(StyledText, {
|
|
392
|
+
...props,
|
|
393
|
+
...(as ? {
|
|
394
|
+
forwardedAs: as
|
|
395
|
+
} : {}),
|
|
396
|
+
ref: ref
|
|
397
|
+
});
|
|
398
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
399
|
+
});
|
|
400
|
+
|
|
401
|
+
const TimelineImpl = /*#__PURE__*/forwardRef(function Timeline(props, ref) {
|
|
402
|
+
return /*#__PURE__*/jsx(Box, {
|
|
403
|
+
as: Timeline$1,
|
|
404
|
+
ref: ref,
|
|
405
|
+
...props
|
|
406
|
+
});
|
|
407
|
+
});
|
|
408
|
+
const TimelineItem = /*#__PURE__*/forwardRef(function TimelineItem(props, ref) {
|
|
409
|
+
return /*#__PURE__*/jsx(Box, {
|
|
410
|
+
as: Timeline$1.Item,
|
|
411
|
+
ref: ref,
|
|
412
|
+
...props
|
|
413
|
+
});
|
|
414
|
+
});
|
|
415
|
+
function TimelineBadge(props) {
|
|
416
|
+
return /*#__PURE__*/jsx(Box, {
|
|
417
|
+
as: Timeline$1.Badge,
|
|
418
|
+
...props
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
const TimelineBody = /*#__PURE__*/forwardRef(function TimelineBody(props, ref) {
|
|
422
|
+
return /*#__PURE__*/jsx(Box, {
|
|
423
|
+
as: Timeline$1.Body,
|
|
424
|
+
ref: ref,
|
|
425
|
+
...props
|
|
426
|
+
});
|
|
427
|
+
});
|
|
428
|
+
const TimelineBreak = /*#__PURE__*/forwardRef(function TimelineBreak(props, ref) {
|
|
429
|
+
return /*#__PURE__*/jsx(Box, {
|
|
430
|
+
as: Timeline$1.Break,
|
|
431
|
+
ref: ref,
|
|
432
|
+
...props
|
|
433
|
+
});
|
|
434
|
+
});
|
|
435
|
+
const Timeline = Object.assign(TimelineImpl, {
|
|
436
|
+
Item: TimelineItem,
|
|
437
|
+
Badge: TimelineBadge,
|
|
438
|
+
Body: TimelineBody,
|
|
439
|
+
Break: TimelineBreak
|
|
440
|
+
});
|
|
441
|
+
|
|
55
442
|
const ToggleSwitch = /*#__PURE__*/forwardRef(function ToggleSwitch(props, ref) {
|
|
56
|
-
return /*#__PURE__*/
|
|
443
|
+
return /*#__PURE__*/jsx(Box, {
|
|
57
444
|
as: ToggleSwitch$1,
|
|
445
|
+
ref: ref,
|
|
446
|
+
...props
|
|
447
|
+
});
|
|
448
|
+
});
|
|
449
|
+
|
|
450
|
+
const Token = /*#__PURE__*/React.forwardRef(({
|
|
451
|
+
sx: sxProp,
|
|
452
|
+
style,
|
|
453
|
+
...rest
|
|
454
|
+
}, ref) => {
|
|
455
|
+
const contextTheme = useTheme();
|
|
456
|
+
const theme$1 = contextTheme.theme || theme;
|
|
457
|
+
|
|
458
|
+
// If no sx prop is provided, just return PrimerToken directly
|
|
459
|
+
if (!sxProp) {
|
|
460
|
+
return /*#__PURE__*/jsx(Token$1, {
|
|
461
|
+
...rest,
|
|
462
|
+
style: style,
|
|
463
|
+
ref: ref
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
// Convert sx to CSS styles using the theme context
|
|
468
|
+
const sxStyles = css(sxProp)(theme$1);
|
|
469
|
+
const mergedStyle = {
|
|
470
|
+
...sxStyles,
|
|
471
|
+
...style
|
|
472
|
+
};
|
|
473
|
+
return /*#__PURE__*/jsx(Token$1, {
|
|
474
|
+
...rest,
|
|
475
|
+
style: mergedStyle,
|
|
58
476
|
ref: ref
|
|
59
|
-
}
|
|
477
|
+
});
|
|
478
|
+
});
|
|
479
|
+
|
|
480
|
+
const Truncate = styled(Truncate$1).withConfig({
|
|
481
|
+
shouldForwardProp: prop => prop !== 'sx'
|
|
482
|
+
}).withConfig({
|
|
483
|
+
displayName: "Truncate",
|
|
484
|
+
componentId: "sc-x3i4it-0"
|
|
485
|
+
})(["", ""], sx);
|
|
486
|
+
|
|
487
|
+
const StyledUnderlineNav = /*#__PURE__*/forwardRef(function UnderlineNav(props, ref) {
|
|
488
|
+
return /*#__PURE__*/jsx(Box, {
|
|
489
|
+
as: UnderlineNav$1,
|
|
490
|
+
ref: ref,
|
|
491
|
+
...props
|
|
492
|
+
});
|
|
493
|
+
});
|
|
494
|
+
const UnderlineNavImpl = /*#__PURE__*/forwardRef(({
|
|
495
|
+
as,
|
|
496
|
+
...props
|
|
497
|
+
}, ref) => /*#__PURE__*/jsx(StyledUnderlineNav, {
|
|
498
|
+
...props,
|
|
499
|
+
...(as ? {
|
|
500
|
+
forwardedAs: as
|
|
501
|
+
} : {}),
|
|
502
|
+
ref: ref
|
|
503
|
+
}));
|
|
504
|
+
const StyledUnderlineNavItem = styled(UnderlineNav$1.Item).withConfig({
|
|
505
|
+
shouldForwardProp: prop => prop !== 'sx'
|
|
506
|
+
}).withConfig({
|
|
507
|
+
displayName: "UnderlineNav__StyledUnderlineNavItem",
|
|
508
|
+
componentId: "sc-dx6br2-0"
|
|
509
|
+
})(["", ""], sx);
|
|
510
|
+
const UnderlineNavItem = /*#__PURE__*/forwardRef(({
|
|
511
|
+
as,
|
|
512
|
+
...props
|
|
513
|
+
}, ref) => /*#__PURE__*/jsx(StyledUnderlineNavItem, {
|
|
514
|
+
...props,
|
|
515
|
+
...(as ? {
|
|
516
|
+
forwardedAs: as
|
|
517
|
+
} : {}),
|
|
518
|
+
ref: ref
|
|
519
|
+
}));
|
|
520
|
+
const UnderlineNav = Object.assign(UnderlineNavImpl, {
|
|
521
|
+
Item: UnderlineNavItem
|
|
60
522
|
});
|
|
61
523
|
|
|
62
|
-
export { SegmentedControl, StateLabel, SubNav, ToggleSwitch };
|
|
524
|
+
export { ActionMenu, Autocomplete, Avatar, Breadcrumb, Breadcrumbs, Checkbox, CheckboxGroup, CircleBadge, CounterLabel, Flash, Header, Heading, Label, Link, LinkButton, NavList, Overlay, RadioGroup, RelativeTime, SegmentedControl, Spinner, StateLabel, SubNav, Text, Timeline, ToggleSwitch, Token, Truncate, UnderlineNav };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is originally from `@radix-ui/react-polymorphic` before the package
|
|
3
|
+
* was deprecated. The original source for this lived in the URL below.
|
|
4
|
+
*
|
|
5
|
+
* @see https://github.com/radix-ui/primitives/blob/17ffcb7aaa42cbd36b3c210ba86d7d73d218e5be/packages/react/polymorphic/src/polymorphic.ts
|
|
6
|
+
*/
|
|
7
|
+
import * as React from 'react';
|
|
8
|
+
type Merge<P1 = {}, P2 = {}> = Omit<P1, keyof P2> & P2;
|
|
9
|
+
/**
|
|
10
|
+
* Infers the OwnProps if E is a ForwardRefExoticComponentWithAs
|
|
11
|
+
*/
|
|
12
|
+
type OwnProps<E> = E extends ForwardRefComponent<any, infer P> ? P : {};
|
|
13
|
+
/**
|
|
14
|
+
* Infers the JSX.IntrinsicElement if E is a ForwardRefExoticComponentWithAs
|
|
15
|
+
*/
|
|
16
|
+
type IntrinsicElement<E> = E extends ForwardRefComponent<infer I, any> ? I : never;
|
|
17
|
+
type ForwardRefExoticComponent<E, OwnProps> = React.ForwardRefExoticComponent<Merge<E extends React.ElementType ? React.ComponentPropsWithRef<E> : never, OwnProps & {
|
|
18
|
+
as?: E;
|
|
19
|
+
}>>;
|
|
20
|
+
interface ForwardRefComponent<IntrinsicElementString, OwnProps = {}> extends ForwardRefExoticComponent<IntrinsicElementString, OwnProps> {
|
|
21
|
+
/**
|
|
22
|
+
* When `as` prop is passed, use this overload.
|
|
23
|
+
* Merges original own props (without DOM props) and the inferred props
|
|
24
|
+
* from `as` element with the own props taking precedence.
|
|
25
|
+
*
|
|
26
|
+
* We explicitly avoid `React.ElementType` and manually narrow the prop types
|
|
27
|
+
* so that events are typed when using JSX.IntrinsicElements.
|
|
28
|
+
*/
|
|
29
|
+
<As = IntrinsicElementString>(props: As extends '' ? {
|
|
30
|
+
as: keyof JSX.IntrinsicElements;
|
|
31
|
+
} : As extends React.ComponentType<infer P> ? Merge<P, OwnProps & {
|
|
32
|
+
as: As;
|
|
33
|
+
}> : As extends keyof JSX.IntrinsicElements ? Merge<JSX.IntrinsicElements[As], OwnProps & {
|
|
34
|
+
as: As;
|
|
35
|
+
}> : never): React.ReactElement | null;
|
|
36
|
+
}
|
|
37
|
+
export type { ForwardRefComponent, OwnProps, IntrinsicElement, Merge };
|
|
38
|
+
//# sourceMappingURL=polymorphic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"polymorphic.d.ts","sourceRoot":"","sources":["../src/polymorphic.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAK9B,KAAK,KAAK,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,GAAG,EAAE,CAAA;AAEtD;;GAEG;AACH,KAAK,QAAQ,CAAC,CAAC,IAAI,CAAC,SAAS,mBAAmB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,CAAA;AAEvE;;GAEG;AACH,KAAK,gBAAgB,CAAC,CAAC,IAAI,CAAC,SAAS,mBAAmB,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;AAElF,KAAK,yBAAyB,CAAC,CAAC,EAAE,QAAQ,IAAI,KAAK,CAAC,yBAAyB,CAC3E,KAAK,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC,GAAG,KAAK,EAAE,QAAQ,GAAG;IAAC,EAAE,CAAC,EAAE,CAAC,CAAA;CAAC,CAAC,CACjG,CAAA;AAMD,UAAU,mBAAmB,CAC3B,sBAAsB,EACtB,QAAQ,GAAG,EAAE,CAKb,SAAQ,yBAAyB,CAAC,sBAAsB,EAAE,QAAQ,CAAC;IACnE;;;;;;;OAOG;IACH,CAAC,EAAE,GAAG,sBAAsB,EAC1B,KAAK,EAAE,EAAE,SAAS,EAAE,GAChB;QAAC,EAAE,EAAE,MAAM,GAAG,CAAC,iBAAiB,CAAA;KAAC,GACjC,EAAE,SAAS,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,GACrC,KAAK,CAAC,CAAC,EAAE,QAAQ,GAAG;QAAC,EAAE,EAAE,EAAE,CAAA;KAAC,CAAC,GAC7B,EAAE,SAAS,MAAM,GAAG,CAAC,iBAAiB,GACpC,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,EAAE,CAAC,EAAE,QAAQ,GAAG;QAAC,EAAE,EAAE,EAAE,CAAA;KAAC,CAAC,GACrD,KAAK,GACZ,KAAK,CAAC,YAAY,GAAG,IAAI,CAAA;CAC7B;AAED,YAAY,EAAC,mBAAmB,EAAE,QAAQ,EAAE,gBAAgB,EAAE,KAAK,EAAC,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { BackgroundProps, BorderProps, ColorProps, FlexboxProps, GridProps, LayoutProps, PositionProps, ShadowProps, SpaceProps, TypographyProps } from 'styled-system';
|
|
2
|
+
import type { SxProp } from './sx';
|
|
3
|
+
export type StyledProps = SxProp & SpaceProps & ColorProps & TypographyProps & LayoutProps & FlexboxProps & GridProps & BackgroundProps & BorderProps & PositionProps & ShadowProps;
|
|
4
|
+
export type { BetterSystemStyleObject } from '@primer/react';
|
|
5
|
+
//# sourceMappingURL=styled-props.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styled-props.d.ts","sourceRoot":"","sources":["../src/styled-props.ts"],"names":[],"mappings":"AAAA,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;AACtB,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,MAAM,CAAA;AAEhC,MAAM,MAAM,WAAW,GAAG,MAAM,GAC9B,UAAU,GACV,UAAU,GACV,eAAe,GACf,WAAW,GACX,YAAY,GACZ,SAAS,GACT,eAAe,GACf,WAAW,GACX,aAAa,GACb,WAAW,CAAA;AAEb,YAAY,EAAC,uBAAuB,EAAC,MAAM,eAAe,CAAA"}
|
package/dist/sx.d.ts
ADDED
package/dist/sx.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sx.d.ts","sourceRoot":"","sources":["../src/sx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,EAAE,EAAE,KAAK,MAAM,EAAC,MAAM,eAAe,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@primer/styled-react",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
"./experimental": {
|
|
15
15
|
"types": "./dist/experimental.d.ts",
|
|
16
16
|
"default": "./dist/experimental.js"
|
|
17
|
-
}
|
|
17
|
+
},
|
|
18
|
+
"./components.json": "./dist/components.json"
|
|
18
19
|
},
|
|
19
20
|
"files": [
|
|
20
21
|
"README.md",
|
|
@@ -29,11 +30,12 @@
|
|
|
29
30
|
"devDependencies": {
|
|
30
31
|
"@babel/preset-react": "^7.27.1",
|
|
31
32
|
"@babel/preset-typescript": "^7.27.1",
|
|
32
|
-
"@primer/react": "^38.0.0-rc.
|
|
33
|
+
"@primer/react": "^38.0.0-rc.5",
|
|
33
34
|
"@rollup/plugin-babel": "^6.0.4",
|
|
34
35
|
"@types/react": "18.3.11",
|
|
35
36
|
"@types/react-dom": "18.3.1",
|
|
36
37
|
"@vitejs/plugin-react": "^4.3.3",
|
|
38
|
+
"babel-plugin-styled-components": "2.1.4",
|
|
37
39
|
"publint": "^0.3.12",
|
|
38
40
|
"react": "18.3.1",
|
|
39
41
|
"react-dom": "18.3.1",
|
|
@@ -44,7 +46,7 @@
|
|
|
44
46
|
"typescript": "^5.9.2"
|
|
45
47
|
},
|
|
46
48
|
"peerDependencies": {
|
|
47
|
-
"@primer/react": "38.0.0-rc.
|
|
49
|
+
"@primer/react": "38.0.0-rc.5",
|
|
48
50
|
"@types/react": "18.x || 19.x",
|
|
49
51
|
"@types/react-dom": "18.x || 19.x",
|
|
50
52
|
"@types/react-is": "18.x || 19.x",
|