@manuscripts/style-guide 3.4.5 → 3.4.7
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 +45 -4
- package/dist/cjs/components/DatePicker.js +188 -0
- package/dist/cjs/components/Form.js +1 -1
- package/dist/cjs/components/FormCommon.js +53 -0
- package/dist/cjs/components/FormFieldContainer.js +24 -0
- package/dist/cjs/components/InspectorSection.js +4 -4
- package/dist/cjs/components/RadioButton.js +15 -5
- package/dist/cjs/components/RadioGroup.js +27 -0
- package/dist/cjs/components/SelectField.js +10 -4
- package/dist/cjs/components/TextField.js +24 -13
- package/dist/cjs/components/icons/calendar.js +7 -0
- package/dist/cjs/components/icons/globe.js +7 -0
- package/dist/cjs/components/icons/index.js +7 -3
- package/dist/cjs/index.js +7 -2
- package/dist/es/components/ContextMenu.js +45 -4
- package/dist/es/components/DatePicker.js +181 -0
- package/dist/es/components/Form.js +1 -1
- package/dist/es/components/FormCommon.js +45 -0
- package/dist/es/components/FormFieldContainer.js +17 -0
- package/dist/es/components/InspectorSection.js +4 -4
- package/dist/es/components/RadioButton.js +16 -6
- package/dist/es/components/RadioGroup.js +20 -0
- package/dist/es/components/SelectField.js +10 -4
- package/dist/es/components/TextField.js +24 -13
- package/dist/es/components/icons/calendar.js +3 -0
- package/dist/es/components/icons/globe.js +3 -0
- package/dist/es/components/icons/index.js +2 -0
- package/dist/es/index.js +5 -1
- package/dist/types/components/DatePicker.d.ts +27 -0
- package/dist/types/components/FormCommon.d.ts +25 -0
- package/dist/types/components/FormFieldContainer.d.ts +26 -0
- package/dist/types/components/InspectorSection.d.ts +1 -0
- package/dist/types/components/RadioButton.d.ts +2 -2
- package/dist/types/components/RadioGroup.d.ts +28 -0
- package/dist/types/components/SelectField.d.ts +4 -2
- package/dist/types/components/icons/calendar.d.ts +19 -0
- package/dist/types/components/icons/globe.d.ts +19 -0
- package/dist/types/components/icons/index.d.ts +2 -0
- package/dist/types/index.d.ts +5 -1
- package/dist/types/theme.d.ts +2 -0
- package/package.json +3 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef } from 'react';
|
|
2
3
|
import styled from 'styled-components';
|
|
3
4
|
import { IconButton, IconButtonGroup } from './Button';
|
|
4
5
|
import * as Icons from './icons';
|
|
@@ -13,6 +14,11 @@ const ContextMenuIconButton = styled(IconButton) `
|
|
|
13
14
|
background-color: #f2f2f2;
|
|
14
15
|
border-color: #f2f2f2;
|
|
15
16
|
}
|
|
17
|
+
&:not([disabled]):focus-visible {
|
|
18
|
+
outline: 4px solid #3dadff;
|
|
19
|
+
outline-offset: -2px;
|
|
20
|
+
background-color: transparent !important;
|
|
21
|
+
}
|
|
16
22
|
&[disabled] {
|
|
17
23
|
color: #c9c9c9 !important;
|
|
18
24
|
background-color: #fff !important;
|
|
@@ -23,7 +29,42 @@ const icons = Object.entries(Icons).reduce((acc, [name, IconComponent]) => {
|
|
|
23
29
|
acc[iconName] = IconComponent;
|
|
24
30
|
return acc;
|
|
25
31
|
}, {});
|
|
26
|
-
export const ContextMenu = ({ actions }) =>
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
32
|
+
export const ContextMenu = ({ actions }) => {
|
|
33
|
+
const containerRef = useRef(null);
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
const container = containerRef.current;
|
|
36
|
+
if (!container) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const buttons = Array.from(container.querySelectorAll('button:not([disabled])'));
|
|
40
|
+
if (buttons.length === 0) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
buttons.forEach((button, index) => {
|
|
44
|
+
button.tabIndex = index === 0 ? 0 : -1;
|
|
45
|
+
});
|
|
46
|
+
const handleKeyDown = (event) => {
|
|
47
|
+
if (event.key !== 'ArrowRight' && event.key !== 'ArrowLeft') {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const target = event.target;
|
|
51
|
+
const currentIndex = buttons.indexOf(target);
|
|
52
|
+
if (currentIndex === -1) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
event.preventDefault();
|
|
56
|
+
const nextIndex = event.key === 'ArrowRight'
|
|
57
|
+
? (currentIndex + 1) % buttons.length
|
|
58
|
+
: (currentIndex - 1 + buttons.length) % buttons.length;
|
|
59
|
+
buttons[nextIndex]?.focus();
|
|
60
|
+
};
|
|
61
|
+
container.addEventListener('keydown', handleKeyDown);
|
|
62
|
+
return () => {
|
|
63
|
+
container.removeEventListener('keydown', handleKeyDown);
|
|
64
|
+
};
|
|
65
|
+
}, [actions]);
|
|
66
|
+
return (_jsx(IconButtonGroup, { size: 32, ref: containerRef, children: actions.map((action) => {
|
|
67
|
+
const Icon = icons[action.icon];
|
|
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
|
+
}) }));
|
|
70
|
+
};
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import 'react-datepicker/dist/react-datepicker.css';
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import ReactDatePicker from 'react-datepicker';
|
|
5
|
+
import styled from 'styled-components';
|
|
6
|
+
import { CalendarIcon } from './icons';
|
|
7
|
+
export const DatePicker = ({ id, originalDate, date, handleDateChange, placeholder, showTimeSelect, required, }) => {
|
|
8
|
+
const [selectedDate, setSelectedDate] = useState(date || null);
|
|
9
|
+
const handleChange = (date) => {
|
|
10
|
+
setSelectedDate(date);
|
|
11
|
+
handleDateChange(date);
|
|
12
|
+
};
|
|
13
|
+
const format = showTimeSelect
|
|
14
|
+
? 'd MMM yyyy, EEEE h:mm aa'
|
|
15
|
+
: 'd MMM yyyy, EEEE';
|
|
16
|
+
return (_jsxs(Calendar, { children: [_jsx(ReactDatePicker, { id: id, selected: selectedDate, onChange: handleChange, placeholderText: placeholder, minDate: originalDate, showTimeSelect: showTimeSelect, dateFormat: format, className: "calendar-input", popperPlacement: "bottom", required: required }), _jsx(IconWrapper, { children: _jsx(CalendarIcon, { width: 16, height: 16 }) })] }));
|
|
17
|
+
};
|
|
18
|
+
const Calendar = styled.div `
|
|
19
|
+
width: 100%;
|
|
20
|
+
position: relative;
|
|
21
|
+
display: block;
|
|
22
|
+
|
|
23
|
+
.react-datepicker {
|
|
24
|
+
display: flex;
|
|
25
|
+
padding: ${(props) => props.theme.grid.unit * 5}px;
|
|
26
|
+
font-size: ${(props) => props.theme.font.size.normal};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.react-datepicker-wrapper,
|
|
30
|
+
.react-datepicker__input-container {
|
|
31
|
+
display: block;
|
|
32
|
+
width: 100% !important;
|
|
33
|
+
|
|
34
|
+
input::placeholder {
|
|
35
|
+
color: ${(props) => props.theme.colors.text.greyMuted ||
|
|
36
|
+
props.theme.colors.text.secondary ||
|
|
37
|
+
'#6E6E6E'};
|
|
38
|
+
opacity: 1;
|
|
39
|
+
font-family: 'PT Sans', sans-serif;
|
|
40
|
+
font-size: ${(props) => props.theme.font.size.medium};
|
|
41
|
+
font-style: italic;
|
|
42
|
+
font-weight: ${(props) => props.theme.font.weight.normal};
|
|
43
|
+
line-height: ${(props) => props.theme.font.lineHeight.large};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
input:focus::placeholder {
|
|
47
|
+
color: ${(props) => props.theme.colors.text.greyLight || '#C9C9C9'} !important;
|
|
48
|
+
opacity: 1 !important;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.react-datepicker__header {
|
|
53
|
+
background-color: unset;
|
|
54
|
+
border: unset;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.react-datepicker__day.react-datepicker__day--disabled {
|
|
58
|
+
color: #ccc;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.react-datepicker__day-name,
|
|
62
|
+
.react-datepicker__day,
|
|
63
|
+
.react-datepicker__time-name {
|
|
64
|
+
color: #000000cc;
|
|
65
|
+
padding: ${(props) => props.theme.grid.unit}px;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.react-datepicker__day-names .react-datepicker__day-name {
|
|
69
|
+
color: #d4d4d4;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.react-datepicker__time {
|
|
73
|
+
.react-datepicker__time-box {
|
|
74
|
+
width: 95px;
|
|
75
|
+
|
|
76
|
+
.react-datepicker__time-list {
|
|
77
|
+
overflow-y: unset;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
h2.react-datepicker__current-month {
|
|
83
|
+
padding-bottom: ${(props) => props.theme.grid.unit * 5}px;
|
|
84
|
+
font-weight: 400;
|
|
85
|
+
font-size: ${(props) => props.theme.font.size.medium};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.react-datepicker[aria-label='Choose Date and Time'] {
|
|
89
|
+
.react-datepicker__navigation--next {
|
|
90
|
+
right: 150px;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.react-datepicker__navigation--next {
|
|
95
|
+
right: 65px;
|
|
96
|
+
top: 24px;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.react-datepicker__navigation--previous {
|
|
100
|
+
left: 65px;
|
|
101
|
+
top: 24px;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.react-datepicker__day--selected {
|
|
105
|
+
border: 1px solid rgb(188, 231, 246);
|
|
106
|
+
background-color: rgb(242, 251, 252);
|
|
107
|
+
border-radius: 50%;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.react-datepicker__day:not(.-selected):hover {
|
|
111
|
+
border-radius: 50%;
|
|
112
|
+
background-color: rgb(242, 251, 252);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.react-datepicker-popper[data-placement^='bottom']
|
|
116
|
+
.react-datepicker__triangle {
|
|
117
|
+
fill: white;
|
|
118
|
+
color: white;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.react-datepicker__day--outside-month {
|
|
122
|
+
visibility: hidden;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.react-datepicker__day--keyboard-selected {
|
|
126
|
+
background-color: unset;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.calendar-input {
|
|
130
|
+
width: 100%;
|
|
131
|
+
box-sizing: border-box;
|
|
132
|
+
min-height: 40px;
|
|
133
|
+
border-radius: 3px;
|
|
134
|
+
font: ${(props) => props.theme.font.weight.normal}
|
|
135
|
+
${(props) => props.theme.font.size.medium} / 1
|
|
136
|
+
${(props) => props.theme.font.family.sans};
|
|
137
|
+
line-height: ${(props) => props.theme.font.lineHeight.large};
|
|
138
|
+
padding: 0 ${(props) => props.theme.grid.unit * 10}px 0
|
|
139
|
+
${(props) => props.theme.grid.unit * 4}px;
|
|
140
|
+
text-align: start;
|
|
141
|
+
border: 1px solid ${(props) => props.theme.colors.border.field.default};
|
|
142
|
+
color: ${(props) => props.theme.colors.text.primary};
|
|
143
|
+
outline: 0;
|
|
144
|
+
background-color: #fff;
|
|
145
|
+
|
|
146
|
+
&::placeholder {
|
|
147
|
+
color: ${(props) => props.theme.colors.text.greyMuted ||
|
|
148
|
+
props.theme.colors.text.secondary ||
|
|
149
|
+
'#6E6E6E'};
|
|
150
|
+
opacity: 1;
|
|
151
|
+
font-family: 'PT Sans', sans-serif;
|
|
152
|
+
font-size: ${(props) => props.theme.font.size.medium};
|
|
153
|
+
font-style: italic;
|
|
154
|
+
font-weight: ${(props) => props.theme.font.weight.normal};
|
|
155
|
+
line-height: ${(props) => props.theme.font.lineHeight.large};
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
&:focus {
|
|
159
|
+
border: 2px solid ${(props) => props.theme.colors.brand.default};
|
|
160
|
+
background-color: #f2fbfc;
|
|
161
|
+
padding: 0 ${(props) => props.theme.grid.unit * 10 - 1}px 0
|
|
162
|
+
${(props) => props.theme.grid.unit * 4 - 1}px;
|
|
163
|
+
outline: none;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
&:hover {
|
|
167
|
+
border-color: ${(props) => props.theme.colors.text.greyMuted};
|
|
168
|
+
background-color: #f2fbfc;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
`;
|
|
172
|
+
const IconWrapper = styled.div `
|
|
173
|
+
position: absolute;
|
|
174
|
+
right: ${(props) => props.theme.grid.unit * 3}px;
|
|
175
|
+
top: 50%;
|
|
176
|
+
transform: translateY(-50%);
|
|
177
|
+
display: flex;
|
|
178
|
+
align-items: center;
|
|
179
|
+
pointer-events: none;
|
|
180
|
+
color: ${(props) => props.theme.colors.border.secondary};
|
|
181
|
+
`;
|
|
@@ -75,7 +75,7 @@ export const FormLabel = styled.legend `
|
|
|
75
75
|
${(props) => props.theme.font.lineHeight.large}
|
|
76
76
|
${(props) => props.theme.font.family.sans};
|
|
77
77
|
letter-spacing: -0.4px;
|
|
78
|
-
color: ${(props) => props.theme.colors.text.
|
|
78
|
+
color: ${(props) => props.theme.colors.text.primary};
|
|
79
79
|
`;
|
|
80
80
|
export const FormActionsBar = styled.div `
|
|
81
81
|
display: flex;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { AttentionRedIcon } from './icons';
|
|
4
|
+
export const FieldError = ({ error }) => {
|
|
5
|
+
if (!error) {
|
|
6
|
+
return null;
|
|
7
|
+
}
|
|
8
|
+
return (_jsxs(_Fragment, { children: [_jsx(AttentionRedIcon, { className: "error-icon", width: 16, height: 16 }), _jsx(ErrorText, { children: error })] }));
|
|
9
|
+
};
|
|
10
|
+
export const FieldInfo = ({ info }) => {
|
|
11
|
+
if (!info) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
return _jsx(FieldInfoText, { children: info });
|
|
15
|
+
};
|
|
16
|
+
const ErrorText = styled.span `
|
|
17
|
+
font-size: ${(props) => props.theme.font.size.small};
|
|
18
|
+
color: ${(props) => props.theme.colors.text.error};
|
|
19
|
+
`;
|
|
20
|
+
const FieldInfoText = styled.span `
|
|
21
|
+
font-size: ${(props) => props.theme.font.size.small};
|
|
22
|
+
color: ${(props) => props.theme.colors.text.secondary};
|
|
23
|
+
`;
|
|
24
|
+
export const TextWithGenerationWrapper = styled.div `
|
|
25
|
+
display: flex;
|
|
26
|
+
align-items: start;
|
|
27
|
+
gap: 1rem;
|
|
28
|
+
width: 100%;
|
|
29
|
+
|
|
30
|
+
> div:first-child {
|
|
31
|
+
flex-grow: 1;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
button {
|
|
35
|
+
margin-top: ${(props) => props.theme.grid.unit * 6}px !important;
|
|
36
|
+
}
|
|
37
|
+
`;
|
|
38
|
+
export const TextFieldError = styled.div `
|
|
39
|
+
margin-top: 4px;
|
|
40
|
+
`;
|
|
41
|
+
export const TextFieldErrorItem = styled.div `
|
|
42
|
+
font-family: ${(props) => props.theme.font.family.sans};
|
|
43
|
+
font-size: ${(props) => props.theme.font.size.small};
|
|
44
|
+
color: ${(props) => props.theme.colors.text.error};
|
|
45
|
+
`;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Children, cloneElement, Fragment, } from 'react';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { TextFieldLabel } from './TextField';
|
|
5
|
+
import { TextFieldError, TextFieldErrorItem } from './FormCommon';
|
|
6
|
+
export const FormFieldContainer = ({ label, error, info, id, children, }) => {
|
|
7
|
+
const childrenWithErrorProp = Children.map(children, (child) => cloneElement(child, {
|
|
8
|
+
error: error ? String(error) : undefined,
|
|
9
|
+
}));
|
|
10
|
+
return (_jsxs(Fragment, { children: [label ? (_jsxs(TextFieldLabel, { htmlFor: id, children: [label, " ", childrenWithErrorProp] })) : (childrenWithErrorProp), info && !error && _jsx(FormFieldInfo, { children: info }), error && (_jsx(TextFieldError, { children: _jsx(TextFieldErrorItem, { children: error }) }))] }));
|
|
11
|
+
};
|
|
12
|
+
const FormFieldInfo = styled.div `
|
|
13
|
+
font-family: ${(props) => props.theme.font.family.sans};
|
|
14
|
+
font-size: ${(props) => props.theme.font.size.small};
|
|
15
|
+
color: ${(props) => props.theme.colors.text.secondary};
|
|
16
|
+
margin-top: 4px;
|
|
17
|
+
`;
|
|
@@ -8,7 +8,7 @@ const Section = styled.div `
|
|
|
8
8
|
`;
|
|
9
9
|
const Heading = styled.div `
|
|
10
10
|
display: flex;
|
|
11
|
-
padding: 0
|
|
11
|
+
padding: 0;
|
|
12
12
|
cursor: pointer;
|
|
13
13
|
margin: ${(props) => props.theme.grid.unit * 4}px
|
|
14
14
|
${(props) => props.theme.grid.unit * 6}px
|
|
@@ -51,11 +51,11 @@ export const Subheading = styled(HeadingText) `
|
|
|
51
51
|
export const Field = styled.div `
|
|
52
52
|
margin-bottom: ${(props) => props.theme.grid.unit * 4}px;
|
|
53
53
|
`;
|
|
54
|
-
export const InspectorSection = ({ title, contentStyles, children, }) => {
|
|
54
|
+
export const InspectorSection = ({ title, contentStyles, children, collapsible = true, }) => {
|
|
55
55
|
const [expanded, setExpanded] = useState(true);
|
|
56
|
-
return (_jsxs(Section, { children: [_jsx(Line, {}), _jsxs(Heading, { onClick: () => setExpanded(!expanded), marginBottom: (!(expanded && children) && '40px') || undefined, children: [_jsx(HeadingText, { children: title }), _jsx(ExpanderButton, { "aria-label": 'Toggle expand section', onClick: () => setExpanded(!expanded), style: {
|
|
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
57
|
transform: expanded ? 'rotate(0deg)' : 'rotate(180deg)',
|
|
58
|
-
}, children: _jsx(ArrowDownCircleIcon, {}) })] }), expanded && children && _jsx("div", { style: contentStyles, children: children })] }));
|
|
58
|
+
}, children: _jsx(ArrowDownCircleIcon, {}) }))] }), expanded && children && _jsx("div", { style: contentStyles, children: children })] }));
|
|
59
59
|
};
|
|
60
60
|
const Line = styled.hr `
|
|
61
61
|
flex: 1;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
const Input = styled.input `
|
|
4
4
|
border: 0;
|
|
@@ -46,16 +46,16 @@ const Input = styled.input `
|
|
|
46
46
|
|
|
47
47
|
&:checked + label::before {
|
|
48
48
|
background: ${(props) => props.theme.colors.background.primary};
|
|
49
|
-
box-shadow: inset 0 0 0 4px
|
|
50
|
-
border-color:
|
|
49
|
+
box-shadow: inset 0 0 0 4px ${(props) => props.theme.colors.brand.default};
|
|
50
|
+
border-color: ${(props) => props.theme.colors.brand.default};
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
&:hover:not(:disabled) + label::before {
|
|
54
|
-
border-color: ${(props) => props.theme.colors.text.
|
|
54
|
+
border-color: ${(props) => props.theme.colors.text.greyMuted};
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
&:focus-visible + label::before {
|
|
58
|
-
border-color:
|
|
58
|
+
border-color: ${(props) => props.theme.colors.brand.default};
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
&:disabled + label {
|
|
@@ -69,4 +69,14 @@ const Input = styled.input `
|
|
|
69
69
|
border-color: #e4e4e4;
|
|
70
70
|
}
|
|
71
71
|
`;
|
|
72
|
-
|
|
72
|
+
const RadioButtonContainer = styled.div `
|
|
73
|
+
display: inline-flex;
|
|
74
|
+
align-items: center;
|
|
75
|
+
position: relative;
|
|
76
|
+
margin-right: ${(props) => props.theme.grid.unit * 4}px;
|
|
77
|
+
|
|
78
|
+
&:last-child {
|
|
79
|
+
margin-right: 0;
|
|
80
|
+
}
|
|
81
|
+
`;
|
|
82
|
+
export const RadioButton = ({ checked, id, label, name, ...rest }) => (_jsxs(RadioButtonContainer, { className: "radio-button-container", children: [_jsx(Input, { checked: checked, type: "radio", name: name, id: id, ...rest }), _jsx("label", { htmlFor: id, children: label })] }));
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { RadioButton } from './RadioButton';
|
|
4
|
+
const RadioWrapper = styled.div `
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: row;
|
|
7
|
+
flex-wrap: wrap;
|
|
8
|
+
gap: ${(props) => props.theme.grid.unit * 4}px;
|
|
9
|
+
padding: ${(props) => props.theme.grid.unit * 2}px 0;
|
|
10
|
+
|
|
11
|
+
& > * {
|
|
12
|
+
margin-right: ${(props) => props.theme.grid.unit * 4}px;
|
|
13
|
+
&:last-child {
|
|
14
|
+
margin-right: 0;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
`;
|
|
18
|
+
export const StyledRadioGroup = ({ name, options, value, onChange, disabled, }) => {
|
|
19
|
+
return (_jsx(RadioWrapper, { children: options.map((option, index) => (_jsx(RadioButton, { name: name, id: `${name}-option-${index}`, label: option.label, value: option.value, checked: value === option.value, onChange: onChange, disabled: disabled }, index))) }));
|
|
20
|
+
};
|
|
@@ -13,15 +13,17 @@ const selectStyles = (theme, error, variant) => ({
|
|
|
13
13
|
: state.isFocused
|
|
14
14
|
? theme.colors.brand.default
|
|
15
15
|
: theme.colors.border.field.default,
|
|
16
|
+
borderWidth: state.isFocused ? 2 : 1,
|
|
16
17
|
boxShadow: 'none',
|
|
17
18
|
'&:hover': {
|
|
18
19
|
borderColor: error
|
|
19
20
|
? theme.colors.border.error
|
|
20
21
|
: state.isFocused
|
|
21
22
|
? theme.colors.brand.default
|
|
22
|
-
: theme.colors.text.secondary,
|
|
23
|
+
: theme.colors.text.greyMuted || theme.colors.text.secondary,
|
|
23
24
|
backgroundColor: !state.isDisabled ? '#F2FBFC' : 'transparent',
|
|
24
25
|
},
|
|
26
|
+
padding: state.isFocused ? '0 7px' : '0 8px',
|
|
25
27
|
backgroundColor: state.isDisabled
|
|
26
28
|
? '#F5F5F5'
|
|
27
29
|
: state.isFocused
|
|
@@ -61,11 +63,15 @@ const selectStyles = (theme, error, variant) => ({
|
|
|
61
63
|
overflow: 'hidden',
|
|
62
64
|
boxShadow: '0 4px 6px rgba(0, 0, 0, 0.1)',
|
|
63
65
|
}),
|
|
64
|
-
placeholder: (base) => ({
|
|
66
|
+
placeholder: (base, state) => ({
|
|
65
67
|
...base,
|
|
66
|
-
color:
|
|
68
|
+
color: state.isFocused || state.selectProps.menuIsOpen
|
|
69
|
+
? theme.colors.text.greyLight || '#C9C9C9'
|
|
70
|
+
: theme.colors.text.greyMuted ||
|
|
71
|
+
theme.colors.text.secondary ||
|
|
72
|
+
'#6E6E6E',
|
|
67
73
|
fontStyle: 'italic',
|
|
68
|
-
fontFamily:
|
|
74
|
+
fontFamily: "'PT Sans', sans-serif",
|
|
69
75
|
fontSize: theme.font.size.medium,
|
|
70
76
|
fontWeight: theme.font.weight.normal,
|
|
71
77
|
lineHeight: theme.font.lineHeight.large,
|
|
@@ -37,9 +37,9 @@ export const commonStyles = css `
|
|
|
37
37
|
color: ${(props) => props.theme.colors.text.primary};
|
|
38
38
|
|
|
39
39
|
&::placeholder {
|
|
40
|
-
color: ${(props) => props.theme.colors.text.
|
|
40
|
+
color: ${(props) => props.theme.colors.text.greyMuted || '#6E6E6E'};
|
|
41
41
|
opacity: 1;
|
|
42
|
-
font-family:
|
|
42
|
+
font-family: 'PT Sans', sans-serif;
|
|
43
43
|
font-size: ${(props) => props.theme.font.size.medium};
|
|
44
44
|
font-style: italic;
|
|
45
45
|
font-weight: ${(props) => props.theme.font.weight.normal};
|
|
@@ -48,6 +48,7 @@ export const commonStyles = css `
|
|
|
48
48
|
|
|
49
49
|
&:hover:not(:disabled) {
|
|
50
50
|
background-color: #f2fbfc;
|
|
51
|
+
border-color: ${(props) => props.theme.colors.text.greyMuted};
|
|
51
52
|
}
|
|
52
53
|
|
|
53
54
|
&:focus:not(:disabled) {
|
|
@@ -56,10 +57,20 @@ export const commonStyles = css `
|
|
|
56
57
|
? props.theme.colors.border.error
|
|
57
58
|
: props.theme.colors.brand.default};
|
|
58
59
|
background-color: #f2fbfc;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
padding: ${(props) => {
|
|
61
|
+
if (props.variant === 'small') {
|
|
62
|
+
return '0 11px';
|
|
63
|
+
}
|
|
64
|
+
if (props.variant === 'large') {
|
|
65
|
+
return '3px 15px';
|
|
62
66
|
}
|
|
67
|
+
return '0 11px';
|
|
68
|
+
}};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
&:focus::placeholder {
|
|
72
|
+
color: ${(props) => props.theme.colors.text.greyLight || '#C9C9C9'} !important;
|
|
73
|
+
opacity: 1 !important;
|
|
63
74
|
}
|
|
64
75
|
|
|
65
76
|
&:disabled {
|
|
@@ -109,16 +120,16 @@ export const TextFieldGroup = styled.div `
|
|
|
109
120
|
}
|
|
110
121
|
`;
|
|
111
122
|
export const TextFieldLabel = styled.label `
|
|
123
|
+
display: block;
|
|
112
124
|
font-family: ${(props) => props.theme.font.family.sans};
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
margin-top: ${(props) => props.theme.grid.unit}px;
|
|
118
|
-
}
|
|
125
|
+
color: ${(props) => props.theme.colors.text.primary};
|
|
126
|
+
font-size: ${(props) => props.theme.font.size.normal};
|
|
127
|
+
font-weight: ${(props) => props.theme.font.weight.normal};
|
|
128
|
+
line-height: ${(props) => props.theme.font.lineHeight.normal};
|
|
119
129
|
|
|
120
|
-
|
|
121
|
-
margin-top: ${(props) => props.theme.grid.unit}px;
|
|
130
|
+
> * {
|
|
131
|
+
margin-top: ${(props) => props.theme.grid.unit * 2}px;
|
|
132
|
+
display: block;
|
|
122
133
|
}
|
|
123
134
|
`;
|
|
124
135
|
const TextFieldWrapperStyles = styled.div `
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
export const CalendarIcon = (props) => (_jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [_jsx("path", { d: "M0.5 5.5H15.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { d: "M14 2.5H2C1.60218 2.5 1.22064 2.65804 0.93934 2.93934C0.658035 3.22064 0.5 3.60218 0.5 4V13C0.5 13.3978 0.658035 13.7794 0.93934 14.0607C1.22064 14.342 1.60218 14.5 2 14.5H14C14.3978 14.5 14.7794 14.342 15.0607 14.0607C15.342 13.7794 15.5 13.3978 15.5 13V4C15.5 3.60218 15.342 3.22064 15.0607 2.93934C14.7794 2.65804 14.3978 2.5 14 2.5V2.5Z", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { d: "M4.5 0.5V2.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { d: "M11.5 0.5V2.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })] }));
|
|
3
|
+
export default CalendarIcon;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
export const GlobeIcon = (props) => (_jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [_jsx("path", { d: "M15 8C15 4.13401 11.866 1 8 1C4.13401 1 1 4.13401 1 8C1 11.866 4.13401 15 8 15V16C3.58172 16 0 12.4183 0 8C0 3.58172 3.58172 0 8 0C12.4183 0 16 3.58172 16 8C16 12.4183 12.4183 16 8 16V15C11.866 15 15 11.866 15 8Z", fill: "currentColor" }), _jsx("path", { d: "M15.5 7.5V8.5L1 8.5L1 7.5L15.5 7.5Z", fill: "currentColor" }), _jsx("path", { d: "M10.5 8C10.5 5.89548 10.1247 4.03808 9.55859 2.74414C9.27493 2.09576 8.96317 1.63356 8.66748 1.34766C8.37657 1.06641 8.15238 1 8 1C7.84762 1 7.62343 1.06641 7.33252 1.34766C7.03683 1.63356 6.72507 2.09576 6.44141 2.74414C5.87533 4.03808 5.5 5.89548 5.5 8C5.5 10.1045 5.87533 11.9619 6.44141 13.2559C6.72507 13.9042 7.03683 14.3664 7.33252 14.6523C7.62343 14.9336 7.84762 15 8 15V16C6.067 16 4.5 12.4183 4.5 8C4.5 3.58172 6.067 0 8 0C9.933 0 11.5 3.58172 11.5 8C11.5 12.4183 9.933 16 8 16V15C8.15238 15 8.37657 14.9336 8.66748 14.6523C8.96317 14.3664 9.27493 13.9042 9.55859 13.2559C10.1247 11.9619 10.5 10.1045 10.5 8Z", fill: "currentColor" }), _jsx("path", { d: "M8 5.5C6.43859 5.5 5.00301 5.27085 3.93994 4.88428C3.41056 4.69177 2.94707 4.45051 2.60645 4.15771C2.26743 3.86625 2 3.47669 2 3H3C3 3.07559 3.04069 3.21233 3.2583 3.39941C3.47429 3.58507 3.816 3.77497 4.28174 3.94434C5.20928 4.28162 6.52384 4.5 8 4.5C9.47616 4.5 10.7907 4.28162 11.7183 3.94434C12.184 3.77497 12.5257 3.58507 12.7417 3.39941C12.9593 3.21233 13 3.07559 13 3H14C14 3.47669 13.7326 3.86625 13.3936 4.15771C13.0529 4.45051 12.5894 4.69177 12.0601 4.88428C10.997 5.27085 9.56141 5.5 8 5.5Z", fill: "currentColor" }), _jsx("path", { d: "M8 10.5C9.56141 10.5 10.997 10.7292 12.0601 11.1157C12.5894 11.3082 13.0529 11.5495 13.3936 11.8423C13.7326 12.1338 14 12.5233 14 13H13C13 12.9244 12.9593 12.7877 12.7417 12.6006C12.5257 12.4149 12.184 12.225 11.7183 12.0557C10.7907 11.7184 9.47616 11.5 8 11.5C6.52384 11.5 5.20928 11.7184 4.28174 12.0557C3.816 12.225 3.47429 12.4149 3.2583 12.6006C3.04069 12.7877 3 12.9244 3 13H2C2 12.5233 2.26743 12.1337 2.60645 11.8423C2.94707 11.5495 3.41056 11.3082 3.93994 11.1157C5.00301 10.7292 6.43859 10.5 8 10.5Z", fill: "currentColor" })] }));
|
|
3
|
+
export default GlobeIcon;
|
|
@@ -36,6 +36,7 @@ export { default as AffiliationIcon } from './affiliation';
|
|
|
36
36
|
export { default as AuthorPlaceholderIcon } from './author-placeholder';
|
|
37
37
|
export { default as AffiliationPlaceholderIcon } from './affiliation-placeholder';
|
|
38
38
|
export { default as BookIcon } from './book';
|
|
39
|
+
export { default as CalendarIcon } from './calendar';
|
|
39
40
|
export { default as ChatIcon } from './chat';
|
|
40
41
|
export { default as SystemUserAvatarIcon } from './system-user-avatar';
|
|
41
42
|
export { default as CitationCountIcon } from './citation-count';
|
|
@@ -65,6 +66,7 @@ export { default as FileUnknownIcon } from './file-unknown';
|
|
|
65
66
|
export { default as FileVideoIcon } from './file-video';
|
|
66
67
|
export { default as HandleInspectorIcon } from './handle-inspector';
|
|
67
68
|
export { default as HandleOutlineIcon } from './handle-outline';
|
|
69
|
+
export { default as GlobeIcon } from './globe';
|
|
68
70
|
export { default as HelpIcon } from './help';
|
|
69
71
|
export { default as ImageLeftIcon } from './image-left';
|
|
70
72
|
export { default as ImageDefaultIcon } from './image-default';
|
package/dist/es/index.js
CHANGED
|
@@ -13,13 +13,14 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
export { defaultTheme } from './defaultTheme';
|
|
17
16
|
export * as colors from './colors';
|
|
17
|
+
export { defaultTheme } from './defaultTheme';
|
|
18
18
|
export * from './components/AlertMessage';
|
|
19
19
|
export * from './components/Message';
|
|
20
20
|
export * from './components/Button';
|
|
21
21
|
export * from './components/ContextMenu';
|
|
22
22
|
export * from './components/RadioButton';
|
|
23
|
+
export { StyledRadioGroup, } from './components/RadioGroup';
|
|
23
24
|
export * from './components/Avatar';
|
|
24
25
|
export * from './components/Dialog';
|
|
25
26
|
export * from './components/DraggableModal';
|
|
@@ -31,6 +32,8 @@ export * from './components/SaveStatus';
|
|
|
31
32
|
export * from './components/StyledModal';
|
|
32
33
|
export * from './components/Sidebar';
|
|
33
34
|
export * from './components/TextField';
|
|
35
|
+
export * from './components/FormFieldContainer';
|
|
36
|
+
export * from './components/FormCommon';
|
|
34
37
|
export * from './components/ToggleSwitch';
|
|
35
38
|
export { ToggleHeader, ToggleIcon } from './components/ToggleHeader';
|
|
36
39
|
export * from './components/Tooltip';
|
|
@@ -45,6 +48,7 @@ export * from './components/Text';
|
|
|
45
48
|
export * from './components/RelativeDate';
|
|
46
49
|
export * from './components/Menus';
|
|
47
50
|
export * from './components/Drawer';
|
|
51
|
+
export * from './components/DatePicker';
|
|
48
52
|
export * from './components/SelectField';
|
|
49
53
|
export * from './components/SelectedItemsBox';
|
|
50
54
|
export * from './hooks/use-dropdown';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2026 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-datepicker/dist/react-datepicker.css';
|
|
17
|
+
import React from 'react';
|
|
18
|
+
export interface DatePickerProps {
|
|
19
|
+
id?: string;
|
|
20
|
+
date?: Date;
|
|
21
|
+
originalDate?: Date;
|
|
22
|
+
handleDateChange: (date: Date | null) => void;
|
|
23
|
+
placeholder?: string;
|
|
24
|
+
showTimeSelect?: boolean;
|
|
25
|
+
required?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export declare const DatePicker: React.FC<DatePickerProps>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2026 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
|
+
export declare const FieldError: React.FC<{
|
|
18
|
+
error?: string;
|
|
19
|
+
}>;
|
|
20
|
+
export declare const FieldInfo: React.FC<{
|
|
21
|
+
info?: string;
|
|
22
|
+
}>;
|
|
23
|
+
export declare const TextWithGenerationWrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
24
|
+
export declare const TextFieldError: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
25
|
+
export declare const TextFieldErrorItem: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
@@ -0,0 +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
|
+
*/
|
|
16
|
+
import { FunctionComponent, ReactElement, ReactNode } from 'react';
|
|
17
|
+
import { ErrorProps } from './Form';
|
|
18
|
+
interface FormFieldContainerProps {
|
|
19
|
+
label?: string;
|
|
20
|
+
error?: ReactNode | undefined;
|
|
21
|
+
info?: ReactNode | undefined;
|
|
22
|
+
id?: string;
|
|
23
|
+
children: ReactElement<ErrorProps>;
|
|
24
|
+
}
|
|
25
|
+
export declare const FormFieldContainer: FunctionComponent<FormFieldContainerProps>;
|
|
26
|
+
export {};
|