@manuscripts/style-guide 3.4.0 → 3.4.1

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.
@@ -20,6 +20,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
21
  exports.CheckboxField = exports.CheckboxLabel = void 0;
22
22
  const styled_components_1 = __importDefault(require("styled-components"));
23
+ const CHECKED_ICON = 'data:image/svg+xml,%3Csvg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"%3E%3Cpath fill-rule="evenodd" clip-rule="evenodd" d="M0 4C0 1.79086 1.79086 0 4 0H12C14.2091 0 16 1.79086 16 4V12C16 14.2091 14.2091 16 12 16H4C1.79086 16 0 14.2091 0 12V4Z" fill="%230D79D0"/%3E%3Cpath d="M6.48052 9.81367L11.5848 4.26912C11.7499 4.08971 11.9444 4 12.1685 4C12.3926 4 12.5872 4.08971 12.7523 4.26912C12.9174 4.44842 13 4.66099 13 4.90684C13 5.15269 12.9174 5.36531 12.7523 5.54473L7.06432 11.7309C6.89916 11.9103 6.70456 12 6.48052 12C6.25648 12 6.06187 11.9103 5.89671 11.7309L3.24437 8.84968C3.07921 8.67026 2.99777 8.45763 3.00005 8.21179C3.00232 7.96594 3.08604 7.75337 3.2512 7.57407C3.41626 7.39465 3.61195 7.30495 3.83827 7.30495C4.06458 7.30495 4.26032 7.39465 4.42548 7.57407L6.48052 9.81367Z" fill="white" stroke="white" stroke-width="0.5"/%3E%3C/svg%3E';
23
24
  exports.CheckboxLabel = styled_components_1.default.label `
24
25
  input {
25
26
  border: 0;
@@ -36,39 +37,56 @@ exports.CheckboxLabel = styled_components_1.default.label `
36
37
 
37
38
  div {
38
39
  align-items: center;
39
- color: ${(props) => props.disabled ? '#aaa' : props.theme.colors.text.secondary};
40
+ font-family: ${(props) => props.theme.font.family.sans};
41
+ font-size: ${(props) => props.theme.font.size.normal};
42
+ font-weight: ${(props) => props.theme.font.weight.normal};
43
+ color: ${(props) => props.disabled
44
+ ? props.theme.colors.text.muted
45
+ : props.theme.colors.text.primary};
40
46
  display: flex;
41
47
  flex-wrap: nowrap;
42
- line-height: 16px;
43
- margin: 16px 0 8px;
48
+ line-height: 20px;
49
+ margin: 8px 0;
50
+ cursor: ${(props) => (props.disabled ? 'not-allowed' : 'pointer')};
44
51
 
45
52
  &::before {
46
- content: ' ';
53
+ content: '';
47
54
  display: inline-block;
48
55
  flex-shrink: 0;
49
56
  width: 16px;
50
57
  height: 16px;
51
- border: 1px solid ${(props) => props.theme.colors.text.secondary};
52
- border-radius: 4px;
53
- margin-right: 1em;
58
+ border: 1.5px solid ${(props) => props.theme.colors.border.field.default};
59
+ border-radius: 3px;
60
+ margin-right: 10px;
54
61
  text-align: center;
62
+ background: ${(props) => props.theme.colors.background.primary};
55
63
  }
56
64
  }
57
65
 
66
+
58
67
  input:checked + div::before {
59
- background: ${(props) => props.theme.colors.brand.default};
60
- border-color: ${(props) => props.theme.colors.brand.default};
61
- color: white;
62
- content: '✓';
68
+ background-color: transparent !important;
69
+ border-color: transparent !important;
70
+ background-image: url('${CHECKED_ICON}') !important;
71
+ background-repeat: no-repeat !important;
72
+ background-position: center !important;
73
+ background-size: cover !important;
63
74
  }
64
75
 
65
- input:focus + div::before {
66
- border-color: ${(props) => props.theme.colors.button.primary.border.hover};
76
+ input:focus-visible + div::before {
77
+ outline: none;
67
78
  }
68
79
 
69
- input:focus-visible + div::before {
70
- outline: 2px solid ${(props) => props.theme.colors.outline.focus};
71
- outline-offset: 2px;
80
+ input:disabled + div::before {
81
+ background: ${(props) => props.theme.colors.background.fifth};
82
+ border-color: ${(props) => props.theme.colors.border.field.default};
83
+ }
84
+ input:disabled + div {
85
+ color: ${(props) => props.theme.colors.text.secondary};
86
+ }
87
+
88
+ input:checked:disabled + div::before {
89
+ filter: grayscale(1) opacity(0.4);
72
90
  }
73
91
  `;
74
92
  exports.CheckboxField = styled_components_1.default.input.attrs({
@@ -42,7 +42,7 @@ const styled_components_1 = __importDefault(require("styled-components"));
42
42
  const Button_1 = require("./Button");
43
43
  const Icons = __importStar(require("./icons"));
44
44
  const ContextMenuIconButton = (0, styled_components_1.default)(Button_1.IconButton) `
45
- color: #6e6e6e;
45
+ color: ${(props) => props.theme.colors.text.secondary};
46
46
  &:not([disabled]).selected {
47
47
  background-color: #c9c9c9;
48
48
  }
@@ -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.FormError = exports.FormActions = exports.FormHeader = exports.CenteredForm = void 0;
21
+ exports.InputErrorText = exports.InputHelperText = exports.LabelText = exports.Label = exports.FormSubtitle = exports.FormTitle = exports.FormActionsBar = exports.FormLabel = exports.FormRow = exports.FormField = exports.FormContainer = exports.FormError = exports.FormActions = exports.FormHeader = exports.CenteredForm = void 0;
22
22
  const formik_1 = require("formik");
23
23
  const styled_components_1 = __importDefault(require("styled-components"));
24
24
  exports.CenteredForm = (0, styled_components_1.default)(formik_1.Form) `
@@ -49,3 +49,96 @@ exports.FormError = styled_components_1.default.div `
49
49
  position: relative;
50
50
  padding: 12px;
51
51
  `;
52
+ exports.FormContainer = styled_components_1.default.div `
53
+ margin: 0 auto;
54
+ display: flex;
55
+ flex-direction: column;
56
+ gap: ${(props) => props.theme.grid.unit * 4}px;
57
+ padding: ${(props) => props.theme.grid.unit * 4}px;
58
+ box-sizing: border-box;
59
+ `;
60
+ exports.FormField = styled_components_1.default.div `
61
+ display: flex;
62
+ flex-direction: column;
63
+ gap: 4px;
64
+ `;
65
+ exports.FormRow = styled_components_1.default.div `
66
+ display: flex;
67
+ flex-direction: ${(props) => props.direction ?? 'column'};
68
+ gap: ${(props) => props.theme.grid.unit * 2}px;
69
+ margin-bottom: ${(props) => props.theme.grid.unit * 4}px;
70
+ justify-content: ${(props) => props.justify ?? 'flex-start'};
71
+ align-items: ${(props) => props.align ?? (props.direction === 'row' ? 'center' : 'stretch')};
72
+ flex-wrap: ${(props) => (props.direction === 'row' ? 'wrap' : 'nowrap')};
73
+ `;
74
+ exports.FormLabel = styled_components_1.default.legend `
75
+ &:not(:first-child) {
76
+ margin-top: 15px;
77
+ }
78
+ margin-bottom: 15px;
79
+ font: ${(props) => props.theme.font.weight.normal}
80
+ ${(props) => props.theme.font.size.xlarge} /
81
+ ${(props) => props.theme.font.lineHeight.large}
82
+ ${(props) => props.theme.font.family.sans};
83
+ letter-spacing: -0.4px;
84
+ color: ${(props) => props.theme.colors.text.secondary};
85
+ `;
86
+ exports.FormActionsBar = styled_components_1.default.div `
87
+ display: flex;
88
+ flex-wrap: wrap;
89
+ justify-content: flex-end;
90
+ gap: ${(props) => props.theme.grid.unit * 2}px;
91
+ margin-top: ${(props) => props.theme.grid.unit * 3}px;
92
+ `;
93
+ exports.FormTitle = styled_components_1.default.h2 `
94
+ margin: 0;
95
+ font: ${(props) => props.theme.font.weight.medium}
96
+ ${(props) => props.theme.font.size.xlarge} /
97
+ ${(props) => props.theme.font.lineHeight.normal}
98
+ ${(props) => props.theme.font.family.sans};
99
+ color: ${(props) => props.theme.colors.text.primary};
100
+ `;
101
+ exports.FormSubtitle = styled_components_1.default.p `
102
+ margin: 0;
103
+ color: ${(props) => props.theme.colors.text.secondary};
104
+ font: ${(props) => props.theme.font.weight.normal}
105
+ ${(props) => props.theme.font.size.medium} /
106
+ ${(props) => props.theme.font.lineHeight.large}
107
+ ${(props) => props.theme.font.family.sans};
108
+ `;
109
+ exports.Label = styled_components_1.default.label `
110
+ display: inline-flex;
111
+ align-items: center;
112
+ gap: ${(props) => props.theme.grid.unit}px;
113
+ color: ${(props) => props.theme.colors.text.secondary};
114
+ font: ${(props) => props.theme.font.weight.normal}
115
+ ${(props) => props.theme.font.size.normal} /
116
+ ${(props) => props.theme.font.lineHeight.normal}
117
+ ${(props) => props.theme.font.family.sans};
118
+ `;
119
+ exports.LabelText = styled_components_1.default.div `
120
+ font: ${(props) => props.theme.font.weight.normal}
121
+ ${(props) => props.theme.font.size.normal} / 1
122
+ ${(props) => props.theme.font.family.sans};
123
+ letter-spacing: -0.2px;
124
+ color: ${(props) => props.theme.colors.text.primary};
125
+ &::before {
126
+ margin-right: 8px !important;
127
+ }
128
+ `;
129
+ exports.InputHelperText = styled_components_1.default.span `
130
+ color: ${(props) => props.theme.colors.text.muted};
131
+ font: ${(props) => props.theme.font.weight.normal}
132
+ ${(props) => props.theme.font.size.small} /
133
+ ${(props) => props.theme.font.lineHeight.normal}
134
+ ${(props) => props.theme.font.family.sans};
135
+ `;
136
+ exports.InputErrorText = styled_components_1.default.span `
137
+ color: ${(props) => props.theme.colors.text.error};
138
+ font: ${(props) => props.theme.font.weight.normal}
139
+ ${(props) => props.theme.font.size.small} /
140
+ ${(props) => props.theme.font.lineHeight.normal}
141
+ ${(props) => props.theme.font.family.sans};
142
+ display: block;
143
+ margin-top: 4px;
144
+ `;
@@ -9,7 +9,7 @@ const styled_components_1 = __importDefault(require("styled-components"));
9
9
  const isMac = /Mac/.test(window.navigator.platform);
10
10
  exports.ShortcutContainer = styled_components_1.default.div `
11
11
  display: inline-flex;
12
- color: #6e6e6e;
12
+ color: ${(props) => props.theme.colors.text.secondary};
13
13
  margin-left: 16px;
14
14
  flex-shrink: 0;
15
15
  justify-content: flex-end;
@@ -15,8 +15,8 @@ const Container = styled_components_1.default.div `
15
15
  flex-wrap: wrap;
16
16
  gap: 4px;
17
17
  align-items: center;
18
- padding: 0;
19
- background: hotpink
18
+ padding: 4px 8px;
19
+ background: ${(props) => props.theme.colors.background.primary};
20
20
 
21
21
 
22
22
  &:hover Input {
@@ -49,7 +49,7 @@ const RemoveButton = styled_components_1.default.button `
49
49
  width: 10px;
50
50
  height: 10px;
51
51
  color: white;
52
- background: #6e6e6e;
52
+ background: ${(props) => props.theme.colors.text.secondary};
53
53
  margin-left: 4px;
54
54
  border: none;
55
55
  border-radius: 100%;
@@ -7,49 +7,72 @@ exports.RadioButton = void 0;
7
7
  const jsx_runtime_1 = require("react/jsx-runtime");
8
8
  const styled_components_1 = __importDefault(require("styled-components"));
9
9
  const Input = styled_components_1.default.input `
10
- position: absolute;
11
- left: -9999px;
12
- opacity: 0;
10
+ border: 0;
11
+ clip: rect(0 0 0 0);
12
+ clip-path: inset(50%);
13
+ height: 1px;
14
+ margin: -1px;
15
+ overflow: hidden;
16
+ padding: 0;
17
+ position: absolute;
18
+ white-space: nowrap;
19
+ width: 1px;
13
20
 
14
- + label {
15
- cursor: pointer;
16
- margin: 0;
17
- display: inline-block;
18
- font-size: ${(props) => props.theme.font.size.large};
19
- color: ${(props) => props.theme.colors.text.primary};
20
- line-height: ${(props) => props.theme.font.lineHeight.large};
21
- margin-bottom: ${(props) => props.theme.grid.unit}px;
22
- position: relative;
23
- padding-left: ${(props) => props.theme.grid.unit * 7}px;
24
- text-align: left;
21
+ + label {
22
+ cursor: pointer;
23
+ margin: 0;
24
+ display: inline-flex;
25
+ align-items: center;
26
+ font-family: ${(props) => props.theme.font.family.sans};
27
+ font-size: ${(props) => props.theme.font.size.normal};
28
+ font-weight: ${(props) => props.theme.font.weight.normal};
29
+ color: ${(props) => props.theme.colors.text.primary};
30
+ line-height: 20px;
31
+ margin-bottom: ${(props) => props.theme.grid.unit}px;
32
+ position: relative;
33
+ padding-left: 24px;
34
+ text-align: left;
35
+ user-select: none;
25
36
 
26
- &::before {
27
- border: 2px solid ${(props) => props.theme.colors.background.primary};
28
- border-radius: 50%;
29
- box-shadow: 0 0 0 1px
30
- ${(props) => props.theme.colors.text.primary};
31
- box-sizing: border-box;
32
- content: ' ';
33
- display: block;
34
- height: 18px;
35
- position: absolute;
36
- left: 0;
37
- top: ${(props) => props.theme.grid.unit}px;
38
- width: 18px;
39
- z-index: 0;
40
- }
37
+ &::before {
38
+ border: 1.5px solid ${(props) => props.theme.colors.border.field.default};
39
+ border-radius: 50%;
40
+ box-sizing: border-box;
41
+ content: ' ';
42
+ display: block;
43
+ height: 16px;
44
+ width: 16px;
45
+ position: absolute;
46
+ left: 0;
47
+ top: 50%;
48
+ transform: translateY(-50%);
49
+ background: ${(props) => props.theme.colors.background.primary};
41
50
  }
51
+ }
42
52
 
43
- &:checked + label::before {
44
- background: ${(props) => props.theme.colors.brand.medium};
45
- box-shadow: 0 0 0 1px ${(props) => props.theme.colors.brand.medium};
46
- }
47
- &:hover,
48
- &:focus {
49
- + label::before {
50
- box-shadow: 0 0 0 1px ${(props) => props.theme.colors.brand.medium};
51
- }
52
- }
53
+ &:checked + label::before {
54
+ background: ${(props) => props.theme.colors.background.primary};
55
+ box-shadow: inset 0 0 0 4px #0d79d0;
56
+ border-color: #0d79d0;
57
+ }
58
+
59
+ &:hover:not(:disabled) + label::before {
60
+ border-color: ${(props) => props.theme.colors.text.secondary};
61
+ }
62
+
63
+ &:focus-visible + label::before {
64
+ border-color: #0d79d0;
65
+ }
66
+
67
+ &:disabled + label {
68
+ color: ${(props) => props.theme.colors.text.secondary};
69
+ cursor: not-allowed;
70
+ }
71
+
72
+ &:disabled + label::before {
73
+ background: #c9c9c9;
74
+ filter: grayscale(1) opacity(0.4);
75
+ border-color: #e4e4e4;
53
76
  }
54
77
  `;
55
78
  const RadioButton = ({ checked, id, label, name, ...rest }) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Input, { checked: checked, type: "radio", name: name, id: id, ...rest }), (0, jsx_runtime_1.jsx)("label", { htmlFor: id, children: label })] }));
@@ -6,5 +6,94 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.SelectField = void 0;
7
7
  const jsx_runtime_1 = require("react/jsx-runtime");
8
8
  const react_select_1 = __importDefault(require("react-select"));
9
- const SelectField = ({ id, options, field, form, }) => ((0, jsx_runtime_1.jsx)(react_select_1.default, { inputId: id, options: options, name: field.name, classNamePrefix: field.name, value: options?.find((option) => option.value === field.value), onChange: (option) => form.setFieldValue(field.name, option?.value), onBlur: field.onBlur }));
9
+ const styled_components_1 = require("styled-components");
10
+ const selectStyles = (theme, error, variant) => ({
11
+ control: (base, state) => ({
12
+ ...base,
13
+ minHeight: variant === 'large' ? 40 : 32,
14
+ borderRadius: 3,
15
+ fontFamily: theme.font.family.sans,
16
+ fontSize: theme.font.size.medium,
17
+ borderColor: error
18
+ ? theme.colors.border.error
19
+ : state.isFocused
20
+ ? theme.colors.brand.default
21
+ : theme.colors.border.field.default,
22
+ boxShadow: 'none',
23
+ '&:hover': {
24
+ borderColor: error
25
+ ? theme.colors.border.error
26
+ : state.isFocused
27
+ ? theme.colors.brand.default
28
+ : theme.colors.text.secondary,
29
+ backgroundColor: !state.isDisabled ? '#F2FBFC' : 'transparent',
30
+ },
31
+ backgroundColor: state.isDisabled
32
+ ? '#F5F5F5'
33
+ : state.isFocused
34
+ ? '#F2FBFC'
35
+ : theme.colors.background.primary,
36
+ transition: 'border-color 120ms ease, box-shadow 120ms ease',
37
+ cursor: state.isDisabled ? 'not-allowed' : 'pointer',
38
+ }),
39
+ valueContainer: (base) => ({
40
+ ...base,
41
+ padding: '0 8px',
42
+ }),
43
+ singleValue: (base, state) => ({
44
+ ...base,
45
+ color: state.isDisabled ? '#B3B3B3' : theme.colors.text.primary,
46
+ fontFamily: theme.font.family.sans,
47
+ fontSize: theme.font.size.medium,
48
+ }),
49
+ option: (base, state) => ({
50
+ ...base,
51
+ fontFamily: theme.font.family.sans,
52
+ fontSize: theme.font.size.medium,
53
+ backgroundColor: state.isSelected
54
+ ? theme.colors.brand.default
55
+ : state.isFocused
56
+ ? '#F2FBFC'
57
+ : theme.colors.background.primary,
58
+ color: state.isSelected ? '#FFF' : theme.colors.text.primary,
59
+ '&:active': {
60
+ backgroundColor: theme.colors.brand.default,
61
+ color: '#FFF',
62
+ },
63
+ }),
64
+ menu: (base) => ({
65
+ ...base,
66
+ borderRadius: 3,
67
+ overflow: 'hidden',
68
+ boxShadow: '0 4px 6px rgba(0, 0, 0, 0.1)',
69
+ }),
70
+ placeholder: (base) => ({
71
+ ...base,
72
+ color: theme.colors.text.secondary,
73
+ fontStyle: 'italic',
74
+ fontFamily: theme.font.family.sans,
75
+ fontSize: theme.font.size.medium,
76
+ fontWeight: theme.font.weight.normal,
77
+ lineHeight: theme.font.lineHeight.large,
78
+ }),
79
+ dropdownIndicator: (base, state) => ({
80
+ ...base,
81
+ color: state.isDisabled ? '#B3B3B3' : theme.colors.text.secondary,
82
+ '&:hover': {
83
+ color: state.isDisabled ? '#B3B3B3' : theme.colors.text.primary,
84
+ },
85
+ }),
86
+ });
87
+ const SelectField = ({ id, options, field, form, error, variant, isDisabled, ...rest }) => {
88
+ const theme = (0, styled_components_1.useTheme)();
89
+ const name = field?.name || '';
90
+ const value = field?.value;
91
+ return ((0, jsx_runtime_1.jsx)(react_select_1.default, { inputId: id, options: options, name: name, classNamePrefix: name, value: options?.find((option) => option.value === value), onChange: (option) => form?.setFieldValue(name, option?.value), onBlur: field?.onBlur, styles: selectStyles(theme, error, variant), isDisabled: form?.isSubmitting || isDisabled, ...rest, theme: (base) => ({
92
+ ...base,
93
+ colors: {
94
+ ...base.colors,
95
+ primary: theme.colors.brand.default || base.colors.primary,
96
+ },
97
+ }) }));
98
+ };
10
99
  exports.SelectField = SelectField;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.StyledModal = exports.ScrollableModalContent = exports.ModelContent = exports.ModalSidebarTitle = exports.ModalSidebarHeader = exports.ModalSidebar = exports.ModalBody = exports.CloseButton = exports.ModalHeader = exports.ModalContainer = void 0;
6
+ exports.StyledModal = exports.ModalTitle = exports.ModalCardBody = exports.ScrollableModalContent = exports.ModelContent = exports.ModalSidebarTitle = exports.ModalSidebarHeader = exports.ModalSidebar = exports.ModalBody = exports.CloseButton = exports.ModalHeader = exports.ModalContainer = void 0;
7
7
  const jsx_runtime_1 = require("react/jsx-runtime");
8
8
  const react_modal_1 = __importDefault(require("react-modal"));
9
9
  const styled_components_1 = __importDefault(require("styled-components"));
@@ -100,6 +100,25 @@ exports.ScrollableModalContent = (0, styled_components_1.default)(exports.ModelC
100
100
  overflow-y: auto;
101
101
  max-height: 100%;
102
102
  `;
103
+ exports.ModalCardBody = styled_components_1.default.div `
104
+ box-sizing: border-box;
105
+ padding: ${(props) => 6 * props.theme.grid.unit}px;
106
+ background-color: ${(props) => props.theme.colors.background.primary};
107
+ width: ${(props) => props.width
108
+ ? typeof props.width === 'number'
109
+ ? `${props.width}px`
110
+ : props.width
111
+ : '640px'};
112
+ max-width: 60vw;
113
+ max-height: 80vh;
114
+ `;
115
+ exports.ModalTitle = styled_components_1.default.h2 `
116
+ font-family: ${(props) => props.theme.font.family.sans};
117
+ font-size: ${(props) => props.theme.font.size.medium};
118
+ font-weight: ${(props) => props.theme.font.weight.bold};
119
+ color: ${(props) => props.theme.colors.text.primary};
120
+ margin: 0 0 20px 0;
121
+ `;
103
122
  exports.StyledModal = (0, styled_components_1.default)(ReactModalAdapter).attrs({
104
123
  closeTimeoutMS: totalTransitionTime,
105
124
  overlayClassName: {
@@ -33,37 +33,79 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.TextFieldWrapper = exports.TextFieldLabel = exports.TextFieldGroup = exports.TextArea = exports.TextField = exports.commonStyles = void 0;
36
+ exports.TextFieldWrapper = exports.TextFieldLabel = exports.TextFieldGroup = exports.YearField = exports.YearInput = exports.TextArea = exports.TextField = exports.commonStyles = void 0;
37
37
  const jsx_runtime_1 = require("react/jsx-runtime");
38
+ const formik_1 = require("formik");
38
39
  const styled_components_1 = __importStar(require("styled-components"));
39
40
  exports.commonStyles = (0, styled_components_1.css) `
40
41
  border: 1px solid
41
42
  ${(props) => props.error
42
43
  ? props.theme.colors.border.error
43
44
  : props.theme.colors.border.field.default};
44
- border-radius: ${(props) => props.theme.grid.radius.small};
45
+ border-radius: 3px;
45
46
  box-sizing: border-box;
46
47
  font: ${(props) => props.theme.font.weight.normal}
47
48
  ${(props) => props.theme.font.size.medium} / 1
48
49
  ${(props) => props.theme.font.family.sans};
50
+ line-height: ${(props) => props.theme.font.lineHeight.large};
49
51
  outline: none;
50
- padding: 10px ${(props) => props.theme.grid.unit * 4}px;
52
+ padding: ${(props) => {
53
+ if (props.variant === 'small') {
54
+ return '0 12px';
55
+ }
56
+ if (props.variant === 'large') {
57
+ return '4px 16px';
58
+ }
59
+ return '0 12px';
60
+ }};
61
+ min-height: ${(props) => {
62
+ if (props.variant === 'small') {
63
+ return '32px';
64
+ }
65
+ if (props.variant === 'large') {
66
+ return '40px';
67
+ }
68
+ return '40px';
69
+ }};
51
70
  position: relative;
52
71
  width: 100%;
53
- ${(props) => props.error && 'z-index: 2'};
72
+ background-color: #fff;
73
+ color: ${(props) => props.theme.colors.text.primary};
74
+
75
+ &::placeholder {
76
+ color: ${(props) => props.theme.colors.text.secondary};
77
+ opacity: 1;
78
+ font-family: ${(props) => props.theme.font.family.sans};
79
+ font-size: ${(props) => props.theme.font.size.medium};
80
+ font-style: italic;
81
+ font-weight: ${(props) => props.theme.font.weight.normal};
82
+ line-height: ${(props) => props.theme.font.lineHeight.large};
83
+ }
54
84
 
55
- &:focus {
56
- border-color: ${(props) => props.theme.colors.border.field.hover};
57
- background-color: ${(props) => props.theme.colors.background.fifth};
85
+ &:hover:not(:disabled) {
86
+ background-color: #f2fbfc;
58
87
  }
59
88
 
60
- &:hover {
61
- background-color: ${(props) => props.theme.colors.background.fifth};
89
+ &:focus:not(:disabled) {
90
+ border: 2px solid
91
+ ${(props) => props.error
92
+ ? props.theme.colors.border.error
93
+ : props.theme.colors.brand.default};
94
+ background-color: #f2fbfc;
95
+
96
+ &::placeholder {
97
+ color: #c9c9c9;
98
+ }
62
99
  }
63
100
 
64
- &:invalid {
65
- box-shadow: none;
101
+ &:disabled {
102
+ background-color: #f5f5f5;
103
+ border-color: #e4e4e4;
104
+ color: #b3b3b3;
105
+ cursor: not-allowed;
66
106
  }
107
+
108
+ ${(props) => props.error && 'z-index: 2'};
67
109
  `;
68
110
  exports.TextField = styled_components_1.default.input `
69
111
  display: block;
@@ -73,6 +115,10 @@ exports.TextArea = styled_components_1.default.textarea `
73
115
  ${exports.commonStyles}
74
116
  max-width: 100%;
75
117
  `;
118
+ exports.YearInput = styled_components_1.default.input `
119
+ ${exports.commonStyles}
120
+ `;
121
+ exports.YearField = (0, styled_components_1.default)(formik_1.Field).attrs({ as: exports.YearInput }) ``;
76
122
  exports.TextFieldGroup = styled_components_1.default.div `
77
123
  & ${exports.TextField}:first-of-type {
78
124
  margin-top: ${(props) => props.theme.grid.unit}px;
@@ -0,0 +1,69 @@
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.ToggleSwitch = void 0;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const styled_components_1 = __importDefault(require("styled-components"));
9
+ const Track = styled_components_1.default.button `
10
+ position: relative;
11
+ width: 30px;
12
+ height: 16px;
13
+ border-radius: 999px;
14
+ border: 1px solid
15
+ ${(props) => props.checked ? '#0d79d0' : props.theme.colors.text.secondary};
16
+ background: ${(props) => props.checked ? '#0d79d0' : props.theme.colors.text.secondary};
17
+ padding: 0;
18
+ cursor: ${(props) => (props.disabled ? 'not-allowed' : 'pointer')};
19
+ transition:
20
+ background-color 120ms ease,
21
+ border-color 120ms ease,
22
+ box-shadow 120ms ease;
23
+ outline: none;
24
+ flex-shrink: 0;
25
+
26
+ &:focus-visible {
27
+ box-shadow: 0 0 0 2px #0d79d04d;
28
+ }
29
+
30
+ &:disabled {
31
+ background: #c9c9c9;
32
+ border-color: #c9c9c9;
33
+ }
34
+ `;
35
+ const Thumb = styled_components_1.default.span `
36
+ position: absolute;
37
+ top: 0;
38
+ left: ${(props) => (props.checked ? '14px' : '0px')};
39
+ width: 14px;
40
+ height: 14px;
41
+ border-radius: 50%;
42
+ background: #fff;
43
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
44
+ transition: left 120ms ease;
45
+
46
+ ${(props) => props.disabled &&
47
+ `
48
+ background: #fdfdfd;
49
+ box-shadow: none;
50
+ `}
51
+ `;
52
+ const LabelText = styled_components_1.default.span `
53
+ color: ${(props) => props.disabled ? '#b3b3b3' : props.theme.colors.text.primary};
54
+ font: ${(props) => props.theme.font.weight.normal}
55
+ ${(props) => props.theme.font.size.medium} / 1
56
+ ${(props) => props.theme.font.family.sans};
57
+ line-height: 20px;
58
+ `;
59
+ const Container = styled_components_1.default.label `
60
+ display: inline-flex;
61
+ align-items: center;
62
+ gap: 8px;
63
+ cursor: pointer;
64
+ flex-direction: ${(props) => props.labelPosition === 'left' ? 'row' : 'row-reverse'};
65
+ `;
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 }) })] }));
68
+ };
69
+ exports.ToggleSwitch = ToggleSwitch;
package/dist/cjs/index.js CHANGED
@@ -51,6 +51,7 @@ __exportStar(require("./components/TextField"), exports);
51
51
  __exportStar(require("./components/TextFieldContainer"), exports);
52
52
  __exportStar(require("./components/TextFieldError"), exports);
53
53
  __exportStar(require("./components/TextFieldGroupContainer"), exports);
54
+ __exportStar(require("./components/ToggleSwitch"), exports);
54
55
  var ToggleHeader_1 = require("./components/ToggleHeader");
55
56
  Object.defineProperty(exports, "ToggleHeader", { enumerable: true, get: function () { return ToggleHeader_1.ToggleHeader; } });
56
57
  Object.defineProperty(exports, "ToggleIcon", { enumerable: true, get: function () { return ToggleHeader_1.ToggleIcon; } });