@manuscripts/style-guide 2.0.29-LEAN-4077.7 → 2.0.29-LEAN-4213.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/ContextMenu.js +0 -1
- package/dist/cjs/components/Dialog.js +0 -3
- package/dist/cjs/components/Drawer.js +119 -0
- package/dist/cjs/components/SelectedItemsBox.js +69 -0
- package/dist/cjs/components/TextField.js +4 -4
- package/dist/cjs/components/icons/add-institution.js +23 -0
- package/dist/cjs/components/icons/add-outline.js +1 -1
- package/dist/cjs/components/icons/add-user.js +11 -0
- package/dist/cjs/components/icons/affiliation-placeholder.js +42 -0
- package/dist/cjs/components/icons/affiliation.js +10 -0
- package/dist/cjs/components/icons/author-placeholder.js +49 -0
- package/dist/cjs/components/icons/circle-tick-animation.js +2 -13
- package/dist/cjs/components/icons/index.js +12 -2
- package/dist/cjs/components/icons/x.js +12 -0
- package/dist/cjs/index.js +2 -1
- package/dist/es/components/ContextMenu.js +1 -2
- package/dist/es/components/Dialog.js +1 -4
- package/dist/es/components/Drawer.js +89 -0
- package/dist/es/components/SelectedItemsBox.js +62 -0
- package/dist/es/components/TextField.js +1 -1
- package/dist/es/components/icons/add-institution.js +18 -0
- package/dist/es/components/icons/add-outline.js +1 -1
- package/dist/es/components/icons/add-user.js +6 -0
- package/dist/es/components/icons/affiliation-placeholder.js +37 -0
- package/dist/es/components/icons/affiliation.js +5 -0
- package/dist/es/components/icons/author-placeholder.js +44 -0
- package/dist/es/components/icons/circle-tick-animation.js +2 -13
- package/dist/es/components/icons/index.js +5 -0
- package/dist/es/components/icons/x.js +5 -0
- package/dist/es/index.js +2 -1
- package/dist/types/components/Dialog.d.ts +1 -2
- package/dist/types/components/Drawer.d.ts +16 -0
- package/dist/types/components/SelectedItemsBox.d.ts +12 -0
- package/dist/types/components/TextField.d.ts +0 -1
- package/dist/types/components/icons/add-institution.d.ts +4 -0
- package/dist/types/components/icons/add-user.d.ts +4 -0
- package/dist/types/components/icons/affiliation-placeholder.d.ts +19 -0
- package/dist/types/components/icons/affiliation.d.ts +4 -0
- package/dist/types/components/icons/author-placeholder.d.ts +19 -0
- package/dist/types/components/icons/circle-tick-animation.d.ts +1 -0
- package/dist/types/components/icons/index.d.ts +5 -0
- package/dist/types/components/icons/x.d.ts +4 -0
- package/dist/types/index.d.ts +2 -1
- package/package.json +1 -1
- package/dist/cjs/components/MultiValueInput.js +0 -152
- package/dist/es/components/MultiValueInput.js +0 -122
- package/dist/types/components/MultiValueInput.d.ts +0 -8
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.MultiValueInput = void 0;
|
|
30
|
-
const react_1 = __importStar(require("react"));
|
|
31
|
-
const styled_components_1 = __importDefault(require("styled-components"));
|
|
32
|
-
const TextField_1 = require("./TextField");
|
|
33
|
-
const Container = styled_components_1.default.div `
|
|
34
|
-
${TextField_1.commonStyles}
|
|
35
|
-
|
|
36
|
-
display: flex;
|
|
37
|
-
flex-wrap: wrap;
|
|
38
|
-
gap: 4px;
|
|
39
|
-
align-items: center;
|
|
40
|
-
padding: 0;
|
|
41
|
-
background: hotpink
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
&:hover Input {
|
|
45
|
-
background-color: ${(props) => props.theme.colors.background.fifth};
|
|
46
|
-
}
|
|
47
|
-
&:has(Input:focus) {
|
|
48
|
-
background-color: ${(props) => props.theme.colors.background.fifth};
|
|
49
|
-
border-color: ${(props) => props.theme.colors.border.field.hover};
|
|
50
|
-
}
|
|
51
|
-
`;
|
|
52
|
-
const Chip = styled_components_1.default.span `
|
|
53
|
-
display: flex;
|
|
54
|
-
align-items: center;
|
|
55
|
-
background-color: #f2f2f2;
|
|
56
|
-
color: ${(props) => props.theme.colors.text.primary};
|
|
57
|
-
border-radius: 12px;
|
|
58
|
-
border: 1px solid ${(props) => props.theme.colors.border.tertiary};
|
|
59
|
-
padding: ${(props) => props.theme.grid.unit}px;
|
|
60
|
-
font-size: ${(props) => props.theme.font.size.small};
|
|
61
|
-
line-height: ${(props) => props.theme.font.lineHeight.normal};
|
|
62
|
-
|
|
63
|
-
& + Input {
|
|
64
|
-
padding-left: 0;
|
|
65
|
-
}
|
|
66
|
-
`;
|
|
67
|
-
const RemoveButton = styled_components_1.default.button `
|
|
68
|
-
display: flex;
|
|
69
|
-
align-items: center;
|
|
70
|
-
justify-content: center;
|
|
71
|
-
width: 10px;
|
|
72
|
-
height: 10px;
|
|
73
|
-
color: white;
|
|
74
|
-
background: #6e6e6e;
|
|
75
|
-
margin-left: 4px;
|
|
76
|
-
border: none;
|
|
77
|
-
border-radius: 100%;
|
|
78
|
-
cursor: pointer;
|
|
79
|
-
font-size: 10px;
|
|
80
|
-
|
|
81
|
-
&:hover {
|
|
82
|
-
background: black;
|
|
83
|
-
}
|
|
84
|
-
`;
|
|
85
|
-
const Input = styled_components_1.default.input `
|
|
86
|
-
${TextField_1.commonStyles}
|
|
87
|
-
|
|
88
|
-
border: none;
|
|
89
|
-
flex: 1;
|
|
90
|
-
min-width: 6em;
|
|
91
|
-
padding: 10px 16px;
|
|
92
|
-
|
|
93
|
-
appearance: none;
|
|
94
|
-
-moz-appearance: textfield;
|
|
95
|
-
-webkit-appearance: none;
|
|
96
|
-
|
|
97
|
-
&::-webkit-outer-spin-button,
|
|
98
|
-
&::-webkit-inner-spin-button {
|
|
99
|
-
-webkit-appearance: none;
|
|
100
|
-
margin: 0;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
&::-moz-appearance: textfield;
|
|
104
|
-
`;
|
|
105
|
-
const MultiValueInput = ({ inputType, placeholder = '', initialValues = [], onChange, }) => {
|
|
106
|
-
const [values, setValues] = (0, react_1.useState)(initialValues);
|
|
107
|
-
const [currentValue, setCurrentValue] = (0, react_1.useState)('');
|
|
108
|
-
const handleAddValue = (value) => {
|
|
109
|
-
if (value.trim() && !values.includes(value.trim())) {
|
|
110
|
-
const updatedValues = [...values, value.trim()];
|
|
111
|
-
setValues(updatedValues);
|
|
112
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(updatedValues);
|
|
113
|
-
}
|
|
114
|
-
setCurrentValue('');
|
|
115
|
-
};
|
|
116
|
-
const handleInputChange = (e) => {
|
|
117
|
-
const value = e.target.value;
|
|
118
|
-
if (inputType === 'number' && /^\d*$/.test(value)) {
|
|
119
|
-
setCurrentValue(value);
|
|
120
|
-
}
|
|
121
|
-
else if (inputType === 'text') {
|
|
122
|
-
setCurrentValue(value);
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
const handleBlur = () => {
|
|
126
|
-
if (currentValue) {
|
|
127
|
-
handleAddValue(currentValue);
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
const handleKeyDown = (e) => {
|
|
131
|
-
if (e.key === 'Enter') {
|
|
132
|
-
e.preventDefault();
|
|
133
|
-
handleAddValue(currentValue);
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
|
-
const handleRemoveValue = (index) => {
|
|
137
|
-
const updatedValues = values.filter((_, i) => i !== index);
|
|
138
|
-
setValues(updatedValues);
|
|
139
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(updatedValues);
|
|
140
|
-
};
|
|
141
|
-
const xplaceholder = placeholder
|
|
142
|
-
? placeholder
|
|
143
|
-
: inputType === 'number'
|
|
144
|
-
? 'Enter number and press enter'
|
|
145
|
-
: 'Enter text and press enter';
|
|
146
|
-
return (react_1.default.createElement(Container, null,
|
|
147
|
-
values.map((value, index) => (react_1.default.createElement(Chip, { key: index },
|
|
148
|
-
value,
|
|
149
|
-
react_1.default.createElement(RemoveButton, { onMouseUp: () => handleRemoveValue(index) }, "\u00D7")))),
|
|
150
|
-
react_1.default.createElement(Input, { type: inputType, value: currentValue, onChange: handleInputChange, onKeyDown: handleKeyDown, onBlur: handleBlur, placeholder: xplaceholder })));
|
|
151
|
-
};
|
|
152
|
-
exports.MultiValueInput = MultiValueInput;
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import styled from 'styled-components';
|
|
3
|
-
import { commonStyles } from './TextField';
|
|
4
|
-
const Container = styled.div `
|
|
5
|
-
${commonStyles}
|
|
6
|
-
|
|
7
|
-
display: flex;
|
|
8
|
-
flex-wrap: wrap;
|
|
9
|
-
gap: 4px;
|
|
10
|
-
align-items: center;
|
|
11
|
-
padding: 0;
|
|
12
|
-
background: hotpink
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
&:hover Input {
|
|
16
|
-
background-color: ${(props) => props.theme.colors.background.fifth};
|
|
17
|
-
}
|
|
18
|
-
&:has(Input:focus) {
|
|
19
|
-
background-color: ${(props) => props.theme.colors.background.fifth};
|
|
20
|
-
border-color: ${(props) => props.theme.colors.border.field.hover};
|
|
21
|
-
}
|
|
22
|
-
`;
|
|
23
|
-
const Chip = styled.span `
|
|
24
|
-
display: flex;
|
|
25
|
-
align-items: center;
|
|
26
|
-
background-color: #f2f2f2;
|
|
27
|
-
color: ${(props) => props.theme.colors.text.primary};
|
|
28
|
-
border-radius: 12px;
|
|
29
|
-
border: 1px solid ${(props) => props.theme.colors.border.tertiary};
|
|
30
|
-
padding: ${(props) => props.theme.grid.unit}px;
|
|
31
|
-
font-size: ${(props) => props.theme.font.size.small};
|
|
32
|
-
line-height: ${(props) => props.theme.font.lineHeight.normal};
|
|
33
|
-
|
|
34
|
-
& + Input {
|
|
35
|
-
padding-left: 0;
|
|
36
|
-
}
|
|
37
|
-
`;
|
|
38
|
-
const RemoveButton = styled.button `
|
|
39
|
-
display: flex;
|
|
40
|
-
align-items: center;
|
|
41
|
-
justify-content: center;
|
|
42
|
-
width: 10px;
|
|
43
|
-
height: 10px;
|
|
44
|
-
color: white;
|
|
45
|
-
background: #6e6e6e;
|
|
46
|
-
margin-left: 4px;
|
|
47
|
-
border: none;
|
|
48
|
-
border-radius: 100%;
|
|
49
|
-
cursor: pointer;
|
|
50
|
-
font-size: 10px;
|
|
51
|
-
|
|
52
|
-
&:hover {
|
|
53
|
-
background: black;
|
|
54
|
-
}
|
|
55
|
-
`;
|
|
56
|
-
const Input = styled.input `
|
|
57
|
-
${commonStyles}
|
|
58
|
-
|
|
59
|
-
border: none;
|
|
60
|
-
flex: 1;
|
|
61
|
-
min-width: 6em;
|
|
62
|
-
padding: 10px 16px;
|
|
63
|
-
|
|
64
|
-
appearance: none;
|
|
65
|
-
-moz-appearance: textfield;
|
|
66
|
-
-webkit-appearance: none;
|
|
67
|
-
|
|
68
|
-
&::-webkit-outer-spin-button,
|
|
69
|
-
&::-webkit-inner-spin-button {
|
|
70
|
-
-webkit-appearance: none;
|
|
71
|
-
margin: 0;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
&::-moz-appearance: textfield;
|
|
75
|
-
`;
|
|
76
|
-
export const MultiValueInput = ({ inputType, placeholder = '', initialValues = [], onChange, }) => {
|
|
77
|
-
const [values, setValues] = useState(initialValues);
|
|
78
|
-
const [currentValue, setCurrentValue] = useState('');
|
|
79
|
-
const handleAddValue = (value) => {
|
|
80
|
-
if (value.trim() && !values.includes(value.trim())) {
|
|
81
|
-
const updatedValues = [...values, value.trim()];
|
|
82
|
-
setValues(updatedValues);
|
|
83
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(updatedValues);
|
|
84
|
-
}
|
|
85
|
-
setCurrentValue('');
|
|
86
|
-
};
|
|
87
|
-
const handleInputChange = (e) => {
|
|
88
|
-
const value = e.target.value;
|
|
89
|
-
if (inputType === 'number' && /^\d*$/.test(value)) {
|
|
90
|
-
setCurrentValue(value);
|
|
91
|
-
}
|
|
92
|
-
else if (inputType === 'text') {
|
|
93
|
-
setCurrentValue(value);
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
const handleBlur = () => {
|
|
97
|
-
if (currentValue) {
|
|
98
|
-
handleAddValue(currentValue);
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
const handleKeyDown = (e) => {
|
|
102
|
-
if (e.key === 'Enter') {
|
|
103
|
-
e.preventDefault();
|
|
104
|
-
handleAddValue(currentValue);
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
const handleRemoveValue = (index) => {
|
|
108
|
-
const updatedValues = values.filter((_, i) => i !== index);
|
|
109
|
-
setValues(updatedValues);
|
|
110
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(updatedValues);
|
|
111
|
-
};
|
|
112
|
-
const xplaceholder = placeholder
|
|
113
|
-
? placeholder
|
|
114
|
-
: inputType === 'number'
|
|
115
|
-
? 'Enter number and press enter'
|
|
116
|
-
: 'Enter text and press enter';
|
|
117
|
-
return (React.createElement(Container, null,
|
|
118
|
-
values.map((value, index) => (React.createElement(Chip, { key: index },
|
|
119
|
-
value,
|
|
120
|
-
React.createElement(RemoveButton, { onMouseUp: () => handleRemoveValue(index) }, "\u00D7")))),
|
|
121
|
-
React.createElement(Input, { type: inputType, value: currentValue, onChange: handleInputChange, onKeyDown: handleKeyDown, onBlur: handleBlur, placeholder: xplaceholder })));
|
|
122
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export interface MultiValueInputProps {
|
|
3
|
-
inputType: 'text' | 'number';
|
|
4
|
-
placeholder: string;
|
|
5
|
-
initialValues?: string[];
|
|
6
|
-
onChange?: (values: string[]) => void;
|
|
7
|
-
}
|
|
8
|
-
export declare const MultiValueInput: React.FC<MultiValueInputProps>;
|