@financial-times/o3-form 0.5.4 → 0.6.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 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-B6g8Gfrb.js';
2
+ import { C as CheckBoxProps, F as FormFieldsetProps } from './index-CufC9u5W.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
@@ -4,7 +4,7 @@ var _outils = require('@financial-times/o-utils');
4
4
  var _FormField = require('./fieldComponents/FormField');
5
5
  const uniqueId = _outils.uidBuilder.call(void 0, "o3-form-checkbox-input");
6
6
  const CheckBoxItem = (props) => {
7
- let { inputId, attributes, optional, error } = props;
7
+ let { inputId, checkboxDescription, attributes, optional, error } = props;
8
8
  if (!inputId) {
9
9
  inputId = uniqueId("_");
10
10
  }
@@ -24,7 +24,10 @@ const CheckBoxItem = (props) => {
24
24
  "aria-required": !optional
25
25
  }
26
26
  ),
27
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "label", { htmlFor: inputId, className: "o3-form-input-checkbox__label", children: props.checkboxLabel })
27
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "label", { htmlFor: inputId, className: "o3-form-input-checkbox__label", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { children: [
28
+ props.checkboxLabel,
29
+ checkboxDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "o3-form-input-checkbox__description", children: checkboxDescription })
30
+ ] }) })
28
31
  ] });
29
32
  };
30
33
  const CheckBox = (props) => {
@@ -33,7 +36,13 @@ const CheckBox = (props) => {
33
36
  labelId: props.inputId,
34
37
  descriptionId: props.inputId
35
38
  };
36
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _FormField.TitledFormField, { ...newProps, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CheckBoxItem, { ...newProps, children: " " }) });
39
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _FormField.TitledFormField, { ...newProps, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
40
+ CheckBoxItem,
41
+ {
42
+ ...newProps,
43
+ checkboxDescription: props.checkboxDescription
44
+ }
45
+ ) });
37
46
  };
38
47
  const CheckBoxGroup = (props) => {
39
48
  const { children, ...restProps } = props;
@@ -1,5 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { E as ErrorSummaryProps } from './index-B6g8Gfrb.js';
2
+ import { E as ErrorSummaryProps } from './index-CufC9u5W.js';
3
3
 
4
4
  declare const ErrorSummary: ({ errors, errorMessage, }: ErrorSummaryProps) => react_jsx_runtime.JSX.Element;
5
5
 
@@ -1,5 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { P as PasswordInputProps } from './index-B6g8Gfrb.js';
2
+ import { P as PasswordInputProps } from './index-CufC9u5W.js';
3
3
 
4
4
  declare const PasswordInput: ({ label, feedback, description, disabled, attributes, inputId, optional, }: PasswordInputProps) => react_jsx_runtime.JSX.Element;
5
5
 
@@ -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-B6g8Gfrb.js';
2
+ import { R as RadioButtonProps, F as FormFieldsetProps } from './index-CufC9u5W.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;
@@ -1,5 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { T as TextInputProps } from './index-B6g8Gfrb.js';
2
+ import { T as TextInputProps } from './index-CufC9u5W.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-B6g8Gfrb.js';
2
+ import { a as FeedbackProps } from '../index-CufC9u5W.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-B6g8Gfrb.js';
2
+ import { b as FormFieldProps, F as FormFieldsetProps } from '../index-CufC9u5W.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;
@@ -19,6 +19,7 @@ interface CheckBoxProps extends BaseInputProps {
19
19
  inputId: string;
20
20
  checkboxLabel: string;
21
21
  feedback?: FeedbackProps;
22
+ checkboxDescription?: string;
22
23
  }
23
24
  interface RadioButtonProps extends BaseInputProps {
24
25
  inputId: string;
package/cjs/index.d.ts CHANGED
@@ -7,4 +7,4 @@ export { ErrorSummary } from './Error-summary.js';
7
7
  export { PasswordInput } from './PasswordInput.js';
8
8
  export { TextInput } from './TextInput.js';
9
9
  import 'react/jsx-runtime';
10
- import './index-B6g8Gfrb.js';
10
+ import './index-CufC9u5W.js';
package/css/main.css CHANGED
@@ -168,6 +168,9 @@ input[class*=o3-form-text-input][type=text]:disabled {
168
168
  .o3-form-input-checkbox__input:disabled + label {
169
169
  color: var(--_o3-form-color-use-case-border-disabled);
170
170
  }
171
+ .o3-form-input-checkbox__input:disabled + label .o3-form-input-checkbox__description {
172
+ color: var(--_o3-form-color-use-case-border-disabled);
173
+ }
171
174
  .o3-form-input-checkbox__input:checked:disabled + label::before {
172
175
  background-color: var(--_o3-form-color-use-case-selected-disabled);
173
176
  border-color: var(--_o3-form-color-use-case-selected-disabled);
@@ -231,13 +234,22 @@ input[class*=o3-form-text-input][type=text]:disabled {
231
234
  }
232
235
  .o3-form-input-checkbox__label {
233
236
  display: flex;
234
- align-items: center;
237
+ align-items: flex-start;
235
238
  font-family: var(--o3-type-body-base-font-family);
236
239
  font-size: var(--o3-type-body-base-font-size);
237
240
  font-weight: var(--o3-type-body-base-font-weight);
238
241
  line-height: var(--o3-type-body-base-line-height);
239
242
  color: var(--o3-color-use-case-body-text);
240
243
  }
244
+ .o3-form-input-checkbox__description {
245
+ display: block;
246
+ font-family: var(--o3-type-detail-font-family);
247
+ font-size: var(--o3-type-detail-font-size);
248
+ font-weight: var(--o3-type-detail-font-weight);
249
+ line-height: var(--o3-type-detail-line-height);
250
+ color: var(--o3-color-use-case-body-text);
251
+ margin-top: var(--o3-spacing-4xs);
252
+ }
241
253
 
242
254
  /* src/css/components/radio-button.css */
243
255
  .o3-form-input-radio-button + label::before {
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-B6g8Gfrb.js';
2
+ import { C as CheckBoxProps, F as FormFieldsetProps } from './index-CufC9u5W.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
@@ -4,7 +4,7 @@ import { uidBuilder } from "@financial-times/o-utils";
4
4
  import { TitledFormField, FormFieldset } from "./fieldComponents/FormField";
5
5
  const uniqueId = uidBuilder("o3-form-checkbox-input");
6
6
  const CheckBoxItem = (props) => {
7
- let { inputId, attributes, optional, error } = props;
7
+ let { inputId, checkboxDescription, attributes, optional, error } = props;
8
8
  if (!inputId) {
9
9
  inputId = uniqueId("_");
10
10
  }
@@ -24,7 +24,10 @@ const CheckBoxItem = (props) => {
24
24
  "aria-required": !optional
25
25
  }
26
26
  ),
27
- /* @__PURE__ */ jsx("label", { htmlFor: inputId, className: "o3-form-input-checkbox__label", children: props.checkboxLabel })
27
+ /* @__PURE__ */ jsx("label", { htmlFor: inputId, className: "o3-form-input-checkbox__label", children: /* @__PURE__ */ jsxs("span", { children: [
28
+ props.checkboxLabel,
29
+ checkboxDescription && /* @__PURE__ */ jsx("span", { className: "o3-form-input-checkbox__description", children: checkboxDescription })
30
+ ] }) })
28
31
  ] });
29
32
  };
30
33
  const CheckBox = (props) => {
@@ -33,7 +36,13 @@ const CheckBox = (props) => {
33
36
  labelId: props.inputId,
34
37
  descriptionId: props.inputId
35
38
  };
36
- return /* @__PURE__ */ jsx(TitledFormField, { ...newProps, children: /* @__PURE__ */ jsx(CheckBoxItem, { ...newProps, children: " " }) });
39
+ return /* @__PURE__ */ jsx(TitledFormField, { ...newProps, children: /* @__PURE__ */ jsx(
40
+ CheckBoxItem,
41
+ {
42
+ ...newProps,
43
+ checkboxDescription: props.checkboxDescription
44
+ }
45
+ ) });
37
46
  };
38
47
  const CheckBoxGroup = (props) => {
39
48
  const { children, ...restProps } = props;
@@ -1,5 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { E as ErrorSummaryProps } from './index-B6g8Gfrb.js';
2
+ import { E as ErrorSummaryProps } from './index-CufC9u5W.js';
3
3
 
4
4
  declare const ErrorSummary: ({ errors, errorMessage, }: ErrorSummaryProps) => react_jsx_runtime.JSX.Element;
5
5
 
@@ -1,5 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { P as PasswordInputProps } from './index-B6g8Gfrb.js';
2
+ import { P as PasswordInputProps } from './index-CufC9u5W.js';
3
3
 
4
4
  declare const PasswordInput: ({ label, feedback, description, disabled, attributes, inputId, optional, }: PasswordInputProps) => react_jsx_runtime.JSX.Element;
5
5
 
@@ -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-B6g8Gfrb.js';
2
+ import { R as RadioButtonProps, F as FormFieldsetProps } from './index-CufC9u5W.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;
@@ -1,5 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { T as TextInputProps } from './index-B6g8Gfrb.js';
2
+ import { T as TextInputProps } from './index-CufC9u5W.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-B6g8Gfrb.mjs';
2
+ import { a as FeedbackProps } from '../index-CufC9u5W.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-B6g8Gfrb.mjs';
2
+ import { b as FormFieldProps, F as FormFieldsetProps } from '../index-CufC9u5W.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;
@@ -19,6 +19,7 @@ interface CheckBoxProps extends BaseInputProps {
19
19
  inputId: string;
20
20
  checkboxLabel: string;
21
21
  feedback?: FeedbackProps;
22
+ checkboxDescription?: string;
22
23
  }
23
24
  interface RadioButtonProps extends BaseInputProps {
24
25
  inputId: string;
package/esm/index.d.ts CHANGED
@@ -7,4 +7,4 @@ export { ErrorSummary } from './Error-summary.js';
7
7
  export { PasswordInput } from './PasswordInput.js';
8
8
  export { TextInput } from './TextInput.js';
9
9
  import 'react/jsx-runtime';
10
- import './index-B6g8Gfrb.js';
10
+ import './index-CufC9u5W.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@financial-times/o3-form",
3
- "version": "0.5.4",
3
+ "version": "0.6.0",
4
4
  "description": "Provides a viewport-aware tooltip for annotating or or highlighting other aspects of a product's UI",
5
5
  "keywords": [
6
6
  "form",