@manuscripts/style-guide 3.5.13 → 3.5.15
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 +5 -5
- package/dist/cjs/components/AlertMessage.js +17 -5
- package/dist/cjs/components/Badge.js +25 -21
- package/dist/cjs/components/ExpandableSection.js +55 -0
- package/dist/cjs/components/NavDropdown.js +6 -2
- package/dist/cjs/components/Text.js +7 -1
- package/dist/cjs/components/icons/x.js +1 -1
- package/dist/cjs/defaultTheme.js +20 -1
- package/dist/cjs/index.js +2 -5
- package/dist/es/components/AlertMessage.js +17 -5
- package/dist/es/components/Badge.js +24 -21
- package/dist/es/components/ExpandableSection.js +48 -0
- package/dist/es/components/NavDropdown.js +6 -2
- package/dist/es/components/Text.js +6 -0
- package/dist/es/components/icons/x.js +2 -2
- package/dist/es/defaultTheme.js +20 -1
- package/dist/es/index.js +1 -2
- package/dist/types/components/Badge.d.ts +12 -2
- package/dist/types/components/ExpandableSection.d.ts +9 -0
- package/dist/types/components/Text.d.ts +1 -0
- package/dist/types/components/icons/x.d.ts +1 -1
- package/dist/types/index.d.ts +1 -2
- package/dist/types/theme.d.ts +15 -0
- package/package.json +1 -1
- package/dist/cjs/components/InspectorSection.js +0 -72
- package/dist/cjs/components/ToggleHeader.js +0 -58
- package/dist/es/components/InspectorSection.js +0 -65
- package/dist/es/components/ToggleHeader.js +0 -51
- package/dist/types/components/InspectorSection.d.ts +0 -40
- package/dist/types/components/ToggleHeader.d.ts +0 -26
package/README.md
CHANGED
|
@@ -4,8 +4,8 @@ React components for Manuscripts applications.
|
|
|
4
4
|
|
|
5
5
|
## Example usage
|
|
6
6
|
|
|
7
|
-
```tsx
|
|
8
|
-
import { PrimaryButton } from '@manuscripts/style-guide'
|
|
7
|
+
```tsx
|
|
8
|
+
import { PrimaryButton } from '@manuscripts/style-guide'
|
|
9
9
|
|
|
10
10
|
const Example: React.FunctionComponent<{
|
|
11
11
|
handleClick: React.MouseEventHandler<HTMLButtonElement>
|
|
@@ -14,12 +14,12 @@ const Example: React.FunctionComponent<{
|
|
|
14
14
|
<PrimaryButton onClick={handleClick}>Done</PrimaryButton>
|
|
15
15
|
</div>
|
|
16
16
|
)
|
|
17
|
-
```
|
|
17
|
+
```
|
|
18
18
|
|
|
19
|
-
## Development
|
|
19
|
+
## Development
|
|
20
20
|
|
|
21
21
|
Run `yarn build` to build the `dist` folder for distribution.
|
|
22
22
|
|
|
23
23
|
Run `yarn dev` to automatically rebuild when a file is changed.
|
|
24
24
|
|
|
25
|
-
If a component needs new theme properties, add the types to `src/theme.ts` and add the corresponding values to `.storybook/theme.ts`.
|
|
25
|
+
If a component needs new theme properties, add the types to `src/theme.ts` and add the corresponding values to `.storybook/theme.ts`.
|
|
@@ -21,12 +21,9 @@ const AlertMessage = ({ title, message, variant, link, closeConfig, className, }
|
|
|
21
21
|
const AlertIcon = variantIcons[variant];
|
|
22
22
|
const handleClose = () => {
|
|
23
23
|
setIsOpen(false);
|
|
24
|
-
closeConfig?.onClick?.();
|
|
24
|
+
setTimeout(() => closeConfig?.onClick?.(), 175);
|
|
25
25
|
};
|
|
26
|
-
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
29
|
-
return ((0, jsx_runtime_1.jsxs)(Alert, { "$variant": variant, className: className, children: [(0, jsx_runtime_1.jsx)(IconWrapper, { "$hasTitle": !!title, children: (0, jsx_runtime_1.jsx)(AlertIcon, {}) }), (0, jsx_runtime_1.jsxs)(Content, { children: [title && (0, jsx_runtime_1.jsx)(Title, { children: title }), (0, jsx_runtime_1.jsxs)(MessageRow, { children: [(0, jsx_runtime_1.jsx)(Message, { children: message }), link && ((0, jsx_runtime_1.jsx)(ActionLink, { type: "button", onClick: link.onClick, children: link.label }))] })] }), closeConfig && ((0, jsx_runtime_1.jsx)(AlertCloseAction, { closeConfig: closeConfig, onClose: handleClose }))] }));
|
|
26
|
+
return ((0, jsx_runtime_1.jsxs)(Alert, { "$variant": variant, className: className, "data-open": isOpen ? '' : undefined, children: [(0, jsx_runtime_1.jsx)(IconWrapper, { "$hasTitle": !!title, children: (0, jsx_runtime_1.jsx)(AlertIcon, {}) }), (0, jsx_runtime_1.jsxs)(Content, { children: [title && (0, jsx_runtime_1.jsx)(Title, { children: title }), (0, jsx_runtime_1.jsxs)(MessageRow, { children: [(0, jsx_runtime_1.jsx)(Message, { children: message }), link && ((0, jsx_runtime_1.jsx)(ActionLink, { type: "button", onClick: link.onClick, children: link.label }))] })] }), closeConfig && ((0, jsx_runtime_1.jsx)(AlertCloseAction, { closeConfig: closeConfig, onClose: handleClose }))] }));
|
|
30
27
|
};
|
|
31
28
|
exports.AlertMessage = AlertMessage;
|
|
32
29
|
const Alert = styled_components_1.default.div `
|
|
@@ -41,6 +38,21 @@ const Alert = styled_components_1.default.div `
|
|
|
41
38
|
${(props) => props.theme.font.family.Lato};
|
|
42
39
|
gap: ${(props) => props.theme.grid.unit * 3}px;
|
|
43
40
|
padding: ${(props) => props.theme.grid.unit * 3}px;
|
|
41
|
+
opacity: 1;
|
|
42
|
+
transition:
|
|
43
|
+
opacity 200ms ease-out,
|
|
44
|
+
display 200ms allow-discrete;
|
|
45
|
+
|
|
46
|
+
&:not([data-open]) {
|
|
47
|
+
display: none;
|
|
48
|
+
opacity: 0;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@starting-style {
|
|
52
|
+
&[data-open] {
|
|
53
|
+
opacity: 0;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
44
56
|
`;
|
|
45
57
|
const IconWrapper = styled_components_1.default.div `
|
|
46
58
|
display: flex;
|
|
@@ -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
|
`;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ExpandableSection = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
10
|
+
const icons_1 = require("./icons");
|
|
11
|
+
const ExpandableSection = ({ title, children, defaultOpen = true, bordered = false, }) => {
|
|
12
|
+
const [open, setOpen] = (0, react_1.useState)(defaultOpen);
|
|
13
|
+
const handleKeyDown = (e) => {
|
|
14
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
15
|
+
e.preventDefault();
|
|
16
|
+
setOpen((prev) => !prev);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
return ((0, jsx_runtime_1.jsxs)(Container, { bordered: bordered, children: [(0, jsx_runtime_1.jsxs)(Header, { onClick: () => setOpen((prev) => !prev), onKeyDown: handleKeyDown, tabIndex: 0, role: "button", "aria-expanded": open, children: [(0, jsx_runtime_1.jsx)(Title, { children: title }), (0, jsx_runtime_1.jsx)(ArrowIcon, { open: open })] }), (0, jsx_runtime_1.jsx)(ContentOuter, { open: open, inert: !open || undefined, children: (0, jsx_runtime_1.jsx)(ContentInner, { children: (0, jsx_runtime_1.jsx)("div", { children: children }) }) })] }));
|
|
20
|
+
};
|
|
21
|
+
exports.ExpandableSection = ExpandableSection;
|
|
22
|
+
const Container = styled_components_1.default.div `
|
|
23
|
+
border: ${(props) => props.bordered
|
|
24
|
+
? `1px solid ${props.theme.colors.border.tertiary}`
|
|
25
|
+
: 'none'};
|
|
26
|
+
border-radius: ${(props) => props.theme.grid.radius.default};
|
|
27
|
+
background: ${(props) => props.theme.colors.background.primary};
|
|
28
|
+
`;
|
|
29
|
+
const Header = styled_components_1.default.div `
|
|
30
|
+
display: flex;
|
|
31
|
+
justify-content: space-between;
|
|
32
|
+
align-items: center;
|
|
33
|
+
padding: ${(props) => props.theme.grid.unit * 4}px;
|
|
34
|
+
cursor: pointer;
|
|
35
|
+
font-weight: ${(props) => props.theme.font.weight.semibold};
|
|
36
|
+
`;
|
|
37
|
+
const Title = styled_components_1.default.span `
|
|
38
|
+
font-size: ${(props) => props.theme.font.size.medium};
|
|
39
|
+
color: ${(props) => props.theme.colors.text.primary};
|
|
40
|
+
`;
|
|
41
|
+
const ArrowIcon = (0, styled_components_1.default)(icons_1.ArrowDownCircleIcon) `
|
|
42
|
+
transition: transform 0.25s ease;
|
|
43
|
+
transform: rotate(${(props) => (props.open ? '180deg' : '0deg')});
|
|
44
|
+
`;
|
|
45
|
+
const ContentOuter = styled_components_1.default.div `
|
|
46
|
+
display: grid;
|
|
47
|
+
grid-template-rows: ${(props) => (props.open ? '1fr' : '0fr')};
|
|
48
|
+
overflow: ${(props) => (props.open ? 'visible' : 'hidden')};
|
|
49
|
+
transition: grid-template-rows 0.25s ease,
|
|
50
|
+
overflow 0s ${(props) => (props.open ? '0.25s' : '0s')} allow-discrete;
|
|
51
|
+
`;
|
|
52
|
+
const ContentInner = styled_components_1.default.div `
|
|
53
|
+
overflow: visible;
|
|
54
|
+
min-height: 0;
|
|
55
|
+
`;
|
|
@@ -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,
|
|
@@ -18,7 +18,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
18
18
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
19
|
};
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.SecondarySmallText = exports.PrimarySmallText = exports.SecondaryBoldHeading = exports.PrimaryBoldHeading = void 0;
|
|
21
|
+
exports.SectionTitle = exports.SecondarySmallText = exports.PrimarySmallText = exports.SecondaryBoldHeading = exports.PrimaryBoldHeading = void 0;
|
|
22
22
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
23
23
|
exports.PrimaryBoldHeading = styled_components_1.default.div `
|
|
24
24
|
font-family: ${(props) => props.theme.font.family.sans};
|
|
@@ -41,3 +41,9 @@ exports.PrimarySmallText = styled_components_1.default.div `
|
|
|
41
41
|
exports.SecondarySmallText = (0, styled_components_1.default)(exports.PrimarySmallText) `
|
|
42
42
|
color: ${(props) => props.theme.colors.text.secondary};
|
|
43
43
|
`;
|
|
44
|
+
exports.SectionTitle = styled_components_1.default.div `
|
|
45
|
+
font-size: ${(props) => props.theme.font.size.medium};
|
|
46
|
+
font-weight: ${(props) => props.theme.font.weight.semibold};
|
|
47
|
+
color: ${(props) => props.theme.colors.text.primary};
|
|
48
|
+
padding-bottom: ${(props) => props.theme.grid.unit * 4}px;
|
|
49
|
+
`;
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.XIcon = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const XIcon = (props) => ((0, jsx_runtime_1.
|
|
5
|
+
const XIcon = ({ fill = '#353535', ...props }) => ((0, jsx_runtime_1.jsxs)("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [(0, jsx_runtime_1.jsx)("path", { d: "M9.89853 0.833309C10.293 0.439192 10.9322 0.439008 11.3266 0.833309C11.7209 1.22764 11.7207 1.86688 11.3266 2.26133L2.50153 11.0864C2.1071 11.4808 1.46793 11.4808 1.07351 11.0864C0.679117 10.6919 0.679116 10.0528 1.07351 9.65833L9.89853 0.833309Z", fill: fill, stroke: fill, "stroke-width": "0.1" }), (0, jsx_runtime_1.jsx)("path", { d: "M9.89853 11.0867C10.293 11.4808 10.9322 11.481 11.3266 11.0867C11.7209 10.6924 11.7207 10.0531 11.3266 9.65868L2.50153 0.833656C2.1071 0.439254 1.46793 0.439236 1.07351 0.833656C0.679117 1.22808 0.679116 1.86726 1.07351 2.26168L9.89853 11.0867Z", fill: fill, stroke: fill, "stroke-width": "0.1" })] }));
|
|
6
6
|
exports.XIcon = XIcon;
|
|
7
7
|
exports.default = exports.XIcon;
|
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: {
|
package/dist/cjs/index.js
CHANGED
|
@@ -51,7 +51,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
51
51
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
52
52
|
};
|
|
53
53
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
-
exports.
|
|
54
|
+
exports.StyledRadioGroup = exports.defaultTheme = exports.colors = void 0;
|
|
55
55
|
exports.colors = __importStar(require("./colors"));
|
|
56
56
|
var defaultTheme_1 = require("./defaultTheme");
|
|
57
57
|
Object.defineProperty(exports, "defaultTheme", { enumerable: true, get: function () { return defaultTheme_1.defaultTheme; } });
|
|
@@ -76,13 +76,9 @@ __exportStar(require("./components/TextField"), exports);
|
|
|
76
76
|
__exportStar(require("./components/FormFieldContainer"), exports);
|
|
77
77
|
__exportStar(require("./components/FormCommon"), exports);
|
|
78
78
|
__exportStar(require("./components/ToggleSwitch"), exports);
|
|
79
|
-
var ToggleHeader_1 = require("./components/ToggleHeader");
|
|
80
|
-
Object.defineProperty(exports, "ToggleHeader", { enumerable: true, get: function () { return ToggleHeader_1.ToggleHeader; } });
|
|
81
|
-
Object.defineProperty(exports, "ToggleIcon", { enumerable: true, get: function () { return ToggleHeader_1.ToggleIcon; } });
|
|
82
79
|
__exportStar(require("./components/Tooltip"), exports);
|
|
83
80
|
__exportStar(require("./components/icons"), exports);
|
|
84
81
|
__exportStar(require("./components/Inspector"), exports);
|
|
85
|
-
__exportStar(require("./components/InspectorSection"), exports);
|
|
86
82
|
__exportStar(require("./components/Badge"), exports);
|
|
87
83
|
__exportStar(require("./components/NavDropdown"), exports);
|
|
88
84
|
__exportStar(require("./components/Dropdown"), exports);
|
|
@@ -95,6 +91,7 @@ __exportStar(require("./components/Drawer"), exports);
|
|
|
95
91
|
__exportStar(require("./components/DatePicker"), exports);
|
|
96
92
|
__exportStar(require("./components/SelectField"), exports);
|
|
97
93
|
__exportStar(require("./components/SelectedItemsBox"), exports);
|
|
94
|
+
__exportStar(require("./components/ExpandableSection"), exports);
|
|
98
95
|
__exportStar(require("./hooks/use-dropdown"), exports);
|
|
99
96
|
__exportStar(require("./hooks/use-menus"), exports);
|
|
100
97
|
__exportStar(require("./hooks/use-scroll-detection"), exports);
|
|
@@ -15,12 +15,9 @@ export const AlertMessage = ({ title, message, variant, link, closeConfig, class
|
|
|
15
15
|
const AlertIcon = variantIcons[variant];
|
|
16
16
|
const handleClose = () => {
|
|
17
17
|
setIsOpen(false);
|
|
18
|
-
closeConfig?.onClick?.();
|
|
18
|
+
setTimeout(() => closeConfig?.onClick?.(), 175);
|
|
19
19
|
};
|
|
20
|
-
|
|
21
|
-
return null;
|
|
22
|
-
}
|
|
23
|
-
return (_jsxs(Alert, { "$variant": variant, className: className, children: [_jsx(IconWrapper, { "$hasTitle": !!title, children: _jsx(AlertIcon, {}) }), _jsxs(Content, { children: [title && _jsx(Title, { children: title }), _jsxs(MessageRow, { children: [_jsx(Message, { children: message }), link && (_jsx(ActionLink, { type: "button", onClick: link.onClick, children: link.label }))] })] }), closeConfig && (_jsx(AlertCloseAction, { closeConfig: closeConfig, onClose: handleClose }))] }));
|
|
20
|
+
return (_jsxs(Alert, { "$variant": variant, className: className, "data-open": isOpen ? '' : undefined, children: [_jsx(IconWrapper, { "$hasTitle": !!title, children: _jsx(AlertIcon, {}) }), _jsxs(Content, { children: [title && _jsx(Title, { children: title }), _jsxs(MessageRow, { children: [_jsx(Message, { children: message }), link && (_jsx(ActionLink, { type: "button", onClick: link.onClick, children: link.label }))] })] }), closeConfig && (_jsx(AlertCloseAction, { closeConfig: closeConfig, onClose: handleClose }))] }));
|
|
24
21
|
};
|
|
25
22
|
const Alert = styled.div `
|
|
26
23
|
align-items: center;
|
|
@@ -34,6 +31,21 @@ const Alert = styled.div `
|
|
|
34
31
|
${(props) => props.theme.font.family.Lato};
|
|
35
32
|
gap: ${(props) => props.theme.grid.unit * 3}px;
|
|
36
33
|
padding: ${(props) => props.theme.grid.unit * 3}px;
|
|
34
|
+
opacity: 1;
|
|
35
|
+
transition:
|
|
36
|
+
opacity 200ms ease-out,
|
|
37
|
+
display 200ms allow-discrete;
|
|
38
|
+
|
|
39
|
+
&:not([data-open]) {
|
|
40
|
+
display: none;
|
|
41
|
+
opacity: 0;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@starting-style {
|
|
45
|
+
&[data-open] {
|
|
46
|
+
opacity: 0;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
37
49
|
`;
|
|
38
50
|
const IconWrapper = styled.div `
|
|
39
51
|
display: flex;
|
|
@@ -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
|
`;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { ArrowDownCircleIcon } from './icons';
|
|
5
|
+
export const ExpandableSection = ({ title, children, defaultOpen = true, bordered = false, }) => {
|
|
6
|
+
const [open, setOpen] = useState(defaultOpen);
|
|
7
|
+
const handleKeyDown = (e) => {
|
|
8
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
9
|
+
e.preventDefault();
|
|
10
|
+
setOpen((prev) => !prev);
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
return (_jsxs(Container, { bordered: bordered, children: [_jsxs(Header, { onClick: () => setOpen((prev) => !prev), onKeyDown: handleKeyDown, tabIndex: 0, role: "button", "aria-expanded": open, children: [_jsx(Title, { children: title }), _jsx(ArrowIcon, { open: open })] }), _jsx(ContentOuter, { open: open, inert: !open || undefined, children: _jsx(ContentInner, { children: _jsx("div", { children: children }) }) })] }));
|
|
14
|
+
};
|
|
15
|
+
const Container = styled.div `
|
|
16
|
+
border: ${(props) => props.bordered
|
|
17
|
+
? `1px solid ${props.theme.colors.border.tertiary}`
|
|
18
|
+
: 'none'};
|
|
19
|
+
border-radius: ${(props) => props.theme.grid.radius.default};
|
|
20
|
+
background: ${(props) => props.theme.colors.background.primary};
|
|
21
|
+
`;
|
|
22
|
+
const Header = styled.div `
|
|
23
|
+
display: flex;
|
|
24
|
+
justify-content: space-between;
|
|
25
|
+
align-items: center;
|
|
26
|
+
padding: ${(props) => props.theme.grid.unit * 4}px;
|
|
27
|
+
cursor: pointer;
|
|
28
|
+
font-weight: ${(props) => props.theme.font.weight.semibold};
|
|
29
|
+
`;
|
|
30
|
+
const Title = styled.span `
|
|
31
|
+
font-size: ${(props) => props.theme.font.size.medium};
|
|
32
|
+
color: ${(props) => props.theme.colors.text.primary};
|
|
33
|
+
`;
|
|
34
|
+
const ArrowIcon = styled(ArrowDownCircleIcon) `
|
|
35
|
+
transition: transform 0.25s ease;
|
|
36
|
+
transform: rotate(${(props) => (props.open ? '180deg' : '0deg')});
|
|
37
|
+
`;
|
|
38
|
+
const ContentOuter = styled.div `
|
|
39
|
+
display: grid;
|
|
40
|
+
grid-template-rows: ${(props) => (props.open ? '1fr' : '0fr')};
|
|
41
|
+
overflow: ${(props) => (props.open ? 'visible' : 'hidden')};
|
|
42
|
+
transition: grid-template-rows 0.25s ease,
|
|
43
|
+
overflow 0s ${(props) => (props.open ? '0.25s' : '0s')} allow-discrete;
|
|
44
|
+
`;
|
|
45
|
+
const ContentInner = styled.div `
|
|
46
|
+
overflow: visible;
|
|
47
|
+
min-height: 0;
|
|
48
|
+
`;
|
|
@@ -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,
|
|
@@ -35,3 +35,9 @@ export const PrimarySmallText = styled.div `
|
|
|
35
35
|
export const SecondarySmallText = styled(PrimarySmallText) `
|
|
36
36
|
color: ${(props) => props.theme.colors.text.secondary};
|
|
37
37
|
`;
|
|
38
|
+
export const SectionTitle = styled.div `
|
|
39
|
+
font-size: ${(props) => props.theme.font.size.medium};
|
|
40
|
+
font-weight: ${(props) => props.theme.font.weight.semibold};
|
|
41
|
+
color: ${(props) => props.theme.colors.text.primary};
|
|
42
|
+
padding-bottom: ${(props) => props.theme.grid.unit * 4}px;
|
|
43
|
+
`;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
export const XIcon = (props) => (
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
export const XIcon = ({ fill = '#353535', ...props }) => (_jsxs("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [_jsx("path", { d: "M9.89853 0.833309C10.293 0.439192 10.9322 0.439008 11.3266 0.833309C11.7209 1.22764 11.7207 1.86688 11.3266 2.26133L2.50153 11.0864C2.1071 11.4808 1.46793 11.4808 1.07351 11.0864C0.679117 10.6919 0.679116 10.0528 1.07351 9.65833L9.89853 0.833309Z", fill: fill, stroke: fill, "stroke-width": "0.1" }), _jsx("path", { d: "M9.89853 11.0867C10.293 11.4808 10.9322 11.481 11.3266 11.0867C11.7209 10.6924 11.7207 10.0531 11.3266 9.65868L2.50153 0.833656C2.1071 0.439254 1.46793 0.439236 1.07351 0.833656C0.679117 1.22808 0.679116 1.86726 1.07351 2.26168L9.89853 11.0867Z", fill: fill, stroke: fill, "stroke-width": "0.1" })] }));
|
|
3
3
|
export default XIcon;
|
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: {
|
package/dist/es/index.js
CHANGED
|
@@ -35,11 +35,9 @@ export * from './components/TextField';
|
|
|
35
35
|
export * from './components/FormFieldContainer';
|
|
36
36
|
export * from './components/FormCommon';
|
|
37
37
|
export * from './components/ToggleSwitch';
|
|
38
|
-
export { ToggleHeader, ToggleIcon } from './components/ToggleHeader';
|
|
39
38
|
export * from './components/Tooltip';
|
|
40
39
|
export * from './components/icons';
|
|
41
40
|
export * from './components/Inspector';
|
|
42
|
-
export * from './components/InspectorSection';
|
|
43
41
|
export * from './components/Badge';
|
|
44
42
|
export * from './components/NavDropdown';
|
|
45
43
|
export * from './components/Dropdown';
|
|
@@ -52,6 +50,7 @@ export * from './components/Drawer';
|
|
|
52
50
|
export * from './components/DatePicker';
|
|
53
51
|
export * from './components/SelectField';
|
|
54
52
|
export * from './components/SelectedItemsBox';
|
|
53
|
+
export * from './components/ExpandableSection';
|
|
55
54
|
export * from './hooks/use-dropdown';
|
|
56
55
|
export * from './hooks/use-menus';
|
|
57
56
|
export * from './hooks/use-scroll-detection';
|
|
@@ -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 {};
|
|
@@ -17,3 +17,4 @@ export declare const PrimaryBoldHeading: import("styled-components").StyledCompo
|
|
|
17
17
|
export declare const SecondaryBoldHeading: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
18
18
|
export declare const PrimarySmallText: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
19
19
|
export declare const SecondarySmallText: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
20
|
+
export declare const SectionTitle: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -36,11 +36,9 @@ export * from './components/TextField';
|
|
|
36
36
|
export * from './components/FormFieldContainer';
|
|
37
37
|
export * from './components/FormCommon';
|
|
38
38
|
export * from './components/ToggleSwitch';
|
|
39
|
-
export { ToggleHeader, ToggleIcon } from './components/ToggleHeader';
|
|
40
39
|
export * from './components/Tooltip';
|
|
41
40
|
export * from './components/icons';
|
|
42
41
|
export * from './components/Inspector';
|
|
43
|
-
export * from './components/InspectorSection';
|
|
44
42
|
export * from './components/Badge';
|
|
45
43
|
export * from './components/NavDropdown';
|
|
46
44
|
export * from './components/Dropdown';
|
|
@@ -53,6 +51,7 @@ export * from './components/Drawer';
|
|
|
53
51
|
export * from './components/DatePicker';
|
|
54
52
|
export * from './components/SelectField';
|
|
55
53
|
export * from './components/SelectedItemsBox';
|
|
54
|
+
export * from './components/ExpandableSection';
|
|
56
55
|
export * from './hooks/use-dropdown';
|
|
57
56
|
export * from './hooks/use-menus';
|
|
58
57
|
export * from './hooks/use-scroll-detection';
|
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.15",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-style-guide",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.InspectorSection = exports.Field = exports.Subheading = exports.ExpanderButton = void 0;
|
|
7
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
-
const react_1 = require("react");
|
|
9
|
-
const styled_components_1 = __importDefault(require("styled-components"));
|
|
10
|
-
const Button_1 = require("./Button");
|
|
11
|
-
const icons_1 = require("./icons");
|
|
12
|
-
const Section = styled_components_1.default.div `
|
|
13
|
-
font-size: ${(props) => props.theme.font.size.normal};
|
|
14
|
-
`;
|
|
15
|
-
const Heading = styled_components_1.default.div `
|
|
16
|
-
display: flex;
|
|
17
|
-
padding: 0;
|
|
18
|
-
cursor: pointer;
|
|
19
|
-
margin: ${(props) => props.theme.grid.unit * 4}px
|
|
20
|
-
${(props) => props.theme.grid.unit * 6}px
|
|
21
|
-
${(props) => props.marginBottom || '32px'}
|
|
22
|
-
${(props) => props.theme.grid.unit * 6}px;
|
|
23
|
-
`;
|
|
24
|
-
const HeadingText = styled_components_1.default.div `
|
|
25
|
-
font-size: ${(props) => props.theme.font.size.medium};
|
|
26
|
-
font-weight: ${(props) => props.theme.font.weight.semibold};
|
|
27
|
-
color: ${(props) => props.theme.colors.text.primary};
|
|
28
|
-
flex: 1;
|
|
29
|
-
`;
|
|
30
|
-
exports.ExpanderButton = (0, styled_components_1.default)(Button_1.IconButton).attrs(() => ({
|
|
31
|
-
size: 20,
|
|
32
|
-
defaultColor: true,
|
|
33
|
-
})) `
|
|
34
|
-
border: none;
|
|
35
|
-
border-radius: 50%;
|
|
36
|
-
|
|
37
|
-
&:focus,
|
|
38
|
-
&:hover {
|
|
39
|
-
&:not([disabled]) {
|
|
40
|
-
background: ${(props) => props.theme.colors.background.fifth};
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
svg circle {
|
|
45
|
-
stroke: ${(props) => props.theme.colors.border.secondary};
|
|
46
|
-
}
|
|
47
|
-
`;
|
|
48
|
-
exports.Subheading = (0, styled_components_1.default)(HeadingText) `
|
|
49
|
-
font-size: ${(props) => props.theme.font.size.normal};
|
|
50
|
-
font-weight: ${(props) => props.theme.font.weight.normal};
|
|
51
|
-
margin-bottom: ${(props) => props.theme.grid.unit * 3}px;
|
|
52
|
-
|
|
53
|
-
&:not(:first-child) {
|
|
54
|
-
margin-top: ${(props) => props.theme.grid.unit * 6}px;
|
|
55
|
-
}
|
|
56
|
-
`;
|
|
57
|
-
exports.Field = styled_components_1.default.div `
|
|
58
|
-
margin-bottom: ${(props) => props.theme.grid.unit * 4}px;
|
|
59
|
-
`;
|
|
60
|
-
const InspectorSection = ({ title, contentStyles, children, collapsible = true, }) => {
|
|
61
|
-
const [expanded, setExpanded] = (0, react_1.useState)(true);
|
|
62
|
-
return ((0, jsx_runtime_1.jsxs)(Section, { children: [(0, jsx_runtime_1.jsx)(Line, {}), (0, jsx_runtime_1.jsxs)(Heading, { onClick: () => collapsible && setExpanded(!expanded), marginBottom: (!(expanded && children) && '40px') || undefined, style: { cursor: collapsible ? 'pointer' : 'default' }, children: [(0, jsx_runtime_1.jsx)(HeadingText, { children: title }), collapsible && ((0, jsx_runtime_1.jsx)(exports.ExpanderButton, { "aria-label": 'Toggle expand section', onClick: () => setExpanded(!expanded), style: {
|
|
63
|
-
transform: expanded ? 'rotate(0deg)' : 'rotate(180deg)',
|
|
64
|
-
}, children: (0, jsx_runtime_1.jsx)(icons_1.ArrowDownCircleIcon, {}) }))] }), expanded && children && (0, jsx_runtime_1.jsx)("div", { style: contentStyles, children: children })] }));
|
|
65
|
-
};
|
|
66
|
-
exports.InspectorSection = InspectorSection;
|
|
67
|
-
const Line = styled_components_1.default.hr `
|
|
68
|
-
flex: 1;
|
|
69
|
-
border: 1px solid ${(props) => props.theme.colors.border.tertiary};
|
|
70
|
-
background: ${(props) => props.theme.colors.border.tertiary};
|
|
71
|
-
margin: 0 ${(props) => props.theme.grid.unit * 6}px;
|
|
72
|
-
`;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.ToggleIcon = exports.ToggleHeader = void 0;
|
|
7
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
-
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
-
const icons_1 = require("./icons");
|
|
10
|
-
const ToggleHeader = ({ title, isOpen, onToggle, }) => {
|
|
11
|
-
const handleToggle = (e) => {
|
|
12
|
-
e.stopPropagation();
|
|
13
|
-
onToggle();
|
|
14
|
-
};
|
|
15
|
-
const handleKeyDown = (e) => {
|
|
16
|
-
if (e.key === 'Enter') {
|
|
17
|
-
e.preventDefault();
|
|
18
|
-
handleToggle(e);
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
return ((0, jsx_runtime_1.jsxs)(ToggleHeaderContainer, { onClick: handleToggle, children: [(0, jsx_runtime_1.jsx)("span", { children: title }), (0, jsx_runtime_1.jsx)(exports.ToggleIcon, { isOpen: isOpen, onKeyDown: handleKeyDown, tabIndex: 0, children: isOpen ? (0, jsx_runtime_1.jsx)(icons_1.TriangleExpandedIcon, {}) : (0, jsx_runtime_1.jsx)(icons_1.TriangleCollapsedIcon, {}) })] }));
|
|
22
|
-
};
|
|
23
|
-
exports.ToggleHeader = ToggleHeader;
|
|
24
|
-
const ToggleHeaderContainer = styled_components_1.default.div `
|
|
25
|
-
display: flex;
|
|
26
|
-
align-items: center;
|
|
27
|
-
justify-content: space-between;
|
|
28
|
-
padding: 16px;
|
|
29
|
-
color: #353535;
|
|
30
|
-
|
|
31
|
-
cursor: pointer;
|
|
32
|
-
|
|
33
|
-
border-top: 1px solid #f2f2f2;
|
|
34
|
-
|
|
35
|
-
font-size: 16px;
|
|
36
|
-
font-weight: 700;
|
|
37
|
-
font-family: Lato, sans-serif;
|
|
38
|
-
`;
|
|
39
|
-
exports.ToggleIcon = styled_components_1.default.div `
|
|
40
|
-
width: 20px;
|
|
41
|
-
height: 20px;
|
|
42
|
-
border-radius: 50%;
|
|
43
|
-
border: 1px solid #e2e2e2;
|
|
44
|
-
text-align: center;
|
|
45
|
-
cursor: pointer;
|
|
46
|
-
|
|
47
|
-
&:focus-visible {
|
|
48
|
-
outline: 2px solid ${(props) => props.theme.colors.outline.focus};
|
|
49
|
-
outline-offset: 2px;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
svg {
|
|
53
|
-
width: 19px;
|
|
54
|
-
height: 19px;
|
|
55
|
-
transform: rotate(${(props) => (props.isOpen ? '0deg' : '270deg')});
|
|
56
|
-
transition: transform 0.2s ease; // Smooth transition for rotation
|
|
57
|
-
}
|
|
58
|
-
`;
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from 'react';
|
|
3
|
-
import styled from 'styled-components';
|
|
4
|
-
import { IconButton } from './Button';
|
|
5
|
-
import { ArrowDownCircleIcon } from './icons';
|
|
6
|
-
const Section = styled.div `
|
|
7
|
-
font-size: ${(props) => props.theme.font.size.normal};
|
|
8
|
-
`;
|
|
9
|
-
const Heading = styled.div `
|
|
10
|
-
display: flex;
|
|
11
|
-
padding: 0;
|
|
12
|
-
cursor: pointer;
|
|
13
|
-
margin: ${(props) => props.theme.grid.unit * 4}px
|
|
14
|
-
${(props) => props.theme.grid.unit * 6}px
|
|
15
|
-
${(props) => props.marginBottom || '32px'}
|
|
16
|
-
${(props) => props.theme.grid.unit * 6}px;
|
|
17
|
-
`;
|
|
18
|
-
const HeadingText = styled.div `
|
|
19
|
-
font-size: ${(props) => props.theme.font.size.medium};
|
|
20
|
-
font-weight: ${(props) => props.theme.font.weight.semibold};
|
|
21
|
-
color: ${(props) => props.theme.colors.text.primary};
|
|
22
|
-
flex: 1;
|
|
23
|
-
`;
|
|
24
|
-
export const ExpanderButton = styled(IconButton).attrs(() => ({
|
|
25
|
-
size: 20,
|
|
26
|
-
defaultColor: true,
|
|
27
|
-
})) `
|
|
28
|
-
border: none;
|
|
29
|
-
border-radius: 50%;
|
|
30
|
-
|
|
31
|
-
&:focus,
|
|
32
|
-
&:hover {
|
|
33
|
-
&:not([disabled]) {
|
|
34
|
-
background: ${(props) => props.theme.colors.background.fifth};
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
svg circle {
|
|
39
|
-
stroke: ${(props) => props.theme.colors.border.secondary};
|
|
40
|
-
}
|
|
41
|
-
`;
|
|
42
|
-
export const Subheading = styled(HeadingText) `
|
|
43
|
-
font-size: ${(props) => props.theme.font.size.normal};
|
|
44
|
-
font-weight: ${(props) => props.theme.font.weight.normal};
|
|
45
|
-
margin-bottom: ${(props) => props.theme.grid.unit * 3}px;
|
|
46
|
-
|
|
47
|
-
&:not(:first-child) {
|
|
48
|
-
margin-top: ${(props) => props.theme.grid.unit * 6}px;
|
|
49
|
-
}
|
|
50
|
-
`;
|
|
51
|
-
export const Field = styled.div `
|
|
52
|
-
margin-bottom: ${(props) => props.theme.grid.unit * 4}px;
|
|
53
|
-
`;
|
|
54
|
-
export const InspectorSection = ({ title, contentStyles, children, collapsible = true, }) => {
|
|
55
|
-
const [expanded, setExpanded] = useState(true);
|
|
56
|
-
return (_jsxs(Section, { children: [_jsx(Line, {}), _jsxs(Heading, { onClick: () => collapsible && setExpanded(!expanded), marginBottom: (!(expanded && children) && '40px') || undefined, style: { cursor: collapsible ? 'pointer' : 'default' }, children: [_jsx(HeadingText, { children: title }), collapsible && (_jsx(ExpanderButton, { "aria-label": 'Toggle expand section', onClick: () => setExpanded(!expanded), style: {
|
|
57
|
-
transform: expanded ? 'rotate(0deg)' : 'rotate(180deg)',
|
|
58
|
-
}, children: _jsx(ArrowDownCircleIcon, {}) }))] }), expanded && children && _jsx("div", { style: contentStyles, children: children })] }));
|
|
59
|
-
};
|
|
60
|
-
const Line = styled.hr `
|
|
61
|
-
flex: 1;
|
|
62
|
-
border: 1px solid ${(props) => props.theme.colors.border.tertiary};
|
|
63
|
-
background: ${(props) => props.theme.colors.border.tertiary};
|
|
64
|
-
margin: 0 ${(props) => props.theme.grid.unit * 6}px;
|
|
65
|
-
`;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import styled from 'styled-components';
|
|
3
|
-
import { TriangleCollapsedIcon, TriangleExpandedIcon } from './icons';
|
|
4
|
-
export const ToggleHeader = ({ title, isOpen, onToggle, }) => {
|
|
5
|
-
const handleToggle = (e) => {
|
|
6
|
-
e.stopPropagation();
|
|
7
|
-
onToggle();
|
|
8
|
-
};
|
|
9
|
-
const handleKeyDown = (e) => {
|
|
10
|
-
if (e.key === 'Enter') {
|
|
11
|
-
e.preventDefault();
|
|
12
|
-
handleToggle(e);
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
return (_jsxs(ToggleHeaderContainer, { onClick: handleToggle, children: [_jsx("span", { children: title }), _jsx(ToggleIcon, { isOpen: isOpen, onKeyDown: handleKeyDown, tabIndex: 0, children: isOpen ? _jsx(TriangleExpandedIcon, {}) : _jsx(TriangleCollapsedIcon, {}) })] }));
|
|
16
|
-
};
|
|
17
|
-
const ToggleHeaderContainer = styled.div `
|
|
18
|
-
display: flex;
|
|
19
|
-
align-items: center;
|
|
20
|
-
justify-content: space-between;
|
|
21
|
-
padding: 16px;
|
|
22
|
-
color: #353535;
|
|
23
|
-
|
|
24
|
-
cursor: pointer;
|
|
25
|
-
|
|
26
|
-
border-top: 1px solid #f2f2f2;
|
|
27
|
-
|
|
28
|
-
font-size: 16px;
|
|
29
|
-
font-weight: 700;
|
|
30
|
-
font-family: Lato, sans-serif;
|
|
31
|
-
`;
|
|
32
|
-
export const ToggleIcon = styled.div `
|
|
33
|
-
width: 20px;
|
|
34
|
-
height: 20px;
|
|
35
|
-
border-radius: 50%;
|
|
36
|
-
border: 1px solid #e2e2e2;
|
|
37
|
-
text-align: center;
|
|
38
|
-
cursor: pointer;
|
|
39
|
-
|
|
40
|
-
&:focus-visible {
|
|
41
|
-
outline: 2px solid ${(props) => props.theme.colors.outline.focus};
|
|
42
|
-
outline-offset: 2px;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
svg {
|
|
46
|
-
width: 19px;
|
|
47
|
-
height: 19px;
|
|
48
|
-
transform: rotate(${(props) => (props.isOpen ? '0deg' : '270deg')});
|
|
49
|
-
transition: transform 0.2s ease; // Smooth transition for rotation
|
|
50
|
-
}
|
|
51
|
-
`;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* © 2020 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
|
-
*/
|
|
16
|
-
import React, { CSSProperties } from 'react';
|
|
17
|
-
export declare const ExpanderButton: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, {
|
|
18
|
-
type: "button" | "submit" | "reset";
|
|
19
|
-
} & {
|
|
20
|
-
danger?: boolean;
|
|
21
|
-
disabled?: boolean;
|
|
22
|
-
mini?: boolean;
|
|
23
|
-
} & {
|
|
24
|
-
defaultColor?: boolean;
|
|
25
|
-
size?: number;
|
|
26
|
-
iconColor?: string;
|
|
27
|
-
} & {
|
|
28
|
-
size: number;
|
|
29
|
-
defaultColor: boolean;
|
|
30
|
-
}, "type" | "defaultColor" | "size">;
|
|
31
|
-
export declare const Subheading: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
32
|
-
export declare const Field: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
33
|
-
interface Props {
|
|
34
|
-
title: React.ReactNode;
|
|
35
|
-
contentStyles?: CSSProperties;
|
|
36
|
-
children?: React.ReactNode;
|
|
37
|
-
collapsible?: boolean;
|
|
38
|
-
}
|
|
39
|
-
export declare const InspectorSection: React.FC<Props>;
|
|
40
|
-
export {};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* © 2025 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
|
-
*/
|
|
16
|
-
import React from 'react';
|
|
17
|
-
interface SectionHeaderProps {
|
|
18
|
-
title: string;
|
|
19
|
-
isOpen: boolean;
|
|
20
|
-
onToggle: () => void;
|
|
21
|
-
}
|
|
22
|
-
export declare const ToggleHeader: React.FC<SectionHeaderProps>;
|
|
23
|
-
export declare const ToggleIcon: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
|
|
24
|
-
isOpen: boolean;
|
|
25
|
-
}, never>;
|
|
26
|
-
export {};
|