@manuscripts/style-guide 3.6.1 → 3.6.3
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/Avatar.js +10 -10
- package/dist/cjs/components/Button.js +16 -16
- package/dist/cjs/components/Checkbox.js +2 -2
- package/dist/cjs/components/ContextMenu.js +1 -1
- package/dist/cjs/components/DateInput.js +3 -3
- package/dist/cjs/components/Dialog.js +1 -1
- package/dist/cjs/components/Drawer.js +2 -2
- package/dist/cjs/components/Dropdown.js +7 -5
- package/dist/cjs/components/ExpandableSection.js +5 -5
- package/dist/cjs/components/Form.js +4 -4
- package/dist/cjs/components/Menus/Menus.js +4 -4
- package/dist/cjs/components/Menus/Submenu.js +2 -2
- package/dist/cjs/components/MultiValueInput.js +6 -2
- package/dist/cjs/components/NavDropdown.js +8 -10
- package/dist/cjs/components/Resizer/ResizerButton.js +1 -1
- package/dist/cjs/components/Resizer/ResizerButtonInner.js +9 -9
- package/dist/cjs/components/SelectedItemsBox.js +3 -3
- package/dist/cjs/components/StyledModal.js +7 -7
- package/dist/cjs/components/SystemUserAvatar.js +5 -5
- package/dist/cjs/components/TextField.js +8 -8
- package/dist/cjs/components/ToggleSwitch.js +7 -7
- package/dist/es/components/Avatar.js +10 -10
- package/dist/es/components/Button.js +16 -16
- package/dist/es/components/Checkbox.js +2 -2
- package/dist/es/components/ContextMenu.js +1 -1
- package/dist/es/components/DateInput.js +3 -3
- package/dist/es/components/Dialog.js +1 -1
- package/dist/es/components/Drawer.js +2 -2
- package/dist/es/components/Dropdown.js +7 -5
- package/dist/es/components/ExpandableSection.js +5 -5
- package/dist/es/components/Form.js +4 -4
- package/dist/es/components/Menus/Menus.js +4 -4
- package/dist/es/components/Menus/Submenu.js +2 -2
- package/dist/es/components/MultiValueInput.js +7 -3
- package/dist/es/components/NavDropdown.js +8 -10
- package/dist/es/components/Resizer/ResizerButton.js +1 -1
- package/dist/es/components/Resizer/ResizerButtonInner.js +9 -9
- package/dist/es/components/SelectedItemsBox.js +3 -3
- package/dist/es/components/StyledModal.js +7 -7
- package/dist/es/components/SystemUserAvatar.js +5 -5
- package/dist/es/components/TextField.js +8 -8
- package/dist/es/components/ToggleSwitch.js +7 -7
- package/dist/types/components/Button.d.ts +36 -47
- package/dist/types/components/Checkbox.d.ts +1 -1
- package/dist/types/components/DateInput.d.ts +2 -2
- package/dist/types/components/Dropdown.d.ts +5 -7
- package/dist/types/components/Form.d.ts +3 -3
- package/dist/types/components/NavDropdown.d.ts +9 -12
- package/dist/types/components/Resizer/ResizerButtonInner.d.ts +2 -2
- package/dist/types/components/StyledModal.d.ts +8 -9
- package/dist/types/components/TextField.d.ts +2 -2
- package/package.json +1 -1
|
@@ -39,7 +39,7 @@ const formik_1 = require("formik");
|
|
|
39
39
|
const styled_components_1 = __importStar(require("styled-components"));
|
|
40
40
|
exports.commonStyles = (0, styled_components_1.css) `
|
|
41
41
|
border: 1px solid
|
|
42
|
-
${(props) => props
|
|
42
|
+
${(props) => props.$error
|
|
43
43
|
? props.theme.colors.border.error
|
|
44
44
|
: props.theme.colors.border.field.default};
|
|
45
45
|
border-radius: 3px;
|
|
@@ -50,19 +50,19 @@ exports.commonStyles = (0, styled_components_1.css) `
|
|
|
50
50
|
line-height: ${(props) => props.theme.font.lineHeight.large};
|
|
51
51
|
outline: none;
|
|
52
52
|
padding: ${(props) => {
|
|
53
|
-
if (props
|
|
53
|
+
if (props.$variant === 'small') {
|
|
54
54
|
return '0 12px';
|
|
55
55
|
}
|
|
56
|
-
if (props
|
|
56
|
+
if (props.$variant === 'large') {
|
|
57
57
|
return '4px 16px';
|
|
58
58
|
}
|
|
59
59
|
return '0 12px';
|
|
60
60
|
}};
|
|
61
61
|
min-height: ${(props) => {
|
|
62
|
-
if (props
|
|
62
|
+
if (props.$variant === 'small') {
|
|
63
63
|
return '32px';
|
|
64
64
|
}
|
|
65
|
-
if (props
|
|
65
|
+
if (props.$variant === 'large') {
|
|
66
66
|
return '40px';
|
|
67
67
|
}
|
|
68
68
|
return '40px';
|
|
@@ -89,13 +89,13 @@ exports.commonStyles = (0, styled_components_1.css) `
|
|
|
89
89
|
|
|
90
90
|
&:focus:not(:disabled) {
|
|
91
91
|
border: 2px solid
|
|
92
|
-
${(props) => props
|
|
92
|
+
${(props) => props.$error
|
|
93
93
|
? props.theme.colors.border.error
|
|
94
94
|
: props.theme.colors.brand.default};
|
|
95
95
|
background-color: #f2fbfc;
|
|
96
|
-
${(props) => props
|
|
96
|
+
${(props) => props.$variant &&
|
|
97
97
|
(0, styled_components_1.css) `
|
|
98
|
-
padding: ${(props) => props
|
|
98
|
+
padding: ${(props) => props.$variant === 'small' ? '0 11px' : '3px 15px'};
|
|
99
99
|
`}
|
|
100
100
|
}
|
|
101
101
|
|
|
@@ -12,8 +12,8 @@ const Track = styled_components_1.default.button `
|
|
|
12
12
|
height: 16px;
|
|
13
13
|
border-radius: 999px;
|
|
14
14
|
border: 1px solid
|
|
15
|
-
${(props) => props
|
|
16
|
-
background: ${(props) => props
|
|
15
|
+
${(props) => props.$checked ? '#0d79d0' : props.theme.colors.text.secondary};
|
|
16
|
+
background: ${(props) => props.$checked ? '#0d79d0' : props.theme.colors.text.secondary};
|
|
17
17
|
padding: 0;
|
|
18
18
|
cursor: ${(props) => (props.disabled ? 'not-allowed' : 'pointer')};
|
|
19
19
|
transition:
|
|
@@ -35,7 +35,7 @@ const Track = styled_components_1.default.button `
|
|
|
35
35
|
const Thumb = styled_components_1.default.span `
|
|
36
36
|
position: absolute;
|
|
37
37
|
top: 0;
|
|
38
|
-
left: ${(props) => (props
|
|
38
|
+
left: ${(props) => (props.$checked ? '14px' : '0px')};
|
|
39
39
|
width: 14px;
|
|
40
40
|
height: 14px;
|
|
41
41
|
border-radius: 50%;
|
|
@@ -43,14 +43,14 @@ const Thumb = styled_components_1.default.span `
|
|
|
43
43
|
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
|
|
44
44
|
transition: left 120ms ease;
|
|
45
45
|
|
|
46
|
-
${(props) => props
|
|
46
|
+
${(props) => props.$disabled &&
|
|
47
47
|
`
|
|
48
48
|
background: #fdfdfd;
|
|
49
49
|
box-shadow: none;
|
|
50
50
|
`}
|
|
51
51
|
`;
|
|
52
52
|
const LabelText = styled_components_1.default.span `
|
|
53
|
-
color: ${(props) => props
|
|
53
|
+
color: ${(props) => props.$disabled ? '#b3b3b3' : props.theme.colors.text.primary};
|
|
54
54
|
font: ${(props) => props.theme.font.weight.normal}
|
|
55
55
|
${(props) => props.theme.font.size.medium} / 1
|
|
56
56
|
${(props) => props.theme.font.family.sans};
|
|
@@ -61,9 +61,9 @@ const Container = styled_components_1.default.label `
|
|
|
61
61
|
align-items: center;
|
|
62
62
|
gap: 8px;
|
|
63
63
|
cursor: pointer;
|
|
64
|
-
flex-direction: ${(props) => props
|
|
64
|
+
flex-direction: ${(props) => props.$labelPosition === 'left' ? 'row' : 'row-reverse'};
|
|
65
65
|
`;
|
|
66
66
|
const ToggleSwitch = ({ checked, disabled, onChange, label, id, labelPosition = 'left', }) => {
|
|
67
|
-
return ((0, jsx_runtime_1.jsxs)(Container, { labelPosition: labelPosition, children: [label && (0, jsx_runtime_1.jsx)(LabelText, { disabled: disabled, children: label }), (0, jsx_runtime_1.jsx)(Track, { id: id, type: "button", role: "switch", "aria-checked": checked, "aria-label": label, checked: checked, disabled: disabled, onClick: () => !disabled && onChange(!checked), children: (0, jsx_runtime_1.jsx)(Thumb, { checked: checked, disabled: disabled }) })] }));
|
|
67
|
+
return ((0, jsx_runtime_1.jsxs)(Container, { "$labelPosition": labelPosition, children: [label && (0, jsx_runtime_1.jsx)(LabelText, { "$disabled": disabled, children: label }), (0, jsx_runtime_1.jsx)(Track, { id: id, type: "button", role: "switch", "aria-checked": checked, "aria-label": label, "$checked": checked, disabled: disabled, onClick: () => !disabled && onChange(!checked), children: (0, jsx_runtime_1.jsx)(Thumb, { "$checked": checked, "$disabled": disabled }) })] }));
|
|
68
68
|
};
|
|
69
69
|
exports.ToggleSwitch = ToggleSwitch;
|
|
@@ -24,32 +24,32 @@ const AvatarContainer = styled.div `
|
|
|
24
24
|
align-items: center;
|
|
25
25
|
justify-content: center;
|
|
26
26
|
position: relative;
|
|
27
|
-
opacity: ${(props) => props
|
|
27
|
+
opacity: ${(props) => props.$opacity};
|
|
28
28
|
`;
|
|
29
29
|
const RoundedImage = styled.img `
|
|
30
|
-
width: ${(props) => props
|
|
31
|
-
height: ${(props) => props
|
|
30
|
+
width: ${(props) => props.$size}px;
|
|
31
|
+
height: ${(props) => props.$size}px;
|
|
32
32
|
border-radius: 50%;
|
|
33
33
|
align-items: center;
|
|
34
34
|
justify-content: center;
|
|
35
35
|
`;
|
|
36
36
|
const StyledAvatar = styled(ProfileIcon) `
|
|
37
37
|
path {
|
|
38
|
-
fill: ${(props) => props
|
|
38
|
+
fill: ${(props) => props.$color || props.theme.colors.text.secondary};
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
&:hover path {
|
|
42
|
-
fill: ${(props) => props
|
|
42
|
+
fill: ${(props) => props.$color || props.theme.colors.text.info};
|
|
43
43
|
}
|
|
44
44
|
`;
|
|
45
45
|
const InitialsCircle = styled.div `
|
|
46
|
-
width: ${(props) => props
|
|
47
|
-
height: ${(props) => props
|
|
46
|
+
width: ${(props) => props.$size}px;
|
|
47
|
+
height: ${(props) => props.$size}px;
|
|
48
48
|
border-radius: 50%;
|
|
49
|
-
background: ${(props) => props
|
|
49
|
+
background: ${(props) => props.$bg};
|
|
50
50
|
color: #ffffff;
|
|
51
51
|
font-weight: bold;
|
|
52
|
-
font-size: ${(props) => Math.round(props
|
|
52
|
+
font-size: ${(props) => Math.round(props.$size * 0.4)}px;
|
|
53
53
|
display: flex;
|
|
54
54
|
align-items: center;
|
|
55
55
|
justify-content: center;
|
|
@@ -62,5 +62,5 @@ export const Avatar = (props) => {
|
|
|
62
62
|
setSrcError(true);
|
|
63
63
|
}, []);
|
|
64
64
|
const showInitials = (!props.src || srcError) && !!props.name;
|
|
65
|
-
return (_jsx(AvatarContainer, { opacity: props.opacity || 1, children: props.src && !srcError ? (_jsx(RoundedImage, { src: props.src, size: props.size, onError: handleSrcError })) : showInitials ? (_jsx(InitialsCircle, { size: props.size, bg: INITIALS_PALETTE[props.name.charCodeAt(0) % INITIALS_PALETTE.length], children: getInitials(props.name) })) : (_jsx(StyledAvatar, { height: props.size, width: props.size, color: props.color })) }));
|
|
65
|
+
return (_jsx(AvatarContainer, { "$opacity": props.opacity || 1, children: props.src && !srcError ? (_jsx(RoundedImage, { src: props.src, "$size": props.size, onError: handleSrcError })) : showInitials ? (_jsx(InitialsCircle, { "$size": props.size, "$bg": INITIALS_PALETTE[props.name.charCodeAt(0) % INITIALS_PALETTE.length], children: getInitials(props.name) })) : (_jsx(StyledAvatar, { height: props.size, width: props.size, "$color": props.color })) }));
|
|
66
66
|
};
|
|
@@ -68,10 +68,10 @@ const btnStyles = css `
|
|
|
68
68
|
margin-left: ${(props) => props.theme.grid.unit}px;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
${(props) => props
|
|
72
|
-
${(props) => props
|
|
71
|
+
${(props) => props.$danger && dangerBtnStyles}
|
|
72
|
+
${(props) => props.$mini && miniBtnStyles}
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
&:disabled {
|
|
75
75
|
${disabledBtnStyles}
|
|
76
76
|
}
|
|
77
77
|
|
|
@@ -141,8 +141,8 @@ export const IconTextButton = styled(ButtonTemplate) `
|
|
|
141
141
|
`;
|
|
142
142
|
export const ToggleButton = styled(ButtonTemplate) `
|
|
143
143
|
color: ${(props) => props.theme.colors.text.primary};
|
|
144
|
-
background-color: ${(props) => props
|
|
145
|
-
border-color: ${(props) => props
|
|
144
|
+
background-color: ${(props) => props.$selected ? props.theme.colors.background.fifth : 'transparent'};
|
|
145
|
+
border-color: ${(props) => props.$selected
|
|
146
146
|
? props.theme.colors.border.primary
|
|
147
147
|
: props.theme.colors.border.secondary};
|
|
148
148
|
|
|
@@ -164,14 +164,14 @@ export const ToggleButton = styled(ButtonTemplate) `
|
|
|
164
164
|
|
|
165
165
|
svg {
|
|
166
166
|
path[stroke] {
|
|
167
|
-
stroke: ${(props) => props
|
|
167
|
+
stroke: ${(props) => props.$selected
|
|
168
168
|
? props.theme.colors.brand.medium
|
|
169
169
|
: props.theme.colors.text.primary};
|
|
170
170
|
}
|
|
171
171
|
text[fill],
|
|
172
172
|
rect[fill],
|
|
173
173
|
path[fill] {
|
|
174
|
-
fill: ${(props) => props
|
|
174
|
+
fill: ${(props) => props.$selected
|
|
175
175
|
? props.theme.colors.brand.medium
|
|
176
176
|
: props.theme.colors.text.primary};
|
|
177
177
|
}
|
|
@@ -183,7 +183,7 @@ export const ToggleButtonAlt = styled(ButtonTemplate) `
|
|
|
183
183
|
border: none;
|
|
184
184
|
border-bottom: 1px solid transparent;
|
|
185
185
|
border-radius: 0;
|
|
186
|
-
${(props) => props
|
|
186
|
+
${(props) => props.$selected && 'border-color: ' + props.theme.colors.border.info};
|
|
187
187
|
|
|
188
188
|
font-size: ${(props) => props.theme.font.size.normal};
|
|
189
189
|
padding: 0 ${(props) => props.theme.grid.unit}px;
|
|
@@ -205,21 +205,21 @@ const svgColors = css `
|
|
|
205
205
|
|
|
206
206
|
svg {
|
|
207
207
|
path[stroke] {
|
|
208
|
-
stroke: ${(props) => props
|
|
208
|
+
stroke: ${(props) => props.$iconColor || 'currentColor'};
|
|
209
209
|
}
|
|
210
210
|
text[fill],
|
|
211
211
|
rect[fill],
|
|
212
212
|
path[fill] {
|
|
213
|
-
fill: ${(props) => props
|
|
213
|
+
fill: ${(props) => props.$iconColor || 'currentColor'};
|
|
214
214
|
}
|
|
215
215
|
}
|
|
216
216
|
`;
|
|
217
217
|
const IconButtonTemplate = styled(ButtonTemplate) `
|
|
218
218
|
padding: 0;
|
|
219
|
-
height: ${(props) => props
|
|
220
|
-
width: ${(props) => props
|
|
219
|
+
height: ${(props) => props.$size || 40}px;
|
|
220
|
+
width: ${(props) => props.$size || 40}px;
|
|
221
221
|
|
|
222
|
-
${(props) => !props
|
|
222
|
+
${(props) => !props.$defaultColor && svgColors}
|
|
223
223
|
`;
|
|
224
224
|
export const IconButton = styled(IconButtonTemplate) `
|
|
225
225
|
${(props) => btnColors(props.theme.colors.text.primary, props.theme.colors.button.default.background.default, props.theme.colors.button.default.border.default, false)}
|
|
@@ -233,7 +233,7 @@ export const IconButton = styled(IconButtonTemplate) `
|
|
|
233
233
|
}
|
|
234
234
|
`;
|
|
235
235
|
export const RoundIconButton = styled(IconButton).attrs((props) => ({
|
|
236
|
-
defaultColor: true,
|
|
236
|
+
$defaultColor: true,
|
|
237
237
|
})) `
|
|
238
238
|
background: ${(props) => props.theme.colors.background.primary};
|
|
239
239
|
border: 5px solid ${(props) => props.theme.colors.background.primary} !important;
|
|
@@ -280,8 +280,8 @@ export const IconButtonGroup = styled.div `
|
|
|
280
280
|
justify-content: flex-start;
|
|
281
281
|
align-items: center;
|
|
282
282
|
button {
|
|
283
|
-
width: ${(props) => props
|
|
284
|
-
height: ${(props) => props
|
|
283
|
+
width: ${(props) => props.$size || 28}px;
|
|
284
|
+
height: ${(props) => props.$size || 28}px;
|
|
285
285
|
}
|
|
286
286
|
`;
|
|
287
287
|
export const TextButton = styled(IconTextButton) `
|
|
@@ -34,14 +34,14 @@ export const CheckboxLabel = styled.label `
|
|
|
34
34
|
font-family: ${(props) => props.theme.font.family.sans};
|
|
35
35
|
font-size: ${(props) => props.theme.font.size.normal};
|
|
36
36
|
font-weight: ${(props) => props.theme.font.weight.normal};
|
|
37
|
-
color: ${(props) => props
|
|
37
|
+
color: ${(props) => props.$disabled
|
|
38
38
|
? props.theme.colors.text.muted
|
|
39
39
|
: props.theme.colors.text.primary};
|
|
40
40
|
display: flex;
|
|
41
41
|
flex-wrap: nowrap;
|
|
42
42
|
line-height: 20px;
|
|
43
43
|
margin: 8px 0;
|
|
44
|
-
cursor: ${(props) => (props
|
|
44
|
+
cursor: ${(props) => (props.$disabled ? 'not-allowed' : 'pointer')};
|
|
45
45
|
|
|
46
46
|
&::before {
|
|
47
47
|
content: '';
|
|
@@ -63,7 +63,7 @@ export const ContextMenu = ({ actions }) => {
|
|
|
63
63
|
container.removeEventListener('keydown', handleKeyDown);
|
|
64
64
|
};
|
|
65
65
|
}, [actions]);
|
|
66
|
-
return (_jsx(IconButtonGroup, { size: 32, ref: containerRef, children: actions.map((action) => {
|
|
66
|
+
return (_jsx(IconButtonGroup, { "$size": 32, ref: containerRef, children: actions.map((action) => {
|
|
67
67
|
const Icon = icons[action.icon];
|
|
68
68
|
return (_jsx(ContextMenuIconButton, { "data-tooltip-content": action.label, onClick: action.disabled === true ? () => null : action.action, className: action.selected ? 'selected' : '', disabled: !!action.disabled, children: _jsx(Icon, { width: 18, height: 18 }) }, action.icon));
|
|
69
69
|
}) }));
|
|
@@ -4,10 +4,10 @@ import { CalendarIcon } from './icons';
|
|
|
4
4
|
const inputStyles = css `
|
|
5
5
|
box-sizing: border-box;
|
|
6
6
|
width: 100%;
|
|
7
|
-
min-height: ${(props) => (props
|
|
7
|
+
min-height: ${(props) => (props.$variant === 'small' ? '32px' : '40px')};
|
|
8
8
|
padding: 0 36px 0 12px;
|
|
9
9
|
border: 1px solid
|
|
10
|
-
${(props) => props
|
|
10
|
+
${(props) => props.$error
|
|
11
11
|
? props.theme.colors.border.error
|
|
12
12
|
: props.theme.colors.border.field.default};
|
|
13
13
|
border-radius: 3px;
|
|
@@ -41,7 +41,7 @@ const inputStyles = css `
|
|
|
41
41
|
|
|
42
42
|
&:focus:not(:disabled) {
|
|
43
43
|
border: 2px solid
|
|
44
|
-
${(props) => props
|
|
44
|
+
${(props) => props.$error
|
|
45
45
|
? props.theme.colors.border.error
|
|
46
46
|
: props.theme.colors.brand.default};
|
|
47
47
|
background-color: #f2fbfc;
|
|
@@ -93,7 +93,7 @@ const SecondaryTextDanger = styled.button.attrs({ type: 'button' }) `
|
|
|
93
93
|
opacity: 0.5;
|
|
94
94
|
}
|
|
95
95
|
`;
|
|
96
|
-
const PrimaryAction = (props) => props.isDestructive ? (props.hasForm ? (_jsx(PrimaryButton, { danger: true, disabled: props.disabled, form: "formDialog", type: "submit", children: props.title })) : (_jsx(PrimaryButton, { danger: true, disabled: props.disabled, onClick: props.action, autoFocus: true, children: props.title }))) : props.hasForm ? (_jsx(PrimaryButton, { disabled: props.disabled, form: "formDialog", type: "submit", children: props.title })) : (_jsx(PrimaryButton, { disabled: props.disabled, onClick: props.action, autoFocus: true, children: props.title }));
|
|
96
|
+
const PrimaryAction = (props) => props.isDestructive ? (props.hasForm ? (_jsx(PrimaryButton, { "$danger": true, disabled: props.disabled, form: "formDialog", type: "submit", children: props.title })) : (_jsx(PrimaryButton, { "$danger": true, disabled: props.disabled, onClick: props.action, autoFocus: true, children: props.title }))) : props.hasForm ? (_jsx(PrimaryButton, { disabled: props.disabled, form: "formDialog", type: "submit", children: props.title })) : (_jsx(PrimaryButton, { disabled: props.disabled, onClick: props.action, autoFocus: true, children: props.title }));
|
|
97
97
|
const SecondaryAction = (props) => props.variant === 'textDanger' ? (_jsx(SecondaryTextDanger, { disabled: props.disabled, onClick: props.action, children: props.title })) : (_jsx(SecondaryButton, { disabled: props.disabled, onClick: props.action, children: props.title }));
|
|
98
98
|
export class Dialog extends React.Component {
|
|
99
99
|
constructor() {
|
|
@@ -11,7 +11,7 @@ const slideIn = keyframes `
|
|
|
11
11
|
}
|
|
12
12
|
`;
|
|
13
13
|
const DrawerContainer = withFocusTrap(styled.div `
|
|
14
|
-
width: ${(props) => props
|
|
14
|
+
width: ${(props) => props.$width || '300px'};
|
|
15
15
|
background: ${(props) => props.theme.colors.background.primary};
|
|
16
16
|
height: 100%;
|
|
17
17
|
display: flex;
|
|
@@ -96,5 +96,5 @@ export const DrawerItemMeta = styled.span `
|
|
|
96
96
|
color: ${(props) => props.theme.colors.text.secondary};
|
|
97
97
|
`;
|
|
98
98
|
export const Drawer = ({ title, onBack, width, children, }) => {
|
|
99
|
-
return (_jsxs(DrawerContainer, { "data-cy": "drawer", width: width, children: [_jsxs(DrawerBackButton, { onClick: onBack, children: [_jsx("span", { children: "\u2190" }), "Back"] }), _jsx(DrawerTitle, { children: title }), children] }));
|
|
99
|
+
return (_jsxs(DrawerContainer, { "data-cy": "drawer", "$width": width, children: [_jsxs(DrawerBackButton, { onClick: onBack, children: [_jsx("span", { children: "\u2190" }), "Back"] }), _jsx(DrawerTitle, { children: title }), children] }));
|
|
100
100
|
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
|
-
export const DropdownList = styled.div.attrs({
|
|
2
|
+
export const DropdownList = styled.div.attrs({
|
|
3
|
+
'data-cy': 'dropdown',
|
|
4
|
+
}) `
|
|
3
5
|
display: flex;
|
|
4
6
|
flex-direction: column;
|
|
5
7
|
border: 1px solid ${(props) => props.theme.colors.border.secondary};
|
|
@@ -7,10 +9,10 @@ export const DropdownList = styled.div.attrs({ 'data-cy': 'dropdown' }) `
|
|
|
7
9
|
border-radius: 4px;
|
|
8
10
|
box-shadow: 0 4px 9px rgba(0, 0, 0, 0.3);
|
|
9
11
|
background: ${(props) => props.theme.colors.background.primary};
|
|
10
|
-
width: ${(props) => (props
|
|
11
|
-
${(props) => props
|
|
12
|
-
${(props) => (props
|
|
13
|
-
top: ${(props) => props.theme.grid.unit * (props
|
|
12
|
+
width: ${(props) => (props.$width ? props.$width + 'px' : 'auto')};
|
|
13
|
+
${(props) => props.$height && `max-height: ${props.$height}px`};
|
|
14
|
+
${(props) => (props.$direction === 'right' ? ' right: 0' : 'left : 0')};
|
|
15
|
+
top: ${(props) => props.theme.grid.unit * (props.$top || 3)}px;
|
|
14
16
|
position: absolute;
|
|
15
17
|
z-index: 10;
|
|
16
18
|
justify-content: space-evenly;
|
|
@@ -10,7 +10,7 @@ export const ExpandableSection = ({ title, children, defaultOpen = true, bordere
|
|
|
10
10
|
setOpen((prev) => !prev);
|
|
11
11
|
}
|
|
12
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 }) }) })] }));
|
|
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
14
|
};
|
|
15
15
|
const Container = styled.div `
|
|
16
16
|
border: ${(props) => props.bordered
|
|
@@ -33,15 +33,15 @@ const Title = styled.span `
|
|
|
33
33
|
`;
|
|
34
34
|
const ArrowIcon = styled(ArrowDownCircleIcon) `
|
|
35
35
|
transition: transform 0.25s ease;
|
|
36
|
-
transform: rotate(${(props) => (props
|
|
36
|
+
transform: rotate(${(props) => (props.$open ? '180deg' : '0deg')});
|
|
37
37
|
`;
|
|
38
38
|
const ContentOuter = styled.div `
|
|
39
39
|
display: grid;
|
|
40
|
-
grid-template-rows: ${(props) => (props
|
|
41
|
-
overflow: ${(props) => (props
|
|
40
|
+
grid-template-rows: ${(props) => (props.$open ? '1fr' : '0fr')};
|
|
41
|
+
overflow: ${(props) => (props.$open ? 'visible' : 'hidden')};
|
|
42
42
|
transition:
|
|
43
43
|
grid-template-rows 0.25s ease,
|
|
44
|
-
overflow 0s ${(props) => (props
|
|
44
|
+
overflow 0s ${(props) => (props.$open ? '0.25s' : '0s')} allow-discrete;
|
|
45
45
|
`;
|
|
46
46
|
const ContentInner = styled.div `
|
|
47
47
|
overflow: visible;
|
|
@@ -58,12 +58,12 @@ export const FormField = styled.div `
|
|
|
58
58
|
`;
|
|
59
59
|
export const FormRow = styled.div `
|
|
60
60
|
display: flex;
|
|
61
|
-
flex-direction: ${(props) => props
|
|
61
|
+
flex-direction: ${(props) => props.$direction ?? 'column'};
|
|
62
62
|
gap: ${(props) => props.theme.grid.unit * 2}px;
|
|
63
63
|
margin-bottom: ${(props) => props.theme.grid.unit * 4}px;
|
|
64
|
-
justify-content: ${(props) => props
|
|
65
|
-
align-items: ${(props) => props
|
|
66
|
-
flex-wrap: ${(props) => (props
|
|
64
|
+
justify-content: ${(props) => props.$justify ?? 'flex-start'};
|
|
65
|
+
align-items: ${(props) => props.$align ?? (props.$direction === 'row' ? 'center' : 'stretch')};
|
|
66
|
+
flex-wrap: ${(props) => (props.$direction === 'row' ? 'wrap' : 'nowrap')};
|
|
67
67
|
`;
|
|
68
68
|
export const FormLabel = styled.legend `
|
|
69
69
|
&:not(:first-child) {
|
|
@@ -21,10 +21,10 @@ const MenuContainer = styled.div `
|
|
|
21
21
|
& ${MenuHeading} {
|
|
22
22
|
background-color: ${(props) => props.theme.colors.background.secondary};
|
|
23
23
|
line-height: 24px;
|
|
24
|
-
color: ${(props) => (props
|
|
24
|
+
color: ${(props) => (props.$isEnabled ? '#353535' : '#e2e2e2')};
|
|
25
25
|
|
|
26
26
|
&:hover {
|
|
27
|
-
background-color: ${(props) => (props
|
|
27
|
+
background-color: ${(props) => (props.$isEnabled ? '#f2fbfc' : '#fff')};
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
`;
|
|
@@ -84,12 +84,12 @@ export const Menus = ({ menus, innerRef, handleClick, close, }) => {
|
|
|
84
84
|
}
|
|
85
85
|
};
|
|
86
86
|
return (_jsx(MenusContainer, { ref: innerRef, "data-cy": 'manuscript-menus', onKeyDown: handleKeyDown, children: menus.map((menu, index) => {
|
|
87
|
-
return (_jsxs(MenuContainer, { "data-cy": 'menu', isEnabled: menu.isEnabled, children: [_jsx(MenuHeading, { ref: (el) => {
|
|
87
|
+
return (_jsxs(MenuContainer, { "data-cy": 'menu', "$isEnabled": menu.isEnabled, children: [_jsx(MenuHeading, { ref: (el) => {
|
|
88
88
|
menuHeadingsRef.current[index] = el;
|
|
89
89
|
}, onMouseDown: (e) => {
|
|
90
90
|
e.preventDefault();
|
|
91
91
|
handleClick([index]);
|
|
92
|
-
}, isOpen: menu.isOpen, children: _jsx(Text, { children: menu.label }) }), menu.isEnabled && menu.isOpen && menu.submenu && (_jsx(SubmenusContainerWrapper, { children: _jsx(SubmenusContainer, { "data-submenu-container": true, tabIndex: -1, children: menu.submenu.map((submenu, sindex) => {
|
|
92
|
+
}, "$isOpen": menu.isOpen, children: _jsx(Text, { children: menu.label }) }), menu.isEnabled && menu.isOpen && menu.submenu && (_jsx(SubmenusContainerWrapper, { children: _jsx(SubmenusContainer, { "data-submenu-container": true, tabIndex: -1, children: menu.submenu.map((submenu, sindex) => {
|
|
93
93
|
return (_jsx(Submenu, { menu: submenu, handleClick: (i) => handleClick([index, sindex, ...i]), close: close }, `${index}-${sindex}`));
|
|
94
94
|
}) }) }))] }, `menu-${index}`));
|
|
95
95
|
}) }));
|
|
@@ -65,7 +65,7 @@ const Container = styled.div `
|
|
|
65
65
|
cursor: pointer;
|
|
66
66
|
padding: 8px 16px 8px 4px;
|
|
67
67
|
outline: none;
|
|
68
|
-
${(props) => props
|
|
68
|
+
${(props) => props.$isOpen && 'background: #f2fbfc;'}
|
|
69
69
|
|
|
70
70
|
&:hover, &:focus {
|
|
71
71
|
background: #f2fbfc;
|
|
@@ -152,7 +152,7 @@ export const SubmenuLabel = ({ menu, handleClick, close, }) => {
|
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
};
|
|
155
|
-
return (_jsxs(Container, { isOpen: menu.isOpen, "data-cy": 'submenu', "data-submenu-item": true, className: menu.isEnabled ? '' : 'disabled', tabIndex: -1, onMouseDown: (e) => {
|
|
155
|
+
return (_jsxs(Container, { "$isOpen": menu.isOpen, "data-cy": 'submenu', "data-submenu-item": true, className: menu.isEnabled ? '' : 'disabled', tabIndex: -1, onMouseDown: (e) => {
|
|
156
156
|
e.preventDefault();
|
|
157
157
|
handleClick([]);
|
|
158
158
|
}, onKeyDown: handleKeyDown, children: [_jsx(Active, { children: activeContent(menu) }), _jsx(Text, { children: menu.label }), menu.submenu && _jsx(Arrow, {}), menu.shortcut && _jsx(Shortcut, { shortcut: menu.shortcut })] }));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from 'react';
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
import { commonStyles } from './TextField';
|
|
5
5
|
const Container = styled.div `
|
|
@@ -78,9 +78,13 @@ const Input = styled.input `
|
|
|
78
78
|
|
|
79
79
|
&::-moz-appearance: textfield;
|
|
80
80
|
`;
|
|
81
|
-
export const MultiValueInput = ({ id, inputType, placeholder = '', initialValues
|
|
82
|
-
const [values, setValues] = useState(initialValues);
|
|
81
|
+
export const MultiValueInput = ({ id, inputType, placeholder = '', initialValues, onChange, }) => {
|
|
82
|
+
const [values, setValues] = useState(initialValues ?? []);
|
|
83
83
|
const [currentValue, setCurrentValue] = useState('');
|
|
84
|
+
useEffect(() => {
|
|
85
|
+
setValues(initialValues ?? []);
|
|
86
|
+
setCurrentValue('');
|
|
87
|
+
}, [initialValues]);
|
|
84
88
|
const handleAddValue = (value) => {
|
|
85
89
|
if (value.trim() && !values.includes(value.trim())) {
|
|
86
90
|
const updatedValues = [...values, value.trim()];
|
|
@@ -20,9 +20,9 @@ export const NavDropdown = styled.div `
|
|
|
20
20
|
font-weight: ${(props) => props.theme.font.weight.normal};
|
|
21
21
|
max-height: 80vh;
|
|
22
22
|
max-width: 300px;
|
|
23
|
-
${(props) => props
|
|
24
|
-
${(props) => (props
|
|
25
|
-
top: ${(props) => (props
|
|
23
|
+
${(props) => props.$minWidth && 'min-width: ' + props.$minWidth + 'px;'}
|
|
24
|
+
${(props) => (props.$direction === 'right' ? ' right: 0' : 'left : 0')};
|
|
25
|
+
top: ${(props) => (props.$top ? props.$top : props.theme.grid.unit * 10)}px;
|
|
26
26
|
position: absolute;
|
|
27
27
|
z-index: 10;
|
|
28
28
|
`;
|
|
@@ -43,10 +43,10 @@ const commonStyles = css `
|
|
|
43
43
|
align-items: center;
|
|
44
44
|
text-decoration: none;
|
|
45
45
|
white-space: nowrap;
|
|
46
|
-
color: ${(props) => props
|
|
46
|
+
color: ${(props) => props.$disabled
|
|
47
47
|
? props.theme.colors.text.secondary
|
|
48
48
|
: props.theme.colors.text.primary};
|
|
49
|
-
pointer-events: ${(props) => (props
|
|
49
|
+
pointer-events: ${(props) => (props.$disabled ? 'none' : 'unset')};
|
|
50
50
|
|
|
51
51
|
&:hover {
|
|
52
52
|
background: ${(props) => props.theme.colors.background.fifth};
|
|
@@ -84,7 +84,7 @@ export const NavDropdownToggle = styled(ArrowUpIcon) `
|
|
|
84
84
|
}
|
|
85
85
|
`;
|
|
86
86
|
export const NotificationsBadge = styled.div `
|
|
87
|
-
background-color: ${(props) => props
|
|
87
|
+
background-color: ${(props) => props.$isOpen
|
|
88
88
|
? props.theme.colors.background.success
|
|
89
89
|
: props.theme.colors.brand.default};
|
|
90
90
|
color: ${(props) => props.theme.colors.text.onDark};
|
|
@@ -100,12 +100,10 @@ export const NotificationsBadge = styled.div `
|
|
|
100
100
|
padding: 2px;
|
|
101
101
|
border-radius: 50px;
|
|
102
102
|
`;
|
|
103
|
-
export const NavDropdownButtonContainer = styled(SecondaryButton)
|
|
104
|
-
selected: props.isOpen,
|
|
105
|
-
})) `
|
|
103
|
+
export const NavDropdownButtonContainer = styled(SecondaryButton) `
|
|
106
104
|
.inheritColors path {
|
|
107
105
|
fill: currentColor;
|
|
108
106
|
stroke: currentColor;
|
|
109
107
|
}
|
|
110
108
|
`;
|
|
111
|
-
export const NavDropdownButton = ({ as, children, disabled, isOpen, notificationsCount, onClick, removeChevron, buttonRef, }) => (_jsxs(NavDropdownButtonContainer, { ref: buttonRef, as: as, disabled: disabled, onClick: onClick, isOpen: isOpen, className: 'dropdown-toggle', tabIndex: 0, children: [_jsx(NavDropdownButtonText, { children: children }), !!notificationsCount && (_jsx(NotificationsBadge, { isOpen: isOpen, children: notificationsCount })), !removeChevron && _jsx(NavDropdownToggle, { className: isOpen ? 'open' : '' })] }));
|
|
109
|
+
export const NavDropdownButton = ({ as, children, disabled, isOpen, notificationsCount, onClick, removeChevron, buttonRef, }) => (_jsxs(NavDropdownButtonContainer, { ref: buttonRef, as: as, disabled: disabled, onClick: onClick, "$isOpen": isOpen, className: 'dropdown-toggle', tabIndex: 0, children: [_jsx(NavDropdownButtonText, { children: children }), !!notificationsCount && (_jsx(NotificationsBadge, { "$isOpen": isOpen, children: notificationsCount })), !removeChevron && _jsx(NavDropdownToggle, { className: isOpen ? 'open' : '' })] }));
|
|
@@ -14,6 +14,6 @@ const inners = {
|
|
|
14
14
|
export const ResizerButton = React.memo(({ buttonInner, direction, side, isCollapsed = false, isVisible = false, onClick, }) => {
|
|
15
15
|
const preventMouseDown = useCallback((event) => event.preventDefault(), []);
|
|
16
16
|
const ResizerButtonInner = buttonInner || inners[direction][side];
|
|
17
|
-
return (_jsx(ResizerButtonInner, { "aria-expanded": !isCollapsed, isCollapsed: isCollapsed, isVisible: isVisible, onClick: onClick, onMouseDown: preventMouseDown, tabIndex: 0 }));
|
|
17
|
+
return (_jsx(ResizerButtonInner, { "aria-expanded": !isCollapsed, "$isCollapsed": isCollapsed, "$isVisible": isVisible, onClick: onClick, onMouseDown: preventMouseDown, tabIndex: 0 }));
|
|
18
18
|
});
|
|
19
19
|
ResizerButton.displayName = 'ResizerButton';
|
|
@@ -25,7 +25,7 @@ const ResizerButtonInner = styled.button `
|
|
|
25
25
|
background-color: #ddd;
|
|
26
26
|
border-radius: ${toggleArrowDepth}px;
|
|
27
27
|
position: absolute;
|
|
28
|
-
opacity: ${(props) => (props
|
|
28
|
+
opacity: ${(props) => (props.$isVisible ? 1 : 0.5)};
|
|
29
29
|
transition: ${transformTransition}, ${opacityTransition};
|
|
30
30
|
}
|
|
31
31
|
|
|
@@ -78,10 +78,10 @@ export const HorizontalEndResizerButtonInner = styled(HorizontalResizerButtonInn
|
|
|
78
78
|
&:hover,
|
|
79
79
|
&:focus {
|
|
80
80
|
&::before {
|
|
81
|
-
transform: rotate(${(props) => (props
|
|
81
|
+
transform: rotate(${(props) => (props.$isCollapsed ? '-40deg' : '40deg')});
|
|
82
82
|
}
|
|
83
83
|
&::after {
|
|
84
|
-
transform: rotate(${(props) => (props
|
|
84
|
+
transform: rotate(${(props) => (props.$isCollapsed ? '40deg' : '-40deg')});
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
`;
|
|
@@ -96,10 +96,10 @@ export const HorizontalStartResizerButtonInner = styled(HorizontalResizerButtonI
|
|
|
96
96
|
&:hover,
|
|
97
97
|
&:focus {
|
|
98
98
|
&::before {
|
|
99
|
-
transform: rotate(${(props) => (props
|
|
99
|
+
transform: rotate(${(props) => (props.$isCollapsed ? '40deg' : '-40deg')});
|
|
100
100
|
}
|
|
101
101
|
&::after {
|
|
102
|
-
transform: rotate(${(props) => (props
|
|
102
|
+
transform: rotate(${(props) => (props.$isCollapsed ? '-40deg' : '40deg')});
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
`;
|
|
@@ -134,10 +134,10 @@ export const VerticalEndResizerButtonInner = styled(VerticalResizerButtonInner)
|
|
|
134
134
|
&:hover,
|
|
135
135
|
&:focus {
|
|
136
136
|
&::before {
|
|
137
|
-
transform: rotate(${(props) => (props
|
|
137
|
+
transform: rotate(${(props) => (props.$isCollapsed ? '40deg' : '-40deg')});
|
|
138
138
|
}
|
|
139
139
|
&::after {
|
|
140
|
-
transform: rotate(${(props) => (props
|
|
140
|
+
transform: rotate(${(props) => (props.$isCollapsed ? '-40deg' : '40deg')});
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
`;
|
|
@@ -154,10 +154,10 @@ export const VerticalStartResizerButtonInner = styled(VerticalResizerButtonInner
|
|
|
154
154
|
&:hover,
|
|
155
155
|
&:focus {
|
|
156
156
|
&::before {
|
|
157
|
-
transform: rotate(${(props) => (props
|
|
157
|
+
transform: rotate(${(props) => (props.$isCollapsed ? '-40deg' : '40deg')});
|
|
158
158
|
}
|
|
159
159
|
&::after {
|
|
160
|
-
transform: rotate(${(props) => (props
|
|
160
|
+
transform: rotate(${(props) => (props.$isCollapsed ? '40deg' : '-40deg')});
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
163
|
`;
|
|
@@ -36,10 +36,10 @@ const Item = styled.div `
|
|
|
36
36
|
display: flex;
|
|
37
37
|
align-items: center;
|
|
38
38
|
gap: 4px;
|
|
39
|
-
background: ${(props) => (props
|
|
39
|
+
background: ${(props) => (props.$disabled ? '#dddcdc' : '#f2f2f2')};
|
|
40
40
|
border-radius: 6px;
|
|
41
41
|
padding: 4px;
|
|
42
|
-
color: ${(props) => props
|
|
42
|
+
color: ${(props) => props.$disabled ? '#707070' : props.theme.colors.text.primary};
|
|
43
43
|
font: ${(props) => props.theme.font.weight.normal}
|
|
44
44
|
${(props) => props.theme.font.size.small}
|
|
45
45
|
${(props) => props.theme.font.family.sans};
|
|
@@ -65,6 +65,6 @@ const RemoveButton = styled.button `
|
|
|
65
65
|
}
|
|
66
66
|
`;
|
|
67
67
|
export const SelectedItemsBox = ({ items, onRemove, placeholder = 'No items selected', ...props }) => {
|
|
68
|
-
return (_jsx(BoxContainer, { ...props, children: items.length > 0 ? (_jsx(ItemsList, { children: items.map((item) => (_jsxs(Item, { "data-cy": "item", disabled: !!props.disabled, children: [item.label, !props.disabled && (_jsx(RemoveButton, { onClick: () => onRemove(item.id), "aria-label": `Remove ${item.label}`, children: "x" }))] }, item.id))) })) : (_jsx(EmptyContainer, { children: _jsx(Placeholder, { children: placeholder }) })) }));
|
|
68
|
+
return (_jsx(BoxContainer, { ...props, children: items.length > 0 ? (_jsx(ItemsList, { children: items.map((item) => (_jsxs(Item, { "data-cy": "item", "$disabled": !!props.disabled, children: [item.label, !props.disabled && (_jsx(RemoveButton, { onClick: () => onRemove(item.id), "aria-label": `Remove ${item.label}`, children: "x" }))] }, item.id))) })) : (_jsx(EmptyContainer, { children: _jsx(Placeholder, { children: placeholder }) })) }));
|
|
69
69
|
};
|
|
70
70
|
export default SelectedItemsBox;
|