@manuscripts/style-guide 3.5.12 → 3.5.14
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 +3 -3
- package/dist/cjs/components/Badge.js +25 -21
- package/dist/cjs/components/NavDropdown.js +6 -2
- package/dist/cjs/defaultTheme.js +20 -1
- package/dist/es/components/Badge.js +24 -21
- package/dist/es/components/NavDropdown.js +6 -2
- package/dist/es/defaultTheme.js +20 -1
- package/dist/types/components/Badge.d.ts +12 -2
- package/dist/types/theme.d.ts +15 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ React components for Manuscripts applications.
|
|
|
5
5
|
## Example usage
|
|
6
6
|
|
|
7
7
|
```tsx
|
|
8
|
-
import { PrimaryButton } from '@manuscripts/style-guide'
|
|
8
|
+
import { PrimaryButton } from '@manuscripts/style-guide'
|
|
9
9
|
|
|
10
10
|
const Example: React.FunctionComponent<{
|
|
11
11
|
handleClick: React.MouseEventHandler<HTMLButtonElement>
|
|
@@ -18,8 +18,8 @@ const Example: React.FunctionComponent<{
|
|
|
18
18
|
|
|
19
19
|
## Development
|
|
20
20
|
|
|
21
|
-
Run `yarn build` to build the `dist` folder for distribution.
|
|
21
|
+
Run `yarn build` to build the `dist` folder for distribution.
|
|
22
22
|
|
|
23
|
-
Run `yarn dev` to automatically rebuild when a file is changed.
|
|
23
|
+
Run `yarn dev` to automatically rebuild when a file is changed.
|
|
24
24
|
|
|
25
25
|
If a component needs new theme properties, add the types to `src/theme.ts` and add the corresponding values to `.storybook/theme.ts`.
|
|
@@ -1,29 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* © 2019 Atypon Systems LLC
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
4
|
};
|
|
20
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
6
|
exports.Badge = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
22
8
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
9
|
+
const Badge = ({ variant = 'default', label, width, size = 'md', }) => {
|
|
10
|
+
return ((0, jsx_runtime_1.jsx)(BadgeContainer, { "$variant": variant, "$width": width, "$size": size, children: label }));
|
|
11
|
+
};
|
|
12
|
+
exports.Badge = Badge;
|
|
13
|
+
const BadgeContainer = styled_components_1.default.div `
|
|
14
|
+
background: ${(props) => props.theme.colors.badge[props.$variant].background};
|
|
15
|
+
color: ${(props) => props.theme.colors.badge[props.$variant].color};
|
|
16
|
+
font-family: ${(props) => props.theme.font.family.Lato};
|
|
17
|
+
font-weight: ${(props) => props.theme.font.weight.bold};
|
|
18
|
+
font-size: ${(props) => props.$size === 'sm'
|
|
19
|
+
? props.theme.font.size.small
|
|
20
|
+
: props.theme.font.size.normal};
|
|
21
|
+
line-height: ${(props) => props.$size === 'sm'
|
|
22
|
+
? props.theme.font.lineHeight.normal
|
|
23
|
+
: props.theme.font.lineHeight.large};
|
|
24
|
+
width: ${(props) => (props.$width ? `${props.$width}px` : 'fit-content')};
|
|
25
|
+
padding-inline: ${(props) => props.theme.grid.unit * 2}px;
|
|
26
|
+
padding-block: ${(props) => props.theme.grid.unit}px;
|
|
27
|
+
border-radius: ${(props) => props.theme.grid.radius.small};
|
|
28
|
+
text-align: center;
|
|
29
|
+
border: ${(props) => props.theme.colors.badge[props.$variant].border
|
|
30
|
+
? `1px solid ${props.theme.colors.badge[props.$variant].border}`
|
|
31
|
+
: 'none'};
|
|
32
|
+
min-width: max-content;
|
|
29
33
|
`;
|
|
@@ -37,7 +37,6 @@ exports.NavDropdownButton = exports.NavDropdownButtonContainer = exports.Notific
|
|
|
37
37
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
38
|
const react_router_dom_1 = require("react-router-dom");
|
|
39
39
|
const styled_components_1 = __importStar(require("styled-components"));
|
|
40
|
-
const Badge_1 = require("./Badge");
|
|
41
40
|
const Button_1 = require("./Button");
|
|
42
41
|
const icons_1 = require("./icons");
|
|
43
42
|
exports.NavDropdownContainer = styled_components_1.default.div `
|
|
@@ -120,7 +119,7 @@ exports.NavDropdownToggle = (0, styled_components_1.default)(icons_1.ArrowUpIcon
|
|
|
120
119
|
transform: rotate(0deg);
|
|
121
120
|
}
|
|
122
121
|
`;
|
|
123
|
-
exports.NotificationsBadge =
|
|
122
|
+
exports.NotificationsBadge = styled_components_1.default.div `
|
|
124
123
|
background-color: ${(props) => props.isOpen
|
|
125
124
|
? props.theme.colors.background.success
|
|
126
125
|
: props.theme.colors.brand.default};
|
|
@@ -131,6 +130,11 @@ exports.NotificationsBadge = (0, styled_components_1.default)(Badge_1.Badge) `
|
|
|
131
130
|
max-height: 10px;
|
|
132
131
|
min-width: 10px;
|
|
133
132
|
min-height: 10px;
|
|
133
|
+
display: flex;
|
|
134
|
+
align-items: center;
|
|
135
|
+
justify-content: center;
|
|
136
|
+
padding: 2px;
|
|
137
|
+
border-radius: 50px;
|
|
134
138
|
`;
|
|
135
139
|
exports.NavDropdownButtonContainer = (0, styled_components_1.default)(Button_1.SecondaryButton).attrs((props) => ({
|
|
136
140
|
selected: props.isOpen,
|
package/dist/cjs/defaultTheme.js
CHANGED
|
@@ -180,11 +180,30 @@ exports.defaultTheme = {
|
|
|
180
180
|
error: colors.punchRed,
|
|
181
181
|
info: colors.jellyBeanBlue,
|
|
182
182
|
success: colors.killarneyGreen,
|
|
183
|
-
warning: colors.contrastOrange
|
|
183
|
+
warning: colors.contrastOrange,
|
|
184
184
|
},
|
|
185
185
|
outline: {
|
|
186
186
|
focus: colors.focusBlue,
|
|
187
187
|
},
|
|
188
|
+
badge: {
|
|
189
|
+
default: {
|
|
190
|
+
background: colors.mercuryGrey,
|
|
191
|
+
color: colors.greyDark,
|
|
192
|
+
},
|
|
193
|
+
primary: { background: colors.manuscriptsBlueDark, color: colors.white },
|
|
194
|
+
warning: {
|
|
195
|
+
background: colors.manuscriptsSecondary,
|
|
196
|
+
color: colors.greyDark,
|
|
197
|
+
},
|
|
198
|
+
info: { background: colors.manuscriptsIcons, color: colors.white },
|
|
199
|
+
bordered: {
|
|
200
|
+
background: colors.seashellGrey,
|
|
201
|
+
color: colors.greyDark,
|
|
202
|
+
border: colors.mercuryGrey,
|
|
203
|
+
},
|
|
204
|
+
success: { background: colors.contrastGreen, color: colors.white },
|
|
205
|
+
dark: { background: colors.greyMuted, color: colors.white },
|
|
206
|
+
},
|
|
188
207
|
},
|
|
189
208
|
font: {
|
|
190
209
|
family: {
|
|
@@ -1,23 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
* © 2019 Atypon Systems LLC
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
2
|
import styled from 'styled-components';
|
|
17
|
-
export const Badge =
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
3
|
+
export const Badge = ({ variant = 'default', label, width, size = 'md', }) => {
|
|
4
|
+
return (_jsx(BadgeContainer, { "$variant": variant, "$width": width, "$size": size, children: label }));
|
|
5
|
+
};
|
|
6
|
+
const BadgeContainer = styled.div `
|
|
7
|
+
background: ${(props) => props.theme.colors.badge[props.$variant].background};
|
|
8
|
+
color: ${(props) => props.theme.colors.badge[props.$variant].color};
|
|
9
|
+
font-family: ${(props) => props.theme.font.family.Lato};
|
|
10
|
+
font-weight: ${(props) => props.theme.font.weight.bold};
|
|
11
|
+
font-size: ${(props) => props.$size === 'sm'
|
|
12
|
+
? props.theme.font.size.small
|
|
13
|
+
: props.theme.font.size.normal};
|
|
14
|
+
line-height: ${(props) => props.$size === 'sm'
|
|
15
|
+
? props.theme.font.lineHeight.normal
|
|
16
|
+
: props.theme.font.lineHeight.large};
|
|
17
|
+
width: ${(props) => (props.$width ? `${props.$width}px` : 'fit-content')};
|
|
18
|
+
padding-inline: ${(props) => props.theme.grid.unit * 2}px;
|
|
19
|
+
padding-block: ${(props) => props.theme.grid.unit}px;
|
|
20
|
+
border-radius: ${(props) => props.theme.grid.radius.small};
|
|
21
|
+
text-align: center;
|
|
22
|
+
border: ${(props) => props.theme.colors.badge[props.$variant].border
|
|
23
|
+
? `1px solid ${props.theme.colors.badge[props.$variant].border}`
|
|
24
|
+
: 'none'};
|
|
25
|
+
min-width: max-content;
|
|
23
26
|
`;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { NavLink } from 'react-router-dom';
|
|
3
3
|
import styled, { css } from 'styled-components';
|
|
4
|
-
import { Badge } from './Badge';
|
|
5
4
|
import { SecondaryButton } from './Button';
|
|
6
5
|
import { ArrowUpIcon } from './icons';
|
|
7
6
|
export const NavDropdownContainer = styled.div `
|
|
@@ -84,7 +83,7 @@ export const NavDropdownToggle = styled(ArrowUpIcon) `
|
|
|
84
83
|
transform: rotate(0deg);
|
|
85
84
|
}
|
|
86
85
|
`;
|
|
87
|
-
export const NotificationsBadge = styled
|
|
86
|
+
export const NotificationsBadge = styled.div `
|
|
88
87
|
background-color: ${(props) => props.isOpen
|
|
89
88
|
? props.theme.colors.background.success
|
|
90
89
|
: props.theme.colors.brand.default};
|
|
@@ -95,6 +94,11 @@ export const NotificationsBadge = styled(Badge) `
|
|
|
95
94
|
max-height: 10px;
|
|
96
95
|
min-width: 10px;
|
|
97
96
|
min-height: 10px;
|
|
97
|
+
display: flex;
|
|
98
|
+
align-items: center;
|
|
99
|
+
justify-content: center;
|
|
100
|
+
padding: 2px;
|
|
101
|
+
border-radius: 50px;
|
|
98
102
|
`;
|
|
99
103
|
export const NavDropdownButtonContainer = styled(SecondaryButton).attrs((props) => ({
|
|
100
104
|
selected: props.isOpen,
|
package/dist/es/defaultTheme.js
CHANGED
|
@@ -144,11 +144,30 @@ export const defaultTheme = {
|
|
|
144
144
|
error: colors.punchRed,
|
|
145
145
|
info: colors.jellyBeanBlue,
|
|
146
146
|
success: colors.killarneyGreen,
|
|
147
|
-
warning: colors.contrastOrange
|
|
147
|
+
warning: colors.contrastOrange,
|
|
148
148
|
},
|
|
149
149
|
outline: {
|
|
150
150
|
focus: colors.focusBlue,
|
|
151
151
|
},
|
|
152
|
+
badge: {
|
|
153
|
+
default: {
|
|
154
|
+
background: colors.mercuryGrey,
|
|
155
|
+
color: colors.greyDark,
|
|
156
|
+
},
|
|
157
|
+
primary: { background: colors.manuscriptsBlueDark, color: colors.white },
|
|
158
|
+
warning: {
|
|
159
|
+
background: colors.manuscriptsSecondary,
|
|
160
|
+
color: colors.greyDark,
|
|
161
|
+
},
|
|
162
|
+
info: { background: colors.manuscriptsIcons, color: colors.white },
|
|
163
|
+
bordered: {
|
|
164
|
+
background: colors.seashellGrey,
|
|
165
|
+
color: colors.greyDark,
|
|
166
|
+
border: colors.mercuryGrey,
|
|
167
|
+
},
|
|
168
|
+
success: { background: colors.contrastGreen, color: colors.white },
|
|
169
|
+
dark: { background: colors.greyMuted, color: colors.white },
|
|
170
|
+
},
|
|
152
171
|
},
|
|
153
172
|
font: {
|
|
154
173
|
family: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* ©
|
|
2
|
+
* © 2026 Atypon Systems LLC
|
|
3
3
|
*
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
@@ -13,4 +13,14 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
|
|
16
|
+
import React from 'react';
|
|
17
|
+
export type BadgeVariant = 'default' | 'primary' | 'warning' | 'info' | 'bordered' | 'success' | 'dark';
|
|
18
|
+
export type BadgeSize = 'sm' | 'md';
|
|
19
|
+
interface BadgeProps {
|
|
20
|
+
label: string;
|
|
21
|
+
variant?: BadgeVariant;
|
|
22
|
+
width?: number;
|
|
23
|
+
size?: BadgeSize;
|
|
24
|
+
}
|
|
25
|
+
export declare const Badge: React.FC<BadgeProps>;
|
|
26
|
+
export {};
|
package/dist/types/theme.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ interface Colors {
|
|
|
25
25
|
border: Border & Alerts & Variations;
|
|
26
26
|
brand: Brand;
|
|
27
27
|
button: Button;
|
|
28
|
+
badge: Badge;
|
|
28
29
|
text: Text & Alerts & Variations;
|
|
29
30
|
outline: Outline;
|
|
30
31
|
}
|
|
@@ -103,6 +104,20 @@ interface Button {
|
|
|
103
104
|
secondary: Elements;
|
|
104
105
|
error: Elements;
|
|
105
106
|
}
|
|
107
|
+
interface BadgeVariant {
|
|
108
|
+
background: string;
|
|
109
|
+
color: string;
|
|
110
|
+
border?: string;
|
|
111
|
+
}
|
|
112
|
+
interface Badge {
|
|
113
|
+
default: BadgeVariant;
|
|
114
|
+
primary: BadgeVariant;
|
|
115
|
+
warning: BadgeVariant;
|
|
116
|
+
info: BadgeVariant;
|
|
117
|
+
bordered: BadgeVariant;
|
|
118
|
+
success: BadgeVariant;
|
|
119
|
+
dark: BadgeVariant;
|
|
120
|
+
}
|
|
106
121
|
interface Text {
|
|
107
122
|
muted: string;
|
|
108
123
|
onDark: string;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manuscripts/style-guide",
|
|
3
3
|
"description": "Shared components for Manuscripts applications",
|
|
4
|
-
"version": "3.5.
|
|
4
|
+
"version": "3.5.14",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-style-guide",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|