@financial-times/o3-form 0.4.0 → 0.5.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/cjs/CheckBox.d.ts +1 -1
- package/cjs/CheckBox.js +5 -0
- package/cjs/Error-summary.d.ts +1 -1
- package/cjs/PasswordInput.d.ts +1 -4
- package/cjs/PasswordInput.js +8 -4
- package/cjs/RadioButton.d.ts +1 -1
- package/cjs/RadioButton.js +6 -4
- package/cjs/TextInput.d.ts +1 -1
- package/cjs/TextInput.js +5 -2
- package/cjs/fieldComponents/Feedback.d.ts +1 -1
- package/cjs/fieldComponents/FormField.d.ts +4 -4
- package/cjs/fieldComponents/FormField.js +5 -2
- package/cjs/{index-CHdbHHZ0.d.ts → index-D6jDTWIC.d.ts} +5 -1
- package/cjs/index.d.ts +1 -1
- package/css/core.css +23 -0
- package/css/internal.css +23 -0
- package/css/main.css +70 -44
- package/css/professional.css +23 -0
- package/css/sustainable-views.css +23 -0
- package/css/whitelabel.css +11 -11
- package/esm/CheckBox.d.ts +1 -1
- package/esm/CheckBox.js +5 -0
- package/esm/Error-summary.d.ts +1 -1
- package/esm/PasswordInput.d.ts +1 -4
- package/esm/PasswordInput.js +8 -4
- package/esm/RadioButton.d.ts +1 -1
- package/esm/RadioButton.js +6 -4
- package/esm/TextInput.d.ts +1 -1
- package/esm/TextInput.js +5 -2
- package/esm/fieldComponents/Feedback.d.mts +1 -1
- package/esm/fieldComponents/FormField.d.mts +4 -4
- package/esm/fieldComponents/FormField.js +5 -2
- package/esm/{index-CHdbHHZ0.d.ts → index-D6jDTWIC.d.ts} +5 -1
- package/esm/index.d.ts +1 -1
- package/package.json +1 -1
package/cjs/CheckBox.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { C as CheckBoxProps, F as FormFieldsetProps } from './index-
|
|
2
|
+
import { C as CheckBoxProps, F as FormFieldsetProps } from './index-D6jDTWIC.js';
|
|
3
3
|
|
|
4
4
|
declare const CheckBoxItem: (props: CheckBoxProps) => react_jsx_runtime.JSX.Element;
|
|
5
5
|
declare const CheckBox: (props: CheckBoxProps) => react_jsx_runtime.JSX.Element;
|
package/cjs/CheckBox.js
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _jsxruntime = require('react/jsx-runtime');
|
|
2
2
|
var _react = require('react');
|
|
3
|
+
var _outils = require('@financial-times/o-utils');
|
|
3
4
|
var _FormField = require('./fieldComponents/FormField');
|
|
5
|
+
const uniqueId = _outils.uidBuilder.call(void 0, "o3-form-checkbox-input");
|
|
4
6
|
const CheckBoxItem = (props) => {
|
|
5
7
|
let { inputId, attributes, optional, error } = props;
|
|
8
|
+
if (!inputId) {
|
|
9
|
+
inputId = uniqueId("_");
|
|
10
|
+
}
|
|
6
11
|
const classNames = ["o3-form-input-checkbox__input", "o3-visually-hidden"];
|
|
7
12
|
if (error) {
|
|
8
13
|
classNames.push("o3-form-input-error");
|
package/cjs/Error-summary.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { E as ErrorSummaryProps } from './index-
|
|
2
|
+
import { E as ErrorSummaryProps } from './index-D6jDTWIC.js';
|
|
3
3
|
|
|
4
4
|
declare const ErrorSummary: ({ errors, errorMessage, }: ErrorSummaryProps) => react_jsx_runtime.JSX.Element;
|
|
5
5
|
|
package/cjs/PasswordInput.d.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
2
|
+
import { P as PasswordInputProps } from './index-D6jDTWIC.js';
|
|
3
3
|
|
|
4
|
-
interface PasswordInputProps extends FormFieldProps {
|
|
5
|
-
disabled?: boolean;
|
|
6
|
-
}
|
|
7
4
|
declare const PasswordInput: ({ label, feedback, description, disabled, attributes, inputId, optional, }: PasswordInputProps) => react_jsx_runtime.JSX.Element;
|
|
8
5
|
|
|
9
6
|
export { PasswordInput };
|
package/cjs/PasswordInput.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _jsxruntime = require('react/jsx-runtime');
|
|
2
|
+
var _outils = require('@financial-times/o-utils');
|
|
2
3
|
var _FormField = require('./fieldComponents/FormField');
|
|
3
4
|
var _CheckBox = require('./CheckBox');
|
|
5
|
+
const uniqueId = _outils.uidBuilder.call(void 0, "o3-form-password-input");
|
|
4
6
|
const PasswordInput = ({
|
|
5
7
|
label,
|
|
6
8
|
feedback,
|
|
@@ -10,6 +12,8 @@ const PasswordInput = ({
|
|
|
10
12
|
inputId,
|
|
11
13
|
optional
|
|
12
14
|
}) => {
|
|
15
|
+
const id = inputId || uniqueId("_");
|
|
16
|
+
const showPasswordId = `${id}-showPassword`;
|
|
13
17
|
const inputClasses = ["o3-form", "o3-form-text-input"];
|
|
14
18
|
if (feedback && feedback.type === "error") {
|
|
15
19
|
inputClasses.push("o3-form-text-input--error");
|
|
@@ -21,13 +25,13 @@ const PasswordInput = ({
|
|
|
21
25
|
label,
|
|
22
26
|
feedback,
|
|
23
27
|
description,
|
|
24
|
-
inputId,
|
|
28
|
+
inputId: id,
|
|
25
29
|
optional,
|
|
26
30
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
27
31
|
"input",
|
|
28
32
|
{
|
|
29
33
|
...attributes,
|
|
30
|
-
id
|
|
34
|
+
id,
|
|
31
35
|
disabled,
|
|
32
36
|
className: inputClasses.join(" "),
|
|
33
37
|
required: !optional,
|
|
@@ -42,11 +46,11 @@ const PasswordInput = ({
|
|
|
42
46
|
_CheckBox.CheckBoxItem,
|
|
43
47
|
{
|
|
44
48
|
attributes: { disabled },
|
|
45
|
-
inputId:
|
|
49
|
+
inputId: showPasswordId,
|
|
46
50
|
checkboxLabel: "Show Password"
|
|
47
51
|
}
|
|
48
52
|
),
|
|
49
|
-
!disabled && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "a", { href: "", children: "Forgot password?" })
|
|
53
|
+
!disabled && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "a", { className: "o3-typography-link", href: "", children: "Forgot password?" })
|
|
50
54
|
] })
|
|
51
55
|
] });
|
|
52
56
|
};
|
package/cjs/RadioButton.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { R as RadioButtonProps, F as FormFieldsetProps } from './index-
|
|
2
|
+
import { R as RadioButtonProps, F as FormFieldsetProps } from './index-D6jDTWIC.js';
|
|
3
3
|
|
|
4
4
|
declare const RadioButtonItem: (props: RadioButtonProps) => react_jsx_runtime.JSX.Element;
|
|
5
5
|
declare const RadioButtonGroup: (props: FormFieldsetProps) => react_jsx_runtime.JSX.Element;
|
package/cjs/RadioButton.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _jsxruntime = require('react/jsx-runtime');
|
|
2
2
|
var _react = require('react');
|
|
3
|
+
var _outils = require('@financial-times/o-utils');
|
|
3
4
|
var _FormField = require('./fieldComponents/FormField');
|
|
5
|
+
const uniqueId = _outils.uidBuilder.call(void 0, "o3-form-radio-button-input");
|
|
4
6
|
const RadioButtonItem = (props) => {
|
|
5
7
|
let { inputId, attributes, optional, error } = props;
|
|
6
|
-
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
];
|
|
8
|
+
if (!inputId) {
|
|
9
|
+
inputId = uniqueId("_");
|
|
10
|
+
}
|
|
11
|
+
const classNames = ["o3-form-input-radio-button", "o3-visually-hidden"];
|
|
10
12
|
if (error) {
|
|
11
13
|
classNames.push("o3-form-input-error");
|
|
12
14
|
}
|
package/cjs/TextInput.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { T as TextInputProps } from './index-
|
|
2
|
+
import { T as TextInputProps } from './index-D6jDTWIC.js';
|
|
3
3
|
|
|
4
4
|
declare const TextInput: ({ label, feedback, description, disabled, length, attributes, inputId, optional, }: TextInputProps) => react_jsx_runtime.JSX.Element;
|
|
5
5
|
|
package/cjs/TextInput.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _jsxruntime = require('react/jsx-runtime');
|
|
2
|
+
var _outils = require('@financial-times/o-utils');
|
|
2
3
|
var _FormField = require('./fieldComponents/FormField');
|
|
4
|
+
const uniqueId = _outils.uidBuilder.call(void 0, "o3-form-text-input");
|
|
3
5
|
const TextInput = ({
|
|
4
6
|
label,
|
|
5
7
|
feedback,
|
|
@@ -10,6 +12,7 @@ const TextInput = ({
|
|
|
10
12
|
inputId,
|
|
11
13
|
optional
|
|
12
14
|
}) => {
|
|
15
|
+
const id = inputId || uniqueId("_");
|
|
13
16
|
const inputClasses = ["o3-form", "o3-form-text-input"];
|
|
14
17
|
if (feedback && feedback.type === "error") {
|
|
15
18
|
inputClasses.push("o3-form-text-input--error");
|
|
@@ -23,13 +26,13 @@ const TextInput = ({
|
|
|
23
26
|
label,
|
|
24
27
|
feedback,
|
|
25
28
|
description,
|
|
26
|
-
inputId,
|
|
29
|
+
inputId: id,
|
|
27
30
|
optional,
|
|
28
31
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
29
32
|
"input",
|
|
30
33
|
{
|
|
31
34
|
...attributes,
|
|
32
|
-
id
|
|
35
|
+
id,
|
|
33
36
|
disabled,
|
|
34
37
|
className: inputClasses.join(" "),
|
|
35
38
|
required: !optional,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
2
|
+
import { a as FeedbackProps } from '../index-D6jDTWIC.js';
|
|
3
3
|
|
|
4
4
|
declare const Feedback: ({ message, type }: FeedbackProps) => react_jsx_runtime.JSX.Element;
|
|
5
5
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
2
|
+
import { b as FormFieldProps, F as FormFieldsetProps } from '../index-D6jDTWIC.js';
|
|
3
3
|
|
|
4
|
-
declare const LabeledFormField: ({ inputId, label, description, feedback, children, optional }: FormFieldProps) => react_jsx_runtime.JSX.Element;
|
|
5
|
-
declare const TitledFormField: ({ label, description, feedback, children, optional }: FormFieldProps) => react_jsx_runtime.JSX.Element;
|
|
6
|
-
declare const FormFieldset: ({ label, description, feedback, children, optional }: FormFieldsetProps) => react_jsx_runtime.JSX.Element;
|
|
4
|
+
declare const LabeledFormField: ({ inputId, label, description, feedback, children, optional, }: FormFieldProps) => react_jsx_runtime.JSX.Element;
|
|
5
|
+
declare const TitledFormField: ({ label, description, feedback, children, optional, }: FormFieldProps) => react_jsx_runtime.JSX.Element;
|
|
6
|
+
declare const FormFieldset: ({ label, description, feedback, children, optional, }: FormFieldsetProps) => react_jsx_runtime.JSX.Element;
|
|
7
7
|
|
|
8
8
|
export { FormFieldset, LabeledFormField, TitledFormField };
|
|
@@ -56,8 +56,11 @@ const FormFieldset = ({
|
|
|
56
56
|
labelClasses.push("o3-form-field--optional");
|
|
57
57
|
}
|
|
58
58
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "fieldset", { className: "o3-form-field", "aria-describedby": `${descriptionId}`, children: [
|
|
59
|
-
/* @__PURE__ */ _jsxruntime.
|
|
60
|
-
|
|
59
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "legend", { className: labelClasses.join(" "), children: [
|
|
60
|
+
label,
|
|
61
|
+
" ",
|
|
62
|
+
description && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "o3-form-input__description", id: descriptionId, children: description })
|
|
63
|
+
] }),
|
|
61
64
|
children,
|
|
62
65
|
feedback && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Feedback.Feedback, { ...feedback })
|
|
63
66
|
] });
|
|
@@ -11,6 +11,10 @@ interface TextInputProps extends BaseInputProps {
|
|
|
11
11
|
length?: 2 | 3 | 4 | 5;
|
|
12
12
|
feedback?: FeedbackProps;
|
|
13
13
|
}
|
|
14
|
+
interface PasswordInputProps extends BaseInputProps {
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
feedback?: FeedbackProps;
|
|
17
|
+
}
|
|
14
18
|
interface CheckBoxProps extends BaseInputProps {
|
|
15
19
|
inputId: string;
|
|
16
20
|
checkboxLabel: string;
|
|
@@ -45,4 +49,4 @@ type ErrorSummaryProps = {
|
|
|
45
49
|
}[];
|
|
46
50
|
};
|
|
47
51
|
|
|
48
|
-
export type { CheckBoxProps as C, ErrorSummaryProps as E, FormFieldsetProps as F, RadioButtonProps as R, TextInputProps as T,
|
|
52
|
+
export type { CheckBoxProps as C, ErrorSummaryProps as E, FormFieldsetProps as F, PasswordInputProps as P, RadioButtonProps as R, TextInputProps as T, FeedbackProps as a, FormFieldProps as b };
|
package/cjs/index.d.ts
CHANGED
package/css/core.css
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
@import "@financial-times/o3-foundation/css/core.css";
|
|
2
|
+
@import "./main.css";
|
|
3
|
+
|
|
4
|
+
/* src/css/tokens/core/o3-form/_variables.css */
|
|
5
|
+
[data-o3-brand=core] .o3-form {
|
|
6
|
+
--_o3-form-error-summary-background-color: rgba(204, 0, 0, 0.14);
|
|
7
|
+
--_o3-form-input-border-radius: 6px;
|
|
8
|
+
--_o3-form-color-use-case-background-error: rgba(204, 0, 0, 0.06);
|
|
9
|
+
--_o3-form-input-border: 2px solid var(--o3-color-palette-black-30);
|
|
10
|
+
--_o3-form-color-use-case-selected-disabled: var(--o3-color-use-case-button-disabled);
|
|
11
|
+
--_o3-form-color-use-case-border-disabled: var(--o3-color-palette-black-10);
|
|
12
|
+
--_o3-form-color-use-case-border: var(--o3-color-palette-black-50);
|
|
13
|
+
--_o3-form-color-use-case-background-disabled: var(--o3-color-palette-black-10);
|
|
14
|
+
--_o3-form-color-use-case-background: var(--o3-color-palette-white);
|
|
15
|
+
--_o3-form-input-border-error: 2px solid var(--o3-color-use-case-error);
|
|
16
|
+
--_o3-form-color-use-case-selected-active: var(--o3-color-use-case-button-pressed);
|
|
17
|
+
--_o3-form-color-use-case-selected-hover: var(--o3-color-use-case-button-hover);
|
|
18
|
+
--_o3-form-color-use-case-selected: var(--o3-color-use-case-button-default);
|
|
19
|
+
--_o3-form-color-use-case-border-active: var(--o3-color-use-case-button-pressed);
|
|
20
|
+
--_o3-form-color-use-case-border-hover: var(--o3-color-use-case-button-hover);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/* src/css/brands/core.css */
|
package/css/internal.css
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
@import "@financial-times/o3-foundation/css/internal.css";
|
|
2
|
+
@import "./main.css";
|
|
3
|
+
|
|
4
|
+
/* src/css/tokens/internal/o3-form/_variables.css */
|
|
5
|
+
[data-o3-brand=internal] .o3-form {
|
|
6
|
+
--_o3-form-color-use-case-background-error: rgba(204, 0, 0, 0.06);
|
|
7
|
+
--_o3-form-error-summary-background-color: rgba(204, 0, 0, 0.14);
|
|
8
|
+
--_o3-form-input-border-radius: 6px;
|
|
9
|
+
--_o3-form-color-use-case-selected-disabled: var(--o3-color-palette-black-5);
|
|
10
|
+
--_o3-form-color-use-case-border-disabled: var(--o3-color-use-case-button-disabled);
|
|
11
|
+
--_o3-form-color-use-case-border: var(--o3-color-palette-black-50);
|
|
12
|
+
--_o3-form-color-use-case-background-disabled: var(--o3-color-palette-black-10);
|
|
13
|
+
--_o3-form-color-use-case-background: var(--o3-color-palette-white);
|
|
14
|
+
--_o3-form-input-border: 2px solid var(--o3-color-palette-black-30);
|
|
15
|
+
--_o3-form-color-use-case-selected-active: var(--o3-color-use-case-button-pressed);
|
|
16
|
+
--_o3-form-color-use-case-selected-hover: var(--o3-color-use-case-button-hover);
|
|
17
|
+
--_o3-form-color-use-case-selected: var(--o3-color-use-case-button-default);
|
|
18
|
+
--_o3-form-color-use-case-border-active: var(--o3-color-use-case-button-pressed);
|
|
19
|
+
--_o3-form-color-use-case-border-hover: var(--o3-color-use-case-button-hover);
|
|
20
|
+
--_o3-form-input-border-error: 2px solid var(--o3-color-use-case-error);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/* src/css/brands/internal.css */
|
package/css/main.css
CHANGED
|
@@ -19,6 +19,13 @@
|
|
|
19
19
|
padding: 0;
|
|
20
20
|
border: 0;
|
|
21
21
|
}
|
|
22
|
+
.o3-form-field:where(fieldset) legend {
|
|
23
|
+
margin-bottom: var(--o3-spacing-3xs);
|
|
24
|
+
}
|
|
25
|
+
.o3-form-field:where(fieldset) legend .o3-form-input__description {
|
|
26
|
+
margin-top: var(--o3-spacing-5xs);
|
|
27
|
+
display: block;
|
|
28
|
+
}
|
|
22
29
|
.o3-form-field :is(.o3-form-field__label, .o3-form-field__title, .o3-form-field__legend) {
|
|
23
30
|
font-size: var(--o3-font-size-metric2-negative-1);
|
|
24
31
|
line-height: var(--o3-font-lineheight-metric2-negative-1);
|
|
@@ -31,9 +38,6 @@
|
|
|
31
38
|
color: var(--o3-color-use-case-muted-text);
|
|
32
39
|
font-weight: var(--o3-font-weight-regular);
|
|
33
40
|
}
|
|
34
|
-
.o3-form-field .o3-form-field__legend {
|
|
35
|
-
padding: 0 0 var(--o3-spacing-5xs) 0;
|
|
36
|
-
}
|
|
37
41
|
.o3-form-field .o3-form-input__description {
|
|
38
42
|
font-size: var(--o3-font-size-metric2-negative-1);
|
|
39
43
|
line-height: var(--o3-font-lineheight-metric2-negative-1);
|
|
@@ -79,7 +83,7 @@
|
|
|
79
83
|
.o3-form-text-input {
|
|
80
84
|
border: var(--_o3-form-input-border);
|
|
81
85
|
padding: var(--o3-spacing-3xs) var(--o3-spacing-2xs);
|
|
82
|
-
background-color: var(--
|
|
86
|
+
background-color: var(--_o3-form-color-use-case-background);
|
|
83
87
|
box-sizing: border-box;
|
|
84
88
|
border-radius: var(--_o3-form-input-border-radius);
|
|
85
89
|
--o3-grid-columns-to-span-count: 4;
|
|
@@ -102,13 +106,13 @@
|
|
|
102
106
|
}
|
|
103
107
|
.o3-form-text-input--error {
|
|
104
108
|
border: var(--_o3-form-input-border-error);
|
|
105
|
-
background-color: var(--
|
|
109
|
+
background-color: var(--_o3-form-color-use-case-background-error);
|
|
106
110
|
}
|
|
107
111
|
input[class*=o3-form-text-input][type=password]:disabled,
|
|
108
112
|
input[class*=o3-form-text-input][type=text]:disabled {
|
|
109
113
|
color: var(--o3-color-use-case-muted-text);
|
|
110
|
-
background-color: var(--
|
|
111
|
-
border-color: var(--
|
|
114
|
+
background-color: var(--_o3-form-color-use-case-background-disabled);
|
|
115
|
+
border-color: var(--_o3-form-color-use-case-border-disabled);
|
|
112
116
|
}
|
|
113
117
|
|
|
114
118
|
/* src/css/components/checkbox.css */
|
|
@@ -123,17 +127,17 @@ input[class*=o3-form-text-input][type=text]:disabled {
|
|
|
123
127
|
box-sizing: border-box;
|
|
124
128
|
}
|
|
125
129
|
.o3-form-input-checkbox__input:hover + label::before {
|
|
126
|
-
border-color: var(--
|
|
130
|
+
border-color: var(--_o3-form-color-use-case-selected-hover);
|
|
127
131
|
}
|
|
128
132
|
.o3-form-input-checkbox__input:active + label::before {
|
|
129
|
-
border-color: var(--
|
|
133
|
+
border-color: var(--_o3-form-color-use-case-selected-active);
|
|
130
134
|
}
|
|
131
135
|
.o3-form-input-checkbox__input:checked + label::after {
|
|
132
136
|
position: absolute;
|
|
133
137
|
content: "";
|
|
134
138
|
width: var(--o3-spacing-s);
|
|
135
139
|
height: var(--o3-spacing-s);
|
|
136
|
-
background-color: var(--
|
|
140
|
+
background-color: var(--_o3-form-color-use-case-background);
|
|
137
141
|
-webkit-mask-image: var(--o3-icons-ft-icon-tick);
|
|
138
142
|
mask-image: var(--o3-icons-ft-icon-tick);
|
|
139
143
|
-webkit-mask-repeat: no-repeat;
|
|
@@ -142,26 +146,26 @@ input[class*=o3-form-text-input][type=text]:disabled {
|
|
|
142
146
|
mask-size: contain;
|
|
143
147
|
}
|
|
144
148
|
.o3-form-input-checkbox__input:checked + label::before {
|
|
145
|
-
background-color: var(--
|
|
146
|
-
border-color: var(--
|
|
149
|
+
background-color: var(--_o3-form-color-use-case-selected);
|
|
150
|
+
border-color: var(--_o3-form-color-use-case-selected);
|
|
147
151
|
}
|
|
148
152
|
.o3-form-input-checkbox__input:checked:hover + label::before {
|
|
149
|
-
background-color: var(--
|
|
150
|
-
border-color: var(--
|
|
153
|
+
background-color: var(--_o3-form-color-use-case-selected-hover);
|
|
154
|
+
border-color: var(--_o3-form-color-use-case-selected-hover);
|
|
151
155
|
}
|
|
152
156
|
.o3-form-input-checkbox__input:checked:active + label::before {
|
|
153
|
-
background-color: var(--
|
|
154
|
-
border-color: var(--
|
|
157
|
+
background-color: var(--_o3-form-color-use-case-selected-active);
|
|
158
|
+
border-color: var(--_o3-form-color-use-case-selected-active);
|
|
155
159
|
}
|
|
156
160
|
.o3-form-input-checkbox__input:disabled + label::before {
|
|
157
|
-
border-color: var(--
|
|
161
|
+
border-color: var(--_o3-form-color-use-case-border-disabled);
|
|
158
162
|
}
|
|
159
163
|
.o3-form-input-checkbox__input:disabled + label {
|
|
160
|
-
color: var(--
|
|
164
|
+
color: var(--_o3-form-color-use-case-border-disabled);
|
|
161
165
|
}
|
|
162
166
|
.o3-form-input-checkbox__input:checked:disabled + label::before {
|
|
163
|
-
background-color: var(--
|
|
164
|
-
border-color: var(--
|
|
167
|
+
background-color: var(--_o3-form-color-use-case-selected-disabled);
|
|
168
|
+
border-color: var(--_o3-form-color-use-case-selected-disabled);
|
|
165
169
|
}
|
|
166
170
|
.o3-form-input-checkbox__input.o3-form-input-error + label::before {
|
|
167
171
|
border-color: var(--o3-color-use-case-error);
|
|
@@ -175,15 +179,15 @@ input[class*=o3-form-text-input][type=text]:disabled {
|
|
|
175
179
|
background-color: var(--o3-color-use-case-error);
|
|
176
180
|
}
|
|
177
181
|
.o3-form-input-checkbox__input:indeterminate + label::before {
|
|
178
|
-
border-color: var(--
|
|
179
|
-
background-color: var(--
|
|
182
|
+
border-color: var(--_o3-form-color-use-case-selected);
|
|
183
|
+
background-color: var(--_o3-form-color-use-case-selected);
|
|
180
184
|
}
|
|
181
185
|
.o3-form-input-checkbox__input:indeterminate + label::after {
|
|
182
186
|
position: absolute;
|
|
183
187
|
content: "";
|
|
184
188
|
width: var(--o3-spacing-s);
|
|
185
189
|
height: var(--o3-spacing-s);
|
|
186
|
-
background-color: var(--
|
|
190
|
+
background-color: var(--_o3-form-color-use-case-background);
|
|
187
191
|
-webkit-mask-image: var(--o3-icons-ft-icon-minus);
|
|
188
192
|
mask-image: var(--o3-icons-ft-icon-minus);
|
|
189
193
|
-webkit-mask-repeat: no-repeat;
|
|
@@ -192,13 +196,13 @@ input[class*=o3-form-text-input][type=text]:disabled {
|
|
|
192
196
|
mask-size: contain;
|
|
193
197
|
}
|
|
194
198
|
.o3-form-input-checkbox__input:indeterminate:hover + label::before {
|
|
195
|
-
border-color: var(--
|
|
196
|
-
background-color: var(--
|
|
199
|
+
border-color: var(--_o3-form-color-use-case-selected-hover);
|
|
200
|
+
background-color: var(--_o3-form-color-use-case-selected-hover);
|
|
197
201
|
}
|
|
198
202
|
.o3-form-input-checkbox__input:indeterminate:active + label::before,
|
|
199
203
|
.o3-form-input-checkbox__input:indeterminate:disabled + label::before {
|
|
200
|
-
border-color: var(--
|
|
201
|
-
background-color: var(--
|
|
204
|
+
border-color: var(--_o3-form-color-use-case-selected-hover);
|
|
205
|
+
background-color: var(--_o3-form-color-use-case-selected-hover);
|
|
202
206
|
}
|
|
203
207
|
.o3-form-input-checkbox__input.o3-form-input-error:indeterminate + label::before {
|
|
204
208
|
border-color: var(--o3-color-use-case-error);
|
|
@@ -207,6 +211,19 @@ input[class*=o3-form-text-input][type=text]:disabled {
|
|
|
207
211
|
.o3-form-input-checkbox__input.o3-form-input-error:indeterminate + label::after {
|
|
208
212
|
background-color: var(--o3-color-use-case-error);
|
|
209
213
|
}
|
|
214
|
+
.o3-form-input-checkbox__input:focus + label::before {
|
|
215
|
+
box-shadow: var(--o3-focus-use-case-ring-inner), var(--03-focus-use-case-ring-outer);
|
|
216
|
+
outline: 3px solid transparent;
|
|
217
|
+
}
|
|
218
|
+
@supports selector(:focus-visible) {
|
|
219
|
+
.o3-form-input-checkbox__input:focus + label::before {
|
|
220
|
+
box-shadow: unset;
|
|
221
|
+
}
|
|
222
|
+
.o3-form-input-checkbox__input:focus-visible + label::before {
|
|
223
|
+
box-shadow: var(--o3-focus-use-case-ring-inner), var(--o3-focus-use-case-ring-outer);
|
|
224
|
+
outline: 3px solid transparent;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
210
227
|
.o3-form-input-checkbox__label {
|
|
211
228
|
display: flex;
|
|
212
229
|
align-items: center;
|
|
@@ -215,10 +232,6 @@ input[class*=o3-form-text-input][type=text]:disabled {
|
|
|
215
232
|
font-weight: var(--o3-typography-use-case-body-small-font-weight);
|
|
216
233
|
color: var(--o3-color-use-case-body-text);
|
|
217
234
|
}
|
|
218
|
-
.o3-form-input-checkbox__label:focus-visible {
|
|
219
|
-
padding: var(--o3-spacing-5xs);
|
|
220
|
-
margin: calc(-1 * var(--o3-spacing-5xs)) 0 calc(-1 * var(--o3-spacing-5xs)) calc(-1 * var(--o3-spacing-5xs));
|
|
221
|
-
}
|
|
222
235
|
|
|
223
236
|
/* src/css/components/radio-button.css */
|
|
224
237
|
.o3-form-input-radio-button + label::before {
|
|
@@ -232,55 +245,68 @@ input[class*=o3-form-text-input][type=text]:disabled {
|
|
|
232
245
|
box-sizing: border-box;
|
|
233
246
|
}
|
|
234
247
|
.o3-form-input-radio-button:hover + label::before {
|
|
235
|
-
border-color: var(--
|
|
248
|
+
border-color: var(--_o3-form-color-use-case-border-hover);
|
|
236
249
|
}
|
|
237
250
|
.o3-form-input-radio-button:active + label::before {
|
|
238
|
-
border-color: var(--
|
|
251
|
+
border-color: var(--_o3-form-color-use-case-border-active);
|
|
239
252
|
}
|
|
240
253
|
.o3-form-input-radio-button:checked + label::before {
|
|
241
|
-
border-color: var(--
|
|
254
|
+
border-color: var(--_o3-form-color-use-case-selected);
|
|
242
255
|
}
|
|
243
256
|
.o3-form-input-radio-button:checked + label::after {
|
|
244
257
|
position: absolute;
|
|
245
258
|
content: "";
|
|
246
259
|
width: var(--o3-spacing-3xs);
|
|
247
260
|
height: var(--o3-spacing-3xs);
|
|
248
|
-
background-color: var(--
|
|
261
|
+
background-color: var(--_o3-form-color-use-case-selected);
|
|
249
262
|
margin: 6px;
|
|
250
263
|
border-radius: 50%;
|
|
251
264
|
}
|
|
252
265
|
.o3-form-input-radio-button:checked:hover + label::before {
|
|
253
|
-
border-color: var(--
|
|
266
|
+
border-color: var(--_o3-form-color-use-case-selected-hover);
|
|
254
267
|
}
|
|
255
268
|
.o3-form-input-radio-button:checked:hover + label::after {
|
|
256
|
-
background-color: var(--
|
|
269
|
+
background-color: var(--_o3-form-color-use-case-selected-hover);
|
|
257
270
|
}
|
|
258
271
|
.o3-form-input-radio-button:checked:active + label::before {
|
|
259
|
-
border-color: var(--
|
|
272
|
+
border-color: var(--_o3-form-color-use-case-selected-active);
|
|
260
273
|
}
|
|
261
274
|
.o3-form-input-radio-button:checked:active + label::after {
|
|
262
|
-
background-color: var(--
|
|
275
|
+
background-color: var(--_o3-form-color-use-case-selected-active);
|
|
263
276
|
}
|
|
264
277
|
.o3-form-input-radio-button:disabled + label::before {
|
|
265
|
-
border-color: var(--
|
|
278
|
+
border-color: var(--_o3-form-color-use-case-border-disabled);
|
|
266
279
|
}
|
|
267
280
|
.o3-form-input-radio-button:disabled:checked + label::after {
|
|
268
|
-
background-color: var(--
|
|
281
|
+
background-color: var(--_o3-form-color-use-case-border-disabled);
|
|
269
282
|
}
|
|
270
283
|
.o3-form-input-radio-button:disabled + label {
|
|
271
|
-
color: var(--
|
|
284
|
+
color: var(--_o3-form-color-use-case-border-disabled);
|
|
272
285
|
}
|
|
273
286
|
.o3-form-input-radio-button.o3-form-input-error + label::before {
|
|
274
287
|
border-color: var(--o3-color-use-case-error);
|
|
275
|
-
background-color: var(--
|
|
288
|
+
background-color: var(--_o3-form-color-use-case-background-error);
|
|
276
289
|
}
|
|
277
290
|
.o3-form-input-radio-button.o3-form-input-error:checked + label::before {
|
|
278
291
|
border-color: var(--o3-color-use-case-error);
|
|
279
|
-
background-color: var(--
|
|
292
|
+
background-color: var(--_o3-form-color-use-case-background-error);
|
|
280
293
|
}
|
|
281
294
|
.o3-form-input-radio-button.o3-form-input-error:checked + label::after {
|
|
282
295
|
background-color: var(--o3-color-use-case-error);
|
|
283
296
|
}
|
|
297
|
+
.o3-form-input-radio-button:focus + label::before {
|
|
298
|
+
box-shadow: var(--o3-focus-use-case-ring-inner), var(--03-focus-use-case-ring-outer);
|
|
299
|
+
outline: 3px solid transparent;
|
|
300
|
+
}
|
|
301
|
+
@supports selector(:focus-visible) {
|
|
302
|
+
.o3-form-input-radio-button:focus + label::before {
|
|
303
|
+
box-shadow: unset;
|
|
304
|
+
}
|
|
305
|
+
.o3-form-input-radio-button:focus-visible + label::before {
|
|
306
|
+
box-shadow: var(--o3-focus-use-case-ring-inner), var(--o3-focus-use-case-ring-outer);
|
|
307
|
+
outline: 3px solid transparent;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
284
310
|
.o3-form-input-radio-button__label {
|
|
285
311
|
display: flex;
|
|
286
312
|
align-items: center;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
@import "@financial-times/o3-foundation/css/professional.css";
|
|
2
|
+
@import "./main.css";
|
|
3
|
+
|
|
4
|
+
/* src/css/tokens/core/professional/o3-form/_variables.css */
|
|
5
|
+
[data-o3-brand=professional] .o3-form {
|
|
6
|
+
--_o3-form-error-summary-background-color: rgba(204, 0, 0, 0.14);
|
|
7
|
+
--_o3-form-input-border-radius: 6px;
|
|
8
|
+
--_o3-form-color-use-case-background-error: rgba(204, 0, 0, 0.06);
|
|
9
|
+
--_o3-form-input-border: 2px solid var(--o3-color-palette-black-30);
|
|
10
|
+
--_o3-form-color-use-case-selected-disabled: var(--o3-color-use-case-button-disabled);
|
|
11
|
+
--_o3-form-color-use-case-selected-active: var(--o3-color-use-case-button-pressed);
|
|
12
|
+
--_o3-form-color-use-case-selected-hover: var(--o3-color-use-case-button-hover);
|
|
13
|
+
--_o3-form-color-use-case-border-disabled: var(--o3-color-palette-black-10);
|
|
14
|
+
--_o3-form-color-use-case-border-active: var(--o3-color-use-case-button-pressed);
|
|
15
|
+
--_o3-form-color-use-case-border-hover: var(--o3-color-use-case-button-hover);
|
|
16
|
+
--_o3-form-color-use-case-border: var(--o3-color-palette-black-50);
|
|
17
|
+
--_o3-form-color-use-case-background-disabled: var(--o3-color-palette-black-10);
|
|
18
|
+
--_o3-form-color-use-case-background: var(--o3-color-palette-white);
|
|
19
|
+
--_o3-form-input-border-error: 2px solid var(--o3-color-use-case-error);
|
|
20
|
+
--_o3-form-color-use-case-selected: var(--o3-color-use-case-button-default);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/* src/css/brands/professional.css */
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
@import "@financial-times/o3-foundation/css/sustainable-views.css";
|
|
2
|
+
@import "./main.css";
|
|
3
|
+
|
|
4
|
+
/* src/css/tokens/sustainable-views/o3-form/_variables.css */
|
|
5
|
+
[data-o3-brand=sustainable-views] .o3-form {
|
|
6
|
+
--_o3-form-error-summary-background-color: rgba(204, 0, 0, 0.14);
|
|
7
|
+
--_o3-form-input-border-radius: 6px;
|
|
8
|
+
--_o3-form-color-use-case-background-error: rgba(204, 0, 0, 0.06);
|
|
9
|
+
--_o3-form-input-border: 2px solid var(--o3-color-palette-black-30);
|
|
10
|
+
--_o3-form-color-use-case-selected-disabled: var(--o3-color-palette-black-10);
|
|
11
|
+
--_o3-form-color-use-case-border-disabled: var(--o3-color-use-case-button-disabled);
|
|
12
|
+
--_o3-form-color-use-case-border: var(--o3-color-palette-black-50);
|
|
13
|
+
--_o3-form-color-use-case-background-disabled: var(--o3-color-palette-black-10);
|
|
14
|
+
--_o3-form-color-use-case-background: var(--o3-color-palette-white);
|
|
15
|
+
--_o3-form-input-border-error: 2px solid var(--o3-color-use-case-error);
|
|
16
|
+
--_o3-form-color-use-case-selected-active: var(--o3-color-use-case-button-pressed);
|
|
17
|
+
--_o3-form-color-use-case-selected-hover: var(--o3-color-use-case-button-hover);
|
|
18
|
+
--_o3-form-color-use-case-selected: var(--o3-color-use-case-button-default);
|
|
19
|
+
--_o3-form-color-use-case-border-active: var(--o3-color-use-case-button-pressed);
|
|
20
|
+
--_o3-form-color-use-case-border-hover: var(--o3-color-use-case-button-hover);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/* src/css/brands/sustainable-views.css */
|
package/css/whitelabel.css
CHANGED
|
@@ -3,20 +3,20 @@
|
|
|
3
3
|
|
|
4
4
|
/* src/css/tokens/whitelabel/o3-form/_variables.css */
|
|
5
5
|
[data-o3-brand=whitelabel] .o3-form {
|
|
6
|
-
--
|
|
6
|
+
--_o3-form-color-use-case-background-error: rgba(204, 0, 0, 0.06);
|
|
7
7
|
--_o3-form-error-summary-background-color: rgba(204, 0, 0, 0.14);
|
|
8
8
|
--_o3-form-input-border-radius: 6px;
|
|
9
|
-
--
|
|
10
|
-
--
|
|
11
|
-
--
|
|
12
|
-
--o3-form-color-use-case-selected: var(--o3-color-palette-black-50);
|
|
13
|
-
--o3-form-color-use-case-border-disabled: var(--o3-color-palette-black-30);
|
|
14
|
-
--o3-form-color-use-case-border-active: var(--o3-color-palette-black-40);
|
|
15
|
-
--o3-form-color-use-case-border-hover: var(--o3-color-palette-black-20);
|
|
16
|
-
--o3-form-color-use-case-border: var(--o3-color-palette-black-30);
|
|
17
|
-
--o3-form-color-use-case-background-disabled: var(--o3-color-palette-black-5);
|
|
18
|
-
--o3-form-color-use-case-background: var(--o3-color-palette-white);
|
|
9
|
+
--_o3-form-color-use-case-border-disabled: var(--o3-color-palette-black-10);
|
|
10
|
+
--_o3-form-color-use-case-border: var(--o3-color-palette-black-50);
|
|
11
|
+
--_o3-form-color-use-case-background: var(--o3-color-palette-white);
|
|
19
12
|
--_o3-form-input-border: 2px solid var(--o3-color-palette-black-30);
|
|
13
|
+
--_o3-form-color-use-case-selected-disabled: var(--o3-color-use-case-button-disabled);
|
|
14
|
+
--_o3-form-color-use-case-selected-active: var(--o3-color-use-case-button-pressed);
|
|
15
|
+
--_o3-form-color-use-case-selected-hover: var(--o3-color-use-case-button-hover);
|
|
16
|
+
--_o3-form-color-use-case-selected: var(--o3-color-use-case-button-default);
|
|
17
|
+
--_o3-form-color-use-case-border-active: var(--o3-color-use-case-button-pressed);
|
|
18
|
+
--_o3-form-color-use-case-border-hover: var(--o3-color-use-case-button-hover);
|
|
19
|
+
--_o3-form-color-use-case-background-disabled: var(--o3-color-use-case-button-disabled);
|
|
20
20
|
--_o3-form-input-border-error: 2px solid var(--o3-color-use-case-error);
|
|
21
21
|
}
|
|
22
22
|
|
package/esm/CheckBox.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { C as CheckBoxProps, F as FormFieldsetProps } from './index-
|
|
2
|
+
import { C as CheckBoxProps, F as FormFieldsetProps } from './index-D6jDTWIC.js';
|
|
3
3
|
|
|
4
4
|
declare const CheckBoxItem: (props: CheckBoxProps) => react_jsx_runtime.JSX.Element;
|
|
5
5
|
declare const CheckBox: (props: CheckBoxProps) => react_jsx_runtime.JSX.Element;
|
package/esm/CheckBox.js
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { createElement } from "react";
|
|
3
|
+
import { uidBuilder } from "@financial-times/o-utils";
|
|
3
4
|
import { TitledFormField, FormFieldset } from "./fieldComponents/FormField";
|
|
5
|
+
const uniqueId = uidBuilder("o3-form-checkbox-input");
|
|
4
6
|
const CheckBoxItem = (props) => {
|
|
5
7
|
let { inputId, attributes, optional, error } = props;
|
|
8
|
+
if (!inputId) {
|
|
9
|
+
inputId = uniqueId("_");
|
|
10
|
+
}
|
|
6
11
|
const classNames = ["o3-form-input-checkbox__input", "o3-visually-hidden"];
|
|
7
12
|
if (error) {
|
|
8
13
|
classNames.push("o3-form-input-error");
|
package/esm/Error-summary.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { E as ErrorSummaryProps } from './index-
|
|
2
|
+
import { E as ErrorSummaryProps } from './index-D6jDTWIC.js';
|
|
3
3
|
|
|
4
4
|
declare const ErrorSummary: ({ errors, errorMessage, }: ErrorSummaryProps) => react_jsx_runtime.JSX.Element;
|
|
5
5
|
|
package/esm/PasswordInput.d.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
2
|
+
import { P as PasswordInputProps } from './index-D6jDTWIC.js';
|
|
3
3
|
|
|
4
|
-
interface PasswordInputProps extends FormFieldProps {
|
|
5
|
-
disabled?: boolean;
|
|
6
|
-
}
|
|
7
4
|
declare const PasswordInput: ({ label, feedback, description, disabled, attributes, inputId, optional, }: PasswordInputProps) => react_jsx_runtime.JSX.Element;
|
|
8
5
|
|
|
9
6
|
export { PasswordInput };
|
package/esm/PasswordInput.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { uidBuilder } from "@financial-times/o-utils";
|
|
2
3
|
import { LabeledFormField } from "./fieldComponents/FormField";
|
|
3
4
|
import { CheckBoxItem } from "./CheckBox";
|
|
5
|
+
const uniqueId = uidBuilder("o3-form-password-input");
|
|
4
6
|
const PasswordInput = ({
|
|
5
7
|
label,
|
|
6
8
|
feedback,
|
|
@@ -10,6 +12,8 @@ const PasswordInput = ({
|
|
|
10
12
|
inputId,
|
|
11
13
|
optional
|
|
12
14
|
}) => {
|
|
15
|
+
const id = inputId || uniqueId("_");
|
|
16
|
+
const showPasswordId = `${id}-showPassword`;
|
|
13
17
|
const inputClasses = ["o3-form", "o3-form-text-input"];
|
|
14
18
|
if (feedback && feedback.type === "error") {
|
|
15
19
|
inputClasses.push("o3-form-text-input--error");
|
|
@@ -21,13 +25,13 @@ const PasswordInput = ({
|
|
|
21
25
|
label,
|
|
22
26
|
feedback,
|
|
23
27
|
description,
|
|
24
|
-
inputId,
|
|
28
|
+
inputId: id,
|
|
25
29
|
optional,
|
|
26
30
|
children: /* @__PURE__ */ jsx(
|
|
27
31
|
"input",
|
|
28
32
|
{
|
|
29
33
|
...attributes,
|
|
30
|
-
id
|
|
34
|
+
id,
|
|
31
35
|
disabled,
|
|
32
36
|
className: inputClasses.join(" "),
|
|
33
37
|
required: !optional,
|
|
@@ -42,11 +46,11 @@ const PasswordInput = ({
|
|
|
42
46
|
CheckBoxItem,
|
|
43
47
|
{
|
|
44
48
|
attributes: { disabled },
|
|
45
|
-
inputId:
|
|
49
|
+
inputId: showPasswordId,
|
|
46
50
|
checkboxLabel: "Show Password"
|
|
47
51
|
}
|
|
48
52
|
),
|
|
49
|
-
!disabled && /* @__PURE__ */ jsx("a", { href: "", children: "Forgot password?" })
|
|
53
|
+
!disabled && /* @__PURE__ */ jsx("a", { className: "o3-typography-link", href: "", children: "Forgot password?" })
|
|
50
54
|
] })
|
|
51
55
|
] });
|
|
52
56
|
};
|
package/esm/RadioButton.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { R as RadioButtonProps, F as FormFieldsetProps } from './index-
|
|
2
|
+
import { R as RadioButtonProps, F as FormFieldsetProps } from './index-D6jDTWIC.js';
|
|
3
3
|
|
|
4
4
|
declare const RadioButtonItem: (props: RadioButtonProps) => react_jsx_runtime.JSX.Element;
|
|
5
5
|
declare const RadioButtonGroup: (props: FormFieldsetProps) => react_jsx_runtime.JSX.Element;
|
package/esm/RadioButton.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { createElement } from "react";
|
|
3
|
+
import { uidBuilder } from "@financial-times/o-utils";
|
|
3
4
|
import { FormFieldset } from "./fieldComponents/FormField";
|
|
5
|
+
const uniqueId = uidBuilder("o3-form-radio-button-input");
|
|
4
6
|
const RadioButtonItem = (props) => {
|
|
5
7
|
let { inputId, attributes, optional, error } = props;
|
|
6
|
-
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
];
|
|
8
|
+
if (!inputId) {
|
|
9
|
+
inputId = uniqueId("_");
|
|
10
|
+
}
|
|
11
|
+
const classNames = ["o3-form-input-radio-button", "o3-visually-hidden"];
|
|
10
12
|
if (error) {
|
|
11
13
|
classNames.push("o3-form-input-error");
|
|
12
14
|
}
|
package/esm/TextInput.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { T as TextInputProps } from './index-
|
|
2
|
+
import { T as TextInputProps } from './index-D6jDTWIC.js';
|
|
3
3
|
|
|
4
4
|
declare const TextInput: ({ label, feedback, description, disabled, length, attributes, inputId, optional, }: TextInputProps) => react_jsx_runtime.JSX.Element;
|
|
5
5
|
|
package/esm/TextInput.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { uidBuilder } from "@financial-times/o-utils";
|
|
2
3
|
import { LabeledFormField } from "./fieldComponents/FormField";
|
|
4
|
+
const uniqueId = uidBuilder("o3-form-text-input");
|
|
3
5
|
const TextInput = ({
|
|
4
6
|
label,
|
|
5
7
|
feedback,
|
|
@@ -10,6 +12,7 @@ const TextInput = ({
|
|
|
10
12
|
inputId,
|
|
11
13
|
optional
|
|
12
14
|
}) => {
|
|
15
|
+
const id = inputId || uniqueId("_");
|
|
13
16
|
const inputClasses = ["o3-form", "o3-form-text-input"];
|
|
14
17
|
if (feedback && feedback.type === "error") {
|
|
15
18
|
inputClasses.push("o3-form-text-input--error");
|
|
@@ -23,13 +26,13 @@ const TextInput = ({
|
|
|
23
26
|
label,
|
|
24
27
|
feedback,
|
|
25
28
|
description,
|
|
26
|
-
inputId,
|
|
29
|
+
inputId: id,
|
|
27
30
|
optional,
|
|
28
31
|
children: /* @__PURE__ */ jsx(
|
|
29
32
|
"input",
|
|
30
33
|
{
|
|
31
34
|
...attributes,
|
|
32
|
-
id
|
|
35
|
+
id,
|
|
33
36
|
disabled,
|
|
34
37
|
className: inputClasses.join(" "),
|
|
35
38
|
required: !optional,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
2
|
+
import { a as FeedbackProps } from '../index-D6jDTWIC.mjs';
|
|
3
3
|
|
|
4
4
|
declare const Feedback: ({ message, type }: FeedbackProps) => react_jsx_runtime.JSX.Element;
|
|
5
5
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
2
|
+
import { b as FormFieldProps, F as FormFieldsetProps } from '../index-D6jDTWIC.mjs';
|
|
3
3
|
|
|
4
|
-
declare const LabeledFormField: ({ inputId, label, description, feedback, children, optional }: FormFieldProps) => react_jsx_runtime.JSX.Element;
|
|
5
|
-
declare const TitledFormField: ({ label, description, feedback, children, optional }: FormFieldProps) => react_jsx_runtime.JSX.Element;
|
|
6
|
-
declare const FormFieldset: ({ label, description, feedback, children, optional }: FormFieldsetProps) => react_jsx_runtime.JSX.Element;
|
|
4
|
+
declare const LabeledFormField: ({ inputId, label, description, feedback, children, optional, }: FormFieldProps) => react_jsx_runtime.JSX.Element;
|
|
5
|
+
declare const TitledFormField: ({ label, description, feedback, children, optional, }: FormFieldProps) => react_jsx_runtime.JSX.Element;
|
|
6
|
+
declare const FormFieldset: ({ label, description, feedback, children, optional, }: FormFieldsetProps) => react_jsx_runtime.JSX.Element;
|
|
7
7
|
|
|
8
8
|
export { FormFieldset, LabeledFormField, TitledFormField };
|
|
@@ -56,8 +56,11 @@ const FormFieldset = ({
|
|
|
56
56
|
labelClasses.push("o3-form-field--optional");
|
|
57
57
|
}
|
|
58
58
|
return /* @__PURE__ */ jsxs("fieldset", { className: "o3-form-field", "aria-describedby": `${descriptionId}`, children: [
|
|
59
|
-
/* @__PURE__ */
|
|
60
|
-
|
|
59
|
+
/* @__PURE__ */ jsxs("legend", { className: labelClasses.join(" "), children: [
|
|
60
|
+
label,
|
|
61
|
+
" ",
|
|
62
|
+
description && /* @__PURE__ */ jsx("span", { className: "o3-form-input__description", id: descriptionId, children: description })
|
|
63
|
+
] }),
|
|
61
64
|
children,
|
|
62
65
|
feedback && /* @__PURE__ */ jsx(Feedback, { ...feedback })
|
|
63
66
|
] });
|
|
@@ -11,6 +11,10 @@ interface TextInputProps extends BaseInputProps {
|
|
|
11
11
|
length?: 2 | 3 | 4 | 5;
|
|
12
12
|
feedback?: FeedbackProps;
|
|
13
13
|
}
|
|
14
|
+
interface PasswordInputProps extends BaseInputProps {
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
feedback?: FeedbackProps;
|
|
17
|
+
}
|
|
14
18
|
interface CheckBoxProps extends BaseInputProps {
|
|
15
19
|
inputId: string;
|
|
16
20
|
checkboxLabel: string;
|
|
@@ -45,4 +49,4 @@ type ErrorSummaryProps = {
|
|
|
45
49
|
}[];
|
|
46
50
|
};
|
|
47
51
|
|
|
48
|
-
export type { CheckBoxProps as C, ErrorSummaryProps as E, FormFieldsetProps as F, RadioButtonProps as R, TextInputProps as T,
|
|
52
|
+
export type { CheckBoxProps as C, ErrorSummaryProps as E, FormFieldsetProps as F, PasswordInputProps as P, RadioButtonProps as R, TextInputProps as T, FeedbackProps as a, FormFieldProps as b };
|
package/esm/index.d.ts
CHANGED