@manuscripts/style-guide 3.5.9 → 3.5.10
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/DatePicker.js +3 -0
- package/dist/cjs/components/FormCommon.js +1 -0
- package/dist/cjs/components/FormFieldContainer.js +1 -0
- package/dist/cjs/components/TextField.js +1 -0
- package/dist/es/components/DatePicker.js +4 -1
- package/dist/es/components/FormCommon.js +1 -0
- package/dist/es/components/FormFieldContainer.js +1 -0
- package/dist/es/components/TextField.js +1 -0
- package/package.json +1 -1
|
@@ -12,6 +12,9 @@ const styled_components_1 = __importDefault(require("styled-components"));
|
|
|
12
12
|
const icons_1 = require("./icons");
|
|
13
13
|
const DatePicker = ({ id, originalDate, date, handleDateChange, placeholder, showTimeSelect, required, }) => {
|
|
14
14
|
const [selectedDate, setSelectedDate] = (0, react_1.useState)(date || null);
|
|
15
|
+
(0, react_1.useEffect)(() => {
|
|
16
|
+
setSelectedDate(date ?? null);
|
|
17
|
+
}, [date]);
|
|
15
18
|
const handleChange = (date) => {
|
|
16
19
|
setSelectedDate(date);
|
|
17
20
|
handleDateChange(date);
|
|
@@ -45,6 +45,7 @@ exports.TextWithGenerationWrapper = styled_components_1.default.div `
|
|
|
45
45
|
`;
|
|
46
46
|
exports.TextFieldError = styled_components_1.default.div `
|
|
47
47
|
margin-top: 4px;
|
|
48
|
+
width: 100%;
|
|
48
49
|
`;
|
|
49
50
|
exports.TextFieldErrorItem = styled_components_1.default.div `
|
|
50
51
|
font-family: ${(props) => props.theme.font.family.sans};
|
|
@@ -17,6 +17,7 @@ const FormFieldContainer = ({ label, error, info, id, children, }) => {
|
|
|
17
17
|
};
|
|
18
18
|
exports.FormFieldContainer = FormFieldContainer;
|
|
19
19
|
const FormFieldInfo = styled_components_1.default.div `
|
|
20
|
+
width: 100%;
|
|
20
21
|
font-family: ${(props) => props.theme.font.family.sans};
|
|
21
22
|
font-size: ${(props) => props.theme.font.size.small};
|
|
22
23
|
color: ${(props) => props.theme.colors.text.secondary};
|
|
@@ -155,6 +155,7 @@ exports.TextFieldGroup = styled_components_1.default.div `
|
|
|
155
155
|
`;
|
|
156
156
|
exports.TextFieldLabel = styled_components_1.default.label `
|
|
157
157
|
display: block;
|
|
158
|
+
width: 100%;
|
|
158
159
|
font-family: ${(props) => props.theme.font.family.sans};
|
|
159
160
|
color: ${(props) => props.theme.colors.text.primary};
|
|
160
161
|
font-size: ${(props) => props.theme.font.size.normal};
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import 'react-datepicker/dist/react-datepicker.css';
|
|
3
|
-
import { useState } from 'react';
|
|
3
|
+
import { useEffect, useState } from 'react';
|
|
4
4
|
import ReactDatePicker from 'react-datepicker';
|
|
5
5
|
import styled from 'styled-components';
|
|
6
6
|
import { CalendarIcon } from './icons';
|
|
7
7
|
export const DatePicker = ({ id, originalDate, date, handleDateChange, placeholder, showTimeSelect, required, }) => {
|
|
8
8
|
const [selectedDate, setSelectedDate] = useState(date || null);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
setSelectedDate(date ?? null);
|
|
11
|
+
}, [date]);
|
|
9
12
|
const handleChange = (date) => {
|
|
10
13
|
setSelectedDate(date);
|
|
11
14
|
handleDateChange(date);
|
|
@@ -10,6 +10,7 @@ export const FormFieldContainer = ({ label, error, info, id, children, }) => {
|
|
|
10
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
11
|
};
|
|
12
12
|
const FormFieldInfo = styled.div `
|
|
13
|
+
width: 100%;
|
|
13
14
|
font-family: ${(props) => props.theme.font.family.sans};
|
|
14
15
|
font-size: ${(props) => props.theme.font.size.small};
|
|
15
16
|
color: ${(props) => props.theme.colors.text.secondary};
|
|
@@ -119,6 +119,7 @@ export const TextFieldGroup = styled.div `
|
|
|
119
119
|
`;
|
|
120
120
|
export const TextFieldLabel = styled.label `
|
|
121
121
|
display: block;
|
|
122
|
+
width: 100%;
|
|
122
123
|
font-family: ${(props) => props.theme.font.family.sans};
|
|
123
124
|
color: ${(props) => props.theme.colors.text.primary};
|
|
124
125
|
font-size: ${(props) => props.theme.font.size.normal};
|
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.10",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-style-guide",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|