@financial-times/o3-form 0.1.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 +1 -0
- package/cjs/index.d.ts +43 -0
- package/cjs/index.js +3 -0
- package/css/main.css +38 -0
- package/css/whitelabel.css +4 -0
- package/esm/index.d.ts +43 -0
- package/esm/index.js +3 -0
- package/origami.json +16 -0
- package/package.json +45 -0
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# o3-form[](#licence)
|
package/cjs/index.d.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
type BaseInputProps = {
|
|
4
|
+
inputId?: string;
|
|
5
|
+
label?: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
optional?: boolean;
|
|
8
|
+
error?: string;
|
|
9
|
+
attributes?: JSX.IntrinsicElements['input'];
|
|
10
|
+
};
|
|
11
|
+
interface FormFieldProps extends BaseInputProps {
|
|
12
|
+
feedback?: FeedBackProps;
|
|
13
|
+
children: JSX.Element & JSX.IntrinsicElements['input'];
|
|
14
|
+
}
|
|
15
|
+
interface FormFieldsetProps {
|
|
16
|
+
label: string;
|
|
17
|
+
description?: string;
|
|
18
|
+
error?: string;
|
|
19
|
+
children: JSX.Element | JSX.Element[];
|
|
20
|
+
feedback?: FeedBackProps;
|
|
21
|
+
}
|
|
22
|
+
interface FormFieldsetProps {
|
|
23
|
+
label: string;
|
|
24
|
+
description?: string;
|
|
25
|
+
error?: string;
|
|
26
|
+
children: JSX.Element | JSX.Element[];
|
|
27
|
+
}
|
|
28
|
+
type FeedBackProps = {
|
|
29
|
+
message: string;
|
|
30
|
+
type: 'error';
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
declare const Feedback: ({ message, type }: FeedBackProps) => react_jsx_runtime.JSX.Element;
|
|
34
|
+
|
|
35
|
+
declare const LabeledFormField: ({ inputId, label, description, feedback, children, optional, }: FormFieldProps) => react_jsx_runtime.JSX.Element;
|
|
36
|
+
declare const TitledFormField: ({ label, description, feedback, children, optional, }: FormFieldProps) => react_jsx_runtime.JSX.Element;
|
|
37
|
+
declare const FormFieldset: ({ label, description, feedback, children, }: FormFieldsetProps) => react_jsx_runtime.JSX.Element;
|
|
38
|
+
|
|
39
|
+
declare const Form: ({ children }: {
|
|
40
|
+
children: JSX.Element | JSX.Element[];
|
|
41
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
42
|
+
|
|
43
|
+
export { Feedback, Form, FormFieldset, LabeledFormField, TitledFormField };
|
package/cjs/index.js
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _createStarExport(obj) { Object.keys(obj) .filter((key) => key !== "default" && key !== "__esModule") .forEach((key) => { if (exports.hasOwnProperty(key)) { return; } Object.defineProperty(exports, key, {enumerable: true, configurable: true, get: () => obj[key]}); }); }var _Feedback = require('./fieldComponents/Feedback'); _createStarExport(_Feedback);
|
|
2
|
+
var _FormField = require('./fieldComponents/FormField'); _createStarExport(_FormField);
|
|
3
|
+
var _Form = require('./fieldComponents/Form'); _createStarExport(_Form);
|
package/css/main.css
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/* src/css/components/form.css */
|
|
2
|
+
.o3-form {
|
|
3
|
+
font-family: var(--o3-font-family-metric);
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
/* src/css/components/form-field.css */
|
|
7
|
+
.o3-form-field {
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
gap: var(--o3-spacing-3xs);
|
|
11
|
+
}
|
|
12
|
+
.o3-form-field__feedback--error {
|
|
13
|
+
color: var(--o3-color-use-case-error);
|
|
14
|
+
font-size: var(--o3-font-size-metric2-0);
|
|
15
|
+
}
|
|
16
|
+
.o3-form-field__title {
|
|
17
|
+
font-size: var(--o3-font-size-metric2-0);
|
|
18
|
+
font-weight: 500;
|
|
19
|
+
}
|
|
20
|
+
fieldset.o3-form-field {
|
|
21
|
+
margin: 0;
|
|
22
|
+
padding: 0;
|
|
23
|
+
border: 0;
|
|
24
|
+
}
|
|
25
|
+
fieldset.o3-form-field legend {
|
|
26
|
+
margin: 0;
|
|
27
|
+
padding: 0;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/* src/css/components/feedback.css */
|
|
31
|
+
[class^=o3-form-feedback__] {
|
|
32
|
+
margin-top: var(--o3-spacing-3xs);
|
|
33
|
+
}
|
|
34
|
+
.o3-form-feedback__error {
|
|
35
|
+
color: var(--o3-color-palette-crimson);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/* main.css */
|
package/esm/index.d.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
type BaseInputProps = {
|
|
4
|
+
inputId?: string;
|
|
5
|
+
label?: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
optional?: boolean;
|
|
8
|
+
error?: string;
|
|
9
|
+
attributes?: JSX.IntrinsicElements['input'];
|
|
10
|
+
};
|
|
11
|
+
interface FormFieldProps extends BaseInputProps {
|
|
12
|
+
feedback?: FeedBackProps;
|
|
13
|
+
children: JSX.Element & JSX.IntrinsicElements['input'];
|
|
14
|
+
}
|
|
15
|
+
interface FormFieldsetProps {
|
|
16
|
+
label: string;
|
|
17
|
+
description?: string;
|
|
18
|
+
error?: string;
|
|
19
|
+
children: JSX.Element | JSX.Element[];
|
|
20
|
+
feedback?: FeedBackProps;
|
|
21
|
+
}
|
|
22
|
+
interface FormFieldsetProps {
|
|
23
|
+
label: string;
|
|
24
|
+
description?: string;
|
|
25
|
+
error?: string;
|
|
26
|
+
children: JSX.Element | JSX.Element[];
|
|
27
|
+
}
|
|
28
|
+
type FeedBackProps = {
|
|
29
|
+
message: string;
|
|
30
|
+
type: 'error';
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
declare const Feedback: ({ message, type }: FeedBackProps) => react_jsx_runtime.JSX.Element;
|
|
34
|
+
|
|
35
|
+
declare const LabeledFormField: ({ inputId, label, description, feedback, children, optional, }: FormFieldProps) => react_jsx_runtime.JSX.Element;
|
|
36
|
+
declare const TitledFormField: ({ label, description, feedback, children, optional, }: FormFieldProps) => react_jsx_runtime.JSX.Element;
|
|
37
|
+
declare const FormFieldset: ({ label, description, feedback, children, }: FormFieldsetProps) => react_jsx_runtime.JSX.Element;
|
|
38
|
+
|
|
39
|
+
declare const Form: ({ children }: {
|
|
40
|
+
children: JSX.Element | JSX.Element[];
|
|
41
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
42
|
+
|
|
43
|
+
export { Feedback, Form, FormFieldset, LabeledFormField, TitledFormField };
|
package/esm/index.js
ADDED
package/origami.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"origamiType": "component",
|
|
3
|
+
"origamiVersion": "3.0",
|
|
4
|
+
"support": "https://github.com/Financial-Times/origami/issues/new?labels=o3-form,components",
|
|
5
|
+
"supportContact": {
|
|
6
|
+
"email": "origami.support@ft.com",
|
|
7
|
+
"slack": "financialtimes/origami-support"
|
|
8
|
+
},
|
|
9
|
+
"brands": [
|
|
10
|
+
"core",
|
|
11
|
+
"internal",
|
|
12
|
+
"whitelabel"
|
|
13
|
+
],
|
|
14
|
+
"supportStatus": "experimental",
|
|
15
|
+
"browserFeatures": {}
|
|
16
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@financial-times/o3-form",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Provides a viewport-aware tooltip for annotating or or highlighting other aspects of a product's UI",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"form",
|
|
7
|
+
"input",
|
|
8
|
+
"field",
|
|
9
|
+
"fieldset",
|
|
10
|
+
"submit",
|
|
11
|
+
"file",
|
|
12
|
+
"upload"
|
|
13
|
+
],
|
|
14
|
+
"homepage": "https://registry.origami.ft.com/components/o3-form",
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/Financial-Times/origami/issues/new?labels=o3-form,components",
|
|
17
|
+
"email": "origami.support@ft.com"
|
|
18
|
+
},
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"browser": "./index.js",
|
|
21
|
+
"main": "./cjs/index.js",
|
|
22
|
+
"module": "./esm/index.js",
|
|
23
|
+
"files": [
|
|
24
|
+
"cjs",
|
|
25
|
+
"esm",
|
|
26
|
+
"index.js",
|
|
27
|
+
"index.d.ts",
|
|
28
|
+
"css",
|
|
29
|
+
"origami.json",
|
|
30
|
+
"package.json",
|
|
31
|
+
"README.md"
|
|
32
|
+
],
|
|
33
|
+
"scripts": {
|
|
34
|
+
"build": "bash ../../scripts/component/build-o3.bash o3-form"
|
|
35
|
+
},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"@financial-times/o-utils": "^2.2.1",
|
|
38
|
+
"@financial-times/o3-figma-sb-links": "^0.0.0",
|
|
39
|
+
"@financial-times/o3-foundation": "^1.2.0"
|
|
40
|
+
},
|
|
41
|
+
"engines": {
|
|
42
|
+
"npm": ">7"
|
|
43
|
+
},
|
|
44
|
+
"private": false
|
|
45
|
+
}
|