@financial-times/o3-form 0.7.2 → 0.8.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/README.md +53 -0
- package/cjs/CheckBox.d.ts +1 -1
- package/cjs/Error-summary.d.ts +1 -1
- package/cjs/PasswordInput.d.ts +1 -1
- package/cjs/RadioButton.d.ts +1 -1
- package/cjs/SelectInput.d.ts +2 -2
- package/cjs/SelectInput.js +18 -11
- package/cjs/TextInput.d.ts +1 -1
- package/cjs/fieldComponents/Feedback.d.ts +1 -1
- package/cjs/fieldComponents/FormField.d.ts +1 -1
- package/cjs/{index-B5zd_nrf.d.ts → index-1UM0FDHf.d.ts} +1 -0
- package/cjs/index.d.ts +2 -1
- package/cjs/index.js +1 -0
- package/css/main.css +9 -2
- package/esm/CheckBox.d.ts +1 -1
- package/esm/Error-summary.d.ts +1 -1
- package/esm/PasswordInput.d.ts +1 -1
- package/esm/RadioButton.d.ts +1 -1
- package/esm/SelectInput.d.ts +2 -2
- package/esm/SelectInput.js +18 -11
- package/esm/TextInput.d.ts +1 -1
- package/esm/fieldComponents/Feedback.d.mts +1 -1
- package/esm/fieldComponents/FormField.d.mts +1 -1
- package/esm/{index-B5zd_nrf.d.ts → index-1UM0FDHf.d.ts} +1 -0
- package/esm/index.d.ts +2 -1
- package/esm/index.js +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -457,6 +457,8 @@ import {CheckBoxGroup, CheckBoxItem} from '@financial-times/o3-form/cjs'; // or
|
|
|
457
457
|
|
|
458
458
|
A dropdown select input for choosing one option from a list.
|
|
459
459
|
|
|
460
|
+
**HTML**
|
|
461
|
+
|
|
460
462
|
```html
|
|
461
463
|
<div class="o3-form-field">
|
|
462
464
|
<label
|
|
@@ -493,6 +495,8 @@ A dropdown select input for choosing one option from a list.
|
|
|
493
495
|
</div>
|
|
494
496
|
```
|
|
495
497
|
|
|
498
|
+
**TSX**
|
|
499
|
+
|
|
496
500
|
```tsx
|
|
497
501
|
import {SelectInput} from '@financial-times/o3-form';
|
|
498
502
|
|
|
@@ -508,6 +512,55 @@ import {SelectInput} from '@financial-times/o3-form';
|
|
|
508
512
|
</SelectInput>
|
|
509
513
|
```
|
|
510
514
|
|
|
515
|
+
#### Short Text Input
|
|
516
|
+
|
|
517
|
+
Select input supports width control for shorter inputs:
|
|
518
|
+
|
|
519
|
+
```html
|
|
520
|
+
<div class="o3-form-field">
|
|
521
|
+
<label
|
|
522
|
+
class="o3-form-field__label"
|
|
523
|
+
for="o3-form-select-input-_3564083419195512"
|
|
524
|
+
>
|
|
525
|
+
Title
|
|
526
|
+
</label>
|
|
527
|
+
<div class="o3-form-select-input__container o3-form-select-input--short-3">
|
|
528
|
+
<select
|
|
529
|
+
id="o3-form-select-input-_3564083419195512"
|
|
530
|
+
class="o3-form o3-form-select-input"
|
|
531
|
+
required=""
|
|
532
|
+
aria-required="true"
|
|
533
|
+
maxlength="0"
|
|
534
|
+
type="select"
|
|
535
|
+
>
|
|
536
|
+
<option value="American Express">American Express</option>
|
|
537
|
+
<option value="Visa Debit">Visa Debit</option>
|
|
538
|
+
<option value="Visa Credit">Visa Credit</option>
|
|
539
|
+
<option value="Mastercard Debit">Mastercard Debit</option>
|
|
540
|
+
<option value="Mastercard Credit">Mastercard Credit</option>
|
|
541
|
+
</select>
|
|
542
|
+
</div>
|
|
543
|
+
<div class="o3-form-feedback o3-form-feedback__undefined">
|
|
544
|
+
<span class="o3-form-feedback__undefined-message"></span>
|
|
545
|
+
</div>
|
|
546
|
+
</div>
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
**TSX**
|
|
550
|
+
|
|
551
|
+
```tsx
|
|
552
|
+
import {SelectInput} from '@financial-times/o3-form';
|
|
553
|
+
|
|
554
|
+
<SelectInput
|
|
555
|
+
label="Title"
|
|
556
|
+
length="3"
|
|
557
|
+
>
|
|
558
|
+
<option value="Mr">Mr</option>
|
|
559
|
+
<option value="Mrs">Mrs</option>
|
|
560
|
+
<option value="Mx>">Mx</option>
|
|
561
|
+
</SelectInput>
|
|
562
|
+
```
|
|
563
|
+
|
|
511
564
|
## Contact
|
|
512
565
|
|
|
513
566
|
If you have any questions or comments about this component, or need help using it, please either [raise an issue](https://github.com/Financial-Times/o3-editorial-typography/issues), visit [#origami-support](https://financialtimes.slack.com/messages/origami-support/) or email [Origami Support](mailto:origami-support@ft.com).
|
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-1UM0FDHf.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/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-1UM0FDHf.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,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { P as PasswordInputProps } from './index-
|
|
2
|
+
import { P as PasswordInputProps } from './index-1UM0FDHf.js';
|
|
3
3
|
|
|
4
4
|
declare const PasswordInput: ({ label, feedback, description, disabled, attributes, inputId, optional, forgotPasswordLink, }: PasswordInputProps) => react_jsx_runtime.JSX.Element;
|
|
5
5
|
|
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-1UM0FDHf.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/SelectInput.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { S as SelectInputProps } from './index-
|
|
2
|
+
import { S as SelectInputProps } from './index-1UM0FDHf.js';
|
|
3
3
|
|
|
4
|
-
declare const SelectInput: ({ label, feedback, description, disabled, attributes, inputId, optional, children, }: SelectInputProps) => react_jsx_runtime.JSX.Element;
|
|
4
|
+
declare const SelectInput: ({ label, feedback, description, disabled, attributes, inputId, optional, children, length, }: SelectInputProps) => react_jsx_runtime.JSX.Element;
|
|
5
5
|
|
|
6
6
|
export { SelectInput };
|
package/cjs/SelectInput.js
CHANGED
|
@@ -10,7 +10,8 @@ const SelectInput = ({
|
|
|
10
10
|
attributes,
|
|
11
11
|
inputId,
|
|
12
12
|
optional,
|
|
13
|
-
children
|
|
13
|
+
children,
|
|
14
|
+
length
|
|
14
15
|
}) => {
|
|
15
16
|
const id = inputId || uniqueId("_");
|
|
16
17
|
const inputClasses = ["o3-form", "o3-form-select-input"];
|
|
@@ -25,18 +26,24 @@ const SelectInput = ({
|
|
|
25
26
|
description,
|
|
26
27
|
inputId: id,
|
|
27
28
|
optional,
|
|
28
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
29
|
-
"
|
|
29
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
30
|
+
"div",
|
|
30
31
|
{
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
className: `o3-form-select-input__container ${length ? `o3-form-select-input--short-${length}` : ""}`,
|
|
33
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
34
|
+
"select",
|
|
35
|
+
{
|
|
36
|
+
...attributes,
|
|
37
|
+
id,
|
|
38
|
+
disabled,
|
|
39
|
+
className: inputClasses.join(" "),
|
|
40
|
+
required: !optional,
|
|
41
|
+
"aria-required": !optional,
|
|
42
|
+
children
|
|
43
|
+
}
|
|
44
|
+
)
|
|
38
45
|
}
|
|
39
|
-
)
|
|
46
|
+
)
|
|
40
47
|
}
|
|
41
48
|
);
|
|
42
49
|
};
|
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-1UM0FDHf.js';
|
|
3
3
|
|
|
4
4
|
declare const TextInput: ({ label, feedback, description, disabled, length, attributes, inputId, optional, }: TextInputProps) => react_jsx_runtime.JSX.Element;
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { a as FeedbackProps } from '../index-
|
|
2
|
+
import { a as FeedbackProps } from '../index-1UM0FDHf.js';
|
|
3
3
|
|
|
4
4
|
declare const Feedback: ({ message, type }: FeedbackProps) => react_jsx_runtime.JSX.Element;
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { b as FormFieldProps, F as FormFieldsetProps } from '../index-
|
|
2
|
+
import { b as FormFieldProps, F as FormFieldsetProps } from '../index-1UM0FDHf.js';
|
|
3
3
|
|
|
4
4
|
declare const LabeledFormField: ({ inputId, label, description, feedback, children, optional, }: FormFieldProps) => react_jsx_runtime.JSX.Element;
|
|
5
5
|
declare const TitledFormField: ({ label, description, feedback, children, optional, }: FormFieldProps) => react_jsx_runtime.JSX.Element;
|
package/cjs/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export { CheckBox, CheckBoxGroup, CheckBoxItem } from './CheckBox.js';
|
|
|
5
5
|
export { RadioButtonGroup, RadioButtonItem } from './RadioButton.js';
|
|
6
6
|
export { ErrorSummary } from './Error-summary.js';
|
|
7
7
|
export { PasswordInput } from './PasswordInput.js';
|
|
8
|
+
export { SelectInput } from './SelectInput.js';
|
|
8
9
|
export { TextInput } from './TextInput.js';
|
|
9
10
|
import 'react/jsx-runtime';
|
|
10
|
-
import './index-
|
|
11
|
+
import './index-1UM0FDHf.js';
|
package/cjs/index.js
CHANGED
|
@@ -5,4 +5,5 @@ var _CheckBox = require('./CheckBox'); _createStarExport(_CheckBox);
|
|
|
5
5
|
var _RadioButton = require('./RadioButton'); _createStarExport(_RadioButton);
|
|
6
6
|
var _Errorsummary = require('./Error-summary'); _createStarExport(_Errorsummary);
|
|
7
7
|
var _PasswordInput = require('./PasswordInput'); _createStarExport(_PasswordInput);
|
|
8
|
+
var _SelectInput = require('./SelectInput'); _createStarExport(_SelectInput);
|
|
8
9
|
var _TextInput = require('./TextInput'); _createStarExport(_TextInput);
|
package/css/main.css
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
display: flex;
|
|
12
12
|
flex-direction: column;
|
|
13
13
|
font-family: var(--o3-font-family-metric);
|
|
14
|
-
gap: var(--o3-spacing-
|
|
14
|
+
gap: var(--o3-spacing-3xs);
|
|
15
15
|
}
|
|
16
16
|
.o3-form-field:where(fieldset) {
|
|
17
17
|
margin: 0;
|
|
@@ -397,7 +397,6 @@ input[class*=o3-form-text-input][type=text]:disabled {
|
|
|
397
397
|
position: relative;
|
|
398
398
|
--o3-grid-columns-to-span-count: 4;
|
|
399
399
|
max-width: var(--o3-grid-columns-to-span-width, 100%);
|
|
400
|
-
margin-top: var(--o3-spacing-3xs);
|
|
401
400
|
}
|
|
402
401
|
.o3-password-input__container input {
|
|
403
402
|
width: 100%;
|
|
@@ -454,6 +453,14 @@ input[class*=o3-form-text-input][type=text]:disabled {
|
|
|
454
453
|
-webkit-appearance: none;
|
|
455
454
|
appearance: none;
|
|
456
455
|
}
|
|
456
|
+
.o3-form-select-input__container.o3-form-select-input--short-1 {
|
|
457
|
+
--_o3-form-select-input-max-width: calc(1.8em + 48px);
|
|
458
|
+
max-width: var(--_o3-form-select-input-max-width);
|
|
459
|
+
}
|
|
460
|
+
.o3-form-select-input__container.o3-form-select-input--short-3 {
|
|
461
|
+
--_o3-form-select-input-max-width: calc(2.5em + 48px);
|
|
462
|
+
max-width: var(--_o3-form-select-input-max-width);
|
|
463
|
+
}
|
|
457
464
|
.o3-form-select-input__container {
|
|
458
465
|
position: relative;
|
|
459
466
|
display: inline-block;
|
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-1UM0FDHf.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/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-1UM0FDHf.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,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { P as PasswordInputProps } from './index-
|
|
2
|
+
import { P as PasswordInputProps } from './index-1UM0FDHf.js';
|
|
3
3
|
|
|
4
4
|
declare const PasswordInput: ({ label, feedback, description, disabled, attributes, inputId, optional, forgotPasswordLink, }: PasswordInputProps) => react_jsx_runtime.JSX.Element;
|
|
5
5
|
|
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-1UM0FDHf.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/SelectInput.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { S as SelectInputProps } from './index-
|
|
2
|
+
import { S as SelectInputProps } from './index-1UM0FDHf.js';
|
|
3
3
|
|
|
4
|
-
declare const SelectInput: ({ label, feedback, description, disabled, attributes, inputId, optional, children, }: SelectInputProps) => react_jsx_runtime.JSX.Element;
|
|
4
|
+
declare const SelectInput: ({ label, feedback, description, disabled, attributes, inputId, optional, children, length, }: SelectInputProps) => react_jsx_runtime.JSX.Element;
|
|
5
5
|
|
|
6
6
|
export { SelectInput };
|
package/esm/SelectInput.js
CHANGED
|
@@ -10,7 +10,8 @@ const SelectInput = ({
|
|
|
10
10
|
attributes,
|
|
11
11
|
inputId,
|
|
12
12
|
optional,
|
|
13
|
-
children
|
|
13
|
+
children,
|
|
14
|
+
length
|
|
14
15
|
}) => {
|
|
15
16
|
const id = inputId || uniqueId("_");
|
|
16
17
|
const inputClasses = ["o3-form", "o3-form-select-input"];
|
|
@@ -25,18 +26,24 @@ const SelectInput = ({
|
|
|
25
26
|
description,
|
|
26
27
|
inputId: id,
|
|
27
28
|
optional,
|
|
28
|
-
children: /* @__PURE__ */ jsx(
|
|
29
|
-
"
|
|
29
|
+
children: /* @__PURE__ */ jsx(
|
|
30
|
+
"div",
|
|
30
31
|
{
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
className: `o3-form-select-input__container ${length ? `o3-form-select-input--short-${length}` : ""}`,
|
|
33
|
+
children: /* @__PURE__ */ jsx(
|
|
34
|
+
"select",
|
|
35
|
+
{
|
|
36
|
+
...attributes,
|
|
37
|
+
id,
|
|
38
|
+
disabled,
|
|
39
|
+
className: inputClasses.join(" "),
|
|
40
|
+
required: !optional,
|
|
41
|
+
"aria-required": !optional,
|
|
42
|
+
children
|
|
43
|
+
}
|
|
44
|
+
)
|
|
38
45
|
}
|
|
39
|
-
)
|
|
46
|
+
)
|
|
40
47
|
}
|
|
41
48
|
);
|
|
42
49
|
};
|
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-1UM0FDHf.js';
|
|
3
3
|
|
|
4
4
|
declare const TextInput: ({ label, feedback, description, disabled, length, attributes, inputId, optional, }: TextInputProps) => react_jsx_runtime.JSX.Element;
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { a as FeedbackProps } from '../index-
|
|
2
|
+
import { a as FeedbackProps } from '../index-1UM0FDHf.mjs';
|
|
3
3
|
|
|
4
4
|
declare const Feedback: ({ message, type }: FeedbackProps) => react_jsx_runtime.JSX.Element;
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { b as FormFieldProps, F as FormFieldsetProps } from '../index-
|
|
2
|
+
import { b as FormFieldProps, F as FormFieldsetProps } from '../index-1UM0FDHf.mjs';
|
|
3
3
|
|
|
4
4
|
declare const LabeledFormField: ({ inputId, label, description, feedback, children, optional, }: FormFieldProps) => react_jsx_runtime.JSX.Element;
|
|
5
5
|
declare const TitledFormField: ({ label, description, feedback, children, optional, }: FormFieldProps) => react_jsx_runtime.JSX.Element;
|
package/esm/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export { CheckBox, CheckBoxGroup, CheckBoxItem } from './CheckBox.js';
|
|
|
5
5
|
export { RadioButtonGroup, RadioButtonItem } from './RadioButton.js';
|
|
6
6
|
export { ErrorSummary } from './Error-summary.js';
|
|
7
7
|
export { PasswordInput } from './PasswordInput.js';
|
|
8
|
+
export { SelectInput } from './SelectInput.js';
|
|
8
9
|
export { TextInput } from './TextInput.js';
|
|
9
10
|
import 'react/jsx-runtime';
|
|
10
|
-
import './index-
|
|
11
|
+
import './index-1UM0FDHf.js';
|
package/esm/index.js
CHANGED