@primer/styled-react 0.0.0-20251210204724 → 0.0.0-20260203041651
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/dist/components/ActionList.js +145 -89
- package/dist/components/ActionMenu.js +15 -15
- package/dist/components/Avatar.js +11 -13
- package/dist/components/BaseStyles.js +47 -28
- package/dist/components/Box.js +10 -18
- package/dist/components/Breadcrumbs.js +32 -22
- package/dist/components/Button.js +105 -41
- package/dist/components/Button.stories.d.ts +8 -0
- package/dist/components/Button.stories.d.ts.map +1 -0
- package/dist/components/CounterLabel.js +11 -13
- package/dist/components/DataTable.js +27 -19
- package/dist/components/Dialog.js +79 -53
- package/dist/components/Flash.js +9 -9
- package/dist/components/FormControl.js +15 -15
- package/dist/components/Header.js +44 -36
- package/dist/components/Heading.js +9 -9
- package/dist/components/IconButton.js +36 -23
- package/dist/components/Label.js +22 -17
- package/dist/components/Link.js +22 -17
- package/dist/components/LinkButton.js +9 -9
- package/dist/components/Overlay.js +9 -9
- package/dist/components/PageHeader.js +100 -62
- package/dist/components/SegmentedControl.js +25 -27
- package/dist/components/Spinner.js +9 -9
- package/dist/components/Text.js +22 -17
- package/dist/components/TextInput.js +32 -25
- package/dist/components/Textarea.js +22 -17
- package/dist/components/ThemeProvider.js +185 -132
- package/dist/components/Timeline.js +38 -40
- package/dist/components/ToggleSwitch.js +11 -13
- package/dist/components/Token.js +22 -17
- package/dist/components/Tooltip.js +12 -14
- package/dist/components/Truncate.js +9 -9
- package/dist/components/UnderlineNav.js +39 -27
- package/dist/components/deprecated/ActionList.js +39 -34
- package/dist/components/deprecated/DialogV1.js +38 -28
- package/dist/components/deprecated/Octicon.js +35 -28
- package/dist/components/deprecated/TabNav.js +38 -24
- package/dist/components/deprecated/Tooltip.js +28 -20
- package/dist/components.json +2 -28
- package/dist/deprecated.js +5 -7
- package/dist/experimental.d.ts +0 -21
- package/dist/experimental.d.ts.map +1 -1
- package/dist/experimental.js +4 -7
- package/dist/index.d.ts +0 -122
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +36 -48
- package/dist/sx.js +6 -7
- package/dist/theme-get.js +8 -8
- package/package.json +11 -7
- package/dist/components/Autocomplete.d.ts +0 -17
- package/dist/components/Autocomplete.d.ts.map +0 -1
- package/dist/components/Autocomplete.js +0 -23
- package/dist/components/Checkbox.d.ts +0 -5
- package/dist/components/Checkbox.d.ts.map +0 -1
- package/dist/components/Checkbox.js +0 -17
- package/dist/components/CheckboxGroup.d.ts +0 -34
- package/dist/components/CheckboxGroup.d.ts.map +0 -1
- package/dist/components/CheckboxGroup.js +0 -41
- package/dist/components/CircleBadge.d.ts +0 -8
- package/dist/components/CircleBadge.d.ts.map +0 -1
- package/dist/components/CircleBadge.js +0 -12
- package/dist/components/NavList.d.ts +0 -30
- package/dist/components/NavList.d.ts.map +0 -1
- package/dist/components/NavList.js +0 -55
- package/dist/components/RadioGroup.d.ts +0 -34
- package/dist/components/RadioGroup.d.ts.map +0 -1
- package/dist/components/RadioGroup.js +0 -41
- package/dist/components/RelativeTime.d.ts +0 -6
- package/dist/components/RelativeTime.d.ts.map +0 -1
- package/dist/components/RelativeTime.js +0 -14
- package/dist/components/Select.d.ts +0 -8
- package/dist/components/Select.d.ts.map +0 -1
- package/dist/components/Select.js +0 -19
- package/dist/components/StateLabel.d.ts +0 -10
- package/dist/components/StateLabel.d.ts.map +0 -1
- package/dist/components/StateLabel.js +0 -16
- package/dist/components/SubNav.d.ts +0 -10
- package/dist/components/SubNav.d.ts.map +0 -1
- package/dist/components/SubNav.js +0 -28
- package/dist/components/UnderlinePanels.d.ts +0 -14
- package/dist/components/UnderlinePanels.d.ts.map +0 -1
- package/dist/components/UnderlinePanels.js +0 -23
|
@@ -1,107 +1,163 @@
|
|
|
1
|
-
import
|
|
2
|
-
import styled from
|
|
3
|
-
import { ActionList } from
|
|
4
|
-
import
|
|
5
|
-
import { jsx } from
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { ActionList as ActionList$1 } from '@primer/react';
|
|
4
|
+
import { sx } from '../sx.js';
|
|
5
|
+
import { jsx } from 'react/jsx-runtime';
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
const StyledActionList = styled(ActionList$1).withConfig({
|
|
8
|
+
shouldForwardProp: prop => prop !== 'sx'
|
|
9
|
+
}).withConfig({
|
|
10
|
+
displayName: "ActionList__StyledActionList",
|
|
11
|
+
componentId: "sc-hw2362-0"
|
|
11
12
|
})(["", ""], sx);
|
|
12
|
-
const ActionListImpl =
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
const ActionListImpl = /*#__PURE__*/React.forwardRef(function ActionListImpl({
|
|
14
|
+
as,
|
|
15
|
+
...rest
|
|
16
|
+
}, ref) {
|
|
17
|
+
return /*#__PURE__*/jsx(StyledActionList, {
|
|
18
|
+
ref: ref,
|
|
19
|
+
...rest,
|
|
20
|
+
...(as ? {
|
|
21
|
+
forwardedAs: as
|
|
22
|
+
} : {})
|
|
23
|
+
});
|
|
18
24
|
});
|
|
19
|
-
const StyledActionListLinkItem = styled(ActionList.LinkItem).withConfig({
|
|
20
|
-
|
|
21
|
-
|
|
25
|
+
const StyledActionListLinkItem = styled(ActionList$1.LinkItem).withConfig({
|
|
26
|
+
shouldForwardProp: prop => prop !== 'sx'
|
|
27
|
+
}).withConfig({
|
|
28
|
+
displayName: "ActionList__StyledActionListLinkItem",
|
|
29
|
+
componentId: "sc-hw2362-1"
|
|
22
30
|
})(["", ""], sx);
|
|
23
|
-
const ActionListLinkItem =
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
31
|
+
const ActionListLinkItem = /*#__PURE__*/React.forwardRef(({
|
|
32
|
+
children,
|
|
33
|
+
as,
|
|
34
|
+
...props
|
|
35
|
+
}, ref) => /*#__PURE__*/jsx(StyledActionListLinkItem, {
|
|
36
|
+
ref: ref,
|
|
37
|
+
...props,
|
|
38
|
+
...(as ? {
|
|
39
|
+
forwardedAs: as
|
|
40
|
+
} : {}),
|
|
41
|
+
children: children
|
|
28
42
|
}));
|
|
29
|
-
ActionListLinkItem.displayName =
|
|
30
|
-
const StyledActionListTrailingAction = styled(ActionList.TrailingAction).withConfig({
|
|
31
|
-
|
|
32
|
-
|
|
43
|
+
ActionListLinkItem.displayName = 'ActionList.LinkItem';
|
|
44
|
+
const StyledActionListTrailingAction = styled(ActionList$1.TrailingAction).withConfig({
|
|
45
|
+
shouldForwardProp: prop => prop !== 'sx'
|
|
46
|
+
}).withConfig({
|
|
47
|
+
displayName: "ActionList__StyledActionListTrailingAction",
|
|
48
|
+
componentId: "sc-hw2362-2"
|
|
33
49
|
})(["", ""], sx);
|
|
34
|
-
const ActionListTrailingAction =
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
50
|
+
const ActionListTrailingAction = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
51
|
+
const {
|
|
52
|
+
as,
|
|
53
|
+
...rest
|
|
54
|
+
} = props;
|
|
55
|
+
return /*#__PURE__*/jsx(StyledActionListTrailingAction, {
|
|
56
|
+
...rest,
|
|
57
|
+
...(as ? {
|
|
58
|
+
forwardedAs: as
|
|
59
|
+
} : {}),
|
|
60
|
+
ref: ref
|
|
61
|
+
});
|
|
41
62
|
});
|
|
42
|
-
const StyledActionListItem = styled(ActionList.Item).withConfig({
|
|
43
|
-
|
|
44
|
-
|
|
63
|
+
const StyledActionListItem = styled(ActionList$1.Item).withConfig({
|
|
64
|
+
shouldForwardProp: prop => prop !== 'sx'
|
|
65
|
+
}).withConfig({
|
|
66
|
+
displayName: "ActionList__StyledActionListItem",
|
|
67
|
+
componentId: "sc-hw2362-3"
|
|
45
68
|
})(["", ""], sx);
|
|
46
|
-
const ActionListItem =
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
69
|
+
const ActionListItem = /*#__PURE__*/React.forwardRef(({
|
|
70
|
+
children,
|
|
71
|
+
as,
|
|
72
|
+
...props
|
|
73
|
+
}, ref) => /*#__PURE__*/jsx(StyledActionListItem, {
|
|
74
|
+
ref: ref,
|
|
75
|
+
...props,
|
|
76
|
+
...(as ? {
|
|
77
|
+
forwardedAs: as
|
|
78
|
+
} : {}),
|
|
79
|
+
children: children
|
|
51
80
|
}));
|
|
52
|
-
const StyledActionListGroup = styled(ActionList.Group).withConfig({
|
|
53
|
-
|
|
54
|
-
|
|
81
|
+
const StyledActionListGroup = styled(ActionList$1.Group).withConfig({
|
|
82
|
+
shouldForwardProp: prop => prop !== 'sx'
|
|
83
|
+
}).withConfig({
|
|
84
|
+
displayName: "ActionList__StyledActionListGroup",
|
|
85
|
+
componentId: "sc-hw2362-4"
|
|
55
86
|
})(["", ""], sx);
|
|
56
|
-
const ActionListGroup = ({
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
87
|
+
const ActionListGroup = ({
|
|
88
|
+
children,
|
|
89
|
+
as,
|
|
90
|
+
...props
|
|
91
|
+
}) => /*#__PURE__*/jsx(StyledActionListGroup, {
|
|
92
|
+
...props,
|
|
93
|
+
...(as ? {
|
|
94
|
+
forwardedAs: as
|
|
95
|
+
} : {}),
|
|
96
|
+
children: children
|
|
60
97
|
});
|
|
61
|
-
ActionListGroup.displayName =
|
|
62
|
-
const ActionListDivider = styled(ActionList.Divider).withConfig({
|
|
63
|
-
|
|
64
|
-
|
|
98
|
+
ActionListGroup.displayName = 'ActionList.Group';
|
|
99
|
+
const ActionListDivider = styled(ActionList$1.Divider).withConfig({
|
|
100
|
+
shouldForwardProp: prop => prop !== 'sx'
|
|
101
|
+
}).withConfig({
|
|
102
|
+
displayName: "ActionList__ActionListDivider",
|
|
103
|
+
componentId: "sc-hw2362-5"
|
|
65
104
|
})(["", ""], sx);
|
|
66
|
-
const StyledActionListLeadingVisual = styled(ActionList.LeadingVisual).withConfig({
|
|
67
|
-
|
|
68
|
-
|
|
105
|
+
const StyledActionListLeadingVisual = styled(ActionList$1.LeadingVisual).withConfig({
|
|
106
|
+
shouldForwardProp: prop => prop !== 'sx'
|
|
107
|
+
}).withConfig({
|
|
108
|
+
displayName: "ActionList__StyledActionListLeadingVisual",
|
|
109
|
+
componentId: "sc-hw2362-6"
|
|
69
110
|
})(["", ""], sx);
|
|
70
|
-
const ActionListLeadingVisual = ({
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
111
|
+
const ActionListLeadingVisual = ({
|
|
112
|
+
children,
|
|
113
|
+
as,
|
|
114
|
+
...props
|
|
115
|
+
}) => /*#__PURE__*/jsx(StyledActionListLeadingVisual, {
|
|
116
|
+
...props,
|
|
117
|
+
...(as ? {
|
|
118
|
+
forwardedAs: as
|
|
119
|
+
} : {}),
|
|
120
|
+
children: children
|
|
74
121
|
});
|
|
75
|
-
ActionListLeadingVisual.displayName =
|
|
76
|
-
const StyledActionListTrailingVisual = styled(ActionList.TrailingVisual).withConfig({
|
|
77
|
-
|
|
78
|
-
|
|
122
|
+
ActionListLeadingVisual.displayName = 'ActionList.LeadingVisual';
|
|
123
|
+
const StyledActionListTrailingVisual = styled(ActionList$1.TrailingVisual).withConfig({
|
|
124
|
+
shouldForwardProp: prop => prop !== 'sx'
|
|
125
|
+
}).withConfig({
|
|
126
|
+
displayName: "ActionList__StyledActionListTrailingVisual",
|
|
127
|
+
componentId: "sc-hw2362-7"
|
|
79
128
|
})(["", ""], sx);
|
|
80
|
-
const ActionListTrailingVisual = ({
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
129
|
+
const ActionListTrailingVisual = ({
|
|
130
|
+
children,
|
|
131
|
+
as,
|
|
132
|
+
...props
|
|
133
|
+
}) => /*#__PURE__*/jsx(StyledActionListTrailingVisual, {
|
|
134
|
+
...props,
|
|
135
|
+
...(as ? {
|
|
136
|
+
forwardedAs: as
|
|
137
|
+
} : {}),
|
|
138
|
+
children: children
|
|
84
139
|
});
|
|
85
|
-
ActionListTrailingVisual.displayName =
|
|
86
|
-
const ActionList
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
140
|
+
ActionListTrailingVisual.displayName = 'ActionList.TrailingVisual';
|
|
141
|
+
const ActionList = Object.assign(ActionListImpl, {
|
|
142
|
+
Item: ActionListItem,
|
|
143
|
+
LinkItem: ActionListLinkItem,
|
|
144
|
+
Group: ActionListGroup,
|
|
145
|
+
GroupHeading: ActionList$1.GroupHeading,
|
|
146
|
+
Divider: ActionListDivider,
|
|
147
|
+
Description: ActionList$1.Description,
|
|
148
|
+
LeadingVisual: ActionListLeadingVisual,
|
|
149
|
+
TrailingVisual: ActionListTrailingVisual,
|
|
150
|
+
Heading: ActionList$1.Heading,
|
|
151
|
+
TrailingAction: ActionListTrailingAction
|
|
97
152
|
});
|
|
98
|
-
ActionListItem.__SLOT__ = ActionList.Item.__SLOT__;
|
|
99
|
-
ActionListLinkItem.__SLOT__ = ActionList.LinkItem.__SLOT__;
|
|
100
|
-
ActionListGroup.__SLOT__ = ActionList.Group.__SLOT__;
|
|
101
|
-
ActionListDivider.__SLOT__ = ActionList.Divider.__SLOT__;
|
|
102
|
-
ActionListLeadingVisual.__SLOT__ = ActionList.LeadingVisual.__SLOT__;
|
|
103
|
-
ActionListTrailingVisual.__SLOT__ = ActionList.TrailingVisual.__SLOT__;
|
|
104
|
-
ActionListTrailingAction.__SLOT__ = ActionList.TrailingAction.__SLOT__;
|
|
105
153
|
|
|
106
|
-
|
|
107
|
-
|
|
154
|
+
// Assign slot markers after component definitions
|
|
155
|
+
ActionListItem.__SLOT__ = ActionList$1.Item.__SLOT__;
|
|
156
|
+
ActionListLinkItem.__SLOT__ = ActionList$1.LinkItem.__SLOT__;
|
|
157
|
+
ActionListGroup.__SLOT__ = ActionList$1.Group.__SLOT__;
|
|
158
|
+
ActionListDivider.__SLOT__ = ActionList$1.Divider.__SLOT__;
|
|
159
|
+
ActionListLeadingVisual.__SLOT__ = ActionList$1.LeadingVisual.__SLOT__;
|
|
160
|
+
ActionListTrailingVisual.__SLOT__ = ActionList$1.TrailingVisual.__SLOT__;
|
|
161
|
+
ActionListTrailingAction.__SLOT__ = ActionList$1.TrailingAction.__SLOT__;
|
|
162
|
+
|
|
163
|
+
export { ActionList };
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { ActionMenu as ActionMenu$1 } from '@primer/react';
|
|
2
|
+
import { sx } from '../sx.js';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
const ActionMenuOverlay = styled(ActionMenu$1.Overlay).withConfig({
|
|
6
|
+
shouldForwardProp: prop => prop !== 'sx'
|
|
7
|
+
}).withConfig({
|
|
8
|
+
displayName: "ActionMenu__ActionMenuOverlay",
|
|
9
|
+
componentId: "sc-w5s60e-0"
|
|
9
10
|
})(["", ""], sx);
|
|
10
|
-
const ActionMenu
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
const ActionMenu = Object.assign(ActionMenu$1, {
|
|
12
|
+
Button: ActionMenu$1.Button,
|
|
13
|
+
Anchor: ActionMenu$1.Anchor,
|
|
14
|
+
Overlay: ActionMenuOverlay,
|
|
15
|
+
Divider: ActionMenu$1.Divider
|
|
15
16
|
});
|
|
16
|
-
ActionMenuOverlay.__SLOT__ = ActionMenu.Overlay.__SLOT__;
|
|
17
|
+
ActionMenuOverlay.__SLOT__ = ActionMenu$1.Overlay.__SLOT__;
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
export { ActionMenu$1 as ActionMenu };
|
|
19
|
+
export { ActionMenu };
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { jsx } from
|
|
1
|
+
import { Avatar as Avatar$1 } from '@primer/react';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { Box } from './Box.js';
|
|
4
|
+
import { jsx } from 'react/jsx-runtime';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
});
|
|
6
|
+
const Avatar = /*#__PURE__*/forwardRef(function Avatar(props, ref) {
|
|
7
|
+
return /*#__PURE__*/jsx(Box, {
|
|
8
|
+
as: Avatar$1,
|
|
9
|
+
ref: ref,
|
|
10
|
+
...props
|
|
11
|
+
});
|
|
13
12
|
});
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
export { Avatar$1 as Avatar };
|
|
14
|
+
export { Avatar };
|
|
@@ -1,32 +1,51 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
1
|
+
import { clsx } from 'clsx';
|
|
2
|
+
import { useTheme } from './ThemeProvider.js';
|
|
3
|
+
import 'focus-visible';
|
|
4
|
+
import { createGlobalStyle } from 'styled-components';
|
|
5
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
6
6
|
|
|
7
|
-
//#region src/components/BaseStyles.tsx
|
|
8
7
|
const GlobalStyle = createGlobalStyle(["*{box-sizing:border-box;}body{margin:0;}table{border-collapse:collapse;}[data-color-mode='light'] input{color-scheme:light;}[data-color-mode='dark'] input{color-scheme:dark;}@media (prefers-color-scheme:light){[data-color-mode='auto'][data-light-theme*='light']{color-scheme:light;}}@media (prefers-color-scheme:dark){[data-color-mode='auto'][data-dark-theme*='dark']{color-scheme:dark;}}[role='button']:focus:not(:focus-visible):not(:global(.focus-visible)),[role='tabpanel'][tabindex='0']:focus:not(:focus-visible):not(:global(.focus-visible)),button:focus:not(:focus-visible):not(:global(.focus-visible)),summary:focus:not(:focus-visible):not(:global(.focus-visible)),a:focus:not(:focus-visible):not(:global(.focus-visible)){outline:none;box-shadow:none;}[tabindex='0']:focus:not(:focus-visible):not(:global(.focus-visible)),details-dialog:focus:not(:focus-visible):not(:global(.focus-visible)){outline:none;}.BaseStyles{font-family:var(--BaseStyles-fontFamily,var(--fontStack-system));line-height:var(--BaseStyles-lineHeight,1.5);color:var(--BaseStyles-fgColor,var(--fgColor-default));&:has([data-color-mode='light']){input &{color-scheme:light;}}&:has([data-color-mode='dark']){input &{color-scheme:dark;}}:where(a:not([class*='prc-']):not([class*='PRC-']):not([class*='Primer_Brand__'])){color:var(--fgColor-accent,var(--color-accent-fg));text-decoration:none;&:hover{text-decoration:underline;}}}"]);
|
|
9
|
-
function BaseStyles({
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
8
|
+
function BaseStyles({
|
|
9
|
+
children,
|
|
10
|
+
color,
|
|
11
|
+
fontFamily,
|
|
12
|
+
lineHeight,
|
|
13
|
+
className,
|
|
14
|
+
as: Component = 'div',
|
|
15
|
+
style,
|
|
16
|
+
...rest
|
|
17
|
+
}) {
|
|
18
|
+
const {
|
|
19
|
+
colorMode,
|
|
20
|
+
colorScheme,
|
|
21
|
+
dayScheme,
|
|
22
|
+
nightScheme
|
|
23
|
+
} = useTheme();
|
|
24
|
+
const baseStyles = {
|
|
25
|
+
['--BaseStyles-fgColor']: color,
|
|
26
|
+
['--BaseStyles-fontFamily']: fontFamily,
|
|
27
|
+
['--BaseStyles-lineHeight']: lineHeight
|
|
28
|
+
};
|
|
29
|
+
return /*#__PURE__*/jsxs(Component, {
|
|
30
|
+
className: clsx('BaseStyles', className),
|
|
31
|
+
"data-portal-root": true
|
|
32
|
+
/**
|
|
33
|
+
* We need to map valid primer/react color modes onto valid color modes for primer/primitives
|
|
34
|
+
* valid color modes for primer/primitives: auto | light | dark
|
|
35
|
+
* valid color modes for primer/primer: auto | day | night | light | dark
|
|
36
|
+
*/,
|
|
37
|
+
"data-color-mode": colorMode === 'auto' ? 'auto' : colorScheme?.includes('dark') ? 'dark' : 'light',
|
|
38
|
+
"data-light-theme": dayScheme,
|
|
39
|
+
"data-dark-theme": nightScheme,
|
|
40
|
+
style: {
|
|
41
|
+
...baseStyles,
|
|
42
|
+
...style
|
|
43
|
+
},
|
|
44
|
+
...rest,
|
|
45
|
+
children: [/*#__PURE__*/jsx(GlobalStyle, {
|
|
46
|
+
colorScheme: colorScheme?.includes('dark') ? 'dark' : 'light'
|
|
47
|
+
}), children]
|
|
48
|
+
});
|
|
29
49
|
}
|
|
30
50
|
|
|
31
|
-
|
|
32
|
-
export { BaseStyles };
|
|
51
|
+
export { BaseStyles };
|
package/dist/components/Box.js
CHANGED
|
@@ -1,23 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import { space, color, typography, layout, flexbox, grid, background, border, position, shadow } from 'styled-system';
|
|
3
|
+
import { sx } from '../sx.js';
|
|
4
4
|
|
|
5
|
-
//#region src/components/Box.tsx
|
|
6
5
|
/**
|
|
7
|
-
* @deprecated The Box component is deprecated. Replace with a `div` or
|
|
8
|
-
* appropriate HTML element instead, with CSS modules for styling.
|
|
9
|
-
* @see https://github.com/primer/react/blob/main/contributor-docs/migration-from-box.md
|
|
10
|
-
*/
|
|
6
|
+
* @deprecated The Box component is deprecated. Replace with a `div` or
|
|
7
|
+
* appropriate HTML element instead, with CSS modules for styling.
|
|
8
|
+
* @see https://github.com/primer/react/blob/main/contributor-docs/migration-from-box.md
|
|
9
|
+
*/
|
|
11
10
|
const Box = styled.div.withConfig({
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
displayName: "Box",
|
|
12
|
+
componentId: "sc-62in7e-0"
|
|
14
13
|
})(space, color, typography, layout, flexbox, grid, background, border, position, shadow, sx);
|
|
15
|
-
/**
|
|
16
|
-
* @deprecated The Box component is deprecated. Replace with a `div` or
|
|
17
|
-
* appropriate HTML element instead, with CSS modules for styling.
|
|
18
|
-
* @see https://github.com/primer/react/blob/main/contributor-docs/migration-from-box.md
|
|
19
|
-
*/
|
|
20
|
-
var Box_default = Box;
|
|
21
14
|
|
|
22
|
-
|
|
23
|
-
export { Box, Box_default as default };
|
|
15
|
+
export { Box };
|
|
@@ -1,28 +1,38 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { jsx } from
|
|
1
|
+
import { Breadcrumbs as Breadcrumbs$1 } from '@primer/react';
|
|
2
|
+
import { sx } from '../sx.js';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { jsx } from 'react/jsx-runtime';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
const BreadcrumbsImpl = styled(Breadcrumbs$1).withConfig({
|
|
7
|
+
shouldForwardProp: prop => prop !== 'sx'
|
|
8
|
+
}).withConfig({
|
|
9
|
+
displayName: "Breadcrumbs__BreadcrumbsImpl",
|
|
10
|
+
componentId: "sc-1qj8pw-0"
|
|
10
11
|
})(["", ""], sx);
|
|
11
|
-
const StyledBreadcrumbsItem = styled(Breadcrumbs.Item).withConfig({
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
const StyledBreadcrumbsItem = styled(Breadcrumbs$1.Item).withConfig({
|
|
13
|
+
shouldForwardProp: prop => prop !== 'sx'
|
|
14
|
+
}).withConfig({
|
|
15
|
+
displayName: "Breadcrumbs__StyledBreadcrumbsItem",
|
|
16
|
+
componentId: "sc-1qj8pw-1"
|
|
14
17
|
})(["", ""], sx);
|
|
15
|
-
function BreadcrumbsItem({
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
function BreadcrumbsItem({
|
|
19
|
+
as,
|
|
20
|
+
...props
|
|
21
|
+
}) {
|
|
22
|
+
return /*#__PURE__*/jsx(StyledBreadcrumbsItem, {
|
|
23
|
+
...props,
|
|
24
|
+
...(as ? {
|
|
25
|
+
forwardedAs: as
|
|
26
|
+
} : {})
|
|
27
|
+
});
|
|
20
28
|
}
|
|
21
|
-
const Breadcrumbs
|
|
29
|
+
const Breadcrumbs = Object.assign(BreadcrumbsImpl, {
|
|
30
|
+
Item: BreadcrumbsItem
|
|
31
|
+
});
|
|
32
|
+
|
|
22
33
|
/**
|
|
23
|
-
* @deprecated Use the `Breadcrumbs` component instead (i.e. `<Breadcrumb>` → `<Breadcrumbs>`)
|
|
24
|
-
*/
|
|
25
|
-
const Breadcrumb = Breadcrumbs
|
|
34
|
+
* @deprecated Use the `Breadcrumbs` component instead (i.e. `<Breadcrumb>` → `<Breadcrumbs>`)
|
|
35
|
+
*/
|
|
36
|
+
const Breadcrumb = Breadcrumbs;
|
|
26
37
|
|
|
27
|
-
|
|
28
|
-
export { Breadcrumb, Breadcrumbs$1 as Breadcrumbs };
|
|
38
|
+
export { Breadcrumb, Breadcrumbs };
|
|
@@ -1,48 +1,112 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import { jsx } from
|
|
1
|
+
import { Button } from '@primer/react';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { sx } from '../sx.js';
|
|
5
|
+
import { jsx } from 'react/jsx-runtime';
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
const StyledButtonComponent = styled(Button).withConfig({
|
|
8
|
+
shouldForwardProp: prop => prop !== 'sx'
|
|
9
|
+
}).withConfig({
|
|
10
|
+
displayName: "Button__StyledButtonComponent",
|
|
11
|
+
componentId: "sc-vqy3e4-0"
|
|
11
12
|
})(["", ""], sx);
|
|
12
|
-
const ButtonComponent =
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
13
|
+
const ButtonComponent = /*#__PURE__*/forwardRef(({
|
|
14
|
+
as,
|
|
15
|
+
sx,
|
|
16
|
+
style: propStyle,
|
|
17
|
+
...props
|
|
18
|
+
}, ref) => {
|
|
19
|
+
const {
|
|
20
|
+
block,
|
|
21
|
+
size = 'medium',
|
|
22
|
+
leadingVisual,
|
|
23
|
+
trailingVisual,
|
|
24
|
+
trailingAction
|
|
25
|
+
} = props;
|
|
26
|
+
let sxStyles = {};
|
|
27
|
+
const style = {
|
|
28
|
+
...(propStyle || {})
|
|
29
|
+
};
|
|
30
|
+
if (sx !== null && Object.keys(sx || {}).length > 0) {
|
|
31
|
+
sxStyles = generateCustomSxProp({
|
|
32
|
+
block,
|
|
33
|
+
size,
|
|
34
|
+
leadingVisual,
|
|
35
|
+
trailingVisual,
|
|
36
|
+
trailingAction
|
|
37
|
+
}, sx);
|
|
38
|
+
const {
|
|
39
|
+
color
|
|
40
|
+
} = sx;
|
|
41
|
+
if (color) style['--button-color'] = color;
|
|
42
|
+
}
|
|
43
|
+
return /*#__PURE__*/jsx(StyledButtonComponent, {
|
|
44
|
+
style: style,
|
|
45
|
+
sx: sxStyles,
|
|
46
|
+
ref: ref,
|
|
47
|
+
...props,
|
|
48
|
+
...(as ? {
|
|
49
|
+
forwardedAs: as
|
|
50
|
+
} : {})
|
|
51
|
+
});
|
|
34
52
|
});
|
|
53
|
+
|
|
54
|
+
// This function is used to generate a custom cssSelector for the sxProp
|
|
55
|
+
|
|
56
|
+
// The usual sx prop can like this:
|
|
57
|
+
// sx={{
|
|
58
|
+
// [`@media (max-width: 768px)`]: {
|
|
59
|
+
// '& > ul': {
|
|
60
|
+
// backgroundColor: 'deeppink',
|
|
61
|
+
// },
|
|
62
|
+
// '&:hover': {
|
|
63
|
+
// backgroundColor: 'yellow',
|
|
64
|
+
// },
|
|
65
|
+
// },
|
|
66
|
+
// '&:hover': {
|
|
67
|
+
// backgroundColor: 'yellow',
|
|
68
|
+
// },
|
|
69
|
+
// '&': {
|
|
70
|
+
// width : 320px
|
|
71
|
+
// }
|
|
72
|
+
// }}
|
|
73
|
+
//*
|
|
74
|
+
/* What we want for Button styles is this:
|
|
75
|
+
sx={{
|
|
76
|
+
// [`@media (max-width: 768px)`]: {
|
|
77
|
+
// '&[data-attribute="something"] > ul': {
|
|
78
|
+
// backgroundColor: 'deeppink',
|
|
79
|
+
// },
|
|
80
|
+
// '&[data-attribute="something"]:hover': {
|
|
81
|
+
// backgroundColor: 'yellow',
|
|
82
|
+
// },
|
|
83
|
+
// },
|
|
84
|
+
// '&[data-attribute="something"]:hover': {
|
|
85
|
+
// backgroundColor: 'yellow',
|
|
86
|
+
// },
|
|
87
|
+
// '&[data-attribute="something"]': {
|
|
88
|
+
// width : 320px
|
|
89
|
+
// }
|
|
90
|
+
// }}
|
|
91
|
+
|
|
92
|
+
// We need to make sure we append the customCSSSelector to the original class selector. i.e & - > &[data-attribute="Icon"][data-size="small"]
|
|
93
|
+
*/
|
|
35
94
|
function generateCustomSxProp(props, providedSx) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
95
|
+
// Possible data attributes: data-size, data-block, data-no-visuals
|
|
96
|
+
const size = `[data-size="${props.size}"]`;
|
|
97
|
+
const block = props.block ? `[data-block="block"]` : '';
|
|
98
|
+
const noVisuals = props.leadingVisual || props.trailingVisual || props.trailingAction ? '' : '[data-no-visuals]';
|
|
99
|
+
|
|
100
|
+
// this is a custom selector. We need to make sure we add the data attributes to the base css class (& -> &[data-attributename="value"]])
|
|
101
|
+
const cssSelector = `&${size}${block}${noVisuals}`; // &[data-size="small"][data-block="block"][data-no-visuals]
|
|
102
|
+
|
|
103
|
+
const customSxProp = {};
|
|
104
|
+
if (!providedSx) return customSxProp;else {
|
|
105
|
+
customSxProp[cssSelector] = providedSx;
|
|
106
|
+
return customSxProp;
|
|
107
|
+
}
|
|
43
108
|
}
|
|
44
|
-
ButtonComponent.displayName =
|
|
109
|
+
ButtonComponent.displayName = 'Button';
|
|
45
110
|
ButtonComponent.__SLOT__ = Button.__SLOT__;
|
|
46
111
|
|
|
47
|
-
|
|
48
|
-
export { ButtonComponent, generateCustomSxProp };
|
|
112
|
+
export { ButtonComponent, generateCustomSxProp };
|